vibe-coding-master 0.0.6 → 0.0.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/README.md +207 -66
- package/dist/backend/adapters/filesystem.js +13 -0
- package/dist/backend/adapters/git-adapter.js +79 -1
- package/dist/backend/adapters/translation-provider.js +145 -0
- package/dist/backend/api/artifact-routes.js +16 -7
- package/dist/backend/api/harness-routes.js +22 -0
- package/dist/backend/api/message-routes.js +2 -0
- package/dist/backend/api/project-routes.js +3 -8
- package/dist/backend/api/task-routes.js +14 -0
- package/dist/backend/api/translation-routes.js +70 -0
- package/dist/backend/runtime/node-pty-runtime.js +20 -18
- package/dist/backend/server.js +33 -2
- package/dist/backend/services/app-settings-service.js +128 -0
- package/dist/backend/services/artifact-service.js +7 -4
- package/dist/backend/services/claude-transcript-service.js +509 -0
- package/dist/backend/services/command-dispatcher.js +4 -2
- package/dist/backend/services/harness-service.js +196 -0
- package/dist/backend/services/message-service.js +1 -1
- package/dist/backend/services/project-service.js +50 -9
- package/dist/backend/services/session-service.js +13 -9
- package/dist/backend/services/status-service.js +79 -1
- package/dist/backend/services/task-service.js +118 -4
- package/dist/backend/services/translation-prompts.js +173 -0
- package/dist/backend/services/translation-queue.js +39 -0
- package/dist/backend/services/translation-service.js +546 -0
- package/dist/backend/templates/handoff.js +32 -0
- package/dist/backend/templates/harness/architect-agent.js +12 -0
- package/dist/backend/templates/harness/claude-root.js +14 -0
- package/dist/backend/templates/harness/coder-agent.js +11 -0
- package/dist/backend/templates/harness/gitignore.js +9 -0
- package/dist/backend/templates/harness/project-manager-agent.js +14 -0
- package/dist/backend/templates/harness/reviewer-agent.js +13 -0
- package/dist/backend/ws/translation-ws.js +35 -0
- package/dist/shared/types/harness.js +1 -0
- package/dist/shared/types/translation.js +5 -0
- package/dist/shared/validation/artifact-check.js +15 -1
- package/dist/shared/validation/language-detect.js +46 -0
- package/dist-frontend/assets/index-CuiNNOzj.css +32 -0
- package/dist-frontend/assets/index-D59GuHCR.js +58 -0
- package/dist-frontend/index.html +2 -2
- package/docs/cc-best-practices.md +109 -40
- package/docs/product-design.md +370 -1374
- package/docs/v1-architecture-design.md +595 -1114
- package/docs/v1-implementation-plan.md +898 -1603
- package/package.json +1 -1
- package/scripts/verify-package.mjs +8 -0
- package/dist/backend/templates/role-messaging-context.js +0 -44
- package/dist-frontend/assets/index-Bah6k-Ix.css +0 -32
- package/dist-frontend/assets/index-EMaQuIB6.js +0 -58
- package/docs/v1-message-bus-orchestration-design.md +0 -534
|
@@ -1,1431 +1,912 @@
|
|
|
1
|
-
#
|
|
1
|
+
# V1 Architecture Design
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
日期:2026-05-29
|
|
5
|
-
状态:架构设计草案
|
|
6
|
-
依据:
|
|
3
|
+
Last updated: 2026-05-31
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
- `docs/cc-best-practices.md`
|
|
5
|
+
This document describes the architecture implemented by the current VCM codebase.
|
|
10
6
|
|
|
11
|
-
## 1.
|
|
7
|
+
## 1. System Overview
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
VCM is a local Node.js application with:
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
- Fastify backend.
|
|
12
|
+
- React frontend.
|
|
13
|
+
- `node-pty` terminal runtime.
|
|
14
|
+
- `xterm.js` terminal view.
|
|
15
|
+
- Claude Code role processes.
|
|
16
|
+
- API-driven message bus.
|
|
17
|
+
- Claude transcript JSONL tailer for translation.
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
Runtime shape:
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
- 支持用户在 GUI 内直接输入、确认权限、继续对话。
|
|
29
|
-
- 将 terminal output 持续保存为 raw logs。
|
|
30
|
-
- 在 GUI 中查看 role command 和 handoff artifacts。
|
|
31
|
-
- 从 GUI 将 role command 发送到目标 role session。
|
|
32
|
-
- 展示 session 状态、artifact 状态、任务状态和下一步建议。
|
|
33
|
-
- 支持停止、重启、恢复单个 role session。
|
|
34
|
-
|
|
35
|
-
V1 的成功标准不是“能不能用命令控制多个终端”,而是:
|
|
36
|
-
|
|
37
|
-
> 用户是否可以不离开 GUI,就完成多 Claude Code sessions 的创建、切换、沟通、观察、日志保存和 handoff artifact 查看。
|
|
38
|
-
|
|
39
|
-
## 2. V1 非目标
|
|
40
|
-
|
|
41
|
-
V1 明确不做:
|
|
42
|
-
|
|
43
|
-
- SaaS 多用户协作。
|
|
44
|
-
- 企业权限和审计。
|
|
45
|
-
- 完整 Desktop 打包和自动更新。
|
|
46
|
-
- 产品层翻译管线。
|
|
47
|
-
- 独立翻译模型调用。
|
|
48
|
-
- 自动生成完整 Task Spec。
|
|
49
|
-
- 自动 Preflight Review。
|
|
50
|
-
- 自动 Cross-Model Code Review。
|
|
51
|
-
- 自动识别 public contract / test contract。
|
|
52
|
-
- 自动执行 validation commands。
|
|
53
|
-
- 自动创建 PR。
|
|
54
|
-
- Jira / Linear / GitHub 双向同步。
|
|
55
|
-
- 云端 session 托管。
|
|
56
|
-
- 多 repo / 多任务并行调度。
|
|
57
|
-
- 多 worktree 自动管理。
|
|
58
|
-
- 让用户手动管理底层 terminal process。
|
|
21
|
+
```text
|
|
22
|
+
browser
|
|
23
|
+
-> React GUI
|
|
24
|
+
-> HTTP API + WebSocket
|
|
25
|
+
-> Fastify backend
|
|
26
|
+
-> services
|
|
27
|
+
-> node-pty
|
|
28
|
+
-> claude --agent <role>
|
|
29
|
+
```
|
|
59
30
|
|
|
60
|
-
|
|
31
|
+
The app is local-first. It writes project control state under `.ai/vcm/`, handoff artifacts under `.ai/handoffs/` inside the active task worktree, app settings under `~/.vcm/settings.json`, and reads Claude transcript files under `~/.claude/projects/`.
|
|
61
32
|
|
|
62
|
-
##
|
|
33
|
+
## 2. Processes And Ports
|
|
63
34
|
|
|
64
|
-
|
|
35
|
+
Default ports:
|
|
65
36
|
|
|
66
|
-
|
|
37
|
+
- backend / production GUI: `4173`
|
|
38
|
+
- Vite dev GUI: `5173`
|
|
67
39
|
|
|
68
|
-
|
|
69
|
-
- 创建任务。
|
|
70
|
-
- 启动 role sessions。
|
|
71
|
-
- 切换 `project-manager / architect / coder / reviewer`。
|
|
72
|
-
- 直接在 session 面板中输入和查看输出。
|
|
73
|
-
- 查看 role command、logs、handoff artifacts 和状态。
|
|
40
|
+
Development:
|
|
74
41
|
|
|
75
|
-
|
|
42
|
+
```text
|
|
43
|
+
npm run dev
|
|
44
|
+
-> backend at http://127.0.0.1:4173
|
|
45
|
+
-> Vite dev server at http://127.0.0.1:5173
|
|
46
|
+
```
|
|
76
47
|
|
|
77
|
-
|
|
78
|
-
- 调试 backend。
|
|
79
|
-
- 导出状态。
|
|
80
|
-
- 执行自动化 smoke test。
|
|
48
|
+
Production / npm package:
|
|
81
49
|
|
|
82
|
-
|
|
50
|
+
```text
|
|
51
|
+
vcm
|
|
52
|
+
-> backend serves dist-frontend at http://127.0.0.1:4173
|
|
53
|
+
```
|
|
83
54
|
|
|
84
|
-
|
|
55
|
+
`src/main.ts` starts the backend and optionally starts Vite when `--dev` is passed.
|
|
85
56
|
|
|
86
|
-
|
|
57
|
+
## 3. Frontend Architecture
|
|
87
58
|
|
|
88
|
-
|
|
89
|
-
- process id。
|
|
90
|
-
- terminal stream。
|
|
91
|
-
- WebSocket message。
|
|
92
|
-
- input/output bridge。
|
|
59
|
+
Entry:
|
|
93
60
|
|
|
94
|
-
|
|
61
|
+
- `src/frontend/main.tsx`
|
|
62
|
+
- `src/frontend/app.tsx`
|
|
95
63
|
|
|
96
|
-
|
|
64
|
+
Main state lives in `App`:
|
|
97
65
|
|
|
98
|
-
|
|
66
|
+
- connected project
|
|
67
|
+
- recent repository paths
|
|
68
|
+
- harness status
|
|
69
|
+
- task list
|
|
70
|
+
- active task
|
|
71
|
+
- active role
|
|
72
|
+
- active workflow report
|
|
73
|
+
- active messages
|
|
74
|
+
- active orchestration state
|
|
75
|
+
- task-local event list
|
|
99
76
|
|
|
100
|
-
|
|
77
|
+
Layout:
|
|
101
78
|
|
|
102
79
|
```text
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
-> user approves or sends from GUI
|
|
107
|
-
-> VibeCodingMaster backend writes short instruction to target role session
|
|
108
|
-
-> target role session executes
|
|
109
|
-
-> backend records raw log
|
|
110
|
-
-> handoff artifact becomes stable result
|
|
80
|
+
AppShell
|
|
81
|
+
sidebar: ProjectDashboard
|
|
82
|
+
main: TaskWorkspace or EmptyWorkspace
|
|
111
83
|
```
|
|
112
84
|
|
|
113
|
-
|
|
85
|
+
### ProjectDashboard
|
|
114
86
|
|
|
115
|
-
|
|
116
|
-
- GUI 让用户看见、确认和发送。
|
|
117
|
-
- Backend 把短指令写入正确 role session。
|
|
118
|
-
- Role agent 执行命令并产出 artifact。
|
|
119
|
-
- Handoff artifacts 是跨 session 的事实源。
|
|
87
|
+
File:
|
|
120
88
|
|
|
121
|
-
|
|
89
|
+
- `src/frontend/routes/project-dashboard.tsx`
|
|
122
90
|
|
|
123
|
-
|
|
91
|
+
Responsibilities:
|
|
124
92
|
|
|
125
|
-
|
|
126
|
-
.
|
|
127
|
-
|
|
93
|
+
- Render collapsible sidebar sections.
|
|
94
|
+
- Render repository connect form.
|
|
95
|
+
- Render repository summary.
|
|
96
|
+
- Render workflow panel.
|
|
97
|
+
- Render settings section with Messages, Events, Auto orchestration.
|
|
98
|
+
- Render harness status/actions.
|
|
99
|
+
- Render task creation form with one task-name field, a checked non-optional worktree/branch indicator, and generated branch/path previews.
|
|
100
|
+
- Render task list.
|
|
101
|
+
- Render Messages and Events modals.
|
|
128
102
|
|
|
129
|
-
|
|
103
|
+
All sections default collapsed. `Repository Path` opens when there is no selected task.
|
|
130
104
|
|
|
131
|
-
###
|
|
105
|
+
### TaskWorkspace
|
|
132
106
|
|
|
133
|
-
|
|
107
|
+
File:
|
|
134
108
|
|
|
135
|
-
|
|
136
|
-
one task
|
|
137
|
-
-> one GUI task workspace
|
|
138
|
-
-> multiple role sessions
|
|
139
|
-
-> one handoff directory
|
|
140
|
-
-> one repo working directory
|
|
141
|
-
```
|
|
109
|
+
- `src/frontend/routes/task-workspace.tsx`
|
|
142
110
|
|
|
143
|
-
|
|
111
|
+
Responsibilities:
|
|
144
112
|
|
|
145
|
-
|
|
113
|
+
- Fetch task status, messages, and orchestration state.
|
|
114
|
+
- Poll those every three seconds.
|
|
115
|
+
- Render compact header with task title, branch, immutable worktree path, role tabs, and Refresh.
|
|
116
|
+
- Hold per-role permission mode selection.
|
|
117
|
+
- Render one `SessionConsole` per role but only show the active role.
|
|
118
|
+
- Emit workflow/messages/orchestration/events back to `App` so sidebar stays synchronized.
|
|
146
119
|
|
|
147
|
-
|
|
120
|
+
### SessionConsole
|
|
148
121
|
|
|
149
|
-
|
|
122
|
+
File:
|
|
150
123
|
|
|
151
|
-
|
|
152
|
-
project-manager -> architect -> coder -> reviewer
|
|
153
|
-
```
|
|
124
|
+
- `src/frontend/components/session-console.tsx`
|
|
154
125
|
|
|
155
|
-
|
|
126
|
+
Responsibilities:
|
|
156
127
|
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
-
|
|
160
|
-
-
|
|
128
|
+
- Render role toolbar.
|
|
129
|
+
- Render embedded terminal for running sessions.
|
|
130
|
+
- Render empty/resume state for stopped sessions.
|
|
131
|
+
- Toggle translation panel.
|
|
132
|
+
- Split terminal and translation into two equal columns when translation is on.
|
|
161
133
|
|
|
162
|
-
|
|
134
|
+
### TranslationPanel
|
|
163
135
|
|
|
164
|
-
|
|
165
|
-
- PM 直接替代 coder 实现复杂功能。
|
|
166
|
-
- reviewer 接管大范围实现。
|
|
136
|
+
File:
|
|
167
137
|
|
|
168
|
-
|
|
138
|
+
- `src/frontend/components/translation-panel.tsx`
|
|
169
139
|
|
|
170
|
-
|
|
140
|
+
Responsibilities:
|
|
171
141
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
142
|
+
- Load translation settings and prompt previews.
|
|
143
|
+
- Open translation WebSocket for the current terminal runtime session id.
|
|
144
|
+
- Render dark translation output panel.
|
|
145
|
+
- Render translation status: `ready`, `translating <elapsed>`, or `error`.
|
|
146
|
+
- Render preserved tool output as dim one-line rows.
|
|
147
|
+
- Render prose source while translating, then translated text after completion.
|
|
148
|
+
- Render user composer.
|
|
149
|
+
- Translate on `Enter`; newline on `Shift+Enter`.
|
|
150
|
+
- Replace Chinese input with English draft after translation.
|
|
151
|
+
- Send English draft to the active terminal.
|
|
152
|
+
- Provide panel-level `Auto-send`, `Settings`, and `Clear`.
|
|
178
153
|
|
|
179
|
-
|
|
154
|
+
## 4. Backend Architecture
|
|
180
155
|
|
|
181
|
-
|
|
156
|
+
Entry:
|
|
182
157
|
|
|
183
|
-
|
|
158
|
+
- `src/backend/server.ts`
|
|
184
159
|
|
|
185
|
-
|
|
160
|
+
`createDefaultServerDeps()` wires:
|
|
186
161
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
162
|
+
- filesystem adapter
|
|
163
|
+
- command runner
|
|
164
|
+
- git adapter
|
|
165
|
+
- Claude adapter
|
|
166
|
+
- app settings service
|
|
167
|
+
- node-pty runtime
|
|
168
|
+
- session registry
|
|
169
|
+
- artifact service
|
|
170
|
+
- harness service
|
|
171
|
+
- project service
|
|
172
|
+
- task service
|
|
173
|
+
- session service
|
|
174
|
+
- command dispatcher
|
|
175
|
+
- status service
|
|
176
|
+
- message service
|
|
177
|
+
- translation service
|
|
190
178
|
|
|
191
|
-
|
|
179
|
+
Fastify registers:
|
|
192
180
|
|
|
193
|
-
-
|
|
194
|
-
-
|
|
195
|
-
-
|
|
196
|
-
-
|
|
181
|
+
- project routes
|
|
182
|
+
- harness routes
|
|
183
|
+
- task routes
|
|
184
|
+
- session routes
|
|
185
|
+
- artifact routes
|
|
186
|
+
- message routes
|
|
187
|
+
- translation routes
|
|
188
|
+
- terminal WebSocket
|
|
189
|
+
- translation WebSocket
|
|
197
190
|
|
|
198
|
-
|
|
191
|
+
## 5. Repository Connection
|
|
199
192
|
|
|
200
|
-
|
|
193
|
+
File:
|
|
201
194
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
原因:
|
|
195
|
+
- `src/backend/services/project-service.ts`
|
|
196
|
+
- `src/backend/adapters/git-adapter.ts`
|
|
207
197
|
|
|
208
|
-
|
|
209
|
-
- 与 xterm.js 集成成熟。
|
|
210
|
-
- 本地开发体验快。
|
|
211
|
-
- 后续可以被 Electron / Tauri / Desktop shell 包装。
|
|
212
|
-
|
|
213
|
-
前端核心依赖:
|
|
198
|
+
Connect flow:
|
|
214
199
|
|
|
215
200
|
```text
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
201
|
+
POST /api/projects/connect
|
|
202
|
+
-> resolve path
|
|
203
|
+
-> check path exists
|
|
204
|
+
-> check .git marker directly
|
|
205
|
+
-> create .ai/vcm/config.json
|
|
206
|
+
-> ensure .ai/vcm state dirs
|
|
207
|
+
-> read branch and dirty state
|
|
208
|
+
-> record recent repo path in ~/.vcm/settings.json
|
|
219
209
|
```
|
|
220
210
|
|
|
221
|
-
|
|
211
|
+
Git repository detection:
|
|
222
212
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
Node.js HTTP server + WebSocket
|
|
227
|
-
```
|
|
213
|
+
- `.git` directory with `HEAD` is accepted.
|
|
214
|
+
- `.git` file with `gitdir:` pointer and target `HEAD` is accepted.
|
|
215
|
+
- This supports normal repositories and worktrees.
|
|
228
216
|
|
|
229
|
-
|
|
217
|
+
Git metadata commands use:
|
|
230
218
|
|
|
231
219
|
```text
|
|
232
|
-
|
|
233
|
-
ws
|
|
220
|
+
git -c safe.directory=<repoRoot> -c safe.directory=<realpath(repoRoot)> ...
|
|
234
221
|
```
|
|
235
222
|
|
|
236
|
-
|
|
223
|
+
VCM does not require global `safe.directory` configuration.
|
|
237
224
|
|
|
238
|
-
|
|
239
|
-
- 提供 terminal WebSocket。
|
|
240
|
-
- 管理 pseudo-terminal lifecycle。
|
|
241
|
-
- 读写 `.vcm` 和 `.ai/handoffs`。
|
|
242
|
-
- 执行 git / claude 环境检查。
|
|
225
|
+
## 6. Task Worktree Architecture
|
|
243
226
|
|
|
244
|
-
|
|
227
|
+
Task-level worktree management is the current architecture for multi-task parallelism.
|
|
245
228
|
|
|
246
|
-
|
|
229
|
+
Rule:
|
|
247
230
|
|
|
248
231
|
```text
|
|
249
|
-
|
|
232
|
+
one VCM task = one branch + one git worktree + one handoff directory + one role-session set
|
|
250
233
|
```
|
|
251
234
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
- 启动 `claude --agent <role>`,并按用户选择追加权限参数。
|
|
255
|
-
- 承载交互式输入输出。
|
|
256
|
-
- 支持 backend 程序化写入 input。
|
|
257
|
-
- 支持 backend 程序化监听 output。
|
|
258
|
-
- 支持 terminal resize。
|
|
259
|
-
- 支持退出码和进程状态。
|
|
260
|
-
- 配合 xterm.js 提供接近真实终端的 GUI 体验。
|
|
261
|
-
|
|
262
|
-
V1 的 terminal runtime 固定为:
|
|
235
|
+
Branch name:
|
|
263
236
|
|
|
264
237
|
```text
|
|
265
|
-
|
|
238
|
+
feature/<taskSlug>
|
|
266
239
|
```
|
|
267
240
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
### 4.5 进程执行
|
|
271
|
-
|
|
272
|
-
推荐:
|
|
241
|
+
Worktree path:
|
|
273
242
|
|
|
274
243
|
```text
|
|
275
|
-
|
|
244
|
+
<baseRepoRoot>/.ai/vcm/worktrees/<taskSlug>
|
|
276
245
|
```
|
|
277
246
|
|
|
278
|
-
|
|
247
|
+
VCM does not support switching a task to another branch or worktree after creation. If the user needs a different branch/worktree, they should create a new task.
|
|
279
248
|
|
|
280
|
-
|
|
281
|
-
- 调用 `claude --version`。
|
|
282
|
-
- 执行 shell-safe command。
|
|
283
|
-
- 不用于承载 Claude Code 交互式 session;交互式 session 由 `node-pty` 负责。
|
|
284
|
-
|
|
285
|
-
### 4.6 本地状态存储
|
|
286
|
-
|
|
287
|
-
V1 推荐 JSON 文件,而不是 SQLite。
|
|
288
|
-
|
|
289
|
-
推荐路径:
|
|
249
|
+
VCM does not create worktrees by role. All four role sessions for a task share the same task worktree:
|
|
290
250
|
|
|
291
251
|
```text
|
|
292
|
-
.vcm/
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
<task-slug>.json
|
|
298
|
-
app-state.json
|
|
252
|
+
.ai/vcm/worktrees/<taskSlug>/
|
|
253
|
+
project-manager session cwd
|
|
254
|
+
architect session cwd
|
|
255
|
+
coder session cwd
|
|
256
|
+
reviewer session cwd
|
|
299
257
|
```
|
|
300
258
|
|
|
301
|
-
|
|
259
|
+
### 6.1 Base Repo vs Task Worktree
|
|
302
260
|
|
|
303
|
-
|
|
304
|
-
- 状态量小。
|
|
305
|
-
- 易于检查和恢复。
|
|
306
|
-
- 与 repo-local harness 理念一致。
|
|
261
|
+
VCM distinguishes:
|
|
307
262
|
|
|
308
|
-
|
|
263
|
+
- `baseRepoRoot`: repository the user connected.
|
|
264
|
+
- `taskRepoRoot`: git worktree path for a specific task.
|
|
265
|
+
- `branch`: `feature/<taskSlug>`.
|
|
266
|
+
- `worktreePath`: same as `taskRepoRoot`.
|
|
309
267
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
V1 不需要复杂 Markdown AST。
|
|
313
|
-
|
|
314
|
-
建议:
|
|
315
|
-
|
|
316
|
-
- 写入模板用字符串模板。
|
|
317
|
-
- artifact completeness 用标题存在性检查。
|
|
318
|
-
- 前端预览用简单 Markdown renderer。
|
|
319
|
-
- 后续再引入 Markdown parser。
|
|
320
|
-
|
|
321
|
-
### 4.8 测试框架
|
|
322
|
-
|
|
323
|
-
推荐:
|
|
268
|
+
Project-level VCM control state stays under the base repo:
|
|
324
269
|
|
|
325
270
|
```text
|
|
326
|
-
|
|
327
|
-
|
|
271
|
+
<baseRepoRoot>/.ai/vcm/config.json
|
|
272
|
+
<baseRepoRoot>/.ai/vcm/tasks/<task>.json
|
|
273
|
+
<baseRepoRoot>/.ai/vcm/sessions/<task>.json
|
|
274
|
+
<baseRepoRoot>/.ai/vcm/messages/<task>.jsonl
|
|
275
|
+
<baseRepoRoot>/.ai/vcm/orchestration/<task>.json
|
|
276
|
+
<baseRepoRoot>/.ai/vcm/worktrees/<task>/
|
|
328
277
|
```
|
|
329
278
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
- slug/path 生成。
|
|
333
|
-
- artifact schema 检查。
|
|
334
|
-
- session status 推断。
|
|
335
|
-
- REST API。
|
|
336
|
-
- WebSocket terminal bridge。
|
|
337
|
-
- role command dispatch。
|
|
338
|
-
- GUI task workspace smoke test。
|
|
339
|
-
|
|
340
|
-
## 5. 进程架构
|
|
341
|
-
|
|
342
|
-
V1 采用本地 Web GUI + 本地 Node backend。
|
|
279
|
+
Task source changes and handoff artifacts live in the task worktree:
|
|
343
280
|
|
|
344
281
|
```text
|
|
345
|
-
|
|
346
|
-
-> Browser / Desktop shell
|
|
347
|
-
-> React Task Workspace
|
|
348
|
-
-> xterm.js Role Session Console
|
|
349
|
-
-> WebSocket terminal bridge
|
|
350
|
-
-> REST API
|
|
351
|
-
-> Local Node backend
|
|
352
|
-
-> GitAdapter
|
|
353
|
-
-> ClaudeAdapter
|
|
354
|
-
-> FileSystemAdapter
|
|
355
|
-
-> ArtifactService
|
|
356
|
-
-> TaskService
|
|
357
|
-
-> SessionRegistry
|
|
358
|
-
-> TerminalRuntimeManager
|
|
359
|
-
-> node-pty
|
|
360
|
-
-> claude --agent project-manager
|
|
361
|
-
-> claude --agent architect
|
|
362
|
-
-> claude --agent coder
|
|
363
|
-
-> claude --agent reviewer
|
|
282
|
+
<baseRepoRoot>/.ai/vcm/worktrees/<task>/.ai/handoffs/<task>/
|
|
364
283
|
```
|
|
365
284
|
|
|
366
|
-
|
|
285
|
+
This central base-state model lets VCM list and manage multiple tasks while each task's code changes happen in a separate worktree.
|
|
367
286
|
|
|
368
|
-
|
|
287
|
+
### 6.2 Git Ignore Requirement
|
|
369
288
|
|
|
370
|
-
|
|
289
|
+
The base repository must ignore `.ai/vcm/`.
|
|
371
290
|
|
|
372
|
-
|
|
291
|
+
Reason:
|
|
373
292
|
|
|
374
|
-
-
|
|
375
|
-
-
|
|
376
|
-
-
|
|
377
|
-
- 显示 blocked tasks、recent validation failures、known issues、harness health。
|
|
378
|
-
- 提供进入 Task Workspace 的入口。
|
|
293
|
+
- `.ai/vcm/worktrees/<task>` is a nested git worktree.
|
|
294
|
+
- Without `.ai/vcm/` in `.gitignore`, the base repo sees worktree files as untracked noise.
|
|
295
|
+
- `.ai/vcm` also contains local task/session/message metadata that should not be committed by default.
|
|
379
296
|
|
|
380
|
-
|
|
297
|
+
The VCM harness manages a `.gitignore` block that ignores `.ai/vcm/` before task worktree creation.
|
|
381
298
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
推荐布局:
|
|
299
|
+
### 6.3 Task Creation Flow
|
|
385
300
|
|
|
386
301
|
```text
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
302
|
+
POST /api/tasks
|
|
303
|
+
-> validate taskSlug
|
|
304
|
+
-> compute branch feature/<taskSlug>
|
|
305
|
+
-> compute worktreePath <baseRepoRoot>/.ai/vcm/worktrees/<taskSlug>
|
|
306
|
+
-> assert branch does not already exist
|
|
307
|
+
-> assert worktreePath does not already exist
|
|
308
|
+
-> assert .ai/vcm/ is ignored by Git
|
|
309
|
+
-> assert base repo has no uncommitted changes
|
|
310
|
+
-> git worktree add -b feature/<taskSlug> <worktreePath> <baseRef>
|
|
311
|
+
-> create handoff structure in taskRepoRoot
|
|
312
|
+
-> write central task metadata under baseRepoRoot/.ai/vcm/tasks/<task>.json
|
|
398
313
|
```
|
|
399
314
|
|
|
400
|
-
|
|
315
|
+
The default `baseRef` is the connected repo's current `HEAD`.
|
|
401
316
|
|
|
402
|
-
|
|
317
|
+
### 6.4 Task Cleanup Flow
|
|
403
318
|
|
|
404
|
-
|
|
319
|
+
```text
|
|
320
|
+
POST /api/tasks/:taskSlug/cleanup
|
|
321
|
+
-> require no running role sessions
|
|
322
|
+
-> load task metadata
|
|
323
|
+
-> verify worktree path belongs under <baseRepoRoot>/.ai/vcm/worktrees/
|
|
324
|
+
-> check worktree status
|
|
325
|
+
-> refuse cleanup when uncommitted work exists unless force is explicitly requested
|
|
326
|
+
-> git worktree remove <worktreePath>
|
|
327
|
+
-> delete central task/session/message/orchestration metadata
|
|
328
|
+
```
|
|
405
329
|
|
|
406
|
-
|
|
407
|
-
- 展示 command,例如 `claude --agent architect`。
|
|
408
|
-
- 展示 xterm.js terminal viewport。
|
|
409
|
-
- 支持输入、复制、选择文本、resize。
|
|
410
|
-
- 展示状态:not started / starting / running / waiting / blocked / done / crashed。
|
|
411
|
-
- 支持 start / stop / restart。
|
|
412
|
-
- 显示 raw log path。
|
|
330
|
+
Branch deletion is intentionally separate:
|
|
413
331
|
|
|
414
|
-
|
|
332
|
+
- Keep `feature/<taskSlug>` by default.
|
|
333
|
+
- Allow branch deletion only with explicit confirmation.
|
|
334
|
+
- Prefer allowing deletion only when the branch has been merged, or when the user force-confirms.
|
|
415
335
|
|
|
416
|
-
|
|
336
|
+
## 7. Task And Artifact Model
|
|
417
337
|
|
|
418
|
-
|
|
338
|
+
File:
|
|
419
339
|
|
|
420
|
-
|
|
340
|
+
- `src/backend/services/task-service.ts`
|
|
341
|
+
- `src/backend/services/artifact-service.ts`
|
|
342
|
+
- `src/shared/types/task.ts`
|
|
343
|
+
- `src/shared/types/artifact.ts`
|
|
421
344
|
|
|
422
|
-
|
|
345
|
+
Task state:
|
|
423
346
|
|
|
424
347
|
```text
|
|
425
|
-
|
|
426
|
-
PM wrote architect.md
|
|
427
|
-
User sent architect command
|
|
428
|
-
Architect wrote architecture-plan.md
|
|
429
|
-
Coder waiting for permission
|
|
430
|
-
Reviewer missing validation evidence
|
|
348
|
+
<baseRepoRoot>/.ai/vcm/tasks/<task>.json
|
|
431
349
|
```
|
|
432
350
|
|
|
433
|
-
|
|
351
|
+
Each task stores:
|
|
434
352
|
|
|
435
|
-
|
|
353
|
+
- `taskSlug`
|
|
354
|
+
- optional `title`
|
|
355
|
+
- timestamps
|
|
356
|
+
- `baseRepoRoot`
|
|
357
|
+
- `worktreePath`
|
|
358
|
+
- `repoRoot` / `taskRepoRoot`
|
|
359
|
+
- branch, always `feature/<taskSlug>` for VCM-created tasks
|
|
360
|
+
- handoff directory
|
|
361
|
+
- status
|
|
362
|
+
- optional spec path
|
|
436
363
|
|
|
437
|
-
|
|
364
|
+
Task creation:
|
|
438
365
|
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
366
|
+
```text
|
|
367
|
+
POST /api/tasks
|
|
368
|
+
-> validate slug
|
|
369
|
+
-> create branch and worktree
|
|
370
|
+
-> create handoff directories
|
|
371
|
+
-> create artifact templates
|
|
372
|
+
-> write base .ai/vcm/tasks/<task>.json
|
|
444
373
|
```
|
|
445
374
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
V1 后端应抽象 terminal runtime,避免把 node-pty 写死到上层业务。
|
|
375
|
+
Handoff directory:
|
|
449
376
|
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
377
|
+
```text
|
|
378
|
+
<taskRepoRoot>/.ai/handoffs/<task>/
|
|
379
|
+
role-commands/
|
|
380
|
+
architect.md
|
|
381
|
+
coder.md
|
|
382
|
+
reviewer.md
|
|
383
|
+
logs/
|
|
384
|
+
project-manager.log
|
|
385
|
+
architect.log
|
|
386
|
+
coder.log
|
|
387
|
+
reviewer.log
|
|
388
|
+
architecture-plan.md
|
|
389
|
+
implementation-log.md
|
|
390
|
+
validation-log.md
|
|
391
|
+
review-report.md
|
|
392
|
+
docs-sync-report.md
|
|
393
|
+
messages/
|
|
461
394
|
```
|
|
462
395
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
`NodePtyTerminalRuntime` 负责:
|
|
466
|
-
|
|
467
|
-
- spawn `claude`。
|
|
468
|
-
- 设置 cwd 为 repo root。
|
|
469
|
-
- 设置 env。
|
|
470
|
-
- 捕获 stdout/stderr stream。
|
|
471
|
-
- 将 stream 推送给 WebSocket subscribers。
|
|
472
|
-
- 将 stream append 到 role log。
|
|
473
|
-
- 监听 exit code。
|
|
474
|
-
- 更新 session status。
|
|
475
|
-
- 支持 resize。
|
|
396
|
+
Artifact checks are simple V1 checks:
|
|
476
397
|
|
|
477
|
-
|
|
398
|
+
- missing
|
|
399
|
+
- placeholder / incomplete
|
|
400
|
+
- ok
|
|
478
401
|
|
|
479
|
-
|
|
402
|
+
They are used for workflow readiness, not content quality judgment.
|
|
480
403
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
```json
|
|
484
|
-
{ "type": "input", "sessionId": "session_123", "data": "hello\n" }
|
|
485
|
-
{ "type": "resize", "sessionId": "session_123", "cols": 120, "rows": 32 }
|
|
486
|
-
{ "type": "output", "sessionId": "session_123", "data": "..." }
|
|
487
|
-
{ "type": "status", "sessionId": "session_123", "status": "running" }
|
|
488
|
-
{ "type": "exit", "sessionId": "session_123", "exitCode": 0 }
|
|
489
|
-
```
|
|
404
|
+
## 8. Workflow Computation
|
|
490
405
|
|
|
491
|
-
|
|
406
|
+
File:
|
|
492
407
|
|
|
493
|
-
|
|
408
|
+
- `src/backend/services/status-service.ts`
|
|
494
409
|
|
|
495
|
-
|
|
410
|
+
Endpoint:
|
|
496
411
|
|
|
497
412
|
```text
|
|
498
|
-
|
|
413
|
+
GET /api/tasks/:taskSlug/status
|
|
499
414
|
```
|
|
500
415
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
示例:
|
|
504
|
-
|
|
505
|
-
```text
|
|
506
|
-
Please read and execute the role command at: .ai/handoffs/<task-slug>/role-commands/architect.md
|
|
507
|
-
```
|
|
508
|
-
|
|
509
|
-
发送流程:
|
|
416
|
+
The workflow has five steps:
|
|
510
417
|
|
|
511
418
|
```text
|
|
512
|
-
|
|
513
|
-
-> POST /api/tasks/:taskSlug/sessions/:role/dispatch
|
|
514
|
-
-> backend checks role command file exists, non-empty, and not placeholder/draft
|
|
515
|
-
-> backend writes short instruction to terminal runtime
|
|
516
|
-
-> backend records dispatch event
|
|
419
|
+
architecture-plan -> implementation -> review -> docs-sync -> final-acceptance
|
|
517
420
|
```
|
|
518
421
|
|
|
519
|
-
|
|
422
|
+
Step readiness:
|
|
520
423
|
|
|
521
|
-
|
|
424
|
+
- Architecture is ready until `architecture-plan.md` is ok.
|
|
425
|
+
- Implementation is blocked until architecture is ok.
|
|
426
|
+
- Review is blocked until `implementation-log.md` and `validation-log.md` are ok.
|
|
427
|
+
- Docs Sync is blocked until `review-report.md` is ok.
|
|
428
|
+
- PM Final is blocked until `docs-sync-report.md` is ok.
|
|
522
429
|
|
|
523
|
-
|
|
524
|
-
write input:
|
|
525
|
-
runtime.write(sessionId, "Please read ...\r")
|
|
430
|
+
The report is displayed in the sidebar `Workflow` section.
|
|
526
431
|
|
|
527
|
-
|
|
528
|
-
runtime.subscribe(sessionId, listener)
|
|
529
|
-
```
|
|
432
|
+
## 9. Session Runtime
|
|
530
433
|
|
|
531
|
-
|
|
434
|
+
Files:
|
|
532
435
|
|
|
533
|
-
-
|
|
534
|
-
-
|
|
535
|
-
-
|
|
536
|
-
- backend
|
|
537
|
-
- backend 根据进程退出、输出活动和用户操作更新轻量状态。
|
|
538
|
-
- backend 在 GUI 中提示 waiting / crashed / exited 等状态。
|
|
436
|
+
- `src/backend/services/session-service.ts`
|
|
437
|
+
- `src/backend/adapters/claude-adapter.ts`
|
|
438
|
+
- `src/backend/runtime/node-pty-runtime.ts`
|
|
439
|
+
- `src/backend/runtime/session-registry.ts`
|
|
539
440
|
|
|
540
|
-
|
|
441
|
+
Session service owns role session lifecycle:
|
|
541
442
|
|
|
542
|
-
-
|
|
543
|
-
-
|
|
544
|
-
-
|
|
545
|
-
-
|
|
546
|
-
-
|
|
443
|
+
- start
|
|
444
|
+
- resume
|
|
445
|
+
- restart
|
|
446
|
+
- stop
|
|
447
|
+
- list
|
|
448
|
+
- get
|
|
547
449
|
|
|
548
|
-
|
|
450
|
+
Runtime session id and Claude session id are different:
|
|
549
451
|
|
|
550
|
-
|
|
452
|
+
- runtime session id identifies the local `node-pty` process in VCM.
|
|
453
|
+
- Claude session id identifies the Claude Code conversation for resume/transcript lookup.
|
|
551
454
|
|
|
552
|
-
|
|
455
|
+
Start:
|
|
553
456
|
|
|
554
457
|
```text
|
|
555
|
-
|
|
556
|
-
-> claude --agent <role>
|
|
557
|
-
|
|
558
|
-
bypassPermissions
|
|
559
|
-
-> claude --agent <role> --permission-mode bypassPermissions
|
|
560
|
-
|
|
561
|
-
--dangerously-skip-permissions
|
|
562
|
-
-> claude --agent <role> --dangerously-skip-permissions
|
|
458
|
+
claude --agent <role> --session-id <uuid>
|
|
563
459
|
```
|
|
564
460
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
- 权限模式是用户显式选择,不由 Project Manager 或 backend 自动切换。
|
|
568
|
-
- 权限模式只影响 Start / Restart 创建的新 Claude Code 进程。
|
|
569
|
-
- `RoleSessionRecord.permissionMode` 必须记录实际启动模式。
|
|
570
|
-
- GUI 显示实际 command,方便用户确认当前 session 的权限状态。
|
|
571
|
-
|
|
572
|
-
## 8. Repo Artifacts
|
|
573
|
-
|
|
574
|
-
V1 需要创建和维护:
|
|
461
|
+
Resume:
|
|
575
462
|
|
|
576
463
|
```text
|
|
577
|
-
|
|
578
|
-
handoffs/
|
|
579
|
-
<task-slug>/
|
|
580
|
-
role-commands/
|
|
581
|
-
architect.md
|
|
582
|
-
coder.md
|
|
583
|
-
reviewer.md
|
|
584
|
-
logs/
|
|
585
|
-
project-manager.log
|
|
586
|
-
architect.log
|
|
587
|
-
coder.log
|
|
588
|
-
reviewer.log
|
|
589
|
-
architecture-plan.md
|
|
590
|
-
implementation-log.md
|
|
591
|
-
validation-log.md
|
|
592
|
-
review-report.md
|
|
593
|
-
|
|
594
|
-
.vcm/
|
|
595
|
-
config.json
|
|
596
|
-
tasks/
|
|
597
|
-
<task-slug>.json
|
|
598
|
-
sessions/
|
|
599
|
-
<task-slug>.json
|
|
600
|
-
app-state.json
|
|
464
|
+
claude --agent <role> --resume <uuid>
|
|
601
465
|
```
|
|
602
466
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
## 9. 模块划分
|
|
606
|
-
|
|
607
|
-
推荐代码结构:
|
|
467
|
+
Permission flags:
|
|
608
468
|
|
|
609
469
|
```text
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
frontend/
|
|
614
|
-
app.tsx
|
|
615
|
-
routes/
|
|
616
|
-
project-dashboard.tsx
|
|
617
|
-
task-workspace.tsx
|
|
618
|
-
components/
|
|
619
|
-
app-shell.tsx
|
|
620
|
-
task-nav.tsx
|
|
621
|
-
role-session-tabs.tsx
|
|
622
|
-
session-console.tsx
|
|
623
|
-
event-log.tsx
|
|
624
|
-
status-badge.tsx
|
|
625
|
-
terminal/
|
|
626
|
-
xterm-view.tsx
|
|
627
|
-
terminal-client.ts
|
|
628
|
-
state/
|
|
629
|
-
api-client.ts
|
|
630
|
-
task-store.ts
|
|
631
|
-
session-store.ts
|
|
632
|
-
|
|
633
|
-
backend/
|
|
634
|
-
server.ts
|
|
635
|
-
api/
|
|
636
|
-
project-routes.ts
|
|
637
|
-
task-routes.ts
|
|
638
|
-
session-routes.ts
|
|
639
|
-
artifact-routes.ts
|
|
640
|
-
ws/
|
|
641
|
-
terminal-ws.ts
|
|
642
|
-
runtime/
|
|
643
|
-
terminal-runtime.ts
|
|
644
|
-
node-pty-runtime.ts
|
|
645
|
-
session-registry.ts
|
|
646
|
-
services/
|
|
647
|
-
project-service.ts
|
|
648
|
-
task-service.ts
|
|
649
|
-
session-service.ts
|
|
650
|
-
artifact-service.ts
|
|
651
|
-
command-dispatcher.ts
|
|
652
|
-
status-service.ts
|
|
653
|
-
adapters/
|
|
654
|
-
git-adapter.ts
|
|
655
|
-
claude-adapter.ts
|
|
656
|
-
filesystem.ts
|
|
657
|
-
command-runner.ts
|
|
658
|
-
validation/
|
|
659
|
-
environment-check.ts
|
|
660
|
-
artifact-check.ts
|
|
661
|
-
slug-check.ts
|
|
662
|
-
templates/
|
|
663
|
-
handoff.ts
|
|
664
|
-
role-command.ts
|
|
665
|
-
types/
|
|
666
|
-
project.ts
|
|
667
|
-
task.ts
|
|
668
|
-
session.ts
|
|
669
|
-
role.ts
|
|
670
|
-
artifact.ts
|
|
671
|
-
terminal.ts
|
|
672
|
-
api.ts
|
|
673
|
-
|
|
674
|
-
tests/
|
|
675
|
-
unit/
|
|
676
|
-
integration/
|
|
677
|
-
e2e/
|
|
470
|
+
--permission-mode bypassPermissions
|
|
471
|
+
--dangerously-skip-permissions
|
|
678
472
|
```
|
|
679
473
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
职责:
|
|
474
|
+
Session persistence:
|
|
683
475
|
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
- 管理 active task 和 active role tab state。
|
|
688
|
-
|
|
689
|
-
### 9.2 SessionConsole
|
|
690
|
-
|
|
691
|
-
职责:
|
|
476
|
+
```text
|
|
477
|
+
<baseRepoRoot>/.ai/vcm/sessions/<task>.json
|
|
478
|
+
```
|
|
692
479
|
|
|
693
|
-
|
|
694
|
-
- 连接指定 role session 的 WebSocket stream。
|
|
695
|
-
- 将用户输入写回 backend。
|
|
696
|
-
- 处理 resize。
|
|
697
|
-
- 显示 start / stop / restart 操作。
|
|
480
|
+
The persisted record includes:
|
|
698
481
|
|
|
699
|
-
|
|
482
|
+
- runtime session id
|
|
483
|
+
- Claude session id
|
|
484
|
+
- transcript path
|
|
485
|
+
- role
|
|
486
|
+
- status
|
|
487
|
+
- command display
|
|
488
|
+
- permission mode
|
|
489
|
+
- cwd
|
|
490
|
+
- pid
|
|
491
|
+
- raw log path
|
|
492
|
+
- role command path
|
|
493
|
+
- handoff artifact path
|
|
700
494
|
|
|
701
|
-
|
|
495
|
+
If a runtime process is gone but the role has a Claude session id, `getRoleSession` returns a recoverable `resumable` status.
|
|
702
496
|
|
|
703
|
-
-
|
|
704
|
-
- 保持短日志形态,不占用 terminal 主视野。
|
|
497
|
+
In task-worktree mode, `cwd` must be the immutable task worktree path. Role sessions must not start in the base repo when a task worktree exists.
|
|
705
498
|
|
|
706
|
-
|
|
499
|
+
## 10. Terminal Runtime
|
|
707
500
|
|
|
708
|
-
|
|
501
|
+
File:
|
|
709
502
|
|
|
710
|
-
-
|
|
711
|
-
- 提供 WebSocket endpoint。
|
|
712
|
-
- 管理 backend service lifecycle。
|
|
713
|
-
- Serve frontend static assets。
|
|
503
|
+
- `src/backend/runtime/node-pty-runtime.ts`
|
|
714
504
|
|
|
715
|
-
|
|
505
|
+
The runtime:
|
|
716
506
|
|
|
717
|
-
|
|
507
|
+
- spawns `node-pty`
|
|
508
|
+
- sets `TERM=xterm-256color`
|
|
509
|
+
- sets color-friendly env vars
|
|
510
|
+
- appends raw PTY output to `<taskRepoRoot>/.ai/handoffs/<task>/logs/<role>.log`
|
|
511
|
+
- emits terminal output/input/exit events to WebSocket subscribers
|
|
512
|
+
- replays the log on terminal WebSocket subscribe
|
|
718
513
|
|
|
719
|
-
|
|
720
|
-
- 启动 Claude Code pty。
|
|
721
|
-
- 转发 terminal input/output。
|
|
722
|
-
- 保存 raw logs。
|
|
723
|
-
- 维护 runtime status。
|
|
514
|
+
Terminal WebSocket:
|
|
724
515
|
|
|
725
|
-
|
|
516
|
+
```text
|
|
517
|
+
GET /ws/terminal/:sessionId
|
|
518
|
+
```
|
|
726
519
|
|
|
727
|
-
|
|
520
|
+
Client messages:
|
|
728
521
|
|
|
729
|
-
-
|
|
730
|
-
-
|
|
731
|
-
- 支持页面刷新后的 session 查询。
|
|
732
|
-
- 标记 crashed / exited / missing。
|
|
522
|
+
- input
|
|
523
|
+
- resize
|
|
733
524
|
|
|
734
|
-
|
|
525
|
+
Server messages:
|
|
735
526
|
|
|
736
|
-
|
|
527
|
+
- output
|
|
528
|
+
- exit
|
|
529
|
+
- error
|
|
737
530
|
|
|
738
|
-
|
|
739
|
-
- 创建 `role-commands/` 和 `logs/`。
|
|
740
|
-
- 创建 artifact 模板。
|
|
741
|
-
- 检查 artifact 是否存在。
|
|
742
|
-
- 检查 artifact 是否包含关键标题。
|
|
743
|
-
- 保存 role command。
|
|
744
|
-
- 追加 raw terminal logs。
|
|
531
|
+
## 11. Message Bus
|
|
745
532
|
|
|
746
|
-
|
|
533
|
+
Files:
|
|
747
534
|
|
|
748
|
-
|
|
535
|
+
- `src/backend/services/message-service.ts`
|
|
536
|
+
- `src/backend/templates/message-envelope.ts`
|
|
537
|
+
- `src/cli/vcmctl.ts`
|
|
749
538
|
|
|
750
|
-
|
|
751
|
-
- 校验目标 role session 是否 running。
|
|
752
|
-
- 将短指令写入目标 terminal session。
|
|
753
|
-
- 记录 dispatch event。
|
|
539
|
+
State:
|
|
754
540
|
|
|
755
|
-
|
|
541
|
+
```text
|
|
542
|
+
.ai/vcm/messages/<task>.jsonl
|
|
543
|
+
.ai/vcm/orchestration/<task>.json
|
|
544
|
+
.ai/handoffs/<task>/messages/<message-id>.md
|
|
545
|
+
```
|
|
756
546
|
|
|
757
|
-
|
|
758
|
-
- 每次 dispatch 都必须有 role command artifact。
|
|
759
|
-
- 高风险 command 后续可增加用户确认 gate。
|
|
547
|
+
Policy:
|
|
760
548
|
|
|
761
|
-
|
|
549
|
+
- User can only send `user-request` to `project-manager`.
|
|
550
|
+
- PM can send `task`, `question`, `review-request`, `revise`, `cancel` to non-PM roles.
|
|
551
|
+
- Non-PM roles can send `result`, `question`, `blocked`, `finding` to PM.
|
|
762
552
|
|
|
763
|
-
|
|
553
|
+
Manual mode:
|
|
764
554
|
|
|
765
555
|
```text
|
|
766
|
-
|
|
767
|
-
POST /api/projects/connect
|
|
768
|
-
GET /api/projects/current
|
|
769
|
-
GET /api/projects/harness
|
|
556
|
+
send -> pending_approval -> Stage -> staged
|
|
770
557
|
```
|
|
771
558
|
|
|
772
|
-
`
|
|
559
|
+
`Stage` writes:
|
|
773
560
|
|
|
774
|
-
```
|
|
775
|
-
|
|
776
|
-
"repoPath": "/path/to/repo"
|
|
777
|
-
}
|
|
561
|
+
```text
|
|
562
|
+
Read and handle VCM message <id> at <bodyPath>
|
|
778
563
|
```
|
|
779
564
|
|
|
780
|
-
|
|
565
|
+
It does not append Enter.
|
|
566
|
+
|
|
567
|
+
Auto mode:
|
|
781
568
|
|
|
782
569
|
```text
|
|
783
|
-
|
|
784
|
-
POST /api/tasks
|
|
785
|
-
GET /api/tasks/:taskSlug
|
|
786
|
-
GET /api/tasks/:taskSlug/status
|
|
570
|
+
send -> delivered
|
|
787
571
|
```
|
|
788
572
|
|
|
789
|
-
`
|
|
573
|
+
The backend writes a `[VCM MESSAGE]` envelope to the target terminal and appends Enter.
|
|
790
574
|
|
|
791
|
-
|
|
792
|
-
{
|
|
793
|
-
"taskSlug": "fix-refund-coupon",
|
|
794
|
-
"title": "Fix refund coupon behavior",
|
|
795
|
-
"specPath": ".ai/task-specs/fix-refund-coupon.md"
|
|
796
|
-
}
|
|
797
|
-
```
|
|
575
|
+
The backend still exposes pause/resume orchestration API routes and stores `paused` for compatibility. The current GUI only toggles `mode` between `manual` and `auto`.
|
|
798
576
|
|
|
799
|
-
|
|
577
|
+
Messages and orchestration snapshots are central project state under `baseRepoRoot/.ai/vcm`. Message body markdown lives in the task worktree handoff directory.
|
|
800
578
|
|
|
801
|
-
|
|
802
|
-
GET /api/tasks/:taskSlug/sessions
|
|
803
|
-
POST /api/tasks/:taskSlug/sessions/:role/start
|
|
804
|
-
POST /api/tasks/:taskSlug/sessions/:role/stop
|
|
805
|
-
POST /api/tasks/:taskSlug/sessions/:role/resume
|
|
806
|
-
POST /api/tasks/:taskSlug/sessions/:role/restart
|
|
807
|
-
POST /api/tasks/:taskSlug/sessions/:role/resize
|
|
808
|
-
POST /api/tasks/:taskSlug/sessions/:role/dispatch
|
|
809
|
-
```
|
|
579
|
+
## 12. Role Command Compatibility
|
|
810
580
|
|
|
811
|
-
|
|
581
|
+
Files:
|
|
812
582
|
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
GET /api/tasks/:taskSlug/role-commands/:role
|
|
817
|
-
PUT /api/tasks/:taskSlug/role-commands/:role
|
|
818
|
-
GET /api/tasks/:taskSlug/logs/:role
|
|
819
|
-
```
|
|
583
|
+
- `src/backend/services/command-dispatcher.ts`
|
|
584
|
+
- `src/backend/api/session-routes.ts`
|
|
585
|
+
- `src/backend/api/artifact-routes.ts`
|
|
820
586
|
|
|
821
|
-
|
|
587
|
+
Compatibility endpoint:
|
|
822
588
|
|
|
823
589
|
```text
|
|
824
|
-
|
|
590
|
+
POST /api/tasks/:taskSlug/sessions/:role/dispatch
|
|
825
591
|
```
|
|
826
592
|
|
|
827
|
-
|
|
593
|
+
Dispatchable roles:
|
|
828
594
|
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
```
|
|
595
|
+
- `architect`
|
|
596
|
+
- `coder`
|
|
597
|
+
- `reviewer`
|
|
833
598
|
|
|
834
|
-
|
|
599
|
+
The dispatcher:
|
|
835
600
|
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
```
|
|
601
|
+
1. Loads the task.
|
|
602
|
+
2. Reads the role command artifact.
|
|
603
|
+
3. Rejects missing, empty, or placeholder role commands.
|
|
604
|
+
4. Resolves primary command path `role-commands/<role>.md`, with legacy fallback `<role>-command.md`.
|
|
605
|
+
5. Writes `Please read and execute the role command at: <path>` to the target terminal and submits Enter.
|
|
842
606
|
|
|
843
|
-
|
|
607
|
+
This is a compatibility path. The preferred V1 coordination path is `vcmctl` message bus.
|
|
844
608
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
```json
|
|
848
|
-
{
|
|
849
|
-
"version": 1,
|
|
850
|
-
"repoRoot": "/path/to/repo",
|
|
851
|
-
"defaultRoles": ["project-manager", "architect", "coder", "reviewer"],
|
|
852
|
-
"handoffRoot": ".ai/handoffs",
|
|
853
|
-
"stateRoot": ".vcm",
|
|
854
|
-
"terminalBackend": "node-pty",
|
|
855
|
-
"claudeCommand": "claude"
|
|
856
|
-
}
|
|
857
|
-
```
|
|
609
|
+
## 13. Harness Service
|
|
858
610
|
|
|
859
|
-
|
|
611
|
+
File:
|
|
860
612
|
|
|
861
|
-
|
|
862
|
-
{
|
|
863
|
-
"version": 1,
|
|
864
|
-
"taskSlug": "fix-refund-coupon",
|
|
865
|
-
"title": "Fix refund coupon behavior",
|
|
866
|
-
"createdAt": "2026-05-29T00:00:00+08:00",
|
|
867
|
-
"updatedAt": "2026-05-29T00:00:00+08:00",
|
|
868
|
-
"repoRoot": "/path/to/repo",
|
|
869
|
-
"branch": "feature/refund-coupon",
|
|
870
|
-
"handoffDir": ".ai/handoffs/fix-refund-coupon",
|
|
871
|
-
"status": "created",
|
|
872
|
-
"specPath": ".ai/task-specs/fix-refund-coupon.md"
|
|
873
|
-
}
|
|
874
|
-
```
|
|
613
|
+
- `src/backend/services/harness-service.ts`
|
|
875
614
|
|
|
876
|
-
|
|
615
|
+
Harness files:
|
|
877
616
|
|
|
878
|
-
```
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
"command": "claude --agent architect --permission-mode bypassPermissions",
|
|
886
|
-
"permissionMode": "bypassPermissions",
|
|
887
|
-
"cwd": "/path/to/repo",
|
|
888
|
-
"terminalBackend": "node-pty",
|
|
889
|
-
"pid": 12345,
|
|
890
|
-
"logPath": ".ai/handoffs/fix-refund-coupon/logs/architect.log",
|
|
891
|
-
"roleCommandPath": ".ai/handoffs/fix-refund-coupon/role-commands/architect.md",
|
|
892
|
-
"handoffArtifactPath": ".ai/handoffs/fix-refund-coupon/architecture-plan.md",
|
|
893
|
-
"startedAt": "2026-05-29T00:00:00+08:00",
|
|
894
|
-
"lastOutputAt": "2026-05-29T00:03:14+08:00",
|
|
895
|
-
"exitCode": null
|
|
896
|
-
}
|
|
617
|
+
```text
|
|
618
|
+
CLAUDE.md
|
|
619
|
+
.gitignore
|
|
620
|
+
.claude/agents/project-manager.md
|
|
621
|
+
.claude/agents/architect.md
|
|
622
|
+
.claude/agents/coder.md
|
|
623
|
+
.claude/agents/reviewer.md
|
|
897
624
|
```
|
|
898
625
|
|
|
899
|
-
|
|
626
|
+
Managed block:
|
|
900
627
|
|
|
901
|
-
```
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
"updatedAt": "2026-05-29T00:03:14+08:00",
|
|
906
|
-
"roles": {
|
|
907
|
-
"project-manager": {
|
|
908
|
-
"id": "session_pm_123",
|
|
909
|
-
"status": "running"
|
|
910
|
-
},
|
|
911
|
-
"architect": {
|
|
912
|
-
"id": "session_architect_123",
|
|
913
|
-
"claudeSessionId": "00000000-0000-4000-8000-000000000001",
|
|
914
|
-
"status": "running",
|
|
915
|
-
"record": "{...RoleSessionRecord}"
|
|
916
|
-
},
|
|
917
|
-
"coder": {
|
|
918
|
-
"id": null,
|
|
919
|
-
"status": "not_started"
|
|
920
|
-
},
|
|
921
|
-
"reviewer": {
|
|
922
|
-
"id": null,
|
|
923
|
-
"status": "not_started"
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
}
|
|
628
|
+
```md
|
|
629
|
+
<!-- VCM:BEGIN version=1 -->
|
|
630
|
+
...
|
|
631
|
+
<!-- VCM:END -->
|
|
927
632
|
```
|
|
928
633
|
|
|
929
|
-
|
|
634
|
+
`.gitignore` uses the same VCM managed-block concept with hash comments:
|
|
930
635
|
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
running
|
|
937
|
-
waiting
|
|
938
|
-
blocked
|
|
939
|
-
done
|
|
940
|
-
resumable
|
|
941
|
-
crashed
|
|
942
|
-
exited
|
|
943
|
-
missing
|
|
944
|
-
unknown
|
|
636
|
+
```gitignore
|
|
637
|
+
# VCM:BEGIN version=1
|
|
638
|
+
.ai/vcm/
|
|
639
|
+
.vcm/
|
|
640
|
+
# VCM:END
|
|
945
641
|
```
|
|
946
642
|
|
|
947
|
-
|
|
643
|
+
The service:
|
|
948
644
|
|
|
949
|
-
-
|
|
950
|
-
-
|
|
951
|
-
-
|
|
952
|
-
- `
|
|
953
|
-
-
|
|
954
|
-
- `waiting/blocked/done` 可以先由用户或 role output marker 显式标记。
|
|
955
|
-
- 自动推断只能作为 best-effort。
|
|
645
|
+
- checks whether files exist
|
|
646
|
+
- checks whether a managed block exists
|
|
647
|
+
- compares the managed block with the current template
|
|
648
|
+
- plans `create`, `insert`, `update`, or `ok`
|
|
649
|
+
- applies only the planned managed-block change
|
|
956
650
|
|
|
957
|
-
|
|
651
|
+
It must not overwrite user content outside the VCM block.
|
|
958
652
|
|
|
959
|
-
|
|
960
|
-
{
|
|
961
|
-
"id": "evt_123",
|
|
962
|
-
"sessionId": "session_architect_123",
|
|
963
|
-
"taskSlug": "fix-refund-coupon",
|
|
964
|
-
"role": "architect",
|
|
965
|
-
"type": "output",
|
|
966
|
-
"timestamp": "2026-05-29T00:03:14+08:00",
|
|
967
|
-
"data": "..."
|
|
968
|
-
}
|
|
969
|
-
```
|
|
653
|
+
## 14. Translation Architecture
|
|
970
654
|
|
|
971
|
-
|
|
655
|
+
Files:
|
|
972
656
|
|
|
973
|
-
|
|
657
|
+
- `src/backend/services/translation-service.ts`
|
|
658
|
+
- `src/backend/services/translation-queue.ts`
|
|
659
|
+
- `src/backend/services/translation-prompts.ts`
|
|
660
|
+
- `src/backend/services/claude-transcript-service.ts`
|
|
661
|
+
- `src/backend/adapters/translation-provider.ts`
|
|
662
|
+
- `src/backend/ws/translation-ws.ts`
|
|
663
|
+
- `src/backend/api/translation-routes.ts`
|
|
664
|
+
- `src/frontend/components/translation-panel.tsx`
|
|
665
|
+
- `src/frontend/components/translation-settings-modal.tsx`
|
|
974
666
|
|
|
975
|
-
|
|
976
|
-
vcm dev 或桌面入口
|
|
977
|
-
-> start local Node backend
|
|
978
|
-
-> serve React frontend
|
|
979
|
-
-> open browser / desktop shell
|
|
980
|
-
-> show Project Dashboard
|
|
981
|
-
```
|
|
667
|
+
### Settings
|
|
982
668
|
|
|
983
|
-
|
|
669
|
+
Settings service:
|
|
984
670
|
|
|
985
|
-
|
|
986
|
-
User selects repo path
|
|
987
|
-
-> POST /api/projects/connect
|
|
988
|
-
-> check git repo
|
|
989
|
-
-> check claude --version
|
|
990
|
-
-> create .vcm/config.json
|
|
991
|
-
-> create .ai/handoffs/
|
|
992
|
-
-> show branch and dirty warning
|
|
993
|
-
```
|
|
671
|
+
- `src/backend/services/app-settings-service.ts`
|
|
994
672
|
|
|
995
|
-
|
|
673
|
+
Storage:
|
|
996
674
|
|
|
997
675
|
```text
|
|
998
|
-
|
|
999
|
-
-> enter task slug / title
|
|
1000
|
-
-> POST /api/tasks
|
|
1001
|
-
-> create .ai/handoffs/<task-slug>/
|
|
1002
|
-
-> create role-commands/
|
|
1003
|
-
-> create logs/
|
|
1004
|
-
-> create artifact templates
|
|
1005
|
-
-> create .vcm/tasks/<task-slug>.json
|
|
1006
|
-
-> open Task Workspace
|
|
676
|
+
~/.vcm/settings.json
|
|
1007
677
|
```
|
|
1008
678
|
|
|
1009
|
-
|
|
679
|
+
Stored data:
|
|
1010
680
|
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
-> NodePtyTerminalRuntime spawns claude --agent project-manager
|
|
1015
|
-
-> backend writes RoleSessionRecord
|
|
1016
|
-
-> frontend opens WebSocket
|
|
1017
|
-
-> xterm.js renders output
|
|
1018
|
-
```
|
|
681
|
+
- translation settings
|
|
682
|
+
- translation secrets
|
|
683
|
+
- recent repository paths, max 5
|
|
1019
684
|
|
|
1020
|
-
|
|
685
|
+
Legacy migration:
|
|
1021
686
|
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
-> if session not started, show Start button
|
|
1027
|
-
-> user types directly into terminal
|
|
1028
|
-
```
|
|
687
|
+
- `~/.vibe-coding-master/settings.json`
|
|
688
|
+
- `~/.vibe-coding-master/translation.json`
|
|
689
|
+
|
|
690
|
+
### Provider
|
|
1029
691
|
|
|
1030
|
-
|
|
692
|
+
Provider type:
|
|
1031
693
|
|
|
1032
694
|
```text
|
|
1033
|
-
|
|
1034
|
-
-> User can inspect the command file in the task directory when needed
|
|
1035
|
-
-> User clicks Send Command in the target role toolbar
|
|
1036
|
-
-> backend validates command file
|
|
1037
|
-
-> backend writes short instruction to architect pty
|
|
1038
|
-
-> backend records dispatch event
|
|
695
|
+
openai-compatible
|
|
1039
696
|
```
|
|
1040
697
|
|
|
1041
|
-
|
|
698
|
+
It uses chat completions and builds the URL from `baseUrl`.
|
|
1042
699
|
|
|
1043
|
-
|
|
1044
|
-
V1 main GUI does not render artifact status.
|
|
1045
|
-
Handoff files remain available in the task directory and backend services.
|
|
1046
|
-
```
|
|
700
|
+
Prompt keys:
|
|
1047
701
|
|
|
1048
|
-
|
|
702
|
+
- `zh-to-en`
|
|
703
|
+
- `zh-to-en-with-context`
|
|
704
|
+
- `en-to-zh`
|
|
1049
705
|
|
|
1050
|
-
|
|
1051
|
-
User clicks Restart coder
|
|
1052
|
-
-> backend stops existing coder pty if any
|
|
1053
|
-
-> preserves logs and artifacts
|
|
1054
|
-
-> starts new claude --agent coder
|
|
1055
|
-
-> updates session record
|
|
1056
|
-
-> frontend reconnects WebSocket
|
|
1057
|
-
```
|
|
706
|
+
### Claude Output Path
|
|
1058
707
|
|
|
1059
|
-
|
|
708
|
+
Output translation reads Claude transcript JSONL, not terminal raw output.
|
|
1060
709
|
|
|
1061
|
-
|
|
710
|
+
Resolution order:
|
|
1062
711
|
|
|
1063
|
-
|
|
712
|
+
1. persisted `RoleSessionRecord.transcriptPath`
|
|
713
|
+
2. `claudeTranscriptPath(session.cwd, session.claudeSessionId)`
|
|
714
|
+
3. scan `~/.claude/projects/*/<sessionId>.jsonl` and choose newest mtime
|
|
1064
715
|
|
|
1065
|
-
|
|
716
|
+
Tailer:
|
|
1066
717
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
File Responsibilities
|
|
1073
|
-
Public Surface Contract
|
|
1074
|
-
Phases
|
|
1075
|
-
Validation Per Phase
|
|
1076
|
-
Risks
|
|
1077
|
-
Stop Conditions
|
|
1078
|
-
```
|
|
718
|
+
- validates file exists
|
|
719
|
+
- can replay history since session start minus a grace window
|
|
720
|
+
- uses `fs.watch`
|
|
721
|
+
- also polls every 500ms
|
|
722
|
+
- parses only complete newline-delimited JSON records
|
|
1079
723
|
|
|
1080
|
-
|
|
724
|
+
Parsed transcript events:
|
|
1081
725
|
|
|
1082
|
-
|
|
726
|
+
- `text`
|
|
727
|
+
- `thinking`
|
|
728
|
+
- `question`
|
|
729
|
+
- `todo`
|
|
730
|
+
- `agent`
|
|
731
|
+
- `tool_use`
|
|
732
|
+
- `tool_result`
|
|
1083
733
|
|
|
1084
|
-
|
|
1085
|
-
Summary
|
|
1086
|
-
Files Changed
|
|
1087
|
-
Public Surface Changed
|
|
1088
|
-
Tests Added / Updated
|
|
1089
|
-
Validation Run
|
|
1090
|
-
Deviations From Architecture Plan
|
|
1091
|
-
Follow-ups
|
|
1092
|
-
```
|
|
734
|
+
Translation service behavior:
|
|
1093
735
|
|
|
1094
|
-
|
|
736
|
+
- ignores thinking
|
|
737
|
+
- translates text/question/todo/agent as prose
|
|
738
|
+
- preserves tool_use/tool_result as tool-output
|
|
739
|
+
- queues translation per runtime session id
|
|
740
|
+
- emits WebSocket `translation-entry`
|
|
741
|
+
- emits WebSocket `translation-status`
|
|
1095
742
|
|
|
1096
|
-
|
|
743
|
+
### User Input Path
|
|
1097
744
|
|
|
1098
745
|
```text
|
|
1099
|
-
|
|
746
|
+
textarea -> POST translation/input -> provider -> English draft in the same textarea -> optional send
|
|
1100
747
|
```
|
|
1101
748
|
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
最低标题:
|
|
749
|
+
Send path:
|
|
1105
750
|
|
|
1106
751
|
```text
|
|
1107
|
-
|
|
1108
|
-
Role / Handoff Compliance
|
|
1109
|
-
Scope Review
|
|
1110
|
-
Architecture Review
|
|
1111
|
-
Public Contract Review
|
|
1112
|
-
Test Review
|
|
1113
|
-
Validation Evidence
|
|
1114
|
-
Findings
|
|
1115
|
-
Decision
|
|
752
|
+
POST translation/send -> runtime.write(session.id, englishText + "\r")
|
|
1116
753
|
```
|
|
1117
754
|
|
|
1118
|
-
|
|
755
|
+
The backend strips trailing newlines before appending `\r`.
|
|
1119
756
|
|
|
1120
|
-
|
|
757
|
+
## 15. API Surface
|
|
1121
758
|
|
|
1122
|
-
|
|
759
|
+
Project:
|
|
1123
760
|
|
|
1124
761
|
```text
|
|
1125
|
-
|
|
1126
|
-
|
|
762
|
+
GET /api/health
|
|
763
|
+
GET /api/projects/recent
|
|
764
|
+
GET /api/projects/current
|
|
765
|
+
POST /api/projects/connect
|
|
1127
766
|
```
|
|
1128
767
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
`POST /api/projects/connect` 必须检查 Git repo。
|
|
1132
|
-
|
|
1133
|
-
失败时提示:
|
|
768
|
+
Harness:
|
|
1134
769
|
|
|
1135
770
|
```text
|
|
1136
|
-
|
|
771
|
+
GET /api/projects/harness
|
|
772
|
+
POST /api/projects/harness/apply
|
|
1137
773
|
```
|
|
1138
774
|
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
默认不重复启动。
|
|
1142
|
-
|
|
1143
|
-
GUI 显示:
|
|
1144
|
-
|
|
1145
|
-
- Focus existing session。
|
|
1146
|
-
- Restart session。
|
|
1147
|
-
- Stop session。
|
|
1148
|
-
|
|
1149
|
-
### 14.4 role command 缺失
|
|
1150
|
-
|
|
1151
|
-
发送 command 必须失败:
|
|
775
|
+
Tasks:
|
|
1152
776
|
|
|
1153
777
|
```text
|
|
1154
|
-
|
|
1155
|
-
|
|
778
|
+
GET /api/tasks
|
|
779
|
+
POST /api/tasks
|
|
780
|
+
GET /api/tasks/:taskSlug
|
|
781
|
+
GET /api/tasks/:taskSlug/status
|
|
782
|
+
POST /api/tasks/:taskSlug/cleanup
|
|
1156
783
|
```
|
|
1157
784
|
|
|
1158
|
-
|
|
785
|
+
There is no task-level "switch worktree" API. Worktree selection happens only at task creation.
|
|
1159
786
|
|
|
1160
|
-
|
|
787
|
+
Sessions:
|
|
1161
788
|
|
|
1162
789
|
```text
|
|
1163
|
-
|
|
790
|
+
GET /api/tasks/:taskSlug/sessions
|
|
791
|
+
POST /api/tasks/:taskSlug/sessions/:role/start
|
|
792
|
+
POST /api/tasks/:taskSlug/sessions/:role/resume
|
|
793
|
+
POST /api/tasks/:taskSlug/sessions/:role/restart
|
|
794
|
+
POST /api/tasks/:taskSlug/sessions/:role/stop
|
|
795
|
+
POST /api/tasks/:taskSlug/sessions/:role/dispatch
|
|
1164
796
|
```
|
|
1165
797
|
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
Backend artifact schema check 标记 missing,不自动补写真实内容。
|
|
1169
|
-
|
|
1170
|
-
### 14.7 进程崩溃
|
|
1171
|
-
|
|
1172
|
-
role session 进程异常退出时:
|
|
1173
|
-
|
|
1174
|
-
- 状态标记为 `crashed`。
|
|
1175
|
-
- 保留 raw log。
|
|
1176
|
-
- 显示 exit code。
|
|
1177
|
-
- 提供 Restart。
|
|
1178
|
-
|
|
1179
|
-
### 14.8 页面刷新
|
|
1180
|
-
|
|
1181
|
-
页面刷新后:
|
|
1182
|
-
|
|
1183
|
-
- 前端重新请求 task/session 状态。
|
|
1184
|
-
- 对 live session 重新建立 WebSocket。
|
|
1185
|
-
- 对 missing live process 显示 `missing` 或 `exited`。
|
|
1186
|
-
|
|
1187
|
-
## 15. 安全和权限边界
|
|
1188
|
-
|
|
1189
|
-
V1 不是 sandbox。它是本地 GUI session orchestrator。
|
|
1190
|
-
|
|
1191
|
-
V1 必须明确提示:
|
|
1192
|
-
|
|
1193
|
-
- Claude Code 在用户当前 repo 环境运行。
|
|
1194
|
-
- VCM 不拦截 Claude Code 的所有文件写入。
|
|
1195
|
-
- GUI 中的 terminal 是真实 Claude Code session。
|
|
1196
|
-
- 高风险任务仍需要 human approval。
|
|
1197
|
-
- 角色隔离依赖 `.claude/agents/*`、Claude Code permissions、用户 review 和 handoff artifacts。
|
|
1198
|
-
|
|
1199
|
-
V1 推荐但不强制:
|
|
1200
|
-
|
|
1201
|
-
- 项目提供 `.claude/agents/project-manager.md`。
|
|
1202
|
-
- 项目提供 `.claude/agents/architect.md`。
|
|
1203
|
-
- 项目提供 `.claude/agents/coder.md`。
|
|
1204
|
-
- 项目提供 `.claude/agents/reviewer.md`。
|
|
1205
|
-
- 项目配置 Claude Code permission hooks。
|
|
1206
|
-
|
|
1207
|
-
V1 可以提供 Harness Health 检查这些文件是否存在,但不自动生成复杂 role agents。
|
|
1208
|
-
|
|
1209
|
-
## 16. 后续演进接口
|
|
1210
|
-
|
|
1211
|
-
V1 代码应预留这些抽象,但不完整实现:
|
|
1212
|
-
|
|
1213
|
-
### 16.1 Review Adapter
|
|
1214
|
-
|
|
1215
|
-
后续接入 Cross-Model Reviewer。
|
|
1216
|
-
|
|
1217
|
-
### 16.2 Validation Runner
|
|
1218
|
-
|
|
1219
|
-
后续自动运行 validation commands。
|
|
1220
|
-
|
|
1221
|
-
### 16.3 Worktree Manager
|
|
1222
|
-
|
|
1223
|
-
后续实现:
|
|
798
|
+
Artifacts:
|
|
1224
799
|
|
|
1225
800
|
```text
|
|
1226
|
-
|
|
801
|
+
GET /api/tasks/:taskSlug/artifacts
|
|
802
|
+
GET /api/tasks/:taskSlug/artifacts/:artifactName
|
|
803
|
+
GET /api/tasks/:taskSlug/role-commands/:role
|
|
804
|
+
PUT /api/tasks/:taskSlug/role-commands/:role
|
|
805
|
+
GET /api/tasks/:taskSlug/logs/:role
|
|
1227
806
|
```
|
|
1228
807
|
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
### 16.4 Session Persistence Hardening
|
|
1232
|
-
|
|
1233
|
-
后续增强:
|
|
1234
|
-
|
|
1235
|
-
- backend lifecycle 管理。
|
|
1236
|
-
- session registry 持久化。
|
|
1237
|
-
- raw log replay。
|
|
1238
|
-
- 页面刷新和 backend 重启后的状态恢复。
|
|
1239
|
-
- crashed / exited session 的恢复建议。
|
|
1240
|
-
|
|
1241
|
-
### 16.5 Desktop Shell
|
|
1242
|
-
|
|
1243
|
-
后续用 Electron 或 Tauri 包装本地 Web GUI。
|
|
1244
|
-
|
|
1245
|
-
### 16.6 Permission / Hook Manager
|
|
1246
|
-
|
|
1247
|
-
后续生成 role-specific Claude Code permission hooks。
|
|
1248
|
-
|
|
1249
|
-
## 17. 实施顺序
|
|
1250
|
-
|
|
1251
|
-
### Milestone 1: Local GUI Shell
|
|
1252
|
-
|
|
1253
|
-
- TypeScript monorepo / app 初始化。
|
|
1254
|
-
- React + Vite frontend。
|
|
1255
|
-
- Node backend。
|
|
1256
|
-
- `vcm dev` 启动前后端。
|
|
1257
|
-
- Project Dashboard。
|
|
1258
|
-
- repo connect API。
|
|
1259
|
-
- environment check。
|
|
1260
|
-
|
|
1261
|
-
### Milestone 2: Task Workspace and Artifacts
|
|
1262
|
-
|
|
1263
|
-
- Task Workspace 页面。
|
|
1264
|
-
- `POST /api/tasks`。
|
|
1265
|
-
- handoff directory。
|
|
1266
|
-
- role command templates。
|
|
1267
|
-
- artifact templates。
|
|
1268
|
-
- artifact schema checks。
|
|
1269
|
-
|
|
1270
|
-
### Milestone 3: Embedded Terminal Runtime
|
|
1271
|
-
|
|
1272
|
-
- TerminalRuntime interface。
|
|
1273
|
-
- NodePtyTerminalRuntime。
|
|
1274
|
-
- WebSocket terminal bridge。
|
|
1275
|
-
- xterm.js SessionConsole。
|
|
1276
|
-
- start / stop / restart role session。
|
|
1277
|
-
- raw logs。
|
|
1278
|
-
|
|
1279
|
-
### Milestone 4: Role Session Cockpit
|
|
1280
|
-
|
|
1281
|
-
- role session tabs。
|
|
1282
|
-
- session status badges。
|
|
1283
|
-
- reconnect after page refresh。
|
|
1284
|
-
- event log。
|
|
1285
|
-
- session registry。
|
|
1286
|
-
- crash / exited handling。
|
|
1287
|
-
|
|
1288
|
-
### Milestone 5: GUI Role Command Dispatch
|
|
1289
|
-
|
|
1290
|
-
- role command viewer。
|
|
1291
|
-
- Send Command button。
|
|
1292
|
-
- backend dispatch API。
|
|
1293
|
-
- short instruction write to pty。
|
|
1294
|
-
- dispatch event recording。
|
|
1295
|
-
|
|
1296
|
-
### Milestone 6: Acceptance Smoke
|
|
1297
|
-
|
|
1298
|
-
- one repo。
|
|
1299
|
-
- one task。
|
|
1300
|
-
- start project-manager。
|
|
1301
|
-
- start architect。
|
|
1302
|
-
- send architect command。
|
|
1303
|
-
- verify output streams in GUI。
|
|
1304
|
-
- verify raw logs saved。
|
|
1305
|
-
- verify artifact status shown。
|
|
1306
|
-
- restart coder session。
|
|
1307
|
-
- stop all sessions。
|
|
1308
|
-
|
|
1309
|
-
## 18. V1 验收标准
|
|
1310
|
-
|
|
1311
|
-
V1 完成时,应能在一个真实 repo 中演示:
|
|
808
|
+
Messages:
|
|
1312
809
|
|
|
1313
810
|
```text
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
10. 用户需要时可在任务目录查看 architect.md
|
|
1324
|
-
11. 用户点击目标 role 的 Send Command
|
|
1325
|
-
12. architect session 收到短指令并执行
|
|
1326
|
-
13. architect raw output 写入 logs/architect.log
|
|
1327
|
-
14. backend artifact check 可识别 architecture-plan.md missing / incomplete / ok
|
|
1328
|
-
15. 用户可以 restart coder session
|
|
1329
|
-
16. 页面刷新后能恢复 task/session 状态
|
|
811
|
+
GET /api/tasks/:taskSlug/messages
|
|
812
|
+
POST /api/tasks/:taskSlug/messages
|
|
813
|
+
POST /api/tasks/:taskSlug/messages/:messageId/stage
|
|
814
|
+
POST /api/tasks/:taskSlug/messages/:messageId/approve
|
|
815
|
+
POST /api/tasks/:taskSlug/messages/:messageId/reject
|
|
816
|
+
GET /api/tasks/:taskSlug/orchestration
|
|
817
|
+
PUT /api/tasks/:taskSlug/orchestration
|
|
818
|
+
POST /api/tasks/:taskSlug/orchestration/pause
|
|
819
|
+
POST /api/tasks/:taskSlug/orchestration/resume
|
|
1330
820
|
```
|
|
1331
821
|
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
- GUI 启动成功。
|
|
1335
|
-
- repo 连接成功。
|
|
1336
|
-
- role session 创建成功。
|
|
1337
|
-
- terminal input/output 稳定。
|
|
1338
|
-
- raw logs 不丢。
|
|
1339
|
-
- artifact 状态可见。
|
|
1340
|
-
- role command dispatch 可控。
|
|
1341
|
-
- 页面刷新后可恢复状态。
|
|
1342
|
-
|
|
1343
|
-
## 19. 主要风险和应对
|
|
1344
|
-
|
|
1345
|
-
### 19.1 Claude Code 交互终端嵌入复杂
|
|
1346
|
-
|
|
1347
|
-
应对:
|
|
822
|
+
Translation:
|
|
1348
823
|
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
- backend 持有 session registry。
|
|
1360
|
-
- `.vcm/sessions` 保存每个 role 的完整 `RoleSessionRecord` 和 `claudeSessionId`。
|
|
1361
|
-
- 首次启动使用 `claude --agent <role> --session-id <uuid>`。
|
|
1362
|
-
- backend 重启或异常退出后,GUI 将旧 pty 标记为 `resumable`。
|
|
1363
|
-
- Resume 使用 `claude --agent <role> --resume <uuid>` 创建新的 embedded terminal。
|
|
1364
|
-
- raw logs 持续写入。
|
|
1365
|
-
- 页面刷新重新订阅。
|
|
1366
|
-
- 后续继续增强 backend lifecycle 和 raw log replay。
|
|
1367
|
-
|
|
1368
|
-
### 19.3 Claude Code 状态不可结构化
|
|
824
|
+
```text
|
|
825
|
+
GET /api/translation/settings
|
|
826
|
+
PUT /api/translation/settings
|
|
827
|
+
GET /api/translation/prompts
|
|
828
|
+
POST /api/translation/test
|
|
829
|
+
POST /api/tasks/:taskSlug/sessions/:role/translation/input
|
|
830
|
+
POST /api/tasks/:taskSlug/sessions/:role/translation/send
|
|
831
|
+
POST /api/translation/sessions/:sessionId/clear
|
|
832
|
+
POST /api/translation/sessions/:sessionId/retry/:translationId
|
|
833
|
+
```
|
|
1369
834
|
|
|
1370
|
-
|
|
835
|
+
WebSockets:
|
|
1371
836
|
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
837
|
+
```text
|
|
838
|
+
/ws/terminal/:sessionId
|
|
839
|
+
/ws/translation/:sessionId
|
|
840
|
+
```
|
|
1375
841
|
|
|
1376
|
-
|
|
842
|
+
## 16. Error Handling
|
|
1377
843
|
|
|
1378
|
-
|
|
844
|
+
File:
|
|
1379
845
|
|
|
1380
|
-
-
|
|
1381
|
-
- dispatch 必须读取 role command artifact。
|
|
1382
|
-
- GUI 展示 command 并由用户发送。
|
|
1383
|
-
- backend 记录 dispatch event。
|
|
846
|
+
- `src/backend/errors.ts`
|
|
1384
847
|
|
|
1385
|
-
|
|
848
|
+
Backend services throw `VcmError` with:
|
|
1386
849
|
|
|
1387
|
-
|
|
850
|
+
- code
|
|
851
|
+
- message
|
|
852
|
+
- status code
|
|
853
|
+
- optional hint
|
|
1388
854
|
|
|
1389
|
-
|
|
1390
|
-
- backend status 可报告 missing/incomplete/ok。
|
|
1391
|
-
- reviewer 后续检查 handoff compliance。
|
|
855
|
+
Fastify error handler returns:
|
|
1392
856
|
|
|
1393
|
-
|
|
857
|
+
```json
|
|
858
|
+
{
|
|
859
|
+
"error": {
|
|
860
|
+
"code": "CODE",
|
|
861
|
+
"message": "Human-readable message",
|
|
862
|
+
"hint": "Optional hint"
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
```
|
|
1394
866
|
|
|
1395
|
-
|
|
867
|
+
## 17. Packaging Architecture
|
|
1396
868
|
|
|
1397
|
-
|
|
1398
|
-
- 如果当前 branch 是 `main` 或 `master`,显示 warning。
|
|
1399
|
-
- V1 不强制创建 branch,但强烈建议用户切到 task branch。
|
|
869
|
+
`package.json` publishes built artifacts:
|
|
1400
870
|
|
|
1401
|
-
|
|
871
|
+
- `dist`
|
|
872
|
+
- `dist-frontend`
|
|
873
|
+
- `docs`
|
|
874
|
+
- `scripts`
|
|
875
|
+
- `README.md`
|
|
1402
876
|
|
|
1403
|
-
|
|
877
|
+
Bins:
|
|
1404
878
|
|
|
1405
|
-
-
|
|
1406
|
-
-
|
|
1407
|
-
- V1 不做自动 review、validation runner、PR。
|
|
1408
|
-
- 优先完成 SessionConsole、role dispatch 和 session recovery。
|
|
879
|
+
- `vcm` -> `dist/main.js`
|
|
880
|
+
- `vcmctl` -> `dist/cli/vcmctl.js`
|
|
1409
881
|
|
|
1410
|
-
|
|
882
|
+
Important scripts:
|
|
1411
883
|
|
|
1412
|
-
|
|
884
|
+
- `build`: clean, TypeScript build, Vite build
|
|
885
|
+
- `verify:package`: verifies required dist files and frontend assets
|
|
886
|
+
- `prepack`: build and package verification
|
|
887
|
+
- `postinstall`: fixes `node-pty` spawn helper when needed
|
|
1413
888
|
|
|
1414
|
-
|
|
889
|
+
## 18. Security And Safety Boundaries
|
|
1415
890
|
|
|
1416
|
-
|
|
891
|
+
Current boundaries:
|
|
1417
892
|
|
|
1418
|
-
|
|
893
|
+
- VCM runs local processes with the user's permissions.
|
|
894
|
+
- VCM does not auto-confirm Claude Code permission prompts.
|
|
895
|
+
- Relaxed Claude permission modes are user-selected per role launch.
|
|
896
|
+
- Translation API key is local in `~/.vcm/settings.json`.
|
|
897
|
+
- Translation output is UI/runtime state only unless a user or role copies it into a file.
|
|
898
|
+
- `.ai/vcm` is local project control state and must be ignored by Git.
|
|
899
|
+
- Task handoff artifacts live in the task worktree and users should decide whether those artifacts belong in task commits.
|
|
900
|
+
- Task worktrees are created only during task creation; VCM does not expose branch/worktree switching APIs.
|
|
901
|
+
- Sandbox isolation should come from a devContainer, Docker container, VM, or other user-controlled environment.
|
|
1419
902
|
|
|
1420
|
-
|
|
1421
|
-
少做智能判断
|
|
1422
|
-
多做状态可见
|
|
1423
|
-
少自动修改代码
|
|
1424
|
-
多沉淀 artifacts
|
|
1425
|
-
少解析终端语义
|
|
1426
|
-
多保留 raw logs
|
|
1427
|
-
少暴露终端编排细节
|
|
1428
|
-
多提供 GUI 操作入口
|
|
1429
|
-
```
|
|
903
|
+
## 19. Known Implementation Boundaries
|
|
1430
904
|
|
|
1431
|
-
|
|
905
|
+
- No tmux backend.
|
|
906
|
+
- No per-role worktree manager.
|
|
907
|
+
- No branch switching for an existing task.
|
|
908
|
+
- No main-page artifact inspector.
|
|
909
|
+
- No raw PTY output translation.
|
|
910
|
+
- No hard workflow gate enforcement.
|
|
911
|
+
- No durable backend event log for the sidebar Events modal; current events are frontend runtime events for the active task.
|
|
912
|
+
- No hosted multi-user collaboration.
|