code wiki / _hdl_build / nx_heartbeat_register.nx

nx_heartbeat_register.nx source

↩ module page · 42 lines · 3236 B

1// nx_heartbeat_register.nx -- registers the math arc's HEARTBEAT WIRING via the 2// Librarian. ENGINEER evidence re-run here: the classifier sync gate (healed), 3// the classifier KATs (de-staled), and the math scorecard step all GREEN. 4// license_tier: ORIGINAL 5import "nx_cap_register.nx" 6import "nx_capreg_librarian.nx" 7import "nx_syscalls.nx" 8 9func hbr_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 hbr_run("/tmp/nx_classifier_sync.sov.elf" as *u8) != 0 { allok = 0 } 26 if hbr_run("/tmp/nx_pattern_classify_test.sov.elf" as *u8) != 0 { allok = 0 } 27 if hbr_run("/tmp/nx_math_scorecard.sov.elf" as *u8) != 0 { allok = 0 } 28 cr_w(1, "ENGINEER: classifier sync + KATs + math scorecard step pass=" as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8) 29 let eng: i64 = ig_engineer(1, 1, 1, allok) 30 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1) 31 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) } 32 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) } 33 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8 34 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8 35 let idx: i64 = cl_next_idx(lp, jp) 36 let ok: i64 = cl_register_dual(lp, jp, idx, 5, 37 2, "GEN MATH-ARC HEARTBEAT WIRING + CLASSIFIER DRIFT HEALED -- the math engine joins the team loop at BOTH cadences: (1) nx_math_scorecard added as Conductor pulse step 19 (cheap evidence-derived grade refresh every 30-min beat); (2) nx_autorun_daemon (pulse_daemon shape: conf-interval knowledge/status/autorun_daemon.conf I=21600, pid dup-guard via /proc cmdline, self-daemonize, durable-runner beats, AUTORUN-BEAT rows) re-runs the FULL nx_math_rung_run re-prove every 6h -- rule-21 split: the pulse stays cheap, the evidence renews on the slow beat. (3) CLASSIFIER DRIFT HEALED by the gate doing its job: pulse stood ATTENTION because emit12/TEMPLATE_TABLE (shape 17, concurrent arc) shipped without census/classifier sync; Builder added PL_TEMPLATE_TABLE census row + classifier route (IN_TABLE+IN_BYTES before STATE_FLOW/THRESHOLD_TABLE, order=policy) -> CLSYNC 17/17/17 GREEN; classifier KAT de-staled (hardcoded ==16 -> ==pl_n_patterns(): the literal broke on every library growth; emitter-vs-census drift stays the sync gate's job) + new shape-17 route KAT -> 24/24. (4) math_rungs.tsv atan ugate column swapped to the EMITTED gate (_f64_atan_gate_emitted) -- first rung where kernel AND gate are both team-authored artifacts in the autonomous beat. Composes CAPREG372/373" as *u8) 38 if ok != 1 { cr_w(1, "DUAL-WRITE FAILED\n" as *u8); sys_exit(1) } 39 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx); cr_w(1, " REGISTERED (math heartbeat wiring + drift heal)\n" as *u8) 40 sys_exit(0) 41 return 0 42}