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.
Files changed (63) hide show
  1. package/README.md +2 -2
  2. package/README.npm.md +2 -2
  3. package/dist/agent-variants/PreviewRuntime.d.ts +1 -20
  4. package/dist/agent-variants/PreviewRuntime.js +1 -102
  5. package/dist/agent-variants/SessionStore.d.ts +1 -8
  6. package/dist/agent-variants/SessionStore.js +2 -32
  7. package/dist/agent-variants/WorkspaceInventory.d.ts +0 -3
  8. package/dist/agent-variants/WorkspaceInventory.js +5 -28
  9. package/dist/agent-variants/WorktreeOrchestrator.d.ts +1 -30
  10. package/dist/agent-variants/WorktreeOrchestrator.js +4 -643
  11. package/dist/agent-variants/WorktreeOrchestrator.testHelpers.d.ts +0 -7
  12. package/dist/agent-variants/WorktreeOrchestrator.testHelpers.js +0 -34
  13. package/dist/agent-variants/contracts.d.ts +0 -60
  14. package/dist/agent-variants/contracts.js +1 -8
  15. package/dist/agent-variants/index.d.ts +1 -1
  16. package/dist/agent-variants/runPlan.d.ts +0 -2
  17. package/dist/agent-variants/runPlan.js +0 -3
  18. package/dist/agent-variants/variant-project-runtime.d.ts +0 -2
  19. package/dist/agent-variants/variantWorkspaceFiles.d.ts +0 -3
  20. package/dist/agent-variants/variantWorkspaceFiles.js +1 -59
  21. package/dist/agent-variants/variantsTelemetry.d.ts +0 -8
  22. package/dist/cli/commands/mcpServe.d.ts +2 -2
  23. package/dist/cli/commands/mcpServe.js +1 -0
  24. package/dist/cli/commands/variants.js +2 -43
  25. package/dist/cli/router.js +3 -2
  26. package/dist/config/flags.d.ts +0 -3
  27. package/dist/config/flags.js +0 -1
  28. package/dist/config/pluginMetrics.js +0 -4
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +20 -8
  31. package/dist/install/mcpRegistration.js +1 -0
  32. package/dist/mcp/explorationTools.js +0 -17
  33. package/dist/routes/account.js +4 -2
  34. package/dist/routes/agentVariants.js +1 -89
  35. package/dist/routes/library/browserAccess.d.ts +3 -1
  36. package/dist/routes/library/browserAccess.js +5 -3
  37. package/dist/routes/library/index.js +1 -0
  38. package/dist/services/AuthService.js +2 -2
  39. package/dist/services/ConfigManager.d.ts +18 -1
  40. package/dist/services/ConfigManager.js +91 -4
  41. package/dist/services/SessionBridgeService.d.ts +0 -2
  42. package/dist/services/SessionBridgeService.js +0 -26
  43. package/dist/services/TelemetryService.d.ts +4 -15
  44. package/dist/services/TelemetryService.js +29 -33
  45. package/dist/services/VariantRunService.d.ts +0 -5
  46. package/dist/services/VariantRunService.js +0 -3
  47. package/dist/services/WorktreeManager.d.ts +0 -3
  48. package/dist/services/WorktreeManager.js +7 -54
  49. package/dist/services/createAgentVariantsOrchestrator.js +0 -1
  50. package/dist/services/profiles/DesignProfiles.js +4 -3
  51. package/dist/utils/skills/claude-skill.d.ts +1 -1
  52. package/dist/utils/skills/claude-skill.js +1 -1
  53. package/dist/utils/skills/cli-guidance.d.ts +1 -1
  54. package/dist/utils/skills/cli-guidance.js +6 -8
  55. package/dist/utils/skills/cursor-rules.d.ts +1 -1
  56. package/dist/utils/skills/cursor-rules.js +1 -1
  57. package/package.json +3 -3
  58. package/src/ui/dist/assets/{LibraryEntry-BJl_pPMq.js → LibraryEntry-CFkd6v_O.js} +9 -9
  59. package/src/ui/dist/assets/main-B_jie9r3.js +439 -0
  60. package/src/ui/dist/index.html +1 -1
  61. package/dist/agent-variants/createProjectArtifacts.d.ts +0 -61
  62. package/dist/agent-variants/createProjectArtifacts.js +0 -113
  63. package/src/ui/dist/assets/main-D1832qVC.js +0 -439
