@openclaw/line 2026.7.2-beta.4 → 2026.7.2-beta.7
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/README.md +1 -1
- package/dist/accounts-BqEVsDoB.js +103 -0
- package/dist/api.js +2 -2
- package/dist/{card-command-Ch0TwcDW.js → card-command-ty11OJNt.js} +1 -2
- package/dist/{channel-CNcv74n2.js → channel-D4i_K4fQ.js} +9 -9
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel.runtime-BdhK8Xw7.js +4 -0
- package/dist/contract-api.js +1 -1
- package/dist/flex-templates-iKJsyCq-.js +1339 -0
- package/dist/index.js +1 -1
- package/dist/{markdown-to-line-DWIdzBfy.js → markdown-to-line-DMDQTMhx.js} +27 -12
- package/dist/{monitor-BinAXvIY.js → monitor-DXEodYFJ.js} +63 -106
- package/dist/monitor.runtime-CZquR7jI.js +2 -0
- package/dist/{outbound.runtime-DRyoVa81.js → outbound.runtime-BS0IhU_M.js} +1 -1
- package/dist/{probe-BslD77tJ.js → probe-CM03wo6r.js} +7 -9
- package/dist/probe.runtime-D13ZtXsd.js +2 -0
- package/dist/{reply-payload-transform-d57WYHFm.js → reply-payload-transform-D5-dHB8b.js} +1 -1
- package/dist/runtime-api.js +9 -9
- package/dist/setup-api.js +1 -1
- package/dist/{setup-surface-Bili5gWy.js → setup-surface-DRQ7n0En.js} +93 -129
- package/package.json +4 -5
- package/dist/accounts-BUBOoW5Q.js +0 -169
- package/dist/basic-cards-Rb-Ow7LN.js +0 -307
- package/dist/channel.runtime-BBCZvRa_.js +0 -4
- package/dist/flex-templates-KiKaVYgi.js +0 -813
- package/dist/monitor.runtime-DKj4FHkA.js +0 -2
- package/dist/probe.runtime-CRhVGqwl.js +0 -2
- package/npm-shrinkwrap.json +0 -60
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/LICENSE +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/README.md +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/assert/strict.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/assert.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/async_hooks.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/buffer.buffer.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/buffer.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/child_process.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/cluster.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/compatibility/iterators.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/console.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/constants.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/crypto.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/dgram.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/diagnostics_channel.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/dns/promises.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/dns.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/domain.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/events.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/fs/promises.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/fs.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/globals.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/globals.typedarray.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/http.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/http2.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/https.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/index.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/inspector.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/inspector.generated.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/module.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/net.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/os.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/package.json +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/path.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/perf_hooks.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/process.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/punycode.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/querystring.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/readline/promises.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/readline.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/repl.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/sea.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/sqlite.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/stream/consumers.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/stream/promises.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/stream/web.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/stream.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/string_decoder.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/test.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/timers/promises.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/timers.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/tls.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/trace_events.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.6/buffer.buffer.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.6/compatibility/float16array.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.6/globals.typedarray.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.6/index.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.7/compatibility/float16array.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.7/index.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/tty.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/url.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/util.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/v8.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/vm.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/wasi.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/abortcontroller.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/crypto.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/domexception.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/events.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/fetch.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/navigator.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/storage.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/streams.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/worker_threads.d.ts +0 -0
- /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/zlib.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/LICENSE +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/README.md +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/agent.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/api.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/balanced-pool.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/cache-interceptor.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/cache.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/client-stats.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/client.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/connector.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/content-type.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/cookies.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/diagnostics-channel.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/dispatcher.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/env-http-proxy-agent.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/errors.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/eventsource.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/fetch.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/formdata.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/global-dispatcher.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/global-origin.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/h2c-client.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/handlers.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/header.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/index.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/interceptors.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-agent.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-call-history.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-client.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-errors.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-interceptor.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-pool.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/package.json +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/patch.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/pool-stats.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/pool.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/proxy-agent.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/readable.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/retry-agent.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/retry-handler.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/round-robin-pool.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/snapshot-agent.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/util.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/utility.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/webidl.d.ts +0 -0
- /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/websocket.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
|
4
4
|
function createLineCardCommandLoader(api) {
|
|
5
5
|
return createLazyRuntimeModule(async () => {
|
|
6
6
|
let registered = null;
|
|
7
|
-
const { registerLineCardCommand } = await import("./card-command-
|
|
7
|
+
const { registerLineCardCommand } = await import("./card-command-ty11OJNt.js");
|
|
8
8
|
registerLineCardCommand({
|
|
9
9
|
...api,
|
|
10
10
|
registerCommand(command) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as resolveLineAccount } from "./accounts-
|
|
1
|
+
import { i as resolveLineAccount } from "./accounts-BqEVsDoB.js";
|
|
2
2
|
import { a as validateLineMediaUrl, t as createLineSendReceipt } from "./send-receipt-CY2ey8XH.js";
|
|
3
|
-
import {
|
|
3
|
+
import { _ as postbackAction, g as normalizeLineMessageActions, h as normalizeLineAction, m as messageAction, o as createReceiptCard, v as uriAction } from "./flex-templates-iKJsyCq-.js";
|
|
4
4
|
import { markdownToIRWithMeta, stripMarkdown, stripMarkdown as stripMarkdown$1 } from "openclaw/plugin-sdk/text-chunking";
|
|
5
5
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
6
6
|
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -54,6 +54,19 @@ function formatProductCarouselText(description, price) {
|
|
|
54
54
|
const descriptionText = truncateTemplateText(description, Math.max(0, COMPACT_TEMPLATE_TEXT_LIMIT - priceText.length - 1));
|
|
55
55
|
return descriptionText ? `${descriptionText}\n${priceText}` : priceText;
|
|
56
56
|
}
|
|
57
|
+
function normalizeCarouselColumnActions(column) {
|
|
58
|
+
return {
|
|
59
|
+
...column,
|
|
60
|
+
actions: column.actions.map((action) => normalizeLineAction(action)),
|
|
61
|
+
defaultAction: column.defaultAction === void 0 ? void 0 : normalizeLineAction(column.defaultAction)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function normalizeImageCarouselColumnAction(column) {
|
|
65
|
+
return {
|
|
66
|
+
...column,
|
|
67
|
+
action: normalizeLineAction(column.action, 12)
|
|
68
|
+
};
|
|
69
|
+
}
|
|
57
70
|
/**
|
|
58
71
|
* Create a confirm template (yes/no style dialog)
|
|
59
72
|
*/
|
|
@@ -61,7 +74,7 @@ function createConfirmTemplate(text, confirmAction, cancelAction, altText) {
|
|
|
61
74
|
const template = {
|
|
62
75
|
type: "confirm",
|
|
63
76
|
text: truncateTemplateText(text, 240),
|
|
64
|
-
actions: [confirmAction, cancelAction]
|
|
77
|
+
actions: [normalizeLineAction(confirmAction), normalizeLineAction(cancelAction)]
|
|
65
78
|
};
|
|
66
79
|
return {
|
|
67
80
|
type: "template",
|
|
@@ -83,12 +96,12 @@ function createButtonTemplate(title, text, actions, options) {
|
|
|
83
96
|
type: "buttons",
|
|
84
97
|
...normalizedTitle ? { title: truncateTemplateText(normalizedTitle, 40) } : {},
|
|
85
98
|
text: truncateTemplateText(text, textLimit),
|
|
86
|
-
actions: actions.slice(0, 4),
|
|
99
|
+
actions: actions.slice(0, 4).map((action) => normalizeLineAction(action)),
|
|
87
100
|
thumbnailImageUrl: options?.thumbnailImageUrl,
|
|
88
101
|
imageAspectRatio: options?.imageAspectRatio ?? "rectangle",
|
|
89
102
|
imageSize: options?.imageSize ?? "cover",
|
|
90
103
|
imageBackgroundColor: options?.imageBackgroundColor,
|
|
91
|
-
defaultAction: options?.defaultAction
|
|
104
|
+
defaultAction: options?.defaultAction === void 0 ? void 0 : normalizeLineAction(options.defaultAction)
|
|
92
105
|
};
|
|
93
106
|
return {
|
|
94
107
|
type: "template",
|
|
@@ -102,7 +115,7 @@ function createButtonTemplate(title, text, actions, options) {
|
|
|
102
115
|
function createTemplateCarousel(columns, options) {
|
|
103
116
|
const template = {
|
|
104
117
|
type: "carousel",
|
|
105
|
-
columns: columns.slice(0, 10),
|
|
118
|
+
columns: columns.slice(0, 10).map(normalizeCarouselColumnActions),
|
|
106
119
|
imageAspectRatio: options?.imageAspectRatio ?? "rectangle",
|
|
107
120
|
imageSize: options?.imageSize ?? "cover"
|
|
108
121
|
};
|
|
@@ -123,10 +136,10 @@ function createCarouselColumn(params) {
|
|
|
123
136
|
return {
|
|
124
137
|
title: truncateOptionalTemplateText(params.title, 40),
|
|
125
138
|
text: truncateTemplateText(params.text, textLimit),
|
|
126
|
-
actions: params.actions.slice(0, 3),
|
|
139
|
+
actions: params.actions.slice(0, 3).map((action) => normalizeLineAction(action)),
|
|
127
140
|
thumbnailImageUrl: params.thumbnailImageUrl,
|
|
128
141
|
imageBackgroundColor: params.imageBackgroundColor,
|
|
129
|
-
defaultAction: params.defaultAction
|
|
142
|
+
defaultAction: params.defaultAction === void 0 ? void 0 : normalizeLineAction(params.defaultAction)
|
|
130
143
|
};
|
|
131
144
|
}
|
|
132
145
|
/**
|
|
@@ -135,7 +148,7 @@ function createCarouselColumn(params) {
|
|
|
135
148
|
function createImageCarousel(columns, altText) {
|
|
136
149
|
const template = {
|
|
137
150
|
type: "image_carousel",
|
|
138
|
-
columns: columns.slice(0, 10)
|
|
151
|
+
columns: columns.slice(0, 10).map(normalizeImageCarouselColumnAction)
|
|
139
152
|
};
|
|
140
153
|
return {
|
|
141
154
|
type: "template",
|
|
@@ -149,7 +162,7 @@ function createImageCarousel(columns, altText) {
|
|
|
149
162
|
function createImageCarouselColumn(imageUrl, action) {
|
|
150
163
|
return {
|
|
151
164
|
imageUrl,
|
|
152
|
-
action
|
|
165
|
+
action: normalizeLineAction(action, 12)
|
|
153
166
|
};
|
|
154
167
|
}
|
|
155
168
|
/**
|
|
@@ -331,9 +344,10 @@ function resolveLineReceiptKind(messages) {
|
|
|
331
344
|
async function pushLineMessages(to, messages, opts, behavior = {}) {
|
|
332
345
|
if (messages.length === 0) throw new Error("Message must be non-empty for LINE sends");
|
|
333
346
|
const { account, client, chatId } = createLinePushContext(to, opts);
|
|
347
|
+
const normalizedMessages = messages.map(normalizeLineMessageActions);
|
|
334
348
|
const pushRequest = client.pushMessage({
|
|
335
349
|
to: chatId,
|
|
336
|
-
messages
|
|
350
|
+
messages: normalizedMessages
|
|
337
351
|
});
|
|
338
352
|
if (behavior.errorContext) await pushRequest.catch((err) => {
|
|
339
353
|
logLineHttpError(err, behavior.errorContext);
|
|
@@ -355,9 +369,10 @@ async function pushLineMessages(to, messages, opts, behavior = {}) {
|
|
|
355
369
|
}
|
|
356
370
|
async function replyLineMessages(replyToken, messages, opts, behavior = {}) {
|
|
357
371
|
const { account, client } = createLineMessagingClient(opts);
|
|
372
|
+
const normalizedMessages = messages.map(normalizeLineMessageActions);
|
|
358
373
|
await client.replyMessage({
|
|
359
374
|
replyToken,
|
|
360
|
-
messages
|
|
375
|
+
messages: normalizedMessages
|
|
361
376
|
});
|
|
362
377
|
recordLineOutboundActivity(account.accountId);
|
|
363
378
|
if (opts.verbose) logVerbose(behavior.verboseMessage?.(messages.length) ?? `line: replied with ${messages.length} messages`);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { i as resolveLineAccount, r as resolveDefaultLineAccountId } from "./accounts-
|
|
1
|
+
import { i as resolveLineAccount, r as resolveDefaultLineAccountId } from "./accounts-BqEVsDoB.js";
|
|
2
2
|
import { a as resolveLineGroupConfigEntry, n as getLineRuntime, t as buildLineQuickReplyFallbackText } from "./quick-reply-fallback-D86FwAfr.js";
|
|
3
3
|
import { n as buildLineMediaMessage, r as hasLineSpecificMediaOptions } from "./send-receipt-CY2ey8XH.js";
|
|
4
|
-
import { E as buildTemplateMessageFromPayload, S as replyMessageLine, i as processLineMessage, l as createLocationMessage, p as getUserDisplayName, s as createFlexMessage, u as createQuickReplyItems, v as pushMessageLine, w as showLoadingAnimation, y as pushMessagesLine } from "./markdown-to-line-
|
|
4
|
+
import { E as buildTemplateMessageFromPayload, S as replyMessageLine, i as processLineMessage, l as createLocationMessage, p as getUserDisplayName, s as createFlexMessage, u as createQuickReplyItems, v as pushMessageLine, w as showLoadingAnimation, y as pushMessagesLine } from "./markdown-to-line-DMDQTMhx.js";
|
|
5
5
|
import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
|
|
6
|
-
import { normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
-
import { DEFAULT_INGRESS_ADOPTION_STALL_MS, DEFAULT_INGRESS_RETRY_MAX_ATTEMPTS, bindIngressLifecycleToReplyOptions, createChannelIngressMonitor } from "openclaw/plugin-sdk/channel-outbound";
|
|
6
|
+
import { normalizeNullableString, normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
+
import { DEFAULT_INGRESS_ADOPTION_STALL_MS, DEFAULT_INGRESS_RETRY_MAX_ATTEMPTS, bindIngressLifecycleToReplyOptions, createChannelIngressError, createChannelIngressMonitor } from "openclaw/plugin-sdk/channel-outbound";
|
|
8
8
|
import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
9
9
|
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
|
|
10
10
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
@@ -16,8 +16,9 @@ import { saveMediaStream } from "openclaw/plugin-sdk/media-store";
|
|
|
16
16
|
import { createNonExitingRuntime, danger, logVerbose, shouldLogVerbose, waitForAbortSignal, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
17
17
|
import { fetchWithRuntimeDispatcherOrMockedGlobal } from "openclaw/plugin-sdk/runtime-fetch";
|
|
18
18
|
import { HTTPFetchError } from "@line/bot-sdk";
|
|
19
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
19
20
|
import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
|
|
20
|
-
import { buildMentionRegexes, formatInboundEnvelope, formatInboundMediaUnavailableText, formatLocationText, hasFinalInboundReplyDispatch, matchesMentionPatterns, resolveInboundSessionEnvelopeContext,
|
|
21
|
+
import { buildChannelInboundEventContext, buildMentionRegexes, formatInboundEnvelope, formatInboundMediaUnavailableText, formatLocationText, hasFinalInboundReplyDispatch, matchesMentionPatterns, resolveInboundSessionEnvelopeContext, toInboundMediaFactsWithMetadata, toLocationContext } from "openclaw/plugin-sdk/channel-inbound";
|
|
21
22
|
import { chunkMarkdownText } from "openclaw/plugin-sdk/reply-runtime";
|
|
22
23
|
import { isRequestBodyLimitError, normalizePluginHttpPath, normalizeWebhookPath, registerWebhookTargetWithPluginRoute, requestBodyErrorToText, resolveSingleWebhookTarget } from "openclaw/plugin-sdk/webhook-ingress";
|
|
23
24
|
import { beginWebhookRequestPipelineOrReject, createWebhookInFlightLimiter, isRequestBodyLimitError as isRequestBodyLimitError$1, readRequestBodyWithLimit, requestBodyErrorToText as requestBodyErrorToText$1, runDetachedWebhookWork } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
@@ -28,7 +29,6 @@ import { hasControlCommand } from "openclaw/plugin-sdk/command-auth-native";
|
|
|
28
29
|
import { ensureConfiguredBindingRouteReady, readChannelAllowFromStore, resolveConfiguredBindingRoute, resolvePairingIdLabel, resolvePinnedMainDmOwnerFromAllowlist, resolveRuntimeConversationBindingRoute, upsertChannelPairingRequest } from "openclaw/plugin-sdk/conversation-runtime";
|
|
29
30
|
import { resolveAgentRoute, resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
|
|
30
31
|
import { resolveAllowlistProviderRuntimeGroupPolicy, resolveDefaultGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
31
|
-
import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-dispatch-runtime";
|
|
32
32
|
import crypto from "node:crypto";
|
|
33
33
|
import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
34
34
|
//#region extensions/line/src/bot-access.ts
|
|
@@ -441,40 +441,18 @@ function extractNativeMediaKind(message) {
|
|
|
441
441
|
default: return;
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
function resolveLineConversationLabel(params) {
|
|
445
|
-
return params.isGroup ? params.groupId ? `group:${params.groupId}` : params.roomId ? `room:${params.roomId}` : "unknown-group" : params.senderLabel;
|
|
446
|
-
}
|
|
447
|
-
function resolveLineAddresses(params) {
|
|
448
|
-
const fromAddress = params.isGroup ? params.groupId ? `line:group:${params.groupId}` : params.roomId ? `line:room:${params.roomId}` : `line:${params.peerId}` : `line:${params.userId ?? params.peerId}`;
|
|
449
|
-
return {
|
|
450
|
-
fromAddress,
|
|
451
|
-
toAddress: params.isGroup ? fromAddress : `line:${params.userId ?? params.peerId}`,
|
|
452
|
-
originatingTo: params.isGroup ? fromAddress : `line:${params.userId ?? params.peerId}`
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
444
|
async function finalizeLineInboundContext(params) {
|
|
456
|
-
const { fromAddress, toAddress, originatingTo } = resolveLineAddresses({
|
|
457
|
-
isGroup: params.source.isGroup,
|
|
458
|
-
groupId: params.source.groupId,
|
|
459
|
-
roomId: params.source.roomId,
|
|
460
|
-
userId: params.source.userId,
|
|
461
|
-
peerId: params.source.peerId
|
|
462
|
-
});
|
|
463
445
|
const senderId = params.source.userId ?? "unknown";
|
|
464
446
|
const senderLabel = params.source.userId ? `user:${params.source.userId}` : "unknown";
|
|
465
|
-
const conversationLabel =
|
|
466
|
-
|
|
467
|
-
groupId: params.source.groupId,
|
|
468
|
-
roomId: params.source.roomId,
|
|
469
|
-
senderLabel
|
|
470
|
-
});
|
|
447
|
+
const conversationLabel = params.source.isGroup ? params.source.groupId ? `group:${params.source.groupId}` : params.source.roomId ? `room:${params.source.roomId}` : "unknown-group" : senderLabel;
|
|
448
|
+
const address = params.source.groupId ? `line:group:${params.source.groupId}` : params.source.roomId ? `line:room:${params.source.roomId}` : `line:${params.source.userId ?? params.source.peerId}`;
|
|
471
449
|
const { storePath, envelopeOptions, previousTimestamp } = resolveInboundSessionEnvelopeContext({
|
|
472
450
|
cfg: params.cfg,
|
|
473
451
|
agentId: params.route.agentId,
|
|
474
452
|
sessionKey: params.route.sessionKey
|
|
475
453
|
});
|
|
476
454
|
const agentBody = params.agentBody ?? params.rawBody;
|
|
477
|
-
const media =
|
|
455
|
+
const media = await toInboundMediaFactsWithMetadata(params.media);
|
|
478
456
|
const body = formatInboundEnvelope({
|
|
479
457
|
channel: "LINE",
|
|
480
458
|
from: conversationLabel,
|
|
@@ -485,34 +463,45 @@ async function finalizeLineInboundContext(params) {
|
|
|
485
463
|
previousTimestamp,
|
|
486
464
|
envelope: envelopeOptions
|
|
487
465
|
});
|
|
488
|
-
const ctxPayload =
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
466
|
+
const ctxPayload = buildChannelInboundEventContext({
|
|
467
|
+
channel: "line",
|
|
468
|
+
accountId: params.route.accountId,
|
|
469
|
+
messageId: params.messageSid,
|
|
470
|
+
timestamp: params.timestamp,
|
|
471
|
+
from: address,
|
|
472
|
+
sender: { id: senderId },
|
|
473
|
+
conversation: {
|
|
474
|
+
kind: params.source.isGroup ? "group" : "direct",
|
|
475
|
+
id: params.source.peerId,
|
|
476
|
+
label: conversationLabel
|
|
477
|
+
},
|
|
478
|
+
route: {
|
|
479
|
+
agentId: params.route.agentId,
|
|
480
|
+
dmScope: params.route.dmScope,
|
|
481
|
+
accountId: params.route.accountId,
|
|
482
|
+
routeSessionKey: params.route.sessionKey
|
|
483
|
+
},
|
|
484
|
+
reply: {
|
|
485
|
+
to: address,
|
|
486
|
+
originatingTo: address
|
|
487
|
+
},
|
|
488
|
+
message: {
|
|
489
|
+
body,
|
|
490
|
+
bodyForAgent: agentBody,
|
|
491
|
+
rawBody: params.rawBody,
|
|
492
|
+
commandBody: params.rawBody,
|
|
493
|
+
inboundHistory: params.inboundHistory
|
|
494
|
+
},
|
|
495
|
+
access: { commands: { authorized: params.commandAuthorized } },
|
|
506
496
|
media,
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
}
|
|
515
|
-
InboundHistory: params.inboundHistory
|
|
497
|
+
extra: {
|
|
498
|
+
...params.locationContext,
|
|
499
|
+
GroupSubject: params.source.isGroup ? params.source.groupId ?? params.source.roomId : void 0,
|
|
500
|
+
GroupSystemPrompt: params.source.isGroup ? normalizeOptionalString(resolveLineGroupConfigEntry(params.account.config.groups, {
|
|
501
|
+
groupId: params.source.groupId,
|
|
502
|
+
roomId: params.source.roomId
|
|
503
|
+
})?.systemPrompt) : void 0
|
|
504
|
+
}
|
|
516
505
|
});
|
|
517
506
|
const pinnedMainDmOwner = !params.source.isGroup ? resolvePinnedMainDmOwnerFromAllowlist({
|
|
518
507
|
dmScope: params.cfg.session?.dmScope,
|
|
@@ -1077,14 +1066,7 @@ const LINE_WEBHOOK_DRAIN_INTERVAL_MS = 500;
|
|
|
1077
1066
|
const LINE_WEBHOOK_MAX_CONCURRENT_DELIVERIES = 8;
|
|
1078
1067
|
const LINE_WEBHOOK_DRAIN_SCAN_LIMIT = 100;
|
|
1079
1068
|
const LINE_WEBHOOK_ACTIVE_DELIVERY_STOP_GRACE_MS = 5e3;
|
|
1080
|
-
const
|
|
1081
|
-
const LINE_WEBHOOK_TOMBSTONE_MAX_ENTRIES = 4096;
|
|
1082
|
-
var LineWebhookPayloadError = class extends Error {
|
|
1083
|
-
constructor(message, options) {
|
|
1084
|
-
super(message, options);
|
|
1085
|
-
this.name = "LineWebhookPayloadError";
|
|
1086
|
-
}
|
|
1087
|
-
};
|
|
1069
|
+
const LineWebhookPayloadError = createChannelIngressError("LineWebhookPayloadError");
|
|
1088
1070
|
var LineWebhookTerminalDeliveryError = class extends Error {
|
|
1089
1071
|
constructor(message, options) {
|
|
1090
1072
|
super(message, options);
|
|
@@ -1092,18 +1074,15 @@ var LineWebhookTerminalDeliveryError = class extends Error {
|
|
|
1092
1074
|
this.name = "LineWebhookTerminalDeliveryError";
|
|
1093
1075
|
}
|
|
1094
1076
|
};
|
|
1095
|
-
function nonEmptyString(value) {
|
|
1096
|
-
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
1097
|
-
}
|
|
1098
1077
|
/** Message ids preserve the shipped replay-guard keyspace; other events use LINE's delivery id. */
|
|
1099
1078
|
function eventIdFor(event) {
|
|
1100
1079
|
if (!event || typeof event !== "object") throw new LineWebhookPayloadError("LINE webhook event must be an object.");
|
|
1101
1080
|
const candidate = event;
|
|
1102
1081
|
if (candidate.type === "message") {
|
|
1103
|
-
const messageId =
|
|
1082
|
+
const messageId = normalizeNullableString(candidate.message?.id);
|
|
1104
1083
|
if (messageId) return `message:${messageId}`;
|
|
1105
1084
|
}
|
|
1106
|
-
const webhookEventId =
|
|
1085
|
+
const webhookEventId = normalizeNullableString(candidate.webhookEventId);
|
|
1107
1086
|
if (webhookEventId) return `event:${webhookEventId}`;
|
|
1108
1087
|
throw new LineWebhookPayloadError("LINE webhook event is missing a stable delivery id.");
|
|
1109
1088
|
}
|
|
@@ -1111,15 +1090,15 @@ function laneKeyFor(event, eventId) {
|
|
|
1111
1090
|
if (!event || typeof event !== "object") return eventId;
|
|
1112
1091
|
const source = event.source;
|
|
1113
1092
|
if (source?.type === "group") {
|
|
1114
|
-
const groupId =
|
|
1093
|
+
const groupId = normalizeNullableString(source.groupId);
|
|
1115
1094
|
if (groupId) return `group:${groupId}`;
|
|
1116
1095
|
}
|
|
1117
1096
|
if (source?.type === "room") {
|
|
1118
|
-
const roomId =
|
|
1097
|
+
const roomId = normalizeNullableString(source.roomId);
|
|
1119
1098
|
if (roomId) return `room:${roomId}`;
|
|
1120
1099
|
}
|
|
1121
1100
|
if (source?.type === "user") {
|
|
1122
|
-
const userId =
|
|
1101
|
+
const userId = normalizeNullableString(source.userId);
|
|
1123
1102
|
if (userId) return `user:${userId}`;
|
|
1124
1103
|
}
|
|
1125
1104
|
return eventId;
|
|
@@ -1155,7 +1134,6 @@ async function waitForActiveDeliveriesBeforeDispose(activeDeliveries) {
|
|
|
1155
1134
|
function createLineWebhookSpool(options) {
|
|
1156
1135
|
const queue = options.queue ?? getLineRuntime().state.openChannelIngressQueue({ accountId: options.accountId });
|
|
1157
1136
|
const activeDeliveries = /* @__PURE__ */ new Set();
|
|
1158
|
-
const deferredClaims = /* @__PURE__ */ new Map();
|
|
1159
1137
|
let acceptsDeferredClaims = true;
|
|
1160
1138
|
const monitor = createChannelIngressMonitor({
|
|
1161
1139
|
queue,
|
|
@@ -1193,49 +1171,28 @@ function createLineWebhookSpool(options) {
|
|
|
1193
1171
|
},
|
|
1194
1172
|
createClaimError: (kind) => new LineWebhookPayloadError(kind === "invalid-version" ? "LINE webhook spool payload is invalid." : "LINE webhook event identity changed after durable admission.")
|
|
1195
1173
|
},
|
|
1196
|
-
deliver: async ({ event, destination }, lifecycle
|
|
1174
|
+
deliver: async ({ event, destination }, lifecycle) => {
|
|
1197
1175
|
const boundLifecycle = bindIngressLifecycleToReplyOptions(lifecycle).turnAdoptionLifecycle;
|
|
1198
1176
|
let handedOff = false;
|
|
1199
|
-
let resolveDeferredClaim;
|
|
1200
|
-
const deferredClaim = new Promise((resolve) => {
|
|
1201
|
-
resolveDeferredClaim = resolve;
|
|
1202
|
-
});
|
|
1203
|
-
let deferredClaimSettled = false;
|
|
1204
|
-
const settleDeferredClaim = () => {
|
|
1205
|
-
if (deferredClaimSettled) return;
|
|
1206
|
-
deferredClaimSettled = true;
|
|
1207
|
-
if (deferredClaims.get(claim.id) === deferredClaim) deferredClaims.delete(claim.id);
|
|
1208
|
-
resolveDeferredClaim();
|
|
1209
|
-
};
|
|
1210
1177
|
const delivery = options.deliver(event, destination, { turnAdoptionLifecycle: {
|
|
1211
1178
|
...boundLifecycle,
|
|
1212
1179
|
onAdopted: async () => {
|
|
1213
1180
|
handedOff = true;
|
|
1214
|
-
|
|
1215
|
-
await boundLifecycle.onAdopted();
|
|
1216
|
-
} finally {
|
|
1217
|
-
settleDeferredClaim();
|
|
1218
|
-
}
|
|
1181
|
+
await boundLifecycle.onAdopted();
|
|
1219
1182
|
},
|
|
1220
1183
|
onDeferred: () => {
|
|
1221
1184
|
handedOff = true;
|
|
1222
1185
|
if (!acceptsDeferredClaims) {
|
|
1223
|
-
settleDeferredClaim();
|
|
1224
1186
|
Promise.resolve().then(() => boundLifecycle.onAbandoned()).catch((error) => {
|
|
1225
1187
|
options.runtime.error?.(danger(`line: failed to abandon a late webhook delivery: ${errorText(error)}`));
|
|
1226
1188
|
});
|
|
1227
1189
|
return;
|
|
1228
1190
|
}
|
|
1229
|
-
if (!deferredClaimSettled) deferredClaims.set(claim.id, deferredClaim);
|
|
1230
1191
|
boundLifecycle.onDeferred();
|
|
1231
1192
|
},
|
|
1232
1193
|
onAbandoned: async () => {
|
|
1233
1194
|
handedOff = true;
|
|
1234
|
-
|
|
1235
|
-
await boundLifecycle.onAbandoned();
|
|
1236
|
-
} finally {
|
|
1237
|
-
settleDeferredClaim();
|
|
1238
|
-
}
|
|
1195
|
+
await boundLifecycle.onAbandoned();
|
|
1239
1196
|
}
|
|
1240
1197
|
} });
|
|
1241
1198
|
activeDeliveries.add(delivery);
|
|
@@ -1252,14 +1209,13 @@ function createLineWebhookSpool(options) {
|
|
|
1252
1209
|
pollIntervalMs: LINE_WEBHOOK_DRAIN_INTERVAL_MS,
|
|
1253
1210
|
retention: {
|
|
1254
1211
|
pruneIntervalMs: 0,
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
failedTtlMs: LINE_WEBHOOK_TOMBSTONE_TTL_MS,
|
|
1258
|
-
failedMaxEntries: LINE_WEBHOOK_TOMBSTONE_MAX_ENTRIES
|
|
1212
|
+
completedMaxEntries: 4096,
|
|
1213
|
+
failedMaxEntries: 4096
|
|
1259
1214
|
},
|
|
1260
1215
|
appendRetryDelaysMs: [0],
|
|
1261
1216
|
waitForDeliveryIdleBeforeRepump: false,
|
|
1262
1217
|
waitForDeliveryIdleOnStop: false,
|
|
1218
|
+
deferredClaims: "manual",
|
|
1263
1219
|
runPumpTask: runDetachedWebhookWork,
|
|
1264
1220
|
admissionMode: "durable-after-stop",
|
|
1265
1221
|
drain: {
|
|
@@ -1310,7 +1266,7 @@ function createLineWebhookSpool(options) {
|
|
|
1310
1266
|
try {
|
|
1311
1267
|
const deliveriesSettled = await waitForActiveDeliveriesBeforeDispose(activeDeliveries);
|
|
1312
1268
|
if (!deliveriesSettled) options.runtime.log(warn(`line: timed out after ${LINE_WEBHOOK_ACTIVE_DELIVERY_STOP_GRACE_MS}ms waiting for active webhook deliveries; releasing drain ownership`));
|
|
1313
|
-
|
|
1269
|
+
await monitor.waitForDeferredClaims();
|
|
1314
1270
|
acceptsDeferredClaims = false;
|
|
1315
1271
|
if (deliveriesSettled) await monitor.waitForIdle();
|
|
1316
1272
|
} finally {
|
|
@@ -1463,7 +1419,7 @@ function createLineNodeWebhookHandler(params) {
|
|
|
1463
1419
|
res.end(JSON.stringify({ error: requestBodyErrorToText$1("REQUEST_BODY_TIMEOUT") }));
|
|
1464
1420
|
return;
|
|
1465
1421
|
}
|
|
1466
|
-
params.runtime.error?.(danger(`line webhook error: ${
|
|
1422
|
+
params.runtime.error?.(danger(`line webhook error: ${formatErrorMessage(err)}`));
|
|
1467
1423
|
if (!res.headersSent) {
|
|
1468
1424
|
res.statusCode = 500;
|
|
1469
1425
|
res.setHeader("Content-Type", "application/json");
|
|
@@ -1693,6 +1649,7 @@ async function monitorLineProvider(opts) {
|
|
|
1693
1649
|
if (body.events && body.events.length > 0) {
|
|
1694
1650
|
logVerbose(`line: received ${body.events.length} webhook events`);
|
|
1695
1651
|
await match.target.bot.handleWebhook(body);
|
|
1652
|
+
res.setHeader("x-openclaw-delivery-accepted", "durable");
|
|
1696
1653
|
}
|
|
1697
1654
|
res.statusCode = 200;
|
|
1698
1655
|
res.setHeader("Content-Type", "application/json");
|
|
@@ -1710,7 +1667,7 @@ async function monitorLineProvider(opts) {
|
|
|
1710
1667
|
res.end(JSON.stringify({ error: requestBodyErrorToText("REQUEST_BODY_TIMEOUT") }));
|
|
1711
1668
|
return;
|
|
1712
1669
|
}
|
|
1713
|
-
runtime.error?.(danger(`line webhook error: ${
|
|
1670
|
+
runtime.error?.(danger(`line webhook error: ${formatErrorMessage(err)}`));
|
|
1714
1671
|
if (!res.headersSent) {
|
|
1715
1672
|
res.statusCode = 500;
|
|
1716
1673
|
res.setHeader("Content-Type", "application/json");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as sendMessageLine, E as buildTemplateMessageFromPayload, _ as pushLocationMessage, b as pushTemplateMessage, h as pushFlexMessage, i as processLineMessage, u as createQuickReplyItems, v as pushMessageLine, x as pushTextMessageWithQuickReplies, y as pushMessagesLine } from "./markdown-to-line-
|
|
1
|
+
import { C as sendMessageLine, E as buildTemplateMessageFromPayload, _ as pushLocationMessage, b as pushTemplateMessage, h as pushFlexMessage, i as processLineMessage, u as createQuickReplyItems, v as pushMessageLine, x as pushTextMessageWithQuickReplies, y as pushMessagesLine } from "./markdown-to-line-DMDQTMhx.js";
|
|
2
2
|
export { buildTemplateMessageFromPayload, createQuickReplyItems, processLineMessage, pushFlexMessage, pushLocationMessage, pushMessageLine, pushMessagesLine, pushTemplateMessage, pushTextMessageWithQuickReplies, sendMessageLine };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { runChannelProbe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
2
2
|
import { messagingApi } from "@line/bot-sdk";
|
|
3
3
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
4
4
|
//#region extensions/line/src/probe.ts
|
|
@@ -8,8 +8,8 @@ async function probeLineBot(channelAccessToken, timeoutMs = 5e3) {
|
|
|
8
8
|
error: "Channel access token not configured"
|
|
9
9
|
};
|
|
10
10
|
const client = new messagingApi.MessagingApiClient({ channelAccessToken: channelAccessToken.trim() });
|
|
11
|
-
|
|
12
|
-
const profile = await
|
|
11
|
+
return await runChannelProbe(timeoutMs, async () => {
|
|
12
|
+
const profile = await client.getBotInfo();
|
|
13
13
|
return {
|
|
14
14
|
ok: true,
|
|
15
15
|
bot: {
|
|
@@ -19,12 +19,10 @@ async function probeLineBot(channelAccessToken, timeoutMs = 5e3) {
|
|
|
19
19
|
pictureUrl: profile.pictureUrl
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
}
|
|
22
|
+
}, (error) => ({
|
|
23
|
+
ok: false,
|
|
24
|
+
error: formatErrorMessage(error)
|
|
25
|
+
}));
|
|
28
26
|
}
|
|
29
27
|
//#endregion
|
|
30
28
|
export { probeLineBot as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as createEventCard, i as createAgendaCard, n as createDeviceControlCard, r as createMediaPlayerCard, t as createAppleTvRemoteCard } from "./flex-templates-iKJsyCq-.js";
|
|
2
2
|
import { normalizeLowercaseStringOrEmpty, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { DmPolicySchema, GroupPolicySchema, buildChannelConfigSchema, buildGroupEntrySchema, buildMultiAccountChannelSchema, requireOpenAllowFrom } from "openclaw/plugin-sdk/channel-config-schema";
|
|
4
4
|
import { requireChannelOpenAllowFrom } from "openclaw/plugin-sdk/extension-shared";
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { i as resolveLineAccount, n as normalizeAccountId, r as resolveDefaultLineAccountId, t as listLineAccountIds } from "./accounts-
|
|
1
|
+
import { i as resolveLineAccount, n as normalizeAccountId, r as resolveDefaultLineAccountId, t as listLineAccountIds } from "./accounts-BqEVsDoB.js";
|
|
2
2
|
import { a as resolveLineGroupConfigEntry, i as resolveExactLineGroupConfigKey, o as resolveLineGroupLookupIds, r as setLineRuntime, s as resolveLineGroupsConfig } from "./quick-reply-fallback-D86FwAfr.js";
|
|
3
|
-
import { i as LineConfigSchema, n as parseLineDirectives, r as LineChannelConfigSchema, t as hasLineDirectives } from "./reply-payload-transform-
|
|
4
|
-
import { a as
|
|
5
|
-
import { a as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as probeLineBot } from "./probe-BslD77tJ.js";
|
|
3
|
+
import { i as LineConfigSchema, n as parseLineDirectives, r as LineChannelConfigSchema, t as hasLineDirectives } from "./reply-payload-transform-D5-dHB8b.js";
|
|
4
|
+
import { _ as postbackAction, a as createEventCard, c as createCarousel, d as createListCard, f as createNotificationBubble, i as createAgendaCard, l as createImageCard, m as messageAction, n as createDeviceControlCard, o as createReceiptCard, p as datetimePickerAction, r as createMediaPlayerCard, s as createActionCard, t as createAppleTvRemoteCard, u as createInfoCard, v as uriAction } from "./flex-templates-iKJsyCq-.js";
|
|
5
|
+
import { A as createConfirmTemplate, C as sendMessageLine, D as createButtonMenu, E as buildTemplateMessageFromPayload, F as createTemplateCarousel, I as createYesNoConfirm, L as toFlexMessage, M as createImageCarouselColumn, N as createLinkMenu, O as createButtonTemplate, P as createProductCarousel, S as replyMessageLine, T as resolveLineChannelAccessToken, _ as pushLocationMessage, a as stripMarkdown, b as pushTemplateMessage, c as createImageMessage, d as createTextMessageWithQuickReplies, f as createVideoMessage, g as pushImageMessage, h as pushFlexMessage, i as processLineMessage, j as createImageCarousel, k as createCarouselColumn, l as createLocationMessage, m as getUserProfile, n as convertTableToFlexBubble, o as createAudioMessage, p as getUserDisplayName, r as hasMarkdownToConvert, s as createFlexMessage, t as convertCodeBlockToFlexBubble, u as createQuickReplyItems, v as pushMessageLine, w as showLoadingAnimation, x as pushTextMessageWithQuickReplies, y as pushMessagesLine } from "./markdown-to-line-DMDQTMhx.js";
|
|
6
|
+
import { a as validateLineSignature, c as normalizeAllowFrom, i as parseLineWebhookBody, n as createLineNodeWebhookHandler, o as downloadLineMedia, r as readLineWebhookRequestBody, s as firstDefined, t as monitorLineProvider } from "./monitor-DXEodYFJ.js";
|
|
7
|
+
import { t as probeLineBot } from "./probe-CM03wo6r.js";
|
|
9
8
|
import { clearAccountEntryFields } from "openclaw/plugin-sdk/core";
|
|
10
9
|
import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
|
|
11
10
|
import { DEFAULT_ACCOUNT_ID, formatDocsLink, setSetupChannelEnabled, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
12
11
|
import { buildComputedAccountStatusSnapshot, buildTokenChannelStatusSummary } from "openclaw/plugin-sdk/status-helpers";
|
|
13
12
|
import { danger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
14
13
|
import { messagingApi } from "@line/bot-sdk";
|
|
15
|
-
import {
|
|
14
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
15
|
+
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-local-roots";
|
|
16
16
|
import { mimeTypeFromFilePath } from "openclaw/plugin-sdk/media-mime";
|
|
17
17
|
import { loadWebMediaRaw } from "openclaw/plugin-sdk/web-media";
|
|
18
18
|
//#region extensions/line/src/webhook.ts
|
|
@@ -60,7 +60,7 @@ function createLineWebhookMiddleware(options) {
|
|
|
60
60
|
}
|
|
61
61
|
res.status(200).json({ status: "ok" });
|
|
62
62
|
} catch (err) {
|
|
63
|
-
runtime?.error?.(danger(`line webhook error: ${
|
|
63
|
+
runtime?.error?.(danger(`line webhook error: ${formatErrorMessage(err)}`));
|
|
64
64
|
if (!res.headersSent) res.status(500).json({ error: "Internal server error" });
|
|
65
65
|
}
|
|
66
66
|
};
|
package/dist/setup-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as lineSetupAdapter, t as lineSetupWizard } from "./setup-surface-
|
|
1
|
+
import { n as lineSetupAdapter, t as lineSetupWizard } from "./setup-surface-DRQ7n0En.js";
|
|
2
2
|
export { lineSetupAdapter, lineSetupWizard };
|