@mosadd/mcp 3.0.1 → 3.0.2
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 +5 -0
- package/dist/bin/mcp.js +1 -1
- package/dist/{chunk-J2S44U5R.js → chunk-I3FSPQ4G.js} +29 -6
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/__tests__/mirc-files.test.ts +80 -0
- package/src/providers/supabase-dm.ts +5 -0
- package/src/tools/mdm.ts +5 -2
- package/src/tools/mirc-messages.ts +7 -2
- package/src/tools/voice-format.ts +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,11 @@ and this project follows [Semantic Versioning](https://semver.org/). The `3.0.0-
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [3.0.2] — 2026-11-30
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- **Agents now see files sent in a conversation.** A screenshot or document sent with a message in a channel or a direct message used to come back from `mIRC_list_messages` / `mDM_list` as the message text alone. Both tools now return `attachments: [{name, mime, size, url}]`, where `url` is a fresh signed link valid for about an hour (fetch it to see the file). This covers files attached to a message and the older format where the file was written into the message as JSON. The link is made with the reader's own permissions, so someone outside the channel or the conversation gets no link. An encrypted file comes back with `encrypted: true` and no `url`.
|
|
14
|
+
|
|
10
15
|
## [3.0.1] — 2026-11-30
|
|
11
16
|
|
|
12
17
|
### Fixed
|
package/dist/bin/mcp.js
CHANGED
|
@@ -155,6 +155,23 @@ function voiceText(text, voice) {
|
|
|
155
155
|
const t = typeof voice.transcript === "string" ? voice.transcript.trim() : "";
|
|
156
156
|
return t ? `${marker} ${t}` : marker;
|
|
157
157
|
}
|
|
158
|
+
function attachmentsFrom(raw) {
|
|
159
|
+
if (!Array.isArray(raw)) return void 0;
|
|
160
|
+
const out = [];
|
|
161
|
+
for (const f of raw.slice(0, 20)) {
|
|
162
|
+
if (!f || typeof f !== "object") continue;
|
|
163
|
+
const r = f;
|
|
164
|
+
const url = typeof r.url === "string" && /^https:\/\//.test(r.url) ? r.url : null;
|
|
165
|
+
out.push({
|
|
166
|
+
name: typeof r.name === "string" && r.name ? r.name : "file",
|
|
167
|
+
mime: typeof r.mime === "string" && r.mime ? r.mime : "application/octet-stream",
|
|
168
|
+
size: typeof r.size === "number" && Number.isFinite(r.size) ? r.size : null,
|
|
169
|
+
url,
|
|
170
|
+
...r.encrypted === true ? { encrypted: true } : {}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
return out.length ? out : void 0;
|
|
174
|
+
}
|
|
158
175
|
|
|
159
176
|
// src/crypto/mdm-session.ts
|
|
160
177
|
import {
|
|
@@ -744,7 +761,8 @@ var SupabaseDmProvider = class {
|
|
|
744
761
|
recipientSelfPayload: m.recipient_self_payload ?? null,
|
|
745
762
|
transcript: m.transcript ?? null,
|
|
746
763
|
audioUrl: m.audio_url ?? null,
|
|
747
|
-
durationMs: m.duration_ms ?? null
|
|
764
|
+
durationMs: m.duration_ms ?? null,
|
|
765
|
+
files: attachmentsFrom(m.files)
|
|
748
766
|
})),
|
|
749
767
|
// history mode (`before`) returns `next_before`; incremental (`since`) returns `cursor`+`has_more`.
|
|
750
768
|
nextCursor: data?.next_before ?? (data?.has_more ? data?.cursor ?? null : null)
|
|
@@ -986,7 +1004,9 @@ async function mDM_list(input, ctx) {
|
|
|
986
1004
|
sender_identity_id: m.senderId,
|
|
987
1005
|
timestamp: m.timestamp,
|
|
988
1006
|
thread_id: m.threadId,
|
|
989
|
-
...voiceFields(m)
|
|
1007
|
+
...voiceFields(m),
|
|
1008
|
+
// 30.11: pliki (zrzut, dokument) z podpisanym adresem ~1 h — prawa czytającego (strona rozmowy)
|
|
1009
|
+
...m.files?.length ? { attachments: m.files } : {}
|
|
990
1010
|
};
|
|
991
1011
|
if (!isE2eeEnvelope(m.payload)) {
|
|
992
1012
|
return { ...base, text: formatVoiceIfAny(unpackPayload(m.payload).text), encrypted: false };
|
|
@@ -1144,7 +1164,7 @@ var mdmTools = [
|
|
|
1144
1164
|
title: "Read direct messages",
|
|
1145
1165
|
annotations: { readOnlyHint: true },
|
|
1146
1166
|
requires: "any",
|
|
1147
|
-
description:
|
|
1167
|
+
description: 'List recent direct messages with a specific contact. Pass contact_id as the identity_id from mDM_list_contacts. Decrypts end-to-end-encrypted messages from the contact automatically; legacy plaintext messages are shown as-is. Optionally filter to a single thread_label. FILES: a screenshot or document in the conversation comes back in `attachments: [{name, mime, size, url}]` \u2014 `url` is a signed link valid for about an hour, fetch it to see the file; an encrypted file has `encrypted: true` and no url. VOICE: a voice message has `voice: {transcript, audio_url, duration_ms}` and `text` reads "[voice note \u2014 25s] <transcript>".',
|
|
1148
1168
|
inputSchema: mDM_list_input,
|
|
1149
1169
|
handler: mDM_list
|
|
1150
1170
|
},
|
|
@@ -2044,12 +2064,15 @@ async function mIRC_list_messages(input, ctx) {
|
|
|
2044
2064
|
audioUrl: m.audio_url ?? null,
|
|
2045
2065
|
durationMs: m.duration_ms ?? null
|
|
2046
2066
|
});
|
|
2067
|
+
const pliki = attachmentsFrom(m.files);
|
|
2047
2068
|
messages.push({
|
|
2048
2069
|
id: m.id,
|
|
2049
2070
|
sender_identity_id: m.sender_identity_id,
|
|
2050
2071
|
text: voiceText(formatVoiceIfAny(await payloadToText(input.channel_id, m.encrypted_payload)), glos.voice),
|
|
2051
2072
|
timestamp: m.created_at,
|
|
2052
|
-
...glos
|
|
2073
|
+
...glos,
|
|
2074
|
+
// 30.11: zrzut / plik przy wiadomości — podpisany adres ~1 h z message-list, prawa czytającego (członek kanału)
|
|
2075
|
+
...pliki ? { attachments: pliki } : {}
|
|
2053
2076
|
});
|
|
2054
2077
|
}
|
|
2055
2078
|
return {
|
|
@@ -2072,7 +2095,7 @@ var mircMessagesTools = [
|
|
|
2072
2095
|
title: "Read channel messages",
|
|
2073
2096
|
annotations: { readOnlyHint: true },
|
|
2074
2097
|
requires: "network",
|
|
2075
|
-
description: "List recent text messages in a persistent channel (mIRC), newest first, cursor-paginated. Pass channel_id; the backing space is resolved automatically. ENCRYPTION: messages your line can decrypt (group-key channels \u2014 auto-provisioned key material) come back as readable text; everything else is decoded as written: the app's plain text and the toolkit's JSON envelope both come back as readable text (open channels such as coordination channels are never encrypted). Only a sealed group-key envelope your line holds no key for reads <ciphertext>.",
|
|
2098
|
+
description: "List recent text messages in a persistent channel (mIRC), newest first, cursor-paginated. Pass channel_id; the backing space is resolved automatically. ENCRYPTION: messages your line can decrypt (group-key channels \u2014 auto-provisioned key material) come back as readable text; everything else is decoded as written: the app's plain text and the toolkit's JSON envelope both come back as readable text (open channels such as coordination channels are never encrypted). Only a sealed group-key envelope your line holds no key for reads <ciphertext>. FILES: a screenshot or document sent with a message comes back in `attachments: [{name, mime, size, url}]` \u2014 `url` is a signed link valid for about an hour, fetch it to see the file; an encrypted file has `encrypted: true` and no url. VOICE: a voice message has `voice: {transcript, audio_url, duration_ms}` and `text` reads \"[voice note \u2014 25s] <transcript>\".",
|
|
2076
2099
|
inputSchema: mIRC_list_messages_input,
|
|
2077
2100
|
handler: mIRC_list_messages
|
|
2078
2101
|
}
|
|
@@ -3998,7 +4021,7 @@ var TOOL_COUNT = allTools.length;
|
|
|
3998
4021
|
// package.json
|
|
3999
4022
|
var package_default = {
|
|
4000
4023
|
name: "@mosadd/mcp",
|
|
4001
|
-
version: "3.0.
|
|
4024
|
+
version: "3.0.2",
|
|
4002
4025
|
mcpName: "io.github.hei33enberg/mosadd-mcp",
|
|
4003
4026
|
description: "Model Context Protocol server for mosadd. Exposes 4 modules (mDM, mIRC, mURL, mAYL) and capabilities (mTALK, mRAG) plus comms agent-actions \u2014 85 tools \u2014 to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
|
|
4004
4027
|
homepage: "https://github.com/Hei33enberg/mosADD-OS/tree/main/packages/mcp",
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mosadd/mcp",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"mcpName": "io.github.hei33enberg/mosadd-mcp",
|
|
5
5
|
"description": "Model Context Protocol server for mosadd. Exposes 4 modules (mDM, mIRC, mURL, mAYL) and capabilities (mTALK, mRAG) plus comms agent-actions — 85 tools — to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
|
|
6
6
|
"homepage": "https://github.com/Hei33enberg/mosADD-OS/tree/main/packages/mcp",
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 30.11.2026 — agenci nie widzieli plików od człowieka: zrzut wrzucony do kanału razem z wiadomością tekstową leży
|
|
3
|
+
* w metadanych wiadomości, message-list (mosADD) oddaje go jako `files` z podpisanym adresem (prawa czytającego),
|
|
4
|
+
* a mIRC_list_messages / mDM_list nie przenosiły tego pola — agent widział sam tekst.
|
|
5
|
+
*
|
|
6
|
+
* Pilnowane:
|
|
7
|
+
* 1. zrzut przy wiadomości tekstowej → attachments [{name, mime, size, url}] obok tekstu;
|
|
8
|
+
* 2. plik szyfrowany → encrypted:true, url null; adres nie-https odrzucony;
|
|
9
|
+
* 3. wiadomość bez plików → bez pola attachments;
|
|
10
|
+
* 4. mDM_list i dostawca mDM przenoszą to samo pole.
|
|
11
|
+
*
|
|
12
|
+
* SABOTAŻ (30.11): `...(pliki ? { attachments: pliki } : {})` wycięte z mirc-messages.ts → czerwone 1 i 2.
|
|
13
|
+
*/
|
|
14
|
+
import { readFileSync } from "node:fs";
|
|
15
|
+
import { describe, expect, it, vi } from "vitest";
|
|
16
|
+
import type { MosaddTool } from "../types.js";
|
|
17
|
+
|
|
18
|
+
const CHANNEL_ID = "6d0f1c1e-1111-4a2b-9c3d-000000000002";
|
|
19
|
+
const b64 = (s: string) => Buffer.from(s, "utf8").toString("base64");
|
|
20
|
+
const URL1 = "https://api.example/storage/v1/object/sign/chat-files/u1/c1/screenshot.png?token=t";
|
|
21
|
+
|
|
22
|
+
vi.mock("../crypto/channel-e2ee.js", () => ({
|
|
23
|
+
decryptChannelPayload: async () => null,
|
|
24
|
+
encryptChannelPayload: async () => null,
|
|
25
|
+
unwrapEnvelopeText: (s: string) => s,
|
|
26
|
+
}));
|
|
27
|
+
vi.mock("../providers/supabase.js", () => ({
|
|
28
|
+
readSupabaseEnv: () => ({ url: "https://example.supabase.co", anonKey: "anon", userJwt: "jwt" }),
|
|
29
|
+
invokeFunction: async (fn: string) => {
|
|
30
|
+
if (fn === "channel-manage") return { linked_space_id: "space-1" };
|
|
31
|
+
if (fn === "message-list") {
|
|
32
|
+
return {
|
|
33
|
+
messages: [
|
|
34
|
+
{ id: "m-zrzut", sender_identity_id: "czlowiek", encrypted_payload: b64("zobacz, tu jest źle"), created_at: "2026-11-30T03:30:41Z",
|
|
35
|
+
message_type: "txt", files: [{ name: "screenshot.png", mime: "image/png", size: 182044, url: URL1 }] },
|
|
36
|
+
{ id: "m-tajny", sender_identity_id: "czlowiek", encrypted_payload: b64("plik"), created_at: "2026-11-30T03:31:00Z",
|
|
37
|
+
message_type: "file", files: [{ name: "a.pdf", mime: "application/pdf", size: 10, url: null, encrypted: true },
|
|
38
|
+
{ name: "b.png", mime: "image/png", size: 1, url: "http://bez-tls.example/b.png" }] },
|
|
39
|
+
{ id: "m-txt", sender_identity_id: "czlowiek", encrypted_payload: b64("sam tekst"), created_at: "2026-11-30T03:32:00Z", message_type: "txt" },
|
|
40
|
+
],
|
|
41
|
+
next_before: null,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
throw new Error(`unexpected edge function ${fn}`);
|
|
45
|
+
},
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
const ctx = { log: () => {} } as never;
|
|
49
|
+
const { mircMessagesTools } = await import("../tools/mirc-messages.js");
|
|
50
|
+
const lista = mircMessagesTools.find((t) => t.name === "mIRC_list_messages") as MosaddTool;
|
|
51
|
+
const czytaj = async () => ((await lista.handler({ channel_id: CHANNEL_ID }, ctx)) as { messages: Array<Record<string, unknown>> }).messages;
|
|
52
|
+
|
|
53
|
+
describe("pliki w kanale docierają do agenta", () => {
|
|
54
|
+
it("1: zrzut przy wiadomości tekstowej → attachments z podpisanym adresem obok tekstu", async () => {
|
|
55
|
+
const m = (await czytaj()).find((x) => x.id === "m-zrzut")!;
|
|
56
|
+
expect(m.text).toBe("zobacz, tu jest źle");
|
|
57
|
+
expect(m.attachments).toEqual([{ name: "screenshot.png", mime: "image/png", size: 182044, url: URL1 }]);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("2: plik szyfrowany → encrypted:true bez url; adres nie-https odrzucony", async () => {
|
|
61
|
+
const m = (await czytaj()).find((x) => x.id === "m-tajny")!;
|
|
62
|
+
expect(m.attachments).toEqual([
|
|
63
|
+
{ name: "a.pdf", mime: "application/pdf", size: 10, url: null, encrypted: true },
|
|
64
|
+
{ name: "b.png", mime: "image/png", size: 1, url: null },
|
|
65
|
+
]);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("3: wiadomość bez plików → bez pola attachments", async () => {
|
|
69
|
+
const m = (await czytaj()).find((x) => x.id === "m-txt")!;
|
|
70
|
+
expect(m).not.toHaveProperty("attachments");
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("4: mDM_list i dostawca mDM przenoszą to samo pole", () => {
|
|
74
|
+
const prov = readFileSync(new URL("../providers/supabase-dm.ts", import.meta.url), "utf8");
|
|
75
|
+
const tool = readFileSync(new URL("../tools/mdm.ts", import.meta.url), "utf8");
|
|
76
|
+
expect(prov).toContain("files: attachmentsFrom(m.files)");
|
|
77
|
+
expect(tool).toContain("...(m.files?.length ? { attachments: m.files } : {})");
|
|
78
|
+
expect(lista.description).toContain("attachments: [{name, mime, size, url}]");
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -20,6 +20,7 @@ import type {
|
|
|
20
20
|
DmMessage,
|
|
21
21
|
} from "@mosadd/providers";
|
|
22
22
|
import { getSupabase, invokeFunction, readSupabaseEnv } from "./supabase.js";
|
|
23
|
+
import { attachmentsFrom, type MessageAttachment } from "../tools/voice-format.js";
|
|
23
24
|
|
|
24
25
|
const PROTOCOL_VERSION = "mosadd.chat.v1";
|
|
25
26
|
|
|
@@ -66,6 +67,8 @@ export interface DmMessageExt extends DmMessage {
|
|
|
66
67
|
transcript?: string | null;
|
|
67
68
|
audioUrl?: string | null;
|
|
68
69
|
durationMs?: number | null;
|
|
70
|
+
/** 30.11: pliki wiadomości z message-list (fileEnrich.ts w mosADD) — podpisany adres, prawa czytającego. */
|
|
71
|
+
files?: MessageAttachment[];
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
export class SupabaseDmProvider implements DmProvider {
|
|
@@ -178,6 +181,7 @@ export class SupabaseDmProvider implements DmProvider {
|
|
|
178
181
|
transcript?: string | null;
|
|
179
182
|
audio_url?: string | null;
|
|
180
183
|
duration_ms?: number | null;
|
|
184
|
+
files?: unknown;
|
|
181
185
|
}>;
|
|
182
186
|
cursor?: string | null;
|
|
183
187
|
has_more?: boolean;
|
|
@@ -204,6 +208,7 @@ export class SupabaseDmProvider implements DmProvider {
|
|
|
204
208
|
transcript: m.transcript ?? null,
|
|
205
209
|
audioUrl: m.audio_url ?? null,
|
|
206
210
|
durationMs: m.duration_ms ?? null,
|
|
211
|
+
files: attachmentsFrom(m.files),
|
|
207
212
|
})),
|
|
208
213
|
// history mode (`before`) returns `next_before`; incremental (`since`) returns `cursor`+`has_more`.
|
|
209
214
|
nextCursor: data?.next_before ?? (data?.has_more ? (data?.cursor ?? null) : null),
|
package/src/tools/mdm.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { z } from "zod";
|
|
18
18
|
import type { MosaddTool, MosaddToolContext } from "../types.js";
|
|
19
|
-
import { formatVoiceIfAny, voiceFields, voiceText } from "./voice-format.js";
|
|
19
|
+
import { formatVoiceIfAny, voiceFields, voiceText, type MessageAttachment } from "./voice-format.js";
|
|
20
20
|
import { invokeFunction, getSupabase, readSupabaseEnv } from "../providers/supabase.js";
|
|
21
21
|
import {
|
|
22
22
|
encryptForPeer,
|
|
@@ -403,6 +403,7 @@ async function mDM_list(
|
|
|
403
403
|
thread_id: string;
|
|
404
404
|
encrypted: boolean;
|
|
405
405
|
voice?: { transcript: string | null; audio_url: string | null; duration_ms: number | null };
|
|
406
|
+
attachments?: MessageAttachment[];
|
|
406
407
|
}>;
|
|
407
408
|
next_cursor: string | null;
|
|
408
409
|
threads: string[];
|
|
@@ -436,6 +437,8 @@ async function mDM_list(
|
|
|
436
437
|
timestamp: m.timestamp,
|
|
437
438
|
thread_id: m.threadId,
|
|
438
439
|
...voiceFields(m),
|
|
440
|
+
// 30.11: pliki (zrzut, dokument) z podpisanym adresem ~1 h — prawa czytającego (strona rozmowy)
|
|
441
|
+
...(m.files?.length ? { attachments: m.files } : {}),
|
|
439
442
|
};
|
|
440
443
|
// Legacy plaintext envelope (deprecated path) — unpack directly.
|
|
441
444
|
if (!isE2eeEnvelope(m.payload)) {
|
|
@@ -659,7 +662,7 @@ export const mdmTools: MosaddTool[] = [
|
|
|
659
662
|
annotations: { readOnlyHint: true },
|
|
660
663
|
requires: "any",
|
|
661
664
|
description:
|
|
662
|
-
"List recent direct messages with a specific contact. Pass contact_id as the identity_id from mDM_list_contacts. Decrypts end-to-end-encrypted messages from the contact automatically; legacy plaintext messages are shown as-is. Optionally filter to a single thread_label.",
|
|
665
|
+
"List recent direct messages with a specific contact. Pass contact_id as the identity_id from mDM_list_contacts. Decrypts end-to-end-encrypted messages from the contact automatically; legacy plaintext messages are shown as-is. Optionally filter to a single thread_label. FILES: a screenshot or document in the conversation comes back in `attachments: [{name, mime, size, url}]` — `url` is a signed link valid for about an hour, fetch it to see the file; an encrypted file has `encrypted: true` and no url. VOICE: a voice message has `voice: {transcript, audio_url, duration_ms}` and `text` reads \"[voice note — 25s] <transcript>\".",
|
|
663
666
|
inputSchema: mDM_list_input,
|
|
664
667
|
handler: mDM_list as MosaddTool["handler"],
|
|
665
668
|
},
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import type { MosaddTool, MosaddToolContext } from "../types.js";
|
|
13
13
|
import { invokeFunction, readSupabaseEnv } from "../providers/supabase.js";
|
|
14
|
-
import { formatVoiceIfAny, voiceFields, voiceText } from "./voice-format.js";
|
|
14
|
+
import { attachmentsFrom, formatVoiceIfAny, voiceFields, voiceText, type MessageAttachment } from "./voice-format.js";
|
|
15
15
|
import { decryptChannelPayload, encryptChannelPayload, unwrapEnvelopeText } from "../crypto/channel-e2ee.js";
|
|
16
16
|
import { decodeStoredPayloadText } from "./channel-payload.js";
|
|
17
17
|
|
|
@@ -141,6 +141,7 @@ type MircListedMessage = {
|
|
|
141
141
|
text: string;
|
|
142
142
|
timestamp: string;
|
|
143
143
|
voice?: { transcript: string | null; audio_url: string | null; duration_ms: number | null };
|
|
144
|
+
attachments?: MessageAttachment[];
|
|
144
145
|
};
|
|
145
146
|
|
|
146
147
|
async function mIRC_list_messages(
|
|
@@ -165,6 +166,7 @@ async function mIRC_list_messages(
|
|
|
165
166
|
transcript?: string | null;
|
|
166
167
|
audio_url?: string | null;
|
|
167
168
|
duration_ms?: number | null;
|
|
169
|
+
files?: unknown;
|
|
168
170
|
}>;
|
|
169
171
|
next_before?: string | null;
|
|
170
172
|
cursor?: string | null;
|
|
@@ -186,12 +188,15 @@ async function mIRC_list_messages(
|
|
|
186
188
|
audioUrl: m.audio_url ?? null,
|
|
187
189
|
durationMs: m.duration_ms ?? null,
|
|
188
190
|
});
|
|
191
|
+
const pliki = attachmentsFrom(m.files);
|
|
189
192
|
messages.push({
|
|
190
193
|
id: m.id,
|
|
191
194
|
sender_identity_id: m.sender_identity_id,
|
|
192
195
|
text: voiceText(formatVoiceIfAny(await payloadToText(input.channel_id, m.encrypted_payload)), glos.voice),
|
|
193
196
|
timestamp: m.created_at,
|
|
194
197
|
...glos,
|
|
198
|
+
// 30.11: zrzut / plik przy wiadomości — podpisany adres ~1 h z message-list, prawa czytającego (członek kanału)
|
|
199
|
+
...(pliki ? { attachments: pliki } : {}),
|
|
195
200
|
});
|
|
196
201
|
}
|
|
197
202
|
|
|
@@ -218,7 +223,7 @@ export const mircMessagesTools: MosaddTool[] = [
|
|
|
218
223
|
annotations: { readOnlyHint: true },
|
|
219
224
|
requires: "network",
|
|
220
225
|
description:
|
|
221
|
-
"List recent text messages in a persistent channel (mIRC), newest first, cursor-paginated. Pass channel_id; the backing space is resolved automatically. ENCRYPTION: messages your line can decrypt (group-key channels — auto-provisioned key material) come back as readable text; everything else is decoded as written: the app's plain text and the toolkit's JSON envelope both come back as readable text (open channels such as coordination channels are never encrypted). Only a sealed group-key envelope your line holds no key for reads <ciphertext>.",
|
|
226
|
+
"List recent text messages in a persistent channel (mIRC), newest first, cursor-paginated. Pass channel_id; the backing space is resolved automatically. ENCRYPTION: messages your line can decrypt (group-key channels — auto-provisioned key material) come back as readable text; everything else is decoded as written: the app's plain text and the toolkit's JSON envelope both come back as readable text (open channels such as coordination channels are never encrypted). Only a sealed group-key envelope your line holds no key for reads <ciphertext>. FILES: a screenshot or document sent with a message comes back in `attachments: [{name, mime, size, url}]` — `url` is a signed link valid for about an hour, fetch it to see the file; an encrypted file has `encrypted: true` and no url. VOICE: a voice message has `voice: {transcript, audio_url, duration_ms}` and `text` reads \"[voice note — 25s] <transcript>\".",
|
|
222
227
|
inputSchema: mIRC_list_messages_input,
|
|
223
228
|
handler: mIRC_list_messages as MosaddTool["handler"],
|
|
224
229
|
},
|
|
@@ -64,3 +64,26 @@ export function voiceText(
|
|
|
64
64
|
const t = typeof voice.transcript === "string" ? voice.transcript.trim() : "";
|
|
65
65
|
return t ? `${marker} ${t}` : marker;
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
/** 30.11.2026 — plik w wiadomości (zrzut przy tekście, mDM_send_file, stary JSON kompozytora): message-list (mosADD)
|
|
69
|
+
* oddaje `files` z podpisanym adresem (~1 h) uprawnieniami czytającego; tu idą do agenta jako `attachments`.
|
|
70
|
+
* Zaszyfrowany plik: `encrypted: true`, `url: null`. */
|
|
71
|
+
export type MessageAttachment = { name: string; mime: string; size: number | null; url: string | null; encrypted?: true };
|
|
72
|
+
|
|
73
|
+
export function attachmentsFrom(raw: unknown): MessageAttachment[] | undefined {
|
|
74
|
+
if (!Array.isArray(raw)) return undefined;
|
|
75
|
+
const out: MessageAttachment[] = [];
|
|
76
|
+
for (const f of raw.slice(0, 20)) {
|
|
77
|
+
if (!f || typeof f !== "object") continue;
|
|
78
|
+
const r = f as Record<string, unknown>;
|
|
79
|
+
const url = typeof r.url === "string" && /^https:\/\//.test(r.url) ? r.url : null;
|
|
80
|
+
out.push({
|
|
81
|
+
name: typeof r.name === "string" && r.name ? r.name : "file",
|
|
82
|
+
mime: typeof r.mime === "string" && r.mime ? r.mime : "application/octet-stream",
|
|
83
|
+
size: typeof r.size === "number" && Number.isFinite(r.size) ? r.size : null,
|
|
84
|
+
url,
|
|
85
|
+
...(r.encrypted === true ? { encrypted: true as const } : {}),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return out.length ? out : undefined;
|
|
89
|
+
}
|