@im-more/dsh-telegram 0.0.0-stage → 0.1.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/cordis.patch.yml +10 -0
- package/lib/index.js +2067 -0
- package/lib/index.js.map +1 -0
- package/lib/types/bot.d.ts +70 -0
- package/lib/types/bot.d.ts.map +1 -0
- package/lib/types/bot.js +231 -0
- package/lib/types/bot.js.map +1 -0
- package/lib/types/config.d.ts +34 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +41 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/decode.d.ts +39 -0
- package/lib/types/decode.d.ts.map +1 -0
- package/lib/types/decode.js +382 -0
- package/lib/types/decode.js.map +1 -0
- package/lib/types/errors.d.ts +33 -0
- package/lib/types/errors.d.ts.map +1 -0
- package/lib/types/errors.js +89 -0
- package/lib/types/errors.js.map +1 -0
- package/lib/types/identity.d.ts +19 -0
- package/lib/types/identity.d.ts.map +1 -0
- package/lib/types/identity.js +34 -0
- package/lib/types/identity.js.map +1 -0
- package/lib/types/index.d.ts +10 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +8 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/media.d.ts +38 -0
- package/lib/types/media.d.ts.map +1 -0
- package/lib/types/media.js +65 -0
- package/lib/types/media.js.map +1 -0
- package/lib/types/modes/html.d.ts +16 -0
- package/lib/types/modes/html.d.ts.map +1 -0
- package/lib/types/modes/html.js +155 -0
- package/lib/types/modes/html.js.map +1 -0
- package/lib/types/modes/plain.d.ts +14 -0
- package/lib/types/modes/plain.d.ts.map +1 -0
- package/lib/types/modes/plain.js +56 -0
- package/lib/types/modes/plain.js.map +1 -0
- package/lib/types/modes/shared.d.ts +140 -0
- package/lib/types/modes/shared.d.ts.map +1 -0
- package/lib/types/modes/shared.js +405 -0
- package/lib/types/modes/shared.js.map +1 -0
- package/lib/types/polling.d.ts +26 -0
- package/lib/types/polling.d.ts.map +1 -0
- package/lib/types/polling.js +149 -0
- package/lib/types/polling.js.map +1 -0
- package/lib/types/request.d.ts +67 -0
- package/lib/types/request.d.ts.map +1 -0
- package/lib/types/request.js +158 -0
- package/lib/types/request.js.map +1 -0
- package/lib/types/secret.d.ts +27 -0
- package/lib/types/secret.d.ts.map +1 -0
- package/lib/types/secret.js +39 -0
- package/lib/types/secret.js.map +1 -0
- package/lib/types/send.d.ts +48 -0
- package/lib/types/send.d.ts.map +1 -0
- package/lib/types/send.js +326 -0
- package/lib/types/send.js.map +1 -0
- package/lib/types/types/game.d.ts +102 -0
- package/lib/types/types/game.d.ts.map +1 -0
- package/lib/types/types/game.js +5 -0
- package/lib/types/types/game.js.map +1 -0
- package/lib/types/types/index.d.ts +2751 -0
- package/lib/types/types/index.d.ts.map +1 -0
- package/lib/types/types/index.js +88 -0
- package/lib/types/types/index.js.map +1 -0
- package/lib/types/types/inline.d.ts +796 -0
- package/lib/types/types/inline.d.ts.map +1 -0
- package/lib/types/types/inline.js +4 -0
- package/lib/types/types/inline.js.map +1 -0
- package/lib/types/types/internal.d.ts +32 -0
- package/lib/types/types/internal.d.ts.map +1 -0
- package/lib/types/types/internal.js +30 -0
- package/lib/types/types/internal.js.map +1 -0
- package/lib/types/types/passport.d.ts +229 -0
- package/lib/types/types/passport.d.ts.map +1 -0
- package/lib/types/types/passport.js +3 -0
- package/lib/types/types/passport.js.map +1 -0
- package/lib/types/types/payment.d.ts +285 -0
- package/lib/types/types/payment.d.ts.map +1 -0
- package/lib/types/types/payment.js +6 -0
- package/lib/types/types/payment.js.map +1 -0
- package/lib/types/types/sticker.d.ts +221 -0
- package/lib/types/types/sticker.d.ts.map +1 -0
- package/lib/types/types/sticker.js +11 -0
- package/lib/types/types/sticker.js.map +1 -0
- package/lib/types/types/update.d.ts +97 -0
- package/lib/types/types/update.d.ts.map +1 -0
- package/lib/types/types/update.js +6 -0
- package/lib/types/types/update.js.map +1 -0
- package/lib/types/webhook.d.ts +29 -0
- package/lib/types/webhook.d.ts.map +1 -0
- package/lib/types/webhook.js +129 -0
- package/lib/types/webhook.js.map +1 -0
- package/package.json +61 -3
- package/src/bot.ts +349 -0
- package/src/config.ts +73 -0
- package/src/decode.ts +472 -0
- package/src/errors.ts +103 -0
- package/src/identity.ts +41 -0
- package/src/index.ts +14 -0
- package/src/media.ts +79 -0
- package/src/modes/html.ts +193 -0
- package/src/modes/plain.ts +75 -0
- package/src/modes/shared.ts +505 -0
- package/src/polling.ts +176 -0
- package/src/request.ts +224 -0
- package/src/secret.ts +46 -0
- package/src/send.ts +454 -0
- package/src/types/.eslintrc.yml +2 -0
- package/src/types/game.ts +112 -0
- package/src/types/index.ts +3028 -0
- package/src/types/inline.ts +857 -0
- package/src/types/internal.ts +64 -0
- package/src/types/passport.ts +256 -0
- package/src/types/payment.ts +304 -0
- package/src/types/sticker.ts +244 -0
- package/src/types/update.ts +107 -0
- package/src/webhook.ts +168 -0
- package/README.md +0 -3
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["types/errors.js","types/request.js","types/types/internal.js","types/types/inline.js","types/types/game.js","types/types/passport.js","types/types/payment.js","types/types/sticker.js","types/types/update.js","types/types/index.js","types/config.js","types/identity.js","types/media.js","types/modes/shared.js","types/modes/html.js","types/modes/plain.js","types/decode.js","types/polling.js","types/send.js","types/secret.js","types/webhook.js","types/bot.js"],"sourcesContent":["import { PlatformError } from '@deepseek-ai/cordis-plugin-im-core';\n/** One failed Telegram Bot API call, with the fields `classify` needs. */\nexport class TelegramApiError extends Error {\n method;\n status;\n errorCode;\n description;\n retryAfterMs;\n constructor(message, init) {\n super(message, init.cause === undefined ? undefined : { cause: init.cause });\n this.name = 'TelegramApiError';\n this.method = init.method;\n this.status = init.status;\n this.errorCode = init.errorCode;\n this.description = init.description;\n this.retryAfterMs = init.retryAfterMs;\n }\n}\n/**\n * Map any failure onto the core platform taxonomy.\n *\n * Telegram answers content and permission refusals with a JSON error code, so\n * those are certainly unpublished; transport failures and 5xx answers leave\n * the outcome unknown.\n *\n * @param error - the caught failure.\n * @returns the classified platform error.\n */\nexport function classifyTelegramError(error) {\n if (error instanceof PlatformError)\n return error;\n if (error instanceof TelegramApiError) {\n const code = error.errorCode ?? error.status;\n const init = {\n ...(code === undefined ? {} : { code }),\n ...(error.retryAfterMs === undefined\n ? {}\n : { retryAfterMs: error.retryAfterMs }),\n cause: error,\n };\n if (code === 429)\n return new PlatformError('rate-limit', error.message, {\n ...init,\n published: 'no',\n });\n if (code === 401 || code === 403)\n return new PlatformError('permission', error.message, {\n ...init,\n published: 'no',\n });\n if (code === 404)\n return new PlatformError('not-found', error.message, {\n ...init,\n published: 'no',\n });\n if (code !== undefined && code >= 500)\n return new PlatformError('retryable', error.message, {\n ...init,\n published: 'unknown',\n });\n if (code !== undefined && code >= 400)\n return new PlatformError('invalid', error.message, {\n ...init,\n published: 'no',\n });\n return new PlatformError('retryable', error.message, {\n ...init,\n published: 'unknown',\n });\n }\n if (error instanceof Error && error.name === 'AbortError') {\n return new PlatformError('fatal', error.message, {\n published: 'unknown',\n cause: error,\n });\n }\n const message = error instanceof Error ? error.message : String(error);\n return new PlatformError('retryable', `telegram request failed: ${message}`, {\n published: 'unknown',\n cause: error,\n });\n}\n/** Whether an API failure means the requested edit changed nothing. */\nexport function isNotModified(error) {\n return (error instanceof TelegramApiError &&\n error.errorCode === 400 &&\n (error.description ?? '').includes('message is not modified'));\n}\n//# sourceMappingURL=errors.js.map","/**\n * Telegram Bot API transport: one POST path for every method, envelope and\n * error handling, multipart bodies, and file download.\n *\n * The typed method surface lives on `Internal`; this module owns the shared\n * wire mechanics so the generated client and the upload paths cannot diverge.\n */\nimport { TelegramApiError } from \"./errors.js\";\n/**\n * Build the request endpoints for one bot token.\n *\n * @param ctx - context whose `http` service performs requests.\n * @param token - bot token, appended to the API origin.\n * @param apiBaseUrl - Bot API base URL.\n * @param filesBaseUrl - file download base URL.\n * @returns the shared request endpoints.\n */\nexport function createTelegramRequest(ctx, token, apiBaseUrl, filesBaseUrl) {\n const base = apiBaseUrl.replace(/\\/+$/, '');\n return {\n ctx,\n token,\n origin: `${base}/bot${token}`,\n filesBase: filesBaseUrl.replace(/\\/+$/, ''),\n };\n}\n/**\n * Invoke one Bot API method through the shared envelope and error path.\n *\n * @param request - endpoints for this bot.\n * @param method - Bot API method name.\n * @param payload - JSON body or multipart form.\n * @param signal - cancellation.\n * @returns the method's `result` field.\n */\nexport async function invoke(request, method, payload, signal) {\n let response;\n try {\n response = (await request.ctx.http(`${request.origin}/${method}`, {\n method: 'POST',\n data: payload ?? {},\n ...(signal === undefined ? {} : { signal }),\n }));\n }\n catch (cause) {\n if (isCancellation(cause, signal))\n throw cancellation(cause, signal);\n const failed = responseOf(cause);\n if (failed !== undefined) {\n const failedBody = (await failed.json().catch(() => undefined));\n if (failedBody !== undefined && typeof failedBody === 'object')\n throw failure(method, failed.status, failedBody);\n }\n throw new TelegramApiError(`telegram ${method} request failed`, {\n method,\n cause,\n });\n }\n const body = (await response.json().catch(() => undefined));\n if (body === undefined || typeof body !== 'object') {\n // Reading the body fails when the answer is cut short by cancellation; that is still a cancellation.\n if (signal?.aborted === true)\n throw signal.reason;\n throw new TelegramApiError(`telegram ${method} answered ${response.status} without a JSON envelope`, {\n method,\n status: response.status,\n });\n }\n if (!body.ok)\n throw failure(method, response.status, body);\n return body.result;\n}\n/**\n * Download one file the platform hosts.\n *\n * @param request - endpoints for this bot.\n * @param filePath - `file_path` of a `getFile` answer.\n * @param signal - cancellation.\n * @returns the response whose body is the file.\n */\nexport async function downloadFile(request, filePath, signal) {\n const url = `${request.filesBase}/file/bot${request.token}/${filePath.replace(/^\\/+/, '')}`;\n return (await request.ctx.http(url, signal === undefined ? {} : { signal }));\n}\n/**\n * Send one multipart media form (`sendPhoto`, `sendVideo`, …).\n *\n * @param request - endpoints for this bot.\n * @param method - Bot API send method.\n * @param form - multipart body.\n * @param signal - cancellation.\n * @returns the sent message.\n */\nexport function sendMedia(request, method, form, signal) {\n return invoke(request, method, form, signal);\n}\n/**\n * Send one `sendMediaGroup` multipart form.\n *\n * @param request - endpoints for this bot.\n * @param form - multipart body.\n * @param signal - cancellation.\n * @returns the sent messages.\n */\nexport function sendMediaGroup(request, form, signal) {\n return invoke(request, 'sendMediaGroup', form, signal);\n}\nfunction failure(method, status, body) {\n const retryAfter = body.parameters?.retry_after;\n return new TelegramApiError(`telegram ${method} answered ${body.error_code ?? status}${body.description === undefined ? '' : `: ${body.description}`}`, {\n method,\n status,\n ...(body.error_code === undefined ? {} : { errorCode: body.error_code }),\n ...(body.description === undefined\n ? {}\n : { description: body.description }),\n ...(retryAfter === undefined ? {} : { retryAfterMs: retryAfter * 1000 }),\n });\n}\n/**\n * Whether a failed request was cancelled, either because its signal is aborted or because the failure it produced is\n * an abort.\n *\n * @param cause - the value `ctx.http` rejected with.\n * @param signal - the cancellation signal handed to the request.\n * @returns true when the request was cancelled rather than rejected by the transport.\n */\nfunction isCancellation(cause, signal) {\n if (signal?.aborted === true)\n return true;\n if (isAbortError(cause))\n return true;\n return signal?.reason !== undefined && cause === signal.reason;\n}\n/**\n * The value a cancelled request rejects with: the signal's reason, so the classifier recognises the cancellation\n * instead of a wrapped transport failure.\n *\n * @param cause - the value `ctx.http` rejected with.\n * @param signal - the cancellation signal handed to the request.\n * @returns the abort error to rethrow.\n */\nfunction cancellation(cause, signal) {\n return signal?.aborted === true ? signal.reason : cause;\n}\n/** Whether a caught value is an abort error, including the `DOMException` a signal produces. */\nfunction isAbortError(cause) {\n return ((cause instanceof Error || cause instanceof DOMException) &&\n cause.name === 'AbortError');\n}\n/** The HTTP service's failure carries the response it refused; recover it structurally. */\nfunction responseOf(cause) {\n if (typeof cause !== 'object' || cause === null || !('response' in cause))\n return undefined;\n const response = cause.response;\n return response instanceof Response ? response : undefined;\n}\n//# sourceMappingURL=request.js.map","import { invoke } from \"../request.js\";\n/**\n * Client for every Bot API method declared in this directory.\n *\n * Each declaration file ends with `Internal.define('methodName')` calls; this\n * class turns them into prototype methods over the shared transport in\n * `request.ts`, so the full upstream method surface stays callable\n * without duplicating method bodies. The `declare module './internal.ts'`\n * blocks in those files provide the parameter and return types.\n */\nexport class Internal {\n request;\n constructor(request) {\n this.request = request;\n }\n /**\n * Register one Bot API method from a declaration file.\n * @param method - Bot API method name.\n */\n static define(method) {\n Object.defineProperty(Internal.prototype, method, {\n configurable: true,\n writable: true,\n value: async function (data = {}, signal) {\n return await invoke(this.request, method, data, signal);\n },\n });\n }\n}\n//# sourceMappingURL=internal.js.map","import { Internal } from \"./index.js\";\nInternal.define('answerInlineQuery');\nInternal.define('answerWebAppQuery');\n//# sourceMappingURL=inline.js.map","import { Internal } from \"./index.js\";\nInternal.define('sendGame');\nInternal.define('setGameScore');\nInternal.define('getGameHighScores');\n//# sourceMappingURL=game.js.map","import { Internal } from \"./index.js\";\nInternal.define('setPassportDataErrors');\n//# sourceMappingURL=passport.js.map","import { Internal } from \"./index.js\";\nInternal.define('sendInvoice');\nInternal.define('createInvoiceLink');\nInternal.define('answerShippingQuery');\nInternal.define('answerPreCheckoutQuery');\n//# sourceMappingURL=payment.js.map","import { Internal } from \"./index.js\";\nInternal.define('sendSticker');\nInternal.define('getStickerSet');\nInternal.define('getCustomEmojiStickers');\nInternal.define('uploadStickerFile');\nInternal.define('createNewStickerSet');\nInternal.define('addStickerToSet');\nInternal.define('setStickerPositionInSet');\nInternal.define('deleteStickerFromSet');\nInternal.define('setStickerSetThumb');\n//# sourceMappingURL=sticker.js.map","import { Internal } from \"./index.js\";\nInternal.define('getUpdates');\nInternal.define('setWebhook');\nInternal.define('deleteWebhook');\nInternal.define('getWebhookInfo');\n//# sourceMappingURL=update.js.map","// version: December 30, 2022\nimport { Internal } from \"./internal.js\";\nexport * from \"./internal.js\";\nexport * from \"./inline.js\";\nexport * from \"./game.js\";\nexport * from \"./passport.js\";\nexport * from \"./payment.js\";\nexport * from \"./sticker.js\";\nexport * from \"./update.js\";\nInternal.define('getMe');\nInternal.define('logOut');\nInternal.define('close');\nInternal.define('sendMessage');\nInternal.define('forwardMessage');\nInternal.define('copyMessage');\nInternal.define('sendPhoto');\nInternal.define('sendAudio');\nInternal.define('sendDocument');\nInternal.define('sendVideo');\nInternal.define('sendAnimation');\nInternal.define('sendVoice');\nInternal.define('sendVideoNote');\nInternal.define('sendMediaGroup');\nInternal.define('sendLocation');\nInternal.define('editMessageLiveLocation');\nInternal.define('stopMessageLiveLocation');\nInternal.define('sendVenue');\nInternal.define('sendContact');\nInternal.define('sendPoll');\nInternal.define('sendDice');\nInternal.define('sendChatAction');\nInternal.define('getUserProfilePhotos');\nInternal.define('getFile');\nInternal.define('banChatMember');\nInternal.define('unbanChatMember');\nInternal.define('restrictChatMember');\nInternal.define('promoteChatMember');\nInternal.define('setChatAdministratorCustomTitle');\nInternal.define('banChatSenderChat');\nInternal.define('unbanChatSenderChat');\nInternal.define('setChatPermissions');\nInternal.define('exportChatInviteLink');\nInternal.define('createChatInviteLink');\nInternal.define('editChatInviteLink');\nInternal.define('revokeChatInviteLink');\nInternal.define('approveChatJoinRequest');\nInternal.define('declineChatJoinRequest');\nInternal.define('setChatPhoto');\nInternal.define('deleteChatPhoto');\nInternal.define('setChatTitle');\nInternal.define('setChatDescription');\nInternal.define('pinChatMessage');\nInternal.define('unpinChatMessage');\nInternal.define('unpinAllChatMessages');\nInternal.define('leaveChat');\nInternal.define('getChat');\nInternal.define('getChatAdministrators');\nInternal.define('getChatMemberCount');\nInternal.define('getChatMember');\nInternal.define('setChatStickerSet');\nInternal.define('deleteChatStickerSet');\nInternal.define('getForumTopicIconStickers');\nInternal.define('createForumTopic');\nInternal.define('editForumTopic');\nInternal.define('closeForumTopic');\nInternal.define('reopenForumTopic');\nInternal.define('deleteForumTopic');\nInternal.define('unpinAllForumTopicMessages');\nInternal.define('editGeneralForumTopic');\nInternal.define('closeGeneralForumTopic');\nInternal.define('reopenGeneralForumTopic');\nInternal.define('hideGeneralForumTopic');\nInternal.define('unhideGeneralForumTopic');\nInternal.define('answerCallbackQuery');\nInternal.define('setMyCommands');\nInternal.define('deleteMyCommands');\nInternal.define('getMyCommands');\nInternal.define('setChatMenuButton');\nInternal.define('getChatMenuButton');\nInternal.define('setMyDefaultAdministratorRights');\nInternal.define('getMyDefaultAdministratorRights');\nInternal.define('editMessageText');\nInternal.define('editMessageCaption');\nInternal.define('editMessageMedia');\nInternal.define('editMessageReplyMarkup');\nInternal.define('stopPoll');\nInternal.define('deleteMessage');\n//# sourceMappingURL=index.js.map","import z from '@deepseek-ai/schemastery';\n/** Validated Telegram adapter configuration. */\nexport const Config = z.object({\n token: z.string().role('secret').required(),\n transport: z.union(['polling', 'webhook']).default('polling'),\n dropPendingUpdates: z.boolean().default(true),\n apiBaseUrl: z.string().role('url').default('https://api.telegram.org'),\n files: z\n .object({\n baseUrl: z.string().role('url'),\n local: z.boolean().default(false),\n })\n .default({}),\n polling: z\n .object({\n timeoutMs: z.natural().role('ms').default(25_000),\n retryTimes: z.natural().default(6),\n retryIntervalMs: z.natural().role('ms').default(5_000),\n retryLazyMs: z.natural().role('ms').default(60_000),\n mediaGroupWindowMs: z.natural().role('ms').default(1_200),\n })\n .default({}),\n webhook: z\n .object({\n path: z.string().default('/telegram/webhook'),\n publicUrl: z.string().role('url'),\n maxBodyBytes: z.natural().default(1_048_576),\n })\n .default({}),\n media: z\n .object({\n stagingTtlMs: z\n .natural()\n .role('ms')\n .default(10 * 60_000),\n maxStagedBytes: z.natural().default(64 * 1024 * 1024),\n })\n .default({}),\n linkPreview: z.boolean().default(true),\n});\n//# sourceMappingURL=config.js.map","/** Failure to derive the bot identity from the configured token. */\nexport class TelegramIdentityError extends Error {\n constructor(message) {\n super(message);\n this.name = 'TelegramIdentityError';\n }\n}\n/**\n * The bot id encoded in a Bot API token.\n * @param token - `<bot id>:<secret>`.\n * @returns the numeric bot id as text.\n */\nexport function botIdFromToken(token) {\n const [id] = token.split(':');\n if (id === undefined || !/^\\d+$/.test(id)) {\n throw new TelegramIdentityError('telegram: token must look like \"<bot id>:<secret>\"');\n }\n return id;\n}\n/**\n * Verify a `getMe` answer against the token prefix.\n * @param token - the configured Bot API token.\n * @param user - the `getMe` result.\n * @returns the bot's numeric id.\n */\nexport function verifyIdentity(token, user) {\n const expected = botIdFromToken(token);\n const actual = String(user.id);\n if (actual !== expected) {\n throw new TelegramIdentityError(`telegram: token belongs to bot ${expected} but getMe returned bot ${actual}`);\n }\n return actual;\n}\n//# sourceMappingURL=identity.js.map","import { randomUUID } from 'node:crypto';\n/**\n * Bounded in-memory staging for outbound media.\n *\n * Telegram has no standalone upload endpoint: bytes must ride the `sendPhoto`\n * / `sendMediaGroup` multipart request. `upload` fetches and stages them, and\n * `sendPayload` reads them back by key. Entries expire and the whole store is\n * bounded, so a long-lived bot cannot grow without limit; a retried send still\n * finds its bytes until the TTL elapses.\n */\nexport class MediaStaging {\n ttlMs;\n maxBytes;\n entries = new Map();\n bytes = 0;\n constructor(ttlMs, maxBytes) {\n this.ttlMs = ttlMs;\n this.maxBytes = maxBytes;\n }\n /**\n * Stage bytes under a fresh opaque key.\n * @param media - the bytes and their display name.\n * @returns the resource key `prepare` hands to `serialize`.\n */\n stage(media) {\n const now = Date.now();\n this.prune(now);\n const key = `tg-media:${randomUUID()}`;\n const bytes = media.data.byteLength;\n this.entries.set(key, { media, bytes, expiresAt: now + this.ttlMs });\n this.bytes += bytes;\n this.evict(now);\n return { key, expiresAt: now + this.ttlMs };\n }\n /**\n * Read staged bytes back.\n * @param key - a key returned by {@link stage}.\n * @returns the staged media, or undefined once expired or evicted.\n */\n get(key) {\n this.prune(Date.now());\n return this.entries.get(key)?.media;\n }\n prune(now) {\n for (const [key, entry] of this.entries) {\n if (entry.expiresAt > now)\n continue;\n this.entries.delete(key);\n this.bytes -= entry.bytes;\n }\n }\n evict(now) {\n while (this.bytes > this.maxBytes) {\n const oldest = this.entries.keys().next();\n if (oldest.done === true)\n return;\n const entry = this.entries.get(oldest.value);\n this.entries.delete(oldest.value);\n if (entry !== undefined)\n this.bytes -= entry.bytes;\n }\n this.prune(now);\n }\n}\n//# sourceMappingURL=media.js.map","import { isPhrasingContainer } from '@deepseek-ai/satori-element';\n/** Telegram's documented bounds, shared by both modes. */\nexport const TELEGRAM_LIMITS = {\n text: 4_096,\n caption: 1_024,\n parts: 10,\n buttonsPerRow: 5,\n streamIntervalMs: 1_000,\n deleteWindowMs: 48 * 60 * 60 * 1_000,\n};\n/** Map a core resource kind onto the Telegram method family. */\nexport function mediaKindOf(kind) {\n switch (kind) {\n case 'image':\n return 'photo';\n case 'audio':\n return 'audio';\n case 'video':\n return 'video';\n case 'file':\n return 'document';\n }\n}\n/**\n * Media element → the node of its own platform message.\n *\n * Telegram has no inline media, and a `parse_mode` message carries no attachment, so media never stays inside a\n * text run. Media that stood in phrasing content (`<p>`, a heading, a link, an inline wrapper) is reported as\n * `moved`: the caller sees the message as text plus an extra media message instead of one block.\n *\n * @param el - one of `img`/`audio`/`video`/`file`.\n * @param ctx - render context of the mode.\n * @returns the media node, to be published after the text run it was found in.\n */\nexport function mediaNode(el, ctx) {\n const parent = ctx.ancestors[ctx.ancestors.length - 1];\n if (parent !== undefined && isPhrasingContainer(parent.type)) {\n ctx.report.moved.push({\n tag: el.type,\n reason: 'telegram-media-split',\n path: ctx.stableId(el),\n });\n }\n switch (el.type) {\n case 'img':\n return {\n type: 'media',\n ref: ctx.resource('image', el.attrs.src, {}),\n kind: 'photo',\n };\n case 'video':\n return {\n type: 'media',\n ref: ctx.resource('video', el.attrs.src, {}),\n kind: 'video',\n };\n case 'audio':\n return {\n type: 'media',\n ref: ctx.resource('audio', el.attrs.src, {}),\n kind: 'audio',\n };\n case 'file':\n return {\n type: 'media',\n ref: ctx.resource('file', el.attrs.src, el.attrs.name === undefined ? {} : { name: el.attrs.name }),\n kind: 'document',\n };\n }\n}\n/** Escape character data for `parse_mode: HTML`. */\nexport function escapeHtml(text) {\n return text\n .replaceAll('&', '&')\n .replaceAll('<', '<')\n .replaceAll('>', '>');\n}\n/** Escape one HTML attribute value. */\nexport function escapeAttribute(text) {\n return escapeHtml(text).replaceAll('\"', '"');\n}\n/**\n * Concatenate the text nodes of a subtree, dropping non-text nodes.\n *\n * Only for a context that holds a label and nothing else (a button caption); content handlers go through\n * {@link textRun} so that a media element reaches `assemble` instead of disappearing.\n */\nexport function inlineText(nodes) {\n let html = '';\n for (const node of nodes) {\n if (node.type === 'text')\n html += node.html;\n else if (node.type === 'button')\n html += escapeHtml(node.button.text);\n }\n return html;\n}\n/**\n * Split rendered children into the text run of one platform message and the nodes Telegram posts on their own.\n *\n * Inline wrappers (`p`, `b`, `a`, `li`, …) use this instead of concatenating text: a media element of the subtree\n * has to reach `assemble`, which turns it into a media message, rather than being dropped from the run.\n *\n * @param nodes - rendered children.\n * @returns the text HTML of the run and the non-text nodes, both in source order.\n */\nexport function textRun(nodes) {\n let html = '';\n const rest = [];\n for (const node of nodes) {\n if (node.type === 'text')\n html += node.html;\n else\n rest.push(node);\n }\n return { html, nodes: rest };\n}\n/** Split markup into tags, entities and code points so cuts never break a tag. */\nfunction tokenize(html) {\n const tokens = [];\n let i = 0;\n while (i < html.length) {\n const char = html[i];\n if (char === '<') {\n const end = html.indexOf('>', i);\n if (end === -1) {\n tokens.push({ raw: html.slice(i), visible: 0, newline: false });\n break;\n }\n tokens.push({ raw: html.slice(i, end + 1), visible: 0, newline: false });\n i = end + 1;\n continue;\n }\n if (char === '&') {\n const end = html.indexOf(';', i);\n if (end !== -1 && end - i <= 10) {\n tokens.push({ raw: html.slice(i, end + 1), visible: 1, newline: false });\n i = end + 1;\n continue;\n }\n }\n const codePoint = html.codePointAt(i);\n const raw = String.fromCodePoint(codePoint);\n tokens.push({ raw, visible: 1, newline: raw === '\\n' });\n i += raw.length;\n }\n return tokens;\n}\n/** Visible (after entity parsing) length of rendered HTML. */\nexport function visibleLength(html) {\n let length = 0;\n for (const token of tokenize(html))\n length += token.visible;\n return length;\n}\n/** Tag name of an opening tag, or undefined for a closing/self-closing tag. */\nfunction openTagName(raw) {\n if (!raw.startsWith('<') || raw.startsWith('</') || raw.startsWith('<!'))\n return undefined;\n const name = /^<([a-zA-Z][\\w-]*)/.exec(raw)?.[1];\n return name?.toLowerCase();\n}\n/**\n * Split rendered HTML into chunks no longer than `limit` visible characters,\n * closing and reopening inline tags at every cut so each message parses alone.\n */\nexport function splitHtml(html, limit) {\n if (visibleLength(html) <= limit)\n return [html];\n const chunks = [];\n let current = '';\n let visible = 0;\n const stack = [];\n const closeAll = () => stack\n .map((tag) => `</${tag.name}>`)\n .reverse()\n .join('');\n const reopenAll = () => stack.map((tag) => tag.open).join('');\n const flush = () => {\n if (current === '')\n return;\n chunks.push(current + closeAll());\n current = reopenAll();\n visible = 0;\n };\n for (const token of tokenize(html)) {\n if (token.visible > 0 && visible + token.visible > limit)\n flush();\n current += token.raw;\n visible += token.visible;\n const name = openTagName(token.raw);\n if (name !== undefined && !token.raw.endsWith('/>')) {\n stack.push({ name, open: token.raw });\n }\n else if (token.raw.startsWith('</')) {\n stack.pop();\n }\n }\n if (current !== '')\n chunks.push(current + closeAll());\n return chunks;\n}\n/** Group consecutive media into albums Telegram accepts. */\nfunction groupMedia(items) {\n const groups = [];\n for (const item of items) {\n const current = groups[groups.length - 1];\n const mixable = (a, b) => {\n const visual = (kind) => kind === 'photo' || kind === 'video' || kind === 'animation';\n return (visual(a) && visual(b)) || a === b;\n };\n if (current === undefined ||\n current.length >= TELEGRAM_LIMITS.parts ||\n !current.every((other) => mixable(other.kind, item.kind))) {\n groups.push([item]);\n }\n else {\n current.push(item);\n }\n }\n return groups;\n}\n/** Lay buttons into rows of at most five. */\nfunction layoutButtons(buttons) {\n const rows = [];\n let row = [];\n for (const button of buttons) {\n if (row.length >= TELEGRAM_LIMITS.buttonsPerRow) {\n rows.push(row);\n row = [];\n }\n row.push(button);\n }\n if (row.length > 0)\n rows.push(row);\n return rows;\n}\n/**\n * Fold a node stream into platform messages.\n *\n * Text before a media element becomes its caption when it fits; otherwise it\n * stays a text message. Consecutive media are grouped into albums, and all\n * buttons are attached to the last message.\n */\nexport function assembleDraft(nodes) {\n const drafts = [];\n let text = '';\n let media = [];\n let caption;\n let buttons = [];\n const flushText = () => {\n const trimmed = text.trim();\n if (trimmed === '') {\n text = '';\n return;\n }\n for (const chunk of splitHtml(trimmed, TELEGRAM_LIMITS.text)) {\n drafts.push({ text: chunk, media: [], buttons: [] });\n }\n text = '';\n };\n const flushMedia = () => {\n if (media.length === 0)\n return;\n const groups = groupMedia(media);\n for (const [index, group] of groups.entries()) {\n drafts.push({\n text: index === 0 ? (caption ?? '') : '',\n media: group,\n buttons: [],\n });\n }\n media = [];\n caption = undefined;\n };\n for (const node of nodes) {\n switch (node.type) {\n case 'text':\n if (media.length > 0) {\n if (text.trim() !== '')\n flushText();\n flushMedia();\n }\n text += node.html;\n break;\n case 'media':\n if (media.length === 0) {\n if (text.trim() !== '') {\n const visible = visibleLength(text.trim());\n if (visible <= TELEGRAM_LIMITS.caption) {\n caption = text.trim();\n text = '';\n }\n else {\n flushText();\n }\n }\n }\n media.push({ ref: node.ref, kind: node.kind });\n break;\n case 'button':\n buttons.push(node.button);\n break;\n }\n }\n flushMedia();\n flushText();\n const rows = layoutButtons(buttons);\n if (rows.length > 0) {\n const last = drafts[drafts.length - 1];\n if (last !== undefined)\n last.buttons = rows;\n else\n drafts.push({ text: '\\u2060', media: [], buttons: rows });\n }\n return drafts;\n}\n/** Resolve one media key from `prepared.resolved`. */\nfunction resolvedKey(prepared, ref) {\n const resolved = prepared.resolved.get(ref);\n if (resolved === undefined) {\n throw new Error('telegram: media was not prepared before serialize');\n }\n return resolved.key;\n}\n/** Build the request payload of one draft. */\nexport function serializeDraft(prepared, ctx, parseMode) {\n const { draft } = prepared;\n const threadId = typeof ctx.target.thread === 'string' && /^\\d+$/.test(ctx.target.thread)\n ? Number(ctx.target.thread)\n : undefined;\n // Only the first platform message answers the quoted one: a split message would otherwise repeat the quote on\n // every part. `SerializeContext.quote` reaches every part, so the adapter picks the one that carries it.\n const replyTo = ctx.index === 0 && ctx.quote !== undefined && /^\\d+$/.test(ctx.quote)\n ? Number(ctx.quote)\n : undefined;\n const buttons = draft.buttons.length === 0\n ? undefined\n : draft.buttons.map((row) => row.map(toWireButton));\n if (draft.media.length === 0) {\n return {\n kind: 'text',\n chatId: ctx.target.chat.id,\n ...(threadId === undefined ? {} : { threadId }),\n ...(replyTo === undefined ? {} : { replyTo }),\n ...(parseMode === undefined ? {} : { parseMode }),\n text: draft.text,\n ...(buttons === undefined ? {} : { buttons }),\n };\n }\n const media = draft.media.map((item) => ({\n kind: item.kind,\n key: resolvedKey(prepared, item.ref),\n name: item.ref.meta.name ?? '',\n }));\n return {\n kind: media.length > 1 ? 'album' : 'media',\n chatId: ctx.target.chat.id,\n ...(threadId === undefined ? {} : { threadId }),\n ...(replyTo === undefined ? {} : { replyTo }),\n ...(parseMode === undefined ? {} : { parseMode }),\n ...(draft.text.trim() === '' ? {} : { caption: draft.text.trim() }),\n media,\n ...(buttons === undefined ? {} : { buttons }),\n };\n}\n/**\n * Hard platform limits of one draft, checked before any request.\n *\n * Only `callback_data` can fail here. The three other bounds the platform\n * documents are unreachable by construction: `splitHtml` cuts text at\n * `TELEGRAM_LIMITS.text`, `assembleDraft` keeps a caption only when it fits\n * `TELEGRAM_LIMITS.caption` (longer text stays a text message), and\n * `groupMedia` caps an album at `TELEGRAM_LIMITS.parts`.\n *\n * @param draft - the assembled draft.\n * @returns every violation the platform would refuse.\n */\nexport function checkDraft(draft) {\n const violations = [];\n for (const row of draft.buttons) {\n for (const button of row) {\n if (button.kind !== 'callback')\n continue;\n const bytes = Buffer.byteLength(button.data ?? '', 'utf8');\n if (bytes <= 64)\n continue;\n violations.push({\n kind: 'size',\n key: 'limit.payload.bytes',\n limit: 64,\n actual: bytes,\n message: `Telegram callback_data accepts 64 bytes, got ${bytes}`,\n });\n }\n }\n return violations;\n}\n/** Convert one collected button into Telegram's wire shape. */\nfunction toWireButton(button) {\n return button.kind === 'link'\n ? { text: button.text, url: button.url ?? '' }\n : { text: button.text, callback_data: button.data ?? '' };\n}\n//# sourceMappingURL=shared.js.map","/**\n * `html` mode: Telegram's `parse_mode: HTML`.\n *\n * Native tags are the documented subset (`b`/`i`/`u`/`s`/`a`/`code`/`pre`/\n * `blockquote`/`tg-spoiler`); everything else either becomes text inside a\n * draft or takes the core fallback. Media is sent as separate media messages\n * (albums for consecutive items) — including media that stood inside an inline\n * wrapper, which is lifted out of the text run and reported as moved — and\n * action, link and submit buttons become an inline keyboard. An `input` button\n * has no native form control here, so it takes the core fallback.\n */\nimport { ElementRegistry, } from '@deepseek-ai/cordis-plugin-im-core';\nimport { assembleDraft, checkDraft, escapeAttribute, escapeHtml, mediaNode, serializeDraft, TELEGRAM_LIMITS, textRun, } from \"./shared.js\";\n/** Wrap the text of `children` in one inline tag; media of the subtree follows as its own message. */\nfunction wrap(tag, ctx, children) {\n const { html, nodes } = textRun(ctx.render(children));\n return [\n ...(html === ''\n ? []\n : [{ type: 'text', html: `<${tag}>${html}</${tag}>` }]),\n ...nodes,\n ];\n}\n/** Render a heading as a bold line, then the media of the heading, then the paragraph break. */\nfunction heading(ctx, children) {\n const { html, nodes } = textRun(ctx.render(children));\n const line = html === '' ? [] : [{ type: 'text', html: `<b>${html}</b>` }];\n return [...line, ...nodes, { type: 'text', html: '\\n\\n' }];\n}\n/** Build the `html` mode. */\nexport function createHtmlMode() {\n const elements = new ElementRegistry()\n .register('text', (el) => ({\n type: 'text',\n html: escapeHtml(el.attrs.content),\n }))\n .register('br', () => ({ type: 'text', html: '\\n' }))\n // Paragraphs hand their children through so that media reaches `assemble` instead of being flattened away.\n .register('p', (el, ctx) => [\n ...ctx.render(el.children),\n { type: 'text', html: '\\n\\n' },\n ])\n .register('b', (el, ctx) => wrap('b', ctx, el.children))\n .register('i', (el, ctx) => wrap('i', ctx, el.children))\n .register('u', (el, ctx) => wrap('u', ctx, el.children))\n .register('s', (el, ctx) => wrap('s', ctx, el.children))\n .register('spoiler', (el, ctx) => wrap('tg-spoiler', ctx, el.children))\n .register('blockquote', (el, ctx) => wrap('blockquote', ctx, el.children))\n .register('code', (el, ctx) => ({\n type: 'text',\n html: `<code>${escapeHtml(ctx.text(el.children))}</code>`,\n }))\n .register('pre', (el, ctx) => {\n const text = escapeHtml(ctx.text(el.children));\n const language = el.attrs.lang;\n return {\n type: 'text',\n html: language === undefined\n ? `<pre>${text}</pre>`\n : `<pre><code class=\"language-${escapeAttribute(language)}\">${text}</code></pre>`,\n };\n })\n .register('a', (el, ctx) => {\n const { html, nodes } = textRun(ctx.render(el.children));\n // A link around nothing but an image keeps the URL as its label; the image follows as its own message.\n const label = html === '' ? escapeHtml(el.attrs.href) : html;\n return [\n {\n type: 'text',\n html: `<a href=\"${escapeAttribute(el.attrs.href)}\">${label}</a>`,\n },\n ...nodes,\n ];\n })\n .register('at', (el) => {\n if (el.attrs.id !== undefined && el.attrs.type === 'user') {\n const label = escapeHtml(el.attrs.name ?? el.attrs.id);\n return {\n type: 'text',\n html: `<a href=\"tg://user?id=${escapeAttribute(el.attrs.id)}\">${label}</a>`,\n };\n }\n const label = el.attrs.name ?? el.attrs.type;\n return { type: 'text', html: escapeHtml(`@${label}`) };\n }, { variants: ['user', 'all', 'here', 'role'] })\n .register('h1', (el, ctx) => heading(ctx, el.children))\n .register('h2', (el, ctx) => heading(ctx, el.children))\n .register('h3', (el, ctx) => heading(ctx, el.children))\n .register('h4', (el, ctx) => heading(ctx, el.children))\n .register('h5', (el, ctx) => heading(ctx, el.children))\n .register('h6', (el, ctx) => heading(ctx, el.children))\n .register('ul', (el, ctx) => ctx.render(el.children))\n .register('ol', (el, ctx) => ctx.render(el.children))\n .register('li', (el, ctx) => {\n const { html, nodes } = textRun(ctx.render(el.children));\n const line = html === '' ? [] : [{ type: 'text', html: `• ${html}` }];\n return [...line, ...nodes, { type: 'text', html: '\\n' }];\n })\n .register('hr', () => ({ type: 'text', html: '\\n—\\n' }))\n .register('img', (el, ctx) => mediaNode(el, ctx), { variants: ['inline'] })\n .register('video', (el, ctx) => mediaNode(el, ctx))\n .register('audio', (el, ctx) => mediaNode(el, ctx))\n .register('file', (el, ctx) => mediaNode(el, ctx))\n .register('emoji', (el) => ({\n type: 'text',\n html: escapeHtml(el.attrs.name ?? ''),\n }))\n .register('channel', (el) => ({\n type: 'text',\n html: escapeHtml(el.attrs.name ?? ''),\n }))\n .register('small', (el, ctx) => ctx.render(el.children))\n .register('button', (el, ctx) => {\n if (el.attrs.type === 'link') {\n return {\n type: 'button',\n button: {\n kind: 'link',\n text: ctx.text(el.children).trim() || el.attrs.href,\n url: el.attrs.href,\n },\n };\n }\n // `input` is not a declared variant (the core fallback renders it as text), but the attribute union still holds it.\n if (el.attrs.type === 'input') {\n return {\n type: 'text',\n html: escapeHtml(ctx.text(el.children).trim() || el.attrs.text),\n };\n }\n return {\n type: 'button',\n button: {\n kind: 'callback',\n text: ctx.text(el.children).trim() || el.attrs.id,\n data: el.attrs.id,\n },\n };\n }, { variants: ['action', 'link', 'submit'] });\n return {\n id: 'html',\n elements,\n limits: {\n 'limit.text.chars': TELEGRAM_LIMITS.text,\n 'limit.buttons.row': TELEGRAM_LIMITS.buttonsPerRow,\n 'limit.stream.interval': TELEGRAM_LIMITS.streamIntervalMs,\n 'limit.message.parts': TELEGRAM_LIMITS.parts,\n 'limit.delete.window': TELEGRAM_LIMITS.deleteWindowMs,\n },\n assemble: (nodes) => assembleDraft(nodes),\n serialize: (prepared, ctx) => serializeDraft(prepared, ctx, 'HTML'),\n check: (draft) => checkDraft(draft),\n };\n}\n//# sourceMappingURL=html.js.map","/**\n * `plain` mode: no `parse_mode`, no formatting, no inline keyboard.\n *\n * Text is sent verbatim; links keep only their label, mentions become\n * `@name`, and buttons degrade to text lines. Media still goes out as media\n * messages — including media that stood inside an inline wrapper, which is\n * lifted out of the text run and reported as moved — so a platform that\n * refuses HTML can still receive the content.\n */\nimport { ElementRegistry } from '@deepseek-ai/cordis-plugin-im-core';\nimport { assembleDraft, checkDraft, inlineText, mediaNode, serializeDraft, TELEGRAM_LIMITS, textRun, } from \"./shared.js\";\n/** Build the `plain` mode. */\nexport function createPlainMode() {\n const elements = new ElementRegistry()\n .register('text', (el) => ({ type: 'text', html: el.attrs.content }))\n .register('br', () => ({ type: 'text', html: '\\n' }))\n // Paragraphs hand their children through so that media reaches `assemble` instead of being flattened away.\n .register('p', (el, ctx) => [\n ...ctx.render(el.children),\n { type: 'text', html: '\\n\\n' },\n ])\n .register('a', (el, ctx) => {\n const { html, nodes } = textRun(ctx.render(el.children));\n // A link around nothing but an image keeps the URL as its label; the image follows as its own message.\n return [\n { type: 'text', html: html === '' ? el.attrs.href : html },\n ...nodes,\n ];\n })\n .register('at', (el) => ({\n type: 'text',\n html: `@${el.attrs.name ?? (el.attrs.type === 'user' ? el.attrs.id : undefined) ?? el.attrs.type}`,\n }), { variants: ['user', 'all', 'here', 'role'] })\n .register('img', (el, ctx) => mediaNode(el, ctx), { variants: ['inline'] })\n .register('video', (el, ctx) => mediaNode(el, ctx))\n .register('audio', (el, ctx) => mediaNode(el, ctx))\n .register('file', (el, ctx) => mediaNode(el, ctx))\n .register('button', (el, ctx) => ({\n type: 'text',\n html: `[${inlineText(ctx.render(el.children)).trim() || (el.attrs.type === 'link' ? el.attrs.href : el.attrs.type === 'input' ? el.attrs.text : el.attrs.id)}]\\n`,\n }), { variants: ['action', 'link', 'submit'] });\n return {\n id: 'plain',\n elements,\n limits: {\n 'limit.text.chars': TELEGRAM_LIMITS.text,\n 'limit.stream.interval': TELEGRAM_LIMITS.streamIntervalMs,\n 'limit.message.parts': TELEGRAM_LIMITS.parts,\n 'limit.delete.window': TELEGRAM_LIMITS.deleteWindowMs,\n },\n assemble: (nodes) => assembleDraft(nodes),\n serialize: (prepared, ctx) => serializeDraft(prepared, ctx, undefined),\n check: (draft) => checkDraft(draft),\n };\n}\n//# sourceMappingURL=plain.js.map","/**\n * Inbound decoding: one Telegram update becomes either an intake `Session`\n * (`message`) or a button interaction session.\n *\n * Text runs through `entities` into the element vocabulary (bold, italic,\n * links, mentions, code, spoilers, quotes), media becomes resource elements\n * whose `src` is the bot's `satori:` file route, and everything the vocabulary\n * cannot express degrades to readable text. Only `message` and `callback_query`\n * updates are decoded; other update families are ignored.\n */\nimport { h, normalize } from '@deepseek-ai/satori-element';\n/** Display name of a Telegram user. */\nfunction userName(user) {\n const name = [user.first_name, user.last_name]\n .filter((part) => part !== undefined && part !== '')\n .join(' ');\n return name !== '' ? name : (user.username ?? String(user.id));\n}\n/** Platform user reference. */\nfunction userRef(user) {\n return {\n id: String(user.id),\n name: userName(user),\n isBot: user.is_bot,\n };\n}\n/** Chat reference; forum messages are `topic`, everything else is `group`. */\nfunction chatRef(chat, message) {\n const name = chat.title ??\n [chat.first_name, chat.last_name]\n .filter((part) => part !== undefined)\n .join(' ');\n if (chat.type === 'private') {\n return {\n id: String(chat.id),\n type: 'direct',\n ...(name === '' ? {} : { name }),\n };\n }\n return {\n id: String(chat.id),\n type: message.is_topic_message === true ? 'topic' : 'group',\n ...(name === '' ? {} : { name }),\n };\n}\n/** Whether an entity type is one the vocabulary renders. */\nfunction entityTag(type) {\n switch (type) {\n case 'bold':\n return 'b';\n case 'italic':\n return 'i';\n case 'underline':\n return 'u';\n case 'strikethrough':\n return 's';\n case 'spoiler':\n return 'spoiler';\n case 'blockquote':\n case 'expandable_blockquote':\n return 'blockquote';\n case 'code':\n return 'code';\n case 'pre':\n return 'pre';\n default:\n return undefined;\n }\n}\n/** Render a text range with its nested entities. */\nfunction renderRange(input, entities, from, to) {\n const nodes = [];\n let cursor = from;\n for (const entity of entities) {\n const start = entity.offset;\n const end = start + entity.length;\n if (start < cursor || end > to)\n continue;\n if (start > cursor)\n nodes.push(input.text.slice(cursor, start));\n const inner = renderRange(input, entities.filter((other) => other !== entity), start, end);\n const tag = entityTag(entity.type);\n if (tag !== undefined) {\n switch (tag) {\n case 'b':\n nodes.push(h('b', {}, ...inner));\n break;\n case 'i':\n nodes.push(h('i', {}, ...inner));\n break;\n case 'u':\n nodes.push(h('u', {}, ...inner));\n break;\n case 's':\n nodes.push(h('s', {}, ...inner));\n break;\n case 'spoiler':\n nodes.push(h('spoiler', {}, ...inner));\n break;\n case 'blockquote':\n nodes.push(h('blockquote', {}, ...inner));\n break;\n case 'code':\n nodes.push(h('code', {}, ...inner));\n break;\n case 'pre':\n nodes.push(h('pre', entity.language === undefined ? {} : { lang: entity.language }, ...inner));\n break;\n }\n }\n else if (entity.type === 'text_link' && entity.url !== undefined) {\n nodes.push(h('a', { href: entity.url }, ...inner));\n }\n else if (entity.type === 'text_mention' && entity.user !== undefined) {\n nodes.push(h('at', {\n type: 'user',\n id: String(entity.user.id),\n name: userName(entity.user),\n }));\n }\n else {\n nodes.push(...inner);\n }\n cursor = end;\n }\n if (cursor < to)\n nodes.push(input.text.slice(cursor, to));\n return nodes;\n}\n/** Element tree of one text body. */\nfunction textNodes(input) {\n if (input.text === '')\n return [];\n const entities = [...(input.entities ?? [])]\n .filter((entity) => entity.offset >= 0 &&\n entity.length > 0 &&\n entity.offset + entity.length <= input.text.length)\n .sort((a, b) => a.offset - b.offset || b.length - a.length);\n return renderRange(input, entities, 0, input.text.length);\n}\n/** The best photo size of a message (the last one is the largest). */\nfunction photoSize(message) {\n return message.photo?.[message.photo.length - 1];\n}\n/** One `satori:` URL for a Telegram file id. */\nfunction fileUrl(bot, fileId) {\n return bot.getInternalUrl(`/files/${encodeURIComponent(fileId)}`);\n}\n/** Media elements of one message. */\nfunction mediaNodes(bot, message) {\n const nodes = [];\n const photo = photoSize(message);\n if (photo !== undefined)\n nodes.push(h('img', { src: fileUrl(bot, photo.file_id) }));\n if (message.sticker !== undefined) {\n if (message.sticker.is_animated &&\n message.sticker.thumbnail === undefined) {\n nodes.push('[动画表情]');\n }\n else {\n const fileId = message.sticker.thumbnail?.file_id ?? message.sticker.file_id;\n nodes.push(h('img', { src: fileUrl(bot, fileId) }));\n }\n }\n if (message.animation !== undefined) {\n nodes.push(h('video', {\n src: fileUrl(bot, message.animation.file_id),\n ...(message.animation.file_name === undefined\n ? {}\n : { name: message.animation.file_name }),\n duration: message.animation.duration,\n }));\n }\n if (message.video !== undefined) {\n nodes.push(h('video', {\n src: fileUrl(bot, message.video.file_id),\n ...(message.video.file_name === undefined\n ? {}\n : { name: message.video.file_name }),\n duration: message.video.duration,\n }));\n }\n if (message.voice !== undefined) {\n nodes.push(h('audio', {\n src: fileUrl(bot, message.voice.file_id),\n name: 'voice',\n duration: message.voice.duration,\n }));\n }\n if (message.audio !== undefined) {\n nodes.push(h('audio', {\n src: fileUrl(bot, message.audio.file_id),\n ...(message.audio.file_name === undefined\n ? {}\n : { name: message.audio.file_name }),\n duration: message.audio.duration,\n }));\n }\n if (message.document !== undefined) {\n nodes.push(h('file', {\n src: fileUrl(bot, message.document.file_id),\n ...(message.document.file_name === undefined\n ? {}\n : { name: message.document.file_name }),\n }));\n }\n if (message.venue !== undefined) {\n nodes.push(`[位置: ${message.venue.title} — ${message.venue.address}]`);\n }\n else if (message.location !== undefined) {\n nodes.push(`[位置: ${message.location.latitude}, ${message.location.longitude}]`);\n }\n if (message.contact !== undefined) {\n const name = [message.contact.first_name, message.contact.last_name]\n .filter((part) => part !== undefined)\n .join(' ');\n nodes.push(`[联系人: ${name} ${message.contact.phone_number}]`);\n }\n return nodes;\n}\n/** Message body: caption/text entities plus media. */\nfunction contentNodes(bot, message) {\n const text = {\n text: message.text ?? message.caption ?? '',\n entities: message.entities ?? message.caption_entities,\n };\n const nodes = [...textNodes(text), ...mediaNodes(bot, message)];\n return nodes.length > 0\n ? nodes\n : [\n h('raw', {\n platform: 'telegram',\n type: 'message',\n data: message,\n }),\n ];\n}\n/** Mention flags and mentioned users of a message. */\nfunction mentionsOf(bot, message) {\n const users = [];\n let self = false;\n const username = bot.username?.toLowerCase();\n for (const entity of [\n ...(message.entities ?? []),\n ...(message.caption_entities ?? []),\n ]) {\n if (entity.type === 'text_mention' && entity.user !== undefined) {\n const ref = userRef(entity.user);\n users.push(ref);\n if (ref.id === bot.selfId)\n self = true;\n }\n else if (entity.type === 'mention') {\n const text = (message.text ?? message.caption ?? '').slice(entity.offset, entity.offset + entity.length);\n const name = text.replace(/^@/, '');\n if (name === '')\n continue;\n users.push({ id: name, name: `@${name}` });\n if (username !== undefined && name.toLowerCase() === username)\n self = true;\n }\n }\n if (!self && username !== undefined) {\n const body = message.text ?? message.caption ?? '';\n if (new RegExp(`(^|\\\\s)@${username}(\\\\s|$)`, 'i').test(body))\n self = true;\n }\n return { self, all: false, users };\n}\n/**\n * Decode one message into `InboundMessage`.\n * @param bot - the receiving adapter.\n * @param messages - one message, or every message of a merged media group (in order).\n * @returns the normalized inbound message.\n */\nexport function decodeMessage(bot, messages) {\n const [primary] = messages;\n if (primary === undefined)\n throw new Error('telegram: decodeMessage requires at least one message');\n const senderUser = primary.from ?? primary.sender_chat;\n const sender = senderUser === undefined\n ? { id: 'unknown', name: 'unknown' }\n : 'is_bot' in senderUser\n ? userRef(senderUser)\n : {\n id: String(senderUser.id),\n name: ('title' in senderUser ? senderUser.title : undefined) ??\n String(senderUser.id),\n };\n const content = normalize(messages.flatMap((message) => contentNodes(bot, message)));\n const threadId = primary.message_thread_id;\n const date = primary.date * 1000;\n const referrer = {\n chatId: String(primary.chat.id),\n messageId: String(primary.message_id),\n date,\n ...(threadId === undefined ? {} : { threadId: String(threadId) }),\n };\n const ids = messages.map((message) => String(message.message_id));\n return {\n id: String(Math.min(...messages.map((message) => message.message_id))),\n ...(ids.length < 2 ? {} : { aliases: ids.slice(1) }),\n chat: chatRef(primary.chat, primary),\n ...(threadId === undefined || primary.is_topic_message !== true\n ? {}\n : { thread: { id: String(threadId) } }),\n sender,\n content,\n ...(primary.reply_to_message === undefined ||\n 'forum_topic_created' in primary.reply_to_message\n ? {}\n : { quote: { id: String(primary.reply_to_message.message_id) } }),\n mentions: mentionsOf(bot, primary),\n time: date,\n referrer,\n raw: messages.length === 1 ? primary : messages,\n };\n}\n/**\n * Decode one Telegram update.\n * @param bot - the receiving adapter.\n * @param update - the update envelope.\n * @returns the session to publish, or undefined for an ignored update.\n */\nexport function decodeUpdate(bot, update) {\n if (update.message !== undefined) {\n const message = decodeMessage(bot, [update.message]);\n return bot.session({\n type: 'message',\n id: message.id,\n timestamp: message.time,\n message,\n raw: update,\n });\n }\n if (update.callback_query !== undefined) {\n return decodeCallback(bot, update.callback_query);\n }\n return undefined;\n}\n/** Decode one button click. */\nfunction decodeCallback(bot, query) {\n if (query === undefined || query.message === undefined)\n return undefined;\n const message = query.message;\n const chat = chatRef(message.chat, message);\n const referrer = {\n chatId: String(message.chat.id),\n messageId: String(message.message_id),\n date: message.date * 1000,\n ...(message.message_thread_id === undefined\n ? {}\n : { threadId: String(message.message_thread_id) }),\n callbackQueryId: query.id,\n };\n const button = {\n id: query.data ?? '',\n ...(query.data === undefined ? {} : { data: query.data }),\n referrer,\n time: Date.now(),\n bot,\n user: userRef(query.from),\n chat,\n message: { id: String(message.message_id), chat },\n respond: async (answer) => {\n await bot.internal.answerCallbackQuery({\n callback_query_id: query.id,\n ...(answer.toast === undefined\n ? {}\n : { text: answer.toast.content, show_alert: false }),\n });\n },\n };\n return bot.session({\n type: 'interaction/button',\n id: query.id,\n timestamp: Date.now(),\n button,\n raw: query,\n });\n}\n//# sourceMappingURL=decode.js.map","import { Status } from '@deepseek-ai/cordis-plugin-im-core';\nimport { decodeMessage, decodeUpdate } from \"./decode.js\";\nimport { classifyTelegramError } from \"./errors.js\";\n/** Update families the adapter consumes */\nexport const ALLOWED_UPDATES = ['message', 'callback_query'];\n/** Waitable sleep that resolves early on abort. */\nfunction sleep(ms, signal) {\n return new Promise((resolve) => {\n if (signal.aborted) {\n resolve();\n return;\n }\n const timer = setTimeout(() => {\n signal.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n const onAbort = () => {\n clearTimeout(timer);\n resolve();\n };\n signal.addEventListener('abort', onAbort, { once: true });\n });\n}\n/**\n * `getUpdates` long polling.\n *\n * The offset is the next update to fetch. It advances only after\n * `bot.receive` accepted an update, so a crash or a failed intake leaves the\n * update unacknowledged and Telegram redelivers it; the host's event dedupe\n * covers the frames already stored.\n */\nexport class TelegramPolling {\n bot;\n controller;\n running;\n offset = 0;\n constructor(bot) {\n this.bot = bot;\n }\n /** Register nothing; establish the offset and start the loop. */\n async start() {\n const { internal, config } = this.bot;\n try {\n const info = await internal.getWebhookInfo();\n if (info.url !== '') {\n this.bot.ctx.logger.warn('telegram: removing the existing webhook so polling can receive updates');\n await internal.setWebhook({ url: '' });\n }\n if (config.dropPendingUpdates) {\n const pending = await internal.getUpdates({\n offset: -1,\n limit: 1,\n timeout: 0,\n });\n const highest = pending.reduce((max, update) => Math.max(max, update.update_id), -1);\n this.offset = highest + 1;\n }\n }\n catch (error) {\n // `Bot.start` only stores a connect failure on `bot.error`, so log it here.\n this.bot.ctx.logger.error('telegram: long polling could not start: %s', error instanceof Error ? error.message : String(error));\n throw error;\n }\n this.controller = new AbortController();\n this.running = this.loop(this.controller.signal);\n this.bot.online();\n }\n /** Stop polling and wait for the loop to unwind. */\n async stop() {\n this.controller?.abort();\n this.controller = undefined;\n await this.running?.catch(() => undefined);\n this.running = undefined;\n }\n async loop(signal) {\n const { internal, config } = this.bot;\n let failures = 0;\n while (!signal.aborted) {\n try {\n const updates = await internal.getUpdates({\n offset: this.offset,\n limit: 100,\n timeout: Math.max(1, Math.ceil(config.polling.timeoutMs / 1_000)),\n allowed_updates: ALLOWED_UPDATES,\n }, signal);\n failures = 0;\n this.bot.online();\n await this.process(updates, signal);\n }\n catch (error) {\n if (signal.aborted)\n return;\n const classified = classifyTelegramError(error);\n this.bot.ctx.logger.warn('telegram: long polling failed: %s', classified.message);\n this.bot.status = Status.RECONNECT;\n // `retryTimes` is a fast-retry budget, not a give-up limit: after that\n // many consecutive failures the loop keeps retrying at the lazy\n // interval, and a rate-limit answer overrides both intervals.\n const base = failures < config.polling.retryTimes\n ? config.polling.retryIntervalMs\n : config.polling.retryLazyMs;\n await sleep(classified.retryAfterMs ?? base, signal);\n failures += 1;\n }\n }\n }\n async process(updates, signal) {\n let index = 0;\n while (index < updates.length) {\n const update = updates[index];\n const groupId = update.message?.media_group_id;\n if (groupId === undefined) {\n await this.publish(update);\n this.offset = update.update_id + 1;\n index += 1;\n continue;\n }\n const entries = [];\n while (index < updates.length) {\n const candidate = updates[index];\n const message = candidate.message;\n if (message === undefined || message.media_group_id !== groupId)\n break;\n entries.push({ updateId: candidate.update_id, message });\n index += 1;\n }\n // One album arrives as several updates in a burst; wait out the window so\n // the parts are published as one message, then confirm them together.\n await sleep(this.bot.config.polling.mediaGroupWindowMs, signal);\n if (signal.aborted)\n return;\n entries.sort((a, b) => a.message.message_id - b.message.message_id);\n const inbound = decodeMessage(this.bot, entries.map((entry) => entry.message));\n await this.bot.receive(this.bot.session({\n type: 'message',\n id: inbound.id,\n timestamp: inbound.time,\n message: inbound,\n }));\n this.offset = Math.max(this.offset, ...entries.map((entry) => entry.updateId + 1));\n }\n }\n async publish(update) {\n const session = decodeUpdate(this.bot, update);\n if (session !== undefined)\n await this.bot.receive(session);\n }\n}\n//# sourceMappingURL=polling.js.map","import { PlatformError, } from '@deepseek-ai/cordis-plugin-im-core';\nimport { classifyTelegramError, isNotModified } from \"./errors.js\";\n/** Telegram method for one single-media payload. */\nfunction sendMethod(kind) {\n switch (kind) {\n case 'photo':\n return 'sendPhoto';\n case 'video':\n return 'sendVideo';\n case 'audio':\n return 'sendAudio';\n case 'animation':\n return 'sendAnimation';\n default:\n return 'sendDocument';\n }\n}\n/** Multipart field name of one media kind. */\nfunction mediaField(kind) {\n switch (kind) {\n case 'photo':\n return 'photo';\n case 'video':\n return 'video';\n case 'audio':\n return 'audio';\n case 'animation':\n return 'animation';\n default:\n return 'document';\n }\n}\n/** The inline keyboard a payload carries, if any. */\nfunction markupOf(payload) {\n return payload.buttons === undefined\n ? undefined\n : { inline_keyboard: payload.buttons };\n}\n/** Put the fields every send request shares into a multipart form. */\nfunction appendCommon(form, payload, threadId) {\n form.set('chat_id', payload.chatId);\n if (threadId !== undefined)\n form.set('message_thread_id', String(threadId));\n if (payload.replyTo !== undefined) {\n form.set('reply_parameters', JSON.stringify({\n message_id: payload.replyTo,\n allow_sending_without_reply: true,\n }));\n }\n if (payload.caption !== undefined && payload.caption !== '') {\n form.set('caption', payload.caption);\n if (payload.parseMode !== undefined)\n form.set('parse_mode', payload.parseMode);\n }\n const markup = markupOf(payload);\n if (markup !== undefined)\n form.set('reply_markup', JSON.stringify(markup));\n}\n/** Wrap staged bytes in a named blob for multipart upload. */\nfunction blobOf(staged) {\n return new Blob([staged.data], staged.mime === undefined ? {} : { type: staged.mime });\n}\n/**\n * The published part of one sent message.\n *\n * @param message - the Telegram message the send answered with.\n * @param mediaKeys - staged media keys the request carried, when it carried media.\n * @returns the part, with the media keys recorded in `raw` for a later edit check.\n */\nfunction partOf(message, mediaKeys) {\n const id = message.message_id;\n // The request already reached the platform, so an answer without an id is a published outcome, not a refusal.\n if (id === undefined)\n throw new PlatformError('invalid', 'telegram: the Bot API answered without a message id', { published: 'unknown' });\n return {\n id: String(id),\n kind: 'message',\n time: message.date === undefined ? Date.now() : message.date * 1000,\n ...(message.message_thread_id === undefined\n ? {}\n : { thread: { id: String(message.message_thread_id) } }),\n ...(mediaKeys === undefined ? {} : { raw: { mediaKeys } }),\n };\n}\n/** Media keys recorded in `SentPart.raw` by {@link partOf}, absent on a handle rebuilt after a restart. */\nfunction recordedMediaKeys(part) {\n const raw = part.raw;\n if (typeof raw !== 'object' || raw === null || !('mediaKeys' in raw))\n return undefined;\n const keys = raw.mediaKeys;\n return Array.isArray(keys) ? keys : undefined;\n}\n/** Whether an edit still targets the media the part was published with. */\nfunction sameMediaKeys(a, b) {\n return a.length === b.length && a.every((key, index) => key === b[index]);\n}\n/** Look one staged media item up, failing before any request when it expired. */\nfunction stagedOf(deps, key) {\n const staged = deps.staging.get(key);\n if (staged === undefined) {\n throw new PlatformError('invalid', 'telegram: the staged media bytes expired before send; nothing was published', {\n published: 'no',\n });\n }\n return staged;\n}\n/** Thread id carried by an adapter referrer, when the target asks to follow it. */\nfunction referrerThread(referrer) {\n if (typeof referrer !== 'object' ||\n referrer === null ||\n !('threadId' in referrer))\n return undefined;\n const value = referrer.threadId;\n return typeof value === 'string' && /^\\d+$/.test(value)\n ? Number(value)\n : undefined;\n}\n/**\n * Send one serialized payload.\n *\n * @param deps - adapter services.\n * @param payload - the serialized draft.\n * @param target - the chat (and thread) the payload goes to.\n * @param ctx - core send context (signal, part index).\n * @returns the published part.\n */\nexport async function sendPayload(deps, payload, target, ctx) {\n const signal = ctx.options.signal;\n const markup = markupOf(payload);\n const threadId = payload.threadId ??\n (target.thread === true ? referrerThread(target.referrer) : undefined);\n if (payload.kind === 'text') {\n const linkPreview = deps.config.linkPreview\n ? {}\n : { link_preview_options: { is_disabled: true } };\n const message = await deps.internal.sendMessage({\n chat_id: payload.chatId,\n text: payload.text ?? '',\n ...(payload.parseMode === undefined\n ? {}\n : { parse_mode: payload.parseMode }),\n ...(threadId === undefined ? {} : { message_thread_id: threadId }),\n ...(payload.replyTo === undefined\n ? {}\n : {\n reply_parameters: {\n message_id: payload.replyTo,\n allow_sending_without_reply: true,\n },\n }),\n ...(markup === undefined ? {} : { reply_markup: markup }),\n ...linkPreview,\n }, signal);\n return partOf(message);\n }\n const items = payload.media ?? [];\n const first = items[0];\n if (first === undefined)\n throw new PlatformError('invalid', 'telegram: media payload without media', { published: 'no' });\n if (payload.kind === 'album') {\n const form = new FormData();\n const media = items.map((item, index) => {\n form.append(`file${index}`, blobOf(stagedOf(deps, item.key)), item.name || `file${index}`);\n return {\n type: item.kind,\n media: `attach://file${index}`,\n ...(index !== 0 ||\n payload.caption === undefined ||\n payload.caption === ''\n ? {}\n : {\n caption: payload.caption,\n ...(payload.parseMode === undefined\n ? {}\n : { parse_mode: payload.parseMode }),\n }),\n };\n });\n // `sendMediaGroup` accepts no caption, parse_mode or reply_markup fields: the\n // caption rides the first media item.\n form.set('chat_id', payload.chatId);\n if (threadId !== undefined)\n form.set('message_thread_id', String(threadId));\n if (payload.replyTo !== undefined) {\n form.set('reply_parameters', JSON.stringify({\n message_id: payload.replyTo,\n allow_sending_without_reply: true,\n }));\n }\n form.set('media', JSON.stringify(media));\n const messages = await deps.sendMediaGroup(form, signal);\n const head = messages[0];\n if (head === undefined)\n throw new PlatformError('invalid', 'telegram: sendMediaGroup returned no messages');\n const part = partOf(head, items.map((item) => item.key));\n // `partOf` refused an answer without an id, so the head carries one.\n const headId = head.message_id;\n const aliases = messages\n .slice(1)\n .flatMap((message) => message.message_id === undefined ? [] : [String(message.message_id)]);\n // An album carries no keyboard, so a keyboard message answers its first item instead of being dropped.\n if (payload.buttons !== undefined && payload.buttons.length > 0) {\n let keyboard;\n try {\n keyboard = await deps.internal.sendMessage({\n chat_id: payload.chatId,\n // The caption already rides the first album item; the keyboard message carries no body of its own.\n text: '\\u2060',\n ...(payload.parseMode === undefined\n ? {}\n : { parse_mode: payload.parseMode }),\n ...(threadId === undefined ? {} : { message_thread_id: threadId }),\n reply_parameters: {\n message_id: headId,\n allow_sending_without_reply: true,\n },\n reply_markup: { inline_keyboard: payload.buttons },\n }, signal);\n }\n catch (error) {\n // The album is already on the platform, so the outcome is unknown even when Telegram refused the keyboard.\n const cause = classifyTelegramError(error);\n throw new PlatformError(cause.kind, cause.message, {\n ...(cause.code === undefined ? {} : { code: cause.code }),\n ...(cause.retryAfterMs === undefined\n ? {}\n : { retryAfterMs: cause.retryAfterMs }),\n published: 'unknown',\n cause,\n });\n }\n aliases.push(String(keyboard.message_id));\n }\n return aliases.length === 0 ? part : { ...part, aliases };\n }\n const form = new FormData();\n appendCommon(form, payload, threadId);\n form.append(mediaField(first.kind), blobOf(stagedOf(deps, first.key)), first.name || 'file');\n const message = await deps.sendMedia(sendMethod(first.kind), form, signal);\n return partOf(message, [first.key]);\n}\n/**\n * Edit one published message in place.\n *\n * Text messages use `editMessageText`; media messages edit their caption. An\n * edit cannot replace the media, and a caption edit without a caption or a\n * keyboard would publish nothing, so both are refused for the caller to\n * withdraw and resend.\n *\n * @param deps - adapter services.\n * @param part - the published part.\n * @param payload - the freshly serialized draft.\n * @param handle - the message handle (carries the target chat).\n * @param signal - cancellation.\n */\nexport async function editPayload(deps, part, payload, handle, signal) {\n const messageId = Number(part.id);\n if (!Number.isSafeInteger(messageId)) {\n throw new PlatformError('invalid', `telegram: \"${part.id}\" is not a Telegram message id`);\n }\n const markup = payload.buttons === undefined\n ? { inline_keyboard: [] }\n : { inline_keyboard: payload.buttons };\n try {\n if (payload.kind === 'text') {\n await deps.internal.editMessageText({\n chat_id: handle.target.chat.id,\n message_id: messageId,\n text: payload.text ?? '',\n ...(payload.parseMode === undefined\n ? {}\n : { parse_mode: payload.parseMode }),\n reply_markup: markup,\n ...(deps.config.linkPreview\n ? {}\n : { link_preview_options: { is_disabled: true } }),\n }, signal);\n return;\n }\n const caption = payload.caption ?? '';\n const recorded = recordedMediaKeys(part);\n if (recorded !== undefined) {\n const edited = (payload.media ?? []).map((item) => item.key);\n if (!sameMediaKeys(recorded, edited)) {\n throw new PlatformError('invalid', 'telegram: an edit cannot replace media; withdraw and resend the message instead', { published: 'no' });\n }\n }\n // Telegram has no empty-caption edit: an empty caption with no keyboard would silently do nothing.\n if (caption === '' &&\n (payload.buttons === undefined || payload.buttons.length === 0)) {\n throw new PlatformError('invalid', 'telegram: a media edit needs a caption or a keyboard; withdraw and resend the message instead', { published: 'no' });\n }\n await deps.internal.editMessageCaption({\n chat_id: handle.target.chat.id,\n message_id: messageId,\n caption,\n ...(payload.parseMode === undefined\n ? {}\n : { parse_mode: payload.parseMode }),\n reply_markup: markup,\n }, signal);\n }\n catch (error) {\n if (isNotModified(error))\n return;\n throw error;\n }\n}\n/**\n * Delete one published message.\n *\n * @param deps - adapter services.\n * @param part - the published part.\n * @param handle - the message handle (carries the target chat).\n */\nexport async function deletePart(deps, part, handle) {\n const messageId = Number(part.id);\n if (!Number.isSafeInteger(messageId)) {\n throw new PlatformError('invalid', `telegram: \"${part.id}\" is not a Telegram message id`);\n }\n await deps.internal.deleteMessage({\n chat_id: handle.target.chat.id,\n message_id: messageId,\n });\n}\n//# sourceMappingURL=send.js.map","import { createHmac, timingSafeEqual } from 'node:crypto';\n/**\n * Domain-separation label for the derived webhook secret token. Changing it\n * invalidates every already-configured webhook, so treat it as a wire constant.\n */\nexport const WEBHOOK_SECRET_LABEL = 'dsh-im-more/telegram/webhook/secret-token/v1';\n/**\n * Derive the `secret_token` Telegram echoes in\n * `X-Telegram-Bot-Api-Secret-Token`.\n *\n * The value is an HMAC of a fixed label keyed by the Bot API token: it is\n * stable for one bot, never exposes the token, and stays inside Telegram's\n * 1–256 character `A-Z a-z 0-9 _ -` alphabet because base64url uses that set.\n *\n * @param botToken - the Bot API token (`<bot_id>:<secret>`).\n * @returns a 43-character base64url secret token.\n */\nexport function deriveWebhookSecret(botToken) {\n return createHmac('sha256', botToken)\n .update(WEBHOOK_SECRET_LABEL)\n .digest('base64url');\n}\n/**\n * Compare a received secret-token header with the derived value in constant\n * time.\n *\n * @param expected - the derived secret token.\n * @param received - the header value, if the request carried one.\n * @returns whether the header matches.\n */\nexport function matchesWebhookSecret(expected, received) {\n if (received === undefined)\n return false;\n const expectedBytes = Buffer.from(expected);\n const receivedBytes = Buffer.from(received);\n return (expectedBytes.length === receivedBytes.length &&\n timingSafeEqual(expectedBytes, receivedBytes));\n}\n//# sourceMappingURL=secret.js.map","import { decodeUpdate } from \"./decode.js\";\nimport { ALLOWED_UPDATES } from \"./polling.js\";\nimport { deriveWebhookSecret, matchesWebhookSecret } from \"./secret.js\";\n/** Header Telegram echoes the configured secret token in. */\nconst SECRET_HEADER = 'x-telegram-bot-api-secret-token';\n/** Route path Telegram posts to: leading slash, no trailing slash. */\nfunction routePath(path) {\n const withSlash = path.startsWith('/') ? path : `/${path}`;\n return withSlash.length > 1 ? withSlash.replace(/\\/+$/, '') : withSlash;\n}\n/** One request's bounded body. */\nasync function readBody(request, limit) {\n const chunks = [];\n let size = 0;\n for await (const chunk of request) {\n const buffer = Buffer.isBuffer(chunk)\n ? chunk\n : Buffer.from(chunk);\n size += buffer.byteLength;\n if (size > limit)\n return undefined;\n chunks.push(buffer);\n }\n return Buffer.concat(chunks).toString('utf8');\n}\n/**\n * Webhook transport over the profile's `ctx.webServer`.\n *\n * The route is anonymous at the Web server layer and authenticated by\n * Telegram's secret-token header, whose value the adapter derives from the\n * Bot API token. `connect` registers the route and calls `setWebhook`, so a\n * profile without `webServer` fails with an actionable message instead of\n * silently receiving nothing.\n */\nexport class TelegramWebhook {\n bot;\n dispose;\n constructor(bot) {\n this.bot = bot;\n }\n /** Register the route and point Telegram at it. */\n async start() {\n const webServer = this.bot.ctx.get('webServer');\n if (webServer === undefined) {\n throw this.failStart('telegram: the webhook transport needs a profile-provided webServer; use transport \"polling\" instead');\n }\n const publicUrl = this.bot.config.webhook.publicUrl;\n if (publicUrl === undefined || publicUrl === null || publicUrl === '') {\n throw this.failStart('telegram: webhook.publicUrl is required for the webhook transport');\n }\n const url = new URL(publicUrl);\n if (url.protocol !== 'https:') {\n throw this.failStart('telegram: webhook.publicUrl must be an https URL (Telegram refuses plain HTTP webhooks)');\n }\n const path = routePath(this.bot.config.webhook.path);\n this.dispose = webServer.register({\n kind: 'exact',\n path,\n auth: 'anonymous',\n handler: (request, response) => this.handle(request, response),\n });\n try {\n await this.bot.internal.setWebhook({\n url: `${publicUrl.replace(/\\/+$/, '')}${path}`,\n secret_token: deriveWebhookSecret(this.bot.config.token),\n drop_pending_updates: this.bot.config.dropPendingUpdates,\n allowed_updates: [...ALLOWED_UPDATES],\n });\n }\n catch (error) {\n this.dispose();\n this.dispose = undefined;\n this.bot.ctx.logger.error('telegram: setWebhook failed: %s', error instanceof Error ? error.message : String(error));\n throw error;\n }\n this.bot.online();\n }\n /** Release the route. The webhook itself stays registered so Telegram keeps retrying. */\n async stop() {\n this.dispose?.();\n this.dispose = undefined;\n }\n /**\n * Log a fatal start failure before the caller throws it, because `Bot.start`\n * only stores a connect failure on `bot.error`.\n *\n * @param message - error text that also names the corrective action.\n * @returns the error for the caller to throw.\n */\n failStart(message) {\n this.bot.ctx.logger.error(message);\n return new Error(message);\n }\n async handle(request, response) {\n try {\n if (request.method !== 'POST') {\n response.writeHead(405, { allow: 'POST' });\n response.end();\n return;\n }\n const expected = deriveWebhookSecret(this.bot.config.token);\n const received = request.headers[SECRET_HEADER];\n if (!matchesWebhookSecret(expected, typeof received === 'string' ? received : undefined)) {\n response.writeHead(401);\n response.end();\n return;\n }\n const body = await readBody(request, this.bot.config.webhook.maxBodyBytes);\n if (body === undefined) {\n response.writeHead(413);\n response.end();\n return;\n }\n const update = JSON.parse(body);\n const session = decodeUpdate(this.bot, update);\n if (session !== undefined)\n await this.bot.receive(session);\n response.writeHead(200, { 'content-type': 'text/plain' });\n response.end('OK');\n }\n catch (error) {\n this.bot.ctx.logger.warn('telegram: webhook delivery failed: %s', error instanceof Error ? error.message : String(error));\n if (!response.headersSent)\n response.writeHead(500);\n response.end();\n }\n }\n}\n//# sourceMappingURL=webhook.js.map","import { Adapter, createEditDriver, } from '@deepseek-ai/cordis-plugin-im-core';\nimport { readFile } from 'node:fs/promises';\nimport { extname } from 'node:path';\nimport { Config } from \"./config.js\";\nimport { classifyTelegramError } from \"./errors.js\";\nimport { botIdFromToken, verifyIdentity } from \"./identity.js\";\nimport { MediaStaging } from \"./media.js\";\nimport { createTelegramRequest, downloadFile, sendMedia, sendMediaGroup, } from \"./request.js\";\n// The declaration files register their typed methods on `Internal` at import time.\nimport { createHtmlMode } from \"./modes/html.js\";\nimport { createPlainMode } from \"./modes/plain.js\";\nimport { TelegramPolling } from \"./polling.js\";\nimport { deletePart, editPayload, sendPayload, } from \"./send.js\";\nimport \"./types/index.js\";\nimport { Internal } from \"./types/internal.js\";\nimport { TelegramWebhook } from \"./webhook.js\";\n/** File extension of a MIME type, for the multipart part name. */\nfunction extensionOf(mime) {\n switch (mime) {\n case 'image/png':\n return '.png';\n case 'image/jpeg':\n return '.jpg';\n case 'image/webp':\n return '.webp';\n case 'image/gif':\n return '.gif';\n case 'video/mp4':\n return '.mp4';\n case 'video/webm':\n return '.webm';\n case 'audio/mpeg':\n return '.mp3';\n case 'audio/ogg':\n return '.ogg';\n case 'application/pdf':\n return '.pdf';\n default:\n return '';\n }\n}\n/** MIME type by file extension for `files.local` reads; unknown extensions are binary. */\nconst LOCAL_MIME_TYPES = {\n '.gif': 'image/gif',\n '.jpeg': 'image/jpeg',\n '.jpg': 'image/jpeg',\n '.json': 'application/json',\n '.m4a': 'audio/mp4',\n '.mp3': 'audio/mpeg',\n '.mp4': 'video/mp4',\n '.oga': 'audio/ogg',\n '.ogg': 'audio/ogg',\n '.pdf': 'application/pdf',\n '.png': 'image/png',\n '.txt': 'text/plain',\n '.wav': 'audio/wav',\n '.webm': 'video/webm',\n '.webp': 'image/webp',\n};\n/** Content type of a locally stored Bot API file. */\nfunction localMimeType(filePath) {\n return (LOCAL_MIME_TYPES[extname(filePath).toLowerCase()] ??\n 'application/octet-stream');\n}\n/** Whether a filesystem failure means the file does not exist. */\nfunction isMissingFile(error) {\n return (error instanceof Error && error.code === 'ENOENT');\n}\n/**\n * Telegram Bot API adapter.\n *\n * Identity comes from `getMe`; polling and webhook are the two transports;\n * `html` and `plain` are the two modes; outbound media is staged in memory and\n * sent as multipart, because Telegram has no standalone upload endpoint.\n */\nexport class TelegramBot extends Adapter {\n /** The adapter needs the Satori service and the isolated `http` service (official adapters declare `http` with `@Inject('http')`). */\n static inject = ['satori', 'http'];\n /** The Loader applies this schema to a profile row's `config` before the constructor runs. */\n static Config = Config;\n modes = {\n html: createHtmlMode(),\n plain: createPlainMode(),\n };\n modeOrder = ['html', 'plain'];\n /** Endpoints shared by the Bot API client and file downloads. */\n request;\n /** Full typed Bot API surface registered by the vendored type declarations. */\n internal;\n /** Outbound media bytes between `prepare` and `sendPayload`. */\n staging;\n /** `@username` of the bot, once `getMe` answered. */\n username;\n transport;\n constructor(ctx, config) {\n super(ctx, config, {\n id: `telegram:${botIdFromToken(config.token)}`,\n platform: 'telegram',\n adapter: 'telegram',\n });\n this.request = createTelegramRequest(ctx, config.token, config.apiBaseUrl, config.files.baseUrl ?? config.apiBaseUrl);\n this.internal = new Internal(this.request);\n this.staging = new MediaStaging(config.media.stagingTtlMs, config.media.maxStagedBytes);\n this.defineInternalRoute('/files/:fileId', async ({ params }) => this.serveFile(params.fileId));\n }\n async connect() {\n try {\n const me = await this.internal.getMe();\n this.selfId = verifyIdentity(this.config.token, me);\n this.username = me.username;\n this.user = {\n id: this.selfId,\n name: me.username ?? me.first_name,\n isBot: true,\n };\n }\n catch (error) {\n // `Bot.start` only stores a connect failure on `bot.error`, so log it\n // here; transports log their own start failures at their start sites.\n this.ctx.logger.error('telegram: connect failed: %s', error instanceof Error ? error.message : String(error));\n throw error;\n }\n this.transport =\n this.config.transport === 'webhook'\n ? new TelegramWebhook(this)\n : new TelegramPolling(this);\n await this.transport.start();\n }\n async disconnect() {\n const transport = this.transport;\n this.transport = undefined;\n await transport?.stop();\n }\n async upload(ref, _scope, ctx) {\n const fetched = await ctx.fetch(ref.src, ctx.signal);\n const mime = ref.meta.mime ?? fetched.mime;\n const name = ref.meta.name ??\n fetched.name ??\n `telegram-${ref.kind}${extensionOf(mime)}`;\n return this.staging.stage({\n data: fetched.data,\n name,\n ...(mime === undefined ? {} : { mime }),\n });\n }\n resourceScope(_target, _kind) {\n return this.id;\n }\n async sendPayload(payload, target, ctx) {\n return await sendPayload(this.sendDeps(), payload, target, ctx);\n }\n async editPayload(part, payload, handle, signal) {\n await editPayload(this.sendDeps(), part, payload, handle, signal);\n }\n async deletePart(part, handle) {\n await deletePart(this.sendDeps(), part, handle);\n }\n streamDriver(_mode, _target) {\n return createEditDriver(this);\n }\n classify(error) {\n return classifyTelegramError(error);\n }\n /**\n * Resolve one `satori:` file route.\n *\n * `files.local` reads the Bot API server's host filesystem; otherwise the\n * file is downloaded from the configured file endpoint.\n */\n async serveFile(fileId) {\n if (this.config.files.local)\n return await this.serveLocalFile(fileId);\n try {\n const file = await this.internal.getFile({ file_id: fileId });\n if (file.file_path === undefined)\n return new Response(null, { status: 404 });\n const response = await downloadFile(this.request, file.file_path);\n const headers = new Headers();\n const mime = response.headers.get('content-type');\n if (mime !== null)\n headers.set('content-type', mime);\n return new Response(response.body, { status: response.status, headers });\n }\n catch (error) {\n this.ctx.logger.warn('telegram: file %s could not be served: %s', fileId, error instanceof Error ? error.message : String(error));\n return new Response(null, { status: 502 });\n }\n }\n /**\n * Serve one file from the local Bot API server's filesystem, where\n * `file_path` is an absolute host path instead of a URL segment.\n */\n async serveLocalFile(fileId) {\n try {\n const file = await this.internal.getFile({ file_id: fileId });\n if (file.file_path === undefined)\n return new Response(null, { status: 404 });\n const data = await readFile(file.file_path);\n return new Response(data, {\n status: 200,\n headers: { 'content-type': localMimeType(file.file_path) },\n });\n }\n catch (error) {\n if (isMissingFile(error))\n return new Response(null, { status: 404 });\n this.ctx.logger.warn('telegram: file %s could not be served: %s', fileId, error instanceof Error ? error.message : String(error));\n return new Response(null, { status: 502 });\n }\n }\n sendDeps() {\n return {\n internal: this.internal,\n config: this.config,\n staging: this.staging,\n sendMedia: (method, form, signal) => this.sendMediaForm(method, form, signal),\n sendMediaGroup: (form, signal) => this.sendMediaGroupForm(form, signal),\n };\n }\n /** Send one multipart media form; overridable so send tests never touch the network. */\n sendMediaForm(method, form, signal) {\n return sendMedia(this.request, method, form, signal);\n }\n /** Send one `sendMediaGroup` multipart form. */\n sendMediaGroupForm(form, signal) {\n return sendMediaGroup(this.request, form, signal);\n }\n}\nexport { Config };\nexport default TelegramBot;\n//# sourceMappingURL=bot.js.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAEA,IAAa,mBAAb,cAAsC,MAAM;CACxC;CACA;CACA;CACA;CACA;CACA,YAAY,SAAS,MAAM;EACvB,MAAM,SAAS,KAAK,UAAU,KAAA,IAAY,KAAA,IAAY,EAAE,OAAO,KAAK,MAAM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OAAO,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC;GAC7C,KAAK,IAAI,OAAO,KAAK,6CAA6C,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;GAChI,OAAO,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC;EAC7C;CACJ;CACA,WAAW;EACP,OAAO;GACH,UAAU,KAAK;GACf,QAAQ,KAAK;GACb,SAAS,KAAK;GACd,YAAY,QAAQ,MAAM,WAAW,KAAK,cAAc,QAAQ,MAAM,MAAM;GAC5E,iBAAiB,MAAM,WAAW,KAAK,mBAAmB,MAAM,MAAM;EAC1E;CACJ;;CAEA,cAAc,QAAQ,MAAM,QAAQ;EAChC,OAAO,UAAU,KAAK,SAAS,QAAQ,MAAM,MAAM;CACvD;;CAEA,mBAAmB,MAAM,QAAQ;EAC7B,OAAO,eAAe,KAAK,SAAS,MAAM,MAAM;CACpD;AACJ"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import { Adapter, type Mode, type PrepareContext, type ResolvedResource, type ResourceKind, type ResourceRef, type SendContext, type SentPart, type StreamDriver, type Target } from '@deepseek-ai/cordis-plugin-im-core';
|
|
3
|
+
import { Config } from './config.ts';
|
|
4
|
+
import { MediaStaging } from './media.ts';
|
|
5
|
+
import { type TelegramRequest } from './request.ts';
|
|
6
|
+
import type { TelegramModeTypes } from './modes/shared.ts';
|
|
7
|
+
import { deletePart, editPayload } from './send.ts';
|
|
8
|
+
import './types/index.ts';
|
|
9
|
+
import type { Message } from './types/index.ts';
|
|
10
|
+
import { Internal } from './types/internal.ts';
|
|
11
|
+
/** The two modes this adapter always registers. */
|
|
12
|
+
export interface TelegramModes {
|
|
13
|
+
[mode: string]: Mode<TelegramModeTypes>;
|
|
14
|
+
html: Mode<TelegramModeTypes>;
|
|
15
|
+
plain: Mode<TelegramModeTypes>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Telegram Bot API adapter.
|
|
19
|
+
*
|
|
20
|
+
* Identity comes from `getMe`; polling and webhook are the two transports;
|
|
21
|
+
* `html` and `plain` are the two modes; outbound media is staged in memory and
|
|
22
|
+
* sent as multipart, because Telegram has no standalone upload endpoint.
|
|
23
|
+
*/
|
|
24
|
+
export declare class TelegramBot extends Adapter<Config, TelegramModes> {
|
|
25
|
+
/** The adapter needs the Satori service and the isolated `http` service (official adapters declare `http` with `@Inject('http')`). */
|
|
26
|
+
static inject: string[];
|
|
27
|
+
/** The Loader applies this schema to a profile row's `config` before the constructor runs. */
|
|
28
|
+
static readonly Config: import("@deepseek-ai/schemastery").default<Config>;
|
|
29
|
+
readonly modes: TelegramModes;
|
|
30
|
+
readonly modeOrder: readonly ["html", "plain"];
|
|
31
|
+
/** Endpoints shared by the Bot API client and file downloads. */
|
|
32
|
+
readonly request: TelegramRequest;
|
|
33
|
+
/** Full typed Bot API surface registered by the vendored type declarations. */
|
|
34
|
+
readonly internal: Internal;
|
|
35
|
+
/** Outbound media bytes between `prepare` and `sendPayload`. */
|
|
36
|
+
readonly staging: MediaStaging;
|
|
37
|
+
/** `@username` of the bot, once `getMe` answered. */
|
|
38
|
+
username: string | undefined;
|
|
39
|
+
private transport;
|
|
40
|
+
constructor(ctx: Context, config: Config);
|
|
41
|
+
connect(): Promise<void>;
|
|
42
|
+
disconnect(): Promise<void>;
|
|
43
|
+
upload(ref: ResourceRef, _scope: string, ctx: PrepareContext): Promise<ResolvedResource>;
|
|
44
|
+
resourceScope(_target: Target, _kind: ResourceKind): string;
|
|
45
|
+
sendPayload(payload: unknown, target: Target, ctx: SendContext): Promise<SentPart>;
|
|
46
|
+
editPayload(part: SentPart, payload: unknown, handle: Parameters<typeof editPayload>[3], signal?: AbortSignal): Promise<void>;
|
|
47
|
+
deletePart(part: SentPart, handle: Parameters<typeof deletePart>[2]): Promise<void>;
|
|
48
|
+
streamDriver(_mode: string, _target: Target): StreamDriver | undefined;
|
|
49
|
+
classify(error: unknown): import("@deepseek-ai/cordis-plugin-im-core").PlatformError;
|
|
50
|
+
/**
|
|
51
|
+
* Resolve one `satori:` file route.
|
|
52
|
+
*
|
|
53
|
+
* `files.local` reads the Bot API server's host filesystem; otherwise the
|
|
54
|
+
* file is downloaded from the configured file endpoint.
|
|
55
|
+
*/
|
|
56
|
+
private serveFile;
|
|
57
|
+
/**
|
|
58
|
+
* Serve one file from the local Bot API server's filesystem, where
|
|
59
|
+
* `file_path` is an absolute host path instead of a URL segment.
|
|
60
|
+
*/
|
|
61
|
+
private serveLocalFile;
|
|
62
|
+
private sendDeps;
|
|
63
|
+
/** Send one multipart media form; overridable so send tests never touch the network. */
|
|
64
|
+
sendMediaForm(method: string, form: FormData, signal?: AbortSignal): Promise<Message>;
|
|
65
|
+
/** Send one `sendMediaGroup` multipart form. */
|
|
66
|
+
sendMediaGroupForm(form: FormData, signal?: AbortSignal): Promise<Message[]>;
|
|
67
|
+
}
|
|
68
|
+
export { Config };
|
|
69
|
+
export default TelegramBot;
|
|
70
|
+
//# sourceMappingURL=bot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../../src/bot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EACL,OAAO,EAEP,KAAK,IAAI,EACT,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,MAAM,EACZ,MAAM,oCAAoC,CAAA;AAG3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,cAAc,CAAA;AAIrB,OAAO,KAAK,EAAE,iBAAiB,EA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