code wiki / (root) / nx_conductor_live.nx

nx_conductor_live.nx

buildroot/runtime/nx_conductor_live.nx

16601 B280 linesdepth 8pulls 11 transitivereach 0 importersview sourcekind tooltopic conductor
docsdependenciesstructsconstsfunctions

about

nx_conductor_live.nx -- the Nishi CONDUCTOR, v3: the LIVE, WARDEN-GATED tick that ticks the INVENTION ORGANS via the SOVEREIGN code path (NO .sh). v1 (nx_conductor.nx) was OBSERVE-ONLY (measure canaries + journal, no Warden, no action). v2 was LIVE+Warden-gated but dispatched each gate by fork+exec'ing a .sh WRAPPER via /bin/bash -- the LAST non-sovereign part. v3 REMOVES that: the beat now runs the invention organs (AUTHOR + VERIFY-BY-PROOF) directly via the gr_gate shape ported INTO the Conductor (cl_run/cl_gate): fork+exec the PINNED known-good compiler -> as -> ld -> nx_run_timeout, exit-code = verdict. No /bin/bash, no .sh anywhere on the dispatch path -- argv[0] is the known-good ELF / as / ld, never a shell. (Operator cardinal: sovereign NishiLang only.) Each BEAT it (1) asks the WARDEN to authorize the additive verify/author-to- memory action, then (2) ticks the two invention organs hang-safe (each stage, including cc/as/ld, runs under a self-SIGALRM deadline so a looping build- oracle or organ kills itself -- it cannot wedge the beat), and (3) journals the verdict to the event bus -- on cadence, UNATTENDED. This flips the build-> verify->invent loop from "a human runs it" to "the crew ticks itself." The Warden GATES, it does not rubber-stamp: each beat we show it ALLOW the safe (additive, read-only) verify/author-to-MEMORY tick AND DENY a forbidden source overwrite -- proving the cardinal gate is live in the loop (#13 additive-only). The author organ EMITs to MEMORY only; an EMIT-to-SOURCE would be a W_OVERWRITE_SRC -> DENIED. The exit code itself proves the deny fired on every beat (warden_denies must == CL_BEATS). Composes nx_run_timeout (hang-safety + nx_rt_alarm) + nx_warden_lib (the cardinal gate). Sovereign: raw syscalls, zero deps, ZERO shell. Bounded beats (testable); the unbounded daemon is a config flip once this is trusted. license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_run_timeout.nx nx_warden_lib.nx nx_win_ledger.nx nx_framed_append.nx nx_conductor_live.nx

imports: nx_run_timeout.nxnx_warden_lib.nxnx_win_ledger.nxnx_framed_append.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main cl_wstr nx_win_ledger_new sys_mmap nx_blob_store_new sys_mmap ↻ nx_journal_log_new sys_mmap ↻ cl_wnum cl_hb_beat sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real fa_cat fa_catn sys_mmap ↻ fa_appendz fa_append sys_mmap ↻ sys_openat_append sys_flock fa_write_all sys_write sys_close fa_len warden_authorize warden_check w_is_build_artifact w_contains w_audit sys_openat_append ↻ w_wstr sys_write ↻ w_kind_name sys_close ↻ cl_gate cl_run sys_fork sys_openat_wr sys_dup3

structs

none

consts

37const CL_EVENTLOG: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/_offc/nx_crew_events.log"
38const CL_GATE_TIMEOUT_MS: i64 = 12000 // per-organ RUN hang bound
39const CL_BUILD_TIMEOUT_MS: i64 = 60000 // per cc/as/ld stage hang bound (compiler can loop)
40const CL_CADENCE_MS: i64 = 500 // sleep between beats (short for the demo)
41const CL_BEATS: i64 = 3 // bounded; unbounded daemon = config flip
42const CL_MODE_FILE: i64 = 420
43const CL_NGATES: i64 = 2 // the two invention organs (author + verify-by-proof)
47const CL_CC: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/_offc/nx_cc_known_good.elf"
48const CL_AS: *u8 = "/usr/bin/as"
49const CL_LD: *u8 = "/usr/bin/ld"
51const CL_S: *u8 = "/tmp/nx_cl.s"
52const CL_O: *u8 = "/tmp/nx_cl.o"
53const CL_ELF: *u8 = "/tmp/nx_cl.elf"
55const CL_REC_CAP: i64 = 256 // bounded event/heartbeat record (matches WMS-R0 RECCAP)
56const CL_HB_CHANNEL: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/status/wms_heartbeat.log"
57const CL_CONDUCTOR_WS: i64 = 1 // the conductor's own workstream id in the heartbeat channel

functions

59func cl_wstr(fd: i64, s: *u8) -> i64
called by 1: main
65func cl_wnum(fd: i64, n: i64) -> i64
called by 1: main
80func cl_hb_beat(seq: i64) -> i64
103func cl_run(path: *u8, argv: *i64, envp: *i64, out_path: *u8, timeout_ms: i64) -> i64
135func cl_gate(testnx: *u8, elapsed_out: *i64) -> i64
called by 1: main calls 2: cl_runnx_run_timeout
160func cl_event(beat: i64, label: *u8, verdict: *u8, ms: i64) -> i64
called by 1: main calls 3: fa_catfa_catnfa_appendz
180func cl_journal_win(L: *NxWinLedger, repro_gate: *u8) -> i64
198func main() -> i64