@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.
Files changed (130) hide show
  1. package/dist/.setup/{accounts-DOiM8-y3.mjs → accounts-Dm_NoU7R.mjs} +1 -2
  2. package/dist/.setup/{api-PmHlEZ7r.mjs → api-ByXjHPMe.mjs} +3 -4
  3. package/dist/.setup/api-DCMpIrda.mjs +3 -0
  4. package/dist/.setup/{card-command-BMLk4YKh.mjs → card-command-utjlRvb-.mjs} +27 -45
  5. package/dist/.setup/{channel-j3EnT95N.mjs → channel-D9i_xlsJ.mjs} +252 -359
  6. package/dist/.setup/channel.runtime-C-E2qsIu.mjs +4 -0
  7. package/dist/.setup/{monitor-DQ-v9pI6.mjs → monitor-BYGe2Y7S.mjs} +256 -358
  8. package/dist/.setup/{outbound.runtime-BJL2119X.mjs → outbound.runtime-AQvUJvJV.mjs} +2 -2
  9. package/dist/.setup/{runtime-V7yh9OeC.mjs → runtime-C9ldw-V4.mjs} +1 -2
  10. package/dist/.setup/{send-g4gFsc9W.mjs → send-H86JOXWw.mjs} +40 -109
  11. package/dist/.setup/{send-retry-Dzbkz5wG.mjs → send-retry-D6J7bThI.mjs} +187 -105
  12. package/dist/.setup/{setup-surface-CYd8oqzt.mjs → setup-surface-DvbBjHFi.mjs} +5 -9
  13. package/dist/.setup/{template-messages-COcdie6C.mjs → template-messages-KG1GwG0h.mjs} +36 -52
  14. package/dist/.setup/{webhook-spool-contract-msjTl60Q.mjs → webhook-spool-contract-COhQK5XQ.mjs} +1 -2
  15. package/dist/.source-module-urls/2c97352967966b7ab9f67f528eb25c098b6fe10ea0e4616ffae3851ed839d81e.json +1 -1
  16. package/dist/api.js +2 -2
  17. package/dist/channel-plugin-api.js +1 -1
  18. package/dist/contract-api.js +1 -1
  19. package/dist/doctor-contract-api.js +3 -5
  20. package/dist/index.js +2 -3
  21. package/dist/runtime-api.js +1 -1
  22. package/dist/secret-contract-api.js +1 -2
  23. package/dist/setup-api.js +1 -1
  24. package/dist/setup-entry.js +2 -3
  25. package/node_modules/@line/bot-sdk/node_modules/@types/node/README.md +1 -1
  26. package/node_modules/@line/bot-sdk/node_modules/@types/node/package.json +2 -2
  27. package/node_modules/@line/bot-sdk/node_modules/@types/node/util.d.ts +7 -4
  28. package/node_modules/typebox/build/format/duration.d.mts +2 -2
  29. package/node_modules/typebox/build/format/duration.mjs +2 -2
  30. package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
  31. package/node_modules/typebox/build/format/idn_email.mjs +1 -0
  32. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
  33. package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
  34. package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
  35. package/node_modules/typebox/build/format/ipv4.mjs +2 -2
  36. package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
  37. package/node_modules/typebox/build/format/ipv6.mjs +1 -1
  38. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  39. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  40. package/node_modules/typebox/build/schema/build.mjs +1 -0
  41. package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
  42. package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
  43. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
  44. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
  45. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
  46. package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
  47. package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
  48. package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
  49. package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
  50. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
  51. package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
  52. package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
  53. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
  54. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
  55. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
  56. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
  57. package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
  58. package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
  59. package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
  60. package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
  61. package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
  62. package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
  63. package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
  64. package/node_modules/typebox/build/system/memory/create.mjs +18 -13
  65. package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
  66. package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
  67. package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
  68. package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
  69. package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
  70. package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
  71. package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
  72. package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
  73. package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
  74. package/node_modules/typebox/build/system/memory/update.mjs +43 -16
  75. package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
  76. package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
  77. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
  78. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
  79. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
  80. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
  81. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
  82. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
  83. package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
  84. package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
  85. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
  86. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
  87. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
  88. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
  89. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
  90. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  91. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
  92. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
  93. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
  94. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
  95. package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
  96. package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
  97. package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
  98. package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
  99. package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
  100. package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
  101. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
  102. package/node_modules/typebox/package.json +1 -1
  103. package/node_modules/typebox/readme.md +1 -1
  104. package/node_modules/zod/package.json +1 -1
  105. package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
  106. package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
  107. package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
  108. package/node_modules/zod/src/v4/core/compile.ts +9 -0
  109. package/node_modules/zod/src/v4/core/schemas.ts +35 -1
  110. package/node_modules/zod/src/v4/core/util.ts +13 -0
  111. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  112. package/node_modules/zod/v4/core/compile.cjs +8 -0
  113. package/node_modules/zod/v4/core/compile.js +8 -0
  114. package/node_modules/zod/v4/core/schemas.cjs +30 -0
  115. package/node_modules/zod/v4/core/schemas.d.cts +3 -1
  116. package/node_modules/zod/v4/core/schemas.d.ts +3 -1
  117. package/node_modules/zod/v4/core/schemas.js +30 -0
  118. package/node_modules/zod/v4/core/util.cjs +15 -0
  119. package/node_modules/zod/v4/core/util.d.cts +2 -0
  120. package/node_modules/zod/v4/core/util.d.ts +2 -0
  121. package/node_modules/zod/v4/core/util.js +14 -0
  122. package/node_modules/zod/v4/core/versions.cjs +1 -1
  123. package/node_modules/zod/v4/core/versions.js +1 -1
  124. package/package.json +6 -6
  125. package/dist/.setup/api-Bis3gHmg.mjs +0 -3
  126. package/dist/.setup/channel.runtime-in_KhKi8.mjs +0 -4
  127. package/dist/.setup/monitor.runtime-DtJPzQya.mjs +0 -1
  128. package/dist/.setup/probe.runtime-DaGwztSg.mjs +0 -1
  129. package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
  130. package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
