@openclaw/zalo 2026.7.2-beta.7 → 2026.7.33
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-BYBjeo4Q.js → .setup/actions.runtime-C0KWbUJu.mjs} +1 -1
- package/dist/.setup/api-D2kRAHnC.mjs +6 -0
- package/dist/{channel-idqJI6YK.js → .setup/channel-ChIucoCG.mjs} +68 -66
- package/dist/{channel.runtime-DsaLk085.js → .setup/channel.runtime-DgMX6VOe.mjs} +5 -5
- package/dist/{monitor-C5cximHM.js → .setup/monitor-JTCxbIQP.mjs} +81 -97
- package/dist/{monitor.webhook-D56OCa3C.js → .setup/monitor.webhook-BwPNGSB4.mjs} +71 -25
- package/dist/{runtime-api-qxdOyk3M.js → .setup/runtime-api-CAA4ZtqF.mjs} +3 -2
- package/dist/{secret-contract-Bxvjh0Hq.js → .setup/secret-contract-Bno_huZF.mjs} +47 -6
- package/dist/.setup/secret-contract-api-CILabB_S.mjs +3 -0
- package/dist/{send-BUvbbedq.js → .setup/send-CNCw5UOt.mjs} +10 -21
- package/dist/{setup-core-LzhuTlsD.js → .setup/setup-core-BLbVCFpT.mjs} +112 -116
- package/dist/{setup-surface-CQMbpZye.js → .setup/setup-surface-gn6fs9pd.mjs} +7 -5
- package/dist/api.js +3 -3
- package/dist/channel-plugin-api.js +1 -1
- package/dist/contract-api.js +1 -1
- package/dist/runtime-api.js +2 -2
- package/dist/secret-contract-api.js +1 -1
- package/dist/setup-api.js +2 -2
- package/dist/setup-entry.js +3 -2
- package/openclaw.plugin.json +6 -0
- package/package.json +5 -46
- package/dist/webhook-spool-DzCPbb3O.js +0 -121
- /package/dist/{group-access-8qHRzDHx.js → .setup/group-access-8qHRzDHx.mjs} +0 -0
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import { d as
|
|
1
|
+
import { d as resolveZaloToken, u as resolveZaloAccount } from "./setup-core-BLbVCFpT.mjs";
|
|
2
2
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
3
|
-
import { stripChannelTargetPrefix, stripTargetKindPrefix } from "openclaw/plugin-sdk/core";
|
|
4
3
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
5
4
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
6
5
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
7
6
|
import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
|
|
8
7
|
import { resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
9
8
|
import { makeProxyFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
10
|
-
//#region extensions/zalo/src/timeouts.ts
|
|
11
|
-
const ZALO_DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
12
|
-
const ZALO_OUTBOUND_MEDIA_TTL_MS = 2 * 6e4;
|
|
13
|
-
const ZALO_SEND_PHOTO_REQUEST_TIMEOUT_MS = 15e4;
|
|
14
|
-
//#endregion
|
|
15
9
|
//#region extensions/zalo/src/api.ts
|
|
16
10
|
/**
|
|
17
11
|
* Zalo Bot API client
|
|
@@ -51,20 +45,21 @@ function resolveZaloApiUrl(apiUrl) {
|
|
|
51
45
|
async function callZaloApi(method, token, body, options) {
|
|
52
46
|
const url = `${resolveZaloApiUrl(options?.apiUrl)}/bot${token}/${method}`;
|
|
53
47
|
const controller = new AbortController();
|
|
54
|
-
const requestTimeoutMs = resolveTimerTimeoutMs(options
|
|
55
|
-
const timeoutId = setTimeout(() => controller.abort(), requestTimeoutMs);
|
|
48
|
+
const requestTimeoutMs = options?.timeoutMs === void 0 ? void 0 : resolveTimerTimeoutMs(options.timeoutMs, 1);
|
|
49
|
+
const timeoutId = requestTimeoutMs === void 0 ? void 0 : setTimeout(() => controller.abort(), requestTimeoutMs);
|
|
56
50
|
const fetcher = options?.fetch ?? fetch;
|
|
57
51
|
try {
|
|
58
|
-
const
|
|
52
|
+
const response = await fetcher(url, {
|
|
59
53
|
method: "POST",
|
|
60
54
|
headers: { "Content-Type": "application/json" },
|
|
61
55
|
body: body ? JSON.stringify(body) : void 0,
|
|
62
56
|
signal: controller.signal
|
|
63
|
-
})
|
|
57
|
+
});
|
|
58
|
+
const data = await readProviderJsonResponse(response, `zalo.${method}`);
|
|
64
59
|
if (!data.ok) throw new ZaloApiError(data.description ?? `Zalo API error: ${method}`, data.error_code, data.description);
|
|
65
60
|
return data;
|
|
66
61
|
} finally {
|
|
67
|
-
clearTimeout(timeoutId);
|
|
62
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
68
63
|
}
|
|
69
64
|
}
|
|
70
65
|
/**
|
|
@@ -98,10 +93,7 @@ async function sendPhoto(token, params, fetcher) {
|
|
|
98
93
|
return callZaloApi("sendPhoto", token, {
|
|
99
94
|
...params,
|
|
100
95
|
photo: parsedPhotoUrl.href
|
|
101
|
-
}, {
|
|
102
|
-
timeoutMs: ZALO_SEND_PHOTO_REQUEST_TIMEOUT_MS,
|
|
103
|
-
fetch: fetcher
|
|
104
|
-
});
|
|
96
|
+
}, { fetch: fetcher });
|
|
105
97
|
}
|
|
106
98
|
/**
|
|
107
99
|
* Send a temporary chat action such as typing.
|
|
@@ -232,7 +224,7 @@ function resolveValidatedSendContext(chatId, options) {
|
|
|
232
224
|
ok: false,
|
|
233
225
|
error: "No Zalo bot token configured"
|
|
234
226
|
};
|
|
235
|
-
const trimmedChatId =
|
|
227
|
+
const trimmedChatId = chatId?.trim();
|
|
236
228
|
if (!trimmedChatId) return {
|
|
237
229
|
ok: false,
|
|
238
230
|
error: "No chat_id provided"
|
|
@@ -244,9 +236,6 @@ function resolveValidatedSendContext(chatId, options) {
|
|
|
244
236
|
fetcher
|
|
245
237
|
};
|
|
246
238
|
}
|
|
247
|
-
function normalizeZaloSendChatId(chatId) {
|
|
248
|
-
return stripTargetKindPrefix(stripChannelTargetPrefix(chatId, "zalo", "zl"));
|
|
249
|
-
}
|
|
250
239
|
function resolveSendContextOrFailure(chatId, options) {
|
|
251
240
|
const context = resolveValidatedSendContext(chatId, options);
|
|
252
241
|
return context.ok ? { context } : { failure: {
|
|
@@ -297,4 +286,4 @@ async function sendPhotoZalo(chatId, photoUrl, options = {}) {
|
|
|
297
286
|
}, context.fetcher))());
|
|
298
287
|
}
|
|
299
288
|
//#endregion
|
|
300
|
-
export { getMe as a, sendChatAction as c, setWebhook as d,
|
|
289
|
+
export { getMe as a, sendChatAction as c, setWebhook as d, deleteWebhook as i, sendMessage as l, resolveZaloProxyFetch as n, getUpdates as o, ZaloApiError as r, getWebhookInfo as s, sendMessageZalo as t, sendPhoto as u };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { createAccountListHelpers } from "openclaw/plugin-sdk/account-helpers";
|
|
1
|
+
import { createAccountListHelpers, resolveMergedAccountConfig } from "openclaw/plugin-sdk/account-helpers";
|
|
2
2
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
3
3
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { tryReadSecretFileSync } from "openclaw/plugin-sdk/core";
|
|
5
5
|
import { resolveAccountEntry } from "openclaw/plugin-sdk/routing";
|
|
6
|
-
import { buildSecretInputSchema,
|
|
7
|
-
import {
|
|
8
|
-
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
9
|
-
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, createDelegatedSetupWizardProxy, createPatchedAccountSetupAdapter, createSetupInputPresenceValidator, createSetupTranslator, formatDocsLink, mergeAllowFromEntries, normalizeAccountId as normalizeAccountId$1, patchScopedAccountConfig, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
|
|
6
|
+
import { buildSecretInputSchema, normalizeResolvedSecretInputString, normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
7
|
+
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, addWildcardAllowFrom, createDelegatedSetupWizardProxy, createPatchedAccountSetupAdapter, createSetupInputPresenceValidator, createSetupTranslator, formatDocsLink, mergeAllowFromEntries, normalizeAccountId as normalizeAccountId$1 } from "openclaw/plugin-sdk/setup";
|
|
10
8
|
//#region \0rolldown/runtime.js
|
|
11
9
|
var __defProp = Object.defineProperty;
|
|
12
10
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -30,116 +28,95 @@ function resolveZaloToken(config, accountId, options) {
|
|
|
30
28
|
const accountConfig = resolveAccountEntry(baseConfig?.accounts, normalizeAccountId(resolvedAccountId));
|
|
31
29
|
const accountHasBotToken = Boolean(accountConfig && Object.hasOwn(accountConfig, "botToken"));
|
|
32
30
|
if (accountConfig && accountHasBotToken) {
|
|
33
|
-
const token =
|
|
31
|
+
const token = options?.allowUnresolvedSecretRef ? normalizeSecretInputString(accountConfig.botToken) : normalizeResolvedSecretInputString({
|
|
34
32
|
value: accountConfig.botToken,
|
|
35
|
-
path: `channels.zalo.accounts.${resolvedAccountId}.botToken
|
|
36
|
-
mode: options?.mode
|
|
33
|
+
path: `channels.zalo.accounts.${resolvedAccountId}.botToken`
|
|
37
34
|
});
|
|
38
|
-
if (token
|
|
39
|
-
token
|
|
40
|
-
source: "config"
|
|
41
|
-
status: "available"
|
|
42
|
-
};
|
|
43
|
-
if (token.status === "configured_unavailable") return {
|
|
44
|
-
token: "",
|
|
45
|
-
source: "config",
|
|
46
|
-
status: "configured_unavailable"
|
|
35
|
+
if (token) return {
|
|
36
|
+
token,
|
|
37
|
+
source: "config"
|
|
47
38
|
};
|
|
48
39
|
const fileToken = readTokenFromFile(accountConfig.tokenFile);
|
|
49
40
|
if (fileToken) return {
|
|
50
41
|
token: fileToken,
|
|
51
|
-
source: "configFile"
|
|
52
|
-
status: "available"
|
|
42
|
+
source: "configFile"
|
|
53
43
|
};
|
|
54
44
|
}
|
|
55
45
|
if (!accountHasBotToken) {
|
|
56
46
|
const fileToken = readTokenFromFile(accountConfig?.tokenFile);
|
|
57
47
|
if (fileToken) return {
|
|
58
48
|
token: fileToken,
|
|
59
|
-
source: "configFile"
|
|
60
|
-
status: "available"
|
|
49
|
+
source: "configFile"
|
|
61
50
|
};
|
|
62
51
|
}
|
|
63
52
|
if (!accountHasBotToken) {
|
|
64
|
-
const token =
|
|
53
|
+
const token = options?.allowUnresolvedSecretRef ? normalizeSecretInputString(baseConfig?.botToken) : normalizeResolvedSecretInputString({
|
|
65
54
|
value: baseConfig?.botToken,
|
|
66
|
-
path: "channels.zalo.botToken"
|
|
67
|
-
mode: options?.mode
|
|
55
|
+
path: "channels.zalo.botToken"
|
|
68
56
|
});
|
|
69
|
-
if (token
|
|
70
|
-
token
|
|
71
|
-
source: "config"
|
|
72
|
-
status: "available"
|
|
73
|
-
};
|
|
74
|
-
if (token.status === "configured_unavailable") return {
|
|
75
|
-
token: "",
|
|
76
|
-
source: "config",
|
|
77
|
-
status: "configured_unavailable"
|
|
57
|
+
if (token) return {
|
|
58
|
+
token,
|
|
59
|
+
source: "config"
|
|
78
60
|
};
|
|
79
61
|
const fileToken = readTokenFromFile(baseConfig?.tokenFile);
|
|
80
62
|
if (fileToken) return {
|
|
81
63
|
token: fileToken,
|
|
82
|
-
source: "configFile"
|
|
83
|
-
status: "available"
|
|
64
|
+
source: "configFile"
|
|
84
65
|
};
|
|
85
66
|
}
|
|
86
67
|
if (isDefaultAccount) {
|
|
87
68
|
const envToken = process.env.ZALO_BOT_TOKEN?.trim();
|
|
88
69
|
if (envToken) return {
|
|
89
70
|
token: envToken,
|
|
90
|
-
source: "env"
|
|
91
|
-
status: "available"
|
|
71
|
+
source: "env"
|
|
92
72
|
};
|
|
93
73
|
}
|
|
94
74
|
return {
|
|
95
75
|
token: "",
|
|
96
|
-
source: "none"
|
|
97
|
-
status: "missing"
|
|
76
|
+
source: "none"
|
|
98
77
|
};
|
|
99
78
|
}
|
|
100
79
|
//#endregion
|
|
101
80
|
//#region extensions/zalo/src/accounts.ts
|
|
102
81
|
var accounts_exports = /* @__PURE__ */ __exportAll({
|
|
103
|
-
|
|
82
|
+
listEnabledZaloAccounts: () => listEnabledZaloAccounts,
|
|
104
83
|
listZaloAccountIds: () => listZaloAccountIds,
|
|
105
84
|
resolveDefaultZaloAccountId: () => resolveDefaultZaloAccountId,
|
|
106
85
|
resolveZaloAccount: () => resolveZaloAccount
|
|
107
86
|
});
|
|
108
|
-
const { listAccountIds: listZaloAccountIds, resolveDefaultAccountId: resolveDefaultZaloAccountId
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
87
|
+
const { listAccountIds: listZaloAccountIds, resolveDefaultAccountId: resolveDefaultZaloAccountId } = createAccountListHelpers("zalo", { implicitDefaultAccount: {
|
|
88
|
+
channelKeys: ["botToken", "tokenFile"],
|
|
89
|
+
envVars: ["ZALO_BOT_TOKEN"]
|
|
90
|
+
} });
|
|
91
|
+
function mergeZaloAccountConfig(cfg, accountId) {
|
|
92
|
+
return resolveMergedAccountConfig({
|
|
93
|
+
channelConfig: cfg.channels?.zalo,
|
|
94
|
+
accounts: (cfg.channels?.zalo)?.accounts,
|
|
95
|
+
accountId,
|
|
96
|
+
omitKeys: ["defaultAccount"]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function resolveZaloAccount(params) {
|
|
116
100
|
const accountId = normalizeAccountId(params.accountId ?? (params.cfg.channels?.zalo)?.defaultAccount);
|
|
117
101
|
const baseEnabled = (params.cfg.channels?.zalo)?.enabled !== false;
|
|
118
102
|
const merged = mergeZaloAccountConfig(params.cfg, accountId);
|
|
119
103
|
const accountEnabled = merged.enabled !== false;
|
|
120
104
|
const enabled = baseEnabled && accountEnabled;
|
|
121
|
-
const tokenResolution = resolveZaloToken(params.cfg.channels?.zalo, accountId, {
|
|
105
|
+
const tokenResolution = resolveZaloToken(params.cfg.channels?.zalo, accountId, { allowUnresolvedSecretRef: params.allowUnresolvedSecretRef });
|
|
122
106
|
return {
|
|
123
107
|
accountId,
|
|
124
108
|
name: normalizeOptionalString(merged.name),
|
|
125
109
|
enabled,
|
|
126
110
|
token: tokenResolution.token,
|
|
127
111
|
tokenSource: tokenResolution.source,
|
|
128
|
-
tokenStatus: tokenResolution.status,
|
|
129
112
|
config: merged
|
|
130
113
|
};
|
|
131
114
|
}
|
|
132
|
-
function
|
|
133
|
-
return
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
function inspectZaloAccount(params) {
|
|
139
|
-
return resolveZaloAccountWithMode({
|
|
140
|
-
...params,
|
|
141
|
-
mode: "inspect"
|
|
142
|
-
});
|
|
115
|
+
function listEnabledZaloAccounts(cfg) {
|
|
116
|
+
return listZaloAccountIds(cfg).map((accountId) => resolveZaloAccount({
|
|
117
|
+
cfg,
|
|
118
|
+
accountId
|
|
119
|
+
})).filter((account) => account.enabled);
|
|
143
120
|
}
|
|
144
121
|
//#endregion
|
|
145
122
|
//#region extensions/zalo/src/setup-allow-from.ts
|
|
@@ -160,7 +137,7 @@ async function promptZaloAllowFrom(params) {
|
|
|
160
137
|
cfg,
|
|
161
138
|
accountId
|
|
162
139
|
}).config.allowFrom ?? [];
|
|
163
|
-
const
|
|
140
|
+
const normalized = (await prompter.text({
|
|
164
141
|
message: t$1("wizard.zalo.allowFromPrompt"),
|
|
165
142
|
placeholder: "123456789",
|
|
166
143
|
initialValue: existingAllowFrom[0] ? String(existingAllowFrom[0]) : void 0,
|
|
@@ -169,7 +146,8 @@ async function promptZaloAllowFrom(params) {
|
|
|
169
146
|
if (!raw) return t$1("common.required");
|
|
170
147
|
if (!/^\d+$/.test(raw)) return t$1("wizard.zalo.allowFromNumeric");
|
|
171
148
|
}
|
|
172
|
-
})).trim()
|
|
149
|
+
})).trim();
|
|
150
|
+
const unique = mergeAllowFromEntries(existingAllowFrom, [normalized]);
|
|
173
151
|
if (accountId === DEFAULT_ACCOUNT_ID$1) return {
|
|
174
152
|
...cfg,
|
|
175
153
|
channels: {
|
|
@@ -207,69 +185,78 @@ async function promptZaloAllowFrom(params) {
|
|
|
207
185
|
//#region extensions/zalo/src/setup-core.ts
|
|
208
186
|
const t = createSetupTranslator();
|
|
209
187
|
const channel = "zalo";
|
|
210
|
-
const zaloSetupAdapter = {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}]
|
|
219
|
-
}),
|
|
220
|
-
buildPatch: (input) => input.useEnv ? {} : input.tokenFile ? { tokenFile: input.tokenFile } : input.token ? { botToken: input.token } : {}
|
|
188
|
+
const zaloSetupAdapter = createPatchedAccountSetupAdapter({
|
|
189
|
+
channelKey: channel,
|
|
190
|
+
validateInput: createSetupInputPresenceValidator({
|
|
191
|
+
defaultAccountOnlyEnvError: "ZALO_BOT_TOKEN can only be used for the default account.",
|
|
192
|
+
whenNotUseEnv: [{
|
|
193
|
+
someOf: ["token", "tokenFile"],
|
|
194
|
+
message: "Zalo requires token or --token-file (or --use-env)."
|
|
195
|
+
}]
|
|
221
196
|
}),
|
|
222
|
-
|
|
223
|
-
};
|
|
224
|
-
const zaloSetupContract = defineChannelSetupContract({
|
|
225
|
-
fields: {
|
|
226
|
-
token: {
|
|
227
|
-
kind: "string",
|
|
228
|
-
sensitive: true,
|
|
229
|
-
cli: {
|
|
230
|
-
flags: "--token <token>",
|
|
231
|
-
description: "Zalo bot token"
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
tokenFile: {
|
|
235
|
-
kind: "string",
|
|
236
|
-
sensitive: true,
|
|
237
|
-
cli: {
|
|
238
|
-
flags: "--token-file <path>",
|
|
239
|
-
description: "Zalo bot token file"
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
useEnv: {
|
|
243
|
-
kind: "boolean",
|
|
244
|
-
cli: {
|
|
245
|
-
flags: "--use-env",
|
|
246
|
-
description: "Use ZALO_BOT_TOKEN"
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
legacyAdapter: zaloSetupAdapter
|
|
197
|
+
buildPatch: (input) => input.useEnv ? {} : input.tokenFile ? { tokenFile: input.tokenFile } : input.token ? { botToken: input.token } : {}
|
|
251
198
|
});
|
|
252
|
-
const zaloDmPolicy =
|
|
199
|
+
const zaloDmPolicy = {
|
|
253
200
|
label: "Zalo",
|
|
254
201
|
channel,
|
|
255
|
-
|
|
256
|
-
|
|
202
|
+
policyKey: "channels.zalo.dmPolicy",
|
|
203
|
+
allowFromKey: "channels.zalo.allowFrom",
|
|
204
|
+
resolveConfigKeys: (cfg, accountId) => (accountId ?? resolveDefaultZaloAccountId(cfg)) !== DEFAULT_ACCOUNT_ID$1 ? {
|
|
205
|
+
policyKey: `channels.zalo.accounts.${accountId ?? resolveDefaultZaloAccountId(cfg)}.dmPolicy`,
|
|
206
|
+
allowFromKey: `channels.zalo.accounts.${accountId ?? resolveDefaultZaloAccountId(cfg)}.allowFrom`
|
|
207
|
+
} : {
|
|
208
|
+
policyKey: "channels.zalo.dmPolicy",
|
|
209
|
+
allowFromKey: "channels.zalo.allowFrom"
|
|
210
|
+
},
|
|
211
|
+
getCurrent: (cfg, accountId) => resolveZaloAccount({
|
|
212
|
+
cfg,
|
|
213
|
+
accountId: accountId ?? resolveDefaultZaloAccountId(cfg)
|
|
214
|
+
}).config.dmPolicy ?? "pairing",
|
|
215
|
+
setPolicy: (cfg, policy, accountId) => {
|
|
216
|
+
const resolvedAccountId = accountId && normalizeAccountId$1(accountId) ? normalizeAccountId$1(accountId) ?? DEFAULT_ACCOUNT_ID$1 : resolveDefaultZaloAccountId(cfg);
|
|
217
|
+
const resolved = resolveZaloAccount({
|
|
257
218
|
cfg,
|
|
258
|
-
accountId:
|
|
219
|
+
accountId: resolvedAccountId
|
|
259
220
|
});
|
|
221
|
+
if (resolvedAccountId === DEFAULT_ACCOUNT_ID$1) return {
|
|
222
|
+
...cfg,
|
|
223
|
+
channels: {
|
|
224
|
+
...cfg.channels,
|
|
225
|
+
zalo: {
|
|
226
|
+
...cfg.channels?.zalo,
|
|
227
|
+
enabled: true,
|
|
228
|
+
dmPolicy: policy,
|
|
229
|
+
...policy === "open" ? { allowFrom: addWildcardAllowFrom(resolved.config.allowFrom) } : {}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
const currentAccount = cfg.channels?.zalo?.accounts?.[resolvedAccountId];
|
|
234
|
+
return {
|
|
235
|
+
...cfg,
|
|
236
|
+
channels: {
|
|
237
|
+
...cfg.channels,
|
|
238
|
+
zalo: {
|
|
239
|
+
...cfg.channels?.zalo,
|
|
240
|
+
enabled: true,
|
|
241
|
+
accounts: {
|
|
242
|
+
...cfg.channels?.zalo?.accounts,
|
|
243
|
+
[resolvedAccountId]: {
|
|
244
|
+
...currentAccount,
|
|
245
|
+
enabled: currentAccount?.enabled ?? true,
|
|
246
|
+
dmPolicy: policy,
|
|
247
|
+
...policy === "open" ? { allowFrom: addWildcardAllowFrom(resolved.config.allowFrom) } : {}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
};
|
|
260
253
|
},
|
|
261
|
-
applyPatch: ({ cfg, account, patch }) => patchScopedAccountConfig({
|
|
262
|
-
cfg,
|
|
263
|
-
channelKey: channel,
|
|
264
|
-
accountId: account.accountId,
|
|
265
|
-
patch
|
|
266
|
-
}),
|
|
267
254
|
promptAllowFrom: async ({ cfg, prompter, accountId }) => promptZaloAllowFrom({
|
|
268
255
|
cfg,
|
|
269
256
|
prompter,
|
|
270
257
|
accountId: accountId ?? resolveDefaultZaloAccountId(cfg)
|
|
271
258
|
})
|
|
272
|
-
}
|
|
259
|
+
};
|
|
273
260
|
function createZaloSetupWizardProxy(loadWizard) {
|
|
274
261
|
return createDelegatedSetupWizardProxy({
|
|
275
262
|
channel,
|
|
@@ -285,8 +272,17 @@ function createZaloSetupWizardProxy(loadWizard) {
|
|
|
285
272
|
credentials: [],
|
|
286
273
|
delegateFinalize: true,
|
|
287
274
|
dmPolicy: zaloDmPolicy,
|
|
288
|
-
disable: (cfg) =>
|
|
275
|
+
disable: (cfg) => ({
|
|
276
|
+
...cfg,
|
|
277
|
+
channels: {
|
|
278
|
+
...cfg.channels,
|
|
279
|
+
zalo: {
|
|
280
|
+
...cfg.channels?.zalo,
|
|
281
|
+
enabled: false
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
})
|
|
289
285
|
});
|
|
290
286
|
}
|
|
291
287
|
//#endregion
|
|
292
|
-
export {
|
|
288
|
+
export { promptZaloAllowFrom as a, listZaloAccountIds as c, resolveZaloToken as d, buildSecretInputSchema as f, noteZaloTokenHelp as i, resolveDefaultZaloAccountId as l, zaloDmPolicy as n, accounts_exports as o, normalizeSecretInputString as p, zaloSetupAdapter as r, listEnabledZaloAccounts as s, createZaloSetupWizardProxy as t, resolveZaloAccount as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as promptZaloAllowFrom, i as noteZaloTokenHelp, n as zaloDmPolicy, u as resolveZaloAccount } from "./setup-core-BLbVCFpT.mjs";
|
|
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
|
const t = createSetupTranslator();
|
|
@@ -72,9 +72,10 @@ const zaloSetupWizard = {
|
|
|
72
72
|
unconfiguredScore: 10,
|
|
73
73
|
includeStatusLine: true,
|
|
74
74
|
resolveConfigured: ({ cfg, accountId }) => {
|
|
75
|
-
const account =
|
|
75
|
+
const account = resolveZaloAccount({
|
|
76
76
|
cfg,
|
|
77
|
-
accountId
|
|
77
|
+
accountId,
|
|
78
|
+
allowUnresolvedSecretRef: true
|
|
78
79
|
});
|
|
79
80
|
return Boolean(account.token) || hasConfiguredSecretInput(account.config.botToken) || Boolean(account.config.tokenFile?.trim());
|
|
80
81
|
}
|
|
@@ -82,9 +83,10 @@ const zaloSetupWizard = {
|
|
|
82
83
|
credentials: [],
|
|
83
84
|
finalize: async ({ cfg, accountId, forceAllowFrom, options, prompter }) => {
|
|
84
85
|
let next = cfg;
|
|
85
|
-
const resolvedAccount =
|
|
86
|
+
const resolvedAccount = resolveZaloAccount({
|
|
86
87
|
cfg: next,
|
|
87
|
-
accountId
|
|
88
|
+
accountId,
|
|
89
|
+
allowUnresolvedSecretRef: true
|
|
88
90
|
});
|
|
89
91
|
const accountConfigured = Boolean(resolvedAccount.token);
|
|
90
92
|
const allowEnv = accountId === DEFAULT_ACCOUNT_ID;
|
package/dist/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as zaloDmPolicy, r as zaloSetupAdapter, t as createZaloSetupWizardProxy } from "
|
|
2
|
-
import { t as zaloPlugin } from "
|
|
3
|
-
import { n as resolveZaloRuntimeGroupPolicy } from "
|
|
1
|
+
import { n as zaloDmPolicy, r as zaloSetupAdapter, t as createZaloSetupWizardProxy } from "./.setup/setup-core-BLbVCFpT.mjs";
|
|
2
|
+
import { t as zaloPlugin } from "./.setup/channel-ChIucoCG.mjs";
|
|
3
|
+
import { n as resolveZaloRuntimeGroupPolicy } from "./.setup/group-access-8qHRzDHx.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 "
|
|
1
|
+
import { t as zaloPlugin } from "./.setup/channel-ChIucoCG.mjs";
|
|
2
2
|
export { zaloPlugin };
|
package/dist/contract-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as resolveZaloRuntimeGroupPolicy } from "
|
|
1
|
+
import { n as resolveZaloRuntimeGroupPolicy } from "./.setup/group-access-8qHRzDHx.mjs";
|
|
2
2
|
export { resolveZaloRuntimeGroupPolicy };
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as mergeAllowFromEntries, B as registerWebhookTargetWithPluginRoute, C as formatAllowFromLowercase, D as isNumericTargetId, E as isNormalizedSenderAllowed, F as promptSingleChannelSecretInput, G as
|
|
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
|
+
import { A as mergeAllowFromEntries, B as registerWebhookTargetWithPluginRoute, C as formatAllowFromLowercase, D as isNumericTargetId, E as isNormalizedSenderAllowed, F as promptSingleChannelSecretInput, G as resolveWebhookPath, H as resolveDefaultGroupPolicy, I as readJsonWebhookBodyOrReject, J as sendPayloadWithChunkedTextAndMedia, K as resolveWebhookTargetWithAuthOrRejectSync, L as readStringParam, M as normalizeAccountId, N as normalizeResolvedSecretInputString, O as jsonResult, P as normalizeSecretInputString, Q as withResolvedWebhookRequestPipeline, R as registerPluginHttpRoute, S as deliverTextOrMediaReply, T as hasConfiguredSecretInput, U as resolveInboundRouteEnvelopeBuilderWithRuntime, V as resolveClientIp, W as resolveOpenProviderRuntimeGroupPolicy, X as waitForAbortSignal, Y as setTopLevelChannelDmPolicyWithAllowFrom, Z as warnMissingProviderGroupPolicyFallbackOnce, _ as createChannelMessageReplyPipeline, a as WEBHOOK_ANOMALY_COUNTER_DEFAULTS, b as createFixedWindowRateLimiter, c as applyAccountNameToChannelSection, d as buildBaseAccountStatusSnapshot, f as buildChannelConfigSchema, g as chunkTextForOutbound, h as buildTokenChannelStatusSummary, i as PAIRING_APPROVED_MESSAGE, j as migrateBaseNameToDefaultAccount, k as logTypingFailure, l as applyBasicWebhookRequestGuards, m as buildSingleChannelSecretPromptState, n as setZaloRuntime, o as WEBHOOK_RATE_LIMIT_DEFAULTS, p as buildSecretInputSchema, q as runSingleChannelSecretStep, r as DEFAULT_ACCOUNT_ID, s as addWildcardAllowFrom, u as applySetupAccountConfigPatch, v as createChannelPairingController, w as formatPairingApproveHint, x as createWebhookAnomalyTracker, y as createDedupeCache, z as registerWebhookTarget } from "./.setup/runtime-api-CAA4ZtqF.mjs";
|
|
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, resolveInboundRouteEnvelopeBuilderWithRuntime, resolveOpenProviderRuntimeGroupPolicy, resolveWebhookPath, resolveWebhookTargetWithAuthOrRejectSync, runSingleChannelSecretStep, sendPayloadWithChunkedTextAndMedia, setTopLevelChannelDmPolicyWithAllowFrom, setZaloRuntime, waitForAbortSignal, warnMissingProviderGroupPolicyFallbackOnce, withResolvedWebhookRequestPipeline };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "
|
|
1
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./.setup/secret-contract-Bno_huZF.mjs";
|
|
2
2
|
export { channelSecrets, collectRuntimeConfigAssignments, secretTargetRegistryEntries };
|
package/dist/setup-api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as zaloDmPolicy, r as zaloSetupAdapter, t as createZaloSetupWizardProxy } from "
|
|
2
|
-
import { n as resolveZaloRuntimeGroupPolicy } from "
|
|
1
|
+
import { n as zaloDmPolicy, r as zaloSetupAdapter, t as createZaloSetupWizardProxy } from "./.setup/setup-core-BLbVCFpT.mjs";
|
|
2
|
+
import { n as resolveZaloRuntimeGroupPolicy } from "./.setup/group-access-8qHRzDHx.mjs";
|
|
3
3
|
import { loadBundledEntryExportSync } from "openclaw/plugin-sdk/channel-entry-contract";
|
|
4
4
|
//#region extensions/zalo/setup-api.ts
|
|
5
5
|
function createLazyObjectValue(load) {
|
package/dist/setup-entry.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { defineBundledChannelSetupEntry } from "openclaw/plugin-sdk/channel-entry-contract";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
2
3
|
//#region extensions/zalo/setup-entry.ts
|
|
3
4
|
var setup_entry_default = defineBundledChannelSetupEntry({
|
|
4
5
|
importMetaUrl: import.meta.url,
|
|
5
6
|
plugin: {
|
|
6
|
-
specifier: "
|
|
7
|
+
specifier: fileURLToPath(new URL(".setup/api-D2kRAHnC.mjs", import.meta.url).href),
|
|
7
8
|
exportName: "zaloPlugin"
|
|
8
9
|
},
|
|
9
10
|
secrets: {
|
|
10
|
-
specifier: "
|
|
11
|
+
specifier: fileURLToPath(new URL(".setup/secret-contract-api-CILabB_S.mjs", import.meta.url).href),
|
|
11
12
|
exportName: "channelSecrets"
|
|
12
13
|
}
|
|
13
14
|
});
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/zalo",
|
|
3
|
-
"version": "2026.7.
|
|
3
|
+
"version": "2026.7.33",
|
|
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.
|
|
11
|
+
"openclaw": ">=2026.7.33"
|
|
12
12
|
},
|
|
13
13
|
"peerDependenciesMeta": {
|
|
14
14
|
"openclaw": {
|
|
@@ -20,19 +20,8 @@
|
|
|
20
20
|
"./index.ts"
|
|
21
21
|
],
|
|
22
22
|
"setupEntry": "./dist/setup-entry.js",
|
|
23
|
-
"setupFeatures": {
|
|
24
|
-
"configPromotion": true
|
|
25
|
-
},
|
|
26
23
|
"channel": {
|
|
27
24
|
"id": "zalo",
|
|
28
|
-
"configuredState": {
|
|
29
|
-
"env": {
|
|
30
|
-
"anyOf": [
|
|
31
|
-
"ZALO_BOT_TOKEN",
|
|
32
|
-
"ZALO_WEBHOOK_SECRET"
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
25
|
"label": "Zalo",
|
|
37
26
|
"selectionLabel": "Zalo (Bot API)",
|
|
38
27
|
"docsPath": "/channels/zalo",
|
|
@@ -42,37 +31,7 @@
|
|
|
42
31
|
"zl"
|
|
43
32
|
],
|
|
44
33
|
"order": 80,
|
|
45
|
-
"quickstartAllowFrom": true
|
|
46
|
-
"setup": {
|
|
47
|
-
"fields": [
|
|
48
|
-
{
|
|
49
|
-
"key": "token",
|
|
50
|
-
"kind": "string",
|
|
51
|
-
"sensitive": true,
|
|
52
|
-
"cli": {
|
|
53
|
-
"flags": "--token <token>",
|
|
54
|
-
"description": "Zalo bot token"
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"key": "tokenFile",
|
|
59
|
-
"kind": "string",
|
|
60
|
-
"sensitive": true,
|
|
61
|
-
"cli": {
|
|
62
|
-
"flags": "--token-file <path>",
|
|
63
|
-
"description": "Zalo bot token file"
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"key": "useEnv",
|
|
68
|
-
"kind": "boolean",
|
|
69
|
-
"cli": {
|
|
70
|
-
"flags": "--use-env",
|
|
71
|
-
"description": "Use ZALO_BOT_TOKEN"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
}
|
|
34
|
+
"quickstartAllowFrom": true
|
|
76
35
|
},
|
|
77
36
|
"install": {
|
|
78
37
|
"npmSpec": "@openclaw/zalo",
|
|
@@ -80,10 +39,10 @@
|
|
|
80
39
|
"minHostVersion": ">=2026.4.10"
|
|
81
40
|
},
|
|
82
41
|
"compat": {
|
|
83
|
-
"pluginApi": ">=2026.7.
|
|
42
|
+
"pluginApi": ">=2026.7.33"
|
|
84
43
|
},
|
|
85
44
|
"build": {
|
|
86
|
-
"openclawVersion": "2026.7.
|
|
45
|
+
"openclawVersion": "2026.7.33"
|
|
87
46
|
},
|
|
88
47
|
"release": {
|
|
89
48
|
"publishToClawHub": true,
|