@openclaw/line 2026.10.10 → 2026.11.5-beta.1
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-Bz8QPCGD.mjs → api-ByXjHPMe.mjs} +1 -1
- package/dist/.setup/api-DCMpIrda.mjs +3 -0
- package/dist/.setup/{card-command-XYkg1XvG.mjs → card-command-utjlRvb-.mjs} +26 -43
- package/dist/.setup/{channel-ezTshIoC.mjs → channel-D9i_xlsJ.mjs} +237 -329
- package/dist/.setup/channel.runtime-C-E2qsIu.mjs +4 -0
- package/dist/.setup/{monitor-BBEBldZu.mjs → monitor-BYGe2Y7S.mjs} +240 -328
- package/dist/.setup/{outbound.runtime-BSuF2lax.mjs → outbound.runtime-AQvUJvJV.mjs} +2 -2
- package/dist/.setup/{send-B8TYfTO_.mjs → send-H86JOXWw.mjs} +37 -103
- package/dist/.setup/{send-retry-gHsCgBlf.mjs → send-retry-D6J7bThI.mjs} +174 -80
- package/dist/.setup/{template-messages-CdpQxqqb.mjs → template-messages-KG1GwG0h.mjs} +32 -44
- package/dist/.source-module-urls/2c97352967966b7ab9f67f528eb25c098b6fe10ea0e4616ffae3851ed839d81e.json +1 -1
- package/dist/api.js +2 -2
- package/dist/channel-plugin-api.js +1 -1
- package/dist/index.js +1 -1
- 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-EJnP_1cJ.mjs +0 -3
- package/dist/.setup/channel.runtime-4w8EffJb.mjs +0 -4
- package/dist/.setup/monitor.runtime-BWIgUqzC.mjs +0 -1
- package/dist/.setup/probe.runtime-a-fC57xd.mjs +0 -1
- 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-D6J7bThI.mjs";
|
|
1
2
|
import { n as resolveDefaultLineAccountId, r as resolveLineAccount, t as listLineAccountIds } from "./accounts-Dm_NoU7R.mjs";
|
|
2
3
|
import { a as normalizeLineAllowEntry, i as hasLineCredentials, r as lineSetupContract, t as lineSetupWizard } from "./setup-surface-DvbBjHFi.mjs";
|
|
3
4
|
import { t as getLineRuntime } from "./runtime-C9ldw-V4.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-gHsCgBlf.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,51 +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
|
-
// 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
29
|
// extensions/line/src/config-adapter.ts
|
|
60
30
|
const lineConfigAdapter = createScopedChannelConfigAdapter({
|
|
61
31
|
sectionKey: "line",
|
|
@@ -158,8 +128,8 @@ const lineChannelPluginCommon = {
|
|
|
158
128
|
account,
|
|
159
129
|
configured: hasLineCredentials(account),
|
|
160
130
|
extra: {
|
|
161
|
-
tokenSource: account.tokenSource
|
|
162
|
-
signingSecretSource: account.signingSecretSource
|
|
131
|
+
tokenSource: account.tokenSource,
|
|
132
|
+
signingSecretSource: account.signingSecretSource,
|
|
163
133
|
tokenStatus: account.tokenStatus,
|
|
164
134
|
signingSecretStatus: account.signingSecretStatus
|
|
165
135
|
}
|
|
@@ -214,21 +184,19 @@ function classifyAllowFrom(values) {
|
|
|
214
184
|
* map outright instead of merging entry by entry. Reading both scopes together would
|
|
215
185
|
* credit an account with groups its runtime never sees.
|
|
216
186
|
*/
|
|
217
|
-
function
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
return Object.entries(groups).filter((entry) => isRecord(entry[1]));
|
|
221
|
-
}
|
|
222
|
-
function inspectLineGroupCoverage(params) {
|
|
187
|
+
function readLineGroupCoverage(params) {
|
|
188
|
+
const { account, parent } = params;
|
|
189
|
+
const groupAllowFrom = firstDefined(account.groupAllowFrom, parent?.groupAllowFrom);
|
|
223
190
|
const empty = {
|
|
224
191
|
group: [],
|
|
225
192
|
defaults: [],
|
|
226
193
|
channel: []
|
|
227
194
|
};
|
|
228
|
-
const
|
|
195
|
+
const sourceGroups = isRecord(account.groups) ? account.groups : parent?.groups;
|
|
196
|
+
const entries = isRecord(sourceGroups) ? Object.entries(sourceGroups).filter((entry) => isRecord(entry[1])) : [];
|
|
229
197
|
const groups = Object.fromEntries(entries);
|
|
230
198
|
const defaults = groups[GROUP_DEFAULTS_KEY];
|
|
231
|
-
const defaultCoverage = classifyAllowFrom(firstDefined(defaults?.allowFrom,
|
|
199
|
+
const defaultCoverage = classifyAllowFrom(firstDefined(defaults?.allowFrom, groupAllowFrom));
|
|
232
200
|
let covered = defaults?.enabled !== false && defaultCoverage.covered;
|
|
233
201
|
const referenceBacked = defaults?.enabled !== false && defaultCoverage.referenced ? [GROUP_DEFAULTS_KEY] : [];
|
|
234
202
|
const uncovered = [];
|
|
@@ -241,13 +209,13 @@ function inspectLineGroupCoverage(params) {
|
|
|
241
209
|
}) !== id) continue;
|
|
242
210
|
const effectiveGroup = resolveLineGroupConfigEntry(groups, { groupId });
|
|
243
211
|
if (effectiveGroup?.enabled === false) continue;
|
|
244
|
-
const allowlist = classifyAllowFrom(firstDefined(effectiveGroup?.allowFrom,
|
|
212
|
+
const allowlist = classifyAllowFrom(firstDefined(effectiveGroup?.allowFrom, groupAllowFrom));
|
|
245
213
|
if (allowlist.referenced) referenceBacked.push(id);
|
|
246
214
|
if (allowlist.covered) covered = true;
|
|
247
215
|
else if (allowlist.referenced) continue;
|
|
248
216
|
else if (group.allowFrom !== void 0) empty.group.push(id);
|
|
249
217
|
else if (defaults?.allowFrom !== void 0) empty.defaults.push(id);
|
|
250
|
-
else if (
|
|
218
|
+
else if (groupAllowFrom !== void 0) empty.channel.push(id);
|
|
251
219
|
else uncovered.push(id);
|
|
252
220
|
}
|
|
253
221
|
return {
|
|
@@ -257,19 +225,8 @@ function inspectLineGroupCoverage(params) {
|
|
|
257
225
|
empty
|
|
258
226
|
};
|
|
259
227
|
}
|
|
260
|
-
function readLineGroupCoverage(params) {
|
|
261
|
-
const { account, parent } = params;
|
|
262
|
-
return inspectLineGroupCoverage({
|
|
263
|
-
account,
|
|
264
|
-
...parent ? { parent } : {},
|
|
265
|
-
groupAllowFrom: firstDefined(account.groupAllowFrom, parent?.groupAllowFrom)
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
function readGroupPolicy(value) {
|
|
269
|
-
return typeof value === "string" ? value : void 0;
|
|
270
|
-
}
|
|
271
228
|
function isLineGroupAllowlistScope(params) {
|
|
272
|
-
return params.channelName === "line" && (
|
|
229
|
+
return params.channelName === "line" && (readStringValue(params.account.groupPolicy) ?? readStringValue(params.parent?.groupPolicy)) === "allowlist";
|
|
273
230
|
}
|
|
274
231
|
function formatGroupIds(ids) {
|
|
275
232
|
return ids.map((id) => `"${id}"`).join(", ");
|
|
@@ -338,8 +295,9 @@ function describeLineWebhookDelivery(params) {
|
|
|
338
295
|
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`
|
|
339
296
|
};
|
|
340
297
|
}
|
|
341
|
-
|
|
342
|
-
|
|
298
|
+
const lineStatusAdapter = createComputedAccountStatusAdapter({
|
|
299
|
+
defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID),
|
|
300
|
+
collectStatusIssues: (accounts) => [...collectLineCredentialIssues(accounts), ...collectIssuesForEnabledAccounts({
|
|
343
301
|
accounts,
|
|
344
302
|
readAccount: (account) => account.configured === false ? null : account,
|
|
345
303
|
collectIssues: ({ account, accountId, issues }) => {
|
|
@@ -351,13 +309,9 @@ function collectLineWebhookIssues(accounts) {
|
|
|
351
309
|
...delivery
|
|
352
310
|
});
|
|
353
311
|
}
|
|
354
|
-
})
|
|
355
|
-
}
|
|
356
|
-
const lineStatusAdapter = createComputedAccountStatusAdapter({
|
|
357
|
-
defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID),
|
|
358
|
-
collectStatusIssues: (accounts) => [...collectLineCredentialIssues(accounts), ...collectLineWebhookIssues(accounts)],
|
|
312
|
+
})],
|
|
359
313
|
buildChannelSummary: ({ snapshot }) => buildTokenChannelStatusSummary(snapshot),
|
|
360
|
-
probeAccount: async ({ account, timeoutMs }) => await (await import("./
|
|
314
|
+
probeAccount: async ({ account, timeoutMs }) => await (await import("./send-retry-D6J7bThI.mjs").then((n) => n.o)).probeLineBot(account.channelAccessToken, timeoutMs),
|
|
361
315
|
resolveAccountSnapshot: ({ account, probe }) => ({
|
|
362
316
|
accountId: account.accountId,
|
|
363
317
|
name: account.name,
|
|
@@ -388,7 +342,7 @@ const lineGatewayAdapter = {
|
|
|
388
342
|
statusSink({ lifecycle: "starting" });
|
|
389
343
|
let lineBotLabel = "";
|
|
390
344
|
try {
|
|
391
|
-
const probe = await (await import("./
|
|
345
|
+
const probe = await (await import("./send-retry-D6J7bThI.mjs").then((n) => n.o)).probeLineBot(token, 2500);
|
|
392
346
|
const displayName = probe.ok ? probe.bot?.displayName?.trim() : null;
|
|
393
347
|
if (displayName) lineBotLabel = ` (${displayName})`;
|
|
394
348
|
const delivery = describeLineWebhookDelivery({ webhook: probe.ok ? probe.webhook : void 0 });
|
|
@@ -397,7 +351,7 @@ const lineGatewayAdapter = {
|
|
|
397
351
|
if (getLineRuntime().logging.shouldLogVerbose()) ctx.log?.debug?.(`[${account.accountId}] bot check failed: ${String(err)}`);
|
|
398
352
|
}
|
|
399
353
|
ctx.log?.info(`[${account.accountId}] starting LINE provider${lineBotLabel}`);
|
|
400
|
-
const { monitorLineProvider } = await import("./monitor
|
|
354
|
+
const { monitorLineProvider } = await import("./monitor-BYGe2Y7S.mjs");
|
|
401
355
|
return await monitorLineProvider({
|
|
402
356
|
channelAccessToken: token,
|
|
403
357
|
channelSecret: secret,
|
|
@@ -439,210 +393,12 @@ const lineGatewayAdapter = {
|
|
|
439
393
|
};
|
|
440
394
|
}
|
|
441
395
|
};
|
|
442
|
-
// extensions/line/src/group-policy.ts
|
|
443
|
-
function resolveLineGroupRequireMention(params) {
|
|
444
|
-
const tree = buildChannelGroupsScopeTree(params.cfg, "line", params.accountId);
|
|
445
|
-
const matchedKey = resolveExactLineGroupConfigKey({
|
|
446
|
-
groups: tree.scopes,
|
|
447
|
-
groupId: params.groupId
|
|
448
|
-
});
|
|
449
|
-
return resolveScopeRequireMention({
|
|
450
|
-
tree,
|
|
451
|
-
path: matchedKey ? [matchedKey] : []
|
|
452
|
-
});
|
|
453
|
-
}
|
|
454
396
|
// extensions/line/src/quick-reply-fallback.ts
|
|
455
397
|
function buildLineQuickReplyFallbackText(labels) {
|
|
456
398
|
const normalized = normalizeStringEntries(labels).slice(0, 13);
|
|
457
399
|
if (normalized.length === 0) return "Choose an option.";
|
|
458
400
|
return `Options:\n${normalized.map((label) => `- ${label}`).join("\n")}`;
|
|
459
401
|
}
|
|
460
|
-
// extensions/line/src/flex-templates/media-control-cards.ts
|
|
461
|
-
function createControlButton(label, data, style = "secondary") {
|
|
462
|
-
return {
|
|
463
|
-
type: "button",
|
|
464
|
-
action: postbackAction(label, data),
|
|
465
|
-
style,
|
|
466
|
-
height: "sm",
|
|
467
|
-
flex: 1
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
function createMediaPlayerCard(params) {
|
|
471
|
-
const { title, subtitle, source, imageUrl, isPlaying, controls } = params;
|
|
472
|
-
const trackInfo = [createCardTitle(title)];
|
|
473
|
-
if (subtitle) trackInfo.push(cardText(subtitle, {
|
|
474
|
-
size: "md",
|
|
475
|
-
color: "#666666",
|
|
476
|
-
wrap: true,
|
|
477
|
-
margin: "sm"
|
|
478
|
-
}));
|
|
479
|
-
const statusItems = [];
|
|
480
|
-
if (isPlaying !== void 0) statusItems.push(cardBox("horizontal", [cardBox("vertical", [], {
|
|
481
|
-
width: "8px",
|
|
482
|
-
height: "8px",
|
|
483
|
-
backgroundColor: isPlaying ? "#06C755" : "#CCCCCC",
|
|
484
|
-
cornerRadius: "4px"
|
|
485
|
-
}), cardText(isPlaying ? "Now Playing" : "Paused", {
|
|
486
|
-
size: "xs",
|
|
487
|
-
color: isPlaying ? "#06C755" : "#888888",
|
|
488
|
-
weight: "bold",
|
|
489
|
-
margin: "sm"
|
|
490
|
-
})], { alignItems: "center" }));
|
|
491
|
-
if (source) statusItems.push(cardText(source, {
|
|
492
|
-
size: "xs",
|
|
493
|
-
color: "#AAAAAA",
|
|
494
|
-
margin: statusItems.length > 0 ? "lg" : void 0
|
|
495
|
-
}));
|
|
496
|
-
const bodyContents = [cardBox("vertical", trackInfo)];
|
|
497
|
-
if (statusItems.length > 0) bodyContents.push(cardBox("horizontal", statusItems, {
|
|
498
|
-
margin: "lg",
|
|
499
|
-
alignItems: "center"
|
|
500
|
-
}));
|
|
501
|
-
const bubble = createCardBubble(bodyContents);
|
|
502
|
-
if (imageUrl) bubble.hero = {
|
|
503
|
-
type: "image",
|
|
504
|
-
url: imageUrl,
|
|
505
|
-
size: "full",
|
|
506
|
-
aspectRatio: "1:1",
|
|
507
|
-
aspectMode: "cover"
|
|
508
|
-
};
|
|
509
|
-
const controlButtons = [];
|
|
510
|
-
for (const [key, label, style] of [
|
|
511
|
-
[
|
|
512
|
-
"previous",
|
|
513
|
-
"⏮",
|
|
514
|
-
"secondary"
|
|
515
|
-
],
|
|
516
|
-
[
|
|
517
|
-
"play",
|
|
518
|
-
"▶",
|
|
519
|
-
isPlaying ? "secondary" : "primary"
|
|
520
|
-
],
|
|
521
|
-
[
|
|
522
|
-
"pause",
|
|
523
|
-
"⏸",
|
|
524
|
-
isPlaying ? "primary" : "secondary"
|
|
525
|
-
],
|
|
526
|
-
[
|
|
527
|
-
"next",
|
|
528
|
-
"⏭",
|
|
529
|
-
"secondary"
|
|
530
|
-
]
|
|
531
|
-
]) {
|
|
532
|
-
const button = createControlButton(label, controls[key].data, style);
|
|
533
|
-
if (key !== "previous") button.margin = "md";
|
|
534
|
-
controlButtons.push(button);
|
|
535
|
-
}
|
|
536
|
-
bubble.footer = cardBox("vertical", [cardBox("horizontal", controlButtons)], {
|
|
537
|
-
paddingAll: "lg",
|
|
538
|
-
backgroundColor: "#FAFAFA"
|
|
539
|
-
});
|
|
540
|
-
return bubble;
|
|
541
|
-
}
|
|
542
|
-
function createAppleTvRemoteCard(params) {
|
|
543
|
-
const { deviceName, status, actionData } = params;
|
|
544
|
-
const headerContents = [createCardTitle(deviceName)];
|
|
545
|
-
if (status) headerContents.push(cardText(status, {
|
|
546
|
-
size: "sm",
|
|
547
|
-
color: "#666666",
|
|
548
|
-
wrap: true,
|
|
549
|
-
margin: "sm"
|
|
550
|
-
}));
|
|
551
|
-
const labels = {
|
|
552
|
-
up: "↑",
|
|
553
|
-
down: "↓",
|
|
554
|
-
left: "←",
|
|
555
|
-
right: "→",
|
|
556
|
-
select: "OK",
|
|
557
|
-
menu: "Menu",
|
|
558
|
-
home: "Home",
|
|
559
|
-
play: "Play",
|
|
560
|
-
pause: "Pause",
|
|
561
|
-
volumeUp: "Vol +",
|
|
562
|
-
volumeDown: "Vol -",
|
|
563
|
-
mute: "Mute"
|
|
564
|
-
};
|
|
565
|
-
const controlRows = [
|
|
566
|
-
[void 0, [
|
|
567
|
-
null,
|
|
568
|
-
"up",
|
|
569
|
-
null
|
|
570
|
-
]],
|
|
571
|
-
["md", [
|
|
572
|
-
"left",
|
|
573
|
-
"select",
|
|
574
|
-
"right"
|
|
575
|
-
]],
|
|
576
|
-
["md", [
|
|
577
|
-
null,
|
|
578
|
-
"down",
|
|
579
|
-
null
|
|
580
|
-
]],
|
|
581
|
-
["lg", ["menu", "home"]],
|
|
582
|
-
["md", ["play", "pause"]],
|
|
583
|
-
["md", [
|
|
584
|
-
"volumeUp",
|
|
585
|
-
"mute",
|
|
586
|
-
"volumeDown"
|
|
587
|
-
]]
|
|
588
|
-
].map(([margin, buttons]) => cardBox("horizontal", buttons.map((key) => key ? createControlButton(labels[key], actionData[key], key === "select" ? "primary" : "secondary") : { type: "filler" }), margin ? { margin } : {}));
|
|
589
|
-
return createCardBubble([
|
|
590
|
-
cardBox("vertical", headerContents),
|
|
591
|
-
{
|
|
592
|
-
type: "separator",
|
|
593
|
-
margin: "lg",
|
|
594
|
-
color: "#EEEEEE"
|
|
595
|
-
},
|
|
596
|
-
...controlRows
|
|
597
|
-
]);
|
|
598
|
-
}
|
|
599
|
-
function createDeviceControlCard(params) {
|
|
600
|
-
const { deviceName, deviceType, status, controls } = params;
|
|
601
|
-
const headerContents = [cardBox("horizontal", [cardBox("vertical", [], {
|
|
602
|
-
width: "10px",
|
|
603
|
-
height: "10px",
|
|
604
|
-
backgroundColor: "#06C755",
|
|
605
|
-
cornerRadius: "5px"
|
|
606
|
-
}), {
|
|
607
|
-
...createCardTitle(deviceName),
|
|
608
|
-
flex: 1,
|
|
609
|
-
margin: "md"
|
|
610
|
-
}], { alignItems: "center" })];
|
|
611
|
-
if (deviceType) headerContents.push(cardText(deviceType, {
|
|
612
|
-
size: "sm",
|
|
613
|
-
color: "#888888",
|
|
614
|
-
margin: "sm"
|
|
615
|
-
}));
|
|
616
|
-
if (status) headerContents.push(cardBox("vertical", [cardText(status, {
|
|
617
|
-
size: "sm",
|
|
618
|
-
color: "#444444",
|
|
619
|
-
wrap: true
|
|
620
|
-
})], {
|
|
621
|
-
margin: "lg",
|
|
622
|
-
paddingAll: "md",
|
|
623
|
-
backgroundColor: "#F8F9FA",
|
|
624
|
-
cornerRadius: "md"
|
|
625
|
-
}));
|
|
626
|
-
const bubble = createCardBubble(headerContents);
|
|
627
|
-
if (controls.length > 0) {
|
|
628
|
-
const rows = [];
|
|
629
|
-
const limitedControls = controls.slice(0, 6);
|
|
630
|
-
for (let i = 0; i < limitedControls.length; i += 2) {
|
|
631
|
-
const rowButtons = [];
|
|
632
|
-
for (const [offset, ctrl] of limitedControls.slice(i, i + 2).entries()) rowButtons.push({
|
|
633
|
-
...createControlButton(truncateLineActionLabel(ctrl.label, 18), ctrl.data),
|
|
634
|
-
margin: offset > 0 ? "md" : void 0
|
|
635
|
-
});
|
|
636
|
-
if (rowButtons.length === 1) rowButtons.push({ type: "filler" });
|
|
637
|
-
rows.push(cardBox("horizontal", rowButtons, { margin: i > 0 ? "md" : void 0 }));
|
|
638
|
-
}
|
|
639
|
-
bubble.footer = cardBox("vertical", rows, {
|
|
640
|
-
paddingAll: "lg",
|
|
641
|
-
backgroundColor: "#FAFAFA"
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
return bubble;
|
|
645
|
-
}
|
|
646
402
|
// extensions/line/src/question-postback.ts
|
|
647
403
|
const QUESTION_ID_PARAM = "line.question";
|
|
648
404
|
const OPTION_INDEX_PARAM = "line.option";
|
|
@@ -657,7 +413,6 @@ function buildLineQuestionPostbackData(callback) {
|
|
|
657
413
|
const data = params.toString();
|
|
658
414
|
return Buffer.byteLength(data, "utf8") <= POSTBACK_DATA_MAX_BYTES ? data : void 0;
|
|
659
415
|
}
|
|
660
|
-
/** Reads a question choice back out of inbound postback data, if it carries one. */
|
|
661
416
|
function parseLineQuestionPostbackData(data) {
|
|
662
417
|
if (!data.includes(QUESTION_ID_PARAM)) return;
|
|
663
418
|
const params = new URLSearchParams(data);
|
|
@@ -959,24 +714,90 @@ async function prepareLineReplyPayload(payload, to) {
|
|
|
959
714
|
}
|
|
960
715
|
const toSlug = (value) => normalizeLowercaseStringOrEmpty(value).replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "device";
|
|
961
716
|
const lineActionData = (action, device) => `line.action=${encodeURIComponent(action)}&line.device=${encodeURIComponent(device)}`;
|
|
717
|
+
function createControlButton(label, data, style = "secondary") {
|
|
718
|
+
return {
|
|
719
|
+
type: "button",
|
|
720
|
+
action: postbackAction(label, data),
|
|
721
|
+
style,
|
|
722
|
+
height: "sm",
|
|
723
|
+
flex: 1
|
|
724
|
+
};
|
|
725
|
+
}
|
|
962
726
|
function renderLineCard(card) {
|
|
963
727
|
if (card.type === "media_player") {
|
|
964
728
|
const device = toSlug(card.source || card.title);
|
|
729
|
+
const isPlaying = card.status ? card.status === "playing" : void 0;
|
|
730
|
+
const trackInfo = [createCardTitle(card.title)];
|
|
731
|
+
if (card.artist) trackInfo.push(cardText(card.artist, {
|
|
732
|
+
size: "md",
|
|
733
|
+
color: "#666666",
|
|
734
|
+
wrap: true,
|
|
735
|
+
margin: "sm"
|
|
736
|
+
}));
|
|
737
|
+
const statusItems = [];
|
|
738
|
+
if (isPlaying !== void 0) statusItems.push(cardBox("horizontal", [cardBox("vertical", [], {
|
|
739
|
+
width: "8px",
|
|
740
|
+
height: "8px",
|
|
741
|
+
backgroundColor: isPlaying ? "#06C755" : "#CCCCCC",
|
|
742
|
+
cornerRadius: "4px"
|
|
743
|
+
}), cardText(isPlaying ? "Now Playing" : "Paused", {
|
|
744
|
+
size: "xs",
|
|
745
|
+
color: isPlaying ? "#06C755" : "#888888",
|
|
746
|
+
weight: "bold",
|
|
747
|
+
margin: "sm"
|
|
748
|
+
})], { alignItems: "center" }));
|
|
749
|
+
if (card.source) statusItems.push(cardText(card.source, {
|
|
750
|
+
size: "xs",
|
|
751
|
+
color: "#AAAAAA",
|
|
752
|
+
margin: statusItems.length > 0 ? "lg" : void 0
|
|
753
|
+
}));
|
|
754
|
+
const bodyContents = [cardBox("vertical", trackInfo)];
|
|
755
|
+
if (statusItems.length > 0) bodyContents.push(cardBox("horizontal", statusItems, {
|
|
756
|
+
margin: "lg",
|
|
757
|
+
alignItems: "center"
|
|
758
|
+
}));
|
|
759
|
+
const bubble = createCardBubble(bodyContents);
|
|
760
|
+
if (card.imageUrl) bubble.hero = {
|
|
761
|
+
type: "image",
|
|
762
|
+
url: card.imageUrl,
|
|
763
|
+
size: "full",
|
|
764
|
+
aspectRatio: "1:1",
|
|
765
|
+
aspectMode: "cover"
|
|
766
|
+
};
|
|
767
|
+
const controlButtons = [];
|
|
768
|
+
for (const [key, label, style] of [
|
|
769
|
+
[
|
|
770
|
+
"previous",
|
|
771
|
+
"⏮",
|
|
772
|
+
"secondary"
|
|
773
|
+
],
|
|
774
|
+
[
|
|
775
|
+
"play",
|
|
776
|
+
"▶",
|
|
777
|
+
isPlaying ? "secondary" : "primary"
|
|
778
|
+
],
|
|
779
|
+
[
|
|
780
|
+
"pause",
|
|
781
|
+
"⏸",
|
|
782
|
+
isPlaying ? "primary" : "secondary"
|
|
783
|
+
],
|
|
784
|
+
[
|
|
785
|
+
"next",
|
|
786
|
+
"⏭",
|
|
787
|
+
"secondary"
|
|
788
|
+
]
|
|
789
|
+
]) {
|
|
790
|
+
const button = createControlButton(label, lineActionData(key, device), style);
|
|
791
|
+
if (key !== "previous") button.margin = "md";
|
|
792
|
+
controlButtons.push(button);
|
|
793
|
+
}
|
|
794
|
+
bubble.footer = cardBox("vertical", [cardBox("horizontal", controlButtons)], {
|
|
795
|
+
paddingAll: "lg",
|
|
796
|
+
backgroundColor: "#FAFAFA"
|
|
797
|
+
});
|
|
965
798
|
return {
|
|
966
799
|
altText: `🎵 ${card.title}${card.artist ? ` - ${card.artist}` : ""}`,
|
|
967
|
-
contents:
|
|
968
|
-
title: card.title,
|
|
969
|
-
subtitle: card.artist,
|
|
970
|
-
source: card.source,
|
|
971
|
-
imageUrl: card.imageUrl,
|
|
972
|
-
isPlaying: card.status ? card.status === "playing" : void 0,
|
|
973
|
-
controls: {
|
|
974
|
-
previous: { data: lineActionData("previous", device) },
|
|
975
|
-
play: { data: lineActionData("play", device) },
|
|
976
|
-
pause: { data: lineActionData("pause", device) },
|
|
977
|
-
next: { data: lineActionData("next", device) }
|
|
978
|
-
}
|
|
979
|
-
})
|
|
800
|
+
contents: bubble
|
|
980
801
|
};
|
|
981
802
|
}
|
|
982
803
|
if (card.type === "event") return {
|
|
@@ -988,39 +809,98 @@ function renderLineCard(card) {
|
|
|
988
809
|
contents: createAgendaCard(card)
|
|
989
810
|
};
|
|
990
811
|
const device = toSlug(card.type === "device" ? card.name : card.name || "apple_tv");
|
|
991
|
-
if (card.type === "device")
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
})
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
812
|
+
if (card.type === "device") {
|
|
813
|
+
const headerContents = [cardBox("horizontal", [cardBox("vertical", [], {
|
|
814
|
+
width: "10px",
|
|
815
|
+
height: "10px",
|
|
816
|
+
backgroundColor: "#06C755",
|
|
817
|
+
cornerRadius: "5px"
|
|
818
|
+
}), {
|
|
819
|
+
...createCardTitle(card.name),
|
|
820
|
+
flex: 1,
|
|
821
|
+
margin: "md"
|
|
822
|
+
}], { alignItems: "center" })];
|
|
823
|
+
if (card.deviceType) headerContents.push(cardText(card.deviceType, {
|
|
824
|
+
size: "sm",
|
|
825
|
+
color: "#888888",
|
|
826
|
+
margin: "sm"
|
|
827
|
+
}));
|
|
828
|
+
if (card.status) headerContents.push(cardBox("vertical", [cardText(card.status, {
|
|
829
|
+
size: "sm",
|
|
830
|
+
color: "#444444",
|
|
831
|
+
wrap: true
|
|
832
|
+
})], {
|
|
833
|
+
margin: "lg",
|
|
834
|
+
paddingAll: "md",
|
|
835
|
+
backgroundColor: "#F8F9FA",
|
|
836
|
+
cornerRadius: "md"
|
|
837
|
+
}));
|
|
838
|
+
const bubble = createCardBubble(headerContents);
|
|
839
|
+
const controls = card.controls ?? [];
|
|
840
|
+
if (controls.length > 0) {
|
|
841
|
+
const rows = [];
|
|
842
|
+
const limitedControls = controls.slice(0, 6);
|
|
843
|
+
for (let i = 0; i < limitedControls.length; i += 2) {
|
|
844
|
+
const rowButtons = [];
|
|
845
|
+
for (const [offset, ctrl] of limitedControls.slice(i, i + 2).entries()) rowButtons.push({
|
|
846
|
+
...createControlButton(truncateLineActionLabel(ctrl.label, 18), lineActionData(ctrl.action, device)),
|
|
847
|
+
margin: offset > 0 ? "md" : void 0
|
|
848
|
+
});
|
|
849
|
+
if (rowButtons.length === 1) rowButtons.push({ type: "filler" });
|
|
850
|
+
rows.push(cardBox("horizontal", rowButtons, { margin: i > 0 ? "md" : void 0 }));
|
|
851
|
+
}
|
|
852
|
+
bubble.footer = cardBox("vertical", rows, {
|
|
853
|
+
paddingAll: "lg",
|
|
854
|
+
backgroundColor: "#FAFAFA"
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
return {
|
|
858
|
+
altText: `📱 ${card.name}${card.status ? `: ${card.status}` : ""}`,
|
|
859
|
+
contents: bubble
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
const headerContents = [createCardTitle(card.name || "Apple TV")];
|
|
863
|
+
if (card.status) headerContents.push(cardText(card.status, {
|
|
864
|
+
size: "sm",
|
|
865
|
+
color: "#666666",
|
|
866
|
+
wrap: true,
|
|
867
|
+
margin: "sm"
|
|
868
|
+
}));
|
|
869
|
+
const controlRows = [
|
|
870
|
+
[void 0, [
|
|
871
|
+
null,
|
|
872
|
+
["↑", "up"],
|
|
873
|
+
null
|
|
874
|
+
]],
|
|
875
|
+
["md", [
|
|
876
|
+
["←", "left"],
|
|
877
|
+
["OK", "select"],
|
|
878
|
+
["→", "right"]
|
|
879
|
+
]],
|
|
880
|
+
["md", [
|
|
881
|
+
null,
|
|
882
|
+
["↓", "down"],
|
|
883
|
+
null
|
|
884
|
+
]],
|
|
885
|
+
["lg", [["Menu", "menu"], ["Home", "home"]]],
|
|
886
|
+
["md", [["Play", "play"], ["Pause", "pause"]]],
|
|
887
|
+
["md", [
|
|
888
|
+
["Vol +", "volume_up"],
|
|
889
|
+
["Mute", "mute"],
|
|
890
|
+
["Vol -", "volume_down"]
|
|
891
|
+
]]
|
|
892
|
+
].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 } : {}));
|
|
1017
893
|
return {
|
|
1018
894
|
altText: `📺 ${card.name || "Apple TV"} Remote`,
|
|
1019
|
-
contents:
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
895
|
+
contents: createCardBubble([
|
|
896
|
+
cardBox("vertical", headerContents),
|
|
897
|
+
{
|
|
898
|
+
type: "separator",
|
|
899
|
+
margin: "lg",
|
|
900
|
+
color: "#EEEEEE"
|
|
901
|
+
},
|
|
902
|
+
...controlRows
|
|
903
|
+
])
|
|
1024
904
|
};
|
|
1025
905
|
}
|
|
1026
906
|
function createLineQuickReply(items) {
|
|
@@ -1030,7 +910,7 @@ function createLineQuickReply(items) {
|
|
|
1030
910
|
})) };
|
|
1031
911
|
}
|
|
1032
912
|
// extensions/line/src/outbound.ts
|
|
1033
|
-
const loadLineOutboundRuntime = createLazyRuntimeModule(() => import("./outbound.runtime-
|
|
913
|
+
const loadLineOutboundRuntime = createLazyRuntimeModule(() => import("./outbound.runtime-AQvUJvJV.mjs"));
|
|
1034
914
|
function quotedOption(quoteToken) {
|
|
1035
915
|
return quoteToken ? { quoteToken } : {};
|
|
1036
916
|
}
|
|
@@ -1053,7 +933,6 @@ const lineOutboundAdapter = {
|
|
|
1053
933
|
const locationMessage = location ? outboundRuntime.createLocationMessage(location) : null;
|
|
1054
934
|
const { pushMessageLine: sendText, pushMessagesLine: sendBatch, pushFlexMessage: sendFlex, pushTemplateMessage: sendTemplate, pushLocationMessage: sendLocation, pushTextMessageWithQuickReplies: sendQuickReplies, buildTemplateMessageFromPayload: buildTemplate } = outboundRuntime;
|
|
1055
935
|
const sendOptions = {
|
|
1056
|
-
verbose: false,
|
|
1057
936
|
cfg,
|
|
1058
937
|
accountId: accountId ?? void 0,
|
|
1059
938
|
authorize: assertDirectAdapterHandoff ? () => {
|
|
@@ -1070,12 +949,12 @@ const lineOutboundAdapter = {
|
|
|
1070
949
|
} catch (error) {
|
|
1071
950
|
if (acceptedResults.length > 0) {
|
|
1072
951
|
const partial = isChannelPartialDeliveryError(error) ? error : void 0;
|
|
1073
|
-
const receipt = createMessageReceiptFromOutboundResults({ results: [...acceptedResults, ...partial?.deliveryResult.receipt ? [{ receipt: partial.deliveryResult.receipt }] : (partial?.deliveryResult.messageIds ?? []).map((messageId) => ({ messageId }))] });
|
|
1074
952
|
throw createChannelPartialDeliveryError(partial?.cause ?? error, {
|
|
1075
953
|
...partial?.deliveryResult,
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
954
|
+
...createAcceptedChannelDeliveryResult({
|
|
955
|
+
results: acceptedResults,
|
|
956
|
+
deliveryResults: partial ? [partial.deliveryResult] : void 0
|
|
957
|
+
})
|
|
1079
958
|
});
|
|
1080
959
|
}
|
|
1081
960
|
const refusal = isChannelPartialDeliveryError(error) ? void 0 : await explainLineRefusal({
|
|
@@ -1092,12 +971,7 @@ const lineOutboundAdapter = {
|
|
|
1092
971
|
try {
|
|
1093
972
|
await onDeliveryResult?.(createEmptyChannelResult("line", { ...result }));
|
|
1094
973
|
} catch (error) {
|
|
1095
|
-
|
|
1096
|
-
throw createChannelPartialDeliveryError(error, {
|
|
1097
|
-
messageIds: listMessageReceiptPlatformIds(receipt),
|
|
1098
|
-
receipt,
|
|
1099
|
-
visibleReplySent: true
|
|
1100
|
-
});
|
|
974
|
+
throw createChannelPartialDeliveryError(error, createAcceptedChannelDeliveryResult({ results: acceptedResults }));
|
|
1101
975
|
}
|
|
1102
976
|
return result;
|
|
1103
977
|
};
|
|
@@ -1134,7 +1008,7 @@ const lineOutboundAdapter = {
|
|
|
1134
1008
|
}));
|
|
1135
1009
|
};
|
|
1136
1010
|
const processed = payload.text ? outboundRuntime.processLineMessage(payload.text) : [];
|
|
1137
|
-
const chunkLimit = runtime.channel.text.resolveTextChunkLimit
|
|
1011
|
+
const chunkLimit = runtime.channel.text.resolveTextChunkLimit(cfg, "line", accountId ?? void 0, { fallbackLimit: 5e3 });
|
|
1138
1012
|
const orderedMessages = processed.flatMap((segment) => segment.type === "flex" ? [segment.message] : runtime.channel.text.chunkMarkdownText(segment.text, chunkLimit).map((text) => ({
|
|
1139
1013
|
type: "text",
|
|
1140
1014
|
text
|
|
@@ -1236,7 +1110,6 @@ const lineOutboundAdapter = {
|
|
|
1236
1110
|
payload: { text: ctx.text }
|
|
1237
1111
|
}),
|
|
1238
1112
|
sendMedia: async ({ cfg, to, text, mediaUrl, accountId, replyToId, assertDirectAdapterHandoff }) => await (await loadLineOutboundRuntime()).pushMessageLine(to, text, {
|
|
1239
|
-
verbose: false,
|
|
1240
1113
|
mediaUrl,
|
|
1241
1114
|
cfg,
|
|
1242
1115
|
accountId: accountId ?? void 0,
|
|
@@ -1281,7 +1154,7 @@ const lineMessageAdapter = createChannelMessageAdapterFromOutbound({
|
|
|
1281
1154
|
}
|
|
1282
1155
|
});
|
|
1283
1156
|
// extensions/line/src/channel.ts
|
|
1284
|
-
const loadLineChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-
|
|
1157
|
+
const loadLineChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-C-E2qsIu.mjs"));
|
|
1285
1158
|
const lineSecurityAdapter = createRestrictSendersChannelSecurity({
|
|
1286
1159
|
channelKey: "line",
|
|
1287
1160
|
resolveDmPolicy: (account) => account.config.dmPolicy,
|
|
@@ -1297,6 +1170,11 @@ const lineSecurityAdapter = createRestrictSendersChannelSecurity({
|
|
|
1297
1170
|
approveHint: "openclaw pairing approve line <code>",
|
|
1298
1171
|
normalizeDmEntry: (raw) => raw.replace(/^line:(?:user:)?/i, "")
|
|
1299
1172
|
});
|
|
1173
|
+
function normalizeLineConversationId(raw) {
|
|
1174
|
+
const trimmed = raw?.trim() ?? "";
|
|
1175
|
+
if (!trimmed) return null;
|
|
1176
|
+
return (trimmed.match(/^line:(?:(?:user|group|room):)?(.+)$/i)?.[1] ?? trimmed).trim() || null;
|
|
1177
|
+
}
|
|
1300
1178
|
function normalizeLineDirectoryId(entry, kind) {
|
|
1301
1179
|
const id = normalizeLineMessagingTarget(entry);
|
|
1302
1180
|
return id && inferLineTargetChatType(id) === kind ? id : null;
|
|
@@ -1306,7 +1184,17 @@ const linePlugin = createChatChannelPlugin({
|
|
|
1306
1184
|
id: "line",
|
|
1307
1185
|
...lineChannelPluginCommon,
|
|
1308
1186
|
setupWizard: lineSetupWizard,
|
|
1309
|
-
groups: { resolveRequireMention:
|
|
1187
|
+
groups: { resolveRequireMention: (params) => {
|
|
1188
|
+
const tree = buildChannelGroupsScopeTree(params.cfg, "line", params.accountId);
|
|
1189
|
+
const matchedKey = resolveExactLineGroupConfigKey({
|
|
1190
|
+
groups: tree.scopes,
|
|
1191
|
+
groupId: params.groupId
|
|
1192
|
+
});
|
|
1193
|
+
return resolveScopeRequireMention({
|
|
1194
|
+
tree,
|
|
1195
|
+
path: matchedKey ? [matchedKey] : []
|
|
1196
|
+
});
|
|
1197
|
+
} },
|
|
1310
1198
|
allowlist: buildDmGroupAccountAllowlistAdapter({
|
|
1311
1199
|
channelId: "line",
|
|
1312
1200
|
resolveAccount: ({ cfg, accountId }) => resolveLineAccount({
|
|
@@ -1352,7 +1240,10 @@ const linePlugin = createChatChannelPlugin({
|
|
|
1352
1240
|
to: peerId
|
|
1353
1241
|
});
|
|
1354
1242
|
},
|
|
1355
|
-
resolveInboundConversation:
|
|
1243
|
+
resolveInboundConversation: (params) => {
|
|
1244
|
+
const conversationId = normalizeLineConversationId(params.conversationId) ?? normalizeLineConversationId(params.to);
|
|
1245
|
+
return conversationId ? { conversationId } : null;
|
|
1246
|
+
},
|
|
1356
1247
|
targetResolver: {
|
|
1357
1248
|
looksLikeId: (id) => {
|
|
1358
1249
|
const trimmed = id?.trim();
|
|
@@ -1401,7 +1292,24 @@ const linePlugin = createChatChannelPlugin({
|
|
|
1401
1292
|
} },
|
|
1402
1293
|
message: lineMessageAdapter,
|
|
1403
1294
|
actions: lineMessageActions,
|
|
1404
|
-
bindings:
|
|
1295
|
+
bindings: {
|
|
1296
|
+
compileConfiguredBinding: ({ conversationId }) => {
|
|
1297
|
+
const normalized = normalizeLineConversationId(conversationId);
|
|
1298
|
+
return normalized ? { conversationId: normalized } : null;
|
|
1299
|
+
},
|
|
1300
|
+
matchInboundConversation: ({ compiledBinding, conversationId }) => {
|
|
1301
|
+
const normalizedIncoming = normalizeLineConversationId(conversationId);
|
|
1302
|
+
if (!normalizedIncoming || compiledBinding.conversationId !== normalizedIncoming) return null;
|
|
1303
|
+
return {
|
|
1304
|
+
conversationId: normalizedIncoming,
|
|
1305
|
+
matchPriority: 2
|
|
1306
|
+
};
|
|
1307
|
+
},
|
|
1308
|
+
resolveCommandConversation: (params) => {
|
|
1309
|
+
const conversationId = normalizeLineConversationId(params.originatingTo) ?? normalizeLineConversationId(params.commandTo) ?? normalizeLineConversationId(params.fallbackTo);
|
|
1310
|
+
return conversationId ? { conversationId } : null;
|
|
1311
|
+
}
|
|
1312
|
+
},
|
|
1405
1313
|
conversationBindings: { defaultTopLevelPlacement: "current" },
|
|
1406
1314
|
agentPrompt: {
|
|
1407
1315
|
messageToolCapabilities: () => ["inlineButtons"],
|