@osovv/vv-opencode 2.2.0 → 2.3.0-rc.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/CHANGELOG.md +16 -0
- package/README.md +47 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/plugin-toggle-config.d.ts +1 -1
- package/dist/lib/plugin-toggle-config.js +3 -1
- package/dist/lib/plugin-toggle-config.js.map +1 -1
- package/dist/lib/vvoc-config.d.ts +90 -5
- package/dist/lib/vvoc-config.js +123 -9
- package/dist/lib/vvoc-config.js.map +1 -1
- package/dist/plugins/guardian/index.d.ts +3 -6
- package/dist/plugins/guardian/index.js +7 -26
- package/dist/plugins/guardian/index.js.map +1 -1
- package/dist/plugins/telegram/bot-api.d.ts +162 -0
- package/dist/plugins/telegram/bot-api.js +273 -0
- package/dist/plugins/telegram/bot-api.js.map +1 -0
- package/dist/plugins/telegram/commands.d.ts +167 -0
- package/dist/plugins/telegram/commands.js +709 -0
- package/dist/plugins/telegram/commands.js.map +1 -0
- package/dist/plugins/telegram/config.d.ts +38 -0
- package/dist/plugins/telegram/config.js +86 -0
- package/dist/plugins/telegram/config.js.map +1 -0
- package/dist/plugins/telegram/delivery.d.ts +121 -0
- package/dist/plugins/telegram/delivery.js +395 -0
- package/dist/plugins/telegram/delivery.js.map +1 -0
- package/dist/plugins/telegram/gateway.d.ts +61 -0
- package/dist/plugins/telegram/gateway.js +230 -0
- package/dist/plugins/telegram/gateway.js.map +1 -0
- package/dist/plugins/telegram/index.d.ts +110 -0
- package/dist/plugins/telegram/index.js +390 -0
- package/dist/plugins/telegram/index.js.map +1 -0
- package/dist/plugins/telegram/sessions.d.ts +147 -0
- package/dist/plugins/telegram/sessions.js +322 -0
- package/dist/plugins/telegram/sessions.js.map +1 -0
- package/dist/plugins/telegram/topology.d.ts +116 -0
- package/dist/plugins/telegram/topology.js +339 -0
- package/dist/plugins/telegram/topology.js.map +1 -0
- package/dist/plugins/web-tools/schemas.d.ts +19 -19
- package/dist/plugins/workflow/results.d.ts +39 -39
- package/package.json +6 -1
- package/schemas/vvoc/v3.json +89 -13
- package/templates/skills/vv-execute/references/tool-contracts.md +1 -1
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
// FILE: src/plugins/telegram/bot-api.ts
|
|
2
|
+
// VERSION: 1.1.0
|
|
3
|
+
// START_MODULE_CONTRACT
|
|
4
|
+
// PURPOSE: Own the narrow Telegram Bot API surface the bridge consumes, with a grammy-backed production transport and an injectable call seam for deterministic tests.
|
|
5
|
+
// SCOPE: The TelegramTransport interface (topics, sends, edits, drafts with a permanent unsupported latch, callbacks, commands, file download with a hard size cap, getUpdates polling reads), typed structural update shapes, credential-safe error normalization that never exposes the token, connectivity wiring for a custom API root or an outbound proxy (never both), and a grammy call factory that performs no I/O at module import.
|
|
6
|
+
// DEPENDS: [grammy]
|
|
7
|
+
// LINKS: [M-TELEGRAM-BOT-API, M-TELEGRAM-GATEWAY, M-TELEGRAM-CONFIG, V-M-TELEGRAM-BOT-API]
|
|
8
|
+
// ROLE: RUNTIME
|
|
9
|
+
// MAP_MODE: EXPORTS
|
|
10
|
+
// END_MODULE_CONTRACT
|
|
11
|
+
//
|
|
12
|
+
// START_MODULE_MAP
|
|
13
|
+
// TELEGRAM_DEFAULT_API_ROOT - Default Bot API root.
|
|
14
|
+
// TelegramCall - Low-level method-call seam (method, payload) to result.
|
|
15
|
+
// TelegramApiError - Normalized Bot API failure with optional code, description, and retryAfter.
|
|
16
|
+
// TelegramUnsupportedError - Permanent signal that a method is unavailable for this bot.
|
|
17
|
+
// TelegramUser - Structural update sender shape.
|
|
18
|
+
// TelegramChat - Structural update chat shape.
|
|
19
|
+
// TelegramPhotoSize - Structural photo size variant.
|
|
20
|
+
// TelegramMessage - Structural update message shape (thread, text, media, album grouping).
|
|
21
|
+
// TelegramCallbackQuery - Structural callback query shape.
|
|
22
|
+
// TelegramUpdate - Structural update envelope with album grouping key.
|
|
23
|
+
// TelegramBotCommand - Registered command description.
|
|
24
|
+
// TelegramTransport - The narrow send-side plus polling-read API surface the bridge consumes.
|
|
25
|
+
// createGrammyCallApi - Grammy-backed production call seam constructed only on demand.
|
|
26
|
+
// createTelegramTransport - Assemble the transport over an injectable call seam with the drafts latch and credential-safe errors.
|
|
27
|
+
// TelegramInlineButton - Inline keyboard button description.
|
|
28
|
+
// TelegramTransportOptions - Construction options for the transport assembly.
|
|
29
|
+
// END_MODULE_MAP
|
|
30
|
+
//
|
|
31
|
+
// START_CHANGE_SUMMARY
|
|
32
|
+
// LAST_CHANGE: [C-TELEGRAM-BRIDGE-PLUGIN T-002 - Created the grammy-backed Bot API adapter with the injectable call seam, owner chat targeting, drafts-unsupported latch, size-capped file download, connectivity exclusivity, and credential-safe error normalization.]
|
|
33
|
+
// END_CHANGE_SUMMARY
|
|
34
|
+
import { Api, InputFile } from "grammy";
|
|
35
|
+
/** Default Bot API root; a custom root or proxy replaces it through configuration. */
|
|
36
|
+
export const TELEGRAM_DEFAULT_API_ROOT = "https://api.telegram.org";
|
|
37
|
+
/** Normalized Bot API failure; the description never contains the token. */
|
|
38
|
+
export class TelegramApiError extends Error {
|
|
39
|
+
code;
|
|
40
|
+
description;
|
|
41
|
+
retryAfter;
|
|
42
|
+
constructor(code, description, retryAfter = undefined) {
|
|
43
|
+
super(`Telegram API error ${code ?? "?"}: ${description}`);
|
|
44
|
+
this.code = code;
|
|
45
|
+
this.description = description;
|
|
46
|
+
this.retryAfter = retryAfter;
|
|
47
|
+
this.name = "TelegramApiError";
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** Permanent signal that a method is unavailable for this bot; callers fall back. */
|
|
51
|
+
export class TelegramUnsupportedError extends Error {
|
|
52
|
+
method;
|
|
53
|
+
constructor(method) {
|
|
54
|
+
super(`Telegram method unsupported: ${method}`);
|
|
55
|
+
this.method = method;
|
|
56
|
+
this.name = "TelegramUnsupportedError";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/** True when an error description marks a method as unknown or removed for this bot. */
|
|
60
|
+
function isUnsupportedDescription(description) {
|
|
61
|
+
const lowered = description.toLowerCase();
|
|
62
|
+
return lowered.includes("method not found") || lowered.includes("not found");
|
|
63
|
+
}
|
|
64
|
+
/** Replace any token occurrence inside free-text error material; never returns the token. */
|
|
65
|
+
function redactToken(text, token) {
|
|
66
|
+
if (token.length === 0)
|
|
67
|
+
return text;
|
|
68
|
+
return text.split(token).join("[redacted]");
|
|
69
|
+
}
|
|
70
|
+
/** Normalize any thrown value into a TelegramApiError without leaking the token. */
|
|
71
|
+
function normalizeApiError(error, token) {
|
|
72
|
+
if (error instanceof TelegramUnsupportedError)
|
|
73
|
+
return new TelegramApiError(404, error.message);
|
|
74
|
+
const record = error;
|
|
75
|
+
const code = typeof record.error_code === "number" ? record.error_code : undefined;
|
|
76
|
+
const rawDescription = typeof record.description === "string"
|
|
77
|
+
? record.description
|
|
78
|
+
: typeof record.message === "string"
|
|
79
|
+
? record.message
|
|
80
|
+
: "unknown telegram failure";
|
|
81
|
+
const retryAfter = typeof record.parameters?.retry_after === "number" ? record.parameters.retry_after : undefined;
|
|
82
|
+
return new TelegramApiError(code, redactToken(rawDescription, token), retryAfter);
|
|
83
|
+
}
|
|
84
|
+
// START_BLOCK_GRAMMY_FACTORY
|
|
85
|
+
/** Grammy-backed production call seam. Constructing a client performs no requests; unknown-to-grammy methods are reached through the raw method table by name. */
|
|
86
|
+
export function createGrammyCallApi(options) {
|
|
87
|
+
if (options.apiRoot !== undefined && options.proxyUrl !== undefined) {
|
|
88
|
+
throw new Error("telegram connectivity: apiRoot and proxyUrl are mutually exclusive");
|
|
89
|
+
}
|
|
90
|
+
const baseFetchConfig = options.proxyUrl === undefined ? undefined : { proxy: options.proxyUrl };
|
|
91
|
+
const api = new Api(options.token, {
|
|
92
|
+
apiRoot: options.apiRoot ?? TELEGRAM_DEFAULT_API_ROOT,
|
|
93
|
+
...(baseFetchConfig === undefined ? {} : { baseFetchConfig }),
|
|
94
|
+
});
|
|
95
|
+
const raw = api.raw;
|
|
96
|
+
return (method, payload) => {
|
|
97
|
+
const fn = raw[method];
|
|
98
|
+
if (typeof fn !== "function") {
|
|
99
|
+
return Promise.reject(new TelegramUnsupportedError(method));
|
|
100
|
+
}
|
|
101
|
+
return fn.call(api.raw, payload);
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
// END_BLOCK_GRAMMY_FACTORY
|
|
105
|
+
// START_BLOCK_TRANSPORT
|
|
106
|
+
/**
|
|
107
|
+
* Assemble the transport over an injectable call seam. Draft availability is a
|
|
108
|
+
* per-transport permanent latch: the first unsupported signal switches every
|
|
109
|
+
* later sendDraft call into an immediate TelegramUnsupportedError so callers
|
|
110
|
+
* fall back without repeat probing. Every failure surfaces as a credential-safe
|
|
111
|
+
* TelegramApiError whose description never contains the token.
|
|
112
|
+
*/
|
|
113
|
+
export function createTelegramTransport(options) {
|
|
114
|
+
if (options.apiRoot !== undefined && options.proxyUrl !== undefined) {
|
|
115
|
+
throw new Error("telegram connectivity: apiRoot and proxyUrl are mutually exclusive");
|
|
116
|
+
}
|
|
117
|
+
const token = options.token;
|
|
118
|
+
const chatId = options.chatId;
|
|
119
|
+
const call = options.call ?? createGrammyCallApi(options);
|
|
120
|
+
const fetchFile = options.fetchFile ?? ((url, init) => fetch(url, init));
|
|
121
|
+
const apiRoot = options.apiRoot ?? TELEGRAM_DEFAULT_API_ROOT;
|
|
122
|
+
const proxyInit = options.proxyUrl === undefined ? {} : { proxy: options.proxyUrl };
|
|
123
|
+
let draftsSupported = true;
|
|
124
|
+
const serializeMarkup = (rows) => rows === undefined
|
|
125
|
+
? undefined
|
|
126
|
+
: {
|
|
127
|
+
inline_keyboard: rows.map((row) => row.map((button) => ({ text: button.text, callback_data: button.callbackData }))),
|
|
128
|
+
};
|
|
129
|
+
const invoke = async (method, payload) => {
|
|
130
|
+
try {
|
|
131
|
+
return (await call(method, payload));
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
throw normalizeApiError(error, token);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
return {
|
|
138
|
+
async createForumTopic(name) {
|
|
139
|
+
const result = await invoke("createForumTopic", {
|
|
140
|
+
chat_id: chatId,
|
|
141
|
+
name,
|
|
142
|
+
});
|
|
143
|
+
const threadId = result?.message_thread_id;
|
|
144
|
+
if (typeof threadId !== "number") {
|
|
145
|
+
throw new TelegramApiError(undefined, "createForumTopic returned no message_thread_id");
|
|
146
|
+
}
|
|
147
|
+
return { threadId };
|
|
148
|
+
},
|
|
149
|
+
async editForumTopic(threadId, name) {
|
|
150
|
+
await invoke("editForumTopic", {
|
|
151
|
+
chat_id: chatId,
|
|
152
|
+
message_thread_id: threadId,
|
|
153
|
+
name,
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
async closeForumTopic(threadId) {
|
|
157
|
+
await invoke("closeForumTopic", { chat_id: chatId, message_thread_id: threadId });
|
|
158
|
+
},
|
|
159
|
+
async reopenForumTopic(threadId) {
|
|
160
|
+
await invoke("reopenForumTopic", { chat_id: chatId, message_thread_id: threadId });
|
|
161
|
+
},
|
|
162
|
+
async sendMessage(input) {
|
|
163
|
+
const markup = serializeMarkup(input.replyMarkup);
|
|
164
|
+
const result = await invoke("sendMessage", {
|
|
165
|
+
chat_id: chatId,
|
|
166
|
+
message_thread_id: input.threadId,
|
|
167
|
+
text: input.text,
|
|
168
|
+
...(input.parseMode === undefined ? {} : { parse_mode: input.parseMode }),
|
|
169
|
+
...(input.disableNotification === undefined
|
|
170
|
+
? {}
|
|
171
|
+
: { disable_notification: input.disableNotification }),
|
|
172
|
+
...(markup === undefined ? {} : { reply_markup: markup }),
|
|
173
|
+
});
|
|
174
|
+
const messageId = result?.message_id;
|
|
175
|
+
if (typeof messageId !== "number") {
|
|
176
|
+
throw new TelegramApiError(undefined, "sendMessage returned no message_id");
|
|
177
|
+
}
|
|
178
|
+
return { messageId };
|
|
179
|
+
},
|
|
180
|
+
async sendDocument(input) {
|
|
181
|
+
const result = await invoke("sendDocument", {
|
|
182
|
+
chat_id: chatId,
|
|
183
|
+
message_thread_id: input.threadId,
|
|
184
|
+
document: new InputFile(input.content, input.filename),
|
|
185
|
+
...(input.caption === undefined ? {} : { caption: input.caption }),
|
|
186
|
+
});
|
|
187
|
+
const messageId = result?.message_id;
|
|
188
|
+
if (typeof messageId !== "number") {
|
|
189
|
+
throw new TelegramApiError(undefined, "sendDocument returned no message_id");
|
|
190
|
+
}
|
|
191
|
+
return { messageId };
|
|
192
|
+
},
|
|
193
|
+
async editMessageText(input) {
|
|
194
|
+
const markup = serializeMarkup(input.replyMarkup);
|
|
195
|
+
await invoke("editMessageText", {
|
|
196
|
+
chat_id: chatId,
|
|
197
|
+
message_id: input.messageId,
|
|
198
|
+
text: input.text,
|
|
199
|
+
...(input.parseMode === undefined ? {} : { parse_mode: input.parseMode }),
|
|
200
|
+
...(markup === undefined ? {} : { reply_markup: markup }),
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
async deleteMessage(messageId) {
|
|
204
|
+
await invoke("deleteMessage", { chat_id: chatId, message_id: messageId });
|
|
205
|
+
},
|
|
206
|
+
async sendDraft(input) {
|
|
207
|
+
if (!draftsSupported) {
|
|
208
|
+
throw new TelegramUnsupportedError("sendMessageDraft");
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
await invoke("sendMessageDraft", {
|
|
212
|
+
chat_id: chatId,
|
|
213
|
+
message_thread_id: input.threadId,
|
|
214
|
+
draft_id: input.draftId,
|
|
215
|
+
text: input.text,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
if (error instanceof TelegramApiError &&
|
|
220
|
+
(error.code === 404 || isUnsupportedDescription(error.description))) {
|
|
221
|
+
draftsSupported = false;
|
|
222
|
+
throw new TelegramUnsupportedError("sendMessageDraft");
|
|
223
|
+
}
|
|
224
|
+
throw error;
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
async answerCallback(callbackQueryId, text) {
|
|
228
|
+
await invoke("answerCallbackQuery", {
|
|
229
|
+
callback_query_id: callbackQueryId,
|
|
230
|
+
...(text === undefined ? {} : { text }),
|
|
231
|
+
});
|
|
232
|
+
},
|
|
233
|
+
async setMyCommands(commands) {
|
|
234
|
+
await invoke("setMyCommands", {
|
|
235
|
+
commands: commands.map((entry) => ({
|
|
236
|
+
command: entry.command,
|
|
237
|
+
description: entry.description,
|
|
238
|
+
})),
|
|
239
|
+
});
|
|
240
|
+
},
|
|
241
|
+
async downloadFile(fileId, maxBytes) {
|
|
242
|
+
const file = await invoke("getFile", { file_id: fileId });
|
|
243
|
+
const filePath = file?.file_path;
|
|
244
|
+
if (typeof filePath !== "string" || filePath.length === 0) {
|
|
245
|
+
throw new TelegramApiError(undefined, "getFile returned no file_path");
|
|
246
|
+
}
|
|
247
|
+
const url = `${apiRoot}/file/bot${token}/${filePath}`;
|
|
248
|
+
const response = await fetchFile(url, proxyInit);
|
|
249
|
+
if (!response.ok) {
|
|
250
|
+
throw new TelegramApiError(response.status, `file download failed with HTTP ${response.status}`);
|
|
251
|
+
}
|
|
252
|
+
const declared = Number(response.headers.get("content-length") ?? "0");
|
|
253
|
+
if (declared > maxBytes) {
|
|
254
|
+
throw new TelegramApiError(undefined, "file exceeds the configured size cap");
|
|
255
|
+
}
|
|
256
|
+
const buffer = new Uint8Array(await response.arrayBuffer());
|
|
257
|
+
if (buffer.byteLength > maxBytes) {
|
|
258
|
+
throw new TelegramApiError(undefined, "file exceeds the configured size cap");
|
|
259
|
+
}
|
|
260
|
+
return buffer;
|
|
261
|
+
},
|
|
262
|
+
async getUpdates(input) {
|
|
263
|
+
const updates = await invoke("getUpdates", {
|
|
264
|
+
...(input.offset === null ? {} : { offset: input.offset }),
|
|
265
|
+
timeout: input.timeoutSec,
|
|
266
|
+
allowed_updates: ["message", "edited_message", "callback_query"],
|
|
267
|
+
});
|
|
268
|
+
return Array.isArray(updates) ? updates : [];
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
// END_BLOCK_TRANSPORT
|
|
273
|
+
//# sourceMappingURL=bot-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bot-api.js","sourceRoot":"","sources":["../../../src/plugins/telegram/bot-api.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,iBAAiB;AACjB,wBAAwB;AACxB,yKAAyK;AACzK,ibAAib;AACjb,sBAAsB;AACtB,6FAA6F;AAC7F,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,sDAAsD;AACtD,2EAA2E;AAC3E,mGAAmG;AACnG,2FAA2F;AAC3F,mDAAmD;AACnD,iDAAiD;AACjD,uDAAuD;AACvD,6FAA6F;AAC7F,6DAA6D;AAC7D,yEAAyE;AACzE,yDAAyD;AACzD,gGAAgG;AAChG,yFAAyF;AACzF,oIAAoI;AACpI,+DAA+D;AAC/D,gFAAgF;AAChF,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,2QAA2Q;AAC3Q,qBAAqB;AAErB,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,sFAAsF;AACtF,MAAM,CAAC,MAAM,yBAAyB,GAAG,0BAA0B,CAAC;AAKpE,4EAA4E;AAC5E,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAE9B;IACA;IACA;IAHX,YACW,IAAwB,EACxB,WAAmB,EACnB,aAAiC,SAAS;QAEnD,KAAK,CAAC,sBAAsB,IAAI,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC,CAAC;QAJlD,SAAI,GAAJ,IAAI,CAAoB;QACxB,gBAAW,GAAX,WAAW,CAAQ;QACnB,eAAU,GAAV,UAAU,CAAgC;QAGnD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED,qFAAqF;AACrF,MAAM,OAAO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ACD,sBAAsB"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { TelegramCallbackQuery, TelegramTransport } from "./bot-api.js";
|
|
2
|
+
import type { TelegramDelivery } from "./delivery.js";
|
|
3
|
+
import type { SessionBridge } from "./sessions.js";
|
|
4
|
+
import type { TelegramTopology } from "./topology.js";
|
|
5
|
+
/** Injectable native project listing and session creation. */
|
|
6
|
+
export interface NativeProjectSurface {
|
|
7
|
+
listProjects(): Promise<readonly {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly directory: string;
|
|
10
|
+
}[]>;
|
|
11
|
+
createSession(input: {
|
|
12
|
+
readonly directory: string;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
readonly id: string;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
/** Injectable native model listing. */
|
|
18
|
+
export interface NativeModelSurface {
|
|
19
|
+
listModels(): Promise<readonly {
|
|
20
|
+
readonly providerID: string;
|
|
21
|
+
readonly modelID: string;
|
|
22
|
+
}[]>;
|
|
23
|
+
}
|
|
24
|
+
/** Injectable native message listing, revert, and fork. */
|
|
25
|
+
export interface NativeHistorySurface {
|
|
26
|
+
listUserMessages(input: {
|
|
27
|
+
readonly sessionID: string;
|
|
28
|
+
}): Promise<readonly {
|
|
29
|
+
readonly messageID: string;
|
|
30
|
+
readonly text: string;
|
|
31
|
+
}[]>;
|
|
32
|
+
revert(input: {
|
|
33
|
+
readonly sessionID: string;
|
|
34
|
+
readonly messageID: string;
|
|
35
|
+
}): Promise<void>;
|
|
36
|
+
fork(input: {
|
|
37
|
+
readonly sessionID: string;
|
|
38
|
+
readonly messageID: string;
|
|
39
|
+
}): Promise<{
|
|
40
|
+
readonly id: string;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
/** Injectable native permission list and reply. */
|
|
44
|
+
export interface NativePermissionSurface {
|
|
45
|
+
listPending(input: {
|
|
46
|
+
readonly sessionID: string;
|
|
47
|
+
}): Promise<readonly {
|
|
48
|
+
readonly requestID: string;
|
|
49
|
+
readonly summary?: string;
|
|
50
|
+
}[]>;
|
|
51
|
+
reply(input: {
|
|
52
|
+
readonly sessionID: string;
|
|
53
|
+
readonly requestID: string;
|
|
54
|
+
readonly reply: "once" | "always" | "reject";
|
|
55
|
+
}): Promise<void>;
|
|
56
|
+
}
|
|
57
|
+
/** Injectable native question reply. */
|
|
58
|
+
export interface NativeQuestionSurface {
|
|
59
|
+
reply(input: {
|
|
60
|
+
readonly sessionID: string;
|
|
61
|
+
readonly questionID: string;
|
|
62
|
+
readonly answer: string;
|
|
63
|
+
}): Promise<void>;
|
|
64
|
+
}
|
|
65
|
+
/** Pure callback-data builder for permission actions. */
|
|
66
|
+
export declare function permissionCallbackData(requestID: string, action: "once" | "always" | "reject"): string;
|
|
67
|
+
/** Pure callback-data builder for question options. */
|
|
68
|
+
export declare function questionCallbackData(questionID: string, optionIndex: number): string;
|
|
69
|
+
/** Pure callback-data builder for the custom-answer action. */
|
|
70
|
+
export declare function questionCustomCallbackData(questionID: string): string;
|
|
71
|
+
/** Pure callback-data parser shared by interactions and pickers. */
|
|
72
|
+
export declare function parseCallbackData(data: string): {
|
|
73
|
+
readonly kind: "permission";
|
|
74
|
+
readonly id: string;
|
|
75
|
+
readonly action: "once" | "always" | "reject";
|
|
76
|
+
} | {
|
|
77
|
+
readonly kind: "question";
|
|
78
|
+
readonly id: string;
|
|
79
|
+
readonly optionIndex: number;
|
|
80
|
+
} | {
|
|
81
|
+
readonly kind: "question-custom";
|
|
82
|
+
readonly id: string;
|
|
83
|
+
} | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Permission and question prompts. Every decision is manual: buttons call the
|
|
86
|
+
* native surfaces, a failed reply keeps the prompt answerable with a warning,
|
|
87
|
+
* and a prompt that disappears outside Telegram closes truthfully. Choosing the
|
|
88
|
+
* custom answer opens the topic input gate so the next plain message becomes
|
|
89
|
+
* the answer instead of a prompt.
|
|
90
|
+
*/
|
|
91
|
+
export declare class TelegramInteractions {
|
|
92
|
+
#private;
|
|
93
|
+
constructor(deps: {
|
|
94
|
+
transport: TelegramTransport;
|
|
95
|
+
topology: TelegramTopology;
|
|
96
|
+
permissions: NativePermissionSurface;
|
|
97
|
+
questions: NativeQuestionSurface;
|
|
98
|
+
});
|
|
99
|
+
/** Whether a topic currently holds the input gate for a custom answer. */
|
|
100
|
+
isGated(threadId: number): boolean;
|
|
101
|
+
onPermissionEvent(input: {
|
|
102
|
+
readonly sessionID: string;
|
|
103
|
+
readonly requestID: string | undefined;
|
|
104
|
+
readonly phase: "requested" | "resolved";
|
|
105
|
+
readonly summary: string | undefined;
|
|
106
|
+
}): Promise<void>;
|
|
107
|
+
onQuestionEvent(input: {
|
|
108
|
+
readonly sessionID: string;
|
|
109
|
+
readonly questionID: string | undefined;
|
|
110
|
+
readonly phase: "requested" | "resolved";
|
|
111
|
+
readonly prompt: string | undefined;
|
|
112
|
+
readonly options: readonly string[];
|
|
113
|
+
}): Promise<void>;
|
|
114
|
+
/** Handle one owner callback query routed here by the command layer. */
|
|
115
|
+
handleCallback(query: TelegramCallbackQuery): Promise<void>;
|
|
116
|
+
/** Consume a gated plain message as the custom answer; returns true when consumed. */
|
|
117
|
+
consumeGatedText(threadId: number, text: string): Promise<boolean>;
|
|
118
|
+
/** Re-render still-pending native permission prompts after a restart. */
|
|
119
|
+
resurfacePending(sessionIDs: readonly string[]): Promise<void>;
|
|
120
|
+
}
|
|
121
|
+
type Schedule = (fn: () => void, ms: number) => void;
|
|
122
|
+
/**
|
|
123
|
+
* Command dispatch for the General and session topics. Plain text in a session
|
|
124
|
+
* topic is consumed by the custom-answer gate first, then coalesced through the
|
|
125
|
+
* per-topic merge window before admission as a prompt.
|
|
126
|
+
*/
|
|
127
|
+
export declare class TelegramCommands {
|
|
128
|
+
#private;
|
|
129
|
+
constructor(deps: {
|
|
130
|
+
transport: TelegramTransport;
|
|
131
|
+
topology: TelegramTopology;
|
|
132
|
+
delivery: TelegramDelivery;
|
|
133
|
+
bridge: SessionBridge;
|
|
134
|
+
interactions: TelegramInteractions;
|
|
135
|
+
projects: NativeProjectSurface;
|
|
136
|
+
models: NativeModelSurface;
|
|
137
|
+
history: NativeHistorySurface;
|
|
138
|
+
reads: {
|
|
139
|
+
listSessions(): Promise<readonly {
|
|
140
|
+
id: string;
|
|
141
|
+
title: string | undefined;
|
|
142
|
+
timeUpdatedMs: number;
|
|
143
|
+
parentID: string | undefined;
|
|
144
|
+
}[]>;
|
|
145
|
+
activeSessionIds(): Promise<readonly string[]>;
|
|
146
|
+
};
|
|
147
|
+
clock: {
|
|
148
|
+
now(): number;
|
|
149
|
+
};
|
|
150
|
+
schedule?: Schedule;
|
|
151
|
+
maxAttachmentBytes?: number;
|
|
152
|
+
maxAttachments?: number;
|
|
153
|
+
});
|
|
154
|
+
/** Route one owner message; the caller has already verified the sender. */
|
|
155
|
+
handleMessage(input: {
|
|
156
|
+
readonly threadId: number;
|
|
157
|
+
readonly text: string | undefined;
|
|
158
|
+
readonly attachments?: readonly {
|
|
159
|
+
readonly fileId: string;
|
|
160
|
+
readonly filename: string | undefined;
|
|
161
|
+
readonly mimeType: string | undefined;
|
|
162
|
+
}[];
|
|
163
|
+
}): Promise<void>;
|
|
164
|
+
/** Route one owner callback query to pickers or the interactions layer. */
|
|
165
|
+
handleCallback(query: TelegramCallbackQuery): Promise<void>;
|
|
166
|
+
}
|
|
167
|
+
export {};
|