@openclaw/zalo 2026.8.1-beta.3 → 2026.8.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/{actions.runtime-DUY9_6Ss.js → actions.runtime-Bw8qKwdO.js} +1 -1
- package/dist/api.js +2 -2
- package/dist/{channel-Vdxu1Y3k.js → channel-D4w53_mh.js} +12 -9
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-UD-M7eDb.js → channel.runtime-CcYsZxPw.js} +5 -5
- package/dist/{monitor-JdVVhnCm.js → monitor-BjoKVU7z.js} +13 -14
- package/dist/{monitor.webhook-cl1sV6j0.js → monitor.webhook-B5RaWvFf.js} +3 -3
- package/dist/{runtime-api-BNim5FCa.js → runtime-api-CN6fYNQK.js} +1 -1
- package/dist/runtime-api.js +1 -1
- package/dist/{send-DVMIplpy.js → send-w8RLKyQx.js} +22 -28
- package/dist/setup-api.js +1 -1
- package/dist/{setup-core-CcCJ1E26.js → setup-core-DgD3ai3p.js} +15 -4
- package/dist/{setup-surface-CIpp_MDf.js → setup-surface-D5xgPinc.js} +1 -1
- package/dist/setup-surface.js +2 -2
- package/dist/{webhook-spool-Bdnu4GjY.js → webhook-spool-2fDB_7Qy.js} +4 -3
- package/openclaw.plugin.json +5 -0
- package/package.json +5 -6
package/dist/api.js
CHANGED
|
@@ -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-DgD3ai3p.js";
|
|
2
|
+
import { t as zaloPlugin } from "./channel-D4w53_mh.js";
|
|
3
3
|
import { n as resolveZaloRuntimeGroupPolicy } from "./group-access-8qHRzDHx.js";
|
|
4
4
|
import { zaloSetupWizard } from "./setup-api.js";
|
|
5
5
|
export { createZaloSetupWizardProxy, resolveZaloRuntimeGroupPolicy, zaloDmPolicy, zaloPlugin, zaloSetupAdapter, zaloSetupWizard };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as inspectZaloAccount, d as resolveZaloAccount, i as zaloSetupContract, l as
|
|
1
|
+
import { c as inspectZaloAccount, d as resolveDefaultZaloAccountId, f as resolveZaloAccount, i as zaloSetupContract, l as isZaloAccountConfigured, m as buildSecretInputSchema, t as createZaloSetupWizardProxy, u as listZaloAccountIds } from "./setup-core-DgD3ai3p.js";
|
|
2
2
|
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-Cpsqe5Cv.js";
|
|
3
3
|
import { describeWebhookAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
4
4
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
@@ -24,7 +24,7 @@ import { z } from "zod";
|
|
|
24
24
|
import { buildChannelOutboundSessionRoute, stripChannelTargetPrefix, stripTargetKindPrefix } from "openclaw/plugin-sdk/core";
|
|
25
25
|
import { coerceStatusIssueAccountId, readStatusIssueFields } from "openclaw/plugin-sdk/extension-shared";
|
|
26
26
|
//#region extensions/zalo/src/actions.ts
|
|
27
|
-
const loadZaloActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-
|
|
27
|
+
const loadZaloActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-Bw8qKwdO.js"), "zaloActionsRuntime");
|
|
28
28
|
const providerId = "zalo";
|
|
29
29
|
const ZALO_ACTIONS = /* @__PURE__ */ new Set(["send"]);
|
|
30
30
|
function listEnabledAccounts(cfg, accountId) {
|
|
@@ -89,7 +89,9 @@ const zaloApprovalAuth = createChannelApprovalAuth({
|
|
|
89
89
|
},
|
|
90
90
|
normalizeApprover: normalizeZaloApproverId
|
|
91
91
|
}).approvalAuth;
|
|
92
|
-
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region extensions/zalo/src/config-schema.ts
|
|
94
|
+
const zaloAccountSchema = z.object({
|
|
93
95
|
name: z.string().optional(),
|
|
94
96
|
enabled: z.boolean().optional(),
|
|
95
97
|
configWrites: z.boolean().optional(),
|
|
@@ -106,7 +108,11 @@ const ZaloConfigSchema = buildMultiAccountChannelSchema(z.object({
|
|
|
106
108
|
mediaMaxMb: z.number().optional(),
|
|
107
109
|
proxy: z.string().optional(),
|
|
108
110
|
responsePrefix: z.string().optional()
|
|
109
|
-
})
|
|
111
|
+
});
|
|
112
|
+
const ZaloConfigSchema = buildMultiAccountChannelSchema(zaloAccountSchema.extend({ historyLimit: z.number().int().min(0).optional() }), {
|
|
113
|
+
accountSchema: zaloAccountSchema,
|
|
114
|
+
accountsMode: "catchall"
|
|
115
|
+
});
|
|
110
116
|
//#endregion
|
|
111
117
|
//#region extensions/zalo/src/session-route.ts
|
|
112
118
|
function resolveZaloOutboundSessionRoute(params) {
|
|
@@ -180,8 +186,8 @@ function looksLikeZaloChatId(raw, normalized) {
|
|
|
180
186
|
const target = normalizeZaloMessagingTarget(normalized ?? raw);
|
|
181
187
|
return Boolean(target);
|
|
182
188
|
}
|
|
183
|
-
const loadZaloChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-
|
|
184
|
-
const zaloSetupWizard = createZaloSetupWizardProxy(async () => (await import("./setup-surface-
|
|
189
|
+
const loadZaloChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-CcYsZxPw.js"));
|
|
190
|
+
const zaloSetupWizard = createZaloSetupWizardProxy(async () => (await import("./setup-surface-D5xgPinc.js").then((n) => n.t)).zaloSetupWizard);
|
|
185
191
|
const zaloTextChunkLimit = 2e3;
|
|
186
192
|
async function sendZaloDelivery(ctx) {
|
|
187
193
|
const result = await (await loadZaloChannelRuntime()).sendZaloText({
|
|
@@ -214,9 +220,6 @@ const zaloMessageAdapter = defineChannelMessageAdapter({
|
|
|
214
220
|
media: sendZaloDelivery
|
|
215
221
|
}
|
|
216
222
|
});
|
|
217
|
-
function isZaloAccountConfigured(account) {
|
|
218
|
-
return account.tokenStatus ? account.tokenStatus !== "missing" : Boolean(account.token?.trim());
|
|
219
|
-
}
|
|
220
223
|
const zaloConfigAdapter = createScopedChannelConfigAdapter({
|
|
221
224
|
sectionKey: "zalo",
|
|
222
225
|
listAccountIds: listZaloAccountIds,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as zaloPlugin } from "./channel-
|
|
1
|
+
import { t as zaloPlugin } from "./channel-D4w53_mh.js";
|
|
2
2
|
export { zaloPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as getMe, n as resolveZaloProxyFetch, r as ZaloApiError, t as sendMessageZalo } from "./send-
|
|
1
|
+
import { h as normalizeSecretInputString } from "./setup-core-DgD3ai3p.js";
|
|
2
|
+
import { n as PAIRING_APPROVED_MESSAGE } from "./runtime-api-CN6fYNQK.js";
|
|
3
|
+
import { a as getMe, n as resolveZaloProxyFetch, r as ZaloApiError, t as sendMessageZalo } from "./send-w8RLKyQx.js";
|
|
4
4
|
import { createAccountStatusSink } from "openclaw/plugin-sdk/channel-outbound";
|
|
5
5
|
import { runChannelProbe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
6
6
|
//#region extensions/zalo/src/probe.ts
|
|
@@ -35,7 +35,7 @@ async function probeZalo(token, timeoutMs = 5e3, fetcher) {
|
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region extensions/zalo/src/channel.runtime.ts
|
|
37
37
|
async function notifyZaloPairingApproval(params) {
|
|
38
|
-
const { resolveZaloAccount } = await import("./setup-core-
|
|
38
|
+
const { resolveZaloAccount } = await import("./setup-core-DgD3ai3p.js").then((n) => n.s);
|
|
39
39
|
const account = resolveZaloAccount({ cfg: params.cfg });
|
|
40
40
|
if (!account.token) throw new Error("Zalo token not configured");
|
|
41
41
|
await sendMessageZalo(params.id, PAIRING_APPROVED_MESSAGE, { token: account.token });
|
|
@@ -69,7 +69,7 @@ async function startZaloGatewayAccount(ctx) {
|
|
|
69
69
|
setStatus: ctx.setStatus
|
|
70
70
|
});
|
|
71
71
|
ctx.log?.info(`[${account.accountId}] starting provider${zaloBotLabel} mode=${mode}`);
|
|
72
|
-
const { monitorZaloProvider } = await import("./monitor-
|
|
72
|
+
const { monitorZaloProvider } = await import("./monitor-BjoKVU7z.js");
|
|
73
73
|
return monitorZaloProvider({
|
|
74
74
|
token,
|
|
75
75
|
account,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as resolveZaloRuntimeGroupPolicy, t as normalizeZaloAllowEntry } from "./group-access-8qHRzDHx.js";
|
|
2
|
-
import {
|
|
3
|
-
import { c as sendChatAction, d as setWebhook, f as ZALO_OUTBOUND_MEDIA_TTL_MS, i as deleteWebhook, l as sendMessage, n as resolveZaloProxyFetch, o as getUpdates, r as ZaloApiError, s as getWebhookInfo, u as sendPhoto } from "./send-
|
|
2
|
+
import { X as getZaloRuntime } from "./runtime-api-CN6fYNQK.js";
|
|
3
|
+
import { c as sendChatAction, d as setWebhook, f as ZALO_OUTBOUND_MEDIA_TTL_MS, i as deleteWebhook, l as sendMessage, n as resolveZaloProxyFetch, o as getUpdates, r as ZaloApiError, s as getWebhookInfo, u as sendPhoto } from "./send-w8RLKyQx.js";
|
|
4
4
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
5
5
|
import { createLazyRuntimeModule, createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
6
6
|
import { deliverTextOrMediaReply, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
@@ -174,8 +174,8 @@ function resolveZaloTimestampMs(date) {
|
|
|
174
174
|
if (!date) return;
|
|
175
175
|
return date >= UNIX_MILLISECONDS_THRESHOLD ? date : date * 1e3;
|
|
176
176
|
}
|
|
177
|
-
const loadZaloWebhookRuntime = createLazyRuntimeNamedExport(() => import("./monitor.webhook-
|
|
178
|
-
const loadZaloWebhookIngressRuntime = createLazyRuntimeNamedExport(() => import("./webhook-spool-
|
|
177
|
+
const loadZaloWebhookRuntime = createLazyRuntimeNamedExport(() => import("./monitor.webhook-B5RaWvFf.js"), "zaloWebhookRuntime");
|
|
178
|
+
const loadZaloWebhookIngressRuntime = createLazyRuntimeNamedExport(() => import("./webhook-spool-2fDB_7Qy.js"), "zaloWebhookIngressRuntime");
|
|
179
179
|
const loadZaloWebhookModule = createLazyRuntimeModule(async () => ({
|
|
180
180
|
...await loadZaloWebhookRuntime(),
|
|
181
181
|
...await loadZaloWebhookIngressRuntime()
|
|
@@ -323,9 +323,7 @@ async function processUpdate(params) {
|
|
|
323
323
|
case "message.sticker.received":
|
|
324
324
|
logVerbose(core, runtime, `[${account.accountId}] Received sticker from ${message.from.id}`);
|
|
325
325
|
break;
|
|
326
|
-
case "message.unsupported.received":
|
|
327
|
-
logVerbose(core, runtime, `[${account.accountId}] Received unsupported message type from ${message.from.id}`);
|
|
328
|
-
break;
|
|
326
|
+
case "message.unsupported.received": logVerbose(core, runtime, `[${account.accountId}] Received unsupported message type from ${message.from.id}`);
|
|
329
327
|
}
|
|
330
328
|
}
|
|
331
329
|
async function handleTextMessage(params) {
|
|
@@ -677,15 +675,16 @@ async function deliverZaloReply(params) {
|
|
|
677
675
|
});
|
|
678
676
|
} catch (error) {
|
|
679
677
|
if (!visibleReplySent) throw error;
|
|
678
|
+
const receipt = createMessageReceiptFromOutboundResults({
|
|
679
|
+
results: acceptedMessageIds.map((messageId) => ({
|
|
680
|
+
channel: "zalo",
|
|
681
|
+
messageId
|
|
682
|
+
})),
|
|
683
|
+
kind: reply.hasMedia ? "media" : "text"
|
|
684
|
+
});
|
|
680
685
|
throw createChannelPartialDeliveryError(error, {
|
|
681
686
|
messageIds: acceptedMessageIds,
|
|
682
|
-
receipt
|
|
683
|
-
results: acceptedMessageIds.map((messageId) => ({
|
|
684
|
-
channel: "zalo",
|
|
685
|
-
messageId
|
|
686
|
-
})),
|
|
687
|
-
kind: reply.hasMedia ? "media" : "text"
|
|
688
|
-
}),
|
|
687
|
+
receipt,
|
|
689
688
|
visibleReplySent: true
|
|
690
689
|
});
|
|
691
690
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ZaloWebhookPayloadError } from "./webhook-spool-
|
|
1
|
+
import { L as registerWebhookTarget, R as registerWebhookTargetWithPluginRoute, U as resolveWebhookTargetWithAuthOrRejectSync, Y as withResolvedWebhookRequestPipeline, i as WEBHOOK_RATE_LIMIT_DEFAULTS, r as WEBHOOK_ANOMALY_COUNTER_DEFAULTS, s as applyBasicWebhookRequestGuards, v as createFixedWindowRateLimiter, y as createWebhookAnomalyTracker, z as resolveClientIp } from "./runtime-api-CN6fYNQK.js";
|
|
2
|
+
import { ZaloWebhookPayloadError } from "./webhook-spool-2fDB_7Qy.js";
|
|
3
3
|
import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
4
4
|
import { readWebhookBodyOrReject } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
5
5
|
//#region extensions/zalo/src/monitor.webhook.ts
|
|
@@ -90,7 +90,7 @@ async function handleZaloWebhookRequest(req, res) {
|
|
|
90
90
|
const body = await readWebhookBodyOrReject({
|
|
91
91
|
req,
|
|
92
92
|
res,
|
|
93
|
-
maxBytes:
|
|
93
|
+
maxBytes: 1048576,
|
|
94
94
|
timeoutMs: 3e4,
|
|
95
95
|
invalidBodyMessage: "Bad Request"
|
|
96
96
|
});
|
|
@@ -19,4 +19,4 @@ const { setRuntime: setZaloRuntime, getRuntime: getZaloRuntime } = createPluginR
|
|
|
19
19
|
errorMessage: "Zalo runtime not initialized"
|
|
20
20
|
});
|
|
21
21
|
//#endregion
|
|
22
|
-
export {
|
|
22
|
+
export { normalizeAccountId$1 as A, resolveDefaultGroupPolicy$1 as B, hasConfiguredSecretInput$1 as C, logTypingFailure$1 as D, jsonResult as E, readStringParam as F, sendPayloadWithChunkedTextAndMedia$1 as G, resolveWebhookPath$1 as H, registerPluginHttpRoute$1 as I, warnMissingProviderGroupPolicyFallbackOnce$1 as J, setTopLevelChannelDmPolicyWithAllowFrom as K, registerWebhookTarget as L, normalizeSecretInputString as M, promptSingleChannelSecretInput$1 as N, mergeAllowFromEntries$1 as O, readJsonWebhookBodyOrReject as P, registerWebhookTargetWithPluginRoute as R, formatPairingApproveHint as S, isNumericTargetId as T, resolveWebhookTargetWithAuthOrRejectSync as U, resolveOpenProviderRuntimeGroupPolicy$1 as V, runSingleChannelSecretStep$1 as W, getZaloRuntime as X, withResolvedWebhookRequestPipeline as Y, setZaloRuntime as Z, createDedupeCache as _, addWildcardAllowFrom 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, normalizeResolvedSecretInputString as j, migrateBaseNameToDefaultAccount as k, buildBaseAccountStatusSnapshot as l, chunkTextForOutbound$1 as m, PAIRING_APPROVED_MESSAGE as n, applyAccountNameToChannelSection as o, buildTokenChannelStatusSummary$1 as p, waitForAbortSignal as q, WEBHOOK_ANOMALY_COUNTER_DEFAULTS as r, applyBasicWebhookRequestGuards as s, DEFAULT_ACCOUNT_ID$1 as t, buildChannelConfigSchema as u, createFixedWindowRateLimiter as v, isNormalizedSenderAllowed as w, formatAllowFromLowercase$1 as x, createWebhookAnomalyTracker as y, resolveClientIp as z };
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as normalizeAccountId, B as resolveDefaultGroupPolicy, C as hasConfiguredSecretInput, D as logTypingFailure, E as jsonResult, F as readStringParam, G as sendPayloadWithChunkedTextAndMedia, H as resolveWebhookPath, I as registerPluginHttpRoute, J as warnMissingProviderGroupPolicyFallbackOnce, K as setTopLevelChannelDmPolicyWithAllowFrom, L as registerWebhookTarget, M as normalizeSecretInputString, N as promptSingleChannelSecretInput, O as mergeAllowFromEntries, P as readJsonWebhookBodyOrReject, R as registerWebhookTargetWithPluginRoute, S as formatPairingApproveHint, T as isNumericTargetId, U as resolveWebhookTargetWithAuthOrRejectSync, V as resolveOpenProviderRuntimeGroupPolicy, W as runSingleChannelSecretStep, Y as withResolvedWebhookRequestPipeline, Z as setZaloRuntime, _ 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 normalizeResolvedSecretInputString, k as migrateBaseNameToDefaultAccount, l as buildBaseAccountStatusSnapshot, m as chunkTextForOutbound, n as PAIRING_APPROVED_MESSAGE, o as applyAccountNameToChannelSection, p as buildTokenChannelStatusSummary, q as waitForAbortSignal, r as WEBHOOK_ANOMALY_COUNTER_DEFAULTS, s as applyBasicWebhookRequestGuards, t as DEFAULT_ACCOUNT_ID, u as buildChannelConfigSchema, v as createFixedWindowRateLimiter, w as isNormalizedSenderAllowed, x as formatAllowFromLowercase, y as createWebhookAnomalyTracker, z as resolveClientIp } from "./runtime-api-CN6fYNQK.js";
|
|
2
2
|
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, formatAllowFromLowercase, formatPairingApproveHint, hasConfiguredSecretInput, isNormalizedSenderAllowed, isNumericTargetId, jsonResult, logTypingFailure, mergeAllowFromEntries, migrateBaseNameToDefaultAccount, normalizeAccountId, normalizeResolvedSecretInputString, normalizeSecretInputString, promptSingleChannelSecretInput, readJsonWebhookBodyOrReject, readStringParam, registerPluginHttpRoute, registerWebhookTarget, registerWebhookTargetWithPluginRoute, resolveClientIp, resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, resolveWebhookPath, resolveWebhookTargetWithAuthOrRejectSync, runSingleChannelSecretStep, sendPayloadWithChunkedTextAndMedia, setTopLevelChannelDmPolicyWithAllowFrom, setZaloRuntime, waitForAbortSignal, warnMissingProviderGroupPolicyFallbackOnce, withResolvedWebhookRequestPipeline };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as resolveZaloAccount, p as resolveZaloToken } from "./setup-core-DgD3ai3p.js";
|
|
2
2
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
3
3
|
import { stripChannelTargetPrefix, stripTargetKindPrefix } from "openclaw/plugin-sdk/core";
|
|
4
4
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -9,7 +9,7 @@ import { resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtim
|
|
|
9
9
|
import { makeProxyFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
10
10
|
//#region extensions/zalo/src/timeouts.ts
|
|
11
11
|
const ZALO_DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
12
|
-
const ZALO_OUTBOUND_MEDIA_TTL_MS =
|
|
12
|
+
const ZALO_OUTBOUND_MEDIA_TTL_MS = 12e4;
|
|
13
13
|
const ZALO_SEND_PHOTO_REQUEST_TIMEOUT_MS = 15e4;
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region extensions/zalo/src/api.ts
|
|
@@ -264,11 +264,26 @@ async function sendMessageZalo(chatId, text, options = {}) {
|
|
|
264
264
|
const resolved = resolveSendContextOrFailure(chatId, options);
|
|
265
265
|
if ("failure" in resolved) return resolved.failure;
|
|
266
266
|
const { context } = resolved;
|
|
267
|
-
if (options.mediaUrl && (options.mediaUrl.trim() || !text))
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
267
|
+
if (options.mediaUrl && (options.mediaUrl.trim() || !text)) {
|
|
268
|
+
const photoUrl = options.mediaUrl.trim();
|
|
269
|
+
if (!photoUrl) return {
|
|
270
|
+
ok: false,
|
|
271
|
+
error: "No photo URL provided",
|
|
272
|
+
receipt: createZaloSendReceipt({
|
|
273
|
+
chatId: context.chatId,
|
|
274
|
+
kind: "media"
|
|
275
|
+
})
|
|
276
|
+
};
|
|
277
|
+
const caption = text || options.caption;
|
|
278
|
+
return await runZaloSend("Failed to send photo", {
|
|
279
|
+
chatId: context.chatId,
|
|
280
|
+
kind: "media"
|
|
281
|
+
}, () => sendPhoto(context.token, {
|
|
282
|
+
chat_id: context.chatId,
|
|
283
|
+
photo: photoUrl,
|
|
284
|
+
caption: caption !== void 0 ? truncateUtf16Safe(caption, 2e3) : void 0
|
|
285
|
+
}, context.fetcher));
|
|
286
|
+
}
|
|
272
287
|
return await runZaloSend("Failed to send message", {
|
|
273
288
|
chatId: context.chatId,
|
|
274
289
|
kind: "text"
|
|
@@ -277,26 +292,5 @@ async function sendMessageZalo(chatId, text, options = {}) {
|
|
|
277
292
|
text: truncateUtf16Safe(text, 2e3)
|
|
278
293
|
}, context.fetcher));
|
|
279
294
|
}
|
|
280
|
-
async function sendPhotoZalo(chatId, photoUrl, options = {}) {
|
|
281
|
-
const resolved = resolveSendContextOrFailure(chatId, options);
|
|
282
|
-
if ("failure" in resolved) return resolved.failure;
|
|
283
|
-
const { context } = resolved;
|
|
284
|
-
if (!photoUrl?.trim()) return {
|
|
285
|
-
ok: false,
|
|
286
|
-
error: "No photo URL provided",
|
|
287
|
-
receipt: createZaloSendReceipt({
|
|
288
|
-
chatId: context.chatId,
|
|
289
|
-
kind: "media"
|
|
290
|
-
})
|
|
291
|
-
};
|
|
292
|
-
return await runZaloSend("Failed to send photo", {
|
|
293
|
-
chatId: context.chatId,
|
|
294
|
-
kind: "media"
|
|
295
|
-
}, () => (async () => sendPhoto(context.token, {
|
|
296
|
-
chat_id: context.chatId,
|
|
297
|
-
photo: photoUrl.trim(),
|
|
298
|
-
caption: options.caption !== void 0 ? truncateUtf16Safe(options.caption, 2e3) : void 0
|
|
299
|
-
}, context.fetcher))());
|
|
300
|
-
}
|
|
301
295
|
//#endregion
|
|
302
296
|
export { getMe as a, sendChatAction as c, setWebhook as d, ZALO_OUTBOUND_MEDIA_TTL_MS as f, deleteWebhook as i, sendMessage as l, resolveZaloProxyFetch as n, getUpdates as o, ZaloApiError as r, getWebhookInfo as s, sendMessageZalo as t, sendPhoto as u };
|
package/dist/setup-api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as zaloDmPolicy, r as zaloSetupAdapter, t as createZaloSetupWizardProxy } from "./setup-core-
|
|
1
|
+
import { n as zaloDmPolicy, r as zaloSetupAdapter, t as createZaloSetupWizardProxy } from "./setup-core-DgD3ai3p.js";
|
|
2
2
|
import { n as resolveZaloRuntimeGroupPolicy } from "./group-access-8qHRzDHx.js";
|
|
3
3
|
import { loadBundledEntryExportSync } from "openclaw/plugin-sdk/channel-entry-contract";
|
|
4
4
|
//#region extensions/zalo/setup-api.ts
|
|
@@ -93,6 +93,7 @@ function resolveZaloToken(config, accountId, options) {
|
|
|
93
93
|
//#region extensions/zalo/src/accounts.ts
|
|
94
94
|
var accounts_exports = /* @__PURE__ */ __exportAll({
|
|
95
95
|
inspectZaloAccount: () => inspectZaloAccount,
|
|
96
|
+
isZaloAccountConfigured: () => isZaloAccountConfigured,
|
|
96
97
|
listZaloAccountIds: () => listZaloAccountIds,
|
|
97
98
|
resolveDefaultZaloAccountId: () => resolveDefaultZaloAccountId,
|
|
98
99
|
resolveZaloAccount: () => resolveZaloAccount
|
|
@@ -129,10 +130,19 @@ function resolveZaloAccount(params) {
|
|
|
129
130
|
});
|
|
130
131
|
}
|
|
131
132
|
function inspectZaloAccount(params) {
|
|
132
|
-
|
|
133
|
+
const account = resolveZaloAccountWithMode({
|
|
133
134
|
...params,
|
|
134
135
|
mode: "inspect"
|
|
135
136
|
});
|
|
137
|
+
return {
|
|
138
|
+
...account,
|
|
139
|
+
configured: isZaloAccountConfigured(account),
|
|
140
|
+
mode: account.config.webhookUrl ? "webhook" : "polling",
|
|
141
|
+
dmPolicy: account.config.dmPolicy ?? "pairing"
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function isZaloAccountConfigured(account) {
|
|
145
|
+
return account.tokenStatus ? account.tokenStatus !== "missing" : Boolean(account.token?.trim());
|
|
136
146
|
}
|
|
137
147
|
//#endregion
|
|
138
148
|
//#region extensions/zalo/src/setup-allow-from.ts
|
|
@@ -153,7 +163,7 @@ async function promptZaloAllowFrom(params) {
|
|
|
153
163
|
cfg,
|
|
154
164
|
accountId
|
|
155
165
|
}).config.allowFrom ?? [];
|
|
156
|
-
const
|
|
166
|
+
const normalized = (await prompter.text({
|
|
157
167
|
message: t$1("wizard.zalo.allowFromPrompt"),
|
|
158
168
|
placeholder: "123456789",
|
|
159
169
|
initialValue: existingAllowFrom[0] ? String(existingAllowFrom[0]) : void 0,
|
|
@@ -162,7 +172,8 @@ async function promptZaloAllowFrom(params) {
|
|
|
162
172
|
if (!raw) return t$1("common.required");
|
|
163
173
|
if (!/^\d+$/.test(raw)) return t$1("wizard.zalo.allowFromNumeric");
|
|
164
174
|
}
|
|
165
|
-
})).trim()
|
|
175
|
+
})).trim();
|
|
176
|
+
const unique = mergeAllowFromEntries(existingAllowFrom, [normalized]);
|
|
166
177
|
if (accountId === DEFAULT_ACCOUNT_ID$1) return {
|
|
167
178
|
...cfg,
|
|
168
179
|
channels: {
|
|
@@ -283,4 +294,4 @@ function createZaloSetupWizardProxy(loadWizard) {
|
|
|
283
294
|
});
|
|
284
295
|
}
|
|
285
296
|
//#endregion
|
|
286
|
-
export { noteZaloTokenHelp as a, inspectZaloAccount as c,
|
|
297
|
+
export { noteZaloTokenHelp as a, inspectZaloAccount as c, resolveDefaultZaloAccountId as d, resolveZaloAccount as f, __exportAll as g, normalizeSecretInputString as h, zaloSetupContract as i, isZaloAccountConfigured as l, buildSecretInputSchema as m, zaloDmPolicy as n, promptZaloAllowFrom as o, resolveZaloToken as p, zaloSetupAdapter as r, accounts_exports as s, createZaloSetupWizardProxy as t, listZaloAccountIds as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as noteZaloTokenHelp, c as inspectZaloAccount,
|
|
1
|
+
import { a as noteZaloTokenHelp, c as inspectZaloAccount, g as __exportAll, n as zaloDmPolicy, o as promptZaloAllowFrom } from "./setup-core-DgD3ai3p.js";
|
|
2
2
|
import { DEFAULT_ACCOUNT_ID, buildSingleChannelSecretPromptState, createSetupTranslator, createStandardChannelSetupStatus, hasConfiguredSecretInput, promptSingleChannelSecretInput, runSingleChannelSecretStep } from "openclaw/plugin-sdk/setup";
|
|
3
3
|
//#region extensions/zalo/src/setup-surface.ts
|
|
4
4
|
var setup_surface_exports = /* @__PURE__ */ __exportAll({ zaloSetupWizard: () => zaloSetupWizard });
|
package/dist/setup-surface.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { r as zaloSetupAdapter } from "./setup-core-
|
|
2
|
-
import { n as zaloSetupWizard } from "./setup-surface-
|
|
1
|
+
import { r as zaloSetupAdapter } from "./setup-core-DgD3ai3p.js";
|
|
2
|
+
import { n as zaloSetupWizard } from "./setup-surface-D5xgPinc.js";
|
|
3
3
|
export { zaloSetupAdapter, zaloSetupWizard };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as ZaloApiError } from "./send-
|
|
1
|
+
import { X as getZaloRuntime } from "./runtime-api-CN6fYNQK.js";
|
|
2
|
+
import { r as ZaloApiError } from "./send-w8RLKyQx.js";
|
|
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";
|
|
@@ -125,8 +125,9 @@ function isZaloAuthenticationFailure(error) {
|
|
|
125
125
|
return false;
|
|
126
126
|
}
|
|
127
127
|
function createZaloWebhookIngress(options) {
|
|
128
|
+
const queue = options.queue ?? getZaloRuntime().state.openChannelIngressQueue({ accountId: options.accountId });
|
|
128
129
|
const monitor = createChannelIngressMonitor({
|
|
129
|
-
queue
|
|
130
|
+
queue,
|
|
130
131
|
inspect: (rawEvent) => inspectZaloWebhookEvent(rawEvent),
|
|
131
132
|
payload: {
|
|
132
133
|
storage: "raw-event",
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/zalo",
|
|
3
|
-
"version": "2026.8.
|
|
3
|
+
"version": "2026.8.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.8.
|
|
11
|
+
"openclaw": ">=2026.8.2"
|
|
12
12
|
},
|
|
13
13
|
"peerDependenciesMeta": {
|
|
14
14
|
"openclaw": {
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
"configuredState": {
|
|
29
29
|
"env": {
|
|
30
30
|
"anyOf": [
|
|
31
|
-
"ZALO_BOT_TOKEN"
|
|
32
|
-
"ZALO_WEBHOOK_SECRET"
|
|
31
|
+
"ZALO_BOT_TOKEN"
|
|
33
32
|
]
|
|
34
33
|
}
|
|
35
34
|
},
|
|
@@ -83,10 +82,10 @@
|
|
|
83
82
|
"minHostVersion": ">=2026.4.10"
|
|
84
83
|
},
|
|
85
84
|
"compat": {
|
|
86
|
-
"pluginApi": ">=2026.8.
|
|
85
|
+
"pluginApi": ">=2026.8.2"
|
|
87
86
|
},
|
|
88
87
|
"build": {
|
|
89
|
-
"openclawVersion": "2026.8.
|
|
88
|
+
"openclawVersion": "2026.8.2"
|
|
90
89
|
},
|
|
91
90
|
"release": {
|
|
92
91
|
"publishToClawHub": true,
|