@openclaw/zalouser 2026.2.25 → 2026.3.1
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/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/src/accounts.ts +11 -3
- package/src/monitor.ts +8 -3
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/accounts.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { OpenClawConfig } from "openclaw/plugin-sdk";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_ACCOUNT_ID,
|
|
4
|
+
normalizeAccountId,
|
|
5
|
+
normalizeOptionalAccountId,
|
|
6
|
+
} from "openclaw/plugin-sdk/account-id";
|
|
3
7
|
import type { ResolvedZalouserAccount, ZalouserAccountConfig, ZalouserConfig } from "./types.js";
|
|
4
8
|
import { runZca, parseJsonOutput } from "./zca.js";
|
|
5
9
|
|
|
@@ -21,8 +25,12 @@ export function listZalouserAccountIds(cfg: OpenClawConfig): string[] {
|
|
|
21
25
|
|
|
22
26
|
export function resolveDefaultZalouserAccountId(cfg: OpenClawConfig): string {
|
|
23
27
|
const zalouserConfig = cfg.channels?.zalouser as ZalouserConfig | undefined;
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
const preferred = normalizeOptionalAccountId(zalouserConfig?.defaultAccount);
|
|
29
|
+
if (
|
|
30
|
+
preferred &&
|
|
31
|
+
listZalouserAccountIds(cfg).some((accountId) => normalizeAccountId(accountId) === preferred)
|
|
32
|
+
) {
|
|
33
|
+
return preferred;
|
|
26
34
|
}
|
|
27
35
|
const ids = listZalouserAccountIds(cfg);
|
|
28
36
|
if (ids.includes(DEFAULT_ACCOUNT_ID)) {
|
package/src/monitor.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
RuntimeEnv,
|
|
7
7
|
} from "openclaw/plugin-sdk";
|
|
8
8
|
import {
|
|
9
|
+
createScopedPairingAccess,
|
|
9
10
|
createReplyPrefixOptions,
|
|
10
11
|
resolveOutboundMediaUrls,
|
|
11
12
|
mergeAllowlist,
|
|
@@ -177,6 +178,11 @@ async function processMessage(
|
|
|
177
178
|
statusSink?: (patch: { lastInboundAt?: number; lastOutboundAt?: number }) => void,
|
|
178
179
|
): Promise<void> {
|
|
179
180
|
const { threadId, content, timestamp, metadata } = message;
|
|
181
|
+
const pairing = createScopedPairingAccess({
|
|
182
|
+
core,
|
|
183
|
+
channel: "zalouser",
|
|
184
|
+
accountId: account.accountId,
|
|
185
|
+
});
|
|
180
186
|
if (!content?.trim()) {
|
|
181
187
|
return;
|
|
182
188
|
}
|
|
@@ -225,7 +231,7 @@ async function processMessage(
|
|
|
225
231
|
configuredAllowFrom: configAllowFrom,
|
|
226
232
|
senderId,
|
|
227
233
|
isSenderAllowed,
|
|
228
|
-
readAllowFromStore:
|
|
234
|
+
readAllowFromStore: pairing.readAllowFromStore,
|
|
229
235
|
shouldComputeCommandAuthorized: (body, cfg) =>
|
|
230
236
|
core.channel.commands.shouldComputeCommandAuthorized(body, cfg),
|
|
231
237
|
resolveCommandAuthorizedFromAuthorizers: (params) =>
|
|
@@ -243,8 +249,7 @@ async function processMessage(
|
|
|
243
249
|
|
|
244
250
|
if (!allowed) {
|
|
245
251
|
if (dmPolicy === "pairing") {
|
|
246
|
-
const { code, created } = await
|
|
247
|
-
channel: "zalouser",
|
|
252
|
+
const { code, created } = await pairing.upsertPairingRequest({
|
|
248
253
|
id: senderId,
|
|
249
254
|
meta: { name: senderName || undefined },
|
|
250
255
|
});
|