code wiki / _hdl_build / nx_conductor_registry.nx

nx_conductor_registry.nx source

↩ module page · 57 lines · 5362 B

1// nx_conductor_registry.nx -- the CONDUCTOR's PERSISTENT pulse/daemon registry (operator: "pulses and daemons 2// go through the nishi conductor"). The publisher persists what it ships in a ledger; the conductor must 3// likewise persist what it governs. Sovereign seg_store (NOT a TSV -- the ecosystem-only doctrine, same as 4// nx_cap_gap_sov which replaced endpoint_paths.tsv). A pulse fires through the conductor ONLY if it is BOTH 5// (a) REGISTERED here (declared + persisted) AND (b) ADMITTED now (cp_admit: RACI-owned + gate-green + 6// never-brick #26). An unregistered pulse is REFUSED even if it would otherwise admit => the registry is the 7// gate to recurring execution, the analog of the publisher's governed promotion. license_tier: ORIGINAL 8import "nx_seg_store.nx" 9import "nx_conductor_pulse.nx" // cp_run_gate, cp_admit, cp_fire_governed, CP_ADMIT 10import "nx_raci_sov.nx" // raci_migrate, raci_is_accountable -- ownership from the SOVEREIGN RACI (no TSV) 11import "nx_syscalls.nx" 12 13const CR_STORE: *u8 = "knowledge/registry/conductor_pulses" 14 15func cr_clen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } 16 17// SEED the governed-pulse registry into the sovereign store (idempotent full-seed = the cap_gap pattern). 18// Each entry = a pulse the conductor governs: key=organ-gate, val=Accountable owner. Add new governed pulses here. 19func cr_seed() -> i64 { 20 let totp: *i64 = sys_mmap(16) as *i64; let verp: *i64 = sys_mmap(16) as *i64 21 raci_migrate(totp, verp) // ensure the sovereign RACI store exists (off the TSV) for the ownership check 22 let w: *i64 = ss_begin() 23 ss_add(w, 1, "nx_team_train_gate" as *u8, "engineer" as *u8, cr_clen("engineer" as *u8)) 24 ss_add(w, 1, "nx_sovaudit_ratchet_gate" as *u8, "warden" as *u8, cr_clen("warden" as *u8)) // keep-the-debt-gone (1 axis), warden governs 25 ss_add(w, 1, "nx_sprawl_ratchet_gate" as *u8, "warden" as *u8, cr_clen("warden" as *u8)) // keep-ALL-sprawl-gone (debt+collisions+scratch), warden governs -- supersedes the 1-axis above 26 ss_add(w, 1, "nx_research_cycle" as *u8, "researcher" as *u8, cr_clen("researcher" as *u8)) // the self-improving researcher loop (self-gating via its step-7 gate), researcher governs 27 ss_add(w, 1, "nx_capability_shape_audit" as *u8, "warden" as *u8, cr_clen("warden" as *u8)) // the curation MAP: grade every organ + count raw collisions (writes capability_audit.log), warden governs 28 ss_add(w, 1, "nx_collision_harm" as *u8, "warden" as *u8, cr_clen("warden" as *u8)) // the HARM-TRIAGE: realistic debt = harmful (dormant) subset, benign coexistence separated; the living tree grows so this runs standing, warden governs 29 ss_add(w, 1, "nx_capability_no_regression_gate" as *u8, "warden" as *u8, cr_clen("warden" as *u8)) // the curation RATCHET: perfect-objects up-only, collisions down-only, merge-gates green (no functionality lost), warden governs 30 // --- 2026-06-25 orchestration convergence (Critic+audit follow-up): the ONE-PASS recurring pulses, owners from each organ's header/domain (researcher STATED in nx_work_pulse; warden = the ops/gov convention). apm/transient are forever-daemons (self-looping), governed at launch not as periodic pulses, so NOT here. --- 31 ss_add(w, 1, "nx_work_pulse" as *u8, "researcher" as *u8, cr_clen("researcher" as *u8)) // standing work-loop pick (header: RESEARCHER owns rb_next), one-pass, researcher governs 32 ss_add(w, 1, "nx_search_reach_pulse" as *u8, "researcher" as *u8, cr_clen("researcher" as *u8)) // SREACH reach-loop beat (re-proves search gates), research arc, researcher governs 33 ss_add(w, 1, "nx_team_pulse" as *u8, "engineer" as *u8, cr_clen("engineer" as *u8)) // conductor's team self-assessment unit, one-pass, engineer governs the grader build 34 ss_add(w, 1, "nx_pub_recover_pulse" as *u8, "warden" as *u8, cr_clen("warden" as *u8)) // publisher self-healing pass (ops), one-pass, warden governs ops 35 ss_add(w, 1, "nx_docpub_pulse" as *u8, "warden" as *u8, cr_clen("warden" as *u8)) // publish-as-we-work content-change gate, one-pass, warden governs publishing ops 36 ss_commit(CR_STORE, w, sys_now_realtime_sec()) 37 return 0 38} 39 40// is this organ a GOVERNED (registered) pulse? reads the persisted store. 41func cr_is_governed(organ: *u8) -> i64 { 42 let h: *i64 = ss_open(CR_STORE) 43 if (h as i64) == 0 { return 0 } 44 let pq: *i64 = sys_mmap(16) as *i64; let lq: *i64 = sys_mmap(16) as *i64 45 if ss_hget(h, organ, pq, lq) == 1 { return 1 } 46 return 0 47} 48 49// THE CONDUCTOR'S GOVERNED FIRE: a pulse runs ONLY if registered AND admitted now. 50// returns -2 = NOT REGISTERED (conductor refuses) | -1 = registered but admission failed | >=0 = fired (exit code) 51func cr_conductor_fire(organ: *u8, owner: *u8, touches_hw: i64, neverbrick_proven: i64) -> i64 { 52 if cr_is_governed(organ) != 1 { return 0 - 2 } // not in the registry -> refuse 53 let oo: i64 = raci_is_accountable(owner) // ownership from the SOVEREIGN RACI store (no TSV) 54 let gx: i64 = cp_run_gate(organ) 55 let adm: i64 = cp_admit(oo, gx, touches_hw, neverbrick_proven) // RACI-owned + gate-green + never-brick 56 return cp_fire_governed(adm, organ) // -1 if admission failed, else the exit code 57}