weacpx 0.4.10 → 0.5.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/README.md CHANGED
@@ -182,6 +182,8 @@ weacpx restart
182
182
  | `weacpx workspace list` | 查看本机已注册的 workspace |
183
183
  | `weacpx workspace add [name] [--raw]` | 把当前目录注册成 workspace;不传 `name` 时使用当前目录名,含特殊字符的名称会被自动规范化 |
184
184
  | `weacpx workspace rm <name>` | 删除 workspace |
185
+ | `weacpx later list` / `weacpx lt list` | 在终端查看本机待执行定时任务 |
186
+ | `weacpx later cancel <id>` / `weacpx lt cancel <id>` | 在终端取消本机待执行定时任务 |
185
187
 
186
188
  首次运行 `weacpx start` 或 `weacpx run` 时,如果没有会话、workspace 和插件,CLI 会询问是否把当前目录创建为 workspace,并选择一个内置 agent 模板;服务启动后会通过正常会话创建流程创建初始 acpx 会话。
187
189
 
@@ -323,6 +325,34 @@ opencode, qoder, qwen, trae
323
325
  /cancel
324
326
  ```
325
327
 
328
+ ### 定时任务(/later)
329
+
330
+ 让 agent 在未来某个时间自动收到一条消息。**默认在一个为该任务新建的临时会话里执行**(沿用创建时当前会话的 agent 与工作区,对话历史全新,跑完即销毁);加 `--bind` 则发送到创建时绑定的当前会话。到点后把消息作为普通 prompt 投递,结果推回原聊天。
331
+
332
+ | 命令 | 说明 |
333
+ |------|------|
334
+ | `/lt <时间> <消息>` | 创建定时任务(默认临时会话执行;`/later` 同义) |
335
+ | `/lt --bind <时间> <消息>` | 改为发送到当前会话 |
336
+ | `/lt list` | 查看全局待执行任务 |
337
+ | `/lt cancel <id>` | 取消待执行任务 |
338
+
339
+ 最常见例子:
340
+
341
+ ```text
342
+ /lt in 2h 检查 CI 是否通过 # 临时会话(默认)
343
+ /lt --bind 明天 09:00 看 PR # 绑定当前会话
344
+ /lt list
345
+ ```
346
+
347
+ 说明:
348
+
349
+ - 默认临时会话执行,`--bind` 绑定当前会话;默认模式可用配置 `later.defaultMode`(`temp` / `bind`,默认 `temp`)修改
350
+ - 只支持一次性任务,时间必须在 10 秒之后、7 天之内
351
+ - 时间格式是固定白名单(相对时间 / 今天·明天·后天 / 星期几 + 时刻),不支持自然语言
352
+ - 普通对话中 agent 也可以通过当前会话内部工具创建、查看与取消定时任务(`scheduled_create` / `scheduled_list` / `scheduled_cancel`);路由和权限由 daemon 从当前聊天会话解析,外部 `mcp-stdio` 不暴露这些工具
353
+ - 终端里也可以用 `weacpx later list` / `weacpx later cancel <id>` 管理待执行任务;CLI 只做查看和取消,不创建定时任务
354
+ - 完整时间格式、临时/绑定模式、任务状态与限制见 [docs/later-command.md](./docs/later-command.md)
355
+
326
356
  ### 配置与权限
327
357
 
328
358
  | 命令 | 说明 |
@@ -383,6 +413,8 @@ README 里只保留用户视角的最常用命令。
383
413
 
384
414
  `delegate_request` 支持 MCP Tasks:支持该能力的 host 可以让委派请求立即返回原生 task handle,之后通过 `tasks/get` / `tasks/result` / `tasks/cancel` 获取状态、结果或取消任务;worker 输出的 `[PROGRESS] ...` 会显示在 `tasks/get` / `tasks/list` 的 `statusMessage` 里;`input_required` 状态下的 `tasks/result` 会返回下一步操作提示并结束本次 result stream,而不是长时间阻塞;client 按提示调用 `task_get` / `task_approve` / `coordinator_answer_question` 等工具后,再继续 `tasks/get` / `tasks/result` 轮询。不支持 MCP Tasks 的 host 仍可使用兼容工具 `task_get` / `task_list` / `task_watch` / `task_cancel`。
385
415
 
416
+ 定时任务的自然语言创建工具是 weacpx 当前会话内部能力,不会出现在外部 `weacpx mcp-stdio` 的工具列表里。
417
+
386
418
  先启动 daemon:
387
419
 
388
420
  ```bash
