@rubytech/create-realagent-code 0.1.592 → 0.1.593
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/plugins/admin/skills/platform-architecture/SKILL.md +7 -3
- package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +6 -0
- package/payload/platform/plugins/docs/references/internals.md +4 -2
- package/payload/platform/plugins/docs/references/telegram-guide.md +2 -0
- package/payload/platform/plugins/scheduling/PLUGIN.md +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/agent-turn-dispatch.test.js +15 -2
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/agent-turn-dispatch.test.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.js +7 -2
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/scheduling-gate.test.js +125 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/scheduling-gate.test.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/scheduling-gate.d.ts +28 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/scheduling-gate.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/scheduling-gate.js +72 -12
- package/payload/platform/plugins/scheduling/mcp/dist/tools/scheduling-gate.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.d.ts +37 -0
- package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.js +178 -13
- package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/rc-public-lockdown.d.ts +13 -5
- package/payload/platform/services/claude-session-manager/dist/rc-public-lockdown.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/rc-public-lockdown.js +23 -9
- package/payload/platform/services/claude-session-manager/dist/rc-public-lockdown.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/telegram-channel-mcp.d.ts +7 -4
- package/payload/platform/services/claude-session-manager/dist/telegram-channel-mcp.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/telegram-channel-mcp.js +5 -3
- package/payload/platform/services/claude-session-manager/dist/telegram-channel-mcp.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/telegram-channel-store.d.ts +15 -1
- package/payload/platform/services/claude-session-manager/dist/telegram-channel-store.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/telegram-channel-store.js +16 -7
- package/payload/platform/services/claude-session-manager/dist/telegram-channel-store.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/telegram-plugin-mcp.d.ts +28 -0
- package/payload/platform/services/claude-session-manager/dist/telegram-plugin-mcp.d.ts.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/telegram-plugin-mcp.js +53 -0
- package/payload/platform/services/claude-session-manager/dist/telegram-plugin-mcp.js.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/wa-channel-mcp.d.ts +9 -5
- package/payload/platform/services/claude-session-manager/dist/wa-channel-mcp.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/wa-channel-mcp.js +12 -6
- package/payload/platform/services/claude-session-manager/dist/wa-channel-mcp.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/webchat-channel-mcp.d.ts +7 -3
- package/payload/platform/services/claude-session-manager/dist/webchat-channel-mcp.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/webchat-channel-mcp.js +5 -1
- package/payload/platform/services/claude-session-manager/dist/webchat-channel-mcp.js.map +1 -1
- package/payload/platform/services/telegram-channel/dist/instructions.d.ts +14 -2
- package/payload/platform/services/telegram-channel/dist/instructions.d.ts.map +1 -1
- package/payload/platform/services/telegram-channel/dist/instructions.js +34 -3
- package/payload/platform/services/telegram-channel/dist/instructions.js.map +1 -1
- package/payload/server/server.js +74 -9
|
@@ -14,12 +14,20 @@ export declare const DONTASK_DENY_BASIS = "mcp__none__deny-basis";
|
|
|
14
14
|
* the WhatsApp tool on those spawns would allowlist a tool that is not
|
|
15
15
|
* registered and leave the visitor unable to reply at all. */
|
|
16
16
|
export declare function publicReplyToolFor(channelServerName: string | null): string;
|
|
17
|
-
/** The exact argv fragment appended to a role:'public' rc-spawn
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
/** The exact argv fragment appended to a role:'public' rc-spawn: one
|
|
18
|
+
* `--allowed-tools` per granted name, `--strict-mcp-config` so only the
|
|
19
|
+
* per-spawn servers register and none of the plugin servers do, and
|
|
20
20
|
* `--permission-mode dontAsk`, which overrides the brand defaultMode and
|
|
21
|
-
* auto-denies every unlisted tool including Bash, Write, Edit and Read.
|
|
22
|
-
|
|
21
|
+
* auto-denies every unlisted tool including Bash, Write, Edit and Read.
|
|
22
|
+
*
|
|
23
|
+
* Task 2666 — `extraTools` is the pinned telegram surface. Supplied by the
|
|
24
|
+
* caller rather than read here: this module is pure, and the authority for
|
|
25
|
+
* which tools are public is PLUGIN.md as parsed into `toolSurface.public`.
|
|
26
|
+
* Naming them here would be a second registry free to drift from the manifest.
|
|
27
|
+
* Absent or empty reproduces the pre-2666 argv byte for byte, which is what
|
|
28
|
+
* holds WhatsApp and webchat at their single reply entry — this builder is
|
|
29
|
+
* shared by all three channels, so widening it for one could widen all. */
|
|
30
|
+
export declare function buildRcPublicLockdownArgv(channelServerName: string | null, extraTools?: readonly string[]): {
|
|
23
31
|
argv: string[];
|
|
24
32
|
allowedTools: string[];
|
|
25
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rc-public-lockdown.d.ts","sourceRoot":"","sources":["../src/rc-public-lockdown.ts"],"names":[],"mappings":"AAYA;;;;;;;4BAO4B;AAC5B,eAAO,MAA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,MAAM,CAET"}
|
|
@@ -27,17 +27,31 @@ export const DONTASK_DENY_BASIS = 'mcp__none__deny-basis';
|
|
|
27
27
|
export function publicReplyToolFor(channelServerName) {
|
|
28
28
|
return channelServerName ? `mcp__${channelServerName}__reply` : DONTASK_DENY_BASIS;
|
|
29
29
|
}
|
|
30
|
-
/** The exact argv fragment appended to a role:'public' rc-spawn
|
|
31
|
-
*
|
|
32
|
-
*
|
|
30
|
+
/** The exact argv fragment appended to a role:'public' rc-spawn: one
|
|
31
|
+
* `--allowed-tools` per granted name, `--strict-mcp-config` so only the
|
|
32
|
+
* per-spawn servers register and none of the plugin servers do, and
|
|
33
33
|
* `--permission-mode dontAsk`, which overrides the brand defaultMode and
|
|
34
|
-
* auto-denies every unlisted tool including Bash, Write, Edit and Read.
|
|
35
|
-
|
|
34
|
+
* auto-denies every unlisted tool including Bash, Write, Edit and Read.
|
|
35
|
+
*
|
|
36
|
+
* Task 2666 — `extraTools` is the pinned telegram surface. Supplied by the
|
|
37
|
+
* caller rather than read here: this module is pure, and the authority for
|
|
38
|
+
* which tools are public is PLUGIN.md as parsed into `toolSurface.public`.
|
|
39
|
+
* Naming them here would be a second registry free to drift from the manifest.
|
|
40
|
+
* Absent or empty reproduces the pre-2666 argv byte for byte, which is what
|
|
41
|
+
* holds WhatsApp and webchat at their single reply entry — this builder is
|
|
42
|
+
* shared by all three channels, so widening it for one could widen all. */
|
|
43
|
+
export function buildRcPublicLockdownArgv(channelServerName, extraTools = []) {
|
|
36
44
|
const tool = publicReplyToolFor(channelServerName);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
// Deduped rather than concatenated: a caller that passed the channel entry
|
|
46
|
+
// among its extras would otherwise push the same flag twice, and `count=` on
|
|
47
|
+
// the tool-allowlist line would overstate the surface — the same field the
|
|
48
|
+
// op=mcp-registered reconciliation is read against.
|
|
49
|
+
const allowedTools = [...new Set([tool, ...extraTools])];
|
|
50
|
+
const argv = [];
|
|
51
|
+
for (const t of allowedTools)
|
|
52
|
+
argv.push('--allowed-tools', t);
|
|
53
|
+
argv.push('--strict-mcp-config', '--permission-mode', 'dontAsk');
|
|
54
|
+
return { argv, allowedTools };
|
|
41
55
|
}
|
|
42
56
|
/** The realised-surface line, emitted at spawn time on EVERY rc-spawn. Shares
|
|
43
57
|
* the `tool-allowlist` tag with pty-spawner.ts so one grep covers both spawn
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rc-public-lockdown.js","sourceRoot":"","sources":["../src/rc-public-lockdown.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,gFAAgF;AAChF,uEAAuE;AACvE,8EAA8E;AAC9E,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,EAAE;AACF,gFAAgF;AAChF,0DAA0D;AAE1D;;;;;;;4BAO4B;AAC5B,MAAM,CAAC,MAAM,kBAAkB,GAAG,uBAAuB,CAAA;AAEzD;;;;;+DAK+D;AAC/D,MAAM,UAAU,kBAAkB,CAAC,iBAAgC;IACjE,OAAO,iBAAiB,CAAC,CAAC,CAAC,QAAQ,iBAAiB,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAA;AACpF,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"rc-public-lockdown.js","sourceRoot":"","sources":["../src/rc-public-lockdown.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,gFAAgF;AAChF,uEAAuE;AACvE,8EAA8E;AAC9E,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,EAAE;AACF,gFAAgF;AAChF,0DAA0D;AAE1D;;;;;;;4BAO4B;AAC5B,MAAM,CAAC,MAAM,kBAAkB,GAAG,uBAAuB,CAAA;AAEzD;;;;;+DAK+D;AAC/D,MAAM,UAAU,kBAAkB,CAAC,iBAAgC;IACjE,OAAO,iBAAiB,CAAC,CAAC,CAAC,QAAQ,iBAAiB,SAAS,CAAC,CAAC,C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G,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAC1D,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;;+EAM+E;AAC/E,MAAM,UAAU,wBAAwB,CAAC,CAIxC;IACC,OAAO,2CAA2C,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,MAAM,YAAY,CAAC,CAAC,OAAO,EAAE,CAAA;AACrH,CAAC"}
|
|
@@ -16,10 +16,13 @@ export interface TelegramChannelMcpParams {
|
|
|
16
16
|
* fails to spawn and the channel never boots (Task 1402); callers pass the
|
|
17
17
|
* installer-resolved NODE_BIN. */
|
|
18
18
|
nodeBin: string;
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
|
|
19
|
+
/** Which framing the channel server gives this conversation, carried as
|
|
20
|
+
* TG_CHANNEL_ROLE. REQUIRED (Task 2666): it was optional, and an omitted
|
|
21
|
+
* value reached a resolver that answered 'admin', so every way of getting
|
|
22
|
+
* the role wrong landed on the highest-privilege framing and emitted
|
|
23
|
+
* nothing. Required here means the compiler asks each caller the question
|
|
24
|
+
* rather than a default answering it. */
|
|
25
|
+
role: 'admin' | 'public';
|
|
23
26
|
/** Task 2356 — spawn-tee inputs; see channel-spawn-tee.ts. Supplied by the
|
|
24
27
|
* caller because this module is pure. */
|
|
25
28
|
platformRoot: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telegram-channel-mcp.d.ts","sourceRoot":"","sources":["../src/telegram-channel-mcp.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,4BAA4B,qBAAqB,CAAA;AAE9D;;mDAEmD;AACnD,eAAO,MAAM,2BAA2B,iCAAgD,CAAA;AAExF,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAA;IACjB,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,CAAA;I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E,MAAM,GAAG,MAAM,EAAE,CAExE"}
|
|
@@ -40,9 +40,11 @@ export function buildTelegramChannelMcpServers(p) {
|
|
|
40
40
|
TG_CHANNEL_SENDER_ID: p.senderId,
|
|
41
41
|
TG_CHANNEL_GATEWAY_URL: p.gatewayUrl,
|
|
42
42
|
TG_CHANNEL_SESSION_ID: p.sessionId,
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
|
|
43
|
+
// Task 2666 — stamped verbatim on BOTH roles, like the whatsapp and
|
|
44
|
+
// webchat twins. It used to be stamped only on the public path, so an
|
|
45
|
+
// admin spawn's env carried no role at all and the server inferred one;
|
|
46
|
+
// that inference is what a resume with no role silently rode into.
|
|
47
|
+
TG_CHANNEL_ROLE: p.role,
|
|
46
48
|
},
|
|
47
49
|
},
|
|
48
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telegram-channel-mcp.js","sourceRoot":"","sources":["../src/telegram-channel-mcp.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,eAAe;AACf,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAEhF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,MAAM,CAAC,MAAM,4BAA4B,GAAG,kBAAkB,CAAA;AAE9D;;mDAEmD;AACnD,MAAM,CAAC,MAAM,2BAA2B,GAAG,QAAQ,4BAA4B,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"telegram-channel-mcp.js","sourceRoot":"","sources":["../src/telegram-channel-mcp.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,eAAe;AACf,EAAE;AACF,yEAAy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AAC,CAAA;AAC9F,CAAC;AAED;;;kCAGkC;AAClC,MAAM,UAAU,4BAA4B,CAAC,SAAiB,EAAE,GAAW;IACzE,OAAO,IAAI,CAAC,GAAG,EAAE,yBAAyB,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;AAC7F,CAAC;AAED;4EAC4E;AAC5E,MAAM,UAAU,wBAAwB,CAAC,aAAqB;IAC5D,OAAO,CAAC,cAAc,EAAE,aAAa,EAAE,GAAG,8BAA8B,EAAE,CAAC,CAAA;AAC7E,CAAC"}
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import type { Logger } from './types.js';
|
|
2
|
-
/** The three launch fields the channel argv is rebuilt from
|
|
2
|
+
/** The three launch fields the channel argv is rebuilt from, plus Task 2666's
|
|
3
|
+
* optional pin.
|
|
4
|
+
*
|
|
5
|
+
* The pin is optional because an admin or specialist telegram spawn sends
|
|
6
|
+
* neither, and a session bound before 2666 has neither on disk. It is stored
|
|
7
|
+
* rather than re-derived because a RESUME rebuilds the channel argv from this
|
|
8
|
+
* record alone: without it, the second and every later message of a public
|
|
9
|
+
* conversation would come back with no pin and silently drop to the pre-2666
|
|
10
|
+
* single-tool surface. */
|
|
3
11
|
export interface TelegramChannelBinding {
|
|
4
12
|
senderId: string;
|
|
5
13
|
gatewayUrl: string;
|
|
6
14
|
serverPath: string;
|
|
15
|
+
/** The bot this conversation belongs to, its numeric Telegram id. */
|
|
16
|
+
botId?: string;
|
|
17
|
+
/** The chat this conversation belongs to: the sender in a DM, the group in a
|
|
18
|
+
* group, the customer's chat in a business chat. Never derived here — the
|
|
19
|
+
* spawn site supplies the same value it hands the file follower. */
|
|
20
|
+
chatId?: string;
|
|
7
21
|
}
|
|
8
22
|
export interface TelegramChannelEntry extends TelegramChannelBinding {
|
|
9
23
|
boundAt: string;
|
package/payload/platform/services/claude-session-manager/dist/telegram-channel-store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telegram-channel-store.d.ts","sourceRoot":"","sources":["../src/telegram-channel-store.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC
|
|
1
|
+
{"version":3,"file":"telegram-channel-store.d.ts","sourceRoot":"","sources":["../src/telegram-channel-store.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;;;2BAQ2B;AAC3B,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;yEAEqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB;IAClE,OAAO,EAAE,MAAM,CAAA;CAChB;AAkBD,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA0C;IACtE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;gBAEnB,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAK5C;;gDAE4C;IAC5C,YAAY,IAAI,IAAI;IA6CpB,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS;IAIxD,4EAA4E;IAC5E,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,GAAG,oBAAoB;IAO7E,8EAA8E;IAC9E,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAMlC,oDAAoD;IACpD,IAAI,IAAI,MAAM;IAId,OAAO,CAAC,aAAa;CAatB"}
|
|
@@ -23,7 +23,13 @@ function isValidBinding(v) {
|
|
|
23
23
|
const o = v;
|
|
24
24
|
return (typeof o.senderId === 'string' && o.senderId.length > 0 &&
|
|
25
25
|
typeof o.gatewayUrl === 'string' && o.gatewayUrl.length > 0 &&
|
|
26
|
-
typeof o.serverPath === 'string' && o.serverPath.length > 0
|
|
26
|
+
typeof o.serverPath === 'string' && o.serverPath.length > 0 &&
|
|
27
|
+
// Task 2666 — absent is valid, present-and-wrong is not. A numeric botId
|
|
28
|
+
// would reach the plugin env as the string "111" and still pin, so the
|
|
29
|
+
// shape is checked rather than coerced: a record this store cannot vouch
|
|
30
|
+
// for is skipped, and the spawn falls back to the closed surface.
|
|
31
|
+
(o.botId === undefined || (typeof o.botId === 'string' && o.botId.length > 0)) &&
|
|
32
|
+
(o.chatId === undefined || (typeof o.chatId === 'string' && o.chatId.length > 0)));
|
|
27
33
|
}
|
|
28
34
|
export class TelegramChannelStore {
|
|
29
35
|
bySessionId = new Map();
|
|
@@ -71,12 +77,15 @@ export class TelegramChannelStore {
|
|
|
71
77
|
continue;
|
|
72
78
|
const rawBoundAt = value.boundAt;
|
|
73
79
|
const boundAt = typeof rawBoundAt === 'string' && rawBoundAt.length > 0 ? rawBoundAt : new Date(0).toISOString();
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
// Task 2666 — the pin fields are spread rather than named, because a
|
|
81
|
+
// hand-listed reconstruction drops any field added later in silence:
|
|
82
|
+
// `set` already spreads, so a listed load and a spread write disagreed
|
|
83
|
+
// about what a binding is, and the pin survived a write and died on the
|
|
84
|
+
// next boot. The cost is that an unrecognised key in a hand-edited file
|
|
85
|
+
// is now kept in memory rather than dropped; nothing reads one, and the
|
|
86
|
+
// argv rebuild names the fields it wants.
|
|
87
|
+
const { senderId, gatewayUrl, serverPath, ...rest } = value;
|
|
88
|
+
this.bySessionId.set(sessionId, { senderId, gatewayUrl, serverPath, ...rest, boundAt });
|
|
80
89
|
loaded += 1;
|
|
81
90
|
}
|
|
82
91
|
this.logger(`[claude-session-manager] telegram-channel-store-load ok entries=${loaded} path=${this.filePath}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telegram-channel-store.js","sourceRoot":"","sources":["../src/telegram-channel-store.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,iFAAiF;AACjF,+EAA+E;AAC/E,iFAAiF;AACjF,6EAA6E;AAC7E,6CAA6C;AAC7C,EAAE;AACF,aAAa;AACb,6EAA6E;AAC7E,+EAA+E;AAC/E,0EAA0E;AAC1E,yEAAyE;AACzE,6DAA6D;AAC7D,2EAA2E;AAC3E,mEAAmE;AACnE,EAAE;AACF,4BAA4B;AAC5B,8GAA8G;AAE9G,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"telegram-channel-store.js","sourceRoot":"","sources":["../src/telegram-channel-store.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,iFAAiF;AACjF,+EAA+E;AAC/E,iFAAiF;AACjF,6EAA6E;AAC7E,6CAA6C;AAC7C,EAAE;AACF,aAAa;AACb,6EAA6E;AAC7E,+EAA+E;AAC/E,0EAA0E;AAC1E,yEAAyE;AACzE,6DAA6D;AAC7D,2EAA2E;AAC3E,mEAAmE;AACnE,EAAE;AACF,4BAA4B;AAC5B,8GAA8G;AAE9G,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AA4B7E,SAAS,cAAc,CAAC,CAAU;IAChC,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC7C,MAAM,CAAC,GAAG,CAA4B,CAAA;IACtC,OAAO,CACL,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;QACvD,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,IAAI,C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AAK,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,WAAW;YAAE,GAAG,CAAC,SAAS,CAAC,GAAG,KAAK,CAAA;QACzE,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,QAAQ,MAAM,CAAA;QAClC,IAAI,CAAC;YACH,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;YACzD,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QAChC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YAC/D,IAAI,CAAC,MAAM,CAAC,yEAAyE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAA;YAC5G,yEAAyE;QAC3E,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Must equal the plugin directory basename: `qualifyShortToolName` builds
|
|
2
|
+
* `mcp__<plugin>__<tool>` and the allowlist entries have to name a server that
|
|
3
|
+
* is actually registered. */
|
|
4
|
+
export declare const TELEGRAM_PLUGIN_SERVER_NAME = "telegram";
|
|
5
|
+
export interface TelegramPluginMcpParams {
|
|
6
|
+
sessionId: string;
|
|
7
|
+
/** The one bot this session may act as. */
|
|
8
|
+
botId: string;
|
|
9
|
+
/** The one chat this session may send to. */
|
|
10
|
+
chatId: string;
|
|
11
|
+
/** The account whose `account.json` holds the bot token. `toolDeps()` in the
|
|
12
|
+
* plugin reads this as ACCOUNT_ID; without it every tool refuses with
|
|
13
|
+
* `op=no-account`. */
|
|
14
|
+
accountId: string;
|
|
15
|
+
/** Absolute path to the node binary. On darwin the launchd server PATH
|
|
16
|
+
* excludes an nvm node, so a bare `node` fails to spawn (Task 1402). */
|
|
17
|
+
nodeBin: string;
|
|
18
|
+
platformRoot: string;
|
|
19
|
+
logDir: string;
|
|
20
|
+
platformPort: string;
|
|
21
|
+
}
|
|
22
|
+
export interface TelegramPluginMcpServerEntry {
|
|
23
|
+
command: string;
|
|
24
|
+
args: string[];
|
|
25
|
+
env: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
export declare function buildTelegramPluginMcpServers(p: TelegramPluginMcpParams): Record<string, TelegramPluginMcpServerEntry>;
|
|
28
|
+
//# sourceMappingURL=telegram-plugin-mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telegram-plugin-mcp.d.ts","sourceRoot":"","sources":["../src/telegram-plugin-mcp.ts"],"names":[],"mappings":"AAqBA;;8BAE8B;AAC9B,eAAO,MAAM,2BAA2B,aAAa,CAAA;AAErD,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAA;IACb,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAA;IACd;;2BAEuB;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB;6EACyE;IACzE,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC5B;AAED,wBAAgB,6BAA6B,CAC3C,CAAC,EAAE,uBAAuB,GACzB,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,CA4B9C"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Task 2666 — the per-spawn registration of the telegram PLUGIN server for a
|
|
2
|
+
// public telegram spawn.
|
|
3
|
+
//
|
|
4
|
+
// Why this exists at all. A public spawn passes `--strict-mcp-config`, so the
|
|
5
|
+
// only MCP servers it holds are the ones its own `--mcp-config` file names.
|
|
6
|
+
// Admin and specialist spawns take the same plugin from the installed-plugin
|
|
7
|
+
// channel under the LONG prefix (`mcp__plugin_telegram_telegram__…`); a public
|
|
8
|
+
// spawn cannot, so it registers the identical entrypoint here under the SHORT
|
|
9
|
+
// prefix `qualifyShortToolName` produces. The server name is therefore not a
|
|
10
|
+
// free choice: it must equal the plugin directory basename, `telegram`, or
|
|
11
|
+
// every granted tool name points at a server that is not registered — the
|
|
12
|
+
// failure the Task 2403 comment in pty-spawner.ts records, where a spawn was
|
|
13
|
+
// handed `--allowed-tools mcp__telegram-channel__reply` for a server nothing
|
|
14
|
+
// registered and sat alive and idle with no way to answer.
|
|
15
|
+
//
|
|
16
|
+
// Pure (no fs, no process.env), like telegram-channel-mcp.ts, so it unit-tests
|
|
17
|
+
// without node-pty and the caller owns the file write.
|
|
18
|
+
import { join } from 'node:path';
|
|
19
|
+
import { buildChannelSpawnTee } from './channel-spawn-tee.js';
|
|
20
|
+
/** Must equal the plugin directory basename: `qualifyShortToolName` builds
|
|
21
|
+
* `mcp__<plugin>__<tool>` and the allowlist entries have to name a server that
|
|
22
|
+
* is actually registered. */
|
|
23
|
+
export const TELEGRAM_PLUGIN_SERVER_NAME = 'telegram';
|
|
24
|
+
export function buildTelegramPluginMcpServers(p) {
|
|
25
|
+
const tee = buildChannelSpawnTee({
|
|
26
|
+
nodeBin: p.nodeBin,
|
|
27
|
+
platformRoot: p.platformRoot,
|
|
28
|
+
logDir: p.logDir,
|
|
29
|
+
platformPort: p.platformPort,
|
|
30
|
+
sessionId: p.sessionId,
|
|
31
|
+
serverName: TELEGRAM_PLUGIN_SERVER_NAME,
|
|
32
|
+
serverPath: join(p.platformRoot, 'plugins', 'telegram', 'mcp', 'dist', 'index.js'),
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
[TELEGRAM_PLUGIN_SERVER_NAME]: {
|
|
36
|
+
command: tee.command,
|
|
37
|
+
args: tee.args,
|
|
38
|
+
env: {
|
|
39
|
+
...tee.env,
|
|
40
|
+
PLATFORM_ROOT: p.platformRoot,
|
|
41
|
+
ACCOUNT_ID: p.accountId,
|
|
42
|
+
// Task 2666 — the pin. Present ONLY on a public spawn, which is what
|
|
43
|
+
// makes its presence the plugin's own public-spawn signal: an admin
|
|
44
|
+
// spawn takes this plugin from the installed-plugin channel and never
|
|
45
|
+
// reaches this builder, so its tools see neither variable and behave
|
|
46
|
+
// exactly as they did before this task.
|
|
47
|
+
TG_PUBLIC_BOT_ID: p.botId,
|
|
48
|
+
TG_PUBLIC_CHAT_ID: p.chatId,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=telegram-plugin-mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telegram-plugin-mcp.js","sourceRoot":"","sources":["../src/telegram-plugin-mcp.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,yBAAyB;AACzB,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,6EAA6E;AAC7E,2EAA2E;AAC3E,0EAA0E;AAC1E,6EAA6E;AAC7E,6EAA6E;AAC7E,2DAA2D;AAC3D,EAAE;AACF,+EAA+E;AAC/E,uDAAuD;AAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D;;8BAE8B;AAC9B,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,CAAA;AA0BrD,MAAM,UAAU,6BAA6B,CAC3C,CAA0B;IAE1B,MAAM,GAAG,GAAG,oBAAoB,CAAC;QAC/B,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,YAAY,EAAE,CAAC,CAAC,YAAY;QAC5B,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,YAAY,EAAE,CAAC,CAAC,YAAY;QAC5B,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,UAAU,EAAE,2BAA2B;QACvC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC;KACnF,CAAC,CAAA;IACF,OAAO;QACL,CAAC,2BAA2B,CAAC,EAAE;YAC7B,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,GAAG,EAAE;gBACH,GAAG,GAAG,CAAC,GAAG;gBACV,aAAa,EAAE,CAAC,CAAC,YAAY;gBAC7B,UAAU,EAAE,CAAC,CAAC,SAAS;gBACvB,qEAAqE;gBACrE,oEAAoE;gBACpE,sEAAsE;gBACtE,qEAAqE;gBACrE,wCAAwC;gBACxC,gBAAgB,EAAE,CAAC,CAAC,KAAK;gBACzB,iBAAiB,EAAE,CAAC,CAAC,MAAM;aAC5B;SACF;KACF,CAAA;AACH,CAAC"}
|
|
@@ -18,11 +18,15 @@ export interface WaChannelMcpParams {
|
|
|
18
18
|
accountId: string;
|
|
19
19
|
/** Task 2458 — which role this session's channel server serves. The gateway
|
|
20
20
|
* branches its turn-end delivery on it: a public turn goes back down the
|
|
21
|
-
* posting key, an admin turn fans out.
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
|
|
21
|
+
* posting key, an admin turn fans out.
|
|
22
|
+
*
|
|
23
|
+
* Task 2666 — REQUIRED. It was optional and defaulted to 'admin' at the
|
|
24
|
+
* stamp, and the comment here claimed the channel server's refusal of an
|
|
25
|
+
* absent value made a missed stamp loud. It could not: the default filled
|
|
26
|
+
* the value in before the server ever saw it, so the refusal was
|
|
27
|
+
* unreachable and a caller that named no role got the highest-privilege
|
|
28
|
+
* framing in silence. Required means the compiler asks each caller. */
|
|
29
|
+
role: 'admin' | 'public';
|
|
26
30
|
/** Task 2356 — the three values the spawn-tee shim needs. Supplied by the
|
|
27
31
|
* caller because this module is pure: `deps.platformRoot`, `deps.logDir`,
|
|
28
32
|
* and the manager's own PLATFORM_PORT. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wa-channel-mcp.d.ts","sourceRoot":"","sources":["../src/wa-channel-mcp.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,sBAAsB,qBAAqB,CAAA;AAExD,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAA;IAChB,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAA;IAClB,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAA;IAClB;;;uCAGmC;IACnC,OAAO,EAAE,MAAM,CAAA;IACf;;yEAEqE;IACrE,SAAS,EAAE,MAAM,CAAA;IACjB
|
|
1
|
+
{"version":3,"file":"wa-channel-mcp.d.ts","sourceRoot":"","sources":["../src/wa-channel-mcp.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,sBAAsB,qBAAqB,CAAA;AAExD,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAA;IAChB,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAA;IAClB,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAA;IAClB;;;uCAGmC;IACnC,OAAO,EAAE,MAAM,CAAA;IACf;;yEAEqE;IACrE,SAAS,EAAE,MAAM,CAAA;IACjB;;;;;;;;;4EASwE;IACxE,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAA;IACxB;;+CAE2C;IAC3C,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC5B;AAED,wBAAgB,wBAAwB,CACtC,CAAC,EAAE,kBAAkB,GACpB,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAyCzC;AAED,uEAAuE;AACvE,wBAAgB,wBAAwB,IAAI,MAAM,EAAE,CAEnD;AAED;;;kCAGkC;AAClC,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED;4EAC4E;AAC5E,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,CAElE;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAU7D"}
|
|
@@ -39,12 +39,18 @@ export function buildWaChannelMcpServers(p) {
|
|
|
39
39
|
// Task 2290 — without this the gateway refuses the attach, because a
|
|
40
40
|
// nameless subscriber would receive every account's payloads for this phone.
|
|
41
41
|
WA_CHANNEL_ACCOUNT_ID: p.accountId,
|
|
42
|
-
// Task 2458 — stamped on BOTH roles
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
|
|
42
|
+
// Task 2458 — stamped on BOTH roles. The channel server's
|
|
43
|
+
// resolveChannelRole throws on an absent or unrecognised value rather
|
|
44
|
+
// than defaulting to admin, because that default is exactly what sent a
|
|
45
|
+
// visitor's answer into the admin identity fan-out, which resolves no
|
|
46
|
+
// target for a visitor.
|
|
47
|
+
//
|
|
48
|
+
// Task 2666 — passed through verbatim. The ternary here read as a
|
|
49
|
+
// narrowing but was a fallback: it turned an absent role into the
|
|
50
|
+
// string 'admin' BEFORE the server saw it, so the throw above could
|
|
51
|
+
// never fire and the strictness was decorative. `role` is required now,
|
|
52
|
+
// so there is nothing left to collapse.
|
|
53
|
+
WA_CHANNEL_ROLE: p.role,
|
|
48
54
|
},
|
|
49
55
|
},
|
|
50
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wa-channel-mcp.js","sourceRoot":"","sources":["../src/wa-channel-mcp.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,yEAAyE;AACzE,2EAA2E;AAC3E,mBAAmB;AACnB,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAC5E,4EAA4E;AAC5E,+CAA+C;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,MAAM,CAAC,MAAM,sBAAsB,GAAG,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"wa-channel-mcp.js","sourceRoot":"","sources":["../src/wa-channel-mcp.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,yEAAyE;AACzE,2EAA2E;AAC3E,mBAAmB;AACnB,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAC5E,4EAA4E;AAC5E,+CAA+C;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,MAAM,CAAC,MAAM,sBAAsB,GAAG,kBAAkB,CAAA;AA4CxD,MAAM,UAAU,wBAAwB,CACtC,CAAqB;IAErB,qEAAqE;IACrE,6EAA6E;IAC7E,2EAA2E;IAC3E,mEAAmE;IACnE,MAAM,GAAG,GAAG,oBAAoB,CAAC;QAC/B,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,YAAY,EAAE,CAAC,CAAC,YAAY;QAC5B,MAAM,EAAE,CAAC,CAAC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UAAU,kBAAkB,CAAC,SAAiB;IAClD,MAAM,IAAI,GAAG,SAAS;QACpB,0EAA0E;QAC1E,wEAAwE;QACxE,8DAA8D;SAC7D,OAAO,CAAC,4BAA4B,EAAE,EAAE,CAAC;SACzC,OAAO,CAAC,qCAAqC,EAAE,EAAE,CAAC;SAClD,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;SACzB,WAAW,EAAE,CAAA;IAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAA;AAChF,CAAC"}
|
|
@@ -17,9 +17,13 @@ export interface WebchatChannelMcpParams {
|
|
|
17
17
|
* installer-resolved NODE_BIN. */
|
|
18
18
|
nodeBin: string;
|
|
19
19
|
/** Task 756 — 'public' frames the channel server's instructions + reply-tool
|
|
20
|
-
* copy for an anonymous visitor;
|
|
21
|
-
*
|
|
22
|
-
|
|
20
|
+
* copy for an anonymous visitor; 'admin' keeps the operator framing (Task
|
|
21
|
+
* 772). Carried to the server as WEBCHAT_CHANNEL_ROLE.
|
|
22
|
+
*
|
|
23
|
+
* Task 2666 — REQUIRED. Optional plus an 'admin' default at the stamp meant
|
|
24
|
+
* a caller that named no role silently got the operator framing, and the
|
|
25
|
+
* server's strict resolver never saw the absence. */
|
|
26
|
+
role: 'admin' | 'public';
|
|
23
27
|
/** Task 2356 — spawn-tee inputs; see channel-spawn-tee.ts. Supplied by the
|
|
24
28
|
* caller because this module is pure. */
|
|
25
29
|
platformRoot: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webchat-channel-mcp.d.ts","sourceRoot":"","sources":["../src/webchat-channel-mcp.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,2BAA2B,oBAAoB,CAAA;AAE5D;;uDAEuD;AACvD,eAAO,MAAM,0BAA0B,gCAA+C,CAAA;AAEtF,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB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,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,CAEvE"}
|
|
@@ -44,7 +44,11 @@ export function buildWebchatChannelMcpServers(p) {
|
|
|
44
44
|
// for BOTH roles: resolveChannelRole now throws on an absent or
|
|
45
45
|
// unrecognised value rather than defaulting to admin, because that
|
|
46
46
|
// default is what would silently re-register the retired reply tool.
|
|
47
|
-
|
|
47
|
+
//
|
|
48
|
+
// Task 2666 — passed through verbatim. The ternary read as a narrowing
|
|
49
|
+
// but was a fallback: it turned an absent role into 'admin' BEFORE the
|
|
50
|
+
// server saw it, so the throw above could never fire.
|
|
51
|
+
WEBCHAT_CHANNEL_ROLE: p.role,
|
|
48
52
|
},
|
|
49
53
|
},
|
|
50
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webchat-channel-mcp.js","sourceRoot":"","sources":["../src/webchat-channel-mcp.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,4EAA4E;AAC5E,yEAAyE;AACzE,+EAA+E;AAC/E,eAAe;AACf,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAEhF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,MAAM,CAAC,MAAM,2BAA2B,GAAG,iBAAiB,CAAA;AAE5D;;uDAEuD;AACvD,MAAM,CAAC,MAAM,0BAA0B,GAAG,QAAQ,2BAA2B,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"webchat-channel-mcp.js","sourceRoot":"","sources":["../src/webchat-channel-mcp.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,4EAA4E;AAC5E,yEAAyE;AACzE,+EAA+E;AAC/E,eAAe;AACf,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,+EAA+E;AAC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AAE,UAAU,2BAA2B,EAAE,CAAC,CAAA;AAC7F,CAAC;AAED;;;kCAGkC;AAClC,MAAM,UAAU,2BAA2B,CAAC,SAAiB,EAAE,GAAW;IACxE,OAAO,IAAI,CAAC,GAAG,EAAE,wBAAwB,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;AAC5F,CAAC;AAED;4EAC4E;AAC5E,MAAM,UAAU,uBAAuB,CAAC,aAAqB;IAC3D,OAAO,CAAC,cAAc,EAAE,aAAa,EAAE,GAAG,6BAA6B,EAAE,CAAC,CAAA;AAC5E,CAAC"}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
export type TelegramChannelRole = 'admin' | 'public';
|
|
2
|
-
/** Resolve the channel role from the spawn env (TG_CHANNEL_ROLE).
|
|
3
|
-
*
|
|
2
|
+
/** Resolve the channel role from the spawn env (TG_CHANNEL_ROLE). Strict, like
|
|
3
|
+
* the whatsapp and webchat twins.
|
|
4
|
+
*
|
|
5
|
+
* Task 2666 — this used to return 'admin' for anything that was not the
|
|
6
|
+
* literal 'public', and called that the safe default. It is the opposite of
|
|
7
|
+
* safe: admin is the HIGHEST-privilege framing on this door, and reaching it
|
|
8
|
+
* by exclusion means every way of getting the role wrong lands there. A resume
|
|
9
|
+
* that omitted the role booted a stranger's conversation with the block that
|
|
10
|
+
* says the message "is a message the operator has typed to you directly" and
|
|
11
|
+
* to act on it as their instruction, and it emitted nothing while doing so: a
|
|
12
|
+
* spawn that silently became admin is byte-identical to a correct admin spawn.
|
|
13
|
+
*
|
|
14
|
+
* Both spawn paths stamp the env, so an absent or unrecognised value means the
|
|
15
|
+
* spawn is wrong and the channel must not boot. */
|
|
4
16
|
export declare function resolveChannelRole(raw: string | undefined): TelegramChannelRole;
|
|
5
17
|
export declare function channelInstructions(role: TelegramChannelRole): string;
|
|
6
18
|
export declare function replyToolDescription(role: TelegramChannelRole): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,QAAQ,CAAA;AAEpD;
|
|
1
|
+
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,QAAQ,CAAA;AAEpD;;;;;;;;;;;;;oDAaoD;AACpD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,mBAAmB,CAM/E;AAkED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAErE;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAItE;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAEtE;AAoBD,eAAO,MAAM,yBAAyB,QAkEiE,CAAA"}
|
|
@@ -4,10 +4,26 @@
|
|
|
4
4
|
// as an operator instruction — it answers a visitor. The black-box +
|
|
5
5
|
// no-internals guardrails apply to both. Pure so the framing is unit-testable
|
|
6
6
|
// without booting the MCP server.
|
|
7
|
-
/** Resolve the channel role from the spawn env (TG_CHANNEL_ROLE).
|
|
8
|
-
*
|
|
7
|
+
/** Resolve the channel role from the spawn env (TG_CHANNEL_ROLE). Strict, like
|
|
8
|
+
* the whatsapp and webchat twins.
|
|
9
|
+
*
|
|
10
|
+
* Task 2666 — this used to return 'admin' for anything that was not the
|
|
11
|
+
* literal 'public', and called that the safe default. It is the opposite of
|
|
12
|
+
* safe: admin is the HIGHEST-privilege framing on this door, and reaching it
|
|
13
|
+
* by exclusion means every way of getting the role wrong lands there. A resume
|
|
14
|
+
* that omitted the role booted a stranger's conversation with the block that
|
|
15
|
+
* says the message "is a message the operator has typed to you directly" and
|
|
16
|
+
* to act on it as their instruction, and it emitted nothing while doing so: a
|
|
17
|
+
* spawn that silently became admin is byte-identical to a correct admin spawn.
|
|
18
|
+
*
|
|
19
|
+
* Both spawn paths stamp the env, so an absent or unrecognised value means the
|
|
20
|
+
* spawn is wrong and the channel must not boot. */
|
|
9
21
|
export function resolveChannelRole(raw) {
|
|
10
|
-
|
|
22
|
+
if (raw === 'public')
|
|
23
|
+
return 'public';
|
|
24
|
+
if (raw === 'admin')
|
|
25
|
+
return 'admin';
|
|
26
|
+
throw new Error(`telegram-channel: TG_CHANNEL_ROLE must be 'admin' or 'public' (got ${raw === undefined ? 'undefined' : JSON.stringify(raw)})`);
|
|
11
27
|
}
|
|
12
28
|
const NO_INTERNALS = `The platform you run on is a black box: never read, grep, or edit the platform install or its ` +
|
|
13
29
|
`server bundle, and never restart platform services. If the platform itself is broken, describe ` +
|
|
@@ -49,6 +65,21 @@ const PUBLIC_INSTRUCTIONS = SPECIALIST_AUDIENCE +
|
|
|
49
65
|
`question or do what the visitor asked within your remit, then (2) write that answer as the ` +
|
|
50
66
|
`final text of your turn. That text is what reaches the visitor's chat, so never end a turn ` +
|
|
51
67
|
`without it and never wait for confirmation before answering. ` +
|
|
68
|
+
// Task 2666 — a public spawn holds four Telegram tools now. Without this
|
|
69
|
+
// paragraph the agent keeps answering in plain text, because the block above
|
|
70
|
+
// tells it to write its answer as final text and names no tool: the surface
|
|
71
|
+
// would ship and nothing would use it.
|
|
72
|
+
`You can do more than write sentences in this chat, and a good answer often is not a paragraph. ` +
|
|
73
|
+
`Use telegram-card when the visitor is choosing between a small number of things: it posts your ` +
|
|
74
|
+
`text with tappable buttons under it, a button can open a web page inside Telegram, and giving ` +
|
|
75
|
+
`the same card a key lets you update that one message later instead of stacking new ones below ` +
|
|
76
|
+
`it. When you send a card, the card IS your answer — do not repeat it as your final text. ` +
|
|
77
|
+
`Use telegram-ask for a poll, a quiz, a checklist, a map pin, a venue or a contact card. ` +
|
|
78
|
+
`Use telegram-media-send for a photo, document, video, voice note or a set of images. ` +
|
|
79
|
+
`Use telegram-media-fetch to open a file the visitor sent you. ` +
|
|
80
|
+
`Beside a poll or a photo, still write the sentence that says what the visitor is looking at. ` +
|
|
81
|
+
`You act only as this bot and only in this chat: both are fixed for you, so never try to reach ` +
|
|
82
|
+
`another person or another conversation. ` +
|
|
52
83
|
NO_INTERNALS;
|
|
53
84
|
export function channelInstructions(role) {
|
|
54
85
|
return role === 'public' ? PUBLIC_INSTRUCTIONS : ADMIN_INSTRUCTIONS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,+EAA+E;AAC/E,+EAA+E;AAC/E,qEAAqE;AACrE,8EAA8E;AAC9E,kCAAkC;AAIlC;
|
|
1
|
+
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,+EAA+E;AAC/E,+EAA+E;AAC/E,qEAAqE;AACrE,8EAA8E;AAC9E,kCAAkC;AAIlC;;;;;;;;;;;;;oDAaoD;AACpD,MAAM,UAAU,kBAAkB,CAAC,GAAuB;IACxD,IAAI,GAAG,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAA;IACrC,IAAI,GAAG,KAAK,OAAO;QAAE,OAAO,OAAO,CAAA;IACnC,MAAM,IAAI,KAAK,CACb,sEAAsE,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAC/H,CAAA;AACH,CAAC;AAED,MAAM,YAAY,GAChB,gGAAgG;IAChG,iGAAiG;IACjG,mGAAmG;IACnG,iGAAiG;IACjG,0EAA0E,CAAA;AAE5E,yEAAyE;AACzE,gFAAgF;AAChF,wEAAwE;AACxE,yEAAyE;AACzE,8EAA8E;AAC9E,iFAAiF;AACjF,6EAA6E;AAC7E,mFAAmF;AACnF,6EAA6E;AAC7E,8EAA8E;AAC9E,kFAAkF;AACl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