code wiki / (root) / nx_toolreg_reconcile_lib.nx

nx_toolreg_reconcile_lib.nx

buildroot/runtime/nx_toolreg_reconcile_lib.nx

30921 B546 linesdepth 7pulls 10 transitivereach 2 importersview sourcekind librarytopic toolreg
docsdependenciesstructsconstsfunctions

about

nx_toolreg_reconcile_lib.nx -- DISCOVERY RECONCILER, library half. Closes the WIRE class forever: every tool that is GREEN in tool_allowlist.conf (vetted + callable) but ABSENT from the discovery registry (toolreg -> tools/list) gets registered using ITS AUTHOR'S OWN schema row from knowledge/tool_schemas.conf -- no invented contracts. A tool with NO schema row is SKIPPED and reported (fail-closed: never register a contract-less tool). Idempotent by construction (tool_get first). Re-running after any future allowlist growth wires the newcomers -- the allowlist stays the SSOT and discovery reconciles to it, so the built-not-discoverable bucket cannot silently regrow. license_tier: ORIGINAL

dependencies 2 imports · 2 importers

nx_tool_registry.nx nx_vsz_watchdog_core.nx nx_toolreg_reconcile_lib.nx nx_toolreg_reconcile.nx nx_toolreg_reconcile_gate.nx

imports: nx_tool_registry.nxnx_vsz_watchdog_core.nx

imported by: nx_toolreg_reconcile.nxnx_toolreg_reconcile_gate.nx

structs

none

consts

12const RR_FILE_CAP: i64 = 262144 // allowlist/schemas read cap
13const RR_LINE_CAP: i64 = 4096 // one row (name/title/fields/desc)
14const RR_INV_CAP: i64 = 512 // generated invoke line
15const RR_TAB: i64 = 9 // '\t'
16const RR_NL: i64 = 10 // '\n'
17const RR_HASH: i64 = 35 // '#' (comment rows)
18const RR_C_REG: i64 = 0 // counts slot: newly registered
19const RR_C_ALREADY: i64 = 1 // counts slot: already discoverable
20const RR_C_NOSCHEMA: i64 = 2 // counts slot: skipped, no schema row (fail-closed)
21const RR_C_FAIL: i64 = 3 // counts slot: register call failed
22const RR_C_UPDATED: i64 = 4 // counts slot: stored description REWRITTEN from the author's schema
23const RR_C_SCAFFOLD: i64 = 5 // counts slot: row points at a STAGED .elf.new -- not a shipped tool
24const RR_C_NOAUTH: i64 = 6 // counts slot: REGISTERED but its tool_schemas.conf row is GONE
25const RR_C_DUPSCHEMA: i64 = 7 // counts slot: a NAME with more than one schema row
26const RR_COUNTS: i64 = 64 // counts buffer bytes
27const RR_COMMA: i64 = 44 // ',' join separator (name list)
28const RR_SPC: i64 = 32 // ' '
29const RR_SEP_LEN: i64 = 2 // ", " separator width
34const RR_DENY_PATH: *u8 = "knowledge/mcp/exposure_deny.txt"

functions

36func rr_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
44func rr_drift_name(kind: *u8, name: *u8) -> i64
51func rr_seq(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 }
66func rr_is_stagepath(line: *u8, ll: i64) -> i64
79func rr_f0(line: *u8, ll: i64, out: *u8) -> i64
88func rr_flast(line: *u8, ll: i64, out: *u8) -> i64
called by 1: rr_schema_desc
100func rr_rec_desc(rec: *u8, ln: i64, out: *u8) -> i64
called by 1: rr_run
120func rr_schema_desc(buf: *u8, n: i64, name: *u8, desc: *u8) -> i64
142func rr_invoke(name: *u8, inv: *u8) -> i64
called by 1: rr_run
157func rr_is_deny(name: *u8, db: *u8, dn: i64) -> i64
189func rr_dup_census(sb: *u8, sn: i64, dry: i64) -> i64
called by 1: rr_run calls 3: rr_f0rr_seqrr_drift_name
238func rr_allow_has(ab: *u8, an: i64, name: *u8, scratch: *u8) -> i64
called by 1: rr_missing_rows calls 2: rr_f0rr_seq
275func rr_missing_rows(allow_path: *u8, schemas_path: *u8, report: i64) -> i64
331func rr_run(prefix: *u8, allow_path: *u8, schemas_path: *u8, counts: *i64, dry: i64) -> i64
456func rr_reconcile(prefix: *u8, allow_path: *u8, schemas_path: *u8, counts: *i64) -> i64
called by 2: mainmain calls 1: rr_run
471func rr_drift(prefix: *u8, allow_path: *u8, schemas_path: *u8, counts: *i64) -> i64
called by 2: mainmain calls 1: rr_run
481func rr_no_schema_names(prefix: *u8, allow_path: *u8, schemas_path: *u8, out: *u8, outcap: i64) -> i64