@rubytech/create-maxy-code 0.1.374 → 0.1.375

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/neo4j/schema.cypher +9 -4
  3. package/payload/platform/plugins/admin/.claude-plugin/plugin.json +1 -1
  4. package/payload/platform/plugins/admin/PLUGIN.md +7 -1
  5. package/payload/platform/plugins/admin/mcp/dist/index.js +43 -8
  6. package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
  7. package/payload/platform/plugins/admin/mcp/dist/tools/__tests__/account-lifecycle.test.js +50 -2
  8. package/payload/platform/plugins/admin/mcp/dist/tools/__tests__/account-lifecycle.test.js.map +1 -1
  9. package/payload/platform/plugins/admin/mcp/dist/tools/account-lifecycle.d.ts +17 -0
  10. package/payload/platform/plugins/admin/mcp/dist/tools/account-lifecycle.d.ts.map +1 -1
  11. package/payload/platform/plugins/admin/mcp/dist/tools/account-lifecycle.js +40 -1
  12. package/payload/platform/plugins/admin/mcp/dist/tools/account-lifecycle.js.map +1 -1
  13. package/payload/platform/plugins/scheduling/mcp/dist/index.js +1 -4
  14. package/payload/platform/plugins/scheduling/mcp/dist/index.js.map +1 -1
  15. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/booking-reconcile.test.js +18 -36
  16. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/booking-reconcile.test.js.map +1 -1
  17. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/ics-graph-ingest.test.d.ts +2 -0
  18. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/ics-graph-ingest.test.d.ts.map +1 -0
  19. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/ics-graph-ingest.test.js +153 -0
  20. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/ics-graph-ingest.test.js.map +1 -0
  21. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/meeting-write.test.js +11 -19
  22. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/meeting-write.test.js.map +1 -1
  23. package/payload/platform/plugins/scheduling/mcp/dist/lib/booking-reconcile.d.ts +0 -2
  24. package/payload/platform/plugins/scheduling/mcp/dist/lib/booking-reconcile.d.ts.map +1 -1
  25. package/payload/platform/plugins/scheduling/mcp/dist/lib/booking-reconcile.js +10 -17
  26. package/payload/platform/plugins/scheduling/mcp/dist/lib/booking-reconcile.js.map +1 -1
  27. package/payload/platform/plugins/scheduling/mcp/dist/lib/ics-graph-ingest.d.ts +13 -7
  28. package/payload/platform/plugins/scheduling/mcp/dist/lib/ics-graph-ingest.d.ts.map +1 -1
  29. package/payload/platform/plugins/scheduling/mcp/dist/lib/ics-graph-ingest.js +38 -33
  30. package/payload/platform/plugins/scheduling/mcp/dist/lib/ics-graph-ingest.js.map +1 -1
  31. package/payload/platform/plugins/scheduling/mcp/dist/lib/meeting-write.d.ts.map +1 -1
  32. package/payload/platform/plugins/scheduling/mcp/dist/lib/meeting-write.js +13 -19
  33. package/payload/platform/plugins/scheduling/mcp/dist/lib/meeting-write.js.map +1 -1
  34. package/payload/platform/plugins/whatsapp/PLUGIN.md +6 -4
  35. package/payload/platform/plugins/whatsapp/mcp/dist/index.js +31 -15
  36. package/payload/platform/plugins/whatsapp/mcp/dist/index.js.map +1 -1
  37. package/payload/platform/scripts/migrate-whatsapp-to-disk.mjs +115 -0
  38. package/payload/platform/scripts/seed-neo4j.sh +17 -0
  39. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
  40. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +2 -0
  41. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
  42. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  43. package/payload/platform/services/claude-session-manager/dist/http-server.js +21 -8
  44. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  45. package/payload/platform/services/claude-session-manager/dist/index.js +2 -2
  46. package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
  47. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +1 -1
  48. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
  49. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +1 -1
  50. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
  51. package/payload/platform/services/claude-session-manager/dist/rc-daemon.d.ts +1 -1
  52. package/payload/platform/services/claude-session-manager/dist/rc-daemon.d.ts.map +1 -1
  53. package/payload/platform/services/claude-session-manager/dist/rc-daemon.js +1 -1
  54. package/payload/platform/services/claude-session-manager/dist/rc-daemon.js.map +1 -1
  55. package/payload/server/public/assets/AdminLoginScreens-3vFueaZy.js +1 -0
  56. package/payload/server/public/assets/AdminShell-DvczcTdp.js +1 -0
  57. package/payload/server/public/assets/{Checkbox-BagcrE4Q.js → Checkbox-KbEWQEVU.js} +1 -1
  58. package/payload/server/public/assets/{admin-CodAEpgQ.js → admin-Cm1tZXbf.js} +1 -1
  59. package/payload/server/public/assets/{browser-CRTlI7ck.js → browser-C38YYs28.js} +1 -1
  60. package/payload/server/public/assets/{calendar-BBEivUAw.js → calendar-CCN9px9o.js} +1 -1
  61. package/payload/server/public/assets/chat-fj5J5aKV.js +1 -0
  62. package/payload/server/public/assets/data-D1EXeX7P.js +1 -0
  63. package/payload/server/public/assets/{graph-HoHcI7qv.js → graph-DGXKuRbL.js} +3 -3
  64. package/payload/server/public/assets/{graph-labels-BJfK0tbH.js → graph-labels-DYRDEL2l.js} +1 -1
  65. package/payload/server/public/assets/{operator-5wtImBoF.js → operator-Bhtayf9U.js} +1 -1
  66. package/payload/server/public/assets/{page-CzTgPTp3.js → page-BSMtFFmx.js} +5 -5
  67. package/payload/server/public/assets/{public-CUopv7Ro.js → public-DO_OqjJa.js} +1 -1
  68. package/payload/server/public/assets/{rotate-ccw-DttFB1nY.js → rotate-ccw-DQfsmjLr.js} +1 -1
  69. package/payload/server/public/assets/useSubAccountSwitcher-CSCcvysa.css +1 -0
  70. package/payload/server/public/assets/useSubAccountSwitcher-z8xhukFw.js +9 -0
  71. package/payload/server/public/browser.html +4 -4
  72. package/payload/server/public/calendar.html +4 -4
  73. package/payload/server/public/chat.html +6 -6
  74. package/payload/server/public/data.html +4 -4
  75. package/payload/server/public/graph.html +7 -7
  76. package/payload/server/public/index.html +6 -6
  77. package/payload/server/public/operator.html +8 -8
  78. package/payload/server/public/public.html +6 -6
  79. package/payload/server/server.js +1169 -964
  80. package/payload/server/public/assets/AdminLoginScreens-CGTA9noi.js +0 -1
  81. package/payload/server/public/assets/AdminShell-CNwb23_A.js +0 -1
  82. package/payload/server/public/assets/OperatorConversations-BX9t3jgm.css +0 -1
  83. package/payload/server/public/assets/OperatorConversations-CivR0bnD.js +0 -9
  84. package/payload/server/public/assets/chat-r1qKuzHk.js +0 -1
  85. package/payload/server/public/assets/data-BkY0bFYS.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubytech/create-maxy-code",
