code wiki / _hdl_build / nx_synth_register.nx

nx_synth_register.nx source

↩ module page · 76 lines · 4615 B

1// nx_synth_register.nx -- GOVERNED registration of the four S3-S4 code-synthesis capabilities (the 2// Librarian's path, not Claude hand-editing the registry). Evidence is REAL, not asserted: each cap's 3// Engineer verdict comes from fork/exec of its actual SOVEREIGN-BUILT gate ELF (/tmp/<name>.sov.elf, 4// produced by nx_sov_build_run = nx_cc->nxasm_x86->run, no gcc) and the raw wait4 status. Scribe = 5// the CAPABILITY_CATALOG.md synthesis section (written before this run). Council = separation of 6// duties + additive-only. Only IG_INGEST writes a CAPREG line. Mirrors nx_fab_register. 7// license_tier: ORIGINAL 8import "nx_cap_register.nx" 9import "nx_syscalls.nx" 10 11const SR_LAYER: i64 = 2 // GEN -- these caps generate code 12const SR_STATUS: i64 = 2 // ECO_PROVEN 13const SR_NLAYERS: i64 = 6 14 15func sr_run_status(path: *u8) -> i64 { 16 let pid: i64 = sys_fork() 17 if pid == 0 { 18 let argv: *i64 = sys_mmap(32) as *i64 19 argv[0] = path as i64 20 argv[1] = 0 21 let envp: *i64 = sys_mmap(16) as *i64 22 envp[0] = 0 23 sys_execve(path, argv, envp) 24 sys_exit(127) 25 } 26 let st: *i64 = sys_mmap(16) as *i64 27 sys_wait4(pid, st, 0) 28 return st[0] 29} 30 31// run one cap's sovereign gate ELF -> governed pipeline -> CAPREG on INGEST. returns 1 on registered. 32func sr_register_one(idx: i64, elf: *u8, name: *u8) -> i64 { 33 let probe: i64 = sys_openat_rd(elf) 34 var compiled: i64 = 0 35 if probe >= 0 { compiled = 1; sys_close(probe) } 36 let raw: i64 = sr_run_status(elf) 37 var ran_no_signal: i64 = 0 38 if (raw % 128) == 0 { ran_no_signal = 1 } 39 var exit_ok: i64 = 0 40 if raw == 0 { exit_ok = 1 } 41 let eng: i64 = ig_engineer(compiled, compiled, ran_no_signal, exit_ok) 42 cr_w(1, " ENGINEER idx=" as *u8); cr_wn(1, idx); cr_w(1, " verdict=" as *u8); cr_wn(1, eng); cr_w(1, " (1=PASS, gate ELF re-ran sovereign)\n" as *u8) 43 44 let cat: i64 = sys_openat_rd("knowledge/CAPABILITY_CATALOG.md" as *u8) 45 var documented: i64 = 0 46 if cat >= 0 { documented = ig_documented(1, 1); sys_close(cat) } 47 48 let council: i64 = ig_council(eng, 1, 1, 2) 49 let decision: i64 = ig_decision(eng, council, documented) 50 if decision != IG_INGEST { 51 cr_w(1, " HELD idx=" as *u8); cr_wn(1, idx); cr_w(1, " reason=" as *u8); cr_wn(1, ig_held_reason(eng, council, documented)); cr_w(1, "\n" as *u8) 52 return 0 53 } 54 if cr_can_register(SR_LAYER, SR_STATUS, SR_NLAYERS, decision) != 1 { 55 cr_w(1, " REFUSED idx=" as *u8); cr_wn(1, idx); cr_w(1, " reason=" as *u8); cr_wn(1, cr_refusal_reason(SR_LAYER, SR_STATUS, SR_NLAYERS, decision)); cr_w(1, "\n" as *u8) 56 return 0 57 } 58 let fd: i64 = sys_openat_append("/tmp/nishi_cap_registry.log" as *u8, 0x1a4) 59 cr_write_entry(fd, idx, SR_LAYER, name, SR_STATUS) 60 sys_close(fd) 61 cr_w(1, " CAPREG idx=" as *u8); cr_wn(1, idx); cr_w(1, " REGISTERED\n" as *u8) 62 return 1 63} 64 65func main() -> i64 { 66 cr_w(1, "=== LIBRARIAN registers the S3-S4 synthesis caps (governed, evidence = sovereign gate re-runs) ===\n" as *u8) 67 var ok: i64 = 0 68 ok = ok + sr_register_one(212, "/tmp/_sig_index_authored.sov.elf" as *u8, "GEN SIG-INDEX -- typed signature catalog of runtime/*.nx (23,879 funcs, byte-deterministic double-pass, spot-KATs); the component index for all synthesis; struct-free walk (NxDirent miscompile filed); Builder-authored via ma_emit_sig_index" as *u8) 69 ok = ok + sr_register_one(213, "/tmp/_type_search_authored.sov.elf" as *u8, "GEN TYPE-SEARCH -- obs-equivalence bottom-up expression synthesis (12-prim whitelisted pool, const-fold + commutative normalizations, honest SEARCH-EXHAUSTED); 3/3 held-out re-derivations; Builder-authored via ma_emit_type_search; corpus-logged" as *u8) 70 ok = ok + sr_register_one(214, "/tmp/_cegis_authored.sov.elf" as *u8, "GEN CEGIS -- mechanized counterexample-guided synthesis (oracle probe grid -> append -> re-search); validator converged to TRUE threshold logic in 9 rounds after hand-picked examples failed twice; probe-domain convergence (SMT flagged later rung); Builder-authored via ma_emit_cegis" as *u8) 71 ok = ok + sr_register_one(215, "/tmp/_loop_synth_authored.sov.elf" as *u8, "GEN LOOP-SYNTH fold schema -- S4 sketch synthesis (fixed loop skeleton + searched INIT/STEP holes, 400-run held-out verify); 4/4 incl. hash31 = the team's own hash idiom derived from oracle queries; first control-flow corpus records; Builder-authored via ma_emit_loop_synth" as *u8) 72 cr_w(1, "REGISTERED " as *u8); cr_wn(1, ok); cr_w(1, "/4 synthesis caps\n" as *u8) 73 if ok == 4 { sys_exit(0) } 74 sys_exit(1) 75 return 0 76}