@mosadd/mcp 3.0.0-alpha.33 → 3.0.0-alpha.35

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.
@@ -655,28 +655,71 @@ var mdmTools = [
655
655
  }
656
656
  ];
657
657
 
658
- // src/tools/mdm-voice.ts
658
+ // src/tools/mdm-as-agent.ts
659
659
  import { z as z2 } from "zod";
660
+ var mDM_send_as_agent_input = z2.object({
661
+ agent: z2.string().min(1).max(200).describe(
662
+ "Which of YOUR agents to speak as \u2014 its mosADD address (dispatcher@mosadd.com), its identity id, or its display name. Must be an agent you own."
663
+ ),
664
+ text: z2.string().min(1).max(8e3).describe("The message body, as the agent would write it."),
665
+ to: z2.string().max(200).optional().describe(
666
+ "Recipient identity id or mosADD address. Defaults to YOU (the key's owner) \u2014 the common case is an agent reporting to its owner. Must be a person, not another agent."
667
+ ),
668
+ silent: z2.boolean().optional().describe("Deliver without waking a phone: the message still arrives and shows unread, only the OS push is skipped.")
669
+ });
670
+ var mDM_list_my_agents_input = z2.object({});
671
+ async function mDM_send_as_agent(input, ctx) {
672
+ ctx.log("debug", "mDM_send_as_agent", { agent: input.agent });
673
+ return await invokeFunction("mdm-send-as-agent", {
674
+ agent: input.agent,
675
+ text: input.text,
676
+ ...input.to ? { to: input.to } : {},
677
+ ...input.silent ? { silent: true } : {}
678
+ });
679
+ }
680
+ async function mDM_list_my_agents(_input, ctx) {
681
+ ctx.log("debug", "mDM_list_my_agents");
682
+ return await invokeFunction("mdm-send-as-agent", { action: "list_agents" });
683
+ }
684
+ var mdmAsAgentTools = [
685
+ {
686
+ name: "mDM_send_as_agent",
687
+ requires: "network",
688
+ 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.",
689
+ inputSchema: mDM_send_as_agent_input,
690
+ handler: mDM_send_as_agent
691
+ },
692
+ {
693
+ name: "mDM_list_my_agents",
694
+ requires: "network",
695
+ 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.",
696
+ inputSchema: mDM_list_my_agents_input,
697
+ handler: mDM_list_my_agents
698
+ }
699
+ ];
700
+
701
+ // src/tools/mdm-voice.ts
702
+ import { z as z3 } from "zod";
660
703
  var PROTOCOL_VERSION2 = "mosadd.chat.v1";
