rivet-design 0.9.3 → 0.9.4

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 (90) hide show
  1. package/dist/mcp/agent-variants/SessionStore.d.ts +25 -10
  2. package/dist/mcp/agent-variants/SessionStore.d.ts.map +1 -1
  3. package/dist/mcp/agent-variants/SessionStore.js +186 -44
  4. package/dist/mcp/agent-variants/SessionStore.js.map +1 -1
  5. package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts +146 -13
  6. package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts.map +1 -1
  7. package/dist/mcp/agent-variants/WorktreeOrchestrator.js +1223 -58
  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 +1470 -64
  14. package/dist/mcp/agent-variants/contracts.d.ts.map +1 -1
  15. package/dist/mcp/agent-variants/contracts.js +173 -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 +60 -24
  22. package/dist/mcp/agent-variants/createZeroToOneTool.d.ts.map +1 -1
  23. package/dist/mcp/agent-variants/createZeroToOneTool.js +38 -120
  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 +23 -1
  49. package/dist/mcp/agent-variants/tools.d.ts.map +1 -1
  50. package/dist/mcp/agent-variants/tools.js +144 -27
  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 +25 -6
  54. package/dist/mcp/server.js.map +1 -1
  55. package/dist/prompts/agentModPrompts.js +4 -4
  56. package/dist/prompts/agentModPrompts.js.map +1 -1
  57. package/dist/routes/agentVariants.d.ts.map +1 -1
  58. package/dist/routes/agentVariants.js +8 -1
  59. package/dist/routes/agentVariants.js.map +1 -1
  60. package/dist/server.d.ts.map +1 -1
  61. package/dist/server.js +21 -3
  62. package/dist/server.js.map +1 -1
  63. package/dist/services/ProjectDetectionService.d.ts.map +1 -1
  64. package/dist/services/ProjectDetectionService.js +9 -0
  65. package/dist/services/ProjectDetectionService.js.map +1 -1
  66. package/dist/services/WorktreeManager.d.ts +67 -9
  67. package/dist/services/WorktreeManager.d.ts.map +1 -1
  68. package/dist/services/WorktreeManager.js +209 -26
  69. package/dist/services/WorktreeManager.js.map +1 -1
  70. package/dist/services/agent/AgentModService.js +6 -6
  71. package/dist/services/agent/AgentModService.js.map +1 -1
  72. package/dist/services/templates/viteReactTs.d.ts +6 -0
  73. package/dist/services/templates/viteReactTs.d.ts.map +1 -1
  74. package/dist/services/templates/viteReactTs.js +8 -1
  75. package/dist/services/templates/viteReactTs.js.map +1 -1
  76. package/dist/types/change-request-types.d.ts +14 -0
  77. package/dist/types/change-request-types.d.ts.map +1 -1
  78. package/dist/utils/skills/claude-skill.d.ts +1 -1
  79. package/dist/utils/skills/claude-skill.js +2 -2
  80. package/dist/utils/skills/cursor-rules.d.ts +1 -1
  81. package/dist/utils/skills/cursor-rules.js +1 -1
  82. package/dist/utils/skills/shared-variants-protocol.d.ts +1 -1
  83. package/dist/utils/skills/shared-variants-protocol.d.ts.map +1 -1
  84. package/dist/utils/skills/shared-variants-protocol.js +31 -32
  85. package/dist/utils/skills/shared-variants-protocol.js.map +1 -1
  86. package/package.json +3 -4
  87. package/src/ui/dist/assets/{main-DejhsBWR.js → main-CpX7fB64.js} +113 -113
  88. package/src/ui/dist/assets/main-Qqe2_oMT.css +1 -0
  89. package/src/ui/dist/index.html +2 -2
  90. 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,89 @@ 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">;
251
421
  workspacePath: z.ZodString;
252
422
  framework: z.ZodOptional<z.ZodEnum<["vite", "next", "astro", "remix"]>>;
423
+ assetSourceRoot: z.ZodOptional<z.ZodString>;
253
424
  /** Per-variant-slot design context. Slug entries resolve bundled catalog
254
425
  * markdown; markdown entries are written directly as `DESIGN.md`. The
255
426
  * order matches code-gen variant slot order. */
@@ -268,12 +439,12 @@ export declare const projectContextFresh: z.ZodObject<{
268
439
  label: z.ZodString;
269
440
  }, "strip", z.ZodTypeAny, {
270
441
  kind: "markdown";
271
- content: string;
272
442
  label: string;
443
+ content: string;
273
444
  }, {
274
445
  kind: "markdown";
275
- content: string;
276
446
  label: string;
447
+ content: string;
277
448
  }>]>, "many">>;
