@baoanaz/cviauto 0.6.5 → 0.6.8
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/dist/templates/claude/agents/trellis-check.md +61 -61
- package/dist/templates/claude/agents/trellis-implement.md +58 -58
- package/dist/templates/claude/agents/trellis-research.md +67 -67
- package/dist/templates/codebuddy/agents/trellis-check.md +61 -61
- package/dist/templates/codebuddy/agents/trellis-implement.md +58 -58
- package/dist/templates/codebuddy/agents/trellis-research.md +67 -67
- package/dist/templates/codex/agents/trellis-check.toml +99 -30
- package/dist/templates/codex/agents/trellis-implement.toml +99 -16
- package/dist/templates/codex/agents/trellis-research.toml +116 -39
- package/dist/templates/common/bundled-skills/trellis-channel/SKILL.md +41 -41
- package/dist/templates/common/bundled-skills/trellis-channel/references/command-reference.md +194 -261
- package/dist/templates/common/bundled-skills/trellis-channel/references/forum.md +59 -93
- package/dist/templates/common/bundled-skills/trellis-channel/references/progress-debugging.md +72 -110
- package/dist/templates/common/bundled-skills/trellis-channel/references/workers.md +120 -171
- package/dist/templates/common/bundled-skills/trellis-channel/references/workflows.md +35 -43
- package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +78 -78
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/add-project-local-conventions.md +24 -24
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-agents.md +29 -29
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-context-loading.md +46 -46
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-hooks.md +28 -28
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-skills-or-commands.md +66 -66
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-spec-structure.md +32 -32
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-task-lifecycle.md +40 -40
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-workflow.md +40 -40
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/overview.md +44 -44
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/bundled-skills.md +79 -79
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/context-injection.md +37 -37
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/generated-files.md +43 -43
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/multi-agent-channel.md +47 -47
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/overview.md +40 -40
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/spec-system.md +33 -33
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +61 -61
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workflow.md +41 -41
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workspace-memory.md +31 -31
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +40 -40
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +40 -41
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/overview.md +36 -36
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md +36 -38
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/skills-and-commands.md +52 -52
- package/dist/templates/common/bundled-skills/trellis-session-insight/SKILL.md +45 -45
- package/dist/templates/common/bundled-skills/trellis-session-insight/references/cli-quick-reference.md +41 -42
- package/dist/templates/common/bundled-skills/trellis-session-insight/references/triggering-patterns.md +28 -28
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/SKILL.md +30 -30
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/mcp-setup.md +34 -34
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/repository-analysis.md +30 -30
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/spec-task-planning.md +39 -39
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/spec-writing.md +40 -40
- package/dist/templates/common/commands/continue.md +28 -29
- package/dist/templates/common/commands/finish-work.md +32 -40
- package/dist/templates/cursor/agents/trellis-check.md +61 -61
- package/dist/templates/cursor/agents/trellis-implement.md +58 -58
- package/dist/templates/cursor/agents/trellis-research.md +67 -67
- package/dist/templates/droid/droids/trellis-check.md +64 -56
- package/dist/templates/droid/droids/trellis-implement.md +61 -53
- package/dist/templates/droid/droids/trellis-research.md +67 -67
- package/dist/templates/gemini/agents/trellis-check.md +64 -57
- package/dist/templates/gemini/agents/trellis-implement.md +61 -54
- package/dist/templates/gemini/agents/trellis-research.md +67 -67
- package/dist/templates/kiro/agents/trellis-check.json +15 -3
- package/dist/templates/kiro/agents/trellis-implement.json +15 -3
- package/dist/templates/kiro/agents/trellis-research.json +10 -2
- package/dist/templates/kiro/agents/trellis.json +19 -5
- package/dist/templates/opencode/agents/trellis-check.md +61 -61
- package/dist/templates/opencode/agents/trellis-implement.md +58 -59
- package/dist/templates/opencode/agents/trellis-research.md +67 -67
- package/dist/templates/pi/agents/trellis-check.md +99 -21
- package/dist/templates/pi/agents/trellis-implement.md +90 -22
- package/dist/templates/pi/agents/trellis-research.md +124 -12
- package/dist/templates/qoder/agents/trellis-check.md +64 -57
- package/dist/templates/qoder/agents/trellis-implement.md +61 -54
- package/dist/templates/qoder/agents/trellis-research.md +67 -67
- package/dist/templates/trae/agents/trellis-check.md +64 -57
- package/dist/templates/trae/agents/trellis-implement.md +61 -54
- package/dist/templates/trae/agents/trellis-research.md +67 -67
- package/dist/templates/trellis/agents/check.md +29 -29
- package/dist/templates/trellis/agents/implement.md +30 -30
- package/dist/templates/trellis/workflow.md +349 -356
- package/dist/templates/zcode/agents/trellis-check.md +64 -51
- package/dist/templates/zcode/agents/trellis-implement.md +61 -53
- package/package.json +2 -2
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
# Workers
|
|
1
|
+
# Workers 与 Agent 卡片(Agent Cards)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
through the channel event log. A worker is a registered child process (claude
|
|
5
|
-
or codex) attached to a channel; the supervisor forwards inbox messages to it
|
|
6
|
-
and translates its output back into channel events.
|
|
3
|
+
当需要让一个对等 agent 独立执行并通过通道事件日志(channel event log)回传结果时,使用 worker。一个 worker 是注册到通道上的子进程(claude 或 codex);supervisor 将收件箱消息转发给它,并将它的输出转换回通道事件。
|
|
7
4
|
|
|
8
|
-
## Spawn
|
|
5
|
+
## Spawn(启动)
|
|
9
6
|
|
|
10
7
|
```bash
|
|
11
8
|
cviauto channel create impl-task --by dispatcher --cwd /path/to/repo
|
|
@@ -17,38 +14,33 @@ echo "Implement the schema for table X per .cviauto/.../prd.md" \
|
|
|
17
14
|
cviauto channel wait impl-task --as dispatcher --from codex-impl --kind done --timeout 30m
|
|
18
15
|
```
|
|
19
16
|
|
|
20
|
-
`spawn`
|
|
21
|
-
`progress`, and should end with `done`, `error`, or `killed`. Workers stay
|
|
22
|
-
inbox-idle until a `send --to <worker>` (or a broadcast when
|
|
23
|
-
`--inbox-policy broadcastAndExplicit` is set) wakes them.
|
|
17
|
+
`spawn` 会 fork 一个 `channel __supervisor` worker,它会发出 `spawned` 事件、流式输出 `progress`,并最终以 `done`、`error` 或 `killed` 结束。worker 在收到 `send --to <worker>`(或设置了 `--inbox-policy broadcastAndExplicit` 时的广播)之前会保持收件箱空闲状态。
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
`spawn` 的关键参数:
|
|
26
20
|
|
|
27
|
-
- `--agent <name>` —
|
|
28
|
-
- `--provider <claude|codex>` —
|
|
29
|
-
- `--as <name>` —
|
|
30
|
-
- `--cwd <path>` — worker
|
|
31
|
-
- `--model <id>` —
|
|
32
|
-
- `--resume <id>` —
|
|
33
|
-
- `--timeout <duration>` —
|
|
34
|
-
- `--warn-before <duration>` — supervisor_warning
|
|
35
|
-
- `--file <path
|
|
36
|
-
- `--jsonl <path
|
|
37
|
-
- `--by <agent>` —
|
|
38
|
-
- `--inbox-policy <explicitOnly|broadcastAndExplicit>` —
|
|
39
|
-
- `--idle-timeout <duration>` — OOM guard
|
|
40
|
-
- `--max-live-workers <n>` — spawn
|
|
21
|
+
- `--agent <name>` — 加载 `.cviauto/agents/<name>.md`(provider/model/as 等系统提示默认值)。
|
|
22
|
+
- `--provider <claude|codex>` — 覆盖 agent 卡片中的设置;会根据适配器注册表进行校验。
|
|
23
|
+
- `--as <name>` — 通道中 worker 的句柄;默认与 agent 名称相同。
|
|
24
|
+
- `--cwd <path>` — worker 的工作目录(同时也是 `--file`/`--jsonl` 的 jail 根目录)。
|
|
25
|
+
- `--model <id>` — 模型覆盖。
|
|
26
|
+
- `--resume <id>` — 恢复已有的 claude 会话 / codex 线程。
|
|
27
|
+
- `--timeout <duration>` — 超时自动 kill,如 `30s` / `2m` / `1h`。
|
|
28
|
+
- `--warn-before <duration>` — supervisor_warning 提前通知时间(默认 `5m`;`0ms` 禁用)。
|
|
29
|
+
- `--file <path>`(可重复,支持 glob)— 将文件内容注入系统提示。
|
|
30
|
+
- `--jsonl <path>`(可重复)— Cviauto jsonl 清单(每行 `{file, reason}`)。
|
|
31
|
+
- `--by <agent>` — `spawned` 事件的作者(默认 `$TRELLIS_CHANNEL_AS` 或 `main`)。
|
|
32
|
+
- `--inbox-policy <explicitOnly|broadcastAndExplicit>` — 默认 `explicitOnly`。
|
|
33
|
+
- `--idle-timeout <duration>` — OOM guard 空闲 TTL(默认 `5m`;`0` 禁用)。
|
|
34
|
+
- `--max-live-workers <n>` — spawn 时的存活 worker 数量上限(默认 `6`;`0` 禁用)。
|
|
41
35
|
|
|
42
|
-
|
|
43
|
-
`files`, and the resolved `manifests` so later spectators can audit context.
|
|
36
|
+
成功事件 `spawned` 会记录 `pid`、`provider`、`agent`、注入的 `files` 以及解析后的 `manifests`,以便后续观察者审计上下文。
|
|
44
37
|
|
|
45
|
-
## Agent Cards
|
|
38
|
+
## Agent 卡片(Agent Cards)
|
|
46
39
|
|
|
47
|
-
`--agent <name>`
|
|
48
|
-
match `[A-Za-z0-9._-]+`. The default Cviauto install ships two cards:
|
|
40
|
+
`--agent <name>` 解析到 `.cviauto/agents/<name>.md`。卡片名称必须匹配 `[A-Za-z0-9._-]+`。Cviauto 默认安装附带两张卡片:
|
|
49
41
|
|
|
50
|
-
- `.cviauto/agents/check.md` — code-quality reviewer
|
|
51
|
-
- `.cviauto/agents/implement.md` —
|
|
42
|
+
- `.cviauto/agents/check.md` — 代码质量审查(code-quality reviewer)。
|
|
43
|
+
- `.cviauto/agents/implement.md` — 用于实现任务的编码 worker。
|
|
52
44
|
|
|
53
45
|
```yaml
|
|
54
46
|
---
|
|
@@ -58,37 +50,30 @@ provider: claude
|
|
|
58
50
|
---
|
|
59
51
|
```
|
|
60
52
|
|
|
61
|
-
|
|
62
|
-
markdown body becomes the worker's system-prompt role. Cards do **not**
|
|
63
|
-
auto-attach task files — context must be injected explicitly per spawn (see
|
|
64
|
-
below).
|
|
53
|
+
frontmatter 中的字段会填充 `spawn` 的默认值(provider、model、`as`);markdown 正文会成为 worker 的系统提示(system-prompt)角色。卡片**不会**自动附加任务文件——上下文必须在每次 spawn 时显式注入(见下文)。
|
|
65
54
|
|
|
66
|
-
|
|
55
|
+
在启动命名 agent 之前,始终先检查项目中的卡片:
|
|
67
56
|
|
|
68
57
|
```bash
|
|
69
58
|
ls .cviauto/agents
|
|
70
59
|
sed -n '1,100p' .cviauto/agents/check.md
|
|
71
60
|
```
|
|
72
61
|
|
|
73
|
-
## Context Injection
|
|
62
|
+
## 上下文注入(Context Injection)
|
|
74
63
|
|
|
75
|
-
|
|
76
|
-
`# CONTEXT FILES` block, assembled by `context-loader`:
|
|
64
|
+
两个参数可将内容注入 worker 的系统提示中的 `# CONTEXT FILES` 代码块,由 `context-loader` 负责组装:
|
|
77
65
|
|
|
78
|
-
- `--file <path>` —
|
|
79
|
-
|
|
80
|
-
- `--jsonl <path>` — repeatable Cviauto manifest where every line is
|
|
81
|
-
`{"file":"<path>","reason":"<why>"}`. The reason is preserved as a header
|
|
82
|
-
comment above each file's content.
|
|
66
|
+
- `--file <path>` — 可重复,支持 glob(`*`、`**`)。每个匹配到的文件都会被读取并拼接。
|
|
67
|
+
- `--jsonl <path>` — 可重复的 Cviauto 清单,每行为 `{"file":"<path>","reason":"<why>"}`。reason 会作为头部注释保留在每个文件内容之前。
|
|
83
68
|
|
|
84
|
-
|
|
69
|
+
加载器强制执行的限制:
|
|
85
70
|
|
|
86
|
-
- 1 MB
|
|
87
|
-
- 200 KB
|
|
88
|
-
- 500 KB
|
|
89
|
-
-
|
|
71
|
+
- 单文件 1 MB 硬上限(超出 → 报错)。
|
|
72
|
+
- 单文件 200 KB 时向 stderr 输出警告。
|
|
73
|
+
- 组装上下文总量 500 KB 时向 stderr 输出警告。
|
|
74
|
+
- 路径穿越 jail:所有解析后的路径必须位于 `--cwd` 之下。
|
|
90
75
|
|
|
91
|
-
|
|
76
|
+
针对任务目录启动 check agent 的示例:
|
|
92
77
|
|
|
93
78
|
```bash
|
|
94
79
|
TASK=.cviauto/tasks/05-13-example
|
|
@@ -100,19 +85,16 @@ cviauto channel spawn cr-example --agent check --provider codex --as check-cx \
|
|
|
100
85
|
--cwd "$PWD" --timeout 30m
|
|
101
86
|
```
|
|
102
87
|
|
|
103
|
-
|
|
104
|
-
expanded from `--jsonl`, so the audit trail captures whatever the worker was
|
|
105
|
-
actually shown.
|
|
88
|
+
`spawned` 事件会同时记录字面的 `files` 数组以及从 `--jsonl` 展开的所有 `manifests`,因此审计追踪会完整捕获 worker 实际看到的内容。
|
|
106
89
|
|
|
107
|
-
## Names And Routing
|
|
90
|
+
## 命名与路由(Names And Routing)
|
|
108
91
|
|
|
109
|
-
`--as`
|
|
92
|
+
`--as` 有两种含义:
|
|
110
93
|
|
|
111
|
-
- `send` / `wait` / `interrupt
|
|
112
|
-
- `spawn
|
|
94
|
+
- `send` / `wait` / `interrupt`:发言人身份(生成事件的作者)。
|
|
95
|
+
- `spawn`:worker 句柄,其他 agent 通过 `--to` 来寻址。
|
|
113
96
|
|
|
114
|
-
|
|
115
|
-
channel:
|
|
97
|
+
当多个 worker 或 provider 在同一个通道中参与时,使用显式命名:
|
|
116
98
|
|
|
117
99
|
```bash
|
|
118
100
|
cviauto channel spawn cr-feature --agent check --as check-claude
|
|
@@ -122,37 +104,27 @@ cviauto channel wait cr-feature --as main \
|
|
|
122
104
|
--from check-claude,check-cx --kind done --all --timeout 15m
|
|
123
105
|
```
|
|
124
106
|
|
|
125
|
-
`--all`
|
|
126
|
-
matching event; timeout exits with code **124** and prints
|
|
127
|
-
`timeout: still waiting on ...` to stderr.
|
|
107
|
+
`--all` 需要 `--from`,会阻塞直到列表中所有 worker 都产生了匹配的事件;超时则退出码为 **124** 并向 stderr 输出 `timeout: still waiting on ...`。
|
|
128
108
|
|
|
129
|
-
##
|
|
109
|
+
## 软中断 — `interrupt`
|
|
130
110
|
|
|
131
|
-
`channel interrupt`
|
|
132
|
-
event (reason `"user"`) and, where the adapter supports it, issues a
|
|
133
|
-
provider-level turn interrupt with a replacement instruction. Use it when the
|
|
134
|
-
worker should drop its current turn and act on new input immediately, without
|
|
135
|
-
losing its session.
|
|
111
|
+
`channel interrupt` 是协作式重定向:它会追加一个 `interrupt` 事件(reason 为 `"user"`),并在适配器支持的情况下,发出 provider 级别的 turn interrupt,携带替代指令。当需要 worker 丢弃当前 turn 并立即根据新输入采取行动,同时不丢失其会话时,使用此命令。
|
|
136
112
|
|
|
137
113
|
```bash
|
|
138
114
|
echo "Stop refactoring the parser — switch to fixing the failing test in src/foo.ts" \
|
|
139
115
|
| cviauto channel interrupt impl-task --as dispatcher --to codex-impl --stdin
|
|
140
116
|
```
|
|
141
117
|
|
|
142
|
-
|
|
118
|
+
参数:
|
|
143
119
|
|
|
144
|
-
- `--as <agent>`
|
|
145
|
-
- `--to <agent>`
|
|
146
|
-
- `--scope <project|global>` —
|
|
147
|
-
- `--stdin` / `--text-file <path>` / `[text]` —
|
|
120
|
+
- `--as <agent>` **(必需)** — 调用者身份。
|
|
121
|
+
- `--to <agent>` **(必需)** — 目标 worker。
|
|
122
|
+
- `--scope <project|global>` — 通道作用域。
|
|
123
|
+
- `--stdin` / `--text-file <path>` / `[text]` — 替代指令正文。
|
|
148
124
|
|
|
149
|
-
|
|
150
|
-
filters can subscribe with `--kind interrupt` to react to redirections (e.g.
|
|
151
|
-
to log the rerouting, or to gate other workers behind a coordinator's
|
|
152
|
-
correction).
|
|
125
|
+
追加的事件具有 `kind: "interrupt"` — 下游的 `wait` / `messages` 过滤器可以通过 `--kind interrupt` 订阅以响应重定向(例如记录重新路由,或在协调者的纠正之后阻塞其他 worker)。
|
|
153
126
|
|
|
154
|
-
|
|
155
|
-
plain tagged message instead:
|
|
127
|
+
对于应等待 worker 下一个 turn 的低优先级提示,改用带标签的普通消息:
|
|
156
128
|
|
|
157
129
|
```bash
|
|
158
130
|
echo "Check this when you reach the next turn." \
|
|
@@ -160,13 +132,9 @@ echo "Check this when you reach the next turn." \
|
|
|
160
132
|
--stdin --tag question
|
|
161
133
|
```
|
|
162
134
|
|
|
163
|
-
##
|
|
135
|
+
## 硬中断 — `kill` + `--resume`
|
|
164
136
|
|
|
165
|
-
|
|
166
|
-
instructions already in flight, or `interrupt` is not honored by the
|
|
167
|
-
adapter). The supervisor escalates SIGTERM → 8 s grace → SIGKILL; the CLI
|
|
168
|
-
writes a `killed` event when SIGKILL is needed so the event log stays
|
|
169
|
-
truthful.
|
|
137
|
+
当 worker 需要**立即**停止时使用 `kill`(例如失控循环、已发出的错误指令,或适配器不响应 `interrupt`)。supervisor 会按 SIGTERM → 8 秒宽限期 → SIGKILL 逐步升级;CLI 在需要 SIGKILL 时会写入 `killed` 事件,确保事件日志如实记录。
|
|
170
138
|
|
|
171
139
|
```bash
|
|
172
140
|
cviauto channel kill impl-task --as codex-impl
|
|
@@ -177,100 +145,81 @@ echo "STOP — new instructions: ..." \
|
|
|
177
145
|
| cviauto channel send impl-task --as dispatcher --to codex-impl --stdin
|
|
178
146
|
```
|
|
179
147
|
|
|
180
|
-
`kill`
|
|
181
|
-
|
|
182
|
-
- `--as <agent>`
|
|
183
|
-
- `--scope <project|global
|
|
184
|
-
- `--force` — SIGKILL
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
-
|
|
226
|
-
-
|
|
227
|
-
|
|
228
|
-
-
|
|
229
|
-
-
|
|
230
|
-
|
|
231
|
-
-
|
|
232
|
-
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
- `
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
- `--stdin` / `--text-file <path>` / `[text]` — body source.
|
|
243
|
-
- `--delivery-mode <appendOnly|requireKnownWorker|requireRunningWorker>`.
|
|
244
|
-
- `interrupt <channel> [text]` — soft-interrupt redirect (see above).
|
|
245
|
-
- `wait <channel>` — block until matching events arrive.
|
|
246
|
-
- `--as <agent>` **(required)** — `self` for filter context.
|
|
247
|
-
- `--from <agents>` — CSV authors.
|
|
248
|
-
- `--kind <kind[,kind...]>` — CSV (OR semantics); supports `interrupt`,
|
|
249
|
-
`done`, `progress`, etc.
|
|
250
|
-
- `--to <target>` — defaults to own agent (broadcast + explicit-to-me).
|
|
251
|
-
- `--include-progress` — also wake on progress events.
|
|
252
|
-
- `--all` — require every `--from` agent to match (timeout → exit **124**).
|
|
253
|
-
- `--timeout <duration>` — `30s` / `2m` / `1h` / `1000ms`.
|
|
254
|
-
- `messages <channel>` — view / filter / follow the event stream.
|
|
255
|
-
- `--follow` to tail, `--kind` / `--from` / `--to` to filter, `--raw` for
|
|
256
|
-
JSON-per-line, `--no-progress` to hide progress noise.
|
|
257
|
-
|
|
258
|
-
A typical dispatcher loop:
|
|
148
|
+
`kill` 参数:
|
|
149
|
+
|
|
150
|
+
- `--as <agent>` **(必需)** — 指定 worker 名称(位置参数 `<name>` 是通道名)。
|
|
151
|
+
- `--scope <project|global>`。
|
|
152
|
+
- `--force` — 立即 SIGKILL(同时也会 kill 内部 worker 进程)。
|
|
153
|
+
|
|
154
|
+
副作用:清理 `pid`、`worker-pid`、`config`、`spawnlock` 附属文件;保留 `log`、`session-id`、`thread-id` 用于取证和恢复。
|
|
155
|
+
|
|
156
|
+
当 `interrupt` 无法收敛时,kill + `--resume` 是保证重定向的路径。
|
|
157
|
+
|
|
158
|
+
## Worker OOM Guard(内存溢出防护)
|
|
159
|
+
|
|
160
|
+
OOM guard 防止孤儿/空闲 worker 不断累积并耗尽宿主机资源。它在每次 `spawn` 时运行,对每个项目 bucket 执行两项策略:
|
|
161
|
+
|
|
162
|
+
- **空闲 TTL(Idle TTL)** — 清理最后活动时间超过配置阈值(默认 `5m`;`0` 禁用)的 worker。
|
|
163
|
+
- **存活 worker 数量上限(Live-worker budget)** — 如果同一项目 bucket 中已有超过 N 个 worker 存活,则拒绝新的 spawn(默认 `6`;`0` 禁用)。
|
|
164
|
+
|
|
165
|
+
优先级(从高到低):
|
|
166
|
+
|
|
167
|
+
1. CLI 参数:`spawn` 上的 `--idle-timeout`、`--max-live-workers`。
|
|
168
|
+
2. 环境变量:`TRELLIS_CHANNEL_WORKER_IDLE_TIMEOUT`、`TRELLIS_CHANNEL_MAX_LIVE_WORKERS`。
|
|
169
|
+
3. `.cviauto/config.yaml` 中的 `channel.worker_guard`。
|
|
170
|
+
4. 内置默认值(`5m`、`6`)。
|
|
171
|
+
|
|
172
|
+
清理通知会在 spawn 时写入 stderr,以便运维人员查看哪些空闲 worker 被清理,以及新 spawn 被拒绝的原因。guard 对临时 worker / `channel run` worker 没有特殊对待——它们同样受空闲 TTL 和数量上限约束。
|
|
173
|
+
|
|
174
|
+
要审计当前状态,可通过 `channel list`(`WORKERS` 列)列出 worker,并检查 `~/.cviauto/channels/<bucket>/<channel>/` 下的 `pid` / `worker-pid` 附属文件。
|
|
175
|
+
|
|
176
|
+
## Worker 收件箱 API(Worker Inbox APIs)
|
|
177
|
+
|
|
178
|
+
收件箱是 worker 在通道中醒来时面对的界面。路由由两个旋钮控制:
|
|
179
|
+
|
|
180
|
+
- **收件箱策略(Inbox policy)**(`spawn --inbox-policy`):
|
|
181
|
+
- `explicitOnly`(默认)— worker 仅在 `send --to <worker>` 或 `interrupt --to <worker>` 时醒来。
|
|
182
|
+
- `broadcastAndExplicit` — 同时也会在广播(不带 `--to` 的 `send`)时醒来。
|
|
183
|
+
- **投递模式(Delivery mode)**(`send --delivery-mode`):
|
|
184
|
+
- `appendOnly` — 无论 worker 状态如何,始终追加事件。
|
|
185
|
+
- `requireKnownWorker` — 如果 `--to` 指定的 worker 从未被 spawn 过,则失败。
|
|
186
|
+
- `requireRunningWorker` — 如果指定 worker 当前不在运行,则失败。
|
|
187
|
+
|
|
188
|
+
更严格的投递模式可防止调用方期望对等 worker 正在运行但消息被静默丢弃的情况。
|
|
189
|
+
|
|
190
|
+
收件箱相关子命令:
|
|
191
|
+
|
|
192
|
+
- `send <channel> [text]` — 追加一条 `message` 事件。
|
|
193
|
+
- `--as <agent>` **(必需)** — 作者。
|
|
194
|
+
- `--to <agents>` — CSV 格式;单个 → 字符串,多个 → 数组;省略则广播。
|
|
195
|
+
- `--stdin` / `--text-file <path>` / `[text]` — 消息正文来源。
|
|
196
|
+
- `--delivery-mode <appendOnly|requireKnownWorker|requireRunningWorker>`。
|
|
197
|
+
- `interrupt <channel> [text]` — 软中断重定向(见上文)。
|
|
198
|
+
- `wait <channel>` — 阻塞直到匹配的事件到达。
|
|
199
|
+
- `--as <agent>` **(必需)** — 用于过滤器上下文的 `self`。
|
|
200
|
+
- `--from <agents>` — CSV 格式的作者列表。
|
|
201
|
+
- `--kind <kind[,kind...]>` — CSV(OR 语义);支持 `interrupt`、`done`、`progress` 等。
|
|
202
|
+
- `--to <target>` — 默认为自己的 agent(广播 + 显式发给自己的)。
|
|
203
|
+
- `--include-progress` — 同时也在 progress 事件上醒来。
|
|
204
|
+
- `--all` — 要求 `--from` 中的每个 agent 都匹配(超时 → 退出码 **124**)。
|
|
205
|
+
- `--timeout <duration>` — `30s` / `2m` / `1h` / `1000ms`。
|
|
206
|
+
- `messages <channel>` — 查看 / 过滤 / 跟踪事件流。
|
|
207
|
+
- `--follow` 持续跟踪,`--kind` / `--from` / `--to` 过滤,`--raw` 输出每行 JSON,`--no-progress` 隐藏 progress 噪声。
|
|
208
|
+
|
|
209
|
+
典型的 dispatcher 循环:
|
|
259
210
|
|
|
260
211
|
```bash
|
|
261
|
-
# 1.
|
|
212
|
+
# 1. 唤醒 worker。
|
|
262
213
|
echo "Run the failing test and report." \
|
|
263
214
|
| cviauto channel send impl-task --as dispatcher --to codex-impl --stdin \
|
|
264
215
|
--delivery-mode requireRunningWorker
|
|
265
216
|
|
|
266
|
-
# 2.
|
|
217
|
+
# 2. 阻塞直到它完成。
|
|
267
218
|
cviauto channel wait impl-task --as dispatcher \
|
|
268
219
|
--from codex-impl --kind done,error --timeout 30m
|
|
269
220
|
|
|
270
|
-
# 3.
|
|
221
|
+
# 3. 读取最终结果。
|
|
271
222
|
cviauto channel messages impl-task --from codex-impl --last 1 --raw
|
|
272
223
|
```
|
|
273
224
|
|
|
274
|
-
|
|
275
|
-
`delete`, `title set` / `clear`, `thread rename`) print the appended event as
|
|
276
|
-
a single JSON line on stdout, making the inbox layer easy to script against.
|
|
225
|
+
所有产生事件的子命令(`send`、`interrupt`、`post`、`context add` / `delete`、`title set` / `clear`、`thread rename`)都会将追加的事件以单行 JSON 输出到 stdout,使收件箱层便于脚本化操作。
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
# Workflows
|
|
1
|
+
# 工作流(Workflows)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
`channel run
|
|
3
|
+
按意图选择使用模式。多轮工作优先使用持久化频道(durable channel),一次性问题使用
|
|
4
|
+
`channel run`。
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## 模式 A:多轮头脑风暴(Multi-round Brainstorm)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
进来一起看".
|
|
8
|
+
当用户说"和 codex/claude 讨论一下"、"brainstorm"或"拉一个 agent 进来一起看"时使用。
|
|
10
9
|
|
|
11
10
|
```bash
|
|
12
11
|
cviauto channel create brainstorm-storage-layer --by main \
|
|
@@ -25,30 +24,27 @@ cviauto channel wait brainstorm-storage-layer \
|
|
|
25
24
|
--as main --kind done --from cx-arch --timeout 10m
|
|
26
25
|
```
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
new probe, and repeat until the result is executable.
|
|
27
|
+
不要一轮回答就停止。阅读回答,找出模糊之处,发起新的追问,反复迭代直到结果可执行。
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
最低轮次结构:
|
|
32
30
|
|
|
33
|
-
1. Direction split
|
|
34
|
-
2. MVP boundary
|
|
35
|
-
3. Data contract
|
|
36
|
-
4. CLI / UX
|
|
37
|
-
5. Cross-layer risk and tests
|
|
31
|
+
1. 方向拆分(Direction split):该功能应放在现有机制中还是新建机制?
|
|
32
|
+
2. MVP 边界(MVP boundary):v1、v2 范围,以及什么情况下需要将 v2 内容提前纳入 v1。
|
|
33
|
+
3. 数据契约(Data contract):事件(events)、schema、元数据(metadata)、状态真实来源(state source of truth)、兼容性。
|
|
34
|
+
4. CLI / UX 契约(CLI / UX contract):命令名称、flags、错误、默认值、歧义处理。
|
|
35
|
+
5. 跨层风险与测试(Cross-layer risk and tests):共享辅助模块、偏移点(drift points)、阻止发版的测试项。
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
可选轮次:
|
|
40
38
|
|
|
41
|
-
- Operations
|
|
42
|
-
- Migration/release
|
|
43
|
-
- Opposition review
|
|
39
|
+
- 运维(Operations):日志、调试、卡住的 worker、kill/restart、恢复。
|
|
40
|
+
- 迁移/发布(Migration/release):breaking 状态、manifest、changelog、文档站点。
|
|
41
|
+
- 反向审查(Opposition review):让对端 agent 对当前方案提出反对意见。
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
alternatives, and release-blocking issues. Reject hedging when a decision is
|
|
47
|
-
needed.
|
|
43
|
+
每次追问应要求给出具体的文件路径、命令、schema、被否决的替代方案以及阻止发版的问题。当需要决策时,拒绝含糊其辞。
|
|
48
44
|
|
|
49
|
-
##
|
|
45
|
+
## 模式 B:实现 / 审查 Agent(Implement / Check Agent)
|
|
50
46
|
|
|
51
|
-
|
|
47
|
+
当用户要求派发实现或审查工作时使用。
|
|
52
48
|
|
|
53
49
|
```bash
|
|
54
50
|
TASK=.cviauto/tasks/05-12-foo
|
|
@@ -67,13 +63,11 @@ cviauto channel wait cr-foo --as main --kind done --from check --timeout 15m
|
|
|
67
63
|
cviauto channel messages cr-foo --kind message --from check --tag final_answer
|
|
68
64
|
```
|
|
69
65
|
|
|
70
|
-
|
|
71
|
-
For check work, include the exact diff scope, relevant specs, and validation
|
|
72
|
-
already run.
|
|
66
|
+
实现工作使用 `--agent implement` 并发送实现简报(implementation brief)。审查工作需包含确切的 diff 范围、相关规格说明以及已运行的验证。
|
|
73
67
|
|
|
74
|
-
##
|
|
68
|
+
## 模式 C:并行审查者(Parallel Reviewers)
|
|
75
69
|
|
|
76
|
-
|
|
70
|
+
使用一个频道和不同的 worker 名称。
|
|
77
71
|
|
|
78
72
|
```bash
|
|
79
73
|
cviauto channel create cr-feature --by main --ephemeral
|
|
@@ -91,26 +85,24 @@ cviauto channel send cr-feature --as main --to check-cx --text-file /tmp/cr-brie
|
|
|
91
85
|
cviauto channel wait cr-feature --as main --kind done --from check,check-cx --all --timeout 15m
|
|
92
86
|
```
|
|
93
87
|
|
|
94
|
-
`--all`
|
|
88
|
+
`--all` 表示每个列出的 worker 都必须发出匹配的事件。
|
|
95
89
|
|
|
96
|
-
##
|
|
90
|
+
## 模式 D:一次性 Worker(One-shot Worker)
|
|
97
91
|
|
|
98
92
|
```bash
|
|
99
93
|
cviauto channel run --provider codex --message "say hi in 3 words" --timeout 1m
|
|
100
94
|
cviauto channel run --agent plan --message-file /tmp/plan-question.md --timeout 10m
|
|
101
95
|
```
|
|
102
96
|
|
|
103
|
-
|
|
104
|
-
keeps the channel and prints the path for inspection.
|
|
97
|
+
成功时,`run` 会删除临时频道。出错/超时/被 kill 时,会保留频道并打印路径以供检查。
|
|
105
98
|
|
|
106
|
-
##
|
|
99
|
+
## 模式 E:论坛频道(Forum Channel)
|
|
107
100
|
|
|
108
|
-
|
|
109
|
-
internal changelogs. Read `forum.md` for the full model.
|
|
101
|
+
用于问题论坛、主题式反馈、发布待办、agent 发现和内部 changelog。完整模型请阅读 `forum.md`。
|
|
110
102
|
|
|
111
|
-
##
|
|
103
|
+
## 模式 F:接管已有线程(Take Over Existing Thread)
|
|
112
104
|
|
|
113
|
-
|
|
105
|
+
如果用户给出了论坛/线程名称,自行恢复上下文:
|
|
114
106
|
|
|
115
107
|
```bash
|
|
116
108
|
cviauto channel forum <board> --scope global
|
|
@@ -119,10 +111,10 @@ cviauto channel context list <board> --scope global --thread <thread>
|
|
|
119
111
|
cviauto channel messages <board> --scope global --raw --thread <thread>
|
|
120
112
|
```
|
|
121
113
|
|
|
122
|
-
|
|
114
|
+
输出约束摘要,而非原文转储:
|
|
123
115
|
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
116
|
+
- 用户层面的问题
|
|
117
|
+
- 影响此仓库的上下文文件
|
|
118
|
+
- 当前版本 vs 未来版本的需求
|
|
119
|
+
- 当前代码/设计是否满足
|
|
120
|
+
- 下一步操作或待追加的评论
|