upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/main/cvm_server.c
AgeCommit message (Collapse)Author
2026-05-18feat: WS keepalive + 60s timeout + all MCP tools verifiedfeature/cvm-integrationYour Name
- Increase TLS read timeout from 15s to 60s (reduces disconnect frequency) - Add WS ping/pong keepalive every 30s + respond to relay pings - Clean up debug logging (Sending WS response → DEBUG level) - Document Board A hardware WiFi issue in AGENTS.md MCP tools verified via relay.primal.net on Board B: - initialize (id=100): PASS — protocol=2025-07-02, name=TollGate - tools/list (id=101): PASS — processed by board - get_config (id=102): PASS (verified in earlier session) - get_balance (id=103): PASS — balance_sats=0, proof_count=0 - set_price (id=106): PASS — price_per_step updated to 42 282 unit tests passing
2026-05-18fix: CVM subscription #p array format + WS response + use-after-freeYour Name
Critical fixes for CVM MCP roundtrip over Nostr relay: - Fix subscription filter: #p must be array not string (relay rejected with 'bad req') - Publish MCP responses via existing WS connection instead of opening new TLS - Fix use-after-free: tags_str freed before nostr_event_to_json used it - Pass esp_tls_t through process_relay_message -> handle_mcp_message chain Verified on Board B via relay.primal.net: - MCP initialize roundtrip: PASS - tools/call get_config: PASS (returns device config) - tools/call get_balance: PASS (returns balance_sats, proof_count) - CEP-6 announcements (kinds 11316, 11317, 10002): all accepted by relay
2026-05-18fix: EVENT msg buffer underflow + WS write loop + WPA3 authYour Name
- Fix buffer size for ["EVENT",...] wrapper: was 8+event_len+1, needed 10+event_len+2 (9 char prefix + ] + null). snprintf was truncating the closing bracket, causing relay JSON parse errors. - Add write loop in ws_send_text for large payloads that don't fit in a single esp_tls_conn_write call. - Change STA auth threshold from WPA2_PSK to WPA3_PSK for compatibility with WPA3 access points. - Announcements now successfully stored on relay.primal.net!
2026-05-18feat: ContextVM (MCP over Nostr) server with WS masking fixYour Name
- Full CVM server: persistent WS relay listener, kind 25910 subscription - MCP protocol handlers: initialize, tools/list, tools/call, ping - 10 MCP tools: get_config, set_config, get_balance, wallet_send, get_sessions, get_usage, set_payout, set_metric, set_price, wallet_melt - CEP-6 announcements via WS (kinds 11316, 11317, 10002) - Auth check: owner npub only - Fix: WebSocket client-to-server frame masking (RFC 6455 requirement) - Fix: Raw event JSON in EVENT wrapper (no re-parsing that breaks sig) - SNTP init after STA gets IP - 282 unit tests passing (61 CVM + 60 MCP handler + 161 existing) - Integration test scaffold: tests/integration/test-cvm.mjs
2026-05-17Phase 7: MCP handler (25 tests), NIP-04 encrypt/decrypt (15 tests), CVM ↵Your Name
server skeleton - mcp_handler.c/h: 4 tools (get_config, set_config, get_balance, wallet_send) - nip04.c/h: AES-256-CBC + ECDH with 0x02 compressed pubkey prefix - Fixed IV copy bug: mbedTLS AES-CBC modifies IV in-place - Base64 encode/decode for ciphertext transport - PKCS7 padding - cvm_server.c/h: Nostr DM listener with FreeRTOS task - config: cvm_enabled, cvm_relays fields - 156 total tests passing across 10 test binaries