661
- var ContactRef2 = z2.string().min(1).describe("Recipient identity id (UUID). Use mDM_list_contacts to find it.");
662
- var RoomId = z2.string().min(1).describe("Voice room id (from mDM_call_start's call_invite).");
663
- var mDM_call_start_input = z2.object({
704
+ var ContactRef2 = z3.string().min(1).describe("Recipient identity id (UUID). Use mDM_list_contacts to find it.");
705
+ var RoomId = z3.string().min(1).describe("Voice room id (from mDM_call_start's call_invite).");
706
+ var mDM_call_start_input = z3.object({
664
707
  to: ContactRef2,
665
- video: z2.boolean().optional().describe("Request a video call instead of audio-only. Default false."),
666
- thread_label: z2.string().max(120).regex(/^[a-zA-Z0-9._-]+$/).optional().describe("Optional thread label to place the call invite in. Defaults to the contact's main thread.")
708
+ video: z3.boolean().optional().describe("Request a video call instead of audio-only. Default false."),
709
+ thread_label: z3.string().max(120).regex(/^[a-zA-Z0-9._-]+$/).optional().describe("Optional thread label to place the call invite in. Defaults to the contact's main thread.")
667
710
  });
668
- var mDM_call_answer_input = z2.object({ room_id: RoomId });
669
- var mDM_call_end_input = z2.object({
711
+ var mDM_call_answer_input = z3.object({ room_id: RoomId });
712
+ var mDM_call_end_input = z3.object({
670
713
  room_id: RoomId,
671
714
  to: ContactRef2.optional().describe("If set, also drop a call_end control message in this contact's DM thread."),
672
- thread_label: z2.string().max(120).regex(/^[a-zA-Z0-9._-]+$/).optional()
715
+ thread_label: z3.string().max(120).regex(/^[a-zA-Z0-9._-]+$/).optional()
673
716
  });
674
- var mDM_voice_note_input = z2.object({
717
+ var mDM_voice_note_input = z3.object({
675
718
  to: ContactRef2,
676
- audio_url: z2.string().url().describe("URL of the recorded audio clip (already uploaded by the client)."),
677
- duration_ms: z2.number().int().positive().optional().describe("Clip length in milliseconds, if known."),
678
- mime: z2.string().max(120).optional().describe("Audio MIME type, e.g. audio/ogg, audio/mpeg. Default audio/ogg."),
679
- thread_label: z2.string().max(120).regex(/^[a-zA-Z0-9._-]+$/).optional()
719
+ audio_url: z3.string().url().describe("URL of the recorded audio clip (already uploaded by the client)."),
720
+ duration_ms: z3.number().int().positive().optional().describe("Clip length in milliseconds, if known."),
721
+ mime: z3.string().max(120).optional().describe("Audio MIME type, e.g. audio/ogg, audio/mpeg. Default audio/ogg."),
722
+ thread_label: z3.string().max(120).regex(/^[a-zA-Z0-9._-]+$/).optional()
680
723
  });
681
724
  function dmThreadId2(selfId, otherId, label) {
682
725
  const [a, b] = [selfId, otherId].sort();
@@ -779,58 +822,58 @@ var mdmVoiceTools = [
779
822
  ];
780
823
 
781
824
  // src/tools/mirc.ts
782
- import { z as z3 } from "zod";
783
- var ChannelId = z3.string().min(1).max(120).describe("Channel id (UUID). Use mIRC_list to discover available channels.");
784
- var AccessMode = z3.enum(["open", "password", "private"]).describe("open: anyone can join \xB7 password: join with a shared password \xB7 private: invite-only.");
785
- var Capabilities = z3.object({
786
- txt: z3.boolean().default(true),
787
- voice: z3.boolean().default(false),
788
- files: z3.boolean().default(false),
789
- ptt: z3.boolean().default(false),
790
- live: z3.boolean().default(false)
825
+ import { z as z4 } from "zod";
826
+ var ChannelId = z4.string().min(1).max(120).describe("Channel id (UUID). Use mIRC_list to discover available channels.");
827
+ var AccessMode = z4.enum(["open", "password", "private"]).describe("open: anyone can join \xB7 password: join with a shared password \xB7 private: invite-only.");
828
+ var Capabilities = z4.object({
829
+ txt: z4.boolean().default(true),
830
+ voice: z4.boolean().default(false),
831
+ files: z4.boolean().default(false),
832
+ ptt: z4.boolean().default(false),
833
+ live: z4.boolean().default(false)
791
834
  }).describe("Which modes are enabled: txt (text), voice (group voice), files (file attach), ptt (push-to-talk), live (live stream). Voice/PTT/live are server-relayed via LiveKit \u2014 NOT end-to-end encrypted.").optional();
792
- var mIRC_create_input = z3.object({
793
- name: z3.string().min(1).max(80).describe("Channel display name."),
794
- topic: z3.string().max(500).optional().describe("Optional channel topic/description."),
835
+ var mIRC_create_input = z4.object({
836
+ name: z4.string().min(1).max(80).describe("Channel display name."),
837
+ topic: z4.string().max(500).optional().describe("Optional channel topic/description."),
795
838
  access_mode: AccessMode.default("open"),
796
- password: z3.string().min(6).max(120).optional().describe("Password (only for access_mode=password)."),
839
+ password: z4.string().min(6).max(120).optional().describe("Password (only for access_mode=password)."),
797
840
  capabilities: Capabilities,
798
- discoverable: z3.boolean().optional().describe("List this channel in the PUBLIC directory (mIRC_discover). Honoured ONLY for access_mode=open; ignored for password/private."),
799
- wrapped_group_key: z3.string().optional().describe(
841
+ discoverable: z4.boolean().optional().describe("List this channel in the PUBLIC directory (mIRC_discover). Honoured ONLY for access_mode=open; ignored for password/private."),
842
+ wrapped_group_key: z4.string().optional().describe(
800
843
  "Required for access_mode=password|private (these channels are provisioned for group-key text encryption on supported clients): the channel's group key wrapped to the creator's identity key. Open channels ignore it. If omitted on a non-open channel the backend rejects the call with a 'wrapped_group_key required' error."
801
844
  )
802
845
  });
803
- var mIRC_list_input = z3.object({
804
- limit: z3.number().int().min(1).max(500).default(100).optional(),
805
- offset: z3.number().int().min(0).default(0).optional()
846
+ var mIRC_list_input = z4.object({
847
+ limit: z4.number().int().min(1).max(500).default(100).optional(),
848
+ offset: z4.number().int().min(0).default(0).optional()
806
849
  // NOTE: an access_mode filter was removed — channel-manage's list branch doesn't
807
850
  // filter by it (it was a silent no-op). Filter client-side on the returned
808
851
  // access_mode field. Server-side filtering is tracked in the consistency ticket.
809
852
  });
810
- var mIRC_get_input = z3.object({
853
+ var mIRC_get_input = z4.object({
811
854
  channel_id: ChannelId
812
855
  });
813
- var mIRC_update_input = z3.object({
856
+ var mIRC_update_input = z4.object({
814
857
  channel_id: ChannelId,
815
- name: z3.string().min(1).max(80).optional(),
816
- topic: z3.string().max(500).optional(),
858
+ name: z4.string().min(1).max(80).optional(),
859
+ topic: z4.string().max(500).optional(),
817
860
  // NOTE: access_mode was removed — channel-manage's update branch ignores it, and
818
861
  // switching an existing channel to/from an E2EE (password/private) mode needs
819
862
  // group-key handling that isn't wired yet. Recreate the channel to change mode.
820
863
  capabilities: Capabilities,
821
- discoverable: z3.boolean().optional().describe("Toggle public-directory listing (open channels only).")
864
+ discoverable: z4.boolean().optional().describe("Toggle public-directory listing (open channels only).")
822
865
  });
823
- var mIRC_discover_input = z3.object({
824
- q: z3.string().max(100).optional().describe("Optional channel-name filter."),
825
- limit: z3.number().int().min(1).max(500).default(50).optional(),
826
- offset: z3.number().int().min(0).default(0).optional()
866
+ var mIRC_discover_input = z4.object({
867
+ q: z4.string().max(100).optional().describe("Optional channel-name filter."),
868
+ limit: z4.number().int().min(1).max(500).default(50).optional(),
869
+ offset: z4.number().int().min(0).default(0).optional()
827
870
  });
828
- var mIRC_report_input = z3.object({
871
+ var mIRC_report_input = z4.object({
829
872
  channel_id: ChannelId,
830
- reason: z3.enum(["spam", "abuse", "harassment", "illegal", "other"]).describe("Report reason."),
831
- detail: z3.string().max(1e3).optional().describe("Optional free-text context.")
873
+ reason: z4.enum(["spam", "abuse", "harassment", "illegal", "other"]).describe("Report reason."),
874
+ detail: z4.string().max(1e3).optional().describe("Optional free-text context.")
832
875
  });
833
- var mIRC_delete_input = z3.object({
876
+ var mIRC_delete_input = z4.object({
834
877
  channel_id: ChannelId
835
878
  });
836
879
  async function mIRC_create(input, ctx) {
@@ -948,37 +991,37 @@ var mircTools = [
948
991
  ];
949
992
 
950
993
  // src/tools/mirc-members.ts
951
- import { z as z4 } from "zod";
952
- var ChannelId2 = z4.string().min(1).max(120).describe("Channel id (UUID). From mIRC_list / mIRC_create.");
953
- var MemberIdentity = z4.string().min(1).describe("Target user's identity id (UUID). From mDM_list_contacts or radar logs.");
954
- var Role = z4.enum(["superadmin", "admin", "moderator", "member"]).describe("Role to assign. owner = channel creator (not assignable); promote up to one tier below your own.");
955
- var mIRC_join_input = z4.object({
994
+ import { z as z5 } from "zod";
995
+ var ChannelId2 = z5.string().min(1).max(120).describe("Channel id (UUID). From mIRC_list / mIRC_create.");
996
+ var MemberIdentity = z5.string().min(1).describe("Target user's identity id (UUID). From mDM_list_contacts or radar logs.");
997
+ var Role = z5.enum(["superadmin", "admin", "moderator", "member"]).describe("Role to assign. owner = channel creator (not assignable); promote up to one tier below your own.");
998
+ var mIRC_join_input = z5.object({
956
999
  channel_id: ChannelId2,
957
- password: z4.string().min(1).optional().describe("Pass only for access_mode=password channels. Private channels cannot be joined directly (403) \u2014 use mIRC_request_access.")
1000
+ password: z5.string().min(1).optional().describe("Pass only for access_mode=password channels. Private channels cannot be joined directly (403) \u2014 use mIRC_request_access.")
958
1001
  });
959
- var mIRC_request_access_input = z4.object({
1002
+ var mIRC_request_access_input = z5.object({
960
1003
  channel_id: ChannelId2
961
1004
  });
962
- var mIRC_leave_input = z4.object({
1005
+ var mIRC_leave_input = z5.object({
963
1006
  channel_id: ChannelId2
964
1007
  });
965
- var mIRC_reject_request_input = z4.object({
1008
+ var mIRC_reject_request_input = z5.object({
966
1009
  channel_id: ChannelId2,
967
- identity_id: z4.string().min(1).describe("Identity id of the requester to reject (state=requested; from mIRC_list members).")
1010
+ identity_id: z5.string().min(1).describe("Identity id of the requester to reject (state=requested; from mIRC_list members).")
968
1011
  });
969
1012
  var mIRC_approve_request_input = mIRC_reject_request_input.extend({
970
- wrapped_group_key: z4.string().optional().describe(
1013
+ wrapped_group_key: z5.string().optional().describe(
971
1014
  "Required to approve a join to a password/private (group-key) channel: the channel group key wrapped to the approved member's identity key. Without it the backend rejects the approval with a 'wrapped_group_key required' error. (Access requests only exist on non-open channels, so this is effectively always required.)"
972
1015
  )
973
1016
  });
974
- var mIRC_kick_input = z4.object({
1017
+ var mIRC_kick_input = z5.object({
975
1018
  channel_id: ChannelId2,
976
1019
  identity_id: MemberIdentity
977
1020
  // NOTE: a `reason` field used to be advertised here but channel-members-manage
978
1021
  // never persists it (no audit row on kick) — removed until the backend logs it
979
1022
  // (see consistency ticket) so the tool doesn't claim an audit trail it can't deliver.
980
1023
  });
981
- var mIRC_ban_input = z4.object({
1024
+ var mIRC_ban_input = z5.object({
982
1025
  channel_id: ChannelId2,
983
1026
  identity_id: MemberIdentity
984
1027
  // NOTE: `reason` (no storage) and `until` (timed ban) were removed — the EF ban
@@ -986,19 +1029,19 @@ var mIRC_ban_input = z4.object({
986
1029
  // asked for a temporary one. Ban is permanent-until-unban; enforced temp-bans +
987
1030
  // ban audit are tracked in the consistency ticket.
988
1031
  });
989
- var mIRC_unban_input = z4.object({
1032
+ var mIRC_unban_input = z5.object({
990
1033
  channel_id: ChannelId2,
991
1034
  identity_id: MemberIdentity
992
1035
  });
993
- var mIRC_set_role_input = z4.object({
1036
+ var mIRC_set_role_input = z5.object({
994
1037
  channel_id: ChannelId2,
995
1038
  identity_id: MemberIdentity,
996
1039
  role: Role
997
1040
  });
998
- var mIRC_set_ptt_input = z4.object({
1041
+ var mIRC_set_ptt_input = z5.object({
999
1042
  channel_id: ChannelId2,
1000
1043
  identity_id: MemberIdentity,
1001
- ptt_enabled: z4.boolean().describe("Allow this member to hold the PTT floor in voice mode.")
1044
+ ptt_enabled: z5.boolean().describe("Allow this member to hold the PTT floor in voice mode.")
1002
1045
  });
1003
1046
  async function invokeChannelMembers(action, body, ctx) {
1004
1047
  const b = { ...body };
@@ -1092,20 +1135,20 @@ var mircMembersTools = [
1092
1135
  ];
1093
1136
 
1094
1137
  // src/tools/mirc-messages.ts
1095
- import { z as z5 } from "zod";
1138
+ import { z as z6 } from "zod";
1096
1139
  var PROTOCOL_VERSION3 = "mosadd.chat.v1";
1097
- var ChannelId3 = z5.string().min(1).max(120).describe("Channel id (UUID). From mIRC_create / mIRC_list.");
1098
- var mIRC_post_message_input = z5.object({
1140
+ var ChannelId3 = z6.string().min(1).max(120).describe("Channel id (UUID). From mIRC_create / mIRC_list.");
1141
+ var mIRC_post_message_input = z6.object({
1099
1142
  channel_id: ChannelId3,
1100
- text: z5.string().min(1).max(64e3).describe("Message body (UTF-8). Max 64 KB."),
1101
- reply_to_id: z5.string().optional().describe("Optional id of the message being replied to."),
1102
- space_id: z5.string().optional().describe("Optional backing space id. Resolved automatically from the channel if omitted.")
1143
+ text: z6.string().min(1).max(64e3).describe("Message body (UTF-8). Max 64 KB."),
1144
+ reply_to_id: z6.string().optional().describe("Optional id of the message being replied to."),
1145
+ space_id: z6.string().optional().describe("Optional backing space id. Resolved automatically from the channel if omitted.")
1103
1146
  });
1104
- var mIRC_list_messages_input = z5.object({
1147
+ var mIRC_list_messages_input = z6.object({
1105
1148
  channel_id: ChannelId3,
1106
- limit: z5.number().int().min(1).max(200).default(50).optional(),
1107
- cursor: z5.string().optional().describe("Opaque pagination cursor from a prior list response."),
1108
- space_id: z5.string().optional().describe("Optional backing space id. Resolved automatically if omitted.")
1149
+ limit: z6.number().int().min(1).max(200).default(50).optional(),
1150
+ cursor: z6.string().optional().describe("Opaque pagination cursor from a prior list response."),
1151
+ space_id: z6.string().optional().describe("Optional backing space id. Resolved automatically if omitted.")
1109
1152
  });
1110
1153
  function packPlaintextPayload2(text, replyToId) {
1111
1154
  const envelope = {
@@ -1190,7 +1233,7 @@ var mircMessagesTools = [
1190
1233
  ];
1191
1234
 
1192
1235
  // src/tools/mirc-edge.ts
1193
- import { z as z6 } from "zod";
1236
+ import { z as z7 } from "zod";
1194
1237
  var DEFAULT_EDGE_URL = "https://mosadd-edge.mr-brics-33.workers.dev";
1195
1238
  var DEFAULT_SUPABASE_URL = "https://rooffhgbxafyjcwmwpsy.supabase.co";
1196
1239
  function edgeUrl() {
@@ -1204,10 +1247,10 @@ function hubKey() {
1204
1247
  if (!key) throw new Error("MOSADD_API_KEY required for mIRC edge tools (see mosadd login or hub-keys).");
1205
1248
  return key;
1206
1249
  }
1207
- var mIRC_send_edge_input = z6.object({
1208
- channel_id: z6.string().min(1).max(128).describe("Channel id (UUID). Same as mIRC_create / mIRC_list."),
1209
- text: z6.string().min(1).max(64e3).describe("Message body (UTF-8, max 64 KB)."),
1210
- from: z6.string().max(120).optional().describe("Sender hint shown to other clients (defaults to the hub-key owner).")
1250
+ var mIRC_send_edge_input = z7.object({
1251
+ channel_id: z7.string().min(1).max(128).describe("Channel id (UUID). Same as mIRC_create / mIRC_list."),
1252
+ text: z7.string().min(1).max(64e3).describe("Message body (UTF-8, max 64 KB)."),
1253
+ from: z7.string().max(120).optional().describe("Sender hint shown to other clients (defaults to the hub-key owner).")
1211
1254
  });
1212
1255
  async function mIRC_send_edge(input, ctx) {
1213
1256
  ctx.log("debug", "mIRC_send_edge", { channel_id: input.channel_id });
@@ -1227,9 +1270,9 @@ async function mIRC_send_edge(input, ctx) {
1227
1270
  if (!data?.id) throw new Error("mosadd-edge: send returned no id");
1228
1271
  return { message_id: data.id, delivered_at: data.ts ?? Date.now(), channel_id: input.channel_id };
1229
1272
  }
1230
- var mIRC_history_edge_input = z6.object({
1231
- channel_id: z6.string().min(1).max(128).describe("Channel id (UUID)."),
1232
- limit: z6.number().int().min(1).max(100).default(50).optional().describe("How many recent messages to return (max 100, the DO ring size).")
1273
+ var mIRC_history_edge_input = z7.object({
1274
+ channel_id: z7.string().min(1).max(128).describe("Channel id (UUID)."),
1275
+ limit: z7.number().int().min(1).max(100).default(50).optional().describe("How many recent messages to return (max 100, the DO ring size).")
1233
1276
  });
1234
1277
  async function mIRC_history_edge(input, ctx) {
1235
1278
  const limit = input.limit ?? 50;
@@ -1252,9 +1295,9 @@ async function mIRC_history_edge(input, ctx) {
1252
1295
  }))
1253
1296
  };
1254
1297
  }
1255
- var mIRC_mint_channel_token_input = z6.object({
1256
- channel_id: z6.string().min(1).max(128).describe("Channel id \u2014 the JWT will be scoped to this channel only. Must match the WS upgrade path."),
1257
- user_id: z6.string().min(1).max(120).optional().describe("Optional end-user id. Stamped onto messages as 'from'. Useful when one hub key fronts many end-users (relay topology).")
1298
+ var mIRC_mint_channel_token_input = z7.object({
1299
+ channel_id: z7.string().min(1).max(128).describe("Channel id \u2014 the JWT will be scoped to this channel only. Must match the WS upgrade path."),
1300
+ user_id: z7.string().min(1).max(120).optional().describe("Optional end-user id. Stamped onto messages as 'from'. Useful when one hub key fronts many end-users (relay topology).")
1258
1301
  });
1259
1302
  async function mIRC_mint_channel_token(input, ctx) {
1260
1303
  ctx.log("debug", "mIRC_mint_channel_token", { channel_id: input.channel_id });
@@ -1301,57 +1344,57 @@ var mircEdgeTools = [
1301
1344
  ];
1302
1345
 
1303
1346
  // src/tools/mail.ts
1304
- import { z as z7 } from "zod";
1305
- var EmailAddress = z7.string().email().max(254).describe("RFC 5321 email address.");
1306
- var MessageId = z7.string().min(1).describe("Message id (UUID) from mAYL_send or inbox.");
1307
- var mp0st_send_input = z7.object({
1308
- to: z7.union([EmailAddress, z7.array(EmailAddress).min(1).max(50)]).describe(
1347
+ import { z as z8 } from "zod";
1348
+ var EmailAddress = z8.string().email().max(254).describe("RFC 5321 email address.");
1349
+ var MessageId = z8.string().min(1).describe("Message id (UUID) from mAYL_send or inbox.");
1350
+ var mp0st_send_input = z8.object({
1351
+ to: z8.union([EmailAddress, z8.array(EmailAddress).min(1).max(50)]).describe(
1309
1352
  "Recipient(s). Single address or array of up to 50."
1310
1353
  ),
1311
- subject: z7.string().min(1).max(998).describe("Email subject line. Max 998 chars (RFC 5322)."),
1312
- body_text: z7.string().max(1048576).optional().describe("Plain text body. Max 1 MB."),
1313
- body_html: z7.string().max(1048576).optional().describe("HTML body. Max 1 MB."),
1314
- cc: z7.array(EmailAddress).max(50).optional(),
1315
- bcc: z7.array(EmailAddress).max(50).optional(),
1354
+ subject: z8.string().min(1).max(998).describe("Email subject line. Max 998 chars (RFC 5322)."),
1355
+ body_text: z8.string().max(1048576).optional().describe("Plain text body. Max 1 MB."),
1356
+ body_html: z8.string().max(1048576).optional().describe("HTML body. Max 1 MB."),
1357
+ cc: z8.array(EmailAddress).max(50).optional(),
1358
+ bcc: z8.array(EmailAddress).max(50).optional(),
1316
1359
  reply_to: EmailAddress.optional(),
1317
- tracking: z7.boolean().optional().describe("Open-pixel + link-click tracking. Default true. Set false to send with NO tracking (privacy / GDPR-friendly)."),
1318
- 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."),
1319
- 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."),
1320
- 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."),
1321
- auto_destruct: z7.enum(["1h", "24h", "7d"]).optional().describe("Self-destruct timer: the secure-reader link expires after this window.")
1360
+ tracking: z8.boolean().optional().describe("Open-pixel + link-click tracking. Default true. Set false to send with NO tracking (privacy / GDPR-friendly)."),
1361
+ force_reader: z8.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."),
1362
+ disclose_tracking: z8.boolean().optional().describe("Default false. If true (and tracking on), append a tracking-disclosure footer to the email \u2014 recommended for GDPR/ePrivacy compliance."),
1363
+ watermark: z8.union([z8.boolean(), z8.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."),
1364
+ auto_destruct: z8.enum(["1h", "24h", "7d"]).optional().describe("Self-destruct timer: the secure-reader link expires after this window.")
1322
1365
  });
1323
- var mp0st_view_input = z7.object({
1366
+ var mp0st_view_input = z8.object({
1324
1367
  message_id: MessageId
1325
1368
  });
1326
- var mp0st_delete_input = z7.object({
1369
+ var mp0st_delete_input = z8.object({
1327
1370
  message_id: MessageId
1328
1371
  });
1329
- var mp0st_list_input = z7.object({
1330
- direction: z7.enum(["inbound", "outbound"]).optional().describe("Filter to received (inbound) or sent (outbound) mail. Omit for both."),
1331
- limit: z7.number().int().min(1).max(200).optional().describe("Max emails to return. Default 50."),
1332
- before: z7.string().optional().describe("Pagination cursor: pass the previous response's next_cursor to get the next (older) page.")
1372
+ var mp0st_list_input = z8.object({
1373
+ direction: z8.enum(["inbound", "outbound"]).optional().describe("Filter to received (inbound) or sent (outbound) mail. Omit for both."),
1374
+ limit: z8.number().int().min(1).max(200).optional().describe("Max emails to return. Default 50."),
1375
+ before: z8.string().optional().describe("Pagination cursor: pass the previous response's next_cursor to get the next (older) page.")
1333
1376
  });
1334
- var mp0st_stats_input = z7.object({
1377
+ var mp0st_stats_input = z8.object({
1335
1378
  message_id: MessageId
1336
1379
  });
1337
- var mp0st_events_input = z7.object({
1380
+ var mp0st_events_input = z8.object({
1338
1381
  message_id: MessageId
1339
1382
  });
1340
- var mp0st_metrics_input = z7.object({});
1341
- var mp0st_revoke_input = z7.object({
1383
+ var mp0st_metrics_input = z8.object({});
1384
+ var mp0st_revoke_input = z8.object({
1342
1385
  message_id: MessageId,
1343
- restore: z7.boolean().optional().describe("Set true to UN-revoke (restore access). Default false = revoke.")
1386
+ restore: z8.boolean().optional().describe("Set true to UN-revoke (restore access). Default false = revoke.")
1344
1387
  });
1345
- var mp0st_audit_export_input = z7.object({
1388
+ var mp0st_audit_export_input = z8.object({
1346
1389
  message_id: MessageId
1347
1390
  });
1348
- var mp0st_consent_input = z7.object({
1349
- 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."),
1391
+ var mp0st_consent_input = z8.object({
1392
+ action: z8.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."),
1350
1393
  recipient: EmailAddress.optional().describe("Required for 'check' and 'optin'.")
1351
1394
  });
1352
- var mp0st_notify_input = z7.object({
1353
- 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."),
1354
- limit: z7.number().int().min(1).max(200).optional().describe("Max events. Default 50.")
1395
+ var mp0st_notify_input = z8.object({
1396
+ since: z8.string().optional().describe("ISO-8601 cursor \u2014 return only events newer than this. Pass the previous response's `cursor` to poll for new activity."),
1397
+ limit: z8.number().int().min(1).max(200).optional().describe("Max events. Default 50.")
1355
1398
  });
1356
1399
  async function mp0st_send(input, ctx) {
1357
1400
  readSupabaseEnv();
@@ -1508,7 +1551,7 @@ var mailTools = [
1508
1551
  ];
1509
1552
 
1510
1553
  // src/tools/mail-provenance.ts
1511
- import { z as z8 } from "zod";
1554
+ import { z as z9 } from "zod";
1512
1555
  var DEFAULT_SUPABASE_URL2 = "https://rooffhgbxafyjcwmwpsy.supabase.co";
1513
1556
  function supabaseUrl2() {
1514
1557
  return process.env.MOSADD_SUPABASE_URL?.replace(/\/$/, "") ?? process.env.SUPABASE_URL?.replace(/\/$/, "") ?? DEFAULT_SUPABASE_URL2;
@@ -1516,18 +1559,18 @@ function supabaseUrl2() {
1516
1559
  function hubKey2() {
1517
1560
  return process.env.MOSADD_API_KEY ?? process.env.MOSADD_HUB_KEY ?? null;
1518
1561
  }
1519
- var EmailAddress2 = z8.string().email().max(254);
1520
- var mp0st_send_as_agent_input = z8.object({
1521
- to: z8.union([EmailAddress2, z8.array(EmailAddress2).min(1).max(50)]),
1522
- subject: z8.string().min(1).max(998),
1523
- body_text: z8.string().max(1048576).optional(),
1524
- body_html: z8.string().max(1048576).optional(),
1525
- cc: z8.array(EmailAddress2).max(50).optional(),
1526
- bcc: z8.array(EmailAddress2).max(50).optional(),
1562
+ var EmailAddress2 = z9.string().email().max(254);
1563
+ var mp0st_send_as_agent_input = z9.object({
1564
+ to: z9.union([EmailAddress2, z9.array(EmailAddress2).min(1).max(50)]),
1565
+ subject: z9.string().min(1).max(998),
1566
+ body_text: z9.string().max(1048576).optional(),
1567
+ body_html: z9.string().max(1048576).optional(),
1568
+ cc: z9.array(EmailAddress2).max(50).optional(),
1569
+ bcc: z9.array(EmailAddress2).max(50).optional(),
1527
1570
  reply_to: EmailAddress2.optional(),
1528
- tracking: z8.boolean().optional(),
1529
- 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."),
1530
- 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.")
1571
+ tracking: z9.boolean().optional(),
1572
+ agent_id: z9.string().min(1).max(120).describe("Stable id of the agent doing the send. Stamped as sent_by_agent_id for provenance."),
1573
+ task_id: z9.string().min(1).max(120).optional().describe("Optional id of the task/run this send belongs to. Stamped as sent_by_task_id.")
1531
1574
  });
1532
1575
  async function mintHubClaim(agentId, taskId) {
1533
1576
  const key = hubKey2();
@@ -1583,19 +1626,19 @@ var mailProvenanceTools = [
1583
1626
  ];
1584
1627
 
1585
1628
  // src/tools/mail-agentbox.ts
1586
- import { z as z9 } from "zod";
1587
- var BoxId = z9.string().min(1).describe("Agent-box id (UUID) from mAYL_agentbox_provision or mAYL_agentbox_list.");
1588
- var agentbox_provision_input = z9.object({
1589
- display_name: z9.string().max(120).optional().describe("Optional human label for the box (e.g. 'signup catcher'). Max 120 chars."),
1590
- agent_id: z9.string().optional().describe("Optional identity id to attribute the box to \u2014 must be an agent identity you own."),
1591
- kind: z9.enum(["ephemeral", "persistent"]).optional().describe("'ephemeral' (default) auto-expires + is reaped; 'persistent' never expires."),
1592
- ttl_seconds: z9.number().int().positive().max(86400).optional().describe("Lifetime for an ephemeral box, in seconds. Default 600 (10 min). Max 86400 (24 h). Ignored for persistent.")
1593
- });
1594
- var agentbox_list_input = z9.object({});
1595
- var agentbox_release_input = z9.object({ id: BoxId });
1596
- var agentbox_extend_input = z9.object({
1629
+ import { z as z10 } from "zod";
1630
+ var BoxId = z10.string().min(1).describe("Agent-box id (UUID) from mAYL_agentbox_provision or mAYL_agentbox_list.");
1631
+ var agentbox_provision_input = z10.object({
1632
+ display_name: z10.string().max(120).optional().describe("Optional human label for the box (e.g. 'signup catcher'). Max 120 chars."),
1633
+ agent_id: z10.string().optional().describe("Optional identity id to attribute the box to \u2014 must be an agent identity you own."),
1634
+ kind: z10.enum(["ephemeral", "persistent"]).optional().describe("'ephemeral' (default) auto-expires + is reaped; 'persistent' never expires."),
1635
+ ttl_seconds: z10.number().int().positive().max(86400).optional().describe("Lifetime for an ephemeral box, in seconds. Default 600 (10 min). Max 86400 (24 h). Ignored for persistent.")
1636
+ });
1637
+ var agentbox_list_input = z10.object({});
1638
+ var agentbox_release_input = z10.object({ id: BoxId });
1639
+ var agentbox_extend_input = z10.object({
1597
1640
  id: BoxId,
1598
- ttl_seconds: z9.number().int().positive().max(86400).optional().describe("New lifetime from NOW, in seconds. Default 600 (10 min). Max 86400 (24 h). Ephemeral boxes only.")
1641
+ ttl_seconds: z10.number().int().positive().max(86400).optional().describe("New lifetime from NOW, in seconds. Default 600 (10 min). Max 86400 (24 h). Ephemeral boxes only.")
1599
1642
  });
1600
1643
  async function agentbox_provision(input, ctx) {
1601
1644
  readSupabaseEnv();
@@ -1659,16 +1702,16 @@ var mailAgentboxTools = [
1659
1702
  ];
1660
1703
 
1661
1704
  // src/tools/mtalk.ts
1662
- import { z as z10 } from "zod";
1663
- var RoomLabel = z10.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.");
1664
- var RoomId2 = z10.string().min(1).describe("Room id returned by mTALK_open.");
1665
- var mTALK_open_input = z10.object({
1705
+ import { z as z11 } from "zod";
1706
+ 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.");
1707
+ var RoomId2 = z11.string().min(1).describe("Room id returned by mTALK_open.");
1708
+ var mTALK_open_input = z11.object({
1666
1709
  label: RoomLabel.optional().describe("Optional label; defaults to a personal room.")
1667
1710
  });
1668
- var mTALK_join_input = z10.object({ room_id: RoomId2 });
1669
- var mTALK_press_input = z10.object({ room_id: RoomId2 });
1670
- var mTALK_release_input = z10.object({ room_id: RoomId2 });
1671
- var mTALK_state_input = z10.object({ room_id: RoomId2 });
1711
+ var mTALK_join_input = z11.object({ room_id: RoomId2 });
1712
+ var mTALK_press_input = z11.object({ room_id: RoomId2 });
1713
+ var mTALK_release_input = z11.object({ room_id: RoomId2 });
1714
+ var mTALK_state_input = z11.object({ room_id: RoomId2 });
1672
1715
  async function mTALK_open(input, ctx) {
1673
1716
  const { roomId } = await ctx.providers.voice.createRoom(input.label);
1674
1717
  ctx.log("debug", "mTALK_open", { room_id: roomId });
@@ -1732,7 +1775,7 @@ var mtalkTools = [
1732
1775
  ];
1733
1776
 
1734
1777
  // src/tools/attachments.ts
1735
- import { z as z11 } from "zod";
1778
+ import { z as z12 } from "zod";
1736
1779
 
1737
1780
  // src/providers/blob-upload.ts
1738
1781
  function defaultBucket(kind) {
@@ -1782,14 +1825,14 @@ function decodeBase64Body(b64) {
1782
1825
 
1783
1826
  // src/tools/attachments.ts
1784
1827
  var PROTOCOL_VERSION4 = "mosadd.chat.v1";
1785
- var Base64Body = z11.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.");
1786
- var Mime = z11.string().min(1).max(120).describe("MIME type, e.g. audio/ogg, application/pdf, image/png.");
1787
- var DurationMs = z11.number().int().positive().optional().describe("Audio clip length in ms (voice only), if known.");
1788
- var Filename = z11.string().min(1).max(255).optional().describe("Original filename (file only).");
1789
- var ReplyTo = z11.string().optional().describe("Optional id of the message being replied to.");
1790
- var ContactRef3 = z11.string().min(1).describe("Recipient identity id (UUID). Use mDM_list_contacts to find it.");
1791
- var RoomId3 = z11.string().min(1).describe("Room/channel id (UUID).");
1792
- var ThreadLabel = z11.string().max(120).regex(/^[a-zA-Z0-9._-]+$/).optional().describe("Optional thread label within the conversation (mDM USP: multiple threads per contact).");
1828
+ 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.");
1829
+ var Mime = z12.string().min(1).max(120).describe("MIME type, e.g. audio/ogg, application/pdf, image/png.");
1830
+ var DurationMs = z12.number().int().positive().optional().describe("Audio clip length in ms (voice only), if known.");
1831
+ var Filename = z12.string().min(1).max(255).optional().describe("Original filename (file only).");
1832
+ var ReplyTo = z12.string().optional().describe("Optional id of the message being replied to.");
1833
+ var ContactRef3 = z12.string().min(1).describe("Recipient identity id (UUID). Use mDM_list_contacts to find it.");
1834
+ var RoomId3 = z12.string().min(1).describe("Room/channel id (UUID).");
1835
+ 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).");
1793
1836
  function dmThreadId3(selfId, otherId, label) {
1794
1837
  const [a, b] = [selfId, otherId].sort();
1795
1838
  return label ? `dm:${a}:${b}:${label}` : `dm:${a}:${b}`;
@@ -1832,21 +1875,21 @@ async function resolveLinkedSpaceId2(channelId) {
1832
1875
  if (!spaceId) throw new Error(`Channel ${channelId} has no linked space yet \u2014 run mIRC_join/mIRC_list first or pass space_id.`);
1833
1876
  return spaceId;
1834
1877
  }
1835
- var mDM_send_voice_input = z11.object({
1878
+ var mDM_send_voice_input = z12.object({
1836
1879
  to: ContactRef3,
1837
1880
  audio_base64: Base64Body,
1838
1881
  mime: Mime.default("audio/ogg"),
1839
1882
  duration_ms: DurationMs,
1840
- caption: z11.string().max(2e3).optional(),
1883
+ caption: z12.string().max(2e3).optional(),
1841
1884
  thread_label: ThreadLabel,
1842
1885
  reply_to_id: ReplyTo
1843
1886
  });
1844
- var mDM_send_file_input = z11.object({
1887
+ var mDM_send_file_input = z12.object({
1845
1888
  to: ContactRef3,
1846
1889
  file_base64: Base64Body,
1847
1890
  filename: Filename,
1848
1891
  mime: Mime,
1849
- caption: z11.string().max(2e3).optional(),
1892
+ caption: z12.string().max(2e3).optional(),
1850
1893
  thread_label: ThreadLabel,
1851
1894
  reply_to_id: ReplyTo
1852
1895
  });
@@ -1892,23 +1935,23 @@ async function mDM_send_file(input, ctx) {
1892
1935
  recipient_account_id: input.to
1893
1936
  });
1894
1937
  }
1895
- var mIRC_send_voice_input = z11.object({
1938
+ var mIRC_send_voice_input = z12.object({
1896
1939
  channel_id: RoomId3,
1897
1940
  audio_base64: Base64Body,
1898
1941
  mime: Mime.default("audio/ogg"),
1899
1942
  duration_ms: DurationMs,
1900
- caption: z11.string().max(2e3).optional(),
1943
+ caption: z12.string().max(2e3).optional(),
1901
1944
  reply_to_id: ReplyTo,
1902
- space_id: z11.string().optional().describe("Backing space id. Resolved automatically if omitted.")
1945
+ space_id: z12.string().optional().describe("Backing space id. Resolved automatically if omitted.")
1903
1946
  });
1904
- var mIRC_send_file_input = z11.object({
1947
+ var mIRC_send_file_input = z12.object({
1905
1948
  channel_id: RoomId3,
1906
1949
  file_base64: Base64Body,
1907
1950
  filename: Filename,
1908
1951
  mime: Mime,
1909
- caption: z11.string().max(2e3).optional(),
1952
+ caption: z12.string().max(2e3).optional(),
1910
1953
  reply_to_id: ReplyTo,
1911
- space_id: z11.string().optional()
1954
+ space_id: z12.string().optional()
1912
1955
  });
1913
1956
  async function mIRC_send_voice(input, ctx) {
1914
1957
  const space_id = input.space_id ?? await resolveLinkedSpaceId2(input.channel_id);
@@ -1954,13 +1997,13 @@ var attachmentTools = [
1954
1997
  ];
1955
1998
 
1956
1999
  // src/tools/ptt-ingest.ts
1957
- import { z as z12 } from "zod";
1958
- var mTALK_ingest_ptt_input = z12.object({
1959
- audio_base64: z12.string().min(1).max(2e7).describe("Recorded PTT 'over' as base64 (a 'data:audio/\u2026;base64,\u2026' prefix is stripped if present)."),
1960
- mime_type: z12.string().min(1).max(120).default("audio/webm").describe("MIME type of the audio. Default audio/webm (browser MediaRecorder default)."),
1961
- direction: z12.enum(["human_to_agent", "agent_to_human"]).describe("Direction the PTT crossed: who originated, who received. 'human_to_agent' = user spoke to an agent; 'agent_to_human' = agent spoke to the user."),
1962
- message_id: z12.string().min(1).max(120).optional().describe("Optional id of the messages_meta row this PTT belongs to. When present, links the transcript back to the message for jump-to-source from RAG."),
1963
- thread_id: z12.string().min(1).max(120).optional().describe("Optional thread id (e.g. `chat:<channel_id>` or `dm:<a>:<b>`) so the transcript carries its conversational scope into RAG.")
2000
+ import { z as z13 } from "zod";
2001
+ var mTALK_ingest_ptt_input = z13.object({
2002
+ audio_base64: z13.string().min(1).max(2e7).describe("Recorded PTT 'over' as base64 (a 'data:audio/\u2026;base64,\u2026' prefix is stripped if present)."),
2003
+ mime_type: z13.string().min(1).max(120).default("audio/webm").describe("MIME type of the audio. Default audio/webm (browser MediaRecorder default)."),
2004
+ direction: z13.enum(["human_to_agent", "agent_to_human"]).describe("Direction the PTT crossed: who originated, who received. 'human_to_agent' = user spoke to an agent; 'agent_to_human' = agent spoke to the user."),
2005
+ message_id: z13.string().min(1).max(120).optional().describe("Optional id of the messages_meta row this PTT belongs to. When present, links the transcript back to the message for jump-to-source from RAG."),
2006
+ thread_id: z13.string().min(1).max(120).optional().describe("Optional thread id (e.g. `chat:<channel_id>` or `dm:<a>:<b>`) so the transcript carries its conversational scope into RAG.")
1964
2007
  });
1965
2008
  async function mTALK_ingest_ptt(input, ctx) {
1966
2009
  readSupabaseEnv();
@@ -1996,7 +2039,7 @@ var pttIngestTools = [
1996
2039
 
1997
2040
  // src/tools/knowledge.ts
1998
2041
  import { createHash } from "crypto";
1999
- import { z as z13 } from "zod";
2042
+ import { z as z14 } from "zod";
2000
2043
  var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
2001
2044
  var SOURCE_ID_NAMESPACE = "1f0b6c2e-6a4d-4f7a-9c1e-0b2d3a4f5e6b";
2002
2045
  function uuidV5(name, namespace) {
@@ -2008,13 +2051,13 @@ function uuidV5(name, namespace) {
2008
2051
  const h = b.toString("hex");
2009
2052
  return `${h.slice(0, 8)}-${h.slice(8, 12)}-${h.slice(12, 16)}-${h.slice(16, 20)}-${h.slice(20)}`;
2010
2053
  }
2011
- var mRAG_search_input = z13.object({
2012
- query: z13.string().min(1).max(2e3).describe("Natural-language question to answer from the user's own indexed messages/emails/calls/notes."),
2013
- top_k: z13.number().int().min(1).max(25).optional().describe("Max number of source chunks to retrieve and ground the answer in. Default 8."),
2014
- source_types: z13.array(z13.enum(["message", "email", "call", "note", "contact", "file", "ptt"])).optional().describe(
2054
+ var mRAG_search_input = z14.object({
2055
+ query: z14.string().min(1).max(2e3).describe("Natural-language question to answer from the user's own indexed messages/emails/calls/notes."),
2056
+ 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."),
2057
+ source_types: z14.array(z14.enum(["message", "email", "call", "note", "contact", "file", "ptt"])).optional().describe(
2015
2058
  "Restrict retrieval to these source types. Omit to search everything. 'file' covers anything added with mRAG_ingest (its default, and where 'note' ingests land); 'ptt' covers push-to-talk transcripts ingested by mTALK_ingest_ptt."
2016
2059
  ),
2017
- thread_id: z13.string().optional().describe("Optional: restrict retrieval to a single thread id (e.g. a dm:/chat: thread).")
2060
+ thread_id: z14.string().optional().describe("Optional: restrict retrieval to a single thread id (e.g. a dm:/chat: thread).")
2018
2061
  });
2019
2062
  async function mRAG_search(input, ctx) {
2020
2063
  readSupabaseEnv();
@@ -2031,19 +2074,19 @@ async function mRAG_search(input, ctx) {
2031
2074
  chunks_found: data.chunks_found ?? (data.sources?.length ?? 0)
2032
2075
  };
2033
2076
  }
2034
- var PartyArg = z13.object({
2035
- kind: z13.enum(["identity", "account", "email", "phone", "url", "unknown"]).describe("How to read `ref`: a mosadd identity UUID, an account id, an email address, a phone number, a URL, or a plain name ('unknown')."),
2036
- ref: z13.string().min(1).max(400).describe("The stable key this party is recognised by \u2014 identity UUID, email address, phone number, or the party's canonical name. Use the SAME ref for the same party across documents; that is what merges them into one node in the knowledge graph."),
2037
- label: z13.string().max(300).nullish().describe("Human name to display for this party.")
2077
+ var PartyArg = z14.object({
2078
+ kind: z14.enum(["identity", "account", "email", "phone", "url", "unknown"]).describe("How to read `ref`: a mosadd identity UUID, an account id, an email address, a phone number, a URL, or a plain name ('unknown')."),
2079
+ ref: z14.string().min(1).max(400).describe("The stable key this party is recognised by \u2014 identity UUID, email address, phone number, or the party's canonical name. Use the SAME ref for the same party across documents; that is what merges them into one node in the knowledge graph."),
2080
+ label: z14.string().max(300).nullish().describe("Human name to display for this party.")
2038
2081
  });
2039
- var mRAG_ingest_input = z13.object({
2040
- content_text: z13.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."),
2041
- source_type: z13.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."),
2042
- source_id: z13.string().max(500).optional().describe(
2082
+ var mRAG_ingest_input = z14.object({
2083
+ 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."),
2084
+ 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."),
2085
+ source_id: z14.string().max(500).optional().describe(
2043
2086
  "Optional stable id for the source so re-ingests of the SAME document group together (and can be removed later with mRAG_delete). Any string works \u2014 a file path, a case number, a checksum: a non-UUID is folded into a stable id derived from it, deterministically, and the original is kept as metadata.source_ref."
2044
2087
  ),
2045
- thread_id: z13.string().optional().describe("Optional thread id to associate this knowledge with (e.g. a dm:/chat: thread)."),
2046
- title: z13.string().max(300).optional().describe("Optional human title, stored in metadata."),
2088
+ thread_id: z14.string().optional().describe("Optional thread id to associate this knowledge with (e.g. a dm:/chat: thread)."),
2089
+ title: z14.string().max(300).optional().describe("Optional human title, stored in metadata."),
2047
2090
  // ── Graph + file-manager fields ────────────────────────────────────────────
2048
2091
  // Added 2026-08-14. The backend (rag-index → enrichRagMetadata) has accepted all of these
2049
2092
  // since 2026-07-19; THIS tool was the only ingest path that dropped them, so everything
@@ -2056,13 +2099,13 @@ var mRAG_ingest_input = z13.object({
2056
2099
  recipient: PartyArg.optional().describe(
2057
2100
  "Who the document is TO (addressee, court, counterparty). Becomes a node in the knowledge graph, connected to `sender`."
2058
2101
  ),
2059
- occurred_at: z13.string().optional().describe("ISO-8601 timestamp of WHEN the document happened (letter date, filing date, email Date header) \u2014 not when you indexed it. Drives mRAG_graph_timeline; defaults to now if omitted, which makes a 2019 filing look like it happened today."),
2060
- direction: z13.enum(["in", "out", "self"]).optional().describe("Direction relative to the account owner: received, sent, or the owner's own note."),
2061
- labels: z13.array(z13.string().max(120)).max(50).optional().describe("Free-text tags to attach (e.g. a case id, a jurisdiction) for later filtering."),
2062
- name: z13.string().max(400).optional().describe("Original filename, if this came from a file (e.g. 'pozew-2019-03-11.pdf'). Its extension is what classifies the row as a document/image/audio in the file view. Distinct from `title`, which is free prose."),
2063
- mime: z13.string().max(200).optional().describe("MIME type of the original file, if known."),
2064
- size: z13.number().int().nonnegative().optional().describe("Size of the original file in bytes, if known."),
2065
- metadata: z13.record(z13.string(), z13.unknown()).optional().describe("Any extra fields to store alongside the row (case id, docket number, jurisdiction, file path, checksum, sensitivity flag\u2026). Stored verbatim and returned with search hits. NOTE: this is stored server-side in plaintext like the content itself.")
2102
+ occurred_at: z14.string().optional().describe("ISO-8601 timestamp of WHEN the document happened (letter date, filing date, email Date header) \u2014 not when you indexed it. Drives mRAG_graph_timeline; defaults to now if omitted, which makes a 2019 filing look like it happened today."),
2103
+ direction: z14.enum(["in", "out", "self"]).optional().describe("Direction relative to the account owner: received, sent, or the owner's own note."),
2104
+ labels: z14.array(z14.string().max(120)).max(50).optional().describe("Free-text tags to attach (e.g. a case id, a jurisdiction) for later filtering."),
2105
+ name: z14.string().max(400).optional().describe("Original filename, if this came from a file (e.g. 'pozew-2019-03-11.pdf'). Its extension is what classifies the row as a document/image/audio in the file view. Distinct from `title`, which is free prose."),
2106
+ mime: z14.string().max(200).optional().describe("MIME type of the original file, if known."),
2107
+ size: z14.number().int().nonnegative().optional().describe("Size of the original file in bytes, if known."),
2108
+ metadata: z14.record(z14.string(), z14.unknown()).optional().describe("Any extra fields to store alongside the row (case id, docket number, jurisdiction, file path, checksum, sensitivity flag\u2026). Stored verbatim and returned with search hits. NOTE: this is stored server-side in plaintext like the content itself.")
2066
2109
  });
2067
2110
  async function mRAG_ingest(input, ctx) {
2068
2111
  readSupabaseEnv();
@@ -2097,15 +2140,15 @@ async function mRAG_ingest(input, ctx) {
2097
2140
  });
2098
2141
  return { indexed: data.indexed ?? 0, chunk_count: data.chunk_count ?? 0 };
2099
2142
  }
2100
- var mRAG_list_sources_input = z13.object({});
2143
+ var mRAG_list_sources_input = z14.object({});
2101
2144
  async function mRAG_list_sources(_input, ctx) {
2102
2145
  readSupabaseEnv();
2103
2146
  ctx.log("debug", "mRAG_list_sources via rag-sources");
2104
2147
  return await invokeFunction("rag-sources", { action: "list" });
2105
2148
  }
2106
- var mRAG_delete_input = z13.object({
2107
- source_id: z13.string().optional().describe("Delete every indexed chunk with this source_id (from mRAG_list_sources)."),
2108
- thread_id: z13.string().optional().describe("Delete every indexed chunk associated with this thread_id.")
2149
+ var mRAG_delete_input = z14.object({
2150
+ source_id: z14.string().optional().describe("Delete every indexed chunk with this source_id (from mRAG_list_sources)."),
2151
+ thread_id: z14.string().optional().describe("Delete every indexed chunk associated with this thread_id.")
2109
2152
  }).refine((v) => v.source_id || v.thread_id, {
2110
2153
  message: "Provide source_id or thread_id \u2014 mRAG_delete refuses to purge the whole index."
2111
2154
  });
@@ -2150,7 +2193,7 @@ var knowledgeTools = [
2150
2193
  ];
2151
2194
 
2152
2195
  // src/tools/knowledge-graph.ts
2153
- import { z as z14 } from "zod";
2196
+ import { z as z15 } from "zod";
2154
2197
  async function callRpc(fn, args, ctx) {
2155
2198
  readSupabaseEnv();
2156
2199
  ctx.log("debug", `mRAG_graph via ${fn}`, args);
@@ -2160,24 +2203,24 @@ async function callRpc(fn, args, ctx) {
2160
2203
  }
2161
2204
  return data;
2162
2205
  }
2163
- var mRAG_graph_refresh_input = z14.object({
2164
- max_docs: z14.number().int().min(1).max(2e4).optional().describe("Cap on source documents scanned when (re)building the graph. Default 20000 (the max).")
2206
+ var mRAG_graph_refresh_input = z15.object({
2207
+ max_docs: z15.number().int().min(1).max(2e4).optional().describe("Cap on source documents scanned when (re)building the graph. Default 20000 (the max).")
2165
2208
  });
2166
2209
  async function mRAG_graph_refresh(input, ctx) {
2167
2210
  return await callRpc("kg_refresh_me", { p_max_docs: input.max_docs ?? 2e4 }, ctx);
2168
2211
  }
2169
- var mRAG_graph_overview_input = z14.object({
2170
- limit: z14.number().int().min(1).max(200).optional().describe("Max parties to return (busiest first). Default 40, max 200.")
2212
+ var mRAG_graph_overview_input = z15.object({
2213
+ limit: z15.number().int().min(1).max(200).optional().describe("Max parties to return (busiest first). Default 40, max 200.")
2171
2214
  });
2172
2215
  async function mRAG_graph_overview(input, ctx) {
2173
2216
  const rows = await callRpc("kg_overview", { p_limit: input.limit ?? 40 }, ctx);
2174
2217
  const parties = rows ?? [];
2175
2218
  return { parties, count: parties.length };
2176
2219
  }
2177
- var mRAG_graph_neighbors_input = z14.object({
2178
- party_id: z14.string().uuid().describe("The party whose connections to walk (a party_id from mRAG_graph_overview)."),
2179
- depth: z14.number().int().min(1).max(2).optional().describe("Hops to walk. Hard-clamped to 2 server-side. Default 1."),
2180
- limit: z14.number().int().min(1).max(200).optional().describe("Max neighbours to return. Clamped to 200. Default 50.")
2220
+ var mRAG_graph_neighbors_input = z15.object({
2221
+ party_id: z15.string().uuid().describe("The party whose connections to walk (a party_id from mRAG_graph_overview)."),
2222
+ depth: z15.number().int().min(1).max(2).optional().describe("Hops to walk. Hard-clamped to 2 server-side. Default 1."),
2223
+ limit: z15.number().int().min(1).max(200).optional().describe("Max neighbours to return. Clamped to 200. Default 50.")
2181
2224
  });
2182
2225
  async function mRAG_graph_neighbors(input, ctx) {
2183
2226
  const rows = await callRpc(
@@ -2188,9 +2231,9 @@ async function mRAG_graph_neighbors(input, ctx) {
2188
2231
  const neighbors = rows ?? [];
2189
2232
  return { neighbors, count: neighbors.length };
2190
2233
  }
2191
- var mRAG_graph_timeline_input = z14.object({
2192
- party_id: z14.string().uuid().describe("The party whose dated appearance timeline to return (a party_id from mRAG_graph_overview)."),
2193
- limit: z14.number().int().min(1).max(200).optional().describe("Max timeline entries (newest first). Clamped to 200. Default 50.")
2234
+ var mRAG_graph_timeline_input = z15.object({
2235
+ party_id: z15.string().uuid().describe("The party whose dated appearance timeline to return (a party_id from mRAG_graph_overview)."),
2236
+ limit: z15.number().int().min(1).max(200).optional().describe("Max timeline entries (newest first). Clamped to 200. Default 50.")
2194
2237
  });
2195
2238
  async function mRAG_graph_timeline(input, ctx) {
2196
2239
  const rows = await callRpc(
@@ -2233,34 +2276,34 @@ var knowledgeGraphTools = [
2233
2276
  ];
2234
2277
 
2235
2278
  // src/tools/actions.ts
2236
- import { z as z15 } from "zod";
2237
- var formField = z15.object({
2238
- name: z15.string().min(1).max(60).describe("Field key \u2014 returned verbatim in the result."),
2239
- label: z15.string().max(120).optional().describe("Human label shown to the recipient. Defaults to `name`."),
2240
- type: z15.enum(["text", "email", "number", "textarea", "tel", "url"]).optional().describe("Input type. Default 'text'."),
2241
- required: z15.boolean().optional().describe("Whether the recipient must fill this field.")
2242
- });
2243
- var action_create_input = z15.object({
2244
- action_type: z15.enum(["confirm", "file_request", "form", "open_url", "screen_share"]).describe(
2279
+ import { z as z16 } from "zod";
2280
+ var formField = z16.object({
2281
+ name: z16.string().min(1).max(60).describe("Field key \u2014 returned verbatim in the result."),
2282
+ label: z16.string().max(120).optional().describe("Human label shown to the recipient. Defaults to `name`."),
2283
+ type: z16.enum(["text", "email", "number", "textarea", "tel", "url"]).optional().describe("Input type. Default 'text'."),
2284
+ required: z16.boolean().optional().describe("Whether the recipient must fill this field.")
2285
+ });
2286
+ var action_create_input = z16.object({
2287
+ action_type: z16.enum(["confirm", "file_request", "form", "open_url", "screen_share"]).describe(
2245
2288
  "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)."
2246
2289
  ),
2247
- message: z15.string().min(1).max(2e3).describe("What you're asking \u2014 shown on the consent screen above the action UI."),
2248
- creator_label: z15.string().max(80).optional().describe("How you're identified to the recipient (e.g. your agent name). Default 'Agent'."),
2290
+ message: z16.string().min(1).max(2e3).describe("What you're asking \u2014 shown on the consent screen above the action UI."),
2291
+ creator_label: z16.string().max(80).optional().describe("How you're identified to the recipient (e.g. your agent name). Default 'Agent'."),
2249
2292
  // confirm
2250
- yes_label: z15.string().max(40).optional().describe("[confirm] Affirmative button label. Default 'Tak'."),
2251
- no_label: z15.string().max(40).optional().describe("[confirm] Negative button label. Default 'Nie'."),
2293
+ yes_label: z16.string().max(40).optional().describe("[confirm] Affirmative button label. Default 'Tak'."),
2294
+ no_label: z16.string().max(40).optional().describe("[confirm] Negative button label. Default 'Nie'."),
2252
2295
  // file_request
2253
- accept: z15.string().max(200).optional().describe("[file_request] Accepted file types (HTML accept attr, e.g. 'image/*,.pdf')."),
2254
- 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."),
2296
+ accept: z16.string().max(200).optional().describe("[file_request] Accepted file types (HTML accept attr, e.g. 'image/*,.pdf')."),
2297
+ max_bytes: z16.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."),
2255
2298
  // form
2256
- fields: z15.array(formField).min(1).max(20).optional().describe("[form] Fields to collect from the recipient."),
2299
+ fields: z16.array(formField).min(1).max(20).optional().describe("[form] Fields to collect from the recipient."),
2257
2300
  // open_url
2258
- 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."),
2301
+ url: z16.string().url().optional().describe("[open_url] The https URL to open. The full URL is shown to the recipient before they open it."),
2259
2302
  // screen_share
2260
- max_width: z15.number().int().positive().max(1920).optional().describe("[screen_share] Max captured frame width in px (default 1280). Frames are downscaled JPEGs."),
2303
+ max_width: z16.number().int().positive().max(1920).optional().describe("[screen_share] Max captured frame width in px (default 1280). Frames are downscaled JPEGs."),
2261
2304
  // lifecycle
2262
- ttl_ms: z15.number().int().positive().optional().describe("Link lifetime in milliseconds. Default 24h, capped at 7d."),
2263
- max_uses: z15.number().int().min(1).max(50).optional().describe("How many times the link can be redeemed. Default 1 (single-use).")
2305
+ ttl_ms: z16.number().int().positive().optional().describe("Link lifetime in milliseconds. Default 24h, capped at 7d."),
2306
+ max_uses: z16.number().int().min(1).max(50).optional().describe("How many times the link can be redeemed. Default 1 (single-use).")
2264
2307
  });
2265
2308
  function buildParams(input) {
2266
2309
  switch (input.action_type) {
@@ -2301,8 +2344,8 @@ async function action_create(input, ctx) {
2301
2344
  expires_at: res.expires_at ?? ""
2302
2345
  };
2303
2346
  }
2304
- var action_frame_get_input = z15.object({
2305
- action_id: z15.string().min(1).describe("The action_id returned by comms_action_create for a 'screen_share' action you created.")
2347
+ var action_frame_get_input = z16.object({
2348
+ action_id: z16.string().min(1).describe("The action_id returned by comms_action_create for a 'screen_share' action you created.")
2306
2349
  });
2307
2350
  async function action_frame_get(input, ctx) {
2308
2351
  readSupabaseEnv();
@@ -2344,7 +2387,7 @@ var actionTools = [
2344
2387
 
2345
2388
  // src/tools/presence.ts
2346
2389
  import { hostname } from "os";
2347
- import { z as z16 } from "zod";
2390
+ import { z as z17 } from "zod";
2348
2391
  var BEAT_MS = 6e4;
2349
2392
  var HOLD_SECONDS = 300;
2350
2393
  var attachments = /* @__PURE__ */ new Map();
@@ -2368,11 +2411,11 @@ async function resolveSelf(env) {
2368
2411
  }
2369
2412
  return { id: data.id, display_name: data.display_name ?? null };
2370
2413
  }
2371
- var comms_session_attach_input = z16.object({
2372
- label: z16.string().max(120).optional().describe(
2414
+ var comms_session_attach_input = z17.object({
2415
+ label: z17.string().max(120).optional().describe(
2373
2416
  "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."
2374
2417
  ),
2375
- release: z16.boolean().optional().describe(
2418
+ release: z17.boolean().optional().describe(
2376
2419
  "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."
2377
2420
  )
2378
2421
  });
@@ -2430,20 +2473,20 @@ var presenceTools = [
2430
2473
  ];
2431
2474
 
2432
2475
  // src/tools/embed.ts
2433
- import { z as z17 } from "zod";
2476
+ import { z as z18 } from "zod";
2434
2477
  var EMBED_CDN = (process.env.MOSADD_EMBED_CDN ?? "https://embed.mosadd.com").replace(/\/+$/, "");
2435
2478
  var POSITIONS = ["inline", "sidebar-left", "sidebar-right", "floating-bl", "floating-br", "fullscreen"];
2436
2479
  var SKINS = ["default", "retro-irc-1990", "terminal", "minimal-dark", "minimal-light"];
2437
- var embed_create_input = z17.object({
2438
- channel: z17.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."),
2439
- allowed_origins: z17.array(z17.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'."),
2440
- name: z17.string().max(64).optional().describe("Label for the key in the owner's dashboard. Default 'embed: <channel>'."),
2441
- position: z17.enum(POSITIONS).optional().describe("Where the widget renders. Default 'inline'."),
2442
- skin: z17.enum(SKINS).optional().describe("Visual skin. Default 'default' (mosadd-branded retro mIRC)."),
2443
- title: z17.string().max(60).optional().describe("Header title shown in the widget. Default 'mIRC'."),
2444
- anon: z17.boolean().optional().describe("Allow visitors to join with just a nick (no mosadd account). Default true."),
2445
- locale: z17.enum(["en", "pl"]).optional().describe("Widget UI language. Default 'en'."),
2446
- mode: z17.enum(["live", "test"]).optional().describe("Key mode \u2014 'test' for local/dev origins, 'live' for production. Default 'live'.")
2480
+ var embed_create_input = z18.object({
2481
+ channel: z18.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."),
2482
+ allowed_origins: z18.array(z18.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'."),
2483
+ name: z18.string().max(64).optional().describe("Label for the key in the owner's dashboard. Default 'embed: <channel>'."),
2484
+ position: z18.enum(POSITIONS).optional().describe("Where the widget renders. Default 'inline'."),
2485
+ skin: z18.enum(SKINS).optional().describe("Visual skin. Default 'default' (mosadd-branded retro mIRC)."),
2486
+ title: z18.string().max(60).optional().describe("Header title shown in the widget. Default 'mIRC'."),
2487
+ anon: z18.boolean().optional().describe("Allow visitors to join with just a nick (no mosadd account). Default true."),
2488
+ locale: z18.enum(["en", "pl"]).optional().describe("Widget UI language. Default 'en'."),
2489
+ mode: z18.enum(["live", "test"]).optional().describe("Key mode \u2014 'test' for local/dev origins, 'live' for production. Default 'live'.")
2447
2490
  });
2448
2491
  var attrSafe = (s) => s.replace(/["'<>]/g, "");
2449
2492
  function buildSnippet(input, key) {
@@ -2484,16 +2527,16 @@ var embedTools = [
2484
2527
  ];
2485
2528
 
2486
2529
  // src/tools/threat.ts
2487
- import { z as z18 } from "zod";
2530
+ import { z as z19 } from "zod";
2488
2531
  import {
2489
2532
  THREAT_EVENTS,
2490
2533
  THREAT_EVENT_COUNT,
2491
2534
  evaluateEvent,
2492
2535
  getEventDef
2493
2536
  } from "@mosadd/threat-engine";
2494
- var threat_catalog_input = z18.object({
2495
- category: z18.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."),
2496
- platform: z18.enum(["apk", "ios", "pwa", "harmony"]).optional().describe("Filter to events detectable on this platform. Omit for all platforms.")
2537
+ var threat_catalog_input = z19.object({
2538
+ category: z19.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."),
2539
+ platform: z19.enum(["apk", "ios", "pwa", "harmony"]).optional().describe("Filter to events detectable on this platform. Omit for all platforms.")
2497
2540
  });
2498
2541
  async function threat_catalog(input, _ctx) {
2499
2542
  let events = THREAT_EVENTS;
@@ -2501,10 +2544,10 @@ async function threat_catalog(input, _ctx) {
2501
2544
  if (input.platform) events = events.filter((e) => e.platforms.includes(input.platform));
2502
2545
  return { count: events.length, total: THREAT_EVENT_COUNT, events };
2503
2546
  }
2504
- var threat_classify_input = z18.object({
2505
- event_type: z18.string().min(1).max(120).describe('Event type to classify, e.g. "SIM_SWAP", "AUTH_BRUTEFORCE", "TOLL_FRAUD". Case-insensitive.'),
2506
- severity: z18.string().optional().describe('Optional producer severity hint. "killswitch" \u2192 lock_account; "critical" \u2192 revoke_sessions; anything else is informational.'),
2507
- details: z18.string().max(2e3).optional().describe("Optional free-text context (informational only).")
2547
+ var threat_classify_input = z19.object({
2548
+ event_type: z19.string().min(1).max(120).describe('Event type to classify, e.g. "SIM_SWAP", "AUTH_BRUTEFORCE", "TOLL_FRAUD". Case-insensitive.'),
2549
+ severity: z19.string().optional().describe('Optional producer severity hint. "killswitch" \u2192 lock_account; "critical" \u2192 revoke_sessions; anything else is informational.'),
2550
+ details: z19.string().max(2e3).optional().describe("Optional free-text context (informational only).")
2508
2551
  });
2509
2552
  async function threat_classify(input, _ctx) {
2510
2553
  const def = getEventDef(String(input.event_type).toUpperCase());
@@ -2539,7 +2582,7 @@ var threatTools = [
2539
2582
  ];
2540
2583
 
2541
2584
  // src/tools/murl.ts
2542
- import { z as z19 } from "zod";
2585
+ import { z as z20 } from "zod";
2543
2586
  var DEFAULT_EDGE_URL2 = "https://mosadd-edge.mr-brics-33.workers.dev";
2544
2587
  function edgeUrl2() {
2545
2588
  return process.env.MOSADD_EDGE_URL?.replace(/\/$/, "") ?? DEFAULT_EDGE_URL2;
@@ -2562,10 +2605,10 @@ function urlToSlug(input) {
2562
2605
  const base = host.replace(/\./g, "-");
2563
2606
  return { domain: host, slug: segs.length ? `${base}__${segs.join("__")}` : base };
2564
2607
  }
2565
- var DomainArg = z19.string().min(3).max(2048).describe("A domain ('example.com') or a full URL. Keyed PER-URL: a bare domain \u2192 the domain room; a URL with a path (e.g. 'site.com/articles/abc') \u2192 that page's own room.");
2566
- var mURL_read_channel_input = z19.object({
2608
+ var DomainArg = z20.string().min(3).max(2048).describe("A domain ('example.com') or a full URL. Keyed PER-URL: a bare domain \u2192 the domain room; a URL with a path (e.g. 'site.com/articles/abc') \u2192 that page's own room.");
2609
+ var mURL_read_channel_input = z20.object({
2567
2610
  domain: DomainArg,
2568
- limit: z19.number().int().min(1).max(100).optional().describe("Recent messages to return (max 100). Default 50.")
2611
+ limit: z20.number().int().min(1).max(100).optional().describe("Recent messages to return (max 100). Default 50.")
2569
2612
  });
2570
2613
  async function mURL_read_channel(input, ctx) {
2571
2614
  const { domain, slug: slug2 } = urlToSlug(input.domain);
@@ -2584,10 +2627,10 @@ async function mURL_read_channel(input, ctx) {
2584
2627
  messages: (data.messages ?? []).map((m) => ({ id: m.id, from: m.from ?? null, text: m.text, timestamp: m.ts }))
2585
2628
  };
2586
2629
  }
2587
- var mURL_post_input = z19.object({
2630
+ var mURL_post_input = z20.object({
2588
2631
  domain: DomainArg,
2589
- text: z19.string().min(1).max(2e3).describe("Message body (max 2000 chars, up to 3 lines \u2014 Worker-enforced)."),
2590
- from: z19.string().max(120).optional().describe("Sender hint shown to others (defaults to the hub-key owner / your agent name).")
2632
+ text: z20.string().min(1).max(2e3).describe("Message body (max 2000 chars, up to 3 lines \u2014 Worker-enforced)."),
2633
+ from: z20.string().max(120).optional().describe("Sender hint shown to others (defaults to the hub-key owner / your agent name).")
2591
2634
  });
2592
2635
  async function mURL_post(input, ctx) {
2593
2636
  const { domain, slug: slug2 } = urlToSlug(input.domain);
@@ -2605,12 +2648,12 @@ async function mURL_post(input, ctx) {
2605
2648
  if (!data?.id) throw new Error("mosadd-edge: send returned no id");
2606
2649
  return { domain, message_id: data.id, posted_at: data.ts ?? Date.now() };
2607
2650
  }
2608
- var mURL_list_channels_input = z19.object({
2609
- action: z19.enum(["trending", "list", "mine"]).optional().describe("'trending' (default) = most active domain channels in the last N hours; 'list' = paginated catalogue filtered by status; 'mine' = channels you own (DNS-verified)."),
2610
- limit: z19.number().int().min(1).max(100).optional().describe("Max channels to return. Default 20."),
2611
- hours: z19.number().int().min(1).max(168).optional().describe("Trending window in hours. Default 24, max 168 (7d)."),
2612
- status: z19.enum(["open", "claimed", "blocked"]).optional().describe("For action='list': filter (default 'open')."),
2613
- cursor: z19.string().optional().describe("For action='list': pagination \u2014 pass previous response's next_cursor (created_at ISO).")
2651
+ var mURL_list_channels_input = z20.object({
2652
+ action: z20.enum(["trending", "list", "mine"]).optional().describe("'trending' (default) = most active domain channels in the last N hours; 'list' = paginated catalogue filtered by status; 'mine' = channels you own (DNS-verified)."),
2653
+ limit: z20.number().int().min(1).max(100).optional().describe("Max channels to return. Default 20."),
2654
+ hours: z20.number().int().min(1).max(168).optional().describe("Trending window in hours. Default 24, max 168 (7d)."),
2655
+ status: z20.enum(["open", "claimed", "blocked"]).optional().describe("For action='list': filter (default 'open')."),
2656
+ cursor: z20.string().optional().describe("For action='list': pagination \u2014 pass previous response's next_cursor (created_at ISO).")
2614
2657
  });
2615
2658
  async function mURL_list_channels(input, ctx) {
2616
2659
  readSupabaseEnv();
@@ -2624,7 +2667,7 @@ async function mURL_list_channels(input, ctx) {
2624
2667
  cursor: input.cursor ?? null
2625
2668
  });
2626
2669
  }
2627
- var mURL_presence_input = z19.object({ domain: DomainArg });
2670
+ var mURL_presence_input = z20.object({ domain: DomainArg });
2628
2671
  async function mURL_presence(input, ctx) {
2629
2672
  const { domain, slug: slug2 } = urlToSlug(input.domain);
2630
2673
  ctx.log("debug", "mURL_presence", { domain });
@@ -2636,10 +2679,10 @@ async function mURL_presence(input, ctx) {
2636
2679
  const data = await r.json();
2637
2680
  return { domain, count: data.count ?? 0, roster: data.roster ?? [], status: data.status ?? "open" };
2638
2681
  }
2639
- var mURL_create_input = z19.object({
2682
+ var mURL_create_input = z20.object({
2640
2683
  domain: DomainArg,
2641
- branding: z19.record(z19.string(), z19.any()).optional().describe("Optional branding JSON (e.g. display name, colour, avatar URL) shown on the channel."),
2642
- status: z19.enum(["open", "claimed", "blocked"]).optional().describe(
2684
+ branding: z20.record(z20.string(), z20.any()).optional().describe("Optional branding JSON (e.g. display name, colour, avatar URL) shown on the channel."),
2685
+ status: z20.enum(["open", "claimed", "blocked"]).optional().describe(
2643
2686
  "Status for a channel that does NOT exist yet: 'open' (default) = public agent-native room; 'claimed' = registered as yours; 'blocked' = closed. IGNORED if the channel already exists \u2014 murl-manage applies status only on the INSERT of a new row; on an existing row it writes owner + branding and leaves status untouched. mURL rooms auto-create on first activity, so an existing room is the common case: change its status with mURL_update."
2644
2687
  )
2645
2688
  });
@@ -2654,10 +2697,10 @@ async function mURL_create(input, ctx) {
2654
2697
  status: input.status ?? null
2655
2698
  });
2656
2699
  }
2657
- var mURL_update_input = z19.object({
2700
+ var mURL_update_input = z20.object({
2658
2701
  domain: DomainArg,
2659
- branding: z19.record(z19.string(), z19.any()).optional().describe("New branding JSON to set on the channel."),
2660
- status: z19.enum(["open", "claimed", "blocked"]).optional().describe("New status: 'claimed' to mark owned, 'blocked' to close the room, 'open' to reopen.")
2702
+ branding: z20.record(z20.string(), z20.any()).optional().describe("New branding JSON to set on the channel."),
2703
+ status: z20.enum(["open", "claimed", "blocked"]).optional().describe("New status: 'claimed' to mark owned, 'blocked' to close the room, 'open' to reopen.")
2661
2704
  });
2662
2705
  async function mURL_update(input, ctx) {
2663
2706
  readSupabaseEnv();
@@ -2671,7 +2714,7 @@ async function mURL_update(input, ctx) {
2671
2714
  status: input.status ?? null
2672
2715
  });
2673
2716
  }
2674
- var mURL_delete_input = z19.object({ domain: DomainArg });
2717
+ var mURL_delete_input = z20.object({ domain: DomainArg });
2675
2718
  async function mURL_delete(input, ctx) {
2676
2719
  readSupabaseEnv();
2677
2720
  const { domain } = urlToSlug(input.domain);
@@ -2732,7 +2775,7 @@ var murlTools = [
2732
2775
  ];
2733
2776
 
2734
2777
  // src/tools/capabilities.ts
2735
- import { z as z20 } from "zod";
2778
+ import { z as z21 } from "zod";
2736
2779
  var CONTRACT_VERSION = "1.0.0";
2737
2780
  var ALL_REQUIREMENTS = ["any", "radio", "network"];
2738
2781
  function buildCapabilityManifest(tools) {
@@ -2755,7 +2798,7 @@ function makeCapabilitiesTool(channelTools2) {
2755
2798
  name: "comms_capabilities",
2756
2799
  requires: "any",
2757
2800
  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.",
2758
- inputSchema: z20.object({}),
2801
+ inputSchema: z21.object({}),
2759
2802
  handler: async () => buildCapabilityManifest([...channelTools2, tool])
2760
2803
  };
2761
2804
  return tool;
@@ -2764,6 +2807,7 @@ function makeCapabilitiesTool(channelTools2) {
2764
2807
  // src/tools/index.ts
2765
2808
  var channelTools = [
2766
2809
  ...mdmTools,
2810
+ ...mdmAsAgentTools,
2767
2811
  ...mdmVoiceTools,
2768
2812
  ...mircTools,
2769
2813
  ...mircMembersTools,
@@ -2863,6 +2907,84 @@ var TOOL_COUNT = allTools.length;
2863
2907
  // src/server.ts
2864
2908
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2865
2909
 
2910
+ // package.json
2911
+ var package_default = {
2912
+ name: "@mosadd/mcp",
2913
+ version: "3.0.0-alpha.35",
2914
+ mcpName: "io.github.hei33enberg/mosadd-mcp",
2915
+ 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).",
2916
+ homepage: "https://github.com/Hei33enberg/mosADD-OS/tree/main/packages/mcp",
2917
+ repository: {
2918
+ type: "git",
2919
+ url: "https://github.com/Hei33enberg/mosADD-OS.git",
2920
+ directory: "packages/mcp"
2921
+ },
2922
+ license: "Apache-2.0",
2923
+ type: "module",
2924
+ main: "./dist/index.js",
2925
+ module: "./dist/index.js",
2926
+ types: "./dist/index.d.ts",
2927
+ exports: {
2928
+ ".": {
2929
+ types: "./dist/index.d.ts",
2930
+ import: "./dist/index.js"
2931
+ }
2932
+ },
2933
+ bin: {
2934
+ "mosadd-mcp": "./dist/bin/mcp.js",
2935
+ mosadd: "./dist/bin/mcp.js"
2936
+ },
2937
+ files: [
2938
+ "dist",
2939
+ "src",
2940
+ "README.md",
2941
+ "CHANGELOG.md",
2942
+ "LICENSE"
2943
+ ],
2944
+ publishConfig: {
2945
+ access: "public"
2946
+ },
2947
+ scripts: {
2948
+ build: "tsup src/index.ts src/bin/mcp.ts src/bin/login.ts --format esm --dts --clean --shims",
2949
+ dev: "tsx src/bin/mcp.ts",
2950
+ test: "vitest run",
2951
+ typecheck: "tsc -p tsconfig.json --noEmit",
2952
+ clean: "rm -rf dist .turbo"
2953
+ },
2954
+ dependencies: {
2955
+ "@modelcontextprotocol/sdk": "^1.0.4",
2956
+ "@mosadd/crypto": "workspace:*",
2957
+ "@mosadd/protocol": "workspace:*",
2958
+ "@mosadd/providers": "workspace:*",
2959
+ "@mosadd/threat-engine": "workspace:*",
2960
+ "@supabase/supabase-js": "^2.48.0",
2961
+ zod: "^4.3.6"
2962
+ },
2963
+ devDependencies: {
2964
+ tsup: "^8.3.5",
2965
+ tsx: "^4.19.2",
2966
+ typescript: "^5.7.2",
2967
+ vitest: "^2.1.8"
2968
+ },
2969
+ keywords: [
2970
+ "mosadd",
2971
+ "mcp",
2972
+ "model-context-protocol",
2973
+ "agent",
2974
+ "claude",
2975
+ "cursor",
2976
+ "anthropic",
2977
+ "communication",
2978
+ "messaging"
2979
+ ],
2980
+ engines: {
2981
+ node: ">=18"
2982
+ }
2983
+ };
2984
+
2985
+ // src/version.ts
2986
+ var PKG_VERSION = package_default.version;
2987
+
2866
2988
  // src/providers/supabase-dm.ts
2867
2989
  var PROTOCOL_VERSION5 = "mosadd.chat.v1";
2868
2990
  var SupabaseDmProvider = class {
@@ -3022,7 +3144,7 @@ function createMosaddServer(options = {}) {
3022
3144
  const server = new McpServer(
3023
3145
  {
3024
3146
  name: "mosadd",
3025
- version: "3.0.0-alpha.32"
3147
+ version: PKG_VERSION
3026
3148
  },
3027
3149
  {
3028
3150
  capabilities: {