vibe-coding-master 0.0.6 → 0.0.7
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 +168 -63
- package/dist/backend/adapters/translation-provider.js +145 -0
- package/dist/backend/api/artifact-routes.js +3 -0
- package/dist/backend/api/harness-routes.js +22 -0
- package/dist/backend/api/project-routes.js +3 -8
- package/dist/backend/api/translation-routes.js +70 -0
- package/dist/backend/runtime/node-pty-runtime.js +20 -18
- package/dist/backend/server.js +31 -1
- 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/harness-service.js +178 -0
- package/dist/backend/services/project-service.js +4 -0
- package/dist/backend/services/session-service.js +7 -5
- package/dist/backend/services/status-service.js +76 -0
- 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/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-BNASqKEK.css +32 -0
- package/dist-frontend/assets/index-Bp49_End.js +58 -0
- package/dist-frontend/index.html +2 -2
- package/docs/cc-best-practices.md +93 -36
- package/docs/product-design.md +313 -1408
- package/docs/v1-architecture-design.md +500 -1153
- package/docs/v1-implementation-plan.md +783 -1604
- 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,778 @@
|
|
|
1
|
-
#
|
|
1
|
+
# V1 Architecture Design
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
日期:2026-05-29
|
|
5
|
-
状态:架构设计草案
|
|
6
|
-
依据:
|
|
3
|
+
Last updated: 2026-05-30
|
|
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。
|
|
59
|
-
|
|
60
|
-
这些能力应在 V1 的 GUI session cockpit 稳定后作为 V2/V3 能力演进。
|
|
61
|
-
|
|
62
|
-
## 3. 关键设计原则
|
|
63
|
-
|
|
64
|
-
### 3.1 GUI First
|
|
65
|
-
|
|
66
|
-
V1 的主入口是本地 GUI。用户应该通过页面完成:
|
|
67
|
-
|
|
68
|
-
- 选择 repo。
|
|
69
|
-
- 创建任务。
|
|
70
|
-
- 启动 role sessions。
|
|
71
|
-
- 切换 `project-manager / architect / coder / reviewer`。
|
|
72
|
-
- 直接在 session 面板中输入和查看输出。
|
|
73
|
-
- 查看 role command、logs、handoff artifacts 和状态。
|
|
74
|
-
|
|
75
|
-
CLI 只用于:
|
|
76
|
-
|
|
77
|
-
- 启动 dev server。
|
|
78
|
-
- 调试 backend。
|
|
79
|
-
- 导出状态。
|
|
80
|
-
- 执行自动化 smoke test。
|
|
81
|
-
|
|
82
|
-
### 3.2 Terminal Runtime Is Internal
|
|
83
|
-
|
|
84
|
-
Claude Code 本质上是交互式终端程序,V1 通过 embedded terminal 承载它。
|
|
85
|
-
|
|
86
|
-
用户不需要理解:
|
|
21
|
+
```text
|
|
22
|
+
browser
|
|
23
|
+
-> React GUI
|
|
24
|
+
-> HTTP API + WebSocket
|
|
25
|
+
-> Fastify backend
|
|
26
|
+
-> services
|
|
27
|
+
-> node-pty
|
|
28
|
+
-> claude --agent <role>
|
|
29
|
+
```
|
|
87
30
|
|
|
88
|
-
-
|
|
89
|
-
- process id。
|
|
90
|
-
- terminal stream。
|
|
91
|
-
- WebSocket message。
|
|
92
|
-
- input/output bridge。
|
|
31
|
+
The app is local-first. It writes repository task state under `.vcm/`, handoff artifacts under `.ai/handoffs/`, app settings under `~/.vcm/settings.json`, and reads Claude transcript files under `~/.claude/projects/`.
|
|
93
32
|
|
|
94
|
-
|
|
33
|
+
## 2. Processes And Ports
|
|
95
34
|
|
|
96
|
-
|
|
35
|
+
Default ports:
|
|
97
36
|
|
|
98
|
-
|
|
37
|
+
- backend / production GUI: `4173`
|
|
38
|
+
- Vite dev GUI: `5173`
|
|
99
39
|
|
|
100
|
-
|
|
40
|
+
Development:
|
|
101
41
|
|
|
102
42
|
```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
|
|
43
|
+
npm run dev
|
|
44
|
+
-> backend at http://127.0.0.1:4173
|
|
45
|
+
-> Vite dev server at http://127.0.0.1:5173
|
|
111
46
|
```
|
|
112
47
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
- PM 决定发什么 role command。
|
|
116
|
-
- GUI 让用户看见、确认和发送。
|
|
117
|
-
- Backend 把短指令写入正确 role session。
|
|
118
|
-
- Role agent 执行命令并产出 artifact。
|
|
119
|
-
- Handoff artifacts 是跨 session 的事实源。
|
|
120
|
-
|
|
121
|
-
### 3.4 File Handoff First
|
|
122
|
-
|
|
123
|
-
角色交接不依赖聊天记忆。所有关键结果必须进入:
|
|
48
|
+
Production / npm package:
|
|
124
49
|
|
|
125
50
|
```text
|
|
126
|
-
|
|
51
|
+
vcm
|
|
52
|
+
-> backend serves dist-frontend at http://127.0.0.1:4173
|
|
127
53
|
```
|
|
128
54
|
|
|
129
|
-
|
|
55
|
+
`src/main.ts` starts the backend and optionally starts Vite when `--dev` is passed.
|
|
130
56
|
|
|
131
|
-
|
|
57
|
+
## 3. Frontend Architecture
|
|
132
58
|
|
|
133
|
-
|
|
59
|
+
Entry:
|
|
134
60
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
-> one GUI task workspace
|
|
138
|
-
-> multiple role sessions
|
|
139
|
-
-> one handoff directory
|
|
140
|
-
-> one repo working directory
|
|
141
|
-
```
|
|
61
|
+
- `src/frontend/main.tsx`
|
|
62
|
+
- `src/frontend/app.tsx`
|
|
142
63
|
|
|
143
|
-
|
|
64
|
+
Main state lives in `App`:
|
|
144
65
|
|
|
145
|
-
|
|
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
|
|
146
76
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
推荐顺序:
|
|
77
|
+
Layout:
|
|
150
78
|
|
|
151
79
|
```text
|
|
152
|
-
|
|
80
|
+
AppShell
|
|
81
|
+
sidebar: ProjectDashboard
|
|
82
|
+
main: TaskWorkspace or EmptyWorkspace
|
|
153
83
|
```
|
|
154
84
|
|
|
155
|
-
|
|
85
|
+
### ProjectDashboard
|
|
156
86
|
|
|
157
|
-
|
|
158
|
-
- log analysis。
|
|
159
|
-
- artifact inspection。
|
|
160
|
-
- 用户查看多个 session。
|
|
87
|
+
File:
|
|
161
88
|
|
|
162
|
-
|
|
89
|
+
- `src/frontend/routes/project-dashboard.tsx`
|
|
163
90
|
|
|
164
|
-
|
|
165
|
-
- PM 直接替代 coder 实现复杂功能。
|
|
166
|
-
- reviewer 接管大范围实现。
|
|
91
|
+
Responsibilities:
|
|
167
92
|
|
|
168
|
-
|
|
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 one-field task creation form.
|
|
100
|
+
- Render task list.
|
|
101
|
+
- Render Messages and Events modals.
|
|
169
102
|
|
|
170
|
-
|
|
103
|
+
All sections default collapsed. `Repository Path` opens when there is no selected task.
|
|
171
104
|
|
|
172
|
-
|
|
173
|
-
backend session registry
|
|
174
|
-
terminal process state
|
|
175
|
-
repo artifacts
|
|
176
|
-
local VCM metadata
|
|
177
|
-
```
|
|
105
|
+
### TaskWorkspace
|
|
178
106
|
|
|
179
|
-
|
|
107
|
+
File:
|
|
180
108
|
|
|
181
|
-
|
|
109
|
+
- `src/frontend/routes/task-workspace.tsx`
|
|
182
110
|
|
|
183
|
-
|
|
111
|
+
Responsibilities:
|
|
184
112
|
|
|
185
|
-
|
|
113
|
+
- Fetch task status, messages, and orchestration state.
|
|
114
|
+
- Poll those every three seconds.
|
|
115
|
+
- Render compact header with task title, branch, 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.
|
|
186
119
|
|
|
187
|
-
|
|
188
|
-
TypeScript + Node.js LTS
|
|
189
|
-
```
|
|
120
|
+
### SessionConsole
|
|
190
121
|
|
|
191
|
-
|
|
122
|
+
File:
|
|
192
123
|
|
|
193
|
-
-
|
|
194
|
-
- 适合本地 GUI、WebSocket 和进程编排。
|
|
195
|
-
- 易于调用 `git`、`claude`、文件系统和终端 runtime。
|
|
196
|
-
- 与后续 Desktop shell、Web UI 和自动化能力兼容。
|
|
124
|
+
- `src/frontend/components/session-console.tsx`
|
|
197
125
|
|
|
198
|
-
|
|
126
|
+
Responsibilities:
|
|
199
127
|
|
|
200
|
-
|
|
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.
|
|
201
133
|
|
|
202
|
-
|
|
203
|
-
React + Vite
|
|
204
|
-
```
|
|
134
|
+
### TranslationPanel
|
|
205
135
|
|
|
206
|
-
|
|
136
|
+
File:
|
|
207
137
|
|
|
208
|
-
-
|
|
209
|
-
- 与 xterm.js 集成成熟。
|
|
210
|
-
- 本地开发体验快。
|
|
211
|
-
- 后续可以被 Electron / Tauri / Desktop shell 包装。
|
|
138
|
+
- `src/frontend/components/translation-panel.tsx`
|
|
212
139
|
|
|
213
|
-
|
|
140
|
+
Responsibilities:
|
|
214
141
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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`.
|
|
220
153
|
|
|
221
|
-
|
|
154
|
+
## 4. Backend Architecture
|
|
222
155
|
|
|
223
|
-
|
|
156
|
+
Entry:
|
|
224
157
|
|
|
225
|
-
|
|
226
|
-
Node.js HTTP server + WebSocket
|
|
227
|
-
```
|
|
158
|
+
- `src/backend/server.ts`
|
|
228
159
|
|
|
229
|
-
|
|
160
|
+
`createDefaultServerDeps()` wires:
|
|
230
161
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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
|
|
235
178
|
|
|
236
|
-
|
|
179
|
+
Fastify registers:
|
|
237
180
|
|
|
238
|
-
-
|
|
239
|
-
-
|
|
240
|
-
-
|
|
241
|
-
-
|
|
242
|
-
-
|
|
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
|
|
243
190
|
|
|
244
|
-
|
|
191
|
+
## 5. Repository Connection
|
|
245
192
|
|
|
246
|
-
|
|
193
|
+
File:
|
|
247
194
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
```
|
|
195
|
+
- `src/backend/services/project-service.ts`
|
|
196
|
+
- `src/backend/adapters/git-adapter.ts`
|
|
251
197
|
|
|
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 固定为:
|
|
198
|
+
Connect flow:
|
|
263
199
|
|
|
264
200
|
```text
|
|
265
|
-
|
|
201
|
+
POST /api/projects/connect
|
|
202
|
+
-> resolve path
|
|
203
|
+
-> check path exists
|
|
204
|
+
-> check .git marker directly
|
|
205
|
+
-> create .vcm/config.json
|
|
206
|
+
-> ensure .ai/handoffs and .vcm state dirs
|
|
207
|
+
-> read branch and dirty state
|
|
208
|
+
-> record recent repo path in ~/.vcm/settings.json
|
|
266
209
|
```
|
|
267
210
|
|
|
268
|
-
|
|
211
|
+
Git repository detection:
|
|
269
212
|
|
|
270
|
-
|
|
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.
|
|
271
216
|
|
|
272
|
-
|
|
217
|
+
Git metadata commands use:
|
|
273
218
|
|
|
274
219
|
```text
|
|
275
|
-
|
|
220
|
+
git -c safe.directory=<repoRoot> -c safe.directory=<realpath(repoRoot)> ...
|
|
276
221
|
```
|
|
277
222
|
|
|
278
|
-
|
|
223
|
+
VCM does not require global `safe.directory` configuration.
|
|
279
224
|
|
|
280
|
-
|
|
281
|
-
- 调用 `claude --version`。
|
|
282
|
-
- 执行 shell-safe command。
|
|
283
|
-
- 不用于承载 Claude Code 交互式 session;交互式 session 由 `node-pty` 负责。
|
|
225
|
+
## 6. Task And Artifact Model
|
|
284
226
|
|
|
285
|
-
|
|
227
|
+
File:
|
|
286
228
|
|
|
287
|
-
|
|
229
|
+
- `src/backend/services/task-service.ts`
|
|
230
|
+
- `src/backend/services/artifact-service.ts`
|
|
231
|
+
- `src/shared/types/task.ts`
|
|
232
|
+
- `src/shared/types/artifact.ts`
|
|
288
233
|
|
|
289
|
-
|
|
234
|
+
Task state:
|
|
290
235
|
|
|
291
236
|
```text
|
|
292
|
-
.vcm/
|
|
293
|
-
config.json
|
|
294
|
-
tasks/
|
|
295
|
-
<task-slug>.json
|
|
296
|
-
sessions/
|
|
297
|
-
<task-slug>.json
|
|
298
|
-
app-state.json
|
|
237
|
+
.vcm/tasks/<task>.json
|
|
299
238
|
```
|
|
300
239
|
|
|
301
|
-
|
|
240
|
+
Each task stores:
|
|
302
241
|
|
|
303
|
-
-
|
|
304
|
-
-
|
|
305
|
-
-
|
|
306
|
-
-
|
|
242
|
+
- `taskSlug`
|
|
243
|
+
- optional `title`
|
|
244
|
+
- timestamps
|
|
245
|
+
- repo root
|
|
246
|
+
- branch at task creation
|
|
247
|
+
- handoff directory
|
|
248
|
+
- status
|
|
249
|
+
- optional spec path
|
|
307
250
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
### 4.7 Markdown 处理
|
|
311
|
-
|
|
312
|
-
V1 不需要复杂 Markdown AST。
|
|
313
|
-
|
|
314
|
-
建议:
|
|
315
|
-
|
|
316
|
-
- 写入模板用字符串模板。
|
|
317
|
-
- artifact completeness 用标题存在性检查。
|
|
318
|
-
- 前端预览用简单 Markdown renderer。
|
|
319
|
-
- 后续再引入 Markdown parser。
|
|
320
|
-
|
|
321
|
-
### 4.8 测试框架
|
|
322
|
-
|
|
323
|
-
推荐:
|
|
251
|
+
Task creation:
|
|
324
252
|
|
|
325
253
|
```text
|
|
326
|
-
|
|
327
|
-
|
|
254
|
+
POST /api/tasks
|
|
255
|
+
-> validate slug
|
|
256
|
+
-> create handoff directories
|
|
257
|
+
-> create artifact templates
|
|
258
|
+
-> write .vcm/tasks/<task>.json
|
|
328
259
|
```
|
|
329
260
|
|
|
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。
|
|
261
|
+
Handoff directory:
|
|
343
262
|
|
|
344
263
|
```text
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
-> claude --agent architect
|
|
362
|
-
-> claude --agent coder
|
|
363
|
-
-> claude --agent reviewer
|
|
264
|
+
.ai/handoffs/<task>/
|
|
265
|
+
role-commands/
|
|
266
|
+
architect.md
|
|
267
|
+
coder.md
|
|
268
|
+
reviewer.md
|
|
269
|
+
logs/
|
|
270
|
+
project-manager.log
|
|
271
|
+
architect.log
|
|
272
|
+
coder.log
|
|
273
|
+
reviewer.log
|
|
274
|
+
architecture-plan.md
|
|
275
|
+
implementation-log.md
|
|
276
|
+
validation-log.md
|
|
277
|
+
review-report.md
|
|
278
|
+
docs-sync-report.md
|
|
279
|
+
messages/
|
|
364
280
|
```
|
|
365
281
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
## 6. GUI 结构
|
|
282
|
+
Artifact checks are simple V1 checks:
|
|
369
283
|
|
|
370
|
-
|
|
284
|
+
- missing
|
|
285
|
+
- placeholder / incomplete
|
|
286
|
+
- ok
|
|
371
287
|
|
|
372
|
-
|
|
288
|
+
They are used for workflow readiness, not content quality judgment.
|
|
373
289
|
|
|
374
|
-
|
|
375
|
-
- 显示 active tasks。
|
|
376
|
-
- 显示每个任务的 severity、required role route、session health。
|
|
377
|
-
- 显示 blocked tasks、recent validation failures、known issues、harness health。
|
|
378
|
-
- 提供进入 Task Workspace 的入口。
|
|
290
|
+
## 7. Workflow Computation
|
|
379
291
|
|
|
380
|
-
|
|
292
|
+
File:
|
|
381
293
|
|
|
382
|
-
|
|
294
|
+
- `src/backend/services/status-service.ts`
|
|
383
295
|
|
|
384
|
-
|
|
296
|
+
Endpoint:
|
|
385
297
|
|
|
386
298
|
```text
|
|
387
|
-
|
|
388
|
-
│ Header: repo / branch / task / severity / route / overall status │
|
|
389
|
-
├───────────────┬──────────────────────────────────────────────────────────────┤
|
|
390
|
-
│ Task Nav │ Role Sessions │
|
|
391
|
-
│ │ tabs: PM | Architect | Coder | Reviewer │
|
|
392
|
-
│ Session State │ embedded terminal │
|
|
393
|
-
│ Known Issues │ session ops │
|
|
394
|
-
│ │ input handled by terminal │
|
|
395
|
-
├───────────────┴──────────────────────────────────────────────────────────────┤
|
|
396
|
-
│ Event Log: PM wrote architect.md | Coder waiting for approval │
|
|
397
|
-
└──────────────────────────────────────────────────────────────────────────────┘
|
|
299
|
+
GET /api/tasks/:taskSlug/status
|
|
398
300
|
```
|
|
399
301
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
每个 role session 对应一个 console。
|
|
403
|
-
|
|
404
|
-
能力:
|
|
405
|
-
|
|
406
|
-
- 展示 role name。
|
|
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。
|
|
413
|
-
|
|
414
|
-
### 6.4 Handoff Files
|
|
415
|
-
|
|
416
|
-
V1 不在主界面展示独立 artifact inspector。handoff artifacts 和 role commands 仍保存在任务目录中,作为 session 之间的文件级事实源;GUI 的主工作区优先展示 embedded terminal。
|
|
417
|
-
|
|
418
|
-
### 6.5 Event Log
|
|
419
|
-
|
|
420
|
-
展示产品级事件,不展示完整 terminal stream。
|
|
421
|
-
|
|
422
|
-
示例:
|
|
302
|
+
The workflow has five steps:
|
|
423
303
|
|
|
424
304
|
```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
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
## 7. Terminal Runtime
|
|
434
|
-
|
|
435
|
-
### 7.1 Role Session 启动命令
|
|
436
|
-
|
|
437
|
-
每个 role session 启动对应 Claude Code:
|
|
438
|
-
|
|
439
|
-
```bash
|
|
440
|
-
claude --agent project-manager
|
|
441
|
-
claude --agent architect
|
|
442
|
-
claude --agent coder
|
|
443
|
-
claude --agent reviewer
|
|
305
|
+
architecture-plan -> implementation -> review -> docs-sync -> final-acceptance
|
|
444
306
|
```
|
|
445
307
|
|
|
446
|
-
|
|
308
|
+
Step readiness:
|
|
447
309
|
|
|
448
|
-
|
|
310
|
+
- Architecture is ready until `architecture-plan.md` is ok.
|
|
311
|
+
- Implementation is blocked until architecture is ok.
|
|
312
|
+
- Review is blocked until `implementation-log.md` and `validation-log.md` are ok.
|
|
313
|
+
- Docs Sync is blocked until `review-report.md` is ok.
|
|
314
|
+
- PM Final is blocked until `docs-sync-report.md` is ok.
|
|
449
315
|
|
|
450
|
-
|
|
451
|
-
interface TerminalRuntime {
|
|
452
|
-
createSession(input: CreateTerminalSessionInput): Promise<TerminalSession>;
|
|
453
|
-
getSession(sessionId: string): TerminalSession | undefined;
|
|
454
|
-
listSessions(taskSlug?: string): TerminalSessionSummary[];
|
|
455
|
-
write(sessionId: string, data: string): void;
|
|
456
|
-
resize(sessionId: string, cols: number, rows: number): void;
|
|
457
|
-
stop(sessionId: string): Promise<void>;
|
|
458
|
-
restart(sessionId: string): Promise<TerminalSession>;
|
|
459
|
-
subscribe(sessionId: string, listener: TerminalEventListener): Unsubscribe;
|
|
460
|
-
}
|
|
461
|
-
```
|
|
316
|
+
The report is displayed in the sidebar `Workflow` section.
|
|
462
317
|
|
|
463
|
-
|
|
318
|
+
## 8. Session Runtime
|
|
464
319
|
|
|
465
|
-
|
|
320
|
+
Files:
|
|
466
321
|
|
|
467
|
-
-
|
|
468
|
-
-
|
|
469
|
-
-
|
|
470
|
-
-
|
|
471
|
-
- 将 stream 推送给 WebSocket subscribers。
|
|
472
|
-
- 将 stream append 到 role log。
|
|
473
|
-
- 监听 exit code。
|
|
474
|
-
- 更新 session status。
|
|
475
|
-
- 支持 resize。
|
|
322
|
+
- `src/backend/services/session-service.ts`
|
|
323
|
+
- `src/backend/adapters/claude-adapter.ts`
|
|
324
|
+
- `src/backend/runtime/node-pty-runtime.ts`
|
|
325
|
+
- `src/backend/runtime/session-registry.ts`
|
|
476
326
|
|
|
477
|
-
|
|
327
|
+
Session service owns role session lifecycle:
|
|
478
328
|
|
|
479
|
-
|
|
329
|
+
- start
|
|
330
|
+
- resume
|
|
331
|
+
- restart
|
|
332
|
+
- stop
|
|
333
|
+
- list
|
|
334
|
+
- get
|
|
480
335
|
|
|
481
|
-
|
|
336
|
+
Runtime session id and Claude session id are different:
|
|
482
337
|
|
|
483
|
-
|
|
484
|
-
|
|
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
|
-
```
|
|
338
|
+
- runtime session id identifies the local `node-pty` process in VCM.
|
|
339
|
+
- Claude session id identifies the Claude Code conversation for resume/transcript lookup.
|
|
490
340
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
长 role command 不直接粘贴进 terminal。V1 应先写入文件,再向目标 session 发送短指令。
|
|
494
|
-
|
|
495
|
-
任务身份以 VCM `taskSlug` 为准。Project Manager 必须只写入当前 task 的 canonical handoff directory:
|
|
341
|
+
Start:
|
|
496
342
|
|
|
497
343
|
```text
|
|
498
|
-
|
|
344
|
+
claude --agent <role> --session-id <uuid>
|
|
499
345
|
```
|
|
500
346
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
示例:
|
|
347
|
+
Resume:
|
|
504
348
|
|
|
505
349
|
```text
|
|
506
|
-
|
|
350
|
+
claude --agent <role> --resume <uuid>
|
|
507
351
|
```
|
|
508
352
|
|
|
509
|
-
|
|
353
|
+
Permission flags:
|
|
510
354
|
|
|
511
355
|
```text
|
|
512
|
-
|
|
513
|
-
|
|
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
|
|
356
|
+
--permission-mode bypassPermissions
|
|
357
|
+
--dangerously-skip-permissions
|
|
517
358
|
```
|
|
518
359
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
通过 `node-pty`,backend 技术上可以对 Claude Code session 做两类程序化操作:
|
|
360
|
+
Session persistence:
|
|
522
361
|
|
|
523
362
|
```text
|
|
524
|
-
|
|
525
|
-
runtime.write(sessionId, "Please read ...\r")
|
|
526
|
-
|
|
527
|
-
read output:
|
|
528
|
-
runtime.subscribe(sessionId, listener)
|
|
363
|
+
.vcm/sessions/<task>.json
|
|
529
364
|
```
|
|
530
365
|
|
|
531
|
-
|
|
366
|
+
The persisted record includes:
|
|
532
367
|
|
|
533
|
-
-
|
|
534
|
-
-
|
|
535
|
-
-
|
|
536
|
-
-
|
|
537
|
-
-
|
|
538
|
-
-
|
|
368
|
+
- runtime session id
|
|
369
|
+
- Claude session id
|
|
370
|
+
- transcript path
|
|
371
|
+
- role
|
|
372
|
+
- status
|
|
373
|
+
- command display
|
|
374
|
+
- permission mode
|
|
375
|
+
- cwd
|
|
376
|
+
- pid
|
|
377
|
+
- raw log path
|
|
378
|
+
- role command path
|
|
379
|
+
- handoff artifact path
|
|
539
380
|
|
|
540
|
-
|
|
381
|
+
If a runtime process is gone but the role has a Claude session id, `getRoleSession` returns a recoverable `resumable` status.
|
|
541
382
|
|
|
542
|
-
|
|
543
|
-
- PM 写完 command 后自动发送给下一个 role。
|
|
544
|
-
- Architect 完成后自动触发 Coder。
|
|
545
|
-
- Coder 完成后自动触发 Reviewer。
|
|
546
|
-
- 根据 terminal output 自动执行高风险下一步。
|
|
383
|
+
## 9. Terminal Runtime
|
|
547
384
|
|
|
548
|
-
|
|
385
|
+
File:
|
|
549
386
|
|
|
550
|
-
|
|
387
|
+
- `src/backend/runtime/node-pty-runtime.ts`
|
|
551
388
|
|
|
552
|
-
|
|
389
|
+
The runtime:
|
|
553
390
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
391
|
+
- spawns `node-pty`
|
|
392
|
+
- sets `TERM=xterm-256color`
|
|
393
|
+
- sets color-friendly env vars
|
|
394
|
+
- appends raw PTY output to `.ai/handoffs/<task>/logs/<role>.log`
|
|
395
|
+
- emits terminal output/input/exit events to WebSocket subscribers
|
|
396
|
+
- replays the log on terminal WebSocket subscribe
|
|
557
397
|
|
|
558
|
-
|
|
559
|
-
-> claude --agent <role> --permission-mode bypassPermissions
|
|
398
|
+
Terminal WebSocket:
|
|
560
399
|
|
|
561
|
-
|
|
562
|
-
|
|
400
|
+
```text
|
|
401
|
+
GET /ws/terminal/:sessionId
|
|
563
402
|
```
|
|
564
403
|
|
|
565
|
-
|
|
404
|
+
Client messages:
|
|
566
405
|
|
|
567
|
-
-
|
|
568
|
-
-
|
|
569
|
-
- `RoleSessionRecord.permissionMode` 必须记录实际启动模式。
|
|
570
|
-
- GUI 显示实际 command,方便用户确认当前 session 的权限状态。
|
|
406
|
+
- input
|
|
407
|
+
- resize
|
|
571
408
|
|
|
572
|
-
|
|
409
|
+
Server messages:
|
|
573
410
|
|
|
574
|
-
|
|
411
|
+
- output
|
|
412
|
+
- exit
|
|
413
|
+
- error
|
|
575
414
|
|
|
576
|
-
|
|
577
|
-
.ai/
|
|
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
|
|
601
|
-
```
|
|
415
|
+
## 10. Message Bus
|
|
602
416
|
|
|
603
|
-
|
|
417
|
+
Files:
|
|
604
418
|
|
|
605
|
-
|
|
419
|
+
- `src/backend/services/message-service.ts`
|
|
420
|
+
- `src/backend/templates/message-envelope.ts`
|
|
421
|
+
- `src/cli/vcmctl.ts`
|
|
606
422
|
|
|
607
|
-
|
|
423
|
+
State:
|
|
608
424
|
|
|
609
425
|
```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/
|
|
426
|
+
.vcm/messages/<task>.jsonl
|
|
427
|
+
.vcm/orchestration/<task>.json
|
|
428
|
+
.ai/handoffs/<task>/messages/<message-id>.md
|
|
678
429
|
```
|
|
679
430
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
职责:
|
|
683
|
-
|
|
684
|
-
- 渲染 GUI。
|
|
685
|
-
- 调用 REST API。
|
|
686
|
-
- 连接 terminal WebSocket。
|
|
687
|
-
- 管理 active task 和 active role tab state。
|
|
688
|
-
|
|
689
|
-
### 9.2 SessionConsole
|
|
690
|
-
|
|
691
|
-
职责:
|
|
692
|
-
|
|
693
|
-
- 渲染 xterm.js。
|
|
694
|
-
- 连接指定 role session 的 WebSocket stream。
|
|
695
|
-
- 将用户输入写回 backend。
|
|
696
|
-
- 处理 resize。
|
|
697
|
-
- 显示 start / stop / restart 操作。
|
|
698
|
-
|
|
699
|
-
### 9.3 EventLog
|
|
700
|
-
|
|
701
|
-
职责:
|
|
702
|
-
|
|
703
|
-
- 展示任务级运行事件。
|
|
704
|
-
- 保持短日志形态,不占用 terminal 主视野。
|
|
705
|
-
|
|
706
|
-
### 9.4 Backend Server
|
|
707
|
-
|
|
708
|
-
职责:
|
|
709
|
-
|
|
710
|
-
- 提供 REST API。
|
|
711
|
-
- 提供 WebSocket endpoint。
|
|
712
|
-
- 管理 backend service lifecycle。
|
|
713
|
-
- Serve frontend static assets。
|
|
714
|
-
|
|
715
|
-
### 9.5 TerminalRuntimeManager
|
|
716
|
-
|
|
717
|
-
职责:
|
|
718
|
-
|
|
719
|
-
- 管理 role session 生命周期。
|
|
720
|
-
- 启动 Claude Code pty。
|
|
721
|
-
- 转发 terminal input/output。
|
|
722
|
-
- 保存 raw logs。
|
|
723
|
-
- 维护 runtime status。
|
|
724
|
-
|
|
725
|
-
### 9.6 SessionRegistry
|
|
726
|
-
|
|
727
|
-
职责:
|
|
728
|
-
|
|
729
|
-
- 保存当前 backend 进程中的 live sessions。
|
|
730
|
-
- 对比 `.vcm/sessions/<task-slug>.json`。
|
|
731
|
-
- 支持页面刷新后的 session 查询。
|
|
732
|
-
- 标记 crashed / exited / missing。
|
|
431
|
+
Policy:
|
|
733
432
|
|
|
734
|
-
|
|
433
|
+
- User can only send `user-request` to `project-manager`.
|
|
434
|
+
- PM can send `task`, `question`, `review-request`, `revise`, `cancel` to non-PM roles.
|
|
435
|
+
- Non-PM roles can send `result`, `question`, `blocked`, `finding` to PM.
|
|
735
436
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
- 创建 handoff directory。
|
|
739
|
-
- 创建 `role-commands/` 和 `logs/`。
|
|
740
|
-
- 创建 artifact 模板。
|
|
741
|
-
- 检查 artifact 是否存在。
|
|
742
|
-
- 检查 artifact 是否包含关键标题。
|
|
743
|
-
- 保存 role command。
|
|
744
|
-
- 追加 raw terminal logs。
|
|
745
|
-
|
|
746
|
-
### 9.8 CommandDispatcher
|
|
747
|
-
|
|
748
|
-
职责:
|
|
749
|
-
|
|
750
|
-
- 读取 `role-commands/<role>.md`。
|
|
751
|
-
- 校验目标 role session 是否 running。
|
|
752
|
-
- 将短指令写入目标 terminal session。
|
|
753
|
-
- 记录 dispatch event。
|
|
754
|
-
|
|
755
|
-
原则:
|
|
756
|
-
|
|
757
|
-
- 不发送未落盘的长 prompt。
|
|
758
|
-
- 每次 dispatch 都必须有 role command artifact。
|
|
759
|
-
- 高风险 command 后续可增加用户确认 gate。
|
|
760
|
-
|
|
761
|
-
## 10. API 设计
|
|
762
|
-
|
|
763
|
-
### 10.1 Project API
|
|
437
|
+
Manual mode:
|
|
764
438
|
|
|
765
439
|
```text
|
|
766
|
-
|
|
767
|
-
POST /api/projects/connect
|
|
768
|
-
GET /api/projects/current
|
|
769
|
-
GET /api/projects/harness
|
|
440
|
+
send -> pending_approval -> Stage -> staged
|
|
770
441
|
```
|
|
771
442
|
|
|
772
|
-
`
|
|
443
|
+
`Stage` writes:
|
|
773
444
|
|
|
774
|
-
```
|
|
775
|
-
|
|
776
|
-
"repoPath": "/path/to/repo"
|
|
777
|
-
}
|
|
445
|
+
```text
|
|
446
|
+
Read and handle VCM message <id> at <bodyPath>
|
|
778
447
|
```
|
|
779
448
|
|
|
780
|
-
|
|
449
|
+
It does not append Enter.
|
|
450
|
+
|
|
451
|
+
Auto mode:
|
|
781
452
|
|
|
782
453
|
```text
|
|
783
|
-
|
|
784
|
-
POST /api/tasks
|
|
785
|
-
GET /api/tasks/:taskSlug
|
|
786
|
-
GET /api/tasks/:taskSlug/status
|
|
454
|
+
send -> delivered
|
|
787
455
|
```
|
|
788
456
|
|
|
789
|
-
`
|
|
790
|
-
|
|
791
|
-
```json
|
|
792
|
-
{
|
|
793
|
-
"taskSlug": "fix-refund-coupon",
|
|
794
|
-
"title": "Fix refund coupon behavior",
|
|
795
|
-
"specPath": ".ai/task-specs/fix-refund-coupon.md"
|
|
796
|
-
}
|
|
797
|
-
```
|
|
457
|
+
The backend writes a `[VCM MESSAGE]` envelope to the target terminal and appends Enter.
|
|
798
458
|
|
|
799
|
-
|
|
459
|
+
The backend still exposes pause/resume orchestration API routes and stores `paused` for compatibility. The current GUI only toggles `mode` between `manual` and `auto`.
|
|
800
460
|
|
|
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
|
-
```
|
|
461
|
+
## 11. Role Command Compatibility
|
|
810
462
|
|
|
811
|
-
|
|
463
|
+
Files:
|
|
812
464
|
|
|
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
|
-
```
|
|
465
|
+
- `src/backend/services/command-dispatcher.ts`
|
|
466
|
+
- `src/backend/api/session-routes.ts`
|
|
467
|
+
- `src/backend/api/artifact-routes.ts`
|
|
820
468
|
|
|
821
|
-
|
|
469
|
+
Compatibility endpoint:
|
|
822
470
|
|
|
823
471
|
```text
|
|
824
|
-
|
|
472
|
+
POST /api/tasks/:taskSlug/sessions/:role/dispatch
|
|
825
473
|
```
|
|
826
474
|
|
|
827
|
-
|
|
475
|
+
Dispatchable roles:
|
|
828
476
|
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
```
|
|
477
|
+
- `architect`
|
|
478
|
+
- `coder`
|
|
479
|
+
- `reviewer`
|
|
833
480
|
|
|
834
|
-
|
|
481
|
+
The dispatcher:
|
|
835
482
|
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
```
|
|
483
|
+
1. Loads the task.
|
|
484
|
+
2. Reads the role command artifact.
|
|
485
|
+
3. Rejects missing, empty, or placeholder role commands.
|
|
486
|
+
4. Resolves primary command path `role-commands/<role>.md`, with legacy fallback `<role>-command.md`.
|
|
487
|
+
5. Writes `Please read and execute the role command at: <path>` to the target terminal and submits Enter.
|
|
842
488
|
|
|
843
|
-
|
|
489
|
+
This is a compatibility path. The preferred V1 coordination path is `vcmctl` message bus.
|
|
844
490
|
|
|
845
|
-
|
|
491
|
+
## 12. Harness Service
|
|
846
492
|
|
|
847
|
-
|
|
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
|
-
```
|
|
858
|
-
|
|
859
|
-
### 11.2 TaskRecord
|
|
493
|
+
File:
|
|
860
494
|
|
|
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
|
-
```
|
|
495
|
+
- `src/backend/services/harness-service.ts`
|
|
875
496
|
|
|
876
|
-
|
|
497
|
+
Harness files:
|
|
877
498
|
|
|
878
|
-
```
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
"status": "running",
|
|
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
|
-
}
|
|
499
|
+
```text
|
|
500
|
+
CLAUDE.md
|
|
501
|
+
.claude/agents/project-manager.md
|
|
502
|
+
.claude/agents/architect.md
|
|
503
|
+
.claude/agents/coder.md
|
|
504
|
+
.claude/agents/reviewer.md
|
|
897
505
|
```
|
|
898
506
|
|
|
899
|
-
|
|
507
|
+
Managed block:
|
|
900
508
|
|
|
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
|
-
}
|
|
509
|
+
```md
|
|
510
|
+
<!-- VCM:BEGIN version=1 -->
|
|
511
|
+
...
|
|
512
|
+
<!-- VCM:END -->
|
|
927
513
|
```
|
|
928
514
|
|
|
929
|
-
|
|
515
|
+
The service:
|
|
930
516
|
|
|
931
|
-
|
|
517
|
+
- checks whether files exist
|
|
518
|
+
- checks whether a managed block exists
|
|
519
|
+
- compares the managed block with the current template
|
|
520
|
+
- plans `create`, `insert`, `update`, or `ok`
|
|
521
|
+
- applies only the planned managed-block change
|
|
932
522
|
|
|
933
|
-
|
|
934
|
-
not_started
|
|
935
|
-
starting
|
|
936
|
-
running
|
|
937
|
-
waiting
|
|
938
|
-
blocked
|
|
939
|
-
done
|
|
940
|
-
resumable
|
|
941
|
-
crashed
|
|
942
|
-
exited
|
|
943
|
-
missing
|
|
944
|
-
unknown
|
|
945
|
-
```
|
|
523
|
+
It must not overwrite user content outside the VCM block.
|
|
946
524
|
|
|
947
|
-
|
|
525
|
+
## 13. Translation Architecture
|
|
948
526
|
|
|
949
|
-
|
|
950
|
-
- `running` 来自 live pty。
|
|
951
|
-
- `exited/crashed` 来自 process exit。
|
|
952
|
-
- `missing` 来自 metadata 存在但 live process 不存在。
|
|
953
|
-
- `resumable` 来自 metadata 中存在 `claudeSessionId`,但当前没有 live pty。
|
|
954
|
-
- `waiting/blocked/done` 可以先由用户或 role output marker 显式标记。
|
|
955
|
-
- 自动推断只能作为 best-effort。
|
|
527
|
+
Files:
|
|
956
528
|
|
|
957
|
-
|
|
529
|
+
- `src/backend/services/translation-service.ts`
|
|
530
|
+
- `src/backend/services/translation-queue.ts`
|
|
531
|
+
- `src/backend/services/translation-prompts.ts`
|
|
532
|
+
- `src/backend/services/claude-transcript-service.ts`
|
|
533
|
+
- `src/backend/adapters/translation-provider.ts`
|
|
534
|
+
- `src/backend/ws/translation-ws.ts`
|
|
535
|
+
- `src/backend/api/translation-routes.ts`
|
|
536
|
+
- `src/frontend/components/translation-panel.tsx`
|
|
537
|
+
- `src/frontend/components/translation-settings-modal.tsx`
|
|
958
538
|
|
|
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
|
-
```
|
|
970
|
-
|
|
971
|
-
## 12. 核心工作流
|
|
539
|
+
### Settings
|
|
972
540
|
|
|
973
|
-
|
|
541
|
+
Settings service:
|
|
974
542
|
|
|
975
|
-
|
|
976
|
-
vcm dev 或桌面入口
|
|
977
|
-
-> start local Node backend
|
|
978
|
-
-> serve React frontend
|
|
979
|
-
-> open browser / desktop shell
|
|
980
|
-
-> show Project Dashboard
|
|
981
|
-
```
|
|
543
|
+
- `src/backend/services/app-settings-service.ts`
|
|
982
544
|
|
|
983
|
-
|
|
545
|
+
Storage:
|
|
984
546
|
|
|
985
547
|
```text
|
|
986
|
-
|
|
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
|
|
548
|
+
~/.vcm/settings.json
|
|
993
549
|
```
|
|
994
550
|
|
|
995
|
-
|
|
551
|
+
Stored data:
|
|
996
552
|
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
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
|
|
1007
|
-
```
|
|
553
|
+
- translation settings
|
|
554
|
+
- translation secrets
|
|
555
|
+
- recent repository paths, max 5
|
|
1008
556
|
|
|
1009
|
-
|
|
557
|
+
Legacy migration:
|
|
1010
558
|
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
-> POST /api/tasks/<task-slug>/sessions/project-manager/start
|
|
1014
|
-
-> NodePtyTerminalRuntime spawns claude --agent project-manager
|
|
1015
|
-
-> backend writes RoleSessionRecord
|
|
1016
|
-
-> frontend opens WebSocket
|
|
1017
|
-
-> xterm.js renders output
|
|
1018
|
-
```
|
|
559
|
+
- `~/.vibe-coding-master/settings.json`
|
|
560
|
+
- `~/.vibe-coding-master/translation.json`
|
|
1019
561
|
|
|
1020
|
-
###
|
|
562
|
+
### Provider
|
|
1021
563
|
|
|
1022
|
-
|
|
1023
|
-
User clicks Architect tab
|
|
1024
|
-
-> frontend switches active role
|
|
1025
|
-
-> if session exists, subscribe to WebSocket
|
|
1026
|
-
-> if session not started, show Start button
|
|
1027
|
-
-> user types directly into terminal
|
|
1028
|
-
```
|
|
1029
|
-
|
|
1030
|
-
### 12.6 下发 role command
|
|
564
|
+
Provider type:
|
|
1031
565
|
|
|
1032
566
|
```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
|
|
567
|
+
openai-compatible
|
|
1039
568
|
```
|
|
1040
569
|
|
|
1041
|
-
|
|
570
|
+
It uses chat completions and builds the URL from `baseUrl`.
|
|
1042
571
|
|
|
1043
|
-
|
|
1044
|
-
V1 main GUI does not render artifact status.
|
|
1045
|
-
Handoff files remain available in the task directory and backend services.
|
|
1046
|
-
```
|
|
572
|
+
Prompt keys:
|
|
1047
573
|
|
|
1048
|
-
|
|
574
|
+
- `zh-to-en`
|
|
575
|
+
- `zh-to-en-with-context`
|
|
576
|
+
- `en-to-zh`
|
|
1049
577
|
|
|
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
|
-
```
|
|
578
|
+
### Claude Output Path
|
|
1058
579
|
|
|
1059
|
-
|
|
580
|
+
Output translation reads Claude transcript JSONL, not terminal raw output.
|
|
1060
581
|
|
|
1061
|
-
|
|
582
|
+
Resolution order:
|
|
1062
583
|
|
|
1063
|
-
|
|
584
|
+
1. persisted `RoleSessionRecord.transcriptPath`
|
|
585
|
+
2. `claudeTranscriptPath(session.cwd, session.claudeSessionId)`
|
|
586
|
+
3. scan `~/.claude/projects/*/<sessionId>.jsonl` and choose newest mtime
|
|
1064
587
|
|
|
1065
|
-
|
|
588
|
+
Tailer:
|
|
1066
589
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
File Responsibilities
|
|
1073
|
-
Public Surface Contract
|
|
1074
|
-
Phases
|
|
1075
|
-
Validation Per Phase
|
|
1076
|
-
Risks
|
|
1077
|
-
Stop Conditions
|
|
1078
|
-
```
|
|
590
|
+
- validates file exists
|
|
591
|
+
- can replay history since session start minus a grace window
|
|
592
|
+
- uses `fs.watch`
|
|
593
|
+
- also polls every 500ms
|
|
594
|
+
- parses only complete newline-delimited JSON records
|
|
1079
595
|
|
|
1080
|
-
|
|
596
|
+
Parsed transcript events:
|
|
1081
597
|
|
|
1082
|
-
|
|
598
|
+
- `text`
|
|
599
|
+
- `thinking`
|
|
600
|
+
- `question`
|
|
601
|
+
- `todo`
|
|
602
|
+
- `agent`
|
|
603
|
+
- `tool_use`
|
|
604
|
+
- `tool_result`
|
|
1083
605
|
|
|
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
|
-
```
|
|
606
|
+
Translation service behavior:
|
|
1093
607
|
|
|
1094
|
-
|
|
608
|
+
- ignores thinking
|
|
609
|
+
- translates text/question/todo/agent as prose
|
|
610
|
+
- preserves tool_use/tool_result as tool-output
|
|
611
|
+
- queues translation per runtime session id
|
|
612
|
+
- emits WebSocket `translation-entry`
|
|
613
|
+
- emits WebSocket `translation-status`
|
|
1095
614
|
|
|
1096
|
-
|
|
615
|
+
### User Input Path
|
|
1097
616
|
|
|
1098
617
|
```text
|
|
1099
|
-
|
|
618
|
+
textarea -> POST translation/input -> provider -> English draft in the same textarea -> optional send
|
|
1100
619
|
```
|
|
1101
620
|
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
最低标题:
|
|
621
|
+
Send path:
|
|
1105
622
|
|
|
1106
623
|
```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
|
|
624
|
+
POST translation/send -> runtime.write(session.id, englishText + "\r")
|
|
1116
625
|
```
|
|
1117
626
|
|
|
1118
|
-
|
|
627
|
+
The backend strips trailing newlines before appending `\r`.
|
|
1119
628
|
|
|
1120
|
-
|
|
629
|
+
## 14. API Surface
|
|
1121
630
|
|
|
1122
|
-
|
|
631
|
+
Project:
|
|
1123
632
|
|
|
1124
633
|
```text
|
|
1125
|
-
|
|
1126
|
-
|
|
634
|
+
GET /api/health
|
|
635
|
+
GET /api/projects/recent
|
|
636
|
+
GET /api/projects/current
|
|
637
|
+
POST /api/projects/connect
|
|
1127
638
|
```
|
|
1128
639
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
`POST /api/projects/connect` 必须检查 Git repo。
|
|
1132
|
-
|
|
1133
|
-
失败时提示:
|
|
640
|
+
Harness:
|
|
1134
641
|
|
|
1135
642
|
```text
|
|
1136
|
-
|
|
643
|
+
GET /api/projects/harness
|
|
644
|
+
POST /api/projects/harness/apply
|
|
1137
645
|
```
|
|
1138
646
|
|
|
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 必须失败:
|
|
647
|
+
Tasks:
|
|
1152
648
|
|
|
1153
649
|
```text
|
|
1154
|
-
|
|
1155
|
-
|
|
650
|
+
GET /api/tasks
|
|
651
|
+
POST /api/tasks
|
|
652
|
+
GET /api/tasks/:taskSlug
|
|
653
|
+
GET /api/tasks/:taskSlug/status
|
|
1156
654
|
```
|
|
1157
655
|
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
发送 command 必须失败:
|
|
656
|
+
Sessions:
|
|
1161
657
|
|
|
1162
658
|
```text
|
|
1163
|
-
|
|
659
|
+
GET /api/tasks/:taskSlug/sessions
|
|
660
|
+
POST /api/tasks/:taskSlug/sessions/:role/start
|
|
661
|
+
POST /api/tasks/:taskSlug/sessions/:role/resume
|
|
662
|
+
POST /api/tasks/:taskSlug/sessions/:role/restart
|
|
663
|
+
POST /api/tasks/:taskSlug/sessions/:role/stop
|
|
664
|
+
POST /api/tasks/:taskSlug/sessions/:role/dispatch
|
|
1164
665
|
```
|
|
1165
666
|
|
|
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
|
-
后续实现:
|
|
667
|
+
Artifacts:
|
|
1224
668
|
|
|
1225
669
|
```text
|
|
1226
|
-
|
|
670
|
+
GET /api/tasks/:taskSlug/artifacts
|
|
671
|
+
GET /api/tasks/:taskSlug/artifacts/:artifactName
|
|
672
|
+
GET /api/tasks/:taskSlug/role-commands/:role
|
|
673
|
+
PUT /api/tasks/:taskSlug/role-commands/:role
|
|
674
|
+
GET /api/tasks/:taskSlug/logs/:role
|
|
1227
675
|
```
|
|
1228
676
|
|
|
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 中演示:
|
|
677
|
+
Messages:
|
|
1312
678
|
|
|
1313
679
|
```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 状态
|
|
680
|
+
GET /api/tasks/:taskSlug/messages
|
|
681
|
+
POST /api/tasks/:taskSlug/messages
|
|
682
|
+
POST /api/tasks/:taskSlug/messages/:messageId/stage
|
|
683
|
+
POST /api/tasks/:taskSlug/messages/:messageId/approve
|
|
684
|
+
POST /api/tasks/:taskSlug/messages/:messageId/reject
|
|
685
|
+
GET /api/tasks/:taskSlug/orchestration
|
|
686
|
+
PUT /api/tasks/:taskSlug/orchestration
|
|
687
|
+
POST /api/tasks/:taskSlug/orchestration/pause
|
|
688
|
+
POST /api/tasks/:taskSlug/orchestration/resume
|
|
1330
689
|
```
|
|
1331
690
|
|
|
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 交互终端嵌入复杂
|
|
691
|
+
Translation:
|
|
1346
692
|
|
|
1347
|
-
|
|
1348
|
-
|
|
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 状态不可结构化
|
|
693
|
+
```text
|
|
694
|
+
GET /api/translation/settings
|
|
695
|
+
PUT /api/translation/settings
|
|
696
|
+
GET /api/translation/prompts
|
|
697
|
+
POST /api/translation/test
|
|
698
|
+
POST /api/tasks/:taskSlug/sessions/:role/translation/input
|
|
699
|
+
POST /api/tasks/:taskSlug/sessions/:role/translation/send
|
|
700
|
+
POST /api/translation/sessions/:sessionId/clear
|
|
701
|
+
POST /api/translation/sessions/:sessionId/retry/:translationId
|
|
702
|
+
```
|
|
1369
703
|
|
|
1370
|
-
|
|
704
|
+
WebSockets:
|
|
1371
705
|
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
706
|
+
```text
|
|
707
|
+
/ws/terminal/:sessionId
|
|
708
|
+
/ws/translation/:sessionId
|
|
709
|
+
```
|
|
1375
710
|
|
|
1376
|
-
|
|
711
|
+
## 15. Error Handling
|
|
1377
712
|
|
|
1378
|
-
|
|
713
|
+
File:
|
|
1379
714
|
|
|
1380
|
-
-
|
|
1381
|
-
- dispatch 必须读取 role command artifact。
|
|
1382
|
-
- GUI 展示 command 并由用户发送。
|
|
1383
|
-
- backend 记录 dispatch event。
|
|
715
|
+
- `src/backend/errors.ts`
|
|
1384
716
|
|
|
1385
|
-
|
|
717
|
+
Backend services throw `VcmError` with:
|
|
1386
718
|
|
|
1387
|
-
|
|
719
|
+
- code
|
|
720
|
+
- message
|
|
721
|
+
- status code
|
|
722
|
+
- optional hint
|
|
1388
723
|
|
|
1389
|
-
|
|
1390
|
-
- backend status 可报告 missing/incomplete/ok。
|
|
1391
|
-
- reviewer 后续检查 handoff compliance。
|
|
724
|
+
Fastify error handler returns:
|
|
1392
725
|
|
|
1393
|
-
|
|
726
|
+
```json
|
|
727
|
+
{
|
|
728
|
+
"error": {
|
|
729
|
+
"code": "CODE",
|
|
730
|
+
"message": "Human-readable message",
|
|
731
|
+
"hint": "Optional hint"
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
```
|
|
1394
735
|
|
|
1395
|
-
|
|
736
|
+
## 16. Packaging Architecture
|
|
1396
737
|
|
|
1397
|
-
|
|
1398
|
-
- 如果当前 branch 是 `main` 或 `master`,显示 warning。
|
|
1399
|
-
- V1 不强制创建 branch,但强烈建议用户切到 task branch。
|
|
738
|
+
`package.json` publishes built artifacts:
|
|
1400
739
|
|
|
1401
|
-
|
|
740
|
+
- `dist`
|
|
741
|
+
- `dist-frontend`
|
|
742
|
+
- `docs`
|
|
743
|
+
- `scripts`
|
|
744
|
+
- `README.md`
|
|
1402
745
|
|
|
1403
|
-
|
|
746
|
+
Bins:
|
|
1404
747
|
|
|
1405
|
-
-
|
|
1406
|
-
-
|
|
1407
|
-
- V1 不做自动 review、validation runner、PR。
|
|
1408
|
-
- 优先完成 SessionConsole、role dispatch 和 session recovery。
|
|
748
|
+
- `vcm` -> `dist/main.js`
|
|
749
|
+
- `vcmctl` -> `dist/cli/vcmctl.js`
|
|
1409
750
|
|
|
1410
|
-
|
|
751
|
+
Important scripts:
|
|
1411
752
|
|
|
1412
|
-
|
|
753
|
+
- `build`: clean, TypeScript build, Vite build
|
|
754
|
+
- `verify:package`: verifies required dist files and frontend assets
|
|
755
|
+
- `prepack`: build and package verification
|
|
756
|
+
- `postinstall`: fixes `node-pty` spawn helper when needed
|
|
1413
757
|
|
|
1414
|
-
|
|
758
|
+
## 17. Security And Safety Boundaries
|
|
1415
759
|
|
|
1416
|
-
|
|
760
|
+
Current boundaries:
|
|
1417
761
|
|
|
1418
|
-
|
|
762
|
+
- VCM runs local processes with the user's permissions.
|
|
763
|
+
- VCM does not auto-confirm Claude Code permission prompts.
|
|
764
|
+
- Relaxed Claude permission modes are user-selected per role launch.
|
|
765
|
+
- Translation API key is local in `~/.vcm/settings.json`.
|
|
766
|
+
- Translation output is UI/runtime state only unless a user or role copies it into a file.
|
|
767
|
+
- Handoff artifacts and `.vcm` state live in the connected repository; users should decide what to commit or ignore.
|
|
768
|
+
- Sandbox isolation should come from a devContainer, Docker container, VM, or other user-controlled environment.
|
|
1419
769
|
|
|
1420
|
-
|
|
1421
|
-
少做智能判断
|
|
1422
|
-
多做状态可见
|
|
1423
|
-
少自动修改代码
|
|
1424
|
-
多沉淀 artifacts
|
|
1425
|
-
少解析终端语义
|
|
1426
|
-
多保留 raw logs
|
|
1427
|
-
少暴露终端编排细节
|
|
1428
|
-
多提供 GUI 操作入口
|
|
1429
|
-
```
|
|
770
|
+
## 18. Known Implementation Boundaries
|
|
1430
771
|
|
|
1431
|
-
|
|
772
|
+
- No tmux backend.
|
|
773
|
+
- No per-role worktree manager.
|
|
774
|
+
- No main-page artifact inspector.
|
|
775
|
+
- No raw PTY output translation.
|
|
776
|
+
- No hard workflow gate enforcement.
|
|
777
|
+
- No durable backend event log for the sidebar Events modal; current events are frontend runtime events for the active task.
|
|
778
|
+
- No hosted multi-user collaboration.
|