@mosadd/mcp 3.0.0-alpha.17 → 3.0.0-alpha.19

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.
@@ -1136,448 +1136,212 @@ var mircEdgeTools = [
1136
1136
  }
1137
1137
  ];
1138
1138
 
1139
- // src/tools/mroom.ts
1140
- import { z as z7 } from "zod";
1141
- var RoomId2 = z7.string().min(1).describe("Private room id (UUID).");
1142
- var mROOM_voice_join_input = z7.object({
1143
- room_id: RoomId2,
1144
- video: z7.boolean().optional().describe("Request video instead of audio-only. Default false.")
1145
- });
1146
- var mROOM_create_input = z7.object({
1147
- ttl_seconds: z7.number().int().min(60).max(86400 * 30).default(86400).optional().describe("Time-to-live in seconds. Defaults to 24 h. Max 30 days.")
1148
- });
1149
- var mROOM_join_input = z7.object({
1150
- room_id: RoomId2
1151
- });
1152
- var mROOM_close_input = z7.object({
1153
- room_id: RoomId2
1154
- });
1155
- var mROOM_leave_input = z7.object({
1156
- room_id: RoomId2
1157
- });
1158
- var mROOM_list_input = z7.object({});
1159
- var mROOM_create_guest_link_input = z7.object({
1160
- room_id: RoomId2,
1161
- display_name: z7.string().min(1).max(80).describe("Display name the guest will appear under. They never sign up \u2014 this is the only identifier."),
1162
- ttl_seconds: z7.number().int().min(60).max(86400 * 7).default(3600).optional().describe("How long the guest token is valid. Default 1 h, max 7 days.")
1163
- });
1164
- async function mROOM_create(input, ctx) {
1165
- readSupabaseEnv();
1166
- const expires_at = new Date(Date.now() + (input.ttl_seconds ?? 86400) * 1e3).toISOString();
1167
- ctx.log("debug", "mROOM_create invoking privroom-manage", { expires_at });
1168
- return await invokeFunction("privroom-manage", {
1169
- action: "create",
1170
- expires_at
1171
- });
1172
- }
1173
- async function mROOM_join(input, ctx) {
1174
- readSupabaseEnv();
1175
- ctx.log("debug", "mROOM_join invoking privroom-manage", { room_id: input.room_id });
1176
- return await invokeFunction("privroom-manage", {
1177
- action: "join",
1178
- room_id: input.room_id
1179
- });
1180
- }
1181
- async function mROOM_close(input, ctx) {
1182
- readSupabaseEnv();
1183
- ctx.log("debug", "mROOM_close invoking privroom-manage", { room_id: input.room_id });
1184
- return await invokeFunction("privroom-manage", {
1185
- action: "close",
1186
- room_id: input.room_id
1187
- });
1188
- }
1189
- async function mROOM_leave(input, ctx) {
1190
- readSupabaseEnv();
1191
- ctx.log("debug", "mROOM_leave invoking privroom-manage", { room_id: input.room_id });
1192
- return await invokeFunction("privroom-manage", {
1193
- action: "leave",
1194
- room_id: input.room_id
1195
- });
1196
- }
1197
- async function mROOM_list(_input, ctx) {
1198
- readSupabaseEnv();
1199
- ctx.log("debug", "mROOM_list invoking privroom-manage");
1200
- return await invokeFunction("privroom-manage", { action: "list" });
1201
- }
1202
- async function mROOM_create_guest_link(input, ctx) {
1203
- readSupabaseEnv();
1204
- ctx.log("debug", "mROOM_create_guest_link invoking privroom-guest-token", {
1205
- room_id: input.room_id
1206
- });
1207
- const result = await invokeFunction("privroom-guest-token", {
1208
- room_id: input.room_id,
1209
- display_name: input.display_name,
1210
- ttl_seconds: input.ttl_seconds ?? 3600
1211
- });
1212
- return {
1213
- token: result.token,
1214
- join_url: `https://mosadd.com/r/${input.room_id}?t=${result.token}`,
1215
- expires_at: result.expires_at
1216
- };
1217
- }
1218
- async function mROOM_voice_join(input, ctx) {
1219
- const ticket = await ctx.providers.voice.joinTicket(input.room_id);
1220
- ctx.log("debug", "mROOM_voice_join", { room_id: ticket.roomId, identity: ticket.identity });
1221
- return {
1222
- room_id: ticket.roomId,
1223
- token: ticket.token,
1224
- url: ticket.url,
1225
- identity: ticket.identity,
1226
- mode: input.video ? "video" : "audio"
1227
- };
1228
- }
1229
- var mroomTools = [
1230
- {
1231
- name: "mROOM_create",
1232
- requires: "network",
1233
- description: "Create an ephemeral private room. Auto-joins the creator. Defaults to 24 h TTL \u2014 pass ttl_seconds to override.",
1234
- inputSchema: mROOM_create_input,
1235
- handler: mROOM_create
1236
- },
1237
- {
1238
- name: "mROOM_create_guest_link",
1239
- requires: "network",
1240
- description: "USP: Generate a short-lived join link that lets a person enter the room WITHOUT a mosadd account. Returns { token, join_url, expires_at }. Share the join_url out-of-band (email, SMS, QR). Use case: support call, live-stream after-party, anonymous tipline.",
1241
- inputSchema: mROOM_create_guest_link_input,
1242
- handler: mROOM_create_guest_link
1243
- },
1244
- {
1245
- name: "mROOM_join",
1246
- requires: "network",
1247
- description: "Join an existing private room (current user, not a guest).",
1248
- inputSchema: mROOM_join_input,
1249
- handler: mROOM_join
1250
- },
1251
- {
1252
- name: "mROOM_leave",
1253
- requires: "network",
1254
- description: "Leave a private room.",
1255
- inputSchema: mROOM_leave_input,
1256
- handler: mROOM_leave
1257
- },
1258
- {
1259
- name: "mROOM_close",
1260
- requires: "network",
1261
- description: "Close a private room and remove all members. Founder only.",
1262
- inputSchema: mROOM_close_input,
1263
- handler: mROOM_close
1264
- },
1265
- {
1266
- name: "mROOM_list",
1267
- requires: "network",
1268
- description: "List private rooms the current user belongs to.",
1269
- inputSchema: mROOM_list_input,
1270
- handler: mROOM_list
1271
- },
1272
- {
1273
- name: "mROOM_voice_join",
1274
- requires: "network",
1275
- description: "Join an mROOM's full-duplex GROUP voice (everyone can talk \u2014 no walkie-talkie floor; that's mTALK). Returns media credentials (token + url) for the room's audio/video transport. Be a room member first (mROOM_join or a guest link). Set video:true for video.",
1276
- inputSchema: mROOM_voice_join_input,
1277
- handler: mROOM_voice_join
1278
- }
1279
- ];
1280
-
1281
- // src/tools/mroom-messages.ts
1282
- import { z as z8 } from "zod";
1283
- var PROTOCOL_VERSION4 = "mosadd.chat.v1";
1284
- var RoomId3 = z8.string().min(1).describe("Private room id (UUID). From mROOM_create / mROOM_list.");
1285
- var mROOM_send_message_input = z8.object({
1286
- room_id: RoomId3,
1287
- text: z8.string().min(1).max(64e3).describe("Message body (UTF-8). Max 64 KB."),
1288
- reply_to_id: z8.string().optional().describe("Optional id of the message being replied to.")
1289
- });
1290
- var mROOM_list_messages_input = z8.object({
1291
- room_id: RoomId3,
1292
- limit: z8.number().int().min(1).max(200).default(50).optional(),
1293
- cursor: z8.string().optional().describe("Opaque pagination cursor from a prior list response.")
1294
- });
1295
- function packPlaintextPayload3(text, replyToId) {
1296
- const envelope = {
1297
- v: PROTOCOL_VERSION4,
1298
- type: "text",
1299
- text,
1300
- reply_to: replyToId ?? null,
1301
- sent_at: (/* @__PURE__ */ new Date()).toISOString()
1302
- };
1303
- return Buffer.from(JSON.stringify(envelope), "utf8").toString("base64");
1304
- }
1305
- function unpackPayload3(payload) {
1306
- try {
1307
- const json = Buffer.from(payload, "base64").toString("utf8");
1308
- const obj = JSON.parse(json);
1309
- if (typeof obj?.text === "string") return obj;
1310
- } catch {
1311
- }
1312
- return { text: "<ciphertext>" };
1313
- }
1314
- async function mROOM_send_message(input, ctx) {
1315
- readSupabaseEnv();
1316
- const thread_id = `privroom:${input.room_id}`;
1317
- ctx.log("debug", "mROOM_send_message", { thread_id });
1318
- const data = await invokeFunction(
1319
- "message-send",
1320
- {
1321
- space_id: "rooms",
1322
- thread_id,
1323
- encrypted_payload: packPlaintextPayload3(input.text, input.reply_to_id),
1324
- message_type: "text",
1325
- protocol_version: PROTOCOL_VERSION4,
1326
- reply_to_id: input.reply_to_id ?? null
1327
- }
1328
- );
1329
- if (!data?.message?.id) {
1330
- throw new Error("message-send returned no message id");
1331
- }
1332
- return {
1333
- message_id: data.message.id,
1334
- delivered_at: data.message.created_at ?? (/* @__PURE__ */ new Date()).toISOString(),
1335
- thread_id
1336
- };
1337
- }
1338
- async function mROOM_list_messages(input, ctx) {
1339
- readSupabaseEnv();
1340
- const thread_id = `privroom:${input.room_id}`;
1341
- ctx.log("debug", "mROOM_list_messages", { thread_id });
1342
- const data = await invokeFunction("message-list", {
1343
- space_id: "rooms",
1344
- thread_id,
1345
- limit: input.limit ?? 50,
1346
- cursor: input.cursor
1347
- });
1348
- return {
1349
- messages: (data?.messages ?? []).map((m) => ({
1350
- id: m.id,
1351
- sender_identity_id: m.sender_identity_id,
1352
- text: unpackPayload3(m.encrypted_payload).text,
1353
- timestamp: m.created_at
1354
- })),
1355
- next_cursor: data?.next_cursor ?? null
1356
- };
1357
- }
1358
- var mroomMessagesTools = [
1359
- {
1360
- name: "mROOM_send_message",
1361
- requires: "network",
1362
- description: "Send a text message into a private room. Authorisation: must be a member (or guest with a valid token). Alpha payload is plaintext base64; v0.2 wraps with Double Ratchet.",
1363
- inputSchema: mROOM_send_message_input,
1364
- handler: mROOM_send_message
1365
- },
1366
- {
1367
- name: "mROOM_list_messages",
1368
- requires: "network",
1369
- description: "List recent text messages in a private room. Cursor-paginated, newest first.",
1370
- inputSchema: mROOM_list_messages_input,
1371
- handler: mROOM_list_messages
1372
- }
1373
- ];
1374
-
1375
1139
  // src/tools/mail.ts
