code wiki / _hdl_build / nx_procgen_struct_register.nx
nx_procgen_struct_register.nx source
↩ module page · 49 lines · 3485 B
1// nx_procgen_struct_register.nx -- registers the landmark-knob structural
2// handles + the oscillation detector via the Librarian. ENGINEER
3// evidence = gate-built tuner KAT elf green (incl. KAT8 landmark-moves-
4// ext) + the STRUCTURAL-ESCALATION row exists in the verdict history
5// chain (the detector fired on the live ping-pong).
6// license_tier: ORIGINAL
7import "nx_cap_register.nx"
8import "nx_capreg_librarian.nx"
9import "nx_syscalls.nx"
10
11func sr_run(path: *u8) -> i64 {
12 let pid: i64 = sys_fork()
13 if pid == 0 {
14 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4)
15 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) }
16 let argv: *i64 = sys_mmap(16) as *i64
17 argv[0] = path as i64; argv[1] = 0
18 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0
19 sys_execve(path, argv, envp); sys_exit(127)
20 }
21 let st: *i64 = sys_mmap(16) as *i64
22 sys_wait4(pid, st, 0)
23 let sig: i64 = st[0] & 0x7f
24 if sig != 0 { return 128 + sig }
25 return (st[0] >> 8) & 0xff
26}
27
28func main() -> i64 {
29 var ok: i64 = 1
30 if sr_run("/tmp/nx_worldgen_tuner_test.gg.elf" as *u8) != 0 { ok = 0 }
31 let hfd: i64 = sys_openat_rd("knowledge/status/worldgen_verdict_hist.log" as *u8)
32 if hfd < 0 { ok = 0 }
33 if hfd >= 0 { sys_close(hfd) }
34 cr_w(1, "ENGINEER: tuner KATs (incl landmark-ext KAT8) + verdict-hist chain pass=" as *u8); cr_wn(1, ok); cr_w(1, "\n" as *u8)
35
36 let eng: i64 = ig_engineer(1, 1, 1, ok)
37 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1)
38 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) }
39 if cr_can_register(3, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) }
40 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8
41 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8
42 let idx: i64 = cl_next_idx(lp, jp)
43 let okw: i64 = cl_register_dual(lp, jp, idx, 3,
44 2, "VER PROCGEN STRUCTURAL HANDLES + OSCILLATION DETECTOR (arc=PROCGEN; operator: build the team's capabilities for the nishi game engine + handle the callouts). (1) LANDMARK KNOBS: nx_sig_compose_cfg/nx_procgen_landscape_cfg (ADDITIVE, v1 byte-stable wrappers) expose peaks_extra + amp_boost_q10 -- landmark COUNT and MASS as data; tunelib slots 5+6 w/ conf keys + preset-default fallback; tuner grids {0,1,2}x{1.0,1.2,1.4}; KAT8 proves the handle moves EXTREMES (b2.ext > b1.ext at same config). Tuner run: ext 5240 -> 9460 (peaks_extra=2 amp_boost=1433 banked). (2) OSCILLATION DETECTOR in nx_worldgen_refine: every verdict change appends AXIS/GRADE to durable worldgen_verdict_hist.log; on A->B->A with no grade climb, auto-files ONE arc=PROCGEN STRUCTURAL-ESCALATION row naming both axes -- the loop now detects KNOB-SPACE EXHAUSTION mechanically instead of re-filing the same two assignments forever. FIRED LIVE on the real MORE_FEATURES <-> IMPROVE_READ ping-pong at grade C (history = the actual pm_plan verdict sequence). FULL GATE 23 MODULES fails=0. The autonomy ladder now: verdict -> assignment -> tuner -> re-verdict -> oscillation -> STRUCTURAL escalation, zero LLM at every hop; the open escalation row IS the next Builder assignment (composed-primitive rung: separated landmark/water interplay e.g. plateau-routed rivers)" as *u8)
45 if okw != 1 { cr_w(1, "DUAL-WRITE FAILED\n" as *u8); sys_exit(1) }
46 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx); cr_w(1, " REGISTERED (structural handles + oscillation detector)\n" as *u8)
47 sys_exit(0)
48 return 0
49}