@openclaw/line 2026.7.2-beta.1 → 2026.7.2-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api.js CHANGED
@@ -1,5 +1,5 @@
1
- import { n as lineChannelPluginCommon, t as linePlugin } from "./channel-CnPxxRbJ.js";
2
- import { n as lineSetupAdapter, t as lineSetupWizard } from "./setup-surface-Bc36YSS3.js";
1
+ import { n as lineChannelPluginCommon, t as linePlugin } from "./channel-BHR-GoJ0.js";
2
+ import { n as lineSetupAdapter, t as lineSetupWizard } from "./setup-surface-B7W6pwn3.js";
3
3
  //#region extensions/line/src/channel.setup.ts
4
4
  const lineSetupPlugin = {
5
5
  id: "line",
@@ -1,7 +1,8 @@
1
1
  import { i as resolveLineAccount, r as resolveDefaultLineAccountId, t as listLineAccountIds } from "./accounts-DJVOv1JI.js";
2
- import { n as lineSetupAdapter, r as hasLineCredentials, t as lineSetupWizard } from "./setup-surface-Bc36YSS3.js";
3
- import { a as resolveLineOutboundMedia, d as resolveExactLineGroupConfigKey, i as buildLineQuickReplyFallbackText, l as LineChannelConfigSchema, n as parseLineDirectives, r as createLineSendReceipt, s as getLineRuntime, t as hasLineDirectives } from "./reply-payload-transform-BsbwCJGH.js";
2
+ import { n as lineSetupAdapter, r as hasLineCredentials, t as lineSetupWizard } from "./setup-surface-B7W6pwn3.js";
3
+ import { a as buildLineMediaMessage, d as LineChannelConfigSchema, i as buildLineQuickReplyFallbackText, l as getLineRuntime, n as parseLineDirectives, o as hasLineSpecificMediaOptions, p as resolveExactLineGroupConfigKey, r as createLineSendReceipt, s as resolveLineOutboundMedia, t as hasLineDirectives } from "./reply-payload-transform-r9sa-TYT.js";
4
4
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
5
+ import { buildDmGroupAccountAllowlistAdapter, createFlatAllowlistOverrideResolver } from "openclaw/plugin-sdk/allowlist-config-edit";
5
6
  import { buildChannelOutboundSessionRoute, createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
6
7
  import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing";
7
8
  import { buildChannelGroupsScopeTree, createRestrictSendersChannelSecurity, resolveScopeRequireMention } from "openclaw/plugin-sdk/channel-policy";
@@ -14,6 +15,7 @@ import { normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtim
14
15
  import { defineChannelMessageAdapter } from "openclaw/plugin-sdk/channel-outbound";
15
16
  import { createAttachedChannelResultAdapter, createEmptyChannelResult } from "openclaw/plugin-sdk/channel-send-result";
16
17
  import { resolveOutboundMediaUrls } from "openclaw/plugin-sdk/reply-payload";
18
+ import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
17
19
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
18
20
  import { buildTokenChannelStatusSummary, createComputedAccountStatusAdapter, createDefaultChannelRuntimeState, createDependentCredentialStatusIssueCollector } from "openclaw/plugin-sdk/status-helpers";
19
21
  //#region extensions/line/src/bindings.ts
@@ -58,6 +60,22 @@ const lineBindingsAdapter = {
58
60
  function normalizeLineAllowFrom(entry) {
59
61
  return entry.replace(/^line:(?:user:)?/i, "");
60
62
  }
63
+ const lineConfigAdapter = createScopedChannelConfigAdapter({
64
+ sectionKey: "line",
65
+ listAccountIds: listLineAccountIds,
66
+ resolveAccount: (cfg, accountId) => resolveLineAccount({
67
+ cfg,
68
+ accountId: accountId ?? void 0
69
+ }),
70
+ defaultAccountId: resolveDefaultLineAccountId,
71
+ clearBaseFields: [
72
+ "channelSecret",
73
+ "tokenFile",
74
+ "secretFile"
75
+ ],
76
+ resolveAllowFrom: (account) => account.config.allowFrom,
77
+ formatAllowFrom: (allowFrom) => normalizeStringEntries(allowFrom).map(normalizeLineAllowFrom)
78
+ });
61
79
  const lineChannelPluginCommon = {
62
80
  meta: {
63
81
  id: "line",
@@ -81,22 +99,7 @@ const lineChannelPluginCommon = {
81
99
  reload: { configPrefixes: ["channels.line"] },
82
100
  configSchema: LineChannelConfigSchema,
83
101
  config: {
84
- ...createScopedChannelConfigAdapter({
85
- sectionKey: "line",
86
- listAccountIds: listLineAccountIds,
87
- resolveAccount: (cfg, accountId) => resolveLineAccount({
88
- cfg,
89
- accountId: accountId ?? void 0
90
- }),
91
- defaultAccountId: resolveDefaultLineAccountId,
92
- clearBaseFields: [
93
- "channelSecret",
94
- "tokenFile",
95
- "secretFile"
96
- ],
97
- resolveAllowFrom: (account) => account.config.allowFrom,
98
- formatAllowFrom: (allowFrom) => normalizeStringEntries(allowFrom).map(normalizeLineAllowFrom)
99
- }),
102
+ ...lineConfigAdapter,
100
103
  isConfigured: (account) => hasLineCredentials(account),
101
104
  describeAccount: (account) => describeWebhookAccountSnapshot({
102
105
  account,
@@ -108,7 +111,7 @@ const lineChannelPluginCommon = {
108
111
  //#endregion
109
112
  //#region extensions/line/src/gateway.ts
110
113
  const loadLineProbeRuntime$1 = createLazyRuntimeModule(() => import("./probe.runtime-CRhVGqwl.js"));
111
- const loadLineMonitorRuntime = createLazyRuntimeModule(() => import("./monitor.runtime-BiNrVz5G.js"));
114
+ const loadLineMonitorRuntime = createLazyRuntimeModule(() => import("./monitor.runtime-CZuQgsEE.js"));
112
115
  const lineGatewayAdapter = {
113
116
  startAccount: async (ctx) => {
114
117
  const account = ctx.account;
@@ -223,42 +226,12 @@ function inferLineTargetChatType(target) {
223
226
  }
224
227
  //#endregion
225
228
  //#region extensions/line/src/outbound.ts
226
- const loadLineOutboundRuntime = createLazyRuntimeModule(() => import("./outbound.runtime-CI-t7Z8P.js"));
227
- function isLineUserTarget(target) {
228
- const normalized = target.trim().replace(/^line:(group|room|user):/i, "").replace(/^line:/i, "");
229
- return /^U/i.test(normalized);
230
- }
231
- function hasLineSpecificMediaOptions(lineData) {
232
- return Boolean(lineData.mediaKind ?? lineData.previewImageUrl?.trim() ?? (typeof lineData.durationMs === "number" ? lineData.durationMs : void 0) ?? lineData.trackingId?.trim());
233
- }
234
- function buildLineMediaMessageObject(resolved, opts) {
235
- switch (resolved.mediaKind) {
236
- case "video": {
237
- const previewImageUrl = resolved.previewImageUrl?.trim();
238
- if (!previewImageUrl) throw new Error("LINE video messages require previewImageUrl to reference an image URL");
239
- return {
240
- type: "video",
241
- originalContentUrl: resolved.mediaUrl,
242
- previewImageUrl,
243
- ...opts?.allowTrackingId && resolved.trackingId ? { trackingId: resolved.trackingId } : {}
244
- };
245
- }
246
- case "audio": return {
247
- type: "audio",
248
- originalContentUrl: resolved.mediaUrl,
249
- duration: resolved.durationMs ?? 6e4
250
- };
251
- default: return {
252
- type: "image",
253
- originalContentUrl: resolved.mediaUrl,
254
- previewImageUrl: resolved.previewImageUrl ?? resolved.mediaUrl
255
- };
256
- }
257
- }
229
+ const loadLineOutboundRuntime = createLazyRuntimeModule(() => import("./outbound.runtime-DnpU0Cms.js"));
258
230
  const lineOutboundAdapter = {
259
231
  deliveryMode: "direct",
260
232
  chunker: (text, limit) => getLineRuntime().channel.text.chunkMarkdownText(text, limit),
261
233
  textChunkLimit: 5e3,
234
+ sanitizeText: ({ text }) => sanitizeAssistantVisibleText(text),
262
235
  sendPayload: async ({ to, payload, accountId, cfg, onDeliveryResult }) => {
263
236
  const runtime = getLineRuntime();
264
237
  const outboundRuntime = await loadLineOutboundRuntime();
@@ -300,6 +273,12 @@ const lineOutboundAdapter = {
300
273
  const chunks = processed.text ? runtime.channel.text.chunkMarkdownText(processed.text, chunkLimit) : [];
301
274
  const mediaUrls = resolveOutboundMediaUrls(payload);
302
275
  const useLineSpecificMedia = hasLineSpecificMediaOptions(lineData);
276
+ const mediaOptions = {
277
+ mediaKind: useLineSpecificMedia ? lineData.mediaKind : "image",
278
+ previewImageUrl: lineData.previewImageUrl,
279
+ durationMs: lineData.durationMs,
280
+ trackingId: lineData.trackingId
281
+ };
303
282
  const shouldSendQuickRepliesInline = chunks.length === 0 && hasQuickReplies;
304
283
  const sendMediaMessages = async () => {
305
284
  for (const url of mediaUrls) {
@@ -314,12 +293,7 @@ const lineOutboundAdapter = {
314
293
  }));
315
294
  continue;
316
295
  }
317
- const resolved = await resolveLineOutboundMedia(trimmed, {
318
- mediaKind: lineData.mediaKind,
319
- previewImageUrl: lineData.previewImageUrl,
320
- durationMs: lineData.durationMs,
321
- trackingId: lineData.trackingId
322
- });
296
+ const resolved = await resolveLineOutboundMedia(trimmed, mediaOptions);
323
297
  await recordResult((lineRuntime?.sendMessageLine ?? outboundRuntime.sendMessageLine)(to, "", {
324
298
  verbose: false,
325
299
  mediaUrl: resolved.mediaUrl,
@@ -401,21 +375,7 @@ const lineOutboundAdapter = {
401
375
  for (const url of mediaUrls) {
402
376
  const trimmed = url?.trim();
403
377
  if (!trimmed) continue;
404
- if (!useLineSpecificMedia) {
405
- quickReplyMessages.push({
406
- type: "image",
407
- originalContentUrl: trimmed,
408
- previewImageUrl: trimmed
409
- });
410
- continue;
411
- }
412
- const resolved = await resolveLineOutboundMedia(trimmed, {
413
- mediaKind: lineData.mediaKind,
414
- previewImageUrl: lineData.previewImageUrl,
415
- durationMs: lineData.durationMs,
416
- trackingId: lineData.trackingId
417
- });
418
- quickReplyMessages.push(buildLineMediaMessageObject(resolved, { allowTrackingId: isLineUserTarget(to) }));
378
+ quickReplyMessages.push(await buildLineMediaMessage(trimmed, mediaOptions, to));
419
379
  }
420
380
  if (quickReplyMessages.length > 0 && quickReply) {
421
381
  const lastIndex = quickReplyMessages.length - 1;
@@ -560,7 +520,7 @@ const lineStatusAdapter = createComputedAccountStatusAdapter({
560
520
  });
561
521
  //#endregion
562
522
  //#region extensions/line/src/channel.ts
563
- const loadLineChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-FPcRtjcT.js"));
523
+ const loadLineChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-DFgZ_Xwn.js"));
564
524
  const lineSecurityAdapter = createRestrictSendersChannelSecurity({
565
525
  channelKey: "line",
566
526
  resolveDmPolicy: (account) => account.config.dmPolicy,
@@ -581,6 +541,27 @@ const linePlugin = createChatChannelPlugin({
581
541
  ...lineChannelPluginCommon,
582
542
  setupWizard: lineSetupWizard,
583
543
  groups: { resolveRequireMention: resolveLineGroupRequireMention },
544
+ allowlist: buildDmGroupAccountAllowlistAdapter({
545
+ channelId: "line",
546
+ resolveAccount: ({ cfg, accountId }) => resolveLineAccount({
547
+ cfg,
548
+ accountId: accountId ?? void 0
549
+ }),
550
+ normalize: ({ cfg, accountId, values }) => lineConfigAdapter.formatAllowFrom({
551
+ cfg,
552
+ accountId,
553
+ allowFrom: values
554
+ }),
555
+ resolveDmAllowFrom: (account) => account.config.allowFrom,
556
+ resolveGroupAllowFrom: (account) => account.config.groupAllowFrom,
557
+ resolveDmPolicy: (account) => account.config.dmPolicy,
558
+ resolveGroupPolicy: (account) => account.config.groupPolicy,
559
+ resolveGroupOverrides: createFlatAllowlistOverrideResolver({
560
+ resolveRecord: (account) => account.config.groups,
561
+ label: (groupId) => groupId,
562
+ resolveEntries: (groupCfg) => groupCfg?.allowFrom
563
+ })
564
+ }),
584
565
  messaging: {
585
566
  targetPrefixes: ["line"],
586
567
  normalizeTarget: normalizeLineMessagingTarget,
@@ -1,2 +1,2 @@
1
- import { t as linePlugin } from "./channel-CnPxxRbJ.js";
1
+ import { t as linePlugin } from "./channel-BHR-GoJ0.js";
2
2
  export { linePlugin };
@@ -0,0 +1,4 @@
1
+ import { t as monitorLineProvider } from "./monitor-Db2rZsSX.js";
2
+ import { t as probeLineBot } from "./probe-BslD77tJ.js";
3
+ import { S as pushMessageLine } from "./markdown-to-line-XceqeKRP.js";
4
+ export { monitorLineProvider, probeLineBot, pushMessageLine };
@@ -1,13 +1,13 @@
1
1
  import { i as resolveLineAccount } from "./accounts-DJVOv1JI.js";
2
- import { o as validateLineMediaUrl, r as createLineSendReceipt } from "./reply-payload-transform-BsbwCJGH.js";
2
+ import { c as validateLineMediaUrl, r as createLineSendReceipt } from "./reply-payload-transform-r9sa-TYT.js";
3
3
  import { c as uriAction, d as createReceiptCard, o as messageAction, s as postbackAction, t as toFlexMessage } from "./flex-templates-K1lS9i8L.js";
4
+ import { stripMarkdown, stripMarkdown as stripMarkdown$1 } from "openclaw/plugin-sdk/text-chunking";
4
5
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
5
6
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
6
- import { messagingApi } from "@line/bot-sdk";
7
7
  import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
8
+ import { messagingApi } from "@line/bot-sdk";
8
9
  import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
9
10
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
10
- import { stripMarkdown, stripMarkdown as stripMarkdown$1 } from "openclaw/plugin-sdk/text-chunking";
11
11
  //#region extensions/line/src/template-messages.ts
12
12
  const COMPACT_TEMPLATE_TEXT_LIMIT = 60;
13
13
  const graphemeSegmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });