@mosadd/mcp 3.0.0-alpha.24 → 3.0.0-alpha.26
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.
- package/dist/bin/mcp.js +1 -1
- package/dist/{chunk-S6OWXISZ.js → chunk-YBSQUORF.js} +287 -143
- package/dist/index.d.ts +13 -2
- package/dist/index.js +1 -1
- package/package.json +6 -6
- package/src/tools/index.ts +24 -12
- package/src/tools/mail-aliases.ts +25 -0
- package/src/tools/mail-provenance.ts +22 -24
- package/src/tools/mail.ts +11 -11
- package/src/tools/murl.ts +27 -13
- package/src/tools/ptt-ingest.ts +58 -53
package/dist/index.d.ts
CHANGED
|
@@ -200,8 +200,19 @@ declare function createMosaddServer(options?: MosaddServerOptions): McpServer;
|
|
|
200
200
|
/**
|
|
201
201
|
* Tool registry. Each m* module contributes a set of tools.
|
|
202
202
|
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
203
|
+
* User-facing modules (4): mDM, mIRC, mURL, mAYL — the re-arch (LINEAR-3938)
|
|
204
|
+
* mAYL replaces the old mp0st name (mp0st_* still registered as back-compat
|
|
205
|
+
* aliases via mail-aliases.ts; will be removed in alpha.27).
|
|
206
|
+
*
|
|
207
|
+
* Capabilities (not modules — cross-cutting agent tooling): mRAG, comms_.
|
|
208
|
+
* mTALK = voice tier inside mIRC, still its own tools for now; folding into
|
|
209
|
+
* mIRC_voice_* in a follow-up release. threat_* UNREGISTERED — surveillance-
|
|
210
|
+
* era direction is dead (decision_killed_directions).
|
|
211
|
+
*
|
|
212
|
+
* 76 callable tools at registration:
|
|
213
|
+
* mDM 14 + mIRC 22 + mURL 4 + mAYL 11 (= 51 module tools) +
|
|
214
|
+
* mTALK 5 + mRAG 4 + comms_ 3 (= 12 capability tools) +
|
|
215
|
+
* mp0st_* 11 back-compat aliases + comms_capabilities (1) = 76.
|
|
205
216
|
* mROOM was KILLED (LINEAR-3414, channel re-cut → ephemeral private mIRC): its tools
|
|
206
217
|
* live in tools/mroom.ts + mroom-messages.ts but are NOT registered here.
|
|
207
218
|
* Plus action links: comms_action_create (agent → user one-link browser action,
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mosadd/mcp",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.26",
|
|
4
4
|
"mcpName": "io.github.hei33enberg/mosadd-mcp",
|
|
5
|
-
"description": "Model Context Protocol server for mosadd. Exposes
|
|
5
|
+
"description": "Model Context Protocol server for mosadd. Exposes 4 modules (mDM, mIRC, mURL, mAYL) and capabilities (mTALK, mRAG) plus comms agent-actions — 74 tools (mp0st_* aliases through alpha.26) — to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
|
|
6
6
|
"homepage": "https://github.com/Hei33enberg/mosADD-OS/tree/main/packages/mcp",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
39
39
|
"@supabase/supabase-js": "^2.48.0",
|
|
40
40
|
"zod": "^4.3.6",
|
|
41
|
-
"@mosadd/
|
|
42
|
-
"@mosadd/threat-engine": "3.0.0-alpha.
|
|
43
|
-
"@mosadd/
|
|
44
|
-
"@mosadd/
|
|
41
|
+
"@mosadd/crypto": "3.0.0-alpha.26",
|
|
42
|
+
"@mosadd/threat-engine": "3.0.0-alpha.26",
|
|
43
|
+
"@mosadd/protocol": "3.0.0-alpha.26",
|
|
44
|
+
"@mosadd/providers": "3.0.0-alpha.26"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"tsup": "^8.3.5",
|
package/src/tools/index.ts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool registry. Each m* module contributes a set of tools.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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 alpha.27).
|
|
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_* UNREGISTERED — surveillance-
|
|
11
|
+
* era direction is dead (decision_killed_directions).
|
|
12
|
+
*
|
|
13
|
+
* 76 callable tools at registration:
|
|
14
|
+
* mDM 14 + mIRC 22 + mURL 4 + mAYL 11 (= 51 module tools) +
|
|
15
|
+
* mTALK 5 + mRAG 4 + comms_ 3 (= 12 capability tools) +
|
|
16
|
+
* mp0st_* 11 back-compat aliases + comms_capabilities (1) = 76.
|
|
6
17
|
* mROOM was KILLED (LINEAR-3414, channel re-cut → ephemeral private mIRC): its tools
|
|
7
18
|
* live in tools/mroom.ts + mroom-messages.ts but are NOT registered here.
|
|
8
19
|
* Plus action links: comms_action_create (agent → user one-link browser action,
|
|
@@ -24,17 +35,17 @@ import { mircEdgeTools } from "./mirc-edge.js";
|
|
|
24
35
|
// import { mroomTools } from "./mroom.js"; // mROOM: killed (LINEAR-3414) — not registered
|
|
25
36
|
// import { mroomMessagesTools } from "./mroom-messages.js"; // mROOM: killed (LINEAR-3414) — not registered
|
|
26
37
|
import { mailTools } from "./mail.js";
|
|
38
|
+
import { mailAliasTools } from "./mail-aliases.js"; // mp0st_* back-compat aliases for mAYL_*
|
|
39
|
+
import { mailProvenanceTools } from "./mail-provenance.js"; // mAYL_send_as_agent — LINEAR-3991
|
|
27
40
|
// import { mailProvenanceTools } from "./mail-provenance.js"; // scaffold (mp0st_send_as_agent) — not registered, see below
|
|
28
41
|
import { mtalkTools } from "./mtalk.js";
|
|
29
42
|
import { attachmentTools } from "./attachments.js";
|
|
30
|
-
|
|
43
|
+
import { pttIngestTools } from "./ptt-ingest.js"; // P4.1 / LINEAR-3998 — body aligned to deployed ptt-ingest EF
|
|
31
44
|
// import { mcallTools } from "./mcall.js"; // mCALL: carrier-pending — not registered (see header note)
|
|
32
45
|
import { knowledgeTools } from "./knowledge.js";
|
|
33
46
|
import { actionTools } from "./actions.js";
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
// widget surface is parked. Unregister until both ship. See consistency ticket.
|
|
37
|
-
import { threatTools } from "./threat.js";
|
|
47
|
+
import { embedTools } from "./embed.js"; // P5.1 / LINEAR-4002 — embed-keys + mirc-embed-token deployed to prod 2026-06-27. Widget at embed.mosadd.com still owner-deploy (separate Vercel project).
|
|
48
|
+
// import { threatTools } from "./threat.js"; // threat_*: UNREGISTERED 2026-06-27 (re-arch). Surveillance-era direction killed; source kept for archival.
|
|
38
49
|
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).
|
|
39
50
|
import { makeCapabilitiesTool } from "./capabilities.js";
|
|
40
51
|
|
|
@@ -48,19 +59,20 @@ const channelTools: MosaddTool[] = [
|
|
|
48
59
|
...mircEdgeTools,
|
|
49
60
|
// ...mroomTools, // mROOM: killed (LINEAR-3414) — channel re-cut into ephemeral private mIRC
|
|
50
61
|
// ...mroomMessagesTools, // mROOM: killed (LINEAR-3414)
|
|
51
|
-
...mailTools,
|
|
52
|
-
|
|
62
|
+
...mailTools, // mAYL_*: canonical email module (was mp0st_*; renamed re-arch 2026-06-27)
|
|
63
|
+
...mailAliasTools, // mp0st_*: back-compat aliases — DEPRECATED, removed in alpha.27
|
|
64
|
+
...mailProvenanceTools, // mAYL_send_as_agent: agent-attributed mail send via hub-claim-mint (LINEAR-3991)
|
|
53
65
|
// endpoint (404s every call) + sends provenance body fields the EF never reads. Unregister until
|
|
54
66
|
// rewired onto hub-key-exchange (agent_id/task_id + mosadd_hub JWT claim). See consistency ticket.
|
|
55
67
|
...mtalkTools,
|
|
56
68
|
...attachmentTools,
|
|
57
|
-
|
|
69
|
+
...pttIngestTools, // mTALK_ingest_ptt: P4.1 / LINEAR-3998 — body aligned to deployed ptt-ingest EF
|
|
58
70
|
// ptt-ingest EF (needs {direction, audio_base64, mime_type, message_id|thread_id} → 400s every
|
|
59
71
|
// call) and the PTT→RAG path needs rework. Unregister until both are fixed. See consistency ticket.
|
|
60
72
|
...knowledgeTools,
|
|
61
73
|
...actionTools, // Action links (Tier 1): agent → user one-link browser action via action-create EF
|
|
62
|
-
|
|
63
|
-
...threatTools, //
|
|
74
|
+
...embedTools, // comms_embed_create: P5.1 / LINEAR-4002 — EFs live, widget at embed.mosadd.com awaits owner-deploy
|
|
75
|
+
// ...threatTools, // UNREGISTERED 2026-06-27 — killed direction; source kept for archival
|
|
64
76
|
...murlTools, // mURL: revived as a full module (founder 2026-06-27) — read/post/presence/list_channels over live domain channels
|
|
65
77
|
// ...mcallTools, // mCALL: carrier-pending (no telephony carrier live) — re-register when a carrier is configured
|
|
66
78
|
// mirlTools,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// mail-aliases.ts — back-compat mp0st_* aliases for mAYL_* tools
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// The mosADD re-arch (2026-06-27) renamed the email module from `mp0st` to
|
|
5
|
+
// `mAYL` (LINEAR-3938 / 3985). The canonical tool names are mAYL_* — see
|
|
6
|
+
// `tools/mail.ts`. THIS module exposes back-compat aliases so any agent already
|
|
7
|
+
// wired to mp0st_send / mp0st_view / etc. KEEPS WORKING in this release.
|
|
8
|
+
//
|
|
9
|
+
// Rule: never drop an alias in the release that adds its replacement — live
|
|
10
|
+
// agents would 404. mp0st_* aliases stay through alpha.25 and the next minor;
|
|
11
|
+
// flag for removal goes into the alpha.27 release notes.
|
|
12
|
+
// =============================================================================
|
|
13
|
+
|
|
14
|
+
import type { MosaddTool } from "../types.js";
|
|
15
|
+
import { mailTools } from "./mail.js";
|
|
16
|
+
|
|
17
|
+
/** Same handlers/schemas as `mailTools`, but registered under the legacy mp0st_* names. */
|
|
18
|
+
export const mailAliasTools: MosaddTool[] = mailTools.map((tool) => ({
|
|
19
|
+
...tool,
|
|
20
|
+
name: tool.name.replace(/^mAYL_/, "mp0st_"),
|
|
21
|
+
description:
|
|
22
|
+
`[DEPRECATED — use ${tool.name} instead. mp0st_* aliases stay through alpha.25 ` +
|
|
23
|
+
`for back-compat; will be removed in alpha.27.] ` +
|
|
24
|
+
tool.description,
|
|
25
|
+
}));
|
|
@@ -62,53 +62,51 @@ const mp0st_send_as_agent_input = z.object({
|
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
* Exchange the hub key for
|
|
66
|
-
*
|
|
67
|
-
*
|
|
65
|
+
* Exchange the hub key for an HS256 hub-claim JWT that authorizes agent-attributed
|
|
66
|
+
* mail sends. The `mp0st-send` EF verifies this token with HUB_JWT_SECRET and reads
|
|
67
|
+
* `agent_id` + `task_id` from its claims authoritatively (body fields are NOT trusted
|
|
68
|
+
* for provenance). LINEAR-3991.
|
|
68
69
|
*/
|
|
69
70
|
async function mintHubClaim(agentId: string, taskId?: string): Promise<string> {
|
|
70
71
|
const key = hubKey();
|
|
71
72
|
if (!key) {
|
|
72
|
-
throw new Error("
|
|
73
|
+
throw new Error("mAYL_send_as_agent needs MOSADD_API_KEY (hub key) to mint a provenance claim.");
|
|
73
74
|
}
|
|
74
75
|
const r = await fetch(`${supabaseUrl()}/functions/v1/hub-claim-mint`, {
|
|
75
76
|
method: "POST",
|
|
76
77
|
headers: { "Content-Type": "application/json", Authorization: `Bearer ${key}` },
|
|
77
|
-
body: JSON.stringify({
|
|
78
|
+
body: JSON.stringify({ agent_id: agentId, task_id: taskId ?? null }),
|
|
78
79
|
});
|
|
79
80
|
if (!r.ok) {
|
|
80
81
|
const b = await r.text().catch(() => "");
|
|
81
82
|
throw new Error(`hub-claim-mint ${r.status}: ${b.slice(0, 200)}`);
|
|
82
83
|
}
|
|
83
|
-
const data = (await r.json()) as {
|
|
84
|
-
if (!data?.
|
|
85
|
-
return data.
|
|
84
|
+
const data = (await r.json()) as { access_token?: string };
|
|
85
|
+
if (!data?.access_token) throw new Error("hub-claim-mint: no access_token in response");
|
|
86
|
+
return data.access_token;
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
async function
|
|
89
|
+
async function mAYL_send_as_agent(
|
|
89
90
|
input: z.infer<typeof mp0st_send_as_agent_input>,
|
|
90
91
|
ctx: MosaddToolContext,
|
|
91
92
|
): Promise<{ message_id: string; status: string; is_internal: boolean; sent_by: "agent" }> {
|
|
92
93
|
if (!input.body_text && !input.body_html) {
|
|
93
|
-
throw new Error("
|
|
94
|
+
throw new Error("mAYL_send_as_agent requires at least one of body_text or body_html.");
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
//
|
|
97
|
-
// so the EF attributes the row to the agent.
|
|
98
|
-
//
|
|
97
|
+
// Mint the hub-claim JWT and present it directly to mp0st-send (NOT the user
|
|
98
|
+
// session client) so the EF attributes the row to the agent. mp0st-send verifies
|
|
99
|
+
// the HS256 signature with HUB_JWT_SECRET and stamps sent_by_agent_id /
|
|
100
|
+
// sent_by_task_id from the verified claims — body fields are NOT trusted for
|
|
101
|
+
// provenance.
|
|
99
102
|
const claim = await mintHubClaim(input.agent_id, input.task_id);
|
|
100
|
-
ctx.log("debug", "
|
|
103
|
+
ctx.log("debug", "mAYL_send_as_agent invoking mp0st-send with hub-claim", { agent_id: input.agent_id });
|
|
101
104
|
|
|
102
|
-
const { agent_id, task_id, ...mailFields } = input;
|
|
105
|
+
const { agent_id: _ai, task_id: _ti, ...mailFields } = input;
|
|
103
106
|
const r = await fetch(`${supabaseUrl()}/functions/v1/mp0st-send`, {
|
|
104
107
|
method: "POST",
|
|
105
108
|
headers: { "Content-Type": "application/json", Authorization: `Bearer ${claim}` },
|
|
106
|
-
body: JSON.stringify(
|
|
107
|
-
...mailFields,
|
|
108
|
-
sent_by: "agent",
|
|
109
|
-
sent_by_agent_id: agent_id,
|
|
110
|
-
sent_by_task_id: task_id ?? null,
|
|
111
|
-
}),
|
|
109
|
+
body: JSON.stringify(mailFields),
|
|
112
110
|
});
|
|
113
111
|
if (!r.ok) {
|
|
114
112
|
const b = await r.text().catch(() => "");
|
|
@@ -127,11 +125,11 @@ async function mp0st_send_as_agent(
|
|
|
127
125
|
|
|
128
126
|
export const mailProvenanceTools: MosaddTool[] = [
|
|
129
127
|
{
|
|
130
|
-
name: "
|
|
128
|
+
name: "mAYL_send_as_agent",
|
|
131
129
|
requires: "network",
|
|
132
130
|
description:
|
|
133
|
-
"Send an email ATTRIBUTED TO THE AGENT (provenance-stamped). Unlike
|
|
131
|
+
"Send an email ATTRIBUTED TO THE AGENT (provenance-stamped). Unlike mAYL_send (sends as the user), this stamps sent_by='agent' plus your agent_id and optional task_id onto the email record and audit trail — so recipients and compliance can see the mail was agent-originated. Auth: presents a hub-claim JWT (needs MOSADD_API_KEY). The mp0st-send EF verifies the claim with HUB_JWT_SECRET; body trust is never granted for provenance.",
|
|
134
132
|
inputSchema: mp0st_send_as_agent_input,
|
|
135
|
-
handler:
|
|
133
|
+
handler: mAYL_send_as_agent as MosaddTool["handler"],
|
|
136
134
|
},
|
|
137
135
|
];
|
package/src/tools/mail.ts
CHANGED
|
@@ -292,7 +292,7 @@ async function mp0st_notify(
|
|
|
292
292
|
|
|
293
293
|
export const mailTools: MosaddTool[] = [
|
|
294
294
|
{
|
|
295
|
-
name: "
|
|
295
|
+
name: "mAYL_list",
|
|
296
296
|
requires: "network",
|
|
297
297
|
description:
|
|
298
298
|
"List the user's mailbox (their <userId>@mosadd.com inbox/outbox) newest-first, with sender, subject, status and a short snippet. Filter by direction ('inbound' = received, 'outbound' = sent). Use the returned next_cursor with `before` to page through older mail. Call mp0st_view to read a full message body.",
|
|
@@ -300,7 +300,7 @@ export const mailTools: MosaddTool[] = [
|
|
|
300
300
|
handler: mp0st_list as MosaddTool["handler"],
|
|
301
301
|
},
|
|
302
302
|
{
|
|
303
|
-
name: "
|
|
303
|
+
name: "mAYL_send",
|
|
304
304
|
requires: "network",
|
|
305
305
|
description:
|
|
306
306
|
"Send an email from the user's mosadd address (<userId>@mosadd.com). Pass body_text or body_html (or both). Supports cc, bcc, reply_to. Monitoring/legal options: tracking (open+click, default on; set false for no tracking), force_reader (stub email → recipient opens in mosadd's secure reader, unlocking print/copy/time-on-read tracking + revoke), watermark (recipient watermark visible in screenshots/prints), disclose_tracking (GDPR footer), auto_destruct ('1h'|'24h'|'7d').",
|
|
@@ -308,14 +308,14 @@ export const mailTools: MosaddTool[] = [
|
|
|
308
308
|
handler: mp0st_send as MosaddTool["handler"],
|
|
309
309
|
},
|
|
310
310
|
{
|
|
311
|
-
name: "
|
|
311
|
+
name: "mAYL_view",
|
|
312
312
|
requires: "network",
|
|
313
313
|
description: "Read the full body and metadata of an email by message_id.",
|
|
314
314
|
inputSchema: mp0st_view_input,
|
|
315
315
|
handler: mp0st_view as MosaddTool["handler"],
|
|
316
316
|
},
|
|
317
317
|
{
|
|
318
|
-
name: "
|
|
318
|
+
name: "mAYL_delete",
|
|
319
319
|
requires: "network",
|
|
320
320
|
description:
|
|
321
321
|
"Delete one of the user's emails by message_id (from mp0st_list). Soft-delete — it stops showing in mp0st_list. Owner-scoped: only your own mail.",
|
|
@@ -323,7 +323,7 @@ export const mailTools: MosaddTool[] = [
|
|
|
323
323
|
handler: mp0st_delete as MosaddTool["handler"],
|
|
324
324
|
},
|
|
325
325
|
{
|
|
326
|
-
name: "
|
|
326
|
+
name: "mAYL_stats",
|
|
327
327
|
requires: "network",
|
|
328
328
|
description:
|
|
329
329
|
"Engagement summary for one sent email (by message_id): open_count, unique_opens, click_count, whether it was likely forwarded, first/last opened time, and a breakdown of tracked event types. Opens/clicks are real (tracking pixel + link-wrap); forward detection is best-effort (IP-subnet diversity). Owner-scoped.",
|
|
@@ -331,7 +331,7 @@ export const mailTools: MosaddTool[] = [
|
|
|
331
331
|
handler: mp0st_stats as MosaddTool["handler"],
|
|
332
332
|
},
|
|
333
333
|
{
|
|
334
|
-
name: "
|
|
334
|
+
name: "mAYL_events",
|
|
335
335
|
requires: "network",
|
|
336
336
|
description:
|
|
337
337
|
"Raw engagement timeline for one email (by message_id): every tracked event (pixel_open, link_click, forwarded, page_view, copy/print/focus signals) with timestamp, device type and link URL. Use mp0st_stats for the rollup; use this for the per-event detail. Owner-scoped.",
|
|
@@ -339,7 +339,7 @@ export const mailTools: MosaddTool[] = [
|
|
|
339
339
|
handler: mp0st_events as MosaddTool["handler"],
|
|
340
340
|
},
|
|
341
341
|
{
|
|
342
|
-
name: "
|
|
342
|
+
name: "mAYL_metrics",
|
|
343
343
|
requires: "network",
|
|
344
344
|
description:
|
|
345
345
|
"Mailbox-wide engagement aggregate across the user's sent mail: total_sent, opened_emails, open_rate_pct, total_opens, total_clicks, forwarded_emails. Owner-scoped.",
|
|
@@ -347,7 +347,7 @@ export const mailTools: MosaddTool[] = [
|
|
|
347
347
|
handler: mp0st_metrics as MosaddTool["handler"],
|
|
348
348
|
},
|
|
349
349
|
{
|
|
350
|
-
name: "
|
|
350
|
+
name: "mAYL_revoke",
|
|
351
351
|
requires: "network",
|
|
352
352
|
description:
|
|
353
353
|
"Revoke (recall) a sent email's secure-reader access by message_id — the recipient can no longer open the full message via the mosadd reader link (Virtru-style recall, immediate). Pass restore:true to re-enable. HONEST LIMIT: cannot un-send or claw back content the recipient already read, copied, or screenshotted — only disables future reader access. Owner-scoped.",
|
|
@@ -355,7 +355,7 @@ export const mailTools: MosaddTool[] = [
|
|
|
355
355
|
handler: mp0st_revoke as MosaddTool["handler"],
|
|
356
356
|
},
|
|
357
357
|
{
|
|
358
|
-
name: "
|
|
358
|
+
name: "mAYL_audit_export",
|
|
359
359
|
requires: "network",
|
|
360
360
|
description:
|
|
361
361
|
"Export a tamper-evident engagement audit report for one sent email (RMail-style): full event trail (opens, clicks, reader print/copy/forward signals) + totals, plus an HMAC-SHA256 signature over the canonical JSON so the report can be proven unaltered. For legal/compliance use. HONEST LIMIT: proves what mosadd observed; it is not a qualified delivery receipt (ERDS). Owner-scoped.",
|
|
@@ -363,7 +363,7 @@ export const mailTools: MosaddTool[] = [
|
|
|
363
363
|
handler: mp0st_audit_export as MosaddTool["handler"],
|
|
364
364
|
},
|
|
365
365
|
{
|
|
366
|
-
name: "
|
|
366
|
+
name: "mAYL_consent",
|
|
367
367
|
requires: "network",
|
|
368
368
|
description:
|
|
369
369
|
"Manage recipient tracking opt-outs (GDPR/ePrivacy). action 'list' = recipients who opted out of your tracking; 'check' {recipient} = whether one opted out; 'optin' {recipient} = re-enable. Recipients self-opt-out via the footer link in your tracked emails; mp0st_send then automatically sends them with NO pixel/link-wrap. Owner-scoped.",
|
|
@@ -371,7 +371,7 @@ export const mailTools: MosaddTool[] = [
|
|
|
371
371
|
handler: mp0st_consent as MosaddTool["handler"],
|
|
372
372
|
},
|
|
373
373
|
{
|
|
374
|
-
name: "
|
|
374
|
+
name: "mAYL_notify",
|
|
375
375
|
requires: "network",
|
|
376
376
|
description:
|
|
377
377
|
"Recent engagement feed across ALL your sent mail — the 'who just opened/clicked my mail' notifications stream (opens, clicks, forwards, reader print/copy signals), newest first, each with the email subject + recipient. Poll: pass the returned `cursor` back as `since` to get only new activity. Owner-scoped.",
|
package/src/tools/murl.ts
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* mURL — IRC-for-URLs: real-time chat attached to any web DOMAIN, AGENT-NATIVE.
|
|
3
3
|
*
|
|
4
4
|
* Same mosadd-edge Cloudflare Worker / Durable Object backend as mIRC edge, but the
|
|
5
|
-
* channel id is the
|
|
6
|
-
*
|
|
5
|
+
* channel id is the URL SLUG: host("."→"-") + path("/"→"__") (RFC-0004). A bare domain
|
|
6
|
+
* → the domain room; a full URL with a path → a per-PAGE room (the per-article ask).
|
|
7
|
+
* Auto-created on first activity (status "open"); the domain owner can verify/claim the
|
|
8
|
+
* whole domain (a domain block covers all its page rooms).
|
|
7
9
|
*
|
|
8
10
|
* THE WEDGE: every prior "chat on a web page" (Google Sidewiki, Genius, Hypothes.is,
|
|
9
11
|
* HERE.fm) died on the empty-room cold-start because they were HUMAN-ONLY — you arrive,
|
|
@@ -28,22 +30,34 @@ function hubKey(): string {
|
|
|
28
30
|
return key;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
/** A domain OR full URL → { domain, slug }.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
/** A domain OR full URL → { domain, slug }. mURL is keyed PER-URL (RFC-0004):
|
|
34
|
+
* slug = host("."→"-") + each path segment ("/"→"__"); scheme, query, fragment and
|
|
35
|
+
* trailing slash are stripped and segments are sanitised to [a-z0-9-]. A bare domain
|
|
36
|
+
* (no path) yields the DOMAIN room (back-compat); a URL with a path yields a PER-PAGE
|
|
37
|
+
* room. `domain` (host only) is returned for status/branding — a domain block covers
|
|
38
|
+
* every page room under it. */
|
|
39
|
+
function urlToSlug(input: string): { domain: string; slug: string } {
|
|
40
|
+
let s = String(input).trim().toLowerCase();
|
|
41
|
+
s = s.replace(/^[a-z]+:\/\//, "").replace(/[?#].*$/, ""); // strip scheme + query + fragment
|
|
42
|
+
const slash = s.indexOf("/");
|
|
43
|
+
let host = (slash >= 0 ? s.slice(0, slash) : s).replace(/:\d+$/, "");
|
|
35
44
|
if (host.startsWith("www.")) host = host.slice(4);
|
|
36
45
|
if (!host || !/^[a-z0-9-]+(\.[a-z0-9-]+)+$/.test(host)) {
|
|
37
|
-
throw new Error(`Invalid
|
|
46
|
+
throw new Error(`Invalid URL: "${input}" — pass a domain like "example.com" or a full URL.`);
|
|
38
47
|
}
|
|
39
|
-
|
|
48
|
+
const segs = (slash >= 0 ? s.slice(slash) : "")
|
|
49
|
+
.split("/")
|
|
50
|
+
.map((seg) => seg.replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, ""))
|
|
51
|
+
.filter(Boolean);
|
|
52
|
+
const base = host.replace(/\./g, "-");
|
|
53
|
+
return { domain: host, slug: segs.length ? `${base}__${segs.join("__")}` : base };
|
|
40
54
|
}
|
|
41
55
|
|
|
42
56
|
const DomainArg = z
|
|
43
57
|
.string()
|
|
44
58
|
.min(3)
|
|
45
|
-
.max(
|
|
46
|
-
.describe("A domain (
|
|
59
|
+
.max(2048)
|
|
60
|
+
.describe("A domain ('example.com') or a full URL. Keyed PER-URL: a bare domain → the domain room; a URL with a path (e.g. 'site.com/articles/abc') → that page's own room.");
|
|
47
61
|
|
|
48
62
|
// ── read ──────────────────────────────────────────────────────────────────────
|
|
49
63
|
const mURL_read_channel_input = z.object({
|
|
@@ -54,7 +68,7 @@ async function mURL_read_channel(
|
|
|
54
68
|
input: z.infer<typeof mURL_read_channel_input>,
|
|
55
69
|
ctx: MosaddToolContext,
|
|
56
70
|
): Promise<{ domain: string; messages: Array<{ id: string; from: string | null; text: string; timestamp: number }> }> {
|
|
57
|
-
const { domain, slug } =
|
|
71
|
+
const { domain, slug } = urlToSlug(input.domain);
|
|
58
72
|
const limit = input.limit ?? 50;
|
|
59
73
|
ctx.log("debug", "mURL_read_channel", { domain });
|
|
60
74
|
const r = await fetch(`${edgeUrl()}/c/${slug}/history?limit=${limit}`, {
|
|
@@ -81,7 +95,7 @@ async function mURL_post(
|
|
|
81
95
|
input: z.infer<typeof mURL_post_input>,
|
|
82
96
|
ctx: MosaddToolContext,
|
|
83
97
|
): Promise<{ domain: string; message_id: string; posted_at: number }> {
|
|
84
|
-
const { domain, slug } =
|
|
98
|
+
const { domain, slug } = urlToSlug(input.domain);
|
|
85
99
|
ctx.log("debug", "mURL_post", { domain });
|
|
86
100
|
const r = await fetch(`${edgeUrl()}/c/${slug}/send`, {
|
|
87
101
|
method: "POST",
|
|
@@ -148,7 +162,7 @@ async function mURL_presence(
|
|
|
148
162
|
input: z.infer<typeof mURL_presence_input>,
|
|
149
163
|
ctx: MosaddToolContext,
|
|
150
164
|
): Promise<{ domain: string; count: number; roster: string[]; status: string }> {
|
|
151
|
-
const { domain, slug } =
|
|
165
|
+
const { domain, slug } = urlToSlug(input.domain);
|
|
152
166
|
ctx.log("debug", "mURL_presence", { domain });
|
|
153
167
|
const r = await fetch(`${edgeUrl()}/c/${slug}/presence`);
|
|
154
168
|
if (!r.ok) {
|
package/src/tools/ptt-ingest.ts
CHANGED
|
@@ -1,82 +1,87 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* PTT
|
|
2
|
+
* mTALK_ingest_ptt — submit a recorded PTT "over" for transcription + RAG ingest.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* The actual mIRC/mDM voice-message PERSISTENCE (writing a message_meta row,
|
|
5
|
+
* fanning it out to listeners) is owned by the message-send/send-voice path,
|
|
6
|
+
* NOT by this tool. ptt-ingest exists purely to bridge a finished PTT segment
|
|
7
|
+
* into the user's RAG index — a row in `ptt_transcripts` (status='pending')
|
|
8
|
+
* + a transcribe job that lands in `user_embeddings(source_type='ptt')`.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* 2. call `ptt-ingest` EF with the attachment descriptor + routing (which
|
|
13
|
-
* channel/room the "over" belongs to). The EF persists a queued-PTT message.
|
|
14
|
-
* 3. if the user has opted in to RAG, `rag-transcribe` runs and the transcript
|
|
15
|
-
* lands in user_embeddings(source_type='ptt').
|
|
10
|
+
* Use this when an agent has a PTT audio buffer it wants searchable in the
|
|
11
|
+
* user's RAG later (e.g. "what did Alice tell me on PTT yesterday?"). The
|
|
12
|
+
* voice message itself is sent separately via mDM_send_voice / mIRC_send_voice.
|
|
16
13
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* Auth: standard Supabase session JWT (the caller's RAG opt-in is read from
|
|
15
|
+
* their account; opted-out callers get status='skipped_optout').
|
|
16
|
+
* LINEAR-3998 (P4.1 PTT unify) — re-arch 2026-06-27.
|
|
19
17
|
*/
|
|
20
|
-
|
|
21
18
|
import { z } from "zod";
|
|
22
19
|
import type { MosaddTool, MosaddToolContext } from "../types.js";
|
|
23
20
|
import { invokeFunction, readSupabaseEnv } from "../providers/supabase.js";
|
|
24
|
-
import { uploadBlob, decodeBase64Body } from "../providers/blob-upload.js";
|
|
25
21
|
|
|
26
22
|
const mTALK_ingest_ptt_input = z.object({
|
|
27
23
|
audio_base64: z
|
|
28
24
|
.string()
|
|
29
25
|
.min(1)
|
|
30
26
|
.max(20_000_000)
|
|
31
|
-
.describe("Recorded PTT 'over' as base64 (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.
|
|
27
|
+
.describe("Recorded PTT 'over' as base64 (a 'data:audio/…;base64,…' prefix is stripped if present)."),
|
|
28
|
+
mime_type: z
|
|
29
|
+
.string()
|
|
30
|
+
.min(1)
|
|
31
|
+
.max(120)
|
|
32
|
+
.default("audio/webm")
|
|
33
|
+
.describe("MIME type of the audio. Default audio/webm (browser MediaRecorder default)."),
|
|
34
|
+
direction: z
|
|
35
|
+
.enum(["human_to_agent", "agent_to_human"])
|
|
36
|
+
.describe("Direction the PTT crossed: who originated, who received. 'human_to_agent' = user spoke to an agent; 'agent_to_human' = agent spoke to the user."),
|
|
37
|
+
message_id: z
|
|
38
|
+
.string()
|
|
39
|
+
.min(1)
|
|
40
|
+
.max(120)
|
|
40
41
|
.optional()
|
|
41
|
-
.describe("
|
|
42
|
+
.describe("Optional id of the messages_meta row this PTT belongs to. When present, links the transcript back to the message for jump-to-source from RAG."),
|
|
43
|
+
thread_id: z
|
|
44
|
+
.string()
|
|
45
|
+
.min(1)
|
|
46
|
+
.max(120)
|
|
47
|
+
.optional()
|
|
48
|
+
.describe("Optional thread id (e.g. `chat:<channel_id>` or `dm:<a>:<b>`) so the transcript carries its conversational scope into RAG."),
|
|
42
49
|
});
|
|
43
50
|
|
|
51
|
+
interface PttIngestResponse {
|
|
52
|
+
ptt_id?: string;
|
|
53
|
+
status?: "pending" | "skipped_optout" | "queued";
|
|
54
|
+
enqueued?: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
44
57
|
async function mTALK_ingest_ptt(
|
|
45
58
|
input: z.infer<typeof mTALK_ingest_ptt_input>,
|
|
46
59
|
ctx: MosaddToolContext,
|
|
47
|
-
): Promise<{ ptt_id: string;
|
|
60
|
+
): Promise<{ ptt_id: string; status: string; opted_in: boolean }> {
|
|
48
61
|
readSupabaseEnv();
|
|
49
|
-
if (!input.channel_id && !input.room_id) {
|
|
50
|
-
throw new Error("mTALK_ingest_ptt requires one of channel_id or room_id to route the queued PTT.");
|
|
51
|
-
}
|
|
52
|
-
const prefix = input.channel_id ? `chat:${input.channel_id}` : `room:${input.room_id}`;
|
|
53
|
-
const attachment = await uploadBlob({
|
|
54
|
-
kind: "ptt",
|
|
55
|
-
bytes: decodeBase64Body(input.audio_base64),
|
|
56
|
-
mime: input.mime,
|
|
57
|
-
prefix,
|
|
58
|
-
duration_ms: input.duration_ms,
|
|
59
|
-
});
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
// Tolerate a "data:audio/…;base64,…" prefix from MediaRecorder/canvas captures.
|
|
64
|
+
const audio = input.audio_base64.replace(/^data:[^;]+;base64,/, "");
|
|
65
|
+
|
|
66
|
+
ctx.log("debug", "mTALK_ingest_ptt invoking ptt-ingest", {
|
|
67
|
+
direction: input.direction,
|
|
68
|
+
thread_id: input.thread_id ?? null,
|
|
69
|
+
mime_type: input.mime_type,
|
|
70
|
+
});
|
|
62
71
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}>("ptt-ingest", {
|
|
70
|
-
attachment,
|
|
71
|
-
channel_id: input.channel_id ?? null,
|
|
72
|
-
room_id: input.room_id ?? null,
|
|
73
|
-
transcribe: input.transcribe ?? true,
|
|
72
|
+
const res = await invokeFunction<PttIngestResponse>("ptt-ingest", {
|
|
73
|
+
audio_base64: audio,
|
|
74
|
+
mime_type: input.mime_type,
|
|
75
|
+
direction: input.direction,
|
|
76
|
+
message_id: input.message_id ?? null,
|
|
77
|
+
thread_id: input.thread_id ?? null,
|
|
74
78
|
});
|
|
75
79
|
|
|
80
|
+
const status = res.status ?? "pending";
|
|
76
81
|
return {
|
|
77
82
|
ptt_id: res.ptt_id ?? "",
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
status,
|
|
84
|
+
opted_in: status !== "skipped_optout",
|
|
80
85
|
};
|
|
81
86
|
}
|
|
82
87
|
|
|
@@ -85,7 +90,7 @@ export const pttIngestTools: MosaddTool[] = [
|
|
|
85
90
|
name: "mTALK_ingest_ptt",
|
|
86
91
|
requires: "network",
|
|
87
92
|
description:
|
|
88
|
-
"
|
|
93
|
+
"Submit a finished PTT 'over' (push-to-talk audio segment) for transcription into the caller's RAG index — so 'what did X say on PTT?' is searchable later. The PERSISTENCE of the voice message itself (the message_meta row + fan-out) is handled by mDM_send_voice / mIRC_send_voice; this tool is the transcription bridge only. Honors per-user RAG opt-in: opted-out callers get status='skipped_optout' (no transcript stored). Auth: Supabase session JWT.",
|
|
89
94
|
inputSchema: mTALK_ingest_ptt_input,
|
|
90
95
|
handler: mTALK_ingest_ptt as MosaddTool["handler"],
|
|
91
96
|
},
|