@openclaw/zalo 2026.7.2-beta.7 → 2026.7.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { t as sendMessageZalo } from "./send-BUvbbedq.js";
1
+ import { t as sendMessageZalo } from "./send-CNCw5UOt.mjs";
2
2
  //#region extensions/zalo/src/actions.runtime.ts
3
3
  const zaloActionsRuntime = { sendMessageZalo };
4
4
  //#endregion
@@ -0,0 +1,6 @@
1
+ import { n as zaloDmPolicy, r as zaloSetupAdapter, t as createZaloSetupWizardProxy } from "./setup-core-BLbVCFpT.mjs";
2
+ import { t as zaloPlugin } from "./channel-ChIucoCG.mjs";
3
+ import { n as resolveZaloRuntimeGroupPolicy } from "./group-access-8qHRzDHx.mjs";
4
+ import { zaloSetupWizard } from "../setup-api.js";
5
+ import "../api.js";
6
+ export { createZaloSetupWizardProxy, resolveZaloRuntimeGroupPolicy, zaloDmPolicy, zaloPlugin, zaloSetupAdapter, zaloSetupWizard };
@@ -1,5 +1,5 @@
1
- import { c as inspectZaloAccount, d as resolveZaloAccount, i as zaloSetupContract, l as listZaloAccountIds, p as buildSecretInputSchema, r as zaloSetupAdapter, t as createZaloSetupWizardProxy, u as resolveDefaultZaloAccountId } from "./setup-core-LzhuTlsD.js";
2
- import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-Bxvjh0Hq.js";
1
+ import { c as listZaloAccountIds, f as buildSecretInputSchema, l as resolveDefaultZaloAccountId, r as zaloSetupAdapter, s as listEnabledZaloAccounts, t as createZaloSetupWizardProxy, u as resolveZaloAccount } from "./setup-core-BLbVCFpT.mjs";
2
+ import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-Bno_huZF.mjs";
3
3
  import { describeWebhookAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
4
4
  import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
5
5
  import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
@@ -7,44 +7,40 @@ import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter, createSco
7
7
  import { buildChannelConfigSchema, createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
8
8
  import { defineChannelMessageAdapter } from "openclaw/plugin-sdk/channel-outbound";
9
9
  import { buildOpenGroupPolicyRestrictSendersWarning, buildOpenGroupPolicyWarning, createOpenProviderGroupPolicyWarningCollector } from "openclaw/plugin-sdk/channel-policy";
10
- import { createAttachedChannelResultAdapter, createEmptyChannelResult } from "openclaw/plugin-sdk/channel-send-result";
10
+ import { createEmptyChannelResult, createRawChannelSendResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
11
11
  import { buildTokenChannelStatusSummary } from "openclaw/plugin-sdk/channel-status";
12
12
  import { createStaticReplyToModeResolver } from "openclaw/plugin-sdk/conversation-runtime";
13
13
  import { createChannelDirectoryAdapter, listResolvedDirectoryUserEntriesFromAllowFrom } from "openclaw/plugin-sdk/directory-runtime";
14
14
  import { createLazyRuntimeModule, createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
15
15
  import { sendPayloadWithChunkedTextAndMedia } from "openclaw/plugin-sdk/reply-payload";
16
- import { createComputedAccountStatusAdapter, createDefaultChannelRuntimeState, standardDmPolicyOpenIssue } from "openclaw/plugin-sdk/status-helpers";
17
- import { chunkTextForOutbound, sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
16
+ import { createComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
17
+ import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
18
18
  import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
19
19
  import { buildChannelOutboundSessionRoute, stripChannelTargetPrefix, stripTargetKindPrefix } from "openclaw/plugin-sdk/core";
20
20
  import { jsonResult, readStringParam } from "openclaw/plugin-sdk/channel-actions";
21
21
  import { extractToolSend } from "openclaw/plugin-sdk/tool-send";
22
- import { createChannelApprovalAuth } from "openclaw/plugin-sdk/approval-auth-runtime";
23
- import { AllowFromListSchema, DmPolicySchema, GroupPolicySchema, MarkdownConfigSchema, buildMultiAccountChannelSchema } from "openclaw/plugin-sdk/channel-config-schema";
22
+ import { createResolvedApproverActionAuthAdapter, resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
23
+ import { AllowFromListSchema, DmPolicySchema, GroupPolicySchema, MarkdownConfigSchema, buildCatchallMultiAccountChannelSchema } from "openclaw/plugin-sdk/channel-config-schema";
24
24
  import { z } from "zod";
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-BYBjeo4Q.js"), "zaloActionsRuntime");
27
+ const loadZaloActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-C0KWbUJu.mjs"), "zaloActionsRuntime");
28
28
  const providerId = "zalo";
29
- const ZALO_ACTIONS = /* @__PURE__ */ new Set(["send"]);
30
29
  function listEnabledAccounts(cfg, accountId) {
31
- return (accountId ? [inspectZaloAccount({
30
+ return (accountId ? [resolveZaloAccount({
32
31
  cfg,
33
32
  accountId
34
- })] : listZaloAccountIds(cfg).map((listedAccountId) => inspectZaloAccount({
35
- cfg,
36
- accountId: listedAccountId
37
- }))).filter((account) => account.enabled && account.tokenStatus === "available");
33
+ })] : listEnabledZaloAccounts(cfg)).filter((account) => account.enabled && account.tokenSource !== "none");
38
34
  }
39
35
  const zaloMessageActions = {
40
36
  describeMessageTool: ({ cfg, accountId }) => {
41
37
  if (listEnabledAccounts(cfg, accountId).length === 0) return null;
38
+ const actions = /* @__PURE__ */ new Set(["send"]);
42
39
  return {
43
- actions: Array.from(ZALO_ACTIONS),
40
+ actions: Array.from(actions),
44
41
  capabilities: []
45
42
  };
46
43
  },
47
- supportsAction: ({ action }) => ZALO_ACTIONS.has(action),
48
44
  extractToolSend: ({ args }) => extractToolSend(args, "sendMessage"),
49
45
  handleAction: async ({ action, params, cfg, accountId }) => {
50
46
  if (action === "send") {
@@ -79,17 +75,23 @@ function normalizeZaloApproverId(value) {
79
75
  const normalized = String(value).trim().replace(/^(zalo|zl):/i, "").trim();
80
76
  return /^\d+$/.test(normalized) ? normalized : void 0;
81
77
  }
82
- const zaloApprovalAuth = createChannelApprovalAuth({
78
+ const zaloApprovalAuth = createResolvedApproverActionAuthAdapter({
83
79
  channelLabel: "Zalo",
84
- resolveInputs: ({ cfg, accountId }) => {
85
- return { allowFrom: resolveZaloAccount({
80
+ resolveApprovers: ({ cfg, accountId }) => {
81
+ const account = resolveZaloAccount({
86
82
  cfg,
87
83
  accountId
88
- }).config.allowFrom };
84
+ }).config;
85
+ return resolveApprovalApprovers({
86
+ allowFrom: account.allowFrom,
87
+ normalizeApprover: normalizeZaloApproverId
88
+ });
89
89
  },
90
- normalizeApprover: normalizeZaloApproverId
91
- }).approvalAuth;
92
- const ZaloConfigSchema = buildMultiAccountChannelSchema(z.object({
90
+ normalizeSenderId: (value) => normalizeZaloApproverId(value)
91
+ });
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
  markdown: MarkdownConfigSchema,
@@ -105,7 +107,8 @@ const ZaloConfigSchema = buildMultiAccountChannelSchema(z.object({
105
107
  mediaMaxMb: z.number().optional(),
106
108
  proxy: z.string().optional(),
107
109
  responsePrefix: z.string().optional()
108
- }), { accountsMode: "catchall" });
110
+ });
111
+ const ZaloConfigSchema = buildCatchallMultiAccountChannelSchema(zaloAccountSchema);
109
112
  //#endregion
110
113
  //#region extensions/zalo/src/session-route.ts
111
114
  function resolveZaloOutboundSessionRoute(params) {
@@ -148,12 +151,13 @@ function collectZaloStatusIssues(accounts) {
148
151
  const enabled = account.enabled !== false;
149
152
  const configured = account.configured === true;
150
153
  if (!enabled || !configured) continue;
151
- if (account.dmPolicy === "open") issues.push(standardDmPolicyOpenIssue({
154
+ if (account.dmPolicy === "open") issues.push({
152
155
  channel: "zalo",
153
156
  accountId,
154
- channelLabel: "Zalo",
155
- configPath: "channels.zalo"
156
- }));
157
+ kind: "config",
158
+ message: "Zalo dmPolicy is \"open\", allowing any user to message the bot without pairing.",
159
+ fix: "Set channels.zalo.dmPolicy to \"pairing\" or \"allowlist\" to restrict access."
160
+ });
157
161
  }
158
162
  return issues;
159
163
  }
@@ -179,27 +183,24 @@ function looksLikeZaloChatId(raw, normalized) {
179
183
  const target = normalizeZaloMessagingTarget(normalized ?? raw);
180
184
  return Boolean(target);
181
185
  }
182
- const loadZaloChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-DsaLk085.js"));
183
- const zaloSetupWizard = createZaloSetupWizardProxy(async () => (await import("./setup-surface-CQMbpZye.js")).zaloSetupWizard);
186
+ const loadZaloChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-DgMX6VOe.mjs"));
187
+ const zaloSetupWizard = createZaloSetupWizardProxy(async () => (await import("./setup-surface-gn6fs9pd.mjs")).zaloSetupWizard);
184
188
  const zaloTextChunkLimit = 2e3;
185
- async function sendZaloDelivery(ctx) {
186
- const result = await (await loadZaloChannelRuntime()).sendZaloText({
187
- to: ctx.to,
188
- text: ctx.text,
189
- accountId: ctx.accountId ?? void 0,
190
- mediaUrl: ctx.mediaUrl,
191
- cfg: ctx.cfg
192
- });
193
- if (!result.ok) throw new Error(result.error ?? `Failed to send Zalo ${ctx.mediaUrl ? "media" : "message"}`);
194
- return {
195
- messageId: result.messageId ?? "",
196
- receipt: result.receipt
197
- };
198
- }
199
- const zaloSendResultAdapter = createAttachedChannelResultAdapter({
189
+ const zaloRawSendResultAdapter = createRawChannelSendResultAdapter({
200
190
  channel: "zalo",
201
- sendText: sendZaloDelivery,
202
- sendMedia: sendZaloDelivery
191
+ sendText: async ({ to, text, accountId, cfg }) => await (await loadZaloChannelRuntime()).sendZaloText({
192
+ to,
193
+ text,
194
+ accountId: accountId ?? void 0,
195
+ cfg
196
+ }),
197
+ sendMedia: async ({ to, text, mediaUrl, accountId, cfg }) => await (await loadZaloChannelRuntime()).sendZaloText({
198
+ to,
199
+ text,
200
+ accountId: accountId ?? void 0,
201
+ mediaUrl,
202
+ cfg
203
+ })
203
204
  });
204
205
  const zaloMessageAdapter = defineChannelMessageAdapter({
205
206
  id: "zalo",
@@ -209,13 +210,21 @@ const zaloMessageAdapter = defineChannelMessageAdapter({
209
210
  messageSendingHooks: true
210
211
  } },
211
212
  send: {
212
- text: sendZaloDelivery,
213
- media: sendZaloDelivery
213
+ text: async ({ to, text, accountId, cfg }) => await (await loadZaloChannelRuntime()).sendZaloText({
214
+ to,
215
+ text,
216
+ accountId: accountId ?? void 0,
217
+ cfg
218
+ }),
219
+ media: async ({ to, text, mediaUrl, accountId, cfg }) => await (await loadZaloChannelRuntime()).sendZaloText({
220
+ to,
221
+ text,
222
+ accountId: accountId ?? void 0,
223
+ mediaUrl,
224
+ cfg
225
+ })
214
226
  }
215
227
  });
216
- function isZaloAccountConfigured(account) {
217
- return account.tokenStatus ? account.tokenStatus !== "missing" : Boolean(account.token?.trim());
218
- }
219
228
  const zaloConfigAdapter = createScopedChannelConfigAdapter({
220
229
  sectionKey: "zalo",
221
230
  listAccountIds: listZaloAccountIds,
@@ -264,7 +273,6 @@ const zaloPlugin = createChatChannelPlugin({
264
273
  id: "zalo",
265
274
  meta,
266
275
  setup: zaloSetupAdapter,
267
- setupContract: zaloSetupContract,
268
276
  setupWizard: zaloSetupWizard,
269
277
  capabilities: {
270
278
  chatTypes: ["direct", "group"],
@@ -279,16 +287,12 @@ const zaloPlugin = createChatChannelPlugin({
279
287
  configSchema: buildChannelConfigSchema(ZaloConfigSchema),
280
288
  config: {
281
289
  ...zaloConfigAdapter,
282
- inspectAccount: adaptScopedAccountAccessor(inspectZaloAccount),
283
- isConfigured: isZaloAccountConfigured,
290
+ isConfigured: (account) => Boolean(account.token?.trim()),
284
291
  describeAccount: (account) => describeWebhookAccountSnapshot({
285
292
  account,
286
- configured: isZaloAccountConfigured(account),
293
+ configured: Boolean(account.token?.trim()),
287
294
  mode: account.config.webhookUrl ? "webhook" : "polling",
288
- extra: {
289
- tokenSource: account.tokenSource,
290
- tokenStatus: account.tokenStatus
291
- }
295
+ extra: { tokenSource: account.tokenSource }
292
296
  })
293
297
  },
294
298
  approvalCapability: zaloApprovalAuth,
@@ -325,7 +329,7 @@ const zaloPlugin = createChatChannelPlugin({
325
329
  timeoutMs
326
330
  }),
327
331
  resolveAccountSnapshot: ({ account }) => {
328
- const configured = isZaloAccountConfigured(account);
332
+ const configured = Boolean(account.token?.trim());
329
333
  return {
330
334
  accountId: account.accountId,
331
335
  name: account.name,
@@ -333,7 +337,6 @@ const zaloPlugin = createChatChannelPlugin({
333
337
  configured,
334
338
  extra: {
335
339
  tokenSource: account.tokenSource,
336
- tokenStatus: account.tokenStatus,
337
340
  mode: account.config.webhookUrl ? "webhook" : "polling",
338
341
  dmPolicy: account.config.dmPolicy ?? "pairing"
339
342
  }
@@ -359,17 +362,16 @@ const zaloPlugin = createChatChannelPlugin({
359
362
  chunker: chunkTextForOutbound,
360
363
  chunkerMode: "text",
361
364
  textChunkLimit: zaloTextChunkLimit,
362
- sanitizeText: ({ text }) => sanitizeAssistantVisibleText(text),
363
365
  sendPayload: async (ctx) => await sendPayloadWithChunkedTextAndMedia({
364
366
  ctx,
365
367
  textChunkLimit: zaloTextChunkLimit,
366
368
  chunker: chunkTextForOutbound,
367
- sendText: (nextCtx) => zaloSendResultAdapter.sendText(nextCtx),
368
- sendMedia: (nextCtx) => zaloSendResultAdapter.sendMedia(nextCtx),
369
+ sendText: (nextCtx) => zaloRawSendResultAdapter.sendText(nextCtx),
370
+ sendMedia: (nextCtx) => zaloRawSendResultAdapter.sendMedia(nextCtx),
369
371
  emptyResult: createEmptyChannelResult("zalo"),
370
372
  onResult: ctx.onDeliveryResult
371
373
  }),
372
- ...zaloSendResultAdapter
374
+ ...zaloRawSendResultAdapter
373
375
  }
374
376
  });
375
377
  //#endregion
@@ -1,6 +1,6 @@
1
- import { m as normalizeSecretInputString } from "./setup-core-LzhuTlsD.js";
2
- import { i as PAIRING_APPROVED_MESSAGE } from "./runtime-api-qxdOyk3M.js";
3
- import { a as getMe, n as resolveZaloProxyFetch, r as ZaloApiError, t as sendMessageZalo } from "./send-BUvbbedq.js";
1
+ import { p as normalizeSecretInputString } from "./setup-core-BLbVCFpT.mjs";
2
+ import { i as PAIRING_APPROVED_MESSAGE } from "./runtime-api-CAA4ZtqF.mjs";
3
+ import { a as getMe, n as resolveZaloProxyFetch, r as ZaloApiError, t as sendMessageZalo } from "./send-CNCw5UOt.mjs";
4
4
  import { createAccountStatusSink } from "openclaw/plugin-sdk/channel-outbound";
5
5
  //#region extensions/zalo/src/probe.ts
6
6
  async function probeZalo(token, timeoutMs = 5e3, fetcher) {
@@ -52,7 +52,7 @@ async function probeZalo(token, timeoutMs = 5e3, fetcher) {
52
52
  //#endregion
53
53
  //#region extensions/zalo/src/channel.runtime.ts
54
54
  async function notifyZaloPairingApproval(params) {
55
- const { resolveZaloAccount } = await import("./setup-core-LzhuTlsD.js").then((n) => n.s);
55
+ const { resolveZaloAccount } = await import("./setup-core-BLbVCFpT.mjs").then((n) => n.o);
56
56
  const account = resolveZaloAccount({ cfg: params.cfg });
57
57
  if (!account.token) throw new Error("Zalo token not configured");
58
58
  await sendMessageZalo(params.id, PAIRING_APPROVED_MESSAGE, { token: account.token });
@@ -86,7 +86,7 @@ async function startZaloGatewayAccount(ctx) {
86
86
  setStatus: ctx.setStatus
87
87
  });
88
88
  ctx.log?.info(`[${account.accountId}] starting provider${zaloBotLabel} mode=${mode}`);
89
- const { monitorZaloProvider } = await import("./monitor-C5cximHM.js");
89
+ const { monitorZaloProvider } = await import("./monitor-JTCxbIQP.mjs");
90
90
  return monitorZaloProvider({
91
91
  token,
92
92
  account,