@@ -56,23 +56,6 @@ const registerExplorationTools = (dependencies) => {
56
56
  callerAgent: dependencies.callerAgent,
57
57
  callerModel: (0, callerModel_1.callerModelArgsFromToolMeta)(extra._meta)[1],
58
58
  }));
59
- (0, intentTool_1.registerIntentTool)(dependencies, {
60
- name: 'rivet_apply_design',
61
- title: 'Apply chosen design',
62
- description: 'Apply the explicitly selected direction to the project working tree. Writes or replaces project files; generated applications may install dependencies and start a dev server, executing local code and contacting package registries. Only use after the user selects this result. Does not generate a different design.',
63
- shape: {
64
- project: intentTool_1.requiredText,
65
- sessionId: intentTool_1.requiredText,
66
- variantId: intentTool_1.requiredText,
67
- },
68
- annotations: intentTool_1.externalChange,
69
- }, async (input) => runCommand('variants', [
70
- 'commit',
71
- input.variantId,
72
- '--session',
73
- input.sessionId,
74
- ...projectArgs(input.project),
75
- ]));
76
59
  (0, intentTool_1.registerIntentTool)(dependencies, {
77
60
  name: 'rivet_cancel_exploration',
78
61
  title: 'Cancel exploration',
@@ -27,8 +27,9 @@ const createAccountRouter = (telemetry) => {
27
27
  const config = (0, ConfigManager_1.getConfigManager)();
28
28
  config.setAuth(token, email, refreshToken, userId);
29
29
  const carriedInstallRef = (0, installRef_1.parseInstallRef)(installRef);
30
- if (carriedInstallRef)
31
- config.clearInstallRef(carriedInstallRef);
30
+ if (carriedInstallRef) {
31
+ config.completeInstallRefSignIn(carriedInstallRef, config.getUserId());
32
+ }
32
33
  }
33
34
  catch {
34
35
  return res
@@ -36,6 +37,7 @@ const createAccountRouter = (telemetry) => {
36
37
  .json({ error: 'Failed to store auth credentials' });
37
38
  }
38
39
  telemetry?.identifyUser();
40
+ telemetry?.reportInstallRefActivations();
39
41
  log.info(`Stored auth for ${email} via browser OAuth`);
40
42
  res.json({ success: true });
41
43
  });
@@ -48,9 +48,6 @@ const previewPortBody = v3_1.z.object({
48
48
  variantId: v3_1.z.string().min(1).nullable(),
49
49
  retry: v3_1.z.boolean().optional(),
50
50
  });
51
- const commitBody = v3_1.z.object({
52
- variantId: v3_1.z.string().min(1),
53
- });
54
51
  const adoptPastBody = v3_1.z.object({
55
52
  pastSessionId: v3_1.z.string().min(1),
56
53
  pastVariantId: v3_1.z.string().min(1),
@@ -1679,92 +1676,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1679
1676
  sendError(res, err);
1680
1677
  }
1681
1678
  });
