@openclaw/zalo 2026.5.7 → 2026.5.9-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.
- package/dist/{actions.runtime-kJ65ZxW7.js → actions.runtime-BQ5w5Doy.js} +1 -1
- package/dist/api.js +1 -1
- package/dist/{channel-VPbtV3Oq.js → channel-Dv3a8qOv.js} +28 -3
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-BnTAWQx5.js → channel.runtime-DmdT2jqb.js} +4 -4
- package/dist/{monitor-DMysJBWa.js → monitor-HPIkfv6L.js} +55 -39
- package/dist/{monitor.webhook-DqnuvgjV.js → monitor.webhook-0sObsTVp.js} +2 -2
- package/dist/{proxy-CY8VuC6H.js → proxy-D5AGEsI0.js} +2 -6
- package/dist/{runtime-api-MOTmRW4F.js → runtime-api-CMlbWaSj.js} +2 -2
- package/dist/runtime-api.js +2 -2
- package/dist/{send-Gv3l5EGI.js → send-znUV-Z2f.js} +52 -12
- package/package.json +4 -7
package/dist/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as zaloPlugin } from "./channel-
|
|
1
|
+
import { t as zaloPlugin } from "./channel-Dv3a8qOv.js";
|
|
2
2
|
import { n as zaloDmPolicy, r as zaloSetupAdapter, t as createZaloSetupWizardProxy } from "./setup-core-DigRD3j1.js";
|
|
3
3
|
import { r as resolveZaloRuntimeGroupPolicy, t as evaluateZaloGroupAccess } from "./group-access-DZR43lOR.js";
|
|
4
4
|
import { zaloSetupWizard } from "./setup-api.js";
|
|
@@ -6,6 +6,7 @@ import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
|
6
6
|
import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
|
|
7
7
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter, createScopedDmSecurityResolver, mapAllowFromEntries } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
8
8
|
import { buildChannelConfigSchema, createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
9
|
+
import { defineChannelMessageAdapter } from "openclaw/plugin-sdk/channel-message";
|
|
9
10
|
import { buildOpenGroupPolicyRestrictSendersWarning, buildOpenGroupPolicyWarning, createOpenProviderGroupPolicyWarningCollector } from "openclaw/plugin-sdk/channel-policy";
|
|
10
11
|
import { createEmptyChannelResult, createRawChannelSendResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
|
|
11
12
|
import { buildTokenChannelStatusSummary } from "openclaw/plugin-sdk/channel-status";
|
|
@@ -24,7 +25,7 @@ import { AllowFromListSchema, DmPolicySchema, GroupPolicySchema, MarkdownConfigS
|
|
|
24
25
|
import { z } from "openclaw/plugin-sdk/zod";
|
|
25
26
|
import { coerceStatusIssueAccountId, readStatusIssueFields } from "openclaw/plugin-sdk/extension-shared";
|
|
26
27
|
//#region extensions/zalo/src/actions.ts
|
|
27
|
-
const loadZaloActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-
|
|
28
|
+
const loadZaloActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-BQ5w5Doy.js"), "zaloActionsRuntime");
|
|
28
29
|
const providerId = "zalo";
|
|
29
30
|
function listEnabledAccounts(cfg, accountId) {
|
|
30
31
|
return (accountId ? [resolveZaloAccount({
|
|
@@ -173,7 +174,7 @@ function normalizeZaloMessagingTarget(raw) {
|
|
|
173
174
|
if (!trimmed) return;
|
|
174
175
|
return trimmed.replace(/^(zalo|zl):/i, "").trim();
|
|
175
176
|
}
|
|
176
|
-
const loadZaloChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-
|
|
177
|
+
const loadZaloChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-DmdT2jqb.js"));
|
|
177
178
|
const zaloSetupWizard = createZaloSetupWizardProxy(async () => (await import("./setup-surface-2Up3yWov.js")).zaloSetupWizard);
|
|
178
179
|
const zaloTextChunkLimit = 2e3;
|
|
179
180
|
const zaloRawSendResultAdapter = createRawChannelSendResultAdapter({
|
|
@@ -192,6 +193,29 @@ const zaloRawSendResultAdapter = createRawChannelSendResultAdapter({
|
|
|
192
193
|
cfg
|
|
193
194
|
})
|
|
194
195
|
});
|
|
196
|
+
const zaloMessageAdapter = defineChannelMessageAdapter({
|
|
197
|
+
id: "zalo",
|
|
198
|
+
durableFinal: { capabilities: {
|
|
199
|
+
text: true,
|
|
200
|
+
media: true,
|
|
201
|
+
messageSendingHooks: true
|
|
202
|
+
} },
|
|
203
|
+
send: {
|
|
204
|
+
text: async ({ to, text, accountId, cfg }) => await (await loadZaloChannelRuntime()).sendZaloText({
|
|
205
|
+
to,
|
|
206
|
+
text,
|
|
207
|
+
accountId: accountId ?? void 0,
|
|
208
|
+
cfg
|
|
209
|
+
}),
|
|
210
|
+
media: async ({ to, text, mediaUrl, accountId, cfg }) => await (await loadZaloChannelRuntime()).sendZaloText({
|
|
211
|
+
to,
|
|
212
|
+
text,
|
|
213
|
+
accountId: accountId ?? void 0,
|
|
214
|
+
mediaUrl,
|
|
215
|
+
cfg
|
|
216
|
+
})
|
|
217
|
+
}
|
|
218
|
+
});
|
|
195
219
|
const zaloConfigAdapter = createScopedChannelConfigAdapter({
|
|
196
220
|
sectionKey: "zalo",
|
|
197
221
|
listAccountIds: listZaloAccountIds,
|
|
@@ -310,7 +334,8 @@ const zaloPlugin = createChatChannelPlugin({
|
|
|
310
334
|
};
|
|
311
335
|
}
|
|
312
336
|
}),
|
|
313
|
-
gateway: { startAccount: async (ctx) => await (await loadZaloChannelRuntime()).startZaloGatewayAccount(ctx) }
|
|
337
|
+
gateway: { startAccount: async (ctx) => await (await loadZaloChannelRuntime()).startZaloGatewayAccount(ctx) },
|
|
338
|
+
message: zaloMessageAdapter
|
|
314
339
|
},
|
|
315
340
|
security: {
|
|
316
341
|
resolveDmPolicy: resolveZaloDmPolicy,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as zaloPlugin } from "./channel-
|
|
1
|
+
import { t as zaloPlugin } from "./channel-Dv3a8qOv.js";
|
|
2
2
|
export { zaloPlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as normalizeSecretInputString } from "./accounts-9NLDDlZ8.js";
|
|
2
|
-
import { n as PAIRING_APPROVED_MESSAGE } from "./runtime-api-
|
|
3
|
-
import { i as getMe, n as ZaloApiError, t as resolveZaloProxyFetch } from "./proxy-
|
|
4
|
-
import { t as sendMessageZalo } from "./send-
|
|
2
|
+
import { n as PAIRING_APPROVED_MESSAGE } from "./runtime-api-CMlbWaSj.js";
|
|
3
|
+
import { i as getMe, n as ZaloApiError, t as resolveZaloProxyFetch } from "./proxy-D5AGEsI0.js";
|
|
4
|
+
import { t as sendMessageZalo } from "./send-znUV-Z2f.js";
|
|
5
5
|
import { createAccountStatusSink } from "openclaw/plugin-sdk/channel-lifecycle";
|
|
6
6
|
//#region extensions/zalo/src/probe.ts
|
|
7
7
|
async function probeZalo(token, timeoutMs = 5e3, fetcher) {
|
|
@@ -87,7 +87,7 @@ async function startZaloGatewayAccount(ctx) {
|
|
|
87
87
|
setStatus: ctx.setStatus
|
|
88
88
|
});
|
|
89
89
|
ctx.log?.info(`[${account.accountId}] starting provider${zaloBotLabel} mode=${mode}`);
|
|
90
|
-
const { monitorZaloProvider } = await import("./monitor-
|
|
90
|
+
const { monitorZaloProvider } = await import("./monitor-HPIkfv6L.js");
|
|
91
91
|
return monitorZaloProvider({
|
|
92
92
|
token,
|
|
93
93
|
account,
|
|
@@ -1,20 +1,35 @@
|
|
|
1
1
|
import { n as isZaloSenderAllowed, t as evaluateZaloGroupAccess } from "./group-access-DZR43lOR.js";
|
|
2
2
|
import { t as getZaloRuntime } from "./runtime-BRFxnYQx.js";
|
|
3
|
-
import { a as getUpdates, c as sendMessage, l as sendPhoto, n as ZaloApiError, o as getWebhookInfo, r as deleteWebhook, s as sendChatAction, t as resolveZaloProxyFetch, u as setWebhook } from "./proxy-
|
|
3
|
+
import { a as getUpdates, c as sendMessage, l as sendPhoto, n as ZaloApiError, o as getWebhookInfo, r as deleteWebhook, s as sendChatAction, t as resolveZaloProxyFetch, u as setWebhook } from "./proxy-D5AGEsI0.js";
|
|
4
4
|
import { deliverTextOrMediaReply, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
5
5
|
import { resolveDefaultGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
6
6
|
import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
|
|
7
|
-
import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline";
|
|
8
7
|
import { logTypingFailure } from "openclaw/plugin-sdk/channel-feedback";
|
|
9
8
|
import { resolveDirectDmAuthorizationOutcome, resolveSenderCommandAuthorizationWithRuntime } from "openclaw/plugin-sdk/command-auth";
|
|
10
9
|
import { resolveInboundRouteEnvelopeBuilderWithRuntime } from "openclaw/plugin-sdk/inbound-envelope";
|
|
11
10
|
import { registerPluginHttpRoute, resolveWebhookPath } from "openclaw/plugin-sdk/webhook-ingress";
|
|
12
11
|
import { waitForAbortSignal } from "openclaw/plugin-sdk/runtime-env";
|
|
13
12
|
import { randomBytes } from "node:crypto";
|
|
14
|
-
import {
|
|
13
|
+
import { readFile, readdir, stat, unlink } from "node:fs/promises";
|
|
15
14
|
import { join } from "node:path";
|
|
16
15
|
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
|
|
16
|
+
import { privateFileStore } from "openclaw/plugin-sdk/security-runtime";
|
|
17
17
|
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
|
|
18
|
+
//#region extensions/zalo/src/monitor-durable.ts
|
|
19
|
+
function prepareZaloDurableReplyPayload(params) {
|
|
20
|
+
if (!params.payload.text) return params.payload;
|
|
21
|
+
return {
|
|
22
|
+
...params.payload,
|
|
23
|
+
text: params.convertMarkdownTables(params.payload.text, params.tableMode)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function resolveZaloDurableReplyOptions(params) {
|
|
27
|
+
if (params.infoKind !== "final") return false;
|
|
28
|
+
const reply = resolveSendableOutboundReplyParts(params.payload);
|
|
29
|
+
if (reply.hasMedia || !reply.hasText) return false;
|
|
30
|
+
return { to: params.chatId };
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
18
33
|
//#region extensions/zalo/src/outbound-media.ts
|
|
19
34
|
const ZALO_OUTBOUND_MEDIA_TTL_MS = 2 * 6e4;
|
|
20
35
|
const ZALO_OUTBOUND_MEDIA_SEGMENT = "media";
|
|
@@ -34,11 +49,8 @@ function createHostedZaloMediaToken() {
|
|
|
34
49
|
return randomBytes(24).toString("hex");
|
|
35
50
|
}
|
|
36
51
|
async function ensureHostedZaloMediaDir() {
|
|
37
|
-
await
|
|
38
|
-
|
|
39
|
-
mode: 448
|
|
40
|
-
});
|
|
41
|
-
await chmod(ZALO_OUTBOUND_MEDIA_DIR, 448).catch(() => void 0);
|
|
52
|
+
await privateFileStore(ZALO_OUTBOUND_MEDIA_DIR).writeText(".ready", "");
|
|
53
|
+
await unlink(join(ZALO_OUTBOUND_MEDIA_DIR, ".ready")).catch(() => void 0);
|
|
42
54
|
}
|
|
43
55
|
async function deleteHostedZaloMediaEntry(id) {
|
|
44
56
|
await Promise.all([unlink(resolveHostedZaloMediaMetadataPath(id)).catch(() => void 0), unlink(resolveHostedZaloMediaBufferPath(id)).catch(() => void 0)]);
|
|
@@ -97,16 +109,14 @@ async function prepareHostedZaloMediaUrl(params) {
|
|
|
97
109
|
const id = createHostedZaloMediaId();
|
|
98
110
|
const token = createHostedZaloMediaToken();
|
|
99
111
|
const publicBaseUrl = new URL(params.webhookUrl).origin;
|
|
100
|
-
|
|
112
|
+
const store = privateFileStore(ZALO_OUTBOUND_MEDIA_DIR);
|
|
113
|
+
await store.writeText(`${id}.bin`, media.buffer);
|
|
101
114
|
try {
|
|
102
|
-
await
|
|
115
|
+
await store.writeJson(`${id}.json`, {
|
|
103
116
|
routePath,
|
|
104
117
|
token,
|
|
105
118
|
contentType: media.contentType,
|
|
106
119
|
expiresAt: Date.now() + ZALO_OUTBOUND_MEDIA_TTL_MS
|
|
107
|
-
}), {
|
|
108
|
-
encoding: "utf8",
|
|
109
|
-
mode: 384
|
|
110
120
|
});
|
|
111
121
|
} catch (error) {
|
|
112
122
|
await deleteHostedZaloMediaEntry(id);
|
|
@@ -175,7 +185,7 @@ const ZALO_TYPING_TIMEOUT_MS = 5e3;
|
|
|
175
185
|
let zaloWebhookModulePromise;
|
|
176
186
|
const hostedMediaRouteRefs = /* @__PURE__ */ new Map();
|
|
177
187
|
function loadZaloWebhookModule() {
|
|
178
|
-
zaloWebhookModulePromise ??= import("./monitor.webhook-
|
|
188
|
+
zaloWebhookModulePromise ??= import("./monitor.webhook-0sObsTVp.js");
|
|
179
189
|
return zaloWebhookModulePromise;
|
|
180
190
|
}
|
|
181
191
|
function registerSharedHostedMediaRoute(params) {
|
|
@@ -559,29 +569,23 @@ async function processMessageWithPipeline(params) {
|
|
|
559
569
|
channel: "zalo",
|
|
560
570
|
accountId: account.accountId
|
|
561
571
|
});
|
|
562
|
-
const
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
channel: "zalo",
|
|
578
|
-
action: "start",
|
|
579
|
-
target: chatId,
|
|
580
|
-
error: err
|
|
581
|
-
});
|
|
582
|
-
}
|
|
572
|
+
const replyPipeline = { typing: {
|
|
573
|
+
start: async () => {
|
|
574
|
+
await sendChatAction(token, {
|
|
575
|
+
chat_id: chatId,
|
|
576
|
+
action: "typing"
|
|
577
|
+
}, fetcher, ZALO_TYPING_TIMEOUT_MS);
|
|
578
|
+
},
|
|
579
|
+
onStartError: (err) => {
|
|
580
|
+
logTypingFailure({
|
|
581
|
+
log: (message) => logVerbose(core, runtime, message),
|
|
582
|
+
channel: "zalo",
|
|
583
|
+
action: "start",
|
|
584
|
+
target: chatId,
|
|
585
|
+
error: err
|
|
586
|
+
});
|
|
583
587
|
}
|
|
584
|
-
}
|
|
588
|
+
} };
|
|
585
589
|
await core.channel.turn.run({
|
|
586
590
|
channel: "zalo",
|
|
587
591
|
accountId: account.accountId,
|
|
@@ -606,6 +610,16 @@ async function processMessageWithPipeline(params) {
|
|
|
606
610
|
recordInboundSession: core.channel.session.recordInboundSession,
|
|
607
611
|
dispatchReplyWithBufferedBlockDispatcher: core.channel.reply.dispatchReplyWithBufferedBlockDispatcher,
|
|
608
612
|
delivery: {
|
|
613
|
+
preparePayload: (payload) => prepareZaloDurableReplyPayload({
|
|
614
|
+
payload,
|
|
615
|
+
tableMode,
|
|
616
|
+
convertMarkdownTables: core.channel.text.convertMarkdownTables
|
|
617
|
+
}),
|
|
618
|
+
durable: (payload, info) => resolveZaloDurableReplyOptions({
|
|
619
|
+
payload,
|
|
620
|
+
infoKind: info.kind,
|
|
621
|
+
chatId
|
|
622
|
+
}),
|
|
609
623
|
deliver: async (payload) => {
|
|
610
624
|
await deliverZaloReply({
|
|
611
625
|
payload,
|
|
@@ -622,15 +636,17 @@ async function processMessageWithPipeline(params) {
|
|
|
622
636
|
accountId: account.accountId,
|
|
623
637
|
statusSink,
|
|
624
638
|
fetcher,
|
|
625
|
-
tableMode
|
|
639
|
+
tableMode: "off"
|
|
626
640
|
});
|
|
627
641
|
},
|
|
642
|
+
onDelivered: () => {
|
|
643
|
+
statusSink?.({ lastOutboundAt: Date.now() });
|
|
644
|
+
},
|
|
628
645
|
onError: (err, info) => {
|
|
629
646
|
runtime.error?.(`[${account.accountId}] Zalo ${info.kind} reply failed: ${String(err)}`);
|
|
630
647
|
}
|
|
631
648
|
},
|
|
632
|
-
|
|
633
|
-
replyOptions: { onModelSelected },
|
|
649
|
+
replyPipeline,
|
|
634
650
|
record: { onRecordError: (err) => {
|
|
635
651
|
runtime.error?.(`zalo: failed updating session meta: ${String(err)}`);
|
|
636
652
|
} }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as withResolvedWebhookRequestPipeline, B as resolveClientIp, F as readJsonWebhookBodyOrReject, R as registerWebhookTarget, i as WEBHOOK_RATE_LIMIT_DEFAULTS, q as resolveWebhookTargetWithAuthOrRejectSync, r as WEBHOOK_ANOMALY_COUNTER_DEFAULTS, s as applyBasicWebhookRequestGuards, v as createFixedWindowRateLimiter, y as createWebhookAnomalyTracker, z as registerWebhookTargetWithPluginRoute } from "./runtime-api-
|
|
2
|
-
import { createClaimableDedupe } from "openclaw/plugin-sdk/persistent-dedupe";
|
|
1
|
+
import { $ as withResolvedWebhookRequestPipeline, B as resolveClientIp, F as readJsonWebhookBodyOrReject, R as registerWebhookTarget, i as WEBHOOK_RATE_LIMIT_DEFAULTS, q as resolveWebhookTargetWithAuthOrRejectSync, r as WEBHOOK_ANOMALY_COUNTER_DEFAULTS, s as applyBasicWebhookRequestGuards, v as createFixedWindowRateLimiter, y as createWebhookAnomalyTracker, z as registerWebhookTargetWithPluginRoute } from "./runtime-api-CMlbWaSj.js";
|
|
3
2
|
import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
3
|
+
import { createClaimableDedupe } from "openclaw/plugin-sdk/persistent-dedupe";
|
|
4
4
|
//#region extensions/zalo/src/monitor.webhook.ts
|
|
5
5
|
const ZALO_WEBHOOK_REPLAY_WINDOW_MS = 5 * 6e4;
|
|
6
6
|
const webhookTargets = /* @__PURE__ */ new Map();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { makeProxyFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
3
3
|
//#region extensions/zalo/src/api.ts
|
|
4
4
|
/**
|
|
5
5
|
* Zalo Bot API client
|
|
@@ -123,11 +123,7 @@ function resolveZaloProxyFetch(proxyUrl) {
|
|
|
123
123
|
if (!trimmed) return;
|
|
124
124
|
const cached = proxyCache.get(trimmed);
|
|
125
125
|
if (cached) return cached;
|
|
126
|
-
const
|
|
127
|
-
const fetcher = (input, init) => fetch$1(input, {
|
|
128
|
-
...init,
|
|
129
|
-
dispatcher: agent
|
|
130
|
-
});
|
|
126
|
+
const fetcher = makeProxyFetch(trimmed);
|
|
131
127
|
proxyCache.set(trimmed, fetcher);
|
|
132
128
|
return fetcher;
|
|
133
129
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "./runtime-BRFxnYQx.js";
|
|
2
2
|
import { formatAllowFromLowercase as formatAllowFromLowercase$1, isNormalizedSenderAllowed as isNormalizedSenderAllowed$1 } from "openclaw/plugin-sdk/allow-from";
|
|
3
|
+
import { createChannelMessageReplyPipeline } from "openclaw/plugin-sdk/channel-message";
|
|
3
4
|
import { PAIRING_APPROVED_MESSAGE, buildTokenChannelStatusSummary as buildTokenChannelStatusSummary$1 } from "openclaw/plugin-sdk/channel-status";
|
|
4
5
|
import { deliverTextOrMediaReply as deliverTextOrMediaReply$1, isNumericTargetId as isNumericTargetId$1, sendPayloadWithChunkedTextAndMedia as sendPayloadWithChunkedTextAndMedia$1 } from "openclaw/plugin-sdk/reply-payload";
|
|
5
6
|
import { buildBaseAccountStatusSnapshot } from "openclaw/plugin-sdk/status-helpers";
|
|
@@ -10,10 +11,9 @@ import { addWildcardAllowFrom as addWildcardAllowFrom$1, applyAccountNameToChann
|
|
|
10
11
|
import { evaluateSenderGroupAccess as evaluateSenderGroupAccess$1 } from "openclaw/plugin-sdk/group-access";
|
|
11
12
|
import { resolveDefaultGroupPolicy as resolveDefaultGroupPolicy$1, resolveOpenProviderRuntimeGroupPolicy as resolveOpenProviderRuntimeGroupPolicy$1, warnMissingProviderGroupPolicyFallbackOnce as warnMissingProviderGroupPolicyFallbackOnce$1 } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
12
13
|
import { createChannelPairingController as createChannelPairingController$1 } from "openclaw/plugin-sdk/channel-pairing";
|
|
13
|
-
import { createChannelReplyPipeline as createChannelReplyPipeline$1 } from "openclaw/plugin-sdk/channel-reply-pipeline";
|
|
14
14
|
import { logTypingFailure as logTypingFailure$1 } from "openclaw/plugin-sdk/channel-feedback";
|
|
15
15
|
import { resolveDirectDmAuthorizationOutcome as resolveDirectDmAuthorizationOutcome$1, resolveSenderCommandAuthorizationWithRuntime as resolveSenderCommandAuthorizationWithRuntime$1 } from "openclaw/plugin-sdk/command-auth";
|
|
16
16
|
import { resolveInboundRouteEnvelopeBuilderWithRuntime as resolveInboundRouteEnvelopeBuilderWithRuntime$1 } from "openclaw/plugin-sdk/inbound-envelope";
|
|
17
17
|
import { waitForAbortSignal } from "openclaw/plugin-sdk/runtime";
|
|
18
18
|
import { WEBHOOK_ANOMALY_COUNTER_DEFAULTS, WEBHOOK_RATE_LIMIT_DEFAULTS, applyBasicWebhookRequestGuards, createFixedWindowRateLimiter, createWebhookAnomalyTracker, readJsonWebhookBodyOrReject, registerPluginHttpRoute as registerPluginHttpRoute$1, registerWebhookTarget, registerWebhookTargetWithPluginRoute, resolveWebhookPath as resolveWebhookPath$1, resolveWebhookTargetWithAuthOrRejectSync, withResolvedWebhookRequestPipeline } from "openclaw/plugin-sdk/webhook-ingress";
|
|
19
|
-
export { withResolvedWebhookRequestPipeline as $, migrateBaseNameToDefaultAccount as A, resolveClientIp as B, formatPairingApproveHint as C, jsonResult as D, isNumericTargetId$1 as E, readJsonWebhookBodyOrReject as F, resolveSenderCommandAuthorizationWithRuntime$1 as G, resolveDirectDmAuthorizationOutcome$1 as H, readStringParam as I, runSingleChannelSecretStep$1 as J, resolveWebhookPath$1 as K, registerPluginHttpRoute$1 as L, normalizeResolvedSecretInputString as M, normalizeSecretInputString as N, logTypingFailure$1 as O, promptSingleChannelSecretInput$1 as P, warnMissingProviderGroupPolicyFallbackOnce$1 as Q, registerWebhookTarget as R, formatAllowFromLowercase$1 as S, isNormalizedSenderAllowed$1 as T, resolveInboundRouteEnvelopeBuilderWithRuntime$1 as U, resolveDefaultGroupPolicy$1 as V, resolveOpenProviderRuntimeGroupPolicy$1 as W, setTopLevelChannelDmPolicyWithAllowFrom as X, sendPayloadWithChunkedTextAndMedia$1 as Y, waitForAbortSignal as Z, createDedupeCache as _, addWildcardAllowFrom$1 as a, deliverTextOrMediaReply$1 as b, applySetupAccountConfigPatch as c, buildSecretInputSchema as d, buildSingleChannelSecretPromptState$1 as f,
|
|
19
|
+
export { withResolvedWebhookRequestPipeline as $, migrateBaseNameToDefaultAccount as A, resolveClientIp as B, formatPairingApproveHint as C, jsonResult as D, isNumericTargetId$1 as E, readJsonWebhookBodyOrReject as F, resolveSenderCommandAuthorizationWithRuntime$1 as G, resolveDirectDmAuthorizationOutcome$1 as H, readStringParam as I, runSingleChannelSecretStep$1 as J, resolveWebhookPath$1 as K, registerPluginHttpRoute$1 as L, normalizeResolvedSecretInputString as M, normalizeSecretInputString as N, logTypingFailure$1 as O, promptSingleChannelSecretInput$1 as P, warnMissingProviderGroupPolicyFallbackOnce$1 as Q, registerWebhookTarget as R, formatAllowFromLowercase$1 as S, isNormalizedSenderAllowed$1 as T, resolveInboundRouteEnvelopeBuilderWithRuntime$1 as U, resolveDefaultGroupPolicy$1 as V, resolveOpenProviderRuntimeGroupPolicy$1 as W, setTopLevelChannelDmPolicyWithAllowFrom as X, sendPayloadWithChunkedTextAndMedia$1 as Y, waitForAbortSignal as Z, createDedupeCache as _, addWildcardAllowFrom$1 as a, deliverTextOrMediaReply$1 as b, applySetupAccountConfigPatch as c, buildSecretInputSchema as d, buildSingleChannelSecretPromptState$1 as f, createChannelPairingController$1 as g, createChannelMessageReplyPipeline as h, WEBHOOK_RATE_LIMIT_DEFAULTS as i, normalizeAccountId$1 as j, mergeAllowFromEntries$1 as k, buildBaseAccountStatusSnapshot as l, chunkTextForOutbound$1 as m, PAIRING_APPROVED_MESSAGE as n, applyAccountNameToChannelSection as o, buildTokenChannelStatusSummary$1 as p, resolveWebhookTargetWithAuthOrRejectSync as q, WEBHOOK_ANOMALY_COUNTER_DEFAULTS as r, applyBasicWebhookRequestGuards as s, DEFAULT_ACCOUNT_ID$1 as t, buildChannelConfigSchema as u, createFixedWindowRateLimiter as v, hasConfiguredSecretInput$1 as w, evaluateSenderGroupAccess$1 as x, createWebhookAnomalyTracker as y, registerWebhookTargetWithPluginRoute as z };
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as withResolvedWebhookRequestPipeline, A as migrateBaseNameToDefaultAccount, B as resolveClientIp, C as formatPairingApproveHint, D as jsonResult, E as isNumericTargetId, F as readJsonWebhookBodyOrReject, G as resolveSenderCommandAuthorizationWithRuntime, H as resolveDirectDmAuthorizationOutcome, I as readStringParam, J as runSingleChannelSecretStep, K as resolveWebhookPath, L as registerPluginHttpRoute, M as normalizeResolvedSecretInputString, N as normalizeSecretInputString, O as logTypingFailure, P as promptSingleChannelSecretInput, Q as warnMissingProviderGroupPolicyFallbackOnce, R as registerWebhookTarget, S as formatAllowFromLowercase, T as isNormalizedSenderAllowed, U as resolveInboundRouteEnvelopeBuilderWithRuntime, V as resolveDefaultGroupPolicy, W as resolveOpenProviderRuntimeGroupPolicy, X as setTopLevelChannelDmPolicyWithAllowFrom, Y as sendPayloadWithChunkedTextAndMedia, Z as waitForAbortSignal, _ as createDedupeCache, a as addWildcardAllowFrom, b as deliverTextOrMediaReply, c as applySetupAccountConfigPatch, d as buildSecretInputSchema, f as buildSingleChannelSecretPromptState, g as
|
|
1
|
+
import { $ as withResolvedWebhookRequestPipeline, A as migrateBaseNameToDefaultAccount, B as resolveClientIp, C as formatPairingApproveHint, D as jsonResult, E as isNumericTargetId, F as readJsonWebhookBodyOrReject, G as resolveSenderCommandAuthorizationWithRuntime, H as resolveDirectDmAuthorizationOutcome, I as readStringParam, J as runSingleChannelSecretStep, K as resolveWebhookPath, L as registerPluginHttpRoute, M as normalizeResolvedSecretInputString, N as normalizeSecretInputString, O as logTypingFailure, P as promptSingleChannelSecretInput, Q as warnMissingProviderGroupPolicyFallbackOnce, R as registerWebhookTarget, S as formatAllowFromLowercase, T as isNormalizedSenderAllowed, U as resolveInboundRouteEnvelopeBuilderWithRuntime, V as resolveDefaultGroupPolicy, W as resolveOpenProviderRuntimeGroupPolicy, X as setTopLevelChannelDmPolicyWithAllowFrom, Y as sendPayloadWithChunkedTextAndMedia, Z as waitForAbortSignal, _ as createDedupeCache, a as addWildcardAllowFrom, b as deliverTextOrMediaReply, c as applySetupAccountConfigPatch, d as buildSecretInputSchema, f as buildSingleChannelSecretPromptState, g as createChannelPairingController, h as createChannelMessageReplyPipeline, i as WEBHOOK_RATE_LIMIT_DEFAULTS, j as normalizeAccountId, k as mergeAllowFromEntries, l as buildBaseAccountStatusSnapshot, m as chunkTextForOutbound, n as PAIRING_APPROVED_MESSAGE, o as applyAccountNameToChannelSection, p as buildTokenChannelStatusSummary, q as resolveWebhookTargetWithAuthOrRejectSync, r as WEBHOOK_ANOMALY_COUNTER_DEFAULTS, s as applyBasicWebhookRequestGuards, t as DEFAULT_ACCOUNT_ID, u as buildChannelConfigSchema, v as createFixedWindowRateLimiter, w as hasConfiguredSecretInput, x as evaluateSenderGroupAccess, y as createWebhookAnomalyTracker, z as registerWebhookTargetWithPluginRoute } from "./runtime-api-CMlbWaSj.js";
|
|
2
2
|
import { n as setZaloRuntime } from "./runtime-BRFxnYQx.js";
|
|
3
|
-
export { DEFAULT_ACCOUNT_ID, PAIRING_APPROVED_MESSAGE, WEBHOOK_ANOMALY_COUNTER_DEFAULTS, WEBHOOK_RATE_LIMIT_DEFAULTS, addWildcardAllowFrom, applyAccountNameToChannelSection, applyBasicWebhookRequestGuards, applySetupAccountConfigPatch, buildBaseAccountStatusSnapshot, buildChannelConfigSchema, buildSecretInputSchema, buildSingleChannelSecretPromptState, buildTokenChannelStatusSummary, chunkTextForOutbound,
|
|
3
|
+
export { DEFAULT_ACCOUNT_ID, PAIRING_APPROVED_MESSAGE, WEBHOOK_ANOMALY_COUNTER_DEFAULTS, WEBHOOK_RATE_LIMIT_DEFAULTS, addWildcardAllowFrom, applyAccountNameToChannelSection, applyBasicWebhookRequestGuards, applySetupAccountConfigPatch, buildBaseAccountStatusSnapshot, buildChannelConfigSchema, buildSecretInputSchema, buildSingleChannelSecretPromptState, buildTokenChannelStatusSummary, chunkTextForOutbound, createChannelMessageReplyPipeline, createChannelPairingController, createDedupeCache, createFixedWindowRateLimiter, createWebhookAnomalyTracker, deliverTextOrMediaReply, evaluateSenderGroupAccess, formatAllowFromLowercase, formatPairingApproveHint, hasConfiguredSecretInput, isNormalizedSenderAllowed, isNumericTargetId, jsonResult, logTypingFailure, mergeAllowFromEntries, migrateBaseNameToDefaultAccount, normalizeAccountId, normalizeResolvedSecretInputString, normalizeSecretInputString, promptSingleChannelSecretInput, readJsonWebhookBodyOrReject, readStringParam, registerPluginHttpRoute, registerWebhookTarget, registerWebhookTargetWithPluginRoute, resolveClientIp, resolveDefaultGroupPolicy, resolveDirectDmAuthorizationOutcome, resolveInboundRouteEnvelopeBuilderWithRuntime, resolveOpenProviderRuntimeGroupPolicy, resolveSenderCommandAuthorizationWithRuntime, resolveWebhookPath, resolveWebhookTargetWithAuthOrRejectSync, runSingleChannelSecretStep, sendPayloadWithChunkedTextAndMedia, setTopLevelChannelDmPolicyWithAllowFrom, setZaloRuntime, waitForAbortSignal, warnMissingProviderGroupPolicyFallbackOnce, withResolvedWebhookRequestPipeline };
|
|
@@ -1,28 +1,54 @@
|
|
|
1
1
|
import { a as resolveZaloAccount, o as resolveZaloToken } from "./accounts-9NLDDlZ8.js";
|
|
2
|
-
import { c as sendMessage, l as sendPhoto, t as resolveZaloProxyFetch } from "./proxy-
|
|
2
|
+
import { c as sendMessage, l as sendPhoto, t as resolveZaloProxyFetch } from "./proxy-D5AGEsI0.js";
|
|
3
|
+
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-message";
|
|
3
4
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
4
5
|
//#region extensions/zalo/src/send.ts
|
|
5
|
-
function
|
|
6
|
+
function createZaloSendReceipt(params) {
|
|
7
|
+
const messageId = params.messageId?.trim();
|
|
8
|
+
return createMessageReceiptFromOutboundResults({
|
|
9
|
+
results: messageId ? [{
|
|
10
|
+
channel: "zalo",
|
|
11
|
+
messageId,
|
|
12
|
+
chatId: params.chatId
|
|
13
|
+
}] : [],
|
|
14
|
+
kind: params.kind
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function toZaloSendResult(response, params) {
|
|
6
18
|
if (response.ok && response.result) return {
|
|
7
19
|
ok: true,
|
|
8
|
-
messageId: response.result.message_id
|
|
20
|
+
messageId: response.result.message_id,
|
|
21
|
+
receipt: createZaloSendReceipt({
|
|
22
|
+
messageId: response.result.message_id,
|
|
23
|
+
chatId: params.chatId,
|
|
24
|
+
kind: params.kind
|
|
25
|
+
})
|
|
9
26
|
};
|
|
10
27
|
return {
|
|
11
28
|
ok: false,
|
|
12
|
-
error: "Failed to send message"
|
|
29
|
+
error: "Failed to send message",
|
|
30
|
+
receipt: createZaloSendReceipt({
|
|
31
|
+
chatId: params.chatId,
|
|
32
|
+
kind: params.kind
|
|
33
|
+
})
|
|
13
34
|
};
|
|
14
35
|
}
|
|
15
|
-
async function runZaloSend(failureMessage, send) {
|
|
36
|
+
async function runZaloSend(failureMessage, params, send) {
|
|
16
37
|
try {
|
|
17
|
-
const result = toZaloSendResult(await send());
|
|
38
|
+
const result = toZaloSendResult(await send(), params);
|
|
18
39
|
return result.ok ? result : {
|
|
19
40
|
ok: false,
|
|
20
|
-
error: failureMessage
|
|
41
|
+
error: failureMessage,
|
|
42
|
+
receipt: result.receipt
|
|
21
43
|
};
|
|
22
44
|
} catch (err) {
|
|
23
45
|
return {
|
|
24
46
|
ok: false,
|
|
25
|
-
error: formatErrorMessage(err)
|
|
47
|
+
error: formatErrorMessage(err),
|
|
48
|
+
receipt: createZaloSendReceipt({
|
|
49
|
+
chatId: params.chatId,
|
|
50
|
+
kind: params.kind
|
|
51
|
+
})
|
|
26
52
|
};
|
|
27
53
|
}
|
|
28
54
|
}
|
|
@@ -66,7 +92,11 @@ function resolveSendContextOrFailure(chatId, options) {
|
|
|
66
92
|
const context = resolveValidatedSendContext(chatId, options);
|
|
67
93
|
return context.ok ? { context } : { failure: {
|
|
68
94
|
ok: false,
|
|
69
|
-
error: context.error
|
|
95
|
+
error: context.error,
|
|
96
|
+
receipt: createZaloSendReceipt({
|
|
97
|
+
chatId,
|
|
98
|
+
kind: "unknown"
|
|
99
|
+
})
|
|
70
100
|
} };
|
|
71
101
|
}
|
|
72
102
|
async function sendMessageZalo(chatId, text, options = {}) {
|
|
@@ -78,7 +108,10 @@ async function sendMessageZalo(chatId, text, options = {}) {
|
|
|
78
108
|
token: context.token,
|
|
79
109
|
caption: text || options.caption
|
|
80
110
|
});
|
|
81
|
-
return await runZaloSend("Failed to send message",
|
|
111
|
+
return await runZaloSend("Failed to send message", {
|
|
112
|
+
chatId: context.chatId,
|
|
113
|
+
kind: "text"
|
|
114
|
+
}, () => sendMessage(context.token, {
|
|
82
115
|
chat_id: context.chatId,
|
|
83
116
|
text: text.slice(0, 2e3)
|
|
84
117
|
}, context.fetcher));
|
|
@@ -89,9 +122,16 @@ async function sendPhotoZalo(chatId, photoUrl, options = {}) {
|
|
|
89
122
|
const { context } = resolved;
|
|
90
123
|
if (!photoUrl?.trim()) return {
|
|
91
124
|
ok: false,
|
|
92
|
-
error: "No photo URL provided"
|
|
125
|
+
error: "No photo URL provided",
|
|
126
|
+
receipt: createZaloSendReceipt({
|
|
127
|
+
chatId: context.chatId,
|
|
128
|
+
kind: "media"
|
|
129
|
+
})
|
|
93
130
|
};
|
|
94
|
-
return await runZaloSend("Failed to send photo",
|
|
131
|
+
return await runZaloSend("Failed to send photo", {
|
|
132
|
+
chatId: context.chatId,
|
|
133
|
+
kind: "media"
|
|
134
|
+
}, () => (async () => sendPhoto(context.token, {
|
|
95
135
|
chat_id: context.chatId,
|
|
96
136
|
photo: photoUrl.trim(),
|
|
97
137
|
caption: options.caption?.slice(0, 2e3)
|
package/package.json
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/zalo",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.9-beta.1",
|
|
4
4
|
"description": "OpenClaw Zalo channel plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/openclaw/openclaw"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"undici": "8.2.0"
|
|
12
|
-
},
|
|
13
10
|
"devDependencies": {
|
|
14
11
|
"@openclaw/plugin-sdk": "workspace:*",
|
|
15
12
|
"openclaw": "workspace:*"
|
|
16
13
|
},
|
|
17
14
|
"peerDependencies": {
|
|
18
|
-
"openclaw": ">=2026.5.
|
|
15
|
+
"openclaw": ">=2026.5.9-beta.1"
|
|
19
16
|
},
|
|
20
17
|
"peerDependenciesMeta": {
|
|
21
18
|
"openclaw": {
|
|
@@ -46,10 +43,10 @@
|
|
|
46
43
|
"minHostVersion": ">=2026.4.10"
|
|
47
44
|
},
|
|
48
45
|
"compat": {
|
|
49
|
-
"pluginApi": ">=2026.5.
|
|
46
|
+
"pluginApi": ">=2026.5.9-beta.1"
|
|
50
47
|
},
|
|
51
48
|
"build": {
|
|
52
|
-
"openclawVersion": "2026.5.
|
|
49
|
+
"openclawVersion": "2026.5.9-beta.1"
|
|
53
50
|
},
|
|
54
51
|
"release": {
|
|
55
52
|
"publishToClawHub": true,
|