@openclaw/line 2026.10.2 → 2026.10.5-beta.2
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/dist/.setup/api-BxKwG8cd.mjs +3 -0
- package/dist/.setup/{api-CMU7bG-C.mjs → api-DPd9f0cI.mjs} +2 -2
- package/dist/.setup/{card-command-BrU6u6pm.mjs → card-command-BMLk4YKh.mjs} +15 -24
- package/dist/.setup/{channel-InKuXaRS.mjs → channel-DVuSrT_i.mjs} +161 -227
- package/dist/.setup/channel.runtime-IN_F95BO.mjs +4 -0
- package/dist/.setup/{monitor-Bb3HieCd.mjs → monitor-BY32s5Um.mjs} +68 -83
- package/dist/.setup/monitor.runtime-DKuc2SBe.mjs +2 -0
- package/dist/.setup/outbound.runtime-DLyndDng.mjs +3 -0
- package/dist/.setup/probe.runtime-D2MUF_B_.mjs +2 -0
- package/dist/.setup/{send-DAwROcyQ.mjs → send-g4gFsc9W.mjs} +51 -71
- package/dist/.setup/{send-retry-B9Nor0-J.mjs → send-retry-Dzbkz5wG.mjs} +186 -379
- package/dist/.setup/{setup-surface-1jkHGWg7.mjs → setup-surface-CYd8oqzt.mjs} +1 -1
- package/dist/.setup/{template-messages-DdF9zv_j.mjs → template-messages-CwPsGQjw.mjs} +67 -118
- package/dist/api.js +2 -2
- package/dist/channel-plugin-api.js +1 -1
- package/dist/index.js +1 -3
- package/dist/setup-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/node_modules/@line/bot-sdk/dist/channel-access-token/api/channelAccessTokenClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/channel-access-token/api/channelAccessTokenClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/channel-access-token/api/channelAccessTokenClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/exceptions.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/exceptions.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/http-fetch.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/http-fetch.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/index.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/insight/api/insightClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/insight/api/insightClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/liff/api/liffClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/liff/api/liffClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/line-bot-client.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/line-bot-client.factory.generated.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/line-bot-client.generated.d.ts +38 -0
- package/node_modules/@line/bot-sdk/dist/cjs/line-bot-client.generated.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/line-bot-client.generated.js +46 -0
- package/node_modules/@line/bot-sdk/dist/cjs/line-bot-client.generated.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/line-bot-client.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/api/manageAudienceBlobClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/api/manageAudienceBlobClient.js +15 -5
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/api/manageAudienceBlobClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/api/manageAudienceClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/api/manageAudienceClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/api/messagingApiBlobClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/api/messagingApiBlobClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/api/messagingApiClient.d.ts +39 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/api/messagingApiClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/api/messagingApiClient.js +59 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/api/messagingApiClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/models.d.ts +5 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/models.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/models.js +5 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/models.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpMessagesRequest.d.ts +5 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpMessagesRequest.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedButton.d.ts +26 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedButton.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedButton.js +14 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedButton.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedEmphasizedItem.d.ts +27 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedEmphasizedItem.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedEmphasizedItem.js +14 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedEmphasizedItem.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedItem.d.ts +26 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedItem.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedItem.js +14 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedItem.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageBody.d.ts +32 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageBody.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageBody.js +14 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageBody.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageRequest.d.ts +32 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageRequest.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageRequest.js +14 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageRequest.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/middleware.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/module/api/lineModuleClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/module/api/lineModuleClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/module-attach/api/lineModuleAttachClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/module-attach/api/lineModuleAttachClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/shop/api/shopClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/shop/api/shopClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/utils.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/validate-signature.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/version.d.ts +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/version.js +1 -1
- package/node_modules/@line/bot-sdk/dist/exceptions.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/exceptions.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/http-fetch.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/insight/api/insightClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/liff/api/liffClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/line-bot-client.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/line-bot-client.generated.d.ts +38 -0
- package/node_modules/@line/bot-sdk/dist/line-bot-client.generated.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/line-bot-client.generated.js +46 -0
- package/node_modules/@line/bot-sdk/dist/line-bot-client.generated.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/api/manageAudienceBlobClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/api/manageAudienceBlobClient.js +15 -5
- package/node_modules/@line/bot-sdk/dist/manage-audience/api/manageAudienceBlobClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/api/manageAudienceClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/api/messagingApiBlobClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/api/messagingApiClient.d.ts +39 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/api/messagingApiClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/api/messagingApiClient.js +61 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/api/messagingApiClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/models.d.ts +5 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/models.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/models.js +5 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/models.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpMessagesRequest.d.ts +5 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpMessagesRequest.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedButton.d.ts +26 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedButton.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedButton.js +13 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedButton.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedEmphasizedItem.d.ts +27 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedEmphasizedItem.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedEmphasizedItem.js +13 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedEmphasizedItem.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedItem.d.ts +26 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedItem.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedItem.js +13 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedItem.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageBody.d.ts +32 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageBody.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageBody.js +13 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageBody.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageRequest.d.ts +32 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageRequest.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageRequest.js +13 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageRequest.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/module/api/lineModuleClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/module-attach/api/lineModuleAttachClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/shop/api/shopClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/version.d.ts +1 -1
- package/node_modules/@line/bot-sdk/dist/version.js +1 -1
- package/node_modules/@line/bot-sdk/lib/line-bot-client.generated.ts +68 -0
- package/node_modules/@line/bot-sdk/lib/manage-audience/api/manageAudienceBlobClient.ts +15 -5
- package/node_modules/@line/bot-sdk/lib/messaging-api/.openapi-generator/FILES +5 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/api/messagingApiClient.ts +89 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/models.ts +5 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/pnpMessagesRequest.ts +5 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/pnpTemplatedButton.ts +26 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/pnpTemplatedEmphasizedItem.ts +27 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/pnpTemplatedItem.ts +26 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/pnpTemplatedMessageBody.ts +33 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/pnpTemplatedMessageRequest.ts +33 -0
- package/node_modules/@line/bot-sdk/lib/version.ts +1 -1
- package/node_modules/@line/bot-sdk/node_modules/@types/node/README.md +2 -2
- package/node_modules/@line/bot-sdk/node_modules/@types/node/async_hooks.d.ts +18 -22
- package/node_modules/@line/bot-sdk/node_modules/@types/node/buffer.buffer.d.ts +10 -5
- package/node_modules/@line/bot-sdk/node_modules/@types/node/buffer.d.ts +7 -0
- package/node_modules/@line/bot-sdk/node_modules/@types/node/child_process.d.ts +5 -1
- package/node_modules/@line/bot-sdk/node_modules/@types/node/crypto.d.ts +114 -47
- package/node_modules/@line/bot-sdk/node_modules/@types/node/dgram.d.ts +119 -4
- package/node_modules/@line/bot-sdk/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@line/bot-sdk/node_modules/@types/node/dns.d.ts +6 -6
- package/node_modules/@line/bot-sdk/node_modules/@types/node/events.d.ts +13 -22
- package/node_modules/@line/bot-sdk/node_modules/@types/node/fs/promises.d.ts +79 -66
- package/node_modules/@line/bot-sdk/node_modules/@types/node/fs.d.ts +153 -90
- package/node_modules/@line/bot-sdk/node_modules/@types/node/http.d.ts +94 -2
- package/node_modules/@line/bot-sdk/node_modules/@types/node/http2.d.ts +65 -18
- package/node_modules/@line/bot-sdk/node_modules/@types/node/inspector.d.ts +47 -1
- package/node_modules/@line/bot-sdk/node_modules/@types/node/inspector.generated.d.ts +167 -0
- package/node_modules/@line/bot-sdk/node_modules/@types/node/module.d.ts +1 -0
- package/node_modules/@line/bot-sdk/node_modules/@types/node/net.d.ts +139 -15
- package/node_modules/@line/bot-sdk/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@line/bot-sdk/node_modules/@types/node/package.json +3 -18
- package/node_modules/@line/bot-sdk/node_modules/@types/node/perf_hooks.d.ts +31 -19
- package/node_modules/@line/bot-sdk/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@line/bot-sdk/node_modules/@types/node/sqlite.d.ts +153 -11
- package/node_modules/@line/bot-sdk/node_modules/@types/node/stream/consumers.d.ts +7 -0
- package/node_modules/@line/bot-sdk/node_modules/@types/node/stream/web.d.ts +19 -0
- package/node_modules/@line/bot-sdk/node_modules/@types/node/stream.d.ts +2 -1
- package/node_modules/@line/bot-sdk/node_modules/@types/node/test.d.ts +320 -13
- package/node_modules/@line/bot-sdk/node_modules/@types/node/tls.d.ts +50 -15
- package/node_modules/@line/bot-sdk/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +5 -0
- package/node_modules/@line/bot-sdk/node_modules/@types/node/tty.d.ts +4 -3
- package/node_modules/@line/bot-sdk/node_modules/@types/node/url.d.ts +27 -3
- package/node_modules/@line/bot-sdk/node_modules/@types/node/util.d.ts +42 -2
- package/node_modules/@line/bot-sdk/node_modules/@types/node/v8.d.ts +51 -23
- package/node_modules/@line/bot-sdk/node_modules/@types/node/vm.d.ts +52 -87
- package/node_modules/@line/bot-sdk/node_modules/@types/node/zlib.d.ts +23 -0
- package/node_modules/@line/bot-sdk/node_modules/undici-types/cache-interceptor.d.ts +6 -0
- package/node_modules/@line/bot-sdk/node_modules/undici-types/client.d.ts +15 -0
- package/node_modules/@line/bot-sdk/node_modules/undici-types/connector.d.ts +2 -0
- package/node_modules/@line/bot-sdk/node_modules/undici-types/dispatcher.d.ts +8 -5
- package/node_modules/@line/bot-sdk/node_modules/undici-types/errors.d.ts +17 -1
- package/node_modules/@line/bot-sdk/node_modules/undici-types/index.d.ts +4 -1
- package/node_modules/@line/bot-sdk/node_modules/undici-types/interceptors.d.ts +7 -0
- package/node_modules/@line/bot-sdk/node_modules/undici-types/package.json +1 -1
- package/node_modules/@line/bot-sdk/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
- package/node_modules/@line/bot-sdk/node_modules/undici-types/webidl.d.ts +6 -0
- package/node_modules/@line/bot-sdk/node_modules/undici-types/websocket.d.ts +2 -0
- package/node_modules/@line/bot-sdk/package.json +10 -9
- package/package.json +5 -5
- package/dist/.setup/api-BBSLQek1.mjs +0 -3
- package/dist/.setup/channel.runtime-BEhASjr_.mjs +0 -4
- package/dist/.setup/monitor.runtime-C6Kgs5BI.mjs +0 -2
- package/dist/.setup/outbound.runtime-BwO_m4n5.mjs +0 -3
- package/dist/.setup/probe.runtime-C6LYzOHu.mjs +0 -2
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { n as resolveDefaultLineAccountId, r as resolveLineAccount } from "./accounts-DOiM8-y3.mjs";
|
|
2
|
-
import { a as
|
|
3
|
-
import { a as normalizeLineAllowEntry } from "./setup-surface-
|
|
2
|
+
import { a as parseLineQuestionPostbackData, c as resolveLineGroupConfigEntry, i as isLineQuestionPostbackData, n as createLineQuickReply, o as resolveLineQuestionPostback, r as prepareLineReplyPayload, s as buildLineQuickReplyFallbackText } from "./channel-DVuSrT_i.mjs";
|
|
3
|
+
import { a as normalizeLineAllowEntry } from "./setup-surface-CYd8oqzt.mjs";
|
|
4
4
|
import { t as getLineRuntime } from "./runtime-V7yh9OeC.mjs";
|
|
5
|
-
import { D as
|
|
5
|
+
import { A as resolveLineQuoteToken, D as readLineQuoteToken, E as canCarryLineQuoteToken, M as buildLineMediaMessage, O as recordLineQuoteToken, T as applyLineQuoteToken, k as reportLineQuoteCarrierMissing, n as findLineHttpError, r as resolveLineNonDispatchRetryable, t as explainLineRefusal } from "./send-retry-Dzbkz5wG.mjs";
|
|
6
6
|
import { a as laneKeyFor, i as eventIdFor, n as LINE_WEBHOOK_SPOOL_INVALID_PAYLOAD_MESSAGE, r as LineWebhookPayloadError, t as LINE_WEBHOOK_SPOOL_INVALID_EVENT_REASON } from "./webhook-spool-contract-msjTl60Q.mjs";
|
|
7
|
-
import { a as getUserDisplayName,
|
|
8
|
-
import { n as processLineMessage, t as buildTemplateMessageFromPayload } from "./template-messages-
|
|
7
|
+
import { a as getUserDisplayName, h as quotesLineBotMessage, i as getLineGroupName, l as pushMessageLine, m as showLoadingAnimation, n as createLocationMessage, o as getUserProfile, p as replyMessageLine, t as createFlexMessage, u as pushMessagesLine } from "./send-g4gFsc9W.mjs";
|
|
8
|
+
import { n as processLineMessage, t as buildTemplateMessageFromPayload } from "./template-messages-CwPsGQjw.mjs";
|
|
9
9
|
import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
|
|
10
10
|
import { resolveChannelGroupsConfigPath } from "openclaw/plugin-sdk/channel-policy";
|
|
11
11
|
import { normalizeOptionalString, normalizeStringEntries, readNonEmptyStringPreservingWhitespace } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
12
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
13
13
|
import { firstDefined } from "openclaw/plugin-sdk/allow-from";
|
|
14
14
|
import { DEFAULT_INGRESS_ADOPTION_STALL_MS, DEFAULT_INGRESS_RETRY_MAX_ATTEMPTS, bindIngressLifecycleToReplyOptions, createChannelIngressMonitor, resolveChannelStreamingBlockEnabled } from "openclaw/plugin-sdk/channel-outbound";
|
|
15
|
-
import { buildChannelInboundEventContext, buildMentionRegexes, formatInboundEnvelope, formatInboundMediaUnavailableText, formatLocationText, hasFinalInboundReplyDispatch, implicitMentionKindWhen, isChannelPartialDeliveryError, logInboundDrop, matchesMentionPatterns,
|
|
15
|
+
import { buildChannelInboundEventContext, buildMentionRegexes, formatInboundEnvelope, formatInboundMediaUnavailableText, formatLocationText, hasFinalInboundReplyDispatch, implicitMentionKindWhen, isChannelPartialDeliveryError, logInboundDrop, matchesMentionPatterns, resolveInboundSessionEnvelopeContextAsync, toInboundMediaFactsWithMetadata, toLocationContext } from "openclaw/plugin-sdk/channel-inbound";
|
|
16
16
|
import { collectErrorGraphCandidates, extractErrorCode, formatErrorMessage, readErrorName, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
17
17
|
import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
18
18
|
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
|
|
19
|
-
import {
|
|
19
|
+
import { danger, logVerbose, shouldLogVerbose, waitForAbortSignal, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
20
20
|
import { safeParseJson, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
21
21
|
import { classifyTransientNetworkErrorCode } from "openclaw/plugin-sdk/retry-runtime";
|
|
22
22
|
import { fetchWithRuntimeDispatcherOrMockedGlobal } from "openclaw/plugin-sdk/runtime-fetch";
|
|
@@ -29,7 +29,7 @@ import { canonicalizeWebhookRouteKey, registerWebhookTargetWithPluginRoute, reso
|
|
|
29
29
|
import { beginWebhookRequestPipelineOrReject, createWebhookInFlightLimiter, isRequestBodyLimitError, readRequestBodyWithLimit, requestBodyErrorToText, runDetachedWebhookWork, sendHttpRequestRejection } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
30
30
|
import { chunkMarkdownText } from "openclaw/plugin-sdk/reply-runtime";
|
|
31
31
|
import { resolvePromptHistoryLimit } from "openclaw/plugin-sdk/number-runtime";
|
|
32
|
-
import {
|
|
32
|
+
import { getRuntimeConfigSnapshot, getRuntimeConfigSourceSnapshot, selectApplicableRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
33
33
|
import { fanInChannelIngressLifecycles, resolveChannelImplicitMentions } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
34
34
|
import { reportChannelRoomJoin } from "openclaw/plugin-sdk/channel-join-intro-runtime";
|
|
35
35
|
import { hasControlCommand } from "openclaw/plugin-sdk/command-auth-native";
|
|
@@ -90,7 +90,6 @@ async function deliverLineAutoReply(params) {
|
|
|
90
90
|
const replyVisible = (...args) => sendVisible(() => replyMessageLine(...args));
|
|
91
91
|
const failedPushSegments = /* @__PURE__ */ new WeakMap();
|
|
92
92
|
const pushLineMessages = async (messages, allowFailedBatchTextRecovery, externalTail = []) => {
|
|
93
|
-
if (messages.length === 0) return;
|
|
94
93
|
for (let i = 0; i < messages.length; i += 5) {
|
|
95
94
|
const batch = messages.slice(i, i + 5);
|
|
96
95
|
try {
|
|
@@ -438,7 +437,7 @@ async function finalizeLineInboundContext(params) {
|
|
|
438
437
|
groupId: params.source.groupId,
|
|
439
438
|
roomId: params.source.roomId
|
|
440
439
|
}) : void 0;
|
|
441
|
-
const { storePath, envelopeOptions, previousTimestamp } =
|
|
440
|
+
const { storePath, envelopeOptions, previousTimestamp } = await resolveInboundSessionEnvelopeContextAsync({
|
|
442
441
|
cfg: params.cfg,
|
|
443
442
|
agentId: params.route.agentId,
|
|
444
443
|
sessionKey: params.route.sessionKey
|
|
@@ -564,7 +563,7 @@ async function buildLineMessageContext(params) {
|
|
|
564
563
|
const nativeMediaKind = extractNativeMediaKind(message);
|
|
565
564
|
const mediaFacts = allMedia.length > 0 ? allMedia.map((media) => ({
|
|
566
565
|
...media,
|
|
567
|
-
kind: nativeMediaKind
|
|
566
|
+
kind: nativeMediaKind === "document" && media.contentType?.startsWith("image/") ? "image" : nativeMediaKind
|
|
568
567
|
})) : nativeMediaKind ? [{ kind: nativeMediaKind }] : [];
|
|
569
568
|
const shortfallNotice = params.missingParts ? `[line: ${params.missingParts === 1 ? "1 more image in this send was" : `${params.missingParts} more images in this send were`} not delivered]` : void 0;
|
|
570
569
|
const withShortfall = shortfallNotice ? formatInboundMediaUnavailableText({
|
|
@@ -859,7 +858,7 @@ async function sendLinePairingReply(params) {
|
|
|
859
858
|
await createChannelPairingChallengeIssuer({
|
|
860
859
|
channel: "line",
|
|
861
860
|
accountId: context.account.accountId,
|
|
862
|
-
upsertPairingRequest:
|
|
861
|
+
upsertPairingRequest: ({ id, meta }) => upsertChannelPairingRequest({
|
|
863
862
|
channel: "line",
|
|
864
863
|
id,
|
|
865
864
|
accountId: context.account.accountId,
|
|
@@ -871,7 +870,7 @@ async function sendLinePairingReply(params) {
|
|
|
871
870
|
onCreated: () => {
|
|
872
871
|
logVerbose(`line pairing request sender=${senderId}`);
|
|
873
872
|
},
|
|
874
|
-
sendPairingReply:
|
|
873
|
+
sendPairingReply: (text) => sendLineHandlerText({
|
|
875
874
|
context,
|
|
876
875
|
text,
|
|
877
876
|
replyToken,
|
|
@@ -917,7 +916,7 @@ async function resolveLineEventAdmission(event, context) {
|
|
|
917
916
|
entryIdPrefix: "line-entry"
|
|
918
917
|
},
|
|
919
918
|
cfg,
|
|
920
|
-
readStoreAllowFrom:
|
|
919
|
+
readStoreAllowFrom: () => readChannelAllowFromStore("line", void 0, account.accountId),
|
|
921
920
|
subject: event.type === "join" ? {} : { stableId: senderId },
|
|
922
921
|
conversation: {
|
|
923
922
|
kind: isGroup ? "group" : "direct",
|
|
@@ -1211,6 +1210,7 @@ async function handlePostbackEvent(event, context) {
|
|
|
1211
1210
|
});
|
|
1212
1211
|
return;
|
|
1213
1212
|
}
|
|
1213
|
+
if (isLineQuestionPostbackData(data ?? "")) return;
|
|
1214
1214
|
const postbackContext = await buildLinePostbackContext({
|
|
1215
1215
|
event,
|
|
1216
1216
|
cfg: context.cfg,
|
|
@@ -1311,7 +1311,7 @@ function createLineImageSetIngressBuffer() {
|
|
|
1311
1311
|
}
|
|
1312
1312
|
if (forming.timer) {
|
|
1313
1313
|
clearTimeout(forming.timer);
|
|
1314
|
-
forming.timer = setTimeout(forming.release,
|
|
1314
|
+
forming.timer = setTimeout(forming.release, IMAGE_SET_FLUSH_DELAY_MS);
|
|
1315
1315
|
forming.timer.unref?.();
|
|
1316
1316
|
}
|
|
1317
1317
|
return null;
|
|
@@ -1320,7 +1320,6 @@ function createLineImageSetIngressBuffer() {
|
|
|
1320
1320
|
const pending = {
|
|
1321
1321
|
parts: /* @__PURE__ */ new Map([[input.messageId, part]]),
|
|
1322
1322
|
total: input.total,
|
|
1323
|
-
flushDelayMs: input.flushDelayMs ?? IMAGE_SET_FLUSH_DELAY_MS,
|
|
1324
1323
|
release: () => {
|
|
1325
1324
|
clearTimeout(pending.timer);
|
|
1326
1325
|
release();
|
|
@@ -1334,7 +1333,7 @@ function createLineImageSetIngressBuffer() {
|
|
|
1334
1333
|
}
|
|
1335
1334
|
const carriedMessageIds = carried?.messageIds ?? /* @__PURE__ */ new Set();
|
|
1336
1335
|
const releaseLane = await enterLane(input.laneKey);
|
|
1337
|
-
pending.timer = setTimeout(pending.release,
|
|
1336
|
+
pending.timer = setTimeout(pending.release, IMAGE_SET_FLUSH_DELAY_MS);
|
|
1338
1337
|
pending.timer.unref?.();
|
|
1339
1338
|
if (pending.total !== void 0 && pending.parts.size >= pending.total) pending.release();
|
|
1340
1339
|
await whole;
|
|
@@ -1344,7 +1343,7 @@ function createLineImageSetIngressBuffer() {
|
|
|
1344
1343
|
const missing = pending.total === void 0 ? 0 : pending.total - deliveredMessageIds.size;
|
|
1345
1344
|
if (missing > 0) {
|
|
1346
1345
|
const carry = { messageIds: deliveredMessageIds };
|
|
1347
|
-
carry.timer = setTimeout(() => deliveredBySet.delete(key),
|
|
1346
|
+
carry.timer = setTimeout(() => deliveredBySet.delete(key), IMAGE_SET_FLUSH_DELAY_MS * 5);
|
|
1348
1347
|
carry.timer.unref?.();
|
|
1349
1348
|
deliveredBySet.set(key, carry);
|
|
1350
1349
|
}
|
|
@@ -1388,7 +1387,6 @@ function isLineAuthenticationFailure(error) {
|
|
|
1388
1387
|
const status = error.status;
|
|
1389
1388
|
return status === 401 || status === 403;
|
|
1390
1389
|
}
|
|
1391
|
-
/** The imageSet a LINE inbound event belongs to, when it reported one. */
|
|
1392
1390
|
function senderKeyFor(event) {
|
|
1393
1391
|
const source = event.source;
|
|
1394
1392
|
return source && "userId" in source && source.userId ? `user:${source.userId}` : "anonymous";
|
|
@@ -1607,11 +1605,10 @@ function createLineWebhookSpool(options) {
|
|
|
1607
1605
|
//#region extensions/line/src/bot.ts
|
|
1608
1606
|
const DEFAULT_MEDIA_MAX_MB = 10;
|
|
1609
1607
|
function createLineBot(opts) {
|
|
1610
|
-
const runtime = opts
|
|
1611
|
-
const startupConfig = opts.config ?? getRuntimeConfig();
|
|
1608
|
+
const { runtime, config: startupConfig } = opts;
|
|
1612
1609
|
const startupRuntimeConfig = getRuntimeConfigSnapshot();
|
|
1613
1610
|
const startupRuntimeSourceConfig = getRuntimeConfigSourceSnapshot();
|
|
1614
|
-
const followsRuntimeConfig =
|
|
1611
|
+
const followsRuntimeConfig = startupRuntimeConfig === startupConfig || startupRuntimeSourceConfig !== null && selectApplicableRuntimeConfig({
|
|
1615
1612
|
inputConfig: startupConfig,
|
|
1616
1613
|
runtimeConfig: startupRuntimeConfig,
|
|
1617
1614
|
runtimeSourceConfig: startupRuntimeSourceConfig
|
|
@@ -1621,10 +1618,8 @@ function createLineBot(opts) {
|
|
|
1621
1618
|
cfg: startupConfig,
|
|
1622
1619
|
accountId: opts.accountId
|
|
1623
1620
|
});
|
|
1624
|
-
const
|
|
1625
|
-
const
|
|
1626
|
-
logVerbose("line: no message handler configured");
|
|
1627
|
-
});
|
|
1621
|
+
const configuredMediaMaxMb = account.config.mediaMaxMb;
|
|
1622
|
+
const mediaMaxBytes = (typeof configuredMediaMaxMb === "number" && configuredMediaMaxMb > 0 ? configuredMediaMaxMb : DEFAULT_MEDIA_MAX_MB) * 1024 * 1024;
|
|
1628
1623
|
const groupHistories = /* @__PURE__ */ new Map();
|
|
1629
1624
|
const spool = createLineWebhookSpool({
|
|
1630
1625
|
accountId: account.accountId,
|
|
@@ -1637,7 +1632,7 @@ function createLineBot(opts) {
|
|
|
1637
1632
|
runtime,
|
|
1638
1633
|
buildContext: opts.buildContext,
|
|
1639
1634
|
mediaMaxBytes,
|
|
1640
|
-
processMessage,
|
|
1635
|
+
processMessage: opts.onMessage,
|
|
1641
1636
|
...control.turnAdoptionLifecycle ? { turnAdoptionLifecycle: control.turnAdoptionLifecycle } : {},
|
|
1642
1637
|
...control.missingParts === void 0 ? {} : { missingParts: control.missingParts },
|
|
1643
1638
|
groupHistories,
|
|
@@ -1654,14 +1649,11 @@ function createLineBot(opts) {
|
|
|
1654
1649
|
}
|
|
1655
1650
|
//#endregion
|
|
1656
1651
|
//#region extensions/line/src/monitor-durable.ts
|
|
1657
|
-
function hasLineChannelData(payload) {
|
|
1658
|
-
const lineData = payload.channelData?.line;
|
|
1659
|
-
return Boolean(lineData && Object.keys(lineData).length > 0);
|
|
1660
|
-
}
|
|
1661
1652
|
function resolveLineDurableReplyOptions(params) {
|
|
1662
1653
|
if (params.infoKind !== "final") return false;
|
|
1663
1654
|
if (params.replyToken && !params.replyTokenUsed) return false;
|
|
1664
|
-
|
|
1655
|
+
const lineData = params.payload.channelData?.line;
|
|
1656
|
+
if (lineData && Object.keys(lineData).length > 0) return false;
|
|
1665
1657
|
const reply = resolveSendableOutboundReplyParts(params.payload);
|
|
1666
1658
|
if (reply.hasMedia || !reply.hasText) return false;
|
|
1667
1659
|
return { to: params.to };
|
|
@@ -1674,10 +1666,9 @@ function validateLineSignature(body, signature, channelSecret) {
|
|
|
1674
1666
|
}
|
|
1675
1667
|
//#endregion
|
|
1676
1668
|
//#region extensions/line/src/webhook-node.ts
|
|
1677
|
-
const LINE_WEBHOOK_MAX_BODY_BYTES = 1048576;
|
|
1678
1669
|
const LINE_WEBHOOK_PREAUTH_MAX_BODY_BYTES = 65536;
|
|
1679
1670
|
const LINE_WEBHOOK_PREAUTH_BODY_TIMEOUT_MS = 5e3;
|
|
1680
|
-
async function readLineWebhookRequestBody(req, maxBytes
|
|
1671
|
+
async function readLineWebhookRequestBody(req, maxBytes, timeoutMs) {
|
|
1681
1672
|
return await readRequestBodyWithLimit(req, {
|
|
1682
1673
|
maxBytes,
|
|
1683
1674
|
timeoutMs,
|
|
@@ -1702,7 +1693,6 @@ function sendLineWebhookJson(res, statusCode, body) {
|
|
|
1702
1693
|
res.end(JSON.stringify(body));
|
|
1703
1694
|
}
|
|
1704
1695
|
function createLineNodeWebhookHandler(params) {
|
|
1705
|
-
const maxBodyBytes = params.maxBodyBytes ?? LINE_WEBHOOK_MAX_BODY_BYTES;
|
|
1706
1696
|
const readBody = params.readBody ?? readLineWebhookRequestBody;
|
|
1707
1697
|
return async (req, res) => {
|
|
1708
1698
|
const targets = params.getTargets();
|
|
@@ -1735,7 +1725,7 @@ function createLineNodeWebhookHandler(params) {
|
|
|
1735
1725
|
sendLineWebhookJson(res, 400, { error: "Missing X-Line-Signature header" });
|
|
1736
1726
|
return;
|
|
1737
1727
|
}
|
|
1738
|
-
const rawBody = await readBody(req,
|
|
1728
|
+
const rawBody = await readBody(req, LINE_WEBHOOK_PREAUTH_MAX_BODY_BYTES, LINE_WEBHOOK_PREAUTH_BODY_TIMEOUT_MS);
|
|
1739
1729
|
const match = resolveSingleWebhookTarget(targets, (target) => validateLineSignature(rawBody, signature, target.channelSecret));
|
|
1740
1730
|
if (match.kind === "none") {
|
|
1741
1731
|
logVerbose("line: webhook signature validation failed");
|
|
@@ -1781,29 +1771,19 @@ function resolveLineWebhookPath(webhookPath) {
|
|
|
1781
1771
|
//#endregion
|
|
1782
1772
|
//#region extensions/line/src/monitor.ts
|
|
1783
1773
|
const lineWebhookInFlightLimiter = createWebhookInFlightLimiter();
|
|
1784
|
-
async function registerLineWebhookTarget(params, bot) {
|
|
1785
|
-
try {
|
|
1786
|
-
return registerWebhookTargetWithPluginRoute(params);
|
|
1787
|
-
} catch (error) {
|
|
1788
|
-
await Promise.allSettled([bot.stop()]);
|
|
1789
|
-
throw error;
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
1774
|
const lineWebhookTargets = /* @__PURE__ */ new Map();
|
|
1793
1775
|
function startLineLoadingKeepalive(params) {
|
|
1794
|
-
const intervalMs = params.intervalMs ?? 18e3;
|
|
1795
|
-
const loadingSeconds = params.loadingSeconds ?? 20;
|
|
1796
1776
|
let stopped = false;
|
|
1797
1777
|
const trigger = () => {
|
|
1798
1778
|
if (stopped) return;
|
|
1799
1779
|
showLoadingAnimation(params.userId, {
|
|
1800
1780
|
cfg: params.cfg,
|
|
1801
1781
|
accountId: params.accountId,
|
|
1802
|
-
loadingSeconds
|
|
1782
|
+
loadingSeconds: 20
|
|
1803
1783
|
}).catch(() => {});
|
|
1804
1784
|
};
|
|
1805
1785
|
trigger();
|
|
1806
|
-
const timer = setInterval(trigger,
|
|
1786
|
+
const timer = setInterval(trigger, 18e3);
|
|
1807
1787
|
return () => {
|
|
1808
1788
|
if (stopped) return;
|
|
1809
1789
|
stopped = true;
|
|
@@ -1823,7 +1803,6 @@ async function monitorLineProvider(opts) {
|
|
|
1823
1803
|
buildContext,
|
|
1824
1804
|
config,
|
|
1825
1805
|
onMessage: async (ctx, deliveryControl) => {
|
|
1826
|
-
if (!ctx) return;
|
|
1827
1806
|
const { ctxPayload, replyToken, route } = ctx;
|
|
1828
1807
|
const turnConfig = deliveryControl.cfg;
|
|
1829
1808
|
const stopLoading = Boolean(ctx.userId && !ctx.isGroup) ? startLineLoadingKeepalive({
|
|
@@ -1935,42 +1914,48 @@ async function monitorLineProvider(opts) {
|
|
|
1935
1914
|
getTargets: () => lineWebhookTargets.get(webhookRouteKey) ?? [],
|
|
1936
1915
|
runtime
|
|
1937
1916
|
});
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1917
|
+
let unregisterHttp;
|
|
1918
|
+
try {
|
|
1919
|
+
({unregister: unregisterHttp} = registerWebhookTargetWithPluginRoute({
|
|
1920
|
+
targetsByPath: lineWebhookTargets,
|
|
1921
|
+
target: {
|
|
1922
|
+
accountId: resolvedAccountId,
|
|
1923
|
+
bot,
|
|
1924
|
+
channelSecret: secret,
|
|
1925
|
+
path: normalizedPath,
|
|
1926
|
+
runtime
|
|
1927
|
+
},
|
|
1928
|
+
route: {
|
|
1929
|
+
auth: "plugin",
|
|
1930
|
+
pluginId: "line",
|
|
1931
|
+
source: "line-webhook",
|
|
1932
|
+
accountId: resolvedAccountId,
|
|
1933
|
+
log: (msg) => logVerbose(msg),
|
|
1934
|
+
throwOnFailure: true,
|
|
1935
|
+
handler: async (req, res) => {
|
|
1936
|
+
if (req.method !== "POST") {
|
|
1937
|
+
await handleWebhook(req, res);
|
|
1938
|
+
return;
|
|
1939
|
+
}
|
|
1940
|
+
const requestLifecycle = beginWebhookRequestPipelineOrReject({
|
|
1941
|
+
req,
|
|
1942
|
+
res,
|
|
1943
|
+
inFlightLimiter: lineWebhookInFlightLimiter,
|
|
1944
|
+
inFlightKey: `line:${webhookRouteKey}`
|
|
1945
|
+
});
|
|
1946
|
+
if (!requestLifecycle.ok) return;
|
|
1947
|
+
try {
|
|
1948
|
+
await handleWebhook(req, res);
|
|
1949
|
+
} finally {
|
|
1950
|
+
requestLifecycle.release();
|
|
1951
|
+
}
|
|
1970
1952
|
}
|
|
1971
1953
|
}
|
|
1972
|
-
}
|
|
1973
|
-
}
|
|
1954
|
+
}));
|
|
1955
|
+
} catch (error) {
|
|
1956
|
+
await Promise.allSettled([bot.stop()]);
|
|
1957
|
+
throw error;
|
|
1958
|
+
}
|
|
1974
1959
|
logVerbose(`line: registered webhook handler at ${normalizedPath}`);
|
|
1975
1960
|
statusSink?.(channelReadyPatch());
|
|
1976
1961
|
let stopped = false;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { c as pushLocationMessage, d as pushTemplateMessage, f as pushTextMessageWithQuickReplies, l as pushMessageLine, n as createLocationMessage, r as createQuickReplyItems, s as pushFlexMessage, t as createFlexMessage, u as pushMessagesLine } from "./send-g4gFsc9W.mjs";
|
|
2
|
+
import { n as processLineMessage, t as buildTemplateMessageFromPayload } from "./template-messages-CwPsGQjw.mjs";
|
|
3
|
+
export { buildTemplateMessageFromPayload, createFlexMessage, createLocationMessage, createQuickReplyItems, processLineMessage, pushFlexMessage, pushLocationMessage, pushMessageLine, pushMessagesLine, pushTemplateMessage, pushTextMessageWithQuickReplies };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { r as resolveLineAccount } from "./accounts-DOiM8-y3.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { M as buildLineMediaMessage, T as applyLineQuoteToken, i as runLinePushWithRetries, j as withoutLineQuoteTokens, n as findLineHttpError, o as resolveLineChannelAccessToken, v as messageAction, y as normalizeLineMessage } from "./send-retry-Dzbkz5wG.mjs";
|
|
3
|
+
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
3
4
|
import { createChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
|
|
4
5
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
5
6
|
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -10,6 +11,8 @@ import { fetchWithRuntimeDispatcherOrMockedGlobal } from "openclaw/plugin-sdk/ru
|
|
|
10
11
|
import { randomUUID } from "node:crypto";
|
|
11
12
|
import lineBotSdkPackage from "@line/bot-sdk/package.json" with { type: "json" };
|
|
12
13
|
import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
|
|
14
|
+
import { captureEffectAuthority } from "openclaw/plugin-sdk/fetch-runtime";
|
|
15
|
+
import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
|
|
13
16
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
14
17
|
import { createDedupeCache } from "openclaw/plugin-sdk/dedupe-runtime";
|
|
15
18
|
//#region extensions/line/src/outbound-message-log.ts
|
|
@@ -34,6 +37,23 @@ function quotesLineBotMessage(accountId, quotedMessageId) {
|
|
|
34
37
|
return recentSentByAccount.get(accountId)?.peek(quotedMessageId) ?? false;
|
|
35
38
|
}
|
|
36
39
|
//#endregion
|
|
40
|
+
//#region extensions/line/src/send-receipt.ts
|
|
41
|
+
function createLineSendReceipt(params) {
|
|
42
|
+
const messageIds = (params.messageIds ?? [params.messageId]).map((messageId) => messageId.trim()).filter(Boolean);
|
|
43
|
+
const chatId = params.chatId.trim();
|
|
44
|
+
return createMessageReceiptFromOutboundResults({
|
|
45
|
+
results: messageIds.map((messageId) => ({
|
|
46
|
+
channel: "line",
|
|
47
|
+
messageId,
|
|
48
|
+
chatId,
|
|
49
|
+
conversationId: chatId,
|
|
50
|
+
meta: { messageCount: params.messageCount ?? 1 }
|
|
51
|
+
})),
|
|
52
|
+
...chatId ? { threadId: chatId } : {},
|
|
53
|
+
kind: params.kind ?? "unknown"
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
37
57
|
//#region extensions/line/src/send.ts
|
|
38
58
|
const profileCache = {
|
|
39
59
|
values: /* @__PURE__ */ new Map(),
|
|
@@ -112,42 +132,47 @@ function resolveLineMessagingAccount(opts) {
|
|
|
112
132
|
token: resolveLineChannelAccessToken(opts.channelAccessToken, account)
|
|
113
133
|
};
|
|
114
134
|
}
|
|
115
|
-
async function sendLineProviderMessages(operation, token, request, retryKey, authorize) {
|
|
135
|
+
async function sendLineProviderMessages(operation, token, request, retryKey, authorize, assertDirectAdapterHandoff) {
|
|
116
136
|
try {
|
|
117
|
-
return await postLineProviderMessages(operation, token, request, retryKey, authorize);
|
|
137
|
+
return await postLineProviderMessages(operation, token, request, retryKey, authorize, assertDirectAdapterHandoff);
|
|
118
138
|
} catch (error) {
|
|
119
139
|
const unquoted = findLineHttpError(error)?.status === 400 ? withoutLineQuoteTokens(request.messages) : void 0;
|
|
120
140
|
if (!unquoted) throw error;
|
|
121
141
|
return await postLineProviderMessages(operation, token, {
|
|
122
142
|
...request,
|
|
123
143
|
messages: unquoted
|
|
124
|
-
}, retryKey, authorize);
|
|
144
|
+
}, retryKey, authorize, assertDirectAdapterHandoff);
|
|
125
145
|
}
|
|
126
146
|
}
|
|
127
|
-
async function postLineProviderMessages(operation, token, request, retryKey, authorize) {
|
|
147
|
+
async function postLineProviderMessages(operation, token, request, retryKey, authorize, assertDirectAdapterHandoff) {
|
|
148
|
+
const effect = captureEffectAuthority();
|
|
128
149
|
const requestBody = JSON.stringify(request);
|
|
129
150
|
if (authorize) {
|
|
130
151
|
const authorized = authorize();
|
|
131
152
|
if (!(typeof authorized === "boolean" ? authorized : await authorized)) throw new Error("LINE send authorization denied");
|
|
132
153
|
}
|
|
133
|
-
const response = await
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
154
|
+
const response = await effect.initiate(() => {
|
|
155
|
+
assertDirectAdapterHandoff?.();
|
|
156
|
+
return fetchWithRuntimeDispatcherOrMockedGlobal(`https://api.line.me/v2/bot/message/${operation}`, {
|
|
157
|
+
method: "POST",
|
|
158
|
+
headers: {
|
|
159
|
+
"Content-Type": "application/json",
|
|
160
|
+
Authorization: `Bearer ${token}`,
|
|
161
|
+
"User-Agent": `@line/bot-sdk/${lineBotSdkPackage.version}`,
|
|
162
|
+
...retryKey ? { "X-Line-Retry-Key": retryKey } : {}
|
|
163
|
+
},
|
|
164
|
+
body: requestBody
|
|
165
|
+
});
|
|
142
166
|
});
|
|
143
167
|
const acceptedRetryConflict = retryKey !== void 0 && response.status === 409;
|
|
144
168
|
if (!response.ok && !acceptedRetryConflict) {
|
|
145
169
|
const body = await readResponseTextLimited(response, LINE_PROVIDER_RESPONSE_MAX_BYTES).catch(() => "");
|
|
170
|
+
const redactedBody = redactToolPayloadText(body);
|
|
146
171
|
throw new HTTPFetchError(`${response.status} - ${response.statusText}`, {
|
|
147
172
|
status: response.status,
|
|
148
173
|
statusText: response.statusText,
|
|
149
174
|
headers: response.headers,
|
|
150
|
-
body
|
|
175
|
+
body: redactedBody
|
|
151
176
|
});
|
|
152
177
|
}
|
|
153
178
|
try {
|
|
@@ -159,17 +184,11 @@ async function postLineProviderMessages(operation, token, request, retryKey, aut
|
|
|
159
184
|
});
|
|
160
185
|
}
|
|
161
186
|
}
|
|
162
|
-
function
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
function locationTextFallback(location) {
|
|
166
|
-
return {
|
|
187
|
+
function createLocationMessage(location) {
|
|
188
|
+
if (!location.title.trim() || !location.address.trim()) return {
|
|
167
189
|
type: "text",
|
|
168
190
|
text: [...[location.title, location.address].map((label) => truncateUtf16Safe(label.trim(), LINE_LOCATION_LABEL_LIMIT)).filter(Boolean), `${location.latitude}, ${location.longitude}`].join("\n")
|
|
169
191
|
};
|
|
170
|
-
}
|
|
171
|
-
function createLocationMessage(location) {
|
|
172
|
-
if (!isValidLineLocation(location)) return locationTextFallback(location);
|
|
173
192
|
return {
|
|
174
193
|
type: "location",
|
|
175
194
|
title: truncateUtf16Safe(location.title, LINE_LOCATION_LABEL_LIMIT),
|
|
@@ -221,7 +240,7 @@ async function pushLineMessages(to, messages, opts, behavior = {}) {
|
|
|
221
240
|
return await sendLineProviderMessages("push", token, {
|
|
222
241
|
to: chatId,
|
|
223
242
|
messages: normalizedMessages
|
|
224
|
-
}, retryKey, opts.authorize);
|
|
243
|
+
}, retryKey, opts.authorize, opts.assertDirectAdapterHandoff);
|
|
225
244
|
} catch (err) {
|
|
226
245
|
if (behavior.errorContext) logLineHttpError(err, behavior.errorContext);
|
|
227
246
|
throw err;
|
|
@@ -248,17 +267,7 @@ async function pushLineMessages(to, messages, opts, behavior = {}) {
|
|
|
248
267
|
}
|
|
249
268
|
return result;
|
|
250
269
|
}
|
|
251
|
-
async function
|
|
252
|
-
const { account, token } = resolveLineMessagingAccount(opts);
|
|
253
|
-
return {
|
|
254
|
-
...resolveLineProviderMessageIds(await sendLineProviderMessages("reply", token, {
|
|
255
|
-
replyToken,
|
|
256
|
-
messages: applyLineQuoteToken(messages, opts.quoteToken).map(normalizeLineMessage)
|
|
257
|
-
}, void 0, opts.authorize), "reply"),
|
|
258
|
-
accountId: account.accountId
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
async function sendMessageLine(to, text, opts) {
|
|
270
|
+
async function pushMessageLine(to, text, opts) {
|
|
262
271
|
const chatId = normalizeTarget(to);
|
|
263
272
|
const messages = [];
|
|
264
273
|
const mediaUrl = opts.mediaUrl?.trim();
|
|
@@ -272,38 +281,15 @@ async function sendMessageLine(to, text, opts) {
|
|
|
272
281
|
type: "text",
|
|
273
282
|
text: text.trim()
|
|
274
283
|
});
|
|
275
|
-
if (messages.length === 0) throw new Error("Message must be non-empty for LINE sends");
|
|
276
|
-
if (opts.replyToken) {
|
|
277
|
-
const { messageId, messageIds, accountId } = await replyLineMessages(opts.replyToken, messages, opts);
|
|
278
|
-
const result = {
|
|
279
|
-
messageId,
|
|
280
|
-
chatId,
|
|
281
|
-
receipt: createLineSendReceipt({
|
|
282
|
-
messageId,
|
|
283
|
-
messageIds,
|
|
284
|
-
chatId,
|
|
285
|
-
kind: resolveLineReceiptKind(messages),
|
|
286
|
-
messageCount: messages.length
|
|
287
|
-
})
|
|
288
|
-
};
|
|
289
|
-
recordLineOutboundActivity(accountId, {
|
|
290
|
-
messageIds,
|
|
291
|
-
receipt: result.receipt
|
|
292
|
-
});
|
|
293
|
-
if (opts.verbose) logVerbose(`line: replied to ${chatId}`);
|
|
294
|
-
return result;
|
|
295
|
-
}
|
|
296
284
|
return pushLineMessages(chatId, messages, opts, { verboseMessage: (resolvedChatId) => `line: pushed message to ${resolvedChatId}` });
|
|
297
285
|
}
|
|
298
|
-
async function pushMessageLine(to, text, opts) {
|
|
299
|
-
return sendMessageLine(to, text, {
|
|
300
|
-
...opts,
|
|
301
|
-
replyToken: void 0
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
286
|
async function replyMessageLine(replyToken, messages, opts) {
|
|
305
|
-
const {
|
|
306
|
-
|
|
287
|
+
const { account, token } = resolveLineMessagingAccount(opts);
|
|
288
|
+
const { messageIds } = resolveLineProviderMessageIds(await sendLineProviderMessages("reply", token, {
|
|
289
|
+
replyToken,
|
|
290
|
+
messages: applyLineQuoteToken(messages, opts.quoteToken).map(normalizeLineMessage)
|
|
291
|
+
}, void 0, opts.authorize, opts.assertDirectAdapterHandoff), "reply");
|
|
292
|
+
recordLineOutboundActivity(account.accountId, { messageIds });
|
|
307
293
|
if (opts.verbose) logVerbose(`line: replied with ${messages.length} messages`);
|
|
308
294
|
}
|
|
309
295
|
async function pushMessagesLine(to, messages, opts) {
|
|
@@ -369,7 +355,6 @@ function fetchLineMemberProfile(client, userId, scope) {
|
|
|
369
355
|
return client.getProfile(userId);
|
|
370
356
|
}
|
|
371
357
|
async function getUserProfile(userId, opts) {
|
|
372
|
-
const useCache = opts.useCache ?? true;
|
|
373
358
|
try {
|
|
374
359
|
const { account, token } = resolveLineMessagingAccount(opts);
|
|
375
360
|
const cacheKey = lineProfileCacheKey(account.accountId, userId, opts);
|
|
@@ -385,11 +370,6 @@ async function getUserProfile(userId, opts) {
|
|
|
385
370
|
return null;
|
|
386
371
|
}
|
|
387
372
|
};
|
|
388
|
-
if (!useCache) {
|
|
389
|
-
const profile = await load();
|
|
390
|
-
rememberLineIdentity(profileCache, cacheKey, profile);
|
|
391
|
-
return profile;
|
|
392
|
-
}
|
|
393
373
|
return await loadLineIdentity(profileCache, cacheKey, load);
|
|
394
374
|
} catch (err) {
|
|
395
375
|
logVerbose(`line: failed to fetch profile for ${userId}: ${String(err)}`);
|
|
@@ -421,4 +401,4 @@ async function getLineGroupName(groupId, opts) {
|
|
|
421
401
|
}
|
|
422
402
|
}
|
|
423
403
|
//#endregion
|
|
424
|
-
export { getUserDisplayName as a, pushLocationMessage as c, pushTemplateMessage as d, pushTextMessageWithQuickReplies as f, quotesLineBotMessage as
|
|
404
|
+
export { getUserDisplayName as a, pushLocationMessage as c, pushTemplateMessage as d, pushTextMessageWithQuickReplies as f, quotesLineBotMessage as h, getLineGroupName as i, pushMessageLine as l, showLoadingAnimation as m, createLocationMessage as n, getUserProfile as o, replyMessageLine as p, createQuickReplyItems as r, pushFlexMessage as s, createFlexMessage as t, pushMessagesLine as u };
|