@openclaw/line 2026.10.10-beta.5 → 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/{accounts-DOiM8-y3.mjs → accounts-Dm_NoU7R.mjs} +1 -2
- package/dist/.setup/{api-PmHlEZ7r.mjs → api-ByXjHPMe.mjs} +3 -4
- package/dist/.setup/api-DCMpIrda.mjs +3 -0
- package/dist/.setup/{card-command-BMLk4YKh.mjs → card-command-utjlRvb-.mjs} +27 -45
- package/dist/.setup/{channel-j3EnT95N.mjs → channel-D9i_xlsJ.mjs} +252 -359
- package/dist/.setup/channel.runtime-C-E2qsIu.mjs +4 -0
- package/dist/.setup/{monitor-DQ-v9pI6.mjs → monitor-BYGe2Y7S.mjs} +256 -358
- package/dist/.setup/{outbound.runtime-BJL2119X.mjs → outbound.runtime-AQvUJvJV.mjs} +2 -2
- package/dist/.setup/{runtime-V7yh9OeC.mjs → runtime-C9ldw-V4.mjs} +1 -2
- package/dist/.setup/{send-g4gFsc9W.mjs → send-H86JOXWw.mjs} +40 -109
- package/dist/.setup/{send-retry-Dzbkz5wG.mjs → send-retry-D6J7bThI.mjs} +187 -105
- package/dist/.setup/{setup-surface-CYd8oqzt.mjs → setup-surface-DvbBjHFi.mjs} +5 -9
- package/dist/.setup/{template-messages-COcdie6C.mjs → template-messages-KG1GwG0h.mjs} +36 -52
- package/dist/.setup/{webhook-spool-contract-msjTl60Q.mjs → webhook-spool-contract-COhQK5XQ.mjs} +1 -2
- 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/contract-api.js +1 -1
- package/dist/doctor-contract-api.js +3 -5
- package/dist/index.js +2 -3
- package/dist/runtime-api.js +1 -1
- package/dist/secret-contract-api.js +1 -2
- package/dist/setup-api.js +1 -1
- package/dist/setup-entry.js +2 -3
- 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-Bis3gHmg.mjs +0 -3
- package/dist/.setup/channel.runtime-in_KhKi8.mjs +0 -4
- package/dist/.setup/monitor.runtime-DtJPzQya.mjs +0 -1
- package/dist/.setup/probe.runtime-DaGwztSg.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 {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
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";
|
|
2
|
+
import { n as resolveDefaultLineAccountId, r as resolveLineAccount, t as listLineAccountIds } from "./accounts-Dm_NoU7R.mjs";
|
|
3
|
+
import { a as normalizeLineAllowEntry, i as hasLineCredentials, r as lineSetupContract, t as lineSetupWizard } from "./setup-surface-DvbBjHFi.mjs";
|
|
4
|
+
import { t as getLineRuntime } from "./runtime-C9ldw-V4.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,53 +11,22 @@ 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
|
-
|
|
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
|
-
//#region extensions/line/src/config-adapter.ts
|
|
29
|
+
// extensions/line/src/config-adapter.ts
|
|
61
30
|
const lineConfigAdapter = createScopedChannelConfigAdapter({
|
|
62
31
|
sectionKey: "line",
|
|
63
32
|
listAccountIds: listLineAccountIds,
|
|
@@ -76,8 +45,7 @@ const lineConfigAdapter = createScopedChannelConfigAdapter({
|
|
|
76
45
|
resolveAllowFrom: (account) => account.config.allowFrom,
|
|
77
46
|
formatAllowFrom: (allowFrom) => normalizeStringEntries(allowFrom).map(normalizeLineAllowEntry)
|
|
78
47
|
});
|
|
79
|
-
|
|
80
|
-
//#region extensions/line/src/config-schema.ts
|
|
48
|
+
// extensions/line/src/config-schema.ts
|
|
81
49
|
const ThreadBindingsSchema = z.object({
|
|
82
50
|
enabled: z.boolean().optional(),
|
|
83
51
|
idleHours: z.number().optional(),
|
|
@@ -160,16 +128,15 @@ const lineChannelPluginCommon = {
|
|
|
160
128
|
account,
|
|
161
129
|
configured: hasLineCredentials(account),
|
|
162
130
|
extra: {
|
|
163
|
-
tokenSource: account.tokenSource
|
|
164
|
-
signingSecretSource: account.signingSecretSource
|
|
131
|
+
tokenSource: account.tokenSource,
|
|
132
|
+
signingSecretSource: account.signingSecretSource,
|
|
165
133
|
tokenStatus: account.tokenStatus,
|
|
166
134
|
signingSecretStatus: account.signingSecretStatus
|
|
167
135
|
}
|
|
168
136
|
})
|
|
169
137
|
}
|
|
170
138
|
};
|
|
171
|
-
|
|
172
|
-
//#region extensions/line/src/group-keys.ts
|
|
139
|
+
// extensions/line/src/group-keys.ts
|
|
173
140
|
function resolveLineGroupLookupIds(groupId) {
|
|
174
141
|
const normalized = groupId?.trim();
|
|
175
142
|
if (!normalized) return [];
|
|
@@ -200,8 +167,7 @@ function resolveExactLineGroupConfigKey(params) {
|
|
|
200
167
|
if (!groups) return;
|
|
201
168
|
return resolveLineGroupLookupIds(params.groupId).find((candidate) => Object.hasOwn(groups, candidate));
|
|
202
169
|
}
|
|
203
|
-
|
|
204
|
-
//#region extensions/line/src/doctor.ts
|
|
170
|
+
// extensions/line/src/doctor.ts
|
|
205
171
|
const GROUP_DEFAULTS_KEY = "*";
|
|
206
172
|
function classifyAllowFrom(values) {
|
|
207
173
|
const entries = Array.isArray(values) ? values.map(normalizeLineAllowEntry).filter(Boolean) : [];
|
|
@@ -218,21 +184,19 @@ function classifyAllowFrom(values) {
|
|
|
218
184
|
* map outright instead of merging entry by entry. Reading both scopes together would
|
|
219
185
|
* credit an account with groups its runtime never sees.
|
|
220
186
|
*/
|
|
221
|
-
function
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
return Object.entries(groups).filter((entry) => isRecord(entry[1]));
|
|
225
|
-
}
|
|
226
|
-
function inspectLineGroupCoverage(params) {
|
|
187
|
+
function readLineGroupCoverage(params) {
|
|
188
|
+
const { account, parent } = params;
|
|
189
|
+
const groupAllowFrom = firstDefined(account.groupAllowFrom, parent?.groupAllowFrom);
|
|
227
190
|
const empty = {
|
|
228
191
|
group: [],
|
|
229
192
|
defaults: [],
|
|
230
193
|
channel: []
|
|
231
194
|
};
|
|
232
|
-
const
|
|
195
|
+
const sourceGroups = isRecord(account.groups) ? account.groups : parent?.groups;
|
|
196
|
+
const entries = isRecord(sourceGroups) ? Object.entries(sourceGroups).filter((entry) => isRecord(entry[1])) : [];
|
|
233
197
|
const groups = Object.fromEntries(entries);
|
|
234
198
|
const defaults = groups[GROUP_DEFAULTS_KEY];
|
|
235
|
-
const defaultCoverage = classifyAllowFrom(firstDefined(defaults?.allowFrom,
|
|
199
|
+
const defaultCoverage = classifyAllowFrom(firstDefined(defaults?.allowFrom, groupAllowFrom));
|
|
236
200
|
let covered = defaults?.enabled !== false && defaultCoverage.covered;
|
|
237
201
|
const referenceBacked = defaults?.enabled !== false && defaultCoverage.referenced ? [GROUP_DEFAULTS_KEY] : [];
|
|
238
202
|
const uncovered = [];
|
|
@@ -245,13 +209,13 @@ function inspectLineGroupCoverage(params) {
|
|
|
245
209
|
}) !== id) continue;
|
|
246
210
|
const effectiveGroup = resolveLineGroupConfigEntry(groups, { groupId });
|
|
247
211
|
if (effectiveGroup?.enabled === false) continue;
|
|
248
|
-
const allowlist = classifyAllowFrom(firstDefined(effectiveGroup?.allowFrom,
|
|
212
|
+
const allowlist = classifyAllowFrom(firstDefined(effectiveGroup?.allowFrom, groupAllowFrom));
|
|
249
213
|
if (allowlist.referenced) referenceBacked.push(id);
|
|
250
214
|
if (allowlist.covered) covered = true;
|
|
251
215
|
else if (allowlist.referenced) continue;
|
|
252
216
|
else if (group.allowFrom !== void 0) empty.group.push(id);
|
|
253
217
|
else if (defaults?.allowFrom !== void 0) empty.defaults.push(id);
|
|
254
|
-
else if (
|
|
218
|
+
else if (groupAllowFrom !== void 0) empty.channel.push(id);
|
|
255
219
|
else uncovered.push(id);
|
|
256
220
|
}
|
|
257
221
|
return {
|
|
@@ -261,19 +225,8 @@ function inspectLineGroupCoverage(params) {
|
|
|
261
225
|
empty
|
|
262
226
|
};
|
|
263
227
|
}
|
|
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
228
|
function isLineGroupAllowlistScope(params) {
|
|
276
|
-
return params.channelName === "line" && (
|
|
229
|
+
return params.channelName === "line" && (readStringValue(params.account.groupPolicy) ?? readStringValue(params.parent?.groupPolicy)) === "allowlist";
|
|
277
230
|
}
|
|
278
231
|
function formatGroupIds(ids) {
|
|
279
232
|
return ids.map((id) => `"${id}"`).join(", ");
|
|
@@ -306,8 +259,7 @@ const lineDoctor = {
|
|
|
306
259
|
return covered || referenceBacked.length > 0;
|
|
307
260
|
}
|
|
308
261
|
};
|
|
309
|
-
|
|
310
|
-
//#region extensions/line/src/status.ts
|
|
262
|
+
// extensions/line/src/status.ts
|
|
311
263
|
const collectLineCredentialIssues = createDependentCredentialStatusIssueCollector({
|
|
312
264
|
channel: "line",
|
|
313
265
|
dependencySourceKey: "tokenSource",
|
|
@@ -343,8 +295,9 @@ function describeLineWebhookDelivery(params) {
|
|
|
343
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`
|
|
344
296
|
};
|
|
345
297
|
}
|
|
346
|
-
|
|
347
|
-
|
|
298
|
+
const lineStatusAdapter = createComputedAccountStatusAdapter({
|
|
299
|
+
defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID),
|
|
300
|
+
collectStatusIssues: (accounts) => [...collectLineCredentialIssues(accounts), ...collectIssuesForEnabledAccounts({
|
|
348
301
|
accounts,
|
|
349
302
|
readAccount: (account) => account.configured === false ? null : account,
|
|
350
303
|
collectIssues: ({ account, accountId, issues }) => {
|
|
@@ -356,13 +309,9 @@ function collectLineWebhookIssues(accounts) {
|
|
|
356
309
|
...delivery
|
|
357
310
|
});
|
|
358
311
|
}
|
|
359
|
-
})
|
|
360
|
-
}
|
|
361
|
-
const lineStatusAdapter = createComputedAccountStatusAdapter({
|
|
362
|
-
defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID),
|
|
363
|
-
collectStatusIssues: (accounts) => [...collectLineCredentialIssues(accounts), ...collectLineWebhookIssues(accounts)],
|
|
312
|
+
})],
|
|
364
313
|
buildChannelSummary: ({ snapshot }) => buildTokenChannelStatusSummary(snapshot),
|
|
365
|
-
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),
|
|
366
315
|
resolveAccountSnapshot: ({ account, probe }) => ({
|
|
367
316
|
accountId: account.accountId,
|
|
368
317
|
name: account.name,
|
|
@@ -378,8 +327,7 @@ const lineStatusAdapter = createComputedAccountStatusAdapter({
|
|
|
378
327
|
}
|
|
379
328
|
})
|
|
380
329
|
});
|
|
381
|
-
|
|
382
|
-
//#region extensions/line/src/gateway.ts
|
|
330
|
+
// extensions/line/src/gateway.ts
|
|
383
331
|
const lineGatewayAdapter = {
|
|
384
332
|
startAccount: async (ctx) => {
|
|
385
333
|
const account = ctx.account;
|
|
@@ -394,7 +342,7 @@ const lineGatewayAdapter = {
|
|
|
394
342
|
statusSink({ lifecycle: "starting" });
|
|
395
343
|
let lineBotLabel = "";
|
|
396
344
|
try {
|
|
397
|
-
const probe = await (await import("./
|
|
345
|
+
const probe = await (await import("./send-retry-D6J7bThI.mjs").then((n) => n.o)).probeLineBot(token, 2500);
|
|
398
346
|
const displayName = probe.ok ? probe.bot?.displayName?.trim() : null;
|
|
399
347
|
if (displayName) lineBotLabel = ` (${displayName})`;
|
|
400
348
|
const delivery = describeLineWebhookDelivery({ webhook: probe.ok ? probe.webhook : void 0 });
|
|
@@ -403,7 +351,7 @@ const lineGatewayAdapter = {
|
|
|
403
351
|
if (getLineRuntime().logging.shouldLogVerbose()) ctx.log?.debug?.(`[${account.accountId}] bot check failed: ${String(err)}`);
|
|
404
352
|
}
|
|
405
353
|
ctx.log?.info(`[${account.accountId}] starting LINE provider${lineBotLabel}`);
|
|
406
|
-
const { monitorLineProvider } = await import("./monitor
|
|
354
|
+
const { monitorLineProvider } = await import("./monitor-BYGe2Y7S.mjs");
|
|
407
355
|
return await monitorLineProvider({
|
|
408
356
|
channelAccessToken: token,
|
|
409
357
|
channelSecret: secret,
|
|
@@ -445,215 +393,13 @@ const lineGatewayAdapter = {
|
|
|
445
393
|
};
|
|
446
394
|
}
|
|
447
395
|
};
|
|
448
|
-
|
|
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
|
-
//#region extensions/line/src/quick-reply-fallback.ts
|
|
396
|
+
// extensions/line/src/quick-reply-fallback.ts
|
|
463
397
|
function buildLineQuickReplyFallbackText(labels) {
|
|
464
398
|
const normalized = normalizeStringEntries(labels).slice(0, 13);
|
|
465
399
|
if (normalized.length === 0) return "Choose an option.";
|
|
466
400
|
return `Options:\n${normalized.map((label) => `- ${label}`).join("\n")}`;
|
|
467
401
|
}
|
|
468
|
-
|
|
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
|
-
//#region extensions/line/src/question-postback.ts
|
|
402
|
+
// extensions/line/src/question-postback.ts
|
|
657
403
|
const QUESTION_ID_PARAM = "line.question";
|
|
658
404
|
const OPTION_INDEX_PARAM = "line.option";
|
|
659
405
|
const POSTBACK_DATA_MAX_BYTES = 300;
|
|
@@ -667,7 +413,6 @@ function buildLineQuestionPostbackData(callback) {
|
|
|
667
413
|
const data = params.toString();
|
|
668
414
|
return Buffer.byteLength(data, "utf8") <= POSTBACK_DATA_MAX_BYTES ? data : void 0;
|
|
669
415
|
}
|
|
670
|
-
/** Reads a question choice back out of inbound postback data, if it carries one. */
|
|
671
416
|
function parseLineQuestionPostbackData(data) {
|
|
672
417
|
if (!data.includes(QUESTION_ID_PARAM)) return;
|
|
673
418
|
const params = new URLSearchParams(data);
|
|
@@ -710,8 +455,7 @@ async function resolveLineQuestionPostback(params) {
|
|
|
710
455
|
return { status: "failed" };
|
|
711
456
|
}
|
|
712
457
|
}
|
|
713
|
-
|
|
714
|
-
//#region extensions/line/src/rich-message-schema.ts
|
|
458
|
+
// extensions/line/src/rich-message-schema.ts
|
|
715
459
|
const nonempty = () => Type.String({ minLength: 1 });
|
|
716
460
|
const closed = (properties) => Type.Object(properties, { additionalProperties: false });
|
|
717
461
|
const lineCardSchema = Type.Union([
|
|
@@ -782,8 +526,7 @@ const lineChannelDataSchema = Type.Optional(closed({ line: closed({
|
|
|
782
526
|
durationMs: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
783
527
|
trackingId: Type.Optional(nonempty())
|
|
784
528
|
}) }));
|
|
785
|
-
|
|
786
|
-
//#region extensions/line/src/rich-messages.ts
|
|
529
|
+
// extensions/line/src/rich-messages.ts
|
|
787
530
|
const lineMessageActions = {
|
|
788
531
|
describeMessageTool: ({ cfg, accountId }) => {
|
|
789
532
|
const account = resolveLineAccount({
|
|
@@ -971,24 +714,90 @@ async function prepareLineReplyPayload(payload, to) {
|
|
|
971
714
|
}
|
|
972
715
|
const toSlug = (value) => normalizeLowercaseStringOrEmpty(value).replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "device";
|
|
973
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
|
+
}
|
|
974
726
|
function renderLineCard(card) {
|
|
975
727
|
if (card.type === "media_player") {
|
|
976
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
|
+
});
|
|
977
798
|
return {
|
|
978
799
|
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
|
-
})
|
|
800
|
+
contents: bubble
|
|
992
801
|
};
|
|
993
802
|
}
|
|
994
803
|
if (card.type === "event") return {
|
|
@@ -1000,39 +809,98 @@ function renderLineCard(card) {
|
|
|
1000
809
|
contents: createAgendaCard(card)
|
|
1001
810
|
};
|
|
1002
811
|
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
|
-
|
|
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 } : {}));
|
|
1029
893
|
return {
|
|
1030
894
|
altText: `📺 ${card.name || "Apple TV"} Remote`,
|
|
1031
|
-
contents:
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
895
|
+
contents: createCardBubble([
|
|
896
|
+
cardBox("vertical", headerContents),
|
|
897
|
+
{
|
|
898
|
+
type: "separator",
|
|
899
|
+
margin: "lg",
|
|
900
|
+
color: "#EEEEEE"
|
|
901
|
+
},
|
|
902
|
+
...controlRows
|
|
903
|
+
])
|
|
1036
904
|
};
|
|
1037
905
|
}
|
|
1038
906
|
function createLineQuickReply(items) {
|
|
@@ -1041,9 +909,8 @@ function createLineQuickReply(items) {
|
|
|
1041
909
|
action: item.action.type === "command" ? messageAction(item.label, item.action.command) : postbackAction(item.label, item.action.value, item.label)
|
|
1042
910
|
})) };
|
|
1043
911
|
}
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
const loadLineOutboundRuntime = createLazyRuntimeModule(() => import("./outbound.runtime-BJL2119X.mjs"));
|
|
912
|
+
// extensions/line/src/outbound.ts
|
|
913
|
+
const loadLineOutboundRuntime = createLazyRuntimeModule(() => import("./outbound.runtime-AQvUJvJV.mjs"));
|
|
1047
914
|
function quotedOption(quoteToken) {
|
|
1048
915
|
return quoteToken ? { quoteToken } : {};
|
|
1049
916
|
}
|
|
@@ -1066,7 +933,6 @@ const lineOutboundAdapter = {
|
|
|
1066
933
|
const locationMessage = location ? outboundRuntime.createLocationMessage(location) : null;
|
|
1067
934
|
const { pushMessageLine: sendText, pushMessagesLine: sendBatch, pushFlexMessage: sendFlex, pushTemplateMessage: sendTemplate, pushLocationMessage: sendLocation, pushTextMessageWithQuickReplies: sendQuickReplies, buildTemplateMessageFromPayload: buildTemplate } = outboundRuntime;
|
|
1068
935
|
const sendOptions = {
|
|
1069
|
-
verbose: false,
|
|
1070
936
|
cfg,
|
|
1071
937
|
accountId: accountId ?? void 0,
|
|
1072
938
|
authorize: assertDirectAdapterHandoff ? () => {
|
|
@@ -1083,12 +949,12 @@ const lineOutboundAdapter = {
|
|
|
1083
949
|
} catch (error) {
|
|
1084
950
|
if (acceptedResults.length > 0) {
|
|
1085
951
|
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
952
|
throw createChannelPartialDeliveryError(partial?.cause ?? error, {
|
|
1088
953
|
...partial?.deliveryResult,
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
954
|
+
...createAcceptedChannelDeliveryResult({
|
|
955
|
+
results: acceptedResults,
|
|
956
|
+
deliveryResults: partial ? [partial.deliveryResult] : void 0
|
|
957
|
+
})
|
|
1092
958
|
});
|
|
1093
959
|
}
|
|
1094
960
|
const refusal = isChannelPartialDeliveryError(error) ? void 0 : await explainLineRefusal({
|
|
@@ -1105,12 +971,7 @@ const lineOutboundAdapter = {
|
|
|
1105
971
|
try {
|
|
1106
972
|
await onDeliveryResult?.(createEmptyChannelResult("line", { ...result }));
|
|
1107
973
|
} catch (error) {
|
|
1108
|
-
|
|
1109
|
-
throw createChannelPartialDeliveryError(error, {
|
|
1110
|
-
messageIds: listMessageReceiptPlatformIds(receipt),
|
|
1111
|
-
receipt,
|
|
1112
|
-
visibleReplySent: true
|
|
1113
|
-
});
|
|
974
|
+
throw createChannelPartialDeliveryError(error, createAcceptedChannelDeliveryResult({ results: acceptedResults }));
|
|
1114
975
|
}
|
|
1115
976
|
return result;
|
|
1116
977
|
};
|
|
@@ -1147,7 +1008,7 @@ const lineOutboundAdapter = {
|
|
|
1147
1008
|
}));
|
|
1148
1009
|
};
|
|
1149
1010
|
const processed = payload.text ? outboundRuntime.processLineMessage(payload.text) : [];
|
|
1150
|
-
const chunkLimit = runtime.channel.text.resolveTextChunkLimit
|
|
1011
|
+
const chunkLimit = runtime.channel.text.resolveTextChunkLimit(cfg, "line", accountId ?? void 0, { fallbackLimit: 5e3 });
|
|
1151
1012
|
const orderedMessages = processed.flatMap((segment) => segment.type === "flex" ? [segment.message] : runtime.channel.text.chunkMarkdownText(segment.text, chunkLimit).map((text) => ({
|
|
1152
1013
|
type: "text",
|
|
1153
1014
|
text
|
|
@@ -1249,7 +1110,6 @@ const lineOutboundAdapter = {
|
|
|
1249
1110
|
payload: { text: ctx.text }
|
|
1250
1111
|
}),
|
|
1251
1112
|
sendMedia: async ({ cfg, to, text, mediaUrl, accountId, replyToId, assertDirectAdapterHandoff }) => await (await loadLineOutboundRuntime()).pushMessageLine(to, text, {
|
|
1252
|
-
verbose: false,
|
|
1253
1113
|
mediaUrl,
|
|
1254
1114
|
cfg,
|
|
1255
1115
|
accountId: accountId ?? void 0,
|
|
@@ -1293,9 +1153,8 @@ const lineMessageAdapter = createChannelMessageAdapterFromOutbound({
|
|
|
1293
1153
|
supportedAckPolicies: ["after_receive_record"]
|
|
1294
1154
|
}
|
|
1295
1155
|
});
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
const loadLineChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-in_KhKi8.mjs"));
|
|
1156
|
+
// extensions/line/src/channel.ts
|
|
1157
|
+
const loadLineChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-C-E2qsIu.mjs"));
|
|
1299
1158
|
const lineSecurityAdapter = createRestrictSendersChannelSecurity({
|
|
1300
1159
|
channelKey: "line",
|
|
1301
1160
|
resolveDmPolicy: (account) => account.config.dmPolicy,
|
|
@@ -1311,6 +1170,11 @@ const lineSecurityAdapter = createRestrictSendersChannelSecurity({
|
|
|
1311
1170
|
approveHint: "openclaw pairing approve line <code>",
|
|
1312
1171
|
normalizeDmEntry: (raw) => raw.replace(/^line:(?:user:)?/i, "")
|
|
1313
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
|
+
}
|
|
1314
1178
|
function normalizeLineDirectoryId(entry, kind) {
|
|
1315
1179
|
const id = normalizeLineMessagingTarget(entry);
|
|
1316
1180
|
return id && inferLineTargetChatType(id) === kind ? id : null;
|
|
@@ -1320,7 +1184,17 @@ const linePlugin = createChatChannelPlugin({
|
|
|
1320
1184
|
id: "line",
|
|
1321
1185
|
...lineChannelPluginCommon,
|
|
1322
1186
|
setupWizard: lineSetupWizard,
|
|
1323
|
-
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
|
+
} },
|
|
1324
1198
|
allowlist: buildDmGroupAccountAllowlistAdapter({
|
|
1325
1199
|
channelId: "line",
|
|
1326
1200
|
resolveAccount: ({ cfg, accountId }) => resolveLineAccount({
|
|
@@ -1366,7 +1240,10 @@ const linePlugin = createChatChannelPlugin({
|
|
|
1366
1240
|
to: peerId
|
|
1367
1241
|
});
|
|
1368
1242
|
},
|
|
1369
|
-
resolveInboundConversation:
|
|
1243
|
+
resolveInboundConversation: (params) => {
|
|
1244
|
+
const conversationId = normalizeLineConversationId(params.conversationId) ?? normalizeLineConversationId(params.to);
|
|
1245
|
+
return conversationId ? { conversationId } : null;
|
|
1246
|
+
},
|
|
1370
1247
|
targetResolver: {
|
|
1371
1248
|
looksLikeId: (id) => {
|
|
1372
1249
|
const trimmed = id?.trim();
|
|
@@ -1415,7 +1292,24 @@ const linePlugin = createChatChannelPlugin({
|
|
|
1415
1292
|
} },
|
|
1416
1293
|
message: lineMessageAdapter,
|
|
1417
1294
|
actions: lineMessageActions,
|
|
1418
|
-
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
|
+
},
|
|
1419
1313
|
conversationBindings: { defaultTopLevelPlacement: "current" },
|
|
1420
1314
|
agentPrompt: {
|
|
1421
1315
|
messageToolCapabilities: () => ["inlineButtons"],
|
|
@@ -1457,5 +1351,4 @@ const linePlugin = createChatChannelPlugin({
|
|
|
1457
1351
|
} },
|
|
1458
1352
|
outbound: lineOutboundAdapter
|
|
1459
1353
|
});
|
|
1460
|
-
//#endregion
|
|
1461
1354
|
export { parseLineQuestionPostbackData as a, resolveLineGroupConfigEntry as c, isLineQuestionPostbackData as i, lineChannelPluginCommon as l, createLineQuickReply as n, resolveLineQuestionPostback as o, prepareLineReplyPayload as r, buildLineQuickReplyFallbackText as s, linePlugin as t };
|