rivet-design 0.25.0 → 0.26.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 +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 +320 -380
- 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/agent-variants/workItemInput.d.ts +210 -210
- 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/routes/variantRequestSchema.d.ts +4 -4
- 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/GuidanceVerifierRunner.js +13 -2
- 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/storage/library/ProjectPreviewCache.d.ts +2 -2
- package/dist/types/guidance-verifier.d.ts +458 -59
- package/dist/types/guidance-verifier.js +35 -12
- 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 +7 -9
- 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-Cr4GFYXW.js} +9 -9
- package/src/ui/dist/assets/main-tPO1OCpZ.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
|
@@ -14,8 +14,31 @@ const proxy_1 = require("../config/proxy");
|
|
|
14
14
|
const RequestAuthContext_1 = require("./RequestAuthContext");
|
|
15
15
|
const accessTokenRefresh_1 = require("./accessTokenRefresh");
|
|
16
16
|
const installRef_1 = require("../utils/installRef");
|
|
17
|
+
const telemetryPolicy_1 = require("../config/telemetryPolicy");
|
|
17
18
|
const BrowserAuthorizationRecords_1 = require("../storage/library/BrowserAuthorizationRecords");
|
|
18
19
|
const log = (0, logger_1.createLogger)('ConfigManager');
|
|
20
|
+
const MAX_TRACKED_INSTALL_REFS = 20;
|
|
21
|
+
const queueInstallRefTrigger = ({ records = [], installRef, trigger, downloadType, signInUserId, }) => {
|
|
22
|
+
const existing = records.find((record) => record.installRef === installRef);
|
|
23
|
+
const record = existing ?? {
|
|
24
|
+
installRef,
|
|
25
|
+
pendingTriggers: [],
|
|
26
|
+
reportedTriggers: [],
|
|
27
|
+
};
|
|
28
|
+
const isKnownTrigger = record.pendingTriggers.includes(trigger) ||
|
|
29
|
+
record.reportedTriggers.includes(trigger);
|
|
30
|
+
const updated = isKnownTrigger
|
|
31
|
+
? record
|
|
32
|
+
: {
|
|
33
|
+
...record,
|
|
34
|
+
downloadType: record.downloadType ?? downloadType,
|
|
35
|
+
...(signInUserId ? { signInUserId } : {}),
|
|
36
|
+
pendingTriggers: [...record.pendingTriggers, trigger],
|
|
37
|
+
};
|
|
38
|
+
const others = records.filter((entry) => entry.installRef !== installRef);
|
|
39
|
+
return [...others, updated].slice(-MAX_TRACKED_INSTALL_REFS);
|
|
40
|
+
};
|
|
41
|
+
const hasPendingInstallRefTriggers = (records = []) => records.some((record) => record.pendingTriggers.length > 0);
|
|
19
42
|
const authFields = (config) => ({
|
|
20
43
|
authToken: config.authToken,
|
|
21
44
|
refreshToken: config.refreshToken,
|
|
@@ -280,10 +303,20 @@ class ConfigManager {
|
|
|
280
303
|
this.reloadConfigFromDisk();
|
|
281
304
|
return (0, installRef_1.parseInstallRef)(this.config.installRef);
|
|
282
305
|
}
|
|
283
|
-
setInstallRef(installRef) {
|
|
284
|
-
this.
|
|
285
|
-
|
|
286
|
-
|
|
306
|
+
setInstallRef(installRef, downloadType) {
|
|
307
|
+
this.getBrowserAuthorization().saveSettings(() => {
|
|
308
|
+
this.reloadConfigFromDisk();
|
|
309
|
+
this.config.installRef = installRef;
|
|
310
|
+
if ((0, telemetryPolicy_1.getTelemetryMode)() !== 'off') {
|
|
311
|
+
this.config.installRefActivations = queueInstallRefTrigger({
|
|
312
|
+
records: this.config.installRefActivations,
|
|
313
|
+
installRef,
|
|
314
|
+
trigger: 'first_run',
|
|
315
|
+
downloadType,
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
this.writeConfig();
|
|
319
|
+
});
|
|
287
320
|
}
|
|
288
321
|
clearInstallRef(installRef) {
|
|
289
322
|
this.reloadConfigFromDisk();
|
|
@@ -292,6 +325,60 @@ class ConfigManager {
|
|
|
292
325
|
this.config.installRef = undefined;
|
|
293
326
|
this.saveConfig();
|
|
294
327
|
}
|
|
328
|
+
completeInstallRefSignIn(installRef, userId) {
|
|
329
|
+
this.getBrowserAuthorization().saveSettings(() => {
|
|
330
|
+
this.reloadConfigFromDisk();
|
|
331
|
+
if (this.config.installRef === installRef) {
|
|
332
|
+
this.config.installRef = undefined;
|
|
333
|
+
}
|
|
334
|
+
if ((0, telemetryPolicy_1.getTelemetryMode)() !== 'off') {
|
|
335
|
+
this.config.installRefActivations = queueInstallRefTrigger({
|
|
336
|
+
records: this.config.installRefActivations,
|
|
337
|
+
installRef,
|
|
338
|
+
trigger: 'sign_in',
|
|
339
|
+
signInUserId: userId,
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
this.writeConfig();
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
claimInstallRefActivations() {
|
|
346
|
+
this.reloadConfigFromDisk();
|
|
347
|
+
if (!hasPendingInstallRefTriggers(this.config.installRefActivations)) {
|
|
348
|
+
return [];
|
|
349
|
+
}
|
|
350
|
+
const claimed = [];
|
|
351
|
+
this.getBrowserAuthorization().saveSettings(() => {
|
|
352
|
+
this.reloadConfigFromDisk();
|
|
353
|
+
const records = this.config.installRefActivations ?? [];
|
|
354
|
+
for (const record of records) {
|
|
355
|
+
for (const trigger of record.pendingTriggers) {
|
|
356
|
+
claimed.push({
|
|
357
|
+
installRef: record.installRef,
|
|
358
|
+
trigger,
|
|
359
|
+
...(record.downloadType
|
|
360
|
+
? { downloadType: record.downloadType }
|
|
361
|
+
: {}),
|
|
362
|
+
...(trigger === 'sign_in' && record.signInUserId
|
|
363
|
+
? { userId: record.signInUserId }
|
|
364
|
+
: {}),
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if (claimed.length === 0)
|
|
369
|
+
return;
|
|
370
|
+
this.config.installRefActivations = records.map((record) => ({
|
|
371
|
+
...record,
|
|
372
|
+
pendingTriggers: [],
|
|
373
|
+
reportedTriggers: [
|
|
374
|
+
...record.reportedTriggers,
|
|
375
|
+
...record.pendingTriggers,
|
|
376
|
+
],
|
|
377
|
+
}));
|
|
378
|
+
this.writeConfig();
|
|
379
|
+
});
|
|
380
|
+
return claimed;
|
|
381
|
+
}
|
|
295
382
|
getProxyUrl() {
|
|
296
383
|
this.reloadConfigFromDisk();
|
|
297
384
|
return this.config.proxyUrl || proxy_1.PROXY_URL;
|
|
@@ -239,7 +239,15 @@ const validateEvidence = async (directory, names) => {
|
|
|
239
239
|
const executeGuidanceVerifier = async (args) => {
|
|
240
240
|
const started = Date.now();
|
|
241
241
|
let runDirectory = args.runsDirectory;
|
|
242
|
+
let projectPath = args.projectPath;
|
|
243
|
+
const verifier = {
|
|
244
|
+
contextId: args.packet.source.id,
|
|
245
|
+
sourceDigest: args.packet.sourceDigest,
|
|
246
|
+
};
|
|
242
247
|
const failed = (reason) => ({
|
|
248
|
+
schemaVersion: 1,
|
|
249
|
+
verifier,
|
|
250
|
+
projectPath,
|
|
243
251
|
execution: 'error',
|
|
244
252
|
reason,
|
|
245
253
|
runDirectory,
|
|
@@ -261,7 +269,7 @@ const executeGuidanceVerifier = async (args) => {
|
|
|
261
269
|
files: executable.files,
|
|
262
270
|
directory: path_1.default.join(runDirectory, 'package'),
|
|
263
271
|
});
|
|
264
|
-
|
|
272
|
+
projectPath = await promises_1.default.realpath(args.projectPath);
|
|
265
273
|
if (!(await promises_1.default.stat(projectPath)).isDirectory())
|
|
266
274
|
return failed('setup_failed');
|
|
267
275
|
const evidenceDirectory = path_1.default.join(runDirectory, 'evidence');
|
|
@@ -324,7 +332,7 @@ const executeGuidanceVerifier = async (args) => {
|
|
|
324
332
|
return failed('invalid_result');
|
|
325
333
|
}
|
|
326
334
|
try {
|
|
327
|
-
await validateEvidence(evidenceDirectory, result.checks.flatMap((check) => check.evidence
|
|
335
|
+
await validateEvidence(evidenceDirectory, result.checks.flatMap((check) => check.evidence.map((artifact) => artifact.path)));
|
|
328
336
|
}
|
|
329
337
|
catch {
|
|
330
338
|
return failed('invalid_evidence');
|
|
@@ -335,6 +343,9 @@ const executeGuidanceVerifier = async (args) => {
|
|
|
335
343
|
else if (result.checks.some((check) => check.status === 'blocked'))
|
|
336
344
|
status = 'blocked';
|
|
337
345
|
return {
|
|
346
|
+
schemaVersion: 1,
|
|
347
|
+
verifier,
|
|
348
|
+
projectPath,
|
|
338
349
|
execution: 'completed',
|
|
339
350
|
status,
|
|
340
351
|
checks: result.checks,
|
|
@@ -88,7 +88,6 @@ export declare class SessionBridgeService {
|
|
|
88
88
|
isActive(): boolean;
|
|
89
89
|
getSessionId(): string | null;
|
|
90
90
|
getProjectPath(): string | null;
|
|
91
|
-
rebindProjectPath(projectPath: string): void;
|
|
92
91
|
hasUnfinishedWork(): boolean;
|
|
93
92
|
getChannelDepth(_kind: BatchChannelKind): ChannelDepth;
|
|
94
93
|
getActiveLeaseMetadata(): ActiveLeaseMetadata[];
|
|
@@ -124,7 +123,6 @@ export declare class SessionBridgeService {
|
|
|
124
123
|
setStatusAccessToken(token: string): void;
|
|
125
124
|
hasStatusAccessToken(): boolean;
|
|
126
125
|
isStatusAccessTokenValid(token: string | null | undefined): boolean;
|
|
127
|
-
setCommittedDevServerHealth(port: number | null): void;
|
|
128
126
|
switchPreviewPort(port: number | null): void;
|
|
129
127
|
endSession(): number;
|
|
130
128
|
getWatcherLiveness(_now?: number): WatcherLiveness;
|
|
@@ -85,13 +85,6 @@ class SessionBridgeService {
|
|
|
85
85
|
getProjectPath() {
|
|
86
86
|
return this.projectPath;
|
|
87
87
|
}
|
|
88
|
-
rebindProjectPath(projectPath) {
|
|
89
|
-
if (!this.sessionId) {
|
|
90
|
-
throw new Error('Cannot rebind project path without an active session');
|
|
91
|
-
}
|
|
92
|
-
this.projectPath = projectPath;
|
|
93
|
-
log.info(`Session project rebound to ${projectPath}`);
|
|
94
|
-
}
|
|
95
88
|
hasUnfinishedWork() {
|
|
96
89
|
return false;
|
|
97
90
|
}
|
|
@@ -209,25 +202,6 @@ class SessionBridgeService {
|
|
|
209
202
|
isStatusAccessTokenValid(token) {
|
|
210
203
|
return Boolean(token) && token === this.statusAccessToken;
|
|
211
204
|
}
|
|
212
|
-
setCommittedDevServerHealth(port) {
|
|
213
|
-
if (port === null) {
|
|
214
|
-
this.devServerHealth = this.baseDevServerHealth
|
|
215
|
-
? { ...this.baseDevServerHealth }
|
|
216
|
-
: { ...EMPTY_DEV_SERVER_HEALTH, lastCheckedAt: Date.now() };
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
const committedDevServerHealth = {
|
|
220
|
-
ownership: 'rivet_owned',
|
|
221
|
-
host: 'localhost',
|
|
222
|
-
port,
|
|
223
|
-
isReachable: true,
|
|
224
|
-
reason: 'healthy',
|
|
225
|
-
lastCheckedAt: Date.now(),
|
|
226
|
-
startedByRivet: true,
|
|
227
|
-
};
|
|
228
|
-
this.devServerHealth = committedDevServerHealth;
|
|
229
|
-
this.baseDevServerHealth = { ...committedDevServerHealth };
|
|
230
|
-
}
|
|
231
205
|
switchPreviewPort(port) {
|
|
232
206
|
if (!this._setVariantTarget) {
|
|
233
207
|
log.warn(`switchPreviewPort(${port}) called but no variant target setter registered`);
|
|
@@ -49,7 +49,10 @@ export declare class TelemetryService {
|
|
|
49
49
|
private get distinctId();
|
|
50
50
|
identifyUser(identity?: AccountIdentity): void;
|
|
51
51
|
private mirrorToLocalSink;
|
|
52
|
-
|
|
52
|
+
reportInstallRefActivations(): void;
|
|
53
|
+
track(event: string, properties?: Record<string, unknown>, options?: {
|
|
54
|
+
distinctId?: string;
|
|
55
|
+
}): void;
|
|
53
56
|
trackSessionStart(options: {
|
|
54
57
|
framework?: string;
|
|
55
58
|
port?: number;
|
|
@@ -258,7 +261,6 @@ export declare class TelemetryService {
|
|
|
258
261
|
trackAgentVariantsRefinementFailed(data: MCPVariantsTelemetryMetadata): void;
|
|
259
262
|
trackAgentVariantsRoundStarted(data: MCPVariantsTelemetryMetadata): void;
|
|
260
263
|
trackAgentVariantsRoundCompleted(data: MCPVariantsTelemetryMetadata): void;
|
|
261
|
-
trackAgentVariantsCommitFailed(data: MCPVariantsTelemetryMetadata): void;
|
|
262
264
|
trackAgentVariantsScaffoldStarted(data: {
|
|
263
265
|
sessionId: string;
|
|
264
266
|
variantCount: number;
|
|
@@ -365,13 +367,6 @@ export declare class TelemetryService {
|
|
|
365
367
|
reason?: string;
|
|
366
368
|
hasPort: boolean;
|
|
367
369
|
}): void;
|
|
368
|
-
trackAgentVariantsNewProjectMaterialized(data: {
|
|
369
|
-
sessionId: string;
|
|
370
|
-
variantId: string;
|
|
371
|
-
destinationPath: string;
|
|
372
|
-
changedFilesCount: number;
|
|
373
|
-
durationMs: number;
|
|
374
|
-
}): void;
|
|
375
370
|
trackAgentVariantsSourceContextQuality(data: {
|
|
376
371
|
sessionId: string;
|
|
377
372
|
sourceUrlCount: number;
|
|
@@ -390,12 +385,6 @@ export declare class TelemetryService {
|
|
|
390
385
|
variantId: string;
|
|
391
386
|
status: 'completed' | 'skipped' | 'failed' | 'missing';
|
|
392
387
|
}): void;
|
|
393
|
-
trackAgentVariantsActiveProjectTransition(data: {
|
|
394
|
-
sessionId: string;
|
|
395
|
-
success: boolean;
|
|
396
|
-
reasonCode: string;
|
|
397
|
-
destinationPath: string | null;
|
|
398
|
-
}): void;
|
|
399
388
|
flush(): Promise<void>;
|
|
400
389
|
shutdown(timeoutMs?: number): Promise<void>;
|
|
401
390
|
}
|
|
@@ -178,7 +178,31 @@ class TelemetryService {
|
|
|
178
178
|
}
|
|
179
179
|
catch { }
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
reportInstallRefActivations() {
|
|
182
|
+
if (!this.isEnabled || !this.posthog || (0, telemetryPolicy_1.getTelemetryMode)() !== 'full')
|
|
183
|
+
return;
|
|
184
|
+
try {
|
|
185
|
+
const cm = (0, ConfigManager_1.getConfigManager)();
|
|
186
|
+
for (const activation of cm.claimInstallRefActivations()) {
|
|
187
|
+
const account = cm.getAccountIdentity();
|
|
188
|
+
const userId = activation.userId ?? account.userId;
|
|
189
|
+
if (userId) {
|
|
190
|
+
this.identifyUser(userId === account.userId ? account : { userId });
|
|
191
|
+
}
|
|
192
|
+
this.track('install_ref_activated', {
|
|
193
|
+
install_ref: activation.installRef,
|
|
194
|
+
trigger: activation.trigger,
|
|
195
|
+
...(activation.downloadType
|
|
196
|
+
? { download_type: activation.downloadType }
|
|
197
|
+
: {}),
|
|
198
|
+
}, { distinctId: userId ?? cm.getAnonymousId() });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
log.debug('Could not report install ref activations');
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
track(event, properties = {}, options = {}) {
|
|
182
206
|
const mode = (0, telemetryPolicy_1.getTelemetryMode)();
|
|
183
207
|
if (mode === 'off')
|
|
184
208
|
return;
|
|
@@ -210,9 +234,10 @@ class TelemetryService {
|
|
|
210
234
|
: undefined;
|
|
211
235
|
if (account)
|
|
212
236
|
this.identifyUser(account);
|
|
213
|
-
const distinctId =
|
|
214
|
-
|
|
215
|
-
|
|
237
|
+
const distinctId = options.distinctId ??
|
|
238
|
+
(account
|
|
239
|
+
? (account.userId ?? (0, ConfigManager_1.getConfigManager)().getPluginTelemetryId())
|
|
240
|
+
: this.distinctId);
|
|
216
241
|
const enrichedProperties = {
|
|
217
242
|
...approved,
|
|
218
243
|
telemetry_version: telemetryContract_1.TELEMETRY_VERSION,
|
|
@@ -660,14 +685,6 @@ class TelemetryService {
|
|
|
660
685
|
...(0, MCPVariantsTelemetry_1.buildMCPVariantsTelemetryProperties)(data),
|
|
661
686
|
});
|
|
662
687
|
}
|
|
663
|
-
trackAgentVariantsCommitFailed(data) {
|
|
664
|
-
this.track('agent_variants.commit_failed', {
|
|
665
|
-
...(0, MCPVariantsTelemetry_1.buildMCPVariantsTelemetryProperties)({
|
|
666
|
-
...data,
|
|
667
|
-
requestStatus: data.requestStatus ?? 'failed',
|
|
668
|
-
}),
|
|
669
|
-
});
|
|
670
|
-
}
|
|
671
688
|
trackAgentVariantsScaffoldStarted(data) {
|
|
672
689
|
this.track('agent_variants.scaffold_started', {
|
|
673
690
|
session_id: data.sessionId,
|
|
@@ -803,16 +820,6 @@ class TelemetryService {
|
|
|
803
820
|
source: 'mcp',
|
|
804
821
|
});
|
|
805
822
|
}
|
|
806
|
-
trackAgentVariantsNewProjectMaterialized(data) {
|
|
807
|
-
this.track('agent_variants.new_project_materialized', {
|
|
808
|
-
session_id: data.sessionId,
|
|
809
|
-
variant_id: data.variantId,
|
|
810
|
-
destination_path_hash: this.hashTelemetryValue(data.destinationPath),
|
|
811
|
-
changed_files_count: data.changedFilesCount,
|
|
812
|
-
duration_ms: data.durationMs,
|
|
813
|
-
source: 'mcp',
|
|
814
|
-
});
|
|
815
|
-
}
|
|
816
823
|
trackAgentVariantsSourceContextQuality(data) {
|
|
817
824
|
this.track('agent_variants.source_context_quality', {
|
|
818
825
|
session_id: data.sessionId,
|
|
@@ -840,17 +847,6 @@ class TelemetryService {
|
|
|
840
847
|
source: 'mcp',
|
|
841
848
|
});
|
|
842
849
|
}
|
|
843
|
-
trackAgentVariantsActiveProjectTransition(data) {
|
|
844
|
-
this.track('agent_variants.active_project_transition', {
|
|
845
|
-
session_id: data.sessionId,
|
|
846
|
-
success: data.success,
|
|
847
|
-
reason_code: data.reasonCode,
|
|
848
|
-
destination_path_hash: data.destinationPath
|
|
849
|
-
? this.hashTelemetryValue(data.destinationPath)
|
|
850
|
-
: null,
|
|
851
|
-
source: 'mcp',
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
850
|
async flush() {
|
|
855
851
|
if (this.posthog) {
|
|
856
852
|
try {
|
|
@@ -59,11 +59,6 @@ export declare class VariantRunService {
|
|
|
59
59
|
private prepareRequest;
|
|
60
60
|
private recordGuidance;
|
|
61
61
|
private startStaticPreviewRefinements;
|
|
62
|
-
commitVariant(args: {
|
|
63
|
-
sessionId: string;
|
|
64
|
-
variantId: string;
|
|
65
|
-
skipTeardown?: boolean;
|
|
66
|
-
}): ReturnType<AgentVariantsOrchestrator['commitVariant']>;
|
|
67
62
|
cancelVariants(args: {
|
|
68
63
|
sessionId: string;
|
|
69
64
|
reason?: string;
|
|
@@ -351,9 +351,6 @@ class VariantRunService {
|
|
|
351
351
|
}
|
|
352
352
|
return { success: true };
|
|
353
353
|
}
|
|
354
|
-
commitVariant(args) {
|
|
355
|
-
return this.orchestrator.commitVariant(args);
|
|
356
|
-
}
|
|
357
354
|
cancelVariants(args) {
|
|
358
355
|
this.executor?.cancelSession(args.sessionId);
|
|
359
356
|
return this.orchestrator.cancel(args);
|
|
@@ -23,8 +23,6 @@ export declare class WorktreeManager {
|
|
|
23
23
|
createWorktrees(sessionId: string, count: number, instanceKeyPrefix?: string): Promise<string[]>;
|
|
24
24
|
forkWorktreesFrom(sourceWorktreePath: string, sessionId: string, count: number, instanceKeyPrefix?: string): Promise<string[]>;
|
|
25
25
|
getDiff(worktreePath: string): Promise<string>;
|
|
26
|
-
applyDiff(diff: string, reverse: boolean): Promise<void>;
|
|
27
|
-
applyDiffToProject(diff: string, projectPath: string): Promise<void>;
|
|
28
26
|
getFreePort(): Promise<number>;
|
|
29
27
|
findFreePortFrom(startPort: number, scanWindow?: number): Promise<number>;
|
|
30
28
|
releasePort(port: number): void;
|
|
@@ -34,7 +32,6 @@ export declare class WorktreeManager {
|
|
|
34
32
|
cleanupSession(sessionId: string, freshDestinationParent?: string): Promise<void>;
|
|
35
33
|
createFreshWorktrees(sessionId: string, count: number, template: TemplateBundle, designContext: ReadonlyArray<DesignContextEntry | undefined> | undefined, destinationParent: string): Promise<string[]>;
|
|
36
34
|
private writeDesignContext;
|
|
37
|
-
moveWorktreeToHistory(srcWorktreePath: string, historyDir: string, folderName: string): string;
|
|
38
35
|
cleanupFreshWorktrees(sessionId: string, destinationParent: string, preserve?: ReadonlySet<string>): void;
|
|
39
36
|
private assertSafeSessionId;
|
|
40
37
|
}
|
|
@@ -272,44 +272,9 @@ class WorktreeManager {
|
|
|
272
272
|
}
|
|
273
273
|
async getDiff(worktreePath) {
|
|
274
274
|
const git = (0, simple_git_1.simpleGit)(worktreePath);
|
|
275
|
-
await git.raw(['add', '--intent-to-add', '.']).catch(() => {
|
|
276
|
-
});
|
|
275
|
+
await git.raw(['add', '--intent-to-add', '.']).catch(() => { });
|
|
277
276
|
return git.diff(['--binary', '--full-index', 'HEAD']);
|
|
278
277
|
}
|
|
279
|
-
async applyDiff(diff, reverse) {
|
|
280
|
-
if (!diff.trim())
|
|
281
|
-
return;
|
|
282
|
-
const args = ['apply', '--whitespace=nowarn'];
|
|
283
|
-
if (reverse)
|
|
284
|
-
args.push('--reverse');
|
|
285
|
-
args.push('-');
|
|
286
|
-
return new Promise((resolve, reject) => {
|
|
287
|
-
const cp = (0, child_process_1.spawn)('git', args, {
|
|
288
|
-
env: (0, subprocessEnvironment_1.subprocessEnvironment)('git'),
|
|
289
|
-
cwd: this.projectPath,
|
|
290
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
291
|
-
});
|
|
292
|
-
let stderr = '';
|
|
293
|
-
cp.stderr.on('data', (d) => {
|
|
294
|
-
stderr += d.toString();
|
|
295
|
-
});
|
|
296
|
-
cp.on('close', (code) => {
|
|
297
|
-
if (code !== 0)
|
|
298
|
-
reject(new Error(`git apply failed: ${stderr}`));
|
|
299
|
-
else
|
|
300
|
-
resolve();
|
|
301
|
-
});
|
|
302
|
-
cp.stdin.write(diff);
|
|
303
|
-
cp.stdin.end();
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
async applyDiffToProject(diff, projectPath) {
|
|
307
|
-
if (!diff.trim())
|
|
308
|
-
return;
|
|
309
|
-
const git = (0, simple_git_1.simpleGit)(projectPath);
|
|
310
|
-
const gitRoot = (await git.revparse(['--show-toplevel'])).trim();
|
|
311
|
-
return this.applyPatchViaStdin(diff, gitRoot);
|
|
312
|
-
}
|
|
313
278
|
getFreePort() {
|
|
314
279
|
return new Promise((resolve, reject) => {
|
|
315
280
|
const server = net_1.default.createServer();
|
|
@@ -473,8 +438,7 @@ class WorktreeManager {
|
|
|
473
438
|
isForceful: true,
|
|
474
439
|
});
|
|
475
440
|
}
|
|
476
|
-
catch {
|
|
477
|
-
}
|
|
441
|
+
catch { }
|
|
478
442
|
return fail('timeout');
|
|
479
443
|
}
|
|
480
444
|
async stopDevServer(proc, timeoutMs = 5_000) {
|
|
@@ -494,8 +458,7 @@ class WorktreeManager {
|
|
|
494
458
|
isForceful: false,
|
|
495
459
|
});
|
|
496
460
|
}
|
|
497
|
-
catch {
|
|
498
|
-
}
|
|
461
|
+
catch { }
|
|
499
462
|
let timeout;
|
|
500
463
|
const timedOut = await Promise.race([
|
|
501
464
|
exited.then(() => false),
|
|
@@ -513,8 +476,7 @@ class WorktreeManager {
|
|
|
513
476
|
isForceful: true,
|
|
514
477
|
});
|
|
515
478
|
}
|
|
516
|
-
catch {
|
|
517
|
-
}
|
|
479
|
+
catch { }
|
|
518
480
|
await exited;
|
|
519
481
|
}
|
|
520
482
|
async cleanupSession(sessionId, freshDestinationParent) {
|
|
@@ -605,12 +567,6 @@ class WorktreeManager {
|
|
|
605
567
|
}
|
|
606
568
|
log.warn(`Fresh worktree ${slot}: unknown design system slug '${entry.slug}' — DESIGN.md skipped`);
|
|
607
569
|
}
|
|
608
|
-
moveWorktreeToHistory(srcWorktreePath, historyDir, folderName) {
|
|
609
|
-
fs_1.default.mkdirSync(historyDir, { recursive: true });
|
|
610
|
-
const dest = path_1.default.join(historyDir, folderName);
|
|
611
|
-
fs_1.default.renameSync(srcWorktreePath, dest);
|
|
612
|
-
return dest;
|
|
613
|
-
}
|
|
614
570
|
cleanupFreshWorktrees(sessionId, destinationParent, preserve) {
|
|
615
571
|
this.assertSafeSessionId(sessionId);
|
|
616
572
|
if (!destinationParent || !path_1.default.isAbsolute(destinationParent)) {
|
|
@@ -636,8 +592,7 @@ class WorktreeManager {
|
|
|
636
592
|
fs_1.default.rmdirSync(freshRoot);
|
|
637
593
|
}
|
|
638
594
|
}
|
|
639
|
-
catch {
|
|
640
|
-
}
|
|
595
|
+
catch { }
|
|
641
596
|
}
|
|
642
597
|
catch (e) {
|
|
643
598
|
if (e.code !== 'ENOENT') {
|
|
@@ -697,8 +652,7 @@ const cleanupOrphanedWorktrees = () => {
|
|
|
697
652
|
});
|
|
698
653
|
}
|
|
699
654
|
}
|
|
700
|
-
catch {
|
|
701
|
-
}
|
|
655
|
+
catch { }
|
|
702
656
|
const roots = loadFreshWorktreeRoots();
|
|
703
657
|
const survivingRoots = [];
|
|
704
658
|
for (const root of roots) {
|
|
@@ -729,8 +683,7 @@ const pruneWorktrees = async (projectPath) => {
|
|
|
729
683
|
try {
|
|
730
684
|
await (0, simple_git_1.simpleGit)(projectPath, GIT_OPTS).raw(['worktree', 'prune']);
|
|
731
685
|
}
|
|
732
|
-
catch {
|
|
733
|
-
}
|
|
686
|
+
catch { }
|
|
734
687
|
};
|
|
735
688
|
exports.pruneWorktrees = pruneWorktrees;
|
|
736
689
|
//# sourceMappingURL=WorktreeManager.js.map
|
|
@@ -90,7 +90,6 @@ const createAgentVariantsOrchestrator = (options) => {
|
|
|
90
90
|
};
|
|
91
91
|
}),
|
|
92
92
|
switchPreviewPort: (port) => options.bridge.switchPreviewPort(port),
|
|
93
|
-
setCommittedDevServerHealth: (port) => options.bridge.setCommittedDevServerHealth(port),
|
|
94
93
|
});
|
|
95
94
|
};
|
|
96
95
|
exports.createAgentVariantsOrchestrator = createAgentVariantsOrchestrator;
|
|
@@ -42,6 +42,7 @@ const design_profile_3 = require("../../types/design-profile");
|
|
|
42
42
|
const errorMessage_1 = require("../../utils/errorMessage");
|
|
43
43
|
const APPROVAL_TIMEOUT_MS = 45_000;
|
|
44
44
|
const SAVED_REFERENCE_IMAGE_LIMIT = 20;
|
|
45
|
+
const VERIFICATION_TARGET_INSTRUCTIONS = 'Choose tools for the actual browser, simulator, or other target. Do not assume a URL, DOM, CSS, or Playwright. If required tools or the target are unavailable, report unable to verify.';
|
|
45
46
|
const librarySources = (records) => records.sources().map(({ id, title, provider, isIncluded }) => ({
|
|
46
47
|
id,
|
|
47
48
|
title,
|
|
@@ -403,7 +404,7 @@ class DesignProfiles {
|
|
|
403
404
|
verifierState: 'missing',
|
|
404
405
|
nextAction: {
|
|
405
406
|
action: 'create_context_verifier',
|
|
406
|
-
instructions:
|
|
407
|
+
instructions: `Author and execute a focused verifier against this source and the user-selected target. ${VERIFICATION_TARGET_INSTRUCTIONS} Record observable checks and evidence before offering to save it for reuse.`,
|
|
407
408
|
},
|
|
408
409
|
};
|
|
409
410
|
if (verifier.sourceDigest !== sourceDigest)
|
|
@@ -413,7 +414,7 @@ class DesignProfiles {
|
|
|
413
414
|
verifierState: 'stale',
|
|
414
415
|
nextAction: {
|
|
415
416
|
action: 'revise_context_verifier',
|
|
416
|
-
instructions:
|
|
417
|
+
instructions: `The source changed after this verifier was saved. ${VERIFICATION_TARGET_INSTRUCTIONS} Revise and execute a temporary recipe against the supplied source before offering to replace the saved verifier.`,
|
|
417
418
|
},
|
|
418
419
|
};
|
|
419
420
|
return {
|
|
@@ -430,7 +431,7 @@ class DesignProfiles {
|
|
|
430
431
|
: {}),
|
|
431
432
|
nextAction: {
|
|
432
433
|
action: 'run_context_verifier',
|
|
433
|
-
instructions:
|
|
434
|
+
instructions: `Execute the saved verifier against this source and the user-selected target. ${VERIFICATION_TARGET_INSTRUCTIONS} Report pass, fail, or unable to verify with evidence. Retrieval has not executed any checks.`,
|
|
434
435
|
},
|
|
435
436
|
};
|
|
436
437
|
}, expectedAccountId);
|
|
@@ -7,14 +7,14 @@ declare const PreviewSchema: z.ZodObject<{
|
|
|
7
7
|
capturedAt: z.ZodString;
|
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
|
9
9
|
projectPath: string;
|
|
10
|
-
dataUrl: string;
|
|
11
10
|
label: string;
|
|
11
|
+
dataUrl: string;
|
|
12
12
|
sourceKey: string;
|
|
13
13
|
capturedAt: string;
|
|
14
14
|
}, {
|
|
15
15
|
projectPath: string;
|
|
16
|
-
dataUrl: string;
|
|
17
16
|
label: string;
|
|
17
|
+
dataUrl: string;
|
|
18
18
|
sourceKey: string;
|
|
19
19
|
capturedAt: string;
|
|
20
20
|
}>;
|