@openclaw/zalouser 2026.2.13 → 2026.2.14
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 +6 -0
- package/package.json +1 -1
- package/src/accounts.ts +1 -1
- package/src/channel.ts +11 -45
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/accounts.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OpenClawConfig } from "openclaw/plugin-sdk";
|
|
2
|
-
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk";
|
|
2
|
+
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
3
3
|
import type { ResolvedZalouserAccount, ZalouserAccountConfig, ZalouserConfig } from "./types.js";
|
|
4
4
|
import { runZca, parseJsonOutput } from "./zca.js";
|
|
5
5
|
|
package/src/channel.ts
CHANGED
|
@@ -11,10 +11,13 @@ import {
|
|
|
11
11
|
applyAccountNameToChannelSection,
|
|
12
12
|
buildChannelConfigSchema,
|
|
13
13
|
DEFAULT_ACCOUNT_ID,
|
|
14
|
+
chunkTextForOutbound,
|
|
14
15
|
deleteAccountFromConfigSection,
|
|
16
|
+
formatAllowFromLowercase,
|
|
15
17
|
formatPairingApproveHint,
|
|
16
18
|
migrateBaseNameToDefaultAccount,
|
|
17
19
|
normalizeAccountId,
|
|
20
|
+
resolveChannelAccountConfigBasePath,
|
|
18
21
|
setAccountEnabledInConfigSection,
|
|
19
22
|
} from "openclaw/plugin-sdk";
|
|
20
23
|
import type { ZcaFriend, ZcaGroup, ZcaUserInfo } from "./types.js";
|
|
@@ -117,11 +120,7 @@ export const zalouserDock: ChannelDock = {
|
|
|
117
120
|
String(entry),
|
|
118
121
|
),
|
|
119
122
|
formatAllowFrom: ({ allowFrom }) =>
|
|
120
|
-
allowFrom
|
|
121
|
-
.map((entry) => String(entry).trim())
|
|
122
|
-
.filter(Boolean)
|
|
123
|
-
.map((entry) => entry.replace(/^(zalouser|zlu):/i, ""))
|
|
124
|
-
.map((entry) => entry.toLowerCase()),
|
|
123
|
+
formatAllowFromLowercase({ allowFrom, stripPrefixRe: /^(zalouser|zlu):/i }),
|
|
125
124
|
},
|
|
126
125
|
groups: {
|
|
127
126
|
resolveRequireMention: () => true,
|
|
@@ -193,19 +192,16 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
193
192
|
String(entry),
|
|
194
193
|
),
|
|
195
194
|
formatAllowFrom: ({ allowFrom }) =>
|
|
196
|
-
allowFrom
|
|
197
|
-
.map((entry) => String(entry).trim())
|
|
198
|
-
.filter(Boolean)
|
|
199
|
-
.map((entry) => entry.replace(/^(zalouser|zlu):/i, ""))
|
|
200
|
-
.map((entry) => entry.toLowerCase()),
|
|
195
|
+
formatAllowFromLowercase({ allowFrom, stripPrefixRe: /^(zalouser|zlu):/i }),
|
|
201
196
|
},
|
|
202
197
|
security: {
|
|
203
198
|
resolveDmPolicy: ({ cfg, accountId, account }) => {
|
|
204
199
|
const resolvedAccountId = accountId ?? account.accountId ?? DEFAULT_ACCOUNT_ID;
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
:
|
|
200
|
+
const basePath = resolveChannelAccountConfigBasePath({
|
|
201
|
+
cfg,
|
|
202
|
+
channelKey: "zalouser",
|
|
203
|
+
accountId: resolvedAccountId,
|
|
204
|
+
});
|
|
209
205
|
return {
|
|
210
206
|
policy: account.config.dmPolicy ?? "pairing",
|
|
211
207
|
allowFrom: account.config.allowFrom ?? [],
|
|
@@ -519,37 +515,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
519
515
|
},
|
|
520
516
|
outbound: {
|
|
521
517
|
deliveryMode: "direct",
|
|
522
|
-
chunker:
|
|
523
|
-
if (!text) {
|
|
524
|
-
return [];
|
|
525
|
-
}
|
|
526
|
-
if (limit <= 0 || text.length <= limit) {
|
|
527
|
-
return [text];
|
|
528
|
-
}
|
|
529
|
-
const chunks: string[] = [];
|
|
530
|
-
let remaining = text;
|
|
531
|
-
while (remaining.length > limit) {
|
|
532
|
-
const window = remaining.slice(0, limit);
|
|
533
|
-
const lastNewline = window.lastIndexOf("\n");
|
|
534
|
-
const lastSpace = window.lastIndexOf(" ");
|
|
535
|
-
let breakIdx = lastNewline > 0 ? lastNewline : lastSpace;
|
|
536
|
-
if (breakIdx <= 0) {
|
|
537
|
-
breakIdx = limit;
|
|
538
|
-
}
|
|
539
|
-
const rawChunk = remaining.slice(0, breakIdx);
|
|
540
|
-
const chunk = rawChunk.trimEnd();
|
|
541
|
-
if (chunk.length > 0) {
|
|
542
|
-
chunks.push(chunk);
|
|
543
|
-
}
|
|
544
|
-
const brokeOnSeparator = breakIdx < remaining.length && /\s/.test(remaining[breakIdx]);
|
|
545
|
-
const nextStart = Math.min(remaining.length, breakIdx + (brokeOnSeparator ? 1 : 0));
|
|
546
|
-
remaining = remaining.slice(nextStart).trimStart();
|
|
547
|
-
}
|
|
548
|
-
if (remaining.length) {
|
|
549
|
-
chunks.push(remaining);
|
|
550
|
-
}
|
|
551
|
-
return chunks;
|
|
552
|
-
},
|
|
518
|
+
chunker: chunkTextForOutbound,
|
|
553
519
|
chunkerMode: "text",
|
|
554
520
|
textChunkLimit: 2000,
|
|
555
521
|
sendText: async ({ to, text, accountId, cfg }) => {
|