rivet-design 0.9.3 → 0.9.5

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 (105) hide show
  1. package/dist/mcp/agent-variants/SessionStore.d.ts +26 -10
  2. package/dist/mcp/agent-variants/SessionStore.d.ts.map +1 -1
  3. package/dist/mcp/agent-variants/SessionStore.js +189 -44
  4. package/dist/mcp/agent-variants/SessionStore.js.map +1 -1
  5. package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts +209 -13
  6. package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts.map +1 -1
  7. package/dist/mcp/agent-variants/WorktreeOrchestrator.js +1489 -61
  8. package/dist/mcp/agent-variants/WorktreeOrchestrator.js.map +1 -1
  9. package/dist/mcp/agent-variants/WorktreeOrchestrator.testHelpers.d.ts +65 -0
  10. package/dist/mcp/agent-variants/WorktreeOrchestrator.testHelpers.d.ts.map +1 -0
  11. package/dist/mcp/agent-variants/WorktreeOrchestrator.testHelpers.js +162 -0
  12. package/dist/mcp/agent-variants/WorktreeOrchestrator.testHelpers.js.map +1 -0
  13. package/dist/mcp/agent-variants/contracts.d.ts +1576 -64
  14. package/dist/mcp/agent-variants/contracts.d.ts.map +1 -1
  15. package/dist/mcp/agent-variants/contracts.js +202 -9
  16. package/dist/mcp/agent-variants/contracts.js.map +1 -1
  17. package/dist/mcp/agent-variants/createProjectArtifacts.d.ts +78 -0
  18. package/dist/mcp/agent-variants/createProjectArtifacts.d.ts.map +1 -0
  19. package/dist/mcp/agent-variants/createProjectArtifacts.js +123 -0
  20. package/dist/mcp/agent-variants/createProjectArtifacts.js.map +1 -0
  21. package/dist/mcp/agent-variants/createZeroToOneTool.d.ts +67 -25
  22. package/dist/mcp/agent-variants/createZeroToOneTool.d.ts.map +1 -1
  23. package/dist/mcp/agent-variants/createZeroToOneTool.js +60 -126
  24. package/dist/mcp/agent-variants/createZeroToOneTool.js.map +1 -1
  25. package/dist/mcp/agent-variants/errors.d.ts +1 -1
  26. package/dist/mcp/agent-variants/errors.d.ts.map +1 -1
  27. package/dist/mcp/agent-variants/errors.js +1 -0
  28. package/dist/mcp/agent-variants/errors.js.map +1 -1
  29. package/dist/mcp/agent-variants/index.d.ts +3 -4
  30. package/dist/mcp/agent-variants/index.d.ts.map +1 -1
  31. package/dist/mcp/agent-variants/index.js +2 -2
  32. package/dist/mcp/agent-variants/index.js.map +1 -1
  33. package/dist/mcp/agent-variants/inspirationDesignContext.d.ts +10 -0
  34. package/dist/mcp/agent-variants/inspirationDesignContext.d.ts.map +1 -1
  35. package/dist/mcp/agent-variants/inspirationDesignContext.js +104 -16
  36. package/dist/mcp/agent-variants/inspirationDesignContext.js.map +1 -1
  37. package/dist/mcp/agent-variants/pendingChangesAdapter.d.ts.map +1 -1
  38. package/dist/mcp/agent-variants/pendingChangesAdapter.js +11 -0
  39. package/dist/mcp/agent-variants/pendingChangesAdapter.js.map +1 -1
  40. package/dist/mcp/agent-variants/previewQa.d.ts +61 -0
  41. package/dist/mcp/agent-variants/previewQa.d.ts.map +1 -0
  42. package/dist/mcp/agent-variants/previewQa.js +374 -0
  43. package/dist/mcp/agent-variants/previewQa.js.map +1 -0
  44. package/dist/mcp/agent-variants/sourceContext.d.ts +1 -0
  45. package/dist/mcp/agent-variants/sourceContext.d.ts.map +1 -1
  46. package/dist/mcp/agent-variants/sourceContext.js +28 -3
  47. package/dist/mcp/agent-variants/sourceContext.js.map +1 -1
  48. package/dist/mcp/agent-variants/tools.d.ts +40 -3
  49. package/dist/mcp/agent-variants/tools.d.ts.map +1 -1
  50. package/dist/mcp/agent-variants/tools.js +262 -38
  51. package/dist/mcp/agent-variants/tools.js.map +1 -1
  52. package/dist/mcp/server.d.ts.map +1 -1
  53. package/dist/mcp/server.js +32 -7
  54. package/dist/mcp/server.js.map +1 -1
  55. package/dist/prompts/agentModPrompts.d.ts.map +1 -1
  56. package/dist/prompts/agentModPrompts.js +11 -10
  57. package/dist/prompts/agentModPrompts.js.map +1 -1
  58. package/dist/proxy-middleware/proxy-config.d.ts +2 -2
  59. package/dist/proxy-middleware/proxy-config.d.ts.map +1 -1
  60. package/dist/proxy-middleware/proxy-config.js +66 -22
  61. package/dist/proxy-middleware/proxy-config.js.map +1 -1
  62. package/dist/routes/agentVariants.d.ts +2 -13
  63. package/dist/routes/agentVariants.d.ts.map +1 -1
  64. package/dist/routes/agentVariants.js +156 -2
  65. package/dist/routes/agentVariants.js.map +1 -1
  66. package/dist/server.d.ts.map +1 -1
  67. package/dist/server.js +79 -4
  68. package/dist/server.js.map +1 -1
  69. package/dist/services/ProjectDetectionService.d.ts.map +1 -1
  70. package/dist/services/ProjectDetectionService.js +21 -0
  71. package/dist/services/ProjectDetectionService.js.map +1 -1
  72. package/dist/services/VariantHistoryService.d.ts +117 -0
  73. package/dist/services/VariantHistoryService.d.ts.map +1 -0
  74. package/dist/services/VariantHistoryService.js +385 -0
  75. package/dist/services/VariantHistoryService.js.map +1 -0
  76. package/dist/services/WorktreeManager.d.ts +67 -9
  77. package/dist/services/WorktreeManager.d.ts.map +1 -1
  78. package/dist/services/WorktreeManager.js +209 -26
  79. package/dist/services/WorktreeManager.js.map +1 -1
  80. package/dist/services/agent/AgentCore.d.ts +1 -1
  81. package/dist/services/agent/AgentCore.d.ts.map +1 -1
  82. package/dist/services/agent/AgentCore.js +24 -1
  83. package/dist/services/agent/AgentCore.js.map +1 -1
  84. package/dist/services/agent/AgentModService.d.ts +1 -1
  85. package/dist/services/agent/AgentModService.js +7 -7
  86. package/dist/services/agent/AgentModService.js.map +1 -1
  87. package/dist/services/templates/viteReactTs.d.ts +6 -0
  88. package/dist/services/templates/viteReactTs.d.ts.map +1 -1
  89. package/dist/services/templates/viteReactTs.js +8 -1
  90. package/dist/services/templates/viteReactTs.js.map +1 -1
  91. package/dist/types/change-request-types.d.ts +14 -0
  92. package/dist/types/change-request-types.d.ts.map +1 -1
  93. package/dist/utils/skills/claude-skill.d.ts +1 -1
  94. package/dist/utils/skills/claude-skill.js +2 -2
  95. package/dist/utils/skills/cursor-rules.d.ts +1 -1
  96. package/dist/utils/skills/cursor-rules.js +1 -1
  97. package/dist/utils/skills/shared-variants-protocol.d.ts +1 -1
  98. package/dist/utils/skills/shared-variants-protocol.d.ts.map +1 -1
  99. package/dist/utils/skills/shared-variants-protocol.js +31 -32
  100. package/dist/utils/skills/shared-variants-protocol.js.map +1 -1
  101. package/package.json +4 -5
  102. package/src/ui/dist/assets/main-OdmwI8Od.css +1 -0
  103. package/src/ui/dist/assets/{main-DejhsBWR.js → main-SuZlKEi0.js} +115 -115
  104. package/src/ui/dist/index.html +2 -2
  105. package/src/ui/dist/assets/main-C9jfEp80.css +0 -1
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod/v3';
2
2
  import { ERROR_CODES, type ErrorCode } from './errors';
3
- export declare const STAGES: readonly ["awaiting_source_research", "awaiting_briefs", "awaiting_approval", "work_items_ready", "waiting_for_results", "ready", "degraded", "failed", "cancelled"];
3
+ export declare const STAGES: readonly ["awaiting_source_plan", "awaiting_briefs", "awaiting_approval", "work_items_ready", "waiting_for_results", "ready", "degraded", "failed", "cancelled"];
4
4
  export type Stage = (typeof STAGES)[number];
5
5
  export declare const TERMINAL_STAGES: ReadonlySet<Stage>;
6
- export declare const WORK_ITEM_KINDS: readonly ["source_research", "brief", "scaffold_base", "static_preview", "code_gen", "cleanup_runtime"];
6
+ export declare const WORK_ITEM_KINDS: readonly ["source_plan", "brief", "scaffold_base", "static_preview", "code_gen", "cleanup_runtime"];
7
7
  export type WorkItemKind = (typeof WORK_ITEM_KINDS)[number];
8
8
  export declare const WORK_ITEM_STATUSES: readonly ["pending", "running", "succeeded", "failed", "cancelled"];
9
9
  export type WorkItemStatus = (typeof WORK_ITEM_STATUSES)[number];
@@ -44,6 +44,60 @@ export declare const projectContextExisting: z.ZodObject<{
44
44
  }, {
45
45
  kind: "existing";
46
46
  }>;
47
+ export declare const sourceIntentRoleSchema: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
48
+ export declare const sourceIntentConfidenceSchema: z.ZodEnum<["low", "medium", "high"]>;
49
+ export declare const sourceIntentEntrySchema: z.ZodObject<{
50
+ url: z.ZodString;
51
+ role: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
52
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
53
+ reason: z.ZodString;
54
+ }, "strip", z.ZodTypeAny, {
55
+ reason: string;
56
+ url: string;
57
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
58
+ confidence: "low" | "medium" | "high";
59
+ }, {
60
+ reason: string;
61
+ url: string;
62
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
63
+ confidence: "low" | "medium" | "high";
64
+ }>;
65
+ export declare const sourceIntentArtifactSchema: z.ZodObject<{
66
+ sources: z.ZodArray<z.ZodObject<{
67
+ url: z.ZodString;
68
+ role: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
69
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
70
+ reason: z.ZodString;
71
+ }, "strip", z.ZodTypeAny, {
72
+ reason: string;
73
+ url: string;
74
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
75
+ confidence: "low" | "medium" | "high";
76
+ }, {
77
+ reason: string;
78
+ url: string;
79
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
80
+ confidence: "low" | "medium" | "high";
81
+ }>, "many">;
82
+ }, "strip", z.ZodTypeAny, {
83
+ sources: {
84
+ reason: string;
85
+ url: string;
86
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
87
+ confidence: "low" | "medium" | "high";
88
+ }[];
89
+ }, {
90
+ sources: {
91
+ reason: string;
92
+ url: string;
93
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
94
+ confidence: "low" | "medium" | "high";
95
+ }[];
96
+ }>;
97
+ export type SourceIntentRole = z.infer<typeof sourceIntentRoleSchema>;
98
+ export type SourceIntentConfidence = z.infer<typeof sourceIntentConfidenceSchema>;
99
+ export type SourceIntentEntry = z.infer<typeof sourceIntentEntrySchema>;
100
+ export type SourceIntentArtifact = z.infer<typeof sourceIntentArtifactSchema>;
47
101
  export declare const designContextEntrySchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
48
102
  kind: z.ZodLiteral<"slug">;
49
103
  slug: z.ZodString;
@@ -59,12 +113,12 @@ export declare const designContextEntrySchema: z.ZodDiscriminatedUnion<"kind", [
59
113
  label: z.ZodString;
60
114
  }, "strip", z.ZodTypeAny, {
61
115
  kind: "markdown";
62
- content: string;
63
116
  label: string;
117
+ content: string;
64
118
  }, {
65
119
  kind: "markdown";
66
- content: string;
67
120
  label: string;
121
+ content: string;
68
122
  }>]>;
69
123
  export declare const sourceArtifactKindSchema: z.ZodEnum<["urlText", "siteBrief", "visualBrief", "screenshotNotes"]>;
