code wiki / _hdl_build / nx_claims.nx

nx_claims.nx

buildroot/runtime/_hdl_build/nx_claims.nx

37392 B866 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_claims.nx -- SESSION-CLAIMS AS AN ECOSYSTEM CAPABILITY (ws=ws-intel2, 2026-07-20). Eats debt 1784408445 (claims protocol shell-only via WSL) + feeds 1784408708 (claims hub to NAS = standup claim-holder liveness): claim/beat/release/walk become MCP tools/call verbs on an append-only NAS journal -- peers of nx_ws_sync (journal) / nx_ws_cycle (phase). HOLDERSHIP IS DERIVED, NEVER STORED (evidence law): latest CLAIM not RELEASEd by its holder = the claim; freshness = latest CLAIM/BEAT ts by that holder vs its TTL -> HELD | EXPIRED (crash-expiry BY CONSTRUCTION -- a dead session's claim self-expires, the F214 lease semantics) | FREE (released) | ABSENT. Claim on a contended resource is REFUSED fail-closed (exit 3) -- never silently stolen; an EXPIRED claim is claimable. Frame: <ts>\t<VERB>\t<resource>\t<actor>\t<ttl>\t<note> VERB in {CLAIM, BEAT, RELEASE} SCALE LAW: windowed reads + declared envelope (window_bytes/truncated/claims_capped). license_tier: ORIGINAL No hw writes (Rule 26). claim <journal> <resource> <actor> <ttl_sec> <note> -> HELD | CONTENDED(3) beat <journal> <resource> <actor> <note> -> BEAT | NOT-HOLDER(3) release <journal> <resource> <actor> <note> -> RELEASED | NOT-HOLDER(3) state <journal> <resource> -> ONE-LINE probe: state=HELD|EXPIRED|FREE|ABSENT holder=.. (seq543/seq552: lets nx_seat checkout classify NOT-HOLDER honestly; exit 0 always) walk <journal> -> JSON all resources reap <journal> <reaper> <note> -> F214: release ONLY provably-EXPIRED claims (age>ttl by the claim's OWN ttl field) + ORPHAN-REAPED audit note; idempotent; exit 0 selftest <scratch-journal> -> gate T1..T8 (caller pre-cleans)

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_gate_verdict.nx nx_claims.nx nx_seat.nx

imports: nx_syscalls.nxnx_gate_verdict.nx

imported by: nx_seat.nx

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

main gv_puts sys_write sys_exit cl_vlen cl_lit_eq cl_selftest gv_ctr 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 ↻ gv_head gv_puts ↻ sys_mmap ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real cl_read sys_openat_rd sys_read sys_close gv_check gv_puts ↻ cl_append sys_now_realtime_sec ↻ sys_mmap ↻ cl_catn sys_mmap ↻

structs

none

consts

24const CL_MAGIC_4096: i64 = 4096
25const CL_MAGIC_2000: i64 = 2000
26const CL_MAGIC_200000: i64 = 200000
27const CL_MAGIC_5000: i64 = 5000
29const CL_WIN: i64 = 4194304
30const CL_OUT: i64 = 262144
31const CL_SOFT: i64 = 49152
32const CL_NOTE_MAX: i64 = 200
33const CL_NAME_MAX: i64 = 120
47const CL_TTL_MAX: i64 = 86400

functions

49func cl_cat(d: *u8, o: i64, s: *u8) -> i64 { var p: i64=o; var i: i64=0; while s[i]!=(0 as u8){ d[p]=s[i]; p=p+1; i=i+1 } return p }
50func cl_catn(d: *u8, o: i64, v: i64) -> i64
62func cl_vlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
63func cl_atoi_z(s: *u8) -> i64 { var v: i64=0; var i: i64=0; while s[i]!=(0 as u8){ let c: i64=s[i] as i64; if c>=48 { if c<=57 { v=v*10+(c-48) } } i=i+1 } return v }
called by 1: main
64func cl_read(path: *u8, buf: *u8, cap: i64) -> i64
74func cl_append(journal: *u8, ts: i64, verb: *u8, res: *u8, actor: *u8, ttl: i64, note: *u8) -> i64
106func cl_le(q: *u8, i: i64, n: i64) -> i64
112func cl_col(q: *u8, ls: i64, le: i64, c: i64, out: *i64) -> i64
128func cl_lit_eq(q: *u8, s: i64, e: i64, lit: *u8) -> i64
134func cl_span_eq(q: *u8, s1: i64, e1: i64, s2: i64, e2: i64) -> i64
140func cl_atoi(q: *u8, s: i64, e: i64) -> i64
called by 1: cl_state
148func cl_state(q: *u8, cx: *i64, res_s: i64, res_e: i64, out: *i64) -> i64
205func cl_state_name(st: i64) -> *u8
212func cl_res_seen(q: *u8, upto: i64, r_s: i64, r_e: i64) -> i64
223func cl_res_span_lit(q: *u8, cx: *i64, res: *u8, out: *i64) -> i64
235func cl_note_span(q: *u8, cx: *i64, res_s: i64, res_e: i64, out: *i64) -> i64
252func cl_jesc(d: *u8, o: i64, q: *u8, s: i64, e: i64, maxb: i64) -> i64
266func cl_key(d: *u8, o: i64, name: *u8) -> i64
called by 2: cl_emit_rescl_walk_json calls 1: cl_cat
276func cl_qlit(d: *u8, o: i64, s: *u8) -> i64
called by 2: cl_emit_rescl_walk_json calls 1: cl_cat
283func cl_emit_res(d: *u8, o: i64, q: *u8, cx: *i64, r_s: i64, r_e: i64) -> i64
324func cl_walk_json(q: *u8, cx: *i64, d: *u8) -> i64
406func cl_hesc(d: *u8, o: i64, q: *u8, s: i64, e: i64, maxb: i64) -> i64
called by 1: cl_page_html calls 1: cl_cat
420func cl_page_html(q: *u8, cx: *i64, d: *u8) -> i64
504func cl_find(d: *u8, dn: i64, lit: *u8) -> i64
called by 1: cl_selftest calls 1: cl_vlen
522func cl_span_z(q: *u8, s: i64, e: i64, d: *u8, cap: i64) -> i64
called by 1: cl_reap
529func cl_reap(journal: *u8, q: *u8, cx: *i64, reaper: *u8, note: *u8) -> i64
593func cl_selftest(journal: *u8) -> i64
725func main(argc: i64, argv: *i64) -> i64