weacpx 0.4.9 → 0.5.0
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/README.md +25 -0
- package/dist/bridge/bridge-main.js +20 -3
- package/dist/channels/types.d.ts +11 -0
- package/dist/channels/weixin-channel.d.ts +3 -1
- package/dist/cli.js +1237 -83
- package/dist/config/types.d.ts +7 -0
- package/dist/plugin-api.d.ts +1 -1
- package/dist/plugin-api.js +1 -1
- package/dist/plugins/compatibility.d.ts +1 -1
- package/dist/util/private-file.d.ts +26 -0
- package/dist/weixin/agent/interface.d.ts +2 -0
- package/dist/weixin/messaging/scheduled-turn.d.ts +22 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -323,6 +323,30 @@ opencode, qoder, qwen, trae
|
|
|
323
323
|
/cancel
|
|
324
324
|
```
|
|
325
325
|
|
|
326
|
+
### 定时任务(/later)
|
|
327
|
+
|
|
328
|
+
让 agent 在未来某个时间自动收到一条消息。任务绑定「创建时的当前会话」,到点后把这条消息作为普通 prompt 发给那个会话。
|
|
329
|
+
|
|
330
|
+
| 命令 | 说明 |
|
|
331
|
+
|------|------|
|
|
332
|
+
| `/lt <时间> <消息>` | 创建一次性定时任务(`/later` 同义) |
|
|
333
|
+
| `/lt list` | 查看全局待执行任务 |
|
|
334
|
+
| `/lt cancel <id>` | 取消待执行任务 |
|
|
335
|
+
|
|
336
|
+
最常见例子:
|
|
337
|
+
|
|
338
|
+
```text
|
|
339
|
+
/lt in 2h 检查 CI 是否通过
|
|
340
|
+
/lt 明天 09:00 看 PR
|
|
341
|
+
/lt list
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
说明:
|
|
345
|
+
|
|
346
|
+
- 只支持一次性任务,时间必须在 10 秒之后、7 天之内
|
|
347
|
+
- 时间格式是固定白名单(相对时间 / 今天·明天·后天 / 星期几 + 时刻),不支持自然语言
|
|
348
|
+
- 完整时间格式、任务状态与限制见 [docs/later-command.md](./docs/later-command.md)
|
|
349
|
+
|
|
326
350
|
### 配置与权限
|
|
327
351
|
|
|
328
352
|
| 命令 | 说明 |
|
|
@@ -514,6 +538,7 @@ bun run dev
|
|
|
514
538
|
### 日常使用
|
|
515
539
|
|
|
516
540
|
- 想查看完整聊天命令参考:[docs/commands.md](./docs/commands.md)
|
|
541
|
+
- 想用定时任务(`/later`)安排一次性的未来消息:[docs/later-command.md](./docs/later-command.md)
|
|
517
542
|
- 想理解什么时候该用 delegate、什么时候该开 group:[docs/weacpx-group-usage-guide.md](./docs/weacpx-group-usage-guide.md)
|
|
518
543
|
|
|
519
544
|
### 排错与验证
|
|
@@ -1042,6 +1042,13 @@ function normalizeBridgePermissionMode(value) {
|
|
|
1042
1042
|
function normalizeBridgeNonInteractivePermissions(value) {
|
|
1043
1043
|
return value === "deny" || value === "fail" ? value : "deny";
|
|
1044
1044
|
}
|
|
1045
|
+
function normalizeBridgeQueueOwnerTtlSeconds(value) {
|
|
1046
|
+
if (value === undefined) {
|
|
1047
|
+
return;
|
|
1048
|
+
}
|
|
1049
|
+
const parsed = Number(value);
|
|
1050
|
+
return Number.isFinite(parsed) && parsed >= 0 ? parsed : undefined;
|
|
1051
|
+
}
|
|
1045
1052
|
|
|
1046
1053
|
// src/bridge/bridge-server.ts
|
|
1047
1054
|
init_prompt_output();
|
|
@@ -1125,7 +1132,8 @@ class BridgeRuntime {
|
|
|
1125
1132
|
queueOwnerLauncher;
|
|
1126
1133
|
acpxVerboseSupported = undefined;
|
|
1127
1134
|
constructor(command = "acpx", run = defaultRunner, runSessionCreate = shellSessionCreateRunner, options = {}, runPromptCommand = defaultPromptRunner, repairSessionIndex = tryRepairAcpxSessionIndex, queueOwnerLauncher = new AcpxQueueOwnerLauncher({
|
|
1128
|
-
acpxCommand: command
|
|
1135
|
+
acpxCommand: command,
|
|
1136
|
+
...typeof options.queueOwnerTtlSeconds === "number" && Number.isFinite(options.queueOwnerTtlSeconds) ? { ttlMs: options.queueOwnerTtlSeconds * 1000 } : {}
|
|
1129
1137
|
})) {
|
|
1130
1138
|
this.command = command;
|
|
1131
1139
|
this.run = run;
|
|
@@ -1381,13 +1389,21 @@ class BridgeRuntime {
|
|
|
1381
1389
|
"--json-strict",
|
|
1382
1390
|
"--cwd",
|
|
1383
1391
|
input.cwd,
|
|
1384
|
-
...this.buildPermissionArgs()
|
|
1392
|
+
...this.buildPermissionArgs(),
|
|
1393
|
+
...this.buildQueueOwnerTtlArgs()
|
|
1385
1394
|
];
|
|
1386
1395
|
if (input.agentCommand) {
|
|
1387
1396
|
return [...prefix, "--agent", input.agentCommand, ...tail];
|
|
1388
1397
|
}
|
|
1389
1398
|
return [...prefix, input.agent, ...tail];
|
|
1390
1399
|
}
|
|
1400
|
+
buildQueueOwnerTtlArgs() {
|
|
1401
|
+
const ttl = this.options.queueOwnerTtlSeconds;
|
|
1402
|
+
if (typeof ttl !== "number" || !Number.isFinite(ttl)) {
|
|
1403
|
+
return [];
|
|
1404
|
+
}
|
|
1405
|
+
return ["--ttl", String(ttl)];
|
|
1406
|
+
}
|
|
1391
1407
|
buildPermissionArgs() {
|
|
1392
1408
|
const permissionMode = this.options.permissionMode ?? "approve-all";
|
|
1393
1409
|
const nonInteractivePermissions = this.options.nonInteractivePermissions ?? "deny";
|
|
@@ -1924,7 +1940,8 @@ async function processBridgeInput(options) {
|
|
|
1924
1940
|
async function runBridgeMain() {
|
|
1925
1941
|
const server = new BridgeServer(new BridgeRuntime(process.env.WEACPX_BRIDGE_ACPX_COMMAND ?? "acpx", undefined, undefined, {
|
|
1926
1942
|
permissionMode: normalizeBridgePermissionMode(process.env.WEACPX_BRIDGE_PERMISSION_MODE),
|
|
1927
|
-
nonInteractivePermissions: normalizeBridgeNonInteractivePermissions(process.env.WEACPX_BRIDGE_NON_INTERACTIVE_PERMISSIONS)
|
|
1943
|
+
nonInteractivePermissions: normalizeBridgeNonInteractivePermissions(process.env.WEACPX_BRIDGE_NON_INTERACTIVE_PERMISSIONS),
|
|
1944
|
+
queueOwnerTtlSeconds: normalizeBridgeQueueOwnerTtlSeconds(process.env.WEACPX_BRIDGE_QUEUE_OWNER_TTL_SECONDS)
|
|
1928
1945
|
}));
|
|
1929
1946
|
const input = createInterface({
|
|
1930
1947
|
input: process.stdin,
|
package/dist/channels/types.d.ts
CHANGED
|
@@ -22,6 +22,16 @@ export interface CoordinatorMessageInput {
|
|
|
22
22
|
replyContextToken?: string;
|
|
23
23
|
text: string;
|
|
24
24
|
}
|
|
25
|
+
export interface ScheduledChannelMessageInput {
|
|
26
|
+
chatKey: string;
|
|
27
|
+
taskId?: string;
|
|
28
|
+
sessionAlias: string;
|
|
29
|
+
accountId?: string;
|
|
30
|
+
replyContextToken?: string;
|
|
31
|
+
noticeText: string;
|
|
32
|
+
promptText: string;
|
|
33
|
+
abortSignal?: AbortSignal;
|
|
34
|
+
}
|
|
25
35
|
export interface ChannelStartInput {
|
|
26
36
|
agent: ChatAgent;
|
|
27
37
|
abortSignal: AbortSignal;
|
|
@@ -60,6 +70,7 @@ export interface MessageChannelRuntime {
|
|
|
60
70
|
notifyTaskCompletion(task: OrchestrationTaskRecord): Promise<void>;
|
|
61
71
|
notifyTaskProgress(task: OrchestrationTaskRecord, text: string): Promise<void>;
|
|
62
72
|
sendCoordinatorMessage(input: CoordinatorMessageInput): Promise<void>;
|
|
73
|
+
sendScheduledMessage?(input: ScheduledChannelMessageInput): Promise<void>;
|
|
63
74
|
}
|
|
64
75
|
export type ToolUseStatus = "running" | "success" | "error";
|
|
65
76
|
export type ToolUseKind = "read" | "search" | "execute" | "edit" | "think" | "other";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { MessageChannelRuntime, ChannelStartInput, CoordinatorMessageInput, OrchestrationDeliveryCallbacks, ConsumerLock, ConsumerLockOptions } from "./types.js";
|
|
1
|
+
import type { MessageChannelRuntime, ChannelStartInput, CoordinatorMessageInput, OrchestrationDeliveryCallbacks, ConsumerLock, ConsumerLockOptions, ScheduledChannelMessageInput } from "./types.js";
|
|
2
2
|
import type { RuntimeMediaStore } from "./media-store.js";
|
|
3
3
|
import type { OrchestrationTaskRecord } from "../orchestration/orchestration-types.js";
|
|
4
4
|
export declare class WeixinChannel implements MessageChannelRuntime {
|
|
5
5
|
readonly id = "weixin";
|
|
6
|
+
private agent;
|
|
6
7
|
private quota;
|
|
7
8
|
private logger;
|
|
8
9
|
private markDelivered;
|
|
@@ -19,4 +20,5 @@ export declare class WeixinChannel implements MessageChannelRuntime {
|
|
|
19
20
|
notifyTaskCompletion(task: OrchestrationTaskRecord): Promise<void>;
|
|
20
21
|
notifyTaskProgress(task: OrchestrationTaskRecord, text: string): Promise<void>;
|
|
21
22
|
sendCoordinatorMessage(input: CoordinatorMessageInput): Promise<void>;
|
|
23
|
+
sendScheduledMessage(input: ScheduledChannelMessageInput): Promise<void>;
|
|
22
24
|
}
|