@openclaw/line 2026.11.3 → 2026.11.5-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/.setup/api-4BpGVN1-.mjs +3 -0
  2. package/dist/.setup/{api-WIupE7U1.mjs → api-BRnngy5R.mjs} +1 -1
  3. package/dist/.setup/{card-command-Dnkl21vg.mjs → card-command-2y-RSLPg.mjs} +26 -43
  4. package/dist/.setup/{channel-DIEVJ4PQ.mjs → channel-DJcpjKpx.mjs} +237 -332
  5. package/dist/.setup/channel.runtime-CdfKsNz4.mjs +4 -0
  6. package/dist/.setup/{monitor-JlOPDECF.mjs → monitor-BkuPFFxZ.mjs} +240 -329
  7. package/dist/.setup/{outbound.runtime-pciQUWJd.mjs → outbound.runtime-BPo_111h.mjs} +2 -2
  8. package/dist/.setup/{send-kjjjemFi.mjs → send-C1JZOFMA.mjs} +32 -81
  9. package/dist/.setup/{send-retry-Dzbkz5wG.mjs → send-retry-Bf2Xr6ZN.mjs} +175 -80
  10. package/dist/.setup/{template-messages-COcdie6C.mjs → template-messages-C1Kkr0-e.mjs} +32 -44
  11. package/dist/.source-module-urls/2c97352967966b7ab9f67f528eb25c098b6fe10ea0e4616ffae3851ed839d81e.json +1 -0
  12. package/dist/api.js +2 -2
  13. package/dist/channel-plugin-api.js +1 -2
  14. package/dist/contract-api.js +1 -2
  15. package/dist/index.js +1 -1
  16. package/dist/runtime-api.js +1 -2
  17. package/dist/setup-api.js +1 -2
  18. package/dist/setup-entry.js +1 -1
  19. package/node_modules/@line/bot-sdk/node_modules/@types/node/README.md +1 -1
  20. package/node_modules/@line/bot-sdk/node_modules/@types/node/package.json +2 -2
  21. package/node_modules/@line/bot-sdk/node_modules/@types/node/util.d.ts +7 -4
  22. package/node_modules/typebox/build/format/duration.d.mts +2 -2
  23. package/node_modules/typebox/build/format/duration.mjs +2 -2
  24. package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
  25. package/node_modules/typebox/build/format/idn_email.mjs +1 -0
  26. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
  27. package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
  28. package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
  29. package/node_modules/typebox/build/format/ipv4.mjs +2 -2
  30. package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
  31. package/node_modules/typebox/build/format/ipv6.mjs +1 -1
  32. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  33. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  34. package/node_modules/typebox/build/schema/build.mjs +1 -0
  35. package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
  36. package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
  37. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
  38. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
  39. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
  40. package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
  41. package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
  42. package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
  43. package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
  44. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
  45. package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
  46. package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
  47. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
  48. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
  49. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
  50. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
  51. package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
  52. package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
  53. package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
  54. package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
  55. package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
  56. package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
  57. package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
  58. package/node_modules/typebox/build/system/memory/create.mjs +18 -13
  59. package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
  60. package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
  61. package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
  62. package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
  63. package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
  64. package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
  65. package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
  66. package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
  67. package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
  68. package/node_modules/typebox/build/system/memory/update.mjs +43 -16
  69. package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
  70. package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
  71. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
  72. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
  73. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
  74. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
  75. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
  76. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
  77. package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
  78. package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
  79. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
  80. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
  81. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
  82. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
  83. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
  84. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  85. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
  86. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
  87. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
  88. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
  89. package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
  90. package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
  91. package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
  92. package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
  93. package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
  94. package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
  95. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
  96. package/node_modules/typebox/package.json +1 -1
  97. package/node_modules/typebox/readme.md +1 -1
  98. package/node_modules/zod/package.json +1 -1
  99. package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
  100. package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
  101. package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
  102. package/node_modules/zod/src/v4/core/compile.ts +9 -0
  103. package/node_modules/zod/src/v4/core/schemas.ts +35 -1
  104. package/node_modules/zod/src/v4/core/util.ts +13 -0
  105. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  106. package/node_modules/zod/v4/core/compile.cjs +8 -0
  107. package/node_modules/zod/v4/core/compile.js +8 -0
  108. package/node_modules/zod/v4/core/schemas.cjs +30 -0
  109. package/node_modules/zod/v4/core/schemas.d.cts +3 -1
  110. package/node_modules/zod/v4/core/schemas.d.ts +3 -1
  111. package/node_modules/zod/v4/core/schemas.js +30 -0
  112. package/node_modules/zod/v4/core/util.cjs +15 -0
  113. package/node_modules/zod/v4/core/util.d.cts +2 -0
  114. package/node_modules/zod/v4/core/util.d.ts +2 -0
  115. package/node_modules/zod/v4/core/util.js +14 -0
  116. package/node_modules/zod/v4/core/versions.cjs +1 -1
  117. package/node_modules/zod/v4/core/versions.js +1 -1
  118. package/package.json +6 -6
  119. package/dist/.setup/api-BMSLc5Fi.mjs +0 -3
  120. package/dist/.setup/channel.runtime-CDy9DQUW.mjs +0 -4
  121. package/dist/.setup/monitor.runtime-DsIFiXEZ.mjs +0 -2
  122. package/dist/.setup/probe.runtime-D2MUF_B_.mjs +0 -2
  123. package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
  124. package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
