code wiki / (root) / nx_treatment_lib.nx

nx_treatment_lib.nx

buildroot/runtime/nx_treatment_lib.nx

16158 B372 linesdepth 2pulls 2 transitivereach 35 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_treatment_lib.nx -- THE ONE TREATMENT RULER (ecosystem EC49, 2026-09-16): every capability gets the three-step treatment -- a PRIMITIVE reachable on the MCP and API surfaces, a WORKFLOW that composes it, an AGENT beat that runs it -- and a board declares that treatment per rung as DATA the ranker judges. WHY. Operator 2026-09-16: "make sure its mandatory that they get mcp and api and composable primitives and workflows and agent treatment in our 1 2 3 step process". A rule a seat must remember is adopted at advice rates; a ruler in the ranker is adopted at 100 percent, the same way the bar-age and ladder rulers were placed. ROW (7 fields, on <domain>.plan): treat|<rung>|mcp=<row>|api=<route>|prim=<lib>|wf=<planid>|agent=<row> mcp the tool_allowlist.conf row (the MCP surface) the rung's organ answers to; verified against the allowlist api the API route the row is reached through (the MCP surface IS the API: /api/tools/call name=<row>, /mcp); verified as: declared AND its mcp row verified, since the route is the registered row prim the composable primitive (the lib the organ composes) -- the caller verifies the source exists wf the plan_run plan id whose rows compose the primitive (knowledge/store/plan-<id>-) -- caller verifies agent the beat that runs it: a clockjobs-/clocksched- row name or a gateroster.conf row; verified against both a value of - is MISSING; a declared value the check cannot find is ABSENT; a value the check cannot judge is DECLARED (the caller passed no evidence for that field) -- three negatives, never one word. VERDICT per row: COMPLETE (five fields PRESENT) | PARTIAL (any field MISSING or ABSENT, named) | FIELDS (a malformed row). Per board: TREATED (every treat row COMPLETE) | PARTIAL (a declared row unmet: the hard fail, like a stale bar) | NO-TREATMENT (no treat rows: LABELED, the board opts in by declaring its first). Rungs with no treat row are counted UNDECLARED and named, never refused: opting in is per rung. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 5 importers

nx_syscalls.nx nx_treatment_lib.nx nx_compare_rank.nx nx_rungclose.nx nx_swcompare_lib.nx nx_treatment.nx nx_treatment_gate.nx

imports: nx_syscalls.nx

imported by: nx_compare_rank.nxnx_rungclose.nxnx_swcompare_lib.nxnx_treatment.nxnx_treatment_gate.nx

structs

none

consts