@@ -514,6 +546,7 @@ bun run dev
514
546
  ### 日常使用
515
547
 
516
548
  - 想查看完整聊天命令参考:[docs/commands.md](./docs/commands.md)
549
+ - 想用定时任务(`/later`)安排一次性的未来消息:[docs/later-command.md](./docs/later-command.md)
517
550
  - 想理解什么时候该用 delegate、什么时候该开 group:[docs/weacpx-group-usage-guide.md](./docs/weacpx-group-usage-guide.md)
518
551
 
519
552
  ### 排错与验证
@@ -36,13 +36,9 @@
36
36
  }
37
37
  },
38
38
  "workspaces": {
39
- "backend": {
40
- "cwd": "/absolute/path/to/backend",
41
- "description": "backend repo"
42
- },
43
- "weacpx-console": {
44
- "cwd": "/Users/your-name/Projects/weacpx/.worktrees/weacpx-console-v1",
45
- "description": "weacpx console worktree"
39
+ "home": {
40
+ "cwd": "~",
41
+ "description": "用户主目录"
46
42
  }
47
43
  }
48
44
  }
@@ -843,7 +843,7 @@ function buildWeacpxMcpServerSpec(input) {
843
843
  "mcp-stdio",
844
844
  "--coordinator-session",
845
845
  input.coordinatorSession,
846
- ...input.sourceHandle ? ["--source-handle", input.sourceHandle] : []
846
+ ...input.sourceHandle ? ["--source-handle", input.sourceHandle] : ["--internal-session-tools"]
847
847
  ]
848
848
  };
849
849
  }
@@ -22,6 +22,28 @@ export interface CoordinatorMessageInput {
22
22
  replyContextToken?: string;
23
23
  text: string;
24
24
  }
25
+ export interface ScheduledSessionDescriptor {
26
+ alias: string;
27
+ agent: string;
28
+ workspace: string;
29
+ transportSession: string;
30
+ }
31
+ export interface ScheduledChannelMessageInput {
32
+ chatKey: string;
33
+ taskId?: string;
34
+ sessionAlias: string;
35
+ /**
36
+ * When present, the scheduled prompt runs in a transient session described
37
+ * here (temp mode) instead of the persisted logical session named by
38
+ * `sessionAlias`. `sessionAlias` still records the origin session for display.
39
+ */
40
+ sessionDescriptor?: ScheduledSessionDescriptor;
41
+ accountId?: string;
42
+ replyContextToken?: string;
43
+ noticeText: string;
44
+ promptText: string;
45
+ abortSignal?: AbortSignal;
46
+ }
25
47
  export interface ChannelStartInput {
26
48
  agent: ChatAgent;
27
49
  abortSignal: AbortSignal;
@@ -60,6 +82,7 @@ export interface MessageChannelRuntime {
60
82
  notifyTaskCompletion(task: OrchestrationTaskRecord): Promise<void>;
61
83
  notifyTaskProgress(task: OrchestrationTaskRecord, text: string): Promise<void>;
62
84
  sendCoordinatorMessage(input: CoordinatorMessageInput): Promise<void>;
85
+ sendScheduledMessage?(input: ScheduledChannelMessageInput): Promise<void>;
63
86
  }
64
87
  export type ToolUseStatus = "running" | "success" | "error";
65
88
  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
  }