code wiki / (root) / nx_crew_serve.nx

nx_crew_serve.nx

buildroot/runtime/nx_crew_serve.nx

14376 B237 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind servicetopic crew
docsdependenciesstructsconstsfunctions

about

nx_crew_serve.nx -- the ONE consolidated crew-capabilities MCP backend (operator 2026-07-10: "each role owns its raci capabilities and gets them to be mcp apis"). No-tool-proliferation: ONE nishi_crew tool serves the whole crew. nishi_crew -> the full crew directory (36 roles) + MCP-exposure coverage. nishi_crew <role> -> that role's capability record + its RACI cell (who is A/R/C/I for the activity it OWNS). nishi_crew <role> <activity> -> DISPATCH: RACI-GATE (the role MUST be Accountable for the activity -- no self-escalation), then fork-exec the role's organ and RETURN its output+exit; honest "not deployed" if the organ is not on this host (never faked). This makes a role's capability CALLABLE over MCP. Data-driven from crew_capabilities.data + nishi_raci.tsv. JSON trick: cs_w2() converts ' (39) -> " (34); no '#'/'!'/'"' in string literals (nx_cc lexer traps). Dispatch mirrors nx_ccheck (pipe2 + fork + dup3 + wait4). license_tier: ORIGINAL expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_raci_sov.nx nx_crew_serve.nx

imports: nx_syscalls.nxnx_itoa_lib.nxnx_raci_sov.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap cs_lookup_organ sys_mmap ↻ cs_read sys_openat_rd sys_read sys_close cs_field_cp cs_streq cs_w2 sys_mmap ↻ sys_write cs_raw sys_write ↻ sys_exit cs_is_accountable sys_mmap ↻ raci_read_all ss_open ss_open2 sys_mmap ↻ ss_manifest_dyn ss_manifest_file_dyn ss_cat ss_loadfile sys_map_file ss_readall ss_load_aux2 sys_mmap ↻ ss_cat ↻ ss_loadfile ↻ ss_r32 sys_munmap ssl_total_keys ss_r32 ↻ ssl_pow2 ssl_build ss_r32 ↻ ssl_hash_entry

structs

none

consts

13const CS_MAGIC_2026: i64 = 2026
15const CS_CAP: i64 = 262144
16const CS_OUT: i64 = 8192

functions

18func cs_raw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
19func cs_w2(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){ if s[n]==(39 as u8) { let q: *u8=sys_mmap(1); q[0]=34 as u8; sys_write(1,q,1) } else { sys_write(1, (s as i64 + n) as *u8, 1) } n=n+1 } return 0 }
20func cs_byte(b: i64) -> i64 { let q: *u8=sys_mmap(1); q[0]=b as u8; sys_write(1,q,1); return 0 }
called by 1: cs_jesc calls 2: sys_mmapsys_write
25func cs_wn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
26func cs_read(path: *u8, buf: *u8, cap: i64) -> i64
32func cs_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8) { if a[i]!=b[i] {return 0} i=i+1 } if b[i]!=(0 as u8) {return 0} return 1 }
33func cs_field_raw(line: *u8, len: i64, n: i64, delim: i64) -> i64
called by 2: maincs_emit_raci_inline calls 1: sys_write
38func cs_field_cp(line: *u8, len: i64, n: i64, delim: i64, out: *u8, outcap: i64) -> i64
44func cs_jesc(s: *u8) -> i64
called by 1: main calls 1: cs_byte
52func cs_scopy(dst: *u8, off: i64, src: *u8) -> i64 { var i: i64=0; while src[i]!=(0 as u8){ let d: *u8=(dst as i64 + off + i) as *u8; d[0]=src[i]; i=i+1 } return off+i }
called by 1: cs_organ_resolve
55func cs_is_accountable(role: *u8, activity: *u8) -> i64
76func cs_lookup_organ(role: *u8, organ_out: *u8, act_out: *u8) -> i64
93func cs_organ_resolve(name: *u8, pathout: *u8) -> i64
called by 1: main calls 3: cs_scopysys_openat_rdsys_close
101func cs_dispatch(organ_path: *u8, out: *u8, outcap: i64) -> i64
117func main(argc: i64, argv: *i64) -> i64
216func cs_emit_raci_inline(activity: *u8) -> i64