@mosadd/mcp 3.0.0-alpha.53 → 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.
- package/CHANGELOG.md +53 -0
- package/README.md +150 -150
- package/dist/bin/mcp.js +1 -1
- package/dist/{chunk-AWKITPZQ.js → chunk-IWUGKLDX.js} +144 -33
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/__tests__/blob-upload.test.ts +93 -93
- package/src/__tests__/channel-e2ee.test.ts +62 -62
- package/src/__tests__/flota-jawnie.test.ts +244 -0
- package/src/__tests__/golden-path.test.ts +139 -139
- package/src/__tests__/integration.test.ts +182 -182
- package/src/__tests__/mdm-e2ee.test.ts +212 -212
- package/src/__tests__/mdm-mcp-readable.test.ts +390 -284
- package/src/__tests__/mirc-invite.test.ts +112 -112
- package/src/__tests__/mtalk.test.ts +122 -122
- package/src/__tests__/server.test.ts +71 -71
- package/src/__tests__/tool-count-consistency.test.ts +199 -199
- package/src/bin/login.ts +138 -138
- package/src/bin/mcp.ts +145 -145
- package/src/config.ts +66 -66
- package/src/crypto/channel-e2ee.ts +288 -288
- package/src/crypto/mdm-session.ts +842 -798
- package/src/index.ts +19 -19
- package/src/observability/sentry.ts +79 -79
- package/src/providers/memory-voice.ts +79 -79
- package/src/providers/supabase-dm.ts +202 -174
- package/src/providers/supabase-voice.ts +91 -91
- package/src/server.ts +195 -186
- package/src/tools/actions.ts +166 -166
- package/src/tools/attachments.ts +276 -276
- package/src/tools/capabilities.ts +70 -70
- package/src/tools/channel-payload.ts +69 -0
- package/src/tools/embed.ts +110 -110
- package/src/tools/index.ts +181 -181
- package/src/tools/knowledge.ts +344 -344
- package/src/tools/mail-aliases.ts +25 -25
- package/src/tools/mail-provenance.ts +137 -137
- package/src/tools/mail.ts +403 -403
- package/src/tools/mdm-as-agent.ts +126 -126
- package/src/tools/mdm.ts +140 -45
- package/src/tools/mirc-edge.ts +196 -196
- package/src/tools/mirc-members.ts +287 -287
- package/src/tools/mirc-messages.ts +9 -13
- package/src/tools/mirc.ts +308 -308
- package/src/tools/mroom-messages.ts +4 -12
- package/src/tools/mroom.ts +221 -221
- package/src/tools/mtalk.ts +131 -131
- package/src/tools/presence.ts +442 -442
- package/src/tools/voice-format.ts +28 -28
- package/src/types.ts +121 -121
- package/src/voice/floor.ts +132 -132
package/src/tools/actions.ts
CHANGED
|
@@ -1,166 +1,166 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Action links — agent → user one-link actions (Tier 1).
|
|
3
|
-
*
|
|
4
|
-
* Mint a single-use, expiring link (`https://mosadd.com/do/<token>`) that asks a
|
|
5
|
-
* human to DO something in their browser — confirm, pick a file, fill a form, or
|
|
6
|
-
* open a vetted URL — with explicit consent. Send the returned `link` to the
|
|
7
|
-
* person via any channel (mDM/mIRC/mp0st). They open it, see what's asked, consent,
|
|
8
|
-
* and the browser performs the action IN ITS SANDBOX, then the result is recorded
|
|
9
|
-
* against the action. No install, no OS access, nothing runs without a user gesture.
|
|
10
|
-
*
|
|
11
|
-
* Backend: mosadd `action-create` Edge Function. The action is owned by the
|
|
12
|
-
* calling user (user-JWT scoped — `mosadd login` / MOSADD_USER_JWT), so only you
|
|
13
|
-
* can later read its result.
|
|
14
|
-
*
|
|
15
|
-
* Result read-back (an `action_status` tool) is a follow-up — it needs a small
|
|
16
|
-
* creator-scoped read Edge Function (`action-status`). For now, the recipient's
|
|
17
|
-
* outcome is recorded on the action row; surface it once that EF ships.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import { z } from "zod";
|
|
21
|
-
import type { MosaddTool, MosaddToolContext } from "../types.js";
|
|
22
|
-
import { invokeFunction, readSupabaseEnv, getSupabase } from "../providers/supabase.js";
|
|
23
|
-
|
|
24
|
-
const formField = z.object({
|
|
25
|
-
name: z.string().min(1).max(60).describe("Field key — returned verbatim in the result."),
|
|
26
|
-
label: z.string().max(120).optional().describe("Human label shown to the recipient. Defaults to `name`."),
|
|
27
|
-
type: z.enum(["text", "email", "number", "textarea", "tel", "url"]).optional().describe("Input type. Default 'text'."),
|
|
28
|
-
required: z.boolean().optional().describe("Whether the recipient must fill this field."),
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const action_create_input = z.object({
|
|
32
|
-
action_type: z.enum(["confirm", "file_request", "form", "open_url", "screen_share"]).describe(
|
|
33
|
-
"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 — view only).",
|
|
34
|
-
),
|
|
35
|
-
message: z.string().min(1).max(2000).describe("What you're asking — shown on the consent screen above the action UI."),
|
|
36
|
-
creator_label: z.string().max(80).optional().describe("How you're identified to the recipient (e.g. your agent name). Default 'Agent'."),
|
|
37
|
-
// confirm
|
|
38
|
-
yes_label: z.string().max(40).optional().describe("[confirm] Affirmative button label. Default 'Tak'."),
|
|
39
|
-
no_label: z.string().max(40).optional().describe("[confirm] Negative button label. Default 'Nie'."),
|
|
40
|
-
// file_request
|
|
41
|
-
accept: z.string().max(200).optional().describe("[file_request] Accepted file types (HTML accept attr, e.g. 'image/*,.pdf')."),
|
|
42
|
-
max_bytes: z.number().int().positive().max(5_242_880).optional().describe("[file_request] Max file size in bytes (≤ 5 MB). NOTE: the returned file is NOT yet end-to-end encrypted — do not request sensitive files until Tier 1.1 ships."),
|
|
43
|
-
// form
|
|
44
|
-
fields: z.array(formField).min(1).max(20).optional().describe("[form] Fields to collect from the recipient."),
|
|
45
|
-
// open_url
|
|
46
|
-
url: z.string().url().optional().describe("[open_url] The https URL to open. The full URL is shown to the recipient before they open it."),
|
|
47
|
-
// screen_share
|
|
48
|
-
max_width: z.number().int().positive().max(1920).optional().describe("[screen_share] Max captured frame width in px (default 1280). Frames are downscaled JPEGs."),
|
|
49
|
-
// lifecycle
|
|
50
|
-
ttl_ms: z.number().int().positive().optional().describe("Link lifetime in milliseconds. Default 24h, capped at 7d."),
|
|
51
|
-
max_uses: z.number().int().min(1).max(50).optional().describe("How many times the link can be redeemed. Default 1 (single-use)."),
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
function buildParams(input: z.infer<typeof action_create_input>): Record<string, unknown> {
|
|
55
|
-
switch (input.action_type) {
|
|
56
|
-
case "confirm":
|
|
57
|
-
return { message: input.message, yesLabel: input.yes_label, noLabel: input.no_label };
|
|
58
|
-
case "file_request":
|
|
59
|
-
return { message: input.message, accept: input.accept, maxBytes: input.max_bytes };
|
|
60
|
-
case "form":
|
|
61
|
-
if (!input.fields?.length) throw new Error("action_type 'form' requires a non-empty `fields` array.");
|
|
62
|
-
return { message: input.message, fields: input.fields };
|
|
63
|
-
case "open_url":
|
|
64
|
-
if (!input.url) throw new Error("action_type 'open_url' requires `url`.");
|
|
65
|
-
return { message: input.message, url: input.url };
|
|
66
|
-
case "screen_share":
|
|
67
|
-
return { message: input.message, maxWidth: input.max_width };
|
|
68
|
-
default:
|
|
69
|
-
return { message: input.message };
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
interface ActionCreateResult {
|
|
74
|
-
action_id: string;
|
|
75
|
-
token: string;
|
|
76
|
-
link: string;
|
|
77
|
-
action_type: string;
|
|
78
|
-
expires_at: string;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
async function action_create(
|
|
82
|
-
input: z.infer<typeof action_create_input>,
|
|
83
|
-
ctx: MosaddToolContext,
|
|
84
|
-
): Promise<ActionCreateResult> {
|
|
85
|
-
readSupabaseEnv();
|
|
86
|
-
ctx.log("debug", "action_create invoking action-create", { action_type: input.action_type });
|
|
87
|
-
|
|
88
|
-
const body: Record<string, unknown> = {
|
|
89
|
-
action_type: input.action_type,
|
|
90
|
-
params: buildParams(input),
|
|
91
|
-
};
|
|
92
|
-
if (input.creator_label !== undefined) body.creator_label = input.creator_label;
|
|
93
|
-
if (input.ttl_ms !== undefined) body.ttl_ms = input.ttl_ms;
|
|
94
|
-
if (input.max_uses !== undefined) body.max_uses = input.max_uses;
|
|
95
|
-
|
|
96
|
-
const res = await invokeFunction<Partial<ActionCreateResult> & { error?: string }>("action-create", body);
|
|
97
|
-
if (res.error) throw new Error(res.error);
|
|
98
|
-
if (!res.link || !res.token) throw new Error("action-create returned a malformed response (missing link/token).");
|
|
99
|
-
|
|
100
|
-
return {
|
|
101
|
-
action_id: res.action_id ?? "",
|
|
102
|
-
token: res.token,
|
|
103
|
-
link: res.link,
|
|
104
|
-
action_type: res.action_type ?? input.action_type,
|
|
105
|
-
expires_at: res.expires_at ?? "",
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// ── comms_action_frame_get — read the latest screen frame (Tier 1.5) ──────────
|
|
110
|
-
const action_frame_get_input = z.object({
|
|
111
|
-
action_id: z.string().min(1).describe("The action_id returned by comms_action_create for a 'screen_share' action you created."),
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
async function action_frame_get(
|
|
115
|
-
input: z.infer<typeof action_frame_get_input>,
|
|
116
|
-
ctx: MosaddToolContext,
|
|
117
|
-
): Promise<{ mcpContent: Array<Record<string, unknown>> }> {
|
|
118
|
-
readSupabaseEnv();
|
|
119
|
-
ctx.log("debug", "action_frame_get reading frame", { action_id: input.action_id });
|
|
120
|
-
// Read directly via RLS ("creators read own frames") — the agent's JWT gates it
|
|
121
|
-
// to screen_share actions it created. No edge function needed.
|
|
122
|
-
const sb = getSupabase();
|
|
123
|
-
const { data, error } = await sb
|
|
124
|
-
.from("action_screen_frames")
|
|
125
|
-
.select("image_jpeg, width, seq, updated_at")
|
|
126
|
-
.eq("action_id", input.action_id)
|
|
127
|
-
.maybeSingle();
|
|
128
|
-
if (error) throw new Error(error.message);
|
|
129
|
-
if (!data) {
|
|
130
|
-
return { mcpContent: [{ type: "text", text: "No frame yet — the recipient hasn't started sharing their screen (or you don't own this action)." }] };
|
|
131
|
-
}
|
|
132
|
-
const row = data as { image_jpeg: string; width: number | null; seq: number; updated_at: string };
|
|
133
|
-
const ageSec = Math.round((Date.now() - new Date(row.updated_at).getTime()) / 1000);
|
|
134
|
-
return {
|
|
135
|
-
mcpContent: [
|
|
136
|
-
{ type: "text", text: `Latest screen frame — seq ${row.seq}, ${row.width ?? "?"}px wide, ${ageSec}s old.` },
|
|
137
|
-
{ type: "image", data: row.image_jpeg, mimeType: "image/jpeg" },
|
|
138
|
-
],
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export const actionTools: MosaddTool[] = [
|
|
143
|
-
{
|
|
144
|
-
// RFC 0001: channel-agnostic capability (link is sent over ANY channel), so it
|
|
145
|
-
// lives in the `comms_` namespace rather than a channel `m<MODULE>_` prefix.
|
|
146
|
-
// A dedicated `mACT` module (create/get/status) is a possible RFC follow-up.
|
|
147
|
-
name: "comms_action_create",
|
|
148
|
-
title: "Create one-click action link",
|
|
149
|
-
annotations: { readOnlyHint: false },
|
|
150
|
-
requires: "network",
|
|
151
|
-
description:
|
|
152
|
-
"Mint a single-use, expiring action link (https://mosadd.com/do/<token>) that asks a human to DO something in their browser, with explicit consent. action_type: 'confirm' (yes/no) | 'file_request' (recipient picks a file from their computer) | 'form' (recipient fills fields you define) | 'open_url' (recipient opens a vetted https URL). Returns { action_id, token, link, expires_at }. Send the `link` to the person via mDM/mIRC/mp0st; they open it, consent, and the browser performs the action in its sandbox (no install, no OS access). The action is owned by you (the calling user). HONEST LIMITS: this is browser-sandbox only — it cannot click other apps, run programs, or read files the user didn't pick; and file_request payloads are not yet end-to-end encrypted (don't request sensitive files until Tier 1.1).",
|
|
153
|
-
inputSchema: action_create_input,
|
|
154
|
-
handler: action_create as MosaddTool["handler"],
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: "comms_action_frame_get",
|
|
158
|
-
title: "View shared screen frame",
|
|
159
|
-
annotations: { readOnlyHint: true },
|
|
160
|
-
requires: "network",
|
|
161
|
-
description:
|
|
162
|
-
"See the LATEST screen frame from a 'screen_share' action you created (pass the action_id from comms_action_create). Returns the current screenshot AS AN IMAGE you can look at, plus how old it is. The recipient must have opened the link and clicked 'share screen' first. Poll this every few seconds to watch live. VIEW ONLY — you cannot click or control their screen. Returns a 'no frame yet' note until they start sharing.",
|
|
163
|
-
inputSchema: action_frame_get_input,
|
|
164
|
-
handler: action_frame_get as MosaddTool["handler"],
|
|
165
|
-
},
|
|
166
|
-
];
|
|
1
|
+
/**
|
|
2
|
+
* Action links — agent → user one-link actions (Tier 1).
|
|
3
|
+
*
|
|
4
|
+
* Mint a single-use, expiring link (`https://mosadd.com/do/<token>`) that asks a
|
|
5
|
+
* human to DO something in their browser — confirm, pick a file, fill a form, or
|
|
6
|
+
* open a vetted URL — with explicit consent. Send the returned `link` to the
|
|
7
|
+
* person via any channel (mDM/mIRC/mp0st). They open it, see what's asked, consent,
|
|
8
|
+
* and the browser performs the action IN ITS SANDBOX, then the result is recorded
|
|
9
|
+
* against the action. No install, no OS access, nothing runs without a user gesture.
|
|
10
|
+
*
|
|
11
|
+
* Backend: mosadd `action-create` Edge Function. The action is owned by the
|
|
12
|
+
* calling user (user-JWT scoped — `mosadd login` / MOSADD_USER_JWT), so only you
|
|
13
|
+
* can later read its result.
|
|
14
|
+
*
|
|
15
|
+
* Result read-back (an `action_status` tool) is a follow-up — it needs a small
|
|
16
|
+
* creator-scoped read Edge Function (`action-status`). For now, the recipient's
|
|
17
|
+
* outcome is recorded on the action row; surface it once that EF ships.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { z } from "zod";
|
|
21
|
+
import type { MosaddTool, MosaddToolContext } from "../types.js";
|
|
22
|
+
import { invokeFunction, readSupabaseEnv, getSupabase } from "../providers/supabase.js";
|
|
23
|
+
|
|
24
|
+
const formField = z.object({
|
|
25
|
+
name: z.string().min(1).max(60).describe("Field key — returned verbatim in the result."),
|
|
26
|
+
label: z.string().max(120).optional().describe("Human label shown to the recipient. Defaults to `name`."),
|
|
27
|
+
type: z.enum(["text", "email", "number", "textarea", "tel", "url"]).optional().describe("Input type. Default 'text'."),
|
|
28
|
+
required: z.boolean().optional().describe("Whether the recipient must fill this field."),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const action_create_input = z.object({
|
|
32
|
+
action_type: z.enum(["confirm", "file_request", "form", "open_url", "screen_share"]).describe(
|
|
33
|
+
"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 — view only).",
|
|
34
|
+
),
|
|
35
|
+
message: z.string().min(1).max(2000).describe("What you're asking — shown on the consent screen above the action UI."),
|
|
36
|
+
creator_label: z.string().max(80).optional().describe("How you're identified to the recipient (e.g. your agent name). Default 'Agent'."),
|
|
37
|
+
// confirm
|
|
38
|
+
yes_label: z.string().max(40).optional().describe("[confirm] Affirmative button label. Default 'Tak'."),
|
|
39
|
+
no_label: z.string().max(40).optional().describe("[confirm] Negative button label. Default 'Nie'."),
|
|
40
|
+
// file_request
|
|
41
|
+
accept: z.string().max(200).optional().describe("[file_request] Accepted file types (HTML accept attr, e.g. 'image/*,.pdf')."),
|
|
42
|
+
max_bytes: z.number().int().positive().max(5_242_880).optional().describe("[file_request] Max file size in bytes (≤ 5 MB). NOTE: the returned file is NOT yet end-to-end encrypted — do not request sensitive files until Tier 1.1 ships."),
|
|
43
|
+
// form
|
|
44
|
+
fields: z.array(formField).min(1).max(20).optional().describe("[form] Fields to collect from the recipient."),
|
|
45
|
+
// open_url
|
|
46
|
+
url: z.string().url().optional().describe("[open_url] The https URL to open. The full URL is shown to the recipient before they open it."),
|
|
47
|
+
// screen_share
|
|
48
|
+
max_width: z.number().int().positive().max(1920).optional().describe("[screen_share] Max captured frame width in px (default 1280). Frames are downscaled JPEGs."),
|
|
49
|
+
// lifecycle
|
|
50
|
+
ttl_ms: z.number().int().positive().optional().describe("Link lifetime in milliseconds. Default 24h, capped at 7d."),
|
|
51
|
+
max_uses: z.number().int().min(1).max(50).optional().describe("How many times the link can be redeemed. Default 1 (single-use)."),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
function buildParams(input: z.infer<typeof action_create_input>): Record<string, unknown> {
|
|
55
|
+
switch (input.action_type) {
|
|
56
|
+
case "confirm":
|
|
57
|
+
return { message: input.message, yesLabel: input.yes_label, noLabel: input.no_label };
|
|
58
|
+
case "file_request":
|
|
59
|
+
return { message: input.message, accept: input.accept, maxBytes: input.max_bytes };
|
|
60
|
+
case "form":
|
|
61
|
+
if (!input.fields?.length) throw new Error("action_type 'form' requires a non-empty `fields` array.");
|
|
62
|
+
return { message: input.message, fields: input.fields };
|
|
63
|
+
case "open_url":
|
|
64
|
+
if (!input.url) throw new Error("action_type 'open_url' requires `url`.");
|
|
65
|
+
return { message: input.message, url: input.url };
|
|
66
|
+
case "screen_share":
|
|
67
|
+
return { message: input.message, maxWidth: input.max_width };
|
|
68
|
+
default:
|
|
69
|
+
return { message: input.message };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface ActionCreateResult {
|
|
74
|
+
action_id: string;
|
|
75
|
+
token: string;
|
|
76
|
+
link: string;
|
|
77
|
+
action_type: string;
|
|
78
|
+
expires_at: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async function action_create(
|
|
82
|
+
input: z.infer<typeof action_create_input>,
|
|
83
|
+
ctx: MosaddToolContext,
|
|
84
|
+
): Promise<ActionCreateResult> {
|
|
85
|
+
readSupabaseEnv();
|
|
86
|
+
ctx.log("debug", "action_create invoking action-create", { action_type: input.action_type });
|
|
87
|
+
|
|
88
|
+
const body: Record<string, unknown> = {
|
|
89
|
+
action_type: input.action_type,
|
|
90
|
+
params: buildParams(input),
|
|
91
|
+
};
|
|
92
|
+
if (input.creator_label !== undefined) body.creator_label = input.creator_label;
|
|
93
|
+
if (input.ttl_ms !== undefined) body.ttl_ms = input.ttl_ms;
|
|
94
|
+
if (input.max_uses !== undefined) body.max_uses = input.max_uses;
|
|
95
|
+
|
|
96
|
+
const res = await invokeFunction<Partial<ActionCreateResult> & { error?: string }>("action-create", body);
|
|
97
|
+
if (res.error) throw new Error(res.error);
|
|
98
|
+
if (!res.link || !res.token) throw new Error("action-create returned a malformed response (missing link/token).");
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
action_id: res.action_id ?? "",
|
|
102
|
+
token: res.token,
|
|
103
|
+
link: res.link,
|
|
104
|
+
action_type: res.action_type ?? input.action_type,
|
|
105
|
+
expires_at: res.expires_at ?? "",
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// ── comms_action_frame_get — read the latest screen frame (Tier 1.5) ──────────
|
|
110
|
+
const action_frame_get_input = z.object({
|
|
111
|
+
action_id: z.string().min(1).describe("The action_id returned by comms_action_create for a 'screen_share' action you created."),
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
async function action_frame_get(
|
|
115
|
+
input: z.infer<typeof action_frame_get_input>,
|
|
116
|
+
ctx: MosaddToolContext,
|
|
117
|
+
): Promise<{ mcpContent: Array<Record<string, unknown>> }> {
|
|
118
|
+
readSupabaseEnv();
|
|
119
|
+
ctx.log("debug", "action_frame_get reading frame", { action_id: input.action_id });
|
|
120
|
+
// Read directly via RLS ("creators read own frames") — the agent's JWT gates it
|
|
121
|
+
// to screen_share actions it created. No edge function needed.
|
|
122
|
+
const sb = getSupabase();
|
|
123
|
+
const { data, error } = await sb
|
|
124
|
+
.from("action_screen_frames")
|
|
125
|
+
.select("image_jpeg, width, seq, updated_at")
|
|
126
|
+
.eq("action_id", input.action_id)
|
|
127
|
+
.maybeSingle();
|
|
128
|
+
if (error) throw new Error(error.message);
|
|
129
|
+
if (!data) {
|
|
130
|
+
return { mcpContent: [{ type: "text", text: "No frame yet — the recipient hasn't started sharing their screen (or you don't own this action)." }] };
|
|
131
|
+
}
|
|
132
|
+
const row = data as { image_jpeg: string; width: number | null; seq: number; updated_at: string };
|
|
133
|
+
const ageSec = Math.round((Date.now() - new Date(row.updated_at).getTime()) / 1000);
|
|
134
|
+
return {
|
|
135
|
+
mcpContent: [
|
|
136
|
+
{ type: "text", text: `Latest screen frame — seq ${row.seq}, ${row.width ?? "?"}px wide, ${ageSec}s old.` },
|
|
137
|
+
{ type: "image", data: row.image_jpeg, mimeType: "image/jpeg" },
|
|
138
|
+
],
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export const actionTools: MosaddTool[] = [
|
|
143
|
+
{
|
|
144
|
+
// RFC 0001: channel-agnostic capability (link is sent over ANY channel), so it
|
|
145
|
+
// lives in the `comms_` namespace rather than a channel `m<MODULE>_` prefix.
|
|
146
|
+
// A dedicated `mACT` module (create/get/status) is a possible RFC follow-up.
|
|
147
|
+
name: "comms_action_create",
|
|
148
|
+
title: "Create one-click action link",
|
|
149
|
+
annotations: { readOnlyHint: false },
|
|
150
|
+
requires: "network",
|
|
151
|
+
description:
|
|
152
|
+
"Mint a single-use, expiring action link (https://mosadd.com/do/<token>) that asks a human to DO something in their browser, with explicit consent. action_type: 'confirm' (yes/no) | 'file_request' (recipient picks a file from their computer) | 'form' (recipient fills fields you define) | 'open_url' (recipient opens a vetted https URL). Returns { action_id, token, link, expires_at }. Send the `link` to the person via mDM/mIRC/mp0st; they open it, consent, and the browser performs the action in its sandbox (no install, no OS access). The action is owned by you (the calling user). HONEST LIMITS: this is browser-sandbox only — it cannot click other apps, run programs, or read files the user didn't pick; and file_request payloads are not yet end-to-end encrypted (don't request sensitive files until Tier 1.1).",
|
|
153
|
+
inputSchema: action_create_input,
|
|
154
|
+
handler: action_create as MosaddTool["handler"],
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: "comms_action_frame_get",
|
|
158
|
+
title: "View shared screen frame",
|
|
159
|
+
annotations: { readOnlyHint: true },
|
|
160
|
+
requires: "network",
|
|
161
|
+
description:
|
|
162
|
+
"See the LATEST screen frame from a 'screen_share' action you created (pass the action_id from comms_action_create). Returns the current screenshot AS AN IMAGE you can look at, plus how old it is. The recipient must have opened the link and clicked 'share screen' first. Poll this every few seconds to watch live. VIEW ONLY — you cannot click or control their screen. Returns a 'no frame yet' note until they start sharing.",
|
|
163
|
+
inputSchema: action_frame_get_input,
|
|
164
|
+
handler: action_frame_get as MosaddTool["handler"],
|
|
165
|
+
},
|
|
166
|
+
];
|