@openclaw/line 2026.5.2-beta.2 → 2026.5.3-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 (109) hide show
  1. package/dist/accounts-UXAvdBo_.js +105 -0
  2. package/dist/api.js +11 -0
  3. package/dist/basic-cards-7DTG6E-A.js +307 -0
  4. package/dist/card-command-UlPc6Vuc.js +240 -0
  5. package/dist/channel-Rls9s60K.js +601 -0
  6. package/dist/channel-plugin-api.js +2 -0
  7. package/dist/channel.runtime-bXoj8_Sl.js +4 -0
  8. package/dist/contract-api.js +2 -0
  9. package/dist/index.js +45 -0
  10. package/dist/markdown-to-line-CCWK6PJh.js +789 -0
  11. package/dist/monitor-B4_RxHc0.js +1523 -0
  12. package/dist/monitor.runtime-DyxYlrM9.js +2 -0
  13. package/dist/outbound-media-BfhBmWq5.js +55 -0
  14. package/dist/outbound.runtime-B-luYwEB.js +2 -0
  15. package/dist/probe-D9BPzb2n.js +30 -0
  16. package/dist/probe.runtime-N91OWW1J.js +2 -0
  17. package/dist/quick-reply-fallback-HskUUWsn.js +55 -0
  18. package/dist/reply-payload-transform-CFGTs9ln.js +713 -0
  19. package/dist/runtime-api.js +277 -0
  20. package/dist/schedule-cards-BwQChTdM.js +359 -0
  21. package/dist/secret-contract-api.js +5 -0
  22. package/dist/setup-api.js +2 -0
  23. package/dist/setup-entry.js +11 -0
  24. package/dist/setup-surface-DCH7CE-y.js +281 -0
  25. package/package.json +14 -6
  26. package/api.ts +0 -11
  27. package/channel-plugin-api.ts +0 -1
  28. package/contract-api.ts +0 -5
  29. package/index.ts +0 -54
  30. package/runtime-api.ts +0 -187
  31. package/secret-contract-api.ts +0 -4
  32. package/setup-api.ts +0 -2
  33. package/setup-entry.ts +0 -9
  34. package/src/account-helpers.ts +0 -16
  35. package/src/accounts.test.ts +0 -290
  36. package/src/accounts.ts +0 -187
  37. package/src/actions.ts +0 -61
  38. package/src/auto-reply-delivery.test.ts +0 -248
  39. package/src/auto-reply-delivery.ts +0 -200
  40. package/src/bindings.ts +0 -65
  41. package/src/bot-access.ts +0 -48
  42. package/src/bot-handlers.test.ts +0 -1089
  43. package/src/bot-handlers.ts +0 -642
  44. package/src/bot-message-context.test.ts +0 -405
  45. package/src/bot-message-context.ts +0 -581
  46. package/src/bot.ts +0 -70
  47. package/src/card-command.ts +0 -347
  48. package/src/channel-access-token.ts +0 -14
  49. package/src/channel-api.ts +0 -17
  50. package/src/channel-setup-status.contract.test.ts +0 -70
  51. package/src/channel-shared.ts +0 -48
  52. package/src/channel.logout.test.ts +0 -145
  53. package/src/channel.runtime.ts +0 -3
  54. package/src/channel.sendPayload.test.ts +0 -514
  55. package/src/channel.setup.ts +0 -11
  56. package/src/channel.status.test.ts +0 -63
  57. package/src/channel.ts +0 -154
  58. package/src/config-adapter.ts +0 -29
  59. package/src/config-schema.ts +0 -57
  60. package/src/download.test.ts +0 -133
  61. package/src/download.ts +0 -87
  62. package/src/flex-templates/basic-cards.ts +0 -395
  63. package/src/flex-templates/common.ts +0 -20
  64. package/src/flex-templates/media-control-cards.ts +0 -555
  65. package/src/flex-templates/message.ts +0 -13
  66. package/src/flex-templates/schedule-cards.ts +0 -467
  67. package/src/flex-templates/types.ts +0 -22
  68. package/src/flex-templates.ts +0 -32
  69. package/src/gateway.ts +0 -129
  70. package/src/group-keys.test.ts +0 -123
  71. package/src/group-keys.ts +0 -65
  72. package/src/group-policy.ts +0 -22
  73. package/src/markdown-to-line.test.ts +0 -348
  74. package/src/markdown-to-line.ts +0 -416
  75. package/src/message-cards.test.ts +0 -204
  76. package/src/monitor.lifecycle.test.ts +0 -421
  77. package/src/monitor.runtime.ts +0 -1
  78. package/src/monitor.ts +0 -506
  79. package/src/outbound-media.test.ts +0 -189
  80. package/src/outbound-media.ts +0 -120
  81. package/src/outbound.runtime.ts +0 -12
  82. package/src/outbound.ts +0 -356
  83. package/src/probe.contract.test.ts +0 -9
  84. package/src/probe.runtime.ts +0 -1
  85. package/src/probe.ts +0 -34
  86. package/src/quick-reply-fallback.ts +0 -10
  87. package/src/reply-chunks.test.ts +0 -179
  88. package/src/reply-chunks.ts +0 -110
  89. package/src/reply-payload-transform.test.ts +0 -387
  90. package/src/reply-payload-transform.ts +0 -317
  91. package/src/rich-menu.test.ts +0 -310
  92. package/src/rich-menu.ts +0 -326
  93. package/src/runtime.ts +0 -32
  94. package/src/send.test.ts +0 -346
  95. package/src/send.ts +0 -489
  96. package/src/setup-core.ts +0 -149
  97. package/src/setup-runtime-api.ts +0 -9
  98. package/src/setup-surface.test.ts +0 -474
  99. package/src/setup-surface.ts +0 -227
  100. package/src/signature.test.ts +0 -34
  101. package/src/signature.ts +0 -24
  102. package/src/status.ts +0 -37
  103. package/src/template-messages.ts +0 -333
  104. package/src/types.ts +0 -128
  105. package/src/webhook-node.test.ts +0 -513
  106. package/src/webhook-node.ts +0 -131
  107. package/src/webhook-utils.ts +0 -10
  108. package/src/webhook.ts +0 -111
  109. package/tsconfig.json +0 -16
