code wiki / (root) / nx_writehub_seat.nx

nx_writehub_seat.nx

buildroot/runtime/nx_writehub_seat.nx

7564 B128 linesdepth 6pulls 9 transitivereach 0 importersview sourcekind tooltopic writehub
docsdependenciesstructsconstsfunctions

about

nx_writehub_seat.nx -- WRITING HUB rung R1: the sovereign SEAT WIRE. Closes the #1 census gap (nothing in .nx POSTed to the local generation seats). Drives the operator's LOCAL models over sovereign HTTP -- no cloud, no curl, no shell: gen-llm:11434 /chat (prose seat, sd-server/Qwen) or gen-img:7861 /generate (image seat, Z-Image). Composes nx_http_client's sockaddr + POST-request builder (same primitive as nx_http_post) but application/json. File-driven so there is zero arg-quoting: read knowledge/staging/writehub_seat_req.txt (line1 = llm|img target, the rest = the writer artifact/prompt) -> POST -> bank the seat's reply to knowledge/staging/writehub_seat_out.txt. SEAM BY CONSTRUCTION: this organ only ever connects to 127.0.0.1, so explicit content never leaves the box. license_tier: ORIGINAL module: nishi-core.writehub.seat capability: WRITEHUB_SEAT_WIRE

dependencies 3 imports · 0 importers

nx_http_client.nx nx_connect.nx nx_gate.nx nx_writehub_seat.nx

imports: nx_http_client.nxnx_connect.nxnx_gate.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gw sys_write sys_read ws_starts ws_appc ws_appq ws_appc ↻ ws_app ws_app_esc ws_appc ↻ ws_app ↻ nx_http_client_sockaddr_ip sys_socket nx_connect_bounded nx_fcntl sys_connect sys_mmap sys_poll gn sys_write ↻ sys_mmap ↻ nx_http_client_build_reque nx_dec_emit_u63 ws_strlen ws_drain sys_read ↻ ws_atoi3 sys_openat_wr

structs

none

consts

12const K_MAGIC_1048576: i64 = 1048576
13const K_MAGIC_1310720: i64 = 1310720
14const K_MAGIC_11434: i64 = 11434
15const K_MAGIC_7861: i64 = 7861
16const K_MAGIC_8388608: i64 = 8388608

functions

18func ws_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: main
19func ws_atoi3(buf: *u8, off: i64) -> i64 { var v: i64=0; var i: i64=0; while i<3 { let d: i64=buf[off+i] as i64; if d>=48 { if d<=57 { v=v*10+(d-48) } } i=i+1 } return v }
called by 1: main
20func ws_drain(fd: i64, buf: *u8, cap: i64) -> i64 { var off: i64=0; var go: i64=1; while go==1 { if off>=cap { go=0 } else { let r: i64=sys_read(fd, ((buf as i64)+off) as *u8, cap-off); if r<=0 { go=0 } else { off=off+r } } } return off }
called by 1: main calls 1: sys_read
23func ws_app(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; var i: i64=0; while s[i]!=(0 as u8){ dst[o]=s[i]; o=o+1; i=i+1 } return o }
called by 2: ws_appqmain
25func ws_appc(dst: *u8, off: i64, ch: i64) -> i64 { dst[off]=ch as u8; return off+1 }
27func ws_appq(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; o=ws_appc(dst,o,34); o=ws_app(dst,o,s); o=ws_appc(dst,o,34); return o }
called by 1: main calls 2: ws_appcws_app
29func ws_app_esc(dst: *u8, off: i64, src: *u8, len: i64) -> i64
called by 1: main calls 1: ws_appc
44func ws_starts(buf: *u8, n: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ if i>=n {return 0} if buf[i]!=s[i] {return 0} i=i+1 } return 1 }
called by 1: main
46func main() -> i64