nx_vizsla_tool_register.nx source
↩ module page · 92 lines · 7525 B
1// nx_vizsla_tool_register.nx -- register the VIZSLA personal-assistant coordination capabilities into the
2// sovereign tool registry (operator 2026-07-08: "we need to get these to mcp level apis"). The registry IS
3// what /api/tools + /mcp tools/list serve, so registration = discoverability for any MCP client / agent.
4// RUNNABLE is the separate fail-closed layer: tool_allowlist.conf GREEN rows (added 2026-07-08) + cap token
5// -- proven by nx_vizsla_mcp_gate over the same tea_* execution path /mcp tools/call uses.
6// Idempotent (reg_put additive, history kept). Verifies by READBACK, not by claim. Mirrors
7// nx_genui_tool_register. expect_exit: 0 license_tier: ORIGINAL
8import "nx_tool_registry.nx"
9
10func vt_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 vt_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}
22
23func vt_reg1(name: *u8, desc: *u8, invoke: *u8, status: *u8) -> i64 {
24 let w: i64 = tool_register(name, desc, invoke, status)
25 let p: *i64 = sys_mmap(8) as *i64
26 let l: *i64 = sys_mmap(8) as *i64
27 let g: i64 = tool_get(name, p, l)
28 vt_puts(" "); vt_puts(name); vt_puts(" put-rc="); vt_putn(w); vt_puts(" readback=")
29 if g == 1 { if l[0] > 0 {
30 vt_puts("OK len="); vt_putn(l[0]); vt_puts("\n")
31 return 1
32 } }
33 vt_puts("MISSING -- REGISTER FAILED\n")
34 return 0
35}
36
37func main() -> i64 {
38 vt_puts("=== nx_vizsla_tool_register -- PA coordination capabilities into the discovery registry (knowledge/toolreg-) ===\n")
39 var ok: i64 = 0
40 ok = ok + vt_reg1("vizsla_calendar" as *u8,
41 "personal + group calendar on the tamper-evident CID plane: events, RRULE recurrence incl YEARLY birthdays (Feb-29 clamp), day free/busy, windowed expand, conflict naming" as *u8,
42 "argv: load <file> <prefix> [segid] | day <prefix> <date> | expand <prefix> <from> <to> | conflicts <prefix> <from> <to>" as *u8,
43 "GREEN (nx_vizsla_calendar_gate 11/11 + rec 15/15 + conflict 8/8)" as *u8)
44 ok = ok + vt_reg1("vizsla_ics" as *u8,
45 "RFC 5545 iCalendar EXPORT of the calendar store: CRLF, 75-octet folding, TEXT escaping, stable UIDs, native RRULE passthrough incl YEARLY -- subscribable by Google/Apple/Outlook, deterministic bytes" as *u8,
46 "argv: export <prefix> <from> <to> <out.ics>" as *u8,
47 "GREEN (nx_vizsla_ics_gate 14/14)" as *u8)
48 ok = ok + vt_reg1("vizsla_group" as *u8,
49 "group coordination: FIND-A-TIME (free/busy intersection across member calendar stores incl recurrences -> maximal candidate windows) + slot POLLS (latest-vote-wins tally); member calendars never leave the machine" as *u8,
50 "argv: load <file> <prefix> [segid] | findtime <prefix> <gid> <from> <to> <dur> [earliest latest] | tally <prefix> <pid>" as *u8,
51 "GREEN (nx_vizsla_group_gate 15/15)" as *u8)
52 ok = ok + vt_reg1("vizsla_plan" as *u8,
53 "friend-group planner with PMP mechanics: Eisenhower priority (CONF bands), dependency DAG + loud cycles, CRITICAL PATH, milestones, and timeblock = ready tasks first-fit into real calendar free windows" as *u8,
54 "argv: load <file> <prefix> [segid] | board <prefix> <plan> <today> | timeblock <prefix> <plan> <calprefix> <date> [earliest latest]" as *u8,
55 "GREEN (nx_vizsla_plan_gate 16/16)" as *u8)
56 ok = ok + vt_reg1("vizsla_venue" as *u8,
57 "venue find+hire pipeline: REQ capacity/budget fit-scoring, additive stage history (found->contacted->quoted->visited->booked/rejected), booked venue emits the exact calendar EVENT row" as *u8,
58 "argv: load <file> <prefix> [segid] | board <prefix> <event>" as *u8,
59 "GREEN (nx_vizsla_venue_gate 13/13 incl calendar-bridge composition)" as *u8)
60 ok = ok + vt_reg1("vizsla_remind" as *u8,
61 "birthday + important-event reminder engine: lead-day matching (leads are data e.g. 14,7,1,0) over calendar occurrences + contact birthdays, with a SENT-ONCE additive delivery ledger" as *u8,
62 "argv: due <calprefix|-> <contacts|-> <today> <leads> [sentprefix] | mark <sentprefix> <event|birthday> <id> <date> [segid]" as *u8,
63 "GREEN (nx_vizsla_remind_gate 14/14)" as *u8)
64 ok = ok + vt_reg1("vizsla_digest" as *u8,
65 "the ENGAGEMENT-PARTNER daily brief: relationships to tend + notes + bills + today's calendar + due reminders + plan status + venue hunt in ONE deterministic report (every section optional via conf)" as *u8,
66 "argv: digest <digest.conf> <today>" as *u8,
67 "GREEN (nx_vizsla_digest_gate 14/14)" as *u8)
68 ok = ok + vt_reg1("vizsla_coord_page" as *u8,
69 "sovereign 0-JS first-party coordination page: renders the engagement digest (today/reminders/plan/venue + summary) with a fail-closed sovereignty scan (script/http/link/@import -> REFUSE)" as *u8,
70 "argv: coord <digest.conf> <today> <outfile> (also: page <base> <tid> <today> <outfile> for the relationships page)" as *u8,
71 "GREEN (nx_vizsla_coord_gate 6/6 + render 9/9 + serve 6/6)" as *u8)
72 ok = ok + vt_reg1("vizsla_doc" as *u8,
73 "never-lose DOCUMENT MANAGEMENT on the additive CID plane: versioned by construction (old bytes never destroyed), byte-exact round-trip, full history, rel-links to venue:/plan:/event: entities" as *u8,
74 "argv: put <prefix> <docid> <file> <doctype> <rel> <date> [segid] | get <prefix> <docid> <out> | history <prefix> <docid> | list <prefix> <rel|->" as *u8,
75 "GREEN (nx_vizsla_doc_gate 12/12)" as *u8)
76 ok = ok + vt_reg1("vizsla_notify" as *u8,
77 "OUTWARD DELIVERY -- reminders REACH you: on-site notification delivery (once-only additive ledger, surfaced first-party) + a valid RFC5322 email digest composed ready-to-submit; the external SMTP submit is operator-gated" as *u8,
78 "argv: deliver <notifprefix> <cal|-> <contacts|-> <today> <leads> [channel] | feed <notifprefix> <kind|-> | email <cal|-> <contacts|-> <today> <leads> <from> <to> <out.eml>" as *u8,
79 "GREEN (nx_vizsla_notify_gate 13/13)" as *u8)
80 ok = ok + vt_reg1("vizsla_docgen" as *u8,
81 "OFFICE DOCUMENT GENERATION: turn coordination fields (venue booking / plan / event) into a real Word .docx and FILE it in the versioned doc store (rel-linked, additive) -- the office+coordination+documents bridge, composes nx_docx" as *u8,
82 "argv: build <docprefix> <docid> <doctype> <rel> <date> <fieldsfile> [segid] (fieldsfile: line1=title, each line=a paragraph)" as *u8,
83 "GREEN (nx_vizsla_docgen_gate 9/9; cross-checked by nx_vizsla_doc get + nx_docx read)" as *u8)
84
85 vt_puts("registered+readback "); vt_putn(ok); vt_puts(" / 11\n")
86 vt_puts("RUNNABLE layer: tool_allowlist.conf carries GREEN fork-exec rows for all 9 (2026-07-08);\n")
87 vt_puts(" rich MCP annotations in knowledge/tool_schemas.conf; execution proven by nx_vizsla_mcp_gate\n")
88 vt_puts(" over the SAME tea_run_argv path /mcp tools/call uses. LIVE NAS registry flip = deploy step (operator-gated).\n")
89 if ok == 11 { vt_puts("verdict=GREEN (11 PA coordination capabilities discoverable over /api/tools + /mcp tools/list)\n"); sys_exit(0); return 0 }
90 vt_puts("verdict=RED\n")
91 sys_exit(1); return 1
92}