@@ -0,0 +1,2 @@
1
+ import { t as monitorLineProvider } from "./monitor-B4_RxHc0.js";
2
+ export { monitorLineProvider };
@@ -0,0 +1,55 @@
1
+ import { resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
2
+ import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtime";
3
+ //#region extensions/line/src/outbound-media.ts
4
+ const LINE_OUTBOUND_MEDIA_SSRF_POLICY = { allowPrivateNetwork: false };
5
+ async function validateLineMediaUrl(url) {
6
+ let parsed;
7
+ try {
8
+ parsed = new URL(url);
9
+ } catch {
10
+ throw new Error(`LINE outbound media URL must be a valid URL: ${url}`);
11
+ }
12
+ if (parsed.protocol !== "https:") throw new Error(`LINE outbound media URL must use HTTPS: ${url}`);
13
+ if (url.length > 2e3) throw new Error(`LINE outbound media URL must be 2000 chars or less (got ${url.length})`);
14
+ await resolvePinnedHostnameWithPolicy(parsed.hostname, { policy: LINE_OUTBOUND_MEDIA_SSRF_POLICY });
15
+ }
16
+ function isHttpsUrl(url) {
17
+ try {
18
+ return new URL(url).protocol === "https:";
19
+ } catch {
20
+ return false;
21
+ }
22
+ }
23
+ function detectLineMediaKindFromUrl(url) {
24
+ try {
25
+ const pathname = normalizeLowercaseStringOrEmpty(new URL(url).pathname);
26
+ if (/\.(png|jpe?g|gif|webp|bmp|heic|heif|avif)$/i.test(pathname)) return "image";
27
+ if (/\.(mp4|mov|m4v|webm)$/i.test(pathname)) return "video";
28
+ if (/\.(mp3|m4a|aac|wav|ogg|oga)$/i.test(pathname)) return "audio";
29
+ } catch {
30
+ return;
31
+ }
32
+ }
33
+ async function resolveLineOutboundMedia(mediaUrl, opts = {}) {
34
+ const trimmedUrl = mediaUrl.trim();
35
+ if (isHttpsUrl(trimmedUrl)) {
36
+ await validateLineMediaUrl(trimmedUrl);
37
+ const previewImageUrl = opts.previewImageUrl?.trim();
38
+ if (previewImageUrl) await validateLineMediaUrl(previewImageUrl);
39
+ return {
40
+ mediaUrl: trimmedUrl,
41
+ mediaKind: opts.mediaKind ?? (typeof opts.durationMs === "number" ? "audio" : void 0) ?? (opts.trackingId?.trim() ? "video" : void 0) ?? detectLineMediaKindFromUrl(trimmedUrl) ?? "image",
42
+ ...previewImageUrl ? { previewImageUrl } : {},
43
+ ...typeof opts.durationMs === "number" ? { durationMs: opts.durationMs } : {},
44
+ ...opts.trackingId ? { trackingId: opts.trackingId } : {}
45
+ };
46
+ }
47
+ try {
48
+ if (new URL(trimmedUrl).protocol !== "https:") throw new Error(`LINE outbound media URL must use HTTPS: ${trimmedUrl}`);
49
+ } catch (e) {
50
+ if (e instanceof Error && e.message.startsWith("LINE outbound")) throw e;
51
+ }
52
+ throw new Error("LINE outbound media currently requires a public HTTPS URL");
53
+ }
54
+ //#endregion
55
+ export { validateLineMediaUrl as n, resolveLineOutboundMedia as t };
@@ -0,0 +1,2 @@
1
+ import { A as buildTemplateMessageFromPayload, C as pushMessagesLine, D as sendMessageLine, S as pushMessageLine, T as pushTextMessageWithQuickReplies, c as processLineMessage, m as createQuickReplyItems, w as pushTemplateMessage, x as pushLocationMessage, y as pushFlexMessage } from "./markdown-to-line-CCWK6PJh.js";
2
+ export { buildTemplateMessageFromPayload, createQuickReplyItems, processLineMessage, pushFlexMessage, pushLocationMessage, pushMessageLine, pushMessagesLine, pushTemplateMessage, pushTextMessageWithQuickReplies, sendMessageLine };
@@ -0,0 +1,30 @@
1
+ import { withTimeout } from "openclaw/plugin-sdk/text-runtime";
2
+ import { messagingApi } from "@line/bot-sdk";
3
+ import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
4
+ //#region extensions/line/src/probe.ts
5
+ async function probeLineBot(channelAccessToken, timeoutMs = 5e3) {
6
+ if (!channelAccessToken?.trim()) return {
7
+ ok: false,
8
+ error: "Channel access token not configured"
9
+ };
10
+ const client = new messagingApi.MessagingApiClient({ channelAccessToken: channelAccessToken.trim() });
11
+ try {
12
+ const profile = await withTimeout(client.getBotInfo(), timeoutMs);
13
+ return {
14
+ ok: true,
15
+ bot: {
16
+ displayName: profile.displayName,
17
+ userId: profile.userId,
18
+ basicId: profile.basicId,
19
+ pictureUrl: profile.pictureUrl
20
+ }
21
+ };
22
+ } catch (err) {
23
+ return {
24
+ ok: false,
25
+ error: formatErrorMessage(err)
26
+ };
27
+ }
28
+ }
29
+ //#endregion
30
+ export { probeLineBot as t };
@@ -0,0 +1,2 @@
1
+ import { t as probeLineBot } from "./probe-D9BPzb2n.js";
2
+ export { probeLineBot };
@@ -0,0 +1,55 @@
1
+ import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
2
+ import { resolveAccountEntry } from "openclaw/plugin-sdk/account-resolution";
3
+ import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
4
+ //#region extensions/line/src/group-keys.ts
5
+ function resolveLineGroupLookupIds(groupId) {
6
+ const normalized = groupId?.trim();
7
+ if (!normalized) return [];
8
+ if (normalized.startsWith("group:") || normalized.startsWith("room:")) {
9
+ const rawId = normalized.split(":").slice(1).join(":");
10
+ return rawId ? [rawId, normalized] : [normalized];
11
+ }
12
+ return [
13
+ normalized,
14
+ `group:${normalized}`,
15
+ `room:${normalized}`
16
+ ];
17
+ }
18
+ function resolveLineGroupConfigEntry(groups, params) {
19
+ if (!groups) return;
20
+ for (const candidate of resolveLineGroupLookupIds(params.groupId)) {
21
+ const hit = groups[candidate];
22
+ if (hit) return hit;
23
+ }
24
+ for (const candidate of resolveLineGroupLookupIds(params.roomId)) {
25
+ const hit = groups[candidate];
26
+ if (hit) return hit;
27
+ }
28
+ return groups["*"];
29
+ }
30
+ function resolveLineGroupsConfig(cfg, accountId) {
31
+ const lineConfig = cfg.channels?.line;
32
+ if (!lineConfig) return;
33
+ const normalizedAccountId = normalizeAccountId(accountId);
34
+ return resolveAccountEntry(lineConfig.accounts, normalizedAccountId)?.groups ?? lineConfig.groups;
35
+ }
36
+ function resolveExactLineGroupConfigKey(params) {
37
+ const groups = resolveLineGroupsConfig(params.cfg, params.accountId);
38
+ if (!groups) return;
39
+ return resolveLineGroupLookupIds(params.groupId).find((candidate) => Object.hasOwn(groups, candidate));
40
+ }
41
+ //#endregion
42
+ //#region extensions/line/src/runtime.ts
43
+ const { setRuntime: setLineRuntime, clearRuntime: clearLineRuntime, getRuntime: getLineRuntime } = createPluginRuntimeStore({
44
+ pluginId: "line",
45
+ errorMessage: "LINE runtime not initialized - plugin not registered"
46
+ });
47
+ //#endregion
48
+ //#region extensions/line/src/quick-reply-fallback.ts
49
+ function buildLineQuickReplyFallbackText(labels) {
50
+ const normalized = (labels ?? []).map((label) => label.trim()).filter(Boolean).slice(0, 13);
51
+ if (normalized.length === 0) return "Choose an option.";
52
+ return `Options:\n${normalized.map((label) => `- ${label}`).join("\n")}`;
53
+ }
54
+ //#endregion
55
+ export { resolveLineGroupConfigEntry as a, resolveExactLineGroupConfigKey as i, getLineRuntime as n, resolveLineGroupLookupIds as o, setLineRuntime as r, resolveLineGroupsConfig as s, buildLineQuickReplyFallbackText as t };