@openclaw/zalouser 2026.2.2 → 2026.2.9
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 +24 -0
- package/index.ts +2 -2
- package/package.json +2 -3
- package/src/channel.ts +1 -1
- package/src/config-schema.ts +1 -0
- package/src/monitor.ts +12 -1
- package/src/tool.ts +9 -7
- package/src/types.ts +2 -0
- package/src/zca.ts +1 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026.2.6-3
|
|
4
|
+
|
|
5
|
+
### Changes
|
|
6
|
+
|
|
7
|
+
- Version alignment with core OpenClaw release numbers.
|
|
8
|
+
|
|
9
|
+
## 2026.2.6-2
|
|
10
|
+
|
|
11
|
+
### Changes
|
|
12
|
+
|
|
13
|
+
- Version alignment with core OpenClaw release numbers.
|
|
14
|
+
|
|
15
|
+
## 2026.2.6
|
|
16
|
+
|
|
17
|
+
### Changes
|
|
18
|
+
|
|
19
|
+
- Version alignment with core OpenClaw release numbers.
|
|
20
|
+
|
|
21
|
+
## 2026.2.4
|
|
22
|
+
|
|
23
|
+
### Changes
|
|
24
|
+
|
|
25
|
+
- Version alignment with core OpenClaw release numbers.
|
|
26
|
+
|
|
3
27
|
## 2026.2.2
|
|
4
28
|
|
|
5
29
|
### Changes
|
package/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
1
|
+
import type { AnyAgentTool, OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
2
2
|
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
|
|
3
3
|
import { zalouserDock, zalouserPlugin } from "./src/channel.js";
|
|
4
4
|
import { setZalouserRuntime } from "./src/runtime.js";
|
|
@@ -24,7 +24,7 @@ const plugin = {
|
|
|
24
24
|
"friends (list/search friends), groups (list groups), me (profile info), status (auth check).",
|
|
25
25
|
parameters: ZalouserToolSchema,
|
|
26
26
|
execute: executeZalouserTool,
|
|
27
|
-
});
|
|
27
|
+
} as AnyAgentTool);
|
|
28
28
|
},
|
|
29
29
|
};
|
|
30
30
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/zalouser",
|
|
3
|
-
"version": "2026.2.
|
|
3
|
+
"version": "2026.2.9",
|
|
4
4
|
"description": "OpenClaw Zalo Personal Account plugin via zca-cli",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@sinclair/typebox": "0.34.48"
|
|
8
|
-
"openclaw": "workspace:*"
|
|
7
|
+
"@sinclair/typebox": "0.34.48"
|
|
9
8
|
},
|
|
10
9
|
"devDependencies": {
|
|
11
10
|
"openclaw": "workspace:*"
|
package/src/channel.ts
CHANGED
package/src/config-schema.ts
CHANGED
|
@@ -19,6 +19,7 @@ const zalouserAccountSchema = z.object({
|
|
|
19
19
|
groupPolicy: z.enum(["disabled", "allowlist", "open"]).optional(),
|
|
20
20
|
groups: z.object({}).catchall(groupConfigSchema).optional(),
|
|
21
21
|
messagePrefix: z.string().optional(),
|
|
22
|
+
responsePrefix: z.string().optional(),
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
export const ZalouserConfigSchema = zalouserAccountSchema.extend({
|
package/src/monitor.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChildProcess } from "node:child_process";
|
|
2
2
|
import type { OpenClawConfig, MarkdownTableMode, RuntimeEnv } from "openclaw/plugin-sdk";
|
|
3
|
-
import { mergeAllowlist, summarizeMapping } from "openclaw/plugin-sdk";
|
|
3
|
+
import { createReplyPrefixOptions, mergeAllowlist, summarizeMapping } from "openclaw/plugin-sdk";
|
|
4
4
|
import type { ResolvedZalouserAccount, ZcaFriend, ZcaGroup, ZcaMessage } from "./types.js";
|
|
5
5
|
import { getZalouserRuntime } from "./runtime.js";
|
|
6
6
|
import { sendMessageZalouser } from "./send.js";
|
|
@@ -334,10 +334,18 @@ async function processMessage(
|
|
|
334
334
|
},
|
|
335
335
|
});
|
|
336
336
|
|
|
337
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
338
|
+
cfg: config,
|
|
339
|
+
agentId: route.agentId,
|
|
340
|
+
channel: "zalouser",
|
|
341
|
+
accountId: account.accountId,
|
|
342
|
+
});
|
|
343
|
+
|
|
337
344
|
await core.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
|
|
338
345
|
ctx: ctxPayload,
|
|
339
346
|
cfg: config,
|
|
340
347
|
dispatcherOptions: {
|
|
348
|
+
...prefixOptions,
|
|
341
349
|
deliver: async (payload) => {
|
|
342
350
|
await deliverZalouserReply({
|
|
343
351
|
payload: payload as { text?: string; mediaUrls?: string[]; mediaUrl?: string },
|
|
@@ -360,6 +368,9 @@ async function processMessage(
|
|
|
360
368
|
runtime.error(`[${account.accountId}] Zalouser ${info.kind} reply failed: ${String(err)}`);
|
|
361
369
|
},
|
|
362
370
|
},
|
|
371
|
+
replyOptions: {
|
|
372
|
+
onModelSelected,
|
|
373
|
+
},
|
|
363
374
|
});
|
|
364
375
|
}
|
|
365
376
|
|
package/src/tool.ts
CHANGED
|
@@ -3,6 +3,11 @@ import { runZca, parseJsonOutput } from "./zca.js";
|
|
|
3
3
|
|
|
4
4
|
const ACTIONS = ["send", "image", "link", "friends", "groups", "me", "status"] as const;
|
|
5
5
|
|
|
6
|
+
type AgentToolResult = {
|
|
7
|
+
content: Array<{ type: string; text: string }>;
|
|
8
|
+
details?: unknown;
|
|
9
|
+
};
|
|
10
|
+
|
|
6
11
|
function stringEnum<T extends readonly string[]>(
|
|
7
12
|
values: T,
|
|
8
13
|
options: { description?: string } = {},
|
|
@@ -38,12 +43,7 @@ type ToolParams = {
|
|
|
38
43
|
url?: string;
|
|
39
44
|
};
|
|
40
45
|
|
|
41
|
-
|
|
42
|
-
content: Array<{ type: string; text: string }>;
|
|
43
|
-
details: unknown;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
function json(payload: unknown): ToolResult {
|
|
46
|
+
function json(payload: unknown): AgentToolResult {
|
|
47
47
|
return {
|
|
48
48
|
content: [{ type: "text", text: JSON.stringify(payload, null, 2) }],
|
|
49
49
|
details: payload,
|
|
@@ -53,7 +53,9 @@ function json(payload: unknown): ToolResult {
|
|
|
53
53
|
export async function executeZalouserTool(
|
|
54
54
|
_toolCallId: string,
|
|
55
55
|
params: ToolParams,
|
|
56
|
-
|
|
56
|
+
_signal?: AbortSignal,
|
|
57
|
+
_onUpdate?: unknown,
|
|
58
|
+
): Promise<AgentToolResult> {
|
|
57
59
|
try {
|
|
58
60
|
switch (params.action) {
|
|
59
61
|
case "send": {
|
package/src/types.ts
CHANGED
|
@@ -80,6 +80,7 @@ export type ZalouserAccountConfig = {
|
|
|
80
80
|
{ allow?: boolean; enabled?: boolean; tools?: { allow?: string[]; deny?: string[] } }
|
|
81
81
|
>;
|
|
82
82
|
messagePrefix?: string;
|
|
83
|
+
responsePrefix?: string;
|
|
83
84
|
};
|
|
84
85
|
|
|
85
86
|
export type ZalouserConfig = {
|
|
@@ -95,6 +96,7 @@ export type ZalouserConfig = {
|
|
|
95
96
|
{ allow?: boolean; enabled?: boolean; tools?: { allow?: string[]; deny?: string[] } }
|
|
96
97
|
>;
|
|
97
98
|
messagePrefix?: string;
|
|
99
|
+
responsePrefix?: string;
|
|
98
100
|
accounts?: Record<string, ZalouserAccountConfig>;
|
|
99
101
|
};
|
|
100
102
|
|
package/src/zca.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { spawn, type SpawnOptions } from "node:child_process";
|
|
2
|
+
import { stripAnsi } from "openclaw/plugin-sdk";
|
|
2
3
|
import type { ZcaResult, ZcaRunOptions } from "./types.js";
|
|
3
4
|
|
|
4
5
|
const ZCA_BINARY = "zca";
|
|
@@ -107,11 +108,6 @@ export function runZcaInteractive(args: string[], options?: ZcaRunOptions): Prom
|
|
|
107
108
|
});
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
function stripAnsi(str: string): string {
|
|
111
|
-
// oxlint-disable-next-line no-control-regex
|
|
112
|
-
return str.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "");
|
|
113
|
-
}
|
|
114
|
-
|
|
115
111
|
export function parseJsonOutput<T>(stdout: string): T | null {
|
|
116
112
|
try {
|
|
117
113
|
return JSON.parse(stdout) as T;
|