@@ -1,3 +1,3 @@
1
- import { c as pushLocationMessage, d as pushTemplateMessage, f as pushTextMessageWithQuickReplies, l as pushMessageLine, n as createLocationMessage, r as createQuickReplyItems, s as pushFlexMessage, t as createFlexMessage, u as pushMessagesLine } from "./send-kjjjemFi.mjs";
2
- import { n as processLineMessage, t as buildTemplateMessageFromPayload } from "./template-messages-COcdie6C.mjs";
1
+ import { c as pushLocationMessage, d as pushTemplateMessage, f as pushTextMessageWithQuickReplies, l as pushMessageLine, n as createLocationMessage, r as createQuickReplyItems, s as pushFlexMessage, t as createFlexMessage, u as pushMessagesLine } from "./send-C1JZOFMA.mjs";
2
+ import { n as processLineMessage, t as buildTemplateMessageFromPayload } from "./template-messages-C1Kkr0-e.mjs";
3
3
  export { buildTemplateMessageFromPayload, createFlexMessage, createLocationMessage, createQuickReplyItems, processLineMessage, pushFlexMessage, pushLocationMessage, pushMessageLine, pushMessagesLine, pushTemplateMessage, pushTextMessageWithQuickReplies };
@@ -1,8 +1,8 @@
1
+ import { E as applyLineQuoteToken, F as normalizeLineMessagingTarget, M as withoutLineQuoteTokens, N as buildLineMediaMessage, b as normalizeLineMessage, i as runLinePushWithRetries, n as findLineHttpError, s as resolveLineChannelAccessToken, y as messageAction } from "./send-retry-Bf2Xr6ZN.mjs";
1
2
  import { r as resolveLineAccount } from "./accounts-DOiM8-y3.mjs";
2
- import { M as buildLineMediaMessage, T as applyLineQuoteToken, i as runLinePushWithRetries, j as withoutLineQuoteTokens, n as findLineHttpError, o as resolveLineChannelAccessToken, v as messageAction, y as normalizeLineMessage } from "./send-retry-Dzbkz5wG.mjs";
3
3
  import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
