@im-more/dsh-line 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.
Files changed (97) hide show
  1. package/LICENSE +21 -0
  2. package/cordis.patch.yml +12 -0
  3. package/lib/index.js +1701 -0
  4. package/lib/index.js.map +1 -0
  5. package/lib/types/bot.d.ts +55 -0
  6. package/lib/types/bot.d.ts.map +1 -0
  7. package/lib/types/bot.js +169 -0
  8. package/lib/types/bot.js.map +1 -0
  9. package/lib/types/config.d.ts +47 -0
  10. package/lib/types/config.d.ts.map +1 -0
  11. package/lib/types/config.js +77 -0
  12. package/lib/types/config.js.map +1 -0
  13. package/lib/types/decode.d.ts +60 -0
  14. package/lib/types/decode.d.ts.map +1 -0
  15. package/lib/types/decode.js +321 -0
  16. package/lib/types/decode.js.map +1 -0
  17. package/lib/types/errors.d.ts +47 -0
  18. package/lib/types/errors.d.ts.map +1 -0
  19. package/lib/types/errors.js +112 -0
  20. package/lib/types/errors.js.map +1 -0
  21. package/lib/types/identity.d.ts +17 -0
  22. package/lib/types/identity.d.ts.map +1 -0
  23. package/lib/types/identity.js +24 -0
  24. package/lib/types/identity.js.map +1 -0
  25. package/lib/types/index.d.ts +17 -0
  26. package/lib/types/index.d.ts.map +1 -0
  27. package/lib/types/index.js +16 -0
  28. package/lib/types/index.js.map +1 -0
  29. package/lib/types/media.d.ts +19 -0
  30. package/lib/types/media.d.ts.map +1 -0
  31. package/lib/types/media.js +55 -0
  32. package/lib/types/media.js.map +1 -0
  33. package/lib/types/modes/shared.d.ts +126 -0
  34. package/lib/types/modes/shared.d.ts.map +1 -0
  35. package/lib/types/modes/shared.js +316 -0
  36. package/lib/types/modes/shared.js.map +1 -0
  37. package/lib/types/modes/text.d.ts +13 -0
  38. package/lib/types/modes/text.d.ts.map +1 -0
  39. package/lib/types/modes/text.js +143 -0
  40. package/lib/types/modes/text.js.map +1 -0
  41. package/lib/types/request.d.ts +49 -0
  42. package/lib/types/request.d.ts.map +1 -0
  43. package/lib/types/request.js +162 -0
  44. package/lib/types/request.js.map +1 -0
  45. package/lib/types/send.d.ts +43 -0
  46. package/lib/types/send.d.ts.map +1 -0
  47. package/lib/types/send.js +74 -0
  48. package/lib/types/send.js.map +1 -0
  49. package/lib/types/signature.d.ts +19 -0
  50. package/lib/types/signature.d.ts.map +1 -0
  51. package/lib/types/signature.js +30 -0
  52. package/lib/types/signature.js.map +1 -0
  53. package/lib/types/transport/media.d.ts +62 -0
  54. package/lib/types/transport/media.d.ts.map +1 -0
  55. package/lib/types/transport/media.js +104 -0
  56. package/lib/types/transport/media.js.map +1 -0
  57. package/lib/types/transport/webhook.d.ts +62 -0
  58. package/lib/types/transport/webhook.d.ts.map +1 -0
  59. package/lib/types/transport/webhook.js +208 -0
  60. package/lib/types/transport/webhook.js.map +1 -0
  61. package/lib/types/types/definition.d.ts +1006 -0
  62. package/lib/types/types/definition.d.ts.map +1 -0
  63. package/lib/types/types/definition.js +2 -0
  64. package/lib/types/types/definition.js.map +1 -0
  65. package/lib/types/types/index.d.ts +542 -0
  66. package/lib/types/types/index.d.ts.map +1 -0
  67. package/lib/types/types/index.js +4 -0
  68. package/lib/types/types/index.js.map +1 -0
  69. package/lib/types/types/internal.d.ts +8 -0
  70. package/lib/types/types/internal.d.ts.map +1 -0
  71. package/lib/types/types/internal.js +234 -0
  72. package/lib/types/types/internal.js.map +1 -0
  73. package/lib/types/types/request.d.ts +341 -0
  74. package/lib/types/types/request.d.ts.map +1 -0
  75. package/lib/types/types/request.js +2 -0
  76. package/lib/types/types/request.js.map +1 -0
  77. package/package.json +61 -3
  78. package/src/bot.ts +229 -0
  79. package/src/config.ts +113 -0
  80. package/src/decode.ts +418 -0
  81. package/src/errors.ts +138 -0
  82. package/src/identity.ts +28 -0
  83. package/src/index.ts +60 -0
  84. package/src/media.ts +66 -0
  85. package/src/modes/shared.ts +408 -0
  86. package/src/modes/text.ts +177 -0
  87. package/src/request.ts +215 -0
  88. package/src/send.ts +104 -0
  89. package/src/signature.ts +32 -0
  90. package/src/transport/media.ts +117 -0
  91. package/src/transport/webhook.ts +266 -0
  92. package/src/types/.eslintrc.yml +2 -0
  93. package/src/types/definition.ts +1008 -0
  94. package/src/types/index.ts +593 -0
  95. package/src/types/internal.ts +233 -0
  96. package/src/types/request.ts +341 -0
  97. package/README.md +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["messageOf","messageOf","quoteTokenOf","messageOf","messageOf"],"sources":["types/errors.js","types/request.js","types/types/internal.js","types/types/index.js","types/config.js","types/identity.js","types/media.js","types/decode.js","types/modes/shared.js","types/modes/text.js","types/send.js","types/transport/media.js","types/signature.js","types/transport/webhook.js","types/bot.js"],"sourcesContent":["import { PlatformError } from '@deepseek-ai/cordis-plugin-im-core';\n/**\n * One failed LINE Messaging API call.\n *\n * LINE answers a refusal in one of two JSON envelopes — `{ message, details[] }` for a business refusal and\n * `{ error, error_description }` for a token or request-format refusal — or with a page no proxy should produce.\n */\nexport class LineApiError extends Error {\n status;\n platformMessage;\n error;\n details;\n bodyText;\n nonJson;\n constructor(message, init = {}) {\n super(message, init.cause === undefined ? undefined : { cause: init.cause });\n this.name = 'LineApiError';\n this.status = init.status;\n this.platformMessage = init.platformMessage;\n this.error = init.error;\n this.details = init.details ?? [];\n this.bodyText = init.bodyText;\n this.nonJson = init.nonJson ?? false;\n }\n}\n/** Whether a caught value is an abort error, including the `DOMException` a signal produces. */\nfunction isAbortError(error) {\n return ((error instanceof Error || error instanceof DOMException) &&\n error.name === 'AbortError');\n}\n/**\n * Map any failure onto the core platform taxonomy.\n *\n * A LINE refusal is a request-level answer: the platform rejects the whole request or sends all of it, so every 4xx\n * means nothing was published. Transport failures, answers whose body is not JSON and 5xx leave the outcome unknown.\n *\n * @param error - the caught failure.\n * @returns the classified platform error.\n */\nexport function classifyLineError(error) {\n if (error instanceof PlatformError)\n return error;\n if (error instanceof LineApiError) {\n const status = error.status;\n const init = {\n ...(status === undefined ? {} : { code: status }),\n cause: error,\n };\n // The answer body was not the platform's JSON envelope (a proxy page, a cut-off answer): the status alone cannot\n // say whether the request was rejected or half-processed.\n if (status === undefined || error.nonJson) {\n return new PlatformError('retryable', error.message, {\n ...init,\n published: 'unknown',\n });\n }\n if (status === 429) {\n return new PlatformError('rate-limit', error.message, {\n ...init,\n published: 'no',\n });\n }\n if (status === 401 || status === 403) {\n return new PlatformError('permission', error.message, {\n ...init,\n published: 'no',\n });\n }\n if (status === 404 || status === 410) {\n return new PlatformError('not-found', error.message, {\n ...init,\n published: 'no',\n });\n }\n if (status === 409) {\n // Only a request carrying `X-Line-Retry-Key` answers 409, and it means the key was already accepted: the\n // message may have been sent.\n return new PlatformError('fatal', error.message, {\n ...init,\n published: 'unknown',\n });\n }\n if (status === 413) {\n return new PlatformError('limit', error.message, {\n ...init,\n published: 'no',\n });\n }\n if (status >= 500) {\n return new PlatformError('retryable', error.message, {\n ...init,\n published: 'unknown',\n });\n }\n return new PlatformError('invalid', error.message, {\n ...init,\n published: 'no',\n });\n }\n if (isAbortError(error)) {\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', `line: request failed: ${message}`, {\n published: 'unknown',\n cause: error,\n });\n}\n//# sourceMappingURL=errors.js.map","/**\n * The transport every LINE REST call shares: API root, bearer authentication, JSON unwrapping, the failure\n * `errors.ts` classifies, and content download.\n *\n * The typed method surface lives on `Internal`; the generated route table calls {@link invoke}, so the migrated layer\n * and the hand-written calls (identity, push, members, content download) cannot diverge in authentication or failure\n * handling.\n */\nimport { LineApiError } from \"./errors.js\";\n/** Root of the messaging API: every method except content download and the two audience uploads. */\nexport const LINE_API_ORIGIN = 'https://api.line.me';\n/** Root of the content API, which serves the bytes of an inbound message. */\nexport const LINE_DATA_ORIGIN = 'https://api-data.line.me';\n/** How much of a body that carried no JSON is kept in the error and the log; enough to recognise a gateway page. */\nconst BODY_PREFIX_BYTES = 512;\n/** Message of any caught value, for a log line. */\nfunction messageOf(error) {\n return error instanceof Error ? error.message : String(error);\n}\n/** Whether a failed `ctx.http` call was the caller's cancellation rather than a transport failure. */\nfunction isCancellation(cause, signal) {\n if (signal?.aborted === true)\n return true;\n if ((cause instanceof Error || cause instanceof DOMException) &&\n cause.name === 'AbortError') {\n return true;\n }\n return signal?.reason !== undefined && cause === signal.reason;\n}\n/** A cancelled request rejects with the signal's reason, so the classifier sees the cancellation itself. */\nfunction cancellation(cause, signal) {\n return signal?.aborted === true ? signal.reason : cause;\n}\n/** One JSON object, when the value is a plain object. */\nfunction asRecord(value) {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? value\n : undefined;\n}\n/** The `details` array of a business refusal, keeping only the fields a log or a caller can name. */\nfunction detailsOf(value) {\n if (!Array.isArray(value))\n return [];\n const out = [];\n for (const item of value) {\n const record = asRecord(item);\n if (record === undefined)\n continue;\n out.push({\n ...(typeof record.property === 'string'\n ? { property: record.property }\n : {}),\n ...(typeof record.message === 'string'\n ? { message: record.message }\n : {}),\n });\n }\n return out;\n}\n/** The field names a business refusal names, for the error message. */\nfunction propertiesOf(details) {\n const names = details\n .map((detail) => detail.property)\n .filter((name) => name !== undefined && name !== '');\n return names.length === 0 ? '' : ` (${names.join(', ')})`;\n}\n/**\n * Call one messaging API endpoint.\n *\n * @param request - the adapter whose credentials and context the call uses.\n * @param method - HTTP method.\n * @param path - endpoint path under {@link LINE_API_ORIGIN}.\n * @param config - body, query parameters and cancellation of the call.\n * @returns the unwrapped JSON answer.\n * @throws LineApiError when the platform refused the call or did not answer with JSON.\n */\nexport async function invoke(request, method, path, config = {}) {\n let response;\n try {\n response = await request.ctx.http(`${LINE_API_ORIGIN}${path}`, {\n method,\n headers: { authorization: `Bearer ${request.config.token}` },\n ...(config.data === undefined ? {} : { data: config.data }),\n ...(config.params === undefined ? {} : { params: config.params }),\n ...(config.signal === undefined ? {} : { signal: config.signal }),\n });\n }\n catch (cause) {\n if (isCancellation(cause, config.signal)) {\n throw cancellation(cause, config.signal);\n }\n throw new LineApiError(`line: ${method} ${path} request failed: ${messageOf(cause)}`, { cause });\n }\n let text;\n try {\n text = await response.text();\n }\n catch (cause) {\n // Reading the body fails when the caller cancelled mid-answer; that is still a cancellation.\n if (isCancellation(cause, config.signal)) {\n throw cancellation(cause, config.signal);\n }\n throw new LineApiError(`line: ${method} ${path} answered ${response.status} but its body could not be read`, { status: response.status, cause });\n }\n let body;\n let nonJson = false;\n if (text !== '') {\n try {\n body = JSON.parse(text);\n }\n catch {\n nonJson = true;\n }\n }\n const record = asRecord(body);\n const platformMessage = typeof record?.message === 'string'\n ? record.message\n : typeof record?.error_description === 'string'\n ? record.error_description\n : undefined;\n const error = typeof record?.error === 'string' ? record.error : undefined;\n const details = detailsOf(record?.details);\n if (response.status < 200 || response.status >= 300 || nonJson) {\n const suffix = (platformMessage === undefined ? '' : `: ${platformMessage}`) +\n propertiesOf(details);\n throw new LineApiError(`line: ${method} ${path} answered ${response.status}${suffix}`, {\n status: response.status,\n ...(platformMessage === undefined ? {} : { platformMessage }),\n ...(error === undefined ? {} : { error }),\n ...(details.length === 0 ? {} : { details }),\n ...(text === '' ? {} : { bodyText: text.slice(0, BODY_PREFIX_BYTES) }),\n nonJson,\n });\n }\n return body;\n}\n/**\n * Download the bytes of one inbound message from the content API.\n *\n * The answer is returned as it arrived, whatever its status: the caller maps `200`/`202`/`404`/`410` to the inbound\n * media contract. A request that never got an answer rejects.\n *\n * @param request - the adapter whose credentials and context the download uses.\n * @param messageId - platform message id the bytes belong to.\n * @param signal - cancellation.\n * @returns the content API answer.\n */\nexport async function downloadContent(request, messageId, signal) {\n try {\n const response = await request.ctx.http(`${LINE_DATA_ORIGIN}/v2/bot/message/${encodeURIComponent(messageId)}/content`, {\n headers: { authorization: `Bearer ${request.config.token}` },\n ...(signal === undefined ? {} : { signal }),\n });\n return response;\n }\n catch (cause) {\n if (isCancellation(cause, signal))\n throw cancellation(cause, signal);\n throw cause;\n }\n}\n//# sourceMappingURL=request.js.map","import { invoke, } from \"../request.js\";\nexport class Internal {\n request;\n constructor(request) {\n this.request = request;\n }\n static define(routes) {\n // One method per generated route; the prototype is the method table the declarations augment.\n const methods = Internal.prototype;\n for (const path in routes) {\n for (const key in routes[path]) {\n const method = key;\n const group = routes[path][method];\n if (group === undefined)\n continue;\n const names = Array.isArray(group) ? group : [group];\n for (const name of names) {\n methods[name] = async function (...args) {\n const raw = args.join(', ');\n const url = path.replace(/\\{([^}]+)\\}/g, () => {\n if (!args.length)\n throw new Error(`too few arguments for ${path}, received ${raw}`);\n return args.shift();\n });\n const config = {};\n if (args.length === 1) {\n if (method === 'GET' || method === 'DELETE') {\n config.params = args[0];\n }\n else {\n config.data = args[0];\n }\n }\n else if (args.length === 2 && method !== 'GET' && method !== 'DELETE') {\n config.data = args[0];\n config.params = args[1];\n }\n else if (args.length > 1) {\n throw new Error(`too many arguments for ${path}, received ${raw}`);\n }\n return await invoke(this.request, method, url, config);\n };\n }\n }\n }\n }\n}\nInternal.define({\n '/v2/bot/channel/webhook/endpoint': {\n GET: 'getWebhookEndpoint',\n PUT: 'setWebhookEndpoint',\n },\n '/v2/bot/channel/webhook/test': {\n POST: 'testWebhookEndpoint',\n },\n '/v2/bot/message/{messageId}/content': {\n GET: 'getMessageContent',\n },\n '/v2/bot/message/{messageId}/content/preview': {\n GET: 'getMessageContentPreview',\n },\n '/v2/bot/message/{messageId}/content/transcoding': {\n GET: 'getMessageContentTranscodingByMessageId',\n },\n '/v2/bot/message/reply': {\n POST: 'replyMessage',\n },\n '/v2/bot/message/push': {\n POST: 'pushMessage',\n },\n '/v2/bot/message/multicast': {\n POST: 'multicast',\n },\n '/v2/bot/message/narrowcast': {\n POST: 'narrowcast',\n },\n '/v2/bot/message/progress/narrowcast': {\n GET: 'getNarrowcastProgress',\n },\n '/v2/bot/message/broadcast': {\n POST: 'broadcast',\n },\n '/v2/bot/message/quota': {\n GET: 'getMessageQuota',\n },\n '/v2/bot/message/quota/consumption': {\n GET: 'getMessageQuotaConsumption',\n },\n '/v2/bot/message/delivery/reply': {\n GET: 'getNumberOfSentReplyMessages',\n },\n '/v2/bot/message/delivery/push': {\n GET: 'getNumberOfSentPushMessages',\n },\n '/v2/bot/message/delivery/multicast': {\n GET: 'getNumberOfSentMulticastMessages',\n },\n '/v2/bot/message/delivery/broadcast': {\n GET: 'getNumberOfSentBroadcastMessages',\n },\n '/v2/bot/message/validate/reply': {\n POST: 'validateReply',\n },\n '/v2/bot/message/validate/push': {\n POST: 'validatePush',\n },\n '/v2/bot/message/validate/multicast': {\n POST: 'validateMulticast',\n },\n '/v2/bot/message/validate/narrowcast': {\n POST: 'validateNarrowcast',\n },\n '/v2/bot/message/validate/broadcast': {\n POST: 'validateBroadcast',\n },\n '/v2/bot/message/aggregation/info': {\n GET: 'getAggregationUnitUsage',\n },\n '/v2/bot/message/aggregation/list': {\n GET: 'getAggregationUnitNameList',\n },\n '/v2/bot/profile/{userId}': {\n GET: 'getProfile',\n },\n '/v2/bot/followers/ids': {\n GET: 'getFollowers',\n },\n '/v2/bot/info': {\n GET: 'getBotInfo',\n },\n '/v2/bot/group/{groupId}/member/{userId}': {\n GET: 'getGroupMemberProfile',\n },\n '/v2/bot/room/{roomId}/member/{userId}': {\n GET: 'getRoomMemberProfile',\n },\n '/v2/bot/group/{groupId}/members/ids': {\n GET: 'getGroupMembersIds',\n },\n '/v2/bot/room/{roomId}/members/ids': {\n GET: 'getRoomMembersIds',\n },\n '/v2/bot/group/{groupId}/leave': {\n POST: 'leaveGroup',\n },\n '/v2/bot/room/{roomId}/leave': {\n POST: 'leaveRoom',\n },\n '/v2/bot/group/{groupId}/summary': {\n GET: 'getGroupSummary',\n },\n '/v2/bot/group/{groupId}/members/count': {\n GET: 'getGroupMemberCount',\n },\n '/v2/bot/room/{roomId}/members/count': {\n GET: 'getRoomMemberCount',\n },\n '/v2/bot/richmenu': {\n POST: 'createRichMenu',\n },\n '/v2/bot/richmenu/validate': {\n POST: 'validateRichMenuObject',\n },\n '/v2/bot/richmenu/{richMenuId}/content': {\n GET: 'getRichMenuImage',\n POST: 'setRichMenuImage',\n },\n '/v2/bot/richmenu/{richMenuId}': {\n GET: 'getRichMenu',\n DELETE: 'deleteRichMenu',\n },\n '/v2/bot/richmenu/list': {\n GET: 'getRichMenuList',\n },\n '/v2/bot/user/all/richmenu/{richMenuId}': {\n POST: 'setDefaultRichMenu',\n },\n '/v2/bot/user/all/richmenu': {\n GET: 'getDefaultRichMenuId',\n DELETE: 'cancelDefaultRichMenu',\n },\n '/v2/bot/richmenu/alias': {\n POST: 'createRichMenuAlias',\n },\n '/v2/bot/richmenu/alias/{richMenuAliasId}': {\n GET: 'getRichMenuAlias',\n POST: 'updateRichMenuAlias',\n DELETE: 'deleteRichMenuAlias',\n },\n '/v2/bot/richmenu/alias/list': {\n GET: 'getRichMenuAliasList',\n },\n '/v2/bot/user/{userId}/richmenu': {\n GET: 'getRichMenuIdOfUser',\n DELETE: 'unlinkRichMenuIdFromUser',\n },\n '/v2/bot/user/{userId}/richmenu/{richMenuId}': {\n POST: 'linkRichMenuIdToUser',\n },\n '/v2/bot/richmenu/bulk/link': {\n POST: 'linkRichMenuIdToUsers',\n },\n '/v2/bot/richmenu/bulk/unlink': {\n POST: 'unlinkRichMenuIdFromUsers',\n },\n '/v2/bot/richmenu/batch': {\n POST: 'richMenuBatch',\n },\n '/v2/bot/richmenu/validate/batch': {\n POST: 'validateRichMenuBatchRequest',\n },\n '/v2/bot/richmenu/progress/batch': {\n GET: 'getRichMenuBatchProgress',\n },\n '/v2/bot/user/{userId}/linkToken': {\n POST: 'issueLinkToken',\n },\n '/v2/bot/message/markAsRead': {\n POST: 'markMessagesAsRead',\n },\n '/bot/pnp/push': {\n POST: 'pushMessagesByPhone',\n },\n '/bot/ad/multicast/phone': {\n POST: 'audienceMatch',\n },\n '/v2/bot/message/delivery/pnp': {\n GET: 'getPNPMessageStatistics',\n },\n '/v2/bot/message/delivery/ad_phone': {\n GET: 'getAdPhoneMessageStatistics',\n },\n});\n//# sourceMappingURL=internal.js.map","export * from './request';\nexport * from './internal';\nexport * from './definition';\n//# sourceMappingURL=index.js.map","import z from '@deepseek-ai/schemastery';\n/** Validated LINE adapter configuration. */\nexport const Config = z.object({\n token: z.string().role('secret').required(),\n secret: z.string().role('secret').required(),\n selfId: z.string().required(),\n publicUrl: z.string().role('url').required(),\n webhook: z\n .object({\n path: z.string().default('/line'),\n })\n .default({}),\n media: z\n .object({\n path: z.string().default('/line-media'),\n })\n .default({}),\n});\n/**\n * Normalize a route path: absolute, no trailing slash.\n *\n * @param path - a configured path.\n * @returns the pathname to register on the web server.\n */\nexport function routePath(path) {\n const withSlash = path.startsWith('/') ? path : `/${path}`;\n return withSlash.length > 1 ? withSlash.replace(/\\/+$/, '') : withSlash;\n}\n/**\n * The public base URL without its trailing slashes.\n *\n * @param publicUrl - the configured `publicUrl`.\n * @returns the base every public URL is prefixed with.\n */\nexport function publicBase(publicUrl) {\n return publicUrl.replace(/\\/+$/, '');\n}\n/**\n * The configuration the adapter cannot work from, as far as it can tell locally.\n *\n * LINE has only the webhook transport, so a profile without a public HTTPS base can neither receive an event nor let\n * LINE fetch outbound media. The check runs when the bot starts, not on the first callback.\n *\n * @param config - the validated configuration.\n * @returns the configuration error, or undefined when the configuration is usable.\n */\nexport function configError(config) {\n if (config.token === '') {\n return new Error('line: token is required (the channel access token of the Messaging API channel)');\n }\n if (config.secret === '') {\n return new Error('line: secret is required (the channel secret; it verifies every webhook)');\n }\n if (config.selfId === '') {\n return new Error('line: selfId is required (the bot\\'s own user id: \"U\" + 32 hex, read from the console Basic settings)');\n }\n if (config.publicUrl === '') {\n return new Error('line: publicUrl is required (LINE only delivers webhooks, and it fetches outbound media from this base)');\n }\n let origin;\n try {\n origin = new URL(config.publicUrl);\n }\n catch {\n return new Error(`line: publicUrl must be an absolute URL, got \"${config.publicUrl}\"`);\n }\n if (origin.protocol !== 'https:') {\n return new Error(`line: publicUrl must be an https URL, got \"${config.publicUrl}\" (LINE refuses a plain-HTTP webhook and fetches media over https)`);\n }\n const webhook = routePath(config.webhook.path);\n const media = routePath(config.media.path);\n if (webhook === media) {\n return new Error(`line: webhook.path and media.path must differ, both are \"${webhook}\"`);\n }\n return undefined;\n}\n//# sourceMappingURL=config.js.map","/** Failure to confirm the configured bot identity. */\nexport class LineIdentityError extends Error {\n constructor(message) {\n super(message);\n this.name = 'LineIdentityError';\n }\n}\n/**\n * Verify a `getBotInfo` answer against the configured `selfId`.\n *\n * `bot.id` is fixed at construction, so the channel must be identified from configuration; this call proves the\n * token belongs to that channel instead of discovering the id from it.\n *\n * @param selfId - the configured bot user id.\n * @param info - the `GET /v2/bot/info` answer.\n * @returns the platform user id, which is `selfId`.\n */\nexport function verifyIdentity(selfId, info) {\n if (info.userId !== selfId) {\n throw new LineIdentityError(`line: selfId is ${selfId} but getBotInfo returned ${info.userId}`);\n }\n return info.userId;\n}\n//# sourceMappingURL=identity.js.map","/**\n * Inbound media: the `satori:` route behind an image, video, audio or file element.\n *\n * LINE serves the bytes of a received message from its content API, with the channel's own credentials, and deletes\n * them after a while. The route therefore downloads on demand instead of baking a URL into the stored message.\n */\nimport { downloadContent } from \"./request.js\";\n/** Message of any caught value, for a log line. */\nfunction messageOf(error) {\n return error instanceof Error ? error.message : String(error);\n}\n/**\n * Serve the bytes of one inbound message.\n *\n * The content API answers `202` while a large video or audio is still being transcoded, `404` for an unknown id and\n * `410` for a message the user unsent; the host treats the first as \"not available yet\" and the second pair as \"gone\".\n *\n * @param bot - the receiving adapter.\n * @param messageId - platform message id of the media.\n * @returns the bytes, or the status the host reads as unavailable.\n */\nexport async function serveMessageContent(bot, messageId) {\n let response;\n try {\n response = await downloadContent(bot.request, messageId);\n }\n catch (error) {\n bot.ctx.logger.warn('line: media %s could not be downloaded: %s', messageId, messageOf(error));\n return new Response(null, { status: 502 });\n }\n switch (response.status) {\n case 200: {\n const headers = new Headers();\n const mime = response.headers.get('content-type');\n if (mime !== null)\n headers.set('content-type', mime);\n const cacheControl = response.headers.get('cache-control');\n if (cacheControl !== null)\n headers.set('cache-control', cacheControl);\n return new Response(response.body, { status: 200, headers });\n }\n case 202:\n // The transcoding is not finished; polling it would need a timer this adapter does not own.\n bot.ctx.logger.warn('line: media %s is still being transcoded', messageId);\n return new Response(null, { status: 503 });\n case 404:\n case 410:\n // `410` means the user unsent the message; both are \"these bytes no longer exist\".\n return new Response(null, { status: 404 });\n default:\n bot.ctx.logger.warn('line: media %s answered %s', messageId, String(response.status));\n return new Response(null, { status: 502 });\n }\n}\n//# sourceMappingURL=media.js.map","/**\n * Inbound decoding: one LINE webhook event becomes an intake `Session` (`message`), a button interaction, or an\n * unsent-message notification.\n *\n * LINE gives the content away exactly once — there is no API that reads a message back — so the webhook payload, its\n * UTF-16 indices included, is the only source of text, mentions, quotes and media.\n */\nimport { PlatformError } from '@deepseek-ai/cordis-plugin-im-core';\nimport { h, normalize } from '@deepseek-ai/satori-element';\n/** The `chat.id` of a source: `user:`, `group:` or `room:` plus the platform id. */\nexport function chatIdOf(source) {\n switch (source.type) {\n case 'user':\n return `user:${source.userId}`;\n case 'group':\n return `group:${source.groupId}`;\n case 'room':\n return `room:${source.roomId}`;\n }\n}\n/** The `ChatRef` of a source; a room is a group in the DSH vocabulary. */\nexport function chatRefOf(source) {\n const id = chatIdOf(source);\n return { id, type: source.type === 'user' ? 'direct' : 'group' };\n}\n/**\n * Split a `chat.id` back into the platform conversation.\n *\n * @param chatId - a `chat.id` this adapter wrote, or one a profile configured by hand.\n * @returns the conversation kind and its platform id.\n * @throws PlatformError `invalid` when the id carries no known prefix.\n */\nexport function parseChatId(chatId) {\n const index = chatId.indexOf(':');\n const kind = index === -1 ? '' : chatId.slice(0, index);\n if (kind !== 'user' && kind !== 'group' && kind !== 'room') {\n throw new PlatformError('invalid', `line: chat id \"${chatId}\" carries no user:/group:/room: prefix`, { published: 'no' });\n }\n return { kind, id: chatId.slice(index + 1) };\n}\n/**\n * The `pushMessage` recipient of a `chat.id`.\n *\n * @param chatId - a `chat.id` this adapter wrote.\n * @returns the `to` value of a push request.\n * @throws PlatformError `invalid` when the id carries no known prefix.\n */\nexport function chatTargetOf(chatId) {\n return parseChatId(chatId).id;\n}\n/** The sender of a source; LINE omits the user id of an unconverted user, which collapses to `anonymous`. */\nfunction senderOf(source) {\n const id = source.type === 'user' ? source.userId : (source.userId ?? 'anonymous');\n return { id };\n}\n/** A mention's visible name, without the leading `@` the payload carries. */\nfunction mentionName(slice) {\n return slice.startsWith('@') ? slice.slice(1) : slice;\n}\n/** One UTF-16 slice of a text message; LINE indices count UTF-16 code units. */\nfunction sliceOf(text, index, length) {\n return text.slice(index, index + length);\n}\n/** The element nodes of one text message, slicing the body at its emoji and mention spans. */\nfunction textNodes(message) {\n const text = message.text;\n const spans = [\n ...(message.emojis ?? []).map((emoji) => ({\n kind: 'emoji',\n index: emoji.index,\n length: emoji.length,\n emoji,\n })),\n ...(message.mention?.mentionees ?? []).map((mention) => ({\n kind: 'mention',\n index: mention.index,\n length: mention.length,\n mention,\n })),\n ]\n .filter((span) => span.index >= 0 &&\n span.length > 0 &&\n span.index + span.length <= text.length)\n .sort((a, b) => a.index - b.index);\n const nodes = [];\n let cursor = 0;\n for (const span of spans) {\n // A span the payload reports inside another one cannot be rendered without repeating text.\n if (span.index < cursor)\n continue;\n if (span.index > cursor)\n nodes.push(text.slice(cursor, span.index));\n if (span.kind === 'emoji') {\n nodes.push(h('emoji', { id: `e:${span.emoji.productId}:${span.emoji.emojiId}` }));\n }\n else if (span.mention.type === 'all') {\n nodes.push(h('at', { type: 'all' }));\n }\n else if (span.mention.userId === undefined) {\n // An `at[type=user]` needs the id it addresses; a mention of a user who did not agree to the terms of use names\n // only the visible text, which stays readable as plain text.\n nodes.push(sliceOf(text, span.index, span.length));\n }\n else {\n nodes.push(h('at', {\n type: 'user',\n id: span.mention.userId,\n name: mentionName(sliceOf(text, span.index, span.length)),\n }));\n }\n cursor = span.index + span.length;\n }\n if (cursor < text.length)\n nodes.push(text.slice(cursor));\n return nodes;\n}\n/** The source of an inbound media element: LINE's own content API, or the URL a third party provided. */\nfunction contentSource(bot, messageId, provider) {\n if (provider?.type === 'external')\n return provider.originalContentUrl;\n return bot.getInternalUrl(`/assets/${encodeURIComponent(messageId)}`);\n}\n/** The elements of one message of the seven platform types. */\nfunction messageNodes(bot, message) {\n switch (message.type) {\n case 'text':\n return textNodes(message);\n case 'image':\n return [\n h('img', {\n src: contentSource(bot, message.id, message.contentProvider),\n }),\n ];\n case 'video':\n return [\n h('video', {\n src: contentSource(bot, message.id, message.contentProvider),\n ...(message.duration === undefined\n ? {}\n : { duration: message.duration }),\n }),\n ];\n case 'audio':\n return [\n h('audio', {\n src: contentSource(bot, message.id, message.contentProvider),\n duration: message.duration,\n }),\n ];\n case 'file': {\n const size = Number(message.fileSize);\n return [\n h('file', {\n src: bot.getInternalUrl(`/assets/${encodeURIComponent(message.id)}`),\n name: message.fileName,\n ...(Number.isFinite(size) ? { size } : {}),\n }),\n ];\n }\n case 'location': {\n const lines = [\n message.title,\n message.address,\n `${message.latitude}, ${message.longitude}`,\n ].filter((line) => line !== '');\n return [h('p', lines.join('\\n'))];\n }\n case 'sticker':\n return [\n h('emoji', {\n id: `s:${message.packageId}:${message.stickerId}`,\n }),\n ];\n default:\n // A message type this snapshot does not know: the caller keeps the payload in a `<raw>` element.\n return [];\n }\n}\n/** Mention flags and mentioned users of one message. */\nfunction mentionsOf(bot, message) {\n if (message.type !== 'text')\n return { self: false, all: false, users: [] };\n const text = message.text;\n const mentionees = message.mention?.mentionees ?? [];\n const users = [];\n for (const mention of mentionees) {\n if (mention.type !== 'user' || mention.userId === undefined)\n continue;\n users.push({\n id: mention.userId,\n name: mentionName(sliceOf(text, mention.index, mention.length)),\n });\n }\n const all = mentionees.some((mention) => mention.type === 'all');\n // `isSelf` is the platform's own answer to \"was the bot mentioned\"; an older payload without it falls back to the id.\n const declaresSelf = mentionees.some((mention) => mention.isSelf !== undefined);\n const self = mentionees.some((mention) => mention.isSelf === true) ||\n (!declaresSelf &&\n mentionees.some((mention) => mention.type === 'user' && mention.userId === bot.selfId));\n return { self, all, users };\n}\n/** The quote token of a message, which only the four quotable types carry. */\nfunction quoteTokenOf(message) {\n switch (message.type) {\n case 'text':\n case 'image':\n case 'video':\n case 'sticker':\n return message.quoteToken;\n default:\n return undefined;\n }\n}\n/** The quote an inbound message answers, when the platform names it. */\nfunction quoteOf(message) {\n return message.type === 'text' && message.quotedMessageId !== undefined\n ? { id: message.quotedMessageId }\n : undefined;\n}\n/** Decode one message event into the normalized inbound message. */\nfunction decodeMessage(bot, event) {\n const source = event.source;\n const message = event.message;\n const referrer = {\n messageId: message.id,\n timestamp: event.timestamp,\n mode: event.mode,\n ...(quoteTokenOf(message) === undefined\n ? {}\n : { quoteToken: quoteTokenOf(message) }),\n ...(event.replyToken === undefined ? {} : { replyToken: event.replyToken }),\n };\n const nodes = messageNodes(bot, message);\n const content = normalize(nodes.length > 0\n ? nodes\n : [h('raw', { platform: 'line', type: 'message', data: message })]);\n const quote = quoteOf(message);\n return {\n id: message.id,\n chat: chatRefOf(source),\n sender: senderOf(source),\n content,\n ...(quote === undefined ? {} : { quote }),\n mentions: mentionsOf(bot, message),\n time: event.timestamp,\n referrer,\n raw: event,\n };\n}\n/** Decode the button context of a postback, which names no platform message of its own. */\nfunction decodePostback(bot, event) {\n const chat = chatRefOf(event.source);\n const referrer = {\n timestamp: event.timestamp,\n mode: event.mode,\n replyToken: event.replyToken,\n };\n const button = {\n id: event.postback.data,\n data: event.postback.data,\n referrer,\n time: event.timestamp,\n bot,\n user: senderOf(event.source),\n chat,\n };\n return bot.session({\n type: 'interaction/button',\n id: event.webhookEventId,\n timestamp: event.timestamp,\n button,\n raw: event,\n });\n}\n/**\n * Decode one webhook event.\n *\n * Events the DSH contract has no consumer for (follows, joins, member changes, beacons, edits, deliveries …) are\n * dropped with a debug line: the model has no `friend-*`/`guild-*` event to receive them.\n *\n * @param bot - the receiving adapter.\n * @param event - one event of the webhook body.\n * @returns the session to publish, or undefined for an ignored event.\n */\nexport function decodeEvent(bot, event) {\n if (event.mode === 'standby') {\n // The channel is handled by a human agent; the platform explicitly says not to send from a standby event.\n bot.ctx.logger.debug('line: skipping standby event %s', event.webhookEventId);\n return undefined;\n }\n if (event.deliveryContext?.isRedelivery === true) {\n // A redelivery is handled like any other event: skipping it would lose the event whose first delivery failed.\n bot.ctx.logger.debug('line: handling redelivered event %s', event.webhookEventId);\n }\n switch (event.type) {\n case 'message': {\n const message = decodeMessage(bot, event);\n return bot.session({\n type: 'message',\n id: message.id,\n timestamp: message.time,\n message,\n raw: event,\n });\n }\n case 'unsend':\n return bot.session({\n type: 'message-deleted',\n id: event.webhookEventId,\n timestamp: event.timestamp,\n deleted: { id: event.unsend.messageId, chat: chatRefOf(event.source) },\n raw: event,\n });\n case 'postback':\n return decodePostback(bot, event);\n default:\n bot.ctx.logger.debug('line: ignoring a %s event', event.type);\n return undefined;\n }\n}\n//# sourceMappingURL=decode.js.map","/**\n * Shared types and the draft machinery of the single `text` mode.\n *\n * A LINE message object is the only outbound representation the platform programs against, and one request carries at\n * most five of them. A draft is therefore one request: up to five message objects plus the quick reply items of the\n * last one, because the platform shows only the last message object's quick reply.\n */\nimport { isPhrasingContainer } from '@deepseek-ai/satori-element';\nimport { chatTargetOf } from \"../decode.js\";\n/** The platform's documented bounds. */\nexport const LINE_LIMITS = {\n /** One text message object: 5,000 UTF-16 code units. */\n text: 5_000,\n /** Message objects one push accepts. */\n messages: 5,\n /** Quick reply items one message accepts. */\n quickReplies: 13,\n /** Request body size (`413 Payload Too Large`). */\n payloadBytes: 2 * 1024 * 1024,\n};\n/**\n * The length allowance of one media key that is not the source itself.\n *\n * A non-HTTPS source is staged and the request carries `<publicUrl><media.path>/<token>` instead of it, so measuring the\n * source would refuse a `data:` URL of megabytes that actually spends a few dozen bytes of the request body.\n */\nconst STAGED_URL_ALLOWANCE = 'https://line-media.invalid/0000000000000000000000';\n/**\n * The text of a carrier message that exists only to show a quick reply.\n *\n * LINE has no message object without content, and a message of a zero-width word joiner renders as an empty bubble.\n */\nexport const QUICK_REPLY_CARRIER = '\\u2060';\n/** Report inline media that moves out of its text run into a message object of its own. */\nexport function reportMovedMedia(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: 'line-media-split',\n path: ctx.stableId(el),\n });\n }\n}\n/**\n * The latest paragraph, line or space boundary at or before `limit`.\n *\n * The whitespace that ends the boundary stays in the chunk, so concatenating the chunks reproduces the input.\n *\n * @param text - the text to cut.\n * @param limit - the maximum chunk length in UTF-16 code units.\n * @returns the cut index including the boundary whitespace, or -1 for none.\n */\nfunction boundaryCut(text, limit) {\n const window = text.slice(0, limit);\n const paragraph = window.lastIndexOf('\\n\\n');\n if (paragraph >= 0)\n return paragraph + 2;\n const line = window.lastIndexOf('\\n');\n if (line >= 0)\n return line + 1;\n const space = window.lastIndexOf(' ');\n if (space >= 0)\n return space + 1;\n return -1;\n}\n/** Move a cut left by one unit when it would fall inside a surrogate pair. */\nfunction avoidSplitPair(text, cut) {\n if (cut <= 0 || cut >= text.length)\n return cut;\n const before = text.charCodeAt(cut - 1);\n const after = text.charCodeAt(cut);\n const high = before >= 0xd800 && before <= 0xdbff;\n const low = after >= 0xdc00 && after <= 0xdfff;\n return high && low ? cut - 1 : cut;\n}\n/**\n * Cut text into chunks a text message object accepts.\n *\n * Point cuts prefer a paragraph break, then a line break, then a space, then a code-unit boundary that does not split a\n * surrogate pair. The chunks concatenate back to the input.\n *\n * @param text - the text of one block.\n * @param limit - the maximum chunk length in UTF-16 code units.\n * @returns one or more chunks.\n */\nexport function splitText(text, limit) {\n if (text.length <= limit)\n return [text];\n const chunks = [];\n let rest = text;\n while (rest.length > limit) {\n let cut = boundaryCut(rest, limit);\n if (cut <= 0)\n cut = Math.max(1, limit);\n cut = Math.max(1, avoidSplitPair(rest, cut));\n chunks.push(rest.slice(0, cut));\n rest = rest.slice(cut);\n }\n if (rest !== '')\n chunks.push(rest);\n return chunks;\n}\n/** One message object of a draft, with resource keys resolved by the caller. */\nfunction messageOf(block, keyOf) {\n switch (block.type) {\n case 'text':\n return { type: 'text', text: block.text };\n case 'image': {\n const url = keyOf(block.ref);\n // LINE documents the preview as a smaller image; the original is the one URL every client can show, and some\n // clients use it for the preview anyway.\n return { type: 'image', originalContentUrl: url, previewImageUrl: url };\n }\n case 'video':\n return {\n type: 'video',\n originalContentUrl: keyOf(block.ref),\n previewImageUrl: keyOf(block.poster),\n };\n case 'audio':\n return {\n type: 'audio',\n originalContentUrl: keyOf(block.ref),\n duration: block.duration,\n };\n }\n}\n/** One LINE action object of a quick reply item. */\nfunction actionOf(action) {\n switch (action.type) {\n case 'postback':\n return { type: 'postback', label: action.label, data: action.data };\n case 'uri':\n return { type: 'uri', label: action.label, uri: action.uri };\n case 'message':\n return { type: 'message', label: action.label, text: action.text };\n }\n}\n/** Copy one message object with its quote token. */\nfunction quoteMessage(message, quoteToken) {\n return { ...message, quoteToken };\n}\n/** One quick reply item around a collected button. */\nfunction quickReplyItemOf(action) {\n return { type: 'action', action: actionOf(action) };\n}\n/**\n * The message objects of one draft.\n *\n * A draft without blocks exists only to carry a quick reply (content that is nothing but buttons), so it gets a text\n * message the quick reply can ride on.\n */\nfunction messagesOf(draft, keyOf) {\n const blocks = draft.blocks.length > 0\n ? draft.blocks\n : [{ type: 'text', text: QUICK_REPLY_CARRIER }];\n const messages = blocks.map((block) => messageOf(block, keyOf));\n if (draft.actions.length > 0) {\n const last = messages[messages.length - 1];\n messages[messages.length - 1] = {\n ...last,\n quickReply: { items: draft.actions.map(quickReplyItemOf) },\n };\n }\n return messages;\n}\n/**\n * Fold a node stream into requests.\n *\n * @param nodes - rendered nodes, in document order.\n * @returns one draft per request, in send order; never empty.\n */\nexport function assembleDraft(nodes) {\n const blocks = [];\n const actions = [];\n let buffer = '';\n const flushText = () => {\n const text = buffer.trim();\n buffer = '';\n if (text === '')\n return;\n for (const chunk of splitText(text, LINE_LIMITS.text)) {\n blocks.push({ type: 'text', text: chunk });\n }\n };\n for (const node of nodes) {\n switch (node.type) {\n case 'text':\n buffer += node.text;\n break;\n case 'media':\n flushText();\n blocks.push(node.block);\n break;\n case 'button':\n actions.push(node.action);\n break;\n }\n }\n flushText();\n const drafts = [];\n for (let index = 0; index < blocks.length; index += LINE_LIMITS.messages) {\n drafts.push({\n blocks: blocks.slice(index, index + LINE_LIMITS.messages),\n actions: [],\n });\n }\n if (drafts.length === 0)\n drafts.push({ blocks: [], actions: [] });\n // The platform shows only the last message object's quick reply, so every button rides the last request.\n if (actions.length > 0) {\n drafts[drafts.length - 1].actions = actions;\n }\n return drafts;\n}\n/** The referrer this adapter wrote, when the target still carries it. */\nfunction isLineReferrer(value) {\n return (typeof value === 'object' &&\n value !== null &&\n 'timestamp' in value &&\n 'mode' in value);\n}\n/** One resolved resource key of a prepared draft. */\nfunction resolvedKey(prepared, ref) {\n const resolved = prepared.resolved.get(ref);\n if (resolved === undefined) {\n throw new Error('line: media was not prepared before serialize');\n }\n return resolved.key;\n}\n/** The quote token of this request, when the request answers the message the token belongs to. */\nfunction quoteTokenOf(ctx) {\n if (ctx.index !== 0 || ctx.quote === undefined)\n return undefined;\n const referrer = ctx.target.referrer;\n if (!isLineReferrer(referrer))\n return undefined;\n if (referrer.messageId !== ctx.quote)\n return undefined;\n return referrer.quoteToken;\n}\n/**\n * Build the exact push body of one prepared draft.\n *\n * @param prepared - the draft with its resource keys resolved.\n * @param ctx - the send context: target, part index and quoted message.\n * @returns the request body.\n * @throws PlatformError `invalid` when the target chat id carries no known prefix.\n */\nexport function serializeDraft(prepared, ctx) {\n const messages = messagesOf(prepared.draft, (ref) => resolvedKey(prepared, ref));\n const quoteToken = quoteTokenOf(ctx);\n if (quoteToken !== undefined) {\n const first = messages[0];\n if (first.type === 'text' ||\n first.type === 'image' ||\n first.type === 'video' ||\n first.type === 'sticker') {\n messages[0] = quoteMessage(first, quoteToken);\n }\n else {\n // Only the four types above accept a quote token; an audio object cannot be sent as a quote.\n ctx.bot.ctx.logger.debug('line: the first message object is an %s, which cannot carry a quote token', first.type);\n }\n }\n return { to: chatTargetOf(ctx.target.chat.id), messages };\n}\n/**\n * Hard platform limits of one draft, checked before any request.\n *\n * Text splitting and per-request grouping already keep the draft inside the text, object-count and quick-reply bounds;\n * the checks stay as a regression guard and as the only place a caller learns about a request body that outgrew the\n * 2 MB limit (long media URLs).\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 block of draft.blocks) {\n if (block.type !== 'text')\n continue;\n const length = block.text.length;\n if (length <= LINE_LIMITS.text)\n continue;\n violations.push({\n kind: 'size',\n key: 'limit.text.chars',\n limit: LINE_LIMITS.text,\n actual: length,\n message: `LINE text accepts ${LINE_LIMITS.text} UTF-16 code units, got ${length}`,\n });\n }\n if (draft.actions.length > LINE_LIMITS.quickReplies) {\n violations.push({\n kind: 'size',\n key: 'limit.buttons.rows',\n limit: LINE_LIMITS.quickReplies,\n actual: draft.actions.length,\n message: `LINE quick reply accepts ${LINE_LIMITS.quickReplies} items, got ${draft.actions.length}`,\n });\n }\n const bytes = Buffer.byteLength(JSON.stringify(messagesOf(draft, (ref) => /^https:\\/\\//i.test(ref.src) ? ref.src : STAGED_URL_ALLOWANCE)), 'utf8');\n if (bytes > LINE_LIMITS.payloadBytes) {\n violations.push({\n kind: 'size',\n key: 'limit.payload.bytes',\n limit: LINE_LIMITS.payloadBytes,\n actual: bytes,\n message: `LINE accepts a ${LINE_LIMITS.payloadBytes}-byte request body, got ${bytes}`,\n });\n }\n return violations;\n}\n//# sourceMappingURL=shared.js.map","/**\n * `text` mode: LINE message objects, which is the only outbound representation the Messaging API programs against.\n *\n * Text is sent verbatim — a LINE text message has no markup, so nothing is escaped. Images, videos and audio become\n * message objects of their own; a video without a poster and an audio without a duration cannot be expressed (both\n * fields are required by the platform), so they become a link the LINE client can open. Buttons become quick reply\n * items. Everything else takes the core fallback and is reported as degraded.\n */\nimport { ElementRegistry } from '@deepseek-ai/cordis-plugin-im-core';\nimport { assembleDraft, checkDraft, LINE_LIMITS, reportMovedMedia, serializeDraft, } from \"./shared.js\";\n/** The link text a media element the platform cannot send as its kind degrades to. */\nfunction linkText(name, src) {\n return name === undefined || name === '' ? src : `${name}: ${src}`;\n}\n/** The text run of rendered children and the media that cannot stay inside it. */\nfunction textRun(nodes) {\n let text = '';\n const rest = [];\n for (const node of nodes) {\n if (node.type === 'text')\n text += node.text;\n else\n rest.push(node);\n }\n return { text, nodes: rest };\n}\n/** One image message object, reported as moved when it stood inside a phrasing container. */\nfunction imageNode(el, ctx) {\n reportMovedMedia(el, ctx);\n return {\n type: 'media',\n block: { type: 'image', ref: ctx.resource('image', el.attrs.src, {}) },\n };\n}\n/** One video message object; without a poster the platform refuses the object, so the video becomes a link. */\nfunction videoNode(el, ctx) {\n const { src, poster, name } = el.attrs;\n if (poster === undefined) {\n // The message object requires a preview image, so the video playback is what the platform cannot carry while its\n // link still is. A degraded entry would claim the element itself reached the platform.\n ctx.report.dropped.push({\n what: `video:${name ?? src}`,\n reason: 'line-video-poster',\n });\n return { type: 'text', text: linkText(name, src) };\n }\n reportMovedMedia(el, ctx);\n return {\n type: 'media',\n block: {\n type: 'video',\n ref: ctx.resource('video', src, name === undefined ? {} : { name }),\n poster: ctx.resource('image', poster, {}),\n },\n };\n}\n/** One audio message object; the platform requires the duration, so an audio without one becomes a link. */\nfunction audioNode(el, ctx) {\n const { src, name, duration } = el.attrs;\n if (duration === undefined) {\n ctx.report.dropped.push({\n what: `audio:${name ?? src}`,\n reason: 'line-audio-duration',\n });\n return { type: 'text', text: linkText(name, src) };\n }\n reportMovedMedia(el, ctx);\n return {\n type: 'media',\n block: {\n type: 'audio',\n ref: ctx.resource('audio', src, {\n ...(name === undefined ? {} : { name }),\n duration,\n }),\n duration,\n },\n };\n}\n/** The quick reply action of one button, by its type. */\nfunction buttonAction(el, ctx) {\n const label = ctx.text(el.children).trim();\n switch (el.attrs.type) {\n case 'link':\n return {\n type: 'uri',\n label: label === '' ? el.attrs.href : label,\n uri: el.attrs.href,\n };\n case 'input':\n return {\n type: 'message',\n label: label === '' ? el.attrs.text : label,\n text: el.attrs.text,\n };\n case 'action':\n case 'submit':\n return {\n type: 'postback',\n label: label === '' ? el.attrs.id : label,\n data: el.attrs.id,\n };\n }\n}\n/** Build the `text` mode. */\nexport function createTextMode() {\n const elements = new ElementRegistry()\n .register('text', (el) => ({ type: 'text', text: el.attrs.content }))\n .register('br', () => ({ type: 'text', text: '\\n' }))\n // Paragraphs hand their children through, so inline media reaches `assemble` instead of being flattened away.\n .register('p', (el, ctx) => [\n ...ctx.render(el.children),\n { type: 'text', text: '\\n\\n' },\n ])\n .register('a', (el, ctx) => {\n const run = textRun(ctx.render(el.children));\n // LINE turns a bare URL into a tap target; a link's label keeps the URL visible when it would otherwise be lost.\n const text = run.text.includes(el.attrs.href)\n ? run.text\n : run.text.trim() === ''\n ? el.attrs.href\n : `${run.text} (${el.attrs.href})`;\n return [{ type: 'text', text }, ...run.nodes];\n })\n .register('img', (el, ctx) => imageNode(el, ctx), { variants: ['inline'] })\n .register('video', (el, ctx) => videoNode(el, ctx))\n .register('audio', (el, ctx) => audioNode(el, ctx))\n .register('button', (el, ctx) => ({ type: 'button', action: buttonAction(el, ctx) }), { variants: ['action', 'link', 'input', 'submit', 'theme', 'inline'] })\n .register('button-group', (el, ctx) => ctx.render(el.children));\n return {\n id: 'text',\n elements,\n limits: {\n 'limit.text.chars': LINE_LIMITS.text,\n 'limit.buttons.rows': LINE_LIMITS.quickReplies,\n 'limit.payload.bytes': LINE_LIMITS.payloadBytes,\n },\n assemble: (nodes) => assembleDraft(nodes),\n serialize: (prepared, ctx) => serializeDraft(prepared, ctx),\n check: (draft) => checkDraft(draft),\n };\n}\n//# sourceMappingURL=text.js.map","/**\n * Outbound: one push request per draft, and the member pages `im_members` reads.\n *\n * LINE has no reply API the DSH pipeline could use — a reply token lives one minute and is single-use, while a turn may\n * run for minutes — so every send is a push. The reply token is still kept in the inbound referrer for a plugin that\n * calls `bot.internal.replyMessage` itself.\n */\nimport { PlatformError } from '@deepseek-ai/cordis-plugin-im-core';\nimport { parseChatId } from \"./decode.js\";\n/**\n * Send one serialized payload and report the parts the platform created.\n *\n * A refused push is a request-level failure: LINE has no partial send, and it documents that a request answered with an\n * error sent nothing.\n *\n * @param deps - the adapter's API surface.\n * @param payload - one push body.\n * @param _target - the chat the payload goes to; the recipient already rides `payload.to`.\n * @param _ctx - the core send context; this adapter keeps no per-part state.\n * @returns the published part; its `aliases` are the remaining message ids of the same request.\n * @throws PlatformError `invalid` when the answer carries no `sentMessages`, with an unknown outcome.\n */\nexport async function sendPayload(deps, payload, _target, _ctx) {\n const answer = await deps.internal.pushMessage({\n to: payload.to,\n messages: payload.messages,\n });\n const sent = answer.sentMessages ?? [];\n const [head, ...rest] = sent;\n if (head === undefined) {\n // The request reached the platform and was accepted, but no message id came back: the outcome is not \"unpublished\".\n throw new PlatformError('invalid', 'line: pushMessage answered without sentMessages', { published: 'unknown' });\n }\n return {\n id: head.id,\n kind: 'message',\n time: Date.now(),\n ...(rest.length === 0\n ? {}\n : { aliases: rest.map((message) => message.id) }),\n // The quote tokens of this request are how a later reply can quote one of its own messages.\n raw: {\n ids: sent.map((message) => message.id),\n quoteTokens: sent.map((message) => message.quoteToken),\n },\n };\n}\n/**\n * One page of the members of a chat.\n *\n * A group or a room lists its member ids through the platform; a direct chat's only member is the peer, which the\n * `chat.id` already names. Names are not filled in: the platform wants one profile request per member, and that\n * request is refused for a user who has not agreed to the Official Accounts Terms of Use.\n *\n * @param deps - the adapter's API surface.\n * @param chat - the chat to list.\n * @param cursor - the previous page's `next` token, valid for 24 hours.\n * @param _limit - unused; the platform fixes the page size at 100 and the host truncates the answer.\n * @returns one page of member ids.\n */\nexport async function members(deps, chat, cursor, _limit) {\n const address = parseChatId(chat.id);\n if (address.kind === 'user')\n return { data: [{ id: address.id }] };\n const query = cursor === undefined ? undefined : { start: cursor };\n const answer = address.kind === 'group'\n ? await deps.internal.getGroupMembersIds(address.id, query)\n : await deps.internal.getRoomMembersIds(address.id, query);\n return {\n data: answer.memberIds.map((id) => ({ id })),\n ...(answer.next === undefined ? {} : { next: answer.next }),\n };\n}\n//# sourceMappingURL=send.js.map","/**\n * Outbound media: the public route LINE fetches staged bytes from.\n *\n * The Messaging API has no endpoint that uploads message media; an image, video or audio message carries only HTTPS URLs\n * that the LINE servers fetch themselves. The adapter therefore stages the bytes of every non-HTTPS source in memory\n * and serves them from an anonymous, unguessable URL for the lifetime of the process.\n */\nimport { randomBytes } from 'node:crypto';\nimport { routePath } from \"../config.js\";\n/**\n * Staged bytes by opaque token.\n *\n * Entries live until the process exits: the platform may fetch a URL minutes after a send, and the W1 rule forbids\n * inventing a TTL or a byte cap the platform does not document. The `prepare` cache means the same media is staged\n * once, not once per send.\n */\nexport class MediaStaging {\n base;\n prefix;\n entries = new Map();\n constructor(base, prefix) {\n this.base = base;\n this.prefix = prefix;\n }\n /**\n * Stage one attachment.\n *\n * @param media - the bytes, their MIME type and name.\n * @returns the public URL LINE fetches the bytes from.\n */\n stage(media) {\n // 128 random bits: the route is anonymous, so the URL is the only thing keeping unrelated readers out.\n const token = randomBytes(16).toString('base64url');\n this.entries.set(token, media);\n return `${this.base}${this.prefix}/${token}`;\n }\n /**\n * Read staged bytes back.\n *\n * @param token - the last path segment of a URL returned by {@link stage}.\n * @returns the staged attachment, or undefined for an unknown token.\n */\n get(token) {\n return this.entries.get(token);\n }\n /** The number of attachments currently staged, for tests and diagnostics. */\n get size() {\n return this.entries.size;\n }\n}\n/**\n * The public media route.\n *\n * It is registered as a `prefix` resource, so the web server hands it a Fetch `Request` and takes the `Response` back;\n * the route is anonymous because LINE's servers carry no DSH peer credential.\n */\nexport class LineMediaRoute {\n bot;\n webServer;\n dispose;\n constructor(bot, webServer) {\n this.bot = bot;\n this.webServer = webServer;\n }\n /** Register the prefix route. */\n start() {\n const path = routePath(this.bot.config.media.path);\n this.dispose = this.webServer.register({\n kind: 'prefix',\n path,\n auth: 'anonymous',\n resource: (request) => this.serve(request),\n });\n }\n /** Release the route. */\n stop() {\n this.dispose?.();\n this.dispose = undefined;\n }\n async serve(request) {\n const prefix = `${routePath(this.bot.config.media.path)}/`;\n const { pathname } = new URL(request.url);\n if (!pathname.startsWith(prefix)) {\n return new Response(null, { status: 404 });\n }\n const segment = pathname.slice(prefix.length);\n let token;\n try {\n token = decodeURIComponent(segment);\n }\n catch {\n // The web server answers a malformed escape before this route runs; a token it still cannot decode names nothing.\n return new Response(null, { status: 404 });\n }\n const media = this.bot.staging.get(token);\n if (media === undefined)\n return new Response(null, { status: 404 });\n const headers = new Headers();\n headers.set('content-type', media.mime ?? 'application/octet-stream');\n headers.set('content-length', String(media.data.byteLength));\n return new Response(media.data, { status: 200, headers });\n }\n}\n//# sourceMappingURL=media.js.map","import { createHmac, timingSafeEqual } from 'node:crypto';\n/**\n * The `x-line-signature` value of one webhook request.\n *\n * LINE signs the request body exactly as it arrived, keyed by the channel secret.\n *\n * @param secret - the channel secret.\n * @param body - the raw request body, before any decoding.\n * @returns base64 of `HMAC-SHA256(secret, body)`.\n */\nexport function signatureOf(secret, body) {\n return createHmac('sha256', secret).update(body).digest('base64');\n}\n/**\n * Compare a received signature with the computed one without leaking where they differ.\n *\n * @param expected - the signature computed from the body.\n * @param received - the header value, if the request carried one.\n * @returns whether the header matches.\n */\nexport function matchesSignature(expected, received) {\n if (received === undefined)\n return false;\n const left = Buffer.from(expected, 'utf8');\n const right = Buffer.from(received, 'utf8');\n if (left.length !== right.length)\n return false;\n return timingSafeEqual(left, right);\n}\n//# sourceMappingURL=signature.js.map","/**\n * The webhook transport.\n *\n * LINE has no long connection, polling or gateway: the only inbound path is an HTTPS POST to a URL configured in the\n * console. The route is registered on the profile's `webServer`, which owns the listener and the public address; the\n * adapter keeps the handler anonymous and authenticates every request with the channel secret.\n *\n * The handler answers `200` only after intake stored the events, so a retrying platform can resend a failed delivery,\n * and it answers every refusal before any work is done.\n */\nimport { publicBase, routePath } from \"../config.js\";\nimport { decodeEvent } from \"../decode.js\";\nimport { matchesSignature, signatureOf } from \"../signature.js\";\n/** Header LINE signs the request with. */\nconst SIGNATURE_HEADER = 'x-line-signature';\n/** Message of any caught value, for a log line. */\nfunction messageOf(error) {\n return error instanceof Error ? error.message : String(error);\n}\n/** One header of an inbound request, when it arrived exactly once. */\nfunction headerOf(request, name) {\n const value = request.headers[name];\n return typeof value === 'string' ? value : undefined;\n}\n/** Read a request body to its end. LINE publishes no body-size limit, so the adapter imposes none. */\nasync function readBody(request) {\n const chunks = [];\n for await (const chunk of request) {\n chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));\n }\n return Buffer.concat(chunks).toString('utf8');\n}\n/** Write one bodiless answer. */\nfunction writeStatus(response, status, headers = {}) {\n response.writeHead(status, headers);\n response.end();\n}\n/** One event source, when the payload names a conversation kind this adapter knows. */\nfunction isEventSource(value) {\n if (typeof value !== 'object' || value === null)\n return false;\n const record = value;\n switch (record.type) {\n case 'user':\n return typeof record.userId === 'string';\n case 'group':\n return typeof record.groupId === 'string';\n case 'room':\n return typeof record.roomId === 'string';\n default:\n return false;\n }\n}\n/** One event envelope, as far as decoding needs it: a type, a channel mode, a time and a source. */\nfunction isWebhookEvent(value) {\n if (typeof value !== 'object' || value === null)\n return false;\n const record = value;\n return (typeof record.type === 'string' &&\n (record.mode === 'active' || record.mode === 'standby') &&\n typeof record.timestamp === 'number' &&\n isEventSource(record.source));\n}\n/**\n * The parsed webhook body, when its envelope is complete.\n *\n * @param value - the parsed JSON value.\n * @returns the typed body, or undefined when the value is not a webhook body.\n */\nfunction parseWebhookBody(value) {\n if (typeof value !== 'object' || value === null)\n return undefined;\n const record = value;\n if (typeof record.destination !== 'string')\n return undefined;\n if (!Array.isArray(record.events))\n return undefined;\n const events = [];\n for (const item of record.events) {\n if (!isWebhookEvent(item))\n return undefined;\n events.push(item);\n }\n return { destination: record.destination, events };\n}\n/**\n * The webhook route.\n *\n * `start` registers the route and `announce` points the channel at it, so the media route of the same connect is in\n * place before the channel starts delivering anything.\n */\nexport class LineWebhook {\n bot;\n webServer;\n dispose;\n constructor(bot, webServer) {\n this.bot = bot;\n this.webServer = webServer;\n }\n /** Register the route. */\n start() {\n const path = routePath(this.bot.config.webhook.path);\n this.dispose = this.webServer.register({\n kind: 'exact',\n path,\n auth: 'anonymous',\n handler: (request, response) => this.handle(request, response),\n });\n }\n /**\n * Point the channel at the registered route and read the endpoint state back.\n *\n * A profile that cannot receive anything fails at connect with an actionable message instead of silently getting no\n * events; the route is released on that failure so a half-configured connect leaves nothing behind.\n */\n async announce() {\n try {\n await this.bot.internal.setWebhookEndpoint({\n endpoint: `${publicBase(this.bot.config.publicUrl)}${routePath(this.bot.config.webhook.path)}`,\n });\n }\n catch (error) {\n this.stop();\n this.bot.ctx.logger.error('line: setWebhookEndpoint failed: %s', messageOf(error));\n throw error;\n }\n await this.readBackEndpoint();\n }\n /** Release the route. The channel keeps its endpoint: clearing it would point LINE at a 404. */\n stop() {\n this.dispose?.();\n this.dispose = undefined;\n }\n /**\n * Read the endpoint state back after registering it.\n *\n * A channel whose \"Use webhook\" switch is off answers `active: false`; the console takes up to a minute to apply the\n * new endpoint, so this only warns and never fails the connect.\n */\n async readBackEndpoint() {\n try {\n const state = await this.bot.internal.getWebhookEndpoint();\n if (!state.active) {\n this.bot.ctx.logger.warn('line: the webhook endpoint is not active; turn on \"Use webhook\" in the LINE console');\n }\n }\n catch (error) {\n this.bot.ctx.logger.warn('line: the webhook endpoint could not be read back: %s', messageOf(error));\n }\n }\n async handle(request, response) {\n try {\n if (request.method !== 'POST') {\n writeStatus(response, 405, { allow: 'POST' });\n return;\n }\n // A request without a signature is not from LINE; there is no reason to read its body.\n const received = headerOf(request, SIGNATURE_HEADER);\n if (received === undefined) {\n writeStatus(response, 401);\n return;\n }\n const body = await readBody(request);\n // The signature covers the body as it arrived, so it is verified before the body is interpreted.\n if (!matchesSignature(signatureOf(this.bot.config.secret, body), received)) {\n writeStatus(response, 401);\n return;\n }\n let parsed;\n try {\n parsed = JSON.parse(body);\n }\n catch (error) {\n this.bot.ctx.logger.warn('line: cannot parse a webhook request: %s', messageOf(error));\n writeStatus(response, 400);\n return;\n }\n const payload = parseWebhookBody(parsed);\n if (payload === undefined) {\n writeStatus(response, 400);\n return;\n }\n if (payload.destination !== this.bot.selfId) {\n writeStatus(response, 403);\n return;\n }\n if (payload.events.length === 0) {\n // The console sends an eventless body to probe the endpoint; it has to answer 200.\n writeStatus(response, 200);\n return;\n }\n for (const event of payload.events) {\n const session = decodeEvent(this.bot, event);\n if (session !== undefined)\n await this.bot.receive(session);\n }\n writeStatus(response, 200);\n }\n catch (error) {\n this.bot.ctx.logger.warn('line: webhook delivery failed: %s', messageOf(error));\n if (!response.headersSent)\n writeStatus(response, 500);\n else\n response.end();\n }\n }\n}\n//# sourceMappingURL=webhook.js.map","import { Adapter, PlatformError } from '@deepseek-ai/cordis-plugin-im-core';\nimport { Config, configError, publicBase, routePath } from \"./config.js\";\nimport { classifyLineError } from \"./errors.js\";\nimport { verifyIdentity } from \"./identity.js\";\nimport { serveMessageContent } from \"./media.js\";\nimport { createTextMode } from \"./modes/text.js\";\nimport { members, sendPayload } from \"./send.js\";\nimport { LineMediaRoute, MediaStaging } from \"./transport/media.js\";\nimport { LineWebhook } from \"./transport/webhook.js\";\n// The migrated declarations register their typed methods on `Internal` when they are imported.\nimport \"./types/index.js\";\nimport { Internal } from \"./types/internal.js\";\n/** Message of any caught value, for a log line. */\nfunction messageOf(error) {\n return error instanceof Error ? error.message : String(error);\n}\n/** Whether a resource source is a public HTTPS URL LINE can fetch itself. */\nfunction isHttpsSource(src) {\n try {\n return new URL(src).protocol === 'https:';\n }\n catch {\n // Not a URL at all (`data:`, `file:`, a bare path): those forms are fetched and staged instead.\n return false;\n }\n}\n/**\n * LINE Messaging API adapter.\n *\n * The channel is identified by configuration (`selfId`), confirmed with `getBotInfo` on connect. The webhook is the\n * only transport, `text` is the only mode, and every send is a push: a reply token lives one minute and is single-use,\n * while a turn may run for minutes. Outbound media is staged in memory and served from a public route, because the\n * platform accepts media only as HTTPS URLs it fetches itself.\n */\nexport class LineBot extends Adapter {\n /** The adapter needs the Satori service and the isolated `http` service. */\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 = { text: createTextMode() };\n modeOrder = ['text'];\n /** Endpoints shared by the API client and the content download. */\n request;\n /** Full typed Messaging API surface registered by the vendored declarations. */\n internal;\n /** Outbound media bytes, served from the public media route. */\n staging;\n webhook;\n mediaRoute;\n constructor(ctx, config) {\n super(ctx, config, {\n id: `line:${config.selfId}`,\n platform: 'line',\n adapter: 'line',\n });\n // `bot.id` has to be fixed at construction, so the channel is configured rather than discovered; `connect` proves\n // the token belongs to it.\n this.selfId = config.selfId;\n this.request = { ctx, config };\n this.internal = new Internal(this.request);\n this.staging = new MediaStaging(publicBase(config.publicUrl), routePath(config.media.path));\n this.defineInternalRoute('/assets/:messageId', async ({ params }) => serveMessageContent(this, params.messageId));\n }\n async connect() {\n const invalid = configError(this.config);\n if (invalid !== undefined) {\n this.ctx.logger.error('line: connect failed: %s', invalid.message);\n throw invalid;\n }\n const webServer = this.ctx.get('webServer');\n if (webServer === undefined) {\n const error = new Error('line: this adapter needs a profile-provided webServer; LINE has only the webhook transport, so add a webServer row to the profile and make publicUrl reachable from the internet');\n this.ctx.logger.error(error.message);\n throw error;\n }\n try {\n const info = await this.internal.getBotInfo();\n this.selfId = verifyIdentity(this.config.selfId, info);\n this.user = { id: info.userId, name: info.displayName, isBot: true };\n const webhook = new LineWebhook(this, webServer);\n const mediaRoute = new LineMediaRoute(this, webServer);\n webhook.start();\n try {\n mediaRoute.start();\n }\n catch (error) {\n webhook.stop();\n throw error;\n }\n try {\n await webhook.announce();\n }\n catch (error) {\n mediaRoute.stop();\n throw error;\n }\n this.webhook = webhook;\n this.mediaRoute = mediaRoute;\n this.online();\n }\n catch (error) {\n // `Bot.start` only stores a connect failure on `bot.error`, so log it here.\n this.ctx.logger.error('line: connect failed: %s', messageOf(error));\n throw error;\n }\n }\n async disconnect() {\n const webhook = this.webhook;\n const mediaRoute = this.mediaRoute;\n this.webhook = undefined;\n this.mediaRoute = undefined;\n webhook?.stop();\n mediaRoute?.stop();\n }\n /**\n * Turn one outbound attachment into the key a message object carries.\n *\n * A public HTTPS source is passed through untouched: LINE fetches it, so the bytes never enter this process. Every\n * other source (`data:`, `base64:`, `satori:`, `file:`, plain HTTP) is fetched and staged on the public media route.\n */\n async upload(ref, _scope, ctx) {\n if (isHttpsSource(ref.src)) {\n return {\n key: ref.src,\n extra: { name: ref.meta.name, mime: ref.meta.mime },\n };\n }\n let fetched;\n try {\n fetched = await ctx.fetch(ref.src, ctx.signal);\n }\n catch (error) {\n // The bytes never reached a request: a source that cannot be read is a request-level failure, published: no.\n if (ctx.signal.aborted)\n throw error;\n throw new PlatformError('invalid', `line: media source ${ref.src} could not be read: ${messageOf(error)}`, { published: 'no', cause: error });\n }\n const mime = ref.meta.mime ?? fetched.mime;\n const name = ref.meta.name ?? fetched.name;\n const key = this.staging.stage({\n data: fetched.data,\n ...(mime === undefined ? {} : { mime }),\n ...(name === undefined ? {} : { name }),\n });\n return {\n key,\n extra: {\n ...(name === undefined ? {} : { name }),\n ...(mime === undefined ? {} : { mime }),\n size: fetched.data.byteLength,\n },\n };\n }\n resourceScope(_target, _kind) {\n return this.id;\n }\n async sendPayload(payload, target, ctx) {\n return await sendPayload({ internal: this.internal }, payload, target, ctx);\n }\n async members(chat, cursor, limit) {\n return await members({ internal: this.internal }, chat, cursor, limit);\n }\n classify(error) {\n return classifyLineError(error);\n }\n}\nexport { Config };\nexport default LineBot;\n//# sourceMappingURL=bot.js.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAOA,IAAa,eAAb,cAAkC,MAAM;CACpC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pB,MAAM,cACV;CACA,6BAA6B,EACzB,MAAM,YACV;CACA,8BAA8B,EAC1B,MAAM,aACV;CACA,uCAAuC,EACnC,KAAK,wBACT;CACA,6BAA6B,EACzB,MAAM,YACV;CACA,yBAAyB,EACrB,KAAK,kBACT;CACA,qCAAqC,EACjC,KAAK,6BACT;CACA,kCAAkC,EAC9B,KAAK,+BACT;CACA,iCAAiC,EAC7B,KAAK,8BACT;CACA,sCAAsC,EAClC,KAAK,mCACT;CACA,sCAAsC,EAClC,KAAK,mCACT;CACA,kCAAkC,EAC9B,MAAM,gBACV;CACA,iCAAiC,EAC7B,MAAM,eACV;CACA,sCAAsC,EAClC,MAAM,oBACV;CACA,uCAAuC,EACnC,MAAM,qBACV;CACA,sCAAsC,EAClC,MAAM,oBACV;CACA,oCAAoC,EAChC,KAAK,0BACT;CACA,oCAAoC,EAChC,KAAK,6BACT;CACA,4BAA4B,EACxB,KAAK,aACT;CACA,yBAAyB,EACrB,KAAK,eACT;CACA,gBAAgB,EACZ,KAAK,aACT;CACA,2CAA2C,EACvC,KAAK,wBACT;CACA,yCAAyC,EACrC,KAAK,uBACT;CACA,uCAAuC,EACnC,KAAK,qBACT;CACA,qCAAqC,EACjC,KAAK,oBACT;CACA,iCAAiC,EAC7B,MAAM,aACV;CACA,+BAA+B,EAC3B,MAAM,YACV;CACA,mCAAmC,EAC/B,KAAK,kBACT;CACA,yCAAyC,EACrC,KAAK,sBACT;CACA,uCAAuC,EACnC,KAAK,qBACT;CACA,oBAAoB,EAChB,MAAM,iBACV;CACA,6BAA6B,EACzB,MAAM,yBACV;CACA,yCAAyC;EACrC,KAAK;EACL,MAAM;CACV;CACA,iCAAiC;EAC7B,KAAK;EACL,QAAQ;CACZ;CACA,yBAAyB,EACrB,KAAK,kBACT;CACA,0CAA0C,EACtC,MAAM,qBACV;CACA,6BAA6B;EACzB,KAAK;EACL,QAAQ;CACZ;CACA,0BAA0B,EACtB,MAAM,sBACV;CACA,4CAA4C;EACxC,KAAK;E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KAAK;GACvB;EACJ;CACJ;CACA,cAAc,SAAS,OAAO;EAC1B,OAAO,KAAK;CAChB;CACA,MAAM,YAAY,SAAS,QAAQ,KAAK;EACpC,OAAO,MAAM,YAAY,EAAE,UAAU,KAAK,SAAS,GAAG,SAAS,QAAQ,GAAG;CAC9E;CACA,MAAM,QAAQ,MAAM,QAAQ,OAAO;EAC/B,OAAO,MAAM,QAAQ,EAAE,UAAU,KAAK,SAAS,GAAG,MAAM,QAAQ,KAAK;CACzE;CACA,SAAS,OAAO;EACZ,OAAO,kBAAkB,KAAK;CAClC;AACJ"}
