@openclaw/line 2026.11.3 → 2026.11.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-4BpGVN1-.mjs +3 -0
- package/dist/.setup/{api-WIupE7U1.mjs → api-BRnngy5R.mjs} +1 -1
- package/dist/.setup/{card-command-Dnkl21vg.mjs → card-command-2y-RSLPg.mjs} +26 -43
- package/dist/.setup/{channel-DIEVJ4PQ.mjs → channel-DJcpjKpx.mjs} +237 -332
- package/dist/.setup/channel.runtime-CdfKsNz4.mjs +4 -0
- package/dist/.setup/{monitor-JlOPDECF.mjs → monitor-BkuPFFxZ.mjs} +240 -329
- package/dist/.setup/{outbound.runtime-pciQUWJd.mjs → outbound.runtime-BPo_111h.mjs} +2 -2
- package/dist/.setup/{send-kjjjemFi.mjs → send-C1JZOFMA.mjs} +32 -81
- package/dist/.setup/{send-retry-Dzbkz5wG.mjs → send-retry-Bf2Xr6ZN.mjs} +175 -80
- package/dist/.setup/{template-messages-COcdie6C.mjs → template-messages-C1Kkr0-e.mjs} +32 -44
- package/dist/.source-module-urls/2c97352967966b7ab9f67f528eb25c098b6fe10ea0e4616ffae3851ed839d81e.json +1 -0
- package/dist/api.js +2 -2
- package/dist/channel-plugin-api.js +1 -2
- package/dist/contract-api.js +1 -2
- package/dist/index.js +1 -1
- package/dist/runtime-api.js +1 -2
- package/dist/setup-api.js +1 -2
- package/dist/setup-entry.js +1 -1
- package/node_modules/@line/bot-sdk/node_modules/@types/node/README.md +1 -1
- package/node_modules/@line/bot-sdk/node_modules/@types/node/package.json +2 -2
- package/node_modules/@line/bot-sdk/node_modules/@types/node/util.d.ts +7 -4
- package/node_modules/typebox/build/format/duration.d.mts +2 -2
- package/node_modules/typebox/build/format/duration.mjs +2 -2
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_email.mjs +1 -0
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
- package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
- package/node_modules/typebox/build/format/ipv4.mjs +2 -2
- package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
- package/node_modules/typebox/build/format/ipv6.mjs +1 -1
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/schema/build.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
- package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
- package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
- package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
- package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
- package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
- package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
- package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
- package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
- package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
- package/node_modules/typebox/build/system/memory/create.mjs +18 -13
- package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
- package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
- package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
- package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
- package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
- package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
- package/node_modules/typebox/build/system/memory/update.mjs +43 -16
- package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
- package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
- package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
- package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
- package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
- package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
- package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +1 -1
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
- package/node_modules/zod/src/v4/core/compile.ts +9 -0
- package/node_modules/zod/src/v4/core/schemas.ts +35 -1
- package/node_modules/zod/src/v4/core/util.ts +13 -0
- package/node_modules/zod/src/v4/core/versions.ts +1 -1
- package/node_modules/zod/v4/core/compile.cjs +8 -0
- package/node_modules/zod/v4/core/compile.js +8 -0
- package/node_modules/zod/v4/core/schemas.cjs +30 -0
- package/node_modules/zod/v4/core/schemas.d.cts +3 -1
- package/node_modules/zod/v4/core/schemas.d.ts +3 -1
- package/node_modules/zod/v4/core/schemas.js +30 -0
- package/node_modules/zod/v4/core/util.cjs +15 -0
- package/node_modules/zod/v4/core/util.d.cts +2 -0
- package/node_modules/zod/v4/core/util.d.ts +2 -0
- package/node_modules/zod/v4/core/util.js +14 -0
- package/node_modules/zod/v4/core/versions.cjs +1 -1
- package/node_modules/zod/v4/core/versions.js +1 -1
- package/package.json +6 -6
- package/dist/.setup/api-BMSLc5Fi.mjs +0 -3
- package/dist/.setup/channel.runtime-CDy9DQUW.mjs +0 -4
- package/dist/.setup/monitor.runtime-DsIFiXEZ.mjs +0 -2
- package/dist/.setup/probe.runtime-D2MUF_B_.mjs +0 -2
- package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
- package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { A as reportLineQuoteCarrierMissing, D as canCarryLineQuoteToken, F as normalizeLineMessagingTarget, N as buildLineMediaMessage, P as inferLineTargetChatType, S as truncateLineActionLabel, _ as createCardBubble, c as createAgendaCard, d as createActionCard, g as cardText, h as cardBox, j as resolveLineQuoteToken, l as createEventCard, t as explainLineRefusal, v as createCardTitle, w as fitsLineFlexBubble, x as postbackAction, y as messageAction } from "./send-retry-Bf2Xr6ZN.mjs";
|
|
1
2
|
import { n as resolveDefaultLineAccountId, r as resolveLineAccount, t as listLineAccountIds } from "./accounts-DOiM8-y3.mjs";
|
|
2
3
|
import { a as normalizeLineAllowEntry, i as hasLineCredentials, r as lineSetupContract, t as lineSetupWizard } from "./setup-surface-CYd8oqzt.mjs";
|
|
3
4
|
import { t as getLineRuntime } from "./runtime-V7yh9OeC.mjs";
|
|
4
|
-
import { A as resolveLineQuoteToken, C as fitsLineFlexBubble, E as canCarryLineQuoteToken, M as buildLineMediaMessage, N as inferLineTargetChatType, P as normalizeLineMessagingTarget, _ as createCardTitle, b as postbackAction, c as createEventCard, g as createCardBubble, h as cardText, k as reportLineQuoteCarrierMissing, m as cardBox, s as createAgendaCard, t as explainLineRefusal, u as createActionCard, v as messageAction, x as truncateLineActionLabel } from "./send-retry-Dzbkz5wG.mjs";
|
|
5
5
|
import { buildDmGroupAccountAllowlistAdapter, createFlatAllowlistOverrideResolver } from "openclaw/plugin-sdk/allowlist-config-edit";
|
|
6
6
|
import { buildChannelOutboundSessionRoute, createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
7
7
|
import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing";
|
|
@@ -11,52 +11,21 @@ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
|
11
11
|
import { describeWebhookAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
12
12
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
13
13
|
import { clearAccountFieldsFromConfigSection, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
14
|
-
import { isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
14
|
+
import { isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringEntries, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
15
15
|
import { ChannelDeliveryStreamingConfigSchema, DmPolicySchema, GroupPolicySchema, buildChannelConfigSchema, buildGroupEntrySchema, buildMultiAccountChannelSchema, requireOpenAllowFrom } from "openclaw/plugin-sdk/channel-config-schema";
|
|
16
16
|
import { requireChannelOpenAllowFrom } from "openclaw/plugin-sdk/extension-shared";
|
|
17
17
|
import { z } from "zod";
|
|
18
18
|
import { parseAccessGroupAllowFromEntry } from "openclaw/plugin-sdk/access-groups";
|
|
19
19
|
import { firstDefined } from "openclaw/plugin-sdk/allow-from";
|
|
20
|
-
import { createAccountStatusSink, createChannelMessageAdapterFromOutbound
|
|
20
|
+
import { createAccountStatusSink, createChannelMessageAdapterFromOutbound } from "openclaw/plugin-sdk/channel-outbound";
|
|
21
21
|
import { buildTokenChannelStatusSummary, collectIssuesForEnabledAccounts, createComputedAccountStatusAdapter, createDefaultChannelRuntimeState, createDependentCredentialStatusIssueCollector } from "openclaw/plugin-sdk/status-helpers";
|
|
22
|
-
import { createChannelPartialDeliveryError, isChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
|
|
22
|
+
import { createAcceptedChannelDeliveryResult, createChannelPartialDeliveryError, isChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
|
|
23
23
|
import { createAttachedChannelResultAdapter, createEmptyChannelResult } from "openclaw/plugin-sdk/channel-send-result";
|
|
24
24
|
import { PlatformMessageNotDispatchedError } from "openclaw/plugin-sdk/error-runtime";
|
|
25
25
|
import { resolveAskUserQuestionOptionIndex, resolveAskUserQuestionOptionIndices, resolveOutboundMediaUrls } from "openclaw/plugin-sdk/reply-payload";
|
|
26
26
|
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
|
|
27
27
|
import { normalizeMessagePresentation, renderMessagePresentationFallbackText, renderPresentationForDelivery, resolveMessagePresentationButtonAction, resolveMessagePresentationOptionAction } from "openclaw/plugin-sdk/interactive-runtime";
|
|
28
28
|
import { Type } from "typebox";
|
|
29
|
-
//#region extensions/line/src/bindings.ts
|
|
30
|
-
function normalizeLineConversationId(raw) {
|
|
31
|
-
const trimmed = raw?.trim() ?? "";
|
|
32
|
-
if (!trimmed) return null;
|
|
33
|
-
return (trimmed.match(/^line:(?:(?:user|group|room):)?(.+)$/i)?.[1] ?? trimmed).trim() || null;
|
|
34
|
-
}
|
|
35
|
-
function resolveLineCommandConversation(params) {
|
|
36
|
-
const conversationId = normalizeLineConversationId(params.originatingTo) ?? normalizeLineConversationId(params.commandTo) ?? normalizeLineConversationId(params.fallbackTo);
|
|
37
|
-
return conversationId ? { conversationId } : null;
|
|
38
|
-
}
|
|
39
|
-
function resolveLineInboundConversation(params) {
|
|
40
|
-
const conversationId = normalizeLineConversationId(params.conversationId) ?? normalizeLineConversationId(params.to);
|
|
41
|
-
return conversationId ? { conversationId } : null;
|
|
42
|
-
}
|
|
43
|
-
const lineBindingsAdapter = {
|
|
44
|
-
compileConfiguredBinding: ({ conversationId }) => {
|
|
45
|
-
const normalized = normalizeLineConversationId(conversationId);
|
|
46
|
-
return normalized ? { conversationId: normalized } : null;
|
|
47
|
-
},
|
|
48
|
-
matchInboundConversation: ({ compiledBinding, conversationId }) => {
|
|
49
|
-
const normalizedIncoming = normalizeLineConversationId(conversationId);
|
|
50
|
-
if (!normalizedIncoming || compiledBinding.conversationId !== normalizedIncoming) return null;
|
|
51
|
-
return {
|
|
52
|
-
conversationId: normalizedIncoming,
|
|
53
|
-
matchPriority: 2
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
|
-
resolveCommandConversation: resolveLineCommandConversation,
|
|
57
|
-
resolveInboundConversation: resolveLineInboundConversation
|
|
58
|
-
};
|
|
59
|
-
//#endregion
|
|
60
29
|
//#region extensions/line/src/config-adapter.ts
|
|
61
30
|
const lineConfigAdapter = createScopedChannelConfigAdapter({
|
|
62
31
|
sectionKey: "line",
|
|
@@ -160,8 +129,8 @@ const lineChannelPluginCommon = {
|
|
|
160
129
|
account,
|
|
161
130
|
configured: hasLineCredentials(account),
|
|
162
131
|
extra: {
|
|
163
|
-
tokenSource: account.tokenSource
|
|
164
|
-
signingSecretSource: account.signingSecretSource
|
|
132
|
+
tokenSource: account.tokenSource,
|
|
133
|
+
signingSecretSource: account.signingSecretSource,
|
|
165
134
|
tokenStatus: account.tokenStatus,
|
|
166
135
|
signingSecretStatus: account.signingSecretStatus
|
|
167
136
|
}
|
|
@@ -218,21 +187,19 @@ function classifyAllowFrom(values) {
|
|
|
218
187
|
* map outright instead of merging entry by entry. Reading both scopes together would
|
|
219
188
|
* credit an account with groups its runtime never sees.
|
|
220
189
|
*/
|
|
221
|
-
function
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
return Object.entries(groups).filter((entry) => isRecord(entry[1]));
|
|
225
|
-
}
|
|
226
|
-
function inspectLineGroupCoverage(params) {
|
|
190
|
+
function readLineGroupCoverage(params) {
|
|
191
|
+
const { account, parent } = params;
|
|
192
|
+
const groupAllowFrom = firstDefined(account.groupAllowFrom, parent?.groupAllowFrom);
|
|
227
193
|
const empty = {
|
|
228
194
|
group: [],
|
|
229
195
|
defaults: [],
|
|
230
196
|
channel: []
|
|
231
197
|
};
|
|
232
|
-
const
|
|
198
|
+
const sourceGroups = isRecord(account.groups) ? account.groups : parent?.groups;
|
|
199
|
+
const entries = isRecord(sourceGroups) ? Object.entries(sourceGroups).filter((entry) => isRecord(entry[1])) : [];
|
|
233
200
|
const groups = Object.fromEntries(entries);
|
|
234
201
|
const defaults = groups[GROUP_DEFAULTS_KEY];
|
|
235
|
-
const defaultCoverage = classifyAllowFrom(firstDefined(defaults?.allowFrom,
|
|
202
|
+
const defaultCoverage = classifyAllowFrom(firstDefined(defaults?.allowFrom, groupAllowFrom));
|
|
236
203
|
let covered = defaults?.enabled !== false && defaultCoverage.covered;
|
|
237
204
|
const referenceBacked = defaults?.enabled !== false && defaultCoverage.referenced ? [GROUP_DEFAULTS_KEY] : [];
|
|
238
205
|
const uncovered = [];
|
|
@@ -245,13 +212,13 @@ function inspectLineGroupCoverage(params) {
|
|
|
245
212
|
}) !== id) continue;
|
|
246
213
|
const effectiveGroup = resolveLineGroupConfigEntry(groups, { groupId });
|
|
247
214
|
if (effectiveGroup?.enabled === false) continue;
|
|
248
|
-
const allowlist = classifyAllowFrom(firstDefined(effectiveGroup?.allowFrom,
|
|
215
|
+
const allowlist = classifyAllowFrom(firstDefined(effectiveGroup?.allowFrom, groupAllowFrom));
|
|
249
216
|
if (allowlist.referenced) referenceBacked.push(id);
|
|
250
217
|
if (allowlist.covered) covered = true;
|
|
251
218
|
else if (allowlist.referenced) continue;
|
|
252
219
|
else if (group.allowFrom !== void 0) empty.group.push(id);
|
|
253
220
|
else if (defaults?.allowFrom !== void 0) empty.defaults.push(id);
|
|
254
|
-
else if (
|
|
221
|
+
else if (groupAllowFrom !== void 0) empty.channel.push(id);
|
|
255
222
|
else uncovered.push(id);
|
|
256
223
|
}
|
|
257
224
|
return {
|
|
@@ -261,19 +228,8 @@ function inspectLineGroupCoverage(params) {
|
|
|
261
228
|
empty
|
|
262
229
|
};
|
|
263
230
|
}
|
|
264
|
-
function readLineGroupCoverage(params) {
|
|
265
|
-
const { account, parent } = params;
|
|
266
|
-
return inspectLineGroupCoverage({
|
|
267
|
-
account,
|
|
268
|
-
...parent ? { parent } : {},
|
|
269
|
-
groupAllowFrom: firstDefined(account.groupAllowFrom, parent?.groupAllowFrom)
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
function readGroupPolicy(value) {
|
|
273
|
-
return typeof value === "string" ? value : void 0;
|
|
274
|
-
}
|
|
275
231
|
function isLineGroupAllowlistScope(params) {
|
|
276
|
-
return params.channelName === "line" && (
|
|
232
|
+
return params.channelName === "line" && (readStringValue(params.account.groupPolicy) ?? readStringValue(params.parent?.groupPolicy)) === "allowlist";
|
|
277
233
|
}
|
|
278
234
|
function formatGroupIds(ids) {
|
|
279
235
|
return ids.map((id) => `"${id}"`).join(", ");
|
|
@@ -343,8 +299,9 @@ function describeLineWebhookDelivery(params) {
|
|
|
343
299
|
fix: `register your gateway's public HTTPS URL for the route in channels.line.webhookPath (default /line/webhook) in ${consoleTab}, then turn Use webhook on`
|
|
344
300
|
};
|
|
345
301
|
}
|
|
346
|
-
|
|
347
|
-
|
|
302
|
+
const lineStatusAdapter = createComputedAccountStatusAdapter({
|
|
303
|
+
defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID),
|
|
304
|
+
collectStatusIssues: (accounts) => [...collectLineCredentialIssues(accounts), ...collectIssuesForEnabledAccounts({
|
|
348
305
|
accounts,
|
|
349
306
|
readAccount: (account) => account.configured === false ? null : account,
|
|
350
307
|
collectIssues: ({ account, accountId, issues }) => {
|
|
@@ -356,13 +313,9 @@ function collectLineWebhookIssues(accounts) {
|
|
|
356
313
|
...delivery
|
|
357
314
|
});
|
|
358
315
|
}
|
|
359
|
-
})
|
|
360
|
-
}
|
|
361
|
-
const lineStatusAdapter = createComputedAccountStatusAdapter({
|
|
362
|
-
defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID),
|
|
363
|
-
collectStatusIssues: (accounts) => [...collectLineCredentialIssues(accounts), ...collectLineWebhookIssues(accounts)],
|
|
316
|
+
})],
|
|
364
317
|
buildChannelSummary: ({ snapshot }) => buildTokenChannelStatusSummary(snapshot),
|
|
365
|
-
probeAccount: async ({ account, timeoutMs }) => await (await import("./
|
|
318
|
+
probeAccount: async ({ account, timeoutMs }) => await (await import("./send-retry-Bf2Xr6ZN.mjs").then((n) => n.o)).probeLineBot(account.channelAccessToken, timeoutMs),
|
|
366
319
|
resolveAccountSnapshot: ({ account, probe }) => ({
|
|
367
320
|
accountId: account.accountId,
|
|
368
321
|
name: account.name,
|
|
@@ -394,7 +347,7 @@ const lineGatewayAdapter = {
|
|
|
394
347
|
statusSink({ lifecycle: "starting" });
|
|
395
348
|
let lineBotLabel = "";
|
|
396
349
|
try {
|
|
397
|
-
const probe = await (await import("./
|
|
350
|
+
const probe = await (await import("./send-retry-Bf2Xr6ZN.mjs").then((n) => n.o)).probeLineBot(token, 2500);
|
|
398
351
|
const displayName = probe.ok ? probe.bot?.displayName?.trim() : null;
|
|
399
352
|
if (displayName) lineBotLabel = ` (${displayName})`;
|
|
400
353
|
const delivery = describeLineWebhookDelivery({ webhook: probe.ok ? probe.webhook : void 0 });
|
|
@@ -403,7 +356,7 @@ const lineGatewayAdapter = {
|
|
|
403
356
|
if (getLineRuntime().logging.shouldLogVerbose()) ctx.log?.debug?.(`[${account.accountId}] bot check failed: ${String(err)}`);
|
|
404
357
|
}
|
|
405
358
|
ctx.log?.info(`[${account.accountId}] starting LINE provider${lineBotLabel}`);
|
|
406
|
-
const { monitorLineProvider } = await import("./monitor
|
|
359
|
+
const { monitorLineProvider } = await import("./monitor-BkuPFFxZ.mjs");
|
|
407
360
|
return await monitorLineProvider({
|
|
408
361
|
channelAccessToken: token,
|
|
409
362
|
channelSecret: secret,
|
|
@@ -446,19 +399,6 @@ const lineGatewayAdapter = {
|
|
|
446
399
|
}
|
|
447
400
|
};
|
|
448
401
|
//#endregion
|
|
449
|
-
//#region extensions/line/src/group-policy.ts
|
|
450
|
-
function resolveLineGroupRequireMention(params) {
|
|
451
|
-
const tree = buildChannelGroupsScopeTree(params.cfg, "line", params.accountId);
|
|
452
|
-
const matchedKey = resolveExactLineGroupConfigKey({
|
|
453
|
-
groups: tree.scopes,
|
|
454
|
-
groupId: params.groupId
|
|
455
|
-
});
|
|
456
|
-
return resolveScopeRequireMention({
|
|
457
|
-
tree,
|
|
458
|
-
path: matchedKey ? [matchedKey] : []
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
//#endregion
|
|
462
402
|
//#region extensions/line/src/quick-reply-fallback.ts
|
|
463
403
|
function buildLineQuickReplyFallbackText(labels) {
|
|
464
404
|
const normalized = normalizeStringEntries(labels).slice(0, 13);
|
|
@@ -466,193 +406,6 @@ function buildLineQuickReplyFallbackText(labels) {
|
|
|
466
406
|
return `Options:\n${normalized.map((label) => `- ${label}`).join("\n")}`;
|
|
467
407
|
}
|
|
468
408
|
//#endregion
|
|
469
|
-
//#region extensions/line/src/flex-templates/media-control-cards.ts
|
|
470
|
-
function createControlButton(label, data, style = "secondary") {
|
|
471
|
-
return {
|
|
472
|
-
type: "button",
|
|
473
|
-
action: postbackAction(label, data),
|
|
474
|
-
style,
|
|
475
|
-
height: "sm",
|
|
476
|
-
flex: 1
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
function createMediaPlayerCard(params) {
|
|
480
|
-
const { title, subtitle, source, imageUrl, isPlaying, controls } = params;
|
|
481
|
-
const trackInfo = [createCardTitle(title)];
|
|
482
|
-
if (subtitle) trackInfo.push(cardText(subtitle, {
|
|
483
|
-
size: "md",
|
|
484
|
-
color: "#666666",
|
|
485
|
-
wrap: true,
|
|
486
|
-
margin: "sm"
|
|
487
|
-
}));
|
|
488
|
-
const statusItems = [];
|
|
489
|
-
if (isPlaying !== void 0) statusItems.push(cardBox("horizontal", [cardBox("vertical", [], {
|
|
490
|
-
width: "8px",
|
|
491
|
-
height: "8px",
|
|
492
|
-
backgroundColor: isPlaying ? "#06C755" : "#CCCCCC",
|
|
493
|
-
cornerRadius: "4px"
|
|
494
|
-
}), cardText(isPlaying ? "Now Playing" : "Paused", {
|
|
495
|
-
size: "xs",
|
|
496
|
-
color: isPlaying ? "#06C755" : "#888888",
|
|
497
|
-
weight: "bold",
|
|
498
|
-
margin: "sm"
|
|
499
|
-
})], { alignItems: "center" }));
|
|
500
|
-
if (source) statusItems.push(cardText(source, {
|
|
501
|
-
size: "xs",
|
|
502
|
-
color: "#AAAAAA",
|
|
503
|
-
margin: statusItems.length > 0 ? "lg" : void 0
|
|
504
|
-
}));
|
|
505
|
-
const bodyContents = [cardBox("vertical", trackInfo)];
|
|
506
|
-
if (statusItems.length > 0) bodyContents.push(cardBox("horizontal", statusItems, {
|
|
507
|
-
margin: "lg",
|
|
508
|
-
alignItems: "center"
|
|
509
|
-
}));
|
|
510
|
-
const bubble = createCardBubble(bodyContents);
|
|
511
|
-
if (imageUrl) bubble.hero = {
|
|
512
|
-
type: "image",
|
|
513
|
-
url: imageUrl,
|
|
514
|
-
size: "full",
|
|
515
|
-
aspectRatio: "1:1",
|
|
516
|
-
aspectMode: "cover"
|
|
517
|
-
};
|
|
518
|
-
const controlButtons = [];
|
|
519
|
-
for (const [key, label, style] of [
|
|
520
|
-
[
|
|
521
|
-
"previous",
|
|
522
|
-
"⏮",
|
|
523
|
-
"secondary"
|
|
524
|
-
],
|
|
525
|
-
[
|
|
526
|
-
"play",
|
|
527
|
-
"▶",
|
|
528
|
-
isPlaying ? "secondary" : "primary"
|
|
529
|
-
],
|
|
530
|
-
[
|
|
531
|
-
"pause",
|
|
532
|
-
"⏸",
|
|
533
|
-
isPlaying ? "primary" : "secondary"
|
|
534
|
-
],
|
|
535
|
-
[
|
|
536
|
-
"next",
|
|
537
|
-
"⏭",
|
|
538
|
-
"secondary"
|
|
539
|
-
]
|
|
540
|
-
]) {
|
|
541
|
-
const button = createControlButton(label, controls[key].data, style);
|
|
542
|
-
if (key !== "previous") button.margin = "md";
|
|
543
|
-
controlButtons.push(button);
|
|
544
|
-
}
|
|
545
|
-
bubble.footer = cardBox("vertical", [cardBox("horizontal", controlButtons)], {
|
|
546
|
-
paddingAll: "lg",
|
|
547
|
-
backgroundColor: "#FAFAFA"
|
|
548
|
-
});
|
|
549
|
-
return bubble;
|
|
550
|
-
}
|
|
551
|
-
function createAppleTvRemoteCard(params) {
|
|
552
|
-
const { deviceName, status, actionData } = params;
|
|
553
|
-
const headerContents = [createCardTitle(deviceName)];
|
|
554
|
-
if (status) headerContents.push(cardText(status, {
|
|
555
|
-
size: "sm",
|
|
556
|
-
color: "#666666",
|
|
557
|
-
wrap: true,
|
|
558
|
-
margin: "sm"
|
|
559
|
-
}));
|
|
560
|
-
const labels = {
|
|
561
|
-
up: "↑",
|
|
562
|
-
down: "↓",
|
|
563
|
-
left: "←",
|
|
564
|
-
right: "→",
|
|
565
|
-
select: "OK",
|
|
566
|
-
menu: "Menu",
|
|
567
|
-
home: "Home",
|
|
568
|
-
play: "Play",
|
|
569
|
-
pause: "Pause",
|
|
570
|
-
volumeUp: "Vol +",
|
|
571
|
-
volumeDown: "Vol -",
|
|
572
|
-
mute: "Mute"
|
|
573
|
-
};
|
|
574
|
-
const controlRows = [
|
|
575
|
-
[void 0, [
|
|
576
|
-
null,
|
|
577
|
-
"up",
|
|
578
|
-
null
|
|
579
|
-
]],
|
|
580
|
-
["md", [
|
|
581
|
-
"left",
|
|
582
|
-
"select",
|
|
583
|
-
"right"
|
|
584
|
-
]],
|
|
585
|
-
["md", [
|
|
586
|
-
null,
|
|
587
|
-
"down",
|
|
588
|
-
null
|
|
589
|
-
]],
|
|
590
|
-
["lg", ["menu", "home"]],
|
|
591
|
-
["md", ["play", "pause"]],
|
|
592
|
-
["md", [
|
|
593
|
-
"volumeUp",
|
|
594
|
-
"mute",
|
|
595
|
-
"volumeDown"
|
|
596
|
-
]]
|
|
597
|
-
].map(([margin, buttons]) => cardBox("horizontal", buttons.map((key) => key ? createControlButton(labels[key], actionData[key], key === "select" ? "primary" : "secondary") : { type: "filler" }), margin ? { margin } : {}));
|
|
598
|
-
return createCardBubble([
|
|
599
|
-
cardBox("vertical", headerContents),
|
|
600
|
-
{
|
|
601
|
-
type: "separator",
|
|
602
|
-
margin: "lg",
|
|
603
|
-
color: "#EEEEEE"
|
|
604
|
-
},
|
|
605
|
-
...controlRows
|
|
606
|
-
]);
|
|
607
|
-
}
|
|
608
|
-
function createDeviceControlCard(params) {
|
|
609
|
-
const { deviceName, deviceType, status, controls } = params;
|
|
610
|
-
const headerContents = [cardBox("horizontal", [cardBox("vertical", [], {
|
|
611
|
-
width: "10px",
|
|
612
|
-
height: "10px",
|
|
613
|
-
backgroundColor: "#06C755",
|
|
614
|
-
cornerRadius: "5px"
|
|
615
|
-
}), {
|
|
616
|
-
...createCardTitle(deviceName),
|
|
617
|
-
flex: 1,
|
|
618
|
-
margin: "md"
|
|
619
|
-
}], { alignItems: "center" })];
|
|
620
|
-
if (deviceType) headerContents.push(cardText(deviceType, {
|
|
621
|
-
size: "sm",
|
|
622
|
-
color: "#888888",
|
|
623
|
-
margin: "sm"
|
|
624
|
-
}));
|
|
625
|
-
if (status) headerContents.push(cardBox("vertical", [cardText(status, {
|
|
626
|
-
size: "sm",
|
|
627
|
-
color: "#444444",
|
|
628
|
-
wrap: true
|
|
629
|
-
})], {
|
|
630
|
-
margin: "lg",
|
|
631
|
-
paddingAll: "md",
|
|
632
|
-
backgroundColor: "#F8F9FA",
|
|
633
|
-
cornerRadius: "md"
|
|
634
|
-
}));
|
|
635
|
-
const bubble = createCardBubble(headerContents);
|
|
636
|
-
if (controls.length > 0) {
|
|
637
|
-
const rows = [];
|
|
638
|
-
const limitedControls = controls.slice(0, 6);
|
|
639
|
-
for (let i = 0; i < limitedControls.length; i += 2) {
|
|
640
|
-
const rowButtons = [];
|
|
641
|
-
for (const [offset, ctrl] of limitedControls.slice(i, i + 2).entries()) rowButtons.push({
|
|
642
|
-
...createControlButton(truncateLineActionLabel(ctrl.label, 18), ctrl.data),
|
|
643
|
-
margin: offset > 0 ? "md" : void 0
|
|
644
|
-
});
|
|
645
|
-
if (rowButtons.length === 1) rowButtons.push({ type: "filler" });
|
|
646
|
-
rows.push(cardBox("horizontal", rowButtons, { margin: i > 0 ? "md" : void 0 }));
|
|
647
|
-
}
|
|
648
|
-
bubble.footer = cardBox("vertical", rows, {
|
|
649
|
-
paddingAll: "lg",
|
|
650
|
-
backgroundColor: "#FAFAFA"
|
|
651
|
-
});
|
|
652
|
-
}
|
|
653
|
-
return bubble;
|
|
654
|
-
}
|
|
655
|
-
//#endregion
|
|
656
409
|
//#region extensions/line/src/question-postback.ts
|
|
657
410
|
const QUESTION_ID_PARAM = "line.question";
|
|
658
411
|
const OPTION_INDEX_PARAM = "line.option";
|
|
@@ -667,7 +420,6 @@ function buildLineQuestionPostbackData(callback) {
|
|
|
667
420
|
const data = params.toString();
|
|
668
421
|
return Buffer.byteLength(data, "utf8") <= POSTBACK_DATA_MAX_BYTES ? data : void 0;
|
|
669
422
|
}
|
|
670
|
-
/** Reads a question choice back out of inbound postback data, if it carries one. */
|
|
671
423
|
function parseLineQuestionPostbackData(data) {
|
|
672
424
|
if (!data.includes(QUESTION_ID_PARAM)) return;
|
|
673
425
|
const params = new URLSearchParams(data);
|
|
@@ -971,24 +723,90 @@ async function prepareLineReplyPayload(payload, to) {
|
|
|
971
723
|
}
|
|
972
724
|
const toSlug = (value) => normalizeLowercaseStringOrEmpty(value).replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "device";
|
|
973
725
|
const lineActionData = (action, device) => `line.action=${encodeURIComponent(action)}&line.device=${encodeURIComponent(device)}`;
|
|
726
|
+
function createControlButton(label, data, style = "secondary") {
|
|
727
|
+
return {
|
|
728
|
+
type: "button",
|
|
729
|
+
action: postbackAction(label, data),
|
|
730
|
+
style,
|
|
731
|
+
height: "sm",
|
|
732
|
+
flex: 1
|
|
733
|
+
};
|
|
734
|
+
}
|
|
974
735
|
function renderLineCard(card) {
|
|
975
736
|
if (card.type === "media_player") {
|
|
976
737
|
const device = toSlug(card.source || card.title);
|
|
738
|
+
const isPlaying = card.status ? card.status === "playing" : void 0;
|
|
739
|
+
const trackInfo = [createCardTitle(card.title)];
|
|
740
|
+
if (card.artist) trackInfo.push(cardText(card.artist, {
|
|
741
|
+
size: "md",
|
|
742
|
+
color: "#666666",
|
|
743
|
+
wrap: true,
|
|
744
|
+
margin: "sm"
|
|
745
|
+
}));
|
|
746
|
+
const statusItems = [];
|
|
747
|
+
if (isPlaying !== void 0) statusItems.push(cardBox("horizontal", [cardBox("vertical", [], {
|
|
748
|
+
width: "8px",
|
|
749
|
+
height: "8px",
|
|
750
|
+
backgroundColor: isPlaying ? "#06C755" : "#CCCCCC",
|
|
751
|
+
cornerRadius: "4px"
|
|
752
|
+
}), cardText(isPlaying ? "Now Playing" : "Paused", {
|
|
753
|
+
size: "xs",
|
|
754
|
+
color: isPlaying ? "#06C755" : "#888888",
|
|
755
|
+
weight: "bold",
|
|
756
|
+
margin: "sm"
|
|
757
|
+
})], { alignItems: "center" }));
|
|
758
|
+
if (card.source) statusItems.push(cardText(card.source, {
|
|
759
|
+
size: "xs",
|
|
760
|
+
color: "#AAAAAA",
|
|
761
|
+
margin: statusItems.length > 0 ? "lg" : void 0
|
|
762
|
+
}));
|
|
763
|
+
const bodyContents = [cardBox("vertical", trackInfo)];
|
|
764
|
+
if (statusItems.length > 0) bodyContents.push(cardBox("horizontal", statusItems, {
|
|
765
|
+
margin: "lg",
|
|
766
|
+
alignItems: "center"
|
|
767
|
+
}));
|
|
768
|
+
const bubble = createCardBubble(bodyContents);
|
|
769
|
+
if (card.imageUrl) bubble.hero = {
|
|
770
|
+
type: "image",
|
|
771
|
+
url: card.imageUrl,
|
|
772
|
+
size: "full",
|
|
773
|
+
aspectRatio: "1:1",
|
|
774
|
+
aspectMode: "cover"
|
|
775
|
+
};
|
|
776
|
+
const controlButtons = [];
|
|
777
|
+
for (const [key, label, style] of [
|
|
778
|
+
[
|
|
779
|
+
"previous",
|
|
780
|
+
"⏮",
|
|
781
|
+
"secondary"
|
|
782
|
+
],
|
|
783
|
+
[
|
|
784
|
+
"play",
|
|
785
|
+
"▶",
|
|
786
|
+
isPlaying ? "secondary" : "primary"
|
|
787
|
+
],
|
|
788
|
+
[
|
|
789
|
+
"pause",
|
|
790
|
+
"⏸",
|
|
791
|
+
isPlaying ? "primary" : "secondary"
|
|
792
|
+
],
|
|
793
|
+
[
|
|
794
|
+
"next",
|
|
795
|
+
"⏭",
|
|
796
|
+
"secondary"
|
|
797
|
+
]
|
|
798
|
+
]) {
|
|
799
|
+
const button = createControlButton(label, lineActionData(key, device), style);
|
|
800
|
+
if (key !== "previous") button.margin = "md";
|
|
801
|
+
controlButtons.push(button);
|
|
802
|
+
}
|
|
803
|
+
bubble.footer = cardBox("vertical", [cardBox("horizontal", controlButtons)], {
|
|
804
|
+
paddingAll: "lg",
|
|
805
|
+
backgroundColor: "#FAFAFA"
|
|
806
|
+
});
|
|
977
807
|
return {
|
|
978
808
|
altText: `🎵 ${card.title}${card.artist ? ` - ${card.artist}` : ""}`,
|
|
979
|
-
contents:
|
|
980
|
-
title: card.title,
|
|
981
|
-
subtitle: card.artist,
|
|
982
|
-
source: card.source,
|
|
983
|
-
imageUrl: card.imageUrl,
|
|
984
|
-
isPlaying: card.status ? card.status === "playing" : void 0,
|
|
985
|
-
controls: {
|
|
986
|
-
previous: { data: lineActionData("previous", device) },
|
|
987
|
-
play: { data: lineActionData("play", device) },
|
|
988
|
-
pause: { data: lineActionData("pause", device) },
|
|
989
|
-
next: { data: lineActionData("next", device) }
|
|
990
|
-
}
|
|
991
|
-
})
|
|
809
|
+
contents: bubble
|
|
992
810
|
};
|
|
993
811
|
}
|
|
994
812
|
if (card.type === "event") return {
|
|
@@ -1000,39 +818,98 @@ function renderLineCard(card) {
|
|
|
1000
818
|
contents: createAgendaCard(card)
|
|
1001
819
|
};
|
|
1002
820
|
const device = toSlug(card.type === "device" ? card.name : card.name || "apple_tv");
|
|
1003
|
-
if (card.type === "device")
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
})
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
821
|
+
if (card.type === "device") {
|
|
822
|
+
const headerContents = [cardBox("horizontal", [cardBox("vertical", [], {
|
|
823
|
+
width: "10px",
|
|
824
|
+
height: "10px",
|
|
825
|
+
backgroundColor: "#06C755",
|
|
826
|
+
cornerRadius: "5px"
|
|
827
|
+
}), {
|
|
828
|
+
...createCardTitle(card.name),
|
|
829
|
+
flex: 1,
|
|
830
|
+
margin: "md"
|
|
831
|
+
}], { alignItems: "center" })];
|
|
832
|
+
if (card.deviceType) headerContents.push(cardText(card.deviceType, {
|
|
833
|
+
size: "sm",
|
|
834
|
+
color: "#888888",
|
|
835
|
+
margin: "sm"
|
|
836
|
+
}));
|
|
837
|
+
if (card.status) headerContents.push(cardBox("vertical", [cardText(card.status, {
|
|
838
|
+
size: "sm",
|
|
839
|
+
color: "#444444",
|
|
840
|
+
wrap: true
|
|
841
|
+
})], {
|
|
842
|
+
margin: "lg",
|
|
843
|
+
paddingAll: "md",
|
|
844
|
+
backgroundColor: "#F8F9FA",
|
|
845
|
+
cornerRadius: "md"
|
|
846
|
+
}));
|
|
847
|
+
const bubble = createCardBubble(headerContents);
|
|
848
|
+
const controls = card.controls ?? [];
|
|
849
|
+
if (controls.length > 0) {
|
|
850
|
+
const rows = [];
|
|
851
|
+
const limitedControls = controls.slice(0, 6);
|
|
852
|
+
for (let i = 0; i < limitedControls.length; i += 2) {
|
|
853
|
+
const rowButtons = [];
|
|
854
|
+
for (const [offset, ctrl] of limitedControls.slice(i, i + 2).entries()) rowButtons.push({
|
|
855
|
+
...createControlButton(truncateLineActionLabel(ctrl.label, 18), lineActionData(ctrl.action, device)),
|
|
856
|
+
margin: offset > 0 ? "md" : void 0
|
|
857
|
+
});
|
|
858
|
+
if (rowButtons.length === 1) rowButtons.push({ type: "filler" });
|
|
859
|
+
rows.push(cardBox("horizontal", rowButtons, { margin: i > 0 ? "md" : void 0 }));
|
|
860
|
+
}
|
|
861
|
+
bubble.footer = cardBox("vertical", rows, {
|
|
862
|
+
paddingAll: "lg",
|
|
863
|
+
backgroundColor: "#FAFAFA"
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
return {
|
|
867
|
+
altText: `📱 ${card.name}${card.status ? `: ${card.status}` : ""}`,
|
|
868
|
+
contents: bubble
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
const headerContents = [createCardTitle(card.name || "Apple TV")];
|
|
872
|
+
if (card.status) headerContents.push(cardText(card.status, {
|
|
873
|
+
size: "sm",
|
|
874
|
+
color: "#666666",
|
|
875
|
+
wrap: true,
|
|
876
|
+
margin: "sm"
|
|
877
|
+
}));
|
|
878
|
+
const controlRows = [
|
|
879
|
+
[void 0, [
|
|
880
|
+
null,
|
|
881
|
+
["↑", "up"],
|
|
882
|
+
null
|
|
883
|
+
]],
|
|
884
|
+
["md", [
|
|
885
|
+
["←", "left"],
|
|
886
|
+
["OK", "select"],
|
|
887
|
+
["→", "right"]
|
|
888
|
+
]],
|
|
889
|
+
["md", [
|
|
890
|
+
null,
|
|
891
|
+
["↓", "down"],
|
|
892
|
+
null
|
|
893
|
+
]],
|
|
894
|
+
["lg", [["Menu", "menu"], ["Home", "home"]]],
|
|
895
|
+
["md", [["Play", "play"], ["Pause", "pause"]]],
|
|
896
|
+
["md", [
|
|
897
|
+
["Vol +", "volume_up"],
|
|
898
|
+
["Mute", "mute"],
|
|
899
|
+
["Vol -", "volume_down"]
|
|
900
|
+
]]
|
|
901
|
+
].map(([margin, buttons]) => cardBox("horizontal", buttons.map((button) => button ? createControlButton(button[0], lineActionData(button[1], device), button[1] === "select" ? "primary" : "secondary") : { type: "filler" }), margin ? { margin } : {}));
|
|
1029
902
|
return {
|
|
1030
903
|
altText: `📺 ${card.name || "Apple TV"} Remote`,
|
|
1031
|
-
contents:
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
904
|
+
contents: createCardBubble([
|
|
905
|
+
cardBox("vertical", headerContents),
|
|
906
|
+
{
|
|
907
|
+
type: "separator",
|
|
908
|
+
margin: "lg",
|
|
909
|
+
color: "#EEEEEE"
|
|
910
|
+
},
|
|
911
|
+
...controlRows
|
|
912
|
+
])
|
|
1036
913
|
};
|
|
1037
914
|
}
|
|
1038
915
|
function createLineQuickReply(items) {
|
|
@@ -1043,7 +920,7 @@ function createLineQuickReply(items) {
|
|
|
1043
920
|
}
|
|
1044
921
|
//#endregion
|
|
1045
922
|
//#region extensions/line/src/outbound.ts
|
|
1046
|
-
const loadLineOutboundRuntime = createLazyRuntimeModule(() => import("./outbound.runtime-
|
|
923
|
+
const loadLineOutboundRuntime = createLazyRuntimeModule(() => import("./outbound.runtime-BPo_111h.mjs"));
|
|
1047
924
|
function quotedOption(quoteToken) {
|
|
1048
925
|
return quoteToken ? { quoteToken } : {};
|
|
1049
926
|
}
|
|
@@ -1066,7 +943,6 @@ const lineOutboundAdapter = {
|
|
|
1066
943
|
const locationMessage = location ? outboundRuntime.createLocationMessage(location) : null;
|
|
1067
944
|
const { pushMessageLine: sendText, pushMessagesLine: sendBatch, pushFlexMessage: sendFlex, pushTemplateMessage: sendTemplate, pushLocationMessage: sendLocation, pushTextMessageWithQuickReplies: sendQuickReplies, buildTemplateMessageFromPayload: buildTemplate } = outboundRuntime;
|
|
1068
945
|
const sendOptions = {
|
|
1069
|
-
verbose: false,
|
|
1070
946
|
cfg,
|
|
1071
947
|
accountId: accountId ?? void 0,
|
|
1072
948
|
authorize: assertDirectAdapterHandoff ? () => {
|
|
@@ -1083,12 +959,12 @@ const lineOutboundAdapter = {
|
|
|
1083
959
|
} catch (error) {
|
|
1084
960
|
if (acceptedResults.length > 0) {
|
|
1085
961
|
const partial = isChannelPartialDeliveryError(error) ? error : void 0;
|
|
1086
|
-
const receipt = createMessageReceiptFromOutboundResults({ results: [...acceptedResults, ...partial?.deliveryResult.receipt ? [{ receipt: partial.deliveryResult.receipt }] : (partial?.deliveryResult.messageIds ?? []).map((messageId) => ({ messageId }))] });
|
|
1087
962
|
throw createChannelPartialDeliveryError(partial?.cause ?? error, {
|
|
1088
963
|
...partial?.deliveryResult,
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
964
|
+
...createAcceptedChannelDeliveryResult({
|
|
965
|
+
results: acceptedResults,
|
|
966
|
+
deliveryResults: partial ? [partial.deliveryResult] : void 0
|
|
967
|
+
})
|
|
1092
968
|
});
|
|
1093
969
|
}
|
|
1094
970
|
const refusal = isChannelPartialDeliveryError(error) ? void 0 : await explainLineRefusal({
|
|
@@ -1105,12 +981,7 @@ const lineOutboundAdapter = {
|
|
|
1105
981
|
try {
|
|
1106
982
|
await onDeliveryResult?.(createEmptyChannelResult("line", { ...result }));
|
|
1107
983
|
} catch (error) {
|
|
1108
|
-
|
|
1109
|
-
throw createChannelPartialDeliveryError(error, {
|
|
1110
|
-
messageIds: listMessageReceiptPlatformIds(receipt),
|
|
1111
|
-
receipt,
|
|
1112
|
-
visibleReplySent: true
|
|
1113
|
-
});
|
|
984
|
+
throw createChannelPartialDeliveryError(error, createAcceptedChannelDeliveryResult({ results: acceptedResults }));
|
|
1114
985
|
}
|
|
1115
986
|
return result;
|
|
1116
987
|
};
|
|
@@ -1147,7 +1018,7 @@ const lineOutboundAdapter = {
|
|
|
1147
1018
|
}));
|
|
1148
1019
|
};
|
|
1149
1020
|
const processed = payload.text ? outboundRuntime.processLineMessage(payload.text) : [];
|
|
1150
|
-
const chunkLimit = runtime.channel.text.resolveTextChunkLimit
|
|
1021
|
+
const chunkLimit = runtime.channel.text.resolveTextChunkLimit(cfg, "line", accountId ?? void 0, { fallbackLimit: 5e3 });
|
|
1151
1022
|
const orderedMessages = processed.flatMap((segment) => segment.type === "flex" ? [segment.message] : runtime.channel.text.chunkMarkdownText(segment.text, chunkLimit).map((text) => ({
|
|
1152
1023
|
type: "text",
|
|
1153
1024
|
text
|
|
@@ -1249,7 +1120,6 @@ const lineOutboundAdapter = {
|
|
|
1249
1120
|
payload: { text: ctx.text }
|
|
1250
1121
|
}),
|
|
1251
1122
|
sendMedia: async ({ cfg, to, text, mediaUrl, accountId, replyToId, assertDirectAdapterHandoff }) => await (await loadLineOutboundRuntime()).pushMessageLine(to, text, {
|
|
1252
|
-
verbose: false,
|
|
1253
1123
|
mediaUrl,
|
|
1254
1124
|
cfg,
|
|
1255
1125
|
accountId: accountId ?? void 0,
|
|
@@ -1295,7 +1165,7 @@ const lineMessageAdapter = createChannelMessageAdapterFromOutbound({
|
|
|
1295
1165
|
});
|
|
1296
1166
|
//#endregion
|
|
1297
1167
|
//#region extensions/line/src/channel.ts
|
|
1298
|
-
const loadLineChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-
|
|
1168
|
+
const loadLineChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-CdfKsNz4.mjs"));
|
|
1299
1169
|
const lineSecurityAdapter = createRestrictSendersChannelSecurity({
|
|
1300
1170
|
channelKey: "line",
|
|
1301
1171
|
resolveDmPolicy: (account) => account.config.dmPolicy,
|
|
@@ -1311,6 +1181,11 @@ const lineSecurityAdapter = createRestrictSendersChannelSecurity({
|
|
|
1311
1181
|
approveHint: "openclaw pairing approve line <code>",
|
|
1312
1182
|
normalizeDmEntry: (raw) => raw.replace(/^line:(?:user:)?/i, "")
|
|
1313
1183
|
});
|
|
1184
|
+
function normalizeLineConversationId(raw) {
|
|
1185
|
+
const trimmed = raw?.trim() ?? "";
|
|
1186
|
+
if (!trimmed) return null;
|
|
1187
|
+
return (trimmed.match(/^line:(?:(?:user|group|room):)?(.+)$/i)?.[1] ?? trimmed).trim() || null;
|
|
1188
|
+
}
|
|
1314
1189
|
function normalizeLineDirectoryId(entry, kind) {
|
|
1315
1190
|
const id = normalizeLineMessagingTarget(entry);
|
|
1316
1191
|
return id && inferLineTargetChatType(id) === kind ? id : null;
|
|
@@ -1320,7 +1195,17 @@ const linePlugin = createChatChannelPlugin({
|
|
|
1320
1195
|
id: "line",
|
|
1321
1196
|
...lineChannelPluginCommon,
|
|
1322
1197
|
setupWizard: lineSetupWizard,
|
|
1323
|
-
groups: { resolveRequireMention:
|
|
1198
|
+
groups: { resolveRequireMention: (params) => {
|
|
1199
|
+
const tree = buildChannelGroupsScopeTree(params.cfg, "line", params.accountId);
|
|
1200
|
+
const matchedKey = resolveExactLineGroupConfigKey({
|
|
1201
|
+
groups: tree.scopes,
|
|
1202
|
+
groupId: params.groupId
|
|
1203
|
+
});
|
|
1204
|
+
return resolveScopeRequireMention({
|
|
1205
|
+
tree,
|
|
1206
|
+
path: matchedKey ? [matchedKey] : []
|
|
1207
|
+
});
|
|
1208
|
+
} },
|
|
1324
1209
|
allowlist: buildDmGroupAccountAllowlistAdapter({
|
|
1325
1210
|
channelId: "line",
|
|
1326
1211
|
resolveAccount: ({ cfg, accountId }) => resolveLineAccount({
|
|
@@ -1366,7 +1251,10 @@ const linePlugin = createChatChannelPlugin({
|
|
|
1366
1251
|
to: peerId
|
|
1367
1252
|
});
|
|
1368
1253
|
},
|
|
1369
|
-
resolveInboundConversation:
|
|
1254
|
+
resolveInboundConversation: (params) => {
|
|
1255
|
+
const conversationId = normalizeLineConversationId(params.conversationId) ?? normalizeLineConversationId(params.to);
|
|
1256
|
+
return conversationId ? { conversationId } : null;
|
|
1257
|
+
},
|
|
1370
1258
|
targetResolver: {
|
|
1371
1259
|
looksLikeId: (id) => {
|
|
1372
1260
|
const trimmed = id?.trim();
|
|
@@ -1415,7 +1303,24 @@ const linePlugin = createChatChannelPlugin({
|
|
|
1415
1303
|
} },
|
|
1416
1304
|
message: lineMessageAdapter,
|
|
1417
1305
|
actions: lineMessageActions,
|
|
1418
|
-
bindings:
|
|
1306
|
+
bindings: {
|
|
1307
|
+
compileConfiguredBinding: ({ conversationId }) => {
|
|
1308
|
+
const normalized = normalizeLineConversationId(conversationId);
|
|
1309
|
+
return normalized ? { conversationId: normalized } : null;
|
|
1310
|
+
},
|
|
1311
|
+
matchInboundConversation: ({ compiledBinding, conversationId }) => {
|
|
1312
|
+
const normalizedIncoming = normalizeLineConversationId(conversationId);
|
|
1313
|
+
if (!normalizedIncoming || compiledBinding.conversationId !== normalizedIncoming) return null;
|
|
1314
|
+
return {
|
|
1315
|
+
conversationId: normalizedIncoming,
|
|
1316
|
+
matchPriority: 2
|
|
1317
|
+
};
|
|
1318
|
+
},
|
|
1319
|
+
resolveCommandConversation: (params) => {
|
|
1320
|
+
const conversationId = normalizeLineConversationId(params.originatingTo) ?? normalizeLineConversationId(params.commandTo) ?? normalizeLineConversationId(params.fallbackTo);
|
|
1321
|
+
return conversationId ? { conversationId } : null;
|
|
1322
|
+
}
|
|
1323
|
+
},
|
|
1419
1324
|
conversationBindings: { defaultTopLevelPlacement: "current" },
|
|
1420
1325
|
agentPrompt: {
|
|
1421
1326
|
messageToolCapabilities: () => ["inlineButtons"],
|