@rubytech/create-maxy-code 0.1.583 → 0.1.584
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/package.json +1 -1
- package/payload/platform/lib/telegram-reach/dist/index.d.ts +6 -0
- package/payload/platform/lib/telegram-reach/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/telegram-reach/dist/index.js +38 -3
- package/payload/platform/lib/telegram-reach/dist/index.js.map +1 -1
- package/payload/platform/lib/telegram-reach/src/__tests__/telegram-reach.test.ts +54 -2
- package/payload/platform/lib/telegram-reach/src/index.ts +38 -4
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +5 -1
- package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +6 -0
- package/payload/platform/plugins/docs/references/telegram-guide.md +4 -0
- package/payload/platform/plugins/telegram/.claude-plugin/plugin.json +1 -1
- package/payload/platform/plugins/telegram/PLUGIN.md +3 -7
- package/payload/platform/plugins/telegram/mcp/dist/__tests__/api-census.test.js +25 -11
- package/payload/platform/plugins/telegram/mcp/dist/__tests__/api-census.test.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/__tests__/api-guard.test.js +41 -5
- package/payload/platform/plugins/telegram/mcp/dist/__tests__/api-guard.test.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/__tests__/api-methods.test.js +9 -3
- package/payload/platform/plugins/telegram/mcp/dist/__tests__/api-methods.test.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/__tests__/card-business.test.js +14 -3
- package/payload/platform/plugins/telegram/mcp/dist/__tests__/card-business.test.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/__tests__/reach-tool.test.js +20 -7
- package/payload/platform/plugins/telegram/mcp/dist/__tests__/reach-tool.test.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/__tests__/schemas.test.js +2 -31
- package/payload/platform/plugins/telegram/mcp/dist/__tests__/schemas.test.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/index.js +2 -10
- package/payload/platform/plugins/telegram/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/lib/account-write.d.ts +10 -3
- package/payload/platform/plugins/telegram/mcp/dist/lib/account-write.d.ts.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/lib/account-write.js +29 -16
- package/payload/platform/plugins/telegram/mcp/dist/lib/account-write.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/lib/api-census.d.ts +11 -1
- package/payload/platform/plugins/telegram/mcp/dist/lib/api-census.d.ts.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/lib/api-census.js +18 -4
- package/payload/platform/plugins/telegram/mcp/dist/lib/api-census.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/lib/api-guard.d.ts +11 -1
- package/payload/platform/plugins/telegram/mcp/dist/lib/api-guard.d.ts.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/lib/api-guard.js +34 -2
- package/payload/platform/plugins/telegram/mcp/dist/lib/api-guard.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/lib/api-methods.d.ts +0 -3
- package/payload/platform/plugins/telegram/mcp/dist/lib/api-methods.d.ts.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/lib/api-methods.js +0 -1
- package/payload/platform/plugins/telegram/mcp/dist/lib/api-methods.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/lib/business-window-store.d.ts +7 -4
- package/payload/platform/plugins/telegram/mcp/dist/lib/business-window-store.d.ts.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/lib/business-window-store.js +15 -6
- package/payload/platform/plugins/telegram/mcp/dist/lib/business-window-store.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/lib/chat-send-policy.d.ts +3 -2
- package/payload/platform/plugins/telegram/mcp/dist/lib/chat-send-policy.d.ts.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/lib/chat-send-policy.js +3 -2
- package/payload/platform/plugins/telegram/mcp/dist/lib/chat-send-policy.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/tools/api.js +8 -0
- package/payload/platform/plugins/telegram/mcp/dist/tools/api.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/tools/reach.d.ts.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/tools/reach.js +6 -1
- package/payload/platform/plugins/telegram/mcp/dist/tools/reach.js.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/tools/schemas.d.ts +0 -70
- package/payload/platform/plugins/telegram/mcp/dist/tools/schemas.d.ts.map +1 -1
- package/payload/platform/plugins/telegram/mcp/dist/tools/schemas.js +0 -105
- package/payload/platform/plugins/telegram/mcp/dist/tools/schemas.js.map +1 -1
- package/payload/platform/plugins/telegram/skills/build/SKILL.md +12 -35
- package/payload/platform/plugins/telegram/skills/build/references/methods.md +3 -13
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +0 -1
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
- package/payload/server/server.js +281 -291
package/package.json
CHANGED
|
@@ -77,4 +77,10 @@ export declare function collectTelegramReach(input: {
|
|
|
77
77
|
storeDir: string;
|
|
78
78
|
bots: ReachBotInput[];
|
|
79
79
|
}): ReachResult;
|
|
80
|
+
/** The brand's Telegram message store root, for a given platform root.
|
|
81
|
+
*
|
|
82
|
+
* The ONE derivation of this path. `ui/app/lib/telegram/message-store.ts`
|
|
83
|
+
* writes under it and `plugins/telegram/mcp` reads under it, both through this
|
|
84
|
+
* function, so the writer and the reader cannot name different directories. */
|
|
85
|
+
export declare function telegramStoreRoot(platformRoot: string): string;
|
|
80
86
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
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EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB,GAAG,WAAW,CAsCd;AAqBD;;;;gFAIgF;AAChF,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAG9D"}
|
|
@@ -5,6 +5,7 @@ exports.isBusinessChannelKey = isBusinessChannelKey;
|
|
|
5
5
|
exports.channelKeyToFileStem = channelKeyToFileStem;
|
|
6
6
|
exports.fileStemToChannelKey = fileStemToChannelKey;
|
|
7
7
|
exports.collectTelegramReach = collectTelegramReach;
|
|
8
|
+
exports.telegramStoreRoot = telegramStoreRoot;
|
|
8
9
|
/**
|
|
9
10
|
* Task 2625 — which Telegram chats a registered bot can already message.
|
|
10
11
|
*
|
|
@@ -22,11 +23,16 @@ exports.collectTelegramReach = collectTelegramReach;
|
|
|
22
23
|
* re-exports it, so the store that writes a filename and the walk that reads one
|
|
23
24
|
* cannot disagree.
|
|
24
25
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* `collectTelegramReach` takes `storeDir` from its caller, but the DERIVATION of
|
|
27
|
+
* that directory lives here too, in `telegramStoreRoot`. Task 2625 left it to
|
|
28
|
+
* each caller on the grounds that a library must not know what a brand is, and
|
|
29
|
+
* the two callers promptly disagreed: the webhook wrote the brand config dir
|
|
30
|
+
* while `telegram-reach` read the brand install dir, so the tool reported every
|
|
31
|
+
* chat unreachable and named its own live sender as never having messaged
|
|
32
|
+
* (Task 2644). One derivation, for the same reason the filename rule is here.
|
|
28
33
|
*/
|
|
29
34
|
const node_fs_1 = require("node:fs");
|
|
35
|
+
const node_os_1 = require("node:os");
|
|
30
36
|
const node_path_1 = require("node:path");
|
|
31
37
|
/**
|
|
32
38
|
* Is this a channel key that can safely become a path segment?
|
|
@@ -208,4 +214,33 @@ function collectTelegramReach(input) {
|
|
|
208
214
|
});
|
|
209
215
|
return { bots, storeRows };
|
|
210
216
|
}
|
|
217
|
+
/** The brand's config directory NAME, from its own brand.json.
|
|
218
|
+
*
|
|
219
|
+
* Resolved WITHOUT the platform's `paths.ts`, which throws at module init on a
|
|
220
|
+
* brand.json missing a port field. The inbound Telegram webhook imports this
|
|
221
|
+
* path, so a throw here takes delivery down; a brand.json that cannot be read
|
|
222
|
+
* falls back to `.maxy` instead. */
|
|
223
|
+
function configDirName(platformRoot) {
|
|
224
|
+
const brandPath = (0, node_path_1.join)(platformRoot, "config", "brand.json");
|
|
225
|
+
if ((0, node_fs_1.existsSync)(brandPath)) {
|
|
226
|
+
try {
|
|
227
|
+
const parsed = JSON.parse((0, node_fs_1.readFileSync)(brandPath, "utf8"));
|
|
228
|
+
if (typeof parsed.configDir === "string")
|
|
229
|
+
return parsed.configDir;
|
|
230
|
+
}
|
|
231
|
+
catch {
|
|
232
|
+
// A brand.json that will not parse falls back rather than throwing.
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return ".maxy";
|
|
236
|
+
}
|
|
237
|
+
/** The brand's Telegram message store root, for a given platform root.
|
|
238
|
+
*
|
|
239
|
+
* The ONE derivation of this path. `ui/app/lib/telegram/message-store.ts`
|
|
240
|
+
* writes under it and `plugins/telegram/mcp` reads under it, both through this
|
|
241
|
+
* function, so the writer and the reader cannot name different directories. */
|
|
242
|
+
function telegramStoreRoot(platformRoot) {
|
|
243
|
+
const brandDir = process.env.MAXY_DIR_OVERRIDE ?? (0, node_path_1.resolve)((0, node_os_1.homedir)(), configDirName(platformRoot));
|
|
244
|
+
return (0, node_path_1.join)(brandDir, "data", "telegram-messages");
|
|
245
|
+
}
|
|
211
246
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AA0CA,oDAEC;AAQD,oDAEC;AAQD,oDAQC;AAQD,oDAQC;AA2ID,oDAy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AAS,GAAG,IAAA,gBAAI,EAAC,YAAY,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;IAC7D,IAAI,IAAA,oBAAU,EAAC,SAAS,CAAC,EAAE,CAAC;QAC1B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,sBAAY,EAAC,SAAS,EAAE,MAAM,CAAC,CAA4B,CAAC;YACtF,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ;gBAAE,OAAO,MAAM,CAAC,SAAS,CAAC;QACpE,CAAC;QAAC,MAAM,CAAC;YACP,oEAAoE;QACtE,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;gFAIgF;AAChF,SAAgB,iBAAiB,CAAC,YAAoB;IACpD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,IAAA,mBAAO,EAAC,IAAA,iBAAO,GAAE,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC;IAClG,OAAO,IAAA,gBAAI,EAAC,QAAQ,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
2
|
-
import { mkdtempSync, writeFileSync, rmSync } from "node:fs";
|
|
3
|
-
import { tmpdir } from "node:os";
|
|
2
|
+
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir, homedir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import {
|
|
6
6
|
collectTelegramReach,
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
isBusinessChannelKey,
|
|
9
9
|
channelKeyToFileStem,
|
|
10
10
|
fileStemToChannelKey,
|
|
11
|
+
telegramStoreRoot,
|
|
11
12
|
} from "../index.js";
|
|
12
13
|
|
|
13
14
|
const BOT = "8801383568";
|
|
@@ -214,3 +215,54 @@ describe("collectTelegramReach", () => {
|
|
|
214
215
|
expect(out.bots[0].chats.map((c) => c.senderId)).toEqual([NEO, KIT, "5555555555"]);
|
|
215
216
|
});
|
|
216
217
|
});
|
|
218
|
+
|
|
219
|
+
describe("telegramStoreRoot", () => {
|
|
220
|
+
let root: string;
|
|
221
|
+
|
|
222
|
+
beforeEach(() => {
|
|
223
|
+
root = mkdtempSync(join(tmpdir(), "tg-store-root-"));
|
|
224
|
+
delete process.env.MAXY_DIR_OVERRIDE;
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
afterEach(() => {
|
|
228
|
+
delete process.env.MAXY_DIR_OVERRIDE;
|
|
229
|
+
rmSync(root, { recursive: true, force: true });
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
function writeBrand(configDir: unknown): string {
|
|
233
|
+
const platformRoot = join(root, "platform");
|
|
234
|
+
mkdirSync(join(platformRoot, "config"), { recursive: true });
|
|
235
|
+
writeFileSync(
|
|
236
|
+
join(platformRoot, "config", "brand.json"),
|
|
237
|
+
typeof configDir === "string" ? JSON.stringify({ configDir }) : "{ not json",
|
|
238
|
+
"utf8",
|
|
239
|
+
);
|
|
240
|
+
return platformRoot;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
it("reads configDir from brand.json", () => {
|
|
244
|
+
expect(telegramStoreRoot(writeBrand(".maxy-code"))).toBe(
|
|
245
|
+
join(homedir(), ".maxy-code", "data", "telegram-messages"),
|
|
246
|
+
);
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it("falls back to .maxy when brand.json is absent", () => {
|
|
250
|
+
const platformRoot = join(root, "platform");
|
|
251
|
+
mkdirSync(platformRoot, { recursive: true });
|
|
252
|
+
expect(telegramStoreRoot(platformRoot)).toBe(
|
|
253
|
+
join(homedir(), ".maxy", "data", "telegram-messages"),
|
|
254
|
+
);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it("falls back to .maxy when brand.json is unparseable, without throwing", () => {
|
|
258
|
+
expect(telegramStoreRoot(writeBrand(null))).toBe(
|
|
259
|
+
join(homedir(), ".maxy", "data", "telegram-messages"),
|
|
260
|
+
);
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it("MAXY_DIR_OVERRIDE wins over brand.json", () => {
|
|
264
|
+
const platformRoot = writeBrand(".maxy-code");
|
|
265
|
+
process.env.MAXY_DIR_OVERRIDE = root;
|
|
266
|
+
expect(telegramStoreRoot(platformRoot)).toBe(join(root, "data", "telegram-messages"));
|
|
267
|
+
});
|
|
268
|
+
});
|
|
@@ -15,12 +15,17 @@
|
|
|
15
15
|
* re-exports it, so the store that writes a filename and the walk that reads one
|
|
16
16
|
* cannot disagree.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* `collectTelegramReach` takes `storeDir` from its caller, but the DERIVATION of
|
|
19
|
+
* that directory lives here too, in `telegramStoreRoot`. Task 2625 left it to
|
|
20
|
+
* each caller on the grounds that a library must not know what a brand is, and
|
|
21
|
+
* the two callers promptly disagreed: the webhook wrote the brand config dir
|
|
22
|
+
* while `telegram-reach` read the brand install dir, so the tool reported every
|
|
23
|
+
* chat unreachable and named its own live sender as never having messaged
|
|
24
|
+
* (Task 2644). One derivation, for the same reason the filename rule is here.
|
|
21
25
|
*/
|
|
22
26
|
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
23
|
-
import {
|
|
27
|
+
import { homedir } from "node:os";
|
|
28
|
+
import { join, resolve } from "node:path";
|
|
24
29
|
|
|
25
30
|
/**
|
|
26
31
|
* Is this a channel key that can safely become a path segment?
|
|
@@ -260,3 +265,32 @@ export function collectTelegramReach(input: {
|
|
|
260
265
|
});
|
|
261
266
|
return { bots, storeRows };
|
|
262
267
|
}
|
|
268
|
+
|
|
269
|
+
/** The brand's config directory NAME, from its own brand.json.
|
|
270
|
+
*
|
|
271
|
+
* Resolved WITHOUT the platform's `paths.ts`, which throws at module init on a
|
|
272
|
+
* brand.json missing a port field. The inbound Telegram webhook imports this
|
|
273
|
+
* path, so a throw here takes delivery down; a brand.json that cannot be read
|
|
274
|
+
* falls back to `.maxy` instead. */
|
|
275
|
+
function configDirName(platformRoot: string): string {
|
|
276
|
+
const brandPath = join(platformRoot, "config", "brand.json");
|
|
277
|
+
if (existsSync(brandPath)) {
|
|
278
|
+
try {
|
|
279
|
+
const parsed = JSON.parse(readFileSync(brandPath, "utf8")) as { configDir?: unknown };
|
|
280
|
+
if (typeof parsed.configDir === "string") return parsed.configDir;
|
|
281
|
+
} catch {
|
|
282
|
+
// A brand.json that will not parse falls back rather than throwing.
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return ".maxy";
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** The brand's Telegram message store root, for a given platform root.
|
|
289
|
+
*
|
|
290
|
+
* The ONE derivation of this path. `ui/app/lib/telegram/message-store.ts`
|
|
291
|
+
* writes under it and `plugins/telegram/mcp` reads under it, both through this
|
|
292
|
+
* function, so the writer and the reader cannot name different directories. */
|
|
293
|
+
export function telegramStoreRoot(platformRoot: string): string {
|
|
294
|
+
const brandDir = process.env.MAXY_DIR_OVERRIDE ?? resolve(homedir(), configDirName(platformRoot));
|
|
295
|
+
return join(brandDir, "data", "telegram-messages");
|
|
296
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: platform-architecture
|
|
3
3
|
description: Use when grounding any documented-surface claim about what Maxy ships — plugins, skills, specialists, install/deploy flows, internals. This is the install catalogue, not evidence of what is enabled on the current account. For install state on this account, call `capabilities-here`; for documented surface, cite the `Source:` URL inline.
|
|
4
|
-
content-hash: sha256:
|
|
4
|
+
content-hash: sha256:db2de259ee8282f0f71d1f2ba4ed50ed7893f6dd1389c324197fbbe3956ded60
|
|
5
5
|
brand: maxy-code
|
|
6
6
|
product-name: Maxy
|
|
7
7
|
---
|
|
@@ -2935,6 +2935,10 @@ people who have messaged each one and when they last wrote, and anyone on a bot'
|
|
|
2935
2935
|
never messaged. Being on the admin list is not the same as having opened the chat, so those people
|
|
2936
2936
|
are listed separately as not reachable yet.
|
|
2937
2937
|
|
|
2938
|
+
That list is built from the messages already stored on this machine. Every message that arrives is
|
|
2939
|
+
written down, and both the answer to "who can you reach" and the hourly self-check read that same
|
|
2940
|
+
store, so what Maxy tells you and what actually arrived cannot drift apart.
|
|
2941
|
+
|
|
2938
2942
|
If Maxy ever says a Telegram message cannot be sent, ask it to check that list first.
|
|
2939
2943
|
|
|
2940
2944
|
## Getting a Chat ID
|
|
@@ -9,6 +9,12 @@ Invoked by the admin agent directly.
|
|
|
9
9
|
|
|
10
10
|
This is the platform's release timeline, newest first. Each entry shows the date it shipped and the version it shipped in, so you can tell the operator how current their install is. To compare, read the installed version from `capabilities-here` and match it against the versions below. Keep answers high level and in plain English; this is a summary, not a full commit log.
|
|
11
11
|
|
|
12
|
+
## 2026-08-09 (0.1.584)
|
|
13
|
+
|
|
14
|
+
- The assistant can find the Telegram chats it is able to reach. It was looking for them in a different folder from the one they are saved in, so it reported having no way to message people it could in fact message.
|
|
15
|
+
- A long Telegram answer no longer stops partway. When formatting was dropped and the message sent as plain text, it was not being split at the length limit, so anything past that point was lost.
|
|
16
|
+
- The Telegram payment surface has been withdrawn.
|
|
17
|
+
|
|
12
18
|
## 2026-08-09 (0.1.583)
|
|
13
19
|
|
|
14
20
|
- A connected Telegram Business account can now be answered. Its customer chats were being received and dropped, so the bot could not see or reply to a single one of them.
|
|
@@ -114,6 +114,10 @@ people who have messaged each one and when they last wrote, and anyone on a bot'
|
|
|
114
114
|
never messaged. Being on the admin list is not the same as having opened the chat, so those people
|
|
115
115
|
are listed separately as not reachable yet.
|
|
116
116
|
|
|
117
|
+
That list is built from the messages already stored on this machine. Every message that arrives is
|
|
118
|
+
written down, and both the answer to "who can you reach" and the hourly self-check read that same
|
|
119
|
+
store, so what {{productName}} tells you and what actually arrived cannot drift apart.
|
|
120
|
+
|
|
117
121
|
If {{productName}} ever says a Telegram message cannot be sent, ask it to check that list first.
|
|
118
122
|
|
|
119
123
|
## Getting a Chat ID
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "telegram",
|
|
3
|
-
"description": "Guide users through connecting Telegram bots — creating a bot via BotFather, finding user IDs, and registering any number of bots, each with its own role, access policy and agent. Ships typed tools for cards, inbound files, forum threads, structured asks
|
|
3
|
+
"description": "Guide users through connecting Telegram bots — creating a bot via BotFather, finding user IDs, and registering any number of bots, each with its own role, access policy and agent. Ships typed tools for cards, inbound files, forum threads, structured asks and outbound media, reaches every remaining Bot API method through telegram-api, and carries a build skill for authoring cards, in-place edits and Mini App surfaces.",
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Rubytech LLC"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: telegram
|
|
3
3
|
surface: platform
|
|
4
|
-
description: Guide users through connecting Telegram bots — creating a bot via BotFather, finding user IDs, and registering any number of bots, each with its own role, access policy and agent. Ships typed tools for cards, inbound files, forum threads, structured asks
|
|
4
|
+
description: Guide users through connecting Telegram bots — creating a bot via BotFather, finding user IDs, and registering any number of bots, each with its own role, access policy and agent. Ships typed tools for cards, inbound files, forum threads, structured asks and outbound media, reaches every remaining Bot API method through telegram-api, and carries a build skill for authoring cards, in-place edits and Mini App surfaces.
|
|
5
5
|
metadata: {"platform":{"optional":false}}
|
|
6
6
|
tools:
|
|
7
7
|
- name: telegram-card
|
|
@@ -24,10 +24,6 @@ tools:
|
|
|
24
24
|
publicAllowlist: false
|
|
25
25
|
adminAllowlist: true
|
|
26
26
|
riskClass: external
|
|
27
|
-
- name: telegram-invoice
|
|
28
|
-
publicAllowlist: false
|
|
29
|
-
adminAllowlist: true
|
|
30
|
-
riskClass: external
|
|
31
27
|
- name: message-history
|
|
32
28
|
publicAllowlist: false
|
|
33
29
|
adminAllowlist: false
|
|
@@ -96,8 +92,8 @@ Walks users through connecting Telegram bots. Covers bot creation, token configu
|
|
|
96
92
|
- Admin routing — restrict a bot to admin-only access via numeric user ID bindings
|
|
97
93
|
- A straight answer to "who can we message on Telegram right now" — `telegram-reach` lists, per bot, every private chat that has messaged it and every allowlisted admin who has not, so a reachable person is never refused and an unreachable one is named as needing to write first
|
|
98
94
|
- Checklists on behalf of a connected business account — the identifier Telegram announces once is captured and stored per bot, so `telegram-ask kind=checklist` needs no parameter for it
|
|
99
|
-
-
|
|
100
|
-
-
|
|
95
|
+
- Nine of Telegram's twenty-six update classes reach the agent: messages and edits (with the quoted original when the sender replied), channel posts and their edits, button presses, poll votes, poll closes, reactions, subscription changes, and block/unblock as a log line
|
|
96
|
+
- This install takes no payment inside Telegram. The payment surface was removed: there is no invoice, no payment link and no Stars balance, and `telegram-api` refuses all eight Bot API payment methods. A checkout query from an invoice sent before the removal is logged and left to cancel, never answered and never raised as a turn
|
|
101
97
|
|
|
102
98
|
## Setup
|
|
103
99
|
|
|
@@ -4,9 +4,9 @@ import { tmpdir } from "node:os";
|
|
|
4
4
|
import { join, resolve } from "node:path";
|
|
5
5
|
import { bootCensusLine, diffMethods, extractMethodNames, OWNED_METHODS, tallyPassthrough, passthroughCensusLine, } from "../lib/api-census.js";
|
|
6
6
|
import { BOT_API_METHODS } from "../lib/api-methods.js";
|
|
7
|
+
import { PAYMENT_METHODS } from "../lib/api-guard.js";
|
|
7
8
|
import { ASK_METHOD } from "../tools/ask.js";
|
|
8
9
|
import { MEDIA_SEND_METHOD } from "../tools/media-send.js";
|
|
9
|
-
import { INVOICE_METHOD } from "../tools/invoice.js";
|
|
10
10
|
function stubAccount(bots) {
|
|
11
11
|
const root = mkdtempSync(join(tmpdir(), "tg-census-"));
|
|
12
12
|
const platformRoot = join(root, "platform");
|
|
@@ -20,17 +20,17 @@ describe("bootCensusLine", () => {
|
|
|
20
20
|
// The plugin is core now, so it boots on installs that have no bot at all.
|
|
21
21
|
// Reporting zeros is what makes that visible without anyone reporting it.
|
|
22
22
|
it("reports zeros without an account rather than throwing", () => {
|
|
23
|
-
expect(bootCensusLine("/nope", undefined)).toBe("[telegram-api-census] shipped=
|
|
23
|
+
expect(bootCensusLine("/nope", undefined)).toBe("[telegram-api-census] shipped=177 refused=15 bots=0 withToken=0");
|
|
24
24
|
});
|
|
25
25
|
it("reports zeros when account.json is unreadable", () => {
|
|
26
|
-
expect(bootCensusLine("/nope", "acct-1")).toBe("[telegram-api-census] shipped=
|
|
26
|
+
expect(bootCensusLine("/nope", "acct-1")).toBe("[telegram-api-census] shipped=177 refused=15 bots=0 withToken=0");
|
|
27
27
|
});
|
|
28
28
|
it("counts registered bots and how many carry a token", () => {
|
|
29
29
|
const platformRoot = stubAccount([
|
|
30
30
|
{ id: "1", role: "admin", token: "1:AAA" },
|
|
31
31
|
{ id: "2", role: "public" },
|
|
32
32
|
]);
|
|
33
|
-
expect(bootCensusLine(platformRoot, "acct-1")).toBe("[telegram-api-census] shipped=
|
|
33
|
+
expect(bootCensusLine(platformRoot, "acct-1")).toBe("[telegram-api-census] shipped=177 refused=15 bots=2 withToken=1");
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
36
|
describe("diffMethods", () => {
|
|
@@ -71,9 +71,9 @@ describe("extractMethodNames", () => {
|
|
|
71
71
|
it("deduplicates a name the page anchors twice", () => {
|
|
72
72
|
expect(extractMethodNames(REAL + REAL)).toEqual(["sendMessage"]);
|
|
73
73
|
});
|
|
74
|
-
it("finds all
|
|
74
|
+
it("finds all 177 on the live page shape, built from the shipped list", () => {
|
|
75
75
|
const page = BOT_API_METHODS.map((m) => `<h4><a class="anchor" name="${m.toLowerCase()}"><i class="anchor-icon"></i></a>${m}</h4>`).join("\n");
|
|
76
|
-
expect(extractMethodNames(page)).toHaveLength(
|
|
76
|
+
expect(extractMethodNames(page)).toHaveLength(177);
|
|
77
77
|
expect(diffMethods(extractMethodNames(page))).toEqual({ missing: [], added: [] });
|
|
78
78
|
});
|
|
79
79
|
});
|
|
@@ -93,9 +93,6 @@ describe("OWNED_METHODS", () => {
|
|
|
93
93
|
for (const m of Object.values(MEDIA_SEND_METHOD)) {
|
|
94
94
|
expect(OWNED_METHODS[m]).toBe("telegram-media-send");
|
|
95
95
|
}
|
|
96
|
-
for (const m of Object.values(INVOICE_METHOD)) {
|
|
97
|
-
expect(OWNED_METHODS[m]).toBe("telegram-invoice");
|
|
98
|
-
}
|
|
99
96
|
});
|
|
100
97
|
it("claims nothing no tool implements", () => {
|
|
101
98
|
// The buckets that stay on telegram-api by design: membership,
|
|
@@ -103,14 +100,18 @@ describe("OWNED_METHODS", () => {
|
|
|
103
100
|
expect(OWNED_METHODS.pinChatMessage).toBeUndefined();
|
|
104
101
|
expect(OWNED_METHODS.setMyCommands).toBeUndefined();
|
|
105
102
|
expect(OWNED_METHODS.sendSticker).toBeUndefined();
|
|
103
|
+
// Task 2636 — no tool owns the payment methods any more. They are refused,
|
|
104
|
+
// not owned: claiming an owner here would assert a tool that was deleted.
|
|
105
|
+
for (const m of PAYMENT_METHODS)
|
|
106
|
+
expect(OWNED_METHODS[m]).toBeUndefined();
|
|
106
107
|
});
|
|
107
108
|
it("counts a passthrough call to a newly owned method as owned, not as healthy passthrough", () => {
|
|
108
109
|
const t = tallyPassthrough([
|
|
109
110
|
"[telegram-api] op=call callId=aa method=sendPhoto listed=true files=1",
|
|
110
|
-
"[telegram-api] op=call callId=bb method=
|
|
111
|
+
"[telegram-api] op=call callId=bb method=sendPoll listed=true files=0",
|
|
111
112
|
"[telegram-api] op=call callId=cc method=pinChatMessage listed=true files=0",
|
|
112
113
|
]);
|
|
113
|
-
expect(t.owned).toEqual({ sendPhoto: 1,
|
|
114
|
+
expect(t.owned).toEqual({ sendPhoto: 1, sendPoll: 1 });
|
|
114
115
|
expect(t.passthrough).toEqual({ pinChatMessage: 1 });
|
|
115
116
|
});
|
|
116
117
|
});
|
|
@@ -171,5 +172,18 @@ describe("passthroughCensusLine", () => {
|
|
|
171
172
|
writeFileSync(join(dir, "mcp-admin-s1.log.gz"), Buffer.from([0x1f, 0x8b, 0x08]));
|
|
172
173
|
expect(passthroughCensusLine(dir)).toContain("owned=0 passthrough=0");
|
|
173
174
|
});
|
|
175
|
+
// Task 2636 — the live page still documents all eight. Without the exclusion
|
|
176
|
+
// the audit would report them as eight NEW Telegram methods on every run, for
|
|
177
|
+
// ever. This is the permanent state from now on, not a transitional one.
|
|
178
|
+
it("does not report the removed payment methods as newly added", () => {
|
|
179
|
+
const d = diffMethods([...BOT_API_METHODS, ...PAYMENT_METHODS]);
|
|
180
|
+
expect(d.added).toEqual([]);
|
|
181
|
+
expect(d.missing).toEqual([]);
|
|
182
|
+
});
|
|
183
|
+
// The exclusion must not blind the audit to anything else.
|
|
184
|
+
it("still reports a genuinely new method as added", () => {
|
|
185
|
+
const d = diffMethods([...BOT_API_METHODS, "sendSomethingBrandNew"]);
|
|
186
|
+
expect(d.added).toEqual(["sendSomethingBrandNew"]);
|
|
187
|
+
});
|
|
174
188
|
});
|
|
175
189
|
//# sourceMappingURL=api-census.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-census.test.js","sourceRoot":"","sources":["../../src/__tests__/api-census.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"api-census.test.js","sourceRoot":"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AAC,GAAG,eAAe,EAAE,uBAAuB,CAAC,CAAC,CAAC;QACrE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { checkMethod } from "../lib/api-guard.js";
|
|
2
|
+
import { checkMethod, PAYMENT_METHODS, REFUSED_COUNT } from "../lib/api-guard.js";
|
|
3
3
|
import { BOT_API_METHODS } from "../lib/api-methods.js";
|
|
4
4
|
describe("checkMethod", () => {
|
|
5
5
|
it("refuses setWebhook, naming the tool that owns webhook state", () => {
|
|
@@ -51,19 +51,55 @@ describe("checkMethod", () => {
|
|
|
51
51
|
expect(checkMethod("getManagedBotAccessSettings")).toMatchObject({ allowed: true });
|
|
52
52
|
expect(checkMethod("setManagedBotAccessSettings")).toMatchObject({ allowed: true });
|
|
53
53
|
});
|
|
54
|
-
//
|
|
54
|
+
// Task 2636 — the payment surface is deleted, so the escape hatch must refuse
|
|
55
|
+
// it. Without this the deletion INVERTS: an unlisted method is allowed, so
|
|
56
|
+
// removing the names from BOT_API_METHODS would make sendInvoice reachable.
|
|
57
|
+
it("refuses every payment method, naming no owner because none exists", () => {
|
|
58
|
+
for (const m of PAYMENT_METHODS) {
|
|
59
|
+
expect(checkMethod(m)).toEqual({
|
|
60
|
+
allowed: false,
|
|
61
|
+
reason: "payments-surface-removed",
|
|
62
|
+
owner: "nothing: this install takes no payment inside Telegram",
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
// The list is hand-maintained, so an edit that empties it refuses nothing and
|
|
67
|
+
// reads exactly like a healthy guard — the zero-count trap Task 2557 named.
|
|
68
|
+
// Pinning the eight names literally is what makes that loud.
|
|
69
|
+
it("names all eight payment methods", () => {
|
|
70
|
+
expect(PAYMENT_METHODS.slice().sort()).toEqual([
|
|
71
|
+
"answerPreCheckoutQuery",
|
|
72
|
+
"answerShippingQuery",
|
|
73
|
+
"createInvoiceLink",
|
|
74
|
+
"editUserStarSubscription",
|
|
75
|
+
"getMyStarBalance",
|
|
76
|
+
"getStarTransactions",
|
|
77
|
+
"refundStarPayment",
|
|
78
|
+
"sendInvoice",
|
|
79
|
+
]);
|
|
80
|
+
});
|
|
81
|
+
// Asserting the whole set, not individual names, is what stops a sixteenth
|
|
55
82
|
// refusal being added without a decision.
|
|
56
|
-
it("refuses exactly
|
|
57
|
-
const refused = BOT_API_METHODS.filter((m) => !checkMethod(m).allowed);
|
|
58
|
-
expect(refused
|
|
83
|
+
it("refuses exactly fifteen methods and no more", () => {
|
|
84
|
+
const refused = [...BOT_API_METHODS, ...PAYMENT_METHODS].filter((m) => !checkMethod(m).allowed);
|
|
85
|
+
expect([...new Set(refused)].sort()).toEqual([
|
|
86
|
+
"answerPreCheckoutQuery",
|
|
87
|
+
"answerShippingQuery",
|
|
59
88
|
"close",
|
|
89
|
+
"createInvoiceLink",
|
|
60
90
|
"deleteWebhook",
|
|
91
|
+
"editUserStarSubscription",
|
|
61
92
|
"getManagedBotToken",
|
|
93
|
+
"getMyStarBalance",
|
|
94
|
+
"getStarTransactions",
|
|
62
95
|
"getUpdates",
|
|
63
96
|
"logOut",
|
|
97
|
+
"refundStarPayment",
|
|
64
98
|
"replaceManagedBotToken",
|
|
99
|
+
"sendInvoice",
|
|
65
100
|
"setWebhook",
|
|
66
101
|
]);
|
|
102
|
+
expect(REFUSED_COUNT).toBe(15);
|
|
67
103
|
});
|
|
68
104
|
it("allows a listed method", () => {
|
|
69
105
|
expect(checkMethod("editMessageText")).toEqual({ allowed: true, listed: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-guard.test.js","sourceRoot":"","sources":["../../src/__tests__/api-guard.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,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,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAClF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wEAAwE,EAAE,GAAG,EAAE;QAChF,MAAM,CAAC,WAAW,CAAC,iCAAiC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IACnG,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -3,12 +3,13 @@ import { readFileSync } from "node:fs";
|
|
|
3
3
|
import { dirname, resolve } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { API_VERSION, BOT_API_METHODS, METHOD_SECTIONS } from "../lib/api-methods.js";
|
|
6
|
+
import { PAYMENT_METHODS } from "../lib/api-guard.js";
|
|
6
7
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
7
8
|
describe("api-methods", () => {
|
|
8
|
-
it("carries the
|
|
9
|
+
it("carries the 177 methods of Bot API 10.2 that this install ships", () => {
|
|
9
10
|
expect(API_VERSION).toBe("10.2");
|
|
10
|
-
expect(BOT_API_METHODS).toHaveLength(
|
|
11
|
-
expect(new Set(BOT_API_METHODS).size).toBe(
|
|
11
|
+
expect(BOT_API_METHODS).toHaveLength(177);
|
|
12
|
+
expect(new Set(BOT_API_METHODS).size).toBe(177);
|
|
12
13
|
});
|
|
13
14
|
it("sections partition the method list exactly", () => {
|
|
14
15
|
const flat = METHOD_SECTIONS.flatMap((s) => s.methods);
|
|
@@ -21,5 +22,10 @@ describe("api-methods", () => {
|
|
|
21
22
|
const listed = [...md.matchAll(/^- `([a-z][a-zA-Z]+)`/gm)].map((m) => m[1]);
|
|
22
23
|
expect(listed.slice().sort()).toEqual(BOT_API_METHODS.slice().sort());
|
|
23
24
|
});
|
|
25
|
+
// Task 2636 — the payment surface was removed, so its methods are not shipped.
|
|
26
|
+
it("ships none of the payment methods", () => {
|
|
27
|
+
for (const m of PAYMENT_METHODS)
|
|
28
|
+
expect(BOT_API_METHODS).not.toContain(m);
|
|
29
|
+
});
|
|
24
30
|
});
|
|
25
31
|
//# sourceMappingURL=api-methods.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-methods.test.js","sourceRoot":"","sources":["../../src/__tests__/api-methods.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"api-methods.test.js","sourceRoot":"","sources":["../../src/__tests__/api-methods.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAErD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,M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