code wiki / (root) / nx_conn_catalog.nx

nx_conn_catalog.nx source

↩ module page · 117 lines · 9453 B

1// nx_conn_catalog.nx -- the CONNECTION / TRANSPORT / CRYPTO capability catalogue. 2// 3// Operator 2026-07-17: "our catalogue is shitty for exposing these to you and thats why they need to 4// become standardized apis and microservices and all that catalogued and exposed on a state of the art 5// level." The old nx_capability_catalog tracks 16 hand-typed needs and OMITS the entire networking stack 6// (QUIC, HTTP/2, HTTP/3, TLS, PQ, WebRTC) -- so the richest capabilities are BUILT but INVISIBLE to agents. 7// 8// This catalogue makes the real stack DISCOVERABLE + measures the gap that matters: BUILT-BUT-UNEXPOSED 9// (a capability that exists on disk but has NO standardized MCP/API verb = an agent cannot find or call it). 10// For each capability: BUILT? (organ opens on disk) and EXPOSED? (a standardized MCP/API verb per the 11// exposure policy, knowledge/mcp/coverage_map.txt). The exposure debt is the ranked roadmap: wrap each 12// BUILT-BUT-UNEXPOSED capability as ONE well-typed verb (never blind-wrap primitives -- exposure_policy). 13// Emits a durable, discoverable catalogue (knowledge/conn_catalog.md) + a log line. license_tier: ORIGINAL 14import "nx_gate.nx" 15 16func cc_have(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 } 17func cw(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 } 18func cn(fd: i64, v: i64) -> i64 { 19 if v==0 { sys_write(fd,"0" as *u8,1); return 0 } 20 var m: i64=v; if m<0{sys_write(fd,"-" as *u8,1);m=0-m} 21 let t: *u8=sys_mmap(24); var k: i64=0; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} 22 let o: *u8=sys_mmap(24); var w: i64=0; var q: i64=k-1; while q>=0{o[w]=t[q];w=w+1;q=q-1} 23 sys_write(fd,o,w); return 0 24} 25 26// one capability row. exposed: 1 = a standardized MCP/API verb exists; 0 = BUILT-BUT-UNEXPOSED (the debt). 27// mdfd: the discoverable-catalogue markdown fd. counters: built, exposed, unexposed, tot. 28func cc_cap(cat: *u8, name: *u8, path: *u8, exposed: i64, note: *u8, mdfd: i64, built: *i64, exp: *i64, unexp: *i64, tot: *i64) -> i64 { 29 let b: i64 = cc_have(path) 30 tot[0] = tot[0] + 1 31 if b == 1 { built[0] = built[0] + 1 } 32 // stdout 33 if b == 0 { gw(" [GAP ][ ] " as *u8) } 34 else { 35 if exposed == 1 { gw(" [BUILT][EXPOSED ] " as *u8); exp[0] = exp[0] + 1 } 36 else { gw(" [BUILT][UNEXPOSED] " as *u8); unexp[0] = unexp[0] + 1 } 37 } 38 gw(name); gw(" " as *u8); gw(path); gw(" -> " as *u8); gw(note); gw("\n" as *u8) 39 // discoverable markdown row: | cat | name | organ | built | exposed | note | 40 if mdfd >= 0 { 41 cw(mdfd, "| " as *u8); cw(mdfd, cat); cw(mdfd, " | `" as *u8); cw(mdfd, name); cw(mdfd, "` | `" as *u8); cw(mdfd, path); cw(mdfd, "` | " as *u8) 42 if b == 1 { cw(mdfd, "BUILT" as *u8) } else { cw(mdfd, "gap" as *u8) } 43 cw(mdfd, " | " as *u8) 44 if b == 1 { if exposed == 1 { cw(mdfd, "MCP/API" as *u8) } else { cw(mdfd, "**UNEXPOSED**" as *u8) } } else { cw(mdfd, "-" as *u8) } 45 cw(mdfd, " | " as *u8); cw(mdfd, note); cw(mdfd, " |\n" as *u8) 46 } 47 return b 48} 49 50func main() -> i64 { 51 gw("=== nx_conn_catalog: connection / transport / crypto capability catalogue (BUILT vs EXPOSED) ===\n" as *u8) 52 gw(" operator: capabilities must be CATALOGUED + EXPOSED as standardized APIs. metric that matters = BUILT-BUT-UNEXPOSED.\n\n" as *u8) 53 let built: *i64 = sys_mmap(16) as *i64; built[0]=0 54 let exp: *i64 = sys_mmap(16) as *i64; exp[0]=0 55 let unexp: *i64 = sys_mmap(16) as *i64; unexp[0]=0 56 let tot: *i64 = sys_mmap(16) as *i64; tot[0]=0 57 58 let md: i64 = sys_openat_wr("knowledge/conn_catalog.md" as *u8, 0x1a4) 59 if md >= 0 { 60 cw(md, "# Nishi connection / transport / crypto capability catalogue\n\n" as *u8) 61 cw(md, "Discoverable index of the real networking stack. BUILT = organ on disk; EXPOSED = a standardized MCP/API verb (per exposure_policy). **UNEXPOSED** = the debt: built but no agent can find/call it.\n\n" as *u8) 62 cw(md, "| category | capability | organ | built | exposure | note |\n|---|---|---|---|---|---|\n" as *u8) 63 } 64 65 gw(" -- TRANSPORT (QUIC / RFC 9000) --\n" as *u8) 66 cc_cap("transport" as *u8, "quic-handshake " as *u8, "runtime/nx_quic_hs.nx" as *u8, 0, "RFC 9000 QUIC handshake (over TLS 1.3)" as *u8, md, built, exp, unexp, tot) 67 cc_cap("transport" as *u8, "quic-transport-sm " as *u8, "runtime/nx_quic_handshake_sm.nx" as *u8, 0, "QUIC connection state machine" as *u8, md, built, exp, unexp, tot) 68 cc_cap("transport" as *u8, "quic-aead-keys " as *u8, "runtime/nx_quic_aead.nx" as *u8, 0, "QUIC packet protection (header + payload AEAD)" as *u8, md, built, exp, unexp, tot) 69 cc_cap("transport" as *u8, "quic-loss-recovery " as *u8, "runtime/nx_quic_recovery.nx" as *u8, 0, "RFC 9002 loss detection + congestion control" as *u8, md, built, exp, unexp, tot) 70 cc_cap("transport" as *u8, "quic-fec " as *u8, "runtime/nx_quic_fec.nx" as *u8, 0, "forward error correction -- BEYOND stock browsers" as *u8, md, built, exp, unexp, tot) 71 cc_cap("transport" as *u8, "quic-udp-datagram " as *u8, "runtime/nx_quic_udp.nx" as *u8, 0, "UDP datagram binding" as *u8, md, built, exp, unexp, tot) 72 73 gw("\n -- HTTP --\n" as *u8) 74 cc_cap("http " as *u8, "http1.1-fetch " as *u8, "runtime/nx_tls13_chrome_session.nx" as *u8, 1, "TLS 1.3 fetch client -- EXPOSED via nx_https_get (read cap)" as *u8, md, built, exp, unexp, tot) 75 cc_cap("http " as *u8, "http2-hpack " as *u8, "runtime/nx_hpack.nx" as *u8, 0, "HTTP/2 HPACK header compression -- built, no verb" as *u8, md, built, exp, unexp, tot) 76 cc_cap("http " as *u8, "http3-over-quic " as *u8, "runtime/nx_quic_hs.nx" as *u8, 0, "HTTP/3 rides the QUIC stack -- no fetch verb yet" as *u8, md, built, exp, unexp, tot) 77 cc_cap("http " as *u8, "http-server-edge " as *u8, "runtime/nx_tls13_server.nx" as *u8, 1, "sovereign HTTPS edge (sites.elf) -- LIVE service" as *u8, md, built, exp, unexp, tot) 78 79 gw("\n -- TLS / CRYPTO --\n" as *u8) 80 cc_cap("tls " as *u8, "tls13-client " as *u8, "runtime/nx_tls13_chrome_session.nx" as *u8, 1, "TLS 1.3 client (Chrome-JA3) -- via nx_https_get" as *u8, md, built, exp, unexp, tot) 81 cc_cap("tls " as *u8, "tls13-server " as *u8, "runtime/nx_tls13_server.nx" as *u8, 1, "TLS 1.3 server -- LIVE on the edge" as *u8, md, built, exp, unexp, tot) 82 cc_cap("crypto " as *u8, "aead-chacha20poly " as *u8, "runtime/nx_chacha20_poly1305.nx" as *u8, 0, "ChaCha20-Poly1305 AEAD -- primitive (internal)" as *u8, md, built, exp, unexp, tot) 83 84 gw("\n -- POST-QUANTUM --\n" as *u8) 85 cc_cap("pq " as *u8, "pq-mlkem768 " as *u8, "runtime/nx_ml_kem_768_wasm.nx" as *u8, 0, "ML-KEM-768 FIPS-203 -- KAT-VERIFIED, no verb" as *u8, md, built, exp, unexp, tot) 86 cc_cap("pq " as *u8, "pq-hybrid-x25519mlkem" as *u8,"runtime/nx_x25519mlkem768.nx" as *u8, 0, "X25519MLKEM768 (0x11EC) hybrid KEX -- verified, UNWIRED into fetch (F-sec-04.1)" as *u8, md, built, exp, unexp, tot) 87 88 gw("\n -- REALTIME / VIDEO --\n" as *u8) 89 cc_cap("realtime " as *u8, "webrtc-sfu " as *u8, "runtime/_hdl_build/nx_room_sfu.nx" as *u8, 1, "WebRTC SFU -- LIVE service (nx_vroom_daemon :8446)" as *u8, md, built, exp, unexp, tot) 90 cc_cap("realtime " as *u8, "turn-relay " as *u8, "runtime/nx_turn_relay.nx" as *u8, 0, "TURN relay (NAT traversal) -- no verb" as *u8, md, built, exp, unexp, tot) 91 92 gw("\n -- DNS --\n" as *u8) 93 cc_cap("dns " as *u8, "dns-authoritative " as *u8, "runtime/nx_dns_authoritative.nx" as *u8, 0, "authoritative DNS -- no verb" as *u8, md, built, exp, unexp, tot) 94 95 var unexp_permil: i64 = 0 96 if built[0] > 0 { unexp_permil = (unexp[0] * 1000) / built[0] } 97 gw("\n=== catalogue: BUILT " as *u8); gn(built[0]); gw("/" as *u8); gn(tot[0]) 98 gw(" · EXPOSED " as *u8); gn(exp[0]); gw(" · BUILT-BUT-UNEXPOSED " as *u8); gn(unexp[0]) 99 gw(" (" as *u8); gn(unexp_permil); gw(" permil of built = the EXPOSURE DEBT) ===\n" as *u8) 100 gw("EXPOSURE ROADMAP: wrap each UNEXPOSED capability as ONE standardized MCP/API verb (quic-fetch, http3-get, http2-fetch, pq-fetch,\n" as *u8) 101 gw(" webrtc-room, turn-relay, dns-resolve) per exposure_policy -- never blind-wrap primitives (compose into curated verbs).\n" as *u8) 102 gw("discoverable: knowledge/conn_catalog.md (the catalogue an agent LOOKS UP instead of grepping).\n" as *u8) 103 104 if md >= 0 { 105 cw(md, "\n**Exposure debt:** BUILT " as *u8); cn(md, built[0]); cw(md, ", EXPOSED " as *u8); cn(md, exp[0]); cw(md, ", **BUILT-BUT-UNEXPOSED " as *u8); cn(md, unexp[0]); cw(md, "** = capabilities invisible to agents. Roadmap: one standardized MCP/API verb each.\n" as *u8) 106 sys_close(md) 107 } 108 let lg: i64 = sys_openat_append("knowledge/status/conn_catalog.log" as *u8, 0x1a4) 109 if lg >= 0 { 110 cw(lg, "CONNCAT epoch=" as *u8); cn(lg, sys_now_realtime_sec()) 111 cw(lg, " built=" as *u8); cn(lg, built[0]); cw(lg, " exposed=" as *u8); cn(lg, exp[0]) 112 cw(lg, " unexposed=" as *u8); cn(lg, unexp[0]); cw(lg, " exposure_debt_permil=" as *u8); cn(lg, unexp_permil) 113 cw(lg, " verdict=GREEN\n" as *u8); sys_close(lg) 114 } 115 sys_exit(0) 116 return 0 117}