1682
- postOperation('/variants/:sessionId/commit', async (req, res) => {
1683
- if (rejectNonLocalRequest(req, res))
1684
- return;
1685
- const sessionId = req.params.sessionId;
1686
- const flags = await (0, evaluateFlags_1.getFeatureFlags)({
1687
- userKey: (0, featureFlagUserKey_1.getConfigFeatureFlagUserKey)({ headers: req.headers }),
1688
- });
1689
- if (!flags.variantSend.isEnabled) {
1690
- res.status(403).json({
1691
- errorCode: 'FEATURE_DISABLED',
1692
- message: 'Variant send is not enabled.',
1693
- });
1694
- return;
1695
- }
1696
- const parsed = commitBody.safeParse(req.body);
1697
- if (!parsed.success) {
1698
- res.status(400).json({
1699
- errorCode: 'SCHEMA_VALIDATION_FAILED',
1700
- message: parsed.error.message,
1701
- });
1702
- return;
1703
- }
1704
- try {
1705
- const projectContext = orchestrator.getProjectContext(sessionId);
1706
- const isFresh = projectContext.kind === 'fresh';
1707
- const result = await orchestrator.commitVariant({
1708
- sessionId,
1709
- variantId: parsed.data.variantId,
1710
- skipTeardown: isFresh,
1711
- });
1712
- if (result.enqueued &&
1713
- result.payloadKind === 'project-created' &&
1714
- isFresh) {
1715
- if (!bridge || !result.destinationPath) {
1716
- variantsTelemetry?.trackAgentVariantsActiveProjectTransition({
1717
- sessionId,
1718
- success: false,
1719
- reasonCode: 'bridge_unavailable',
1720
- destinationPath: result.destinationPath ?? null,
1721
- });
1722
- res.status(503).json({
1723
- errorCode: 'RUNTIME_VALIDATION_FAILED',
1724
- message: 'Variant sent, but active-project transition is unavailable. Keep this session open and run open_visual_editor on the destination project.',
1725
- destinationPath: result.destinationPath ?? null,
1726
- });
1727
- return;
1728
- }
1729
- try {
1730
- bridge.rebindProjectPath(result.destinationPath);
1731
- await orchestrator.cleanupCommittedSession(sessionId);
1732
- variantsTelemetry?.trackAgentVariantsActiveProjectTransition({
1733
- sessionId,
1734
- success: true,
1735
- reasonCode: 'rebind_succeeded',
1736
- destinationPath: result.destinationPath,
1737
- });
1738
- }
1739
- catch {
1740
- variantsTelemetry?.trackAgentVariantsActiveProjectTransition({
1741
- sessionId,
1742
- success: false,
1743
- reasonCode: 'rebind_failed',
1744
- destinationPath: result.destinationPath,
1745
- });
1746
- res.status(500).json({
1747
- errorCode: 'RUNTIME_VALIDATION_FAILED',
1748
- message: 'Variant sent, but active-project handoff failed. Destination project is preserved; keep this variants session open and retry send.',
1749
- destinationPath: result.destinationPath,
1750
- });
1751
- return;
1752
- }
1753
- }
1754
- else if (bridge && result.enqueued) {
1755
- try {
1756
- bridge.switchPreviewPort(null);
1757
- }
1758
- catch (err) {
1759
- log.warn('switchPreviewPort(null) after commit failed', err);
1760
- }
1761
- }
1762
- res.json(result);
1763
- }
1764
- catch (err) {
1765
- sendError(res, err);
1766
- }
1767
- });
1768
1679
  postOperation('/variants/:sessionId/deploy', async (req, res) => {
1769
1680
  if (rejectNonLocalRequest(req, res))
1770
1681
  return;
@@ -2138,6 +2049,7 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2138
2049
  sendError(res, err);
2139
2050
  }
2140
2051
  });
2052
+ router.use('/variants', (_req, res) => res.sendStatus(404));
2141
2053
  return router;
2142
2054
  };
2143
2055
  exports.createAgentVariantsRouter = createAgentVariantsRouter;
@@ -1,7 +1,9 @@
1
1
  import { Router } from 'express';
2
2
  import { BrowserSessions } from '../../library/BrowserSessions';