278
449
  sourceContext: z.ZodOptional<z.ZodObject<{
279
450
  sourceUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -284,12 +455,12 @@ export declare const projectContextFresh: z.ZodObject<{
284
455
  content: z.ZodString;
285
456
  }, "strip", z.ZodTypeAny, {
286
457
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
287
- content: string;
288
458
  label: string;
459
+ content: string;
289
460
  }, {
290
461
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
291
- content: string;
292
462
  label: string;
463
+ content: string;
293
464
  }>, "many">>;
294
465
  artifact: z.ZodOptional<z.ZodObject<{
295
466
  sourceFindings: z.ZodArray<z.ZodString, "many">;
@@ -336,14 +507,46 @@ export declare const projectContextFresh: z.ZodObject<{
336
507
  screenshotReferences?: string[] | undefined;
337
508
  risks?: string[] | undefined;
338
509
  }>>;
510
+ sourceIntent: z.ZodOptional<z.ZodObject<{
511
+ sources: z.ZodArray<z.ZodObject<{
512
+ url: z.ZodString;
513
+ role: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
514
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
515
+ reason: z.ZodString;
516
+ }, "strip", z.ZodTypeAny, {
517
+ reason: string;
518
+ url: string;
519
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
520
+ confidence: "low" | "medium" | "high";
521
+ }, {
522
+ reason: string;
523
+ url: string;
524
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
525
+ confidence: "low" | "medium" | "high";
526
+ }>, "many">;
527
+ }, "strip", z.ZodTypeAny, {
528
+ sources: {
529
+ reason: string;
530
+ url: string;
531
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
532
+ confidence: "low" | "medium" | "high";
533
+ }[];
534
+ }, {
535
+ sources: {
536
+ reason: string;
537
+ url: string;
538
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
539
+ confidence: "low" | "medium" | "high";
540
+ }[];
541
+ }>>;
339
542
  designDecision: z.ZodOptional<z.ZodEnum<["let_rivet_choose", "go_custom"]>>;
340
543
  }, "strip", z.ZodTypeAny, {
341
544
  sourceUrls?: string[] | undefined;
342
545
  preserveBrand?: boolean | undefined;
343
546
  sourceArtifacts?: {
344
547
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
345
- content: string;
346
548
  label: string;
549
+ content: string;
347
550
  }[] | undefined;
348
551
  artifact?: {
349
552
  sourceFindings: string[];
@@ -358,14 +561,22 @@ export declare const projectContextFresh: z.ZodObject<{
358
561
  screenshotReferences?: string[] | undefined;
359
562
  risks?: string[] | undefined;
360
563
  } | undefined;
564
+ sourceIntent?: {
565
+ sources: {
566
+ reason: string;
567
+ url: string;
568
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
569
+ confidence: "low" | "medium" | "high";
570
+ }[];
571
+ } | undefined;
361
572
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
362
573
  }, {
363
574
  sourceUrls?: string[] | undefined;
364
575
  preserveBrand?: boolean | undefined;
365
576
  sourceArtifacts?: {
366
577
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
367
- content: string;
368
578
  label: string;
579
+ content: string;
369
580
  }[] | undefined;
370
581
  artifact?: {
371
582
  sourceFindings: string[];
@@ -380,27 +591,82 @@ export declare const projectContextFresh: z.ZodObject<{
380
591
  screenshotReferences?: string[] | undefined;
381
592
  risks?: string[] | undefined;
382
593
  } | undefined;
594
+ sourceIntent?: {
595
+ sources: {
596
+ reason: string;
597
+ url: string;
598
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
599
+ confidence: "low" | "medium" | "high";
600
+ }[];
601
+ } | undefined;
383
602
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
384
603
  }>>;
604
+ /** Agent-supplied execution plan from `report_source_plan`. Drives the
605
+ * generation routing decision at approve() time: `static_preview` keeps
606
+ * the lightweight HTML-only path; `vite_app` provisions a real Vite
607
+ * worktree per variant and copies any large assets from `assetPlan`. */
608
+ executionPlan: z.ZodOptional<z.ZodObject<{
609
+ mode: z.ZodEnum<["static_preview", "vite_app"]>;
610
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
611
+ reason: z.ZodString;
612
+ assetPlan: z.ZodOptional<z.ZodArray<z.ZodObject<{
613
+ source: z.ZodString;
614
+ destination: z.ZodString;
615
+ referenceAs: z.ZodString;
616
+ }, "strip", z.ZodTypeAny, {
617
+ source: string;
618
+ destination: string;
619
+ referenceAs: string;
620
+ }, {
621
+ source: string;
622
+ destination: string;
623
+ referenceAs: string;
624
+ }>, "many">>;
625
+ runtimeRequirements: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
626
+ userQuestion: z.ZodOptional<z.ZodString>;
627
+ }, "strip", z.ZodTypeAny, {
628
+ mode: "static_preview" | "vite_app";
629
+ reason: string;
630
+ confidence: "low" | "medium" | "high";
631
+ assetPlan?: {
632
+ source: string;
633
+ destination: string;
634
+ referenceAs: string;
635
+ }[] | undefined;
636
+ runtimeRequirements?: string[] | undefined;
637
+ userQuestion?: string | undefined;
638
+ }, {
639
+ mode: "static_preview" | "vite_app";
640
+ reason: string;
641
+ confidence: "low" | "medium" | "high";
642
+ assetPlan?: {
643
+ source: string;
644
+ destination: string;
645
+ referenceAs: string;
646
+ }[] | undefined;
647
+ runtimeRequirements?: string[] | undefined;
648
+ userQuestion?: string | undefined;
649
+ }>>;
385
650
  }, "strip", z.ZodTypeAny, {
386
651
  kind: "fresh";
387
652
  workspacePath: string;
388
653
  framework?: "next" | "vite" | "remix" | "astro" | undefined;
654
+ assetSourceRoot?: string | undefined;
389
655
  designContext?: ({
390
656
  slug: string;
391
657
  kind: "slug";
392
658
  } | {
393
659
  kind: "markdown";
394
- content: string;
395
660
  label: string;
661
+ content: string;
396
662
  })[] | undefined;
397
663
  sourceContext?: {
398
664
  sourceUrls?: string[] | undefined;
399
665
  preserveBrand?: boolean | undefined;
400
666
  sourceArtifacts?: {
401
667
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
402
- content: string;
403
668
  label: string;
669
+ content: string;
404
670
  }[] | undefined;
405
671
  artifact?: {
406
672
  sourceFindings: string[];
@@ -415,27 +681,48 @@ export declare const projectContextFresh: z.ZodObject<{
415
681
  screenshotReferences?: string[] | undefined;
416
682
  risks?: string[] | undefined;
417
683
  } | undefined;
684
+ sourceIntent?: {
685
+ sources: {
686
+ reason: string;
687
+ url: string;
688
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
689
+ confidence: "low" | "medium" | "high";
690
+ }[];
691
+ } | undefined;
418
692
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
419
693
  } | undefined;
694
+ executionPlan?: {
695
+ mode: "static_preview" | "vite_app";
696
+ reason: string;
697
+ confidence: "low" | "medium" | "high";
698
+ assetPlan?: {
699
+ source: string;
700
+ destination: string;
701
+ referenceAs: string;
702
+ }[] | undefined;
703
+ runtimeRequirements?: string[] | undefined;
704
+ userQuestion?: string | undefined;
705
+ } | undefined;
420
706
  }, {
421
707
  kind: "fresh";
422
708
  workspacePath: string;
423
709
  framework?: "next" | "vite" | "remix" | "astro" | undefined;
710
+ assetSourceRoot?: string | undefined;
424
711
  designContext?: ({
425
712
  slug: string;
426
713
  kind: "slug";
427
714
  } | {
428
715
  kind: "markdown";
429
- content: string;
430
716
  label: string;
717
+ content: string;
431
718
  })[] | undefined;
432
719
  sourceContext?: {
433
720
  sourceUrls?: string[] | undefined;
434
721
  preserveBrand?: boolean | undefined;
435
722
  sourceArtifacts?: {
436
723
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
437
- content: string;
438
724
  label: string;
725
+ content: string;
439
726
  }[] | undefined;
440
727
  artifact?: {
441
728
  sourceFindings: string[];
@@ -450,8 +737,28 @@ export declare const projectContextFresh: z.ZodObject<{
450
737
  screenshotReferences?: string[] | undefined;
451
738
  risks?: string[] | undefined;
452
739
  } | undefined;
740
+ sourceIntent?: {
741
+ sources: {
742
+ reason: string;
743
+ url: string;
744
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
745
+ confidence: "low" | "medium" | "high";
746
+ }[];
747
+ } | undefined;
453
748
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
454
749
  } | undefined;
750
+ executionPlan?: {
751
+ mode: "static_preview" | "vite_app";
752
+ reason: string;
753
+ confidence: "low" | "medium" | "high";
754
+ assetPlan?: {
755
+ source: string;
756
+ destination: string;
757
+ referenceAs: string;
758
+ }[] | undefined;
759
+ runtimeRequirements?: string[] | undefined;
760
+ userQuestion?: string | undefined;
761
+ } | undefined;
455
762
  }>;
456
763
  export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
457
764
  kind: z.ZodLiteral<"existing">;
@@ -463,6 +770,7 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
463
770
  kind: z.ZodLiteral<"fresh">;
464
771
  workspacePath: z.ZodString;
465
772
  framework: z.ZodOptional<z.ZodEnum<["vite", "next", "astro", "remix"]>>;
773
+ assetSourceRoot: z.ZodOptional<z.ZodString>;
466
774
  /** Per-variant-slot design context. Slug entries resolve bundled catalog
467
775
  * markdown; markdown entries are written directly as `DESIGN.md`. The
468
776
  * order matches code-gen variant slot order. */
@@ -481,12 +789,12 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
481
789
  label: z.ZodString;
482
790
  }, "strip", z.ZodTypeAny, {
483
791
  kind: "markdown";
484
- content: string;
485
792
  label: string;
793
+ content: string;
486
794
  }, {
487
795
  kind: "markdown";
488
- content: string;
489
796
  label: string;
797
+ content: string;
490
798
  }>]>, "many">>;
491
799
  sourceContext: z.ZodOptional<z.ZodObject<{
492
800
  sourceUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -497,12 +805,12 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
497
805
  content: z.ZodString;
498
806
  }, "strip", z.ZodTypeAny, {
499
807
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
500
- content: string;
501
808
  label: string;
809
+ content: string;
502
810
  }, {
503
811
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
504
- content: string;
505
812
  label: string;
813
+ content: string;
506
814
  }>, "many">>;
507
815
  artifact: z.ZodOptional<z.ZodObject<{
508
816
  sourceFindings: z.ZodArray<z.ZodString, "many">;
@@ -549,14 +857,46 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
549
857
  screenshotReferences?: string[] | undefined;
550
858
  risks?: string[] | undefined;
551
859
  }>>;
860
+ sourceIntent: z.ZodOptional<z.ZodObject<{
861
+ sources: z.ZodArray<z.ZodObject<{
862
+ url: z.ZodString;
863
+ role: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
864
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
865
+ reason: z.ZodString;
866
+ }, "strip", z.ZodTypeAny, {
867
+ reason: string;
868
+ url: string;
869
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
870
+ confidence: "low" | "medium" | "high";
871
+ }, {
872
+ reason: string;
873
+ url: string;
874
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
875
+ confidence: "low" | "medium" | "high";
876
+ }>, "many">;
877
+ }, "strip", z.ZodTypeAny, {
878
+ sources: {
879
+ reason: string;
880
+ url: string;
881
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
882
+ confidence: "low" | "medium" | "high";
883
+ }[];
884
+ }, {
885
+ sources: {
886
+ reason: string;
887
+ url: string;
888
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
889
+ confidence: "low" | "medium" | "high";
890
+ }[];
891
+ }>>;
552
892
  designDecision: z.ZodOptional<z.ZodEnum<["let_rivet_choose", "go_custom"]>>;
553
893
  }, "strip", z.ZodTypeAny, {
554
894
  sourceUrls?: string[] | undefined;
555
895
  preserveBrand?: boolean | undefined;
556
896
  sourceArtifacts?: {
557
897
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
558
- content: string;
559
898
  label: string;
899
+ content: string;
560
900
  }[] | undefined;
561
901
  artifact?: {
562
902
  sourceFindings: string[];
@@ -571,14 +911,22 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
571
911
  screenshotReferences?: string[] | undefined;
572
912
  risks?: string[] | undefined;
573
913
  } | undefined;
914
+ sourceIntent?: {
915
+ sources: {
916
+ reason: string;
917
+ url: string;
918
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
919
+ confidence: "low" | "medium" | "high";
920
+ }[];
921
+ } | undefined;
574
922
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
575
923
  }, {
576
924
  sourceUrls?: string[] | undefined;
577
925
  preserveBrand?: boolean | undefined;
578
926
  sourceArtifacts?: {
579
927
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
580
- content: string;
581
928
  label: string;
929
+ content: string;
582
930
  }[] | undefined;
583
931
  artifact?: {
584
932
  sourceFindings: string[];
@@ -593,27 +941,82 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
593
941
  screenshotReferences?: string[] | undefined;
594
942
  risks?: string[] | undefined;
595
943
  } | undefined;
944
+ sourceIntent?: {
945
+ sources: {
946
+ reason: string;
947
+ url: string;
948
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
949
+ confidence: "low" | "medium" | "high";
950
+ }[];
951
+ } | undefined;
596
952
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
597
953
  }>>;
954
+ /** Agent-supplied execution plan from `report_source_plan`. Drives the
955
+ * generation routing decision at approve() time: `static_preview` keeps
956
+ * the lightweight HTML-only path; `vite_app` provisions a real Vite
957
+ * worktree per variant and copies any large assets from `assetPlan`. */
958
+ executionPlan: z.ZodOptional<z.ZodObject<{
959
+ mode: z.ZodEnum<["static_preview", "vite_app"]>;
960
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
961
+ reason: z.ZodString;
962
+ assetPlan: z.ZodOptional<z.ZodArray<z.ZodObject<{
963
+ source: z.ZodString;
964
+ destination: z.ZodString;
965
+ referenceAs: z.ZodString;
966
+ }, "strip", z.ZodTypeAny, {
967
+ source: string;
968
+ destination: string;
969
+ referenceAs: string;
970
+ }, {
971
+ source: string;
972
+ destination: string;
973
+ referenceAs: string;
974
+ }>, "many">>;
975
+ runtimeRequirements: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
976
+ userQuestion: z.ZodOptional<z.ZodString>;
977
+ }, "strip", z.ZodTypeAny, {
978
+ mode: "static_preview" | "vite_app";
979
+ reason: string;
980
+ confidence: "low" | "medium" | "high";
981
+ assetPlan?: {
982
+ source: string;
983
+ destination: string;
984
+ referenceAs: string;
985
+ }[] | undefined;
986
+ runtimeRequirements?: string[] | undefined;
987
+ userQuestion?: string | undefined;
988
+ }, {
989
+ mode: "static_preview" | "vite_app";
990
+ reason: string;
991
+ confidence: "low" | "medium" | "high";
992
+ assetPlan?: {
993
+ source: string;
994
+ destination: string;
995
+ referenceAs: string;
996
+ }[] | undefined;
997
+ runtimeRequirements?: string[] | undefined;
998
+ userQuestion?: string | undefined;
999
+ }>>;
598
1000
  }, "strip", z.ZodTypeAny, {
599
1001
  kind: "fresh";
600
1002
  workspacePath: string;
601
1003
  framework?: "next" | "vite" | "remix" | "astro" | undefined;
1004
+ assetSourceRoot?: string | undefined;
602
1005
  designContext?: ({
603
1006
  slug: string;
604
1007
  kind: "slug";
605
1008
  } | {
606
1009
  kind: "markdown";
607
- content: string;
608
1010
  label: string;
1011
+ content: string;
609
1012
  })[] | undefined;
610
1013
  sourceContext?: {
611
1014
  sourceUrls?: string[] | undefined;
612
1015
  preserveBrand?: boolean | undefined;
613
1016
  sourceArtifacts?: {
614
1017
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
615
- content: string;
616
1018
  label: string;
1019
+ content: string;
617
1020
  }[] | undefined;
618
1021
  artifact?: {
619
1022
  sourceFindings: string[];
@@ -628,27 +1031,48 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
628
1031
  screenshotReferences?: string[] | undefined;
629
1032
  risks?: string[] | undefined;
630
1033
  } | undefined;
1034
+ sourceIntent?: {
1035
+ sources: {
1036
+ reason: string;
1037
+ url: string;
1038
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1039
+ confidence: "low" | "medium" | "high";
1040
+ }[];
1041
+ } | undefined;
631
1042
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
632
1043
  } | undefined;
1044
+ executionPlan?: {
1045
+ mode: "static_preview" | "vite_app";
1046
+ reason: string;
1047
+ confidence: "low" | "medium" | "high";
1048
+ assetPlan?: {
1049
+ source: string;
1050
+ destination: string;
1051
+ referenceAs: string;
1052
+ }[] | undefined;
1053
+ runtimeRequirements?: string[] | undefined;
1054
+ userQuestion?: string | undefined;
1055
+ } | undefined;
633
1056
  }, {
634
1057
  kind: "fresh";
635
1058
  workspacePath: string;
636
1059
  framework?: "next" | "vite" | "remix" | "astro" | undefined;
1060
+ assetSourceRoot?: string | undefined;
637
1061
  designContext?: ({
638
1062
  slug: string;
639
1063
  kind: "slug";
640
1064
  } | {
641
1065
  kind: "markdown";
642
- content: string;
643
1066
  label: string;
1067
+ content: string;
644
1068
  })[] | undefined;
645
1069
  sourceContext?: {
646
1070
  sourceUrls?: string[] | undefined;
647
1071
  preserveBrand?: boolean | undefined;
648
1072
  sourceArtifacts?: {
649
1073
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
650
- content: string;
651
1074
  label: string;
1075
+ content: string;
652
1076
  }[] | undefined;
653
1077
  artifact?: {
654
1078
  sourceFindings: string[];
@@ -663,8 +1087,28 @@ export declare const projectContextSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
663
1087
  screenshotReferences?: string[] | undefined;
664
1088
  risks?: string[] | undefined;
665
1089
  } | undefined;
1090
+ sourceIntent?: {
1091
+ sources: {
1092
+ reason: string;
1093
+ url: string;
1094
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1095
+ confidence: "low" | "medium" | "high";
1096
+ }[];
1097
+ } | undefined;
666
1098
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
667
1099
  } | undefined;
1100
+ executionPlan?: {
1101
+ mode: "static_preview" | "vite_app";
1102
+ reason: string;
1103
+ confidence: "low" | "medium" | "high";
1104
+ assetPlan?: {
1105
+ source: string;
1106
+ destination: string;
1107
+ referenceAs: string;
1108
+ }[] | undefined;
1109
+ runtimeRequirements?: string[] | undefined;
1110
+ userQuestion?: string | undefined;
1111
+ } | undefined;
668
1112
  }>]>;
