rivet-design 0.25.0 → 0.26.0
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 +2 -2
- package/README.npm.md +2 -2
- package/dist/agent-variants/PreviewRuntime.d.ts +1 -20
- package/dist/agent-variants/PreviewRuntime.js +1 -102
- package/dist/agent-variants/SessionStore.d.ts +1 -8
- package/dist/agent-variants/SessionStore.js +2 -32
- package/dist/agent-variants/WorkspaceInventory.d.ts +0 -3
- package/dist/agent-variants/WorkspaceInventory.js +5 -28
- package/dist/agent-variants/WorktreeOrchestrator.d.ts +1 -30
- package/dist/agent-variants/WorktreeOrchestrator.js +4 -643
- package/dist/agent-variants/WorktreeOrchestrator.testHelpers.d.ts +0 -7
- package/dist/agent-variants/WorktreeOrchestrator.testHelpers.js +0 -34
- package/dist/agent-variants/contracts.d.ts +0 -60
- package/dist/agent-variants/contracts.js +1 -8
- package/dist/agent-variants/index.d.ts +1 -1
- package/dist/agent-variants/runPlan.d.ts +0 -2
- package/dist/agent-variants/runPlan.js +0 -3
- package/dist/agent-variants/variant-project-runtime.d.ts +0 -2
- package/dist/agent-variants/variantWorkspaceFiles.d.ts +0 -3
- package/dist/agent-variants/variantWorkspaceFiles.js +1 -59
- package/dist/agent-variants/variantsTelemetry.d.ts +0 -8
- package/dist/cli/commands/mcpServe.d.ts +2 -2
- package/dist/cli/commands/mcpServe.js +1 -0
- package/dist/cli/commands/variants.js +2 -43
- package/dist/cli/router.js +3 -2
- package/dist/config/flags.d.ts +0 -3
- package/dist/config/flags.js +0 -1
- package/dist/config/pluginMetrics.js +0 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -8
- package/dist/install/mcpRegistration.js +1 -0
- package/dist/mcp/explorationTools.js +0 -17
- package/dist/routes/account.js +4 -2
- package/dist/routes/agentVariants.js +1 -89
- package/dist/routes/library/browserAccess.d.ts +3 -1
- package/dist/routes/library/browserAccess.js +5 -3
- package/dist/routes/library/index.js +1 -0
- package/dist/services/AuthService.js +2 -2
- package/dist/services/ConfigManager.d.ts +18 -1
- package/dist/services/ConfigManager.js +91 -4
- package/dist/services/SessionBridgeService.d.ts +0 -2
- package/dist/services/SessionBridgeService.js +0 -26
- package/dist/services/TelemetryService.d.ts +4 -15
- package/dist/services/TelemetryService.js +29 -33
- package/dist/services/VariantRunService.d.ts +0 -5
- package/dist/services/VariantRunService.js +0 -3
- package/dist/services/WorktreeManager.d.ts +0 -3
- package/dist/services/WorktreeManager.js +7 -54
- package/dist/services/createAgentVariantsOrchestrator.js +0 -1
- package/dist/services/profiles/DesignProfiles.js +4 -3
- package/dist/utils/skills/claude-skill.d.ts +1 -1
- package/dist/utils/skills/claude-skill.js +1 -1
- package/dist/utils/skills/cli-guidance.d.ts +1 -1
- package/dist/utils/skills/cli-guidance.js +6 -8
- package/dist/utils/skills/cursor-rules.d.ts +1 -1
- package/dist/utils/skills/cursor-rules.js +1 -1
- package/package.json +3 -3
- package/src/ui/dist/assets/{LibraryEntry-BJl_pPMq.js → LibraryEntry-CFkd6v_O.js} +9 -9
- package/src/ui/dist/assets/main-B_jie9r3.js +439 -0
- package/src/ui/dist/index.html +1 -1
- package/dist/agent-variants/createProjectArtifacts.d.ts +0 -61
- package/dist/agent-variants/createProjectArtifacts.js +0 -113
- package/src/ui/dist/assets/main-D1832qVC.js +0 -439
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ rivet status --project /path/to/app
|
|
|
80
80
|
rivet variants start --project /path/to/app --instruction "try three hero layouts" --count 3
|
|
81
81
|
rivet wait <workId> --project /path/to/app --timeout 120
|
|
82
82
|
rivet variants list --project /path/to/app
|
|
83
|
-
rivet variants
|
|
83
|
+
rivet variants get <projectId>/<sessionId>:<variantId> --detail
|
|
84
84
|
rivet changes request --project /path/to/app --instruction "make the header coral" --element "#header"
|
|
85
85
|
rivet changes pull --project /path/to/app
|
|
86
86
|
rivet update
|
|
@@ -105,7 +105,7 @@ rivet open --project /path/to/app --caller-agent cursor --caller-model <model> -
|
|
|
105
105
|
1. `rivet open` starts or attaches to the local Rivet editor server for a project. It can attach to an existing dev server or start the app's standard `dev`, `start`, or `serve` script when possible.
|
|
106
106
|
2. The editor shows your app and variant previews in the browser. Agents use `rivet variants ...` and `rivet changes ...` to enqueue work.
|
|
107
107
|
3. Use `rivet wait`, `rivet status`, or `rivet status --watch` to observe progress.
|
|
108
|
-
4.
|
|
108
|
+
4. Copy the chosen direction’s context and ask your coding agent to implement it in your project. Rivet preserves the prototype; your agent owns integration and verification.
|
|
109
109
|
|
|
110
110
|
If Rivet reports pull mode, staged work can be drained with `rivet changes pull --project <path>`, applied by the agent, then acknowledged with `rivet changes pull --project <path> --ack <leaseId>`.
|
|
111
111
|
|
package/README.npm.md
CHANGED
|
@@ -80,7 +80,7 @@ rivet status --project /path/to/app
|
|
|
80
80
|
rivet variants start --project /path/to/app --instruction "try three hero layouts" --count 3
|
|
81
81
|
rivet wait <workId> --project /path/to/app --timeout 120
|
|
82
82
|
rivet variants list --project /path/to/app
|
|
83
|
-
rivet variants
|
|
83
|
+
rivet variants get <projectId>/<sessionId>:<variantId> --detail
|
|
84
84
|
rivet changes request --project /path/to/app --instruction "make the header coral" --element "#header"
|
|
85
85
|
rivet changes pull --project /path/to/app
|
|
86
86
|
rivet update
|
|
@@ -105,7 +105,7 @@ rivet open --project /path/to/app --caller-agent cursor --caller-model <model> -
|
|
|
105
105
|
1. `rivet open` starts or attaches to the local Rivet editor server for a project. It can attach to an existing dev server or start the app's standard `dev`, `start`, or `serve` script when possible.
|
|
106
106
|
2. The editor shows your app and variant previews in the browser. Agents use `rivet variants ...` and `rivet changes ...` to enqueue work.
|
|
107
107
|
3. Use `rivet wait`, `rivet status`, or `rivet status --watch` to observe progress.
|
|
108
|
-
4.
|
|
108
|
+
4. Copy the chosen direction’s context and ask your coding agent to implement it in your project. Rivet preserves the prototype; your agent owns integration and verification.
|
|
109
109
|
|
|
110
110
|
If Rivet reports pull mode, staged work can be drained with `rivet changes pull --project <path>`, applied by the agent, then acknowledged with `rivet changes pull --project <path> --ack <leaseId>`.
|
|
111
111
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ChildProcess } from 'child_process';
|
|
2
1
|
import { type PreviewPackageManager } from '../services/ProjectPackageManager';
|
|
3
2
|
import { type DevServerFailureReason } from '../utils/devServerError';
|
|
4
3
|
import type { ProjectContext } from './contracts';
|
|
@@ -32,12 +31,6 @@ type PreviewRuntimeDeps = {
|
|
|
32
31
|
hasUiClients: () => boolean;
|
|
33
32
|
changed: () => void;
|
|
34
33
|
switchPreviewPort?: (port: number | null) => void;
|
|
35
|
-
setCommittedDevServerHealth?: (port: number | null) => void;
|
|
36
|
-
startStaticPreviewServer?: (args: {
|
|
37
|
-
rootPath: string;
|
|
38
|
-
port: number;
|
|
39
|
-
host?: string;
|
|
40
|
-
}) => Promise<ChildProcess>;
|
|
41
34
|
activeVariantServerIdleTtlMs: number;
|
|
42
35
|
devServerRestartDelayMs: number;
|
|
43
36
|
};
|
|
@@ -45,9 +38,6 @@ export declare class PreviewRuntime {
|
|
|
45
38
|
private readonly deps;
|
|
46
39
|
private readonly sessions;
|
|
47
40
|
private readonly environment;
|
|
48
|
-
private readonly lingeringCommitted;
|
|
49
|
-
private readonly committedGenerations;
|
|
50
|
-
private generation;
|
|
51
41
|
constructor(deps: PreviewRuntimeDeps);
|
|
52
42
|
openSession(sessionId: string): void;
|
|
53
43
|
registerVariant(sessionId: string, workItemId: string, worktreePath: string): void;
|
|
@@ -75,14 +65,7 @@ export declare class PreviewRuntime {
|
|
|
75
65
|
retryFailed?: boolean;
|
|
76
66
|
}): Promise<number | undefined>;
|
|
77
67
|
stopVariantServers(sessionId: string): Promise<number>;
|
|
78
|
-
|
|
79
|
-
sessionId: string;
|
|
80
|
-
destinationPath: string;
|
|
81
|
-
mode?: 'vite_app' | 'static_preview';
|
|
82
|
-
}): Promise<number | undefined>;
|
|
83
|
-
getCommittedPort(sessionId: string): number | undefined;
|
|
84
|
-
stopLingeringCommitted(): Promise<void>;
|
|
85
|
-
closeSession(sessionId: string, reason: 'committed' | 'cancel' | 'shutdown'): Promise<void>;
|
|
68
|
+
closeSession(sessionId: string): Promise<void>;
|
|
86
69
|
resolveCommand(sessionId: string, worktreePath: string, port: number, isFresh: boolean): Promise<ResolvedDevServer>;
|
|
87
70
|
private startVariantProcess;
|
|
88
71
|
private watchVariantProcess;
|
|
@@ -91,8 +74,6 @@ export declare class PreviewRuntime {
|
|
|
91
74
|
private resolveRunnableCommand;
|
|
92
75
|
private resolveStartPort;
|
|
93
76
|
private resolveExistingProjectCwd;
|
|
94
|
-
private notifyCommittedPort;
|
|
95
|
-
private notifyCommittedHealth;
|
|
96
77
|
private notifyPreviewPort;
|
|
97
78
|
private clearIdleTimer;
|
|
98
79
|
private requireSession;
|
|
@@ -8,7 +8,6 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const PreviewEnvironment_1 = require("../services/PreviewEnvironment");
|
|
10
10
|
const ProjectPackageManager_1 = require("../services/ProjectPackageManager");
|
|
11
|
-
const StaticPreviewServer_1 = require("../services/StaticPreviewServer");
|
|
12
11
|
const devServerCommand_1 = require("../utils/devServerCommand");
|
|
13
12
|
const devServerError_1 = require("../utils/devServerError");
|
|
14
13
|
const logger_1 = require("../utils/logger");
|
|
@@ -25,18 +24,13 @@ class PreviewRuntime {
|
|
|
25
24
|
deps;
|
|
26
25
|
sessions = new Map();
|
|
27
26
|
environment = new PreviewEnvironment_1.PreviewEnvironment();
|
|
28
|
-
lingeringCommitted = new Map();
|
|
29
|
-
committedGenerations = new Map();
|
|
30
|
-
generation = 0;
|
|
31
27
|
constructor(deps) {
|
|
32
28
|
this.deps = deps;
|
|
33
29
|
}
|
|
34
30
|
openSession(sessionId) {
|
|
35
31
|
if (this.sessions.has(sessionId))
|
|
36
32
|
return;
|
|
37
|
-
this.committedGenerations.delete(sessionId);
|
|
38
33
|
this.sessions.set(sessionId, {
|
|
39
|
-
generation: this.generation,
|
|
40
34
|
variants: new Map(),
|
|
41
35
|
failures: new Map(),
|
|
42
36
|
});
|
|
@@ -143,94 +137,11 @@ class PreviewRuntime {
|
|
|
143
137
|
await Promise.all(stops);
|
|
144
138
|
return stops.length;
|
|
145
139
|
}
|
|
146
|
-
async
|
|
147
|
-
const state = this.sessions.get(args.sessionId);
|
|
148
|
-
const committedGeneration = this.committedGenerations.get(args.sessionId);
|
|
149
|
-
if (state?.generation !== this.generation &&
|
|
150
|
-
committedGeneration !== this.generation) {
|
|
151
|
-
return undefined;
|
|
152
|
-
}
|
|
153
|
-
const mode = args.mode ?? 'vite_app';
|
|
154
|
-
try {
|
|
155
|
-
const port = await this.deps.worktreeManager.getFreePort();
|
|
156
|
-
const process = mode === 'static_preview'
|
|
157
|
-
? await (this.deps.startStaticPreviewServer ?? StaticPreviewServer_1.startStaticPreviewServer)({
|
|
158
|
-
rootPath: args.destinationPath,
|
|
159
|
-
port,
|
|
160
|
-
host: FRESH_DEV_SERVER_HOST,
|
|
161
|
-
})
|
|
162
|
-
: await this.deps.worktreeManager.startDevServer(args.destinationPath, port, 'npm', [
|
|
163
|
-
'run',
|
|
164
|
-
'dev',
|
|
165
|
-
'--',
|
|
166
|
-
'--port',
|
|
167
|
-
String(port),
|
|
168
|
-
'--host',
|
|
169
|
-
FRESH_DEV_SERVER_HOST,
|
|
170
|
-
], { PORT: String(port) });
|
|
171
|
-
const committed = { process, port, path: args.destinationPath };
|
|
172
|
-
if (this.sessions.get(args.sessionId) === state &&
|
|
173
|
-
state?.generation === this.generation) {
|
|
174
|
-
state.committed = committed;
|
|
175
|
-
}
|
|
176
|
-
else if (this.committedGenerations.get(args.sessionId) === this.generation) {
|
|
177
|
-
this.lingeringCommitted.set(args.sessionId, committed);
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
await this.deps.worktreeManager.stopDevServer(process);
|
|
181
|
-
return undefined;
|
|
182
|
-
}
|
|
183
|
-
this.notifyCommittedPort(port);
|
|
184
|
-
log.info(`Committed ${mode} dev server up at ${args.destinationPath} on port ${port}`);
|
|
185
|
-
return port;
|
|
186
|
-
}
|
|
187
|
-
catch (error) {
|
|
188
|
-
log.warn(`Failed to start committed ${mode} dev server at ${args.destinationPath}`, error);
|
|
189
|
-
return undefined;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
getCommittedPort(sessionId) {
|
|
193
|
-
return (this.lingeringCommitted.get(sessionId)?.port ??
|
|
194
|
-
this.sessions.get(sessionId)?.committed?.port);
|
|
195
|
-
}
|
|
196
|
-
async stopLingeringCommitted() {
|
|
197
|
-
this.generation += 1;
|
|
198
|
-
this.committedGenerations.clear();
|
|
199
|
-
const entries = [...this.lingeringCommitted.entries()];
|
|
200
|
-
this.lingeringCommitted.clear();
|
|
201
|
-
if (entries.length > 0)
|
|
202
|
-
this.notifyCommittedHealth(null);
|
|
203
|
-
await Promise.all(entries.map(async ([sessionId, entry]) => {
|
|
204
|
-
try {
|
|
205
|
-
await this.deps.worktreeManager.stopDevServer(entry.process);
|
|
206
|
-
}
|
|
207
|
-
catch (error) {
|
|
208
|
-
log.warn(`stopDevServer for lingering committed server ${sessionId}/${entry.port} failed`, error);
|
|
209
|
-
}
|
|
210
|
-
}));
|
|
211
|
-
}
|
|
212
|
-
async closeSession(sessionId, reason) {
|
|
140
|
+
async closeSession(sessionId) {
|
|
213
141
|
const state = this.sessions.get(sessionId);
|
|
214
142
|
if (!state)
|
|
215
143
|
return;
|
|
216
|
-
if (reason === 'committed') {
|
|
217
|
-
this.committedGenerations.set(sessionId, state.generation);
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
this.committedGenerations.delete(sessionId);
|
|
221
|
-
}
|
|
222
144
|
await this.stopVariantServers(sessionId);
|
|
223
|
-
if (state.committed && reason === 'committed') {
|
|
224
|
-
this.lingeringCommitted.set(sessionId, state.committed);
|
|
225
|
-
}
|
|
226
|
-
else if (state.committed) {
|
|
227
|
-
try {
|
|
228
|
-
await this.deps.worktreeManager.stopDevServer(state.committed.process);
|
|
229
|
-
}
|
|
230
|
-
catch (error) {
|
|
231
|
-
log.warn(`stopDevServer for committed server ${sessionId} failed`, error);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
145
|
for (const preview of state.variants.values()) {
|
|
235
146
|
this.environment.forget(preview.worktreePath);
|
|
236
147
|
}
|
|
@@ -555,18 +466,6 @@ class PreviewRuntime {
|
|
|
555
466
|
}
|
|
556
467
|
return path_1.default.join(worktreePath, path_1.default.relative(environment.projectPath, projectContext.projectPath));
|
|
557
468
|
}
|
|
558
|
-
notifyCommittedPort(port) {
|
|
559
|
-
this.notifyCommittedHealth(port);
|
|
560
|
-
this.notifyPreviewPort(port);
|
|
561
|
-
}
|
|
562
|
-
notifyCommittedHealth(port) {
|
|
563
|
-
try {
|
|
564
|
-
this.deps.setCommittedDevServerHealth?.(port);
|
|
565
|
-
}
|
|
566
|
-
catch (error) {
|
|
567
|
-
log.warn(`setCommittedDevServerHealth(${port}) failed`, error);
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
469
|
notifyPreviewPort(port) {
|
|
571
470
|
try {
|
|
572
471
|
this.deps.switchPreviewPort?.(port);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { GuidanceDocument } from '../types/guidance';
|
|
2
2
|
import type { WorkerSelection } from '../types/change-request-types';
|
|
3
3
|
import { type VariantReference } from '../types/variant-reference';
|
|
4
|
-
import { type Brief, type ActiveVariantSnapshot, type LeasedWorkItemDescriptor, type ProjectContext, type Stage, type StartVariantsBriefContent, type StaticPreviewTargetElement, type Target, type TerminalSummary, type VariantContextBinding, type VariantContextBundle, type VariantQaResult, type VariantWorkItemContext, type
|
|
4
|
+
import { type Brief, type ActiveVariantSnapshot, type LeasedWorkItemDescriptor, type ProjectContext, type Stage, type StartVariantsBriefContent, type StaticPreviewTargetElement, type Target, type TerminalSummary, type VariantContextBinding, type VariantContextBundle, type VariantQaResult, type VariantWorkItemContext, type WorkItem, type WorkItemKind, type WorkItemStatus, type WorkerFidelity, type WorkerRuntimeInfo } from './contracts';
|
|
5
5
|
import { type VariantWorkItemInput, type VariantWorkItemInputByKind, type VariantWorkItemKind } from './workItemInput';
|
|
6
6
|
export declare const DEFAULT_LEASE_TTL_MS: number;
|
|
7
7
|
export declare const SCAFFOLD_LEASE_TTL_MS: number;
|
|
@@ -266,12 +266,6 @@ export declare class SessionStore {
|
|
|
266
266
|
workItemIds: string[];
|
|
267
267
|
sessionStage: Stage;
|
|
268
268
|
};
|
|
269
|
-
recordVariantPick(args: {
|
|
270
|
-
sessionId: string;
|
|
271
|
-
envelope: VariantPickEnvelope;
|
|
272
|
-
}): {
|
|
273
|
-
duplicate: boolean;
|
|
274
|
-
};
|
|
275
269
|
getStage(sessionId: string): Stage;
|
|
276
270
|
getPrompt(sessionId: string): string;
|
|
277
271
|
getRunLabel(sessionId: string): string;
|
|
@@ -297,7 +291,6 @@ export declare class SessionStore {
|
|
|
297
291
|
input: unknown;
|
|
298
292
|
outputSchema: unknown;
|
|
299
293
|
}>;
|
|
300
|
-
getVariantPick(sessionId: string): VariantPickEnvelope | undefined;
|
|
301
294
|
validateReportLease(args: {
|
|
302
295
|
sessionId: string;
|
|
303
296
|
workItemId: string;
|
|
@@ -560,9 +560,6 @@ class SessionStore {
|
|
|
560
560
|
if (target.kind !== 'static_preview' || target.status !== 'succeeded') {
|
|
561
561
|
throw new errors_1.AgentVariantsError('VARIANT_NOT_EDITABLE', 'Only completed static_preview variants can be refined');
|
|
562
562
|
}
|
|
563
|
-
if (session.variantPick) {
|
|
564
|
-
throw new errors_1.AgentVariantsError('PENDING_CHANGE_CONFLICT', 'Cannot refine a variant after one has already been sent');
|
|
565
|
-
}
|
|
566
563
|
const activeRefinement = [...session.workItems.values()].find((item) => {
|
|
567
564
|
if (item.kind !== 'refine_variant')
|
|
568
565
|
return false;
|
|
@@ -614,9 +611,6 @@ class SessionStore {
|
|
|
614
611
|
if (source.kind !== 'static_preview' || source.status !== 'succeeded') {
|
|
615
612
|
throw new errors_1.AgentVariantsError('VARIANT_NOT_EDITABLE', 'Only completed static_preview variants can be varied');
|
|
616
613
|
}
|
|
617
|
-
if (session.variantPick) {
|
|
618
|
-
throw new errors_1.AgentVariantsError('PENDING_CHANGE_CONFLICT', 'Cannot vary a variant after one has already been sent');
|
|
619
|
-
}
|
|
620
614
|
const activeRefinement = [...session.workItems.values()].find((item) => {
|
|
621
615
|
if (item.kind !== 'refine_variant')
|
|
622
616
|
return false;
|
|
@@ -724,9 +718,6 @@ class SessionStore {
|
|
|
724
718
|
if (session.projectContext.kind !== 'existing') {
|
|
725
719
|
throw new errors_1.AgentVariantsError('INVALID_STAGE_ACTION', 'Only existing-project sessions can append code_gen variants');
|
|
726
720
|
}
|
|
727
|
-
if (session.variantPick) {
|
|
728
|
-
throw new errors_1.AgentVariantsError('PENDING_CHANGE_CONFLICT', 'Cannot append variants after one has already been committed');
|
|
729
|
-
}
|
|
730
721
|
if (session.stage === 'cancelled' || session.stage === 'failed') {
|
|
731
722
|
throw new errors_1.AgentVariantsError('INVALID_STAGE_ACTION', `Cannot append variants to a ${session.stage} session`);
|
|
732
723
|
}
|
|
@@ -749,10 +740,10 @@ class SessionStore {
|
|
|
749
740
|
const createdWorkItemIds = [];
|
|
750
741
|
for (const [batchSlotIndex, brief] of args.briefs.entries()) {
|
|
751
742
|
const context = resolveVariantWorkItemContext({
|
|
752
|
-
bundle: args.variantContext
|
|
743
|
+
bundle: args.variantContext,
|
|
753
744
|
projectContext: session.projectContext,
|
|
754
745
|
brief,
|
|
755
|
-
slotIndex:
|
|
746
|
+
slotIndex: batchSlotIndex,
|
|
756
747
|
});
|
|
757
748
|
const visualRef = brief.visualReferenceUrl
|
|
758
749
|
? { visualReferenceUrl: brief.visualReferenceUrl }
|
|
@@ -814,9 +805,6 @@ class SessionStore {
|
|
|
814
805
|
created: false,
|
|
815
806
|
};
|
|
816
807
|
}
|
|
817
|
-
if (session.variantPick) {
|
|
818
|
-
throw new errors_1.AgentVariantsError('PENDING_CHANGE_CONFLICT', 'Cannot adopt a variant after one has already been committed');
|
|
819
|
-
}
|
|
820
808
|
const briefId = `adopted-${(0, crypto_1.randomUUID)().slice(0, 8)}`;
|
|
821
809
|
const item = {
|
|
822
810
|
id: (0, crypto_1.randomUUID)(),
|
|
@@ -1094,21 +1082,6 @@ class SessionStore {
|
|
|
1094
1082
|
}
|
|
1095
1083
|
return { workItemIds, sessionStage: session.stage };
|
|
1096
1084
|
}
|
|
1097
|
-
recordVariantPick(args) {
|
|
1098
|
-
const session = this.requireSession(args.sessionId);
|
|
1099
|
-
if (!['ready', 'degraded'].includes(session.stage)) {
|
|
1100
|
-
throw new errors_1.AgentVariantsError('INVALID_STAGE_ACTION', `Cannot pick variant in stage ${session.stage}`);
|
|
1101
|
-
}
|
|
1102
|
-
if (session.variantPick &&
|
|
1103
|
-
session.variantPick.variantId === args.envelope.variantId) {
|
|
1104
|
-
return { duplicate: true };
|
|
1105
|
-
}
|
|
1106
|
-
if (session.variantPick) {
|
|
1107
|
-
throw new errors_1.AgentVariantsError('PENDING_CHANGE_CONFLICT', `Session already has a variant pick for ${session.variantPick.variantId}`);
|
|
1108
|
-
}
|
|
1109
|
-
session.variantPick = args.envelope;
|
|
1110
|
-
return { duplicate: false };
|
|
1111
|
-
}
|
|
1112
1085
|
getStage(sessionId) {
|
|
1113
1086
|
return this.requireSession(sessionId).stage;
|
|
1114
1087
|
}
|
|
@@ -1165,9 +1138,6 @@ class SessionStore {
|
|
|
1165
1138
|
};
|
|
1166
1139
|
});
|
|
1167
1140
|
}
|
|
1168
|
-
getVariantPick(sessionId) {
|
|
1169
|
-
return this.requireSession(sessionId).variantPick;
|
|
1170
|
-
}
|
|
1171
1141
|
validateReportLease(args) {
|
|
1172
1142
|
const session = this.requireSession(args.sessionId);
|
|
1173
1143
|
const item = this.requireWorkItem(session, args.workItemId);
|
|
@@ -69,11 +69,8 @@ export declare class WorkspaceInventory {
|
|
|
69
69
|
getDependencySignal(sessionId: string): AbortSignal | undefined;
|
|
70
70
|
beginCleanup(sessionId: string): boolean;
|
|
71
71
|
isCleanupStarted(sessionId: string): boolean;
|
|
72
|
-
preserveViteSibling(sessionId: string): void;
|
|
73
72
|
disposeAssignments(args: {
|
|
74
73
|
sessionId: string;
|
|
75
|
-
isFresh: boolean;
|
|
76
|
-
isCommitted: boolean;
|
|
77
74
|
}): Promise<void>;
|
|
78
75
|
private requireSession;
|
|
79
76
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.WorkspaceInventory = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
4
|
const VariantWorkspaceManager_1 = require("./VariantWorkspaceManager");
|
|
9
5
|
const errors_1 = require("./errors");
|
|
10
6
|
const logger_1 = require("../utils/logger");
|
|
@@ -25,7 +21,6 @@ class WorkspaceInventory {
|
|
|
25
21
|
contextAssets: new Map(),
|
|
26
22
|
dependencyAbortController: new AbortController(),
|
|
27
23
|
isCleanupStarted: false,
|
|
28
|
-
isViteSiblingPreserved: false,
|
|
29
24
|
});
|
|
30
25
|
}
|
|
31
26
|
hasSession(sessionId) {
|
|
@@ -131,33 +126,15 @@ class WorkspaceInventory {
|
|
|
131
126
|
isCleanupStarted(sessionId) {
|
|
132
127
|
return this.sessions.get(sessionId)?.isCleanupStarted ?? false;
|
|
133
128
|
}
|
|
134
|
-
preserveViteSibling(sessionId) {
|
|
135
|
-
this.requireSession(sessionId).isViteSiblingPreserved = true;
|
|
136
|
-
}
|
|
137
129
|
async disposeAssignments(args) {
|
|
138
130
|
const state = this.requireSession(args.sessionId);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
await this.worktreeManager.cleanupSession(args.sessionId, state.freshDestinationParent);
|
|
142
|
-
}
|
|
143
|
-
catch (error) {
|
|
144
|
-
log.warn(`cleanupSession failed for ${args.sessionId}`, error);
|
|
145
|
-
}
|
|
131
|
+
try {
|
|
132
|
+
await this.worktreeManager.cleanupSession(args.sessionId, state.freshDestinationParent);
|
|
146
133
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if (!args.isCommitted && args.isFresh) {
|
|
150
|
-
for (const preview of state.staticPreviews.values()) {
|
|
151
|
-
if (ownedRoots.has(preview.assetBase))
|
|
152
|
-
continue;
|
|
153
|
-
try {
|
|
154
|
-
fs_1.default.rmSync(preview.assetBase, { recursive: true, force: true });
|
|
155
|
-
}
|
|
156
|
-
catch (error) {
|
|
157
|
-
log.warn(`failed to remove static preview dir ${preview.assetBase} for ${args.sessionId}`, error);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
log.warn(`cleanupSession failed for ${args.sessionId}`, error);
|
|
160
136
|
}
|
|
137
|
+
state.workspaceManager.removeOwnedArtifactWorkspaces();
|
|
161
138
|
this.sessions.delete(args.sessionId);
|
|
162
139
|
}
|
|
163
140
|
requireSession(sessionId) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type StaticPreviewRefinementRequest, type StaticPreviewRefinementResult } from './staticPreviewRefinements';
|
|
2
2
|
import type { GuidanceDocument } from '../types/guidance';
|
|
3
3
|
import type { VariantStartRequest, VariantStartResult } from './variant-start-types';
|
|
4
|
-
import type { ChildProcess } from 'child_process';
|
|
5
4
|
import { AgentVariantsError } from './errors';
|
|
6
5
|
import { SessionStore, type ApprovedBriefSelection, type ApproveResult, type ProposeArgs, type ProposeResult, type ReportCompleteResult, type RequestWorkResult } from './SessionStore';
|
|
7
6
|
import type { ActiveProjectContext, AdoptPastVariantArgs, BootstrapPastVariantSessionArgs, BootstrapPastVariantSessionResult, ActiveVariantSnapshot, Brief, ProjectContext, Stage, TerminalSummary, VariantContextBinding, HostVariantWorkItemSnapshot, VariantQaResult, WorkItemStatus } from './contracts';
|
|
@@ -30,16 +29,9 @@ export interface OrchestratorDeps {
|
|
|
30
29
|
force?: boolean;
|
|
31
30
|
signal?: AbortSignal;
|
|
32
31
|
}) => Promise<void>;
|
|
33
|
-
materializeProject?: (sourceWorktreePath: string, destinationPath: string) => Promise<void>;
|
|
34
32
|
previewQaRunner?: PreviewQaRunner;
|
|
35
33
|
switchPreviewPort?: (port: number | null) => void;
|
|
36
|
-
setCommittedDevServerHealth?: (port: number | null) => void;
|
|
37
34
|
variantHistory?: VariantHistoryService;
|
|
38
|
-
startStaticPreviewServer?: (args: {
|
|
39
|
-
rootPath: string;
|
|
40
|
-
port: number;
|
|
41
|
-
host?: string;
|
|
42
|
-
}) => Promise<ChildProcess>;
|
|
43
35
|
provisionTimeoutMs?: number;
|
|
44
36
|
activeVariantServerIdleTtlMs?: number;
|
|
45
37
|
devServerRestartDelayMs?: number;
|
|
@@ -70,7 +62,6 @@ export declare class AgentVariantsOrchestrator {
|
|
|
70
62
|
private readonly resolveEnv;
|
|
71
63
|
private readonly telemetry;
|
|
72
64
|
private readonly installDependencies;
|
|
73
|
-
private readonly materializeProject;
|
|
74
65
|
private readonly previewQaRunner;
|
|
75
66
|
private readonly variantHistory;
|
|
76
67
|
private readonly provisionTimeoutMs;
|
|
@@ -80,7 +71,6 @@ export declare class AgentVariantsOrchestrator {
|
|
|
80
71
|
private readonly workspaceInventory;
|
|
81
72
|
private readonly workspaceProvisioning;
|
|
82
73
|
private readonly previewRuntime;
|
|
83
|
-
private readonly inflightCommits;
|
|
84
74
|
private activeSessionId;
|
|
85
75
|
private readonly events;
|
|
86
76
|
constructor(deps: OrchestratorDeps);
|
|
@@ -137,7 +127,6 @@ export declare class AgentVariantsOrchestrator {
|
|
|
137
127
|
private getUsableActiveSessionId;
|
|
138
128
|
isStaticPreviewVariant(sessionId: string, workItemId: string): boolean;
|
|
139
129
|
private resolveHistoryParentVariant;
|
|
140
|
-
getVariantPick(sessionId: string): ReturnType<SessionStore['getVariantPick']>;
|
|
141
130
|
refineVariant(args: {
|
|
142
131
|
guidance?: GuidanceDocument[];
|
|
143
132
|
sessionId: string;
|
|
@@ -247,21 +236,7 @@ export declare class AgentVariantsOrchestrator {
|
|
|
247
236
|
renamedCount: number;
|
|
248
237
|
sessionStage: Stage;
|
|
249
238
|
}>;
|
|
250
|
-
|
|
251
|
-
sessionId: string;
|
|
252
|
-
variantId: string;
|
|
253
|
-
skipTeardown?: boolean;
|
|
254
|
-
}): Promise<{
|
|
255
|
-
enqueued: boolean;
|
|
256
|
-
duplicate: boolean;
|
|
257
|
-
changedFilesCount: number;
|
|
258
|
-
payloadKind?: 'diff' | 'diff-applied' | 'project-created';
|
|
259
|
-
destinationPath?: string;
|
|
260
|
-
previewUrl?: string;
|
|
261
|
-
}>;
|
|
262
|
-
private commitVariantImpl;
|
|
263
|
-
cleanupCommittedSession(sessionId: string): Promise<void>;
|
|
264
|
-
private assertDestinationAvailable;
|
|
239
|
+
cleanupSession(sessionId: string): Promise<void>;
|
|
265
240
|
getVariantDiff(sessionId: string, variantId: string): string | undefined;
|
|
266
241
|
private evaluateQaForReport;
|
|
267
242
|
private evaluateExistingCodeGenQa;
|
|
@@ -281,16 +256,12 @@ export declare class AgentVariantsOrchestrator {
|
|
|
281
256
|
private prepareArtifactBase;
|
|
282
257
|
private createArtifactDiff;
|
|
283
258
|
private persistCompletedArtifactVariant;
|
|
284
|
-
private persistCompletedFreshVariantsForCommit;
|
|
285
|
-
private persistVariantHistoryAtCommit;
|
|
286
259
|
private markPersistedVariantsCancelled;
|
|
287
260
|
private markPersistedVariantCancelled;
|
|
288
261
|
private markPersistedVariantRemoved;
|
|
289
262
|
private markPersistedVariantRenamed;
|
|
290
263
|
private resolveHistoryProjectPath;
|
|
291
264
|
private readManifest;
|
|
292
|
-
private preserveUnchosenVariants;
|
|
293
|
-
private renameWorktreeIntoDestination;
|
|
294
265
|
private teardownSession;
|
|
295
266
|
private ensureResources;
|
|
296
267
|
}
|