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

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 (54) hide show
  1. package/CHANGELOG.md +15 -11
  2. package/README.md +152 -150
  3. package/dist/bin/mcp.js +1 -1
  4. package/dist/{chunk-IWUGKLDX.js → chunk-WEGSITAH.js} +30 -14
  5. package/dist/index.js +1 -1
  6. package/package.json +2 -2
  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 +2 -2
  10. package/src/__tests__/golden-path.test.ts +139 -139
  11. package/src/__tests__/integration.test.ts +217 -182
  12. package/src/__tests__/label-room-owner.test.ts +22 -0
  13. package/src/__tests__/mdm-e2ee.test.ts +212 -212
  14. package/src/__tests__/mdm-mcp-readable.test.ts +390 -390
  15. package/src/__tests__/mirc-invite.test.ts +112 -112
  16. package/src/__tests__/mtalk.test.ts +122 -122
  17. package/src/__tests__/presence.test.ts +199 -199
  18. package/src/__tests__/server.test.ts +71 -71
  19. package/src/__tests__/tool-count-consistency.test.ts +259 -199
  20. package/src/__tests__/voice-fields.test.ts +24 -0
  21. package/src/bin/login.ts +138 -138
  22. package/src/bin/mcp.ts +145 -145
  23. package/src/config.ts +66 -66
  24. package/src/crypto/channel-e2ee.ts +288 -288
  25. package/src/crypto/mdm-session.ts +842 -842
  26. package/src/index.ts +19 -19
  27. package/src/observability/sentry.ts +79 -79
  28. package/src/providers/blob-upload.ts +162 -162
  29. package/src/providers/memory-voice.ts +79 -79
  30. package/src/providers/supabase-dm.ts +212 -202
  31. package/src/providers/supabase-voice.ts +103 -91
  32. package/src/server.ts +195 -195
  33. package/src/tools/actions.ts +166 -166
  34. package/src/tools/attachments.ts +276 -276
  35. package/src/tools/capabilities.ts +70 -70
  36. package/src/tools/channel-payload.ts +2 -2
  37. package/src/tools/embed.ts +110 -110
  38. package/src/tools/index.ts +181 -181
  39. package/src/tools/knowledge.ts +344 -344
  40. package/src/tools/mail-aliases.ts +25 -25
  41. package/src/tools/mail-provenance.ts +137 -137
  42. package/src/tools/mail.ts +403 -403
  43. package/src/tools/mdm-as-agent.ts +138 -126
  44. package/src/tools/mdm.ts +6 -4
  45. package/src/tools/mirc-edge.ts +196 -196
  46. package/src/tools/mirc-members.ts +287 -287
  47. package/src/tools/mirc-messages.ts +1 -1
  48. package/src/tools/mirc.ts +308 -308
  49. package/src/tools/mroom.ts +221 -221
  50. package/src/tools/mtalk.ts +131 -131
  51. package/src/tools/presence.ts +442 -442
  52. package/src/tools/voice-format.ts +43 -28
  53. package/src/types.ts +121 -121
  54. 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 for a named room (e.g. 'ops') that you own: you and your accepted contacts can join it; omit the label 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
+ ];