@opentag/telegram 0.2.0
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/LICENSE +21 -0
- package/README.md +55 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +231 -0
- package/dist/index.js.map +1 -0
- package/dist/normalize.d.ts +43 -0
- package/dist/normalize.d.ts.map +1 -0
- package/dist/render.d.ts +30 -0
- package/dist/render.d.ts.map +1 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Amplift
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @opentag/telegram
|
|
2
|
+
|
|
3
|
+
Telegram message normalization and callback helpers for OpenTag.
|
|
4
|
+
|
|
5
|
+
Use this package to normalize Telegram bot messages into `OpenTagEvent` objects
|
|
6
|
+
and to encode or parse Telegram callback thread keys.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pnpm add @opentag/telegram
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Exports
|
|
15
|
+
|
|
16
|
+
- `normalizeTelegramMessage`: converts a Telegram message into an `OpenTagEvent`.
|
|
17
|
+
- `encodeTelegramThreadKey`: encodes bot, chat, and message coordinates for callback routing.
|
|
18
|
+
- `parseTelegramThreadKey`: decodes a Telegram callback thread key.
|
|
19
|
+
- `renderTelegramAcknowledgement`: renders the Telegram acknowledgement body.
|
|
20
|
+
- `renderTelegramFinalResult`: renders the Telegram final result body.
|
|
21
|
+
- `createTelegramSendMessagePayload`: creates a Telegram Bot API `sendMessage` payload.
|
|
22
|
+
|
|
23
|
+
## Example
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { normalizeTelegramMessage } from "@opentag/telegram";
|
|
27
|
+
|
|
28
|
+
const event = normalizeTelegramMessage({
|
|
29
|
+
botId: "bot_123",
|
|
30
|
+
botUsername: "opentag_bot",
|
|
31
|
+
chatId: "456",
|
|
32
|
+
chatType: "private",
|
|
33
|
+
userId: "789",
|
|
34
|
+
username: "alice",
|
|
35
|
+
text: "investigate this deploy failure",
|
|
36
|
+
messageId: 101,
|
|
37
|
+
updateId: 202,
|
|
38
|
+
binding: {
|
|
39
|
+
botId: "bot_123",
|
|
40
|
+
chatId: "456",
|
|
41
|
+
repoProvider: "github",
|
|
42
|
+
owner: "acme",
|
|
43
|
+
repo: "demo"
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
if (event) {
|
|
48
|
+
// Send the event to @opentag/client or your own OpenTag-compatible control plane.
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Stability
|
|
53
|
+
|
|
54
|
+
Telegram thread key format is public because callback sinks depend on it.
|
|
55
|
+
Change it only with a migration path.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
// src/normalize.ts
|
|
2
|
+
import { commandFromRawText } from "@opentag/core";
|
|
3
|
+
function escapeRegExp(text) {
|
|
4
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5
|
+
}
|
|
6
|
+
function stripTelegramInvocation(input) {
|
|
7
|
+
const trimmed = input.text.trim();
|
|
8
|
+
if (!trimmed) return null;
|
|
9
|
+
if (input.chatType === "private") return trimmed;
|
|
10
|
+
const username = input.botUsername?.replace(/^@/, "");
|
|
11
|
+
const patterns = username ? [
|
|
12
|
+
new RegExp(`^@${escapeRegExp(username)}\\s+`, "i"),
|
|
13
|
+
new RegExp(`^/opentag@${escapeRegExp(username)}\\s+`, "i"),
|
|
14
|
+
/^\/opentag\s+/i
|
|
15
|
+
] : [/^\/opentag\s+/i];
|
|
16
|
+
for (const pattern of patterns) {
|
|
17
|
+
const stripped = trimmed.replace(pattern, "").trim();
|
|
18
|
+
if (stripped !== trimmed) {
|
|
19
|
+
return stripped.length > 0 ? stripped : null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
function encodeTelegramThreadKey(input) {
|
|
25
|
+
return [input.botId, input.chatId, String(input.replyToMessageId), input.messageThreadId ? String(input.messageThreadId) : ""].join("|");
|
|
26
|
+
}
|
|
27
|
+
function parseTelegramThreadKey(threadKey) {
|
|
28
|
+
const [botId, chatId, replyToMessageIdRaw, messageThreadIdRaw] = threadKey.split("|");
|
|
29
|
+
const replyToMessageId = Number(replyToMessageIdRaw);
|
|
30
|
+
if (!botId || !chatId || !Number.isInteger(replyToMessageId) || replyToMessageId <= 0) {
|
|
31
|
+
throw new Error(`Invalid Telegram thread key: ${threadKey}`);
|
|
32
|
+
}
|
|
33
|
+
const messageThreadId = messageThreadIdRaw ? Number(messageThreadIdRaw) : void 0;
|
|
34
|
+
return {
|
|
35
|
+
botId,
|
|
36
|
+
chatId,
|
|
37
|
+
replyToMessageId,
|
|
38
|
+
...messageThreadId && Number.isInteger(messageThreadId) && messageThreadId > 0 ? { messageThreadId } : {}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function permissionsForIntent(intent) {
|
|
42
|
+
const permissions = [
|
|
43
|
+
{
|
|
44
|
+
scope: "chat:postMessage",
|
|
45
|
+
reason: "reply in the originating Telegram thread"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
scope: "runner:local",
|
|
49
|
+
reason: "execute the run on a paired local daemon"
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
if (intent === "fix" || intent === "run") {
|
|
53
|
+
permissions.push(
|
|
54
|
+
{
|
|
55
|
+
scope: "repo:read",
|
|
56
|
+
reason: "inspect the repository in the paired local checkout"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
scope: "repo:write",
|
|
60
|
+
reason: "commit code changes on an isolated run branch"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
scope: "pr:create",
|
|
64
|
+
reason: "open a pull request for completed code changes"
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return permissions;
|
|
69
|
+
}
|
|
70
|
+
function referenceTitle(reference) {
|
|
71
|
+
return reference.title ?? "Command file reference";
|
|
72
|
+
}
|
|
73
|
+
function contextPointersForCommand(command) {
|
|
74
|
+
const context = [];
|
|
75
|
+
for (const reference of command.parsed?.references ?? []) {
|
|
76
|
+
if (reference.kind === "url") {
|
|
77
|
+
context.push({
|
|
78
|
+
kind: "url",
|
|
79
|
+
uri: reference.uri,
|
|
80
|
+
visibility: "organization",
|
|
81
|
+
title: reference.title ?? "Command URL reference"
|
|
82
|
+
});
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (reference.kind === "file" || reference.kind === "path") {
|
|
86
|
+
context.push({
|
|
87
|
+
kind: "file",
|
|
88
|
+
uri: reference.uri,
|
|
89
|
+
...reference.line ? { line: reference.line } : {},
|
|
90
|
+
...reference.startLine ? { startLine: reference.startLine } : {},
|
|
91
|
+
...reference.endLine ? { endLine: reference.endLine } : {},
|
|
92
|
+
visibility: "organization",
|
|
93
|
+
title: referenceTitle(reference)
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return context;
|
|
98
|
+
}
|
|
99
|
+
function commandMetadata(command) {
|
|
100
|
+
if (!command.parsed) return {};
|
|
101
|
+
return {
|
|
102
|
+
commandParser: command.parsed.version,
|
|
103
|
+
commandDiagnostics: command.parsed.diagnostics,
|
|
104
|
+
...command.parsed.approval ? { approval: command.parsed.approval } : {},
|
|
105
|
+
...command.parsed.network ? { network: command.parsed.network } : {}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function normalizeTelegramMessage(input) {
|
|
109
|
+
const rawText = stripTelegramInvocation({
|
|
110
|
+
text: input.text,
|
|
111
|
+
chatType: input.chatType,
|
|
112
|
+
...input.botUsername ? { botUsername: input.botUsername } : {}
|
|
113
|
+
});
|
|
114
|
+
if (!rawText) return null;
|
|
115
|
+
const command = commandFromRawText(rawText);
|
|
116
|
+
const agentId = input.agentId ?? "opentag";
|
|
117
|
+
return {
|
|
118
|
+
id: `evt_telegram_${input.updateId ?? `${input.botId}_${input.chatId}_${input.messageId}`}`,
|
|
119
|
+
source: "telegram",
|
|
120
|
+
sourceEventId: String(input.updateId ?? input.messageId),
|
|
121
|
+
receivedAt: input.receivedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
122
|
+
actor: {
|
|
123
|
+
provider: "telegram",
|
|
124
|
+
providerUserId: input.userId,
|
|
125
|
+
...input.username ? { handle: input.username } : {}
|
|
126
|
+
},
|
|
127
|
+
target: {
|
|
128
|
+
mention: input.botUsername ? `@${input.botUsername.replace(/^@/, "")}` : "/opentag",
|
|
129
|
+
agentId,
|
|
130
|
+
...command.parsed?.executorHint ? { executorHint: command.parsed.executorHint } : {}
|
|
131
|
+
},
|
|
132
|
+
command,
|
|
133
|
+
context: [
|
|
134
|
+
{
|
|
135
|
+
provider: "telegram",
|
|
136
|
+
kind: "message",
|
|
137
|
+
uri: `telegram://bot/${input.botId}/chat/${input.chatId}/message/${input.messageId}`,
|
|
138
|
+
visibility: "organization",
|
|
139
|
+
title: "Telegram message"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
kind: "text",
|
|
143
|
+
uri: input.text,
|
|
144
|
+
visibility: "organization",
|
|
145
|
+
title: "Telegram message text"
|
|
146
|
+
},
|
|
147
|
+
...contextPointersForCommand(command)
|
|
148
|
+
],
|
|
149
|
+
permissions: permissionsForIntent(command.intent),
|
|
150
|
+
callback: {
|
|
151
|
+
provider: "telegram",
|
|
152
|
+
uri: input.callbackUri ?? "https://api.telegram.org/sendMessage",
|
|
153
|
+
threadKey: encodeTelegramThreadKey({
|
|
154
|
+
botId: input.botId,
|
|
155
|
+
chatId: input.chatId,
|
|
156
|
+
replyToMessageId: input.messageId,
|
|
157
|
+
...input.messageThreadId ? { messageThreadId: input.messageThreadId } : {}
|
|
158
|
+
})
|
|
159
|
+
},
|
|
160
|
+
metadata: {
|
|
161
|
+
botId: input.botId,
|
|
162
|
+
chatId: input.chatId,
|
|
163
|
+
messageId: input.messageId,
|
|
164
|
+
chatType: input.chatType,
|
|
165
|
+
...input.messageThreadId ? { messageThreadId: input.messageThreadId } : {},
|
|
166
|
+
...input.botUsername ? { telegramBotUsername: input.botUsername.replace(/^@/, "") } : {},
|
|
167
|
+
...commandMetadata(command),
|
|
168
|
+
repoProvider: input.binding.repoProvider ?? "github",
|
|
169
|
+
owner: input.binding.owner,
|
|
170
|
+
repo: input.binding.repo
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// src/render.ts
|
|
176
|
+
function nextActionSummary(result) {
|
|
177
|
+
if (!result.nextAction) return void 0;
|
|
178
|
+
if (typeof result.nextAction === "string") return result.nextAction;
|
|
179
|
+
return result.nextAction.summary;
|
|
180
|
+
}
|
|
181
|
+
function renderTelegramAcknowledgement(runId) {
|
|
182
|
+
return `I picked this up: ${runId}`;
|
|
183
|
+
}
|
|
184
|
+
function renderTelegramProgress(message) {
|
|
185
|
+
if (/starting claude --print|thinking/i.test(message)) {
|
|
186
|
+
return "Thinking...";
|
|
187
|
+
}
|
|
188
|
+
return "Working...";
|
|
189
|
+
}
|
|
190
|
+
function renderTelegramFinalResult(result) {
|
|
191
|
+
const lines = [`Finished with ${result.conclusion}.`, "", result.summary];
|
|
192
|
+
if (result.verification?.length) {
|
|
193
|
+
lines.push("", "Verification:");
|
|
194
|
+
for (const check of result.verification) {
|
|
195
|
+
lines.push(`- ${check.command}: ${check.outcome}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const nextAction = nextActionSummary(result);
|
|
199
|
+
if (nextAction) {
|
|
200
|
+
lines.push("", `Next action: ${nextAction}`);
|
|
201
|
+
}
|
|
202
|
+
return lines.join("\n");
|
|
203
|
+
}
|
|
204
|
+
function createTelegramSendMessagePayload(input) {
|
|
205
|
+
return {
|
|
206
|
+
chat_id: input.chatId,
|
|
207
|
+
text: input.text,
|
|
208
|
+
...input.replyToMessageId ? { reply_to_message_id: input.replyToMessageId, allow_sending_without_reply: true } : {},
|
|
209
|
+
...input.messageThreadId ? { message_thread_id: input.messageThreadId } : {}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function createTelegramSendMessageDraftPayload(input) {
|
|
213
|
+
return {
|
|
214
|
+
chat_id: input.chatId,
|
|
215
|
+
text: input.text,
|
|
216
|
+
draft_id: input.draftId,
|
|
217
|
+
...input.messageThreadId ? { message_thread_id: input.messageThreadId } : {}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
export {
|
|
221
|
+
createTelegramSendMessageDraftPayload,
|
|
222
|
+
createTelegramSendMessagePayload,
|
|
223
|
+
encodeTelegramThreadKey,
|
|
224
|
+
normalizeTelegramMessage,
|
|
225
|
+
parseTelegramThreadKey,
|
|
226
|
+
renderTelegramAcknowledgement,
|
|
227
|
+
renderTelegramFinalResult,
|
|
228
|
+
renderTelegramProgress,
|
|
229
|
+
stripTelegramInvocation
|
|
230
|
+
};
|
|
231
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/normalize.ts","../src/render.ts"],"sourcesContent":["import { commandFromRawText, type ContextPointer, type OpenTagCommand, type OpenTagEvent, type PermissionGrant } from \"@opentag/core\";\n\nexport type TelegramChannelBinding = {\n botId: string;\n chatId: string;\n repoProvider?: string;\n owner: string;\n repo: string;\n};\n\nexport type TelegramMessageInput = {\n botId: string;\n botUsername?: string;\n chatId: string;\n chatType: \"private\" | \"group\" | \"supergroup\" | \"channel\";\n userId: string;\n username?: string;\n text: string;\n messageId: number;\n updateId?: number;\n messageThreadId?: number;\n receivedAt?: string;\n agentId?: string;\n callbackUri?: string;\n binding: TelegramChannelBinding;\n};\n\nfunction escapeRegExp(text: string): string {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nexport function stripTelegramInvocation(input: {\n text: string;\n chatType: TelegramMessageInput[\"chatType\"];\n botUsername?: string;\n}): string | null {\n const trimmed = input.text.trim();\n if (!trimmed) return null;\n if (input.chatType === \"private\") return trimmed;\n\n const username = input.botUsername?.replace(/^@/, \"\");\n const patterns = username\n ? [\n new RegExp(`^@${escapeRegExp(username)}\\\\s+`, \"i\"),\n new RegExp(`^/opentag@${escapeRegExp(username)}\\\\s+`, \"i\"),\n /^\\/opentag\\s+/i\n ]\n : [/^\\/opentag\\s+/i];\n\n for (const pattern of patterns) {\n const stripped = trimmed.replace(pattern, \"\").trim();\n if (stripped !== trimmed) {\n return stripped.length > 0 ? stripped : null;\n }\n }\n\n return null;\n}\n\nexport function encodeTelegramThreadKey(input: {\n botId: string;\n chatId: string;\n replyToMessageId: number;\n messageThreadId?: number;\n}): string {\n return [input.botId, input.chatId, String(input.replyToMessageId), input.messageThreadId ? String(input.messageThreadId) : \"\"].join(\"|\");\n}\n\nexport function parseTelegramThreadKey(threadKey: string): {\n botId: string;\n chatId: string;\n replyToMessageId: number;\n messageThreadId?: number;\n} {\n const [botId, chatId, replyToMessageIdRaw, messageThreadIdRaw] = threadKey.split(\"|\");\n const replyToMessageId = Number(replyToMessageIdRaw);\n if (!botId || !chatId || !Number.isInteger(replyToMessageId) || replyToMessageId <= 0) {\n throw new Error(`Invalid Telegram thread key: ${threadKey}`);\n }\n const messageThreadId = messageThreadIdRaw ? Number(messageThreadIdRaw) : undefined;\n return {\n botId,\n chatId,\n replyToMessageId,\n ...(messageThreadId && Number.isInteger(messageThreadId) && messageThreadId > 0 ? { messageThreadId } : {})\n };\n}\n\nfunction permissionsForIntent(intent: OpenTagCommand[\"intent\"]): PermissionGrant[] {\n const permissions: PermissionGrant[] = [\n {\n scope: \"chat:postMessage\",\n reason: \"reply in the originating Telegram thread\"\n },\n {\n scope: \"runner:local\",\n reason: \"execute the run on a paired local daemon\"\n }\n ];\n\n if (intent === \"fix\" || intent === \"run\") {\n permissions.push(\n {\n scope: \"repo:read\",\n reason: \"inspect the repository in the paired local checkout\"\n },\n {\n scope: \"repo:write\",\n reason: \"commit code changes on an isolated run branch\"\n },\n {\n scope: \"pr:create\",\n reason: \"open a pull request for completed code changes\"\n }\n );\n }\n\n return permissions;\n}\n\nfunction referenceTitle(reference: NonNullable<OpenTagCommand[\"parsed\"]>[\"references\"][number]): string {\n return reference.title ?? \"Command file reference\";\n}\n\nfunction contextPointersForCommand(command: OpenTagCommand): ContextPointer[] {\n const context: ContextPointer[] = [];\n for (const reference of command.parsed?.references ?? []) {\n if (reference.kind === \"url\") {\n context.push({\n kind: \"url\",\n uri: reference.uri,\n visibility: \"organization\",\n title: reference.title ?? \"Command URL reference\"\n });\n continue;\n }\n if (reference.kind === \"file\" || reference.kind === \"path\") {\n context.push({\n kind: \"file\",\n uri: reference.uri,\n ...(reference.line ? { line: reference.line } : {}),\n ...(reference.startLine ? { startLine: reference.startLine } : {}),\n ...(reference.endLine ? { endLine: reference.endLine } : {}),\n visibility: \"organization\",\n title: referenceTitle(reference)\n });\n }\n }\n return context;\n}\n\nfunction commandMetadata(command: OpenTagCommand): Record<string, unknown> {\n if (!command.parsed) return {};\n return {\n commandParser: command.parsed.version,\n commandDiagnostics: command.parsed.diagnostics,\n ...(command.parsed.approval ? { approval: command.parsed.approval } : {}),\n ...(command.parsed.network ? { network: command.parsed.network } : {})\n };\n}\n\nexport function normalizeTelegramMessage(input: TelegramMessageInput): OpenTagEvent | null {\n const rawText = stripTelegramInvocation({\n text: input.text,\n chatType: input.chatType,\n ...(input.botUsername ? { botUsername: input.botUsername } : {})\n });\n if (!rawText) return null;\n\n const command = commandFromRawText(rawText);\n const agentId = input.agentId ?? \"opentag\";\n\n return {\n id: `evt_telegram_${input.updateId ?? `${input.botId}_${input.chatId}_${input.messageId}`}`,\n source: \"telegram\",\n sourceEventId: String(input.updateId ?? input.messageId),\n receivedAt: input.receivedAt ?? new Date().toISOString(),\n actor: {\n provider: \"telegram\",\n providerUserId: input.userId,\n ...(input.username ? { handle: input.username } : {})\n },\n target: {\n mention: input.botUsername ? `@${input.botUsername.replace(/^@/, \"\")}` : \"/opentag\",\n agentId,\n ...(command.parsed?.executorHint ? { executorHint: command.parsed.executorHint } : {})\n },\n command,\n context: [\n {\n provider: \"telegram\",\n kind: \"message\",\n uri: `telegram://bot/${input.botId}/chat/${input.chatId}/message/${input.messageId}`,\n visibility: \"organization\",\n title: \"Telegram message\"\n },\n {\n kind: \"text\",\n uri: input.text,\n visibility: \"organization\",\n title: \"Telegram message text\"\n },\n ...contextPointersForCommand(command)\n ],\n permissions: permissionsForIntent(command.intent),\n callback: {\n provider: \"telegram\",\n uri: input.callbackUri ?? \"https://api.telegram.org/sendMessage\",\n threadKey: encodeTelegramThreadKey({\n botId: input.botId,\n chatId: input.chatId,\n replyToMessageId: input.messageId,\n ...(input.messageThreadId ? { messageThreadId: input.messageThreadId } : {})\n })\n },\n metadata: {\n botId: input.botId,\n chatId: input.chatId,\n messageId: input.messageId,\n chatType: input.chatType,\n ...(input.messageThreadId ? { messageThreadId: input.messageThreadId } : {}),\n ...(input.botUsername ? { telegramBotUsername: input.botUsername.replace(/^@/, \"\") } : {}),\n ...commandMetadata(command),\n repoProvider: input.binding.repoProvider ?? \"github\",\n owner: input.binding.owner,\n repo: input.binding.repo\n }\n };\n}\n","import type { OpenTagRunResult } from \"@opentag/core\";\n\nfunction nextActionSummary(result: OpenTagRunResult): string | undefined {\n if (!result.nextAction) return undefined;\n if (typeof result.nextAction === \"string\") return result.nextAction;\n return result.nextAction.summary;\n}\n\nexport function renderTelegramAcknowledgement(runId: string): string {\n return `I picked this up: ${runId}`;\n}\n\nexport function renderTelegramProgress(message: string): string {\n if (/starting claude --print|thinking/i.test(message)) {\n return \"Thinking...\";\n }\n\n return \"Working...\";\n}\n\nexport function renderTelegramFinalResult(result: OpenTagRunResult): string {\n const lines = [`Finished with ${result.conclusion}.`, \"\", result.summary];\n\n if (result.verification?.length) {\n lines.push(\"\", \"Verification:\");\n for (const check of result.verification) {\n lines.push(`- ${check.command}: ${check.outcome}`);\n }\n }\n\n const nextAction = nextActionSummary(result);\n if (nextAction) {\n lines.push(\"\", `Next action: ${nextAction}`);\n }\n\n return lines.join(\"\\n\");\n}\n\nexport type TelegramSendMessagePayload = {\n chat_id: string;\n text: string;\n reply_to_message_id?: number;\n message_thread_id?: number;\n allow_sending_without_reply?: boolean;\n};\n\nexport type TelegramSendMessageDraftPayload = {\n chat_id: string;\n text: string;\n draft_id: number;\n message_thread_id?: number;\n};\n\nexport function createTelegramSendMessagePayload(input: {\n chatId: string;\n text: string;\n replyToMessageId?: number;\n messageThreadId?: number;\n}): TelegramSendMessagePayload {\n return {\n chat_id: input.chatId,\n text: input.text,\n ...(input.replyToMessageId ? { reply_to_message_id: input.replyToMessageId, allow_sending_without_reply: true } : {}),\n ...(input.messageThreadId ? { message_thread_id: input.messageThreadId } : {})\n };\n}\n\nexport function createTelegramSendMessageDraftPayload(input: {\n chatId: string;\n text: string;\n draftId: number;\n messageThreadId?: number;\n}): TelegramSendMessageDraftPayload {\n return {\n chat_id: input.chatId,\n text: input.text,\n draft_id: input.draftId,\n ...(input.messageThreadId ? { message_thread_id: input.messageThreadId } : {})\n };\n}\n"],"mappings":";AAAA,SAAS,0BAA6G;AA2BtH,SAAS,aAAa,MAAsB;AAC1C,SAAO,KAAK,QAAQ,uBAAuB,MAAM;AACnD;AAEO,SAAS,wBAAwB,OAItB;AAChB,QAAM,UAAU,MAAM,KAAK,KAAK;AAChC,MAAI,CAAC,QAAS,QAAO;AACrB,MAAI,MAAM,aAAa,UAAW,QAAO;AAEzC,QAAM,WAAW,MAAM,aAAa,QAAQ,MAAM,EAAE;AACpD,QAAM,WAAW,WACb;AAAA,IACE,IAAI,OAAO,KAAK,aAAa,QAAQ,CAAC,QAAQ,GAAG;AAAA,IACjD,IAAI,OAAO,aAAa,aAAa,QAAQ,CAAC,QAAQ,GAAG;AAAA,IACzD;AAAA,EACF,IACA,CAAC,gBAAgB;AAErB,aAAW,WAAW,UAAU;AAC9B,UAAM,WAAW,QAAQ,QAAQ,SAAS,EAAE,EAAE,KAAK;AACnD,QAAI,aAAa,SAAS;AACxB,aAAO,SAAS,SAAS,IAAI,WAAW;AAAA,IAC1C;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,wBAAwB,OAK7B;AACT,SAAO,CAA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,KAAK,IAAI,CAAC;AAAA,IACnH,GAAI,MAAM,kBAAkB,EAAE,mBAAmB,MAAM,gBAAgB,IAAI,CAAC;AAAA,EAC9E;AACF;AAEO,SAAS,sCAAsC,OAKlB;AAClC,SAAO;AAAA,IACL,SAAS,MAAM;AAAA,IACf,MAAM,MAAM;AAAA,IACZ,UAAU,MAAM;AAAA,IAChB,GAAI,MAAM,kBAAkB,EAAE,mBAAmB,MAAM,gBAAgB,IAAI,CAAC;AAAA,EAC9E;AACF;","names":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type OpenTagEvent } from "@opentag/core";
|
|
2
|
+
export type TelegramChannelBinding = {
|
|
3
|
+
botId: string;
|
|
4
|
+
chatId: string;
|
|
5
|
+
repoProvider?: string;
|
|
6
|
+
owner: string;
|
|
7
|
+
repo: string;
|
|
8
|
+
};
|
|
9
|
+
export type TelegramMessageInput = {
|
|
10
|
+
botId: string;
|
|
11
|
+
botUsername?: string;
|
|
12
|
+
chatId: string;
|
|
13
|
+
chatType: "private" | "group" | "supergroup" | "channel";
|
|
14
|
+
userId: string;
|
|
15
|
+
username?: string;
|
|
16
|
+
text: string;
|
|
17
|
+
messageId: number;
|
|
18
|
+
updateId?: number;
|
|
19
|
+
messageThreadId?: number;
|
|
20
|
+
receivedAt?: string;
|
|
21
|
+
agentId?: string;
|
|
22
|
+
callbackUri?: string;
|
|
23
|
+
binding: TelegramChannelBinding;
|
|
24
|
+
};
|
|
25
|
+
export declare function stripTelegramInvocation(input: {
|
|
26
|
+
text: string;
|
|
27
|
+
chatType: TelegramMessageInput["chatType"];
|
|
28
|
+
botUsername?: string;
|
|
29
|
+
}): string | null;
|
|
30
|
+
export declare function encodeTelegramThreadKey(input: {
|
|
31
|
+
botId: string;
|
|
32
|
+
chatId: string;
|
|
33
|
+
replyToMessageId: number;
|
|
34
|
+
messageThreadId?: number;
|
|
35
|
+
}): string;
|
|
36
|
+
export declare function parseTelegramThreadKey(threadKey: string): {
|
|
37
|
+
botId: string;
|
|
38
|
+
chatId: string;
|
|
39
|
+
replyToMessageId: number;
|
|
40
|
+
messageThreadId?: number;
|
|
41
|
+
};
|
|
42
|
+
export declare function normalizeTelegramMessage(input: TelegramMessageInput): OpenTagEvent | null;
|
|
43
|
+
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../src/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgE,KAAK,YAAY,EAAwB,MAAM,eAAe,CAAC;AAEtI,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,SAAS,CAAC;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,sBAAsB,CAAC;CACjC,CAAC;AAMF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,MAAM,GAAG,IAAI,CAsBhB;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,MAAM,CAET;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAaA;AA2ED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,GAAG,IAAI,CAmEzF"}
|
package/dist/render.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { OpenTagRunResult } from "@opentag/core";
|
|
2
|
+
export declare function renderTelegramAcknowledgement(runId: string): string;
|
|
3
|
+
export declare function renderTelegramProgress(message: string): string;
|
|
4
|
+
export declare function renderTelegramFinalResult(result: OpenTagRunResult): string;
|
|
5
|
+
export type TelegramSendMessagePayload = {
|
|
6
|
+
chat_id: string;
|
|
7
|
+
text: string;
|
|
8
|
+
reply_to_message_id?: number;
|
|
9
|
+
message_thread_id?: number;
|
|
10
|
+
allow_sending_without_reply?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type TelegramSendMessageDraftPayload = {
|
|
13
|
+
chat_id: string;
|
|
14
|
+
text: string;
|
|
15
|
+
draft_id: number;
|
|
16
|
+
message_thread_id?: number;
|
|
17
|
+
};
|
|
18
|
+
export declare function createTelegramSendMessagePayload(input: {
|
|
19
|
+
chatId: string;
|
|
20
|
+
text: string;
|
|
21
|
+
replyToMessageId?: number;
|
|
22
|
+
messageThreadId?: number;
|
|
23
|
+
}): TelegramSendMessagePayload;
|
|
24
|
+
export declare function createTelegramSendMessageDraftPayload(input: {
|
|
25
|
+
chatId: string;
|
|
26
|
+
text: string;
|
|
27
|
+
draftId: number;
|
|
28
|
+
messageThreadId?: number;
|
|
29
|
+
}): TelegramSendMessageDraftPayload;
|
|
30
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAQtD,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAM9D;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAgB1E;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAgB,gCAAgC,CAAC,KAAK,EAAE;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,0BAA0B,CAO7B;AAED,wBAAgB,qCAAqC,CAAC,KAAK,EAAE;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,+BAA+B,CAOlC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentag/telegram",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Telegram message normalization and callback helpers for OpenTag.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=20"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"development": "./src/index.ts",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"opentag",
|
|
27
|
+
"telegram",
|
|
28
|
+
"bots",
|
|
29
|
+
"agents",
|
|
30
|
+
"webhooks"
|
|
31
|
+
],
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@opentag/core": "0.2.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"tsup": "^8.5.1",
|
|
38
|
+
"typescript": "^5.9.3"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsup && tsc -b tsconfig.json --emitDeclarationOnly --force",
|
|
42
|
+
"lint": "tsc --noEmit"
|
|
43
|
+
}
|
|
44
|
+
}
|