669
1113
  export type ProjectContext = z.infer<typeof projectContextSchema>;
670
1114
  export type DesignContextEntry = z.infer<typeof designContextEntrySchema>;
@@ -704,6 +1148,15 @@ export type ActiveProjectContext = {
704
1148
  sourceCount: number;
705
1149
  isSourceGrounded: boolean;
706
1150
  };
1151
+ /** Compact summary of the agent's execution plan, suitable for chip /
1152
+ * artifact rendering. The full plan stays on the project context. */
1153
+ executionPlan?: {
1154
+ mode: ExecutionMode;
1155
+ confidence: ExecutionConfidence;
1156
+ reason: string;
1157
+ assetCount: number;
1158
+ runtimeRequirementCount: number;
1159
+ };
707
1160
  };
708
1161
  export interface ActiveVariantActions {
709
1162
  view?: {
@@ -725,6 +1178,68 @@ export interface ActiveVariantSnapshot {
725
1178
  port?: number;
726
1179
  errorCode?: string;
727
1180
  actions?: ActiveVariantActions;
1181
+ /**
1182
+ * Objective post-generation QA verdict. Present once the orchestrator has
1183
+ * run preview QA against the variant's deliverable (asset reachability,
1184
+ * runtime/console health). Surfaced on the chip so the user can see why
1185
+ * a variant is not committable. `not_run` indicates QA has not yet been
1186
+ * exercised for this variant kind (e.g. existing-project `code_gen`).
1187
+ */
1188
+ qa?: VariantQaResult;
1189
+ }
1190
+ /**
1191
+ * Kinds of supporting artifact a variants session can surface to the UI.
1192
+ * `design_context` is the only kind populated today (the DESIGN.md used or
1193
+ * generated for a 0→1 run); the other kinds reserve shape for source
1194
+ * research bundles, QA reports, and persisted asset manifests so the
1195
+ * snapshot contract stays stable as those land.
1196
+ */
1197
+ export declare const VARIANT_ARTIFACT_KINDS: readonly ["design_context", "source_context", "qa_report", "asset"];
1198
+ export type VariantArtifactKind = (typeof VARIANT_ARTIFACT_KINDS)[number];
1199
+ export type VariantArtifactStatus = 'ready' | 'warning' | 'failed';
1200
+ export type VariantArtifactSource = 'agent_browser' | 'cache' | 'static' | 'manual';
1201
+ export type VariantArtifactContentType = 'text/markdown' | 'application/json' | 'text/plain';
1202
+ /**
1203
+ * Stable, transport-safe shape for one supporting artifact attached to a
1204
+ * variants session. For `design_context` artifacts the full markdown
1205
+ * content is required (the UI renders it inline); other kinds may omit
1206
+ * `content` and surface metadata only.
1207
+ */
1208
+ export interface VariantSessionArtifact {
1209
+ id: string;
1210
+ kind: VariantArtifactKind;
1211
+ label: string;
1212
+ summary?: string;
1213
+ usedByVariantCount?: number;
1214
+ status?: VariantArtifactStatus;
1215
+ source?: VariantArtifactSource;
1216
+ contentType?: VariantArtifactContentType;
1217
+ content?: string;
1218
+ path?: string;
1219
+ warnings?: string[];
1220
+ }
1221
+ export type VariantQaStatus = 'passed' | 'failed' | 'not_run';
1222
+ /**
1223
+ * Categorical QA failure mode. Mirrors the failure surfaces the gate
1224
+ * checks for static previews — referenced assets that fail to load, code
1225
+ * that throws on initial render, or a preview document that couldn't be
1226
+ * fetched at all. Kept small so the user-facing prompt can stay legible.
1227
+ */
1228
+ export type VariantQaIssueKind = 'asset_load_failed' | 'console_error' | 'preview_unavailable';
1229
+ export interface VariantQaIssue {
1230
+ kind: VariantQaIssueKind;
1231
+ /** Asset URL or runtime source location that triggered the failure. */
1232
+ detail: string;
1233
+ /** Optional human-readable extra context — e.g. HTTP status, error message. */
1234
+ message?: string;
1235
+ }
1236
+ export interface VariantQaResult {
1237
+ status: VariantQaStatus;
1238
+ issues: VariantQaIssue[];
1239
+ /** Compact, user-facing summary suitable for chip + prompt rendering. */
1240
+ summary: string;
1241
+ /** Source of the inspected preview (the URL or marker the runner used). */
1242
+ checkedSource?: string;
728
1243
  }
729
1244
  export declare const targetSchema: z.ZodObject<{
730
1245
  type: z.ZodEnum<["element", "file", "route"]>;
@@ -741,14 +1256,21 @@ export declare const briefSchema: z.ZodObject<{
741
1256
  briefId: z.ZodString;
742
1257
  label: z.ZodString;
743
1258
  body: z.ZodString;
1259
+ /**
1260
+ * Optional per-brief visual reference URL. Uses the same synchronous
1261
+ * network-target guard as inspiration URLs before downstream agents fetch it.
1262
+ */
1263
+ visualReferenceUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
744
1264
  }, "strip", z.ZodTypeAny, {
745
1265
  label: string;
746
- briefId: string;
747
1266
  body: string;
1267
+ briefId: string;
1268
+ visualReferenceUrl?: string | undefined;
748
1269
  }, {
749
1270
  label: string;
750
- briefId: string;
751
1271
  body: string;
1272
+ briefId: string;
1273
+ visualReferenceUrl?: string | undefined;
752
1274
  }>;
753
1275
  export type Brief = z.infer<typeof briefSchema>;
754
1276
  /**
@@ -784,6 +1306,7 @@ export declare const proposeVariantsInput: {
784
1306
  kind: z.ZodLiteral<"fresh">;
785
1307
  workspacePath: z.ZodString;
786
1308
  framework: z.ZodOptional<z.ZodEnum<["vite", "next", "astro", "remix"]>>;
1309
+ assetSourceRoot: z.ZodOptional<z.ZodString>;
787
1310
  /** Per-variant-slot design context. Slug entries resolve bundled catalog
788
1311
  * markdown; markdown entries are written directly as `DESIGN.md`. The
789
1312
  * order matches code-gen variant slot order. */
@@ -802,12 +1325,12 @@ export declare const proposeVariantsInput: {
802
1325
  label: z.ZodString;
803
1326
  }, "strip", z.ZodTypeAny, {
804
1327
  kind: "markdown";
805
- content: string;
806
1328
  label: string;
1329
+ content: string;
807
1330
  }, {
808
1331
  kind: "markdown";
809
- content: string;
810
1332
  label: string;
1333
+ content: string;
811
1334
  }>]>, "many">>;
812
1335
  sourceContext: z.ZodOptional<z.ZodObject<{
813
1336
  sourceUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -818,12 +1341,12 @@ export declare const proposeVariantsInput: {
818
1341
  content: z.ZodString;
819
1342
  }, "strip", z.ZodTypeAny, {
820
1343
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
821
- content: string;
822
1344
  label: string;
1345
+ content: string;
823
1346
  }, {
824
1347
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
825
- content: string;
826
1348
  label: string;
1349
+ content: string;
827
1350
  }>, "many">>;
828
1351
  artifact: z.ZodOptional<z.ZodObject<{
829
1352
  sourceFindings: z.ZodArray<z.ZodString, "many">;
@@ -870,14 +1393,46 @@ export declare const proposeVariantsInput: {
870
1393
  screenshotReferences?: string[] | undefined;
871
1394
  risks?: string[] | undefined;
872
1395
  }>>;
1396
+ sourceIntent: z.ZodOptional<z.ZodObject<{
1397
+ sources: z.ZodArray<z.ZodObject<{
1398
+ url: z.ZodString;
1399
+ role: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
1400
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
1401
+ reason: z.ZodString;
1402
+ }, "strip", z.ZodTypeAny, {
1403
+ reason: string;
1404
+ url: string;
1405
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1406
+ confidence: "low" | "medium" | "high";
1407
+ }, {
1408
+ reason: string;
1409
+ url: string;
1410
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1411
+ confidence: "low" | "medium" | "high";
1412
+ }>, "many">;
1413
+ }, "strip", z.ZodTypeAny, {
1414
+ sources: {
1415
+ reason: string;
1416
+ url: string;
1417
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1418
+ confidence: "low" | "medium" | "high";
1419
+ }[];
1420
+ }, {
1421
+ sources: {
1422
+ reason: string;
1423
+ url: string;
1424
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1425
+ confidence: "low" | "medium" | "high";
1426
+ }[];
1427
+ }>>;
873
1428
  designDecision: z.ZodOptional<z.ZodEnum<["let_rivet_choose", "go_custom"]>>;
874
1429
  }, "strip", z.ZodTypeAny, {
875
1430
  sourceUrls?: string[] | undefined;
876
1431
  preserveBrand?: boolean | undefined;
877
1432
  sourceArtifacts?: {
878
1433
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
879
- content: string;
880
1434
  label: string;
1435
+ content: string;
881
1436
  }[] | undefined;
882
1437
  artifact?: {
883
1438
  sourceFindings: string[];
@@ -892,14 +1447,22 @@ export declare const proposeVariantsInput: {
892
1447
  screenshotReferences?: string[] | undefined;
893
1448
  risks?: string[] | undefined;
894
1449
  } | undefined;
1450
+ sourceIntent?: {
1451
+ sources: {
1452
+ reason: string;
1453
+ url: string;
1454
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1455
+ confidence: "low" | "medium" | "high";
1456
+ }[];
1457
+ } | undefined;
895
1458
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
896
1459
  }, {
897
1460
  sourceUrls?: string[] | undefined;
898
1461
  preserveBrand?: boolean | undefined;
899
1462
  sourceArtifacts?: {
900
1463
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
901
- content: string;
902
1464
  label: string;
1465
+ content: string;
903
1466
  }[] | undefined;
904
1467
  artifact?: {
905
1468
  sourceFindings: string[];
@@ -914,27 +1477,82 @@ export declare const proposeVariantsInput: {
914
1477
  screenshotReferences?: string[] | undefined;
915
1478
  risks?: string[] | undefined;
916
1479
  } | undefined;
1480
+ sourceIntent?: {
1481
+ sources: {
1482
+ reason: string;
1483
+ url: string;
1484
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1485
+ confidence: "low" | "medium" | "high";
1486
+ }[];
1487
+ } | undefined;
917
1488
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
918
1489
  }>>;
1490
+ /** Agent-supplied execution plan from `report_source_plan`. Drives the
1491
+ * generation routing decision at approve() time: `static_preview` keeps
1492
+ * the lightweight HTML-only path; `vite_app` provisions a real Vite
1493
+ * worktree per variant and copies any large assets from `assetPlan`. */
1494
+ executionPlan: z.ZodOptional<z.ZodObject<{
1495
+ mode: z.ZodEnum<["static_preview", "vite_app"]>;
1496
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
1497
+ reason: z.ZodString;
1498
+ assetPlan: z.ZodOptional<z.ZodArray<z.ZodObject<{
1499
+ source: z.ZodString;
1500
+ destination: z.ZodString;
1501
+ referenceAs: z.ZodString;
1502
+ }, "strip", z.ZodTypeAny, {
1503
+ source: string;
1504
+ destination: string;
1505
+ referenceAs: string;
1506
+ }, {
1507
+ source: string;
1508
+ destination: string;
1509
+ referenceAs: string;
1510
+ }>, "many">>;
1511
+ runtimeRequirements: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1512
+ userQuestion: z.ZodOptional<z.ZodString>;
1513
+ }, "strip", z.ZodTypeAny, {
1514
+ mode: "static_preview" | "vite_app";
1515
+ reason: string;
1516
+ confidence: "low" | "medium" | "high";
1517
+ assetPlan?: {
1518
+ source: string;
1519
+ destination: string;
1520
+ referenceAs: string;
1521
+ }[] | undefined;
1522
+ runtimeRequirements?: string[] | undefined;
1523
+ userQuestion?: string | undefined;
1524
+ }, {
1525
+ mode: "static_preview" | "vite_app";
1526
+ reason: string;
1527
+ confidence: "low" | "medium" | "high";
1528
+ assetPlan?: {
1529
+ source: string;
1530
+ destination: string;
1531
+ referenceAs: string;
1532
+ }[] | undefined;
1533
+ runtimeRequirements?: string[] | undefined;
1534
+ userQuestion?: string | undefined;
1535
+ }>>;
919
1536
  }, "strip", z.ZodTypeAny, {
920
1537
  kind: "fresh";
921
1538
  workspacePath: string;
922
1539
  framework?: "next" | "vite" | "remix" | "astro" | undefined;
1540
+ assetSourceRoot?: string | undefined;
923
1541
  designContext?: ({
924
1542
  slug: string;
925
1543
  kind: "slug";
926
1544
  } | {
927
1545
  kind: "markdown";
928
- content: string;
929
1546
  label: string;
1547
+ content: string;
930
1548
  })[] | undefined;
931
1549
  sourceContext?: {
932
1550
  sourceUrls?: string[] | undefined;
933
1551
  preserveBrand?: boolean | undefined;
934
1552
  sourceArtifacts?: {
935
1553
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
936
- content: string;
937
1554
  label: string;
1555
+ content: string;
938
1556
  }[] | undefined;
939
1557
  artifact?: {
940
1558
  sourceFindings: string[];
@@ -949,27 +1567,48 @@ export declare const proposeVariantsInput: {
949
1567
  screenshotReferences?: string[] | undefined;
950
1568
  risks?: string[] | undefined;
951
1569
  } | undefined;
1570
+ sourceIntent?: {
1571
+ sources: {
1572
+ reason: string;
1573
+ url: string;
1574
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1575
+ confidence: "low" | "medium" | "high";
1576
+ }[];
1577
+ } | undefined;
952
1578
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
953
1579
  } | undefined;
1580
+ executionPlan?: {
1581
+ mode: "static_preview" | "vite_app";
1582
+ reason: string;
1583
+ confidence: "low" | "medium" | "high";
1584
+ assetPlan?: {
1585
+ source: string;
1586
+ destination: string;
1587
+ referenceAs: string;
1588
+ }[] | undefined;
1589
+ runtimeRequirements?: string[] | undefined;
1590
+ userQuestion?: string | undefined;
1591
+ } | undefined;
954
1592
  }, {
955
1593
  kind: "fresh";
956
1594
  workspacePath: string;
957
1595
  framework?: "next" | "vite" | "remix" | "astro" | undefined;
1596
+ assetSourceRoot?: string | undefined;
958
1597
  designContext?: ({
959
1598
  slug: string;
960
1599
  kind: "slug";
961
1600
  } | {
962
1601
  kind: "markdown";
963
- content: string;
964
1602
  label: string;
1603
+ content: string;
965
1604
  })[] | undefined;
966
1605
  sourceContext?: {
967
1606
  sourceUrls?: string[] | undefined;
968
1607
  preserveBrand?: boolean | undefined;
969
1608
  sourceArtifacts?: {
970
1609
  kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
971
- content: string;
972
1610
  label: string;
1611
+ content: string;
973
1612
  }[] | undefined;
974
1613
  artifact?: {
975
1614
  sourceFindings: string[];
@@ -984,8 +1623,28 @@ export declare const proposeVariantsInput: {
984
1623
  screenshotReferences?: string[] | undefined;
985
1624
  risks?: string[] | undefined;
986
1625
  } | undefined;
1626
+ sourceIntent?: {
1627
+ sources: {
1628
+ reason: string;
1629
+ url: string;
1630
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1631
+ confidence: "low" | "medium" | "high";
1632
+ }[];
1633
+ } | undefined;
987
1634
  designDecision?: "let_rivet_choose" | "go_custom" | undefined;
988
1635
  } | undefined;
1636
+ executionPlan?: {
1637
+ mode: "static_preview" | "vite_app";
1638
+ reason: string;
1639
+ confidence: "low" | "medium" | "high";
1640
+ assetPlan?: {
1641
+ source: string;
1642
+ destination: string;
1643
+ referenceAs: string;
1644
+ }[] | undefined;
1645
+ runtimeRequirements?: string[] | undefined;
1646
+ userQuestion?: string | undefined;
1647
+ } | undefined;
989
1648
  }>]>>;
990
1649
  };
991
1650
  export type ProposeVariantsInput = {
@@ -1005,21 +1664,77 @@ export declare const reportVariantBriefsInput: {
1005
1664
  briefId: z.ZodString;
1006
1665
  label: z.ZodString;
1007
1666
  body: z.ZodString;
1667
+ /**
1668
+ * Optional per-brief visual reference URL. Uses the same synchronous
1669
+ * network-target guard as inspiration URLs before downstream agents fetch it.
1670
+ */
1671
+ visualReferenceUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1008
1672
  }, "strip", z.ZodTypeAny, {
1009
1673
  label: string;
1010
- briefId: string;
1011
1674
  body: string;
1675
+ briefId: string;
1676
+ visualReferenceUrl?: string | undefined;
1012
1677
  }, {
1013
1678
  label: string;
1014
- briefId: string;
1015
1679
  body: string;
1680
+ briefId: string;
1681
+ visualReferenceUrl?: string | undefined;
1016
1682
  }>, "many">;
1017
1683
  };
1018
- export declare const reportSourceContextInput: {
1019
- sessionId: z.ZodString;
1020
- workItemId: z.ZodString;
1021
- attempt: z.ZodNumber;
1022
- leaseId: z.ZodString;
1684
+ declare const browserDesignContextSchema: z.ZodObject<{
1685
+ url: z.ZodString;
1686
+ label: z.ZodString;
1687
+ markdown: z.ZodString;
1688
+ }, "strip", z.ZodTypeAny, {
1689
+ markdown: string;
1690
+ url: string;
1691
+ label: string;
1692
+ }, {
1693
+ markdown: string;
1694
+ url: string;
1695
+ label: string;
1696
+ }>;
1697
+ /**
1698
+ * Consolidated planning artifact reported by the agent in a single tool call.
1699
+ * Combines URL/role classification, research findings, browser-extracted
1700
+ * DESIGN.md per design_source URL, and the static_preview vs vite_app
1701
+ * execution decision. Replaces the prior `report_source_intent` +
1702
+ * `report_source_context` round-trips so source-grounded sessions only need
1703
+ * one planning hop before briefs.
1704
+ */
1705
+ export declare const sourcePlanArtifactSchema: z.ZodObject<{
1706
+ sourceIntent: z.ZodObject<{
1707
+ sources: z.ZodArray<z.ZodObject<{
1708
+ url: z.ZodString;
1709
+ role: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
1710
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
1711
+ reason: z.ZodString;
1712
+ }, "strip", z.ZodTypeAny, {
1713
+ reason: string;
1714
+ url: string;
1715
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1716
+ confidence: "low" | "medium" | "high";
1717
+ }, {
1718
+ reason: string;
1719
+ url: string;
1720
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1721
+ confidence: "low" | "medium" | "high";
1722
+ }>, "many">;
1723
+ }, "strip", z.ZodTypeAny, {
1724
+ sources: {
1725
+ reason: string;
1726
+ url: string;
1727
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1728
+ confidence: "low" | "medium" | "high";
1729
+ }[];
1730
+ }, {
1731
+ sources: {
1732
+ reason: string;
1733
+ url: string;
1734
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1735
+ confidence: "low" | "medium" | "high";
1736
+ }[];
1737
+ }>;
1023
1738
  sourceContext: z.ZodObject<{
1024
1739
  sourceFindings: z.ZodArray<z.ZodString, "many">;
1025
1740
  sectionInventory: z.ZodArray<z.ZodString, "many">;
@@ -1065,14 +1780,374 @@ export declare const reportSourceContextInput: {
1065
1780
  screenshotReferences?: string[] | undefined;
1066
1781
  risks?: string[] | undefined;
1067
1782
  }>;
1783
+ designContexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
1784
+ url: z.ZodString;
1785
+ label: z.ZodString;
1786
+ markdown: z.ZodString;
1787
+ }, "strip", z.ZodTypeAny, {
1788
+ markdown: string;
1789
+ url: string;
1790
+ label: string;
1791
+ }, {
1792
+ markdown: string;
1793
+ url: string;
1794
+ label: string;
1795
+ }>, "many">>;
1796
+ executionPlan: z.ZodObject<{
1797
+ mode: z.ZodEnum<["static_preview", "vite_app"]>;
1798
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
1799
+ reason: z.ZodString;
1800
+ assetPlan: z.ZodOptional<z.ZodArray<z.ZodObject<{
1801
+ source: z.ZodString;
1802
+ destination: z.ZodString;
1803
+ referenceAs: z.ZodString;
1804
+ }, "strip", z.ZodTypeAny, {
1805
+ source: string;
1806
+ destination: string;
1807
+ referenceAs: string;
1808
+ }, {
1809
+ source: string;
1810
+ destination: string;
1811
+ referenceAs: string;
1812
+ }>, "many">>;
1813
+ runtimeRequirements: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1814
+ userQuestion: z.ZodOptional<z.ZodString>;
1815
+ }, "strip", z.ZodTypeAny, {
1816
+ mode: "static_preview" | "vite_app";
1817
+ reason: string;
1818
+ confidence: "low" | "medium" | "high";
1819
+ assetPlan?: {
1820
+ source: string;
1821
+ destination: string;
1822
+ referenceAs: string;
1823
+ }[] | undefined;
1824
+ runtimeRequirements?: string[] | undefined;
1825
+ userQuestion?: string | undefined;
1826
+ }, {
1827
+ mode: "static_preview" | "vite_app";
1828
+ reason: string;
1829
+ confidence: "low" | "medium" | "high";
1830
+ assetPlan?: {
1831
+ source: string;
1832
+ destination: string;
1833
+ referenceAs: string;
1834
+ }[] | undefined;
1835
+ runtimeRequirements?: string[] | undefined;
1836
+ userQuestion?: string | undefined;
1837
+ }>;
1838
+ }, "strip", z.ZodTypeAny, {
1839
+ sourceIntent: {
1840
+ sources: {
1841
+ reason: string;
1842
+ url: string;
1843
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1844
+ confidence: "low" | "medium" | "high";
1845
+ }[];
1846
+ };
1847
+ sourceContext: {
1848
+ sourceFindings: string[];
1849
+ sectionInventory: string[];
1850
+ visualObservations: string[];
1851
+ sourceRoles: {
1852
+ url: string;
1853
+ role: "primary" | "inspiration" | "competitor";
1854
+ rationale?: string | undefined;
1855
+ }[];
1856
+ qualityBar: string[];
1857
+ screenshotReferences?: string[] | undefined;
1858
+ risks?: string[] | undefined;
1859
+ };
1860
+ executionPlan: {
1861
+ mode: "static_preview" | "vite_app";
1862
+ reason: string;
1863
+ confidence: "low" | "medium" | "high";
1864
+ assetPlan?: {
1865
+ source: string;
1866
+ destination: string;
1867
+ referenceAs: string;
1868
+ }[] | undefined;
1869
+ runtimeRequirements?: string[] | undefined;
1870
+ userQuestion?: string | undefined;
1871
+ };
1872
+ designContexts?: {
1873
+ markdown: string;
1874
+ url: string;
1875
+ label: string;
1876
+ }[] | undefined;
1877
+ }, {
1878
+ sourceIntent: {
1879
+ sources: {
1880
+ reason: string;
1881
+ url: string;
1882
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1883
+ confidence: "low" | "medium" | "high";
1884
+ }[];
1885
+ };
1886
+ sourceContext: {
1887
+ sourceFindings: string[];
1888
+ sectionInventory: string[];
1889
+ visualObservations: string[];
1890
+ sourceRoles: {
1891
+ url: string;
1892
+ role: "primary" | "inspiration" | "competitor";
1893
+ rationale?: string | undefined;
1894
+ }[];
1895
+ qualityBar: string[];
1896
+ screenshotReferences?: string[] | undefined;
1897
+ risks?: string[] | undefined;
1898
+ };
1899
+ executionPlan: {
1900
+ mode: "static_preview" | "vite_app";
1901
+ reason: string;
1902
+ confidence: "low" | "medium" | "high";
1903
+ assetPlan?: {
1904
+ source: string;
1905
+ destination: string;
1906
+ referenceAs: string;
1907
+ }[] | undefined;
1908
+ runtimeRequirements?: string[] | undefined;
1909
+ userQuestion?: string | undefined;
1910
+ };
1911
+ designContexts?: {
1912
+ markdown: string;
1913
+ url: string;
1914
+ label: string;
1915
+ }[] | undefined;
1916
+ }>;
1917
+ export type SourcePlanArtifact = z.infer<typeof sourcePlanArtifactSchema>;
1918
+ export type BrowserDesignContext = z.infer<typeof browserDesignContextSchema>;
1919
+ export declare const reportSourcePlanInput: {
1920
+ sessionId: z.ZodString;
1921
+ workItemId: z.ZodString;
1922
+ attempt: z.ZodNumber;
1923
+ leaseId: z.ZodString;
1924
+ sourcePlan: z.ZodObject<{
1925
+ sourceIntent: z.ZodObject<{
1926
+ sources: z.ZodArray<z.ZodObject<{
1927
+ url: z.ZodString;
1928
+ role: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
1929
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
1930
+ reason: z.ZodString;
1931
+ }, "strip", z.ZodTypeAny, {
1932
+ reason: string;
1933
+ url: string;
1934
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1935
+ confidence: "low" | "medium" | "high";
1936
+ }, {
1937
+ reason: string;
1938
+ url: string;
1939
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1940
+ confidence: "low" | "medium" | "high";
1941
+ }>, "many">;
1942
+ }, "strip", z.ZodTypeAny, {
1943
+ sources: {
1944
+ reason: string;
1945
+ url: string;
1946
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1947
+ confidence: "low" | "medium" | "high";
1948
+ }[];
1949
+ }, {
1950
+ sources: {
1951
+ reason: string;
1952
+ url: string;
1953
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
1954
+ confidence: "low" | "medium" | "high";
1955
+ }[];
1956
+ }>;
1957
+ sourceContext: z.ZodObject<{
1958
+ sourceFindings: z.ZodArray<z.ZodString, "many">;
1959
+ sectionInventory: z.ZodArray<z.ZodString, "many">;
1960
+ visualObservations: z.ZodArray<z.ZodString, "many">;
1961
+ sourceRoles: z.ZodArray<z.ZodObject<{
1962
+ url: z.ZodString;
1963
+ role: z.ZodEnum<["primary", "inspiration", "competitor"]>;
1964
+ rationale: z.ZodOptional<z.ZodString>;
1965
+ }, "strip", z.ZodTypeAny, {
1966
+ url: string;
1967
+ role: "primary" | "inspiration" | "competitor";
1968
+ rationale?: string | undefined;
1969
+ }, {
1970
+ url: string;
1971
+ role: "primary" | "inspiration" | "competitor";
1972
+ rationale?: string | undefined;
1973
+ }>, "many">;
1974
+ qualityBar: z.ZodArray<z.ZodString, "many">;
1975
+ screenshotReferences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1976
+ risks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1977
+ }, "strip", z.ZodTypeAny, {
1978
+ sourceFindings: string[];
1979
+ sectionInventory: string[];
1980
+ visualObservations: string[];
1981
+ sourceRoles: {
1982
+ url: string;
1983
+ role: "primary" | "inspiration" | "competitor";
1984
+ rationale?: string | undefined;
1985
+ }[];
1986
+ qualityBar: string[];
1987
+ screenshotReferences?: string[] | undefined;
1988
+ risks?: string[] | undefined;
1989
+ }, {
1990
+ sourceFindings: string[];
1991
+ sectionInventory: string[];
1992
+ visualObservations: string[];
1993
+ sourceRoles: {
1994
+ url: string;
1995
+ role: "primary" | "inspiration" | "competitor";
1996
+ rationale?: string | undefined;
1997
+ }[];
1998
+ qualityBar: string[];
1999
+ screenshotReferences?: string[] | undefined;
2000
+ risks?: string[] | undefined;
2001
+ }>;
2002
+ designContexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
2003
+ url: z.ZodString;
2004
+ label: z.ZodString;
2005
+ markdown: z.ZodString;
2006
+ }, "strip", z.ZodTypeAny, {
2007
+ markdown: string;
2008
+ url: string;
2009
+ label: string;
2010
+ }, {
2011
+ markdown: string;
2012
+ url: string;
2013
+ label: string;
2014
+ }>, "many">>;
2015
+ executionPlan: z.ZodObject<{
2016
+ mode: z.ZodEnum<["static_preview", "vite_app"]>;
2017
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
2018
+ reason: z.ZodString;
2019
+ assetPlan: z.ZodOptional<z.ZodArray<z.ZodObject<{
2020
+ source: z.ZodString;
2021
+ destination: z.ZodString;
2022
+ referenceAs: z.ZodString;
2023
+ }, "strip", z.ZodTypeAny, {
2024
+ source: string;
2025
+ destination: string;
2026
+ referenceAs: string;
2027
+ }, {
2028
+ source: string;
2029
+ destination: string;
2030
+ referenceAs: string;
2031
+ }>, "many">>;
2032
+ runtimeRequirements: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2033
+ userQuestion: z.ZodOptional<z.ZodString>;
2034
+ }, "strip", z.ZodTypeAny, {
2035
+ mode: "static_preview" | "vite_app";
2036
+ reason: string;
2037
+ confidence: "low" | "medium" | "high";
2038
+ assetPlan?: {
2039
+ source: string;
2040
+ destination: string;
2041
+ referenceAs: string;
2042
+ }[] | undefined;
2043
+ runtimeRequirements?: string[] | undefined;
2044
+ userQuestion?: string | undefined;
2045
+ }, {
2046
+ mode: "static_preview" | "vite_app";
2047
+ reason: string;
2048
+ confidence: "low" | "medium" | "high";
2049
+ assetPlan?: {
2050
+ source: string;
2051
+ destination: string;
2052
+ referenceAs: string;
2053
+ }[] | undefined;
2054
+ runtimeRequirements?: string[] | undefined;
2055
+ userQuestion?: string | undefined;
2056
+ }>;
2057
+ }, "strip", z.ZodTypeAny, {
2058
+ sourceIntent: {
2059
+ sources: {
2060
+ reason: string;
2061
+ url: string;
2062
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
2063
+ confidence: "low" | "medium" | "high";
2064
+ }[];
2065
+ };
2066
+ sourceContext: {
2067
+ sourceFindings: string[];
2068
+ sectionInventory: string[];
2069
+ visualObservations: string[];
2070
+ sourceRoles: {
2071
+ url: string;
2072
+ role: "primary" | "inspiration" | "competitor";
2073
+ rationale?: string | undefined;
2074
+ }[];
2075
+ qualityBar: string[];
2076
+ screenshotReferences?: string[] | undefined;
2077
+ risks?: string[] | undefined;
2078
+ };
2079
+ executionPlan: {
2080
+ mode: "static_preview" | "vite_app";
2081
+ reason: string;
2082
+ confidence: "low" | "medium" | "high";
2083
+ assetPlan?: {
2084
+ source: string;
2085
+ destination: string;
2086
+ referenceAs: string;
2087
+ }[] | undefined;
2088
+ runtimeRequirements?: string[] | undefined;
2089
+ userQuestion?: string | undefined;
2090
+ };
2091
+ designContexts?: {
2092
+ markdown: string;
2093
+ url: string;
2094
+ label: string;
2095
+ }[] | undefined;
2096
+ }, {
2097
+ sourceIntent: {
2098
+ sources: {
2099
+ reason: string;
2100
+ url: string;
2101
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
2102
+ confidence: "low" | "medium" | "high";
2103
+ }[];
2104
+ };
2105
+ sourceContext: {
2106
+ sourceFindings: string[];
2107
+ sectionInventory: string[];
2108
+ visualObservations: string[];
2109
+ sourceRoles: {
2110
+ url: string;
2111
+ role: "primary" | "inspiration" | "competitor";
2112
+ rationale?: string | undefined;
2113
+ }[];
2114
+ qualityBar: string[];
2115
+ screenshotReferences?: string[] | undefined;
2116
+ risks?: string[] | undefined;
2117
+ };
2118
+ executionPlan: {
2119
+ mode: "static_preview" | "vite_app";
2120
+ reason: string;
2121
+ confidence: "low" | "medium" | "high";
2122
+ assetPlan?: {
2123
+ source: string;
2124
+ destination: string;
2125
+ referenceAs: string;
2126
+ }[] | undefined;
2127
+ runtimeRequirements?: string[] | undefined;
2128
+ userQuestion?: string | undefined;
2129
+ };
2130
+ designContexts?: {
2131
+ markdown: string;
2132
+ url: string;
2133
+ label: string;
2134
+ }[] | undefined;
2135
+ }>;
1068
2136
  };
1069
- export type ReportSourceContextInput = {
2137
+ export type ReportSourcePlanInput = {
1070
2138
  sessionId: string;
1071
2139
  workItemId: string;
1072
2140
  attempt: number;
1073
2141
  leaseId: string;
1074
- sourceContext: SourceContextArtifact;
2142
+ sourcePlan: SourcePlanArtifact;
1075
2143
  };
2144
+ export interface SourcePlanWorkItemDescriptor {
2145
+ id: string;
2146
+ kind: 'source_plan';
2147
+ attempt: number;
2148
+ input: unknown;
2149
+ output_schema: unknown;
2150
+ }
1076
2151
  export type ReportVariantBriefsInput = {
1077
2152
  sessionId: string;
1078
2153
  workItemId: string;
@@ -1138,7 +2213,7 @@ export type CommitVariantOutput = {
1138
2213
  enqueued: boolean;
1139
2214
  duplicate: boolean;
1140
2215
  changedFilesCount: number;
1141
- payloadKind?: 'diff' | 'project-created';
2216
+ payloadKind?: 'diff' | 'diff-applied' | 'project-created';
1142
2217
  destinationPath?: string;
1143
2218
  } | {
1144
2219
  stage: 'failed';
@@ -1197,6 +2272,57 @@ export type ReportVariantCompleteInput = {
1197
2272
  tokensOut?: number;
1198
2273
  model?: string;
1199
2274
  };
2275
+ /**
2276
+ * Stateless inspiration-extraction kickoff. Agents call this before
2277
+ * `start_variants(mode='zero_to_one')` when the user provides inspiration
2278
+ * URLs or other source artifacts, then pass the returned `designContext`
2279
+ * (and optional `sourceContext` echo) into `start_variants`.
2280
+ */
2281
+ export declare const extractInspirationContextInput: {
2282
+ prompt: z.ZodString;
2283
+ count: z.ZodNumber;
2284
+ urls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2285
+ preserveBrand: z.ZodOptional<z.ZodBoolean>;
2286
+ sourceArtifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
2287
+ kind: z.ZodEnum<["urlText", "siteBrief", "visualBrief", "screenshotNotes"]>;
2288
+ label: z.ZodString;
2289
+ content: z.ZodString;
2290
+ }, "strip", z.ZodTypeAny, {
2291
+ kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
2292
+ label: string;
2293
+ content: string;
2294
+ }, {
2295
+ kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
2296
+ label: string;
2297
+ content: string;
2298
+ }>, "many">>;
2299
+ /** When true, bypass any cache entry and force a fresh fetch + extract. */
2300
+ forceRefresh: z.ZodOptional<z.ZodBoolean>;
2301
+ /** Caller-supplied correlation id, echoed into telemetry so this stateless
2302
+ * extraction can be tied to the subsequent `start_variants` call (which
2303
+ * accepts the same field) even though no session exists yet. */
2304
+ clientRequestId: z.ZodOptional<z.ZodString>;
2305
+ };
2306
+ export type ExtractInspirationContextInput = {
2307
+ prompt: string;
2308
+ count: number;
2309
+ urls?: string[];
2310
+ preserveBrand?: boolean;
2311
+ sourceArtifacts?: SourceArtifactInput[];
2312
+ forceRefresh?: boolean;
2313
+ clientRequestId?: string;
2314
+ };
2315
+ export type ExtractInspirationContextOutput = {
2316
+ designContext: DesignContextEntry[];
2317
+ warnings: string[];
2318
+ /** Echoed back so the agent can forward the same shape into
2319
+ * `start_variants(mode='zero_to_one')` without reconstructing it. */
2320
+ sourceContext?: SourceContextInput;
2321
+ } | {
2322
+ stage: 'failed';
2323
+ errorCode: ErrorCode;
2324
+ message: string;
2325
+ };
1200
2326
  export declare const cancelVariantsInput: {
1201
2327
  sessionId: z.ZodString;
1202
2328
  reason: z.ZodOptional<z.ZodString>;
@@ -1227,6 +2353,29 @@ export type CancelVariantOutput = {
1227
2353
  message: string;
1228
2354
  };
1229
2355
  export declare const startVariantsMode: z.ZodEnum<["existing", "zero_to_one"]>;
2356
+ /**
2357
+ * Brief content supplied by the agent through `start_variants`. The server
2358
+ * generates briefIds, so the agent only provides label + body (and an
2359
+ * optional visualReferenceUrl). Shape matches `briefSchema` minus briefId.
2360
+ */
2361
+ export declare const startVariantsBriefContent: z.ZodObject<Omit<{
2362
+ briefId: z.ZodString;
2363
+ label: z.ZodString;
2364
+ body: z.ZodString;
2365
+ /**
2366
+ * Optional per-brief visual reference URL. Uses the same synchronous
2367
+ * network-target guard as inspiration URLs before downstream agents fetch it.
2368
+ */
2369
+ visualReferenceUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
2370
+ }, "briefId">, "strip", z.ZodTypeAny, {
2371
+ label: string;
2372
+ body: string;
2373
+ visualReferenceUrl?: string | undefined;
2374
+ }, {
2375
+ label: string;
2376
+ body: string;
2377
+ visualReferenceUrl?: string | undefined;
2378
+ }>;
1230
2379
  export declare const startVariantsInput: {
1231
2380
  prompt: z.ZodString;
1232
2381
  count: z.ZodOptional<z.ZodNumber>;
@@ -1241,6 +2390,32 @@ export declare const startVariantsInput: {
1241
2390
  type: "element" | "file" | "route";
1242
2391
  ref: string;
1243
2392
  }>>;
2393
+ /**
2394
+ * Per-variant briefs supplied by the agent. When omitted, the server
2395
+ * falls back to a generic "Variant N" label + the prompt verbatim for
2396
+ * each body — UI shows that as the variant name/description, so the
2397
+ * agent should always supply briefs for human-readable variants. When
2398
+ * `briefs` is provided, its length determines the variant count
2399
+ * (overriding any explicit `count`).
2400
+ */
2401
+ briefs: z.ZodOptional<z.ZodArray<z.ZodObject<Omit<{
2402
+ briefId: z.ZodString;
2403
+ label: z.ZodString;
2404
+ body: z.ZodString;
2405
+ /**
2406
+ * Optional per-brief visual reference URL. Uses the same synchronous
2407
+ * network-target guard as inspiration URLs before downstream agents fetch it.
2408
+ */
2409
+ visualReferenceUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
2410
+ }, "briefId">, "strip", z.ZodTypeAny, {
2411
+ label: string;
2412
+ body: string;
2413
+ visualReferenceUrl?: string | undefined;
2414
+ }, {
2415
+ label: string;
2416
+ body: string;
2417
+ visualReferenceUrl?: string | undefined;
2418
+ }>, "many">>;
1244
2419
  /** Zero-to-one only: framework for the scaffolded project. Defaults to 'vite'. */
1245
2420
  framework: z.ZodOptional<z.ZodEnum<["vite"]>>;
1246
2421
  /** Zero-to-one only: absolute parent directory under which Rivet derives
@@ -1250,8 +2425,192 @@ export declare const startVariantsInput: {
1250
2425
  * server's current working directory. Used to detect framework and
1251
2426
  * auto-open the visual editor without a separate detect_project call. */
1252
2427
  projectPath: z.ZodOptional<z.ZodString>;
2428
+ /** Zero-to-one only: per-variant-slot design context produced upstream by
2429
+ * `extract_inspiration_context`. Threaded into the fresh worktree as
2430
+ * DESIGN.md per slot. Slot order matches variant order. */
2431
+ designContext: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2432
+ kind: z.ZodLiteral<"slug">;
2433
+ slug: z.ZodString;
2434
+ }, "strip", z.ZodTypeAny, {
2435
+ slug: string;
2436
+ kind: "slug";
2437
+ }, {
2438
+ slug: string;
2439
+ kind: "slug";
2440
+ }>, z.ZodObject<{
2441
+ kind: z.ZodLiteral<"markdown">;
2442
+ content: z.ZodString;
2443
+ label: z.ZodString;
2444
+ }, "strip", z.ZodTypeAny, {
2445
+ kind: "markdown";
2446
+ label: string;
2447
+ content: string;
2448
+ }, {
2449
+ kind: "markdown";
2450
+ label: string;
2451
+ content: string;
2452
+ }>]>, "many">>;
2453
+ /** Zero-to-one only: optional source-context metadata (inspiration URLs,
2454
+ * preserveBrand flag, sourceArtifacts). Forwarded to the worktree
2455
+ * scaffold so SOURCE_CONTEXT.md is written. */
2456
+ sourceContext: z.ZodOptional<z.ZodObject<{
2457
+ sourceUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2458
+ preserveBrand: z.ZodOptional<z.ZodBoolean>;
2459
+ sourceArtifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
2460
+ kind: z.ZodEnum<["urlText", "siteBrief", "visualBrief", "screenshotNotes"]>;
2461
+ label: z.ZodString;
2462
+ content: z.ZodString;
2463
+ }, "strip", z.ZodTypeAny, {
2464
+ kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
2465
+ label: string;
2466
+ content: string;
2467
+ }, {
2468
+ kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
2469
+ label: string;
2470
+ content: string;
2471
+ }>, "many">>;
2472
+ artifact: z.ZodOptional<z.ZodObject<{
2473
+ sourceFindings: z.ZodArray<z.ZodString, "many">;
2474
+ sectionInventory: z.ZodArray<z.ZodString, "many">;
2475
+ visualObservations: z.ZodArray<z.ZodString, "many">;
2476
+ sourceRoles: z.ZodArray<z.ZodObject<{
2477
+ url: z.ZodString;
2478
+ role: z.ZodEnum<["primary", "inspiration", "competitor"]>;
2479
+ rationale: z.ZodOptional<z.ZodString>;
2480
+ }, "strip", z.ZodTypeAny, {
2481
+ url: string;
2482
+ role: "primary" | "inspiration" | "competitor";
2483
+ rationale?: string | undefined;
2484
+ }, {
2485
+ url: string;
2486
+ role: "primary" | "inspiration" | "competitor";
2487
+ rationale?: string | undefined;
2488
+ }>, "many">;
2489
+ qualityBar: z.ZodArray<z.ZodString, "many">;
2490
+ screenshotReferences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2491
+ risks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2492
+ }, "strip", z.ZodTypeAny, {
2493
+ sourceFindings: string[];
2494
+ sectionInventory: string[];
2495
+ visualObservations: string[];
2496
+ sourceRoles: {
2497
+ url: string;
2498
+ role: "primary" | "inspiration" | "competitor";
2499
+ rationale?: string | undefined;
2500
+ }[];
2501
+ qualityBar: string[];
2502
+ screenshotReferences?: string[] | undefined;
2503
+ risks?: string[] | undefined;
2504
+ }, {
2505
+ sourceFindings: string[];
2506
+ sectionInventory: string[];
2507
+ visualObservations: string[];
2508
+ sourceRoles: {
2509
+ url: string;
2510
+ role: "primary" | "inspiration" | "competitor";
2511
+ rationale?: string | undefined;
2512
+ }[];
2513
+ qualityBar: string[];
2514
+ screenshotReferences?: string[] | undefined;
2515
+ risks?: string[] | undefined;
2516
+ }>>;
2517
+ sourceIntent: z.ZodOptional<z.ZodObject<{
2518
+ sources: z.ZodArray<z.ZodObject<{
2519
+ url: z.ZodString;
2520
+ role: z.ZodEnum<["design_source", "interaction_reference", "asset_source", "content_reference", "other"]>;
2521
+ confidence: z.ZodEnum<["low", "medium", "high"]>;
2522
+ reason: z.ZodString;
2523
+ }, "strip", z.ZodTypeAny, {
2524
+ reason: string;
2525
+ url: string;
2526
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
2527
+ confidence: "low" | "medium" | "high";
2528
+ }, {
2529
+ reason: string;
2530
+ url: string;
2531
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
2532
+ confidence: "low" | "medium" | "high";
2533
+ }>, "many">;
2534
+ }, "strip", z.ZodTypeAny, {
2535
+ sources: {
2536
+ reason: string;
2537
+ url: string;
2538
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
2539
+ confidence: "low" | "medium" | "high";
2540
+ }[];
2541
+ }, {
2542
+ sources: {
2543
+ reason: string;
2544
+ url: string;
2545
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
2546
+ confidence: "low" | "medium" | "high";
2547
+ }[];
2548
+ }>>;
2549
+ designDecision: z.ZodOptional<z.ZodEnum<["let_rivet_choose", "go_custom"]>>;
2550
+ }, "strip", z.ZodTypeAny, {
2551
+ sourceUrls?: string[] | undefined;
2552
+ preserveBrand?: boolean | undefined;
2553
+ sourceArtifacts?: {
2554
+ kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
2555
+ label: string;
2556
+ content: string;
2557
+ }[] | undefined;
2558
+ artifact?: {
2559
+ sourceFindings: string[];
2560
+ sectionInventory: string[];
2561
+ visualObservations: string[];
2562
+ sourceRoles: {
2563
+ url: string;
2564
+ role: "primary" | "inspiration" | "competitor";
2565
+ rationale?: string | undefined;
2566
+ }[];
2567
+ qualityBar: string[];
2568
+ screenshotReferences?: string[] | undefined;
2569
+ risks?: string[] | undefined;
2570
+ } | undefined;
2571
+ sourceIntent?: {
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
+ } | undefined;
2579
+ designDecision?: "let_rivet_choose" | "go_custom" | undefined;
2580
+ }, {
2581
+ sourceUrls?: string[] | undefined;
2582
+ preserveBrand?: boolean | undefined;
2583
+ sourceArtifacts?: {
2584
+ kind: "urlText" | "siteBrief" | "visualBrief" | "screenshotNotes";
2585
+ label: string;
2586
+ content: string;
2587
+ }[] | undefined;
2588
+ artifact?: {
2589
+ sourceFindings: string[];
2590
+ sectionInventory: string[];
2591
+ visualObservations: string[];
2592
+ sourceRoles: {
2593
+ url: string;
2594
+ role: "primary" | "inspiration" | "competitor";
2595
+ rationale?: string | undefined;
2596
+ }[];
2597
+ qualityBar: string[];
2598
+ screenshotReferences?: string[] | undefined;
2599
+ risks?: string[] | undefined;
2600
+ } | undefined;
2601
+ sourceIntent?: {
2602
+ sources: {
2603
+ reason: string;
2604
+ url: string;
2605
+ role: "other" | "design_source" | "interaction_reference" | "asset_source" | "content_reference";
2606
+ confidence: "low" | "medium" | "high";
2607
+ }[];
2608
+ } | undefined;
2609
+ designDecision?: "let_rivet_choose" | "go_custom" | undefined;
2610
+ }>>;
1253
2611
  clientRequestId: z.ZodOptional<z.ZodString>;
1254
2612
  };
2613
+ export type StartVariantsBriefContent = z.infer<typeof startVariantsBriefContent>;
1255
2614
  export type StartVariantsInput = {
1256
2615
  prompt: string;
1257
2616
  count?: number;
@@ -1260,7 +2619,10 @@ export type StartVariantsInput = {
1260
2619
  framework?: 'vite';
1261
2620
  destinationParent?: string;
1262
2621
  projectPath?: string;
2622
+ designContext?: DesignContextEntry[];
2623
+ sourceContext?: SourceContextInput;
1263
2624
  clientRequestId?: string;
2625
+ briefs?: StartVariantsBriefContent[];
1264
2626
  };
1265
2627
  /**
1266
2628
  * Variant entry in the start_variants response. Carries everything the
@@ -1312,13 +2674,6 @@ export interface BriefWorkItemDescriptor {
1312
2674
  input: unknown;
1313
2675
  output_schema: unknown;
1314
2676
  }
1315
- export interface SourceResearchWorkItemDescriptor {
1316
- id: string;
1317
- kind: 'source_research';
1318
- attempt: number;
1319
- input: unknown;
1320
- output_schema: unknown;
1321
- }
1322
2677
  export interface LeasedWorkItemDescriptor {
1323
2678
  id: string;
1324
2679
  kind: WorkItemKind;
@@ -1336,8 +2691,8 @@ export interface VisualEditorAttachment {
1336
2691
  }
1337
2692
  export type ProposeVariantsOutput = {
1338
2693
  sessionId: string;
1339
- stage: 'awaiting_source_research';
1340
- sourceResearchWorkItem: SourceResearchWorkItemDescriptor;
2694
+ stage: 'awaiting_source_plan';
2695
+ sourcePlanWorkItem: SourcePlanWorkItemDescriptor;
1341
2696
  nextAction: 'continue_variants';
1342
2697
  visualEditor?: VisualEditorAttachment;
1343
2698
  } | {
@@ -1363,9 +2718,16 @@ export type ReportVariantBriefsOutput = {
1363
2718
  errorCode: ErrorCode;
1364
2719
  message: string;
1365
2720
  };
1366
- export type ReportSourceContextOutput = {
2721
+ export type ReportSourcePlanOutput = {
1367
2722
  stage: 'awaiting_briefs';
1368
2723
  briefWorkItem: BriefWorkItemDescriptor;
2724
+ executionPlan: {
2725
+ mode: ExecutionMode;
2726
+ confidence: ExecutionConfidence;
2727
+ reason: string;
2728
+ assetCount: number;
2729
+ runtimeRequirementCount: number;
2730
+ };
1369
2731
  nextAction: 'report_variant_briefs';
1370
2732
  } | {
1371
2733
  stage: 'failed';
@@ -1373,11 +2735,16 @@ export type ReportSourceContextOutput = {
1373
2735
  message: string;
1374
2736
  };
1375
2737
  export type ContinueVariantsOutput = {
1376
- stage: 'awaiting_source_research';
2738
+ stage: 'awaiting_source_plan';
1377
2739
  progress: {
1378
2740
  ready: number;
1379
2741
  total: number;
1380
2742
  };
2743
+ } | {
2744
+ stage: 'awaiting_source_plan';
2745
+ leaseId: string;
2746
+ leaseTtlMs: number;
2747
+ leasedWorkItems: LeasedWorkItemDescriptor[];
1381
2748
  } | {
1382
2749
  stage: 'awaiting_approval';
1383
2750
  briefs: Brief[];
@@ -1396,6 +2763,18 @@ export type ContinueVariantsOutput = {
1396
2763
  } | {
1397
2764
  stage: 'ready' | 'degraded' | 'failed' | 'cancelled';
1398
2765
  summary: TerminalSummary;
2766
+ /** Human-readable retry/continue/cancel prompt populated when any
2767
+ * succeeded-then-QA-failed variant is present in the summary. The
2768
+ * calling agent should surface this directly to the user. */
2769
+ qaPrompt?: string;
2770
+ /** Per-variant QA verdicts for variants with a `qa` result. Only
2771
+ * variants with a non-`not_run` status are included so the field
2772
+ * stays empty when nothing interesting has happened. */
2773
+ qa?: Array<{
2774
+ workItemId: string;
2775
+ label?: string;
2776
+ qa: VariantQaResult;
2777
+ }>;
1399
2778
  };
1400
2779
  export type ReportVariantCompleteOutput = {
1401
2780
  stage: 'waiting_for_results';
@@ -1406,6 +2785,13 @@ export type ReportVariantCompleteOutput = {
1406
2785
  } | {
1407
2786
  stage: 'ready' | 'degraded' | 'failed' | 'cancelled';
1408
2787
  summary: TerminalSummary;
2788
+ /** See `ContinueVariantsOutput.qaPrompt`. */
2789
+ qaPrompt?: string;
2790
+ qa?: Array<{
2791
+ workItemId: string;
2792
+ label?: string;
2793
+ qa: VariantQaResult;
2794
+ }>;
1409
2795
  };
1410
2796
  export type CancelVariantsOutput = {
1411
2797
  stage: 'cancelled';
@@ -1425,12 +2811,32 @@ export interface TerminalSummary {
1425
2811
  label?: string;
1426
2812
  }>;
1427
2813
  }
1428
- export type VariantPickPayload = {
2814
+ export type VariantPickPayload =
2815
+ /**
2816
+ * Server-internal raw diff payload. Retained so unit tests and callers that
2817
+ * predate server-side apply can still introspect the diff body. The
2818
+ * production commit path now applies the diff before enqueueing and emits
2819
+ * `diff-applied` to the bridge so MCP agents don't re-apply.
2820
+ */
2821
+ {
1429
2822
  kind: 'diff';
1430
2823
  diff: string;
1431
2824
  target?: Target;
1432
2825
  changedFilesCount: number;
1433
2826
  }
2827
+ /**
2828
+ * Agent-facing post-apply state for existing-project picks. The variant's
2829
+ * unified diff has already been applied to the user's working tree
2830
+ * (uncommitted). Agents must NOT run `git apply` again — just inform the
2831
+ * user and proceed.
2832
+ */
2833
+ | {
2834
+ kind: 'diff-applied';
2835
+ diff: string;
2836
+ target?: Target;
2837
+ changedFilesCount: number;
2838
+ note: string;
2839
+ }
1434
2840
  /**
1435
2841
  * Server-internal pre-materialize state for fresh-project picks. Held while
1436
2842
  * the orchestrator copies `sourceWorktreePath` to `destinationPath`. Never