@mosadd/mcp 3.0.0-alpha.54 → 3.0.0-alpha.55

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 (51) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +150 -150
  3. package/dist/bin/mcp.js +1 -1
  4. package/dist/{chunk-3PUOM4R5.js → chunk-IWUGKLDX.js} +54 -20
  5. package/dist/index.js +1 -1
  6. package/package.json +1 -1
  7. package/src/__tests__/blob-upload.test.ts +93 -93
  8. package/src/__tests__/channel-e2ee.test.ts +62 -62
  9. package/src/__tests__/flota-jawnie.test.ts +244 -0
  10. package/src/__tests__/golden-path.test.ts +139 -139
  11. package/src/__tests__/integration.test.ts +182 -182
  12. package/src/__tests__/mdm-e2ee.test.ts +212 -212
  13. package/src/__tests__/mdm-mcp-readable.test.ts +390 -386
  14. package/src/__tests__/mirc-invite.test.ts +112 -112
  15. package/src/__tests__/mtalk.test.ts +122 -122
  16. package/src/__tests__/server.test.ts +71 -71
  17. package/src/__tests__/tool-count-consistency.test.ts +199 -199
  18. package/src/bin/login.ts +138 -138
  19. package/src/bin/mcp.ts +145 -145
  20. package/src/config.ts +66 -66
  21. package/src/crypto/channel-e2ee.ts +288 -288
  22. package/src/crypto/mdm-session.ts +842 -842
  23. package/src/index.ts +19 -19
  24. package/src/observability/sentry.ts +79 -79
  25. package/src/providers/memory-voice.ts +79 -79
  26. package/src/providers/supabase-dm.ts +202 -202
  27. package/src/providers/supabase-voice.ts +91 -91
  28. package/src/server.ts +195 -195
  29. package/src/tools/actions.ts +166 -166
  30. package/src/tools/attachments.ts +276 -276
  31. package/src/tools/capabilities.ts +70 -70
  32. package/src/tools/channel-payload.ts +69 -0
  33. package/src/tools/embed.ts +110 -110
  34. package/src/tools/index.ts +181 -181
  35. package/src/tools/knowledge.ts +344 -344
  36. package/src/tools/mail-aliases.ts +25 -25
  37. package/src/tools/mail-provenance.ts +137 -137
  38. package/src/tools/mail.ts +403 -403
  39. package/src/tools/mdm-as-agent.ts +126 -126
  40. package/src/tools/mdm.ts +26 -11
  41. package/src/tools/mirc-edge.ts +196 -196
  42. package/src/tools/mirc-members.ts +287 -287
  43. package/src/tools/mirc-messages.ts +9 -13
  44. package/src/tools/mirc.ts +308 -308
  45. package/src/tools/mroom-messages.ts +4 -12
  46. package/src/tools/mroom.ts +221 -221
  47. package/src/tools/mtalk.ts +131 -131
  48. package/src/tools/presence.ts +442 -442
  49. package/src/tools/voice-format.ts +28 -28
  50. package/src/types.ts +121 -121
  51. package/src/voice/floor.ts +132 -132