26const TRT_I64: i64 = 8
27const TRT_STRIDE: i64 = 24
28const TRT_RUNG_O: i64 = 0
29const TRT_RUNG_L: i64 = 1
30const TRT_MCP_O: i64 = 2
31const TRT_MCP_L: i64 = 3
32const TRT_API_O: i64 = 4
33const TRT_API_L: i64 = 5
34const TRT_PRIM_O: i64 = 6
35const TRT_PRIM_L: i64 = 7
36const TRT_WF_O: i64 = 8
37const TRT_WF_L: i64 = 9
38const TRT_AGENT_O: i64 = 10
39const TRT_AGENT_L: i64 = 11
40const TRT_ST_MCP: i64 = 12
41const TRT_ST_API: i64 = 13
42const TRT_ST_PRIM: i64 = 14
43const TRT_ST_WF: i64 = 15
44const TRT_ST_AGENT: i64 = 16
45const TRT_VERDICT: i64 = 17
46const TRT_NF: i64 = 18
47const TRT_LINE: i64 = 19
48const TRT_TAG: *u8 = "treat"
49const TRT_NF_ROW: i64 = 7
50const TRT_F_RUNG: i64 = 1
51const TRT_F_MCP: i64 = 2
52const TRT_F_API: i64 = 3
53const TRT_F_PRIM: i64 = 4
54const TRT_F_WF: i64 = 5
55const TRT_F_AGENT: i64 = 6
56const TRT_MIN_ROW: i64 = 30 // "treat|r|mcp=|api=|prim=|wf=|agent=" plus a newline: the shortest well-formed row
58const TRT_F_MISSING: i64 = 0
59const TRT_F_PRESENT: i64 = 1
60const TRT_F_DECLARED: i64 = 2
61const TRT_F_ABSENT: i64 = 3
63const TRT_V_COMPLETE: i64 = 0
64const TRT_V_PARTIAL: i64 = 1
65const TRT_V_FIELDS: i64 = 2
67const TRT_EXIT_TREATED: i64 = 0
68const TRT_EXIT_PARTIAL: i64 = 1
69const TRT_EXIT_NONE: i64 = 3
71const TRT_C_ROWS: i64 = 0
72const TRT_C_COMPLETE: i64 = 1
73const TRT_C_PARTIAL: i64 = 2
74const TRT_C_FIELDS: i64 = 3
75const TRT_C_RUNGS: i64 = 4
76const TRT_C_UNDECLARED: i64 = 5
77const TRT_C_SLOTS: i64 = 8
78const TRT_CH_PIPE: i64 = 124
79const TRT_CH_NL: i64 = 10
80const TRT_CH_TAB: i64 = 9
81const TRT_CH_DASH: i64 = 45
82const TRT_CH_EQ: i64 = 61
83const TRT_CH_HASH: i64 = 35
84const TRT_CH_SEMI: i64 = 59
85const TRT_CH_COMMA: i64 = 44
86const TRT_RUNG_TAG: *u8 = "rung"
87const TRT_GREEN: *u8 = "GREEN"

functions

89func trt_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
90func trt_cap(bytes: i64) -> i64 { return bytes / TRT_MIN_ROW + 1 }
92func trt_line_end(buf: *u8, n: i64, p: i64) -> i64
102func trt_field(buf: *u8, p: i64, e: i64, k: i64, off: *i64) -> i64
117func trt_nfields(buf: *u8, p: i64, e: i64) -> i64
called by 1: trt_scan
124func trt_span_is(buf: *u8, off: i64, len: i64, lit: *u8) -> i64
called by 2: trt_scantrt_census calls 1: trt_slen
132func trt_kv(buf: *u8, off0: i64, len: i64, key: *u8, off: *i64) -> i64
called by 1: trt_take calls 1: trt_slen
141func trt_value_state(buf: *u8, off: i64, len: i64) -> i64
called by 1: trt_take
147func trt_take(buf: *u8, p: i64, e: i64, k: i64, key: *u8, tab: *i64, b: i64, oslot: i64, lslot: i64, sslot: i64, off: *i64) -> i64
159func trt_scan(buf: *u8, n: i64, tab: *i64, cap: i64) -> i64
196func trt_text_has_row(text: *u8, tn: i64, buf: *u8, noff: i64, nlen: i64) -> i64
called by 1: trt_judge_row calls 1: trt_line_end
216func trt_allow_has(allow: *u8, an: i64, buf: *u8, noff: i64, nlen: i64) -> i64
246func trt_judge_row(tab: *i64, r: i64, buf: *u8, allow: *u8, an: i64, roster: *u8, rn: i64, clock: *u8, cn: i64, prim_ok: i64, wf_ok: i64) -> i64
276func trt_find(tab: *i64, rows: i64, buf: *u8, rid: *u8) -> i64
called by 4: mainrp_evalmaintrt_census calls 1: trt_slen
293func trt_census(tab: *i64, rows: i64, plan: *u8, pn: i64, c: *i64) -> i64
323func trt_partition_sum(c: *i64) -> i64 { return c[TRT_C_COMPLETE] + c[TRT_C_PARTIAL] + c[TRT_C_FIELDS] }
called by 3: mainmainmain
324func trt_verdict(c: *i64) -> i64
329func trt_state_name(s: i64) -> *u8
335func trt_verdict_name(v: i64) -> *u8
340func trt_exit_name(v: i64) -> *u8
346func trt_missing(tab: *i64, r: i64, dst: *u8, o: i64) -> i64
called by 3: mainmainmain calls 1: trt_state_name