@openclaw/zalo 2026.6.11 → 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.
- package/dist/{actions.runtime-ylK8EjWZ.js → actions.runtime-Dn2ZiJpf.js} +1 -1
- package/dist/api.js +1 -1
- package/dist/{channel-BulSjBML.js → channel-DAsgqZBL.js} +2 -2
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-RCfvYRaN.js → channel.runtime-B3bsfcE4.js} +3 -3
- package/dist/{monitor-BCnfAVr4.js → monitor-CH3X2uV7.js} +10 -7
- package/dist/{send-DBzU5EEc.js → send-Bv6fMYcy.js} +18 -3
- package/npm-shrinkwrap.json +3 -3
- package/package.json +4 -4
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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?.
|
|
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-
|
|
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-
|
|
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
|
-
|
|
156
|
+
const UNIX_MILLISECONDS_THRESHOLD = 0xe8d4a51000;
|
|
156
157
|
const hostedMediaRouteRefs = /* @__PURE__ */ new Map();
|
|
157
|
-
function
|
|
158
|
-
|
|
159
|
-
return
|
|
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
|
|
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
|
|
496
|
+
timestamp,
|
|
494
497
|
from: isGroup ? `zalo:group:${chatId}` : `zalo:${senderId}`,
|
|
495
498
|
sender: {
|
|
496
499
|
id: senderId,
|
|
@@ -2,6 +2,7 @@ import { d as resolveZaloToken, u as resolveZaloAccount } from "./setup-core-fwC
|
|
|
2
2
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
3
3
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
4
4
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
5
|
+
import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
|
|
5
6
|
import { resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
6
7
|
import { makeProxyFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
7
8
|
//#region extensions/zalo/src/api.ts
|
|
@@ -10,6 +11,7 @@ import { makeProxyFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
|
10
11
|
* @see https://bot.zaloplatforms.com/docs
|
|
11
12
|
*/
|
|
12
13
|
const ZALO_API_BASE = "https://bot-api.zaloplatforms.com";
|
|
14
|
+
const ZALO_API_URL_ENV = "ZALO_API_URL";
|
|
13
15
|
const ZALO_MEDIA_SSRF_POLICY = {};
|
|
14
16
|
var ZaloApiError = class extends Error {
|
|
15
17
|
constructor(message, errorCode, description) {
|
|
@@ -23,22 +25,35 @@ var ZaloApiError = class extends Error {
|
|
|
23
25
|
return this.errorCode === 408;
|
|
24
26
|
}
|
|
25
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
|
+
}
|
|
26
41
|
/**
|
|
27
42
|
* Call the Zalo Bot API
|
|
28
43
|
*/
|
|
29
44
|
async function callZaloApi(method, token, body, options) {
|
|
30
|
-
const url = `${
|
|
45
|
+
const url = `${resolveZaloApiUrl(options?.apiUrl)}/bot${token}/${method}`;
|
|
31
46
|
const controller = new AbortController();
|
|
32
47
|
const requestTimeoutMs = options?.timeoutMs === void 0 ? void 0 : resolveTimerTimeoutMs(options.timeoutMs, 1);
|
|
33
48
|
const timeoutId = requestTimeoutMs === void 0 ? void 0 : setTimeout(() => controller.abort(), requestTimeoutMs);
|
|
34
49
|
const fetcher = options?.fetch ?? fetch;
|
|
35
50
|
try {
|
|
36
|
-
const data = await (await fetcher(url, {
|
|
51
|
+
const data = await readProviderJsonResponse(await fetcher(url, {
|
|
37
52
|
method: "POST",
|
|
38
53
|
headers: { "Content-Type": "application/json" },
|
|
39
54
|
body: body ? JSON.stringify(body) : void 0,
|
|
40
55
|
signal: controller.signal
|
|
41
|
-
}))
|
|
56
|
+
}), `zalo.${method}`);
|
|
42
57
|
if (!data.ok) throw new ZaloApiError(data.description ?? `Zalo API error: ${method}`, data.error_code, data.description);
|
|
43
58
|
return data;
|
|
44
59
|
} finally {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/zalo",
|
|
3
|
-
"version": "2026.
|
|
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.
|
|
9
|
+
"version": "2026.7.1-beta.2",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"zod": "4.4.3"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"openclaw": ">=2026.
|
|
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.
|
|
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.
|
|
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.
|
|
42
|
+
"pluginApi": ">=2026.7.1-beta.2"
|
|
43
43
|
},
|
|
44
44
|
"build": {
|
|
45
|
-
"openclawVersion": "2026.
|
|
45
|
+
"openclawVersion": "2026.7.1-beta.2"
|
|
46
46
|
},
|
|
47
47
|
"release": {
|
|
48
48
|
"publishToClawHub": true,
|