code wiki / _hdl_build / nx_pattern_emit_register.nx
nx_pattern_emit_register.nx source
↩ module page · 44 lines · 2758 B
1// nx_pattern_emit_register.nx -- GOVERNED registration of the pattern emitters. Engineer gate = the
2// TEAM-AUTHORED verdict-gate test (/tmp/_pe_vgate_test.sov.elf) builds+passes = the Builder authored a
3// working core autonomously. license_tier: ORIGINAL
4import "nx_cap_register.nx"
5import "nx_syscalls.nx"
6
7const PE_IDX: i64 = 231
8const PE_LAYER: i64 = 5 // SELF -- the team building its own modules (Builder authoring)
9const PE_NLAYERS: i64 = 6
10
11func per_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(32) as *i64; argv[0] = path as i64; argv[1] = 0
17 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0
18 sys_execve(path, argv, envp); sys_exit(127)
19 }
20 let st: *i64 = sys_mmap(16) as *i64
21 sys_wait4(pid, st, 0)
22 return st[0]
23}
24
25func main() -> i64 {
26 let elf: *u8 = "/tmp/_pe_vgate_test.sov.elf" as *u8
27 let probe: i64 = sys_openat_rd(elf)
28 var present: i64 = 0
29 if probe >= 0 { present = 1; sys_close(probe) }
30 let raw: i64 = per_run(elf)
31 var rns: i64 = 0; if (raw % 128) == 0 { rns = 1 }
32 var ok: i64 = 0; if raw == 0 { ok = 1 }
33 let eng: i64 = ig_engineer(present, present, rns, ok)
34 cr_w(1, "ENGINEER: team-authored verdict-gate test raw=" as *u8); cr_wn(1, raw); cr_w(1, " (0=authored core builds+passes)\n" as *u8)
35 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1)
36 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) }
37 if cr_can_register(PE_LAYER, 2, PE_NLAYERS, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) }
38 let fd: i64 = sys_openat_append("/tmp/nishi_cap_registry.log" as *u8, 0x1a4)
39 cr_write_entry(fd, PE_IDX, PE_LAYER, "SELF PATTERN-EMIT (BUILDER authors the CORE, not just boilerplate) -- the lever that drives bp_claude_touch->0. Per-pattern emitters author the real working CORE LOGIC from a small spec: pe_emit_verdict_gate (thresholds->UNDER/OK/OVER, the jam/dose shape) + pe_emit_accumulator (fold->metric), each with real boundary KATs. PROVEN: nx_pattern_emit_demo had the team AUTHOR _pe_vgate (if x<180->0, x>230->2, else 1 -- real logic not a stub) + _pe_accum; the ENGINEER verified both authored tests GREEN with ZERO Claude logic-authoring. For a covered shape the team now builds a complete gated capability hands-off; closes the scaffold-author boilerplate gap into the CORE. Composes nx_scaffold_author + nx_pattern_library. Next rungs: emitters for the other 8 shapes -> full autonomous build" as *u8, 2)
40 sys_close(fd)
41 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, PE_IDX); cr_w(1, " REGISTERED\n" as *u8)
42 sys_exit(0)
43 return 0
44}