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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +150 -150
  3. package/dist/bin/mcp.js +1 -1
  4. package/dist/{chunk-3PUOM4R5.js → chunk-IWUGKLDX.js} +54 -20
  5. package/dist/index.js +1 -1
  6. package/package.json +1 -1
  7. package/src/__tests__/blob-upload.test.ts +93 -93
  8. package/src/__tests__/channel-e2ee.test.ts +62 -62
  9. package/src/__tests__/flota-jawnie.test.ts +244 -0
  10. package/src/__tests__/golden-path.test.ts +139 -139
  11. package/src/__tests__/integration.test.ts +182 -182
  12. package/src/__tests__/mdm-e2ee.test.ts +212 -212
  13. package/src/__tests__/mdm-mcp-readable.test.ts +390 -386
  14. package/src/__tests__/mirc-invite.test.ts +112 -112
  15. package/src/__tests__/mtalk.test.ts +122 -122
  16. package/src/__tests__/server.test.ts +71 -71
  17. package/src/__tests__/tool-count-consistency.test.ts +199 -199
  18. package/src/bin/login.ts +138 -138
  19. package/src/bin/mcp.ts +145 -145
  20. package/src/config.ts +66 -66
  21. package/src/crypto/channel-e2ee.ts +288 -288
  22. package/src/crypto/mdm-session.ts +842 -842
  23. package/src/index.ts +19 -19
  24. package/src/observability/sentry.ts +79 -79
  25. package/src/providers/memory-voice.ts +79 -79
  26. package/src/providers/supabase-dm.ts +202 -202
  27. package/src/providers/supabase-voice.ts +91 -91
  28. package/src/server.ts +195 -195
  29. package/src/tools/actions.ts +166 -166
  30. package/src/tools/attachments.ts +276 -276
  31. package/src/tools/capabilities.ts +70 -70
  32. package/src/tools/channel-payload.ts +69 -0
  33. package/src/tools/embed.ts +110 -110
  34. package/src/tools/index.ts +181 -181
  35. package/src/tools/knowledge.ts +344 -344
  36. package/src/tools/mail-aliases.ts +25 -25
  37. package/src/tools/mail-provenance.ts +137 -137
  38. package/src/tools/mail.ts +403 -403
  39. package/src/tools/mdm-as-agent.ts +126 -126
  40. package/src/tools/mdm.ts +26 -11
  41. package/src/tools/mirc-edge.ts +196 -196
  42. package/src/tools/mirc-members.ts +287 -287
  43. package/src/tools/mirc-messages.ts +9 -13
  44. package/src/tools/mirc.ts +308 -308
  45. package/src/tools/mroom-messages.ts +4 -12
  46. package/src/tools/mroom.ts +221 -221
  47. package/src/tools/mtalk.ts +131 -131
  48. package/src/tools/presence.ts +442 -442
  49. package/src/tools/voice-format.ts +28 -28
  50. package/src/types.ts +121 -121
  51. package/src/voice/floor.ts +132 -132
