@openclaw/zalo 2026.7.1-beta.1 → 2026.7.1-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.
@@ -1,4 +1,4 @@
1
- import { t as sendMessageZalo } from "./send-DzchAfon.js";
1
+ import { t as sendMessageZalo } from "./send-Bv6fMYcy.js";
2
2
  //#region extensions/zalo/src/actions.runtime.ts
3
3
  const zaloActionsRuntime = { sendMessageZalo };
4
4
  //#endregion
package/dist/api.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as zaloDmPolicy, r as zaloSetupAdapter, t as createZaloSetupWizardProxy } from "./setup-core-fwCh0QUi.js";
2
- import { t as zaloPlugin } from "./channel-Zju2s6y_.js";
2
+ import { t as zaloPlugin } from "./channel-DAsgqZBL.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 };
@@ -24,7 +24,7 @@ import { AllowFromListSchema, DmPolicySchema, GroupPolicySchema, MarkdownConfigS
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-BvO8xrg_.js"), "zaloActionsRuntime");
27
+ const loadZaloActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-Dn2ZiJpf.js"), "zaloActionsRuntime");
28
28
  const providerId = "zalo";
29
29
  function listEnabledAccounts(cfg, accountId) {
30
30
  return (accountId ? [resolveZaloAccount({
@@ -173,7 +173,7 @@ function normalizeZaloMessagingTarget(raw) {
173
173
  if (!trimmed) return;
174
174
  return trimmed.replace(/^(zalo|zl):/i, "").trim();
175
175
  }
176
- const loadZaloChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-T7qX1CZo.js"));
176
+ const loadZaloChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-B3bsfcE4.js"));
177
177
  const zaloSetupWizard = createZaloSetupWizardProxy(async () => (await import("./setup-surface-8eRimod9.js")).zaloSetupWizard);
178
178
  const zaloTextChunkLimit = 2e3;
179
179
  const zaloRawSendResultAdapter = createRawChannelSendResultAdapter({
@@ -1,2 +1,2 @@
1
- import { t as zaloPlugin } from "./channel-Zju2s6y_.js";
1
+ import { t as zaloPlugin } from "./channel-DAsgqZBL.js";
2
2
  export { zaloPlugin };
@@ -1,6 +1,6 @@
1
1
  import { p as normalizeSecretInputString } from "./setup-core-fwCh0QUi.js";
2
2
  import { i as PAIRING_APPROVED_MESSAGE } from "./runtime-api-CDwUY_-_.js";
3
- import { a as getMe, n as resolveZaloProxyFetch, r as ZaloApiError, t as sendMessageZalo } from "./send-DzchAfon.js";
3
+ import { a as getMe, n as resolveZaloProxyFetch, r as ZaloApiError, t as sendMessageZalo } from "./send-Bv6fMYcy.js";
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) {
@@ -71,7 +71,7 @@ async function startZaloGatewayAccount(ctx) {
71
71
  const fetcher = resolveZaloProxyFetch(account.config.proxy);
72
72
  try {
73
73
  const probe = await probeZalo(token, 2500, fetcher);
74
- const name = probe.ok ? probe.bot?.name?.trim() : null;
74
+ const name = probe.ok ? probe.bot?.account_name?.trim() : null;
75
75
  if (name) zaloBotLabel = ` (${name})`;
76
76
  if (!probe.ok) ctx.log?.warn?.(`[${account.accountId}] Zalo probe failed before provider start (${String(probe.elapsedMs)}ms): ${probe.error}`);
77
77
  ctx.setStatus({
@@ -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-C1dGXDyQ.js");
89
+ const { monitorZaloProvider } = await import("./monitor-CH3X2uV7.js");
90
90
  return monitorZaloProvider({
91
91
  token,
92
92
  account,
@@ -1,6 +1,7 @@
1
1
  import { n as resolveZaloRuntimeGroupPolicy, t as normalizeZaloAllowEntry } from "./group-access-8qHRzDHx.js";
2
2
  import { t as getZaloRuntime } from "./runtime-api-CDwUY_-_.js";
3
- import { c as sendChatAction, d as setWebhook, i as deleteWebhook, l as sendMessage, n as resolveZaloProxyFetch, o as getUpdates, r as ZaloApiError, s as getWebhookInfo, u as sendPhoto } from "./send-DzchAfon.js";
3
+ import { c as sendChatAction, d as setWebhook, i as deleteWebhook, l as sendMessage, n as resolveZaloProxyFetch, o as getUpdates, r as ZaloApiError, s as getWebhookInfo, u as sendPhoto } from "./send-Bv6fMYcy.js";
4
+ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
4
5
  import { deliverTextOrMediaReply, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
5
6
  import { normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
6
7
  import { resolveDefaultGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
@@ -152,12 +153,13 @@ const ZALO_TEXT_LIMIT = 2e3;
152
153
  const DEFAULT_MEDIA_MAX_MB = 5;
153
154
  const WEBHOOK_CLEANUP_TIMEOUT_MS = 5e3;
154
155
  const ZALO_TYPING_TIMEOUT_MS = 5e3;
155
- let zaloWebhookModulePromise;
156
+ const UNIX_MILLISECONDS_THRESHOLD = 0xe8d4a51000;
156
157
  const hostedMediaRouteRefs = /* @__PURE__ */ new Map();
157
- function loadZaloWebhookModule() {
158
- zaloWebhookModulePromise ??= import("./monitor.webhook-B23mUx-y.js");
159
- return zaloWebhookModulePromise;
158
+ function resolveZaloTimestampMs(date) {
159
+ if (!date) return;
160
+ return date >= UNIX_MILLISECONDS_THRESHOLD ? date : date * 1e3;
160
161
  }
162
+ const loadZaloWebhookModule = createLazyRuntimeModule(() => import("./monitor.webhook-B23mUx-y.js"));
161
163
  function releaseSharedHostedMediaRouteRef(routePath) {
162
164
  const current = hostedMediaRouteRefs.get(routePath);
163
165
  if (!current) return;
@@ -480,17 +482,18 @@ async function processMessageWithPipeline(params) {
480
482
  return;
481
483
  }
482
484
  const fromLabel = isGroup ? `group:${chatId}` : senderName || `user:${senderId}`;
485
+ const timestamp = resolveZaloTimestampMs(date);
483
486
  const { storePath, body } = buildEnvelope({
484
487
  channel: "Zalo",
485
488
  from: fromLabel,
486
- timestamp: date ? date * 1e3 : void 0,
489
+ timestamp,
487
490
  body: rawBody
488
491
  });
489
492
  const ctxPayload = core.channel.inbound.buildContext({
490
493
  channel: "zalo",
491
494
  accountId: route.accountId,
492
495
  messageId: message_id,
493
- timestamp: date ? date * 1e3 : void 0,
496
+ timestamp,
494
497
  from: isGroup ? `zalo:group:${chatId}` : `zalo:${senderId}`,
495
498
  sender: {
496
499
  id: senderId,
@@ -11,6 +11,7 @@ import { makeProxyFetch } from "openclaw/plugin-sdk/fetch-runtime";
11
11
  * @see https://bot.zaloplatforms.com/docs
12
12
  */
13
13
  const ZALO_API_BASE = "https://bot-api.zaloplatforms.com";
14
+ const ZALO_API_URL_ENV = "ZALO_API_URL";
14
15
  const ZALO_MEDIA_SSRF_POLICY = {};
15
16
  var ZaloApiError = class extends Error {
16
17
  constructor(message, errorCode, description) {
@@ -24,11 +25,24 @@ var ZaloApiError = class extends Error {
24
25
  return this.errorCode === 408;
25
26
  }
26
27
  };
28
+ function resolveZaloApiUrl(apiUrl) {
29
+ const value = apiUrl === void 0 ? process.env[ZALO_API_URL_ENV]?.trim() ?? ZALO_API_BASE : apiUrl.trim();
30
+ if (!value) throw new Error(`${ZALO_API_URL_ENV} must not be empty.`);
31
+ let parsed;
32
+ try {
33
+ parsed = new URL(value);
34
+ } catch {
35
+ throw new Error(`${ZALO_API_URL_ENV} must be a valid URL.`);
36
+ }
37
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new Error(`${ZALO_API_URL_ENV} must use http:// or https://.`);
38
+ if (parsed.search || parsed.hash) throw new Error(`${ZALO_API_URL_ENV} must not include a query string or fragment.`);
39
+ return parsed.href.replace(/\/+$/u, "");
40
+ }
27
41
  /**
28
42
  * Call the Zalo Bot API
29
43
  */
30
44
  async function callZaloApi(method, token, body, options) {
31
- const url = `${ZALO_API_BASE}/bot${token}/${method}`;
45
+ const url = `${resolveZaloApiUrl(options?.apiUrl)}/bot${token}/${method}`;
32
46
  const controller = new AbortController();
33
47
  const requestTimeoutMs = options?.timeoutMs === void 0 ? void 0 : resolveTimerTimeoutMs(options.timeoutMs, 1);
34
48
  const timeoutId = requestTimeoutMs === void 0 ? void 0 : setTimeout(() => controller.abort(), requestTimeoutMs);
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@openclaw/zalo",
3
- "version": "2026.7.1-beta.1",
3
+ "version": "2026.7.1-beta.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/zalo",
9
- "version": "2026.7.1-beta.1",
9
+ "version": "2026.7.1-beta.2",
10
10
  "dependencies": {
11
11
  "zod": "4.4.3"
12
12
  },
13
13
  "peerDependencies": {
14
- "openclaw": ">=2026.7.1-beta.1"
14
+ "openclaw": ">=2026.7.1-beta.2"
15
15
  },
16
16
  "peerDependenciesMeta": {
17
17
  "openclaw": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/zalo",
3
- "version": "2026.7.1-beta.1",
3
+ "version": "2026.7.1-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.7.1-beta.1"
11
+ "openclaw": ">=2026.7.1-beta.2"
12
12
  },
13
13
  "peerDependenciesMeta": {
14
14
  "openclaw": {
@@ -39,10 +39,10 @@
39
39
  "minHostVersion": ">=2026.4.10"
40
40
  },
41
41
  "compat": {
42
- "pluginApi": ">=2026.7.1-beta.1"
42
+ "pluginApi": ">=2026.7.1-beta.2"
43
43
  },
44
44
  "build": {
45
- "openclawVersion": "2026.7.1-beta.1"
45
+ "openclawVersion": "2026.7.1-beta.2"
46
46
  },
47
47
  "release": {
48
48
  "publishToClawHub": true,