@mosadd/mcp 3.0.0-alpha.38 → 3.0.0-alpha.39

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.
@@ -608,6 +608,8 @@ async function mDM_delete(input, ctx) {
608
608
  var mdmTools = [
609
609
  {
610
610
  name: "mDM_list_contacts",
611
+ title: "List contacts",
612
+ annotations: { readOnlyHint: true },
611
613
  requires: "any",
612
614
  description: "List the user's mosadd contacts. Returns identity_id (use this for mDM_send / mDM_list), account handle, display name, and contact state (pending, accepted, blocked).",
613
615
  inputSchema: mDM_list_contacts_input,
@@ -615,6 +617,8 @@ var mdmTools = [
615
617
  },
616
618
  {
617
619
  name: "mDM_publish_keys",
620
+ title: "Publish encryption keys",
621
+ annotations: { readOnlyHint: false },
618
622
  requires: "any",
619
623
  description: "Publish your mDM prekey bundle so other people can start an end-to-end-encrypted conversation with you. Run this once after sign-in (and to replenish one-time prekeys). Rides the same transport as messages, so it works over network or off-grid radio.",
620
624
  inputSchema: mDM_publish_keys_input,
@@ -622,6 +626,8 @@ var mdmTools = [
622
626
  },
623
627
  {
624
628
  name: "mDM_send",
629
+ title: "Send encrypted DM",
630
+ annotations: { readOnlyHint: false },
625
631
  requires: "any",
626
632
  description: "Send an END-TO-END-ENCRYPTED direct message via mosadd mDM. Pass `to` as the recipient's mosadd identity_id (look it up with mDM_list_contacts). Establishes an X3DH + Double Ratchet session on first contact (the recipient must have run mDM_publish_keys). Optional thread_label puts the message in a named thread \u2014 mosadd USP: multiple threads per contact, unlike WhatsApp/Telegram. If the recipient has no published keys yet, use mDM_send_unencrypted.",
627
633
  inputSchema: mDM_send_input,
@@ -629,6 +635,8 @@ var mdmTools = [
629
635
  },
630
636
  {
631
637
  name: "mDM_send_unencrypted",
638
+ title: "Send unencrypted DM",
639
+ annotations: { readOnlyHint: false },
632
640
  requires: "any",
633
641
  description: "DEPRECATED migration-window fallback: send a direct message WITHOUT end-to-end encryption (plaintext envelope). Only use when the recipient has not yet published prekeys (mDM_send fails with that hint). Prefer mDM_send. Will be removed once E2EE is universal.",
634
642
  inputSchema: mDM_send_input,
@@ -636,6 +644,8 @@ var mdmTools = [
636
644
  },
637
645
  {
638
646
  name: "mDM_list",
647
+ title: "Read direct messages",
648
+ annotations: { readOnlyHint: true },
639
649
  requires: "any",
640
650
  description: "List recent direct messages with a specific contact. Pass contact_id as the identity_id from mDM_list_contacts. Decrypts end-to-end-encrypted messages from the contact automatically; legacy plaintext messages are shown as-is. Optionally filter to a single thread_label.",
641
651
  inputSchema: mDM_list_input,
@@ -643,6 +653,8 @@ var mdmTools = [
643
653
  },
644
654
  {
645
655
  name: "mDM_respond_request",
656
+ title: "Accept or decline contact request",
657
+ annotations: { readOnlyHint: false },
646
658
  requires: "any",
647
659
  description: "Accept or reject an incoming DM request from a contact who is not yet in the user's whitelist.",
648
660
  inputSchema: mDM_respond_request_input,
@@ -650,6 +662,8 @@ var mdmTools = [
650
662
  },
651
663
  {
652
664
  name: "mDM_edit",
665
+ title: "Edit a DM",
666
+ annotations: { destructiveHint: true },
653
667
  requires: "any",
654
668
  description: "Edit a direct message you sent \u2014 replace its body by message_id (pass the conversation's `to` so it can be located). NOTE: end-to-end-encrypted messages CANNOT be edited (the ratchet is forward-only) \u2014 mDM_edit refuses them and you should mDM_delete + mDM_send a replacement instead. Only legacy non-E2EE messages are editable.",
655
669
  inputSchema: mDM_edit_input,
@@ -657,6 +671,8 @@ var mdmTools = [
657
671
  },
658
672
  {
659
673
  name: "mDM_delete",
674
+ title: "Delete a DM",
675
+ annotations: { destructiveHint: true },
660
676
  requires: "any",
661
677
  description: "Delete a direct message you sent by message_id (from mDM_list). Soft-deletes server-side so it stops showing in mDM_list for both sides.",
662
678
  inputSchema: mDM_delete_input,
@@ -693,6 +709,8 @@ async function mDM_list_my_agents(_input, ctx) {
693
709
  var mdmAsAgentTools = [
694
710
  {
695
711
  name: "mDM_send_as_agent",
712
+ title: "Send DM as your agent",
713
+ annotations: { readOnlyHint: false },
696
714
  requires: "network",
697
715
  description: "Send a direct message AS ONE OF YOUR OWN AGENTS instead of as yourself. Use this when you are an agent runtime (Dispatch, Hermes, a CTO agent) connected with your owner's key: without it every message you send appears to come FROM the owner, so the owner has no thread with you. Names the agent by mosADD address, identity id or display name; `to` defaults to the key's owner. The server verifies you OWN that agent \u2014 speaking as someone else's agent, or as another person, is refused. Recipient must be a person: agent-to-agent DM stays blocked.",
698
716
  inputSchema: mDM_send_as_agent_input,
@@ -700,6 +718,8 @@ var mdmAsAgentTools = [
700
718
  },
701
719
  {
702
720
  name: "mDM_list_my_agents",
721
+ title: "List your agents",
722
+ annotations: { readOnlyHint: true },
703
723
  requires: "network",
704
724
  description: "List the agents you are allowed to speak as with mDM_send_as_agent \u2014 every live agent owned by the account behind this key, with its identity id, mosADD address and display name. Call this first when you are unsure which agent identity you hold.",
705
725
  inputSchema: mDM_list_my_agents_input,
@@ -802,6 +822,8 @@ async function mDM_voice_note(input, ctx) {
802
822
  var mdmVoiceTools = [
803
823
  {
804
824
  name: "mDM_call_start",
825
+ title: "Start a voice call",
826
+ annotations: { readOnlyHint: false },
805
827
  requires: "network",
806
828
  description: "Start a 1:1 real-time voice (or video) call with a contact \u2014 the ordinary full-duplex phone-style call (NOT walkie-talkie mTALK, NOT PSTN mCALL). Creates a room, returns join credentials (token + media url), and drops a `call_invite` control message in the DM thread so the contact can answer. Set video:true for video.",
807
829
  inputSchema: mDM_call_start_input,
@@ -809,6 +831,8 @@ var mdmVoiceTools = [
809
831
  },
810
832
  {
811
833
  name: "mDM_call_answer",
834
+ title: "Answer a voice call",
835
+ annotations: { readOnlyHint: false },
812
836
  requires: "network",
813
837
  description: "Answer an incoming 1:1 call by its room_id (from the call_invite seen via mDM_list). Returns join credentials (token + media url) for the same room.",
814
838
  inputSchema: mDM_call_answer_input,
@@ -816,6 +840,8 @@ var mdmVoiceTools = [
816
840
  },
817
841
  {
818
842
  name: "mDM_call_end",
843
+ title: "End a voice call",
844
+ annotations: { readOnlyHint: false },
819
845
  requires: "network",
820
846
  description: "End a 1:1 call. The audio leg ends when clients disconnect; pass `to` to also drop a `call_end` (hangup) control message in the contact's DM thread.",
821
847
  inputSchema: mDM_call_end_input,
@@ -823,6 +849,8 @@ var mdmVoiceTools = [
823
849
  },
824
850
  {
825
851
  name: "mDM_voice_note",
852
+ title: "Leave a voice note",
853
+ annotations: { readOnlyHint: false },
826
854
  requires: "network",
827
855
  description: "Send an asynchronous voice note to a contact: references an already-uploaded audio clip (audio_url) and posts it as a `voice_note` message in the DM thread. Use for fire-and-forget voice instead of a live call.",
828
856
  inputSchema: mDM_voice_note_input,
@@ -950,6 +978,8 @@ async function mIRC_report(input, ctx) {
950
978
  var mircTools = [
951
979
  {
952
980
  name: "mIRC_create",
981
+ title: "Create channel",
982
+ annotations: { readOnlyHint: false },
953
983
  requires: "network",
954
984
  description: "Create a new persistent channel (Discord/Slack-style). Set access_mode to open (anyone joins), password (shared-password gated), or private (invite-only). capabilities controls modes (txt/voice/files/ptt/live; voice/ptt/live are server-relayed via LiveKit, NOT E2EE). Set discoverable:true (open channels only) to list it in the public directory. NOTE: password/private channels are provisioned for group-key TEXT encryption \u2014 supply wrapped_group_key (the group key wrapped to your identity key); open channels do not need it. The mosadd.com app encrypts/decrypts channel text with that key on supported clients; the toolkit's own mIRC_post_message posts server-readable text today (group-key parity is the next milestone). Channel voice is never E2EE.",
955
985
  inputSchema: mIRC_create_input,
@@ -957,6 +987,8 @@ var mircTools = [
957
987
  },
958
988
  {
959
989
  name: "mIRC_list",
990
+ title: "List your channels",
991
+ annotations: { readOnlyHint: true },
960
992
  requires: "network",
961
993
  description: "List channels available to the current user.",
962
994
  inputSchema: mIRC_list_input,
@@ -964,6 +996,8 @@ var mircTools = [
964
996
  },
965
997
  {
966
998
  name: "mIRC_get",
999
+ title: "Get channel details",
1000
+ annotations: { readOnlyHint: true },
967
1001
  requires: "network",
968
1002
  description: "Get full details of a single channel by id.",
969
1003
  inputSchema: mIRC_get_input,
@@ -971,6 +1005,8 @@ var mircTools = [
971
1005
  },
972
1006
  {
973
1007
  name: "mIRC_update",
1008
+ title: "Update channel settings",
1009
+ annotations: { readOnlyHint: false },
974
1010
  requires: "network",
975
1011
  description: "Update channel metadata (name, topic, capabilities). Owner only. Access mode is fixed at creation \u2014 recreate the channel to change it.",
976
1012
  inputSchema: mIRC_update_input,
@@ -978,6 +1014,8 @@ var mircTools = [
978
1014
  },
979
1015
  {
980
1016
  name: "mIRC_delete",
1017
+ title: "Delete channel",
1018
+ annotations: { destructiveHint: true },
981
1019
  requires: "network",
982
1020
  description: "Delete a channel and cascade-remove its members. Owner only.",
983
1021
  inputSchema: mIRC_delete_input,
@@ -985,6 +1023,8 @@ var mircTools = [
985
1023
  },
986
1024
  {
987
1025
  name: "mIRC_discover",
1026
+ title: "Discover public channels",
1027
+ annotations: { readOnlyHint: true },
988
1028
  requires: "network",
989
1029
  description: "Browse the PUBLIC channel DIRECTORY \u2014 open channels whose owners opted in (discoverable=true). Returns {id, channel_key, name, description, capabilities, member_count, is_member}. Filter by name with q; paginated. Join a result with mIRC_join (open = one-click). Private/password/partner channels never appear.",
990
1030
  inputSchema: mIRC_discover_input,
@@ -992,6 +1032,8 @@ var mircTools = [
992
1032
  },
993
1033
  {
994
1034
  name: "mIRC_report",
1035
+ title: "Report abuse",
1036
+ annotations: { readOnlyHint: false },
995
1037
  requires: "network",
996
1038
  description: "Report a channel for abuse (spam/harassment/illegal/etc). Metadata + reason only \u2014 never message content. The reported party is the channel owner (server-derived). Use for public-directory moderation.",
997
1039
  inputSchema: mIRC_report_input,
@@ -1073,6 +1115,8 @@ async function invokeChannelMembers(action, body, ctx) {
1073
1115
  var mircMembersTools = [
1074
1116
  {
1075
1117
  name: "mIRC_join",
1118
+ title: "Join channel",
1119
+ annotations: { readOnlyHint: false },
1076
1120
  requires: "network",
1077
1121
  description: "Join a channel as the current user. Pass `password` only for access_mode=password channels; private channels cannot be joined directly (403) \u2014 use mIRC_request_access + approval. Idempotent: an existing active member gets their membership row back (200, no 409).",
1078
1122
  inputSchema: mIRC_join_input,
@@ -1080,6 +1124,8 @@ var mircMembersTools = [
1080
1124
  },
1081
1125
  {
1082
1126
  name: "mIRC_request_access",
1127
+ title: "Request channel access",
1128
+ annotations: { readOnlyHint: false },
1083
1129
  requires: "network",
1084
1130
  description: "Request access to a password/private channel (your membership goes to state=requested for an admin to approve).",
1085
1131
  inputSchema: mIRC_request_access_input,
@@ -1087,6 +1133,8 @@ var mircMembersTools = [
1087
1133
  },
1088
1134
  {
1089
1135
  name: "mIRC_leave",
1136
+ title: "Leave channel",
1137
+ annotations: { readOnlyHint: false },
1090
1138
  requires: "network",
1091
1139
  description: "Leave a channel as the current user. Owner cannot leave without transferring ownership first.",
1092
1140
  inputSchema: mIRC_leave_input,
@@ -1094,6 +1142,8 @@ var mircMembersTools = [
1094
1142
  },
1095
1143
  {
1096
1144
  name: "mIRC_approve_request",
1145
+ title: "Approve access request",
1146
+ annotations: { readOnlyHint: false },
1097
1147
  requires: "network",
1098
1148
  description: "Approve a pending access request (state=requested \u2192 active). Admins / moderators / owner only. Because access requests only exist on non-open (password/private) channels, you must pass wrapped_group_key \u2014 the channel group key wrapped to the approved member's identity key.",
1099
1149
  inputSchema: mIRC_approve_request_input,
@@ -1101,6 +1151,8 @@ var mircMembersTools = [
1101
1151
  },
1102
1152
  {
1103
1153
  name: "mIRC_reject_request",
1154
+ title: "Reject access request",
1155
+ annotations: { readOnlyHint: false },
1104
1156
  requires: "network",
1105
1157
  description: "Reject a pending access request. Admins / moderators / owner only.",
1106
1158
  inputSchema: mIRC_reject_request_input,
@@ -1108,6 +1160,8 @@ var mircMembersTools = [
1108
1160
  },
1109
1161
  {
1110
1162
  name: "mIRC_kick",
1163
+ title: "Kick a member",
1164
+ annotations: { destructiveHint: true },
1111
1165
  requires: "network",
1112
1166
  description: "Remove a member from the channel. They can rejoin if not banned. Requires moderator+.",
1113
1167
  inputSchema: mIRC_kick_input,
@@ -1115,6 +1169,8 @@ var mircMembersTools = [
1115
1169
  },
1116
1170
  {
1117
1171
  name: "mIRC_ban",
1172
+ title: "Ban a member",
1173
+ annotations: { destructiveHint: true },
1118
1174
  requires: "network",
1119
1175
  description: "Ban a member from the channel. The ban is permanent until you call mIRC_unban. Requires admin+.",
1120
1176
  inputSchema: mIRC_ban_input,
@@ -1122,6 +1178,8 @@ var mircMembersTools = [
1122
1178
  },
1123
1179
  {
1124
1180
  name: "mIRC_unban",
1181
+ title: "Lift a ban",
1182
+ annotations: { readOnlyHint: false },
1125
1183
  requires: "network",
1126
1184
  description: "Lift a ban. Requires admin+.",
1127
1185
  inputSchema: mIRC_unban_input,
@@ -1129,6 +1187,8 @@ var mircMembersTools = [
1129
1187
  },
1130
1188
  {
1131
1189
  name: "mIRC_set_role",
1190
+ title: "Set member role",
1191
+ annotations: { readOnlyHint: false },
1132
1192
  requires: "network",
1133
1193
  description: "Promote / demote a member. Roles: owner(100) > superadmin(90) > admin(80) > moderator(70) > member(10). No 'guest'. An actor may assign any role below their own tier \u2014 so a superadmin (not only the owner) can promote to admin.",
1134
1194
  inputSchema: mIRC_set_role_input,
@@ -1136,6 +1196,8 @@ var mircMembersTools = [
1136
1196
  },
1137
1197
  {
1138
1198
  name: "mIRC_set_ptt",
1199
+ title: "Set push-to-talk permission",
1200
+ annotations: { readOnlyHint: false },
1139
1201
  requires: "network",
1140
1202
  description: "Grant or revoke PTT floor permission for a member in voice-capable channels (capabilities.ptt=true). Requires moderator+.",
1141
1203
  inputSchema: mIRC_set_ptt_input,
@@ -1241,6 +1303,8 @@ async function mIRC_list_messages(input, ctx) {
1241
1303
  var mircMessagesTools = [
1242
1304
  {
1243
1305
  name: "mIRC_post_message",
1306
+ title: "Post channel message",
1307
+ annotations: { readOnlyHint: false },
1244
1308
  requires: "network",
1245
1309
  description: "Post a text message into a persistent channel (mIRC). Pass channel_id from mIRC_create / mIRC_list; the backing space is resolved automatically. This is how an agent actually talks in a channel \u2014 the other mIRC_* tools only manage it. ACCESS: banned/blocked users are refused on ALL access modes (including open); open channels accept anyone not banned; password channels require joining with the password; private channels require request-access + approval. ATTRIBUTION: by default the message is signed with the identity behind the API key \u2014 and a key belongs to a USER, so an agent runtime using its owner's key posts as the OWNER. Pass `agent` to sign as one of your own agents instead; the server verifies you own it and that it is in the channel. ENCRYPTION: this tool posts SERVER-READABLE plaintext base64 on EVERY access mode \u2014 private and password channels included; it is never end-to-end encrypted. Open channels: app clients CAN read toolkit-posted messages. Password/private channels: the mosadd.com app group-key-encrypts channel text on supported clients, but the toolkit does not hold that group key \u2014 the message still lands server-readable and app clients cannot decrypt it as channel text (group-key parity is not yet wired).",
1246
1310
  inputSchema: mIRC_post_message_input,
@@ -1248,6 +1312,8 @@ var mircMessagesTools = [
1248
1312
  },
1249
1313
  {
1250
1314
  name: "mIRC_list_messages",
1315
+ title: "Read channel messages",
1316
+ annotations: { readOnlyHint: true },
1251
1317
  requires: "network",
1252
1318
  description: "List recent text messages in a persistent channel (mIRC), newest first, cursor-paginated. Pass channel_id; the backing space is resolved automatically.",
1253
1319
  inputSchema: mIRC_list_messages_input,
@@ -1345,6 +1411,8 @@ async function mIRC_mint_channel_token(input, ctx) {
1345
1411
  var mircEdgeTools = [
1346
1412
  {
1347
1413
  name: "mIRC_mint_channel_token",
1414
+ title: "Mint channel token",
1415
+ annotations: { readOnlyHint: false },
1348
1416
  requires: "network",
1349
1417
  description: "Exchange the hub key (MOSADD_API_KEY) for a short-lived (5min), channel-scoped JWT. Returns { token, expires_in, channel_id, scope }. The token is safe to hand to a browser to open a WS via `Sec-WebSocket-Protocol: mosadd.v1, bearer.<token>`. The hub key NEVER leaves the server. Use this from any server-side route (Next.js /api/chat-token, Express, etc.) before showing chat in a browser. Required by LINEAR-2675/E6 to avoid leaking the hub key into CDN access logs.",
1350
1418
  inputSchema: mIRC_mint_channel_token_input,
@@ -1352,6 +1420,8 @@ var mircEdgeTools = [
1352
1420
  },
1353
1421
  {
1354
1422
  name: "mIRC_send_edge",
1423
+ title: "Send message (low-latency edge)",
1424
+ annotations: { readOnlyHint: false },
1355
1425
  requires: "network",
1356
1426
  description: "Send a text message into a persistent channel via the mosadd-edge Cloudflare Worker (Durable Object backend). Sub-100ms global fan-out to all WebSocket subscribers of the channel + async flush to Supabase as system-of-record (idempotent). Use this when you want native realtime push without polling. Parallel to mIRC_post_message (Supabase path); pick one per channel. Auth: MOSADD_API_KEY env (hub key).",
1357
1427
  inputSchema: mIRC_send_edge_input,
@@ -1359,6 +1429,8 @@ var mircEdgeTools = [
1359
1429
  },
1360
1430
  {
1361
1431
  name: "mIRC_history_edge",
1432
+ title: "Read channel history (edge)",
1433
+ annotations: { readOnlyHint: true },
1362
1434
  requires: "network",
1363
1435
  description: "Read the last N (max 100) messages held in the channel's Durable Object ring buffer at the edge. Hot path is the DO, not Supabase \u2014 same data lands in messages_meta via async flush, so cold reads / pagination beyond 100 should use mIRC_list_messages.",
1364
1436
  inputSchema: mIRC_history_edge_input,
@@ -1496,6 +1568,8 @@ async function mp0st_notify(input, ctx) {
1496
1568
  var mailTools = [
1497
1569
  {
1498
1570
  name: "mAYL_list",
1571
+ title: "List emails",
1572
+ annotations: { readOnlyHint: true },
1499
1573
  requires: "network",
1500
1574
  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 mAYL_view to read a full message body.",
1501
1575
  inputSchema: mp0st_list_input,
@@ -1503,6 +1577,8 @@ var mailTools = [
1503
1577
  },
1504
1578
  {
1505
1579
  name: "mAYL_send",
1580
+ title: "Send email",
1581
+ annotations: { readOnlyHint: false },
1506
1582
  requires: "network",
1507
1583
  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').",
1508
1584
  inputSchema: mp0st_send_input,
@@ -1510,6 +1586,8 @@ var mailTools = [
1510
1586
  },
1511
1587
  {
1512
1588
  name: "mAYL_view",
1589
+ title: "Read an email",
1590
+ annotations: { readOnlyHint: true },
1513
1591
  requires: "network",
1514
1592
  description: "Read the full body and metadata of an email by message_id.",
1515
1593
  inputSchema: mp0st_view_input,
@@ -1517,6 +1595,8 @@ var mailTools = [
1517
1595
  },
1518
1596
  {
1519
1597
  name: "mAYL_delete",
1598
+ title: "Delete email",
1599
+ annotations: { destructiveHint: true },
1520
1600
  requires: "network",
1521
1601
  description: "Delete one of the user's emails by message_id (from mAYL_list). Soft-delete \u2014 it stops showing in mAYL_list. Owner-scoped: only your own mail.",
1522
1602
  inputSchema: mp0st_delete_input,
@@ -1524,6 +1604,8 @@ var mailTools = [
1524
1604
  },
1525
1605
  {
1526
1606
  name: "mAYL_stats",
1607
+ title: "Email delivery stats",
1608
+ annotations: { readOnlyHint: true },
1527
1609
  requires: "network",
1528
1610
  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.",
1529
1611
  inputSchema: mp0st_stats_input,
@@ -1531,6 +1613,8 @@ var mailTools = [
1531
1613
  },
1532
1614
  {
1533
1615
  name: "mAYL_events",
1616
+ title: "Email event trail",
1617
+ annotations: { readOnlyHint: true },
1534
1618
  requires: "network",
1535
1619
  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 mAYL_stats for the rollup; use this for the per-event detail. Owner-scoped.",
1536
1620
  inputSchema: mp0st_events_input,
@@ -1538,6 +1622,8 @@ var mailTools = [
1538
1622
  },
1539
1623
  {
1540
1624
  name: "mAYL_metrics",
1625
+ title: "Email engagement metrics",
1626
+ annotations: { readOnlyHint: true },
1541
1627
  requires: "network",
1542
1628
  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.",
1543
1629
  inputSchema: mp0st_metrics_input,
@@ -1545,6 +1631,8 @@ var mailTools = [
1545
1631
  },
1546
1632
  {
1547
1633
  name: "mAYL_revoke",
1634
+ title: "Revoke a sent email",
1635
+ annotations: { destructiveHint: true },
1548
1636
  requires: "network",
1549
1637
  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.",
1550
1638
  inputSchema: mp0st_revoke_input,
@@ -1552,6 +1640,8 @@ var mailTools = [
1552
1640
  },
1553
1641
  {
1554
1642
  name: "mAYL_audit_export",
1643
+ title: "Export signed audit report",
1644
+ annotations: { readOnlyHint: true },
1555
1645
  requires: "network",
1556
1646
  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.",
1557
1647
  inputSchema: mp0st_audit_export_input,
@@ -1559,6 +1649,8 @@ var mailTools = [
1559
1649
  },
1560
1650
  {
1561
1651
  name: "mAYL_consent",
1652
+ title: "Manage tracking opt-outs",
1653
+ annotations: { readOnlyHint: false },
1562
1654
  requires: "network",
1563
1655
  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; mAYL_send then automatically sends them with NO pixel/link-wrap. Owner-scoped.",
1564
1656
  inputSchema: mp0st_consent_input,
@@ -1566,6 +1658,8 @@ var mailTools = [
1566
1658
  },
1567
1659
  {
1568
1660
  name: "mAYL_notify",
1661
+ title: "Engagement notifications feed",
1662
+ annotations: { readOnlyHint: true },
1569
1663
  requires: "network",
1570
1664
  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.",
1571
1665
  inputSchema: mp0st_notify_input,
@@ -1641,6 +1735,8 @@ async function mAYL_send_as_agent(input, ctx) {
1641
1735
  var mailProvenanceTools = [
1642
1736
  {
1643
1737
  name: "mAYL_send_as_agent",
1738
+ title: "Send email as your agent",
1739
+ annotations: { readOnlyHint: false },
1644
1740
  requires: "network",
1645
1741
  description: "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 \u2014 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.",
1646
1742
  inputSchema: mp0st_send_as_agent_input,
@@ -1696,6 +1792,8 @@ async function agentbox_extend(input, ctx) {
1696
1792
  var mailAgentboxTools = [
1697
1793
  {
1698
1794
  name: "mAYL_agentbox_provision",
1795
+ title: "Provision disposable inbox",
1796
+ annotations: { readOnlyHint: false },
1699
1797
  requires: "network",
1700
1798
  description: "Mint the agent its OWN real, disposable email inbox at agent-<hex>@mosadd.com that can SEND and RECEIVE. Default ephemeral with a 10-minute TTL (auto-expires + is reaped); pass kind:'persistent' for a permanent box, or ttl_seconds (max 86400) for a custom lifetime. Optional display_name + agent_id. Returns the box {id, address, expires_at}. Use the address to catch signup/verification codes or replies, then mAYL_list (filter by the box address) + mAYL_view to read what arrived. Owner-scoped; max 25 active boxes per account.",
1701
1799
  inputSchema: agentbox_provision_input,
@@ -1703,6 +1801,8 @@ var mailAgentboxTools = [
1703
1801
  },
1704
1802
  {
1705
1803
  name: "mAYL_agentbox_list",
1804
+ title: "List disposable inboxes",
1805
+ annotations: { readOnlyHint: true },
1706
1806
  requires: "network",
1707
1807
  description: "List your active agent inboxes (address, display_name, kind, agent_id, expires_at), newest first. Owner-scoped.",
1708
1808
  inputSchema: agentbox_list_input,
@@ -1710,6 +1810,8 @@ var mailAgentboxTools = [
1710
1810
  },
1711
1811
  {
1712
1812
  name: "mAYL_agentbox_release",
1813
+ title: "Release disposable inbox",
1814
+ annotations: { destructiveHint: true },
1713
1815
  requires: "network",
1714
1816
  description: "Release (delete) one of your agent inboxes by id \u2014 frees the address immediately so it stops receiving. Owner-scoped.",
1715
1817
  inputSchema: agentbox_release_input,
@@ -1717,6 +1819,8 @@ var mailAgentboxTools = [
1717
1819
  },
1718
1820
  {
1719
1821
  name: "mAYL_agentbox_extend",
1822
+ title: "Extend disposable inbox",
1823
+ annotations: { readOnlyHint: false },
1720
1824
  requires: "network",
1721
1825
  description: "Extend an EPHEMERAL agent inbox's lifetime by id (ttl_seconds counted from NOW, max 24 h). Persistent boxes never expire and cannot be extended. Owner-scoped.",
1722
1826
  inputSchema: agentbox_extend_input,
@@ -1762,6 +1866,8 @@ async function mTALK_state(input, ctx) {
1762
1866
  var mtalkTools = [
1763
1867
  {
1764
1868
  name: "mTALK_open",
1869
+ title: "Open push-to-talk room",
1870
+ annotations: { readOnlyHint: false },
1765
1871
  requires: "any",
1766
1872
  description: "Open (or get) a push-to-talk room. Returns a stable room_id. Pass an optional label to share a named room (e.g. 'ops'); omit it for a personal room. Works over network (LiveKit) or off-grid radio depending on the host.",
1767
1873
  inputSchema: mTALK_open_input,
@@ -1769,6 +1875,8 @@ var mtalkTools = [
1769
1875
  },
1770
1876
  {
1771
1877
  name: "mTALK_join",
1878
+ title: "Get PTT join credentials",
1879
+ annotations: { readOnlyHint: false },
1772
1880
  requires: "network",
1773
1881
  description: "Get credentials (token + media URL) to join a PTT room's audio transport. Hand these to a human or bot client to connect. The agent itself drives the floor with mTALK_press / mTALK_release.",
1774
1882
  inputSchema: mTALK_join_input,
@@ -1776,6 +1884,8 @@ var mtalkTools = [
1776
1884
  },
1777
1885
  {
1778
1886
  name: "mTALK_press",
1887
+ title: "Press to talk (request floor)",
1888
+ annotations: { readOnlyHint: false },
1779
1889
  requires: "any",
1780
1890
  description: "Press push-to-talk: request the floor in a room. Half-duplex \u2014 if no one is transmitting you are GRANTED the floor (granted=true) and may speak; otherwise you are queued FIFO and `position` tells you where you are. Call mTALK_release when done. A holder who never releases is auto-bumped after the anti-hog timeout.",
1781
1891
  inputSchema: mTALK_press_input,
@@ -1783,6 +1893,8 @@ var mtalkTools = [
1783
1893
  },
1784
1894
  {
1785
1895
  name: "mTALK_release",
1896
+ title: "Release the floor",
1897
+ annotations: { readOnlyHint: false },
1786
1898
  requires: "any",
1787
1899
  description: "Release push-to-talk: give up the floor (or cancel your queued request). If you held the floor, the next participant in the queue is promoted automatically. Returns the new holder and queue.",
1788
1900
  inputSchema: mTALK_release_input,
@@ -1790,6 +1902,8 @@ var mtalkTools = [
1790
1902
  },
1791
1903
  {
1792
1904
  name: "mTALK_state",
1905
+ title: "Read PTT floor state",
1906
+ annotations: { readOnlyHint: true },
1793
1907
  requires: "any",
1794
1908
  description: "Read a PTT room's floor state without changing it: who is currently transmitting (holder), since when, and the waiting queue.",
1795
1909
  inputSchema: mTALK_state_input,
@@ -1991,6 +2105,8 @@ async function mIRC_send_file(input, ctx) {
1991
2105
  var attachmentTools = [
1992
2106
  {
1993
2107
  name: "mDM_send_voice",
2108
+ title: "Send a voice message",
2109
+ annotations: { readOnlyHint: false },
1994
2110
  requires: "network",
1995
2111
  description: "Send a VOICE note to a contact as a first-class mDM `voice` message (not a URL stub). Pass audio bytes as base64; the tool uploads to Storage and posts via message-send with the voice attachment descriptor. SCAFFOLD: mDM is client-encrypted \u2014 until the seal step ships, bytes are uploaded unsealed (TODO Lane A).",
1996
2112
  inputSchema: mDM_send_voice_input,
@@ -1998,6 +2114,8 @@ var attachmentTools = [
1998
2114
  },
1999
2115
  {
2000
2116
  name: "mDM_send_file",
2117
+ title: "Send a file in DM",
2118
+ annotations: { readOnlyHint: false },
2001
2119
  requires: "network",
2002
2120
  description: "Send a FILE to a contact as a first-class mDM `file` message. Base64 bytes \u2192 Storage \u2192 message-send file attachment. SCAFFOLD: mDM E2EE seal is TODO (Lane A).",
2003
2121
  inputSchema: mDM_send_file_input,
@@ -2005,6 +2123,8 @@ var attachmentTools = [
2005
2123
  },
2006
2124
  {
2007
2125
  name: "mIRC_send_voice",
2126
+ title: "Send voice note to channel",
2127
+ annotations: { readOnlyHint: false },
2008
2128
  requires: "network",
2009
2129
  description: "Send a VOICE note into a persistent channel as a first-class `voice` message. Base64 audio \u2192 Storage \u2192 message-send (backing space resolved automatically).",
2010
2130
  inputSchema: mIRC_send_voice_input,
@@ -2012,6 +2132,8 @@ var attachmentTools = [
2012
2132
  },
2013
2133
  {
2014
2134
  name: "mIRC_send_file",
2135
+ title: "Send file to channel",
2136
+ annotations: { readOnlyHint: false },
2015
2137
  requires: "network",
2016
2138
  description: "Send a FILE into a persistent channel as a first-class `file` message. Base64 bytes \u2192 Storage \u2192 message-send.",
2017
2139
  inputSchema: mIRC_send_file_input,
@@ -2053,6 +2175,8 @@ async function mTALK_ingest_ptt(input, ctx) {
2053
2175
  var pttIngestTools = [
2054
2176
  {
2055
2177
  name: "mTALK_ingest_ptt",
2178
+ title: "Transcribe PTT audio into memory",
2179
+ annotations: { readOnlyHint: false },
2056
2180
  requires: "network",
2057
2181
  description: "Submit a finished PTT 'over' (push-to-talk audio segment) for transcription into the caller's RAG index \u2014 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.",
2058
2182
  inputSchema: mTALK_ingest_ptt_input,
@@ -2187,6 +2311,8 @@ async function mRAG_delete(input, ctx) {
2187
2311
  var knowledgeTools = [
2188
2312
  {
2189
2313
  name: "mRAG_ingest",
2314
+ title: "Ingest into memory",
2315
+ annotations: { readOnlyHint: false },
2190
2316
  requires: "network",
2191
2317
  description: "Add text to the USER'S OWN private knowledge base so mRAG_search can recall it later. Pass content_text (a note, document, transcript, pasted page); it is semantically chunked, embedded (1536-d) and stored in the per-user vector index mRAG_search reads. Returns how many chunks were indexed. \u26A0 IF YOU ARE INDEXING A CORPUS you want to TRAVERSE (who is connected to whom, when), also pass sender / recipient / occurred_at: the knowledge graph builds its nodes from those fields alone, so documents ingested without them are searchable but contribute NOTHING to mRAG_graph_overview / _neighbors / _timeline \u2014 the graph comes back empty however many documents you loaded. Reuse the same party `ref` across documents to merge them into one node. NOTE: indexed content and metadata are stored server-side in plaintext \u2014 NOT covered by the zero-knowledge / E2EE guarantee. Only ingest what the user opted to make searchable.",
2192
2318
  inputSchema: mRAG_ingest_input,
@@ -2194,6 +2320,8 @@ var knowledgeTools = [
2194
2320
  },
2195
2321
  {
2196
2322
  name: "mRAG_search",
2323
+ title: "Search memory",
2324
+ annotations: { readOnlyHint: true },
2197
2325
  requires: "network",
2198
2326
  description: "Search and answer questions over the USER'S OWN mosadd data (messages, emails, calls, notes) with a private per-user RAG index \u2014 hybrid vector + keyword retrieval, reranked, grounded in cited sources (no fabrication). Use it to recall 'what did X say about Y', summarize a thread, or pull facts the user has received. Returns an answer plus the source snippets it used. This is agent memory (mRAG = RAG over your own data) over the user's communications, available outside the mosadd app. NOTE: RAG requires content to be indexed server-side in plaintext, so anything searchable here is NOT covered by the zero-knowledge / E2EE guarantee \u2014 only data the user has explicitly opted into indexing is searchable. See docs/security/e2ee-posture.md.",
2199
2327
  inputSchema: mRAG_search_input,
@@ -2201,6 +2329,8 @@ var knowledgeTools = [
2201
2329
  },
2202
2330
  {
2203
2331
  name: "mRAG_list_sources",
2332
+ title: "List memory sources",
2333
+ annotations: { readOnlyHint: true },
2204
2334
  requires: "network",
2205
2335
  description: "List what is currently indexed in the user's private knowledge base, grouped by source (source_type, source_id, thread_id, title) with per-source chunk counts and first/last indexed timestamps. Use it to see what mRAG_search can recall, and to find a source_id to remove with mRAG_delete. Owner-scoped.",
2206
2336
  inputSchema: mRAG_list_sources_input,
@@ -2208,6 +2338,8 @@ var knowledgeTools = [
2208
2338
  },
2209
2339
  {
2210
2340
  name: "mRAG_delete",
2341
+ title: "Delete memory source",
2342
+ annotations: { destructiveHint: true },
2211
2343
  requires: "network",
2212
2344
  description: "Remove indexed content from the user's knowledge base by source_id or thread_id (from mRAG_list_sources). Deletes every embedded chunk for that source so mRAG_search can no longer recall it. Requires source_id or thread_id (will not purge the whole index). Returns the number of chunks deleted. Owner-scoped.",
2213
2345
  inputSchema: mRAG_delete_input,
@@ -2270,6 +2402,8 @@ async function mRAG_graph_timeline(input, ctx) {
2270
2402
  var knowledgeGraphTools = [
2271
2403
  {
2272
2404
  name: "mRAG_graph_refresh",
2405
+ title: "Rebuild knowledge graph",
2406
+ annotations: { readOnlyHint: false },
2273
2407
  requires: "network",
2274
2408
  description: "(Re)build the USER'S OWN knowledge graph from their indexed data, then return what it found (counts of parties/mentions/edges). Run this first, or after new data has been ingested, so mRAG_graph_overview/neighbors/timeline reflect the latest. Built from METADATA only (who-sent-to-whom, thread membership) \u2014 never message bodies, so it does not weaken E2EE. Owner-scoped.",
2275
2409
  inputSchema: mRAG_graph_refresh_input,
@@ -2277,6 +2411,8 @@ var knowledgeGraphTools = [
2277
2411
  },
2278
2412
  {
2279
2413
  name: "mRAG_graph_overview",
2414
+ title: "Knowledge graph overview",
2415
+ annotations: { readOnlyHint: true },
2280
2416
  requires: "network",
2281
2417
  description: "List the parties (people / companies / services) in the user's knowledge graph, busiest first, each with its party_id, kind, aliases, appearance count, connection count and first/last-seen dates. This is the entry point: use a returned party_id with mRAG_graph_neighbors or mRAG_graph_timeline. Owner-scoped.",
2282
2418
  inputSchema: mRAG_graph_overview_input,
@@ -2284,6 +2420,8 @@ var knowledgeGraphTools = [
2284
2420
  },
2285
2421
  {
2286
2422
  name: "mRAG_graph_neighbors",
2423
+ title: "Explore graph neighbors",
2424
+ annotations: { readOnlyHint: true },
2287
2425
  requires: "network",
2288
2426
  description: "Walk the connections of one party (from mRAG_graph_overview) \u2014 who/what it is linked to, with the edge type, how many times observed, and when. Answers 'who is connected to X, and how'. Depth is hard-clamped to 2 hops and breadth to 200 server-side. Owner-scoped.",
2289
2427
  inputSchema: mRAG_graph_neighbors_input,
@@ -2291,6 +2429,8 @@ var knowledgeGraphTools = [
2291
2429
  },
2292
2430
  {
2293
2431
  name: "mRAG_graph_timeline",
2432
+ title: "Knowledge graph timeline",
2433
+ annotations: { readOnlyHint: true },
2294
2434
  requires: "network",
2295
2435
  description: "Return the dated appearance timeline of one party (from mRAG_graph_overview) \u2014 each source (email/message/call/\u2026), its thread, the party's role, and when it occurred, newest first. Answers 'when and where did X show up'. Owner-scoped.",
2296
2436
  inputSchema: mRAG_graph_timeline_input,
@@ -2394,6 +2534,8 @@ var actionTools = [
2394
2534
  // lives in the `comms_` namespace rather than a channel `m<MODULE>_` prefix.
2395
2535
  // A dedicated `mACT` module (create/get/status) is a possible RFC follow-up.
2396
2536
  name: "comms_action_create",
2537
+ title: "Create one-click action link",
2538
+ annotations: { readOnlyHint: false },
2397
2539
  requires: "network",
2398
2540
  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).",
2399
2541
  inputSchema: action_create_input,
@@ -2401,6 +2543,8 @@ var actionTools = [
2401
2543
  },
2402
2544
  {
2403
2545
  name: "comms_action_frame_get",
2546
+ title: "View shared screen frame",
2547
+ annotations: { readOnlyHint: true },
2404
2548
  requires: "network",
2405
2549
  description: "See the LATEST screen frame from a 'screen_share' action you created (pass the action_id from comms_action_create). Returns the current screenshot AS AN IMAGE you can look at, plus how old it is. The recipient must have opened the link and clicked 'share screen' first. Poll this every few seconds to watch live. VIEW ONLY \u2014 you cannot click or control their screen. Returns a 'no frame yet' note until they start sharing.",
2406
2550
  inputSchema: action_frame_get_input,
@@ -2413,7 +2557,9 @@ import { hostname } from "os";
2413
2557
  import { z as z17 } from "zod";
2414
2558
  var BEAT_MS = 6e4;
2415
2559
  var HOLD_SECONDS = 300;
2560
+ var UUID_RE2 = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
2416
2561
  var attachments = /* @__PURE__ */ new Map();
2562
+ var processBindings = /* @__PURE__ */ new Map();
2417
2563
  async function beat(env, identityId, host, mode) {
2418
2564
  await getSupabase(env).from("agent_bridge_heartbeat").upsert(
2419
2565
  { identity_id: identityId, last_seen_at: (/* @__PURE__ */ new Date()).toISOString(), host, mode },
@@ -2432,64 +2578,122 @@ async function resolveSelf(env) {
2432
2578
  if (error || !data) {
2433
2579
  throw new Error("This account has no mosadd identity row yet \u2014 sign in to mosadd.com once to create it.");
2434
2580
  }
2435
- return { id: data.id, display_name: data.display_name ?? null };
2581
+ return { id: data.id, display_name: data.display_name ?? null, user_id: u.user.id };
2582
+ }
2583
+ async function resolveOwnedAgentLine(env, ownerUserId, ref) {
2584
+ const value = ref.trim();
2585
+ if (!value || /[(),]/.test(value)) return null;
2586
+ let q = getSupabase(env).from("identities").select("id, m0ssad_email, display_name").eq("kind", "agent").eq("owner_user_id", ownerUserId).is("retired_at", null);
2587
+ q = UUID_RE2.test(value) ? q.or(`id.eq.${value},m0ssad_email.eq.${value}`) : q.or(`m0ssad_email.eq.${value},display_name.eq.${value}`);
2588
+ const { data, error } = await q.limit(2);
2589
+ if (error || !data || data.length !== 1) return null;
2590
+ return data[0];
2591
+ }
2592
+ function stopAttachment(identityId) {
2593
+ const existing = attachments.get(identityId);
2594
+ if (existing) {
2595
+ clearInterval(existing.timer);
2596
+ attachments.delete(identityId);
2597
+ }
2598
+ }
2599
+ function startAttachment(env, identityId, host, mode, ctx) {
2600
+ const timer = setInterval(() => {
2601
+ void beat(env, identityId, host, mode).catch((e) => {
2602
+ ctx.log("warn", "comms_session_attach: beat failed", { identity_id: identityId, error: String(e) });
2603
+ });
2604
+ }, BEAT_MS);
2605
+ timer.unref?.();
2606
+ attachments.set(identityId, { timer, env });
2436
2607
  }
2437
2608
  var comms_session_attach_input = z17.object({
2438
2609
  label: z17.string().max(120).optional().describe(
2439
2610
  "Short name for THIS session, shown to the owner as who is holding the line (e.g. 'CTO \u2014 Claude Code', 'dispatcher \u2014 Cowork'). Defaults to the machine name."
2440
2611
  ),
2612
+ as_agent: z17.string().max(200).optional().describe(
2613
+ "Speak as ONE OF THE OWNER'S AGENT LINES while holding the owner's key \u2014 its mosADD address (dispatcher@mosadd.com), identity id, or display name. Declares ONCE per session whose line this session speaks for: the gateway then signs your CHANNEL posts as that agent automatically (no per-post `agent` field needed), and that agent's cloud stand-in defers to you. The server verifies you OWN the agent; a stranger's agent is refused. Omit to claim the key's own line, exactly as before."
2614
+ ),
2441
2615
  release: z17.boolean().optional().describe(
2442
- "Hand the line back immediately instead of claiming it: stops this session's keep-alive and clears the liveness row, so the 24/7 cloud stand-in resumes answering at once rather than after the hold expires. Call this when the session is finishing."
2616
+ "Hand the line back immediately instead of claiming it: stops this session's keep-alive, clears the liveness row (and any as_agent declaration this session made), so the 24/7 cloud stand-in resumes answering at once rather than after the hold expires. Call this when the session is finishing."
2443
2617
  )
2444
2618
  });
2445
2619
  async function comms_session_attach(input, ctx) {
2446
2620
  const env = readSupabaseEnv();
2447
2621
  const self = await resolveSelf(env);
2448
- const existing = attachments.get(self.id);
2449
- if (existing) {
2450
- clearInterval(existing.timer);
2451
- attachments.delete(self.id);
2452
- }
2622
+ const sb = getSupabase(env);
2453
2623
  if (input.release) {
2454
- ctx.log("info", "comms_session_attach: releasing line", { identity_id: self.id });
2455
- const { error } = await getSupabase(env).from("agent_bridge_heartbeat").delete().eq("identity_id", self.id);
2456
- if (error) throw new Error(`Could not release the line: ${error.message}`);
2624
+ const toRelease = /* @__PURE__ */ new Set([self.id]);
2625
+ const bound = processBindings.get(self.user_id);
2626
+ if (bound) toRelease.add(bound);
2627
+ if (input.as_agent) {
2628
+ const agent = await resolveOwnedAgentLine(env, self.user_id, input.as_agent);
2629
+ if (agent) toRelease.add(agent.id);
2630
+ }
2631
+ for (const id of toRelease) {
2632
+ stopAttachment(id);
2633
+ const { error } = await sb.from("agent_bridge_heartbeat").delete().eq("identity_id", id);
2634
+ if (error) throw new Error(`Could not release the line: ${error.message}`);
2635
+ }
2636
+ await sb.from("mosadd_gateway_agent_binding").delete().eq("user_id", self.user_id);
2637
+ processBindings.delete(self.user_id);
2638
+ ctx.log("info", "comms_session_attach: released", { identity_ids: [...toRelease] });
2457
2639
  return {
2458
2640
  attached: false,
2459
2641
  identity_id: self.id,
2460
2642
  display_name: self.display_name,
2461
- note: "Line released. The 24/7 cloud stand-in answers this account from now on."
2643
+ note: "Line released (agent declaration cleared too). The 24/7 cloud stand-in answers from now on."
2462
2644
  };
2463
2645
  }
2464
2646
  const host = input.label?.trim() || `mcp:${hostname()}`;
2465
2647
  const mode = "mcp-session";
2648
+ let lineId = self.id;
2649
+ let speakingAs;
2650
+ if (input.as_agent) {
2651
+ const agent = await resolveOwnedAgentLine(env, self.user_id, input.as_agent);
2652
+ if (!agent) {
2653
+ throw new Error(
2654
+ `No LIVE agent of yours matches "${input.as_agent}". You may only speak as an agent you OWN (its mosADD address, identity id, or display name) \u2014 never as someone else's agent or another human.`
2655
+ );
2656
+ }
2657
+ lineId = agent.id;
2658
+ speakingAs = { identity_id: agent.id, address: agent.m0ssad_email, display_name: agent.display_name };
2659
+ const { error: bindError } = await sb.from("mosadd_gateway_agent_binding").upsert(
2660
+ {
2661
+ user_id: self.user_id,
2662
+ agent_identity_id: agent.id,
2663
+ agent_address: agent.m0ssad_email,
2664
+ bound_at: (/* @__PURE__ */ new Date()).toISOString(),
2665
+ bound_by_host: host
2666
+ },
2667
+ { onConflict: "user_id" }
2668
+ );
2669
+ if (bindError) throw new Error(`Could not declare the agent line: ${bindError.message}`);
2670
+ processBindings.set(self.user_id, agent.id);
2671
+ }
2672
+ stopAttachment(lineId);
2466
2673
  try {
2467
- await beat(env, self.id, host, mode);
2674
+ await beat(env, lineId, host, mode);
2468
2675
  } catch (e) {
2469
2676
  throw new Error(`Could not claim the line: ${e instanceof Error ? e.message : String(e)}`);
2470
2677
  }
2471
- const timer = setInterval(() => {
2472
- void beat(env, self.id, host, mode).catch((e) => {
2473
- ctx.log("warn", "comms_session_attach: beat failed", { identity_id: self.id, error: String(e) });
2474
- });
2475
- }, BEAT_MS);
2476
- timer.unref?.();
2477
- attachments.set(self.id, { timer, env });
2478
- ctx.log("info", "comms_session_attach: line claimed", { identity_id: self.id, host });
2678
+ startAttachment(env, lineId, host, mode, ctx);
2679
+ ctx.log("info", "comms_session_attach: line claimed", { identity_id: lineId, host, as_agent: speakingAs?.address });
2479
2680
  return {
2480
2681
  attached: true,
2481
- identity_id: self.id,
2482
- display_name: self.display_name,
2682
+ identity_id: lineId,
2683
+ display_name: speakingAs ? speakingAs.display_name : self.display_name,
2684
+ ...speakingAs ? { speaking_as: speakingAs } : {},
2483
2685
  host,
2484
2686
  holds_for_seconds: HOLD_SECONDS,
2485
- note: "This session now owns the account's reply lane; the cloud stand-in will not answer while it is held. The hold renews itself for as long as this process runs and lapses on its own if the session dies. Call again with release:true to hand it back immediately."
2687
+ note: speakingAs ? `This session now speaks for ${speakingAs.address ?? speakingAs.identity_id}: channel posts sent through this gateway are signed as that agent automatically (an explicit \`agent\` field still wins), and the agent's cloud stand-in defers to you while the session runs. Call again with release:true to hand it back.` : "This session now owns the account's reply lane; the cloud stand-in will not answer while it is held. The hold renews itself for as long as this process runs and lapses on its own if the session dies. Call again with release:true to hand it back immediately."
2486
2688
  };
2487
2689
  }
2488
2690
  var presenceTools = [
2489
2691
  {
2490
2692
  name: "comms_session_attach",
2693
+ title: "Attach session to a line",
2694
+ annotations: { destructiveHint: false, idempotentHint: true },
2491
2695
  requires: "network",
2492
- description: "Claim this mosADD account's reply lane for the CURRENT agent session, so the 24/7 cloud stand-in stops answering in your place and the owner talks to you instead. Call it once at the start of a session that will answer the owner's messages; the hold renews itself while the session runs and lapses on its own if the session dies, so the account is never left looking alive when nobody is there. Pass release:true when finishing to hand the line back immediately. Owner-scoped: a session can only claim the account whose key it holds.",
2696
+ description: "Claim a mosADD reply lane for the CURRENT agent session, so the 24/7 cloud stand-in stops answering in its place and the owner talks to you instead. Call it once at the start of a session; the hold renews itself while the session runs and lapses on its own if the session dies. Holding the OWNER's key while working as one of their agent lines? Pass as_agent:'<address of YOUR line>' (e.g. dispatcher@mosadd.com) \u2014 the gateway then signs your channel posts as that agent automatically for the whole session and silences that agent's stand-in; ownership is verified server-side. Pass release:true when finishing to hand everything back immediately. Owner-scoped: a session can only claim the account whose key it holds, or a line of an agent that account owns.",
2493
2697
  inputSchema: comms_session_attach_input,
2494
2698
  handler: comms_session_attach
2495
2699
  }
@@ -2542,6 +2746,8 @@ async function embed_create(input, ctx) {
2542
2746
  var embedTools = [
2543
2747
  {
2544
2748
  name: "comms_embed_create",
2749
+ title: "Create website embed",
2750
+ annotations: { readOnlyHint: false },
2545
2751
  requires: "network",
2546
2752
  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 }.",
2547
2753
  inputSchema: embed_create_input,
@@ -2590,6 +2796,8 @@ async function threat_classify(input, _ctx) {
2590
2796
  var threatTools = [
2591
2797
  {
2592
2798
  name: "threat_catalog",
2799
+ title: "Threat taxonomy catalog",
2800
+ annotations: { readOnlyHint: true },
2593
2801
  requires: "any",
2594
2802
  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.",
2595
2803
  inputSchema: threat_catalog_input,
@@ -2597,6 +2805,8 @@ var threatTools = [
2597
2805
  },
2598
2806
  {
2599
2807
  name: "threat_classify",
2808
+ title: "Classify threat event",
2809
+ annotations: { readOnlyHint: true },
2600
2810
  requires: "any",
2601
2811
  description: `Classify a single telemetry event against the mosadd threat taxonomy + DECK engine. For a known event type (e.g. PROCESS_INJECTION, STINGRAY_DETECT, IMSI_CATCHER_SCAN, MEMORY_INJECTION) it returns that event's real severity (info|warning|elevated|critical|killswitch) with action="monitor" \u2014 Pegasus-class events surface as critical immediately, but the engine NEVER auto-acts (it tells you, it never disconnects/locks). Unknown strings fall back to the pure DECK decision (log_only|revoke_sessions|lock_account|suspend_did). Returns { action, severity, reason, known_event, category, label }. Deterministic, offline, no backend.`,
2602
2812
  inputSchema: threat_classify_input,
@@ -2748,6 +2958,8 @@ async function mURL_delete(input, ctx) {
2748
2958
  var murlTools = [
2749
2959
  {
2750
2960
  name: "mURL_read_channel",
2961
+ title: "Read domain channel",
2962
+ annotations: { readOnlyHint: true },
2751
2963
  requires: "network",
2752
2964
  description: "Read the live chat channel for a web DOMAIN (mURL \u2014 'IRC for URLs'). Returns the most recent messages humans and agents have posted about that domain. Use it to get real-time, crowd-sourced context before acting on a site \u2014 e.g. scam warnings, promo codes, outage reports, 'is this legit?'. The channel auto-exists for any domain. Auth: MOSADD_API_KEY (hub key).",
2753
2965
  inputSchema: mURL_read_channel_input,
@@ -2755,6 +2967,8 @@ var murlTools = [
2755
2967
  },
2756
2968
  {
2757
2969
  name: "mURL_post",
2970
+ title: "Post to domain channel",
2971
+ annotations: { readOnlyHint: false },
2758
2972
  requires: "network",
2759
2973
  description: "Post a message into a web DOMAIN's mURL chat channel \u2014 leave context for the humans and agents who visit that site next (a finding, warning, tip, or coordination note). Sub-100ms global fan-out to everyone currently on the channel. Auth: MOSADD_API_KEY (hub key).",
2760
2974
  inputSchema: mURL_post_input,
@@ -2762,6 +2976,8 @@ var murlTools = [
2762
2976
  },
2763
2977
  {
2764
2978
  name: "mURL_presence",
2979
+ title: "Who is on a domain now",
2980
+ annotations: { readOnlyHint: true },
2765
2981
  requires: "network",
2766
2982
  description: "Who is on a domain's mURL channel right now: live participant count + roster nicknames + channel status (open/claimed/blocked). Public (no key needed). Use it to gauge whether a domain has an active audience before posting.",
2767
2983
  inputSchema: mURL_presence_input,
@@ -2769,6 +2985,8 @@ var murlTools = [
2769
2985
  },
2770
2986
  {
2771
2987
  name: "mURL_list_channels",
2988
+ title: "List / trending domain channels",
2989
+ annotations: { readOnlyHint: true },
2772
2990
  requires: "network",
2773
2991
  description: "Discovery for mURL domain channels: 'trending' (most active in the last N hours, default 24) / 'list' (paginated catalogue, status-filtered) / 'mine' (channels you DNS-verified). Returns domain, slug, status, branding, verified_at + (for trending) messages_in_window. For who's-on-now, follow up with mURL_presence on the slug.",
2774
2992
  inputSchema: mURL_list_channels_input,
@@ -2776,6 +2994,8 @@ var murlTools = [
2776
2994
  },
2777
2995
  {
2778
2996
  name: "mURL_create",
2997
+ title: "Claim domain channel",
2998
+ annotations: { readOnlyHint: false },
2779
2999
  requires: "network",
2780
3000
  description: "Create / claim the mURL channel for a web DOMAIN and register YOU as its owner (idempotent \u2014 returns the existing channel if you already own it; fails with 'claimed_by_other' if another account owns it). Optionally set branding, and `status` ONLY when the channel is being created for the first time: on a channel that already exists (mURL rooms auto-create on first activity) murl-manage writes owner + branding and IGNORES status \u2014 use mURL_update to change the status of an existing room. Owner-side: needs your mosADD login session (user JWT via `mosadd login`), not just a hub key \u2014 same as mURL_list_channels action='mine'. Backend: murl-manage EF.",
2781
3001
  inputSchema: mURL_create_input,
@@ -2783,6 +3003,8 @@ var murlTools = [
2783
3003
  },
2784
3004
  {
2785
3005
  name: "mURL_update",
3006
+ title: "Update domain channel",
3007
+ annotations: { readOnlyHint: false },
2786
3008
  requires: "network",
2787
3009
  description: "Update a mURL DOMAIN channel you own: set branding, mark it 'claimed', 'blocked' (close the room), or reopen it as 'open'. Owner-scoped \u2014 you must own the channel (claim it first with mURL_create). Needs your mosADD login session. Backend: murl-manage EF.",
2788
3010
  inputSchema: mURL_update_input,
@@ -2790,6 +3012,8 @@ var murlTools = [
2790
3012
  },
2791
3013
  {
2792
3014
  name: "mURL_delete",
3015
+ title: "Delete domain channel",
3016
+ annotations: { destructiveHint: true },
2793
3017
  requires: "network",
2794
3018
  description: "Delete a mURL DOMAIN channel you own (removes its domain_controls row; the room stops being served). Owner-scoped \u2014 you must own it. Needs your mosADD login session. Backend: murl-manage EF.",
2795
3019
  inputSchema: mURL_delete_input,
@@ -2819,6 +3043,8 @@ function buildCapabilityManifest(tools) {
2819
3043
  function makeCapabilitiesTool(channelTools2) {
2820
3044
  const tool = {
2821
3045
  name: "comms_capabilities",
3046
+ title: "List tool capabilities",
3047
+ annotations: { readOnlyHint: true },
2822
3048
  requires: "any",
2823
3049
  description: "Discover which mosadd tools are available and what transport each requires (any | radio | network). Carrier-aware hosts (e.g. off-grid radio devices) call this once to gate the tool list to what the current carrier supports. Returns a manifest with per-tool requirements grouped by transport.",
2824
3050
  inputSchema: z21.object({}),
@@ -2933,7 +3159,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2933
3159
  // package.json
2934
3160
  var package_default = {
2935
3161
  name: "@mosadd/mcp",
2936
- version: "3.0.0-alpha.38",
3162
+ version: "3.0.0-alpha.39",
2937
3163
  mcpName: "io.github.hei33enberg/mosadd-mcp",
2938
3164
  description: "Model Context Protocol server for mosadd. Exposes 4 modules (mDM, mIRC, mURL, mAYL) and capabilities (mTALK, mRAG) plus comms agent-actions \u2014 84 tools \u2014 to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
2939
3165
  homepage: "https://github.com/Hei33enberg/mosADD-OS/tree/main/packages/mcp",
@@ -3167,6 +3393,17 @@ function createMosaddServer(options = {}) {
3167
3393
  const server = new McpServer(
3168
3394
  {
3169
3395
  name: "mosadd",
3396
+ // Human-facing identity of the server itself (initialize result). The icon URLs
3397
+ // point at the LIVE gateway origin on purpose: clients that honour serverInfo.icons
3398
+ // get the brand mark without scraping the favicon, and the files ship with
3399
+ // apps/mcp-http/public (canon 08-26 — generated by m0ssad-3 scripts/
3400
+ // generate-brand-icons.py, never hand-edited).
3401
+ title: "mosADD \u2014 omnichannel messenger for agents",
3402
+ websiteUrl: "https://mosadd.com",
3403
+ icons: [
3404
+ { src: "https://mcp.mosadd.com/favicon.svg", mimeType: "image/svg+xml", sizes: ["any"] },
3405
+ { src: "https://mcp.mosadd.com/pwa-192.png", mimeType: "image/png", sizes: ["192x192"] }
3406
+ ],
3170
3407
  version: PKG_VERSION
3171
3408
  },
3172
3409
  {
@@ -3177,38 +3414,50 @@ function createMosaddServer(options = {}) {
3177
3414
  );
3178
3415
  for (const tool of allTools) {
3179
3416
  const shape = tool.inputSchema && typeof tool.inputSchema === "object" && "shape" in tool.inputSchema ? tool.inputSchema.shape : tool.inputSchema;
3180
- server.tool(
3181
- tool.name,
3182
- tool.description,
3183
- shape,
3184
- async (input) => {
3185
- const parsed = tool.inputSchema.parse(input);
3186
- try {
3187
- const result = await tool.handler(parsed, ctx);
3188
- const rich = result;
3189
- if (rich && Array.isArray(rich.mcpContent)) {
3190
- return { content: rich.mcpContent };
3191
- }
3192
- return {
3193
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
3194
- };
3195
- } catch (err) {
3196
- ctx.log("error", `tool ${tool.name} failed`, { error: String(err) });
3197
- return {
3198
- isError: true,
3199
- content: [
3200
- {
3201
- type: "text",
3202
- text: JSON.stringify({
3203
- error: err instanceof Error ? err.message : String(err),
3204
- tool: tool.name
3205
- })
3206
- }
3207
- ]
3208
- };
3417
+ const annotations = tool.title || tool.annotations ? { ...tool.title ? { title: tool.title } : {}, ...tool.annotations ?? {} } : void 0;
3418
+ const toolCallback = async (input) => {
3419
+ const parsed = tool.inputSchema.parse(input);
3420
+ try {
3421
+ const result = await tool.handler(parsed, ctx);
3422
+ const rich = result;
3423
+ if (rich && Array.isArray(rich.mcpContent)) {
3424
+ return { content: rich.mcpContent };
3209
3425
  }
3426
+ return {
3427
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
3428
+ };
3429
+ } catch (err) {
3430
+ ctx.log("error", `tool ${tool.name} failed`, { error: String(err) });
3431
+ return {
3432
+ isError: true,
3433
+ content: [
3434
+ {
3435
+ type: "text",
3436
+ text: JSON.stringify({
3437
+ error: err instanceof Error ? err.message : String(err),
3438
+ tool: tool.name
3439
+ })
3440
+ }
3441
+ ]
3442
+ };
3210
3443
  }
3211
- );
3444
+ };
3445
+ if (annotations) {
3446
+ server.tool(
3447
+ tool.name,
3448
+ tool.description,
3449
+ shape,
3450
+ annotations,
3451
+ toolCallback
3452
+ );
3453
+ } else {
3454
+ server.tool(
3455
+ tool.name,
3456
+ tool.description,
3457
+ shape,
3458
+ toolCallback
3459
+ );
3460
+ }
3212
3461
  }
3213
3462
  return server;
3214
3463
  }