@@ -1,131 +1,131 @@
1
- /**
2
- * mTALK — Push-to-Talk (the kill feature).
3
- *
4
- * Half-duplex voice over a real-time room, with a walkie-talkie floor
5
- * discipline: one transmitter at a time, others queue, and an anti-hog timeout
6
- * keeps the floor moving. An AGENT uses these tools to: spin up a PTT room, get
7
- * join credentials for a human/bot client, and drive the floor (press/release
8
- * PTT, see who's transmitting). The audio itself flows over the media transport
9
- * the VoiceProvider points at (LiveKit by default); these tools coordinate WHO
10
- * may transmit, which is the part that makes a PTT channel work.
11
- *
12
- * Transport-agnostic: the same tools drive an off-grid radio host, where the
13
- * floor is the physical RF channel (the host injects its own VoiceProvider).
14
- */
15
-
16
- import { z } from "zod";
17
- import type { MosaddTool, MosaddToolContext } from "../types.js";
18
-
19
- const RoomLabel = z
20
- .string()
21
- .min(1)
22
- .max(120)
23
- .regex(/^[a-zA-Z0-9._-]+$/)
24
- .describe("Human-readable room label (e.g. 'ops', 'field-team'). Used to derive a stable room id.");
25
-
26
- const RoomId = z.string().min(1).describe("Room id returned by mTALK_open.");
27
-
28
- const mTALK_open_input = z.object({
29
- label: RoomLabel.optional().describe("Optional label; defaults to a personal room."),
30
- });
31
- const mTALK_join_input = z.object({ room_id: RoomId });
32
- const mTALK_press_input = z.object({ room_id: RoomId });
33
- const mTALK_release_input = z.object({ room_id: RoomId });
34
- const mTALK_state_input = z.object({ room_id: RoomId });
35
-
36
- async function mTALK_open(
37
- input: z.infer<typeof mTALK_open_input>,
38
- ctx: MosaddToolContext,
39
- ): Promise<{ room_id: string }> {
40
- const { roomId } = await ctx.providers.voice.createRoom(input.label);
41
- ctx.log("debug", "mTALK_open", { room_id: roomId });
42
- return { room_id: roomId };
43
- }
44
-
45
- async function mTALK_join(
46
- input: z.infer<typeof mTALK_join_input>,
47
- ctx: MosaddToolContext,
48
- ): Promise<{ room_id: string; token: string; url: string; identity: string }> {
49
- const ticket = await ctx.providers.voice.joinTicket(input.room_id);
50
- ctx.log("debug", "mTALK_join", { room_id: ticket.roomId, identity: ticket.identity });
51
- return { room_id: ticket.roomId, token: ticket.token, url: ticket.url, identity: ticket.identity };
52
- }
53
-
54
- async function mTALK_press(
55
- input: z.infer<typeof mTALK_press_input>,
56
- ctx: MosaddToolContext,
57
- ): Promise<{ granted: boolean; position: number; holder: string | null; queue: string[] }> {
58
- const res = await ctx.providers.voice.requestFloor(input.room_id);
59
- ctx.log("debug", "mTALK_press", { room_id: input.room_id, granted: res.granted, position: res.position });
60
- return { granted: res.granted, position: res.position, holder: res.snapshot.holder, queue: res.snapshot.queue };
61
- }
62
-
63
- async function mTALK_release(
64
- input: z.infer<typeof mTALK_release_input>,
65
- ctx: MosaddToolContext,
66
- ): Promise<{ holder: string | null; queue: string[] }> {
67
- const snap = await ctx.providers.voice.releaseFloor(input.room_id);
68
- ctx.log("debug", "mTALK_release", { room_id: input.room_id, holder: snap.holder });
69
- return { holder: snap.holder, queue: snap.queue };
70
- }
71
-
72
- async function mTALK_state(
73
- input: z.infer<typeof mTALK_state_input>,
74
- ctx: MosaddToolContext,
75
- ): Promise<{ holder: string | null; since: string | null; queue: string[] }> {
76
- const snap = await ctx.providers.voice.floorState(input.room_id);
77
- return { holder: snap.holder, since: snap.since, queue: snap.queue };
78
- }
79
-
80
- export const mtalkTools: MosaddTool[] = [
81
- {
82
- name: "mTALK_open",
83
- title: "Open push-to-talk room",
84
- annotations: { readOnlyHint: false },
85
- requires: "any",
86
- description:
87
- "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.",
88
- inputSchema: mTALK_open_input,
89
- handler: mTALK_open as MosaddTool["handler"],
90
- },
91
- {
92
- name: "mTALK_join",
93
- title: "Get PTT join credentials",
94
- annotations: { readOnlyHint: false },
95
- requires: "network",
96
- description:
97
- "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.",
98
- inputSchema: mTALK_join_input,
99
- handler: mTALK_join as MosaddTool["handler"],
100
- },
101
- {
102
- name: "mTALK_press",
103
- title: "Press to talk (request floor)",
104
- annotations: { readOnlyHint: false },
105
- requires: "any",
106
- description:
107
- "Press push-to-talk: request the floor in a room. Half-duplex — 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.",
108
- inputSchema: mTALK_press_input,
109
- handler: mTALK_press as MosaddTool["handler"],
110
- },
111
- {
112
- name: "mTALK_release",
113
- title: "Release the floor",
114
- annotations: { readOnlyHint: false },
115
- requires: "any",
116
- description:
117
- "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.",
118
- inputSchema: mTALK_release_input,
119
- handler: mTALK_release as MosaddTool["handler"],
120
- },
121
- {
122
- name: "mTALK_state",
123
- title: "Read PTT floor state",
124
- annotations: { readOnlyHint: true },
125
- requires: "any",
126
- description:
127
- "Read a PTT room's floor state without changing it: who is currently transmitting (holder), since when, and the waiting queue.",
128
- inputSchema: mTALK_state_input,
129
- handler: mTALK_state as MosaddTool["handler"],
130
- },
131
- ];
1
+ /**
2
+ * mTALK — Push-to-Talk (the kill feature).
3
+ *
4
+ * Half-duplex voice over a real-time room, with a walkie-talkie floor
5
+ * discipline: one transmitter at a time, others queue, and an anti-hog timeout
6
+ * keeps the floor moving. An AGENT uses these tools to: spin up a PTT room, get
7
+ * join credentials for a human/bot client, and drive the floor (press/release
8
+ * PTT, see who's transmitting). The audio itself flows over the media transport
9
+ * the VoiceProvider points at (LiveKit by default); these tools coordinate WHO
10
+ * may transmit, which is the part that makes a PTT channel work.
11
+ *
12
+ * Transport-agnostic: the same tools drive an off-grid radio host, where the
13
+ * floor is the physical RF channel (the host injects its own VoiceProvider).
14
+ */
15
+
16
+ import { z } from "zod";
17
+ import type { MosaddTool, MosaddToolContext } from "../types.js";
18
+
19
+ const RoomLabel = z
20
+ .string()
21
+ .min(1)
22
+ .max(120)
23
+ .regex(/^[a-zA-Z0-9._-]+$/)
24
+ .describe("Human-readable room label (e.g. 'ops', 'field-team'). Used to derive a stable room id.");
25
+
26
+ const RoomId = z.string().min(1).describe("Room id returned by mTALK_open.");
27
+
28
+ const mTALK_open_input = z.object({
29
+ label: RoomLabel.optional().describe("Optional label; defaults to a personal room."),
30
+ });
31
+ const mTALK_join_input = z.object({ room_id: RoomId });
32
+ const mTALK_press_input = z.object({ room_id: RoomId });
33
+ const mTALK_release_input = z.object({ room_id: RoomId });
34
+ const mTALK_state_input = z.object({ room_id: RoomId });
35
+
36
+ async function mTALK_open(
37
+ input: z.infer<typeof mTALK_open_input>,
38
+ ctx: MosaddToolContext,
39
+ ): Promise<{ room_id: string }> {
40
+ const { roomId } = await ctx.providers.voice.createRoom(input.label);
41
+ ctx.log("debug", "mTALK_open", { room_id: roomId });
42
+ return { room_id: roomId };
43
+ }
44
+
45
+ async function mTALK_join(
46
+ input: z.infer<typeof mTALK_join_input>,
47
+ ctx: MosaddToolContext,
48
+ ): Promise<{ room_id: string; token: string; url: string; identity: string }> {
49
+ const ticket = await ctx.providers.voice.joinTicket(input.room_id);
50
+ ctx.log("debug", "mTALK_join", { room_id: ticket.roomId, identity: ticket.identity });
51
+ return { room_id: ticket.roomId, token: ticket.token, url: ticket.url, identity: ticket.identity };
52
+ }
53
+
54
+ async function mTALK_press(
55
+ input: z.infer<typeof mTALK_press_input>,
56
+ ctx: MosaddToolContext,
57
+ ): Promise<{ granted: boolean; position: number; holder: string | null; queue: string[] }> {
58
+ const res = await ctx.providers.voice.requestFloor(input.room_id);
59
+ ctx.log("debug", "mTALK_press", { room_id: input.room_id, granted: res.granted, position: res.position });
60
+ return { granted: res.granted, position: res.position, holder: res.snapshot.holder, queue: res.snapshot.queue };
61
+ }
62
+
63
+ async function mTALK_release(
64
+ input: z.infer<typeof mTALK_release_input>,
65
+ ctx: MosaddToolContext,
66
+ ): Promise<{ holder: string | null; queue: string[] }> {
67
+ const snap = await ctx.providers.voice.releaseFloor(input.room_id);
68
+ ctx.log("debug", "mTALK_release", { room_id: input.room_id, holder: snap.holder });
69
+ return { holder: snap.holder, queue: snap.queue };
70
+ }
71
+
72
+ async function mTALK_state(
73
+ input: z.infer<typeof mTALK_state_input>,
74
+ ctx: MosaddToolContext,
75
+ ): Promise<{ holder: string | null; since: string | null; queue: string[] }> {
76
+ const snap = await ctx.providers.voice.floorState(input.room_id);
77
+ return { holder: snap.holder, since: snap.since, queue: snap.queue };
78
+ }
79
+
80
+ export const mtalkTools: MosaddTool[] = [
81
+ {
82
+ name: "mTALK_open",
83
+ title: "Open push-to-talk room",
84
+ annotations: { readOnlyHint: false },
85
+ requires: "any",
86
+ description:
87
+ "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.",
88
+ inputSchema: mTALK_open_input,
89
+ handler: mTALK_open as MosaddTool["handler"],
90
+ },
91
+ {
92
+ name: "mTALK_join",
93
+ title: "Get PTT join credentials",
94
+ annotations: { readOnlyHint: false },
95
+ requires: "network",
96
+ description:
97
+ "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.",
98
+ inputSchema: mTALK_join_input,
99
+ handler: mTALK_join as MosaddTool["handler"],
100
+ },
101
+ {
102
+ name: "mTALK_press",
103
+ title: "Press to talk (request floor)",
104
+ annotations: { readOnlyHint: false },
105
+ requires: "any",
106
+ description:
107
+ "Press push-to-talk: request the floor in a room. Half-duplex — 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.",
108
+ inputSchema: mTALK_press_input,
109
+ handler: mTALK_press as MosaddTool["handler"],
110
+ },
111
+ {
112
+ name: "mTALK_release",
113
+ title: "Release the floor",
114
+ annotations: { readOnlyHint: false },
115
+ requires: "any",
116
+ description:
117
+ "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.",
118
+ inputSchema: mTALK_release_input,
119
+ handler: mTALK_release as MosaddTool["handler"],
120
+ },
121
+ {
122
+ name: "mTALK_state",
123
+ title: "Read PTT floor state",
124
+ annotations: { readOnlyHint: true },
125
+ requires: "any",
126
+ description:
127
+ "Read a PTT room's floor state without changing it: who is currently transmitting (holder), since when, and the waiting queue.",
128
+ inputSchema: mTALK_state_input,
129
+ handler: mTALK_state as MosaddTool["handler"],
130
+ },
131
+ ];