@mosadd/mcp 3.0.0-alpha.55 → 3.0.0-alpha.56
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 -11
- package/LICENSE +21 -0
- package/README.md +151 -150
- package/dist/bin/mcp.js +1 -1
- package/dist/{chunk-IWUGKLDX.js → chunk-T3KDVUAT.js} +14 -10
- package/dist/index.js +1 -1
- package/package.json +10 -10
- 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 +2 -2
- package/src/__tests__/golden-path.test.ts +139 -139
- package/src/__tests__/integration.test.ts +209 -182
- package/src/__tests__/mdm-e2ee.test.ts +212 -212
- package/src/__tests__/mdm-mcp-readable.test.ts +390 -390
- package/src/__tests__/mirc-invite.test.ts +112 -112
- package/src/__tests__/mtalk.test.ts +122 -122
- package/src/__tests__/presence.test.ts +199 -199
- package/src/__tests__/server.test.ts +71 -71
- package/src/__tests__/tool-count-consistency.test.ts +255 -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 -842
- package/src/index.ts +19 -19
- package/src/observability/sentry.ts +79 -79
- package/src/providers/blob-upload.ts +162 -162
- package/src/providers/memory-voice.ts +79 -79
- package/src/providers/supabase-dm.ts +202 -202
- package/src/providers/supabase-voice.ts +91 -91
- package/src/server.ts +195 -195
- 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 +2 -2
- 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 +138 -126
- package/src/tools/mdm.ts +3 -3
- package/src/tools/mirc-edge.ts +196 -196
- package/src/tools/mirc-members.ts +287 -287
- package/src/tools/mirc-messages.ts +1 -1
- package/src/tools/mirc.ts +308 -308
- 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
|
@@ -1,199 +1,255 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { dirname, resolve } from "node:path";
|
|
5
|
-
import { TOOL_COUNT, allTools } from "../tools/index.js";
|
|
6
|
-
|
|
7
|
-
// ── Anti-drift gate ──────────────────────────────────────────────────────────
|
|
8
|
-
// The advertised tool count has drifted across surfaces repeatedly (68/69/65/61/
|
|
9
|
-
// "70+"), which the founder rightly hates. TOOL_COUNT (= allTools.length) is the ONE
|
|
10
|
-
// source of truth; every hardcoded doc surface must equal it. If you add/remove a
|
|
11
|
-
// tool, this test fails until you update the surfaces below (or vice-versa).
|
|
12
|
-
//
|
|
13
|
-
// NOT checked here: the mosADD app's LP `McpToolReference` computes its total
|
|
14
|
-
// dynamically from the rendered list, so it cannot drift; and the mosadd-agent README
|
|
15
|
-
// lives in a separate repo. Both are noted in the migration handoff.
|
|
16
|
-
//
|
|
17
|
-
// ⚠ CROSS-REPO SURFACE THIS TEST CANNOT REACH: the public MCP server card at
|
|
18
|
-
// apps/web/public/.well-known/mcp/server-card.json lives in the m0ssad-3 repo
|
|
19
|
-
// (served at mosadd.com/.well-known/mcp/server-card.json). Found 2026-07-30
|
|
20
|
-
// advertising 69 AND 64 at once while TOOL_COUNT was 73. It is pinned by its own
|
|
21
|
-
// static gate THERE: m0ssad-3 scripts/check-mcp-server-card.mjs (wired into
|
|
22
|
-
// scripts/gates-local.mjs), whose EXPECTED_TOOL_COUNT constant must be bumped in
|
|
23
|
-
// the same change whenever TOOL_COUNT moves.
|
|
24
|
-
|
|
25
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
26
|
-
const repoRoot = resolve(here, "../../../.."); // packages/mcp/src/__tests__ -> repo root
|
|
27
|
-
|
|
28
|
-
const SURFACES: { file: string; re: RegExp; what: string }[] = [
|
|
29
|
-
// README FIRST, because it is the one people actually read. It was NOT in this list until
|
|
30
|
-
// 2026-07-29 — the gate guarded four internal surfaces and left the public face of the project
|
|
31
|
-
// unguarded, which is the wrong way round. The badge is checked because a wrong number in a
|
|
32
|
-
// green badge is the most confident-looking lie a repo can tell.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{ file: "README.md", re:
|
|
36
|
-
{ file: "
|
|
37
|
-
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
{ file: "
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
for (const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
{
|
|
134
|
-
file
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
{
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
})
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { dirname, resolve } from "node:path";
|
|
5
|
+
import { TOOL_COUNT, allTools } from "../tools/index.js";
|
|
6
|
+
|
|
7
|
+
// ── Anti-drift gate ──────────────────────────────────────────────────────────
|
|
8
|
+
// The advertised tool count has drifted across surfaces repeatedly (68/69/65/61/
|
|
9
|
+
// "70+"), which the founder rightly hates. TOOL_COUNT (= allTools.length) is the ONE
|
|
10
|
+
// source of truth; every hardcoded doc surface must equal it. If you add/remove a
|
|
11
|
+
// tool, this test fails until you update the surfaces below (or vice-versa).
|
|
12
|
+
//
|
|
13
|
+
// NOT checked here: the mosADD app's LP `McpToolReference` computes its total
|
|
14
|
+
// dynamically from the rendered list, so it cannot drift; and the mosadd-agent README
|
|
15
|
+
// lives in a separate repo. Both are noted in the migration handoff.
|
|
16
|
+
//
|
|
17
|
+
// ⚠ CROSS-REPO SURFACE THIS TEST CANNOT REACH: the public MCP server card at
|
|
18
|
+
// apps/web/public/.well-known/mcp/server-card.json lives in the m0ssad-3 repo
|
|
19
|
+
// (served at mosadd.com/.well-known/mcp/server-card.json). Found 2026-07-30
|
|
20
|
+
// advertising 69 AND 64 at once while TOOL_COUNT was 73. It is pinned by its own
|
|
21
|
+
// static gate THERE: m0ssad-3 scripts/check-mcp-server-card.mjs (wired into
|
|
22
|
+
// scripts/gates-local.mjs), whose EXPECTED_TOOL_COUNT constant must be bumped in
|
|
23
|
+
// the same change whenever TOOL_COUNT moves.
|
|
24
|
+
|
|
25
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const repoRoot = resolve(here, "../../../.."); // packages/mcp/src/__tests__ -> repo root
|
|
27
|
+
|
|
28
|
+
const SURFACES: { file: string; re: RegExp; what: string }[] = [
|
|
29
|
+
// README FIRST, because it is the one people actually read. It was NOT in this list until
|
|
30
|
+
// 2026-07-29 — the gate guarded four internal surfaces and left the public face of the project
|
|
31
|
+
// unguarded, which is the wrong way round. The badge is checked because a wrong number in a
|
|
32
|
+
// green badge is the most confident-looking lie a repo can tell.
|
|
33
|
+
// README rewritten 2026-09-29 (m.0S truth pass): the badge, the @alpha quickstart line and the long module
|
|
34
|
+
// table are gone; the two sentences that carry the total are pinned instead.
|
|
35
|
+
{ file: "README.md", re: /^(\d+) tools in `@mosadd\/mcp`/m, what: "README tools section" },
|
|
36
|
+
{ file: "packages/mcp/server.json", re: /(\d+)\s+MCP tools/, what: "MCP registry manifest description" },
|
|
37
|
+
// The npm-visible description — what `npm view @mosadd/mcp description` and the npmjs.com
|
|
38
|
+
// page show. Added 2026-07-30 (LINEAR-4813): it already said 73 but nothing enforced it.
|
|
39
|
+
{ file: "packages/mcp/package.json", re: /—\s*(\d+)\s+tools\s+—/, what: "package.json description" },
|
|
40
|
+
// Added 2026-08-01 (content-truth audit, LINEAR-5057 E-17): six surfaces the gate did
|
|
41
|
+
// not pin had silently drifted to 69/66/71/22/4 while TOOL_COUNT was 73. Every public
|
|
42
|
+
// file that hand-types a total is now listed here — if you add a surface with a
|
|
43
|
+
// number, add it to this array in the same PR.
|
|
44
|
+
{ file: "packages/ai/README.md", re: /the (\d+) mosADD toolkit tools/, what: "@mosadd/ai README" },
|
|
45
|
+
{ file: "docs/architecture/human-os.md", re: /exposing \*\*(\d+) tools\*\*/, what: "human-os architecture doc" },
|
|
46
|
+
{ file: "examples/README.md", re: /\*\*(\d+) live MCP tools across/, what: "examples README header" },
|
|
47
|
+
{ file: "packages/mcp/README.md", re: /One key, one server, (\d+) tools/, what: "@mosadd/mcp README intro" },
|
|
48
|
+
{ file: "packages/mcp/README.md", re: /\*\*(\d+) callable tools\*\* in total/, what: "@mosadd/mcp README breakdown" },
|
|
49
|
+
// Added 2026-09-04 (kanon 1.1 review, LINEAR-5870): three more public files hand-typed a total
|
|
50
|
+
// and had sat at 77 through two bumps (82, 84) because nothing pinned them. Both realm llms.txt
|
|
51
|
+
// lines are pinned separately — a single /(\d+) tools/ would only ever see the first.
|
|
52
|
+
// The package's own number, 85 on 2026-09-29, pinned where a text describes @mosadd/mcp itself.
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
// ── The HUB's number ────────────────────────────────────────────────────────
|
|
56
|
+
// 2026-09-29 (verifier of the m.0S distribution pass): the public texts said "85 tools" for
|
|
57
|
+
// https://mcp.mosadd.dev/mcp while the hub listed 88 — it serves every @mosadd/mcp tool plus tools of its
|
|
58
|
+
// own. 2026-09-30: the hub lists 86, because the phone-call tools (call_start, call_status) are held back until
|
|
59
|
+
// calls open (the price list marks them "soon"); the count moved 85 → 88 → 86 in two days. So texts about the
|
|
60
|
+
// ENDPOINT carry no number at all: they point at distribution/hub-tools.json (a snapshot of the live tools/list;
|
|
61
|
+
// `node scripts/check-hub-tools.mjs` compares it with the live hub, `--write` refreshes it), and this gate fails
|
|
62
|
+
// when one of them states "<N> tools" for the endpoint again. A number that describes @mosadd/mcp itself (a line
|
|
63
|
+
// that names `@mosadd/mcp`) stays and is pinned to TOOL_COUNT by SURFACES above.
|
|
64
|
+
const hubSnapshot = JSON.parse(readFileSync(resolve(repoRoot, "distribution/hub-tools.json"), "utf8")) as {
|
|
65
|
+
count: number;
|
|
66
|
+
names: string[];
|
|
67
|
+
server_version: string;
|
|
68
|
+
};
|
|
69
|
+
const packageNames = allTools.map((t) => t.name);
|
|
70
|
+
const HUB_ONLY = hubSnapshot.names.filter((n) => !packageNames.includes(n)).sort();
|
|
71
|
+
const HUB_COUNT = hubSnapshot.count;
|
|
72
|
+
const HELD_BACK = ["call_start", "call_status"]; // phone calls through the user's own Telnyx/Twilio account: "soon"
|
|
73
|
+
|
|
74
|
+
// Every public text that talks about the endpoint (not about the package).
|
|
75
|
+
const HUB_TEXTS = [
|
|
76
|
+
"README.md",
|
|
77
|
+
"docs/hosts.md",
|
|
78
|
+
"docs/roadmap.md",
|
|
79
|
+
"skills/m0s-quickstart/SKILL.md",
|
|
80
|
+
"distribution/clawhub/m0s/SKILL.md",
|
|
81
|
+
"distribution/pulsemcp.md",
|
|
82
|
+
"distribution/mcp-so.md",
|
|
83
|
+
"distribution/awesome-mcp-servers.md",
|
|
84
|
+
];
|
|
85
|
+
/** "88 tools", "88 MCP tools", "88 live tools" — a fixed count, in a line that is not about @mosadd/mcp. */
|
|
86
|
+
const FIXED_COUNT = /\b\d+\s+(?:MCP\s+|live\s+|callable\s+)?tools\b/i;
|
|
87
|
+
function fixedHubCounts(text: string): string[] {
|
|
88
|
+
return text.split(/\r?\n/).filter((l) => FIXED_COUNT.test(l) && !l.includes("@mosadd/mcp"));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
describe("tool-count consistency (anti-drift gate)", () => {
|
|
92
|
+
it("TOOL_COUNT is a positive integer", () => {
|
|
93
|
+
expect(Number.isInteger(TOOL_COUNT)).toBe(true);
|
|
94
|
+
expect(TOOL_COUNT).toBeGreaterThan(0);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
for (const s of SURFACES) {
|
|
98
|
+
it(`${s.what} (${s.file}) advertises exactly TOOL_COUNT (${TOOL_COUNT})`, () => {
|
|
99
|
+
const txt = readFileSync(resolve(repoRoot, s.file), "utf8");
|
|
100
|
+
const m = txt.match(s.re);
|
|
101
|
+
expect(m, `no tool-count number found in ${s.file} — did the surface change shape?`).toBeTruthy();
|
|
102
|
+
expect(
|
|
103
|
+
Number(m![1]),
|
|
104
|
+
`${s.file} says ${m![1]} tools but TOOL_COUNT is ${TOOL_COUNT} — sync the surface or the registry`,
|
|
105
|
+
).toBe(TOOL_COUNT);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
describe("hub tool count (texts about https://mcp.mosadd.dev/mcp)", () => {
|
|
111
|
+
it("the snapshot is the package plus the hub's own tools, nothing missing", () => {
|
|
112
|
+
expect(hubSnapshot.names).toHaveLength(hubSnapshot.count);
|
|
113
|
+
expect(packageNames.filter((n) => !hubSnapshot.names.includes(n)), "package tools the hub does not list").toEqual([]);
|
|
114
|
+
expect(HUB_COUNT).toBe(TOOL_COUNT + HUB_ONLY.length);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it("the README tools section points at the snapshot, names every hub-only tool and says which are held back", () => {
|
|
118
|
+
const readme = readFileSync(resolve(repoRoot, "README.md"), "utf8");
|
|
119
|
+
const para = readme.match(/[^\n]*distribution\/hub-tools\.json[^\n]*(?:\n(?!\n)[^\n]*)*/)?.[0] ?? "";
|
|
120
|
+
expect(para, "README has no paragraph pointing at distribution/hub-tools.json").not.toBe("");
|
|
121
|
+
for (const n of HUB_ONLY) expect(para, `README hub paragraph does not name ${n}`).toContain(`\`${n}\``);
|
|
122
|
+
const listed = HELD_BACK.filter((n) => hubSnapshot.names.includes(n));
|
|
123
|
+
if (listed.length === 0) {
|
|
124
|
+
// calls are not open: the README must say so, and name the tools it holds back
|
|
125
|
+
expect(para).toMatch(/coming soon/);
|
|
126
|
+
expect(para).toMatch(/held back/);
|
|
127
|
+
for (const n of HELD_BACK) expect(para, `README does not name the held-back ${n}`).toContain(`\`${n}\``);
|
|
128
|
+
} else {
|
|
129
|
+
expect(para, `the hub lists ${listed.join(", ")} now — the README still says they are held back`).not.toMatch(/held back/);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
for (const file of HUB_TEXTS) {
|
|
134
|
+
it(`${file} states no fixed number of hub tools (it points at distribution/hub-tools.json)`, () => {
|
|
135
|
+
const lines = fixedHubCounts(readFileSync(resolve(repoRoot, file), "utf8"));
|
|
136
|
+
expect(
|
|
137
|
+
lines,
|
|
138
|
+
`${file} states a fixed tool count for the endpoint (the hub lists ${HUB_COUNT} today, and it changes): drop the number or point at distribution/hub-tools.json`,
|
|
139
|
+
).toEqual([]);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
it("the gate fires: a text that says '88 tools' for the endpoint is caught, one about @mosadd/mcp is not", () => {
|
|
144
|
+
expect(fixedHubCounts("m.0S is a hosted MCP endpoint with 88 tools.")).toHaveLength(1);
|
|
145
|
+
expect(fixedHubCounts("The hub lists **88 MCP tools** today.")).toHaveLength(1);
|
|
146
|
+
expect(fixedHubCounts("85 tools in `@mosadd/mcp` (`3.0.0-alpha.55`)")).toEqual([]);
|
|
147
|
+
expect(fixedHubCounts("The hub's tool list is whatever `tools/list` returns.")).toEqual([]);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// ── Per-MODULE anti-drift gate ───────────────────────────────────────────────
|
|
152
|
+
// WHY this exists (added 2026-08-11): the total-only gate above was GREEN while the
|
|
153
|
+
// prose around every pinned line was wrong. Each SURFACES entry pins ONE regex per
|
|
154
|
+
// file, so somebody could correct the single matched number and leave its own sentence
|
|
155
|
+
// contradicting it. Measured that day, with TOOL_COUNT = 77:
|
|
156
|
+
// - packages/mcp/README.md ended a sentence "**77 callable tools** in total" (pinned,
|
|
157
|
+
// green) whose own terms — mDM 14 + mIRC 24 + mURL 7 + mAYL 12 = 57, +16 — summed
|
|
158
|
+
// to 73, because mAYL had grown by the four mAYL_agentbox_* tools and nobody
|
|
159
|
+
// re-added the addends.
|
|
160
|
+
// - src/tools/index.ts said the same thing in its header comment.
|
|
161
|
+
// A breakdown that contradicts its own total is worse than no breakdown: it looks
|
|
162
|
+
// audited. So the addends are now derived from allTools and pinned too.
|
|
163
|
+
const liveByModule: Record<string, number> = (() => {
|
|
164
|
+
const by: Record<string, number> = {};
|
|
165
|
+
for (const t of allTools) {
|
|
166
|
+
// Prefix = everything before the first "_", except comms_*/threat_* which are
|
|
167
|
+
// capability groups rather than m* modules and are labelled as such in the docs.
|
|
168
|
+
const prefix = t.name.startsWith("comms_")
|
|
169
|
+
? "comms"
|
|
170
|
+
: t.name.startsWith("threat_")
|
|
171
|
+
? "threat"
|
|
172
|
+
: t.name.split("_")[0];
|
|
173
|
+
by[prefix] = (by[prefix] ?? 0) + 1;
|
|
174
|
+
}
|
|
175
|
+
return by;
|
|
176
|
+
})();
|
|
177
|
+
|
|
178
|
+
/** Doc label → the registry prefix it describes. "Irondome" is the brand name for threat_*. */
|
|
179
|
+
const MODULE_LABELS: { label: string; prefix: string }[] = [
|
|
180
|
+
{ label: "mDM", prefix: "mDM" },
|
|
181
|
+
{ label: "mIRC", prefix: "mIRC" },
|
|
182
|
+
{ label: "mURL", prefix: "mURL" },
|
|
183
|
+
{ label: "mAYL", prefix: "mAYL" },
|
|
184
|
+
{ label: "mTALK", prefix: "mTALK" },
|
|
185
|
+
{ label: "mRAG", prefix: "mRAG" },
|
|
186
|
+
];
|
|
187
|
+
|
|
188
|
+
const MODULE_SURFACES: { file: string; what: string; re: (label: string) => RegExp }[] = [
|
|
189
|
+
{
|
|
190
|
+
file: "packages/mcp/src/tools/index.ts",
|
|
191
|
+
what: "registry header breakdown",
|
|
192
|
+
// "modules mDM 14 · mIRC 24 · mURL 7 · mAYL 16 = 61; capabilities mTALK 6 · mRAG 4 …"
|
|
193
|
+
re: (label) => new RegExp(`\\b${label}\\s+(\\d+)\\s*[·=]`),
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
file: "packages/mcp/README.md",
|
|
197
|
+
what: "README module table row",
|
|
198
|
+
// "| **mDM** (14) | `mDM_list_contacts`, …"
|
|
199
|
+
re: (label) => new RegExp(`\\|\\s*\\*\\*${label}\\*\\*\\s*\\((\\d+)\\)`),
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
file: "packages/mcp/README.md",
|
|
203
|
+
what: "README breakdown addends",
|
|
204
|
+
// "mDM (14) + mIRC (24) + … ; capabilities: mTALK (6) + mRAG (4) + …"
|
|
205
|
+
re: (label) => new RegExp(`\\b${label}_?\\s*\\((\\d+)\\)\\s*[+=;]`),
|
|
206
|
+
},
|
|
207
|
+
// Added 2026-09-04 (kanon 1.1 review, LINEAR-5870). Measured that day: examples/README.md had
|
|
208
|
+
// its header bumped to 85 while its own addends still read mDM (14) / mRAG (4) / comms (4) — a
|
|
209
|
+
// breakdown summing to 78 under a headline of 85, the exact shape this gate exists for. The
|
|
210
|
+
// realm llms.txt and the Smithery copy carried mDM 14 / mIRC 24 / mRAG 4 from alpha.33.
|
|
211
|
+
{
|
|
212
|
+
file: "examples/README.md",
|
|
213
|
+
what: "examples README per-module list",
|
|
214
|
+
// "- **mDM** (16): list_contacts, …"
|
|
215
|
+
re: (label) => new RegExp(`\\*\\*${label}\\*\\*\\s*\\((\\d+)\\)`),
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
file: "README.md",
|
|
219
|
+
what: "README tools line",
|
|
220
|
+
// "mDM 16 · mIRC 25 · mURL 7 · mAYL 16 · mTALK 6 · mRAG 8 · comms 5 · threat 2"
|
|
221
|
+
re: (label) => new RegExp(`\\b${label} (\\d+) ·`),
|
|
222
|
+
},
|
|
223
|
+
];
|
|
224
|
+
|
|
225
|
+
describe("per-module tool-count consistency", () => {
|
|
226
|
+
it("every registered tool falls into a known module/capability prefix", () => {
|
|
227
|
+
const known = new Set([...MODULE_LABELS.map((m) => m.prefix), "comms", "threat"]);
|
|
228
|
+
const strays = Object.keys(liveByModule).filter((p) => !known.has(p));
|
|
229
|
+
expect(
|
|
230
|
+
strays,
|
|
231
|
+
`unknown tool prefix(es) ${strays.join(", ")} — a new module shipped without a doc breakdown; ` +
|
|
232
|
+
`add it to MODULE_LABELS and to every surface listed in MODULE_SURFACES`,
|
|
233
|
+
).toEqual([]);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it("the per-module numbers add up to TOOL_COUNT", () => {
|
|
237
|
+
const sum = Object.values(liveByModule).reduce((a, b) => a + b, 0);
|
|
238
|
+
expect(sum).toBe(TOOL_COUNT);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
for (const s of MODULE_SURFACES) {
|
|
242
|
+
for (const { label, prefix } of MODULE_LABELS) {
|
|
243
|
+
it(`${s.what} (${s.file}) says ${label} = ${liveByModule[prefix]}`, () => {
|
|
244
|
+
const txt = readFileSync(resolve(repoRoot, s.file), "utf8");
|
|
245
|
+
const m = txt.match(s.re(label));
|
|
246
|
+
expect(m, `no "${label} <n>" breakdown found in ${s.file} — did the surface change shape?`).toBeTruthy();
|
|
247
|
+
expect(
|
|
248
|
+
Number(m![1]),
|
|
249
|
+
`${s.file} says ${label} has ${m![1]} tools but the registry has ${liveByModule[prefix]} — ` +
|
|
250
|
+
`sync the surface or the registry`,
|
|
251
|
+
).toBe(liveByModule[prefix]);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
});
|