code wiki / _hdl_build / nx_arbiter_serve.nx

nx_arbiter_serve.nx

buildroot/runtime/_hdl_build/nx_arbiter_serve.nx

2352 B32 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind servicetopic arbiter
docsdependenciesstructsconstsfunctions

about

nx_arbiter_serve.nx -- SERVE-WRAPPER making the ARBITER role's capability an MCP-callable self-test (operator 2026-07-10: "each role owns its raci capabilities and gets them to be mcp apis"). The library-role pattern: nx_arbiter is a LIBRARY (fl_try/fl_acquire/fl_release, no main -> not fork-exec'able); this tiny wrapper IMPORTS it and EXERCISES the capability (acquire a lock, prove a contending try is BLOCKED = mutual exclusion, release, prove re-acquire succeeds) -> clean exit 0 + JSON verdict, so nishi_crew can dispatch `arbiter arbitrate`. Self-contained (flock on ~/.nishi/locks, no external data). Import ONLY nx_arbiter.nx (it brings nx_syscalls transitively; a second direct import = the double-import rc=6 trap). JSON trick: asv_w2 converts ' (39) -> " (34). license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_arbiter.nx nx_arbiter_serve.nx

imports: nx_arbiter.nx

imported by: nobody (leaf or entry point)

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

main fl_try fl_mkdir sys_mmap fl_path sys_openat_wr sys_flock sys_close fl_release sys_flock ↻ sys_close ↻ asv_w2 asv_bit

structs

none

consts

none

functions

10func asv_raw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
11func asv_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 }
called by 1: main
12func asv_bit(b: i64) -> i64 { let d: *u8=sys_mmap(1); d[0]=(48+b) as u8; sys_write(1,d,1); return 0 }
called by 1: main
14func main() -> i64