@openclaw/zalo 2026.10.2 → 2026.10.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.
- package/dist/.setup/{api-Do4fKxXr.mjs → api-DcyxnTMW.mjs} +2 -2
- package/dist/.setup/{channel-f4tP7sv3.mjs → channel-BDoyUcaX.mjs} +6 -7
- package/dist/.setup/{channel.runtime-I1gRRKZx.mjs → channel.runtime-h7Ma-rtL.mjs} +6 -9
- package/dist/.setup/{monitor-BcLcFy7k.mjs → monitor-CkPLrWVm.mjs} +53 -90
- package/dist/.setup/{monitor.webhook-cIt_VYBI.mjs → monitor.webhook-B3g1irKn.mjs} +1 -1
- package/dist/.setup/{send-Cj1YI36h.mjs → send-K3VH6hzV.mjs} +6 -4
- package/dist/.setup/{setup-core-BE-EaCnS.mjs → setup-core-BohTbM6i.mjs} +3 -3
- package/dist/.setup/{setup-surface-DMW4dLWX.mjs → setup-surface-Bzs4Hwk9.mjs} +1 -1
- package/dist/.setup/{webhook-spool-MSe2Vqq3.mjs → webhook-spool-DejV9YSc.mjs} +1 -1
- package/dist/api.js +2 -2
- package/dist/channel-plugin-api.js +1 -1
- package/dist/setup-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/dist/setup-surface.js +2 -2
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as zaloDmPolicy, r as zaloSetupAdapter, t as createZaloSetupWizardProxy } from "./setup-core-
|
|
2
|
-
import { t as zaloPlugin } from "./channel-
|
|
1
|
+
import { n as zaloDmPolicy, r as zaloSetupAdapter, t as createZaloSetupWizardProxy } from "./setup-core-BohTbM6i.mjs";
|
|
2
|
+
import { t as zaloPlugin } from "./channel-BDoyUcaX.mjs";
|
|
3
3
|
import { n as resolveZaloRuntimeGroupPolicy } from "./group-access-Blsyu-ot.mjs";
|
|
4
4
|
import { zaloSetupWizard } from "../setup-api.js";
|
|
5
5
|
import "../api.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as isZaloAccountConfigured, d as resolveZaloAccount, i as zaloSetupContract, l as listZaloAccountIds,
|
|
1
|
+
import { c as isZaloAccountConfigured, d as resolveZaloAccount, i as zaloSetupContract, l as listZaloAccountIds, s as inspectZaloAccount, t as createZaloSetupWizardProxy, u as resolveDefaultZaloAccountId } from "./setup-core-BohTbM6i.mjs";
|
|
2
2
|
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-DF_0WQX4.mjs";
|
|
3
3
|
import { describeWebhookAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
4
4
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
@@ -16,6 +16,7 @@ import { sendPayloadWithChunkedTextAndMedia } from "openclaw/plugin-sdk/reply-pa
|
|
|
16
16
|
import { createComputedAccountStatusAdapter, createDefaultChannelRuntimeState, standardDmPolicyOpenIssue } from "openclaw/plugin-sdk/status-helpers";
|
|
17
17
|
import { chunkTextForOutbound, sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
|
|
18
18
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
19
|
+
import { buildSecretInputSchema } from "openclaw/plugin-sdk/secret-input";
|
|
19
20
|
import { jsonResult, readStringParam } from "openclaw/plugin-sdk/channel-actions";
|
|
20
21
|
import { extractToolSend } from "openclaw/plugin-sdk/tool-send";
|
|
21
22
|
import { createChannelApprovalAuth } from "openclaw/plugin-sdk/approval-auth-runtime";
|
|
@@ -24,7 +25,7 @@ import { z } from "zod";
|
|
|
24
25
|
import { buildChannelOutboundSessionRoute, stripChannelTargetPrefix, stripTargetKindPrefix } from "openclaw/plugin-sdk/core";
|
|
25
26
|
import { coerceStatusIssueAccountId, readStatusIssueFields } from "openclaw/plugin-sdk/extension-shared";
|
|
26
27
|
//#region extensions/zalo/src/actions.ts
|
|
27
|
-
const loadZaloActionsRuntime = createLazyRuntimeNamedExport(() => import("./send-
|
|
28
|
+
const loadZaloActionsRuntime = createLazyRuntimeNamedExport(() => import("./send-K3VH6hzV.mjs"), "sendMessageZalo");
|
|
28
29
|
const providerId = "zalo";
|
|
29
30
|
const ZALO_ACTIONS = /* @__PURE__ */ new Set(["send"]);
|
|
30
31
|
function listEnabledAccounts(cfg, accountId) {
|
|
@@ -186,13 +187,11 @@ function looksLikeZaloChatId(raw, normalized) {
|
|
|
186
187
|
const target = normalizeZaloMessagingTarget(normalized ?? raw);
|
|
187
188
|
return Boolean(target);
|
|
188
189
|
}
|
|
189
|
-
const loadZaloChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-
|
|
190
|
-
const zaloSetupWizard = createZaloSetupWizardProxy(async () => (await import("./setup-surface-
|
|
190
|
+
const loadZaloChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-h7Ma-rtL.mjs"));
|
|
191
|
+
const zaloSetupWizard = createZaloSetupWizardProxy(async () => (await import("./setup-surface-Bzs4Hwk9.mjs").then((n) => n.t)).zaloSetupWizard);
|
|
191
192
|
const zaloTextChunkLimit = 2e3;
|
|
192
193
|
async function sendZaloDelivery(ctx) {
|
|
193
|
-
const result = await (await loadZaloChannelRuntime()).
|
|
194
|
-
to: ctx.to,
|
|
195
|
-
text: ctx.text,
|
|
194
|
+
const result = await (await loadZaloChannelRuntime()).sendMessageZalo(ctx.to, ctx.text, {
|
|
196
195
|
accountId: ctx.accountId ?? void 0,
|
|
197
196
|
mediaUrl: ctx.mediaUrl,
|
|
198
197
|
cfg: ctx.cfg,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as getMe, n as ZaloApiError, sendMessageZalo, t as resolveZaloProxyFetch } from "./send-Cj1YI36h.mjs";
|
|
1
|
+
import { i as getMe, n as ZaloApiError, sendMessageZalo, t as resolveZaloProxyFetch } from "./send-K3VH6hzV.mjs";
|
|
3
2
|
import { createAccountStatusSink } from "openclaw/plugin-sdk/channel-outbound";
|
|
3
|
+
import { normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
4
4
|
import { runChannelProbe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
5
5
|
//#region extensions/zalo/src/probe.ts
|
|
6
6
|
function formatZaloProbeError(error, timeoutMs) {
|
|
@@ -33,9 +33,6 @@ async function probeZalo(token, timeoutMs = 5e3, fetcher) {
|
|
|
33
33
|
}
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region extensions/zalo/src/channel.runtime.ts
|
|
36
|
-
async function sendZaloText(params) {
|
|
37
|
-
return await sendMessageZalo(params.to, params.text, params);
|
|
38
|
-
}
|
|
39
36
|
async function probeZaloAccount(params) {
|
|
40
37
|
return await probeZalo(params.account.token, params.timeoutMs, resolveZaloProxyFetch(params.account.config.proxy));
|
|
41
38
|
}
|
|
@@ -49,20 +46,20 @@ async function startZaloGatewayAccount(ctx) {
|
|
|
49
46
|
const probe = await probeZalo(token, 2500, fetcher);
|
|
50
47
|
const name = probe.ok ? probe.bot?.account_name?.trim() : null;
|
|
51
48
|
if (name) zaloBotLabel = ` (${name})`;
|
|
52
|
-
if (!probe.ok) ctx.log?.warn?.(`[${account.accountId}] Zalo
|
|
49
|
+
if (!probe.ok) ctx.log?.warn?.(`[${account.accountId}] Zalo check failed before provider start (${String(probe.elapsedMs)}ms): ${probe.error}`);
|
|
53
50
|
ctx.setStatus({
|
|
54
51
|
accountId: account.accountId,
|
|
55
52
|
bot: probe.bot
|
|
56
53
|
});
|
|
57
54
|
} catch (err) {
|
|
58
|
-
ctx.log?.warn?.(`[${account.accountId}] Zalo
|
|
55
|
+
ctx.log?.warn?.(`[${account.accountId}] Zalo check failed before provider start: ${err instanceof Error ? err.stack ?? err.message : String(err)}`);
|
|
59
56
|
}
|
|
60
57
|
const statusSink = createAccountStatusSink({
|
|
61
58
|
accountId: ctx.accountId,
|
|
62
59
|
setStatus: ctx.setStatus
|
|
63
60
|
});
|
|
64
61
|
ctx.log?.info(`[${account.accountId}] starting provider${zaloBotLabel} mode=${mode}`);
|
|
65
|
-
const { monitorZaloProvider } = await import("./monitor-
|
|
62
|
+
const { monitorZaloProvider } = await import("./monitor-CkPLrWVm.mjs");
|
|
66
63
|
return monitorZaloProvider({
|
|
67
64
|
token,
|
|
68
65
|
account,
|
|
@@ -78,4 +75,4 @@ async function startZaloGatewayAccount(ctx) {
|
|
|
78
75
|
});
|
|
79
76
|
}
|
|
80
77
|
//#endregion
|
|
81
|
-
export { probeZaloAccount,
|
|
78
|
+
export { probeZaloAccount, sendMessageZalo, startZaloGatewayAccount };
|
|
@@ -1,35 +1,20 @@
|
|
|
1
1
|
import { n as resolveZaloRuntimeGroupPolicy, t as normalizeZaloAllowEntry } from "./group-access-Blsyu-ot.mjs";
|
|
2
2
|
import { t as getZaloRuntime } from "./runtime-Dfhzt7qb.mjs";
|
|
3
|
-
import { a as getUpdates, c as sendMessage, d as ZALO_OUTBOUND_MEDIA_TTL_MS, l as sendPhoto, n as ZaloApiError, o as getWebhookInfo, r as deleteWebhook, s as sendChatAction, t as resolveZaloProxyFetch, u as setWebhook } from "./send-
|
|
3
|
+
import { a as getUpdates, c as sendMessage, d as ZALO_OUTBOUND_MEDIA_TTL_MS, l as sendPhoto, n as ZaloApiError, o as getWebhookInfo, r as deleteWebhook, s as sendChatAction, t as resolveZaloProxyFetch, u as setWebhook } from "./send-K3VH6hzV.mjs";
|
|
4
4
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
5
|
-
import { createLazyRuntimeModule, createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
6
5
|
import { deliverTextOrMediaReply, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
7
6
|
import { normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
+
import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
8
8
|
import { resolveDefaultGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
9
9
|
import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
10
10
|
import { logTypingFailure } from "openclaw/plugin-sdk/channel-feedback";
|
|
11
|
-
import { createChannelPartialDeliveryError, formatInboundMediaUnavailableText
|
|
11
|
+
import { createChannelInboundEnvelopeBuilderAsync, createChannelPartialDeliveryError, formatInboundMediaUnavailableText } from "openclaw/plugin-sdk/channel-inbound";
|
|
12
12
|
import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
|
|
13
13
|
import { channelReadyPatch } from "openclaw/plugin-sdk/gateway-runtime";
|
|
14
14
|
import { sleepWithAbort, waitForAbortSignal } from "openclaw/plugin-sdk/runtime-env";
|
|
15
15
|
import { registerPluginHttpRoute, resolveWebhookPath } from "openclaw/plugin-sdk/webhook-ingress";
|
|
16
16
|
import { createHostedOutboundMediaStore } from "openclaw/plugin-sdk/outbound-media";
|
|
17
17
|
import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
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
|
|
33
18
|
//#region extensions/zalo/src/outbound-media.ts
|
|
34
19
|
const ZALO_OUTBOUND_MEDIA_SEGMENT = "media";
|
|
35
20
|
const ZALO_OUTBOUND_MEDIA_PREFIX = `/${ZALO_OUTBOUND_MEDIA_SEGMENT}/`;
|
|
@@ -39,9 +24,11 @@ const ZALO_OUTBOUND_MEDIA_CHUNKS_NAMESPACE = "hosted-outbound-media-chunks";
|
|
|
39
24
|
const ZALO_OUTBOUND_MEDIA_MAX_ENTRIES = 64;
|
|
40
25
|
const ZALO_OUTBOUND_MEDIA_MAX_CHUNK_ROWS = ZALO_OUTBOUND_MEDIA_MAX_ENTRIES * 256;
|
|
41
26
|
let hostedZaloMediaStore;
|
|
42
|
-
|
|
27
|
+
let hostedZaloMediaRuntime;
|
|
28
|
+
function getHostedZaloMediaStore() {
|
|
43
29
|
const runtime = getZaloRuntime();
|
|
44
|
-
return
|
|
30
|
+
if (hostedZaloMediaStore && hostedZaloMediaRuntime === runtime) return hostedZaloMediaStore;
|
|
31
|
+
hostedZaloMediaStore = createHostedOutboundMediaStore({
|
|
45
32
|
metadataStore: runtime.state.openKeyedStore({
|
|
46
33
|
namespace: ZALO_OUTBOUND_MEDIA_NAMESPACE,
|
|
47
34
|
maxEntries: 80
|
|
@@ -55,9 +42,7 @@ function createHostedZaloMediaStore() {
|
|
|
55
42
|
maxChunkRows: ZALO_OUTBOUND_MEDIA_MAX_CHUNK_ROWS,
|
|
56
43
|
resolveExpiresAtMs: (ttlMs) => resolveExpiresAtMsFromDurationMs(ttlMs)
|
|
57
44
|
});
|
|
58
|
-
|
|
59
|
-
function getHostedZaloMediaStore() {
|
|
60
|
-
hostedZaloMediaStore ??= createHostedZaloMediaStore();
|
|
45
|
+
hostedZaloMediaRuntime = runtime;
|
|
61
46
|
return hostedZaloMediaStore;
|
|
62
47
|
}
|
|
63
48
|
function resolveHostedZaloMediaRoutePrefix(params) {
|
|
@@ -69,16 +54,13 @@ function resolveHostedZaloMediaRoutePrefix(params) {
|
|
|
69
54
|
if (!webhookRoutePath) throw new Error("Zalo webhookPath could not be derived for outbound media hosting");
|
|
70
55
|
return webhookRoutePath === "/" ? `/${ZALO_OUTBOUND_MEDIA_SEGMENT}` : `${webhookRoutePath}/${ZALO_OUTBOUND_MEDIA_SEGMENT}`;
|
|
71
56
|
}
|
|
72
|
-
function resolveHostedZaloMediaRoutePath(params) {
|
|
73
|
-
return `${resolveHostedZaloMediaRoutePrefix(params)}/`;
|
|
74
|
-
}
|
|
75
57
|
async function prepareHostedZaloMediaUrl(params) {
|
|
76
58
|
const now = asDateTimestampMs(Date.now());
|
|
77
59
|
if ((now === void 0 ? void 0 : resolveExpiresAtMsFromDurationMs(12e4, { nowMs: now })) === void 0) throw new Error("Zalo outbound media expiry could not be resolved");
|
|
78
|
-
const routePath =
|
|
60
|
+
const routePath = `${resolveHostedZaloMediaRoutePrefix({
|
|
79
61
|
webhookUrl: params.webhookUrl,
|
|
80
62
|
webhookPath: params.webhookPath
|
|
81
|
-
})
|
|
63
|
+
})}/`;
|
|
82
64
|
const publicBaseUrl = new URL(params.webhookUrl).origin;
|
|
83
65
|
return await getHostedZaloMediaStore().prepareUrl({
|
|
84
66
|
mediaUrl: params.mediaUrl,
|
|
@@ -170,12 +152,6 @@ function resolveZaloTimestampMs(date) {
|
|
|
170
152
|
if (!date) return;
|
|
171
153
|
return date >= UNIX_MILLISECONDS_THRESHOLD ? date : date * 1e3;
|
|
172
154
|
}
|
|
173
|
-
const loadZaloWebhookRuntime = createLazyRuntimeNamedExport(() => import("./monitor.webhook-cIt_VYBI.mjs"), "zaloWebhookRuntime");
|
|
174
|
-
const loadZaloWebhookIngressRuntime = createLazyRuntimeNamedExport(() => import("./webhook-spool-MSe2Vqq3.mjs"), "zaloWebhookIngressRuntime");
|
|
175
|
-
const loadZaloWebhookModule = createLazyRuntimeModule(async () => ({
|
|
176
|
-
...await loadZaloWebhookRuntime(),
|
|
177
|
-
...await loadZaloWebhookIngressRuntime()
|
|
178
|
-
}));
|
|
179
155
|
function registerSharedHostedMediaRoute(params) {
|
|
180
156
|
return registerPluginHttpRoute({
|
|
181
157
|
auth: "plugin",
|
|
@@ -412,7 +388,7 @@ async function processMessageWithPipeline(params) {
|
|
|
412
388
|
if (!authorization) return;
|
|
413
389
|
const { isGroup, chatId, senderId, senderName, rawBody } = authorization;
|
|
414
390
|
const agentBody = agentBodyOverride ?? rawBody;
|
|
415
|
-
const
|
|
391
|
+
const route = resolveAgentRoute({
|
|
416
392
|
cfg: config,
|
|
417
393
|
channel: "zalo",
|
|
418
394
|
accountId: account.accountId,
|
|
@@ -438,7 +414,10 @@ async function processMessageWithPipeline(params) {
|
|
|
438
414
|
}
|
|
439
415
|
const fromLabel = isGroup ? `group:${chatId}` : senderName || `user:${senderId}`;
|
|
440
416
|
const timestamp = resolveZaloTimestampMs(date);
|
|
441
|
-
const body =
|
|
417
|
+
const body = (await createChannelInboundEnvelopeBuilderAsync({
|
|
418
|
+
cfg: config,
|
|
419
|
+
route
|
|
420
|
+
}))({
|
|
442
421
|
channel: "Zalo",
|
|
443
422
|
from: fromLabel,
|
|
444
423
|
timestamp,
|
|
@@ -500,33 +479,21 @@ async function processMessageWithPipeline(params) {
|
|
|
500
479
|
},
|
|
501
480
|
ctxPayload,
|
|
502
481
|
delivery: {
|
|
503
|
-
preparePayload: (payload) =>
|
|
504
|
-
payload
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
482
|
+
preparePayload: (payload) => {
|
|
483
|
+
if (!payload.text) return payload;
|
|
484
|
+
return {
|
|
485
|
+
...payload,
|
|
486
|
+
text: core.channel.text.convertMarkdownTables(payload.text, tableMode)
|
|
487
|
+
};
|
|
488
|
+
},
|
|
489
|
+
durable: (payload, info) => {
|
|
490
|
+
if (info.kind !== "final") return false;
|
|
491
|
+
const reply = resolveSendableOutboundReplyParts(payload);
|
|
492
|
+
if (reply.hasMedia || !reply.hasText) return false;
|
|
493
|
+
return { to: chatId };
|
|
494
|
+
},
|
|
513
495
|
deliver: async (payload) => {
|
|
514
|
-
await deliverZaloReply(
|
|
515
|
-
payload,
|
|
516
|
-
token,
|
|
517
|
-
chatId,
|
|
518
|
-
core,
|
|
519
|
-
config,
|
|
520
|
-
webhookUrl: params.webhookUrl,
|
|
521
|
-
webhookPath: params.webhookPath,
|
|
522
|
-
proxyUrl: account.config.proxy,
|
|
523
|
-
mediaMaxBytes: params.mediaMaxMb * 1024 * 1024,
|
|
524
|
-
canHostMedia: params.canHostMedia,
|
|
525
|
-
accountId: account.accountId,
|
|
526
|
-
statusSink,
|
|
527
|
-
fetcher,
|
|
528
|
-
tableMode: "off"
|
|
529
|
-
});
|
|
496
|
+
await deliverZaloReply(payload, chatId, params);
|
|
530
497
|
},
|
|
531
498
|
onDelivered: (_payload, _info, result) => {
|
|
532
499
|
if (result?.visibleReplySent !== false) statusSink?.({ lastOutboundAt: Date.now() });
|
|
@@ -558,10 +525,12 @@ async function processMessageWithPipeline(params) {
|
|
|
558
525
|
...params.turnAdoptionLifecycle ? { turnAdoptionLifecycle: params.turnAdoptionLifecycle } : {}
|
|
559
526
|
});
|
|
560
527
|
}
|
|
561
|
-
async function deliverZaloReply(
|
|
562
|
-
const {
|
|
563
|
-
const
|
|
564
|
-
const
|
|
528
|
+
async function deliverZaloReply(payload, chatId, context) {
|
|
529
|
+
const { token, core, config, webhookUrl, webhookPath, canHostMedia, account, statusSink, fetcher } = context;
|
|
530
|
+
const proxyUrl = account.config.proxy;
|
|
531
|
+
const mediaMaxBytes = context.mediaMaxMb * 1024 * 1024;
|
|
532
|
+
const accountId = account.accountId;
|
|
533
|
+
const reply = resolveSendableOutboundReplyParts(payload);
|
|
565
534
|
const chunkMode = core.channel.text.resolveChunkMode(config, "zalo", accountId);
|
|
566
535
|
const acceptedMessageIds = [];
|
|
567
536
|
let visibleReplySent = false;
|
|
@@ -649,6 +618,19 @@ async function monitorZaloProvider(options) {
|
|
|
649
618
|
}
|
|
650
619
|
abortSignal.addEventListener("abort", stopOnAbort, { once: true });
|
|
651
620
|
runtime.log?.(`[${account.accountId}] Zalo provider init mode=${mode} mediaMaxMb=${String(effectiveMediaMaxMb)}`);
|
|
621
|
+
const processingContext = {
|
|
622
|
+
token,
|
|
623
|
+
account,
|
|
624
|
+
config,
|
|
625
|
+
runtime,
|
|
626
|
+
core,
|
|
627
|
+
mediaMaxMb: effectiveMediaMaxMb,
|
|
628
|
+
canHostMedia,
|
|
629
|
+
webhookUrl: effectiveWebhookUrl,
|
|
630
|
+
webhookPath: effectiveWebhookPath,
|
|
631
|
+
statusSink,
|
|
632
|
+
fetcher
|
|
633
|
+
};
|
|
652
634
|
try {
|
|
653
635
|
if (hostedMediaRoutePath) {
|
|
654
636
|
const unregisterHostedMediaRoute = registerSharedHostedMediaRoute({
|
|
@@ -658,7 +640,8 @@ async function monitorZaloProvider(options) {
|
|
|
658
640
|
stopHandlers.push(unregisterHostedMediaRoute);
|
|
659
641
|
}
|
|
660
642
|
if (useWebhook) {
|
|
661
|
-
const {
|
|
643
|
+
const { registerZaloWebhookTarget, handleZaloWebhookRequest } = (await import("./monitor.webhook-B3g1irKn.mjs")).zaloWebhookRuntime;
|
|
644
|
+
const { createZaloWebhookIngress } = (await import("./webhook-spool-DejV9YSc.mjs")).zaloWebhookIngressRuntime;
|
|
662
645
|
if (!effectiveWebhookUrl || !webhookSecret) throw new Error("Zalo webhookUrl and webhookSecret are required for webhook mode");
|
|
663
646
|
if (!effectiveWebhookUrl.startsWith("https://")) throw new Error("Zalo webhook URL must use HTTPS");
|
|
664
647
|
if (webhookSecret.length < 8 || webhookSecret.length > 256) throw new Error("Zalo webhook secret must be 8-256 characters");
|
|
@@ -671,18 +654,8 @@ async function monitorZaloProvider(options) {
|
|
|
671
654
|
deliver: async (update, turnAdoptionLifecycle) => {
|
|
672
655
|
statusSink?.({ lastInboundAt: Date.now() });
|
|
673
656
|
await processUpdate({
|
|
657
|
+
...processingContext,
|
|
674
658
|
update,
|
|
675
|
-
token,
|
|
676
|
-
account,
|
|
677
|
-
config,
|
|
678
|
-
runtime,
|
|
679
|
-
core,
|
|
680
|
-
mediaMaxMb: effectiveMediaMaxMb,
|
|
681
|
-
canHostMedia,
|
|
682
|
-
webhookUrl: effectiveWebhookUrl,
|
|
683
|
-
webhookPath: path,
|
|
684
|
-
statusSink,
|
|
685
|
-
fetcher,
|
|
686
659
|
turnAdoptionLifecycle
|
|
687
660
|
});
|
|
688
661
|
}
|
|
@@ -746,19 +719,9 @@ async function monitorZaloProvider(options) {
|
|
|
746
719
|
else runtime.error?.(`[${account.accountId}] Zalo polling startup could not clear webhook: ${formatZaloError(err)}`);
|
|
747
720
|
}
|
|
748
721
|
startPollingLoop({
|
|
749
|
-
|
|
750
|
-
account,
|
|
751
|
-
config,
|
|
752
|
-
runtime,
|
|
753
|
-
core,
|
|
754
|
-
canHostMedia,
|
|
755
|
-
webhookUrl: effectiveWebhookUrl,
|
|
756
|
-
webhookPath: effectiveWebhookPath,
|
|
722
|
+
...processingContext,
|
|
757
723
|
abortSignal,
|
|
758
|
-
isStopped: () => stopped
|
|
759
|
-
mediaMaxMb: effectiveMediaMaxMb,
|
|
760
|
-
statusSink,
|
|
761
|
-
fetcher
|
|
724
|
+
isStopped: () => stopped
|
|
762
725
|
});
|
|
763
726
|
await waitForAbortSignal(abortSignal);
|
|
764
727
|
} catch (err) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ZaloWebhookPayloadError } from "./webhook-spool-
|
|
1
|
+
import { ZaloWebhookPayloadError } from "./webhook-spool-DejV9YSc.mjs";
|
|
2
2
|
import { resolveClientIp } from "openclaw/plugin-sdk/core";
|
|
3
3
|
import { WEBHOOK_ANOMALY_COUNTER_DEFAULTS, WEBHOOK_RATE_LIMIT_DEFAULTS, applyBasicWebhookRequestGuards, createFixedWindowRateLimiter, createWebhookAnomalyTracker, registerWebhookTarget, registerWebhookTargetWithPluginRoute, resolveWebhookTargetWithAuthOrRejectSync, withResolvedWebhookRequestPipeline } from "openclaw/plugin-sdk/webhook-ingress";
|
|
4
4
|
import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { d as resolveZaloAccount, f as resolveZaloToken } from "./setup-core-
|
|
1
|
+
import { d as resolveZaloAccount, f as resolveZaloToken } from "./setup-core-BohTbM6i.mjs";
|
|
2
2
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
3
3
|
import { stripChannelTargetPrefix, stripTargetKindPrefix } from "openclaw/plugin-sdk/core";
|
|
4
4
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
5
|
+
import { captureEffectAuthority, makeProxyFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
5
6
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
6
7
|
import { assertOkOrThrowProviderError, readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
|
|
7
8
|
import { resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
8
|
-
import { makeProxyFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
9
9
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
10
10
|
//#region extensions/zalo/src/timeouts.ts
|
|
11
11
|
const ZALO_DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
@@ -58,8 +58,10 @@ async function callZaloApi(method, token, body, options) {
|
|
|
58
58
|
body: body ? JSON.stringify(body) : void 0,
|
|
59
59
|
signal: controller.signal
|
|
60
60
|
};
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
const response = await captureEffectAuthority().initiate(() => {
|
|
62
|
+
options?.assertDirectAdapterHandoff?.();
|
|
63
|
+
return fetcher(url, request);
|
|
64
|
+
});
|
|
63
65
|
await assertOkOrThrowProviderError(response, `zalo.${method}`);
|
|
64
66
|
const data = await readProviderJsonResponse(response, `zalo.${method}`);
|
|
65
67
|
if (!data.ok) throw new ZaloApiError(data.description ?? `Zalo API error: ${method}`, data.error_code, data.description);
|
|
@@ -3,7 +3,7 @@ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/acco
|
|
|
3
3
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { resolveAccountEntry } from "openclaw/plugin-sdk/routing";
|
|
5
5
|
import { tryReadSecretFileSync } from "openclaw/plugin-sdk/secret-file-runtime";
|
|
6
|
-
import {
|
|
6
|
+
import { resolveSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
7
7
|
import { createChannelDmPolicy } from "openclaw/plugin-sdk/channel-dm-policy";
|
|
8
8
|
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
9
9
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, createDelegatedSetupWizardProxy, createPatchedAccountSetupAdapter, createSetupInputPresenceValidator, createSetupTranslator, formatDocsLink, mergeAllowFromEntries, normalizeAccountId as normalizeAccountId$1, patchScopedAccountConfig, patchTopLevelChannelConfigSection, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
|
|
@@ -25,7 +25,7 @@ function resolveZaloToken(config, accountId, options) {
|
|
|
25
25
|
const resolvedAccountId = normalizeAccountId(accountId ?? config?.defaultAccount);
|
|
26
26
|
const isDefaultAccount = resolvedAccountId === DEFAULT_ACCOUNT_ID;
|
|
27
27
|
const baseConfig = config;
|
|
28
|
-
const accountConfig = resolveAccountEntry(baseConfig?.accounts,
|
|
28
|
+
const accountConfig = resolveAccountEntry(baseConfig?.accounts, resolvedAccountId);
|
|
29
29
|
const accountHasBotToken = Boolean(accountConfig && Object.hasOwn(accountConfig, "botToken"));
|
|
30
30
|
if (accountConfig && accountHasBotToken) {
|
|
31
31
|
const token = resolveSecretInputString({
|
|
@@ -261,4 +261,4 @@ function createZaloSetupWizardProxy(loadWizard) {
|
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
263
|
//#endregion
|
|
264
|
-
export { noteZaloTokenHelp as a, isZaloAccountConfigured as c, resolveZaloAccount as d, resolveZaloToken as f, zaloSetupContract as i, listZaloAccountIds as l,
|
|
264
|
+
export { noteZaloTokenHelp as a, isZaloAccountConfigured as c, resolveZaloAccount as d, resolveZaloToken as f, zaloSetupContract as i, listZaloAccountIds as l, zaloDmPolicy as n, promptZaloAllowFrom as o, zaloSetupAdapter as r, inspectZaloAccount as s, createZaloSetupWizardProxy as t, resolveDefaultZaloAccountId as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as noteZaloTokenHelp, n as zaloDmPolicy, o as promptZaloAllowFrom, s as inspectZaloAccount } from "./setup-core-
|
|
1
|
+
import { a as noteZaloTokenHelp, n as zaloDmPolicy, o as promptZaloAllowFrom, s as inspectZaloAccount } from "./setup-core-BohTbM6i.mjs";
|
|
2
2
|
import { DEFAULT_ACCOUNT_ID, buildSingleChannelSecretPromptState, createSetupTranslator, createStandardChannelSetupStatus, hasConfiguredSecretInput, patchTopLevelChannelConfigSection, promptSingleChannelSecretInput, runSingleChannelSecretStep } from "openclaw/plugin-sdk/setup";
|
|
3
3
|
//#region \0rolldown/runtime.js
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as getZaloRuntime } from "./runtime-Dfhzt7qb.mjs";
|
|
2
|
-
import { n as ZaloApiError } from "./send-
|
|
2
|
+
import { n as ZaloApiError } from "./send-K3VH6hzV.mjs";
|
|
3
3
|
import { DEFAULT_INGRESS_ADOPTION_STALL_MS, DEFAULT_INGRESS_RETRY_MAX_ATTEMPTS, bindIngressLifecycleToReplyOptions, createChannelIngressError, createChannelIngressMonitor } from "openclaw/plugin-sdk/channel-outbound";
|
|
4
4
|
import { normalizeNullableString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { z } from "zod";
|
package/dist/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as zaloDmPolicy, r as zaloSetupAdapter, t as createZaloSetupWizardProxy } from "./.setup/setup-core-
|
|
2
|
-
import { t as zaloPlugin } from "./.setup/channel-
|
|
1
|
+
import { n as zaloDmPolicy, r as zaloSetupAdapter, t as createZaloSetupWizardProxy } from "./.setup/setup-core-BohTbM6i.mjs";
|
|
2
|
+
import { t as zaloPlugin } from "./.setup/channel-BDoyUcaX.mjs";
|
|
3
3
|
import { n as resolveZaloRuntimeGroupPolicy } from "./.setup/group-access-Blsyu-ot.mjs";
|
|
4
4
|
import { zaloSetupWizard } from "./setup-api.js";
|
|
5
5
|
export { createZaloSetupWizardProxy, resolveZaloRuntimeGroupPolicy, zaloDmPolicy, zaloPlugin, zaloSetupAdapter, zaloSetupWizard };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as zaloPlugin } from "./.setup/channel-
|
|
1
|
+
import { t as zaloPlugin } from "./.setup/channel-BDoyUcaX.mjs";
|
|
2
2
|
export { zaloPlugin };
|
package/dist/setup-api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as zaloDmPolicy, r as zaloSetupAdapter, t as createZaloSetupWizardProxy } from "./.setup/setup-core-
|
|
1
|
+
import { n as zaloDmPolicy, r as zaloSetupAdapter, t as createZaloSetupWizardProxy } from "./.setup/setup-core-BohTbM6i.mjs";
|
|
2
2
|
import { n as resolveZaloRuntimeGroupPolicy } from "./.setup/group-access-Blsyu-ot.mjs";
|
|
3
3
|
import { loadBundledEntryExportSync } from "openclaw/plugin-sdk/channel-entry-contract";
|
|
4
4
|
//#region extensions/zalo/setup-api.ts
|
package/dist/setup-entry.js
CHANGED
|
@@ -4,7 +4,7 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
var setup_entry_default = defineBundledChannelSetupEntry({
|
|
5
5
|
importMetaUrl: import.meta.url,
|
|
6
6
|
plugin: {
|
|
7
|
-
specifier: fileURLToPath(new URL(".setup/api-
|
|
7
|
+
specifier: fileURLToPath(new URL(".setup/api-DcyxnTMW.mjs", import.meta.url).href),
|
|
8
8
|
exportName: "zaloPlugin"
|
|
9
9
|
},
|
|
10
10
|
secrets: {
|
package/dist/setup-surface.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as zaloSetupWizard } from "./.setup/setup-surface-
|
|
2
|
-
import { r as zaloSetupAdapter } from "./.setup/setup-core-
|
|
1
|
+
import { n as zaloSetupWizard } from "./.setup/setup-surface-Bzs4Hwk9.mjs";
|
|
2
|
+
import { r as zaloSetupAdapter } from "./.setup/setup-core-BohTbM6i.mjs";
|
|
3
3
|
export { zaloSetupAdapter, zaloSetupWizard };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/zalo",
|
|
3
|
-
"version": "2026.10.2",
|
|
3
|
+
"version": "2026.10.5-beta.2",
|
|
4
4
|
"description": "OpenClaw Zalo channel plugin for bot and webhook chats.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"openclaw": ">=2026.10.2"
|
|
11
|
+
"openclaw": ">=2026.10.5-beta.2"
|
|
12
12
|
},
|
|
13
13
|
"peerDependenciesMeta": {
|
|
14
14
|
"openclaw": {
|
|
@@ -83,10 +83,10 @@
|
|
|
83
83
|
"minHostVersion": ">=2026.9.8"
|
|
84
84
|
},
|
|
85
85
|
"compat": {
|
|
86
|
-
"pluginApi": ">=2026.10.2"
|
|
86
|
+
"pluginApi": ">=2026.10.5-beta.2"
|
|
87
87
|
},
|
|
88
88
|
"build": {
|
|
89
|
-
"openclawVersion": "2026.10.2"
|
|
89
|
+
"openclawVersion": "2026.10.5-beta.2"
|
|
90
90
|
},
|
|
91
91
|
"release": {
|
|
92
92
|
"publishToClawHub": true,
|