1376
- import { z as z9 } from "zod";
1377
- var EmailAddress = z9.string().email().max(254).describe("RFC 5321 email address.");
1378
- var MessageId = z9.string().min(1).describe("Message id (UUID) from mAIL_send or inbox.");
1379
- var mAIL_send_input = z9.object({
1380
- to: z9.union([EmailAddress, z9.array(EmailAddress).min(1).max(50)]).describe(
1140
+ import { z as z7 } from "zod";
1141
+ var EmailAddress = z7.string().email().max(254).describe("RFC 5321 email address.");
1142
+ var MessageId = z7.string().min(1).describe("Message id (UUID) from mp0st_send or inbox.");
1143
+ var mp0st_send_input = z7.object({
1144
+ to: z7.union([EmailAddress, z7.array(EmailAddress).min(1).max(50)]).describe(
1381
1145
  "Recipient(s). Single address or array of up to 50."
1382
1146
  ),
1383
- subject: z9.string().min(1).max(998).describe("Email subject line. Max 998 chars (RFC 5322)."),
1384
- body_text: z9.string().max(1048576).optional().describe("Plain text body. Max 1 MB."),
1385
- body_html: z9.string().max(1048576).optional().describe("HTML body. Max 1 MB."),
1386
- cc: z9.array(EmailAddress).max(50).optional(),
1387
- bcc: z9.array(EmailAddress).max(50).optional(),
1147
+ subject: z7.string().min(1).max(998).describe("Email subject line. Max 998 chars (RFC 5322)."),
1148
+ body_text: z7.string().max(1048576).optional().describe("Plain text body. Max 1 MB."),
1149
+ body_html: z7.string().max(1048576).optional().describe("HTML body. Max 1 MB."),
1150
+ cc: z7.array(EmailAddress).max(50).optional(),
1151
+ bcc: z7.array(EmailAddress).max(50).optional(),
1388
1152
  reply_to: EmailAddress.optional(),
1389
- tracking: z9.boolean().optional().describe("Open-pixel + link-click tracking. Default true. Set false to send with NO tracking (privacy / GDPR-friendly)."),
1390
- force_reader: z9.boolean().optional().describe("Default false. If true, the email body is a stub only and the recipient must open it in mosadd's secure reader \u2014 maximizes tracking (print/copy/time-on-read become observable). Best for confidential / legal mail."),
1391
- disclose_tracking: z9.boolean().optional().describe("Default false. If true (and tracking on), append a tracking-disclosure footer to the email \u2014 recommended for GDPR/ePrivacy compliance."),
1392
- watermark: z9.union([z9.boolean(), z9.string().max(120)]).optional().describe("Inject a faint recipient watermark into the secure reader (shows in screenshots/prints). Pass true to watermark with the recipient address, or a custom string."),
1393
- auto_destruct: z9.enum(["1h", "24h", "7d"]).optional().describe("Self-destruct timer: the secure-reader link expires after this window.")
1153
+ tracking: z7.boolean().optional().describe("Open-pixel + link-click tracking. Default true. Set false to send with NO tracking (privacy / GDPR-friendly)."),
1154
+ force_reader: z7.boolean().optional().describe("Default false. If true, the email body is a stub only and the recipient must open it in mosadd's secure reader \u2014 maximizes tracking (print/copy/time-on-read become observable). Best for confidential / legal mail."),
1155
+ disclose_tracking: z7.boolean().optional().describe("Default false. If true (and tracking on), append a tracking-disclosure footer to the email \u2014 recommended for GDPR/ePrivacy compliance."),
1156
+ watermark: z7.union([z7.boolean(), z7.string().max(120)]).optional().describe("Inject a faint recipient watermark into the secure reader (shows in screenshots/prints). Pass true to watermark with the recipient address, or a custom string."),
1157
+ auto_destruct: z7.enum(["1h", "24h", "7d"]).optional().describe("Self-destruct timer: the secure-reader link expires after this window.")
1394
1158
  });
1395
- var mAIL_view_input = z9.object({
1159
+ var mp0st_view_input = z7.object({
1396
1160
  message_id: MessageId
1397
1161
  });
1398
- var mAIL_delete_input = z9.object({
1162
+ var mp0st_delete_input = z7.object({
1399
1163
  message_id: MessageId
1400
1164
  });
1401
- var mAIL_list_input = z9.object({
1402
- direction: z9.enum(["inbound", "outbound"]).optional().describe("Filter to received (inbound) or sent (outbound) mail. Omit for both."),
1403
- limit: z9.number().int().min(1).max(200).optional().describe("Max emails to return. Default 50."),
1404
- before: z9.string().optional().describe("Pagination cursor: pass the previous response's next_cursor to get the next (older) page.")
1165
+ var mp0st_list_input = z7.object({
1166
+ direction: z7.enum(["inbound", "outbound"]).optional().describe("Filter to received (inbound) or sent (outbound) mail. Omit for both."),
1167
+ limit: z7.number().int().min(1).max(200).optional().describe("Max emails to return. Default 50."),
1168
+ before: z7.string().optional().describe("Pagination cursor: pass the previous response's next_cursor to get the next (older) page.")
1405
1169
  });
1406
- var mAIL_stats_input = z9.object({
1170
+ var mp0st_stats_input = z7.object({
1407
1171
  message_id: MessageId
1408
1172
  });
1409
- var mAIL_events_input = z9.object({
1173
+ var mp0st_events_input = z7.object({
1410
1174
  message_id: MessageId
1411
1175
  });
1412
- var mAIL_metrics_input = z9.object({});
1413
- var mAIL_revoke_input = z9.object({
1176
+ var mp0st_metrics_input = z7.object({});
1177
+ var mp0st_revoke_input = z7.object({
1414
1178
  message_id: MessageId,
1415
- restore: z9.boolean().optional().describe("Set true to UN-revoke (restore access). Default false = revoke.")
1179
+ restore: z7.boolean().optional().describe("Set true to UN-revoke (restore access). Default false = revoke.")
1416
1180
  });
1417
- var mAIL_audit_export_input = z9.object({
1181
+ var mp0st_audit_export_input = z7.object({
1418
1182
  message_id: MessageId
1419
1183
  });
1420
- var mAIL_consent_input = z9.object({
1421
- action: z9.enum(["list", "check", "optin"]).describe("'list' = recipients who opted out of your tracking; 'check' = is one recipient opted out; 'optin' = re-enable tracking for a recipient."),
1184
+ var mp0st_consent_input = z7.object({
1185
+ action: z7.enum(["list", "check", "optin"]).describe("'list' = recipients who opted out of your tracking; 'check' = is one recipient opted out; 'optin' = re-enable tracking for a recipient."),
1422
1186
  recipient: EmailAddress.optional().describe("Required for 'check' and 'optin'.")
1423
1187
  });
1424
- var mAIL_notify_input = z9.object({
1425
- since: z9.string().optional().describe("ISO-8601 cursor \u2014 return only events newer than this. Pass the previous response's `cursor` to poll for new activity."),
1426
- limit: z9.number().int().min(1).max(200).optional().describe("Max events. Default 50.")
1188
+ var mp0st_notify_input = z7.object({
1189
+ since: z7.string().optional().describe("ISO-8601 cursor \u2014 return only events newer than this. Pass the previous response's `cursor` to poll for new activity."),
1190
+ limit: z7.number().int().min(1).max(200).optional().describe("Max events. Default 50.")
1427
1191
  });
1428
- async function mAIL_send(input, ctx) {
1192
+ async function mp0st_send(input, ctx) {
1429
1193
  readSupabaseEnv();
1430
1194
  if (!input.body_text && !input.body_html) {
1431
- throw new Error("mAIL_send requires at least one of body_text or body_html.");
1195
+ throw new Error("mp0st_send requires at least one of body_text or body_html.");
1432
1196
  }
1433
- ctx.log("debug", "mAIL_send invoking mp0st-send", { to: input.to });
1197
+ ctx.log("debug", "mp0st_send invoking mp0st-send", { to: input.to });
1434
1198
  const res = await invokeFunction("mp0st-send", input);
1435
1199
  if (res.error) throw new Error(res.error);
1436
1200
  return { message_id: res.email_id ?? "", status: res.status ?? "sent", is_internal: res.is_internal ?? false };
1437
1201
  }
1438
- async function mAIL_view(input, ctx) {
1202
+ async function mp0st_view(input, ctx) {
1439
1203
  readSupabaseEnv();
1440
- ctx.log("debug", "mAIL_view invoking mp0st-get", { message_id: input.message_id });
1204
+ ctx.log("debug", "mp0st_view invoking mp0st-get", { message_id: input.message_id });
1441
1205
  return await invokeFunction("mp0st-get", { message_id: input.message_id });
1442
1206
  }
1443
- async function mAIL_list(input, ctx) {
1207
+ async function mp0st_list(input, ctx) {
1444
1208
  readSupabaseEnv();
1445
- ctx.log("debug", "mAIL_list invoking mp0st-list", { direction: input.direction });
1209
+ ctx.log("debug", "mp0st_list invoking mp0st-list", { direction: input.direction });
1446
1210
  return await invokeFunction("mp0st-list", {
1447
1211
  direction: input.direction ?? null,
1448
1212
  limit: input.limit ?? 50,
1449
1213
  before: input.before ?? null
1450
1214
  });
1451
1215
  }
1452
- async function mAIL_delete(input, ctx) {
1216
+ async function mp0st_delete(input, ctx) {
1453
1217
  readSupabaseEnv();
1454
- ctx.log("debug", "mAIL_delete invoking mp0st-delete", { message_id: input.message_id });
1218
+ ctx.log("debug", "mp0st_delete invoking mp0st-delete", { message_id: input.message_id });
1455
1219
  return await invokeFunction("mp0st-delete", {
1456
1220
  message_id: input.message_id
1457
1221
  });
1458
1222
  }
1459
- async function mAIL_stats(input, ctx) {
1223
+ async function mp0st_stats(input, ctx) {
1460
1224
  readSupabaseEnv();
1461
- ctx.log("debug", "mAIL_stats invoking mp0st-stats", { message_id: input.message_id });
1225
+ ctx.log("debug", "mp0st_stats invoking mp0st-stats", { message_id: input.message_id });
1462
1226
  return await invokeFunction("mp0st-stats", {
1463
1227
  message_id: input.message_id
1464
1228
  });
1465
1229
  }
1466
- async function mAIL_events(input, ctx) {
1230
+ async function mp0st_events(input, ctx) {
1467
1231
  readSupabaseEnv();
1468
- ctx.log("debug", "mAIL_events invoking mp0st-stats", { message_id: input.message_id });
1232
+ ctx.log("debug", "mp0st_events invoking mp0st-stats", { message_id: input.message_id });
1469
1233
  return await invokeFunction("mp0st-stats", { message_id: input.message_id, events: true });
1470
1234
  }
1471
- async function mAIL_metrics(_input, ctx) {
1235
+ async function mp0st_metrics(_input, ctx) {
1472
1236
  readSupabaseEnv();
1473
- ctx.log("debug", "mAIL_metrics invoking mp0st-stats");
1237
+ ctx.log("debug", "mp0st_metrics invoking mp0st-stats");
1474
1238
  return await invokeFunction("mp0st-stats", {});
1475
1239
  }
1476
- async function mAIL_revoke(input, ctx) {
1240
+ async function mp0st_revoke(input, ctx) {
1477
1241
  readSupabaseEnv();
1478
- ctx.log("debug", "mAIL_revoke invoking mp0st-revoke", { message_id: input.message_id, restore: !!input.restore });
1242
+ ctx.log("debug", "mp0st_revoke invoking mp0st-revoke", { message_id: input.message_id, restore: !!input.restore });
1479
1243
  return await invokeFunction("mp0st-revoke", {
1480
1244
  message_id: input.message_id,
1481
1245
  restore: input.restore ?? false
1482
1246
  });
1483
1247
  }
1484
- async function mAIL_audit_export(input, ctx) {
1248
+ async function mp0st_audit_export(input, ctx) {
1485
1249
  readSupabaseEnv();
1486
- ctx.log("debug", "mAIL_audit_export invoking mp0st-audit", { message_id: input.message_id });
1250
+ ctx.log("debug", "mp0st_audit_export invoking mp0st-audit", { message_id: input.message_id });
1487
1251
  return await invokeFunction("mp0st-audit", { message_id: input.message_id });
1488
1252
  }
1489
- async function mAIL_consent(input, ctx) {
1253
+ async function mp0st_consent(input, ctx) {
1490
1254
  readSupabaseEnv();
1491
- ctx.log("debug", "mAIL_consent invoking mp0st-consent", { action: input.action });
1255
+ ctx.log("debug", "mp0st_consent invoking mp0st-consent", { action: input.action });
1492
1256
  return await invokeFunction("mp0st-consent", { action: input.action, recipient: input.recipient ?? null });
1493
1257
  }
1494
- async function mAIL_notify(input, ctx) {
1258
+ async function mp0st_notify(input, ctx) {
1495
1259
  readSupabaseEnv();
1496
- ctx.log("debug", "mAIL_notify invoking mp0st-notify", { since: input.since });
1260
+ ctx.log("debug", "mp0st_notify invoking mp0st-notify", { since: input.since });
1497
1261
  return await invokeFunction("mp0st-notify", { action: "feed", since: input.since ?? null, limit: input.limit ?? 50 });
1498
1262
  }
1499
1263
  var mailTools = [
1500
1264
  {
1501
- name: "mAIL_list",
1265
+ name: "mp0st_list",
1502
1266
  requires: "network",
1503
- description: "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 mAIL_view to read a full message body.",
1504
- inputSchema: mAIL_list_input,
1505
- handler: mAIL_list
1267
+ description: "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.",
1268
+ inputSchema: mp0st_list_input,
1269
+ handler: mp0st_list
1506
1270
  },
1507
1271
  {
1508
- name: "mAIL_send",
1272
+ name: "mp0st_send",
1509
1273
  requires: "network",
1510
1274
  description: "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 \u2192 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').",
1511
- inputSchema: mAIL_send_input,
1512
- handler: mAIL_send
1275
+ inputSchema: mp0st_send_input,
1276
+ handler: mp0st_send
1513
1277
  },
1514
1278
  {
1515
- name: "mAIL_view",
1279
+ name: "mp0st_view",
1516
1280
  requires: "network",
1517
1281
  description: "Read the full body and metadata of an email by message_id.",
1518
- inputSchema: mAIL_view_input,
1519
- handler: mAIL_view
1282
+ inputSchema: mp0st_view_input,
1283
+ handler: mp0st_view
1520
1284
  },
1521
1285
  {
1522
- name: "mAIL_delete",
1286
+ name: "mp0st_delete",
1523
1287
  requires: "network",
1524
- description: "Delete one of the user's emails by message_id (from mAIL_list). Soft-delete \u2014 it stops showing in mAIL_list. Owner-scoped: only your own mail.",
1525
- inputSchema: mAIL_delete_input,
1526
- handler: mAIL_delete
1288
+ description: "Delete one of the user's emails by message_id (from mp0st_list). Soft-delete \u2014 it stops showing in mp0st_list. Owner-scoped: only your own mail.",
1289
+ inputSchema: mp0st_delete_input,
1290
+ handler: mp0st_delete
1527
1291
  },
1528
1292
  {
1529
- name: "mAIL_stats",
1293
+ name: "mp0st_stats",
1530
1294
  requires: "network",
1531
1295
  description: "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.",
1532
- inputSchema: mAIL_stats_input,
1533
- handler: mAIL_stats
1296
+ inputSchema: mp0st_stats_input,
1297
+ handler: mp0st_stats
1534
1298
  },
1535
1299
  {
1536
- name: "mAIL_events",
1300
+ name: "mp0st_events",
1537
1301
  requires: "network",
1538
- description: "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 mAIL_stats for the rollup; use this for the per-event detail. Owner-scoped.",
1539
- inputSchema: mAIL_events_input,
1540
- handler: mAIL_events
1302
+ description: "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.",
1303
+ inputSchema: mp0st_events_input,
1304
+ handler: mp0st_events
1541
1305
  },
1542
1306
  {
1543
- name: "mAIL_metrics",
1307
+ name: "mp0st_metrics",
1544
1308
  requires: "network",
1545
1309
  description: "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.",
1546
- inputSchema: mAIL_metrics_input,
1547
- handler: mAIL_metrics
1310
+ inputSchema: mp0st_metrics_input,
1311
+ handler: mp0st_metrics
1548
1312
  },
1549
1313
  {
1550
- name: "mAIL_revoke",
1314
+ name: "mp0st_revoke",
1551
1315
  requires: "network",
1552
1316
  description: "Revoke (recall) a sent email's secure-reader access by message_id \u2014 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 \u2014 only disables future reader access. Owner-scoped.",
1553
- inputSchema: mAIL_revoke_input,
1554
- handler: mAIL_revoke
1317
+ inputSchema: mp0st_revoke_input,
1318
+ handler: mp0st_revoke
1555
1319
  },
1556
1320
  {
1557
- name: "mAIL_audit_export",
1321
+ name: "mp0st_audit_export",
1558
1322
  requires: "network",
1559
1323
  description: "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.",
1560
- inputSchema: mAIL_audit_export_input,
1561
- handler: mAIL_audit_export
1324
+ inputSchema: mp0st_audit_export_input,
1325
+ handler: mp0st_audit_export
1562
1326
  },
1563
1327
  {
1564
- name: "mAIL_consent",
1328
+ name: "mp0st_consent",
1565
1329
  requires: "network",
1566
- description: "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; mAIL_send then automatically sends them with NO pixel/link-wrap. Owner-scoped.",
1567
- inputSchema: mAIL_consent_input,
1568
- handler: mAIL_consent
1330
+ description: "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.",
1331
+ inputSchema: mp0st_consent_input,
1332
+ handler: mp0st_consent
1569
1333
  },
1570
1334
  {
1571
- name: "mAIL_notify",
1335
+ name: "mp0st_notify",
1572
1336
  requires: "network",
1573
1337
  description: "Recent engagement feed across ALL your sent mail \u2014 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.",
1574
- inputSchema: mAIL_notify_input,
1575
- handler: mAIL_notify
1338
+ inputSchema: mp0st_notify_input,
1339
+ handler: mp0st_notify
1576
1340
  }
1577
1341
  ];
1578
1342
 
1579
1343
  // src/tools/mail-provenance.ts
1580
- import { z as z10 } from "zod";
1344
+ import { z as z8 } from "zod";
1581
1345
  var DEFAULT_SUPABASE_URL2 = "https://rooffhgbxafyjcwmwpsy.supabase.co";
1582
1346
  function supabaseUrl2() {
1583
1347
  return process.env.MOSADD_SUPABASE_URL?.replace(/\/$/, "") ?? process.env.SUPABASE_URL?.replace(/\/$/, "") ?? DEFAULT_SUPABASE_URL2;
@@ -1585,23 +1349,23 @@ function supabaseUrl2() {
1585
1349
  function hubKey2() {
1586
1350
  return process.env.MOSADD_API_KEY ?? process.env.MOSADD_HUB_KEY ?? null;
1587
1351
  }
1588
- var EmailAddress2 = z10.string().email().max(254);
1589
- var mAIL_send_as_agent_input = z10.object({
1590
- to: z10.union([EmailAddress2, z10.array(EmailAddress2).min(1).max(50)]),
1591
- subject: z10.string().min(1).max(998),
1592
- body_text: z10.string().max(1048576).optional(),
1593
- body_html: z10.string().max(1048576).optional(),
1594
- cc: z10.array(EmailAddress2).max(50).optional(),
1595
- bcc: z10.array(EmailAddress2).max(50).optional(),
1352
+ var EmailAddress2 = z8.string().email().max(254);
1353
+ var mp0st_send_as_agent_input = z8.object({
1354
+ to: z8.union([EmailAddress2, z8.array(EmailAddress2).min(1).max(50)]),
1355
+ subject: z8.string().min(1).max(998),
1356
+ body_text: z8.string().max(1048576).optional(),
1357
+ body_html: z8.string().max(1048576).optional(),
1358
+ cc: z8.array(EmailAddress2).max(50).optional(),
1359
+ bcc: z8.array(EmailAddress2).max(50).optional(),
1596
1360
  reply_to: EmailAddress2.optional(),
1597
- tracking: z10.boolean().optional(),
1598
- agent_id: z10.string().min(1).max(120).describe("Stable id of the agent doing the send. Stamped as sent_by_agent_id for provenance."),
1599
- task_id: z10.string().min(1).max(120).optional().describe("Optional id of the task/run this send belongs to. Stamped as sent_by_task_id.")
1361
+ tracking: z8.boolean().optional(),
1362
+ agent_id: z8.string().min(1).max(120).describe("Stable id of the agent doing the send. Stamped as sent_by_agent_id for provenance."),
1363
+ task_id: z8.string().min(1).max(120).optional().describe("Optional id of the task/run this send belongs to. Stamped as sent_by_task_id.")
1600
1364
  });
1601
1365
  async function mintHubClaim(agentId, taskId) {
1602
1366
  const key = hubKey2();
1603
1367
  if (!key) {
1604
- throw new Error("mAIL_send_as_agent needs MOSADD_API_KEY (hub key) to mint a provenance claim.");
1368
+ throw new Error("mp0st_send_as_agent needs MOSADD_API_KEY (hub key) to mint a provenance claim.");
1605
1369
  }
1606
1370
  const r = await fetch(`${supabaseUrl2()}/functions/v1/hub-claim-mint`, {
1607
1371
  method: "POST",
@@ -1616,12 +1380,12 @@ async function mintHubClaim(agentId, taskId) {
1616
1380
  if (!data?.token) throw new Error("hub-claim-mint: no token in response");
1617
1381
  return data.token;
1618
1382
  }
1619
- async function mAIL_send_as_agent(input, ctx) {
1383
+ async function mp0st_send_as_agent(input, ctx) {
1620
1384
  if (!input.body_text && !input.body_html) {
1621
- throw new Error("mAIL_send_as_agent requires at least one of body_text or body_html.");
1385
+ throw new Error("mp0st_send_as_agent requires at least one of body_text or body_html.");
1622
1386
  }
1623
1387
  const claim = await mintHubClaim(input.agent_id, input.task_id);
1624
- ctx.log("debug", "mAIL_send_as_agent invoking mp0st-send with hub-claim", { agent_id: input.agent_id });
1388
+ ctx.log("debug", "mp0st_send_as_agent invoking mp0st-send with hub-claim", { agent_id: input.agent_id });
1625
1389
  const { agent_id, task_id, ...mailFields } = input;
1626
1390
  const r = await fetch(`${supabaseUrl2()}/functions/v1/mp0st-send`, {
1627
1391
  method: "POST",
@@ -1648,25 +1412,25 @@ async function mAIL_send_as_agent(input, ctx) {
1648
1412
  }
1649
1413
  var mailProvenanceTools = [
1650
1414
  {
1651
- name: "mAIL_send_as_agent",
1415
+ name: "mp0st_send_as_agent",
1652
1416
  requires: "network",
1653
- description: "Send an email ATTRIBUTED TO THE AGENT (provenance-stamped). Unlike mAIL_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 \u2014 so recipients and compliance can see the mail was agent-originated. Auth: presents a hub-claim JWT (needs MOSADD_API_KEY). SCAFFOLD: depends on mp0st-send honoring the hub-claim + provenance fields (TODO Lane A).",
1654
- inputSchema: mAIL_send_as_agent_input,
1655
- handler: mAIL_send_as_agent
1417
+ description: "Send an email ATTRIBUTED TO THE AGENT (provenance-stamped). Unlike mp0st_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 \u2014 so recipients and compliance can see the mail was agent-originated. Auth: presents a hub-claim JWT (needs MOSADD_API_KEY). SCAFFOLD: depends on mp0st-send honoring the hub-claim + provenance fields (TODO Lane A).",
1418
+ inputSchema: mp0st_send_as_agent_input,
1419
+ handler: mp0st_send_as_agent
1656
1420
  }
1657
1421
  ];
1658
1422
 
1659
1423
  // src/tools/mtalk.ts
1660
- import { z as z11 } from "zod";
1661
- var RoomLabel = z11.string().min(1).max(120).regex(/^[a-zA-Z0-9._-]+$/).describe("Human-readable room label (e.g. 'ops', 'field-team'). Used to derive a stable room id.");
1662
- var RoomId4 = z11.string().min(1).describe("Room id returned by mTALK_open.");
1663
- var mTALK_open_input = z11.object({
1424
+ import { z as z9 } from "zod";
1425
+ var RoomLabel = z9.string().min(1).max(120).regex(/^[a-zA-Z0-9._-]+$/).describe("Human-readable room label (e.g. 'ops', 'field-team'). Used to derive a stable room id.");
1426
+ var RoomId2 = z9.string().min(1).describe("Room id returned by mTALK_open.");
1427
+ var mTALK_open_input = z9.object({
1664
1428
  label: RoomLabel.optional().describe("Optional label; defaults to a personal room.")
1665
1429
  });
1666
- var mTALK_join_input = z11.object({ room_id: RoomId4 });
1667
- var mTALK_press_input = z11.object({ room_id: RoomId4 });
1668
- var mTALK_release_input = z11.object({ room_id: RoomId4 });
1669
- var mTALK_state_input = z11.object({ room_id: RoomId4 });
1430
+ var mTALK_join_input = z9.object({ room_id: RoomId2 });
1431
+ var mTALK_press_input = z9.object({ room_id: RoomId2 });
1432
+ var mTALK_release_input = z9.object({ room_id: RoomId2 });
1433
+ var mTALK_state_input = z9.object({ room_id: RoomId2 });
1670
1434
  async function mTALK_open(input, ctx) {
1671
1435
  const { roomId } = await ctx.providers.voice.createRoom(input.label);
1672
1436
  ctx.log("debug", "mTALK_open", { room_id: roomId });
@@ -1730,7 +1494,7 @@ var mtalkTools = [
1730
1494
  ];
1731
1495
 
1732
1496
  // src/tools/attachments.ts
1733
- import { z as z12 } from "zod";
1497
+ import { z as z10 } from "zod";
1734
1498
 
1735
1499
  // src/providers/blob-upload.ts
1736
1500
  function defaultBucket(kind) {
@@ -1779,15 +1543,15 @@ function decodeBase64Body(b64) {
1779
1543
  }
1780
1544
 
1781
1545
  // src/tools/attachments.ts
1782
- var PROTOCOL_VERSION5 = "mosadd.chat.v1";
1783
- var Base64Body = z12.string().min(1).max(2e7).describe("Attachment bytes as base64 (or a data: URL). MCP is JSON-only, so binary is base64-encoded. Max ~15 MB decoded.");
1784
- var Mime = z12.string().min(1).max(120).describe("MIME type, e.g. audio/ogg, application/pdf, image/png.");
1785
- var DurationMs = z12.number().int().positive().optional().describe("Audio clip length in ms (voice only), if known.");
1786
- var Filename = z12.string().min(1).max(255).optional().describe("Original filename (file only).");
1787
- var ReplyTo = z12.string().optional().describe("Optional id of the message being replied to.");
1788
- var ContactRef3 = z12.string().min(1).describe("Recipient identity id (UUID). Use mDM_list_contacts to find it.");
1789
- var RoomId5 = z12.string().min(1).describe("Room/channel id (UUID).");
1790
- var ThreadLabel = z12.string().max(120).regex(/^[a-zA-Z0-9._-]+$/).optional().describe("Optional thread label within the conversation (mDM USP: multiple threads per contact).");
1546
+ var PROTOCOL_VERSION4 = "mosadd.chat.v1";
1547
+ var Base64Body = z10.string().min(1).max(2e7).describe("Attachment bytes as base64 (or a data: URL). MCP is JSON-only, so binary is base64-encoded. Max ~15 MB decoded.");
1548
+ var Mime = z10.string().min(1).max(120).describe("MIME type, e.g. audio/ogg, application/pdf, image/png.");
1549
+ var DurationMs = z10.number().int().positive().optional().describe("Audio clip length in ms (voice only), if known.");
1550
+ var Filename = z10.string().min(1).max(255).optional().describe("Original filename (file only).");
1551
+ var ReplyTo = z10.string().optional().describe("Optional id of the message being replied to.");
1552
+ var ContactRef3 = z10.string().min(1).describe("Recipient identity id (UUID). Use mDM_list_contacts to find it.");
1553
+ var RoomId3 = z10.string().min(1).describe("Room/channel id (UUID).");
1554
+ var ThreadLabel = z10.string().max(120).regex(/^[a-zA-Z0-9._-]+$/).optional().describe("Optional thread label within the conversation (mDM USP: multiple threads per contact).");
1791
1555
  function dmThreadId3(selfId, otherId, label) {
1792
1556
  const [a, b] = [selfId, otherId].sort();
1793
1557
  return label ? `dm:${a}:${b}:${label}` : `dm:${a}:${b}`;
@@ -1795,7 +1559,7 @@ function dmThreadId3(selfId, otherId, label) {
1795
1559
  async function sendAttachmentMessage(ctx, args) {
1796
1560
  readSupabaseEnv();
1797
1561
  const captionEnvelope = {
1798
- v: PROTOCOL_VERSION5,
1562
+ v: PROTOCOL_VERSION4,
1799
1563
  type: args.message_type,
1800
1564
  text: args.caption ?? "",
1801
1565
  sent_at: (/* @__PURE__ */ new Date()).toISOString()
@@ -1813,7 +1577,7 @@ async function sendAttachmentMessage(ctx, args) {
1813
1577
  attachments: [args.attachment],
1814
1578
  // TODO(Lane A): confirm field placement
1815
1579
  encrypted_payload,
1816
- protocol_version: PROTOCOL_VERSION5,
1580
+ protocol_version: PROTOCOL_VERSION4,
1817
1581
  recipient_account_id: args.recipient_account_id ?? null,
1818
1582
  reply_to_id: args.reply_to_id ?? null
1819
1583
  });
@@ -1830,21 +1594,21 @@ async function resolveLinkedSpaceId2(channelId) {
1830
1594
  if (!spaceId) throw new Error(`Channel ${channelId} has no linked space yet \u2014 run mIRC_join/mIRC_list first or pass space_id.`);
1831
1595
  return spaceId;
1832
1596
  }
1833
- var mDM_send_voice_input = z12.object({
1597
+ var mDM_send_voice_input = z10.object({
1834
1598
  to: ContactRef3,
1835
1599
  audio_base64: Base64Body,
1836
1600
  mime: Mime.default("audio/ogg"),
1837
1601
  duration_ms: DurationMs,
1838
- caption: z12.string().max(2e3).optional(),
1602
+ caption: z10.string().max(2e3).optional(),
1839
1603
  thread_label: ThreadLabel,
1840
1604
  reply_to_id: ReplyTo
1841
1605
  });
1842
- var mDM_send_file_input = z12.object({
1606
+ var mDM_send_file_input = z10.object({
1843
1607
  to: ContactRef3,
1844
1608
  file_base64: Base64Body,
1845
1609
  filename: Filename,
1846
1610
  mime: Mime,
1847
- caption: z12.string().max(2e3).optional(),
1611
+ caption: z10.string().max(2e3).optional(),
1848
1612
  thread_label: ThreadLabel,
1849
1613
  reply_to_id: ReplyTo
1850
1614
  });
@@ -1890,61 +1654,23 @@ async function mDM_send_file(input, ctx) {
1890
1654
  recipient_account_id: input.to
1891
1655
  });
1892
1656
  }
1893
- var mROOM_send_voice_input = z12.object({
1894
- room_id: RoomId5,
1895
- audio_base64: Base64Body,
1896
- mime: Mime.default("audio/ogg"),
1897
- duration_ms: DurationMs,
1898
- caption: z12.string().max(2e3).optional(),
1899
- reply_to_id: ReplyTo
1900
- });
1901
- var mROOM_send_file_input = z12.object({
1902
- room_id: RoomId5,
1903
- file_base64: Base64Body,
1904
- filename: Filename,
1905
- mime: Mime,
1906
- caption: z12.string().max(2e3).optional(),
1907
- reply_to_id: ReplyTo
1908
- });
1909
- async function mROOM_send_voice(input, ctx) {
1910
- const thread_id = `privroom:${input.room_id}`;
1911
- const attachment = await uploadBlob({
1912
- kind: "voice",
1913
- bytes: decodeBase64Body(input.audio_base64),
1914
- mime: input.mime,
1915
- prefix: thread_id,
1916
- duration_ms: input.duration_ms
1917
- });
1918
- return sendAttachmentMessage(ctx, { space_id: "rooms", thread_id, message_type: "voice", attachment, caption: input.caption, reply_to_id: input.reply_to_id });
1919
- }
1920
- async function mROOM_send_file(input, ctx) {
1921
- const thread_id = `privroom:${input.room_id}`;
1922
- const attachment = await uploadBlob({
1923
- kind: "file",
1924
- bytes: decodeBase64Body(input.file_base64),
1925
- mime: input.mime,
1926
- prefix: thread_id,
1927
- filename: input.filename
1928
- });
1929
- return sendAttachmentMessage(ctx, { space_id: "rooms", thread_id, message_type: "file", attachment, caption: input.caption, reply_to_id: input.reply_to_id });
1930
- }
1931
- var mIRC_send_voice_input = z12.object({
1932
- channel_id: RoomId5,
1657
+ var mIRC_send_voice_input = z10.object({
1658
+ channel_id: RoomId3,
1933
1659
  audio_base64: Base64Body,
1934
1660
  mime: Mime.default("audio/ogg"),
1935
1661
  duration_ms: DurationMs,
1936
- caption: z12.string().max(2e3).optional(),
1662
+ caption: z10.string().max(2e3).optional(),
1937
1663
  reply_to_id: ReplyTo,
1938
- space_id: z12.string().optional().describe("Backing space id. Resolved automatically if omitted.")
1664
+ space_id: z10.string().optional().describe("Backing space id. Resolved automatically if omitted.")
1939
1665
  });
1940
- var mIRC_send_file_input = z12.object({
1941
- channel_id: RoomId5,
1666
+ var mIRC_send_file_input = z10.object({
1667
+ channel_id: RoomId3,
1942
1668
  file_base64: Base64Body,
1943
1669
  filename: Filename,
1944
1670
  mime: Mime,
1945
- caption: z12.string().max(2e3).optional(),
1671
+ caption: z10.string().max(2e3).optional(),
1946
1672
  reply_to_id: ReplyTo,
1947
- space_id: z12.string().optional()
1673
+ space_id: z10.string().optional()
1948
1674
  });
1949
1675
  async function mIRC_send_voice(input, ctx) {
1950
1676
  const space_id = input.space_id ?? await resolveLinkedSpaceId2(input.channel_id);
@@ -1973,20 +1699,6 @@ var attachmentTools = [
1973
1699
  inputSchema: mDM_send_file_input,
1974
1700
  handler: mDM_send_file
1975
1701
  },
1976
- {
1977
- name: "mROOM_send_voice",
1978
- requires: "network",
1979
- description: "Send a VOICE note into a room as a first-class `voice` message. Base64 audio \u2192 Storage \u2192 message-send. Be a room member first (mROOM_join).",
1980
- inputSchema: mROOM_send_voice_input,
1981
- handler: mROOM_send_voice
1982
- },
1983
- {
1984
- name: "mROOM_send_file",
1985
- requires: "network",
1986
- description: "Send a FILE into a room as a first-class `file` message. Base64 bytes \u2192 Storage \u2192 message-send.",
1987
- inputSchema: mROOM_send_file_input,
1988
- handler: mROOM_send_file
1989
- },
1990
1702
  {
1991
1703
  name: "mIRC_send_voice",
1992
1704
  requires: "network",
@@ -2004,15 +1716,15 @@ var attachmentTools = [
2004
1716
  ];
2005
1717
 
2006
1718
  // src/tools/ptt-ingest.ts
2007
- import { z as z13 } from "zod";
2008
- var mTALK_ingest_ptt_input = z13.object({
2009
- audio_base64: z13.string().min(1).max(2e7).describe("Recorded PTT 'over' as base64 (or data: URL)."),
2010
- mime: z13.string().min(1).max(120).default("audio/ogg"),
2011
- duration_ms: z13.number().int().positive().optional(),
1719
+ import { z as z11 } from "zod";
1720
+ var mTALK_ingest_ptt_input = z11.object({
1721
+ audio_base64: z11.string().min(1).max(2e7).describe("Recorded PTT 'over' as base64 (or data: URL)."),
1722
+ mime: z11.string().min(1).max(120).default("audio/ogg"),
1723
+ duration_ms: z11.number().int().positive().optional(),
2012
1724
  // Routing: exactly one of room_id / channel_id identifies where the over lands.
2013
- channel_id: z13.string().optional().describe("mIRC channel id \u2014 route the queued PTT into a persistent channel's PTT log."),
2014
- room_id: z13.string().optional().describe("mROOM/mTALK room id \u2014 route into an ephemeral room's PTT log."),
2015
- transcribe: z13.boolean().optional().describe("Request RAG transcription. Honored only if the user has opted in to rag ingest; ignored otherwise. Default true.")
1725
+ channel_id: z11.string().optional().describe("mIRC channel id \u2014 route the queued PTT into a persistent channel's PTT log."),
1726
+ room_id: z11.string().optional().describe("mROOM/mTALK room id \u2014 route into an ephemeral room's PTT log."),
1727
+ transcribe: z11.boolean().optional().describe("Request RAG transcription. Honored only if the user has opted in to rag ingest; ignored otherwise. Default true.")
2016
1728
  });
2017
1729
  async function mTALK_ingest_ptt(input, ctx) {
2018
1730
  readSupabaseEnv();
@@ -2051,12 +1763,12 @@ var pttIngestTools = [
2051
1763
  ];
2052
1764
 
2053
1765
  // src/tools/knowledge.ts
2054
- import { z as z14 } from "zod";
2055
- var mRAG_search_input = z14.object({
2056
- query: z14.string().min(1).max(2e3).describe("Natural-language question to answer from the user's own indexed messages/emails/calls/notes."),
2057
- top_k: z14.number().int().min(1).max(25).optional().describe("Max number of source chunks to retrieve and ground the answer in. Default 8."),
2058
- source_types: z14.array(z14.enum(["message", "email", "call", "note", "contact"])).optional().describe("Restrict retrieval to these source types. Omit to search everything."),
2059
- thread_id: z14.string().optional().describe("Optional: restrict retrieval to a single thread id (e.g. a dm:/chat: thread).")
1766
+ import { z as z12 } from "zod";
1767
+ var mRAG_search_input = z12.object({
1768
+ query: z12.string().min(1).max(2e3).describe("Natural-language question to answer from the user's own indexed messages/emails/calls/notes."),
1769
+ top_k: z12.number().int().min(1).max(25).optional().describe("Max number of source chunks to retrieve and ground the answer in. Default 8."),
1770
+ source_types: z12.array(z12.enum(["message", "email", "call", "note", "contact"])).optional().describe("Restrict retrieval to these source types. Omit to search everything."),
1771
+ thread_id: z12.string().optional().describe("Optional: restrict retrieval to a single thread id (e.g. a dm:/chat: thread).")
2060
1772
  });
2061
1773
  async function mRAG_search(input, ctx) {
2062
1774
  readSupabaseEnv();
@@ -2073,12 +1785,12 @@ async function mRAG_search(input, ctx) {
2073
1785
  chunks_found: data.chunks_found ?? (data.sources?.length ?? 0)
2074
1786
  };
2075
1787
  }
2076
- var mRAG_ingest_input = z14.object({
2077
- content_text: z14.string().min(1).max(2e5).describe("Text to index into the user's private knowledge base (a note, document, transcript, pasted page\u2026). Chunked + embedded server-side."),
2078
- source_type: z14.enum(["file", "note", "message", "email", "contact", "call"]).optional().describe("What kind of source this is. Default 'file' (a document/note). Use 'note' for ad-hoc text."),
2079
- source_id: z14.string().optional().describe("Optional stable id for the source so re-ingests can be grouped."),
2080
- thread_id: z14.string().optional().describe("Optional thread id to associate this knowledge with (e.g. a dm:/chat: thread)."),
2081
- title: z14.string().max(300).optional().describe("Optional human title, stored in metadata.")
1788
+ var mRAG_ingest_input = z12.object({
1789
+ content_text: z12.string().min(1).max(2e5).describe("Text to index into the user's private knowledge base (a note, document, transcript, pasted page\u2026). Chunked + embedded server-side."),
1790
+ source_type: z12.enum(["file", "note", "message", "email", "contact", "call"]).optional().describe("What kind of source this is. Default 'file' (a document/note). Use 'note' for ad-hoc text."),
1791
+ source_id: z12.string().optional().describe("Optional stable id for the source so re-ingests can be grouped."),
1792
+ thread_id: z12.string().optional().describe("Optional thread id to associate this knowledge with (e.g. a dm:/chat: thread)."),
1793
+ title: z12.string().max(300).optional().describe("Optional human title, stored in metadata.")
2082
1794
  });
2083
1795
  async function mRAG_ingest(input, ctx) {
2084
1796
  readSupabaseEnv();
@@ -2093,15 +1805,15 @@ async function mRAG_ingest(input, ctx) {
2093
1805
  });
2094
1806
  return { indexed: data.indexed ?? 0, chunk_count: data.chunk_count ?? 0 };
2095
1807
  }
2096
- var mRAG_list_sources_input = z14.object({});
1808
+ var mRAG_list_sources_input = z12.object({});
2097
1809
  async function mRAG_list_sources(_input, ctx) {
2098
1810
  readSupabaseEnv();
2099
1811
  ctx.log("debug", "mRAG_list_sources via rag-sources");
2100
1812
  return await invokeFunction("rag-sources", { action: "list" });
2101
1813
  }
2102
- var mRAG_delete_input = z14.object({
2103
- source_id: z14.string().optional().describe("Delete every indexed chunk with this source_id (from mRAG_list_sources)."),
2104
- thread_id: z14.string().optional().describe("Delete every indexed chunk associated with this thread_id.")
1814
+ var mRAG_delete_input = z12.object({
1815
+ source_id: z12.string().optional().describe("Delete every indexed chunk with this source_id (from mRAG_list_sources)."),
1816
+ thread_id: z12.string().optional().describe("Delete every indexed chunk associated with this thread_id.")
2105
1817
  }).refine((v) => v.source_id || v.thread_id, {
2106
1818
  message: "Provide source_id or thread_id \u2014 mRAG_delete refuses to purge the whole index."
2107
1819
  });
@@ -2146,34 +1858,34 @@ var knowledgeTools = [
2146
1858
  ];
2147
1859
 
2148
1860
  // src/tools/actions.ts
2149
- import { z as z15 } from "zod";
2150
- var formField = z15.object({
2151
- name: z15.string().min(1).max(60).describe("Field key \u2014 returned verbatim in the result."),
2152
- label: z15.string().max(120).optional().describe("Human label shown to the recipient. Defaults to `name`."),
2153
- type: z15.enum(["text", "email", "number", "textarea", "tel", "url"]).optional().describe("Input type. Default 'text'."),
2154
- required: z15.boolean().optional().describe("Whether the recipient must fill this field.")
1861
+ import { z as z13 } from "zod";
1862
+ var formField = z13.object({
1863
+ name: z13.string().min(1).max(60).describe("Field key \u2014 returned verbatim in the result."),
1864
+ label: z13.string().max(120).optional().describe("Human label shown to the recipient. Defaults to `name`."),
1865
+ type: z13.enum(["text", "email", "number", "textarea", "tel", "url"]).optional().describe("Input type. Default 'text'."),
1866
+ required: z13.boolean().optional().describe("Whether the recipient must fill this field.")
2155
1867
  });
2156
- var action_create_input = z15.object({
2157
- action_type: z15.enum(["confirm", "file_request", "form", "open_url", "screen_share"]).describe(
1868
+ var action_create_input = z13.object({
1869
+ action_type: z13.enum(["confirm", "file_request", "form", "open_url", "screen_share"]).describe(
2158
1870
  "What you want the recipient to do: 'confirm' (yes/no), 'file_request' (pick a file from their computer), 'form' (fill fields), 'open_url' (open a vetted https URL), 'screen_share' (recipient shares their screen so you can SEE it via comms_action_frame_get \u2014 view only)."
2159
1871
  ),
2160
- message: z15.string().min(1).max(2e3).describe("What you're asking \u2014 shown on the consent screen above the action UI."),
2161
- creator_label: z15.string().max(80).optional().describe("How you're identified to the recipient (e.g. your agent name). Default 'Agent'."),
1872
+ message: z13.string().min(1).max(2e3).describe("What you're asking \u2014 shown on the consent screen above the action UI."),
1873
+ creator_label: z13.string().max(80).optional().describe("How you're identified to the recipient (e.g. your agent name). Default 'Agent'."),
2162
1874
  // confirm
2163
- yes_label: z15.string().max(40).optional().describe("[confirm] Affirmative button label. Default 'Tak'."),
2164
- no_label: z15.string().max(40).optional().describe("[confirm] Negative button label. Default 'Nie'."),
1875
+ yes_label: z13.string().max(40).optional().describe("[confirm] Affirmative button label. Default 'Tak'."),
1876
+ no_label: z13.string().max(40).optional().describe("[confirm] Negative button label. Default 'Nie'."),
2165
1877
  // file_request
2166
- accept: z15.string().max(200).optional().describe("[file_request] Accepted file types (HTML accept attr, e.g. 'image/*,.pdf')."),
2167
- max_bytes: z15.number().int().positive().max(5242880).optional().describe("[file_request] Max file size in bytes (\u2264 5 MB). NOTE: the returned file is NOT yet end-to-end encrypted \u2014 do not request sensitive files until Tier 1.1 ships."),
1878
+ accept: z13.string().max(200).optional().describe("[file_request] Accepted file types (HTML accept attr, e.g. 'image/*,.pdf')."),
1879
+ max_bytes: z13.number().int().positive().max(5242880).optional().describe("[file_request] Max file size in bytes (\u2264 5 MB). NOTE: the returned file is NOT yet end-to-end encrypted \u2014 do not request sensitive files until Tier 1.1 ships."),
2168
1880
  // form
2169
- fields: z15.array(formField).min(1).max(20).optional().describe("[form] Fields to collect from the recipient."),
1881
+ fields: z13.array(formField).min(1).max(20).optional().describe("[form] Fields to collect from the recipient."),
2170
1882
  // open_url
2171
- url: z15.string().url().optional().describe("[open_url] The https URL to open. The full URL is shown to the recipient before they open it."),
1883
+ url: z13.string().url().optional().describe("[open_url] The https URL to open. The full URL is shown to the recipient before they open it."),
2172
1884
  // screen_share
2173
- max_width: z15.number().int().positive().max(1920).optional().describe("[screen_share] Max captured frame width in px (default 1280). Frames are downscaled JPEGs."),
1885
+ max_width: z13.number().int().positive().max(1920).optional().describe("[screen_share] Max captured frame width in px (default 1280). Frames are downscaled JPEGs."),
2174
1886
  // lifecycle
2175
- ttl_ms: z15.number().int().positive().optional().describe("Link lifetime in milliseconds. Default 24h, capped at 7d."),
2176
- max_uses: z15.number().int().min(1).max(50).optional().describe("How many times the link can be redeemed. Default 1 (single-use).")
1887
+ ttl_ms: z13.number().int().positive().optional().describe("Link lifetime in milliseconds. Default 24h, capped at 7d."),
1888
+ max_uses: z13.number().int().min(1).max(50).optional().describe("How many times the link can be redeemed. Default 1 (single-use).")
2177
1889
  });
2178
1890
  function buildParams(input) {
2179
1891
  switch (input.action_type) {
@@ -2214,8 +1926,8 @@ async function action_create(input, ctx) {
2214
1926
  expires_at: res.expires_at ?? ""
2215
1927
  };
2216
1928
  }
2217
- var action_frame_get_input = z15.object({
2218
- action_id: z15.string().min(1).describe("The action_id returned by comms_action_create for a 'screen_share' action you created.")
1929
+ var action_frame_get_input = z13.object({
1930
+ action_id: z13.string().min(1).describe("The action_id returned by comms_action_create for a 'screen_share' action you created.")
2219
1931
  });
2220
1932
  async function action_frame_get(input, ctx) {
2221
1933
  readSupabaseEnv();
@@ -2242,7 +1954,7 @@ var actionTools = [
2242
1954
  // A dedicated `mACT` module (create/get/status) is a possible RFC follow-up.
2243
1955
  name: "comms_action_create",
2244
1956
  requires: "network",
2245
- description: "Mint a single-use, expiring action link (https://mosadd.com/do/<token>) that asks a human to DO something in their browser, with explicit consent. action_type: 'confirm' (yes/no) | 'file_request' (recipient picks a file from their computer) | 'form' (recipient fills fields you define) | 'open_url' (recipient opens a vetted https URL). Returns { action_id, token, link, expires_at }. Send the `link` to the person via mDM/mIRC/mAIL; they open it, consent, and the browser performs the action in its sandbox (no install, no OS access). The action is owned by you (the calling user). HONEST LIMITS: this is browser-sandbox only \u2014 it cannot click other apps, run programs, or read files the user didn't pick; and file_request payloads are not yet end-to-end encrypted (don't request sensitive files until Tier 1.1).",
1957
+ description: "Mint a single-use, expiring action link (https://mosadd.com/do/<token>) that asks a human to DO something in their browser, with explicit consent. action_type: 'confirm' (yes/no) | 'file_request' (recipient picks a file from their computer) | 'form' (recipient fills fields you define) | 'open_url' (recipient opens a vetted https URL). Returns { action_id, token, link, expires_at }. Send the `link` to the person via mDM/mIRC/mp0st; they open it, consent, and the browser performs the action in its sandbox (no install, no OS access). The action is owned by you (the calling user). HONEST LIMITS: this is browser-sandbox only \u2014 it cannot click other apps, run programs, or read files the user didn't pick; and file_request payloads are not yet end-to-end encrypted (don't request sensitive files until Tier 1.1).",
2246
1958
  inputSchema: action_create_input,
2247
1959
  handler: action_create
2248
1960
  },
@@ -2255,6 +1967,102 @@ var actionTools = [
2255
1967
  }
2256
1968
  ];
2257
1969
 
1970
+ // src/tools/embed.ts
1971
+ import { z as z14 } from "zod";
1972
+ var EMBED_CDN = (process.env.MOSADD_EMBED_CDN ?? "https://embed.mosadd.com").replace(/\/+$/, "");
1973
+ var POSITIONS = ["inline", "sidebar-left", "sidebar-right", "floating-bl", "floating-br", "fullscreen"];
1974
+ var SKINS = ["default", "retro-irc-1990", "terminal", "minimal-dark", "minimal-light"];
1975
+ var embed_create_input = z14.object({
1976
+ channel: z14.string().min(1).max(128).regex(/^[A-Za-z0-9_-]+$/).describe("The mIRC channel id everyone on the embed shares (e.g. 'acme-support'). Auto-created on first message if new."),
1977
+ allowed_origins: z14.array(z14.string().min(1)).min(1).max(10).describe("REQUIRED. Domain(s) where the widget will be served \u2014 the key only works from these origins. Use the host(s) of the app you're building, e.g. ['app.acme.com','*.acme.com']. For local testing use mode:'test' and e.g. 'localhost:3000'."),
1978
+ name: z14.string().max(64).optional().describe("Label for the key in the owner's dashboard. Default 'embed: <channel>'."),
1979
+ position: z14.enum(POSITIONS).optional().describe("Where the widget renders. Default 'inline'."),
1980
+ skin: z14.enum(SKINS).optional().describe("Visual skin. Default 'default' (mosadd-branded retro mIRC)."),
1981
+ title: z14.string().max(60).optional().describe("Header title shown in the widget. Default 'mIRC'."),
1982
+ anon: z14.boolean().optional().describe("Allow visitors to join with just a nick (no mosadd account). Default true."),
1983
+ locale: z14.enum(["en", "pl"]).optional().describe("Widget UI language. Default 'en'."),
1984
+ mode: z14.enum(["live", "test"]).optional().describe("Key mode \u2014 'test' for local/dev origins, 'live' for production. Default 'live'.")
1985
+ });
1986
+ var attrSafe = (s) => s.replace(/["'<>]/g, "");
1987
+ function buildSnippet(input, key) {
1988
+ const attrs = [`data-channel="${attrSafe(input.channel)}"`, `data-position="${input.position ?? "inline"}"`];
1989
+ if (input.skin) attrs.push(`data-skin="${input.skin}"`);
1990
+ if (input.title) attrs.push(`data-title="${attrSafe(input.title)}"`);
1991
+ if (input.anon === false) attrs.push(`data-anon="false"`);
1992
+ if (input.locale) attrs.push(`data-locale="${input.locale}"`);
1993
+ return `<div id="mosadd-mirc" ${attrs.join(" ")}></div>
1994
+ <script src="${EMBED_CDN}/v1.js" data-key="${key}"></script>`;
1995
+ }
1996
+ async function embed_create(input, ctx) {
1997
+ readSupabaseEnv();
1998
+ ctx.log("debug", "comms_embed_create minting embed key", { channel: input.channel, origins: input.allowed_origins.length });
1999
+ const res = await invokeFunction("embed-keys", {
2000
+ name: input.name ?? `embed: ${input.channel}`,
2001
+ channels: [input.channel],
2002
+ allowed_origins: input.allowed_origins,
2003
+ mode: input.mode ?? "live"
2004
+ });
2005
+ if (res.error) throw new Error(res.error);
2006
+ if (!res.key) throw new Error("embed-keys returned no publishable key (missing `key`).");
2007
+ return {
2008
+ embed_key: res.key,
2009
+ channel: input.channel,
2010
+ allowed_origins: input.allowed_origins,
2011
+ snippet: buildSnippet(input, res.key)
2012
+ };
2013
+ }
2014
+ var embedTools = [
2015
+ {
2016
+ name: "comms_embed_create",
2017
+ requires: "network",
2018
+ description: "Embed a LIVE mosadd chat channel into an app/site you're building (great for builder-agents on Lovable/Bolt/Cursor/v0). Mints a publishable embed key scoped to a channel + the app's domain(s) and returns a ready-to-paste HTML snippet (a <div> + <script src=embed.mosadd.com/v1.js data-key=\u2026>). Visitors of the host page chat in real time (anonymous nick or mosadd login). REQUIRES `allowed_origins` \u2014 the domain(s) the app is served from (the key only works there). The publishable key is browser-safe (mints only channel-scoped JWTs); your hub key never leaves the server. Returns { embed_key, channel, allowed_origins, snippet }.",
2019
+ inputSchema: embed_create_input,
2020
+ handler: embed_create
2021
+ }
2022
+ ];
2023
+
2024
+ // src/tools/threat.ts
2025
+ import { z as z15 } from "zod";
2026
+ import {
2027
+ THREAT_EVENTS,
2028
+ THREAT_EVENT_COUNT,
2029
+ evaluateEvent
2030
+ } from "@mosadd/threat-engine";
2031
+ var threat_catalog_input = z15.object({
2032
+ category: z15.enum(["COMINT", "ELINT", "MASINT", "CYBER", "BEHAVIORAL", "PRIVACY", "SIGINT", "OSINT", "MPOST"]).optional().describe("Filter the catalog to one intelligence-discipline category. Omit for the full catalog."),
2033
+ platform: z15.enum(["apk", "ios", "pwa", "harmony"]).optional().describe("Filter to events detectable on this platform. Omit for all platforms.")
2034
+ });
2035
+ async function threat_catalog(input, _ctx) {
2036
+ let events = THREAT_EVENTS;
2037
+ if (input.category) events = events.filter((e) => e.category === input.category);
2038
+ if (input.platform) events = events.filter((e) => e.platforms.includes(input.platform));
2039
+ return { count: events.length, total: THREAT_EVENT_COUNT, events };
2040
+ }
2041
+ var threat_classify_input = z15.object({
2042
+ event_type: z15.string().min(1).max(120).describe('Event type to classify, e.g. "SIM_SWAP", "AUTH_BRUTEFORCE", "TOLL_FRAUD". Case-insensitive.'),
2043
+ severity: z15.string().optional().describe('Optional producer severity hint. "killswitch" \u2192 lock_account; "critical" \u2192 revoke_sessions; anything else is informational.'),
2044
+ details: z15.string().max(2e3).optional().describe("Optional free-text context (informational only).")
2045
+ });
2046
+ async function threat_classify(input, _ctx) {
2047
+ return evaluateEvent({ eventType: input.event_type, severity: input.severity, details: input.details });
2048
+ }
2049
+ var threatTools = [
2050
+ {
2051
+ name: "threat_catalog",
2052
+ requires: "any",
2053
+ description: "List the canonical mosadd threat-event taxonomy (the full radar catalog: id, category, default severity, auto-actions, per-platform availability). Filter by category or platform. Pure/offline \u2014 returns { count, total, events }. Use to discover what the defensive engine recognises.",
2054
+ inputSchema: threat_catalog_input,
2055
+ handler: threat_catalog
2056
+ },
2057
+ {
2058
+ name: "threat_classify",
2059
+ requires: "any",
2060
+ description: "Classify a single telemetry event with the pure mosadd DECK decision engine and get a defensive recommendation: { action (log_only|revoke_sessions|lock_account|suspend_did), severity, reason }. Deterministic, side-effect-free, no backend \u2014 the engine DECIDES; the caller carries out the action. Use to evaluate a threat event you already observed.",
2061
+ inputSchema: threat_classify_input,
2062
+ handler: threat_classify
2063
+ }
2064
+ ];
2065
+
2258
2066
  // src/tools/capabilities.ts
2259
2067
  import { z as z16 } from "zod";
2260
2068
  var CONTRACT_VERSION = "1.0.0";
@@ -2293,16 +2101,20 @@ var channelTools = [
2293
2101
  ...mircMembersTools,
2294
2102
  ...mircMessagesTools,
2295
2103
  ...mircEdgeTools,
2296
- ...mroomTools,
2297
- ...mroomMessagesTools,
2104
+ // ...mroomTools, // mROOM: killed (LINEAR-3414) — channel re-cut into ephemeral private mIRC
2105
+ // ...mroomMessagesTools, // mROOM: killed (LINEAR-3414)
2298
2106
  ...mailTools,
2299
2107
  ...mailProvenanceTools,
2300
2108
  ...mtalkTools,
2301
2109
  ...attachmentTools,
2302
2110
  ...pttIngestTools,
2303
2111
  ...knowledgeTools,
2304
- ...actionTools
2112
+ ...actionTools,
2305
2113
  // Action links (Tier 1): agent → user one-link browser action via action-create EF
2114
+ ...embedTools,
2115
+ // comms_embed_create: agent embeds a live channel into the app it builds (embed-keys EF + embed.mosadd.com widget)
2116
+ ...threatTools
2117
+ // threat_catalog + threat_classify: pure defensive threat-event engine (@mosadd/threat-engine, LINEAR-3498)
2306
2118
  // ...murlTools, // mURL: brand/consumer surface (murl.mosadd.com), not a dev product
2307
2119
  // ...mcallTools, // mCALL: carrier-pending (no telephony carrier live) — re-register when a carrier is configured
2308
2120
  // mirlTools,
@@ -2322,7 +2134,7 @@ var allTools = [
2322
2134
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2323
2135
 
2324
2136
  // src/providers/supabase-dm.ts
2325
- var PROTOCOL_VERSION6 = "mosadd.chat.v1";
2137
+ var PROTOCOL_VERSION5 = "mosadd.chat.v1";
2326
2138
  var SupabaseDmProvider = class {
2327
2139
  cachedSelfId = null;
2328
2140
  async selfId() {
@@ -2349,7 +2161,7 @@ var SupabaseDmProvider = class {
2349
2161
  thread_id: args.threadId,
2350
2162
  encrypted_payload,
2351
2163
  message_type: "text",
2352
- protocol_version: PROTOCOL_VERSION6,
2164
+ protocol_version: PROTOCOL_VERSION5,
2353
2165
  recipient_account_id: args.to,
2354
2166
  reply_to_id: args.replyToId ?? null
2355
2167
  });