vibe-coding-master 0.0.17 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -28
- package/dist/backend/api/artifact-routes.js +5 -5
- package/dist/backend/api/harness-routes.js +8 -0
- package/dist/backend/server.js +8 -2
- package/dist/backend/services/artifact-service.js +12 -12
- package/dist/backend/services/harness-service.js +586 -5
- package/dist/backend/services/project-service.js +4 -1
- package/dist/backend/services/session-service.js +1 -3
- package/dist/backend/services/task-service.js +16 -17
- package/dist/backend/templates/handoff.js +64 -26
- package/dist/backend/templates/harness/architect-agent.js +42 -12
- package/dist/backend/templates/harness/claude-root.js +42 -18
- package/dist/backend/templates/harness/coder-agent.js +15 -11
- package/dist/backend/templates/harness/known-issues-doc.js +22 -0
- package/dist/backend/templates/harness/project-manager-agent.js +66 -16
- package/dist/backend/templates/harness/pull-request-template.js +29 -0
- package/dist/backend/templates/harness/reviewer-agent.js +40 -12
- package/dist/backend/templates/harness/vcm-final-acceptance-skill.js +105 -0
- package/dist/backend/templates/harness/vcm-harness-bootstrap-skill.js +78 -0
- package/dist/backend/templates/harness/vcm-long-running-validation-skill.js +50 -0
- package/dist/backend/templates/harness/vcm-route-message-skill.js +86 -0
- package/dist/backend/templates/message-envelope.js +1 -0
- package/dist/backend/templates/role-command.js +7 -1
- package/dist/shared/validation/artifact-check.js +14 -9
- package/dist-frontend/assets/index-BmpJxnNx.css +32 -0
- package/dist-frontend/assets/index-CGUkhVAP.js +90 -0
- package/dist-frontend/index.html +2 -2
- package/docs/cc-best-practices.md +433 -192
- package/docs/full-harness-baseline.md +258 -0
- package/docs/product-design.md +9 -9
- package/docs/v0.2-implementation-plan.md +379 -0
- package/docs/vcm-cc-best-practices.md +449 -0
- package/package.json +3 -1
- package/scripts/harness-tools/generate-module-index +298 -0
- package/scripts/harness-tools/generate-public-surface +692 -0
- package/scripts/install-vcm-harness.mjs +1690 -0
- package/scripts/uninstall-vcm-harness.mjs +490 -0
- package/scripts/verify-package.mjs +4 -0
- package/dist-frontend/assets/index-D40qaonx.css +0 -32
- package/dist-frontend/assets/index-DK2F4LFT.js +0 -90
- package/docs/v1-architecture-design.md +0 -1014
- package/docs/v1-implementation-plan.md +0 -1379
|
@@ -1,1379 +0,0 @@
|
|
|
1
|
-
# V1 Implementation Plan And File Map
|
|
2
|
-
|
|
3
|
-
Last updated: 2026-05-31
|
|
4
|
-
|
|
5
|
-
This document is the current implementation map for VCM V1.
|
|
6
|
-
|
|
7
|
-
## 1. Current Status
|
|
8
|
-
|
|
9
|
-
V1 is implemented as a local GUI app with:
|
|
10
|
-
|
|
11
|
-
- Fastify backend.
|
|
12
|
-
- React frontend.
|
|
13
|
-
- `node-pty` embedded terminals.
|
|
14
|
-
- `xterm.js` terminal rendering.
|
|
15
|
-
- Four Claude Code role sessions.
|
|
16
|
-
- VCM harness installer.
|
|
17
|
-
- API-driven message bus.
|
|
18
|
-
- Translation panel based on Claude transcript JSONL tailing.
|
|
19
|
-
- npm packaging with built `dist` and `dist-frontend` output.
|
|
20
|
-
- Task creation creates one `feature/<task>` branch and one `.claude/worktrees/<task>` git worktree by default; users may clear `Create worktree and branch` to create an inline task in the connected repository/current branch. Because handoffs are scoped as `.ai/vcm/handoffs/` under the task runtime repo, only one active inline task is allowed per connected repository.
|
|
21
|
-
|
|
22
|
-
## 2. Package And Build
|
|
23
|
-
|
|
24
|
-
File:
|
|
25
|
-
|
|
26
|
-
- `package.json`
|
|
27
|
-
|
|
28
|
-
Current package facts:
|
|
29
|
-
|
|
30
|
-
- package name: `vibe-coding-master`
|
|
31
|
-
- current version: `0.0.14`
|
|
32
|
-
- type: ESM
|
|
33
|
-
- `bin.vcm`: `dist/main.js`
|
|
34
|
-
- published files: `dist`, `dist-frontend`, `docs`, `scripts`, `README.md`
|
|
35
|
-
|
|
36
|
-
Scripts:
|
|
37
|
-
|
|
38
|
-
- `clean`: remove build output.
|
|
39
|
-
- `fix:node-pty`: fix packaged `node-pty` spawn helper.
|
|
40
|
-
- `postinstall`: run `fix:node-pty`.
|
|
41
|
-
- `verify:package`: verify required package files.
|
|
42
|
-
- `prepack`: run build and package verification.
|
|
43
|
-
- `dev`: start backend plus Vite dev server.
|
|
44
|
-
- `build`: clean, compile Node TypeScript, build frontend.
|
|
45
|
-
- `start`: run built backend.
|
|
46
|
-
- `typecheck`: TypeScript no-emit checks for browser and Node configs.
|
|
47
|
-
- `test`: Vitest.
|
|
48
|
-
- `e2e`: Playwright.
|
|
49
|
-
|
|
50
|
-
Packaging guard:
|
|
51
|
-
|
|
52
|
-
- `scripts/verify-package.mjs`
|
|
53
|
-
|
|
54
|
-
It verifies required files, shebangs, packaged static path behavior, and frontend built assets.
|
|
55
|
-
|
|
56
|
-
## 3. Source Tree
|
|
57
|
-
|
|
58
|
-
```text
|
|
59
|
-
src/
|
|
60
|
-
main.ts
|
|
61
|
-
shared/
|
|
62
|
-
constants.ts
|
|
63
|
-
types/
|
|
64
|
-
validation/
|
|
65
|
-
backend/
|
|
66
|
-
server.ts
|
|
67
|
-
adapters/
|
|
68
|
-
api/
|
|
69
|
-
runtime/
|
|
70
|
-
services/
|
|
71
|
-
templates/
|
|
72
|
-
ws/
|
|
73
|
-
frontend/
|
|
74
|
-
app.tsx
|
|
75
|
-
main.tsx
|
|
76
|
-
routes/
|
|
77
|
-
components/
|
|
78
|
-
state/
|
|
79
|
-
terminal/
|
|
80
|
-
styles.css
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Removed/obsolete files that must not be documented as active:
|
|
84
|
-
|
|
85
|
-
- `src/shared/validation/translation-classifier.ts`
|
|
86
|
-
- `src/frontend/state/translation-store.ts`
|
|
87
|
-
- `src/frontend/components/translation-entry-row.tsx`
|
|
88
|
-
- `src/frontend/state/task-store.ts`
|
|
89
|
-
|
|
90
|
-
## 4. Entry Points
|
|
91
|
-
|
|
92
|
-
### `src/main.ts`
|
|
93
|
-
|
|
94
|
-
Exports:
|
|
95
|
-
|
|
96
|
-
- `MainOptions`
|
|
97
|
-
- `parseMainArgs(argv): MainOptions`
|
|
98
|
-
- `main(argv): Promise<void>`
|
|
99
|
-
|
|
100
|
-
Responsibilities:
|
|
101
|
-
|
|
102
|
-
- parse `--dev`, `--open`, `--host=`, `--port=`
|
|
103
|
-
- start backend on port `4173` by default
|
|
104
|
-
- start Vite on port `5173` in dev mode
|
|
105
|
-
- serve `dist-frontend` through backend in production mode
|
|
106
|
-
- close backend/Vite on `SIGINT`
|
|
107
|
-
|
|
108
|
-
### Removed CLI Surface
|
|
109
|
-
|
|
110
|
-
The target design removes `vcmctl` completely. Role sessions must not call a VCM CLI to send messages or hook events.
|
|
111
|
-
|
|
112
|
-
Remove:
|
|
113
|
-
|
|
114
|
-
- `src/cli/vcmctl.ts`
|
|
115
|
-
- `bin.vcmctl` from `package.json`
|
|
116
|
-
- packaged `dist/cli/vcmctl.js`
|
|
117
|
-
- `VCM_CTL_COMMAND` session environment
|
|
118
|
-
- harness rules that mention `vcmctl`
|
|
119
|
-
|
|
120
|
-
Role sessions still receive enough environment for direct hook POSTs and backend-aware terminal delivery:
|
|
121
|
-
|
|
122
|
-
- `VCM_API_URL`
|
|
123
|
-
- `VCM_TASK_SLUG`
|
|
124
|
-
- `VCM_ROLE`
|
|
125
|
-
- `VCM_SESSION_ID`
|
|
126
|
-
|
|
127
|
-
## 5. Shared Layer
|
|
128
|
-
|
|
129
|
-
### `src/shared/constants.ts`
|
|
130
|
-
|
|
131
|
-
Exports:
|
|
132
|
-
|
|
133
|
-
- `DEFAULT_BACKEND_PORT`
|
|
134
|
-
- `DEFAULT_FRONTEND_PORT`
|
|
135
|
-
- `ROLE_DEFINITIONS`
|
|
136
|
-
- `ROLE_NAMES`
|
|
137
|
-
- `DISPATCHABLE_ROLES`
|
|
138
|
-
- `isRoleName(value)`
|
|
139
|
-
- `isDispatchableRole(value)`
|
|
140
|
-
- `getRoleDefinition(role)`
|
|
141
|
-
|
|
142
|
-
Roles:
|
|
143
|
-
|
|
144
|
-
- `project-manager`
|
|
145
|
-
- `architect`
|
|
146
|
-
- `coder`
|
|
147
|
-
- `reviewer`
|
|
148
|
-
|
|
149
|
-
Dispatchable roles:
|
|
150
|
-
|
|
151
|
-
- `architect`
|
|
152
|
-
- `coder`
|
|
153
|
-
- `reviewer`
|
|
154
|
-
|
|
155
|
-
### `src/shared/types/role.ts`
|
|
156
|
-
|
|
157
|
-
Defines:
|
|
158
|
-
|
|
159
|
-
- `RoleName`
|
|
160
|
-
- `DispatchableRole`
|
|
161
|
-
- `RoleStatus`
|
|
162
|
-
- `RoleDefinition`
|
|
163
|
-
|
|
164
|
-
### `src/shared/types/project.ts`
|
|
165
|
-
|
|
166
|
-
Defines:
|
|
167
|
-
|
|
168
|
-
- `ProjectConfig`
|
|
169
|
-
- `ProjectSummary`
|
|
170
|
-
- `ConnectProjectRequest`
|
|
171
|
-
|
|
172
|
-
Important fields:
|
|
173
|
-
|
|
174
|
-
- `handoffRoot`
|
|
175
|
-
- `stateRoot`
|
|
176
|
-
- `terminalBackend`
|
|
177
|
-
- `claudeCommand`
|
|
178
|
-
- `isDirty`
|
|
179
|
-
|
|
180
|
-
### `src/shared/types/app-settings.ts`
|
|
181
|
-
|
|
182
|
-
Defines:
|
|
183
|
-
|
|
184
|
-
- `ThemeMode`
|
|
185
|
-
- `AppPreferences`
|
|
186
|
-
- `UpdateAppPreferencesRequest`
|
|
187
|
-
|
|
188
|
-
Theme modes:
|
|
189
|
-
|
|
190
|
-
- `system`
|
|
191
|
-
- `light`
|
|
192
|
-
- `dark`
|
|
193
|
-
|
|
194
|
-
Preferences:
|
|
195
|
-
|
|
196
|
-
- `themeMode`
|
|
197
|
-
- `roundCompletionAlerts`, default `true`
|
|
198
|
-
|
|
199
|
-
### `src/shared/types/task.ts`
|
|
200
|
-
|
|
201
|
-
Defines:
|
|
202
|
-
|
|
203
|
-
- `TaskStatus`
|
|
204
|
-
- `TaskRecord`
|
|
205
|
-
- `CreateTaskRequest`
|
|
206
|
-
|
|
207
|
-
Current UI sends `taskSlug` and `createWorktree`; the API type still permits optional `title` and `specPath`.
|
|
208
|
-
|
|
209
|
-
Worktree fields:
|
|
210
|
-
|
|
211
|
-
- `worktreePath?: string`
|
|
212
|
-
- `branch: feature/<taskSlug>` when worktree creation is selected, otherwise the connected repo's current branch
|
|
213
|
-
- `cleanupStatus?: "active" | "cleaned"`
|
|
214
|
-
- `cleanedAt?: string`
|
|
215
|
-
|
|
216
|
-
`CreateTaskRequest` supports `createWorktree?: boolean`. It creates a worktree and branch by default, and skips both when `createWorktree === false`. Inline creation rejects a second active inline task in the same connected repository.
|
|
217
|
-
|
|
218
|
-
### `src/shared/types/session.ts`
|
|
219
|
-
|
|
220
|
-
Defines:
|
|
221
|
-
|
|
222
|
-
- `ClaudePermissionMode`
|
|
223
|
-
- `RoleSessionRecord`
|
|
224
|
-
- `TaskSessionRecord`
|
|
225
|
-
- `RoleSessionPointer`
|
|
226
|
-
- `StartRoleSessionRequest`
|
|
227
|
-
|
|
228
|
-
`RoleSessionRecord` includes `claudeSessionId` and `transcriptPath`, which are required for resume and translation transcript lookup.
|
|
229
|
-
|
|
230
|
-
### `src/shared/types/message.ts`
|
|
231
|
-
|
|
232
|
-
Defines:
|
|
233
|
-
|
|
234
|
-
- `VcmMessageActor`
|
|
235
|
-
- `VcmMessageType`
|
|
236
|
-
- `VcmOrchestrationMode`
|
|
237
|
-
- `VcmRoleMessage`
|
|
238
|
-
- `VcmOrchestrationState`
|
|
239
|
-
- `VcmRouteFile`
|
|
240
|
-
- `VcmRouteFileDispatchResult`
|
|
241
|
-
|
|
242
|
-
The state type should only expose the current manual/auto mode. Remove compatibility-only paused state when deleting `vcmctl`.
|
|
243
|
-
|
|
244
|
-
### `src/shared/types/round.ts`
|
|
245
|
-
|
|
246
|
-
Defines:
|
|
247
|
-
|
|
248
|
-
- `VcmRoleTurnStatus`
|
|
249
|
-
- `VcmTaskRoundStatus`
|
|
250
|
-
- `VcmRoleTurnState`
|
|
251
|
-
- `VcmTaskRoundState`
|
|
252
|
-
|
|
253
|
-
Round state is task-level. It reports the latest active/completed role, pending route-file count, and a stable `completionId` for frontend notification dedupe.
|
|
254
|
-
|
|
255
|
-
### `src/shared/types/translation.ts`
|
|
256
|
-
|
|
257
|
-
Defines:
|
|
258
|
-
|
|
259
|
-
- `TranslationProviderType`
|
|
260
|
-
- `TranslationDirection`
|
|
261
|
-
- `TranslationInputMode`
|
|
262
|
-
- `TranslationPromptKey`
|
|
263
|
-
- `TRANSLATION_PROMPT_KEYS`
|
|
264
|
-
- `TranslationSourceKind`
|
|
265
|
-
- `TranslationStatus`
|
|
266
|
-
- `TranslationSettings`
|
|
267
|
-
- `TranslationSecretSettings`
|
|
268
|
-
- `TranslationEntry`
|
|
269
|
-
- `TranslateUserInputRequest`
|
|
270
|
-
- `TranslateUserInputResult`
|
|
271
|
-
- `SendTranslatedInputRequest`
|
|
272
|
-
- `TranslationProviderTestResult`
|
|
273
|
-
- `TranslationPromptPreview`
|
|
274
|
-
- `TranslationSessionStatus`
|
|
275
|
-
- `TranslationSessionEvent`
|
|
276
|
-
- `StartTranslationSessionResult`
|
|
277
|
-
- `PollTranslationSessionResult`
|
|
278
|
-
|
|
279
|
-
Prompt keys:
|
|
280
|
-
|
|
281
|
-
- `zh-to-en`
|
|
282
|
-
- `zh-to-en-with-context`
|
|
283
|
-
- `en-to-zh`
|
|
284
|
-
|
|
285
|
-
Source kinds:
|
|
286
|
-
|
|
287
|
-
- `prose`
|
|
288
|
-
- `tool-output`
|
|
289
|
-
|
|
290
|
-
Statuses:
|
|
291
|
-
|
|
292
|
-
- `queued`
|
|
293
|
-
- `translating`
|
|
294
|
-
- `translated`
|
|
295
|
-
- `failed`
|
|
296
|
-
- `preserved`
|
|
297
|
-
|
|
298
|
-
### `src/shared/types/api.ts`
|
|
299
|
-
|
|
300
|
-
Defines:
|
|
301
|
-
|
|
302
|
-
- `ApiErrorResponse`
|
|
303
|
-
- `TaskStatusReport`
|
|
304
|
-
- `DispatchRoleCommandResult`
|
|
305
|
-
- `BootstrapState`
|
|
306
|
-
|
|
307
|
-
### `src/shared/types/artifact.ts`
|
|
308
|
-
|
|
309
|
-
Defines:
|
|
310
|
-
|
|
311
|
-
- `ArtifactKind`
|
|
312
|
-
- `HandoffPaths`
|
|
313
|
-
- `ArtifactCheckResult`
|
|
314
|
-
- `ArtifactSummary`
|
|
315
|
-
|
|
316
|
-
Artifact kinds:
|
|
317
|
-
|
|
318
|
-
- `architecture-plan`
|
|
319
|
-
- `implementation-log`
|
|
320
|
-
- `validation-log`
|
|
321
|
-
- `review-report`
|
|
322
|
-
- `docs-sync-report`
|
|
323
|
-
|
|
324
|
-
### `src/shared/types/harness.ts`
|
|
325
|
-
|
|
326
|
-
Defines:
|
|
327
|
-
|
|
328
|
-
- `HarnessFileKind`
|
|
329
|
-
- `HarnessFileAction`
|
|
330
|
-
- `HarnessFileStatus`
|
|
331
|
-
- `HarnessPlannedChange`
|
|
332
|
-
- `HarnessStatusReport`
|
|
333
|
-
- `HarnessApplyResult`
|
|
334
|
-
|
|
335
|
-
### `src/shared/types/terminal.ts`
|
|
336
|
-
|
|
337
|
-
Defines:
|
|
338
|
-
|
|
339
|
-
- `ClientTerminalMessage`
|
|
340
|
-
- `ServerTerminalMessage`
|
|
341
|
-
- `TerminalEvent`
|
|
342
|
-
|
|
343
|
-
### `src/shared/validation/slug-check.ts`
|
|
344
|
-
|
|
345
|
-
Exports:
|
|
346
|
-
|
|
347
|
-
- `validateTaskSlug(taskSlug)`
|
|
348
|
-
- `assertValidTaskSlug(taskSlug)`
|
|
349
|
-
|
|
350
|
-
Current rule:
|
|
351
|
-
|
|
352
|
-
- lowercase slug-style task names
|
|
353
|
-
- safe for local paths and URLs
|
|
354
|
-
|
|
355
|
-
### `src/shared/validation/artifact-check.ts`
|
|
356
|
-
|
|
357
|
-
Exports:
|
|
358
|
-
|
|
359
|
-
- `checkMarkdownArtifact(kind, path, content)`
|
|
360
|
-
|
|
361
|
-
Current checks are title/placeholder oriented and do not judge semantic quality.
|
|
362
|
-
|
|
363
|
-
### `src/shared/validation/language-detect.ts`
|
|
364
|
-
|
|
365
|
-
Exports:
|
|
366
|
-
|
|
367
|
-
- `cjkRatio(value)`
|
|
368
|
-
- `isProbablyCjk(value, threshold)`
|
|
369
|
-
- `shouldSkipForTargetLanguage(value, targetLanguage)`
|
|
370
|
-
|
|
371
|
-
These helpers remain available, but current Claude-output translation no longer uses a classifier to skip assistant prose.
|
|
372
|
-
|
|
373
|
-
## 6. Backend Adapters
|
|
374
|
-
|
|
375
|
-
### `src/backend/adapters/filesystem.ts`
|
|
376
|
-
|
|
377
|
-
Exports:
|
|
378
|
-
|
|
379
|
-
- `FileSystemAdapter`
|
|
380
|
-
- `EnsureFileOptions`
|
|
381
|
-
- `createNodeFileSystemAdapter()`
|
|
382
|
-
- `resolveRepoPath(repoRoot, repoRelativePath)`
|
|
383
|
-
- `toRepoRelativePath(repoRoot, absolutePath)`
|
|
384
|
-
|
|
385
|
-
Used by all services that touch repo/app files.
|
|
386
|
-
|
|
387
|
-
### `src/backend/adapters/command-runner.ts`
|
|
388
|
-
|
|
389
|
-
Exports:
|
|
390
|
-
|
|
391
|
-
- `CommandResult`
|
|
392
|
-
- `CommandRunner`
|
|
393
|
-
- `CommandRunnerOptions`
|
|
394
|
-
- `createCommandRunner()`
|
|
395
|
-
|
|
396
|
-
Used by Git and Claude adapters.
|
|
397
|
-
|
|
398
|
-
### `src/backend/adapters/git-adapter.ts`
|
|
399
|
-
|
|
400
|
-
Exports:
|
|
401
|
-
|
|
402
|
-
- `GitRepoCheck`
|
|
403
|
-
- `GitAdapter`
|
|
404
|
-
- `createGitAdapter(runner)`
|
|
405
|
-
|
|
406
|
-
Important behavior:
|
|
407
|
-
|
|
408
|
-
- checks `.git` directly
|
|
409
|
-
- accepts normal `.git` directories
|
|
410
|
-
- accepts `.git` pointer files
|
|
411
|
-
- passes per-command `safe.directory`
|
|
412
|
-
|
|
413
|
-
Worktree methods:
|
|
414
|
-
|
|
415
|
-
- `branchExists(repoRoot, branch): Promise<boolean>`
|
|
416
|
-
- `createWorktree(input): Promise<void>`
|
|
417
|
-
- `removeWorktree(repoRoot, worktreePath, options): Promise<void>`
|
|
418
|
-
- `deleteBranch(repoRoot, branch, options): Promise<void>`
|
|
419
|
-
- `getStatusPorcelain(repoRoot): Promise<string>`
|
|
420
|
-
- `isIgnored(repoRoot, repoRelativePath): Promise<boolean>`
|
|
421
|
-
|
|
422
|
-
Required safety:
|
|
423
|
-
|
|
424
|
-
- all Git commands keep command-scoped `safe.directory`
|
|
425
|
-
- `TaskService` verifies Close Task worktree paths are under `<baseRepoRoot>/.claude/worktrees/`
|
|
426
|
-
- VCM-created task branches are derived from validated task slugs as `feature/<taskSlug>`
|
|
427
|
-
|
|
428
|
-
### `src/backend/adapters/claude-adapter.ts`
|
|
429
|
-
|
|
430
|
-
Exports:
|
|
431
|
-
|
|
432
|
-
- `ClaudeAdapter`
|
|
433
|
-
- `createClaudeAdapter(runner)`
|
|
434
|
-
|
|
435
|
-
Builds role commands:
|
|
436
|
-
|
|
437
|
-
```text
|
|
438
|
-
claude --agent <role> --session-id <uuid>
|
|
439
|
-
claude --agent <role> --resume <uuid>
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
Adds permission flags for `bypassPermissions` and `dangerously-skip-permissions`.
|
|
443
|
-
|
|
444
|
-
### `src/backend/adapters/translation-provider.ts`
|
|
445
|
-
|
|
446
|
-
Exports:
|
|
447
|
-
|
|
448
|
-
- `TranslationProviderRequest`
|
|
449
|
-
- `TranslationProviderResult`
|
|
450
|
-
- `TranslationProvider`
|
|
451
|
-
- `TranslationProviderError`
|
|
452
|
-
- `createOpenAiCompatibleTranslationProvider(fetchImpl)`
|
|
453
|
-
- `buildChatCompletionsUrl(baseUrl)`
|
|
454
|
-
- `parseOpenAiUsage(raw)`
|
|
455
|
-
|
|
456
|
-
Implements OpenAI-compatible chat completions.
|
|
457
|
-
|
|
458
|
-
## 7. Backend Runtime
|
|
459
|
-
|
|
460
|
-
### `src/backend/runtime/terminal-runtime.ts`
|
|
461
|
-
|
|
462
|
-
Defines the runtime interface:
|
|
463
|
-
|
|
464
|
-
- `CreateTerminalSessionInput`
|
|
465
|
-
- `TerminalSession`
|
|
466
|
-
- `TerminalEventListener`
|
|
467
|
-
- `Unsubscribe`
|
|
468
|
-
- `SubscribeTerminalOptions`
|
|
469
|
-
- `TerminalRuntime`
|
|
470
|
-
|
|
471
|
-
### `src/backend/runtime/node-pty-runtime.ts`
|
|
472
|
-
|
|
473
|
-
Exports:
|
|
474
|
-
|
|
475
|
-
- `NodePtyRuntimeDeps`
|
|
476
|
-
- `createNodePtyTerminalRuntime(deps)`
|
|
477
|
-
- `buildPtyEnvironment(baseEnv, inputEnv)`
|
|
478
|
-
|
|
479
|
-
Responsibilities:
|
|
480
|
-
|
|
481
|
-
- spawn Claude Code with `node-pty`
|
|
482
|
-
- append raw output to role log file
|
|
483
|
-
- emit terminal output/input/exit events
|
|
484
|
-
- replay logs on subscribe
|
|
485
|
-
- handle writes, resize, stop
|
|
486
|
-
- set color-friendly terminal env vars
|
|
487
|
-
|
|
488
|
-
### `src/backend/runtime/session-registry.ts`
|
|
489
|
-
|
|
490
|
-
Exports:
|
|
491
|
-
|
|
492
|
-
- `SessionRegistry`
|
|
493
|
-
- `createSessionRegistry()`
|
|
494
|
-
|
|
495
|
-
In-memory index for live/persisted role records by runtime session id and role.
|
|
496
|
-
|
|
497
|
-
## 8. Backend Services
|
|
498
|
-
|
|
499
|
-
### `src/backend/services/project-service.ts`
|
|
500
|
-
|
|
501
|
-
Exports:
|
|
502
|
-
|
|
503
|
-
- `ProjectService`
|
|
504
|
-
- `ProjectServiceDeps`
|
|
505
|
-
- `createProjectService(deps)`
|
|
506
|
-
- `buildDefaultProjectConfig(repoRoot)`
|
|
507
|
-
|
|
508
|
-
Responsibilities:
|
|
509
|
-
|
|
510
|
-
- connect repo
|
|
511
|
-
- store current project in process memory
|
|
512
|
-
- record recent repo paths in app settings
|
|
513
|
-
- create `~/.vcm/projects/<project-id>/config.json`
|
|
514
|
-
- ensure base state directories
|
|
515
|
-
- ensure `.ai/vcm/` and `.claude/worktrees/` are ignored by Git before task-worktree creation
|
|
516
|
-
- expose base repo as the project control root
|
|
517
|
-
|
|
518
|
-
Repository connect should keep connecting to the base repo. Task worktrees are managed under that base repo and should not be treated as separate projects in the normal task list.
|
|
519
|
-
|
|
520
|
-
### `src/backend/services/task-service.ts`
|
|
521
|
-
|
|
522
|
-
Exports:
|
|
523
|
-
|
|
524
|
-
- `TaskService`
|
|
525
|
-
- `TaskServiceDeps`
|
|
526
|
-
- `createTaskService(deps)`
|
|
527
|
-
|
|
528
|
-
Responsibilities:
|
|
529
|
-
|
|
530
|
-
- create task
|
|
531
|
-
- list tasks
|
|
532
|
-
- load task
|
|
533
|
-
- save task
|
|
534
|
-
- update task status
|
|
535
|
-
- create task branch and worktree
|
|
536
|
-
- clean up completed task worktree and task metadata
|
|
537
|
-
|
|
538
|
-
Task files:
|
|
539
|
-
|
|
540
|
-
```text
|
|
541
|
-
<baseRepoRoot>/.ai/vcm/tasks/<task>.json
|
|
542
|
-
```
|
|
543
|
-
|
|
544
|
-
Create flow:
|
|
545
|
-
|
|
546
|
-
```text
|
|
547
|
-
createTask(baseRepoRoot, { taskSlug })
|
|
548
|
-
-> assertValidTaskSlug(taskSlug)
|
|
549
|
-
-> assert .ai/vcm/ is ignored
|
|
550
|
-
-> if createWorktree is not false:
|
|
551
|
-
-> assert .claude/worktrees/ is ignored
|
|
552
|
-
-> branch = feature/<taskSlug>
|
|
553
|
-
-> worktreePath = <baseRepoRoot>/.claude/worktrees/<taskSlug>
|
|
554
|
-
-> assert base repo has no uncommitted changes
|
|
555
|
-
-> assert branch does not exist
|
|
556
|
-
-> assert worktree path does not exist
|
|
557
|
-
-> git.createWorktree({ baseRepoRoot, branch, worktreePath, baseRef: HEAD })
|
|
558
|
-
-> taskRepoRoot = worktreePath
|
|
559
|
-
-> otherwise:
|
|
560
|
-
-> branch = current base repo branch
|
|
561
|
-
-> worktreePath = undefined
|
|
562
|
-
-> taskRepoRoot = baseRepoRoot
|
|
563
|
-
-> reject if another inline task is already active
|
|
564
|
-
-> artifactService.ensureHandoffStructure({ repoRoot: taskRepoRoot, handoffDir })
|
|
565
|
-
-> artifactService.createArtifactTemplates({ repoRoot: taskRepoRoot, handoffDir })
|
|
566
|
-
-> ensure task runtime state dirs under <taskRepoRoot>/.ai/vcm/
|
|
567
|
-
-> write central task record under <baseRepoRoot>/.ai/vcm/tasks/<task>.json
|
|
568
|
-
```
|
|
569
|
-
|
|
570
|
-
Close Task flow:
|
|
571
|
-
|
|
572
|
-
```text
|
|
573
|
-
cleanupTask(baseRepoRoot, taskSlug, options)
|
|
574
|
-
-> load central task record
|
|
575
|
-
-> route layer lists role sessions
|
|
576
|
-
-> route layer stops each VCM-managed role session with status running
|
|
577
|
-
-> route layer stops translation tailers and clears task translation cache
|
|
578
|
-
-> if worktreePath exists, verify it is under <baseRepoRoot>/.claude/worktrees/
|
|
579
|
-
-> if worktreePath exists, git.removeWorktree(baseRepoRoot, worktreePath, force=true)
|
|
580
|
-
-> if worktreePath exists, git.deleteBranch(baseRepoRoot, task.branch, force=true) by default
|
|
581
|
-
-> delete <baseRepoRoot>/.ai/vcm/tasks/<task>.json
|
|
582
|
-
-> delete <taskRepoRoot>/.ai/vcm/handoffs/
|
|
583
|
-
-> delete <taskRepoRoot>/.ai/vcm/sessions/<task>.json
|
|
584
|
-
-> delete <taskRepoRoot>/.ai/vcm/messages/<task>.jsonl
|
|
585
|
-
-> delete <taskRepoRoot>/.ai/vcm/orchestration/<task>.json
|
|
586
|
-
-> delete <taskRepoRoot>/.ai/vcm/translation/<task>/
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
The UI labels this operation `Close Task`, styles it as a red destructive action, and shows a browser confirmation that names running role-session shutdown, the worktree, branch, and metadata that will be deleted. VCM actively stops VCM-managed running role sessions, but it does not preflight running sessions or uncommitted changes before closing. Tasks created without a worktree remove VCM metadata only.
|
|
590
|
-
|
|
591
|
-
### `src/backend/services/artifact-service.ts`
|
|
592
|
-
|
|
593
|
-
Exports:
|
|
594
|
-
|
|
595
|
-
- `ArtifactService`
|
|
596
|
-
- input interfaces for handoff, artifacts, role commands, logs
|
|
597
|
-
- `createArtifactService(fs)`
|
|
598
|
-
|
|
599
|
-
Responsibilities:
|
|
600
|
-
|
|
601
|
-
- compute handoff paths
|
|
602
|
-
- create handoff directory structure
|
|
603
|
-
- create artifact templates
|
|
604
|
-
- list artifact checks
|
|
605
|
-
- read artifacts
|
|
606
|
-
- read/save role commands
|
|
607
|
-
- append role logs
|
|
608
|
-
|
|
609
|
-
In task-worktree mode, artifact paths are still repo-relative, but `repoRoot` must be the task worktree path, not the base repo path.
|
|
610
|
-
|
|
611
|
-
Primary role command path:
|
|
612
|
-
|
|
613
|
-
```text
|
|
614
|
-
.ai/vcm/handoffs/role-commands/<role>.md
|
|
615
|
-
```
|
|
616
|
-
|
|
617
|
-
Legacy fallback:
|
|
618
|
-
|
|
619
|
-
```text
|
|
620
|
-
.ai/vcm/handoffs/role-commands/<role>-command.md
|
|
621
|
-
```
|
|
622
|
-
|
|
623
|
-
### `src/backend/services/status-service.ts`
|
|
624
|
-
|
|
625
|
-
Exports:
|
|
626
|
-
|
|
627
|
-
- `StatusService`
|
|
628
|
-
- `StatusServiceDeps`
|
|
629
|
-
- `createStatusService(deps)`
|
|
630
|
-
|
|
631
|
-
Responsibilities:
|
|
632
|
-
|
|
633
|
-
- assemble `TaskStatusReport`
|
|
634
|
-
- list sessions
|
|
635
|
-
- list artifact checks
|
|
636
|
-
- emit missing/incomplete artifact warnings
|
|
637
|
-
|
|
638
|
-
### `src/backend/services/session-service.ts`
|
|
639
|
-
|
|
640
|
-
Exports:
|
|
641
|
-
|
|
642
|
-
- `SessionService`
|
|
643
|
-
- `SessionServiceDeps`
|
|
644
|
-
- `createSessionService(deps)`
|
|
645
|
-
|
|
646
|
-
Responsibilities:
|
|
647
|
-
|
|
648
|
-
- start role session
|
|
649
|
-
- resume role session
|
|
650
|
-
- restart role session
|
|
651
|
-
- stop role session
|
|
652
|
-
- get role session
|
|
653
|
-
- list role sessions
|
|
654
|
-
|
|
655
|
-
Persistence:
|
|
656
|
-
|
|
657
|
-
```text
|
|
658
|
-
<taskRepoRoot>/.ai/vcm/sessions/<task>.json
|
|
659
|
-
```
|
|
660
|
-
|
|
661
|
-
Environment passed to Claude Code:
|
|
662
|
-
|
|
663
|
-
- `VCM_API_URL`
|
|
664
|
-
- `VCM_CTL_COMMAND`
|
|
665
|
-
- `VCM_TASK_SLUG`
|
|
666
|
-
- `VCM_ROLE`
|
|
667
|
-
|
|
668
|
-
In task-worktree mode:
|
|
669
|
-
|
|
670
|
-
- session cwd is `task.worktreePath`
|
|
671
|
-
- session persistence is written under `task.worktreePath/.ai/vcm/sessions`
|
|
672
|
-
- raw logs and handoff artifacts are written under the task worktree
|
|
673
|
-
|
|
674
|
-
### `src/backend/services/message-service.ts`
|
|
675
|
-
|
|
676
|
-
Exports:
|
|
677
|
-
|
|
678
|
-
- `MessageService`
|
|
679
|
-
- `ScanPendingRouteFilesInput`
|
|
680
|
-
- `DispatchPendingRouteFileInput`
|
|
681
|
-
- `RouteFileRecord`
|
|
682
|
-
- `createMessageService(deps)`
|
|
683
|
-
|
|
684
|
-
Responsibilities:
|
|
685
|
-
|
|
686
|
-
- list messages
|
|
687
|
-
- scan route-file outboxes after Claude Code `Stop`
|
|
688
|
-
- snapshot pending route-file messages
|
|
689
|
-
- mark all open messages done for manual recovery
|
|
690
|
-
- get/update orchestration state
|
|
691
|
-
- enforce message policy
|
|
692
|
-
- enforce per-target-role hook-driven busy/idle delivery
|
|
693
|
-
- leave non-empty route files pending when a target role is busy, unavailable, or terminal submission fails
|
|
694
|
-
- deliver the next pending route file when a target role becomes idle
|
|
695
|
-
- persist message snapshots
|
|
696
|
-
- archive dispatched route-file bodies before clearing source files
|
|
697
|
-
- submit route-file messages to the target terminal
|
|
698
|
-
|
|
699
|
-
In task-worktree mode:
|
|
700
|
-
|
|
701
|
-
- message snapshots live under `task.worktreePath/.ai/vcm/messages`
|
|
702
|
-
- orchestration state lives under `task.worktreePath/.ai/vcm/orchestration`
|
|
703
|
-
- pending route files live under `task.worktreePath/.ai/vcm/handoffs/messages`
|
|
704
|
-
- terminal delivery uses the runtime session for the role, whose cwd is the task worktree
|
|
705
|
-
- message mutations are serialized per task inside the VCM process to avoid concurrent dispatch and confirmation races
|
|
706
|
-
|
|
707
|
-
Route-file protocol:
|
|
708
|
-
|
|
709
|
-
- route file name is `<from-role>-<to-role>.md`
|
|
710
|
-
- the filename is the authoritative route; frontmatter cannot override `from` or `to`
|
|
711
|
-
- blank or whitespace-only files are ignored
|
|
712
|
-
- non-empty files are pending
|
|
713
|
-
- each directed route has exactly one pending file, so repeated sends by the same role to the same target become edits to the same file
|
|
714
|
-
- VCM scans after every `Stop` hook
|
|
715
|
-
- Stop hook handling is the only code path allowed to trigger automatic route-file dispatch; do not expose a frontend or public API scan/dispatch endpoint.
|
|
716
|
-
- VCM scans the stopped role's outgoing files and pending files targeting newly idle roles
|
|
717
|
-
- VCM delivers at most one route file per target role per scan
|
|
718
|
-
- if several files target the same idle role, choose oldest modified time, then route name
|
|
719
|
-
- before terminal write, store a `dispatchingAt` snapshot and wait briefly so the GUI can switch to the target role tab
|
|
720
|
-
- successful terminal write snapshots the delivered body as message history
|
|
721
|
-
- `UserPromptSubmit` confirms Claude Code accepted the prompt, stores `acceptedAt`, then clears the source route file if it still contains that same message
|
|
722
|
-
- failed, blocked, manual, or unavailable delivery leaves the source route file unchanged
|
|
723
|
-
- `markAllDone` may clear pending route files only after user confirmation; it does not mutate message history
|
|
724
|
-
- `deleteMessageHistory` rewrites the latest message snapshot file to remove all message history; it must not clear pending route files
|
|
725
|
-
|
|
726
|
-
Required service functions:
|
|
727
|
-
|
|
728
|
-
- `listMessages(taskSlug): Promise<VcmRoleMessage[]>`
|
|
729
|
-
- `listPendingRouteFiles(repoRoot, taskSlug): Promise<RouteFileRecord[]>`
|
|
730
|
-
- `scanAndDispatchPendingRouteFiles(input: { repoRoot: string; taskSlug: string; stoppedRole: RoleName }): Promise<void>`
|
|
731
|
-
- `readRouteFile(path): Promise<RouteFileRecord | null>`
|
|
732
|
-
- `dispatchPendingRouteFile(record): Promise<VcmRouteFileDispatchResult>`
|
|
733
|
-
- `appendMessageSnapshot(message): Promise<void>`
|
|
734
|
-
- `clearRouteFile(path): Promise<void>`
|
|
735
|
-
- `markAllDone(taskSlug, options): Promise<MarkAllMessagesDoneResult>`
|
|
736
|
-
- `deleteMessageHistory(taskSlug): Promise<DeleteMessageHistoryResult>`
|
|
737
|
-
|
|
738
|
-
`dispatchPendingRouteFile` must snapshot before clearing. Clearing means truncating the route file to an empty string, not deleting it.
|
|
739
|
-
|
|
740
|
-
### `src/backend/services/claude-hook-service.ts`
|
|
741
|
-
|
|
742
|
-
Exports:
|
|
743
|
-
|
|
744
|
-
- `ClaudeHookService`
|
|
745
|
-
- `createClaudeHookService(deps)`
|
|
746
|
-
|
|
747
|
-
Responsibilities:
|
|
748
|
-
|
|
749
|
-
- accept Claude Code `UserPromptSubmit` and `Stop` hook events directly over HTTP
|
|
750
|
-
- map hook events to the current VCM project, task, role, and persisted Claude session id
|
|
751
|
-
- update `RoleSessionRecord.activityStatus`: `UserPromptSubmit -> running`, `Stop -> idle`
|
|
752
|
-
- call `MessageService.confirmPromptSubmitted` when `UserPromptSubmit` includes a VCM message envelope
|
|
753
|
-
- call `MessageService.scanAndDispatchPendingRouteFiles` after recording the stop event
|
|
754
|
-
- never require `vcmctl hook-event`
|
|
755
|
-
|
|
756
|
-
### `src/backend/services/command-dispatcher.ts`
|
|
757
|
-
|
|
758
|
-
Exports:
|
|
759
|
-
|
|
760
|
-
- `CommandDispatcher`
|
|
761
|
-
- `DispatchRoleCommandInput`
|
|
762
|
-
- `CommandDispatcherDeps`
|
|
763
|
-
- `createCommandDispatcher(deps)`
|
|
764
|
-
|
|
765
|
-
Obsolete role-command dispatch path. Remove this as part of the route-file messaging migration; preferred orchestration is `MessageService` scanning `.ai/vcm/handoffs/messages/<from-role>-<to-role>.md` after `Stop`.
|
|
766
|
-
|
|
767
|
-
### `src/backend/services/harness-service.ts`
|
|
768
|
-
|
|
769
|
-
Exports:
|
|
770
|
-
|
|
771
|
-
- `HarnessService`
|
|
772
|
-
- `HarnessServiceDeps`
|
|
773
|
-
- `VCM_HARNESS_VERSION`
|
|
774
|
-
- `createHarnessService(deps)`
|
|
775
|
-
|
|
776
|
-
Responsibilities:
|
|
777
|
-
|
|
778
|
-
- inspect harness files
|
|
779
|
-
- manage `.gitignore` entries for VCM local state
|
|
780
|
-
- plan create/insert/update/ok
|
|
781
|
-
- apply VCM managed blocks
|
|
782
|
-
- preserve user content outside managed blocks
|
|
783
|
-
|
|
784
|
-
### `src/backend/services/app-settings-service.ts`
|
|
785
|
-
|
|
786
|
-
Exports:
|
|
787
|
-
|
|
788
|
-
- `StoredTranslationConfig`
|
|
789
|
-
- `AppSettingsFile`
|
|
790
|
-
- `AppSettingsService`
|
|
791
|
-
- `AppSettingsServiceDeps`
|
|
792
|
-
- `createAppSettingsService(deps)`
|
|
793
|
-
|
|
794
|
-
Settings responsibilities:
|
|
795
|
-
|
|
796
|
-
- persist UI theme mode: `system`, `light`, or `dark`
|
|
797
|
-
- persist translation settings and translation secrets
|
|
798
|
-
- persist up to five recent repository paths
|
|
799
|
-
|
|
800
|
-
Storage:
|
|
801
|
-
|
|
802
|
-
```text
|
|
803
|
-
~/.vcm/settings.json
|
|
804
|
-
```
|
|
805
|
-
|
|
806
|
-
### `src/backend/services/translation-prompts.ts`
|
|
807
|
-
|
|
808
|
-
Exports:
|
|
809
|
-
|
|
810
|
-
- `TranslationPromptInput`
|
|
811
|
-
- `BuiltTranslationPrompt`
|
|
812
|
-
- `buildTranslationPrompt(input)`
|
|
813
|
-
- `getTranslationPromptKey(input)`
|
|
814
|
-
- `getBaseTranslationPrompt(key, settings)`
|
|
815
|
-
- `resolveTranslationSystemPrompt(key, settings)`
|
|
816
|
-
- `getTranslationPromptPreviews(settings)`
|
|
817
|
-
|
|
818
|
-
Owns default prompts and user overrides.
|
|
819
|
-
|
|
820
|
-
### `src/backend/services/translation-queue.ts`
|
|
821
|
-
|
|
822
|
-
Exports:
|
|
823
|
-
|
|
824
|
-
- `SerialTranslationQueue`
|
|
825
|
-
- `TranslationQueueRegistry`
|
|
826
|
-
- `createSerialTranslationQueue()`
|
|
827
|
-
- `createTranslationQueueRegistry()`
|
|
828
|
-
|
|
829
|
-
Ensures translations for one session run serially.
|
|
830
|
-
|
|
831
|
-
### `src/backend/services/claude-transcript-service.ts`
|
|
832
|
-
|
|
833
|
-
Exports:
|
|
834
|
-
|
|
835
|
-
- transcript event types
|
|
836
|
-
- `ClaudeTranscriptService`
|
|
837
|
-
- `TranscriptTail`
|
|
838
|
-
- `createClaudeTranscriptService()`
|
|
839
|
-
- `resolveExistingClaudeTranscriptPath(session)`
|
|
840
|
-
- `findClaudeTranscriptPathBySessionId(claudeSessionId)`
|
|
841
|
-
- `claudeProjectsRoot()`
|
|
842
|
-
- `projectHash(projectDir)`
|
|
843
|
-
- `projectsTranscriptDir(projectDir)`
|
|
844
|
-
- `claudeTranscriptPath(projectDir, claudeSessionId)`
|
|
845
|
-
- `parseAssistantContent(line)`
|
|
846
|
-
|
|
847
|
-
Responsibilities:
|
|
848
|
-
|
|
849
|
-
- tail Claude JSONL transcript files
|
|
850
|
-
- resolve transcript path after start/resume/restart
|
|
851
|
-
- parse assistant messages, tool uses, tool results, questions, todos, and agent calls
|
|
852
|
-
|
|
853
|
-
### `src/backend/services/translation-service.ts`
|
|
854
|
-
|
|
855
|
-
Exports:
|
|
856
|
-
|
|
857
|
-
- `TranslationService`
|
|
858
|
-
- `TranslateUserInputServiceInput`
|
|
859
|
-
- `SendTranslatedInputServiceInput`
|
|
860
|
-
- `TranslationEventListener`
|
|
861
|
-
- `TranslationServiceDeps`
|
|
862
|
-
- `createTranslationService(deps)`
|
|
863
|
-
|
|
864
|
-
Responsibilities:
|
|
865
|
-
|
|
866
|
-
- load/update translation settings
|
|
867
|
-
- expose prompt previews
|
|
868
|
-
- test provider
|
|
869
|
-
- start backend transcript listening for a role session
|
|
870
|
-
- poll cached translation events by cursor
|
|
871
|
-
- translate user input
|
|
872
|
-
- send English text to active terminal
|
|
873
|
-
- clear session entries and cached events
|
|
874
|
-
- stop session/task translation listeners
|
|
875
|
-
- retry failed output translation
|
|
876
|
-
- subscribe to Claude transcript service
|
|
877
|
-
- translate prose output and preserve tool output
|
|
878
|
-
|
|
879
|
-
Terminal submission is delegated to `src/backend/runtime/terminal-submit.ts`, which bracket-pastes text, waits briefly, then sends Enter separately.
|
|
880
|
-
|
|
881
|
-
### `src/backend/services/round-service.ts`
|
|
882
|
-
|
|
883
|
-
Exports:
|
|
884
|
-
|
|
885
|
-
- `RoundService`
|
|
886
|
-
- `TaskRoundInput`
|
|
887
|
-
- `RoundServiceDeps`
|
|
888
|
-
- `createRoundService(deps)`
|
|
889
|
-
- `evaluateTaskRoundState(input)`
|
|
890
|
-
|
|
891
|
-
Responsibilities:
|
|
892
|
-
|
|
893
|
-
- read hook-driven role activity from `RoleSessionRecord`
|
|
894
|
-
- map `activityStatus: "running"` to role state `answering`
|
|
895
|
-
- map `activityStatus: "idle"` plus `lastStopAt` to role state `idle`
|
|
896
|
-
- evaluate task-level round completion from hook-driven role states
|
|
897
|
-
- use pending route-file count to keep the round active while more dispatch work exists
|
|
898
|
-
- complete PM -> role -> PM chains only after the final role's hook `Stop`
|
|
899
|
-
|
|
900
|
-
## 9. Backend API
|
|
901
|
-
|
|
902
|
-
### `src/backend/server.ts`
|
|
903
|
-
|
|
904
|
-
Exports:
|
|
905
|
-
|
|
906
|
-
- `CreateServerOptions`
|
|
907
|
-
- `ServerDeps`
|
|
908
|
-
- `createServer(deps, options)`
|
|
909
|
-
- `startServer(options)`
|
|
910
|
-
- `CreateDefaultServerDepsOptions`
|
|
911
|
-
- `createDefaultServerDeps(options)`
|
|
912
|
-
- `getDefaultStaticDir()`
|
|
913
|
-
|
|
914
|
-
Registers HTTP routes and the terminal WebSocket.
|
|
915
|
-
|
|
916
|
-
### Route files
|
|
917
|
-
|
|
918
|
-
- `src/backend/api/app-settings-routes.ts`: UI preferences
|
|
919
|
-
- `src/backend/api/project-routes.ts`: health, recent paths, connect/current project
|
|
920
|
-
- `src/backend/api/harness-routes.ts`: harness status/apply
|
|
921
|
-
- `src/backend/api/task-routes.ts`: tasks, task status, and Close Task cleanup endpoint; Close Task stops running role sessions before translation/task cleanup
|
|
922
|
-
- `src/backend/api/session-routes.ts`: session lifecycle
|
|
923
|
-
- `src/backend/api/artifact-routes.ts`: artifact and log reads/writes
|
|
924
|
-
- `src/backend/api/message-routes.ts`: message history, pending route files, Mark All Done recovery, and orchestration
|
|
925
|
-
- `src/backend/api/claude-hook-routes.ts`: Claude Code `UserPromptSubmit` and `Stop` hook receiver
|
|
926
|
-
- `src/backend/api/round-routes.ts`: task round completion state
|
|
927
|
-
- `src/backend/api/translation-routes.ts`: settings, prompt previews, provider test, start/poll, input/send, clear/retry
|
|
928
|
-
|
|
929
|
-
Worktree task API:
|
|
930
|
-
|
|
931
|
-
```text
|
|
932
|
-
POST /api/tasks/:taskSlug/cleanup
|
|
933
|
-
```
|
|
934
|
-
|
|
935
|
-
Do not add a "switch task worktree" endpoint. Worktree assignment happens only during task creation.
|
|
936
|
-
|
|
937
|
-
### WebSocket files
|
|
938
|
-
|
|
939
|
-
- `src/backend/ws/terminal-ws.ts`
|
|
940
|
-
|
|
941
|
-
Terminal WebSocket forwards PTY output/input/resize.
|
|
942
|
-
|
|
943
|
-
Translation does not use WebSocket. The backend writes cached translation events under `<taskRepoRoot>/.ai/vcm/translation/<task>/<role>/<session-id>.jsonl`; the frontend polls `GET /api/translation/sessions/:sessionId/events?after=<cursor>`. The cursor is the next expected seq, so `after=18` means seq `1..17` can be removed and seq `18+` should be returned.
|
|
944
|
-
|
|
945
|
-
Round completion is HTTP-polled too. `GET /api/tasks/:taskSlug/round` returns `VcmTaskRoundState` from hook-driven role activity plus pending-message blockers; it is not a WebSocket stream.
|
|
946
|
-
|
|
947
|
-
## 10. Backend Templates
|
|
948
|
-
|
|
949
|
-
### `src/backend/templates/handoff.ts`
|
|
950
|
-
|
|
951
|
-
Exports:
|
|
952
|
-
|
|
953
|
-
- `renderArchitecturePlanTemplate(taskSlug)`
|
|
954
|
-
- `renderImplementationLogTemplate(taskSlug)`
|
|
955
|
-
- `renderValidationLogTemplate(taskSlug)`
|
|
956
|
-
- `renderReviewReportTemplate(taskSlug)`
|
|
957
|
-
- `renderDocsSyncReportTemplate(taskSlug)`
|
|
958
|
-
|
|
959
|
-
### `src/backend/templates/role-command.ts`
|
|
960
|
-
|
|
961
|
-
Exports:
|
|
962
|
-
|
|
963
|
-
- `renderRoleCommandTemplate(taskSlug, role)`
|
|
964
|
-
|
|
965
|
-
### `src/backend/templates/message-envelope.ts`
|
|
966
|
-
|
|
967
|
-
Exports:
|
|
968
|
-
|
|
969
|
-
- `renderMessageEnvelope(message)`
|
|
970
|
-
- `renderManualStagePrompt(message)`
|
|
971
|
-
|
|
972
|
-
Manual stage prompt does not submit Enter.
|
|
973
|
-
|
|
974
|
-
Auto delivery envelope is submitted with Enter.
|
|
975
|
-
|
|
976
|
-
### Harness templates
|
|
977
|
-
|
|
978
|
-
- `src/backend/templates/harness/claude-root.ts`
|
|
979
|
-
- `src/backend/templates/harness/gitignore.ts`
|
|
980
|
-
- `src/backend/templates/harness/project-manager-agent.ts`
|
|
981
|
-
- `src/backend/templates/harness/architect-agent.ts`
|
|
982
|
-
- `src/backend/templates/harness/coder-agent.ts`
|
|
983
|
-
- `src/backend/templates/harness/reviewer-agent.ts`
|
|
984
|
-
|
|
985
|
-
Each exports one render function for VCM managed rules.
|
|
986
|
-
|
|
987
|
-
## 11. Frontend State And API Client
|
|
988
|
-
|
|
989
|
-
### `src/frontend/state/api-client.ts`
|
|
990
|
-
|
|
991
|
-
Central browser API wrapper.
|
|
992
|
-
|
|
993
|
-
It calls:
|
|
994
|
-
|
|
995
|
-
- project endpoints
|
|
996
|
-
- harness endpoints
|
|
997
|
-
- task endpoints
|
|
998
|
-
- session endpoints
|
|
999
|
-
- artifact endpoints
|
|
1000
|
-
- message endpoints
|
|
1001
|
-
- orchestration endpoints
|
|
1002
|
-
- route-file inspection endpoints for the Messages modal
|
|
1003
|
-
- round completion endpoint
|
|
1004
|
-
- translation endpoints
|
|
1005
|
-
|
|
1006
|
-
Implemented task cleanup method:
|
|
1007
|
-
|
|
1008
|
-
- `cleanupTask(taskSlug, options)`
|
|
1009
|
-
|
|
1010
|
-
There are no branch/worktree switching APIs in the current frontend client.
|
|
1011
|
-
|
|
1012
|
-
### `src/frontend/state/app-store.ts`
|
|
1013
|
-
|
|
1014
|
-
Exports:
|
|
1015
|
-
|
|
1016
|
-
- `AppStateSnapshot`
|
|
1017
|
-
- `selectActiveTask(tasks, activeTaskSlug)`
|
|
1018
|
-
|
|
1019
|
-
### `src/frontend/state/session-store.ts`
|
|
1020
|
-
|
|
1021
|
-
Exports:
|
|
1022
|
-
|
|
1023
|
-
- `getSessionForRole(sessions, role)`
|
|
1024
|
-
|
|
1025
|
-
## 12. Frontend Routes
|
|
1026
|
-
|
|
1027
|
-
### `src/frontend/app.tsx`
|
|
1028
|
-
|
|
1029
|
-
Exports:
|
|
1030
|
-
|
|
1031
|
-
- `App()`
|
|
1032
|
-
|
|
1033
|
-
Responsibilities:
|
|
1034
|
-
|
|
1035
|
-
- own top-level app state
|
|
1036
|
-
- load current project and recent paths on startup
|
|
1037
|
-
- load app preferences, including `themeMode` and `roundCompletionAlerts`
|
|
1038
|
-
- load tasks and harness status after connect
|
|
1039
|
-
- pass sidebar props to `ProjectDashboard`
|
|
1040
|
-
- pass task props to `TaskWorkspace`
|
|
1041
|
-
- keep active messages/orchestration/events synchronized by task
|
|
1042
|
-
- dedupe task round `completionId` values and show/play completion alerts when enabled
|
|
1043
|
-
|
|
1044
|
-
### `src/frontend/routes/project-dashboard.tsx`
|
|
1045
|
-
|
|
1046
|
-
Exports:
|
|
1047
|
-
|
|
1048
|
-
- `ProjectDashboardProps`
|
|
1049
|
-
- `ProjectDashboard(props)`
|
|
1050
|
-
|
|
1051
|
-
Responsibilities:
|
|
1052
|
-
|
|
1053
|
-
- collapsible sidebar
|
|
1054
|
-
- repository connect form
|
|
1055
|
-
- repository summary
|
|
1056
|
-
- settings section
|
|
1057
|
-
- round completion alert toggle
|
|
1058
|
-
- try alert test button
|
|
1059
|
-
- messages modal
|
|
1060
|
-
- events modal
|
|
1061
|
-
- harness panel
|
|
1062
|
-
- task creation with one task-name field, `Create worktree and branch` checkbox selected by default, branch preview, and worktree path preview
|
|
1063
|
-
- task navigation
|
|
1064
|
-
|
|
1065
|
-
### `src/frontend/routes/task-workspace.tsx`
|
|
1066
|
-
|
|
1067
|
-
Exports:
|
|
1068
|
-
|
|
1069
|
-
- `TaskWorkspaceProps`
|
|
1070
|
-
- `TaskWorkspace(props)`
|
|
1071
|
-
|
|
1072
|
-
Responsibilities:
|
|
1073
|
-
|
|
1074
|
-
- task header with task title, role tabs, global `Translate`, and `Close Task`
|
|
1075
|
-
- red `Close Task` action with destructive confirmation
|
|
1076
|
-
- status/message/orchestration refresh
|
|
1077
|
-
- round state refresh
|
|
1078
|
-
- periodic polling
|
|
1079
|
-
- session lifecycle actions
|
|
1080
|
-
- per-role permission state
|
|
1081
|
-
- runtime event collection for sidebar Events modal
|
|
1082
|
-
|
|
1083
|
-
## 13. Frontend Components
|
|
1084
|
-
|
|
1085
|
-
### `src/frontend/components/app-shell.tsx`
|
|
1086
|
-
|
|
1087
|
-
Exports:
|
|
1088
|
-
|
|
1089
|
-
- `AppShellProps`
|
|
1090
|
-
- `AppShell({ sidebar, children })`
|
|
1091
|
-
|
|
1092
|
-
Two-column page shell.
|
|
1093
|
-
|
|
1094
|
-
### `src/frontend/components/repo-connect-form.tsx`
|
|
1095
|
-
|
|
1096
|
-
Exports:
|
|
1097
|
-
|
|
1098
|
-
- `RepoConnectFormProps`
|
|
1099
|
-
- `RepoConnectForm(props)`
|
|
1100
|
-
|
|
1101
|
-
Layout:
|
|
1102
|
-
|
|
1103
|
-
- path input row
|
|
1104
|
-
- recent select plus connect button row
|
|
1105
|
-
|
|
1106
|
-
This form connects the base repository. It is not used to switch an existing task to another worktree.
|
|
1107
|
-
|
|
1108
|
-
### `src/frontend/components/harness-panel.tsx`
|
|
1109
|
-
|
|
1110
|
-
Exports:
|
|
1111
|
-
|
|
1112
|
-
- `HarnessPanelProps`
|
|
1113
|
-
- `HarnessPanel(props)`
|
|
1114
|
-
|
|
1115
|
-
Shows harness status and install/update action.
|
|
1116
|
-
|
|
1117
|
-
### `src/frontend/components/message-timeline.tsx`
|
|
1118
|
-
|
|
1119
|
-
Exports:
|
|
1120
|
-
|
|
1121
|
-
- `MessageTimelineProps`
|
|
1122
|
-
- `getMessageCounts(messages)`
|
|
1123
|
-
- `MessageTimeline(props)`
|
|
1124
|
-
|
|
1125
|
-
Used inside the Messages modal. Current UI rows show newest message history first with stable increasing sequence numbers, timestamp, route, type, body preview, source route file path, and a `Copy` button. The modal header includes `Mark All Done` for clearing manually handled pending route files and `Delete All` for removing message history. Stage/approve/reject backend APIs should be removed with the route-file migration.
|
|
1126
|
-
|
|
1127
|
-
### `src/frontend/components/event-log.tsx`
|
|
1128
|
-
|
|
1129
|
-
Exports:
|
|
1130
|
-
|
|
1131
|
-
- `EventLogProps`
|
|
1132
|
-
- `EventLog(props)`
|
|
1133
|
-
|
|
1134
|
-
Used inside the Events modal.
|
|
1135
|
-
|
|
1136
|
-
### `src/frontend/components/task-nav.tsx`
|
|
1137
|
-
|
|
1138
|
-
Exports:
|
|
1139
|
-
|
|
1140
|
-
- `TaskNavProps`
|
|
1141
|
-
- `TaskNav(props)`
|
|
1142
|
-
|
|
1143
|
-
Task list in sidebar.
|
|
1144
|
-
|
|
1145
|
-
### `src/frontend/components/role-session-tabs.tsx`
|
|
1146
|
-
|
|
1147
|
-
Exports:
|
|
1148
|
-
|
|
1149
|
-
- `RoleSessionTabsProps`
|
|
1150
|
-
- `RoleSessionTabs(props)`
|
|
1151
|
-
|
|
1152
|
-
Header role tabs with status badges.
|
|
1153
|
-
|
|
1154
|
-
### `src/frontend/components/session-console.tsx`
|
|
1155
|
-
|
|
1156
|
-
Exports:
|
|
1157
|
-
|
|
1158
|
-
- `SessionConsoleProps`
|
|
1159
|
-
- `SessionConsole(props)`
|
|
1160
|
-
|
|
1161
|
-
Role console, `Auto orchestration` toggle, and translation split.
|
|
1162
|
-
|
|
1163
|
-
### `src/frontend/components/session-toolbar.tsx`
|
|
1164
|
-
|
|
1165
|
-
Exports:
|
|
1166
|
-
|
|
1167
|
-
- `SessionToolbarProps`
|
|
1168
|
-
- `SessionToolbar(props)`
|
|
1169
|
-
|
|
1170
|
-
Renders permission select and session lifecycle buttons.
|
|
1171
|
-
|
|
1172
|
-
There is no visible primary `Send Command` button in the current toolbar. Role-command dispatch should be removed with the route-file migration.
|
|
1173
|
-
|
|
1174
|
-
### `src/frontend/components/translation-panel.tsx`
|
|
1175
|
-
|
|
1176
|
-
Exports:
|
|
1177
|
-
|
|
1178
|
-
- `TranslationPanelProps`
|
|
1179
|
-
- `TranslationPanel(props)`
|
|
1180
|
-
|
|
1181
|
-
Renders output translations, settings actions, auto-send toggle, and composer.
|
|
1182
|
-
|
|
1183
|
-
Important current behavior:
|
|
1184
|
-
|
|
1185
|
-
- panel-level status only
|
|
1186
|
-
- no per-entry status label
|
|
1187
|
-
- no `Original` buttons
|
|
1188
|
-
- tool output is preserved, dim, one-line
|
|
1189
|
-
- prose source is replaced by translated text after completion
|
|
1190
|
-
- prose renders Markdown with GFM support
|
|
1191
|
-
- user-input translation entries add a thick divider and larger top spacing to mark question/answer boundaries
|
|
1192
|
-
- no separate translated-English textarea
|
|
1193
|
-
|
|
1194
|
-
### `src/frontend/components/translation-settings-modal.tsx`
|
|
1195
|
-
|
|
1196
|
-
Exports:
|
|
1197
|
-
|
|
1198
|
-
- `TranslationSettingsModalProps`
|
|
1199
|
-
- `TranslationSettingsModal(props)`
|
|
1200
|
-
|
|
1201
|
-
Settings:
|
|
1202
|
-
|
|
1203
|
-
- base URL
|
|
1204
|
-
- API key as text input
|
|
1205
|
-
- model
|
|
1206
|
-
- target language
|
|
1207
|
-
- context
|
|
1208
|
-
- timeout
|
|
1209
|
-
- temperature
|
|
1210
|
-
- direct editors for `zh-to-en`, `zh-to-en-with-context`, and `en-to-zh`
|
|
1211
|
-
- reset prompts to built-in defaults
|
|
1212
|
-
- provider test
|
|
1213
|
-
|
|
1214
|
-
### `src/frontend/components/status-badge.tsx`
|
|
1215
|
-
|
|
1216
|
-
Exports:
|
|
1217
|
-
|
|
1218
|
-
- `StatusBadgeProps`
|
|
1219
|
-
- `StatusBadge(props)`
|
|
1220
|
-
|
|
1221
|
-
### `src/frontend/terminal/xterm-view.tsx`
|
|
1222
|
-
|
|
1223
|
-
Renders `xterm.js`, connects to terminal WebSocket, sends input and resize, and preserves terminal colors.
|
|
1224
|
-
|
|
1225
|
-
### `src/frontend/terminal/terminal-client.ts`
|
|
1226
|
-
|
|
1227
|
-
Terminal WebSocket client wrapper.
|
|
1228
|
-
|
|
1229
|
-
## 14. UI State Details
|
|
1230
|
-
|
|
1231
|
-
Sidebar:
|
|
1232
|
-
|
|
1233
|
-
- all groups default collapsed
|
|
1234
|
-
- `Repository Path` default open only when no task is selected
|
|
1235
|
-
- `Settings` includes `Theme`, `Round alert`, `Try alert`, `Messages`, and `Events`
|
|
1236
|
-
- `Theme` cycles through `System`, `Light`, and `Dark`; `System` follows the browser/OS color-scheme preference
|
|
1237
|
-
- `Round alert` is on by default and controls the in-app completion prompt plus a soft two-note completion chime
|
|
1238
|
-
- `Try alert` calls the same prompt/sound path without waiting for a real completed round
|
|
1239
|
-
|
|
1240
|
-
Task workspace:
|
|
1241
|
-
|
|
1242
|
-
- role tabs in the first header row
|
|
1243
|
-
- messages/events are not in main workspace
|
|
1244
|
-
- active role console fills available space
|
|
1245
|
-
- `Auto orchestration` is a compact role console toggle
|
|
1246
|
-
|
|
1247
|
-
Round completion:
|
|
1248
|
-
|
|
1249
|
-
- task round completion follows hook-driven role activity, not message history
|
|
1250
|
-
- role activity uses Claude Code `UserPromptSubmit` -> `running` and Claude Code `Stop` -> `idle`; VCM terminal submit also optimistically marks the target role `running`
|
|
1251
|
-
- PM -> role -> PM chains complete after PM's final hook `Stop`, not after the intermediate role's `Stop`
|
|
1252
|
-
- pending route files keep the round active
|
|
1253
|
-
- frontend dedupes `completionId` before showing a prompt or playing sound
|
|
1254
|
-
|
|
1255
|
-
Translation:
|
|
1256
|
-
|
|
1257
|
-
- task header button label is `✅ Translate` when on and `× Translate` when off
|
|
1258
|
-
- the task header `Translate` toggle is global across all four role consoles
|
|
1259
|
-
- translation panel `Auto-send` label is `✅ Auto-send` when on and `× Auto-send` when off
|
|
1260
|
-
- panel uses terminal-like dark styling
|
|
1261
|
-
- composer height is compact
|
|
1262
|
-
- `Enter` translates/sends, `Shift+Enter` inserts newline
|
|
1263
|
-
|
|
1264
|
-
## 15. Data Persistence Summary
|
|
1265
|
-
|
|
1266
|
-
App settings:
|
|
1267
|
-
|
|
1268
|
-
```text
|
|
1269
|
-
~/.vcm/settings.json
|
|
1270
|
-
```
|
|
1271
|
-
|
|
1272
|
-
Contains UI theme preference, round-completion alert preference, translation settings/secrets, and recent repository paths.
|
|
1273
|
-
|
|
1274
|
-
Project config:
|
|
1275
|
-
|
|
1276
|
-
```text
|
|
1277
|
-
~/.vcm/projects/<project-id>/config.json
|
|
1278
|
-
~/.vcm/projects/index.json
|
|
1279
|
-
```
|
|
1280
|
-
|
|
1281
|
-
Task state:
|
|
1282
|
-
|
|
1283
|
-
```text
|
|
1284
|
-
<baseRepoRoot>/.ai/vcm/tasks/<task>.json
|
|
1285
|
-
```
|
|
1286
|
-
|
|
1287
|
-
Session state:
|
|
1288
|
-
|
|
1289
|
-
```text
|
|
1290
|
-
<taskRepoRoot>/.ai/vcm/sessions/<task>.json
|
|
1291
|
-
```
|
|
1292
|
-
|
|
1293
|
-
Messages:
|
|
1294
|
-
|
|
1295
|
-
```text
|
|
1296
|
-
<taskRepoRoot>/.ai/vcm/messages/<task>.jsonl
|
|
1297
|
-
<taskRepoRoot>/.ai/vcm/handoffs/messages/<from-role>-<to-role>.md
|
|
1298
|
-
```
|
|
1299
|
-
|
|
1300
|
-
Orchestration:
|
|
1301
|
-
|
|
1302
|
-
```text
|
|
1303
|
-
<taskRepoRoot>/.ai/vcm/orchestration/<task>.json
|
|
1304
|
-
```
|
|
1305
|
-
|
|
1306
|
-
Translation cache:
|
|
1307
|
-
|
|
1308
|
-
```text
|
|
1309
|
-
<taskRepoRoot>/.ai/vcm/translation/<task>/
|
|
1310
|
-
```
|
|
1311
|
-
|
|
1312
|
-
Task worktrees:
|
|
1313
|
-
|
|
1314
|
-
```text
|
|
1315
|
-
.claude/worktrees/<task>/
|
|
1316
|
-
```
|
|
1317
|
-
|
|
1318
|
-
Handoff artifacts:
|
|
1319
|
-
|
|
1320
|
-
```text
|
|
1321
|
-
.ai/vcm/handoffs/
|
|
1322
|
-
```
|
|
1323
|
-
|
|
1324
|
-
Claude transcripts:
|
|
1325
|
-
|
|
1326
|
-
```text
|
|
1327
|
-
~/.claude/projects/<project-hash>/<claude-session-id>.jsonl
|
|
1328
|
-
```
|
|
1329
|
-
|
|
1330
|
-
## 16. Validation Checklist
|
|
1331
|
-
|
|
1332
|
-
Before release or publish:
|
|
1333
|
-
|
|
1334
|
-
```bash
|
|
1335
|
-
npm run typecheck
|
|
1336
|
-
npm test
|
|
1337
|
-
npm run build
|
|
1338
|
-
npm run verify:package
|
|
1339
|
-
```
|
|
1340
|
-
|
|
1341
|
-
For frontend layout changes, also verify manually:
|
|
1342
|
-
|
|
1343
|
-
- connect repository
|
|
1344
|
-
- confirm `.ai/vcm/` and `.claude/worktrees/` are ignored before creating a task worktree
|
|
1345
|
-
- create task and verify branch `feature/<task>` is created
|
|
1346
|
-
- verify worktree path is `<baseRepoRoot>/.claude/worktrees/<task>`
|
|
1347
|
-
- open task
|
|
1348
|
-
- verify role sessions start with cwd set to the task worktree
|
|
1349
|
-
- role tabs stay in header
|
|
1350
|
-
- sidebar sections collapse/open correctly
|
|
1351
|
-
- embedded terminal remains visible after role switch
|
|
1352
|
-
- translation split is 50/50
|
|
1353
|
-
- Messages modal opens from sidebar Settings
|
|
1354
|
-
- Events modal opens from sidebar Settings
|
|
1355
|
-
- Auto orchestration toggles on/off from the role toolbar
|
|
1356
|
-
- Auto orchestration switches to the target role tab when VCM records `dispatchingAt`, before VCM submits the route-file message
|
|
1357
|
-
- Round alert can be toggled from sidebar Settings and fires once after a chained round truly completes
|
|
1358
|
-
- `Enter` in translation composer translates/sends
|
|
1359
|
-
- `Shift+Enter` inserts newline
|
|
1360
|
-
- close a worktree-backed task and verify it stops running role sessions, removes the worktree, deletes the task branch, and removes central task metadata
|
|
1361
|
-
|
|
1362
|
-
## 17. V1 Boundaries To Preserve
|
|
1363
|
-
|
|
1364
|
-
Do not reintroduce these into V1 docs or UI unless the product direction changes:
|
|
1365
|
-
|
|
1366
|
-
- tmux persistence backend
|
|
1367
|
-
- CLI-first task management as the main product mode
|
|
1368
|
-
- main workspace artifact panel
|
|
1369
|
-
- Pause/Resume orchestration buttons in GUI
|
|
1370
|
-
- raw PTY output translation
|
|
1371
|
-
- translation classifier that drops assistant prose
|
|
1372
|
-
- separate translated-English textarea
|
|
1373
|
-
- optional title input in New Task
|
|
1374
|
-
- `Dirty: yes/no` sidebar label
|
|
1375
|
-
- role command dispatch as the primary orchestration path
|
|
1376
|
-
- `vcmctl` as an active CLI or agent-facing message path
|
|
1377
|
-
- per-role worktrees
|
|
1378
|
-
- switching a task to another branch/worktree after creation
|
|
1379
|
-
- a separate `Create task worktree` button outside task creation
|