@openclaw/line 2026.7.2-beta.3 → 2026.7.2-beta.5
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/README.md +1 -1
- package/dist/{accounts-BUBOoW5Q.js → accounts-CSH5sk8U.js} +9 -11
- package/dist/api.js +4 -3
- package/dist/{card-command-DQ-epsgt.js → card-command-BEMIm8D8.js} +1 -1
- package/dist/{channel-uT5RTtpi.js → channel-CTaWrzfl.js} +15 -11
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel.runtime-D4Paci2y.js +4 -0
- package/dist/contract-api.js +1 -1
- package/dist/{flex-templates-K1lS9i8L.js → flex-templates-DVy_wog4.js} +318 -107
- package/dist/index.js +1 -1
- package/dist/{markdown-to-line-D1vapcdP.js → markdown-to-line-Dn00k1bq.js} +239 -229
- package/dist/{monitor-Bk-lpoOZ.js → monitor-DzFU5UPV.js} +317 -323
- package/dist/monitor.runtime-B8xjVqev.js +2 -0
- package/dist/outbound.runtime-eHl7NNHu.js +2 -0
- package/dist/{probe-BslD77tJ.js → probe-CM03wo6r.js} +7 -9
- package/dist/probe.runtime-D13ZtXsd.js +2 -0
- package/dist/quick-reply-fallback-D86FwAfr.js +56 -0
- package/dist/{reply-payload-transform-r9sa-TYT.js → reply-payload-transform-BRM2fRvK.js} +3 -164
- package/dist/runtime-api.js +9 -8
- package/dist/send-receipt-CY2ey8XH.js +107 -0
- package/dist/setup-api.js +1 -1
- package/dist/{setup-surface-BEt4mazl.js → setup-surface-BHQOSD8R.js} +107 -67
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupCreateRoute.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupFailedType.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupJobFailedType.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupJobStatus.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupStatus.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexBoxBorderWidth.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexBoxCornerRadius.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexBubble.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexIconSize.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexSpanSize.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexTextFontSize.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/numberOfMessagesResponse.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/postbackAction.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/subscriptionPeriodDemographic.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/version.d.ts +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/version.js +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/event.d.ts +2 -1
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/event.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/messageEditedEvent.d.ts +24 -0
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/messageEditedEvent.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/messageEditedEvent.js +14 -0
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/messageEditedEvent.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/models.d.ts +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/models.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/models.js +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/models.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/model/audienceGroupCreateRoute.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/model/audienceGroupFailedType.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/model/audienceGroupJobFailedType.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/model/audienceGroupJobStatus.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/model/audienceGroupStatus.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexBoxBorderWidth.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexBoxCornerRadius.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexBubble.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexIconSize.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexSpanSize.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexTextFontSize.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/numberOfMessagesResponse.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/postbackAction.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/subscriptionPeriodDemographic.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/version.d.ts +1 -1
- package/node_modules/@line/bot-sdk/dist/version.js +1 -1
- package/node_modules/@line/bot-sdk/dist/webhook/model/event.d.ts +2 -1
- package/node_modules/@line/bot-sdk/dist/webhook/model/event.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/webhook/model/messageEditedEvent.d.ts +24 -0
- package/node_modules/@line/bot-sdk/dist/webhook/model/messageEditedEvent.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/webhook/model/messageEditedEvent.js +13 -0
- package/node_modules/@line/bot-sdk/dist/webhook/model/messageEditedEvent.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/webhook/model/models.d.ts +1 -0
- package/node_modules/@line/bot-sdk/dist/webhook/model/models.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/webhook/model/models.js +1 -0
- package/node_modules/@line/bot-sdk/dist/webhook/model/models.js.map +1 -1
- package/node_modules/@line/bot-sdk/lib/insight/model/getNumberOfFollowersResponse.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/liff/model/liffScope.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/manage-audience/model/audienceGroupCreateRoute.ts +1 -4
- package/node_modules/@line/bot-sdk/lib/manage-audience/model/audienceGroupFailedType.ts +1 -2
- package/node_modules/@line/bot-sdk/lib/manage-audience/model/audienceGroupJobFailedType.ts +1 -2
- package/node_modules/@line/bot-sdk/lib/manage-audience/model/audienceGroupJobStatus.ts +1 -4
- package/node_modules/@line/bot-sdk/lib/manage-audience/model/audienceGroupStatus.ts +1 -6
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/botInfoResponse.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexBoxBorderWidth.ts +1 -6
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexBoxCornerRadius.ts +1 -7
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexBubble.ts +1 -7
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexIconSize.ts +1 -10
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexSpanSize.ts +1 -10
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexTextFontSize.ts +1 -10
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/getAggregationUnitNameListResponse.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/getFollowersResponse.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/getJoinedMembershipUsersResponse.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/issueLinkTokenResponse.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/numberOfMessagesResponse.ts +2 -5
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/postbackAction.ts +1 -4
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/subscriptionPeriodDemographic.ts +1 -5
- package/node_modules/@line/bot-sdk/lib/version.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/webhook/.openapi-generator/FILES +1 -0
- package/node_modules/@line/bot-sdk/lib/webhook/model/event.ts +2 -0
- package/node_modules/@line/bot-sdk/lib/webhook/model/messageEditedEvent.ts +32 -0
- package/node_modules/@line/bot-sdk/lib/webhook/model/models.ts +1 -0
- package/node_modules/@line/bot-sdk/lib/webhook/model/stickerMessageContent.ts +1 -1
- package/node_modules/@line/bot-sdk/package.json +3 -3
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/fs/promises.d.ts +16 -5
- package/node_modules/@types/node/package.json +3 -3
- package/openclaw.plugin.json +0 -18
- package/package.json +71 -7
- package/dist/channel.runtime-BqNglqnr.js +0 -4
- package/dist/monitor.runtime-CHlqxGVL.js +0 -2
- package/dist/outbound.runtime-ByZ0Dsvu.js +0 -2
- package/dist/probe.runtime-CRhVGqwl.js +0 -2
- package/npm-shrinkwrap.json +0 -60
|
@@ -0,0 +1,2 @@
|
|
|
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-Dn00k1bq.js";
|
|
2
|
+
export { buildTemplateMessageFromPayload, createQuickReplyItems, processLineMessage, pushFlexMessage, pushLocationMessage, pushMessageLine, pushMessagesLine, pushTemplateMessage, pushTextMessageWithQuickReplies, sendMessageLine };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { runChannelProbe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
2
2
|
import { messagingApi } from "@line/bot-sdk";
|
|
3
3
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
4
4
|
//#region extensions/line/src/probe.ts
|
|
@@ -8,8 +8,8 @@ async function probeLineBot(channelAccessToken, timeoutMs = 5e3) {
|
|
|
8
8
|
error: "Channel access token not configured"
|
|
9
9
|
};
|
|
10
10
|
const client = new messagingApi.MessagingApiClient({ channelAccessToken: channelAccessToken.trim() });
|
|
11
|
-
|
|
12
|
-
const profile = await
|
|
11
|
+
return await runChannelProbe(timeoutMs, async () => {
|
|
12
|
+
const profile = await client.getBotInfo();
|
|
13
13
|
return {
|
|
14
14
|
ok: true,
|
|
15
15
|
bot: {
|
|
@@ -19,12 +19,10 @@ async function probeLineBot(channelAccessToken, timeoutMs = 5e3) {
|
|
|
19
19
|
pictureUrl: profile.pictureUrl
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
}
|
|
22
|
+
}, (error) => ({
|
|
23
|
+
ok: false,
|
|
24
|
+
error: formatErrorMessage(error)
|
|
25
|
+
}));
|
|
28
26
|
}
|
|
29
27
|
//#endregion
|
|
30
28
|
export { probeLineBot as t };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
2
|
+
import { resolveAccountEntry } from "openclaw/plugin-sdk/account-resolution";
|
|
3
|
+
import { normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
+
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
5
|
+
//#region extensions/line/src/group-keys.ts
|
|
6
|
+
function resolveLineGroupLookupIds(groupId) {
|
|
7
|
+
const normalized = groupId?.trim();
|
|
8
|
+
if (!normalized) return [];
|
|
9
|
+
if (normalized.startsWith("group:") || normalized.startsWith("room:")) {
|
|
10
|
+
const rawId = normalized.split(":").slice(1).join(":");
|
|
11
|
+
return rawId ? [rawId, normalized] : [normalized];
|
|
12
|
+
}
|
|
13
|
+
return [
|
|
14
|
+
normalized,
|
|
15
|
+
`group:${normalized}`,
|
|
16
|
+
`room:${normalized}`
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
function resolveLineGroupConfigEntry(groups, params) {
|
|
20
|
+
if (!groups) return;
|
|
21
|
+
for (const candidate of resolveLineGroupLookupIds(params.groupId)) {
|
|
22
|
+
const hit = groups[candidate];
|
|
23
|
+
if (hit) return hit;
|
|
24
|
+
}
|
|
25
|
+
for (const candidate of resolveLineGroupLookupIds(params.roomId)) {
|
|
26
|
+
const hit = groups[candidate];
|
|
27
|
+
if (hit) return hit;
|
|
28
|
+
}
|
|
29
|
+
return groups["*"];
|
|
30
|
+
}
|
|
31
|
+
function resolveLineGroupsConfig(cfg, accountId) {
|
|
32
|
+
const lineConfig = cfg.channels?.line;
|
|
33
|
+
if (!lineConfig) return;
|
|
34
|
+
const normalizedAccountId = normalizeAccountId(accountId);
|
|
35
|
+
return resolveAccountEntry(lineConfig.accounts, normalizedAccountId)?.groups ?? lineConfig.groups;
|
|
36
|
+
}
|
|
37
|
+
function resolveExactLineGroupConfigKey(params) {
|
|
38
|
+
const { groups } = params;
|
|
39
|
+
if (!groups) return;
|
|
40
|
+
return resolveLineGroupLookupIds(params.groupId).find((candidate) => Object.hasOwn(groups, candidate));
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region extensions/line/src/runtime.ts
|
|
44
|
+
const { setRuntime: setLineRuntime, getRuntime: getLineRuntime } = createPluginRuntimeStore({
|
|
45
|
+
pluginId: "line",
|
|
46
|
+
errorMessage: "LINE runtime not initialized - plugin not registered"
|
|
47
|
+
});
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region extensions/line/src/quick-reply-fallback.ts
|
|
50
|
+
function buildLineQuickReplyFallbackText(labels) {
|
|
51
|
+
const normalized = normalizeStringEntries(labels ?? []).slice(0, 13);
|
|
52
|
+
if (normalized.length === 0) return "Choose an option.";
|
|
53
|
+
return `Options:\n${normalized.map((label) => `- ${label}`).join("\n")}`;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { resolveLineGroupConfigEntry as a, resolveExactLineGroupConfigKey as i, getLineRuntime as n, resolveLineGroupLookupIds as o, setLineRuntime as r, resolveLineGroupsConfig as s, buildLineQuickReplyFallbackText as t };
|
|
@@ -1,62 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
3
|
-
import { resolveAccountEntry } from "openclaw/plugin-sdk/account-resolution";
|
|
1
|
+
import { a as createEventCard, i as createAgendaCard, n as createDeviceControlCard, r as createMediaPlayerCard, t as createAppleTvRemoteCard } from "./flex-templates-DVy_wog4.js";
|
|
4
2
|
import { normalizeLowercaseStringOrEmpty, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
3
|
import { DmPolicySchema, GroupPolicySchema, buildChannelConfigSchema, buildGroupEntrySchema, buildMultiAccountChannelSchema, requireOpenAllowFrom } from "openclaw/plugin-sdk/channel-config-schema";
|
|
6
4
|
import { requireChannelOpenAllowFrom } from "openclaw/plugin-sdk/extension-shared";
|
|
7
5
|
import { z } from "zod";
|
|
8
|
-
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
9
|
-
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
10
|
-
import { resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
11
6
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
12
7
|
import { parseStrictFiniteNumber } from "openclaw/plugin-sdk/number-runtime";
|
|
13
|
-
//#region extensions/line/src/group-keys.ts
|
|
14
|
-
function resolveLineGroupLookupIds(groupId) {
|
|
15
|
-
const normalized = groupId?.trim();
|
|
16
|
-
if (!normalized) return [];
|
|
17
|
-
if (normalized.startsWith("group:") || normalized.startsWith("room:")) {
|
|
18
|
-
const rawId = normalized.split(":").slice(1).join(":");
|
|
19
|
-
return rawId ? [rawId, normalized] : [normalized];
|
|
20
|
-
}
|
|
21
|
-
return [
|
|
22
|
-
normalized,
|
|
23
|
-
`group:${normalized}`,
|
|
24
|
-
`room:${normalized}`
|
|
25
|
-
];
|
|
26
|
-
}
|
|
27
|
-
function resolveLineGroupConfigEntry(groups, params) {
|
|
28
|
-
if (!groups) return;
|
|
29
|
-
for (const candidate of resolveLineGroupLookupIds(params.groupId)) {
|
|
30
|
-
const hit = groups[candidate];
|
|
31
|
-
if (hit) return hit;
|
|
32
|
-
}
|
|
33
|
-
for (const candidate of resolveLineGroupLookupIds(params.roomId)) {
|
|
34
|
-
const hit = groups[candidate];
|
|
35
|
-
if (hit) return hit;
|
|
36
|
-
}
|
|
37
|
-
return groups["*"];
|
|
38
|
-
}
|
|
39
|
-
function resolveLineGroupsConfig(cfg, accountId) {
|
|
40
|
-
const lineConfig = cfg.channels?.line;
|
|
41
|
-
if (!lineConfig) return;
|
|
42
|
-
const normalizedAccountId = normalizeAccountId(accountId);
|
|
43
|
-
return resolveAccountEntry(lineConfig.accounts, normalizedAccountId)?.groups ?? lineConfig.groups;
|
|
44
|
-
}
|
|
45
|
-
function resolveExactLineGroupConfigKey(params) {
|
|
46
|
-
const { groups } = params;
|
|
47
|
-
if (!groups) return;
|
|
48
|
-
return resolveLineGroupLookupIds(params.groupId).find((candidate) => Object.hasOwn(groups, candidate));
|
|
49
|
-
}
|
|
50
|
-
//#endregion
|
|
51
8
|
//#region extensions/line/src/config-schema.ts
|
|
52
9
|
const ThreadBindingsSchema = z.object({
|
|
53
10
|
enabled: z.boolean().optional(),
|
|
54
11
|
idleHours: z.number().optional(),
|
|
55
12
|
maxAgeHours: z.number().optional(),
|
|
56
13
|
spawnSessions: z.boolean().optional(),
|
|
57
|
-
defaultSpawnContext: z.enum(["isolated", "fork"]).optional()
|
|
58
|
-
spawnSubagentSessions: z.boolean().optional(),
|
|
59
|
-
spawnAcpSessions: z.boolean().optional()
|
|
14
|
+
defaultSpawnContext: z.enum(["isolated", "fork"]).optional()
|
|
60
15
|
}).strict();
|
|
61
16
|
const LineCommonConfigSchemaBase = z.object({
|
|
62
17
|
enabled: z.boolean().optional(),
|
|
@@ -92,122 +47,6 @@ const LineConfigSchema = buildMultiAccountChannelSchema(LineCommonConfigSchemaBa
|
|
|
92
47
|
});
|
|
93
48
|
const LineChannelConfigSchema = buildChannelConfigSchema(LineConfigSchema);
|
|
94
49
|
//#endregion
|
|
95
|
-
//#region extensions/line/src/runtime.ts
|
|
96
|
-
const { setRuntime: setLineRuntime, getRuntime: getLineRuntime } = createPluginRuntimeStore({
|
|
97
|
-
pluginId: "line",
|
|
98
|
-
errorMessage: "LINE runtime not initialized - plugin not registered"
|
|
99
|
-
});
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region extensions/line/src/outbound-media.ts
|
|
102
|
-
const LINE_OUTBOUND_MEDIA_SSRF_POLICY = { allowPrivateNetwork: false };
|
|
103
|
-
async function validateLineMediaUrl(url) {
|
|
104
|
-
let parsed;
|
|
105
|
-
try {
|
|
106
|
-
parsed = new URL(url);
|
|
107
|
-
} catch {
|
|
108
|
-
throw new Error("LINE outbound media URL must be a valid URL");
|
|
109
|
-
}
|
|
110
|
-
if (parsed.protocol !== "https:") throw new Error("LINE outbound media URL must use HTTPS");
|
|
111
|
-
if (url.length > 2e3) throw new Error(`LINE outbound media URL must be 2000 chars or less (got ${url.length})`);
|
|
112
|
-
await resolvePinnedHostnameWithPolicy(parsed.hostname, { policy: LINE_OUTBOUND_MEDIA_SSRF_POLICY });
|
|
113
|
-
}
|
|
114
|
-
function isHttpsUrl(url) {
|
|
115
|
-
try {
|
|
116
|
-
return new URL(url).protocol === "https:";
|
|
117
|
-
} catch {
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
function detectLineMediaKindFromUrl(url) {
|
|
122
|
-
try {
|
|
123
|
-
const pathname = normalizeLowercaseStringOrEmpty(new URL(url).pathname);
|
|
124
|
-
if (/\.(png|jpe?g|gif|webp|bmp|heic|heif|avif)$/i.test(pathname)) return "image";
|
|
125
|
-
if (/\.(mp4|mov|m4v|webm)$/i.test(pathname)) return "video";
|
|
126
|
-
if (/\.(mp3|m4a|aac|wav|ogg|oga)$/i.test(pathname)) return "audio";
|
|
127
|
-
} catch {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
async function resolveLineOutboundMedia(mediaUrl, opts = {}) {
|
|
132
|
-
const trimmedUrl = mediaUrl.trim();
|
|
133
|
-
if (isHttpsUrl(trimmedUrl)) {
|
|
134
|
-
await validateLineMediaUrl(trimmedUrl);
|
|
135
|
-
const previewImageUrl = opts.previewImageUrl?.trim();
|
|
136
|
-
if (previewImageUrl) await validateLineMediaUrl(previewImageUrl);
|
|
137
|
-
return {
|
|
138
|
-
mediaUrl: trimmedUrl,
|
|
139
|
-
mediaKind: opts.mediaKind ?? (typeof opts.durationMs === "number" ? "audio" : void 0) ?? (opts.trackingId?.trim() ? "video" : void 0) ?? detectLineMediaKindFromUrl(trimmedUrl) ?? "image",
|
|
140
|
-
...previewImageUrl ? { previewImageUrl } : {},
|
|
141
|
-
...typeof opts.durationMs === "number" ? { durationMs: opts.durationMs } : {},
|
|
142
|
-
...opts.trackingId ? { trackingId: opts.trackingId } : {}
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
let parsed;
|
|
146
|
-
try {
|
|
147
|
-
parsed = new URL(trimmedUrl);
|
|
148
|
-
} catch {}
|
|
149
|
-
if (parsed) throw new Error("LINE outbound media URL must use HTTPS");
|
|
150
|
-
throw new Error("LINE outbound media currently requires a public HTTPS URL");
|
|
151
|
-
}
|
|
152
|
-
function isLineUserTarget(target) {
|
|
153
|
-
const normalized = target.trim().replace(/^line:(group|room|user):/i, "").replace(/^line:/i, "");
|
|
154
|
-
return /^U/i.test(normalized);
|
|
155
|
-
}
|
|
156
|
-
function hasLineSpecificMediaOptions(lineData) {
|
|
157
|
-
return lineData.mediaKind !== void 0 || Boolean(lineData.previewImageUrl?.trim()) || typeof lineData.durationMs === "number" || Boolean(lineData.trackingId?.trim());
|
|
158
|
-
}
|
|
159
|
-
function buildLineMediaMessageObject(resolved, opts) {
|
|
160
|
-
switch (resolved.mediaKind) {
|
|
161
|
-
case "video": {
|
|
162
|
-
const previewImageUrl = resolved.previewImageUrl?.trim();
|
|
163
|
-
if (!previewImageUrl) throw new Error("LINE video messages require previewImageUrl to reference an image URL");
|
|
164
|
-
return {
|
|
165
|
-
type: "video",
|
|
166
|
-
originalContentUrl: resolved.mediaUrl,
|
|
167
|
-
previewImageUrl,
|
|
168
|
-
...opts?.allowTrackingId && resolved.trackingId ? { trackingId: resolved.trackingId } : {}
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
case "audio": return {
|
|
172
|
-
type: "audio",
|
|
173
|
-
originalContentUrl: resolved.mediaUrl,
|
|
174
|
-
duration: resolved.durationMs ?? 6e4
|
|
175
|
-
};
|
|
176
|
-
default: return {
|
|
177
|
-
type: "image",
|
|
178
|
-
originalContentUrl: resolved.mediaUrl,
|
|
179
|
-
previewImageUrl: resolved.previewImageUrl ?? resolved.mediaUrl
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
async function buildLineMediaMessage(mediaUrl, opts, target) {
|
|
184
|
-
return buildLineMediaMessageObject(await resolveLineOutboundMedia(mediaUrl, opts), { allowTrackingId: isLineUserTarget(target) });
|
|
185
|
-
}
|
|
186
|
-
//#endregion
|
|
187
|
-
//#region extensions/line/src/quick-reply-fallback.ts
|
|
188
|
-
function buildLineQuickReplyFallbackText(labels) {
|
|
189
|
-
const normalized = normalizeStringEntries(labels ?? []).slice(0, 13);
|
|
190
|
-
if (normalized.length === 0) return "Choose an option.";
|
|
191
|
-
return `Options:\n${normalized.map((label) => `- ${label}`).join("\n")}`;
|
|
192
|
-
}
|
|
193
|
-
//#endregion
|
|
194
|
-
//#region extensions/line/src/send-receipt.ts
|
|
195
|
-
function createLineSendReceipt(params) {
|
|
196
|
-
const messageId = params.messageId.trim();
|
|
197
|
-
const chatId = params.chatId.trim();
|
|
198
|
-
return createMessageReceiptFromOutboundResults({
|
|
199
|
-
results: messageId ? [{
|
|
200
|
-
channel: "line",
|
|
201
|
-
messageId,
|
|
202
|
-
chatId,
|
|
203
|
-
conversationId: chatId,
|
|
204
|
-
meta: { messageCount: params.messageCount ?? 1 }
|
|
205
|
-
}] : [],
|
|
206
|
-
...chatId ? { threadId: chatId } : {},
|
|
207
|
-
kind: params.kind ?? "unknown"
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
//#endregion
|
|
211
50
|
//#region extensions/line/src/reply-payload-transform.ts
|
|
212
51
|
/**
|
|
213
52
|
* Parse LINE-specific directives from text and extract them into ReplyPayload fields.
|
|
@@ -492,4 +331,4 @@ function hasLineDirectives(text) {
|
|
|
492
331
|
return /\[\[(quick_replies|location|confirm|buttons|media_player|event|agenda|device|appletv_remote):/i.test(text);
|
|
493
332
|
}
|
|
494
333
|
//#endregion
|
|
495
|
-
export {
|
|
334
|
+
export { LineConfigSchema as i, parseLineDirectives as n, LineChannelConfigSchema as r, hasLineDirectives as t };
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { i as resolveLineAccount, n as normalizeAccountId, r as resolveDefaultLineAccountId, t as listLineAccountIds } from "./accounts-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import { t as
|
|
6
|
-
import {
|
|
1
|
+
import { i as resolveLineAccount, n as normalizeAccountId, r as resolveDefaultLineAccountId, t as listLineAccountIds } from "./accounts-CSH5sk8U.js";
|
|
2
|
+
import { a as resolveLineGroupConfigEntry, i as resolveExactLineGroupConfigKey, o as resolveLineGroupLookupIds, r as setLineRuntime, s as resolveLineGroupsConfig } from "./quick-reply-fallback-D86FwAfr.js";
|
|
3
|
+
import { i as LineConfigSchema, n as parseLineDirectives, r as LineChannelConfigSchema, t as hasLineDirectives } from "./reply-payload-transform-BRM2fRvK.js";
|
|
4
|
+
import { _ as postbackAction, a as createEventCard, c as createCarousel, d as createListCard, f as createNotificationBubble, i as createAgendaCard, l as createImageCard, m as messageAction, n as createDeviceControlCard, o as createReceiptCard, p as datetimePickerAction, r as createMediaPlayerCard, s as createActionCard, t as createAppleTvRemoteCard, u as createInfoCard, v as uriAction } from "./flex-templates-DVy_wog4.js";
|
|
5
|
+
import { A as createConfirmTemplate, C as sendMessageLine, D as createButtonMenu, E as buildTemplateMessageFromPayload, F as createTemplateCarousel, I as createYesNoConfirm, L as toFlexMessage, M as createImageCarouselColumn, N as createLinkMenu, O as createButtonTemplate, P as createProductCarousel, S as replyMessageLine, T as resolveLineChannelAccessToken, _ as pushLocationMessage, a as stripMarkdown, b as pushTemplateMessage, c as createImageMessage, d as createTextMessageWithQuickReplies, f as createVideoMessage, g as pushImageMessage, h as pushFlexMessage, i as processLineMessage, j as createImageCarousel, k as createCarouselColumn, l as createLocationMessage, m as getUserProfile, n as convertTableToFlexBubble, o as createAudioMessage, p as getUserDisplayName, r as hasMarkdownToConvert, s as createFlexMessage, t as convertCodeBlockToFlexBubble, u as createQuickReplyItems, v as pushMessageLine, w as showLoadingAnimation, x as pushTextMessageWithQuickReplies, y as pushMessagesLine } from "./markdown-to-line-Dn00k1bq.js";
|
|
6
|
+
import { a as validateLineSignature, c as normalizeAllowFrom, i as parseLineWebhookBody, n as createLineNodeWebhookHandler, o as downloadLineMedia, r as readLineWebhookRequestBody, s as firstDefined, t as monitorLineProvider } from "./monitor-DzFU5UPV.js";
|
|
7
|
+
import { t as probeLineBot } from "./probe-CM03wo6r.js";
|
|
7
8
|
import { clearAccountEntryFields } from "openclaw/plugin-sdk/core";
|
|
8
9
|
import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
|
|
9
10
|
import { DEFAULT_ACCOUNT_ID, formatDocsLink, setSetupChannelEnabled, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
10
11
|
import { buildComputedAccountStatusSnapshot, buildTokenChannelStatusSummary } from "openclaw/plugin-sdk/status-helpers";
|
|
11
12
|
import { danger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
12
13
|
import { messagingApi } from "@line/bot-sdk";
|
|
13
|
-
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/
|
|
14
|
+
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-local-roots";
|
|
14
15
|
import { mimeTypeFromFilePath } from "openclaw/plugin-sdk/media-mime";
|
|
15
16
|
import { loadWebMediaRaw } from "openclaw/plugin-sdk/web-media";
|
|
16
17
|
//#region extensions/line/src/webhook.ts
|
|
@@ -256,4 +257,4 @@ function createDefaultMenuConfig() {
|
|
|
256
257
|
};
|
|
257
258
|
}
|
|
258
259
|
//#endregion
|
|
259
|
-
export { DEFAULT_ACCOUNT_ID, LineChannelConfigSchema, LineConfigSchema, buildChannelConfigSchema, buildComputedAccountStatusSnapshot, buildTemplateMessageFromPayload, buildTokenChannelStatusSummary, cancelDefaultRichMenu, clearAccountEntryFields, convertCodeBlockToFlexBubble,
|
|
260
|
+
export { DEFAULT_ACCOUNT_ID, LineChannelConfigSchema, LineConfigSchema, buildChannelConfigSchema, buildComputedAccountStatusSnapshot, buildTemplateMessageFromPayload, buildTokenChannelStatusSummary, cancelDefaultRichMenu, clearAccountEntryFields, convertCodeBlockToFlexBubble, convertTableToFlexBubble, createActionCard, createAgendaCard, createAppleTvRemoteCard, createAudioMessage, createButtonMenu, createButtonTemplate, createCarousel, createCarouselColumn, createConfirmTemplate, createDefaultMenuConfig, createDeviceControlCard, createEventCard, createFlexMessage, createGridLayout, createImageCard, createImageCarousel, createImageCarouselColumn, createImageMessage, createInfoCard, createLineNodeWebhookHandler, createLineWebhookMiddleware, createLinkMenu, createListCard, createLocationMessage, createMediaPlayerCard, createNotificationBubble, createProductCarousel, createQuickReplyItems, createReceiptCard, createRichMenu, createRichMenuAlias, createTemplateCarousel, createTextMessageWithQuickReplies, createVideoMessage, createYesNoConfirm, datetimePickerAction, deleteRichMenu, deleteRichMenuAlias, downloadLineMedia, firstDefined, formatDocsLink, getDefaultRichMenuId, getRichMenu, getRichMenuIdOfUser, getRichMenuList, getUserDisplayName, getUserProfile, hasLineDirectives, hasMarkdownToConvert, listLineAccountIds, messageAction, monitorLineProvider, normalizeAccountId, normalizeAllowFrom, parseLineDirectives, parseLineWebhookBody, postbackAction, probeLineBot, processLineMessage, pushFlexMessage, pushImageMessage, pushLocationMessage, pushMessageLine, pushMessagesLine, pushTemplateMessage, pushTextMessageWithQuickReplies, readLineWebhookRequestBody, replyMessageLine, resolveDefaultLineAccountId, resolveExactLineGroupConfigKey, resolveLineAccount, resolveLineChannelAccessToken, resolveLineGroupConfigEntry, resolveLineGroupLookupIds, resolveLineGroupsConfig, sendMessageLine, setDefaultRichMenu, setLineRuntime, setSetupChannelEnabled, showLoadingAnimation, splitSetupEntries, startLineWebhook, stripMarkdown, toFlexMessage, uploadRichMenuImage, uriAction, validateLineSignature };
|
|
@@ -0,0 +1,107 @@
|
|
|
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 };
|
package/dist/setup-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as lineSetupAdapter, t as lineSetupWizard } from "./setup-surface-
|
|
1
|
+
import { n as lineSetupAdapter, t as lineSetupWizard } from "./setup-surface-BHQOSD8R.js";
|
|
2
2
|
export { lineSetupAdapter, lineSetupWizard };
|