code wiki / _hdl_build / nx_ws_cycle.nx
nx_ws_cycle.nx
buildroot/runtime/_hdl_build/nx_ws_cycle.nx
about
nx_ws_cycle.nx -- THE AUTONOMOUS LOOP conductor organ, R1 READ-ONLY (design-of-record
project-nishi-autonomous-loop-design-2026-07-18). Derives a workstream's phase + next_action
from MACHINE ARTIFACTS ONLY (the ws_sync journal + the debt store) -- no self-report advances
anything. DEBT-GATE BY CONSTRUCTION: while any open debt row exists, next NEVER emits WORK.
nx_ws_cycle seedphases [cycleprefix] (idempotent: CONFIG + 13 phase-contract rows)
nx_ws_cycle phases [cycleprefix] (dump the loop contract)
nx_ws_cycle board [journal] [debtprefix] [cycleprefix] (JSON: every ws + derived phase, scoped gate)
nx_ws_cycle next <ws> [journal] [debtprefix] [cycleprefix] (JSON: the one next action, scoped-gated)
nx_ws_cycle phase <ws> [tool] [page] [journal] [debtprefix] [cycleprefix] (R2b EVIDENCE ladder:
derived from artifacts only -- journal frames, scoped debt state, a tool_allowlist.conf row
(EXPOSE proven), a published file's bytes (PUBLISH proven). The caller can only POINT at
artifacts, never assert a phase; a missing artifact = the phase is NOT advanced, fail-closed.)
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_store_seed_lib.nxnx_seg_store.nxnx_syscalls.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
| 17 | const WC_MAGIC_7200: i64 = 7200 |
| 28 | const WC_CAP: i64 = 33554432 |
| 29 | const WC_JCAP: i64 = 33554432 |
| 30 | const WC_SEEK_SET: i64 = 0 |
| 31 | const WC_SEEK_END: i64 = 2 |
| 32 | const WC_TAB: i64 = 9 |
| 33 | const WC_NL: i64 = 10 |
| 34 | const WC_STDERR: i64 = 2 |
| 35 | const WC_SPAN: i64 = 16 |
| 36 | const WC_EXIT_USAGE: i64 = 2 |
| 37 | const WC_EXIT_MMAP: i64 = 9 |
| 38 | const WC_MMAP_ERRMAX: i64 = 4096 |
functions
| 40 | func wc_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } calls 1: sys_write |
| 41 | func wc_werr(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(WC_STDERR, s, n); return 0 } |
| 47 | func wc_mm(n: i64) -> *u8 called by 12: wc_catnwc_haswc_has_litwc_first_kickwc_lastwc_debts_in+6 calls 3: sys_mmapwc_werrsys_exit |
| 56 | func wc_vlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: main |
| 57 | func wc_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { d[o] = s[i]; o = o + 1; i = i + 1 } return o } |
| 58 | func wc_catn(d: *u8, o: i64, v: i64) -> i64 { let t: *u8 = wc_mm(28); var m: i64 = v; if m < 0 { m = 0 } var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 } while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } var i: i64 = 0; while i < k { d[o] = t[k-1-i]; o = o + 1; i = i + 1 } return o } |
| 60 | func wc_cat_esc(d: *u8, o: i64, q: *u8, s: i64, e: i64) -> i64 called by 1: main |
| 78 | func wc_cat_esc_html(d: *u8, o: i64, q: *u8, s: i64, e: i64) -> i64 |
| 95 | func wc_read(path: *u8, buf: *u8, cap: i64, sizep: *i64) -> i64 |
| 123 | func wc_le(q: *u8, i: i64, n: i64) -> i64 { var e: i64 = i; var s: i64 = 1; while s == 1 { if e >= n { s = 0 } else { if q[e] == (WC_NL as u8) { s = 0 } else { e = e + 1 } } } return e } |
| 124 | func wc_col(q: *u8, ls: i64, le: i64, c: i64, out: *i64) -> i64 |
| 140 | func wc_lit_eq(q: *u8, s: i64, e: i64, lit: *u8) -> i64 |
| 146 | func wc_span_eq(q: *u8, s1: i64, e1: i64, s2: i64, e2: i64) -> i64 |
| 152 | func wc_atoi_span(q: *u8, s: i64, e: i64) -> i64 { var v: i64 = 0; var i: i64 = s; while i < e { let c: i64 = q[i] as i64; if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } } i = i + 1 } return v } |
| 154 | func wc_has(q: *u8, n: i64, verb: *u8, ws_s: i64, ws_e: i64) -> i64 |
| 168 | func wc_has_lit(q: *u8, n: i64, verb: *u8, ws: *u8) -> i64 |
| 182 | func wc_first_kick(q: *u8, upto: i64, ws_s: i64, ws_e: i64) -> i64 |
| 196 | func wc_last(q: *u8, n: i64, ws_s: i64, ws_e: i64, ons: *i64) -> i64 |
| 218 | func wc_debts_in(buf: *u8, n: i64, fs: *i64) -> i64 |
| 235 | func wc_debts(dprefix: *u8, buf: *u8, fs: *i64) -> i64 |
| 241 | func wc_cfg(cprefix: *u8, key: *u8, defv: i64) -> i64 |
| 261 | func wc_sevmin(cprefix: *u8) -> i64 { return wc_cfg(cprefix, "global-sev-min" as *u8, 0) } |
| 263 | func wc_scope_hits_ws(q: *u8, s: i64, e: i64, ws: *u8) -> i64 |
| 297 | func wc_row_legacy(q: *u8, ls: i64, le: i64, c0: *i64) -> i64 |
| 313 | func wc_debts_scoped_in(buf: *u8, n: i64, fs: *i64, ws: *u8, sevmin: i64) -> i64 |
| 342 | func wc_debts_scoped(dprefix: *u8, buf: *u8, fs: *i64, ws: *u8, sevmin: i64) -> i64 |
| 347 | func wc_tool_exposed(tool: *u8) -> i64 |
| 362 | func wc_file_bytes(path: *u8) -> i64 |
| 372 | func wc_seedphases(prefix: *u8) -> i64 |
| 400 | func main(argc: i64, argv: *i64) -> i64 |