@@ -1,6 +1,6 @@
1
- import { n as resolveDefaultLineAccountId, r as resolveLineAccount } from "./accounts-DOiM8-y3.mjs";
1
+ import { n as resolveDefaultLineAccountId, r as resolveLineAccount } from "./accounts-Dm_NoU7R.mjs";
2
2
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
3
- import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
3
+ import { asSafeIntegerInRange, hasNonEmptyString, isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { collectErrorGraphCandidates, extractErrorCode, formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
5
5
  import { getFileExtension, mimeTypeFromFilePath } from "openclaw/plugin-sdk/media-mime";
6
6
  import { resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
@@ -11,7 +11,18 @@ import { HTTPFetchError } from "@line/bot-sdk";
11
11
  import { classifyTransientNetworkErrorCode, createChannelApiRetryRunner } from "openclaw/plugin-sdk/retry-runtime";
12
12
  import { assertOkOrThrowHttpError, createProviderOperationDeadline, createProviderOperationTimeoutResolver, fetchWithTimeout, readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
13
13
  import { fetchWithRuntimeDispatcherOrMockedGlobal } from "openclaw/plugin-sdk/runtime-fetch";
14
- //#region extensions/line/src/messaging-target.ts
14
+ // \0rolldown/runtime.js
15
+ var __defProp = Object.defineProperty;
16
+ var __exportAll = (all, no_symbols) => {
17
+ let target = {};
18
+ for (var name in all) __defProp(target, name, {
19
+ get: all[name],
20
+ enumerable: true
21
+ });
22
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
23
+ return target;
24
+ };
25
+ // extensions/line/src/messaging-target.ts
15
26
  function normalizeLineMessagingTarget(target) {
16
27
  const trimmed = target.trim();
17
28
  if (!trimmed) return;
@@ -23,13 +34,11 @@ function inferLineTargetChatType(target) {
23
34
  if (/^U[a-f0-9]{32}$/i.test(normalized)) return "direct";
24
35
  return /^[CR][a-f0-9]{32}$/i.test(normalized) ? "group" : void 0;
25
36
  }
26
- //#endregion
27
- //#region extensions/line/src/media-url.ts
37
+ // extensions/line/src/media-url.ts
28
38
  function isHttpsUrl(value) {
29
39
  return typeof value === "string" && URL.parse(value)?.protocol === "https:";
30
40
  }
31
- //#endregion
32
- //#region extensions/line/src/outbound-media.ts
41
+ // extensions/line/src/outbound-media.ts
33
42
  const LINE_OUTBOUND_MEDIA_SSRF_POLICY = { allowPrivateNetwork: false };
34
43
  async function validateLineMediaUrl(url) {
35
44
  const parsed = URL.parse(url);
@@ -55,7 +64,7 @@ function resolveLineMediaKind(url, opts) {
55
64
  mediaKind: opts.mediaKind,
56
65
  kindSource: "declared"
57
66
  };
58
- if (typeof opts.durationMs === "number") return {
67
+ if (opts.durationMs !== void 0) return {
59
68
  mediaKind: "audio",
60
69
  kindSource: "metadata"
61
70
  };
@@ -103,7 +112,7 @@ async function buildLineMediaMessage(mediaUrl, opts, target) {
103
112
  case "audio": return {
104
113
  type: "audio",
105
114
  originalContentUrl: trimmedUrl,
106
- duration: typeof opts.durationMs === "number" ? opts.durationMs : 6e4
115
+ duration: opts.durationMs ?? 6e4
107
116
  };
108
117
  default: return {
109
118
  type: "image",
@@ -112,8 +121,7 @@ async function buildLineMediaMessage(mediaUrl, opts, target) {
112
121
  };
113
122
  }
114
123
  }
115
- //#endregion
116
- //#region extensions/line/src/quote-tokens.ts
124
+ // extensions/line/src/quote-tokens.ts
117
125
  const QUOTE_TOKEN_LIMIT = 500;
118
126
  const quoteTokensByAccount = /* @__PURE__ */ new Map();
119
127
  function quoteTokenKey(chatId, messageId) {
@@ -125,7 +133,6 @@ function quoteTokenKey(chatId, messageId) {
125
133
  function readLineQuoteToken(message) {
126
134
  return message.type === "text" || message.type === "image" || message.type === "video" || message.type === "sticker" ? message.quoteToken : void 0;
127
135
  }
128
- /** Remembers the token an inbound message can later be quoted with. */
129
136
  function recordLineQuoteToken(params) {
130
137
  const quoteToken = params.quoteToken;
131
138
  if (!quoteToken) return;
@@ -137,7 +144,6 @@ function recordLineQuoteToken(params) {
137
144
  tokens.set(key, quoteToken);
138
145
  pruneMapToMaxSize(tokens, QUOTE_TOKEN_LIMIT);
139
146
  }
140
- /** Resolves the token that quotes one message in one chat, if it is still known. */
141
147
  function resolveLineQuoteToken(params) {
142
148
  const key = params.messageId ? quoteTokenKey(params.chatId, params.messageId) : void 0;
143
149
  if (!key) return;
@@ -167,7 +173,7 @@ function reportLineQuoteCarrierMissing(chatId) {
167
173
  /** Attaches a quote token to the first message in a request that can carry one. */
168
174
  function applyLineQuoteToken(messages, quoteToken) {
169
175
  const target = quoteToken ? messages.findIndex(canCarryLineQuoteToken) : -1;
170
- return target < 0 ? [...messages] : messages.map((message, index) => index === target ? {
176
+ return target < 0 ? messages : messages.map((message, index) => index === target ? {
171
177
  ...message,
172
178
  quoteToken
173
179
  } : message);
@@ -186,8 +192,7 @@ function withoutLineQuoteTokens(messages) {
186
192
  quoteToken: void 0
187
193
  } : message);
188
194
  }
189
- //#endregion
190
- //#region extensions/line/src/flex-templates/message.ts
195
+ // extensions/line/src/flex-templates/message.ts
191
196
  const LINE_FLEX_BUBBLE_MAX_BYTES = 3e4;
192
197
  const LINE_FLEX_CAROUSEL_MAX_BYTES = 5e4;
193
198
  function fitsLineFlexBubble(bubble) {
@@ -200,9 +205,21 @@ function toFlexMessage(altText, contents) {
200
205
  contents
201
206
  };
202
207
  }
203
- //#endregion
204
- //#region extensions/line/src/actions.ts
208
+ // extensions/line/src/actions.ts
205
209
  const LINE_ACTION_LABEL_LIMIT = 20;
210
+ const LINE_QUICK_REPLY_ITEM_LIMIT = 13;
211
+ const lineActionUriProtocols = /* @__PURE__ */ new Set([
212
+ "http:",
213
+ "https:",
214
+ "line:",
215
+ "tel:"
216
+ ]);
217
+ const linePostbackInputOptions = /* @__PURE__ */ new Set([
218
+ "closeRichMenu",
219
+ "openRichMenu",
220
+ "openKeyboard",
221
+ "openVoice"
222
+ ]);
206
223
  const LINE_ACTION_DATA_LIMIT = 300;
207
224
  const LINE_ACTION_URI_LIMIT = 1e3;
208
225
  const LINE_CLIPBOARD_TEXT_LIMIT = 1e3;
@@ -212,6 +229,28 @@ const LINE_IMAGEMAP_MESSAGE_TEXT_LIMIT = 400;
212
229
  const LINE_IMAGEMAP_EXTERNAL_LINK_LABEL_LIMIT = 30;
213
230
  const LINE_IMAGEMAP_ACTION_LIMIT = 50;
214
231
  const graphemeSegmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
232
+ function isValidLineUri(value, icon = false) {
233
+ if (typeof value !== "string" || value.length > (icon ? 2e3 : LINE_ACTION_URI_LIMIT)) return false;
234
+ try {
235
+ const protocol = new URL(value).protocol;
236
+ return icon ? protocol === "https:" : lineActionUriProtocols.has(protocol);
237
+ } catch {
238
+ return false;
239
+ }
240
+ }
241
+ function invalidLineUriReason(value) {
242
+ return typeof value === "string" && value.length > LINE_ACTION_URI_LIMIT ? "URL exceeds LINE's limit." : "URL scheme is not supported by LINE.";
243
+ }
244
+ function isValidLinePickerValue(value, mode) {
245
+ if (mode === "time") return /^(?:[01]\d|2[0-3]):[0-5]\d$/.test(value);
246
+ const match = /^(\d{4})-(\d{2})-(\d{2})(?:[Tt]((?:[01]\d|2[0-3]):[0-5]\d))?$/.exec(value);
247
+ if (!match || mode === "datetime" !== (match[4] !== void 0)) return false;
248
+ const year = Number(match[1]);
249
+ const month = Number(match[2]);
250
+ const day = Number(match[3]);
251
+ const date = new Date(Date.UTC(year, month - 1, day));
252
+ return year >= 1900 && year <= 2100 && date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;
253
+ }
215
254
  function truncateLineActionText(text, limit) {
216
255
  let result = "";
217
256
  let count = 0;
@@ -226,9 +265,6 @@ function truncateLineActionText(text, limit) {
226
265
  function truncateLineActionLabel(label, limit = LINE_ACTION_LABEL_LIMIT) {
227
266
  return truncateLineActionText(label, limit) || (label ? "…" : "");
228
267
  }
229
- function truncateLineActionData(data) {
230
- return truncateUtf16Safe(data, LINE_ACTION_DATA_LIMIT);
231
- }
232
268
  const UNDELIVERABLE_IMAGE_WARNING = "Image unavailable: URL must use HTTPS.";
233
269
  function flexWarning(text) {
234
270
  return {
@@ -267,23 +303,51 @@ function isLineAction(value) {
267
303
  function isUnavailableAction(action) {
268
304
  return action[unavailableActionMarker] === true;
269
305
  }
270
- function normalizeNestedContent(value, labelLimit, warnings) {
271
- if (Array.isArray(value)) return value.map((item) => normalizeNestedContent(item, labelLimit, warnings)).filter((item) => item !== void 0);
306
+ function hasRequiredActionFields(action) {
307
+ switch (action.type) {
308
+ case "message": return typeof action.text === "string";
309
+ case "uri": return hasNonEmptyString(action.uri);
310
+ case "postback": return typeof action.data === "string";
311
+ case "datetimepicker": return typeof action.data === "string" && (action.mode === "date" || action.mode === "time" || action.mode === "datetime");
312
+ case "clipboard": return typeof action.clipboardText === "string" && action.clipboardText.length > 0;
313
+ default: return true;
314
+ }
315
+ }
316
+ function normalizeMessageSurfaceAction(value, labelLimit, surface, requireLabel) {
317
+ if (!isLineAction(value)) return unavailableAction("Action", "action type is not supported by LINE.");
318
+ if (requireLabel && !hasNonEmptyString(value.label)) return unavailableAction("Action", "action label is missing.");
319
+ if (value.type === "richmenuswitch") return unavailableAction("Action", "rich menu switching is only available in rich menus.");
320
+ if (surface !== "quick-reply" && (value.type === "camera" || value.type === "cameraRoll" || value.type === "location")) return unavailableAction("Action", "this action is only available in quick replies.");
321
+ if (surface === "quick-reply" && value.type === "postback" && value.text !== void 0) {
322
+ const { text, ...postback } = value;
323
+ return normalizeLineAction({
324
+ ...postback,
325
+ displayText: postback.displayText ?? text
326
+ }, labelLimit);
327
+ }
328
+ return normalizeLineAction(value, labelLimit);
329
+ }
330
+ function normalizeNestedContent(value, labelLimit, warnings, surface = "flex") {
331
+ if (Array.isArray(value)) return value.map((item) => normalizeNestedContent(item, labelLimit, warnings, surface)).filter((item) => item !== void 0);
272
332
  if (!isRecord(value)) return value;
273
333
  if (warnings && (value.type === "image" || value.type === "icon") && !isHttpsUrl(value.url)) {
274
334
  warnings.push(UNDELIVERABLE_IMAGE_WARNING);
275
335
  return;
276
336
  }
277
337
  const normalized = { ...value };
278
- for (const [key, nested] of Object.entries(value)) if ((key === "action" || key === "defaultAction") && isLineAction(nested)) {
279
- const action = normalizeLineAction(nested, labelLimit);
338
+ for (const [key, nested] of Object.entries(value)) if ((key === "action" || key === "defaultAction") && nested !== void 0) {
339
+ const action = normalizeMessageSurfaceAction(nested, labelLimit, surface, surface === "template" || value.type === "button");
340
+ if (key === "defaultAction" && isUnavailableAction(action)) {
341
+ delete normalized[key];
342
+ continue;
343
+ }
280
344
  if (warnings && key === "action" && (value.type === "video" && action.type !== "uri" || value.type !== "button" && isUnavailableAction(action))) {
281
345
  delete normalized[key];
282
346
  warnings.push(isUnavailableAction(action) ? action.text ?? "Action unavailable." : "Action unavailable in this video.");
283
347
  } else normalized[key] = action;
284
- } else if (key === "actions" && Array.isArray(nested)) normalized[key] = nested.map((action) => isLineAction(action) ? normalizeLineAction(action, labelLimit) : action);
348
+ } else if (key === "actions" && Array.isArray(nested)) normalized[key] = nested.map((action) => normalizeMessageSurfaceAction(action, labelLimit, surface, surface === "template"));
285
349
  else {
286
- const content = normalizeNestedContent(nested, labelLimit, warnings);
350
+ const content = normalizeNestedContent(nested, labelLimit, warnings, surface);
287
351
  if (content === void 0) delete normalized[key];
288
352
  else normalized[key] = content;
289
353
  }
@@ -349,22 +413,22 @@ function unavailableImagemapAction(kind, reason, area) {
349
413
  function normalizeImagemapAction(action) {
350
414
  const label = action.label === void 0 ? void 0 : truncateLineActionText(action.label, LINE_IMAGEMAP_ACTION_LABEL_LIMIT);
351
415
  if (action.type === "uri") {
352
- if (truncateUtf16Safe(action.linkUri, LINE_ACTION_URI_LIMIT) !== action.linkUri) return unavailableImagemapAction("Link", "URL exceeds LINE's limit.", action.area);
416
+ if (!isValidLineUri(action.linkUri)) return unavailableImagemapAction("Link", invalidLineUriReason(action.linkUri), action.area);
353
417
  return {
354
418
  ...action,
355
419
  label
356
420
  };
357
421
  }
358
422
  if (action.type === "message") {
359
- const text = truncateUtf16Safe(action.text, LINE_IMAGEMAP_MESSAGE_TEXT_LIMIT);
360
- if (text !== action.text) return unavailableImagemapAction("Action", "message text exceeds LINE's limit.", action.area);
423
+ if (typeof action.text !== "string") return unavailableImagemapAction("Action", "message text is missing.", action.area);
424
+ if (action.text.length > LINE_IMAGEMAP_MESSAGE_TEXT_LIMIT) return unavailableImagemapAction("Action", "message text exceeds LINE's limit.", action.area);
361
425
  return {
362
426
  ...action,
363
- label,
364
- text
427
+ label
365
428
  };
366
429
  }
367
- if (truncateUtf16Safe(action.clipboardText, LINE_CLIPBOARD_TEXT_LIMIT) !== action.clipboardText) return unavailableImagemapAction("Action", "clipboard text exceeds LINE's limit.", action.area);
430
+ if (typeof action.clipboardText !== "string" || action.clipboardText.length === 0) return unavailableImagemapAction("Action", "clipboard text must not be empty.", action.area);
431
+ if (action.clipboardText.length > LINE_CLIPBOARD_TEXT_LIMIT) return unavailableImagemapAction("Action", "clipboard text exceeds LINE's limit.", action.area);
368
432
  return {
369
433
  ...action,
370
434
  label
@@ -372,16 +436,16 @@ function normalizeImagemapAction(action) {
372
436
  }
373
437
  function normalizeImagemapVideo(video) {
374
438
  const externalLink = video.externalLink;
375
- if (!externalLink) return { video };
376
- const label = externalLink.label === void 0 ? void 0 : truncateUtf16Safe(externalLink.label, LINE_IMAGEMAP_EXTERNAL_LINK_LABEL_LIMIT) || (externalLink.label ? "…" : "");
377
- if (externalLink.linkUri !== void 0 && truncateUtf16Safe(externalLink.linkUri, LINE_ACTION_URI_LIMIT) !== externalLink.linkUri) {
439
+ if (externalLink === void 0) return { video };
440
+ if (!isRecord(externalLink) || !isValidLineUri(externalLink.linkUri) || !hasNonEmptyString(externalLink.label)) {
378
441
  const normalizedVideo = { ...video };
379
442
  delete normalizedVideo.externalLink;
380
443
  return {
381
444
  video: normalizedVideo,
382
- fallbackAction: video.area === void 0 ? void 0 : unavailableImagemapAction("Link", "URL exceeds LINE's limit.", video.area)
445
+ fallbackAction: video.area === void 0 ? void 0 : unavailableImagemapAction("Link", "video link URL or label is invalid.", video.area)
383
446
  };
384
447
  }
448
+ const label = truncateUtf16Safe(externalLink.label, LINE_IMAGEMAP_EXTERNAL_LINK_LABEL_LIMIT) || "…";
385
449
  return { video: {
386
450
  ...video,
387
451
  externalLink: {
@@ -398,7 +462,7 @@ function normalizeLineMessage(message) {
398
462
  };
399
463
  else if (message.type === "template") {
400
464
  const labelLimit = message.template.type === "image_carousel" ? 12 : 20;
401
- const template = normalizeNestedContent(message.template, labelLimit);
465
+ const template = normalizeNestedContent(message.template, labelLimit, void 0, message.template.type === "image_carousel" ? "image-carousel" : "template");
402
466
  const columns = template.type === "carousel" ? template.columns : template.type === "buttons" ? [template] : [];
403
467
  if (columns.some((column) => !isHttpsUrl(column.thumbnailImageUrl))) for (const column of columns) delete column.thumbnailImageUrl;
404
468
  normalized = {
@@ -417,50 +481,77 @@ function normalizeLineMessage(message) {
417
481
  video: videoResult?.video
418
482
  };
419
483
  } else normalized = { ...message };
420
- if (message.quickReply) normalized = {
421
- ...normalized,
422
- quickReply: normalizeNestedContent(message.quickReply, 20)
423
- };
484
+ if (message.quickReply) {
485
+ const items = [];
486
+ for (const item of Array.isArray(message.quickReply.items) ? message.quickReply.items : []) {
487
+ if (!isRecord(item) || !isLineAction(item.action) || !hasNonEmptyString(item.action.label) || !hasRequiredActionFields(item.action)) continue;
488
+ const { imageUrl, ...rest } = item;
489
+ items.push({
490
+ ...rest,
491
+ ...isValidLineUri(imageUrl, true) ? { imageUrl } : {},
492
+ type: "action",
493
+ action: normalizeMessageSurfaceAction(item.action, 20, "quick-reply", true)
494
+ });
495
+ if (items.length === LINE_QUICK_REPLY_ITEM_LIMIT) break;
496
+ }
497
+ if (items.length) normalized.quickReply = { items };
498
+ else delete normalized.quickReply;
499
+ }
424
500
  return normalized;
425
501
  }
426
502
  function normalizeLineAction(action, labelLimit = LINE_ACTION_LABEL_LIMIT) {
427
503
  if (isUnavailableAction(action)) return action;
428
504
  const label = action.label === void 0 ? void 0 : truncateLineActionLabel(action.label, labelLimit);
429
505
  if (action.type === "uri") {
430
- const uriTooLong = action.uri !== void 0 && truncateUtf16Safe(action.uri, LINE_ACTION_URI_LIMIT) !== action.uri;
431
- const desktopUri = action.altUri?.desktop;
432
- const desktopUriTooLong = desktopUri !== void 0 && truncateUtf16Safe(desktopUri, LINE_ACTION_URI_LIMIT) !== desktopUri;
433
- if (uriTooLong || desktopUriTooLong) return unavailableAction("Link", "URL exceeds LINE's limit.");
434
- return {
506
+ if (!isValidLineUri(action.uri)) return unavailableAction("Link", invalidLineUriReason(action.uri));
507
+ const normalized = {
435
508
  ...action,
436
509
  label
437
510
  };
511
+ if (action.altUri !== void 0 && (!isRecord(action.altUri) || !isValidLineUri(action.altUri.desktop))) delete normalized.altUri;
512
+ return normalized;
438
513
  }
439
- if (action.type === "postback") {
440
- const data = action.data === void 0 ? void 0 : truncateLineActionData(action.data);
441
- if (data !== action.data) return unavailableAction("Action", "callback data exceeds LINE's limit.");
442
- const text = action.text === void 0 ? void 0 : truncateLineActionText(action.text, LINE_ACTION_DATA_LIMIT);
443
- const fillInText = action.fillInText === void 0 ? void 0 : truncateLineActionText(action.fillInText, LINE_ACTION_DATA_LIMIT);
444
- if (text !== action.text || fillInText !== action.fillInText) return unavailableAction("Action", "message text exceeds LINE's limit.");
445
- return {
446
- ...action,
514
+ if (action.type === "postback" || action.type === "datetimepicker") {
515
+ if (!hasRequiredActionFields(action)) return unavailableAction("Action", "callback data or picker mode is missing.");
516
+ if (action.data !== void 0 && action.data.length > LINE_ACTION_DATA_LIMIT) return unavailableAction("Action", "callback data exceeds LINE's limit.");
517
+ if (action.type === "datetimepicker") {
518
+ const normalized = {
519
+ ...action,
520
+ label
521
+ };
522
+ for (const field of [
523
+ "initial",
524
+ "min",
525
+ "max"
526
+ ]) {
527
+ const value = normalized[field];
528
+ if (value !== void 0 && !isValidLinePickerValue(value, action.mode)) delete normalized[field];
529
+ }
530
+ if (normalized.min !== void 0 && normalized.max !== void 0 && normalized.min.toUpperCase() >= normalized.max.toUpperCase()) {
531
+ delete normalized.min;
532
+ delete normalized.max;
533
+ }
534
+ return normalized;
535
+ }
536
+ const { text: legacyText, ...postback } = action;
537
+ const chosenText = action.displayText === void 0 ? legacyText : void 0;
538
+ const text = chosenText === void 0 ? void 0 : truncateLineActionText(chosenText, LINE_ACTION_DATA_LIMIT);
539
+ const keyboardText = action.inputOption === "openKeyboard" ? action.fillInText : void 0;
540
+ const fillInText = keyboardText === void 0 ? void 0 : truncateLineActionText(keyboardText, LINE_ACTION_DATA_LIMIT);
541
+ if (text !== chosenText || fillInText !== keyboardText) return unavailableAction("Action", "message text exceeds LINE's limit.");
542
+ const normalized = {
543
+ ...postback,
447
544
  label,
448
- data,
449
545
  displayText: action.displayText === void 0 ? void 0 : truncateLineActionText(action.displayText, LINE_ACTION_DATA_LIMIT),
450
546
  text,
451
547
  fillInText
452
548
  };
453
- }
454
- if (action.type === "datetimepicker") {
455
- const data = action.data === void 0 ? void 0 : truncateLineActionData(action.data);
456
- if (data !== action.data) return unavailableAction("Action", "callback data exceeds LINE's limit.");
457
- return {
458
- ...action,
459
- label,
460
- data
461
- };
549
+ if (normalized.inputOption !== void 0 && !linePostbackInputOptions.has(normalized.inputOption)) delete normalized.inputOption;
550
+ if (normalized.inputOption !== "openKeyboard") delete normalized.fillInText;
551
+ return normalized;
462
552
  }
463
553
  if (action.type === "message") {
554
+ if (!hasRequiredActionFields(action)) return unavailableAction("Action", "message text is missing.");
464
555
  const text = action.text === void 0 ? void 0 : truncateLineActionText(action.text, LINE_ACTION_DATA_LIMIT);
465
556
  if (text !== action.text) return unavailableAction("Action", "message text exceeds LINE's limit.");
466
557
  return {
@@ -470,20 +561,20 @@ function normalizeLineAction(action, labelLimit = LINE_ACTION_LABEL_LIMIT) {
470
561
  };
471
562
  }
472
563
  if (action.type === "clipboard") {
473
- if (truncateUtf16Safe(action.clipboardText, LINE_CLIPBOARD_TEXT_LIMIT) !== action.clipboardText) return unavailableAction("Action", "clipboard text exceeds LINE's limit.");
564
+ if (!hasRequiredActionFields(action)) return unavailableAction("Action", "clipboard text must not be empty.");
565
+ if (action.clipboardText.length > LINE_CLIPBOARD_TEXT_LIMIT) return unavailableAction("Action", "clipboard text exceeds LINE's limit.");
474
566
  return {
475
567
  ...action,
476
568
  label
477
569
  };
478
570
  }
479
571
  if (action.type === "richmenuswitch") {
480
- const data = action.data === void 0 ? void 0 : truncateLineActionData(action.data);
481
- const aliasTooLong = action.richMenuAliasId !== void 0 && truncateUtf16Safe(action.richMenuAliasId, LINE_RICH_MENU_ALIAS_LIMIT) !== action.richMenuAliasId;
482
- if (data !== action.data || aliasTooLong) return unavailableAction("Action", "rich menu data exceeds LINE's limit.");
572
+ const dataTooLong = action.data !== void 0 && action.data.length > LINE_ACTION_DATA_LIMIT;
573
+ const aliasTooLong = action.richMenuAliasId !== void 0 && action.richMenuAliasId.length > LINE_RICH_MENU_ALIAS_LIMIT;
574
+ if (dataTooLong || aliasTooLong) return unavailableAction("Action", "rich menu data exceeds LINE's limit.");
483
575
  return {
484
576
  ...action,
485
- label,
486
- data
577
+ label
487
578
  };
488
579
  }
489
580
  return action.label === label ? action : {
@@ -513,8 +604,7 @@ function postbackAction(label, data, displayText) {
513
604
  displayText
514
605
  });
515
606
  }
516
- //#endregion
517
- //#region extensions/line/src/flex-templates/common.ts
607
+ // extensions/line/src/flex-templates/common.ts
518
608
  function cardText(text, style) {
519
609
  return {
520
610
  type: "text",
@@ -575,8 +665,7 @@ function createCardBubble(bodyContents, footer) {
575
665
  });
576
666
  return bubble;
577
667
  }
578
- //#endregion
579
- //#region extensions/line/src/flex-templates/basic-cards.ts
668
+ // extensions/line/src/flex-templates/basic-cards.ts
580
669
  function createInfoCard(title, body, footer) {
581
670
  return createCardBubble([cardBox("horizontal", [cardBox("vertical", [], {
582
671
  width: "4px",
@@ -669,19 +758,7 @@ function createActionCard(title, body, actions, options) {
669
758
  };
670
759
  return bubble;
671
760
  }
672
- //#endregion
673
- //#region extensions/line/src/flex-templates/schedule-cards.ts
674
- function buildTitleSubtitleHeader(params) {
675
- const { title, subtitle } = params;
676
- const headerContents = [createCardTitle(title)];
677
- if (subtitle) headerContents.push(cardText(subtitle, {
678
- size: "sm",
679
- color: "#888888",
680
- margin: "sm",
681
- wrap: true
682
- }));
683
- return headerContents;
684
- }
761
+ // extensions/line/src/flex-templates/schedule-cards.ts
685
762
  function buildCardHeaderSections(headerContents) {
686
763
  return [cardBox("vertical", headerContents, { paddingBottom: "lg" }), {
687
764
  type: "separator",
@@ -809,10 +886,13 @@ function createEventCard(params) {
809
886
  }
810
887
  function createAgendaCard(params) {
811
888
  const { title, subtitle, events, footer } = params;
812
- const headerContents = buildTitleSubtitleHeader({
813
- title,
814
- subtitle
815
- });
889
+ const headerContents = [createCardTitle(title)];
890
+ if (subtitle) headerContents.push(cardText(subtitle, {
891
+ size: "sm",
892
+ color: "#888888",
893
+ margin: "sm",
894
+ wrap: true
895
+ }));
816
896
  const eventItems = events.slice(0, 6).map((event, index) => {
817
897
  const isActive = event.isNow || index === 0;
818
898
  const accentColor = isActive ? "#06C755" : "#E5E5E5";
@@ -846,15 +926,17 @@ function createAgendaCard(params) {
846
926
  });
847
927
  return createCardBubble([...buildCardHeaderSections(headerContents), cardBox("vertical", eventItems, { paddingTop: "xl" })], footer);
848
928
  }
849
- //#endregion
850
- //#region extensions/line/src/channel-access-token.ts
929
+ // extensions/line/src/channel-access-token.ts
851
930
  function resolveLineChannelAccessToken(explicit, params) {
852
931
  if (explicit?.trim()) return explicit.trim();
853
932
  if (!params.channelAccessToken) throw new Error(params.tokenStatus === "configured_unavailable" ? `LINE channel access token is configured but unavailable for account "${params.accountId}" (check the configured tokenFile).` : `LINE channel access token missing for account "${params.accountId}" (set channels.line.channelAccessToken or LINE_CHANNEL_ACCESS_TOKEN).`);
854
933
  return params.channelAccessToken.trim();
855
934
  }
856
- //#endregion
857
- //#region extensions/line/src/probe.ts
935
+ // extensions/line/src/probe.ts
936
+ var probe_exports = /* @__PURE__ */ __exportAll({
937
+ probeLineBot: () => probeLineBot,
938
+ readLineAccountMessageQuota: () => readLineAccountMessageQuota
939
+ });
858
940
  const LINE_QUOTA_TIMEOUT_MS = 2e3;
859
941
  const LINE_JSON_MAX_BYTES = 16384;
860
942
  function createLineApiReader(channelAccessToken, timeoutMs) {
@@ -885,13 +967,15 @@ async function readLineMessageQuota(channelAccessToken, budgetMs) {
885
967
  const read = createLineApiReader(channelAccessToken, budgetMs);
886
968
  const quota = await read("message/quota");
887
969
  if (quota.type === "none") return { kind: "unlimited" };
888
- if (quota.type !== "limited" || typeof quota.value !== "number" || !Number.isSafeInteger(quota.value) || quota.value < 0) return;
970
+ const limit = asSafeIntegerInRange(quota.value, { min: 0 });
971
+ if (quota.type !== "limited" || limit === void 0) return;
889
972
  const { totalUsage } = await read("message/quota/consumption");
890
- return typeof totalUsage === "number" && Number.isSafeInteger(totalUsage) && totalUsage >= 0 ? {
973
+ const used = asSafeIntegerInRange(totalUsage, { min: 0 });
974
+ return used === void 0 ? void 0 : {
891
975
  kind: "limited",
892
- limit: quota.value,
893
- used: totalUsage
894
- } : void 0;
976
+ limit,
977
+ used
978
+ };
895
979
  } catch {
896
980
  return;
897
981
  }
@@ -942,8 +1026,7 @@ async function probeLineBot(channelAccessToken, timeoutMs = 5e3) {
942
1026
  error: formatErrorMessage(error)
943
1027
  }));
944
1028
  }
945
- //#endregion
946
- //#region extensions/line/src/send-retry.ts
1029
+ // extensions/line/src/send-retry.ts
947
1030
  /** The LINE HTTP response carried by an error graph, when the request reached LINE. */
948
1031
  function findLineHttpError(error) {
949
1032
  return collectErrorGraphCandidates(error, (candidate) => [candidate.cause, candidate.error]).find((candidate) => candidate instanceof HTTPFetchError);
@@ -1004,5 +1087,4 @@ async function explainLineRefusal(params) {
1004
1087
  reason: exhausted ? `LINE refused the push: ${quota.used}/${quota.limit} monthly messages used. Check the account allowance or plan before retrying.` : params.error instanceof Error ? params.error.message : "LINE rejected the message"
1005
1088
  };
1006
1089
  }
1007
- //#endregion
1008
- export { resolveLineQuoteToken as A, fitsLineFlexBubble as C, readLineQuoteToken as D, canCarryLineQuoteToken as E, buildLineMediaMessage as M, inferLineTargetChatType as N, recordLineQuoteToken as O, normalizeLineMessagingTarget as P, uriAction as S, applyLineQuoteToken as T, createCardTitle as _, probeLineBot as a, postbackAction as b, createEventCard as c, createImageCard as d, createInfoCard as f, createCardBubble as g, cardText as h, runLinePushWithRetries as i, withoutLineQuoteTokens as j, reportLineQuoteCarrierMissing as k, createReceiptCard as l, cardBox as m, findLineHttpError as n, resolveLineChannelAccessToken as o, createListCard as p, resolveLineNonDispatchRetryable as r, createAgendaCard as s, explainLineRefusal as t, createActionCard as u, messageAction as v, toFlexMessage as w, truncateLineActionLabel as x, normalizeLineMessage as y };
1090
+ export { reportLineQuoteCarrierMissing as A, uriAction as C, canCarryLineQuoteToken as D, applyLineQuoteToken as E, normalizeLineMessagingTarget as F, withoutLineQuoteTokens as M, buildLineMediaMessage as N, readLineQuoteToken as O, inferLineTargetChatType as P, truncateLineActionLabel as S, toFlexMessage as T, createCardBubble as _, probeLineBot as a, normalizeLineMessage as b, createAgendaCard as c, createActionCard as d, createImageCard as f, cardText as g, cardBox as h, runLinePushWithRetries as i, resolveLineQuoteToken as j, recordLineQuoteToken as k, createEventCard as l, createListCard as m, findLineHttpError as n, probe_exports as o, createInfoCard as p, resolveLineNonDispatchRetryable as r, resolveLineChannelAccessToken as s, explainLineRefusal as t, createReceiptCard as u, createCardTitle as v, fitsLineFlexBubble as w, postbackAction as x, messageAction as y };
@@ -1,15 +1,14 @@
1
- import { n as resolveDefaultLineAccountId, r as resolveLineAccount, t as listLineAccountIds } from "./accounts-DOiM8-y3.mjs";
1
+ import { n as resolveDefaultLineAccountId, r as resolveLineAccount, t as listLineAccountIds } from "./accounts-Dm_NoU7R.mjs";
2
2
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
3
3
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
5
5
  import { createAllowFromSection, createPromptParsedAllowFromForAccount, createSetupInputPresenceValidator, createSetupTranslator, createStandardChannelSetupStatus, defineTokenCredential, formatDocsLink, parseSetupEntriesWithParser, patchScopedAccountConfig, setSetupChannelEnabled, splitSetupEntries } from "openclaw/plugin-sdk/setup";
6
6
  import { createChannelDmPolicy } from "openclaw/plugin-sdk/channel-dm-policy";
7
- //#region extensions/line/src/bot-access.ts
7
+ // extensions/line/src/bot-access.ts
8
8
  function normalizeLineAllowEntry(value) {
9
9
  return String(value).trim().replace(/^line:(?:user:)?/i, "");
10
10
  }
11
- //#endregion
12
- //#region extensions/line/src/account-helpers.ts
11
+ // extensions/line/src/account-helpers.ts
13
12
  function hasLineCredentials(account) {
14
13
  if (account.tokenStatus && account.signingSecretStatus) return account.tokenStatus !== "missing" && account.signingSecretStatus !== "missing";
15
14
  return Boolean(account.channelAccessToken?.trim() && account.channelSecret?.trim());
@@ -19,8 +18,7 @@ function parseLineAllowFromId(raw) {
19
18
  if (!/^U[a-f0-9]{32}$/i.test(trimmed)) return null;
20
19
  return trimmed;
21
20
  }
22
- //#endregion
23
- //#region extensions/line/src/setup-core.ts
21
+ // extensions/line/src/setup-core.ts
24
22
  function patchLineAccountConfig(params) {
25
23
  return patchScopedAccountConfig({
26
24
  cfg: params.cfg,
@@ -163,8 +161,7 @@ const lineSetupContract = defineChannelSetupContract({
163
161
  },
164
162
  legacyAdapter: lineSetupAdapter
165
163
  });
166
- //#endregion
167
- //#region extensions/line/src/setup-surface.ts
164
+ // extensions/line/src/setup-surface.ts
168
165
  const t = createSetupTranslator();
169
166
  const channel = "line";
170
167
  const LINE_SETUP_HELP_LINES = [
@@ -326,5 +323,4 @@ const lineSetupWizard = {
326
323
  },
327
324
  disable: (cfg) => setSetupChannelEnabled(cfg, channel, false)
328
325
  };
329
- //#endregion
330
326
  export { normalizeLineAllowEntry as a, hasLineCredentials as i, lineSetupAdapter as n, lineSetupContract as r, lineSetupWizard as t };