@@ -1,181 +1,181 @@
1
- /**
2
- * Tool registry. Each m* module contributes a set of tools.
3
- *
4
- * User-facing modules (4): mDM, mIRC, mURL, mAYL — the re-arch (LINEAR-3938)
5
- * mAYL replaces the old mp0st name (mp0st_* still registered as back-compat
6
- * aliases via mail-aliases.ts; will be removed in a later alpha).
7
- *
8
- * Capabilities (not modules — cross-cutting agent tooling): mRAG, comms_.
9
- * mTALK = voice tier inside mIRC, still its own tools for now; folding into
10
- * mIRC_voice_* in a follow-up release. threat_* (threat_catalog + threat_classify)
11
- * are REGISTERED (2026-07-15, founder directive + LINEAR-3498): pure/offline
12
- * defensive classification over the threat taxonomy — the surveillance-era
13
- * *marketing* was killed, the classification engine is real and wanted.
14
- *
15
- * 85 callable tools registered — the exact live count is exported as TOOL_COUNT
16
- * (= allTools.length) below; ALWAYS reference that, never re-hard-code a number that drifts.
17
- * Breakdown (2026-09-03, from allTools in this tree; the live tools/list on mcp.mosadd.com catches up
18
- * when the alpha carrying mIRC_invite is published and the gateway redeployed):
19
- * modules mDM 16 · mIRC 25 · mURL 7 · mAYL 16 = 64; capabilities mTALK 6 · mRAG 8 ·
20
- * comms 5 (action_create/action_frame_get/embed_create/capabilities/session_attach) · Irondome/threat 2
21
- * = 21. 64 + 21 = 85. (mIRC 25 = 24 + mIRC_invite added 2026-09-03 (LINEAR-5870): mIRC_join adds the KEY's
22
- * identity while channel posts are signed by the AGENT, so every channel created from the toolkit was mute
23
- * until its agent was added from the app — mIRC_invite wraps channel-members-manage `invite`: own agent →
24
- * auto_joined, anyone else → invite code. mDM 16 = 14 + mDM_send_as_agent/mDM_list_my_agents added 2026-08-17: an MCP key
25
- * is bound to a USER, so an agent runtime wired up with its owner's key spoke AS THE OWNER — these
26
- * let it speak as an agent it OWNS instead, checked server-side. mRAG 8 = 4 search/ingest + 4 mRAG_graph_* traversal tools added 2026-08-11.
27
- * comms_session_attach added 2026-08-14: a live agent session claims the account's reply lane so
28
- * the cloud stand-in defers to it — the front door that used to be a script on one PC.)
29
- * (History of this line drifting: the 2026-07-17 breakdown ended "= 69"
30
- * — wrong twice over, its own terms summed to 71; the 07-30 rewrite said 73 and still had
31
- * mAYL at 12 after mAYL_send_as_agent had been re-registered, so it stayed wrong through the
32
- * four mAYL_agentbox_* tools landing on 08-06. Arithmetic in comments drifts; TOOL_COUNT
33
- * doesn't — and since 08-11 the anti-drift gate checks the PER-MODULE numbers too, not just
34
- * the total, so this comment cannot rot alone any more.)
35
- * (mDM/mIRC each include their 2 attachment tools from attachments.ts.)
36
- * Modules (4): mDM, mIRC, mURL, mAYL. Capabilities: mTALK (voice/PTT), mRAG, comms_, Irondome (threat_*).
37
- * mp0st_* stay as DEPRECATED back-compat aliases for mAYL_* (removed in a later alpha).
38
- * mAYL_send_as_agent + mTALK_ingest_ptt were RE-REGISTERED 2026-07-29: both had been disabled
39
- * on 07-14 notes that had since become false, and both were re-verified on authenticated calls.
40
- * comms_embed_create RE-REGISTERED 2026-07-17 (embed.mosadd.com/v1.js live — P3 of mURL→mIRC).
41
- * mROOM was KILLED (LINEAR-3414, channel re-cut → ephemeral private mIRC): its tools
42
- * live in tools/mroom.ts + mroom-messages.ts but are NOT registered here.
43
- * Plus action links: comms_action_create (agent → user one-link browser action,
44
- * incl. screen_share) + comms_action_frame_get (see the recipient's shared screen).
45
- * mURL is a FULL registered dev module (revived, founder 2026-06-27) — IRC-for-URLs,
46
- * agent-native; backends live (mosadd-edge + murl-channels EF). tools/murl.ts.
47
- * mURL now has full lifecycle: read/post/presence/list_channels (hub-key) PLUS owner-side
48
- * create/claim + update(branding/status) + delete (mURL_create/update/delete → murl-manage
49
- * EF, owner-scoped via user JWT — same auth as mURL_list_channels action='mine').
50
- * mCALL is carrier-pending (no telephony carrier live yet): its tools live in
51
- * tools/mcall.ts but are NOT registered here, so an agent only ever discovers
52
- * tools that actually work. Re-register the one line below when a carrier ships.
53
- */
54
-
55
- import type { MosaddTool } from "../types.js";
56
- import { mdmTools } from "./mdm.js";
57
- import { mdmAsAgentTools } from "./mdm-as-agent.js"; // mDM_send_as_agent + mDM_list_my_agents — 2026-08-17 (LINEAR-5620): a key is bound to a USER, so an agent runtime connected with its owner's key spoke AS THE OWNER and had no thread with him. These let that session speak as an agent it OWNS (verified server-side in mdm-send-as-agent).
58
- import { mdmVoiceTools } from "./mdm-voice.js";
59
- import { mircTools } from "./mirc.js";
60
- import { mircMembersTools } from "./mirc-members.js";
61
- import { mircMessagesTools } from "./mirc-messages.js";
62
- import { mircEdgeTools } from "./mirc-edge.js";
63
- // import { mroomTools } from "./mroom.js"; // mROOM: killed (LINEAR-3414) — not registered
64
- // import { mroomMessagesTools } from "./mroom-messages.js"; // mROOM: killed (LINEAR-3414) — not registered
65
- import { mailTools } from "./mail.js";
66
- // import { mailAliasTools } from "./mail-aliases.js"; // mp0st_* aliases RETIRED 2026-07-15 (founder: unify on mAYL, drop the mp0st codename from every user-visible surface). Source kept for reference.
67
- import { mailProvenanceTools } from "./mail-provenance.js"; // mAYL_send_as_agent — RE-REGISTERED 2026-07-29, see the note at the registry below
68
- import { mailAgentboxTools } from "./mail-agentbox.js"; // mAYL_agentbox_*: agent mints/lists/releases its OWN two-way disposable inbox (backs mayl-agentbox EF). Added 2026-08-06 (LINEAR-5201 Part B)
69
- import { mtalkTools } from "./mtalk.js";
70
- import { attachmentTools } from "./attachments.js";
71
- import { pttIngestTools } from "./ptt-ingest.js"; // mTALK_ingest_ptt — RE-REGISTERED 2026-07-29, see the note at the registry below
72
- // import { mcallTools } from "./mcall.js"; // mCALL: carrier-pending — not registered (see header note)
73
- import { knowledgeTools } from "./knowledge.js";
74
- import { knowledgeGraphTools } from "./knowledge-graph.js"; // mRAG_graph_* — 2026-08-11: MCP door onto the kg_* graph RPCs (traverse people/threads, not just search text)
75
- import { actionTools } from "./actions.js";
76
- import { presenceTools } from "./presence.js"; // comms_session_attach — 2026-08-14: a live agent session claims the account's reply lane (agent_bridge_heartbeat), so the cloud stand-in defers to it. Replaces the PC-only bridge script as the ONLY writer of that signal.
77
- import { embedTools } from "./embed.js"; // comms_embed_create RE-REGISTERED 2026-07-17: embed.mosadd.com/v1.js is LIVE (served by the mosadd Vercel project) — the widget + embed-keys/mirc-embed-token backend were already complete.
78
- import { threatTools } from "./threat.js"; // threat_*: RE-REGISTERED 2026-07-15 (founder directive + LINEAR-3498). Pure/offline classification of the real Pegasus-class threat taxonomy — the engine DECIDES, the caller acts; no surveillance, no backend.
79
- import { murlTools } from "./murl.js"; // mURL: REGISTERED — revived as a full dev module (founder 2026-06-27, re-arch). IRC-for-URLs, agent-native; backends live (mosadd-edge + murl-channels EF).
80
- import { makeCapabilitiesTool } from "./capabilities.js";
81
-
82
- /** The m* channel tools (everything except the meta discovery tool). */
83
- const channelTools: MosaddTool[] = [
84
- ...mdmTools,
85
- ...mdmAsAgentTools,
86
- ...mdmVoiceTools,
87
- ...mircTools,
88
- ...mircMembersTools,
89
- ...mircMessagesTools,
90
- ...mircEdgeTools,
91
- // ...mroomTools, // mROOM: killed (LINEAR-3414) — channel re-cut into ephemeral private mIRC
92
- // ...mroomMessagesTools, // mROOM: killed (LINEAR-3414)
93
- ...mailTools, // mAYL_*: canonical email module (was the mp0st codename; renamed re-arch 2026-06-27)
94
- // ...mailAliasTools, // mp0st_* aliases RETIRED 2026-07-15 — mAYL is the one name; the mp0st codename is now backend-internal only
95
- // ⭐ mAYL_send_as_agent: RE-REGISTERED 2026-07-29 — proven end to end, without sending mail.
96
- // Unregistered since 07-14 on the note "hub-claim EF 404s every call". That note was stale in
97
- // the same way ptt-ingest's was: unauthenticated it returns 401 (the auth gate), not 404.
98
- //
99
- // Settled by running the whole chain rather than the convenient half:
100
- // 1. hub-keys with a plain user JWT issued a real `mosadd_sk_live_…` — so a user session
101
- // mints a hub key and no founder credential was ever needed. I had told the founder it
102
- // required his key; that was wrong and this is the retraction.
103
- // 2. hub-claim-mint with that key → 200, valid claim token, aud `mp0st-send`, 600s expiry.
104
- // 3. mp0st-send with the claim token and a DELIBERATELY EMPTY payload → 400 "Missing to or
105
- // subject". A 400 on payload validation proves the token was ACCEPTED; 401/403 would have
106
- // proven it was not. Auth verified end to end with zero mail sent — a diagnostic must not
107
- // put a real message in someone's inbox.
108
- // The diagnostic key was then REVOKED (revoked_at set, not deleted, so the audit trail lives).
109
- ...mailProvenanceTools,
110
- // mAYL_agentbox_provision/list/release/extend — the agent mints/lists/releases/extends its OWN
111
- // real, two-way, disposable inbox (agent-<hex>@mosadd.com). create_inbox parity with AgentMail,
112
- // on our own stack + provenance. Backs the live mayl-agentbox EF; receive path landed 2026-08-06
113
- // in mp0st-inbound-webhook (LINEAR-5201). Same requireUser auth as every other mAYL tool.
114
- ...mailAgentboxTools,
115
- ...mtalkTools,
116
- ...attachmentTools,
117
- // ⭐ mTALK_ingest_ptt: RE-REGISTERED 2026-07-29 — the backend finally does what the tool promises.
118
- // Unregistered since 07-14 on the note "ptt-ingest EF 400s every call". Re-measured 07-29: that
119
- // reason was stale (it returned 401, the auth gate), and an AUTHENTICATED probe then exposed the
120
- // real fault — 500, `Could not find the table 'public.rag_jobs'`. It authenticated, validated,
121
- // wrote the transcript row, and died one step later against a table dropped when the rag_events
122
- // v2 queue landed. Agent push-to-talk had NEVER once reached memory.
123
- //
124
- // Fixed by handing the audio to `rag-transcribe` (NOT to the v2 queue — that queue carries TEXT
125
- // for embedding and cannot transcribe; audio has to become words first). Verified on prod:
126
- // 200 {"queued":true}, edge log 200 in 2.7s where it used to 500, and the transcript row's
127
- // updated_at moved 4s after insert, so the backgrounded chain genuinely ran.
128
- //
129
- // Registered only AFTER that authenticated 200 — a liveness probe was never enough, because the
130
- // whole point of this registry is that an agent sees only tools that actually work.
131
- ...pttIngestTools,
132
- //
133
- // ✅ RESOLVED 2026-07-29 — both halves of this note are closed; kept as the record of how.
134
- // The disable note recorded a diagnosis from 2026-07-14: hub-claim "404s every call".
135
- // Live-probed today, unauthenticated:
136
- // hub-claim-mint → 401 · ptt-ingest → 401 · mp0st-send → 401 (the control, a tool that
137
- // IS registered and works)
138
- // 401 is the auth gate answering. A dead or missing function returns 404; a function that
139
- // rejects our payload shape returns 400. Neither happens any more, and both are ACTIVE on
140
- // the project. So whatever was broken in July was fixed at some point and nobody came back
141
- // to these lines — we advertised two capabilities as unavailable while their backends
142
- // answered. One of them (ptt) is now proven and registered; this is the other.
143
- //
144
- // NOT re-registering hub-claim on this evidence, deliberately. An unauthenticated 401 proves the
145
- // function is alive; it proves NOTHING about the authenticated path, which is where both
146
- // originally failed. Re-registering on a liveness probe would swap "wrongly disabled" for
147
- // "advertised and broken in a user's hands", which is the worse of the two.
148
- //
149
- // TO CLOSE: call each with a real hub key / session token. If they succeed, delete these
150
- // two comment blocks and uncomment the imports — the count moves 71 → 73 and the anti-drift
151
- // gate will then force every doc surface to follow. (This session cannot mint a session
152
- // token, so it stops here rather than guess.)
153
- ...knowledgeTools,
154
- ...knowledgeGraphTools, // mRAG_graph_*: traverse the per-user knowledge graph (kg_* RPCs) — search finds text, this walks who/what/when
155
- ...actionTools, // Action links (Tier 1): agent → user one-link browser action via action-create EF
156
- ...presenceTools, // comms_session_attach: THIS session owns the account's reply lane while it runs; the 24/7 cloud stand-in defers. Any session, any machine — no bespoke bridge on one PC.
157
- ...embedTools, // comms_embed_create: RE-REGISTERED 2026-07-17 — embed.mosadd.com/v1.js live; mints an embed key + paste-in snippet (mURL→mIRC rework P3)
158
- ...threatTools, // threat_catalog + threat_classify: RE-REGISTERED 2026-07-15 (founder directive + LINEAR-3498) — pure/offline, makes the Pegasus-class classification claim a live, callable capability
159
- ...murlTools, // mURL: revived as a full module (founder 2026-06-27) — read/post/presence/list_channels over live domain channels
160
- // ...mcallTools, // mCALL: carrier-pending (no telephony carrier live) — re-register when a carrier is configured
161
- // mirlTools,
162
- // mmatrixTools, mdiscordTools, mtelegramTools, mslackTools, msignalTools,
163
- //
164
- // Each m* module registers its tools here as it ships.
165
- // RFC required to add a new m* module (see docs/rfcs/0001-module-naming.md).
166
- ];
167
-
168
- export const allTools: MosaddTool[] = [
169
- ...channelTools,
170
- // comms_capabilities: one-call discovery of every tool's `requires` flag,
171
- // so carrier-aware hosts (cymru-os) can gate the tool list by transport.
172
- makeCapabilitiesTool(channelTools),
173
- ];
174
-
175
- /**
176
- * The exact, live number of callable tools this server registers. Reference THIS
177
- * (import { TOOL_COUNT }) in any code/doc surface that shows a tool count, instead
178
- * of hard-coding a number that silently drifts (the "70+/65/68" inconsistency that
179
- * bit us). Mirrors @mosadd/threat-engine's THREAT_EVENT_COUNT pattern.
180
- */
181
- export const TOOL_COUNT: number = allTools.length;
1
+ /**
2
+ * Tool registry. Each m* module contributes a set of tools.
3
+ *
4
+ * User-facing modules (4): mDM, mIRC, mURL, mAYL — the re-arch (LINEAR-3938)
5
+ * mAYL replaces the old mp0st name (mp0st_* still registered as back-compat
6
+ * aliases via mail-aliases.ts; will be removed in a later alpha).
7
+ *
8
+ * Capabilities (not modules — cross-cutting agent tooling): mRAG, comms_.
9
+ * mTALK = voice tier inside mIRC, still its own tools for now; folding into
10
+ * mIRC_voice_* in a follow-up release. threat_* (threat_catalog + threat_classify)
11
+ * are REGISTERED (2026-07-15, founder directive + LINEAR-3498): pure/offline
12
+ * defensive classification over the threat taxonomy — the surveillance-era
13
+ * *marketing* was killed, the classification engine is real and wanted.
14
+ *
15
+ * 85 callable tools registered — the exact live count is exported as TOOL_COUNT
16
+ * (= allTools.length) below; ALWAYS reference that, never re-hard-code a number that drifts.
17
+ * Breakdown (2026-09-03, from allTools in this tree; the live tools/list on mcp.mosadd.com catches up
18
+ * when the alpha carrying mIRC_invite is published and the gateway redeployed):
19
+ * modules mDM 16 · mIRC 25 · mURL 7 · mAYL 16 = 64; capabilities mTALK 6 · mRAG 8 ·
20
+ * comms 5 (action_create/action_frame_get/embed_create/capabilities/session_attach) · Irondome/threat 2
21
+ * = 21. 64 + 21 = 85. (mIRC 25 = 24 + mIRC_invite added 2026-09-03 (LINEAR-5870): mIRC_join adds the KEY's
22
+ * identity while channel posts are signed by the AGENT, so every channel created from the toolkit was mute
23
+ * until its agent was added from the app — mIRC_invite wraps channel-members-manage `invite`: own agent →
24
+ * auto_joined, anyone else → invite code. mDM 16 = 14 + mDM_send_as_agent/mDM_list_my_agents added 2026-08-17: an MCP key
25
+ * is bound to a USER, so an agent runtime wired up with its owner's key spoke AS THE OWNER — these
26
+ * let it speak as an agent it OWNS instead, checked server-side. mRAG 8 = 4 search/ingest + 4 mRAG_graph_* traversal tools added 2026-08-11.
27
+ * comms_session_attach added 2026-08-14: a live agent session claims the account's reply lane so
28
+ * the cloud stand-in defers to it — the front door that used to be a script on one PC.)
29
+ * (History of this line drifting: the 2026-07-17 breakdown ended "= 69"
30
+ * — wrong twice over, its own terms summed to 71; the 07-30 rewrite said 73 and still had
31
+ * mAYL at 12 after mAYL_send_as_agent had been re-registered, so it stayed wrong through the
32
+ * four mAYL_agentbox_* tools landing on 08-06. Arithmetic in comments drifts; TOOL_COUNT
33
+ * doesn't — and since 08-11 the anti-drift gate checks the PER-MODULE numbers too, not just
34
+ * the total, so this comment cannot rot alone any more.)
35
+ * (mDM/mIRC each include their 2 attachment tools from attachments.ts.)
36
+ * Modules (4): mDM, mIRC, mURL, mAYL. Capabilities: mTALK (voice/PTT), mRAG, comms_, Irondome (threat_*).
37
+ * mp0st_* stay as DEPRECATED back-compat aliases for mAYL_* (removed in a later alpha).
38
+ * mAYL_send_as_agent + mTALK_ingest_ptt were RE-REGISTERED 2026-07-29: both had been disabled
39
+ * on 07-14 notes that had since become false, and both were re-verified on authenticated calls.
40
+ * comms_embed_create RE-REGISTERED 2026-07-17 (embed.mosadd.com/v1.js live — P3 of mURL→mIRC).
41
+ * mROOM was KILLED (LINEAR-3414, channel re-cut → ephemeral private mIRC): its tools
42
+ * live in tools/mroom.ts + mroom-messages.ts but are NOT registered here.
43
+ * Plus action links: comms_action_create (agent → user one-link browser action,
44
+ * incl. screen_share) + comms_action_frame_get (see the recipient's shared screen).
45
+ * mURL is a FULL registered dev module (revived, founder 2026-06-27) — IRC-for-URLs,
46
+ * agent-native; backends live (mosadd-edge + murl-channels EF). tools/murl.ts.
47
+ * mURL now has full lifecycle: read/post/presence/list_channels (hub-key) PLUS owner-side
48
+ * create/claim + update(branding/status) + delete (mURL_create/update/delete → murl-manage
49
+ * EF, owner-scoped via user JWT — same auth as mURL_list_channels action='mine').
50
+ * mCALL is carrier-pending (no telephony carrier live yet): its tools live in
51
+ * tools/mcall.ts but are NOT registered here, so an agent only ever discovers
52
+ * tools that actually work. Re-register the one line below when a carrier ships.
53
+ */
54
+
55
+ import type { MosaddTool } from "../types.js";
56
+ import { mdmTools } from "./mdm.js";
57
+ import { mdmAsAgentTools } from "./mdm-as-agent.js"; // mDM_send_as_agent + mDM_list_my_agents — 2026-08-17 (LINEAR-5620): a key is bound to a USER, so an agent runtime connected with its owner's key spoke AS THE OWNER and had no thread with him. These let that session speak as an agent it OWNS (verified server-side in mdm-send-as-agent).
58
+ import { mdmVoiceTools } from "./mdm-voice.js";
59
+ import { mircTools } from "./mirc.js";
60
+ import { mircMembersTools } from "./mirc-members.js";
61
+ import { mircMessagesTools } from "./mirc-messages.js";
62
+ import { mircEdgeTools } from "./mirc-edge.js";
63
+ // import { mroomTools } from "./mroom.js"; // mROOM: killed (LINEAR-3414) — not registered
64
+ // import { mroomMessagesTools } from "./mroom-messages.js"; // mROOM: killed (LINEAR-3414) — not registered
65
+ import { mailTools } from "./mail.js";
66
+ // import { mailAliasTools } from "./mail-aliases.js"; // mp0st_* aliases RETIRED 2026-07-15 (founder: unify on mAYL, drop the mp0st codename from every user-visible surface). Source kept for reference.
67
+ import { mailProvenanceTools } from "./mail-provenance.js"; // mAYL_send_as_agent — RE-REGISTERED 2026-07-29, see the note at the registry below
68
+ import { mailAgentboxTools } from "./mail-agentbox.js"; // mAYL_agentbox_*: agent mints/lists/releases its OWN two-way disposable inbox (backs mayl-agentbox EF). Added 2026-08-06 (LINEAR-5201 Part B)
69
+ import { mtalkTools } from "./mtalk.js";
70
+ import { attachmentTools } from "./attachments.js";
71
+ import { pttIngestTools } from "./ptt-ingest.js"; // mTALK_ingest_ptt — RE-REGISTERED 2026-07-29, see the note at the registry below
72
+ // import { mcallTools } from "./mcall.js"; // mCALL: carrier-pending — not registered (see header note)
73
+ import { knowledgeTools } from "./knowledge.js";
74
+ import { knowledgeGraphTools } from "./knowledge-graph.js"; // mRAG_graph_* — 2026-08-11: MCP door onto the kg_* graph RPCs (traverse people/threads, not just search text)
75
+ import { actionTools } from "./actions.js";
76
+ import { presenceTools } from "./presence.js"; // comms_session_attach — 2026-08-14: a live agent session claims the account's reply lane (agent_bridge_heartbeat), so the cloud stand-in defers to it. Replaces the PC-only bridge script as the ONLY writer of that signal.
77
+ import { embedTools } from "./embed.js"; // comms_embed_create RE-REGISTERED 2026-07-17: embed.mosadd.com/v1.js is LIVE (served by the mosadd Vercel project) — the widget + embed-keys/mirc-embed-token backend were already complete.
78
+ import { threatTools } from "./threat.js"; // threat_*: RE-REGISTERED 2026-07-15 (founder directive + LINEAR-3498). Pure/offline classification of the real Pegasus-class threat taxonomy — the engine DECIDES, the caller acts; no surveillance, no backend.
79
+ import { murlTools } from "./murl.js"; // mURL: REGISTERED — revived as a full dev module (founder 2026-06-27, re-arch). IRC-for-URLs, agent-native; backends live (mosadd-edge + murl-channels EF).
80
+ import { makeCapabilitiesTool } from "./capabilities.js";
81
+
82
+ /** The m* channel tools (everything except the meta discovery tool). */
83
+ const channelTools: MosaddTool[] = [
84
+ ...mdmTools,
85
+ ...mdmAsAgentTools,
86
+ ...mdmVoiceTools,
87
+ ...mircTools,
88
+ ...mircMembersTools,
89
+ ...mircMessagesTools,
90
+ ...mircEdgeTools,
91
+ // ...mroomTools, // mROOM: killed (LINEAR-3414) — channel re-cut into ephemeral private mIRC
92
+ // ...mroomMessagesTools, // mROOM: killed (LINEAR-3414)
93
+ ...mailTools, // mAYL_*: canonical email module (was the mp0st codename; renamed re-arch 2026-06-27)
94
+ // ...mailAliasTools, // mp0st_* aliases RETIRED 2026-07-15 — mAYL is the one name; the mp0st codename is now backend-internal only
95
+ // ⭐ mAYL_send_as_agent: RE-REGISTERED 2026-07-29 — proven end to end, without sending mail.
96
+ // Unregistered since 07-14 on the note "hub-claim EF 404s every call". That note was stale in
97
+ // the same way ptt-ingest's was: unauthenticated it returns 401 (the auth gate), not 404.
98
+ //
99
+ // Settled by running the whole chain rather than the convenient half:
100
+ // 1. hub-keys with a plain user JWT issued a real `mosadd_sk_live_…` — so a user session
101
+ // mints a hub key and no founder credential was ever needed. I had told the founder it
102
+ // required his key; that was wrong and this is the retraction.
103
+ // 2. hub-claim-mint with that key → 200, valid claim token, aud `mp0st-send`, 600s expiry.
104
+ // 3. mp0st-send with the claim token and a DELIBERATELY EMPTY payload → 400 "Missing to or
105
+ // subject". A 400 on payload validation proves the token was ACCEPTED; 401/403 would have
106
+ // proven it was not. Auth verified end to end with zero mail sent — a diagnostic must not
107
+ // put a real message in someone's inbox.
108
+ // The diagnostic key was then REVOKED (revoked_at set, not deleted, so the audit trail lives).
109
+ ...mailProvenanceTools,
110
+ // mAYL_agentbox_provision/list/release/extend — the agent mints/lists/releases/extends its OWN
111
+ // real, two-way, disposable inbox (agent-<hex>@mosadd.com). create_inbox parity with AgentMail,
112
+ // on our own stack + provenance. Backs the live mayl-agentbox EF; receive path landed 2026-08-06
113
+ // in mp0st-inbound-webhook (LINEAR-5201). Same requireUser auth as every other mAYL tool.
114
+ ...mailAgentboxTools,
115
+ ...mtalkTools,
116
+ ...attachmentTools,
117
+ // ⭐ mTALK_ingest_ptt: RE-REGISTERED 2026-07-29 — the backend finally does what the tool promises.
118
+ // Unregistered since 07-14 on the note "ptt-ingest EF 400s every call". Re-measured 07-29: that
119
+ // reason was stale (it returned 401, the auth gate), and an AUTHENTICATED probe then exposed the
120
+ // real fault — 500, `Could not find the table 'public.rag_jobs'`. It authenticated, validated,
121
+ // wrote the transcript row, and died one step later against a table dropped when the rag_events
122
+ // v2 queue landed. Agent push-to-talk had NEVER once reached memory.
123
+ //
124
+ // Fixed by handing the audio to `rag-transcribe` (NOT to the v2 queue — that queue carries TEXT
125
+ // for embedding and cannot transcribe; audio has to become words first). Verified on prod:
126
+ // 200 {"queued":true}, edge log 200 in 2.7s where it used to 500, and the transcript row's
127
+ // updated_at moved 4s after insert, so the backgrounded chain genuinely ran.
128
+ //
129
+ // Registered only AFTER that authenticated 200 — a liveness probe was never enough, because the
130
+ // whole point of this registry is that an agent sees only tools that actually work.
131
+ ...pttIngestTools,
132
+ //
133
+ // ✅ RESOLVED 2026-07-29 — both halves of this note are closed; kept as the record of how.
134
+ // The disable note recorded a diagnosis from 2026-07-14: hub-claim "404s every call".
135
+ // Live-probed today, unauthenticated:
136
+ // hub-claim-mint → 401 · ptt-ingest → 401 · mp0st-send → 401 (the control, a tool that
137
+ // IS registered and works)
138
+ // 401 is the auth gate answering. A dead or missing function returns 404; a function that
139
+ // rejects our payload shape returns 400. Neither happens any more, and both are ACTIVE on
140
+ // the project. So whatever was broken in July was fixed at some point and nobody came back
141
+ // to these lines — we advertised two capabilities as unavailable while their backends
142
+ // answered. One of them (ptt) is now proven and registered; this is the other.
143
+ //
144
+ // NOT re-registering hub-claim on this evidence, deliberately. An unauthenticated 401 proves the
145
+ // function is alive; it proves NOTHING about the authenticated path, which is where both
146
+ // originally failed. Re-registering on a liveness probe would swap "wrongly disabled" for
147
+ // "advertised and broken in a user's hands", which is the worse of the two.
148
+ //
149
+ // TO CLOSE: call each with a real hub key / session token. If they succeed, delete these
150
+ // two comment blocks and uncomment the imports — the count moves 71 → 73 and the anti-drift
151
+ // gate will then force every doc surface to follow. (This session cannot mint a session
152
+ // token, so it stops here rather than guess.)
153
+ ...knowledgeTools,
154
+ ...knowledgeGraphTools, // mRAG_graph_*: traverse the per-user knowledge graph (kg_* RPCs) — search finds text, this walks who/what/when
155
+ ...actionTools, // Action links (Tier 1): agent → user one-link browser action via action-create EF
156
+ ...presenceTools, // comms_session_attach: THIS session owns the account's reply lane while it runs; the 24/7 cloud stand-in defers. Any session, any machine — no bespoke bridge on one PC.
157
+ ...embedTools, // comms_embed_create: RE-REGISTERED 2026-07-17 — embed.mosadd.com/v1.js live; mints an embed key + paste-in snippet (mURL→mIRC rework P3)
158
+ ...threatTools, // threat_catalog + threat_classify: RE-REGISTERED 2026-07-15 (founder directive + LINEAR-3498) — pure/offline, makes the Pegasus-class classification claim a live, callable capability
159
+ ...murlTools, // mURL: revived as a full module (founder 2026-06-27) — read/post/presence/list_channels over live domain channels
160
+ // ...mcallTools, // mCALL: carrier-pending (no telephony carrier live) — re-register when a carrier is configured
161
+ // mirlTools,
162
+ // mmatrixTools, mdiscordTools, mtelegramTools, mslackTools, msignalTools,
163
+ //
164
+ // Each m* module registers its tools here as it ships.
165
+ // RFC required to add a new m* module (see docs/rfcs/0001-module-naming.md).
166
+ ];
167
+
168
+ export const allTools: MosaddTool[] = [
169
+ ...channelTools,
170
+ // comms_capabilities: one-call discovery of every tool's `requires` flag,
171
+ // so carrier-aware hosts (cymru-os) can gate the tool list by transport.
172
+ makeCapabilitiesTool(channelTools),
173
+ ];
174
+
175
+ /**
176
+ * The exact, live number of callable tools this server registers. Reference THIS
177
+ * (import { TOOL_COUNT }) in any code/doc surface that shows a tool count, instead
178
+ * of hard-coding a number that silently drifts (the "70+/65/68" inconsistency that
179
+ * bit us). Mirrors @mosadd/threat-engine's THREAT_EVENT_COUNT pattern.
180
+ */
181
+ export const TOOL_COUNT: number = allTools.length;