@@ -0,0 +1,55 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import { Adapter, PlatformError } from '@deepseek-ai/cordis-plugin-im-core';
3
+ import type { ChatRef, MembersPage, Mode, PrepareContext, ResolvedResource, ResourceKind, ResourceRef, SendContext, SentPart, Target } from '@deepseek-ai/cordis-plugin-im-core';
4
+ import { Config } from './config.ts';
5
+ import type { LineModeTypes } from './modes/shared.ts';
6
+ import type { LineRequest } from './request.ts';
7
+ import { MediaStaging } from './transport/media.ts';
8
+ import './types/index.ts';
9
+ import { Internal } from './types/internal.ts';
10
+ /** The single mode this adapter always registers. */
11
+ export interface LineModes {
12
+ [mode: string]: Mode<LineModeTypes>;
13
+ text: Mode<LineModeTypes>;
14
+ }
15
+ /**
16
+ * LINE Messaging API adapter.
17
+ *
18
+ * The channel is identified by configuration (`selfId`), confirmed with `getBotInfo` on connect. The webhook is the
19
+ * only transport, `text` is the only mode, and every send is a push: a reply token lives one minute and is single-use,
20
+ * while a turn may run for minutes. Outbound media is staged in memory and served from a public route, because the
21
+ * platform accepts media only as HTTPS URLs it fetches itself.
22
+ */
23
+ export declare class LineBot extends Adapter<Config, LineModes> {
24
+ /** The adapter needs the Satori service and the isolated `http` service. */
25
+ static inject: string[];
26
+ /** The Loader applies this schema to a profile row's `config` before the constructor runs. */
27
+ static readonly Config: import("@deepseek-ai/schemastery").default<Config>;
28
+ readonly modes: LineModes;
29
+ readonly modeOrder: readonly ["text"];
30
+ /** Endpoints shared by the API client and the content download. */
31
+ readonly request: LineRequest;
32
+ /** Full typed Messaging API surface registered by the vendored declarations. */
33
+ readonly internal: Internal;
34
+ /** Outbound media bytes, served from the public media route. */
35
+ readonly staging: MediaStaging;
36
+ private webhook;
37
+ private mediaRoute;
38
+ constructor(ctx: Context, config: Config);
39
+ connect(): Promise<void>;
40
+ disconnect(): Promise<void>;
41
+ /**
42
+ * Turn one outbound attachment into the key a message object carries.
43
+ *
44
+ * A public HTTPS source is passed through untouched: LINE fetches it, so the bytes never enter this process. Every
45
+ * other source (`data:`, `base64:`, `satori:`, `file:`, plain HTTP) is fetched and staged on the public media route.
46
+ */
47
+ upload(ref: ResourceRef, _scope: string, ctx: PrepareContext): Promise<ResolvedResource>;
48
+ resourceScope(_target: Target, _kind: ResourceKind): string;
49
+ sendPayload(payload: unknown, target: Target, ctx: SendContext): Promise<SentPart>;
50
+ members(chat: ChatRef, cursor?: string, limit?: number): Promise<MembersPage>;
51
+ classify(error: unknown): PlatformError;
52
+ }
53
+ export { Config };
54
+ export default LineBot;
55
+ //# sourceMappingURL=bot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../../src/bot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAC3E,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,IAAI,EACJ,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,WAAW,EACX,QAAQ,EACR,MAAM,EACP,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAsC,MAAM,aAAa,CAAA;AAIxE,OAAO,KAAK,EAAE,aAAa,EAAe,MAAM,mBAAmB,CAAA;AAEnE,OAAO,KAAK,EAAE,WAAW,EAA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,EAAE,WAAW,GACf,OAAO,CAAC,QAAQ,CAAC;IASL,OAAO,CACpB,IAAI,EAAE,OAAO,EACb,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC;IAId,QAAQ,CAAC,KAAK,EAAE,OAAO;CAGjC;AAED,OAAO,EAAE,MAAM,EAAE,CAAA;AAEjB,eAAe,OAAO,CAAA"}
@@ -0,0 +1,169 @@
1
+ import { Adapter, PlatformError } from '@deepseek-ai/cordis-plugin-im-core';
2
+ import { Config, configError, publicBase, routePath } from "./config.js";
3
+ import { classifyLineError } from "./errors.js";
4
+ import { verifyIdentity } from "./identity.js";
5
+ import { serveMessageContent } from "./media.js";
6
+ import { createTextMode } from "./modes/text.js";
7
+ import { members, sendPayload } from "./send.js";
8
+ import { LineMediaRoute, MediaStaging } from "./transport/media.js";
9
+ import { LineWebhook } from "./transport/webhook.js";
10
+ // The migrated declarations register their typed methods on `Internal` when they are imported.
11
+ import "./types/index.js";
12
+ import { Internal } from "./types/internal.js";
13
+ /** Message of any caught value, for a log line. */
14
+ function messageOf(error) {
15
+ return error instanceof Error ? error.message : String(error);
16
+ }
17
+ /** Whether a resource source is a public HTTPS URL LINE can fetch itself. */
18
+ function isHttpsSource(src) {
19
+ try {
20
+ return new URL(src).protocol === 'https:';
21
+ }
22
+ catch {
23
+ // Not a URL at all (`data:`, `file:`, a bare path): those forms are fetched and staged instead.
24
+ return false;
25
+ }
26
+ }
27
+ /**
28
+ * LINE Messaging API adapter.
29
+ *
30
+ * The channel is identified by configuration (`selfId`), confirmed with `getBotInfo` on connect. The webhook is the
31
+ * only transport, `text` is the only mode, and every send is a push: a reply token lives one minute and is single-use,
32
+ * while a turn may run for minutes. Outbound media is staged in memory and served from a public route, because the
33
+ * platform accepts media only as HTTPS URLs it fetches itself.
34
+ */
35
+ export class LineBot extends Adapter {
36
+ /** The adapter needs the Satori service and the isolated `http` service. */
37
+ static inject = ['satori', 'http'];
38
+ /** The Loader applies this schema to a profile row's `config` before the constructor runs. */
39
+ static Config = Config;
40
+ modes = { text: createTextMode() };
41
+ modeOrder = ['text'];
42
+ /** Endpoints shared by the API client and the content download. */
43
+ request;
44
+ /** Full typed Messaging API surface registered by the vendored declarations. */
45
+ internal;
46
+ /** Outbound media bytes, served from the public media route. */
47
+ staging;
48
+ webhook;
49
+ mediaRoute;
50
+ constructor(ctx, config) {
51
+ super(ctx, config, {
52
+ id: `line:${config.selfId}`,
53
+ platform: 'line',
54
+ adapter: 'line',
55
+ });
56
+ // `bot.id` has to be fixed at construction, so the channel is configured rather than discovered; `connect` proves
57
+ // the token belongs to it.
58
+ this.selfId = config.selfId;
59
+ this.request = { ctx, config };
60
+ this.internal = new Internal(this.request);
61
+ this.staging = new MediaStaging(publicBase(config.publicUrl), routePath(config.media.path));
62
+ this.defineInternalRoute('/assets/:messageId', async ({ params }) => serveMessageContent(this, params.messageId));
63
+ }
64
+ async connect() {
65
+ const invalid = configError(this.config);
66
+ if (invalid !== undefined) {
67
+ this.ctx.logger.error('line: connect failed: %s', invalid.message);
68
+ throw invalid;
69
+ }
70
+ const webServer = this.ctx.get('webServer');
71
+ if (webServer === undefined) {
72
+ const error = new Error('line: this adapter needs a profile-provided webServer; LINE has only the webhook transport, so add a webServer row to the profile and make publicUrl reachable from the internet');
73
+ this.ctx.logger.error(error.message);
74
+ throw error;
75
+ }
76
+ try {
77
+ const info = await this.internal.getBotInfo();
78
+ this.selfId = verifyIdentity(this.config.selfId, info);
79
+ this.user = { id: info.userId, name: info.displayName, isBot: true };
80
+ const webhook = new LineWebhook(this, webServer);
81
+ const mediaRoute = new LineMediaRoute(this, webServer);
82
+ webhook.start();
83
+ try {
84
+ mediaRoute.start();
85
+ }
86
+ catch (error) {
87
+ webhook.stop();
88
+ throw error;
89
+ }
90
+ try {
91
+ await webhook.announce();
92
+ }
93
+ catch (error) {
94
+ mediaRoute.stop();
95
+ throw error;
96
+ }
97
+ this.webhook = webhook;
98
+ this.mediaRoute = mediaRoute;
99
+ this.online();
100
+ }
101
+ catch (error) {
102
+ // `Bot.start` only stores a connect failure on `bot.error`, so log it here.
103
+ this.ctx.logger.error('line: connect failed: %s', messageOf(error));
104
+ throw error;
105
+ }
106
+ }
107
+ async disconnect() {
108
+ const webhook = this.webhook;
109
+ const mediaRoute = this.mediaRoute;
110
+ this.webhook = undefined;
111
+ this.mediaRoute = undefined;
112
+ webhook?.stop();
113
+ mediaRoute?.stop();
114
+ }
115
+ /**
116
+ * Turn one outbound attachment into the key a message object carries.
117
+ *
118
+ * A public HTTPS source is passed through untouched: LINE fetches it, so the bytes never enter this process. Every
119
+ * other source (`data:`, `base64:`, `satori:`, `file:`, plain HTTP) is fetched and staged on the public media route.
120
+ */
121
+ async upload(ref, _scope, ctx) {
122
+ if (isHttpsSource(ref.src)) {
123
+ return {
124
+ key: ref.src,
125
+ extra: { name: ref.meta.name, mime: ref.meta.mime },
126
+ };
127
+ }
128
+ let fetched;
129
+ try {
130
+ fetched = await ctx.fetch(ref.src, ctx.signal);
131
+ }
132
+ catch (error) {
133
+ // The bytes never reached a request: a source that cannot be read is a request-level failure, published: no.
134
+ if (ctx.signal.aborted)
135
+ throw error;
136
+ throw new PlatformError('invalid', `line: media source ${ref.src} could not be read: ${messageOf(error)}`, { published: 'no', cause: error });
137
+ }
138
+ const mime = ref.meta.mime ?? fetched.mime;
139
+ const name = ref.meta.name ?? fetched.name;
140
+ const key = this.staging.stage({
141
+ data: fetched.data,
142
+ ...(mime === undefined ? {} : { mime }),
143
+ ...(name === undefined ? {} : { name }),
144
+ });
145
+ return {
146
+ key,
147
+ extra: {
148
+ ...(name === undefined ? {} : { name }),
149
+ ...(mime === undefined ? {} : { mime }),
150
+ size: fetched.data.byteLength,
151
+ },
152
+ };
153
+ }
154
+ resourceScope(_target, _kind) {
155
+ return this.id;
156
+ }
157
+ async sendPayload(payload, target, ctx) {
158
+ return await sendPayload({ internal: this.internal }, payload, target, ctx);
159
+ }
160
+ async members(chat, cursor, limit) {
161
+ return await members({ internal: this.internal }, chat, cursor, limit);
162
+ }
163
+ classify(error) {
164
+ return classifyLineError(error);
165
+ }
166
+ }
167
+ export { Config };
168
+ export default LineBot;
169
+ //# sourceMappingURL=bot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot.js","sourceRoot":"","sources":["../../src/bot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAa3E,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,+FAA+F;AAC/F,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAQ9C,mDAAmD;AACnD,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC/D,CAAC;AAED,6EAA6E;AAC7E,SAAS,aAAa,CAAC,GAAW;IAChC,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAA;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,gGAAgG;QAChG,OAAO,KAAK,CA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IAChB,CAAC;IAEQ,KAAK,CAAC,WAAW,CACxB,OAAgB,EAChB,MAAc,EACd,GAAgB;QAEhB,OAAO,MAAM,WAAW,CACtB,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,EAC3B,OAAsB,EACtB,MAAM,EACN,GAAG,CACJ,CAAA;IACH,CAAC;IAEQ,KAAK,CAAC,OAAO,CACpB,IAAa,EACb,MAAe,EACf,KAAc;QAEd,OAAO,MAAM,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;IACxE,CAAC;IAEQ,QAAQ,CAAC,KAAc;QAC9B,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAA;IACjC,CAAC;;AAGH,OAAO,EAAE,MAAM,EAAE,CAAA;AAEjB,eAAe,OAAO,CAAA"}
@@ -0,0 +1,47 @@
1
+ import z from '@deepseek-ai/schemastery';
2
+ /** One LINE Messaging API channel. */
3
+ export interface Config {
4
+ /** Channel access token: the `Authorization: Bearer` value of every `api.line.me` call. */
5
+ token: string;
6
+ /** Channel secret: the HMAC key of `X-Line-Signature`; no API call uses it. */
7
+ secret: string;
8
+ /** The bot's own user id (`U` + 32 hex), checked against `getBotInfo` on connect. */
9
+ selfId: string;
10
+ /** Public base URL LINE reaches this process at; the webhook endpoint and the media URLs are built from it. */
11
+ publicUrl: string;
12
+ webhook: {
13
+ /** Inbound webhook path: absolute, no trailing slash. */
14
+ path: string;
15
+ };
16
+ media: {
17
+ /** Public media route prefix: absolute, no trailing slash. Must differ from `webhook.path`. */
18
+ path: string;
19
+ };
20
+ }
21
+ /** Validated LINE adapter configuration. */
22
+ export declare const Config: z<Config>;
23
+ /**
24
+ * Normalize a route path: absolute, no trailing slash.
25
+ *
26
+ * @param path - a configured path.
27
+ * @returns the pathname to register on the web server.
28
+ */
29
+ export declare function routePath(path: string): string;
30
+ /**
31
+ * The public base URL without its trailing slashes.
32
+ *
33
+ * @param publicUrl - the configured `publicUrl`.
34
+ * @returns the base every public URL is prefixed with.
35
+ */
36
+ export declare function publicBase(publicUrl: string): string;
37
+ /**
38
+ * The configuration the adapter cannot work from, as far as it can tell locally.
39
+ *
40
+ * LINE has only the webhook transport, so a profile without a public HTTPS base can neither receive an event nor let
41
+ * LINE fetch outbound media. The check runs when the bot starts, not on the first callback.
42
+ *
43
+ * @param config - the validated configuration.
44
+ * @returns the configuration error, or undefined when the configuration is usable.
45
+ */
46
+ export declare function configError(config: Config): Error | undefined;
47
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAExC,sCAAsC;AACtC,MAAM,WAAW,MAAM;IACrB,2FAA2F;IAC3F,KAAK,EAAE,MAAM,CAAA;IACb,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAA;IACd,qFAAqF;IACrF,MAAM,EAAE,MAAM,CAAA;IACd,+GAA+G;IAC/G,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE;QACP,yDAAyD;QACzD,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,KAAK,EAAE;QACL,+FAA+F;QAC/F,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;CACF;AAED,4CAA4C;AAC5C,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,CAe3B,CAAA;AAEF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG9C;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CA0C7D"}