@openclaw/line 2026.7.2-beta.7 → 2026.8.1-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.
@@ -1,2 +0,0 @@
1
- import { t as monitorLineProvider } from "./monitor-DXEodYFJ.js";
2
- export { monitorLineProvider };
@@ -1,2 +0,0 @@
1
- import { C as sendMessageLine, E as buildTemplateMessageFromPayload, _ as pushLocationMessage, b as pushTemplateMessage, h as pushFlexMessage, i as processLineMessage, u as createQuickReplyItems, v as pushMessageLine, x as pushTextMessageWithQuickReplies, y as pushMessagesLine } from "./markdown-to-line-DMDQTMhx.js";
2
- export { buildTemplateMessageFromPayload, createQuickReplyItems, processLineMessage, pushFlexMessage, pushLocationMessage, pushMessageLine, pushMessagesLine, pushTemplateMessage, pushTextMessageWithQuickReplies, sendMessageLine };
@@ -1,107 +0,0 @@
1
- import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
2
- import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
3
- import { resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
4
- //#region extensions/line/src/outbound-media.ts
5
- const LINE_OUTBOUND_MEDIA_SSRF_POLICY = { allowPrivateNetwork: false };
6
- async function validateLineMediaUrl(url) {
7
- let parsed;
8
- try {
9
- parsed = new URL(url);
10
- } catch {
11
- throw new Error("LINE outbound media URL must be a valid URL");
12
- }
13
- if (parsed.protocol !== "https:") throw new Error("LINE outbound media URL must use HTTPS");
14
- if (url.length > 2e3) throw new Error(`LINE outbound media URL must be 2000 chars or less (got ${url.length})`);
15
- await resolvePinnedHostnameWithPolicy(parsed.hostname, { policy: LINE_OUTBOUND_MEDIA_SSRF_POLICY });
16
- }
17
- function isHttpsUrl(url) {
18
- try {
19
- return new URL(url).protocol === "https:";
20
- } catch {
21
- return false;
22
- }
23
- }
24
- function detectLineMediaKindFromUrl(url) {
25
- try {
26
- const pathname = normalizeLowercaseStringOrEmpty(new URL(url).pathname);
27
- if (/\.(png|jpe?g|gif|webp|bmp|heic|heif|avif)$/i.test(pathname)) return "image";
28
- if (/\.(mp4|mov|m4v|webm)$/i.test(pathname)) return "video";
29
- if (/\.(mp3|m4a|aac|wav|ogg|oga)$/i.test(pathname)) return "audio";
30
- } catch {
31
- return;
32
- }
33
- }
34
- async function resolveLineOutboundMedia(mediaUrl, opts = {}) {
35
- const trimmedUrl = mediaUrl.trim();
36
- if (isHttpsUrl(trimmedUrl)) {
37
- await validateLineMediaUrl(trimmedUrl);
38
- const previewImageUrl = opts.previewImageUrl?.trim();
39
- if (previewImageUrl) await validateLineMediaUrl(previewImageUrl);
40
- return {
41
- mediaUrl: trimmedUrl,
42
- mediaKind: opts.mediaKind ?? (typeof opts.durationMs === "number" ? "audio" : void 0) ?? (opts.trackingId?.trim() ? "video" : void 0) ?? detectLineMediaKindFromUrl(trimmedUrl) ?? "image",
43
- ...previewImageUrl ? { previewImageUrl } : {},
44
- ...typeof opts.durationMs === "number" ? { durationMs: opts.durationMs } : {},
45
- ...opts.trackingId ? { trackingId: opts.trackingId } : {}
46
- };
47
- }
48
- let parsed;
49
- try {
50
- parsed = new URL(trimmedUrl);
51
- } catch {}
52
- if (parsed) throw new Error("LINE outbound media URL must use HTTPS");
53
- throw new Error("LINE outbound media currently requires a public HTTPS URL");
54
- }
55
- function isLineUserTarget(target) {
56
- const normalized = target.trim().replace(/^line:(group|room|user):/i, "").replace(/^line:/i, "");
57
- return /^U/i.test(normalized);
58
- }
59
- function hasLineSpecificMediaOptions(lineData) {
60
- return lineData.mediaKind !== void 0 || Boolean(lineData.previewImageUrl?.trim()) || typeof lineData.durationMs === "number" || Boolean(lineData.trackingId?.trim());
61
- }
62
- function buildLineMediaMessageObject(resolved, opts) {
63
- switch (resolved.mediaKind) {
64
- case "video": {
65
- const previewImageUrl = resolved.previewImageUrl?.trim();
66
- if (!previewImageUrl) throw new Error("LINE video messages require previewImageUrl to reference an image URL");
67
- return {
68
- type: "video",
69
- originalContentUrl: resolved.mediaUrl,
70
- previewImageUrl,
71
- ...opts?.allowTrackingId && resolved.trackingId ? { trackingId: resolved.trackingId } : {}
72
- };
73
- }
74
- case "audio": return {
75
- type: "audio",
76
- originalContentUrl: resolved.mediaUrl,
77
- duration: resolved.durationMs ?? 6e4
78
- };
79
- default: return {
80
- type: "image",
81
- originalContentUrl: resolved.mediaUrl,
82
- previewImageUrl: resolved.previewImageUrl ?? resolved.mediaUrl
83
- };
84
- }
85
- }
86
- async function buildLineMediaMessage(mediaUrl, opts, target) {
87
- return buildLineMediaMessageObject(await resolveLineOutboundMedia(mediaUrl, opts), { allowTrackingId: isLineUserTarget(target) });
88
- }
89
- //#endregion
90
- //#region extensions/line/src/send-receipt.ts
91
- function createLineSendReceipt(params) {
92
- const messageId = params.messageId.trim();
93
- const chatId = params.chatId.trim();
94
- return createMessageReceiptFromOutboundResults({
95
- results: messageId ? [{
96
- channel: "line",
97
- messageId,
98
- chatId,
99
- conversationId: chatId,
100
- meta: { messageCount: params.messageCount ?? 1 }
101
- }] : [],
102
- ...chatId ? { threadId: chatId } : {},
103
- kind: params.kind ?? "unknown"
104
- });
105
- }
106
- //#endregion
107
- export { validateLineMediaUrl as a, resolveLineOutboundMedia as i, buildLineMediaMessage as n, hasLineSpecificMediaOptions as r, createLineSendReceipt as t };