@mosadd/mcp 3.0.0-alpha.12 → 3.0.0-alpha.14
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/README.md +2 -3
- package/dist/bin/mcp.js +1 -1
- package/dist/{chunk-GVHAKT62.js → chunk-I6MAQUMM.js} +26 -134
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
- package/src/tools/index.ts +5 -3
- package/src/tools/mail.ts +6 -2
- package/src/tools/mirc-members.ts +12 -4
- package/src/tools/mirc.ts +5 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
MCP server for [mosadd](https://mosadd.dev) — exposes the OS modules (m\*) as Model Context Protocol tools so any agent runtime can talk to mosadd: Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom.
|
|
4
4
|
|
|
5
|
-
> **3.0.0-alpha.4** — **
|
|
5
|
+
> **3.0.0-alpha.4** — **61 live tools across 6 live modules** (mDM incl. voice, mIRC, mROOM, mAIL, mTALK, mRAG) + the `comms_capabilities` discovery tool, wired to the mosadd backend (BYOK) as a strangler-fig step. Phase 2 routes through the hosted gateway at `mcp.mosadd.com` with the 166-event radar in front.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -53,7 +53,7 @@ In Phase 2, run `mosadd login` to OAuth into hub.mosadd.com — no JWT-juggling
|
|
|
53
53
|
|
|
54
54
|
## Tools shipped in alpha
|
|
55
55
|
|
|
56
|
-
**
|
|
56
|
+
**61 live tools across 6 live modules** (mDM, mIRC, mROOM, mAIL, mTALK, mRAG) + the `comms_capabilities` discovery tool. Highlights per module:
|
|
57
57
|
|
|
58
58
|
| Module | Tools | What it does |
|
|
59
59
|
|---|---|---|
|
|
@@ -63,7 +63,6 @@ In Phase 2, run `mosadd login` to OAuth into hub.mosadd.com — no JWT-juggling
|
|
|
63
63
|
| **mTALK** (5) | `mTALK_open`, `mTALK_join`, `mTALK_press`, `mTALK_release`, `mTALK_state` | Half-duplex push-to-talk: one speaker, FIFO queue, anti-hog auto-release |
|
|
64
64
|
| **mAIL** (11) | `mAIL_send`, `mAIL_view`, `mAIL_list`, `mAIL_delete`, `mAIL_stats`, `mAIL_events`, `mAIL_metrics`, `mAIL_revoke`, `mAIL_audit_export`, `mAIL_consent`, `mAIL_notify` | Mail; every user gets `<id>@mosadd.com`. `mAIL_revoke` recalls secure-reader access; `mAIL_audit_export` emits an HMAC-SHA256-signed engagement audit; `mAIL_consent` manages recipient tracking opt-outs (GDPR); `mAIL_notify` pulls the inbound-mail notification feed |
|
|
65
65
|
| **mRAG** (4) | `mRAG_ingest`, `mRAG_search`, `mRAG_list_sources`, `mRAG_delete` | RAG recall over the user's own data (hybrid vector + BM25) |
|
|
66
|
-
| **mURL** (4) | `mURL_read_channel`, `mURL_post`, `mURL_presence`, `mURL_list_channels` | Real-time chat attached to any web domain — agent-native ("IRC for URLs"). The per-domain room is never empty because agents read context + leave findings via MCP |
|
|
67
66
|
|
|
68
67
|
All tool names follow [RFC 0001](https://github.com/Hei33enberg/mosadd-os/blob/main/docs/rfcs/0001-module-naming.md) — `m<MODULE>_<operation>` snake_case.
|
|
69
68
|
|
package/dist/bin/mcp.js
CHANGED
|
@@ -734,9 +734,11 @@ async function mIRC_get(input, ctx) {
|
|
|
734
734
|
async function mIRC_update(input, ctx) {
|
|
735
735
|
readSupabaseEnv();
|
|
736
736
|
ctx.log("debug", "mIRC_update invoking channel-manage", { channel_id: input.channel_id });
|
|
737
|
+
const { topic, ...rest } = input;
|
|
738
|
+
const payload = topic !== void 0 ? { ...rest, description: topic } : { ...rest };
|
|
737
739
|
return await invokeFunction("channel-manage", {
|
|
738
740
|
action: "update",
|
|
739
|
-
...
|
|
741
|
+
...payload
|
|
740
742
|
});
|
|
741
743
|
}
|
|
742
744
|
async function mIRC_delete(input, ctx) {
|
|
@@ -790,7 +792,7 @@ var mircTools = [
|
|
|
790
792
|
import { z as z4 } from "zod";
|
|
791
793
|
var ChannelId2 = z4.string().min(1).max(120).describe("Channel id (UUID). From mIRC_list / mIRC_create.");
|
|
792
794
|
var MemberIdentity = z4.string().min(1).describe("Target user's identity id (UUID). From mDM_list_contacts or radar logs.");
|
|
793
|
-
var Role = z4.enum(["
|
|
795
|
+
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.");
|
|
794
796
|
var mIRC_join_input = z4.object({
|
|
795
797
|
channel_id: ChannelId2,
|
|
796
798
|
password: z4.string().min(1).optional().describe("Required if the channel is access_mode=private.")
|
|
@@ -834,9 +836,22 @@ var mIRC_set_ptt_input = z4.object({
|
|
|
834
836
|
ptt_enabled: z4.boolean().describe("Allow this member to hold the PTT floor in voice mode.")
|
|
835
837
|
});
|
|
836
838
|
async function invokeChannelMembers(action, body, ctx) {
|
|
839
|
+
const b = { ...body };
|
|
840
|
+
if ("identity_id" in b) {
|
|
841
|
+
b.target_identity_id = b.identity_id;
|
|
842
|
+
delete b.identity_id;
|
|
843
|
+
}
|
|
844
|
+
if ("role" in b) {
|
|
845
|
+
b.new_role = b.role;
|
|
846
|
+
delete b.role;
|
|
847
|
+
}
|
|
848
|
+
if ("ptt_enabled" in b) {
|
|
849
|
+
b.can_ptt = b.ptt_enabled;
|
|
850
|
+
delete b.ptt_enabled;
|
|
851
|
+
}
|
|
837
852
|
readSupabaseEnv();
|
|
838
|
-
ctx.log("debug", `mIRC.${action}`,
|
|
839
|
-
return await invokeFunction("channel-members-manage", { action, ...
|
|
853
|
+
ctx.log("debug", `mIRC.${action}`, b);
|
|
854
|
+
return await invokeFunction("channel-members-manage", { action, ...b });
|
|
840
855
|
}
|
|
841
856
|
var mircMembersTools = [
|
|
842
857
|
{
|
|
@@ -1415,7 +1430,9 @@ async function mAIL_send(input, ctx) {
|
|
|
1415
1430
|
throw new Error("mAIL_send requires at least one of body_text or body_html.");
|
|
1416
1431
|
}
|
|
1417
1432
|
ctx.log("debug", "mAIL_send invoking mp0st-send", { to: input.to });
|
|
1418
|
-
|
|
1433
|
+
const res = await invokeFunction("mp0st-send", input);
|
|
1434
|
+
if (res.error) throw new Error(res.error);
|
|
1435
|
+
return { message_id: res.email_id ?? "", status: res.status ?? "sent", is_internal: res.is_internal ?? false };
|
|
1419
1436
|
}
|
|
1420
1437
|
async function mAIL_view(input, ctx) {
|
|
1421
1438
|
readSupabaseEnv();
|
|
@@ -1726,133 +1743,8 @@ var knowledgeTools = [
|
|
|
1726
1743
|
}
|
|
1727
1744
|
];
|
|
1728
1745
|
|
|
1729
|
-
// src/tools/murl.ts
|
|
1730
|
-
import { z as z12 } from "zod";
|
|
1731
|
-
var DEFAULT_EDGE_URL2 = "https://mosadd-edge.mr-brics-33.workers.dev";
|
|
1732
|
-
function edgeUrl2() {
|
|
1733
|
-
return process.env.MOSADD_EDGE_URL?.replace(/\/$/, "") ?? DEFAULT_EDGE_URL2;
|
|
1734
|
-
}
|
|
1735
|
-
function hubKey2() {
|
|
1736
|
-
const key = process.env.MOSADD_API_KEY ?? process.env.MOSADD_HUB_KEY ?? "";
|
|
1737
|
-
if (!key) throw new Error("MOSADD_API_KEY required for mURL tools (see `mosadd login` / hub-keys).");
|
|
1738
|
-
return key;
|
|
1739
|
-
}
|
|
1740
|
-
function domainToSlug(input) {
|
|
1741
|
-
let host = String(input).trim().toLowerCase();
|
|
1742
|
-
host = host.replace(/^[a-z]+:\/\//, "").replace(/[/?#].*$/, "").replace(/:\d+$/, "");
|
|
1743
|
-
if (host.startsWith("www.")) host = host.slice(4);
|
|
1744
|
-
if (!host || !/^[a-z0-9-]+(\.[a-z0-9-]+)+$/.test(host)) {
|
|
1745
|
-
throw new Error(`Invalid domain: "${input}" \u2014 pass a domain like "example.com" or a URL.`);
|
|
1746
|
-
}
|
|
1747
|
-
return { domain: host, slug: host.replace(/\./g, "-") };
|
|
1748
|
-
}
|
|
1749
|
-
var DomainArg = z12.string().min(3).max(255).describe("A domain (e.g. 'example.com') or a full URL \u2014 the channel is keyed to the domain.");
|
|
1750
|
-
var mURL_read_channel_input = z12.object({
|
|
1751
|
-
domain: DomainArg,
|
|
1752
|
-
limit: z12.number().int().min(1).max(100).optional().describe("Recent messages to return (max 100). Default 50.")
|
|
1753
|
-
});
|
|
1754
|
-
async function mURL_read_channel(input, ctx) {
|
|
1755
|
-
const { domain, slug: slug2 } = domainToSlug(input.domain);
|
|
1756
|
-
const limit = input.limit ?? 50;
|
|
1757
|
-
ctx.log("debug", "mURL_read_channel", { domain });
|
|
1758
|
-
const r = await fetch(`${edgeUrl2()}/c/${slug2}/history?limit=${limit}`, {
|
|
1759
|
-
headers: { Authorization: `Bearer ${hubKey2()}` }
|
|
1760
|
-
});
|
|
1761
|
-
if (!r.ok) {
|
|
1762
|
-
const e = await r.text().catch(() => "");
|
|
1763
|
-
throw new Error(`mosadd-edge ${r.status}: ${e.slice(0, 200)}`);
|
|
1764
|
-
}
|
|
1765
|
-
const data = await r.json();
|
|
1766
|
-
return {
|
|
1767
|
-
domain,
|
|
1768
|
-
messages: (data.messages ?? []).map((m) => ({ id: m.id, from: m.from ?? null, text: m.text, timestamp: m.ts }))
|
|
1769
|
-
};
|
|
1770
|
-
}
|
|
1771
|
-
var mURL_post_input = z12.object({
|
|
1772
|
-
domain: DomainArg,
|
|
1773
|
-
text: z12.string().min(1).max(2e3).describe("Message body (max 2000 chars, up to 3 lines \u2014 Worker-enforced)."),
|
|
1774
|
-
from: z12.string().max(120).optional().describe("Sender hint shown to others (defaults to the hub-key owner / your agent name).")
|
|
1775
|
-
});
|
|
1776
|
-
async function mURL_post(input, ctx) {
|
|
1777
|
-
const { domain, slug: slug2 } = domainToSlug(input.domain);
|
|
1778
|
-
ctx.log("debug", "mURL_post", { domain });
|
|
1779
|
-
const r = await fetch(`${edgeUrl2()}/c/${slug2}/send`, {
|
|
1780
|
-
method: "POST",
|
|
1781
|
-
headers: { "Content-Type": "application/json", Authorization: `Bearer ${hubKey2()}` },
|
|
1782
|
-
body: JSON.stringify({ text: input.text, from: input.from })
|
|
1783
|
-
});
|
|
1784
|
-
if (!r.ok) {
|
|
1785
|
-
const e = await r.text().catch(() => "");
|
|
1786
|
-
throw new Error(`mosadd-edge ${r.status}: ${e.slice(0, 200)}`);
|
|
1787
|
-
}
|
|
1788
|
-
const data = await r.json();
|
|
1789
|
-
if (!data?.id) throw new Error("mosadd-edge: send returned no id");
|
|
1790
|
-
return { domain, message_id: data.id, posted_at: data.ts ?? Date.now() };
|
|
1791
|
-
}
|
|
1792
|
-
var mURL_list_channels_input = z12.object({
|
|
1793
|
-
action: z12.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)."),
|
|
1794
|
-
limit: z12.number().int().min(1).max(100).optional().describe("Max channels to return. Default 20."),
|
|
1795
|
-
hours: z12.number().int().min(1).max(168).optional().describe("Trending window in hours. Default 24, max 168 (7d)."),
|
|
1796
|
-
status: z12.enum(["open", "claimed", "blocked"]).optional().describe("For action='list': filter (default 'open')."),
|
|
1797
|
-
cursor: z12.string().optional().describe("For action='list': pagination \u2014 pass previous response's next_cursor (created_at ISO).")
|
|
1798
|
-
});
|
|
1799
|
-
async function mURL_list_channels(input, ctx) {
|
|
1800
|
-
readSupabaseEnv();
|
|
1801
|
-
const action = input.action ?? "trending";
|
|
1802
|
-
ctx.log("debug", "mURL_list_channels invoking murl-channels", { action });
|
|
1803
|
-
return await invokeFunction("murl-channels", {
|
|
1804
|
-
action,
|
|
1805
|
-
limit: input.limit ?? null,
|
|
1806
|
-
hours: input.hours ?? null,
|
|
1807
|
-
status: input.status ?? null,
|
|
1808
|
-
cursor: input.cursor ?? null
|
|
1809
|
-
});
|
|
1810
|
-
}
|
|
1811
|
-
var mURL_presence_input = z12.object({ domain: DomainArg });
|
|
1812
|
-
async function mURL_presence(input, ctx) {
|
|
1813
|
-
const { domain, slug: slug2 } = domainToSlug(input.domain);
|
|
1814
|
-
ctx.log("debug", "mURL_presence", { domain });
|
|
1815
|
-
const r = await fetch(`${edgeUrl2()}/c/${slug2}/presence`);
|
|
1816
|
-
if (!r.ok) {
|
|
1817
|
-
const e = await r.text().catch(() => "");
|
|
1818
|
-
throw new Error(`mosadd-edge ${r.status}: ${e.slice(0, 200)}`);
|
|
1819
|
-
}
|
|
1820
|
-
const data = await r.json();
|
|
1821
|
-
return { domain, count: data.count ?? 0, roster: data.roster ?? [], status: data.status ?? "open" };
|
|
1822
|
-
}
|
|
1823
|
-
var murlTools = [
|
|
1824
|
-
{
|
|
1825
|
-
name: "mURL_read_channel",
|
|
1826
|
-
requires: "network",
|
|
1827
|
-
description: "Read the live chat channel for a web DOMAIN (mURL \u2014 'IRC for URLs'). Returns the most recent messages humans and agents have posted about that domain. Use it to get real-time, crowd-sourced context before acting on a site \u2014 e.g. scam warnings, promo codes, outage reports, 'is this legit?'. The channel auto-exists for any domain. Auth: MOSADD_API_KEY (hub key).",
|
|
1828
|
-
inputSchema: mURL_read_channel_input,
|
|
1829
|
-
handler: mURL_read_channel
|
|
1830
|
-
},
|
|
1831
|
-
{
|
|
1832
|
-
name: "mURL_post",
|
|
1833
|
-
requires: "network",
|
|
1834
|
-
description: "Post a message into a web DOMAIN's mURL chat channel \u2014 leave context for the humans and agents who visit that site next (a finding, warning, tip, or coordination note). Sub-100ms global fan-out to everyone currently on the channel. Auth: MOSADD_API_KEY (hub key).",
|
|
1835
|
-
inputSchema: mURL_post_input,
|
|
1836
|
-
handler: mURL_post
|
|
1837
|
-
},
|
|
1838
|
-
{
|
|
1839
|
-
name: "mURL_presence",
|
|
1840
|
-
requires: "network",
|
|
1841
|
-
description: "Who is on a domain's mURL channel right now: live participant count + roster nicknames + channel status (open/claimed/blocked). Public (no key needed). Use it to gauge whether a domain has an active audience before posting.",
|
|
1842
|
-
inputSchema: mURL_presence_input,
|
|
1843
|
-
handler: mURL_presence
|
|
1844
|
-
},
|
|
1845
|
-
{
|
|
1846
|
-
name: "mURL_list_channels",
|
|
1847
|
-
requires: "network",
|
|
1848
|
-
description: "Discovery for mURL domain channels: 'trending' (most active in the last N hours, default 24) / 'list' (paginated catalogue, status-filtered) / 'mine' (channels you DNS-verified). Returns domain, slug, status, branding, verified_at + (for trending) messages_in_window. For who's-on-now, follow up with mURL_presence on the slug.",
|
|
1849
|
-
inputSchema: mURL_list_channels_input,
|
|
1850
|
-
handler: mURL_list_channels
|
|
1851
|
-
}
|
|
1852
|
-
];
|
|
1853
|
-
|
|
1854
1746
|
// src/tools/capabilities.ts
|
|
1855
|
-
import { z as
|
|
1747
|
+
import { z as z12 } from "zod";
|
|
1856
1748
|
var CONTRACT_VERSION = "1.0.0";
|
|
1857
1749
|
var ALL_REQUIREMENTS = ["any", "radio", "network"];
|
|
1858
1750
|
function buildCapabilityManifest(tools) {
|
|
@@ -1875,7 +1767,7 @@ function makeCapabilitiesTool(channelTools2) {
|
|
|
1875
1767
|
name: "comms_capabilities",
|
|
1876
1768
|
requires: "any",
|
|
1877
1769
|
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.",
|
|
1878
|
-
inputSchema:
|
|
1770
|
+
inputSchema: z12.object({}),
|
|
1879
1771
|
handler: async () => buildCapabilityManifest([...channelTools2, tool])
|
|
1880
1772
|
};
|
|
1881
1773
|
return tool;
|
|
@@ -1893,8 +1785,8 @@ var channelTools = [
|
|
|
1893
1785
|
...mroomMessagesTools,
|
|
1894
1786
|
...mailTools,
|
|
1895
1787
|
...mtalkTools,
|
|
1896
|
-
...knowledgeTools
|
|
1897
|
-
...murlTools
|
|
1788
|
+
...knowledgeTools
|
|
1789
|
+
// ...murlTools, // mURL: brand/consumer surface (murl.mosadd.com), not a dev product
|
|
1898
1790
|
// ...mcallTools, // mCALL: carrier-pending (no telephony carrier live) — re-register when a carrier is configured
|
|
1899
1791
|
// mirlTools,
|
|
1900
1792
|
// mmatrixTools, mdiscordTools, mtelegramTools, mslackTools, msignalTools,
|
package/dist/index.d.ts
CHANGED
|
@@ -195,7 +195,9 @@ declare function createMosaddServer(options?: MosaddServerOptions): McpServer;
|
|
|
195
195
|
/**
|
|
196
196
|
* Tool registry. Each m* module contributes a set of tools.
|
|
197
197
|
*
|
|
198
|
-
* Live modules (
|
|
198
|
+
* Live modules (6): mDM, mIRC, mROOM, mTALK, mAIL, mRAG — 61 tools + comms_capabilities.
|
|
199
|
+
* mURL is a consumer/brand surface (murl.mosadd.com), NOT a dev product — its tools
|
|
200
|
+
* live in tools/murl.ts but are NOT registered here (founder decision 2026-06-10).
|
|
199
201
|
* mCALL is carrier-pending (no telephony carrier live yet): its tools live in
|
|
200
202
|
* tools/mcall.ts but are NOT registered here, so an agent only ever discovers
|
|
201
203
|
* tools that actually work. Re-register the one line below when a carrier ships.
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mosadd/mcp",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
4
|
-
"description": "Model Context Protocol server for mosadd. Exposes the
|
|
3
|
+
"version": "3.0.0-alpha.14",
|
|
4
|
+
"description": "Model Context Protocol server for mosadd. Exposes the 6 live m* modules (mDM, mIRC, mROOM, mTALK, mAIL, mRAG) — 61 tools — to any agent runtime (Claude Code, Cursor, Windsurf, Cline, ChatGPT Apps, Lovable, Bolt, Goose, Manus, custom).",
|
|
5
5
|
"homepage": "https://github.com/Hei33enberg/mosadd-os/tree/main/packages/mcp",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@supabase/supabase-js": "^2.48.0",
|
|
38
38
|
"zod": "^4.3.6",
|
|
39
39
|
"@mosadd/crypto": "3.0.0-alpha.4",
|
|
40
|
-
"@mosadd/
|
|
41
|
-
"@mosadd/
|
|
40
|
+
"@mosadd/providers": "3.0.0-alpha.4",
|
|
41
|
+
"@mosadd/protocol": "3.0.0-alpha.4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"tsup": "^8.3.5",
|
package/src/tools/index.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool registry. Each m* module contributes a set of tools.
|
|
3
3
|
*
|
|
4
|
-
* Live modules (
|
|
4
|
+
* Live modules (6): mDM, mIRC, mROOM, mTALK, mAIL, mRAG — 61 tools + comms_capabilities.
|
|
5
|
+
* mURL is a consumer/brand surface (murl.mosadd.com), NOT a dev product — its tools
|
|
6
|
+
* live in tools/murl.ts but are NOT registered here (founder decision 2026-06-10).
|
|
5
7
|
* mCALL is carrier-pending (no telephony carrier live yet): its tools live in
|
|
6
8
|
* tools/mcall.ts but are NOT registered here, so an agent only ever discovers
|
|
7
9
|
* tools that actually work. Re-register the one line below when a carrier ships.
|
|
@@ -20,7 +22,7 @@ import { mailTools } from "./mail.js";
|
|
|
20
22
|
import { mtalkTools } from "./mtalk.js";
|
|
21
23
|
// import { mcallTools } from "./mcall.js"; // mCALL: carrier-pending — not registered (see header note)
|
|
22
24
|
import { knowledgeTools } from "./knowledge.js";
|
|
23
|
-
import { murlTools } from "./murl.js";
|
|
25
|
+
// import { murlTools } from "./murl.js"; // mURL: brand/consumer surface, not a dev product — not registered
|
|
24
26
|
import { makeCapabilitiesTool } from "./capabilities.js";
|
|
25
27
|
|
|
26
28
|
/** The m* channel tools (everything except the meta discovery tool). */
|
|
@@ -36,7 +38,7 @@ const channelTools: MosaddTool[] = [
|
|
|
36
38
|
...mailTools,
|
|
37
39
|
...mtalkTools,
|
|
38
40
|
...knowledgeTools,
|
|
39
|
-
...murlTools,
|
|
41
|
+
// ...murlTools, // mURL: brand/consumer surface (murl.mosadd.com), not a dev product
|
|
40
42
|
// ...mcallTools, // mCALL: carrier-pending (no telephony carrier live) — re-register when a carrier is configured
|
|
41
43
|
// mirlTools,
|
|
42
44
|
// mmatrixTools, mdiscordTools, mtelegramTools, mslackTools, msignalTools,
|
package/src/tools/mail.ts
CHANGED
|
@@ -127,13 +127,17 @@ interface MailListItem {
|
|
|
127
127
|
async function mAIL_send(
|
|
128
128
|
input: z.infer<typeof mAIL_send_input>,
|
|
129
129
|
ctx: MosaddToolContext,
|
|
130
|
-
): Promise<{ message_id: string;
|
|
130
|
+
): Promise<{ message_id: string; status: string; is_internal: boolean }> {
|
|
131
131
|
readSupabaseEnv();
|
|
132
132
|
if (!input.body_text && !input.body_html) {
|
|
133
133
|
throw new Error("mAIL_send requires at least one of body_text or body_html.");
|
|
134
134
|
}
|
|
135
135
|
ctx.log("debug", "mAIL_send invoking mp0st-send", { to: input.to });
|
|
136
|
-
|
|
136
|
+
// mp0st-send returns { ok, email_id, status, is_internal } — remap email_id to the
|
|
137
|
+
// tool's message_id contract (email_id IS the message id). Surface backend errors.
|
|
138
|
+
const res = await invokeFunction<{ ok?: boolean; email_id?: string; status?: string; is_internal?: boolean; error?: string }>("mp0st-send", input);
|
|
139
|
+
if (res.error) throw new Error(res.error);
|
|
140
|
+
return { message_id: res.email_id ?? "", status: res.status ?? "sent", is_internal: res.is_internal ?? false };
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
async function mAIL_view(
|
|
@@ -28,8 +28,8 @@ const MemberIdentity = z
|
|
|
28
28
|
.describe("Target user's identity id (UUID). From mDM_list_contacts or radar logs.");
|
|
29
29
|
|
|
30
30
|
const Role = z
|
|
31
|
-
.enum(["
|
|
32
|
-
.describe("
|
|
31
|
+
.enum(["superadmin", "admin", "moderator", "member"])
|
|
32
|
+
.describe("Role to assign. owner = channel creator (not assignable); promote up to one tier below your own.");
|
|
33
33
|
|
|
34
34
|
const mIRC_join_input = z.object({
|
|
35
35
|
channel_id: ChannelId,
|
|
@@ -90,9 +90,17 @@ async function invokeChannelMembers(
|
|
|
90
90
|
body: Record<string, unknown>,
|
|
91
91
|
ctx: MosaddToolContext,
|
|
92
92
|
): Promise<unknown> {
|
|
93
|
+
// Map the toolkit's intuitive input field names to the exact ones the
|
|
94
|
+
// channel-members-manage Edge Function reads. Without this, kick/ban/unban/
|
|
95
|
+
// set-role/set-ptt all 400 ("target_identity_id required"), set-role is
|
|
96
|
+
// ignored, and set-ptt silently disables PTT (missing can_ptt → false).
|
|
97
|
+
const b: Record<string, unknown> = { ...body };
|
|
98
|
+
if ("identity_id" in b) { b.target_identity_id = b.identity_id; delete b.identity_id; }
|
|
99
|
+
if ("role" in b) { b.new_role = b.role; delete b.role; }
|
|
100
|
+
if ("ptt_enabled" in b) { b.can_ptt = b.ptt_enabled; delete b.ptt_enabled; }
|
|
93
101
|
readSupabaseEnv();
|
|
94
|
-
ctx.log("debug", `mIRC.${action}`,
|
|
95
|
-
return await invokeFunction("channel-members-manage", { action, ...
|
|
102
|
+
ctx.log("debug", `mIRC.${action}`, b);
|
|
103
|
+
return await invokeFunction("channel-members-manage", { action, ...b });
|
|
96
104
|
}
|
|
97
105
|
|
|
98
106
|
// ---- Registration ----
|
package/src/tools/mirc.ts
CHANGED
|
@@ -108,9 +108,13 @@ async function mIRC_update(
|
|
|
108
108
|
): Promise<{ channel: unknown }> {
|
|
109
109
|
readSupabaseEnv();
|
|
110
110
|
ctx.log("debug", "mIRC_update invoking channel-manage", { channel_id: input.channel_id });
|
|
111
|
+
// channel-manage reads `description`, not `topic` — map it so topic edits aren't
|
|
112
|
+
// silently dropped.
|
|
113
|
+
const { topic, ...rest } = input as typeof input & { topic?: string };
|
|
114
|
+
const payload = topic !== undefined ? { ...rest, description: topic } : { ...rest };
|
|
111
115
|
return await invokeFunction<{ channel: unknown }>("channel-manage", {
|
|
112
116
|
action: "update",
|
|
113
|
-
...
|
|
117
|
+
...payload,
|
|
114
118
|
});
|
|
115
119
|
}
|
|
116
120
|
|