3
- "version": "0.1.374",
3
+ "version": "0.1.375",
4
4
  "description": "Install Maxy — AI for Productive People",
5
5
  "bin": {
6
6
  "create-maxy-code": "./dist/index.js"
@@ -15,15 +15,20 @@
15
15
  // Constraints
16
16
  // ----------------------------------------------------------
17
17
 
18
- // Person.email must be unique across all Person nodes.
18
+ // Person.email must be unique per account (Task 1304 — account scope is a
19
+ // property, not an edge, so email alone cannot be the natural key: two
20
+ // accounts can each hold a Person with the same email).
19
21
  // Allows multiple nulls — phone-only contacts are not affected.
22
+ DROP CONSTRAINT person_email_unique IF EXISTS;
20
23
  CREATE CONSTRAINT person_email_unique IF NOT EXISTS
21
- FOR (p:Person) REQUIRE p.email IS UNIQUE;
24
+ FOR (p:Person) REQUIRE (p.accountId, p.email) IS UNIQUE;
22
25
 
23
- // Person.telephone must be unique (phone-first channels: WhatsApp, SMS, Telegram)
26
+ // Person.telephone must be unique per account (phone-first channels:
27
+ // WhatsApp, SMS, Telegram). Composite for the same reason as email above.
24
28
  // Allows multiple nulls — email-only contacts are not affected.
29
+ DROP CONSTRAINT person_telephone_unique IF EXISTS;
25
30
  CREATE CONSTRAINT person_telephone_unique IF NOT EXISTS
26
- FOR (p:Person) REQUIRE p.telephone IS UNIQUE;
31
+ FOR (p:Person) REQUIRE (p.accountId, p.telephone) IS UNIQUE;
27
32
 
28
33
  // Service.serviceId must be unique within the Maxy account
29
34
  CREATE CONSTRAINT service_id_unique IF NOT EXISTS
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "admin",
3
- "description": "Platform administration plugin. Provides system-status, public-hostname (deterministic Cloudflare public-URL resolver, single call returning the operator's canonical hostname so agents never guess property names on :CloudflareHostname nodes), admin-hostname (the admin-host twin of public-hostname — resolves the host that serves /calendar and the rest of the admin shell behind sign-in from the same ingress + alias + operator files, so agents point the operator at the admin /calendar URL instead of the public host that 404s it), publish-site (move an extracted static-site tree under <accountDir>/sites/<slug>/, emit one canonical path slug, and refresh llms.txt at the site root — typed refusal taxonomy replaces the prior skill-prose contract), brand-settings, account-manage, capabilities-here (deterministic install-introspection — returns enabledPlugins, tier, models, installed platform + premium specialists, registered Claude Code agent types, and the brand block as a single JSON object; the canonical tool for grounding any claim about what is enabled on the current account), account-update, the multi-account managed-service lifecycle tools (account_list, account_create, account_delete, account_purge — one Rubytech operator hosting N client accounts on one house install; create/delete/purge are operator-only and purge is two-step with a typed confirmation), admin-add, admin-remove, admin-list, admin-update-pin, agent-list, agent-config-read, logs-read, plugin-read, skill-load (one-call resolve+read for SKILL.md by skill name, the canonical primitive for loading a named skill; plugin-read remains the reader for references/* and PLUGIN.md), skill-search (free-text intent → skill resolver: ranks every plugin skill's SKILL.md name+description against a query and returns the top owners with their canonical skills/<slug>/ path, so intent→skill mapping survives the available-skills menu leaving context after a compaction), store-skill (deterministic write counterpart to plugin-read; persists operator-authored skills as plugin files under the active account), session-reset, session-resume, wifi, and action-approval tools (action-pending, action-approve, action-reject, action-edit) for managing the Maxy platform.",
3
+ "description": "Platform administration plugin. Provides system-status, public-hostname (deterministic Cloudflare public-URL resolver, single call returning the operator's canonical hostname so agents never guess property names on :CloudflareHostname nodes), admin-hostname (the admin-host twin of public-hostname — resolves the host that serves /calendar and the rest of the admin shell behind sign-in from the same ingress + alias + operator files, so agents point the operator at the admin /calendar URL instead of the public host that 404s it), publish-site (move an extracted static-site tree under <accountDir>/sites/<slug>/, emit one canonical path slug, and refresh llms.txt at the site root — typed refusal taxonomy replaces the prior skill-prose contract), brand-settings, account-manage, capabilities-here (deterministic install-introspection — returns enabledPlugins, tier, models, installed platform + premium specialists, registered Claude Code agent types, and the brand block as a single JSON object; the canonical tool for grounding any claim about what is enabled on the current account), account-update, the multi-account managed-service lifecycle tools (account_list, account_create, account_delete, account_purge, account_channel_routing, account_channel_routing_set — one Rubytech operator hosting N client accounts on one house install; create/delete/purge are operator-only and purge is two-step with a typed confirmation; account_channel_routing_set repoints the install's single WhatsApp/Telegram inbound stream to a different sub-account), admin-add, admin-remove, admin-list, admin-update-pin, agent-list, agent-config-read, logs-read, plugin-read, skill-load (one-call resolve+read for SKILL.md by skill name, the canonical primitive for loading a named skill; plugin-read remains the reader for references/* and PLUGIN.md), skill-search (free-text intent → skill resolver: ranks every plugin skill's SKILL.md name+description against a query and returns the top owners with their canonical skills/<slug>/ path, so intent→skill mapping survives the available-skills menu leaving context after a compaction), store-skill (deterministic write counterpart to plugin-read; persists operator-authored skills as plugin files under the active account), session-reset, session-resume, wifi, and action-approval tools (action-pending, action-approve, action-reject, action-edit) for managing the Maxy platform.",
4
4
  "version": "0.1.0",
5
5
  "author": {
6
6
  "name": "Rubytech LLC"
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: admin
3
3
  surface: platform
4
- description: "Platform administration plugin. Provides system-status, public-hostname (deterministic Cloudflare public-URL resolver, single call returning the operator's canonical hostname so agents never guess property names on :CloudflareHostname nodes), admin-hostname (the admin-host twin of public-hostname — resolves the host that serves /calendar and the rest of the admin shell behind sign-in from the same ingress + alias + operator files, so agents point the operator at the admin /calendar URL instead of the public host that 404s it), publish-site (move an extracted static-site tree under <accountDir>/sites/<slug>/, emit one canonical path slug, and refresh llms.txt at the site root — typed refusal taxonomy replaces the prior skill-prose contract), brand-settings, account-manage, capabilities-here (deterministic install-introspection — returns enabledPlugins, tier, models, installed platform + premium specialists, registered Claude Code agent types, and the brand block as a single JSON object; the canonical tool for grounding any claim about what is enabled on the current account), account-update, the multi-account managed-service lifecycle tools (account_list, account_create, account_delete, account_purge — one Rubytech operator hosting N client accounts on one house install; create/delete/purge are operator-only and purge is two-step with a typed confirmation), admin-add, admin-remove, admin-list, admin-update-pin, agent-list, agent-config-read, logs-read, plugin-read, skill-load (one-call resolve+read for SKILL.md by skill name, the canonical primitive for loading a named skill; plugin-read remains the reader for references/* and PLUGIN.md), skill-search (free-text intent → skill resolver: ranks every plugin skill's SKILL.md name+description against a query and returns the top owners with their canonical skills/<slug>/ path, so intent→skill mapping survives the available-skills menu leaving context after a compaction), store-skill (deterministic write counterpart to plugin-read; persists operator-authored skills as plugin files under the active account), session-reset, session-resume, wifi, and action-approval tools (action-pending, action-approve, action-reject, action-edit) for managing the Maxy platform."
4
+ description: "Platform administration plugin. Provides system-status, public-hostname (deterministic Cloudflare public-URL resolver, single call returning the operator's canonical hostname so agents never guess property names on :CloudflareHostname nodes), admin-hostname (the admin-host twin of public-hostname — resolves the host that serves /calendar and the rest of the admin shell behind sign-in from the same ingress + alias + operator files, so agents point the operator at the admin /calendar URL instead of the public host that 404s it), publish-site (move an extracted static-site tree under <accountDir>/sites/<slug>/, emit one canonical path slug, and refresh llms.txt at the site root — typed refusal taxonomy replaces the prior skill-prose contract), brand-settings, account-manage, capabilities-here (deterministic install-introspection — returns enabledPlugins, tier, models, installed platform + premium specialists, registered Claude Code agent types, and the brand block as a single JSON object; the canonical tool for grounding any claim about what is enabled on the current account), account-update, the multi-account managed-service lifecycle tools (account_list, account_create, account_delete, account_purge, account_channel_routing, account_channel_routing_set — one Rubytech operator hosting N client accounts on one house install; create/delete/purge are operator-only and purge is two-step with a typed confirmation; account_channel_routing_set repoints the install's single WhatsApp/Telegram inbound stream to a different sub-account), admin-add, admin-remove, admin-list, admin-update-pin, agent-list, agent-config-read, logs-read, plugin-read, skill-load (one-call resolve+read for SKILL.md by skill name, the canonical primitive for loading a named skill; plugin-read remains the reader for references/* and PLUGIN.md), skill-search (free-text intent → skill resolver: ranks every plugin skill's SKILL.md name+description against a query and returns the top owners with their canonical skills/<slug>/ path, so intent→skill mapping survives the available-skills menu leaving context after a compaction), store-skill (deterministic write counterpart to plugin-read; persists operator-authored skills as plugin files under the active account), session-reset, session-resume, wifi, and action-approval tools (action-pending, action-approve, action-reject, action-edit) for managing the Maxy platform."
5
5
  tools:
6
6
  - name: system-status
7
7
  publicAllowlist: false
@@ -39,6 +39,12 @@ tools:
39
39
  - name: account_purge
40
40
  publicAllowlist: false
41
41
  adminAllowlist: true
42
+ - name: account_channel_routing
43
+ publicAllowlist: false
44
+ adminAllowlist: true
45
+ - name: account_channel_routing_set
46
+ publicAllowlist: false
47
+ adminAllowlist: true
42
48
  - name: admin-add
43
49
  publicAllowlist: false
44
50
  adminAllowlist: true
@@ -27,7 +27,7 @@ import { publishSite } from "./tools/publish-site.js";
27
27
  import { resolveCapabilitiesHere } from "./tools/capabilities-here.js";
28
28
  import { runCatalogueCensus } from "./lib/catalogue-census.js";
29
29
  import { lifelineTool } from "../../../../lib/mcp-lifeline/dist/index.js";
30
- import { listAccountsFromDir, isHouseAccount, archiveAccountDir, provisionClientAccount, ACCOUNT_NODE_COUNT_CYPHER, ACCOUNT_PURGE_CYPHER, } from "./tools/account-lifecycle.js";
30
+ import { listAccountsFromDir, isHouseAccount, archiveAccountDir, provisionClientAccount, findHouseAccount, getChannelRoutingAccountId, setChannelRoutingAccountId, ACCOUNT_NODE_COUNT_CYPHER, ACCOUNT_PURGE_CYPHER, } from "./tools/account-lifecycle.js";
31
31
  function refusalGuidance(kind) {
32
32
  switch (kind) {
33
33
  case "unsafe-slug":
@@ -3249,14 +3249,14 @@ eagerTool(server, "action-edit", "Edit a pending action's input and then execute
3249
3249
  // PLATFORM_ROOT rather than the per-session ACCOUNT_ID.
3250
3250
  // ---------------------------------------------------------------------------
3251
3251
  const ACCOUNTS_ROOT = resolve(PLATFORM_ROOT, "..", "data/accounts");
3252
- eagerTool(server, "account_list", "List every account on this install (one house + N clients) with its role. Managed-service operator tool — the active account drives which account a switched session reads and writes.", {}, async () => {
3252
+ eagerTool(server, "account_list", "List every sub-account on this install (one house + N clients) with its role. Managed-service operator tool — the active sub-account drives which account a switched session reads and writes.", {}, async () => {
3253
3253
  const accounts = listAccountsFromDir(ACCOUNTS_ROOT);
3254
3254
  const lines = accounts.map((a) => `${a.accountId} role=${a.role}${a.isHouse ? " (house)" : ""}`);
3255
3255
  return {
3256
3256
  content: [{ type: "text", text: accounts.length ? lines.join("\n") : "No accounts found." }],
3257
3257
  };
3258
3258
  });
3259
- eagerTool(server, "account_create", "Provision a new CLIENT account on this install (managed service). Mints a UUID, scaffolds the account directory (agents, specialists, settings, account.json with role:\"client\"), seeds default plugins, and adds you (the install owner) to the account's admins so you can switch to it. Returns the new accountId. Operator-only; never creates the house account (that is the install itself).", {}, async () => {
3259
+ eagerTool(server, "account_create", "Provision a new CLIENT sub-account on this install (managed service). Mints a UUID, scaffolds the account directory (agents, specialists, settings, account.json with role:\"client\"), seeds default plugins, and adds you (the install owner) to the sub-account's admins so you can switch to it. Returns the new accountId. Operator-only; never creates the house sub-account (that is the install itself).", {}, async () => {
3260
3260
  if (!ACCOUNT_ID)
3261
3261
  return refuseNoAccount("account_create");
3262
3262
  const newId = randomUUID();
@@ -3278,7 +3278,7 @@ eagerTool(server, "account_create", "Provision a new CLIENT account on this inst
3278
3278
  if (!dirExists) {
3279
3279
  return { content: [{ type: "text", text: `account_create FAILED: scaffold did not produce ${accountJson}` }], isError: true };
3280
3280
  }
3281
- return { content: [{ type: "text", text: `Created client account ${newId}. Switch to it from the account picker to work in its data.` }] };
3281
+ return { content: [{ type: "text", text: `Created client sub-account ${newId}. Switch to it from the sub-account picker to work in its data.` }] };
3282
3282
  }
3283
3283
  catch (err) {
3284
3284
  const msg = err instanceof Error ? err.message : String(err);
@@ -3286,7 +3286,7 @@ eagerTool(server, "account_create", "Provision a new CLIENT account on this inst
3286
3286
  return { content: [{ type: "text", text: `account_create FAILED: ${msg}` }], isError: true };
3287
3287
  }
3288
3288
  });
3289
- eagerTool(server, "account_delete", "Archive a CLIENT account: move its directory to data/accounts/.trash/ so it no longer appears in the account list. Graph data is RETAINED — run account_purge with the typed confirmation to irreversibly delete it. Refuses to archive the house account. Pass the accountId to archive.", {
3289
+ eagerTool(server, "account_delete", "Archive a CLIENT sub-account: move its directory to data/accounts/.trash/ so it no longer appears in the sub-account list. Graph data is RETAINED — run account_purge with the typed confirmation to irreversibly delete it. Refuses to archive the house sub-account. Pass the accountId to archive.", {
3290
3290
  accountId: z.string().describe("The client accountId (UUID) to archive."),
3291
3291
  }, async ({ accountId }) => {
3292
3292
  if (!ACCOUNT_ID)
@@ -3295,7 +3295,7 @@ eagerTool(server, "account_delete", "Archive a CLIENT account: move its director
3295
3295
  return { content: [{ type: "text", text: `account_delete: ${accountId} is not a registered account on this install.` }], isError: true };
3296
3296
  }
3297
3297
  if (isHouseAccount(ACCOUNTS_ROOT, accountId)) {
3298
- return { content: [{ type: "text", text: `account_delete refused: ${accountId} is the house account and cannot be archived.` }], isError: true };
3298
+ return { content: [{ type: "text", text: `account_delete refused: ${accountId} is the house sub-account and cannot be archived.` }], isError: true };
3299
3299
  }
3300
3300
  const ts = new Date().toISOString().replace(/[:.]/g, "").replace(/-/g, "");
3301
3301
  try {
@@ -3308,14 +3308,14 @@ eagerTool(server, "account_delete", "Archive a CLIENT account: move its director
3308
3308
  return { content: [{ type: "text", text: `account_delete FAILED: ${msg}` }], isError: true };
3309
3309
  }
3310
3310
  });
3311
- eagerTool(server, "account_purge", "IRREVERSIBLY delete every graph node carrying an account's accountId (DETACH DELETE). Two-step safety: account_delete archives first; this purges. Requires a typed confirmation equal to the accountId itself — any mismatch refuses. Refuses the house account. Returns the node count before and after (after must be zero).", {
3311
+ eagerTool(server, "account_purge", "IRREVERSIBLY delete every graph node carrying a sub-account's accountId (DETACH DELETE). Two-step safety: account_delete archives first; this purges. Requires a typed confirmation equal to the accountId itself — any mismatch refuses. Refuses the house sub-account. Returns the node count before and after (after must be zero).", {
3312
3312
  accountId: z.string().describe("The accountId (UUID) whose graph data to purge."),
3313
3313
  confirm: z.string().describe("Type the accountId exactly to confirm the irreversible purge."),
3314
3314
  }, async ({ accountId, confirm }) => {
3315
3315
  if (!ACCOUNT_ID)
3316
3316
  return refuseNoAccount("account_purge");
3317
3317
  if (isHouseAccount(ACCOUNTS_ROOT, accountId)) {
3318
- return { content: [{ type: "text", text: `account_purge refused: ${accountId} is the house account.` }], isError: true };
3318
+ return { content: [{ type: "text", text: `account_purge refused: ${accountId} is the house sub-account.` }], isError: true };
3319
3319
  }
3320
3320
  if (confirm !== accountId) {
3321
3321
  return { content: [{ type: "text", text: `account_purge refused: confirmation does not match the accountId. Type the accountId exactly to confirm.` }], isError: true };
@@ -3341,6 +3341,41 @@ eagerTool(server, "account_purge", "IRREVERSIBLY delete every graph node carryin
3341
3341
  await session.close();
3342
3342
  }
3343
3343
  });
3344
+ eagerTool(server, "account_channel_routing", "Reports which sub-account WhatsApp/Telegram inbound currently attaches to on this install. There is exactly one WhatsApp number per install (not one per sub-account) — this is the single install-wide routing target, defaulting to the house sub-account.", {}, async () => {
3345
+ const house = findHouseAccount(ACCOUNTS_ROOT);
3346
+ if (!house) {
3347
+ return { content: [{ type: "text", text: "account_channel_routing: no house account found on this install." }], isError: true };
3348
+ }
3349
+ const target = getChannelRoutingAccountId(ACCOUNTS_ROOT) ?? house.accountId;
3350
+ const isDefault = target === house.accountId;
3351
+ return {
3352
+ content: [{ type: "text", text: `WhatsApp/Telegram inbound currently routes to: ${target}${isDefault ? " (house, default)" : ""}` }],
3353
+ };
3354
+ });
3355
+ eagerTool(server, "account_channel_routing_set", "Repoints the single install-wide WhatsApp/Telegram inbound stream to the given sub-account. Refuses an accountId that is not a registered sub-account on this install. Takes effect on the next inbound message — no restart needed.", {
3356
+ accountId: z.string().describe("The sub-account UUID to route WhatsApp/Telegram inbound to."),
3357
+ }, async ({ accountId }) => {
3358
+ if (!ACCOUNT_ID)
3359
+ return refuseNoAccount("account_channel_routing_set");
3360
+ const known = listAccountsFromDir(ACCOUNTS_ROOT);
3361
+ if (!known.some((a) => a.accountId === accountId)) {
3362
+ return { content: [{ type: "text", text: `account_channel_routing_set refused: ${accountId} is not a registered sub-account on this install.` }], isError: true };
3363
+ }
3364
+ const house = findHouseAccount(ACCOUNTS_ROOT);
3365
+ if (!house) {
3366
+ return { content: [{ type: "text", text: "account_channel_routing_set FAILED: no house account found on this install." }], isError: true };
3367
+ }
3368
+ const previous = getChannelRoutingAccountId(ACCOUNTS_ROOT) ?? house.accountId;
3369
+ try {
3370
+ setChannelRoutingAccountId(ACCOUNTS_ROOT, accountId);
3371
+ process.stderr.write(`[platform-account-id] op=repoint from=${previous.slice(0, 8)} to=${accountId.slice(0, 8)}\n`);
3372
+ return { content: [{ type: "text", text: `WhatsApp/Telegram inbound now routes to ${accountId}.` }] };
3373
+ }
3374
+ catch (err) {
3375
+ const msg = err instanceof Error ? err.message : String(err);
3376
+ return { content: [{ type: "text", text: `account_channel_routing_set FAILED: ${msg}` }], isError: true };
3377
+ }
3378
+ });
3344
3379
  // Cleanup on exit (SIGTERM for systemd service stops on Pi)
3345
3380
  const cleanup = async () => {
3346
3381
  await closeDriver();