code wiki / _hdl_build / nx_write.nx
nx_write.nx
buildroot/runtime/_hdl_build/nx_write.nx
about
nx_write.nx -- W-BB-1: THE WRITE LANE'S BACKBONE. The organ that actually WRITES.
u2605u2605u2605u2605u2605u2605THE GAP THIS CLOSES, AND IT IS EMBARRASSING IN THE RIGHT WAY. The write lane had a ruler
(nx_writebench, 625 permil), a panel-reliability bound, a real-person gate, a greeting-structure
grader, a campaign continuity checker and a per-turn dialogue meter -- and NO GENERATOR.
`nx_writer_run` is 9 functions that emit scaffolding and contain no inference call whatsoever: no
engine, no model, no HTTP. Meanwhile the local engine answers /v1/chat/completions in ~1.4s and
has all along; the gen lane has been using it for images and chat for weeks.
u21d2 WE HAD BUILT GRADERS FOR A THING THAT COULD NOT PRODUCE.
u2605u2605u2605u2605u2605u2605A LANE WITH RULERS AND NO PRODUCER MEASURES NOTHING -- COVERAGE ON AN EMPTY LANE IS A
NUMBER ABOUT THE RULER, NOT ABOUT A CAPABILITY.
WHAT THIS IS: prompt -> real prose, on the local engine, for every mode in the registry --
the writing equivalent of what nx_gen is for images.
u2605THE SEAM IS ENFORCED BY CONSTRUCTION, NOT BY POLICY TEXT. write_modes.tsv declares per mode a
REGISTER (sfw|mixed|explicit) and a LANE (tutor|local). An `explicit` mode may only run on the
`local` lane -- it never leaves this machine. That is a routing fact checked here before a single
byte is sent, so it cannot be forgotten by a caller or argued away by a prompt.
u2605ENDPOINT FROM THE SWARM SSOT, never a literal: se_addr("gpu-image") -- the same single source the
gen daemon resolves per request, so a DHCP move heals both lanes at once (the 6-hardcoded-sites
outage is not repeated here).
nx_write <mode> <prompt...> -- generate; prose to stdout
nx_write modes -- list the registry
license_tier: ORIGINAL expect_exit: 0
module: nishi-core.write.backbone
dependencies 6 imports · 0 importers
imports: nx_syscalls.nxnx_estate_path.nxnx_connect.nxnx_swarm_endpoint_lib.nxnx_store_seed_lib.nxnx_lane_conf.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 35 | const W_MAGIC_4096: i64 = 4096 |
| 40 | const W_PLANE: *u8 = "knowledge/store/writemode-" |
| 42 | const W_BUF: i64 = 1048576 |
| 43 | const W_REQ: i64 = 262144 |
| 46 | const W_TMO_SEC: i64 = 300 |
| 47 | const W_MAXTOK: i64 = 1200 |
| 48 | const W_LEN_MIN: i64 = 200 |
| 49 | const W_LEN_MAX: i64 = 8000 |
functions
| 51 | func ww(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 52 | func we(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(2, s, n); return 0 } |
| 53 | func w_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: w_extract |
| 54 | func w_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var a: i64 = o; while s[i] != (0 as u8) { d[a] = s[i]; a = a + 1; i = i + 1 } return a } |
| 55 | func w_catn(d: *u8, o: i64, v: i64) -> i64 |
| 65 | func w_jesc(d: *u8, o: i64, s: *u8) -> i64 called by 1: main |
| 77 | func w_slurp(path: *u8, buf: *u8, cap: i64) -> i64 |
| 88 | func w_streq(a: *u8, b: *u8) -> i64 |
| 95 | func w_field(buf: *u8, s: i64, e: i64, idx: i64, out: *u8, cap: i64) -> i64 called by 1: w_mode_lookup |
| 118 | func w_atoi(s: *u8, pi: *i64) -> i64 called by 1: main |
| 133 | func w_mode_lookup(mode: *u8, reg: *u8, lane: *u8, structure: *u8, mtok: *u8, arc: *u8) -> i64 |
| 164 | func w_list_modes() -> i64 |
| 174 | func w_migrate() -> i64 |
| 213 | func w_system_for(structure: *u8, arc: *u8, out: *u8) -> i64 |
| 238 | func w_engine_call(a: i64, b: i64, c: i64, d: i64, port: i64, req: *u8, reqlen: i64, resp: *u8, cap: i64) -> i64 called by 1: main calls 7: sys_socketsys_set_socket_timeoutsys_mmapnx_connect_boundedsys_closesys_write+1 |
| 261 | func w_probe(a: i64, b: i64, c: i64, d: i64, port: i64) -> i64 |
| 277 | func w_extract(resp: *u8, n: i64) -> i64 |
| 313 | func w_parse_addr(s: *u8, w: *i64) -> i64 called by 1: main |
| 332 | func main(argc: i64, argv: *i64) -> i64 |