code wiki / _hdl_build / nx_ws_cycle.nx

nx_ws_cycle.nx

buildroot/runtime/_hdl_build/nx_ws_cycle.nx

35591 B697 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tooltopic ws
docsdependenciesstructsconstsfunctions

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

nx_store_seed_lib.nx nx_seg_store.nx nx_syscalls.nx nx_ws_cycle.nx

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

main wc_werr sys_write sys_exit wc_lit_eq wc_vlen wc_seedphases wc_mm sys_mmap wc_werr ↻ sys_exit ↻ wc_cat sts_seed ss_begin_cap sys_mmap ↻ sts_mm sys_mmap ↻ sts_werr sys_write ↻ sys_exit ↻ sts_rowkey ss_catn sys_mmap ↻ ss_add ss_add2 ss_w32 ss_len ss_catn ↻ ss_commit ss_segid_ok sys_mmap ↻ ss_cat ss_catn ↻ sys_write ↻ ss_write_seg ss_segid_ok ↻ sys_mmap ↻ ss_cat ↻ ss_catn ↻ sys_write ↻

structs

none

consts

17const WC_MAGIC_7200: i64 = 7200
28const WC_CAP: i64 = 33554432
29const WC_JCAP: i64 = 33554432
30const WC_SEEK_SET: i64 = 0
31const WC_SEEK_END: i64 = 2
32const WC_TAB: i64 = 9
33const WC_NL: i64 = 10
34const WC_STDERR: i64 = 2
35const WC_SPAN: i64 = 16
36const WC_EXIT_USAGE: i64 = 2
37const WC_EXIT_MMAP: i64 = 9
38const WC_MMAP_ERRMAX: i64 = 4096

functions

40func 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
41func 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 }
called by 3: wc_mmwc_seedphasesmain calls 1: sys_write
47func wc_mm(n: i64) -> *u8
56func wc_vlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: main
57func 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 }
58func 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 }
called by 2: wc_seedphasesmain calls 1: wc_mm
60func wc_cat_esc(d: *u8, o: i64, q: *u8, s: i64, e: i64) -> i64
called by 1: main
78func wc_cat_esc_html(d: *u8, o: i64, q: *u8, s: i64, e: i64) -> i64
called by 1: main calls 1: wc_cat
95func wc_read(path: *u8, buf: *u8, cap: i64, sizep: *i64) -> i64
123func 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 }
124func wc_col(q: *u8, ls: i64, le: i64, c: i64, out: *i64) -> i64
140func wc_lit_eq(q: *u8, s: i64, e: i64, lit: *u8) -> i64
146func wc_span_eq(q: *u8, s1: i64, e1: i64, s2: i64, e2: i64) -> i64
152func 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 }
154func wc_has(q: *u8, n: i64, verb: *u8, ws_s: i64, ws_e: i64) -> i64
168func wc_has_lit(q: *u8, n: i64, verb: *u8, ws: *u8) -> i64
called by 1: main calls 4: wc_mmwc_lewc_colwc_lit_eq
182func wc_first_kick(q: *u8, upto: i64, ws_s: i64, ws_e: i64) -> i64
196func wc_last(q: *u8, n: i64, ws_s: i64, ws_e: i64, ons: *i64) -> i64
218func wc_debts_in(buf: *u8, n: i64, fs: *i64) -> i64
235func wc_debts(dprefix: *u8, buf: *u8, fs: *i64) -> i64
241func wc_cfg(cprefix: *u8, key: *u8, defv: i64) -> i64
261func wc_sevmin(cprefix: *u8) -> i64 { return wc_cfg(cprefix, "global-sev-min" as *u8, 0) }
called by 1: main calls 1: wc_cfg
263func wc_scope_hits_ws(q: *u8, s: i64, e: i64, ws: *u8) -> i64
called by 1: wc_debts_scoped_in calls 1: wc_lit_eq
297func wc_row_legacy(q: *u8, ls: i64, le: i64, c0: *i64) -> i64
called by 1: wc_debts_scoped_in calls 1: wc_col
313func wc_debts_scoped_in(buf: *u8, n: i64, fs: *i64, ws: *u8, sevmin: i64) -> i64
342func wc_debts_scoped(dprefix: *u8, buf: *u8, fs: *i64, ws: *u8, sevmin: i64) -> i64
called by 1: main calls 2: sts_loadwc_debts_scoped_in
347func wc_tool_exposed(tool: *u8) -> i64
362func wc_file_bytes(path: *u8) -> i64
372func wc_seedphases(prefix: *u8) -> i64
400func main(argc: i64, argv: *i64) -> i64