code wiki / _hdl_build / nx_iolayer_ws_register.nx

nx_iolayer_ws_register.nx source

↩ module page · 63 lines · 3436 B

1// nx_iolayer_ws_register.nx -- register this arc's workstreams into the WMS registry SSOT 2// (knowledge/store/ws-), so the resume manifest + other empires + AGENTS see them (the operator's 3// "get it to workstreams and agents"). Additive+idempotent (rule #10): reads the live ws:ids index, 4// appends our ids iff absent, commits our ws:<id> records, verifies by READBACK. Mirrors 5// nx_hub_ws_register (the canonical writer template). Streams: 6// IO-LAYER-SOTA (E-PLATFORM): sovereign agent IO surface -- nx_fs read/ls + nx_fs_write write/edit, 7// MCP-live + cap-partitioned + graded EXCEED. last_touched=0 per the template convention. 8// BENCH-COVERAGE (E-DOCTRINE): the standing external-oracle grading discipline (12/52, registry+laps). 9// license_tier: ORIGINAL 10import "nx_workstream_store.nx" 11import "nx_seg_store.nx" 12import "nx_syscalls.nx" 13 14const IW_IDSBUF: i64 = 262144 // ws:ids working copy (matches the template's sizing) 15const IW_STREAMS: i64 = 2 // streams registered by this organ 16const IW_ASCII_0: i64 = 48 // '0' (single-digit verified-count print) 17 18func iw_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 19func iw_len(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } 20 21// append "\t<id>" to idsbuf at olenp[0] iff id is not already a TAB-member (de-duped index) 22func iw_addid(idsbuf: *u8, olenp: *i64, id: *u8) -> i64 { 23 if ws_member(idsbuf, olenp[0], id) == 1 { return 0 } 24 var o: i64 = olenp[0] 25 if o > 0 { idsbuf[o] = 9 as u8; o = o + 1 } 26 var i: i64 = 0 27 while id[i] != (0 as u8) { idsbuf[o] = id[i]; o = o + 1; i = i + 1 } 28 olenp[0] = o 29 return 1 30} 31func iw_rec(w: *i64, key: *u8, val: *u8) -> i64 { return ss_add(w, 1, key, val, iw_len(val)) } 32 33func main() -> i64 { 34 let w: *i64 = ss_begin() 35 let pq: *i64 = sys_mmap(16) as *i64 36 let lq: *i64 = sys_mmap(16) as *i64 37 let idsbuf: *u8 = sys_mmap(IW_IDSBUF) 38 let olenp: *i64 = sys_mmap(8) as *i64 39 olenp[0] = 0 40 if ws_get("ws:ids\x00" as *u8, pq, lq) == 1 { 41 let src: *u8 = pq[0] as *u8 42 let n: i64 = lq[0] 43 var i: i64 = 0 44 while i < n { idsbuf[i] = src[i]; i = i + 1 } 45 olenp[0] = n 46 } 47 iw_addid(idsbuf, olenp, "IO-LAYER-SOTA\x00" as *u8) 48 iw_addid(idsbuf, olenp, "BENCH-COVERAGE\x00" as *u8) 49 ss_add(w, 1, "ws:ids\x00" as *u8, idsbuf, olenp[0]) 50 iw_rec(w, "ws:IO-LAYER-SOTA\x00" as *u8, "IO-LAYER-SOTA\tE-PLATFORM\tACTIVE\t0\tproject-nishi-sovereign-io-layer-2026-07-16.md\truntime/nx_fsops_write.nx\t-\x00" as *u8) 51 iw_rec(w, "ws:BENCH-COVERAGE\x00" as *u8, "BENCH-COVERAGE\tE-DOCTRINE\tACTIVE\t0\tproject-nishi-magicnum-prevention-live-2026-07-15.md\tbench/nx_fswrite_vs_sota.sh\t-\x00" as *u8) 52 let segid: i64 = ws_seg_next(WS_PREFIX) 53 let rc: i64 = ss_commit(WS_PREFIX, w, segid) 54 if rc != 0 { iw_w("nx_iolayer_ws_register: COMMIT FAILED\n\x00" as *u8); return 1 } 55 var ver: i64 = 0 56 if ws_get("ws:IO-LAYER-SOTA\x00" as *u8, pq, lq) == 1 { ver = ver + 1 } 57 if ws_get("ws:BENCH-COVERAGE\x00" as *u8, pq, lq) == 1 { ver = ver + 1 } 58 iw_w("nx_iolayer_ws_register: registered IO-LAYER-SOTA (E-PLATFORM) + BENCH-COVERAGE (E-DOCTRINE); verified=\x00" as *u8) 59 let bb: *u8 = sys_mmap(8); bb[0] = (IW_ASCII_0 + ver) as u8; sys_write(1, bb, 1) 60 iw_w("/2 readback; ws:ids updated.\n\x00" as *u8) 61 if ver == IW_STREAMS { return 0 } 62 return 1 63}