code wiki / _hdl_build / nx_selfloop_register.nx

nx_selfloop_register.nx source

↩ module page · 41 lines · 3546 B

1// nx_selfloop_register.nx -- registers the SELF-MANAGING LOOP completion (work 2// generation + operator flag) via the Librarian. Evidence = both organs re-run 3// live, plus the generator's idempotency (second run adds 0 rows). 4// license_tier: ORIGINAL 5import "nx_cap_register.nx" 6import "nx_capreg_librarian.nx" 7import "nx_syscalls.nx" 8 9func slr_run(path: *u8) -> i64 { 10 let pid: i64 = sys_fork() 11 if pid == 0 { 12 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4) 13 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) } 14 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = 0 15 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0 16 sys_execve(path, argv, envp); sys_exit(127) 17 } 18 let st: *i64 = sys_mmap(16) as *i64 19 sys_wait4(pid, st, 0) 20 return st[0] 21} 22 23func main() -> i64 { 24 var allok: i64 = 1 25 if slr_run("/tmp/nx_gap_to_queue.sov.elf" as *u8) != 0 { allok = 0 } 26 if slr_run("/tmp/nx_team_digest.sov.elf" as *u8) != 0 { allok = 0 } 27 cr_w(1, "ENGINEER: gap-to-queue + team-digest live re-run pass=" as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8) 28 let eng: i64 = ig_engineer(1, 1, 1, allok) 29 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1) 30 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) } 31 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) } 32 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8 33 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8 34 let idx: i64 = cl_next_idx(lp, jp) 35 let ok: i64 = cl_register_dual(lp, jp, idx, 5, 36 2, "GEN LADDER-LEVEL WORK GENERATOR + OPERATOR FLAG (duplication-audited per operator catch: composes, does not re-own). (1) nx_gap_to_queue = the gap->work verb AT LADDER LEVEL: reads rung_grades.log, RED rung -> GEN-CLOSE row, ABSENT rung -> GEN-OPEN row into assignment_queue.tsv, IDEMPOTENT (deterministic ids; re-run adds 0; GREEN rung stops generating). PROVEN: run1 generated 3 (R0/R2 OPEN, R3 CLOSE) from real evidence, run2 added 0. SAME SHAPE as the blessed nx_gate_sentinel (gate-level baseline-react) and nx_pm_plan_gen (capability-level maturity gaps) -- consolidation row X-CONS-002 routes plan_gen into the SAME queue sink (one backlog, three altitudes). This is the Gartner loop: the grade IS the backlog; a NishiLang-vs-C bench panel feeds the identical generator (X-GEN-BENCH) so the ecosystem grows toward Elm-ease+C-speed without a human pick. (2) nx_team_digest = the operator flag (black box -> visible): LADDER/QUEUE/NEXT/NEEDS-YOU(raised-hand NOVEL = the only engage point)/EFFICIENCY from the five evidence logs -> team_digest.log + sovereign HTML. TRANSITIONAL BY DESIGN: nx_user_console + nx_pm_status already own operator-visibility; X-CONS-001 merges the digest sections into the live quality-gated console and retires the standalone HTML (one dashboard). (3) Pulse tail = the loop in causal order: grade -> generate -> count -> sequence -> brief -> meter -> flag, every beat. HONEST SCOPE: math arc remains the only proved end-to-end DOER (6h re-author+re-gate+tamper); arbitrary-assignment self-completion needs literal gate-marker cells (X-Q-003b) + nx_reconcile (X-Q-005), filed not faked. Composes CAPREG388/389/390 + sentinel/plan_gen/console/status lineage" as *u8) 37 if ok != 1 { cr_w(1, "DUAL-WRITE FAILED\n" as *u8); sys_exit(1) } 38 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx); cr_w(1, " REGISTERED (self-managing loop: generate + flag)\n" as *u8) 39 sys_exit(0) 40 return 0 41}