70
124
  export declare const sourceArtifactInputSchema: z.ZodObject<{
@@ -73,12 +127,12 @@ export declare const sourceArtifactInputSchema: z.ZodObject<{
73
127
  content: z.ZodString;
74
128
  }, "strip", z.ZodTypeAny, {
75
129
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
76
- content: string;
77
130
  label: string;
131
+ content: string;
78
132
  }, {
79
133
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
80
- content: string;
81
134
  label: string;
135
+ content: string;
82
136
  }>;
83
137
  export declare const sourceRoleSchema: z.ZodEnum<["primary", "inspiration", "competitor"]>;
84
138
  export declare const sourceRoleEntrySchema: z.ZodObject<{
@@ -148,12 +202,12 @@ export declare const sourceContextInputSchema: z.ZodObject<{
148
202
  content: z.ZodString;
149
203
  }, "strip", z.ZodTypeAny, {
150
204
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
151
- content: string;
152
205
  label: string;
206
+ content: string;
153
207
  }, {
154
208
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
155
- content: string;
156
209
  label: string;
210
+ content: string;
157
211
  }>, "many">>;
158
212
  artifact: z.ZodOptional<z.ZodObject<{
159
213
  sourceFindings: z.ZodArray<z.ZodString, "many">;
@@ -200,14 +254,46 @@ export declare const sourceContextInputSchema: z.ZodObject<{
200
254
  screenshotReferences?: string[] | undefined;
201
255
  risks?: string[] | undefined;
202
256
  }>>;
257
+ sourceIntent: z.ZodOptional<z.ZodObject<{
258
+ sources: z.ZodArray<z.ZodObject<{
259
+ url: z.ZodString;
260
+ role: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
261
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
262
+ reason: z.ZodString;
263
+ }, "strip", z.ZodTypeAny, {
264
+ reason: string;
265
+ url: string;
266
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
267
+ confidence: "low" | "medium" | "high";
268
+ }, {
269
+ reason: string;
270
+ url: string;
271
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
272
+ confidence: "low" | "medium" | "high";
273
+ }>, "many">;
274
+ }, "strip", z.ZodTypeAny, {
275
+ sources: {
276
+ reason: string;
277
+ url: string;
278
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
279
+ confidence: "low" | "medium" | "high";
280
+ }[];
281
+ }, {
282
+ sources: {
283
+ reason: string;
284
+ url: string;
285
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
286
+ confidence: "low" | "medium" | "high";
287
+ }[];
288
+ }>>;
203
289
  designDecision: z.ZodOptional<z.ZodEnum<["let_rivet_choose", "go_custom"]>>;
204
290
  }, "strip", z.ZodTypeAny, {
205
291
  sourceUrls?: string[] | undefined;
206
292
  preserveBrand?: boolean | undefined;
207
293
  sourceArtifacts?: {
208
294
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
209
- content: string;
210
295
  label: string;
296
+ content: string;
211
297
  }[] | undefined;
212
298
  artifact?: {
213
299
  sourceFindings: string[];
@@ -222,14 +308,22 @@ export declare const sourceContextInputSchema: z.ZodObject<{
222
308
  screenshotReferences?: string[] | undefined;
223
309
  risks?: string[] | undefined;
224
310
  } | undefined;
311
+ sourceIntent?: {
312
+ sources: {
313
+ reason: string;
314
+ url: string;
315
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
316
+ confidence: "low" | "medium" | "high";
317
+ }[];
318
+ } | undefined;
225
319
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
226
320
  }, {
227
321
  sourceUrls?: string[] | undefined;
228
322
  preserveBrand?: boolean | undefined;
229
323
  sourceArtifacts?: {
230
324
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
231
- content: string;
232
325
  label: string;
326
+ content: string;
233
327
  }[] | undefined;
234
328
  artifact?: {
235
329
  sourceFindings: string[];
@@ -244,12 +338,99 @@ export declare const sourceContextInputSchema: z.ZodObject<{
244
338
  screenshotReferences?: string[] | undefined;
245
339
  risks?: string[] | undefined;
246
340
  } | undefined;
341
+ sourceIntent?: {
342
+ sources: {
343
+ reason: string;
344
+ url: string;
345
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
346
+ confidence: "low" | "medium" | "high";
347
+ }[];
348
+ } | undefined;
247
349
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
248
350
  }>;
351
+ export declare const executionModeSchema: z.ZodEnum<["static_preview", "vite_app"]>;
352
+ export declare const executionConfidenceSchema: z.ZodEnum<["low", "medium", "high"]>;
353
+ /**
354
+ * One file to copy from an absolute disk path into the generated project.
355
+ * `destination` is project-relative (e.g. `public/assets/avatar.glb`);
356
+ * `referenceAs` is the served path the generated code should use (e.g.
357
+ * `/assets/avatar.glb`). The agent decides asset routing at planning time
358
+ * so MCP can materialize the same layout for every variant.
359
+ */
360
+ export declare const assetPlanEntrySchema: z.ZodObject<{
361
+ source: z.ZodString;
362
+ destination: z.ZodString;
363
+ referenceAs: z.ZodString;
364
+ }, "strip", z.ZodTypeAny, {
365
+ source: string;
366
+ destination: string;
367
+ referenceAs: string;
368
+ }, {
369
+ source: string;
370
+ destination: string;
371
+ referenceAs: string;
372
+ }>;
373
+ export declare const executionCapabilityPlanSchema: z.ZodObject<{
374
+ mode: z.ZodEnum<["static_preview", "vite_app"]>;
375
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
376
+ reason: z.ZodString;
377
+ assetPlan: z.ZodOptional<z.ZodArray<z.ZodObject<{
378
+ source: z.ZodString;
379
+ destination: z.ZodString;
380
+ referenceAs: z.ZodString;
381
+ }, "strip", z.ZodTypeAny, {
382
+ source: string;
383
+ destination: string;
384
+ referenceAs: string;
385
+ }, {
386
+ source: string;
387
+ destination: string;
388
+ referenceAs: string;
389
+ }>, "many">>;
390
+ runtimeRequirements: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
391
+ userQuestion: z.ZodOptional<z.ZodString>;
392
+ }, "strip", z.ZodTypeAny, {
393
+ mode: "static_preview" | "vite_app";
394
+ reason: string;
395
+ confidence: "low" | "medium" | "high";
396
+ assetPlan?: {
397
+ source: string;
398
+ destination: string;
399
+ referenceAs: string;
400
+ }[] | undefined;
401
+ runtimeRequirements?: string[] | undefined;
402
+ userQuestion?: string | undefined;
403
+ }, {
404
+ mode: "static_preview" | "vite_app";
405
+ reason: string;
406
+ confidence: "low" | "medium" | "high";
407
+ assetPlan?: {
408
+ source: string;
409
+ destination: string;
410
+ referenceAs: string;
411
+ }[] | undefined;
412
+ runtimeRequirements?: string[] | undefined;
413
+ userQuestion?: string | undefined;
414
+ }>;
415
+ export type ExecutionMode = z.infer<typeof executionModeSchema>;
416
+ export type ExecutionConfidence = z.infer<typeof executionConfidenceSchema>;
417
+ export type AssetPlanEntry = z.infer<typeof assetPlanEntrySchema>;
418
+ export type ExecutionCapabilityPlan = z.infer<typeof executionCapabilityPlanSchema>;
249
419
  export declare const projectContextFresh: z.ZodObject<{
250
420
  kind: z.ZodLiteral<"fresh">;
421
+ /** Where the generated subproject's files live (e.g.
422
+ * `fable-eng-demo/.rivet/marketing-clone/`). This is the materialize
423
+ * target — the agent reads/writes index.html, src/, etc. here. */
251
424
  workspacePath: z.ZodString;
425
+ /** The user's working directory that owns *all* Rivet artifacts for the
426
+ * session (e.g. `fable-eng-demo`). `<workspaceRoot>/.rivet/` holds
427
+ * generated subprojects, variant history, and create-project manifests.
428
+ * Distinct from `path.dirname(workspacePath)` because subprojects nest
429
+ * inside `.rivet/` — the dirname would resolve to the `.rivet` dir,
430
+ * not the workspace itself. */
431
+ workspaceRoot: z.ZodString;
252
432
  framework: z.ZodOptional<z.ZodEnum<["vite", "next", "astro", "remix"]>>;
433
+ assetSourceRoot: z.ZodOptional<z.ZodString>;
253
434
  /** Per-variant-slot design context. Slug entries resolve bundled catalog
254
435
  * markdown; markdown entries are written directly as `DESIGN.md`. The
255
436
  * order matches code-gen variant slot order. */
@@ -268,12 +449,12 @@ export declare const projectContextFresh: z.ZodObject<{
268
449
  label: z.ZodString;
269
450
  }, "strip", z.ZodTypeAny, {
270
451
  kind: "markdown";
271
- content: string;
272
452
  label: string;
453
+ content: string;
273
454
  }, {
274
455
  kind: "markdown";
275
- content: string;
276
456
  label: string;
457
+ content: string;
277
458
  }>]>, "many">>;
278
459
  sourceContext: z.ZodOptional<z.ZodObject<{
279
460
  sourceUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -284,12 +465,12 @@ export declare const projectContextFresh: z.ZodObject<{
284
465
  content: z.ZodString;
285
466
  }, "strip", z.ZodTypeAny, {
286
467
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
287
- content: string;
288
468
  label: string;
469
+ content: string;
289
470
  }, {
290
471
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
291
- content: string;
292
472
  label: string;
473
+ content: string;
293
474
  }>, "many">>;
294
475
  artifact: z.ZodOptional<z.ZodObject<{
295
476
  sourceFindings: z.ZodArray<z.ZodString, "many">;
@@ -336,14 +517,46 @@ export declare const projectContextFresh: z.ZodObject<{
336
517
  screenshotReferences?: string[] | undefined;
337
518
  risks?: string[] | undefined;
338
519
  }>>;
520
+ sourceIntent: z.ZodOptional<z.ZodObject<{
521
+ sources: z.ZodArray<z.ZodObject<{
522
+ url: z.ZodString;
523
+ role: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
524
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
525
+ reason: z.ZodString;
526
+ }, "strip", z.ZodTypeAny, {
527
+ reason: string;
528
+ url: string;
529
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
530
+ confidence: "low" | "medium" | "high";
531
+ }, {
532
+ reason: string;
533
+ url: string;
534
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
535
+ confidence: "low" | "medium" | "high";
536
+ }>, "many">;
537
+ }, "strip", z.ZodTypeAny, {
538
+ sources: {
539
+ reason: string;
540
+ url: string;
541
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
542
+ confidence: "low" | "medium" | "high";
543
+ }[];
544
+ }, {
545
+ sources: {
546
+ reason: string;
547
+ url: string;
548
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
549
+ confidence: "low" | "medium" | "high";
550
+ }[];
551
+ }>>;
339
552
  designDecision: z.ZodOptional<z.ZodEnum<["let_rivet_choose", "go_custom"]>>;
340
553
  }, "strip", z.ZodTypeAny, {
341
554
  sourceUrls?: string[] | undefined;
342
555
  preserveBrand?: boolean | undefined;
343
556
  sourceArtifacts?: {
344
557
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
345
- content: string;
346
558
  label: string;
559
+ content: string;
347
560
  }[] | undefined;
348
561
  artifact?: {
349
562
  sourceFindings: string[];
@@ -358,14 +571,22 @@ export declare const projectContextFresh: z.ZodObject<{
358
571
  screenshotReferences?: string[] | undefined;
359
572
  risks?: string[] | undefined;
360
573
  } | undefined;
574
+ sourceIntent?: {
575
+ sources: {
576
+ reason: string;
577
+ url: string;
578
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
579
+ confidence: "low" | "medium" | "high";
580
+ }[];
581
+ } | undefined;
361
582
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
362
583
  }, {
363
584
  sourceUrls?: string[] | undefined;
364
585
  preserveBrand?: boolean | undefined;
365
586
  sourceArtifacts?: {
366
587
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
367
- content: string;
368
588
  label: string;
589
+ content: string;
369
590
  }[] | undefined;
370
591
  artifact?: {
371
592
  sourceFindings: string[];
@@ -380,27 +601,83 @@ export declare const projectContextFresh: z.ZodObject<{
380
601
  screenshotReferences?: string[] | undefined;
381
602
  risks?: string[] | undefined;
382
603
  } | undefined;
604
+ sourceIntent?: {
605
+ sources: {
606
+ reason: string;
607
+ url: string;
608
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
609
+ confidence: "low" | "medium" | "high";
610
+ }[];
611
+ } | undefined;
383
612
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
384
613
  }>>;
614
+ /** Agent-supplied execution plan from `report_source_plan`. Drives the
615
+ * generation routing decision at approve() time: `static_preview` keeps
616
+ * the lightweight HTML-only path; `vite_app` provisions a real Vite
617
+ * worktree per variant and copies any large assets from `assetPlan`. */
618
+ executionPlan: z.ZodOptional<z.ZodObject<{
619
+ mode: z.ZodEnum<["static_preview", "vite_app"]>;
620
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
621
+ reason: z.ZodString;
622
+ assetPlan: z.ZodOptional<z.ZodArray<z.ZodObject<{
623
+ source: z.ZodString;
624
+ destination: z.ZodString;
625
+ referenceAs: z.ZodString;
626
+ }, "strip", z.ZodTypeAny, {
627
+ source: string;
628
+ destination: string;
629
+ referenceAs: string;
630
+ }, {
631
+ source: string;
632
+ destination: string;
633
+ referenceAs: string;
634
+ }>, "many">>;
635
+ runtimeRequirements: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
636
+ userQuestion: z.ZodOptional<z.ZodString>;
637
+ }, "strip", z.ZodTypeAny, {
638
+ mode: "static_preview" | "vite_app";
639
+ reason: string;
640
+ confidence: "low" | "medium" | "high";
641
+ assetPlan?: {
642
+ source: string;
643
+ destination: string;
644
+ referenceAs: string;
645
+ }[] | undefined;
646
+ runtimeRequirements?: string[] | undefined;
647
+ userQuestion?: string | undefined;
648
+ }, {
649
+ mode: "static_preview" | "vite_app";
650
+ reason: string;
651
+ confidence: "low" | "medium" | "high";
652
+ assetPlan?: {
653
+ source: string;
654
+ destination: string;
655
+ referenceAs: string;
656
+ }[] | undefined;
657
+ runtimeRequirements?: string[] | undefined;
658
+ userQuestion?: string | undefined;
659
+ }>>;
385
660
  }, "strip", z.ZodTypeAny, {
386
661
  kind: "fresh";
387
662
  workspacePath: string;
663
+ workspaceRoot: string;
388
664
  framework?: "next" | "vite" | "remix" | "astro" | undefined;
665
+ assetSourceRoot?: string | undefined;
389
666
  designContext?: ({
390
667
  slug: string;
391
668
  kind: "slug";
392
669
  } | {
393
670
  kind: "markdown";
394
- content: string;
395
671
  label: string;
672
+ content: string;
396
673
  })[] | undefined;
397
674
  sourceContext?: {
398
675
  sourceUrls?: string[] | undefined;
399
676
  preserveBrand?: boolean | undefined;
400
677
  sourceArtifacts?: {
401
678
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
402
- content: string;
403
679
  label: string;
680
+ content: string;
404
681
  }[] | undefined;
405
682
  artifact?: {
406
683
  sourceFindings: string[];
@@ -415,27 +692,49 @@ export declare const projectContextFresh: z.ZodObject<{
415
692
  screenshotReferences?: string[] | undefined;
416
693
  risks?: string[] | undefined;
417
694
  } | undefined;
695
+ sourceIntent?: {
696
+ sources: {
697
+ reason: string;
698
+ url: string;
699
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
700
+ confidence: "low" | "medium" | "high";
701
+ }[];
702
+ } | undefined;
418
703
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
419
704
  } | undefined;
705
+ executionPlan?: {
706
+ mode: "static_preview" | "vite_app";
707
+ reason: string;
708
+ confidence: "low" | "medium" | "high";
709
+ assetPlan?: {
710
+ source: string;
711
+ destination: string;
712
+ referenceAs: string;
713
+ }[] | undefined;
714
+ runtimeRequirements?: string[] | undefined;
715
+ userQuestion?: string | undefined;
716
+ } | undefined;
420
717
  }, {
421
718
  kind: "fresh";
422
719
  workspacePath: string;
720
+ workspaceRoot: string;
423
721
  framework?: "next" | "vite" | "remix" | "astro" | undefined;
722
+ assetSourceRoot?: string | undefined;
424
723
  designContext?: ({
425
724
  slug: string;
426
725
  kind: "slug";
427
726
  } | {
428
727
  kind: "markdown";
429
- content: string;
430
728
  label: string;
729
+ content: string;
431
730
  })[] | undefined;
432
731
  sourceContext?: {
433
732
  sourceUrls?: string[] | undefined;
434
733
  preserveBrand?: boolean | undefined;
435
734
  sourceArtifacts?: {
436
735
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
437
- content: string;
438
736
  label: string;
737
+ content: string;
439
738
  }[] | undefined;
440
739
  artifact?: {
441
740
  sourceFindings: string[];
@@ -450,8 +749,28 @@ export declare const projectContextFresh: z.ZodObject<{
450
749
  screenshotReferences?: string[] | undefined;
451
750
  risks?: string[] | undefined;
452
751
  } | undefined;
752
+ sourceIntent?: {
753
+ sources: {
754
+ reason: string;
755
+ url: string;
756
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
757
+ confidence: "low" | "medium" | "high";
758
+ }[];
759
+ } | undefined;
453
760
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
454
761
  } | undefined;
762
+ executionPlan?: {
763
+ mode: "static_preview" | "vite_app";
764
+ reason: string;
765
+ confidence: "low" | "medium" | "high";
766
+ assetPlan?: {
767
+ source: string;
768
+ destination: string;
769
+ referenceAs: string;
770
+ }[] | undefined;
771
+ runtimeRequirements?: string[] | undefined;
772
+ userQuestion?: string | undefined;
773
+ } | undefined;
455
774
  }>;
456
775
  export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
457
776
  kind: z.ZodLiteral<"existing">;
@@ -461,8 +780,19 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
461
780
  kind: "existing";
462
781
  }>, z.ZodObject<{
463
782
  kind: z.ZodLiteral<"fresh">;
783
+ /** Where the generated subproject's files live (e.g.
784
+ * `fable-eng-demo/.rivet/marketing-clone/`). This is the materialize
785
+ * target — the agent reads/writes index.html, src/, etc. here. */
464
786
  workspacePath: z.ZodString;
787
+ /** The user's working directory that owns *all* Rivet artifacts for the
788
+ * session (e.g. `fable-eng-demo`). `<workspaceRoot>/.rivet/` holds
789
+ * generated subprojects, variant history, and create-project manifests.
790
+ * Distinct from `path.dirname(workspacePath)` because subprojects nest
791
+ * inside `.rivet/` — the dirname would resolve to the `.rivet` dir,
792
+ * not the workspace itself. */
793
+ workspaceRoot: z.ZodString;
465
794
  framework: z.ZodOptional<z.ZodEnum<["vite", "next", "astro", "remix"]>>;
795
+ assetSourceRoot: z.ZodOptional<z.ZodString>;
466
796
  /** Per-variant-slot design context. Slug entries resolve bundled catalog
467
797
  * markdown; markdown entries are written directly as `DESIGN.md`. The
468
798
  * order matches code-gen variant slot order. */
@@ -481,12 +811,12 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
481
811
  label: z.ZodString;
482
812
  }, "strip", z.ZodTypeAny, {
483
813
  kind: "markdown";
484
- content: string;
485
814
  label: string;
815
+ content: string;
486
816
  }, {
487
817
  kind: "markdown";
488
- content: string;
489
818
  label: string;
819
+ content: string;
490
820
  }>]>, "many">>;
491
821
  sourceContext: z.ZodOptional<z.ZodObject<{
492
822
  sourceUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -497,12 +827,12 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
497
827
  content: z.ZodString;
498
828
  }, "strip", z.ZodTypeAny, {
499
829
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
500
- content: string;
501
830
  label: string;
831
+ content: string;
502
832
  }, {
503
833
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
504
- content: string;
505
834
  label: string;
835
+ content: string;
506
836
  }>, "many">>;
507
837
  artifact: z.ZodOptional<z.ZodObject<{
508
838
  sourceFindings: z.ZodArray<z.ZodString, "many">;
@@ -549,14 +879,46 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
549
879
  screenshotReferences?: string[] | undefined;
550
880
  risks?: string[] | undefined;
551
881
  }>>;
882
+ sourceIntent: z.ZodOptional<z.ZodObject<{
883
+ sources: z.ZodArray<z.ZodObject<{
884
+ url: z.ZodString;
885
+ role: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
886
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
887
+ reason: z.ZodString;
888
+ }, "strip", z.ZodTypeAny, {
889
+ reason: string;
890
+ url: string;
891
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
892
+ confidence: "low" | "medium" | "high";
893
+ }, {
894
+ reason: string;
895
+ url: string;
896
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
897
+ confidence: "low" | "medium" | "high";
898
+ }>, "many">;
899
+ }, "strip", z.ZodTypeAny, {
900
+ sources: {
901
+ reason: string;
902
+ url: string;
903
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
904
+ confidence: "low" | "medium" | "high";
905
+ }[];
906
+ }, {
907
+ sources: {
908
+ reason: string;
909
+ url: string;
910
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
911
+ confidence: "low" | "medium" | "high";
912
+ }[];
913
+ }>>;
552
914
  designDecision: z.ZodOptional<z.ZodEnum<["let_rivet_choose", "go_custom"]>>;
553
915
  }, "strip", z.ZodTypeAny, {
554
916
  sourceUrls?: string[] | undefined;
555
917
  preserveBrand?: boolean | undefined;
556
918
  sourceArtifacts?: {
557
919
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
558
- content: string;
559
920
  label: string;
921
+ content: string;
560
922
  }[] | undefined;
561
923
  artifact?: {
562
924
  sourceFindings: string[];
@@ -571,14 +933,22 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
571
933
  screenshotReferences?: string[] | undefined;
572
934
  risks?: string[] | undefined;
573
935
  } | undefined;
936
+ sourceIntent?: {
937
+ sources: {
938
+ reason: string;
939
+ url: string;
940
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
941
+ confidence: "low" | "medium" | "high";
942
+ }[];
943
+ } | undefined;
574
944
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
575
945
  }, {
576
946
  sourceUrls?: string[] | undefined;
577
947
  preserveBrand?: boolean | undefined;
578
948
  sourceArtifacts?: {
579
949
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
580
- content: string;
581
950
  label: string;
951
+ content: string;
582
952
  }[] | undefined;
583
953
  artifact?: {
584
954
  sourceFindings: string[];
@@ -593,27 +963,83 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
593
963
  screenshotReferences?: string[] | undefined;
594
964
  risks?: string[] | undefined;
595
965
  } | undefined;
966
+ sourceIntent?: {
967
+ sources: {
968
+ reason: string;
969
+ url: string;
970
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
971
+ confidence: "low" | "medium" | "high";
972
+ }[];
973
+ } | undefined;
596
974
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
597
975
  }>>;
976
+ /** Agent-supplied execution plan from `report_source_plan`. Drives the
977
+ * generation routing decision at approve() time: `static_preview` keeps
978
+ * the lightweight HTML-only path; `vite_app` provisions a real Vite
979
+ * worktree per variant and copies any large assets from `assetPlan`. */
980
+ executionPlan: z.ZodOptional<z.ZodObject<{
981
+ mode: z.ZodEnum<["static_preview", "vite_app"]>;
982
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
983
+ reason: z.ZodString;
984
+ assetPlan: z.ZodOptional<z.ZodArray<z.ZodObject<{
985
+ source: z.ZodString;
986
+ destination: z.ZodString;
987
+ referenceAs: z.ZodString;
988
+ }, "strip", z.ZodTypeAny, {
989
+ source: string;
990
+ destination: string;
991
+ referenceAs: string;
992
+ }, {
993
+ source: string;
994
+ destination: string;
995
+ referenceAs: string;
996
+ }>, "many">>;
997
+ runtimeRequirements: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
998
+ userQuestion: z.ZodOptional<z.ZodString>;
999
+ }, "strip", z.ZodTypeAny, {
1000
+ mode: "static_preview" | "vite_app";
1001
+ reason: string;
1002
+ confidence: "low" | "medium" | "high";
1003
+ assetPlan?: {
1004
+ source: string;
1005
+ destination: string;
1006
+ referenceAs: string;
1007
+ }[] | undefined;
1008
+ runtimeRequirements?: string[] | undefined;
1009
+ userQuestion?: string | undefined;
1010
+ }, {
1011
+ mode: "static_preview" | "vite_app";
1012
+ reason: string;
1013
+ confidence: "low" | "medium" | "high";
1014
+ assetPlan?: {
1015
+ source: string;
1016
+ destination: string;
1017
+ referenceAs: string;
1018
+ }[] | undefined;
1019
+ runtimeRequirements?: string[] | undefined;
1020
+ userQuestion?: string | undefined;
1021
+ }>>;
598
1022
  }, "strip", z.ZodTypeAny, {
599
1023
  kind: "fresh";
600
1024
  workspacePath: string;
1025
+ workspaceRoot: string;
601
1026
  framework?: "next" | "vite" | "remix" | "astro" | undefined;
1027
+ assetSourceRoot?: string | undefined;
602
1028
  designContext?: ({
603
1029
  slug: string;
604
1030
  kind: "slug";
605
1031
  } | {
606
1032
  kind: "markdown";
607
- content: string;
608
1033
  label: string;
1034
+ content: string;
609
1035
  })[] | undefined;
610
1036
  sourceContext?: {
611
1037
  sourceUrls?: string[] | undefined;
612
1038
  preserveBrand?: boolean | undefined;
613
1039
  sourceArtifacts?: {
614
1040
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
615
- content: string;
616
1041
  label: string;
1042
+ content: string;
617
1043
  }[] | undefined;
618
1044
  artifact?: {
619
1045
  sourceFindings: string[];
@@ -628,27 +1054,49 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
628
1054
  screenshotReferences?: string[] | undefined;
629
1055
  risks?: string[] | undefined;
630
1056
  } | undefined;
1057
+ sourceIntent?: {
1058
+ sources: {
1059
+ reason: string;
1060
+ url: string;
1061
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1062
+ confidence: "low" | "medium" | "high";
1063
+ }[];
1064
+ } | undefined;
631
1065
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
632
1066
  } | undefined;
1067
+ executionPlan?: {
1068
+ mode: "static_preview" | "vite_app";
1069
+ reason: string;
1070
+ confidence: "low" | "medium" | "high";
1071
+ assetPlan?: {
1072
+ source: string;
1073
+ destination: string;
1074
+ referenceAs: string;
1075
+ }[] | undefined;
1076
+ runtimeRequirements?: string[] | undefined;
1077
+ userQuestion?: string | undefined;
1078
+ } | undefined;
633
1079
  }, {
634
1080
  kind: "fresh";
635
1081
  workspacePath: string;
1082
+ workspaceRoot: string;
636
1083
  framework?: "next" | "vite" | "remix" | "astro" | undefined;
1084
+ assetSourceRoot?: string | undefined;
637
1085
  designContext?: ({
638
1086
  slug: string;
639
1087
  kind: "slug";
640
1088
  } | {
641
1089
  kind: "markdown";
642
- content: string;
643
1090
  label: string;
1091
+ content: string;
644
1092
  })[] | undefined;
645
1093
  sourceContext?: {
646
1094
  sourceUrls?: string[] | undefined;
647
1095
  preserveBrand?: boolean | undefined;
648
1096
  sourceArtifacts?: {
649
1097
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
650
- content: string;
651
1098
  label: string;
1099
+ content: string;
652
1100
  }[] | undefined;
653
1101
  artifact?: {
654
1102
  sourceFindings: string[];
@@ -663,8 +1111,28 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
663
1111
  screenshotReferences?: string[] | undefined;
664
1112
  risks?: string[] | undefined;
665
1113
  } | undefined;
1114
+ sourceIntent?: {
1115
+ sources: {
1116
+ reason: string;
1117
+ url: string;
1118
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1119
+ confidence: "low" | "medium" | "high";
1120
+ }[];
1121
+ } | undefined;
666
1122
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
667
1123
  } | undefined;
1124
+ executionPlan?: {
1125
+ mode: "static_preview" | "vite_app";
1126
+ reason: string;
1127
+ confidence: "low" | "medium" | "high";
1128
+ assetPlan?: {
1129
+ source: string;
1130
+ destination: string;
1131
+ referenceAs: string;
1132
+ }[] | undefined;
1133
+ runtimeRequirements?: string[] | undefined;
1134
+ userQuestion?: string | undefined;
1135
+ } | undefined;
668
1136
  }>]>;
669
1137
  export type ProjectContext = z.infer<typeof projectContextSchema>;
670
1138
  export type DesignContextEntry = z.infer<typeof designContextEntrySchema>;
@@ -692,6 +1160,7 @@ export type ActiveProjectContext = {
692
1160
  } | {
693
1161
  kind: 'fresh';
694
1162
  workspacePath: string;
1163
+ workspaceRoot: string;
695
1164
  framework?: 'vite' | 'next' | 'astro' | 'remix';
696
1165
  designContext?: Array<{
697
1166
  kind: 'slug';
@@ -704,6 +1173,15 @@ export type ActiveProjectContext = {
704
1173
  sourceCount: number;
705
1174
  isSourceGrounded: boolean;
706
1175
  };
1176
+ /** Compact summary of the agent's execution plan, suitable for chip /
1177
+ * artifact rendering. The full plan stays on the project context. */
1178
+ executionPlan?: {
1179
+ mode: ExecutionMode;
1180
+ confidence: ExecutionConfidence;
1181
+ reason: string;
1182
+ assetCount: number;
1183
+ runtimeRequirementCount: number;
1184
+ };
707
1185
  };
708
1186
  export interface ActiveVariantActions {
709
1187
  view?: {
@@ -725,6 +1203,68 @@ export interface ActiveVariantSnapshot {
725
1203
  port?: number;
726
1204
  errorCode?: string;
727
1205
  actions?: ActiveVariantActions;
1206
+ /**
1207
+ * Objective post-generation QA verdict. Present once the orchestrator has
1208
+ * run preview QA against the variant's deliverable (asset reachability,
1209
+ * runtime/console health). Surfaced on the chip so the user can see why
1210
+ * a variant is not committable. `not_run` indicates QA has not yet been
1211
+ * exercised for this variant kind (e.g. existing-project `code_gen`).
1212
+ */
1213
+ qa?: VariantQaResult;
1214
+ }
1215
+ /**
1216
+ * Kinds of supporting artifact a variants session can surface to the UI.
1217
+ * `design_context` is the only kind populated today (the DESIGN.md used or
1218
+ * generated for a 0→1 run); the other kinds reserve shape for source
1219
+ * research bundles, QA reports, and persisted asset manifests so the
1220
+ * snapshot contract stays stable as those land.
1221
+ */
1222
+ export declare const VARIANT_ARTIFACT_KINDS: readonly ["design_context", "source_context", "qa_report", "asset"];
1223
+ export type VariantArtifactKind = (typeof VARIANT_ARTIFACT_KINDS)[number];
1224
+ export type VariantArtifactStatus = 'ready' | 'warning' | 'failed';
1225
+ export type VariantArtifactSource = 'agent_browser' | 'cache' | 'static' | 'manual';
1226
+ export type VariantArtifactContentType = 'text/markdown' | 'application/json' | 'text/plain';
1227
+ /**
1228
+ * Stable, transport-safe shape for one supporting artifact attached to a
1229
+ * variants session. For `design_context` artifacts the full markdown
1230
+ * content is required (the UI renders it inline); other kinds may omit
1231
+ * `content` and surface metadata only.
1232
+ */
1233
+ export interface VariantSessionArtifact {
1234
+ id: string;
1235
+ kind: VariantArtifactKind;
1236
+ label: string;
1237
+ summary?: string;
1238
+ usedByVariantCount?: number;
1239
+ status?: VariantArtifactStatus;
1240
+ source?: VariantArtifactSource;
1241
+ contentType?: VariantArtifactContentType;
1242
+ content?: string;
1243
+ path?: string;
1244
+ warnings?: string[];
1245
+ }
1246
+ export type VariantQaStatus = 'passed' | 'failed' | 'not_run';
1247
+ /**
1248
+ * Categorical QA failure mode. Mirrors the failure surfaces the gate
1249
+ * checks for static previews — referenced assets that fail to load, code
1250
+ * that throws on initial render, or a preview document that couldn't be
1251
+ * fetched at all. Kept small so the user-facing prompt can stay legible.
1252
+ */
1253
+ export type VariantQaIssueKind = 'asset_load_failed' | 'console_error' | 'preview_unavailable';
1254
+ export interface VariantQaIssue {
1255
+ kind: VariantQaIssueKind;
1256
+ /** Asset URL or runtime source location that triggered the failure. */
1257
+ detail: string;
1258
+ /** Optional human-readable extra context — e.g. HTTP status, error message. */
1259
+ message?: string;
1260
+ }
1261
+ export interface VariantQaResult {
1262
+ status: VariantQaStatus;
1263
+ issues: VariantQaIssue[];
1264
+ /** Compact, user-facing summary suitable for chip + prompt rendering. */
1265
+ summary: string;
1266
+ /** Source of the inspected preview (the URL or marker the runner used). */
1267
+ checkedSource?: string;
728
1268
  }
729
1269
  export declare const targetSchema: z.ZodObject<{
730
1270
  type: z.ZodEnum<["element", "file", "route"]>;
@@ -741,14 +1281,21 @@ export declare const briefSchema: z.ZodObject<{
741
1281
  briefId: z.ZodString;
742
1282
  label: z.ZodString;
743
1283
  body: z.ZodString;
1284
+ /**
1285
+ * Optional per-brief visual reference URL. Uses the same synchronous
1286
+ * network-target guard as inspiration URLs before downstream agents fetch it.
1287
+ */
1288
+ visualReferenceUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
744
1289
  }, "strip", z.ZodTypeAny, {
745
1290
  label: string;
746
- briefId: string;
747
1291
  body: string;
1292
+ briefId: string;
1293
+ visualReferenceUrl?: string | undefined;
748
1294
  }, {
749
1295
  label: string;
750
- briefId: string;
751
1296
  body: string;
1297
+ briefId: string;
1298
+ visualReferenceUrl?: string | undefined;
752
1299
  }>;
753
1300
  export type Brief = z.infer<typeof briefSchema>;
754
1301
  /**
@@ -782,8 +1329,19 @@ export declare const proposeVariantsInput: {
782
1329
  kind: "existing";
783
1330
  }>, z.ZodObject<{
784
1331
  kind: z.ZodLiteral<"fresh">;
1332
+ /** Where the generated subproject's files live (e.g.
1333
+ * `fable-eng-demo/.rivet/marketing-clone/`). This is the materialize
1334
+ * target — the agent reads/writes index.html, src/, etc. here. */
785
1335
  workspacePath: z.ZodString;
1336
+ /** The user's working directory that owns *all* Rivet artifacts for the
1337
+ * session (e.g. `fable-eng-demo`). `<workspaceRoot>/.rivet/` holds
1338
+ * generated subprojects, variant history, and create-project manifests.
1339
+ * Distinct from `path.dirname(workspacePath)` because subprojects nest
1340
+ * inside `.rivet/` — the dirname would resolve to the `.rivet` dir,
1341
+ * not the workspace itself. */
1342
+ workspaceRoot: z.ZodString;
786
1343
  framework: z.ZodOptional<z.ZodEnum<["vite", "next", "astro", "remix"]>>;
1344
+ assetSourceRoot: z.ZodOptional<z.ZodString>;
787
1345
  /** Per-variant-slot design context. Slug entries resolve bundled catalog
788
1346
  * markdown; markdown entries are written directly as `DESIGN.md`. The
789
1347
  * order matches code-gen variant slot order. */
@@ -802,12 +1360,12 @@ export declare const proposeVariantsInput: {
802
1360
  label: z.ZodString;
803
1361
  }, "strip", z.ZodTypeAny, {
804
1362
  kind: "markdown";
805
- content: string;
806
1363
  label: string;
1364
+ content: string;
807
1365
  }, {
808
1366
  kind: "markdown";
809
- content: string;
810
1367
  label: string;
1368
+ content: string;
811
1369
  }>]>, "many">>;
812
1370
  sourceContext: z.ZodOptional<z.ZodObject<{
813
1371
  sourceUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -818,12 +1376,12 @@ export declare const proposeVariantsInput: {
818
1376
  content: z.ZodString;
819
1377
  }, "strip", z.ZodTypeAny, {
820
1378
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
821
- content: string;
822
1379
  label: string;
1380
+ content: string;
823
1381
  }, {
824
1382
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
825
- content: string;
826
1383
  label: string;
1384
+ content: string;
827
1385
  }>, "many">>;
828
1386
  artifact: z.ZodOptional<z.ZodObject<{
829
1387
  sourceFindings: z.ZodArray<z.ZodString, "many">;
@@ -870,14 +1428,46 @@ export declare const proposeVariantsInput: {
870
1428
  screenshotReferences?: string[] | undefined;
871
1429
  risks?: string[] | undefined;
872
1430
  }>>;
1431
+ sourceIntent: z.ZodOptional<z.ZodObject<{
1432
+ sources: z.ZodArray<z.ZodObject<{
1433
+ url: z.ZodString;
1434
+ role: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
1435
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
1436
+ reason: z.ZodString;
1437
+ }, "strip", z.ZodTypeAny, {
1438
+ reason: string;
1439
+ url: string;
1440
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1441
+ confidence: "low" | "medium" | "high";
1442
+ }, {
1443
+ reason: string;
1444
+ url: string;
1445
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1446
+ confidence: "low" | "medium" | "high";
1447
+ }>, "many">;
1448
+ }, "strip", z.ZodTypeAny, {
1449
+ sources: {
1450
+ reason: string;
1451
+ url: string;
1452
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1453
+ confidence: "low" | "medium" | "high";
1454
+ }[];
1455
+ }, {
1456
+ sources: {
1457
+ reason: string;
1458
+ url: string;
1459
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1460
+ confidence: "low" | "medium" | "high";
1461
+ }[];
1462
+ }>>;
873
1463
  designDecision: z.ZodOptional<z.ZodEnum<["let_rivet_choose", "go_custom"]>>;
874
1464
  }, "strip", z.ZodTypeAny, {
875
1465
  sourceUrls?: string[] | undefined;
876
1466
  preserveBrand?: boolean | undefined;
877
1467
  sourceArtifacts?: {
878
1468
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
879
- content: string;
880
1469
  label: string;
1470
+ content: string;
881
1471
  }[] | undefined;
882
1472
  artifact?: {
883
1473
  sourceFindings: string[];
@@ -892,14 +1482,22 @@ export declare const proposeVariantsInput: {
892
1482
  screenshotReferences?: string[] | undefined;
893
1483
  risks?: string[] | undefined;
894
1484
  } | undefined;
1485
+ sourceIntent?: {
1486
+ sources: {
1487
+ reason: string;
1488
+ url: string;
1489
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1490
+ confidence: "low" | "medium" | "high";
1491
+ }[];
1492
+ } | undefined;
895
1493
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
896
1494
  }, {
897
1495
  sourceUrls?: string[] | undefined;
898
1496
  preserveBrand?: boolean | undefined;
899
1497
  sourceArtifacts?: {
900
1498
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
901
- content: string;
902
1499
  label: string;
1500
+ content: string;
903
1501
  }[] | undefined;
904
1502
  artifact?: {
905
1503
  sourceFindings: string[];
@@ -914,27 +1512,83 @@ export declare const proposeVariantsInput: {
914
1512
  screenshotReferences?: string[] | undefined;
915
1513
  risks?: string[] | undefined;
916
1514
  } | undefined;
1515
+ sourceIntent?: {
1516
+ sources: {
1517
+ reason: string;
1518
+ url: string;
1519
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1520
+ confidence: "low" | "medium" | "high";
1521
+ }[];
1522
+ } | undefined;
917
1523
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
918
1524
  }>>;
1525
+ /** Agent-supplied execution plan from `report_source_plan`. Drives the
1526
+ * generation routing decision at approve() time: `static_preview` keeps
1527
+ * the lightweight HTML-only path; `vite_app` provisions a real Vite
1528
+ * worktree per variant and copies any large assets from `assetPlan`. */
1529
+ executionPlan: z.ZodOptional<z.ZodObject<{
1530
+ mode: z.ZodEnum<["static_preview", "vite_app"]>;
1531
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
1532
+ reason: z.ZodString;
1533
+ assetPlan: z.ZodOptional<z.ZodArray<z.ZodObject<{
1534
+ source: z.ZodString;
1535
+ destination: z.ZodString;
1536
+ referenceAs: z.ZodString;
1537
+ }, "strip", z.ZodTypeAny, {
1538
+ source: string;
1539
+ destination: string;
1540
+ referenceAs: string;
1541
+ }, {
1542
+ source: string;
1543
+ destination: string;
1544
+ referenceAs: string;
1545
+ }>, "many">>;
1546
+ runtimeRequirements: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1547
+ userQuestion: z.ZodOptional<z.ZodString>;
1548
+ }, "strip", z.ZodTypeAny, {
1549
+ mode: "static_preview" | "vite_app";
1550
+ reason: string;
1551
+ confidence: "low" | "medium" | "high";
1552
+ assetPlan?: {
1553
+ source: string;
1554
+ destination: string;
1555
+ referenceAs: string;
1556
+ }[] | undefined;
1557
+ runtimeRequirements?: string[] | undefined;
1558
+ userQuestion?: string | undefined;
1559
+ }, {
1560
+ mode: "static_preview" | "vite_app";
1561
+ reason: string;
1562
+ confidence: "low" | "medium" | "high";
1563
+ assetPlan?: {
1564
+ source: string;
1565
+ destination: string;
1566
+ referenceAs: string;
1567
+ }[] | undefined;
1568
+ runtimeRequirements?: string[] | undefined;
1569
+ userQuestion?: string | undefined;
1570
+ }>>;
919
1571
  }, "strip", z.ZodTypeAny, {
920
1572
  kind: "fresh";
921
1573
  workspacePath: string;
1574
+ workspaceRoot: string;
922
1575
  framework?: "next" | "vite" | "remix" | "astro" | undefined;
1576
+ assetSourceRoot?: string | undefined;
923
1577
  designContext?: ({
924
1578
  slug: string;
925
1579
  kind: "slug";
926
1580
  } | {
927
1581
  kind: "markdown";
928
- content: string;
929
1582
  label: string;
1583
+ content: string;
930
1584
  })[] | undefined;
931
1585
  sourceContext?: {
932
1586
  sourceUrls?: string[] | undefined;
933
1587
  preserveBrand?: boolean | undefined;
934
1588
  sourceArtifacts?: {
935
1589
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
936
- content: string;
937
1590
  label: string;
1591
+ content: string;
938
1592
  }[] | undefined;
939
1593
  artifact?: {
940
1594
  sourceFindings: string[];
@@ -949,27 +1603,49 @@ export declare const proposeVariantsInput: {
949
1603
  screenshotReferences?: string[] | undefined;
950
1604
  risks?: string[] | undefined;
951
1605
  } | undefined;
1606
+ sourceIntent?: {
1607
+ sources: {
1608
+ reason: string;
1609
+ url: string;
1610
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1611
+ confidence: "low" | "medium" | "high";
1612
+ }[];
1613
+ } | undefined;
952
1614
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
953
1615
  } | undefined;
1616
+ executionPlan?: {
1617
+ mode: "static_preview" | "vite_app";
1618
+ reason: string;
1619
+ confidence: "low" | "medium" | "high";
1620
+ assetPlan?: {
1621
+ source: string;
1622
+ destination: string;
1623
+ referenceAs: string;
1624
+ }[] | undefined;
1625
+ runtimeRequirements?: string[] | undefined;
1626
+ userQuestion?: string | undefined;
1627
+ } | undefined;
954
1628
  }, {
955
1629
  kind: "fresh";
956
1630
  workspacePath: string;
1631
+ workspaceRoot: string;
957
1632
  framework?: "next" | "vite" | "remix" | "astro" | undefined;
1633
+ assetSourceRoot?: string | undefined;
958
1634
  designContext?: ({
959
1635
  slug: string;
960
1636
  kind: "slug";
961
1637
  } | {
962
1638
  kind: "markdown";
963
- content: string;
964
1639
  label: string;
1640
+ content: string;
965
1641
  })[] | undefined;
966
1642
  sourceContext?: {
967
1643
  sourceUrls?: string[] | undefined;
968
1644
  preserveBrand?: boolean | undefined;
969
1645
  sourceArtifacts?: {
970
1646
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
971
- content: string;
972
1647
  label: string;
1648
+ content: string;
973
1649
  }[] | undefined;
974
1650
  artifact?: {
975
1651
  sourceFindings: string[];
@@ -984,8 +1660,28 @@ export declare const proposeVariantsInput: {
984
1660
  screenshotReferences?: string[] | undefined;
985
1661
  risks?: string[] | undefined;
986
1662
  } | undefined;
1663
+ sourceIntent?: {
1664
+ sources: {
1665
+ reason: string;
1666
+ url: string;
1667
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1668
+ confidence: "low" | "medium" | "high";
1669
+ }[];
1670
+ } | undefined;
987
1671
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
988
1672
  } | undefined;
1673
+ executionPlan?: {
1674
+ mode: "static_preview" | "vite_app";
1675
+ reason: string;
1676
+ confidence: "low" | "medium" | "high";
1677
+ assetPlan?: {
1678
+ source: string;
1679
+ destination: string;
1680
+ referenceAs: string;
1681
+ }[] | undefined;
1682
+ runtimeRequirements?: string[] | undefined;
1683
+ userQuestion?: string | undefined;
1684
+ } | undefined;
989
1685
  }>]>>;
990
1686
  };
991
1687
  export type ProposeVariantsInput = {
@@ -1005,21 +1701,77 @@ export declare const reportVariantBriefsInput: {
1005
1701
  briefId: z.ZodString;
1006
1702
  label: z.ZodString;
1007
1703
  body: z.ZodString;
1704
+ /**
1705
+ * Optional per-brief visual reference URL. Uses the same synchronous
1706
+ * network-target guard as inspiration URLs before downstream agents fetch it.
1707
+ */
1708
+ visualReferenceUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1008
1709
  }, "strip", z.ZodTypeAny, {
1009
1710
  label: string;
1010
- briefId: string;
1011
1711
  body: string;
1712
+ briefId: string;
1713
+ visualReferenceUrl?: string | undefined;
1012
1714
  }, {
1013
1715
  label: string;
1014
- briefId: string;
1015
1716
  body: string;
1717
+ briefId: string;
1718
+ visualReferenceUrl?: string | undefined;
1016
1719
  }>, "many">;
1017
1720
  };
1018
- export declare const reportSourceContextInput: {
1019
- sessionId: z.ZodString;
1020
- workItemId: z.ZodString;
1021
- attempt: z.ZodNumber;
1022
- leaseId: z.ZodString;
1721
+ declare const browserDesignContextSchema: z.ZodObject<{
1722
+ url: z.ZodString;
1723
+ label: z.ZodString;
1724
+ markdown: z.ZodString;
1725
+ }, "strip", z.ZodTypeAny, {
1726
+ markdown: string;
1727
+ url: string;
1728
+ label: string;
1729
+ }, {
1730
+ markdown: string;
1731
+ url: string;
1732
+ label: string;
1733
+ }>;
1734
+ /**
1735
+ * Consolidated planning artifact reported by the agent in a single tool call.
1736
+ * Combines URL/role classification, research findings, browser-extracted
1737
+ * DESIGN.md per design_source URL, and the static_preview vs vite_app
1738
+ * execution decision. Replaces the prior `report_source_intent` +
1739
+ * `report_source_context` round-trips so source-grounded sessions only need
1740
+ * one planning hop before briefs.
1741
+ */
1742
+ export declare const sourcePlanArtifactSchema: z.ZodObject<{
1743
+ sourceIntent: z.ZodObject<{
1744
+ sources: z.ZodArray<z.ZodObject<{
1745
+ url: z.ZodString;
1746
+ role: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
1747
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
1748
+ reason: z.ZodString;
1749
+ }, "strip", z.ZodTypeAny, {
1750
+ reason: string;
1751
+ url: string;
1752
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1753
+ confidence: "low" | "medium" | "high";
1754
+ }, {
1755
+ reason: string;
1756
+ url: string;
1757
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1758
+ confidence: "low" | "medium" | "high";
1759
+ }>, "many">;
1760
+ }, "strip", z.ZodTypeAny, {
1761
+ sources: {
1762
+ reason: string;
1763
+ url: string;
1764
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1765
+ confidence: "low" | "medium" | "high";
1766
+ }[];
1767
+ }, {
1768
+ sources: {
1769
+ reason: string;
1770
+ url: string;
1771
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1772
+ confidence: "low" | "medium" | "high";
1773
+ }[];
1774
+ }>;
1023
1775
  sourceContext: z.ZodObject<{
1024
1776
  sourceFindings: z.ZodArray<z.ZodString, "many">;
1025
1777
  sectionInventory: z.ZodArray<z.ZodString, "many">;
@@ -1065,14 +1817,374 @@ export declare const reportSourceContextInput: {
1065
1817
  screenshotReferences?: string[] | undefined;
1066
1818
  risks?: string[] | undefined;
1067
1819
  }>;
1820
+ designContexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
1821
+ url: z.ZodString;
1822
+ label: z.ZodString;
1823
+ markdown: z.ZodString;
1824
+ }, "strip", z.ZodTypeAny, {
1825
+ markdown: string;
1826
+ url: string;
1827
+ label: string;
1828
+ }, {
1829
+ markdown: string;
1830
+ url: string;
1831
+ label: string;
1832
+ }>, "many">>;
1833
+ executionPlan: z.ZodObject<{
1834
+ mode: z.ZodEnum<["static_preview", "vite_app"]>;
1835
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
1836
+ reason: z.ZodString;
1837
+ assetPlan: z.ZodOptional<z.ZodArray<z.ZodObject<{
1838
+ source: z.ZodString;
1839
+ destination: z.ZodString;
1840
+ referenceAs: z.ZodString;
1841
+ }, "strip", z.ZodTypeAny, {
1842
+ source: string;
1843
+ destination: string;
1844
+ referenceAs: string;
1845
+ }, {
1846
+ source: string;
1847
+ destination: string;
1848
+ referenceAs: string;
1849
+ }>, "many">>;
1850
+ runtimeRequirements: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1851
+ userQuestion: z.ZodOptional<z.ZodString>;
1852
+ }, "strip", z.ZodTypeAny, {
1853
+ mode: "static_preview" | "vite_app";
1854
+ reason: string;
1855
+ confidence: "low" | "medium" | "high";
1856
+ assetPlan?: {
1857
+ source: string;
1858
+ destination: string;
1859
+ referenceAs: string;
1860
+ }[] | undefined;
1861
+ runtimeRequirements?: string[] | undefined;
1862
+ userQuestion?: string | undefined;
1863
+ }, {
1864
+ mode: "static_preview" | "vite_app";
1865
+ reason: string;
1866
+ confidence: "low" | "medium" | "high";
1867
+ assetPlan?: {
1868
+ source: string;
1869
+ destination: string;
1870
+ referenceAs: string;
1871
+ }[] | undefined;
1872
+ runtimeRequirements?: string[] | undefined;
1873
+ userQuestion?: string | undefined;
1874
+ }>;
1875
+ }, "strip", z.ZodTypeAny, {
1876
+ sourceIntent: {
1877
+ sources: {
1878
+ reason: string;
1879
+ url: string;
1880
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1881
+ confidence: "low" | "medium" | "high";
1882
+ }[];
1883
+ };
1884
+ sourceContext: {
1885
+ sourceFindings: string[];
1886
+ sectionInventory: string[];
1887
+ visualObservations: string[];
1888
+ sourceRoles: {
1889
+ url: string;
1890
+ role: "primary" | "inspiration" | "competitor";
1891
+ rationale?: string | undefined;
1892
+ }[];
1893
+ qualityBar: string[];
1894
+ screenshotReferences?: string[] | undefined;
1895
+ risks?: string[] | undefined;
1896
+ };
1897
+ executionPlan: {
1898
+ mode: "static_preview" | "vite_app";
1899
+ reason: string;
1900
+ confidence: "low" | "medium" | "high";
1901
+ assetPlan?: {
1902
+ source: string;
1903
+ destination: string;
1904
+ referenceAs: string;
1905
+ }[] | undefined;
1906
+ runtimeRequirements?: string[] | undefined;
1907
+ userQuestion?: string | undefined;
1908
+ };
1909
+ designContexts?: {
1910
+ markdown: string;
1911
+ url: string;
1912
+ label: string;
1913
+ }[] | undefined;
1914
+ }, {
1915
+ sourceIntent: {
1916
+ sources: {
1917
+ reason: string;
1918
+ url: string;
1919
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1920
+ confidence: "low" | "medium" | "high";
1921
+ }[];
1922
+ };
1923
+ sourceContext: {
1924
+ sourceFindings: string[];
1925
+ sectionInventory: string[];
1926
+ visualObservations: string[];
1927
+ sourceRoles: {
1928
+ url: string;
1929
+ role: "primary" | "inspiration" | "competitor";
1930
+ rationale?: string | undefined;
1931
+ }[];
1932
+ qualityBar: string[];
1933
+ screenshotReferences?: string[] | undefined;
1934
+ risks?: string[] | undefined;
1935
+ };
1936
+ executionPlan: {
1937
+ mode: "static_preview" | "vite_app";
1938
+ reason: string;
1939
+ confidence: "low" | "medium" | "high";
1940
+ assetPlan?: {
1941
+ source: string;
1942
+ destination: string;
1943
+ referenceAs: string;
1944
+ }[] | undefined;
1945
+ runtimeRequirements?: string[] | undefined;
1946
+ userQuestion?: string | undefined;
1947
+ };
1948
+ designContexts?: {
1949
+ markdown: string;
1950
+ url: string;
1951
+ label: string;
1952
+ }[] | undefined;
1953
+ }>;
1954
+ export type SourcePlanArtifact = z.infer<typeof sourcePlanArtifactSchema>;
1955
+ export type BrowserDesignContext = z.infer<typeof browserDesignContextSchema>;
1956
+ export declare const reportSourcePlanInput: {
1957
+ sessionId: z.ZodString;
1958
+ workItemId: z.ZodString;
1959
+ attempt: z.ZodNumber;
1960
+ leaseId: z.ZodString;
1961
+ sourcePlan: z.ZodObject<{
1962
+ sourceIntent: z.ZodObject<{
1963
+ sources: z.ZodArray<z.ZodObject<{
1964
+ url: z.ZodString;
1965
+ role: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
1966
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
1967
+ reason: z.ZodString;
1968
+ }, "strip", z.ZodTypeAny, {
1969
+ reason: string;
1970
+ url: string;
1971
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1972
+ confidence: "low" | "medium" | "high";
1973
+ }, {
1974
+ reason: string;
1975
+ url: string;
1976
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1977
+ confidence: "low" | "medium" | "high";
1978
+ }>, "many">;
1979
+ }, "strip", z.ZodTypeAny, {
1980
+ sources: {
1981
+ reason: string;
1982
+ url: string;
1983
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1984
+ confidence: "low" | "medium" | "high";
1985
+ }[];
1986
+ }, {
1987
+ sources: {
1988
+ reason: string;
1989
+ url: string;
1990
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1991
+ confidence: "low" | "medium" | "high";
1992
+ }[];
1993
+ }>;
1994
+ sourceContext: z.ZodObject<{
1995
+ sourceFindings: z.ZodArray<z.ZodString, "many">;
1996
+ sectionInventory: z.ZodArray<z.ZodString, "many">;
1997
+ visualObservations: z.ZodArray<z.ZodString, "many">;
1998
+ sourceRoles: z.ZodArray<z.ZodObject<{
1999
+ url: z.ZodString;
2000
+ role: z.ZodEnum<["primary", "inspiration", "competitor"]>;
2001
+ rationale: z.ZodOptional<z.ZodString>;
2002
+ }, "strip", z.ZodTypeAny, {
2003
+ url: string;
2004
+ role: "primary" | "inspiration" | "competitor";
2005
+ rationale?: string | undefined;
2006
+ }, {
2007
+ url: string;
2008
+ role: "primary" | "inspiration" | "competitor";
2009
+ rationale?: string | undefined;
2010
+ }>, "many">;
2011
+ qualityBar: z.ZodArray<z.ZodString, "many">;
2012
+ screenshotReferences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2013
+ risks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2014
+ }, "strip", z.ZodTypeAny, {
2015
+ sourceFindings: string[];
2016
+ sectionInventory: string[];
2017
+ visualObservations: string[];
2018
+ sourceRoles: {
2019
+ url: string;
2020
+ role: "primary" | "inspiration" | "competitor";
2021
+ rationale?: string | undefined;
2022
+ }[];
2023
+ qualityBar: string[];
2024
+ screenshotReferences?: string[] | undefined;
2025
+ risks?: string[] | undefined;
2026
+ }, {
2027
+ sourceFindings: string[];
2028
+ sectionInventory: string[];
2029
+ visualObservations: string[];
2030
+ sourceRoles: {
2031
+ url: string;
2032
+ role: "primary" | "inspiration" | "competitor";
2033
+ rationale?: string | undefined;
2034
+ }[];
2035
+ qualityBar: string[];
2036
+ screenshotReferences?: string[] | undefined;
2037
+ risks?: string[] | undefined;
2038
+ }>;
2039
+ designContexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
2040
+ url: z.ZodString;
2041
+ label: z.ZodString;
2042
+ markdown: z.ZodString;
2043
+ }, "strip", z.ZodTypeAny, {
2044
+ markdown: string;
2045
+ url: string;
2046
+ label: string;
2047
+ }, {
2048
+ markdown: string;
2049
+ url: string;
2050
+ label: string;
2051
+ }>, "many">>;
2052
+ executionPlan: z.ZodObject<{
2053
+ mode: z.ZodEnum<["static_preview", "vite_app"]>;
2054
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
2055
+ reason: z.ZodString;
2056
+ assetPlan: z.ZodOptional<z.ZodArray<z.ZodObject<{
2057
+ source: z.ZodString;
2058
+ destination: z.ZodString;
2059
+ referenceAs: z.ZodString;
2060
+ }, "strip", z.ZodTypeAny, {
2061
+ source: string;
2062
+ destination: string;
2063
+ referenceAs: string;
2064
+ }, {
2065
+ source: string;
2066
+ destination: string;
2067
+ referenceAs: string;
2068
+ }>, "many">>;
2069
+ runtimeRequirements: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2070
+ userQuestion: z.ZodOptional<z.ZodString>;
2071
+ }, "strip", z.ZodTypeAny, {
2072
+ mode: "static_preview" | "vite_app";
2073
+ reason: string;
2074
+ confidence: "low" | "medium" | "high";
2075
+ assetPlan?: {
2076
+ source: string;
2077
+ destination: string;
2078
+ referenceAs: string;
2079
+ }[] | undefined;
2080
+ runtimeRequirements?: string[] | undefined;
2081
+ userQuestion?: string | undefined;
2082
+ }, {
2083
+ mode: "static_preview" | "vite_app";
2084
+ reason: string;
2085
+ confidence: "low" | "medium" | "high";
2086
+ assetPlan?: {
2087
+ source: string;
2088
+ destination: string;
2089
+ referenceAs: string;
2090
+ }[] | undefined;
2091
+ runtimeRequirements?: string[] | undefined;
2092
+ userQuestion?: string | undefined;
2093
+ }>;
2094
+ }, "strip", z.ZodTypeAny, {
2095
+ sourceIntent: {
2096
+ sources: {
2097
+ reason: string;
2098
+ url: string;
2099
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
2100
+ confidence: "low" | "medium" | "high";
2101
+ }[];
2102
+ };
2103
+ sourceContext: {
2104
+ sourceFindings: string[];
2105
+ sectionInventory: string[];
2106
+ visualObservations: string[];
2107
+ sourceRoles: {
2108
+ url: string;
2109
+ role: "primary" | "inspiration" | "competitor";
2110
+ rationale?: string | undefined;
2111
+ }[];
2112
+ qualityBar: string[];
2113
+ screenshotReferences?: string[] | undefined;
2114
+ risks?: string[] | undefined;
2115
+ };
2116
+ executionPlan: {
2117
+ mode: "static_preview" | "vite_app";
2118
+ reason: string;
2119
+ confidence: "low" | "medium" | "high";
2120
+ assetPlan?: {
2121
+ source: string;
2122
+ destination: string;
2123
+ referenceAs: string;
2124
+ }[] | undefined;
2125
+ runtimeRequirements?: string[] | undefined;
2126
+ userQuestion?: string | undefined;
2127
+ };
2128
+ designContexts?: {
2129
+ markdown: string;
2130
+ url: string;
2131
+ label: string;
2132
+ }[] | undefined;
2133
+ }, {
2134
+ sourceIntent: {
2135
+ sources: {
2136
+ reason: string;
2137
+ url: string;
2138
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
2139
+ confidence: "low" | "medium" | "high";
2140
+ }[];
2141
+ };
2142
+ sourceContext: {
2143
+ sourceFindings: string[];
2144
+ sectionInventory: string[];
2145
+ visualObservations: string[];
2146
+ sourceRoles: {
2147
+ url: string;
2148
+ role: "primary" | "inspiration" | "competitor";
2149
+ rationale?: string | undefined;
2150
+ }[];
2151
+ qualityBar: string[];
2152
+ screenshotReferences?: string[] | undefined;
2153
+ risks?: string[] | undefined;
2154
+ };
2155
+ executionPlan: {
2156
+ mode: "static_preview" | "vite_app";
2157
+ reason: string;
2158
+ confidence: "low" | "medium" | "high";
2159
+ assetPlan?: {
2160
+ source: string;
2161
+ destination: string;
2162
+ referenceAs: string;
2163
+ }[] | undefined;
2164
+ runtimeRequirements?: string[] | undefined;
2165
+ userQuestion?: string | undefined;
2166
+ };
2167
+ designContexts?: {
2168
+ markdown: string;
2169
+ url: string;
2170
+ label: string;
2171
+ }[] | undefined;
2172
+ }>;
1068
2173
  };
1069
- export type ReportSourceContextInput = {
2174
+ export type ReportSourcePlanInput = {
1070
2175
  sessionId: string;
1071
2176
  workItemId: string;
1072
2177
  attempt: number;
1073
2178
  leaseId: string;
1074
- sourceContext: SourceContextArtifact;
2179
+ sourcePlan: SourcePlanArtifact;
1075
2180
  };
2181
+ export interface SourcePlanWorkItemDescriptor {
2182
+ id: string;
2183
+ kind: 'source_plan';
2184
+ attempt: number;
2185
+ input: unknown;
2186
+ output_schema: unknown;
2187
+ }
1076
2188
  export type ReportVariantBriefsInput = {
1077
2189
  sessionId: string;
1078
2190
  workItemId: string;
@@ -1138,7 +2250,7 @@ export type CommitVariantOutput = {
1138
2250
  enqueued: boolean;
1139
2251
  duplicate: boolean;
1140
2252
  changedFilesCount: number;
1141
- payloadKind?: 'diff' | 'project-created';
2253
+ payloadKind?: 'diff' | 'diff-applied' | 'project-created';
1142
2254
  destinationPath?: string;
1143
2255
  } | {
1144
2256
  stage: 'failed';
@@ -1197,6 +2309,57 @@ export type ReportVariantCompleteInput = {
1197
2309
  tokensOut?: number;
1198
2310
  model?: string;
1199
2311
  };
2312
+ /**
2313
+ * Stateless inspiration-extraction kickoff. Agents call this before
2314
+ * `start_variants(mode='zero_to_one')` when the user provides inspiration
2315
+ * URLs or other source artifacts, then pass the returned `designContext`
2316
+ * (and optional `sourceContext` echo) into `start_variants`.
2317
+ */
2318
+ export declare const extractInspirationContextInput: {
2319
+ prompt: z.ZodString;
2320
+ count: z.ZodNumber;
2321
+ urls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2322
+ preserveBrand: z.ZodOptional<z.ZodBoolean>;
2323
+ sourceArtifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
2324
+ kind: z.ZodEnum<["urlText", "siteBrief", "visualBrief", "screenshotNotes"]>;
2325
+ label: z.ZodString;
2326
+ content: z.ZodString;
2327
+ }, "strip", z.ZodTypeAny, {
2328
+ kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
2329
+ label: string;
2330
+ content: string;
2331
+ }, {
2332
+ kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
2333
+ label: string;
2334
+ content: string;
2335
+ }>, "many">>;
2336
+ /** When true, bypass any cache entry and force a fresh fetch + extract. */
2337
+ forceRefresh: z.ZodOptional<z.ZodBoolean>;
2338
+ /** Caller-supplied correlation id, echoed into telemetry so this stateless
2339
+ * extraction can be tied to the subsequent `start_variants` call (which
2340
+ * accepts the same field) even though no session exists yet. */
2341
+ clientRequestId: z.ZodOptional<z.ZodString>;
2342
+ };
2343
+ export type ExtractInspirationContextInput = {
2344
+ prompt: string;
2345
+ count: number;
2346
+ urls?: string[];
2347
+ preserveBrand?: boolean;
2348
+ sourceArtifacts?: SourceArtifactInput[];
2349
+ forceRefresh?: boolean;
2350
+ clientRequestId?: string;
2351
+ };
2352
+ export type ExtractInspirationContextOutput = {
2353
+ designContext: DesignContextEntry[];
2354
+ warnings: string[];
2355
+ /** Echoed back so the agent can forward the same shape into
2356
+ * `start_variants(mode='zero_to_one')` without reconstructing it. */
2357
+ sourceContext?: SourceContextInput;
2358
+ } | {
2359
+ stage: 'failed';
2360
+ errorCode: ErrorCode;
2361
+ message: string;
2362
+ };
1200
2363
  export declare const cancelVariantsInput: {
1201
2364
  sessionId: z.ZodString;
1202
2365
  reason: z.ZodOptional<z.ZodString>;
@@ -1227,6 +2390,29 @@ export type CancelVariantOutput = {
1227
2390
  message: string;
1228
2391
  };
1229
2392
  export declare const startVariantsMode: z.ZodEnum<["existing", "zero_to_one"]>;
2393
+ /**
2394
+ * Brief content supplied by the agent through `start_variants`. The server
2395
+ * generates briefIds, so the agent only provides label + body (and an
2396
+ * optional visualReferenceUrl). Shape matches `briefSchema` minus briefId.
2397
+ */
2398
+ export declare const startVariantsBriefContent: z.ZodObject<Omit<{
2399
+ briefId: z.ZodString;
2400
+ label: z.ZodString;
2401
+ body: z.ZodString;
2402
+ /**
2403
+ * Optional per-brief visual reference URL. Uses the same synchronous
2404
+ * network-target guard as inspiration URLs before downstream agents fetch it.
2405
+ */
2406
+ visualReferenceUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
2407
+ }, "briefId">, "strip", z.ZodTypeAny, {
2408
+ label: string;
2409
+ body: string;
2410
+ visualReferenceUrl?: string | undefined;
2411
+ }, {
2412
+ label: string;
2413
+ body: string;
2414
+ visualReferenceUrl?: string | undefined;
2415
+ }>;
1230
2416
  export declare const startVariantsInput: {
1231
2417
  prompt: z.ZodString;
1232
2418
  count: z.ZodOptional<z.ZodNumber>;
@@ -1241,6 +2427,32 @@ export declare const startVariantsInput: {
1241
2427
  type: "element" | "file" | "route";
1242
2428
  ref: string;
1243
2429
  }>>;
2430
+ /**
2431
+ * Per-variant briefs supplied by the agent. When omitted, the server
2432
+ * falls back to a generic "Variant N" label + the prompt verbatim for
2433
+ * each body — UI shows that as the variant name/description, so the
2434
+ * agent should always supply briefs for human-readable variants. When
2435
+ * `briefs` is provided, its length determines the variant count
2436
+ * (overriding any explicit `count`).
2437
+ */
2438
+ briefs: z.ZodOptional<z.ZodArray<z.ZodObject<Omit<{
2439
+ briefId: z.ZodString;
2440
+ label: z.ZodString;
2441
+ body: z.ZodString;
2442
+ /**
2443
+ * Optional per-brief visual reference URL. Uses the same synchronous
2444
+ * network-target guard as inspiration URLs before downstream agents fetch it.
2445
+ */
2446
+ visualReferenceUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
2447
+ }, "briefId">, "strip", z.ZodTypeAny, {
2448
+ label: string;
2449
+ body: string;
2450
+ visualReferenceUrl?: string | undefined;
2451
+ }, {
2452
+ label: string;
2453
+ body: string;
2454
+ visualReferenceUrl?: string | undefined;
2455
+ }>, "many">>;
1244
2456
  /** Zero-to-one only: framework for the scaffolded project. Defaults to 'vite'. */
1245
2457
  framework: z.ZodOptional<z.ZodEnum<["vite"]>>;
1246
2458
  /** Zero-to-one only: absolute parent directory under which Rivet derives
@@ -1250,8 +2462,192 @@ export declare const startVariantsInput: {
1250
2462
  * server's current working directory. Used to detect framework and
1251
2463
  * auto-open the visual editor without a separate detect_project call. */
1252
2464
  projectPath: z.ZodOptional<z.ZodString>;
2465
+ /** Zero-to-one only: per-variant-slot design context produced upstream by
2466
+ * `extract_inspiration_context`. Threaded into the fresh worktree as
2467
+ * DESIGN.md per slot. Slot order matches variant order. */
2468
+ designContext: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2469
+ kind: z.ZodLiteral<"slug">;
2470
+ slug: z.ZodString;
2471
+ }, "strip", z.ZodTypeAny, {
2472
+ slug: string;
2473
+ kind: "slug";
2474
+ }, {
2475
+ slug: string;
2476
+ kind: "slug";
2477
+ }>, z.ZodObject<{
2478
+ kind: z.ZodLiteral<"markdown">;
2479
+ content: z.ZodString;
2480
+ label: z.ZodString;
2481
+ }, "strip", z.ZodTypeAny, {
2482
+ kind: "markdown";
2483
+ label: string;
2484
+ content: string;
2485
+ }, {
2486
+ kind: "markdown";
2487
+ label: string;
2488
+ content: string;
2489
+ }>]>, "many">>;
2490
+ /** Zero-to-one only: optional source-context metadata (inspiration URLs,
2491
+ * preserveBrand flag, sourceArtifacts). Forwarded to the worktree
2492
+ * scaffold so SOURCE_CONTEXT.md is written. */
2493
+ sourceContext: z.ZodOptional<z.ZodObject<{
2494
+ sourceUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2495
+ preserveBrand: z.ZodOptional<z.ZodBoolean>;
2496
+ sourceArtifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
2497
+ kind: z.ZodEnum<["urlText", "siteBrief", "visualBrief", "screenshotNotes"]>;
2498
+ label: z.ZodString;
2499
+ content: z.ZodString;
2500
+ }, "strip", z.ZodTypeAny, {
2501
+ kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
2502
+ label: string;
2503
+ content: string;
2504
+ }, {
2505
+ kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
2506
+ label: string;
2507
+ content: string;
2508
+ }>, "many">>;
2509
+ artifact: z.ZodOptional<z.ZodObject<{
2510
+ sourceFindings: z.ZodArray<z.ZodString, "many">;
2511
+ sectionInventory: z.ZodArray<z.ZodString, "many">;
2512
+ visualObservations: z.ZodArray<z.ZodString, "many">;
2513
+ sourceRoles: z.ZodArray<z.ZodObject<{
2514
+ url: z.ZodString;
2515
+ role: z.ZodEnum<["primary", "inspiration", "competitor"]>;
2516
+ rationale: z.ZodOptional<z.ZodString>;
2517
+ }, "strip", z.ZodTypeAny, {
2518
+ url: string;
2519
+ role: "primary" | "inspiration" | "competitor";
2520
+ rationale?: string | undefined;
2521
+ }, {
2522
+ url: string;
2523
+ role: "primary" | "inspiration" | "competitor";
2524
+ rationale?: string | undefined;
2525
+ }>, "many">;
2526
+ qualityBar: z.ZodArray<z.ZodString, "many">;
2527
+ screenshotReferences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2528
+ risks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2529
+ }, "strip", z.ZodTypeAny, {
2530
+ sourceFindings: string[];
2531
+ sectionInventory: string[];
2532
+ visualObservations: string[];
2533
+ sourceRoles: {
2534
+ url: string;
2535
+ role: "primary" | "inspiration" | "competitor";
2536
+ rationale?: string | undefined;
2537
+ }[];
2538
+ qualityBar: string[];
2539
+ screenshotReferences?: string[] | undefined;
2540
+ risks?: string[] | undefined;
2541
+ }, {
2542
+ sourceFindings: string[];
2543
+ sectionInventory: string[];
2544
+ visualObservations: string[];
2545
+ sourceRoles: {
2546
+ url: string;
2547
+ role: "primary" | "inspiration" | "competitor";
2548
+ rationale?: string | undefined;
2549
+ }[];
2550
+ qualityBar: string[];
2551
+ screenshotReferences?: string[] | undefined;
2552
+ risks?: string[] | undefined;
2553
+ }>>;
2554
+ sourceIntent: z.ZodOptional<z.ZodObject<{
2555
+ sources: z.ZodArray<z.ZodObject<{
2556
+ url: z.ZodString;
2557
+ role: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
2558
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
2559
+ reason: z.ZodString;
2560
+ }, "strip", z.ZodTypeAny, {
2561
+ reason: string;
2562
+ url: string;
2563
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
2564
+ confidence: "low" | "medium" | "high";
2565
+ }, {
2566
+ reason: string;
2567
+ url: string;
2568
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
2569
+ confidence: "low" | "medium" | "high";
2570
+ }>, "many">;
2571
+ }, "strip", z.ZodTypeAny, {
2572
+ sources: {
2573
+ reason: string;
2574
+ url: string;
2575
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
2576
+ confidence: "low" | "medium" | "high";
2577
+ }[];
2578
+ }, {
2579
+ sources: {
2580
+ reason: string;
2581
+ url: string;
2582
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
2583
+ confidence: "low" | "medium" | "high";
2584
+ }[];
2585
+ }>>;
2586
+ designDecision: z.ZodOptional<z.ZodEnum<["let_rivet_choose", "go_custom"]>>;
2587
+ }, "strip", z.ZodTypeAny, {
2588
+ sourceUrls?: string[] | undefined;
2589
+ preserveBrand?: boolean | undefined;
2590
+ sourceArtifacts?: {
2591
+ kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
2592
+ label: string;
2593
+ content: string;
2594
+ }[] | undefined;
2595
+ artifact?: {
2596
+ sourceFindings: string[];
2597
+ sectionInventory: string[];
2598
+ visualObservations: string[];
2599
+ sourceRoles: {
2600
+ url: string;
2601
+ role: "primary" | "inspiration" | "competitor";
2602
+ rationale?: string | undefined;
2603
+ }[];
2604
+ qualityBar: string[];
2605
+ screenshotReferences?: string[] | undefined;
2606
+ risks?: string[] | undefined;
2607
+ } | undefined;
2608
+ sourceIntent?: {
2609
+ sources: {
2610
+ reason: string;
2611
+ url: string;
2612
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
2613
+ confidence: "low" | "medium" | "high";
2614
+ }[];
2615
+ } | undefined;
2616
+ designDecision?: "let_rivet_choose" | "go_custom" | undefined;
2617
+ }, {
2618
+ sourceUrls?: string[] | undefined;
2619
+ preserveBrand?: boolean | undefined;
2620
+ sourceArtifacts?: {
2621
+ kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
2622
+ label: string;
2623
+ content: string;
2624
+ }[] | undefined;
2625
+ artifact?: {
2626
+ sourceFindings: string[];
2627
+ sectionInventory: string[];
2628
+ visualObservations: string[];
2629
+ sourceRoles: {
2630
+ url: string;
2631
+ role: "primary" | "inspiration" | "competitor";
2632
+ rationale?: string | undefined;
2633
+ }[];
2634
+ qualityBar: string[];
2635
+ screenshotReferences?: string[] | undefined;
2636
+ risks?: string[] | undefined;
2637
+ } | undefined;
2638
+ sourceIntent?: {
2639
+ sources: {
2640
+ reason: string;
2641
+ url: string;
2642
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
2643
+ confidence: "low" | "medium" | "high";
2644
+ }[];
2645
+ } | undefined;
2646
+ designDecision?: "let_rivet_choose" | "go_custom" | undefined;
2647
+ }>>;
1253
2648
  clientRequestId: z.ZodOptional<z.ZodString>;
1254
2649
  };
2650
+ export type StartVariantsBriefContent = z.infer<typeof startVariantsBriefContent>;
1255
2651
  export type StartVariantsInput = {
1256
2652
  prompt: string;
1257
2653
  count?: number;
@@ -1260,7 +2656,10 @@ export type StartVariantsInput = {
1260
2656
  framework?: 'vite';
1261
2657
  destinationParent?: string;
1262
2658
  projectPath?: string;
2659
+ designContext?: DesignContextEntry[];
2660
+ sourceContext?: SourceContextInput;
1263
2661
  clientRequestId?: string;
2662
+ briefs?: StartVariantsBriefContent[];
1264
2663
  };
1265
2664
  /**
1266
2665
  * Variant entry in the start_variants response. Carries everything the
@@ -1312,13 +2711,6 @@ export interface BriefWorkItemDescriptor {
1312
2711
  input: unknown;
1313
2712
  output_schema: unknown;
1314
2713
  }
1315
- export interface SourceResearchWorkItemDescriptor {
1316
- id: string;
1317
- kind: 'source_research';
1318
- attempt: number;
1319
- input: unknown;
1320
- output_schema: unknown;
1321
- }
1322
2714
  export interface LeasedWorkItemDescriptor {
1323
2715
  id: string;
1324
2716
  kind: WorkItemKind;
@@ -1336,8 +2728,8 @@ export interface VisualEditorAttachment {
1336
2728
  }
1337
2729
  export type ProposeVariantsOutput = {
1338
2730
  sessionId: string;
1339
- stage: 'awaiting_source_research';
1340
- sourceResearchWorkItem: SourceResearchWorkItemDescriptor;
2731
+ stage: 'awaiting_source_plan';
2732
+ sourcePlanWorkItem: SourcePlanWorkItemDescriptor;
1341
2733
  nextAction: 'continue_variants';
1342
2734
  visualEditor?: VisualEditorAttachment;
1343
2735
  } | {
@@ -1363,9 +2755,16 @@ export type ReportVariantBriefsOutput = {
1363
2755
  errorCode: ErrorCode;
1364
2756
  message: string;
1365
2757
  };
1366
- export type ReportSourceContextOutput = {
2758
+ export type ReportSourcePlanOutput = {
1367
2759
  stage: 'awaiting_briefs';
1368
2760
  briefWorkItem: BriefWorkItemDescriptor;
2761
+ executionPlan: {
2762
+ mode: ExecutionMode;
2763
+ confidence: ExecutionConfidence;
2764
+ reason: string;
2765
+ assetCount: number;
2766
+ runtimeRequirementCount: number;
2767
+ };
1369
2768
  nextAction: 'report_variant_briefs';
1370
2769
  } | {
1371
2770
  stage: 'failed';
@@ -1373,11 +2772,16 @@ export type ReportSourceContextOutput = {
1373
2772
  message: string;
1374
2773
  };
1375
2774
  export type ContinueVariantsOutput = {
1376
- stage: 'awaiting_source_research';
2775
+ stage: 'awaiting_source_plan';
1377
2776
  progress: {
1378
2777
  ready: number;
1379
2778
  total: number;
1380
2779
  };
2780
+ } | {
2781
+ stage: 'awaiting_source_plan';
2782
+ leaseId: string;
2783
+ leaseTtlMs: number;
2784
+ leasedWorkItems: LeasedWorkItemDescriptor[];
1381
2785
  } | {
1382
2786
  stage: 'awaiting_approval';
1383
2787
  briefs: Brief[];
@@ -1396,6 +2800,18 @@ export type ContinueVariantsOutput = {
1396
2800
  } | {
1397
2801
  stage: 'ready' | 'degraded' | 'failed' | 'cancelled';
1398
2802
  summary: TerminalSummary;
2803
+ /** Human-readable retry/continue/cancel prompt populated when any
2804
+ * succeeded-then-QA-failed variant is present in the summary. The
2805
+ * calling agent should surface this directly to the user. */
2806
+ qaPrompt?: string;
2807
+ /** Per-variant QA verdicts for variants with a `qa` result. Only
2808
+ * variants with a non-`not_run` status are included so the field
2809
+ * stays empty when nothing interesting has happened. */
2810
+ qa?: Array<{
2811
+ workItemId: string;
2812
+ label?: string;
2813
+ qa: VariantQaResult;
2814
+ }>;
1399
2815
  };
1400
2816
  export type ReportVariantCompleteOutput = {
1401
2817
  stage: 'waiting_for_results';
@@ -1406,6 +2822,13 @@ export type ReportVariantCompleteOutput = {
1406
2822
  } | {
1407
2823
  stage: 'ready' | 'degraded' | 'failed' | 'cancelled';
1408
2824
  summary: TerminalSummary;
2825
+ /** See `ContinueVariantsOutput.qaPrompt`. */
2826
+ qaPrompt?: string;
2827
+ qa?: Array<{
2828
+ workItemId: string;
2829
+ label?: string;
2830
+ qa: VariantQaResult;
2831
+ }>;
1409
2832
  };
1410
2833
  export type CancelVariantsOutput = {
1411
2834
  stage: 'cancelled';
@@ -1425,12 +2848,101 @@ export interface TerminalSummary {
1425
2848
  label?: string;
1426
2849
  }>;
1427
2850
  }
1428
- export type VariantPickPayload = {
2851
+ export declare const variantHistoryStatusSchema: z.ZodEnum<["completed", "committed", "rejected", "cancelled"]>;
2852
+ export declare const listPastVariantsInput: {
2853
+ projectPath: z.ZodOptional<z.ZodString>;
2854
+ limit: z.ZodOptional<z.ZodNumber>;
2855
+ status: z.ZodOptional<z.ZodEnum<["completed", "committed", "rejected", "cancelled"]>>;
2856
+ };
2857
+ export type ListPastVariantsInput = {
2858
+ projectPath?: string;
2859
+ limit?: number;
2860
+ status?: z.infer<typeof variantHistoryStatusSchema>;
2861
+ };
2862
+ export interface PastVariantSummary {
2863
+ sessionId: string;
2864
+ variantId: string;
2865
+ label: string;
2866
+ brief: string;
2867
+ kind: 'diff' | 'project-created';
2868
+ status: z.infer<typeof variantHistoryStatusSchema>;
2869
+ createdAt: string;
2870
+ statusChangedAt: string;
2871
+ changedFilesCount: number;
2872
+ }
2873
+ export type ListPastVariantsOutput = {
2874
+ projectPath: string;
2875
+ variants: PastVariantSummary[];
2876
+ } | {
2877
+ stage: 'failed';
2878
+ errorCode: ErrorCode;
2879
+ message: string;
2880
+ };
2881
+ export declare const getVariantInput: {
2882
+ projectPath: z.ZodOptional<z.ZodString>;
2883
+ sessionId: z.ZodString;
2884
+ variantId: z.ZodString;
2885
+ /** When false, diff body / file list are omitted to keep responses small. */
2886
+ includeBody: z.ZodOptional<z.ZodBoolean>;
2887
+ };
2888
+ export type GetVariantInput = {
2889
+ projectPath?: string;
2890
+ sessionId: string;
2891
+ variantId: string;
2892
+ includeBody?: boolean;
2893
+ };
2894
+ export type GetVariantOutput = {
2895
+ projectPath: string;
2896
+ variant: PastVariantSummary & {
2897
+ sessionPrompt: string;
2898
+ baseSha?: string;
2899
+ destinationPath?: string;
2900
+ diff?: string;
2901
+ files?: string[];
2902
+ /** Top-level DESIGN.md artifact body — present for fresh-project
2903
+ * variants scaffolded with a design context. Omitted when
2904
+ * `includeBody: false`. */
2905
+ designMarkdown?: string;
2906
+ /** Provenance for the persisted DESIGN.md so callers can render a
2907
+ * recognizable label (e.g. catalog name) without re-resolving the
2908
+ * slug. */
2909
+ designSource?: {
2910
+ kind: 'slug' | 'markdown';
2911
+ label: string;
2912
+ slug?: string;
2913
+ };
2914
+ };
2915
+ } | {
2916
+ stage: 'failed';
2917
+ errorCode: ErrorCode;
2918
+ message: string;
2919
+ };
2920
+ export type VariantPickPayload =
2921
+ /**
2922
+ * Server-internal raw diff payload. Retained so unit tests and callers that
2923
+ * predate server-side apply can still introspect the diff body. The
2924
+ * production commit path now applies the diff before enqueueing and emits
2925
+ * `diff-applied` to the bridge so MCP agents don't re-apply.
2926
+ */
2927
+ {
1429
2928
  kind: 'diff';
1430
2929
  diff: string;
1431
2930
  target?: Target;
1432
2931
  changedFilesCount: number;
1433
2932
  }
2933
+ /**
2934
+ * Agent-facing post-apply state for existing-project picks. The variant's
2935
+ * unified diff has already been applied to the user's working tree
2936
+ * (uncommitted). Agents must NOT run `git apply` again — just inform the
2937
+ * user and proceed.
2938
+ */
2939
+ | {
2940
+ kind: 'diff-applied';
2941
+ diff: string;
2942
+ target?: Target;
2943
+ changedFilesCount: number;
2944
+ note: string;
2945
+ }
1434
2946
  /**
1435
2947
  * Server-internal pre-materialize state for fresh-project picks. Held while
1436
2948
  * the orchestrator copies `sourceWorktreePath` to `destinationPath`. Never