4
4
  import { createChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
5
- import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
5
+ import { createStaleWhileRevalidateCache } from "openclaw/plugin-sdk/collection-runtime";
6
6
  import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
7
7
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
8
8
  import { HTTPFetchError, messagingApi } from "@line/bot-sdk";
@@ -37,65 +37,20 @@ function quotesLineBotMessage(accountId, quotedMessageId) {
37
37
  return recentSentByAccount.get(accountId)?.peek(quotedMessageId) ?? false;
38
38
  }
39
39
  //#endregion
40
- //#region extensions/line/src/send-receipt.ts
41
- function createLineSendReceipt(params) {
42
- const messageIds = (params.messageIds ?? [params.messageId]).map((messageId) => messageId.trim()).filter(Boolean);
43
- const chatId = params.chatId.trim();
44
- return createMessageReceiptFromOutboundResults({
45
- results: messageIds.map((messageId) => ({
46
- channel: "line",
47
- messageId,
48
- chatId,
49
- conversationId: chatId,
50
- meta: { messageCount: params.messageCount ?? 1 }
51
- })),
52
- ...chatId ? { threadId: chatId } : {},
53
- kind: params.kind ?? "unknown"
54
- });
55
- }
56
- //#endregion
57
40
  //#region extensions/line/src/send.ts
58
- const profileCache = {
59
- values: /* @__PURE__ */ new Map(),
60
- pending: /* @__PURE__ */ new Map()
61
- };
62
- const groupNameCache = {
63
- values: /* @__PURE__ */ new Map(),
64
- pending: /* @__PURE__ */ new Map()
65
- };
66
41
  const PROFILE_CACHE_TTL_MS = 3e5;
67
42
  const PROFILE_CACHE_MAX_ENTRIES = 1e3;
43
+ const profileCache = createStaleWhileRevalidateCache({
44
+ maxEntries: PROFILE_CACHE_MAX_ENTRIES,
45
+ ttlMs: PROFILE_CACHE_TTL_MS
46
+ });
47
+ const groupNameCache = createStaleWhileRevalidateCache({
48
+ maxEntries: PROFILE_CACHE_MAX_ENTRIES,
49
+ ttlMs: PROFILE_CACHE_TTL_MS
50
+ });
68
51
  const LINE_FLEX_ALT_TEXT_LIMIT = 1500;
69
52
  const LINE_LOCATION_LABEL_LIMIT = 100;
70
53
  const LINE_PROVIDER_RESPONSE_MAX_BYTES = 16384;
71
- function rememberLineIdentity(cache, key, value) {
72
- const entry = {
73
- value,
74
- fetchedAt: Date.now()
75
- };
76
- cache.values.delete(key);
77
- cache.values.set(key, entry);
78
- if (cache.values.size <= PROFILE_CACHE_MAX_ENTRIES) return;
79
- for (const [cachedKey, cached] of cache.values) if (entry.fetchedAt - cached.fetchedAt >= PROFILE_CACHE_TTL_MS) cache.values.delete(cachedKey);
80
- pruneMapToMaxSize(cache.values, PROFILE_CACHE_MAX_ENTRIES);
81
- }
82
- async function loadLineIdentity(cache, key, load) {
83
- const cached = cache.values.get(key);
84
- if (cached && Date.now() - cached.fetchedAt < PROFILE_CACHE_TTL_MS) return cached.value;
85
- const pending = cache.pending.get(key);
86
- if (pending) return await pending;
87
- const lookup = load().then((value) => {
88
- rememberLineIdentity(cache, key, value);
89
- return value;
90
- });
91
- cache.pending.set(key, lookup);
92
- pruneMapToMaxSize(cache.pending, PROFILE_CACHE_MAX_ENTRIES);
93
- try {
94
- return await lookup;
95
- } finally {
96
- if (cache.pending.get(key) === lookup) cache.pending.delete(key);
97
- }
98
- }
99
54
  function resolveLineProviderMessageIds(response, operation) {
100
55
  const sentMessages = Array.isArray(response?.sentMessages) ? response.sentMessages : [];
101
56
  const messageIds = sentMessages.flatMap((entry) => {
@@ -114,9 +69,7 @@ function resolveLineProviderMessageIds(response, operation) {
114
69
  };
115
70
  }
116
71
  function normalizeTarget(to) {
117
- const trimmed = to.trim();
118
- if (!trimmed) throw new Error("Recipient is required for LINE sends");
119
- const normalized = trimmed.replace(/^line:group:/i, "").replace(/^line:room:/i, "").replace(/^line:user:/i, "").replace(/^line:/i, "");
72
+ const normalized = normalizeLineMessagingTarget(to);
120
73
  if (!normalized) throw new Error("Recipient is required for LINE sends");
121
74
  if (normalized.length >= 33 && !/^[CUR]/.test(normalized)) throw new Error(`Recipient is not a valid LINE id (case-sensitive; expected leading capital C/U/R): ${truncateUtf16Safe(normalized, 4)}…`);
122
75
  return normalized;
@@ -221,7 +174,7 @@ function resolveLineReceiptKind(messages) {
221
174
  if (types.has("text")) return "text";
222
175
  return "unknown";
223
176
  }
224
- async function pushLineMessages(to, messages, opts, behavior = {}) {
177
+ async function pushLineMessages(to, messages, opts) {
225
178
  if (messages.length === 0) throw new Error("Message must be non-empty for LINE sends");
226
179
  const { account, token } = resolveLineMessagingAccount(opts);
227
180
  const chatId = normalizeTarget(to);
@@ -234,22 +187,22 @@ async function pushLineMessages(to, messages, opts, behavior = {}) {
234
187
  const result = {
235
188
  messageId,
236
189
  chatId,
237
- receipt: createLineSendReceipt({
238
- messageId,
239
- messageIds,
240
- chatId,
241
- kind: resolveLineReceiptKind(messages),
242
- messageCount: messages.length
190
+ receipt: createMessageReceiptFromOutboundResults({
191
+ results: messageIds.map((providerMessageId) => ({
192
+ channel: "line",
193
+ messageId: providerMessageId,
194
+ chatId,
195
+ conversationId: chatId,
196
+ meta: { messageCount: messages.length }
197
+ })),
198
+ ...chatId ? { threadId: chatId } : {},
199
+ kind: resolveLineReceiptKind(messages)
243
200
  })
244
201
  };
245
202
  recordLineOutboundActivity(account.accountId, {
246
203
  messageIds,
247
204
  receipt: result.receipt
248
205
  });
249
- if (opts.verbose) {
250
- const logMessage = behavior.verboseMessage?.(chatId, messages.length) ?? `line: pushed ${messages.length} messages to ${chatId}`;
251
- logVerbose(logMessage);
252
- }
253
206
  return result;
254
207
  }
255
208
  async function pushMessageLine(to, text, opts) {
@@ -266,7 +219,7 @@ async function pushMessageLine(to, text, opts) {
266
219
  type: "text",
267
220
  text: text.trim()
268
221
  });
269
- return pushLineMessages(chatId, messages, opts, { verboseMessage: (resolvedChatId) => `line: pushed message to ${resolvedChatId}` });
222
+ return pushLineMessages(chatId, messages, opts);
270
223
  }
271
224
  async function replyMessageLine(replyToken, messages, opts) {
272
225
  const { account, token } = resolveLineMessagingAccount(opts);
@@ -275,7 +228,6 @@ async function replyMessageLine(replyToken, messages, opts) {
275
228
  messages: applyLineQuoteToken(messages, opts.quoteToken).map(normalizeLineMessage)
276
229
  }, void 0, opts.authorize, opts.assertDirectAdapterHandoff), "reply");
277
230
  recordLineOutboundActivity(account.accountId, { messageIds });
278
- if (opts.verbose) logVerbose(`line: replied with ${messages.length} messages`);
279
231
  }
280
232
  async function pushMessagesLine(to, messages, opts) {
281
233
  return pushLineMessages(to, messages, opts);
@@ -288,23 +240,23 @@ function createFlexMessage(altText, contents) {
288
240
  };
289
241
  }
290
242
  async function pushLocationMessage(to, location, opts) {
291
- return pushLineMessages(to, [createLocationMessage(location)], opts, { verboseMessage: (chatId) => `line: pushed location to ${chatId}` });
243
+ return pushLineMessages(to, [createLocationMessage(location)], opts);
292
244
  }
293
245
  async function pushFlexMessage(to, altText, contents, opts) {
294
- return pushLineMessages(to, [createFlexMessage(altText, contents)], opts, { verboseMessage: (chatId) => `line: pushed flex message to ${chatId}` });
246
+ return pushLineMessages(to, [createFlexMessage(altText, contents)], opts);
295
247
  }
296
248
  async function pushTemplateMessage(to, template, opts) {
297
- return pushLineMessages(to, [template], opts, { verboseMessage: (chatId) => `line: pushed template message to ${chatId}` });
249
+ return pushLineMessages(to, [template], opts);
298
250
  }
299
251
  async function pushTextMessageWithQuickReplies(to, text, quickReplyLabels, opts) {
300
252
  return pushLineMessages(to, [{
301
253
  type: "text",
302
254
  text,
303
255
  quickReply: createQuickReplyItems(quickReplyLabels)
304
- }], opts, { verboseMessage: (chatId) => `line: pushed message with quick replies to ${chatId}` });
256
+ }], opts);
305
257
  }
306
258
  function createQuickReplyItems(labels) {
307
- return { items: labels.slice(0, 13).map((label) => ({
259
+ return { items: labels.map((label) => label.trim()).filter(Boolean).slice(0, 13).map((label) => ({
308
260
  type: "action",
309
261
  action: messageAction(label, label)
310
262
  })) };
@@ -315,9 +267,8 @@ async function showLoadingAnimation(chatId, opts) {
315
267
  try {
316
268
  await client.showLoadingAnimation({
317
269
  chatId: normalizeTarget(chatId),
318
- loadingSeconds: opts.loadingSeconds ?? 20
270
+ loadingSeconds: 20
319
271
  });
320
- logVerbose(`line: showing loading animation to ${chatId}`);
321
272
  } catch (err) {
322
273
  logVerbose(`line: loading animation failed (non-fatal): ${String(err)}`);
323
274
  }
@@ -352,7 +303,7 @@ async function getUserProfile(userId, opts) {
352
303
  return null;
353
304
  }
354
305
  };
355
- return await loadLineIdentity(profileCache, cacheKey, load);
306
+ return (await profileCache.read(cacheKey, load, { allowStale: false })).value;
356
307
  } catch (err) {
357
308
  logVerbose(`line: failed to fetch profile for ${userId}: ${String(err)}`);
358
309
  return null;
@@ -369,14 +320,14 @@ async function getLineGroupName(groupId, opts) {
369
320
  "group",
370
321
  groupId
371
322
  ]);
372
- return await loadLineIdentity(groupNameCache, cacheKey, async () => {
323
+ return (await groupNameCache.read(cacheKey, async () => {
373
324
  try {
374
325
  return (await new messagingApi.MessagingApiClient({ channelAccessToken: token }).getGroupSummary(groupId)).groupName.trim() || void 0;
375
326
  } catch (err) {
376
327
  logVerbose(`line: failed to fetch group summary for ${groupId}: ${String(err)}`);
377
328
  return;
378
329
  }
379
- });
330
+ }, { allowStale: false })).value;
380
331
  } catch (err) {
381
332
  logVerbose(`line: failed to fetch group summary for ${groupId}: ${String(err)}`);
382
333
  return;