code wiki / (root) / nx_toolreg_reconcile_lib.nx

nx_toolreg_reconcile_lib.nx

buildroot/runtime/nx_toolreg_reconcile_lib.nx

13861 B268 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_COUNTS: i64 = 64 // counts buffer bytes
24const RR_COMMA: i64 = 44 // ',' join separator (name list)
25const RR_SPC: i64 = 32 // ' '
26const RR_SEP_LEN: i64 = 2 // ", " separator width
31const RR_DENY_PATH: *u8 = "knowledge/mcp/exposure_deny.txt"

functions

33func rr_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
34func 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 }
36func rr_f0(line: *u8, ll: i64, out: *u8) -> i64
45func rr_flast(line: *u8, ll: i64, out: *u8) -> i64
called by 1: rr_schema_desc
57func rr_rec_desc(rec: *u8, ln: i64, out: *u8) -> i64
called by 1: rr_run
77func rr_schema_desc(buf: *u8, n: i64, name: *u8, desc: *u8) -> i64
99func rr_invoke(name: *u8, inv: *u8) -> i64
called by 1: rr_run
114func rr_is_deny(name: *u8, db: *u8, dn: i64) -> i64
137func rr_run(prefix: *u8, allow_path: *u8, schemas_path: *u8, counts: *i64, dry: i64) -> i64
212func rr_reconcile(prefix: *u8, allow_path: *u8, schemas_path: *u8, counts: *i64) -> i64
called by 2: mainmain calls 1: rr_run
217func rr_drift(prefix: *u8, allow_path: *u8, schemas_path: *u8, counts: *i64) -> i64
called by 2: mainmain calls 1: rr_run
227func rr_no_schema_names(prefix: *u8, allow_path: *u8, schemas_path: *u8, out: *u8, outcap: i64) -> i64