code wiki / _hdl_build / nx_plan_run.nx

nx_plan_run.nx

buildroot/runtime/_hdl_build/nx_plan_run.nx

13174 B303 linesdepth 8pulls 19 transitivereach 0 importersview sourcekind tooltopic plan
docsdependenciesstructsconstsfunctions

about

nx_plan_run.nx -- WORKFLOWS-AS-DATA: the sovereign plan executor (operator 2026-07-18: "i still see scratchpadding not via nishi... get what you are doing outside of it in mcp and api and workflow"). Kills the session-side shell-script orchestration class: a PLAN is rows in a plane (seeded via the MCP-live nx_store_put), and ONE cap-gated tools/call executes the whole sequence SERVER-SIDE, recording per-step results to a results plane (provenance in the plane, as always). nx_plan_run <planid> [allowlist] [planprefix] [resultsprefix] plan rows : knowledge/store/plan-<id>- seq<TAB>tool<TAB>arg... (executed in seq order) results rows: knowledge/store/planrun-<id>- seq<TAB>tool<TAB>rc<TAB>output-snippet SECURITY = the tools-plane model, no escalation: each step's tool MUST be a GREEN row in tool_allowlist.conf; a row's PINNED args override plan args (fixed-arg pinning, caller args ignored); unknown tool -> REFUSED fail-closed; a failing step STOPS the plan (later steps never run) with the failure recorded. nx_plan_run itself is cap-gated on the tools plane. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 5 imports · 0 importers

nx_store_seed_lib.nx nx_seg_store.nx nx_deploy_lib.nx nx_syscalls.nx nx_heavyio_lib.nx nx_plan_run.nx

imports: nx_store_seed_lib.nxnx_seg_store.nxnx_deploy_lib.nxnx_syscalls.nxnx_heavyio_lib.nx

imported by: nobody (leaf or entry point)

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

main pr_werr sys_write pr_slen sys_exit sys_mmap nxa_die sys_write ↻ sys_exit ↻ nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ hio_admit sys_mmap ↻ hio_root sys_mmap ↻ hio_cat sys_openat_rd sys_close hio_cat ↻ hio_admit_conf_root sys_mmap ↻ hio_conf_read sys_openat_rd ↻ sys_mmap ↻ sys_read sys_close ↻ hio_eol hio_keyis hio_slot hio_atoi hio_running

structs

none

consts

20const PR_CAP: i64 = 1048576
21const PR_NL: i64 = 10
22const PR_TAB: i64 = 9
23const PR_SP: i64 = 32
24const PR_MAXCOL: i64 = 16
25const PR_PAIR: i64 = 2
26const PR_SPB: i64 = 256
27const PR_MAXSTEP: i64 = 64
28const PR_MAXARG: i64 = 12
29const PR_ARENA: i64 = 65536
30const PR_PFXCAP: i64 = 256
38const PR_SNIP: i64 = 2000
39const PR_OUTCAP: i64 = 65536
40const PR_STDERR: i64 = 2
41const PR_EXIT_USAGE: i64 = 2
42const PR_EXIT_IO: i64 = 1
43const PR_EXIT_REFUSED: i64 = 4
44const PR_EXIT_STEPFAIL: i64 = 5
45const PR_ZERO: i64 = 48
46const PR_NINE: i64 = 57
47const PR_B10: i64 = 10

functions

49func pr_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: pr_werr
50func pr_werr(s: *u8) -> i64 { sys_write(PR_STDERR, s, pr_slen(s)); return 0 }
called by 1: main calls 2: sys_writepr_slen
51func pr_cols(q: *u8, ls: i64, le: i64, sp: *i64) -> i64
called by 2: pr_find_toolmain
66func pr_slice_int(q: *u8, a: i64, b: i64) -> i64
called by 1: main
72func pr_slice_eq(q: *u8, a: i64, b: i64, r: *u8, c: i64, d: i64) -> i64
called by 1: pr_find_tool
79func pr_cstr(arena: *u8, off: *i64, q: *u8, a: i64, b: i64) -> i64
called by 2: pr_find_toolmain
89func pr_find_tool(al: *u8, n: i64, q: *u8, ta: i64, tb: i64, arena: *u8, off: *i64, elfp: *i64, av: *i64) -> i64
123func pr_snip(dst: *u8, o: i64, src: *u8, n: i64) -> i64
called by 1: main
140func main(argc: i64, argv: *i64) -> i64