code wiki / (root) / nx_project_tool_register.nx

nx_project_tool_register.nx source

↩ module page · 46 lines · 4473 B

1// nx_project_tool_register.nx -- register NISHI PROJECT into the sovereign tool registry (operator 2026-07-09: 2// "get beyond microsoft project and leantime ... work with my team and contractors ... getting it into our mcp apis"). 3// The registry IS what nishifamily.com/api/tools + /mcp tools/list serve, so registration = DISCOVERABILITY. 4// Mirrors nx_compare_tool_register: DISCOVERY here; the native /mcp tools/call execution row (tool_allowlist.conf) 5// + cap mint stay the separate fail-closed step. Writes the CWD registry (knowledge/toolreg-); flipping the LIVE 6// NAS registry = run this on the NAS (CWD nishihost). Idempotent. Verifies by READBACK, not claim. 7// expect_exit: 0 license_tier: ORIGINAL 8import "nx_tool_registry.nx" 9 10func pr_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 11func pr_putn(v: i64) -> i64 { 12 if v == 0 { sys_write(1, "0" as *u8, 1); return 0 } 13 var m: i64 = v 14 if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m } 15 let d: *u8 = sys_mmap(24); var k: i64 = 0 16 while m > 0 { d[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 17 let o: *u8 = sys_mmap(24); var i: i64 = 0 18 while i < k { o[i] = d[k - 1 - i]; i = i + 1 } 19 sys_write(1, o, k) 20 return 0 21} 22func pr_reg1(name: *u8, desc: *u8, invoke: *u8, status: *u8) -> i64 { 23 let w: i64 = tool_register(name, desc, invoke, status) 24 let p: *i64 = sys_mmap(8) as *i64 25 let l: *i64 = sys_mmap(8) as *i64 26 let g: i64 = tool_get(name, p, l) 27 pr_puts(" " as *u8); pr_puts(name); pr_puts(" put-rc=" as *u8); pr_putn(w); pr_puts(" readback=" as *u8) 28 if g == 1 { if l[0] > 0 { pr_puts("OK len=" as *u8); pr_putn(l[0]); pr_puts("\n" as *u8); return 1 } } 29 pr_puts("MISSING -- REGISTER FAILED\n" as *u8) 30 return 0 31} 32 33func main() -> i64 { 34 pr_puts("=== nx_project_tool_register -- Nishi Project (team + contractor PM) into the discovery registry ===\n" as *u8) 35 var ok: i64 = 0 36 ok = ok + pr_reg1("nishi_project" as *u8, 37 "the team + contractor PROJECT layer behind nishifamily.com/project -- beyond Microsoft Project and Leantime by construction: additive never-lose records on the sovereign seg-store (PROJ/MEMBER roster, ASSIGN reassignment latest-wins, LOG time entries, NOTE task discussion, BUDGET/COST money, WCONF work-day config), FAIL-CLOSED role-scoped views (owner/team see all, a contractor sees ONLY their own tasks/notes/logs, non-member DENIED), task states from real dependency records (READY/BLOCKED/DONE via the gated nx_vizsla_plan tsk:/don: plane -- one substrate), workload vs data-driven capacity, CLOSED-LOOP auto-leveling (suggest AND apply as durable ASSIGN records), risk register with chain-slack delay prediction, integer EVM (scope/EV/CPI permil), per-person timesheets, blueprint templates that emit dated task files, and an organ-emitted 0-JS page (tasks + risk + latest-safe gantt + timesheet + notes) serving the LIVE OPAQUE portal /project (picker + per-project pages + cross-project 403, supervised self-healing)." as *u8, 38 "over /mcp: tools/call name=nishi_project arguments={argv:[...]} -- argv forms: [load,<file>,<prefix>,<segid>] . [view,<prefix>,<pid>,<person>] . [workload,<prefix>,<pid>] . [level,<prefix>,<pid>] or [level,<prefix>,<pid>,apply,<date>] . [risk,<prefix>,<pid>,<today>] . [evm,<prefix>,<pid>] . [timesheet,<prefix>,<pid>] . [notes,<prefix>,<pid>,<tid>] . [template,<tplfile>,<pid>,<startdate>,<outfile>] . [html,<prefix>,<pid>,<person>,<today>,<outfile|->]. Store prefixes path-guarded to knowledge/project/ (dot-dot refused). Task records load via vizsla_plan into the same prefix (plan == pid)." as *u8, 39 "GREEN (nx_project_gate 27/27 first-compile incl ASSIGN latest-wins, level-apply E2E, risk/EVM/timesheet/template KATs, scoped-notes html, path-guard + loud negatives; serve gate 13/13 with REAL OPAQUE tokens; live /project portal supervised + self-healing)" as *u8) 40 pr_puts("registered+readback " as *u8); pr_putn(ok); pr_puts(" / 1\n" as *u8) 41 pr_puts("NOTE: writes the CWD registry (knowledge/toolreg-). Run on the NAS (CWD nishihost) to flip the LIVE\n" as *u8) 42 pr_puts(" nishifamily.com/api/tools registry. Native /mcp tools/call execution = the allowlist + cap step.\n" as *u8) 43 if ok == 1 { pr_puts("verdict=GREEN (Nishi Project discoverable in the sovereign tool surface)\n" as *u8); sys_exit(0); return 0 } 44 pr_puts("verdict=RED\n" as *u8) 45 sys_exit(1); return 1 46}