3
- export declare const createBrowserAccessRouter: ({ token, sessions, }: {
3
+ import type { TelemetryService } from '../../services/TelemetryService';
4
+ export declare const createBrowserAccessRouter: ({ token, sessions, telemetry, }: {
4
5
  token: string;
5
6
  sessions: BrowserSessions;
7
+ telemetry?: Pick<TelemetryService, "reportInstallRefActivations">;
6
8
  }) => Router;
7
9
  //# sourceMappingURL=browserAccess.d.ts.map
@@ -14,7 +14,7 @@ const signInBody = zod_1.z.object({
14
14
  refreshToken: zod_1.z.string().optional(),
15
15
  installRef: zod_1.z.string().optional(),
16
16
  });
17
- const createBrowserAccessRouter = ({ token, sessions, }) => {
17
+ const createBrowserAccessRouter = ({ token, sessions, telemetry, }) => {
18
18
  const router = (0, express_1.Router)();
19
19
  router.post('/browser-sessions', (0, express_1.json)({ limit: '8kb' }), async (req, res) => {
20
20
  if (!(0, middleware_1.isLocalBrowserRequest)(req))
@@ -39,8 +39,10 @@ const createBrowserAccessRouter = ({ token, sessions, }) => {
39
39
  userId: profile.userId,
40
40
  });
41
41
  const carriedInstallRef = (0, installRef_1.parseInstallRef)(parsed.data.installRef);
42
- if (carriedInstallRef)
43
- sessions.config.clearInstallRef(carriedInstallRef);
42
+ if (carriedInstallRef) {
43
+ sessions.config.completeInstallRefSignIn(carriedInstallRef, profile.userId);
44
+ }
45
+ telemetry?.reportInstallRefActivations();
44
46
  return res.json({ token: browserToken });
45
47
  });
46
48
  router.post('/browser-sessions/exchange', (0, express_1.json)({ limit: '8kb' }), (req, res) => {
@@ -38,6 +38,7 @@ const createLibraryRouter = (options) => {
38
38
  router.use((0, browserAccess_1.createBrowserAccessRouter)({
39
39
  token: options.token,
40
40
  sessions: options.browserSessions,
41
+ telemetry: options.telemetry,
41
42
  }));
42
43
  router.get('/health', (0, middleware_1.authenticateLibrary)(options.token), (_req, res) => res.json({
43
44
  pid: process.pid,
@@ -403,7 +403,7 @@ class AuthService {
403
403
  if (tokenResult.success && tokenResult.token && tokenResult.user) {
404
404
  this.configManager.setAuth(tokenResult.token, tokenResult.user.email, tokenResult.refreshToken, tokenResult.user.id, { expectedGeneration, isRecovery: true });
405
405
  if (installRef) {
406
- this.configManager.clearInstallRef(installRef);
406
+ this.configManager.completeInstallRefSignIn(installRef, tokenResult.user.id);
407
407
  }
408
408
  log.info(`Logged in as ${tokenResult.user.email}`);
409
409
  }
@@ -530,7 +530,7 @@ class AuthService {
530
530
  (0, pendingLogin_1.clearPendingLogin)();
531
531
  this.configManager.setAuth(tokenResult.token, tokenResult.user.email, tokenResult.refreshToken, tokenResult.user.id, { expectedGeneration: pending.generation, isRecovery: true });
532
532
  if (pending.installRef) {
533
- this.configManager.clearInstallRef(pending.installRef);
533
+ this.configManager.completeInstallRefSignIn(pending.installRef, tokenResult.user.id);
534
534
  }
535
535
  log.info(`Logged in as ${tokenResult.user.email} (resumed login)`);
536
536
  return tokenResult;
@@ -3,6 +3,20 @@ export interface AccountIdentity {
3
3
  userId?: string;
4
4
  email?: string;
5
5
  }
6
+ export type InstallRefActivationTrigger = 'first_run' | 'sign_in';
7
+ export type InstallRefActivation = {
8
+ installRef: string;
9
+ trigger: InstallRefActivationTrigger;
10
+ downloadType?: string;
11
+ userId?: string;
12
+ };
13
+ type InstallRefActivationRecord = {
14
+ installRef: string;
15
+ downloadType?: string;
16
+ signInUserId?: string;
17
+ pendingTriggers: InstallRefActivationTrigger[];
18
+ reportedTriggers: InstallRefActivationTrigger[];
19
+ };
6
20
  type RivetConfig = {
7
21
  authToken?: string;
8
22
  refreshToken?: string;
@@ -21,6 +35,7 @@ type RivetConfig = {
21
35
  workerVendorFallback?: boolean;
22
36
  workerModels?: Partial<Record<'claude' | 'codex' | 'cursor', string>>;
23
37
  installRef?: string;
38
+ installRefActivations?: InstallRefActivationRecord[];
24
39
  };
25
40
  interface ConfigManagerOptions {
26
41
  configPath?: string;
@@ -65,8 +80,10 @@ export declare class ConfigManager {
65
80
  markFirstVariantsRun(): void;
66
81
  claimMcpRemovedTelemetryWindow(now?: Date): boolean;
67
82
  getInstallRef(): string | undefined;
68
- setInstallRef(installRef: string): void;
83
+ setInstallRef(installRef: string, downloadType?: string): void;
69
84
  clearInstallRef(installRef: string): void;
85
+ completeInstallRefSignIn(installRef: string, userId: string | undefined): void;
86
+ claimInstallRefActivations(): InstallRefActivation[];
70
87
  getProxyUrl(): string;
71
88
  getConfiguredRunner(): string | undefined;
72
89
  getConfiguredRunnerPaths(): Record<string, unknown> | undefined;
@@ -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.reloadConfigFromDisk();
285
- this.config.installRef = installRef;
286
- this.saveConfig();
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;
@@ -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
- track(event: string, properties?: Record<string, unknown>): void;
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
- track(event, properties = {}) {
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 = account
214
- ? (account.userId ?? (0, ConfigManager_1.getConfigManager)().getPluginTelemetryId())
215
- : this.distinctId;
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
  }