rivet-design 0.9.2 → 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 (157) hide show
  1. package/dist/mcp/agent-variants/SessionStore.d.ts +78 -2
  2. package/dist/mcp/agent-variants/SessionStore.d.ts.map +1 -1
  3. package/dist/mcp/agent-variants/SessionStore.js +464 -62
  4. package/dist/mcp/agent-variants/SessionStore.js.map +1 -1
  5. package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts +331 -9
  6. package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts.map +1 -1
  7. package/dist/mcp/agent-variants/WorktreeOrchestrator.js +1985 -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 +2508 -10
  14. package/dist/mcp/agent-variants/contracts.d.ts.map +1 -1
  15. package/dist/mcp/agent-variants/contracts.js +295 -5
  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 +241 -0
  22. package/dist/mcp/agent-variants/createZeroToOneTool.d.ts.map +1 -0
  23. package/dist/mcp/agent-variants/createZeroToOneTool.js +213 -0
  24. package/dist/mcp/agent-variants/createZeroToOneTool.js.map +1 -0
  25. package/dist/mcp/agent-variants/designContextStore.d.ts +160 -0
  26. package/dist/mcp/agent-variants/designContextStore.d.ts.map +1 -0
  27. package/dist/mcp/agent-variants/designContextStore.js +295 -0
  28. package/dist/mcp/agent-variants/designContextStore.js.map +1 -0
  29. package/dist/mcp/agent-variants/elementRefToTarget.d.ts +21 -0
  30. package/dist/mcp/agent-variants/elementRefToTarget.d.ts.map +1 -0
  31. package/dist/mcp/agent-variants/elementRefToTarget.js +47 -0
  32. package/dist/mcp/agent-variants/elementRefToTarget.js.map +1 -0
  33. package/dist/mcp/agent-variants/errors.d.ts +1 -1
  34. package/dist/mcp/agent-variants/errors.d.ts.map +1 -1
  35. package/dist/mcp/agent-variants/errors.js +7 -0
  36. package/dist/mcp/agent-variants/errors.js.map +1 -1
  37. package/dist/mcp/agent-variants/index.d.ts +4 -2
  38. package/dist/mcp/agent-variants/index.d.ts.map +1 -1
  39. package/dist/mcp/agent-variants/index.js +7 -1
  40. package/dist/mcp/agent-variants/index.js.map +1 -1
  41. package/dist/mcp/agent-variants/inspirationDesignContext.d.ts +440 -0
  42. package/dist/mcp/agent-variants/inspirationDesignContext.d.ts.map +1 -0
  43. package/dist/mcp/agent-variants/inspirationDesignContext.js +2467 -0
  44. package/dist/mcp/agent-variants/inspirationDesignContext.js.map +1 -0
  45. package/dist/mcp/agent-variants/pendingChangesAdapter.d.ts.map +1 -1
  46. package/dist/mcp/agent-variants/pendingChangesAdapter.js +21 -7
  47. package/dist/mcp/agent-variants/pendingChangesAdapter.js.map +1 -1
  48. package/dist/mcp/agent-variants/previewQa.d.ts +61 -0
  49. package/dist/mcp/agent-variants/previewQa.d.ts.map +1 -0
  50. package/dist/mcp/agent-variants/previewQa.js +374 -0
  51. package/dist/mcp/agent-variants/previewQa.js.map +1 -0
  52. package/dist/mcp/agent-variants/sourceContext.d.ts +8 -0
  53. package/dist/mcp/agent-variants/sourceContext.d.ts.map +1 -0
  54. package/dist/mcp/agent-variants/sourceContext.js +183 -0
  55. package/dist/mcp/agent-variants/sourceContext.js.map +1 -0
  56. package/dist/mcp/agent-variants/tools.d.ts +36 -0
  57. package/dist/mcp/agent-variants/tools.d.ts.map +1 -1
  58. package/dist/mcp/agent-variants/tools.js +451 -19
  59. package/dist/mcp/agent-variants/tools.js.map +1 -1
  60. package/dist/mcp/changeBatchClassification.d.ts +30 -0
  61. package/dist/mcp/changeBatchClassification.d.ts.map +1 -0
  62. package/dist/mcp/changeBatchClassification.js +65 -0
  63. package/dist/mcp/changeBatchClassification.js.map +1 -0
  64. package/dist/mcp/server.d.ts.map +1 -1
  65. package/dist/mcp/server.js +258 -41
  66. package/dist/mcp/server.js.map +1 -1
  67. package/dist/prompts/agentModPrompts.js +4 -4
  68. package/dist/prompts/agentModPrompts.js.map +1 -1
  69. package/dist/proxy-middleware/proxy-config.d.ts.map +1 -1
  70. package/dist/proxy-middleware/proxy-config.js +1 -15
  71. package/dist/proxy-middleware/proxy-config.js.map +1 -1
  72. package/dist/routes/agentVariants.d.ts +3 -1
  73. package/dist/routes/agentVariants.d.ts.map +1 -1
  74. package/dist/routes/agentVariants.js +138 -13
  75. package/dist/routes/agentVariants.js.map +1 -1
  76. package/dist/routes/mcp.d.ts +7 -1
  77. package/dist/routes/mcp.d.ts.map +1 -1
  78. package/dist/routes/mcp.js +139 -16
  79. package/dist/routes/mcp.js.map +1 -1
  80. package/dist/server.d.ts.map +1 -1
  81. package/dist/server.js +23 -5
  82. package/dist/server.js.map +1 -1
  83. package/dist/services/ProjectDetectionService.d.ts.map +1 -1
  84. package/dist/services/ProjectDetectionService.js +9 -0
  85. package/dist/services/ProjectDetectionService.js.map +1 -1
  86. package/dist/services/SessionBridgeService.d.ts +22 -0
  87. package/dist/services/SessionBridgeService.d.ts.map +1 -1
  88. package/dist/services/SessionBridgeService.js +61 -0
  89. package/dist/services/SessionBridgeService.js.map +1 -1
  90. package/dist/services/TelemetryService.d.ts +121 -0
  91. package/dist/services/TelemetryService.d.ts.map +1 -1
  92. package/dist/services/TelemetryService.js +155 -0
  93. package/dist/services/TelemetryService.js.map +1 -1
  94. package/dist/services/WorktreeManager.d.ts +116 -6
  95. package/dist/services/WorktreeManager.d.ts.map +1 -1
  96. package/dist/services/WorktreeManager.js +394 -19
  97. package/dist/services/WorktreeManager.js.map +1 -1
  98. package/dist/services/agent/AgentModService.js +6 -6
  99. package/dist/services/agent/AgentModService.js.map +1 -1
  100. package/dist/services/templates/designCatalog.d.ts +27 -0
  101. package/dist/services/templates/designCatalog.d.ts.map +1 -0
  102. package/dist/services/templates/designCatalog.js +141 -0
  103. package/dist/services/templates/designCatalog.js.map +1 -0
  104. package/dist/services/templates/designmd/airbnb.md +545 -0
  105. package/dist/services/templates/designmd/airtable.md +554 -0
  106. package/dist/services/templates/designmd/apple.md +562 -0
  107. package/dist/services/templates/designmd/binance.md +634 -0
  108. package/dist/services/templates/designmd/bmw-m.md +503 -0
  109. package/dist/services/templates/designmd/bmw.md +544 -0
  110. package/dist/services/templates/designmd/bugatti.md +454 -0
  111. package/dist/services/templates/designmd/cal.md +542 -0
  112. package/dist/services/templates/designmd/claude.md +589 -0
  113. package/dist/services/templates/designmd/clay.md +541 -0
  114. package/dist/services/templates/designmd/cohere.md +451 -0
  115. package/dist/services/templates/designmd/cursor.md +537 -0
  116. package/dist/services/templates/designmd/expo.md +526 -0
  117. package/dist/services/templates/designmd/figma.md +578 -0
  118. package/dist/services/templates/designmd/framer.md +544 -0
  119. package/dist/services/templates/designmd/hp.md +670 -0
  120. package/dist/services/templates/designmd/linear.app.md +548 -0
  121. package/dist/services/templates/designmd/mintlify.md +852 -0
  122. package/dist/services/templates/designmd/miro.md +825 -0
  123. package/dist/services/templates/designmd/notion.md +821 -0
  124. package/dist/services/templates/designmd/raycast.md +669 -0
  125. package/dist/services/templates/designmd/resend.md +585 -0
  126. package/dist/services/templates/designmd/sentry.md +262 -0
  127. package/dist/services/templates/designmd/shopify.md +350 -0
  128. package/dist/services/templates/designmd/spotify.md +246 -0
  129. package/dist/services/templates/designmd/stripe.md +322 -0
  130. package/dist/services/templates/designmd/supabase.md +255 -0
  131. package/dist/services/templates/designmd/superhuman.md +252 -0
  132. package/dist/services/templates/designmd/uber.md +295 -0
  133. package/dist/services/templates/designmd/vercel.md +310 -0
  134. package/dist/services/templates/viteReactTs.d.ts +48 -0
  135. package/dist/services/templates/viteReactTs.d.ts.map +1 -0
  136. package/dist/services/templates/viteReactTs.js +274 -0
  137. package/dist/services/templates/viteReactTs.js.map +1 -0
  138. package/dist/types/change-request-types.d.ts +29 -3
  139. package/dist/types/change-request-types.d.ts.map +1 -1
  140. package/dist/utils/skills/claude-skill.d.ts +2 -2
  141. package/dist/utils/skills/claude-skill.d.ts.map +1 -1
  142. package/dist/utils/skills/claude-skill.js +19 -98
  143. package/dist/utils/skills/claude-skill.js.map +1 -1
  144. package/dist/utils/skills/cursor-rules.d.ts +2 -2
  145. package/dist/utils/skills/cursor-rules.d.ts.map +1 -1
  146. package/dist/utils/skills/cursor-rules.js +15 -80
  147. package/dist/utils/skills/cursor-rules.js.map +1 -1
  148. package/dist/utils/skills/shared-variants-protocol.d.ts +23 -0
  149. package/dist/utils/skills/shared-variants-protocol.d.ts.map +1 -0
  150. package/dist/utils/skills/shared-variants-protocol.js +130 -0
  151. package/dist/utils/skills/shared-variants-protocol.js.map +1 -0
  152. package/package.json +6 -6
  153. package/src/ui/dist/assets/main-CpX7fB64.js +382 -0
  154. package/src/ui/dist/assets/main-Qqe2_oMT.css +1 -0
  155. package/src/ui/dist/index.html +2 -2
  156. package/src/ui/dist/assets/main-AsPCtLsx.js +0 -382
  157. package/src/ui/dist/assets/main-BzmseUDd.css +0 -1
@@ -1,9 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CURSOR_RULES_CONTENT = exports.CURSOR_RULES_FILENAME = exports.CURSOR_RULES_VERSION = void 0;
4
- exports.CURSOR_RULES_VERSION = 12;
4
+ const shared_variants_protocol_1 = require("./shared-variants-protocol");
5
+ exports.CURSOR_RULES_VERSION = 20;
5
6
  exports.CURSOR_RULES_FILENAME = 'rivet.mdc';
6
7
  const CURSOR_RULES_VERSION_MARKER = `rivet-rules-version: ${exports.CURSOR_RULES_VERSION}`;
8
+ const AGENT_VARIANTS_SECTION = (0, shared_variants_protocol_1.buildAgentVariantsSection)({
9
+ inChatEmphasis: 'in chat',
10
+ step9: `**Run all leased code-gen items IN PARALLEL** via parallel tool calls in a single response. For each:
11
+ - Read \`input.briefBody\` and \`input.target\`
12
+ - Edit files in \`input.worktreePath\` (each variant has its own isolated worktree)
13
+ - Call \`report_variant_complete({ sessionId, workItemId, leaseId, attempt, status: 'succeeded' })\`. On failure, status \`'failed'\` with error description.`,
14
+ step11Suffix: `When \`hasChanges: true\`, you'll see a \`VariantChangeItem\` in \`changes[]\`.`,
15
+ nativeGenLabel: 'Task tool',
16
+ });
7
17
  exports.CURSOR_RULES_CONTENT = `---
8
18
  description: Rivet — apply when the user says "open rivet", "open the visual editor", "create variants", "show me options for X", "build me X from scratch", "create a new Y app", or wants to make visual/UI changes or explore design directions
9
19
  alwaysApply: false
@@ -15,14 +25,7 @@ Two flows: the **visual editor** (point-and-click changes to a running web app)
15
25
 
16
26
  > Tip: type \`@rivet.mdc\` in chat to invoke this rule manually.
17
27
 
18
- ## Picking the flow
19
-
20
- | User says | Flow |
21
- |---|---|
22
- | "open rivet", "make a visual change to X" | **Visual editor** (below) |
23
- | "create variants of X", "show me 3-5 options for X", "explore approaches to X" | **Agent variants** |
24
- | "build me a settings page from scratch", "add a feature for Y" | **Agent variants** (no \`target\`) |
25
- | "create a new Vite todo app", "scaffold a Next.js dashboard" | **Agent variants** (\`projectContext.kind=fresh\`) |
28
+ ${shared_variants_protocol_1.PICKING_THE_FLOW_TABLE}
26
29
 
27
30
  ## Visual Editor flow
28
31
 
@@ -30,8 +33,8 @@ Two flows: the **visual editor** (point-and-click changes to a running web app)
30
33
 
31
34
  1. Call \`detect_project\` — returns project info including \`framework\` and \`projectPath\`
32
35
  2. Call \`open_visual_editor({ projectPath, framework })\` — do NOT pass \`startPort\` or any port; the tool handles port selection automatically
33
- 4. Tell the user: "Rivet is ready — make your visual changes and click 'Send to Cursor'."
34
- 5. Call \`watch_for_changes({ sessionId })\` to wait for the user's changes.
36
+ 3. Tell the user: "Rivet is ready — make your visual changes and click 'Send to Cursor'."
37
+ 4. Call \`watch_for_changes({ sessionId })\` to wait for the user's changes.
35
38
 
36
39
  ## Watching and applying
37
40
 
@@ -58,74 +61,6 @@ When the user says they're done, call \`close_visual_editor({ sessionId })\`.
58
61
 
59
62
  ---
60
63
 
61
- ## Agent Variants flow
62
-
63
- For requests like *"create variants of X"*, *"show me 3-5 options for the dropdown"*, *"build me a settings page"*, or *"create a new Vite todo app"* — DO NOT generate variants natively via parallel tool calls. Use this protocol so the user reviews design directions in chat, sees the actual code variants render in parallel, and picks based on the rendered code.
64
-
65
- ### Step-by-step
66
-
67
- 1. **Call \`propose_variants\`** with:
68
- - \`prompt\`: the user's request verbatim
69
- - \`count\`: 3-5 (default 4)
70
- - \`target\` (optional): \`{ type: 'element'|'file'|'route', ref }\` — set this for refinement requests pinned to a specific element/file/route
71
- - \`projectContext\` (optional):
72
- - For brand-new projects: \`{ kind: 'fresh', workspacePath: '/abs/path', framework: 'vite'|'next'|'astro'|'remix' }\`
73
- - Otherwise omit (defaults to existing project)
74
-
75
- Response: \`{ sessionId, briefWorkItem }\`. The brief work item carries an \`input\` blob; you must run it next.
76
-
77
- 2. **Run the brief work item using YOUR own LLM** — generate \`count\` design briefs as \`{ briefId, label, body }\`. Label is short (≤ 4 words). Body is 1-2 sentences describing the design direction. Do NOT call any Rivet tool; this is your LLM doing creative work.
78
-
79
- 3. **Call \`report_variant_briefs\`** with the briefs, plus the \`workItemId\` and \`attempt: 0\`.
80
-
81
- 3.5. **Ensure the Rivet visual editor is open.** If you haven't already opened it in this session, call \`detect_project\` then \`open_visual_editor({ projectPath, framework })\` now — DON'T wait for the user to ask. The user will need the iframe open to see variants render. If a session is already active (\`open_visual_editor\` returns a friendly error), just continue. Once the editor opens, the chip at the bottom-center of the iframe will show generation progress.
82
-
83
- 4. **Show the briefs to the user IN CHAT** as a numbered list. Ask "Look good or want me to adjust any of them?" — DO NOT ask which one to pick. The pick happens AFTER they've seen the actual code.
84
- Example:
85
- > Here are 4 directions:
86
- > 1. **Spring blur** — Apple-style spring with ambient blur and soft edges
87
- > 2. **Linear sharp** — Crisp, fast, minimal padding
88
- > 3. **Notion soft** — Rounded, calm, neutral palette
89
- > 4. **Monoline editorial** — Tight typography, single accent color
90
- > Look good, or want me to adjust any of them?
91
-
92
- 5. **Wait for the user's reply.** Affirmative ("looks good", "go", "yep") → proceed with all briefs. Tweak request ("make #2 feel more like Linear") → call \`approve_variant_briefs\` with \`selections\` containing \`bodyOverride\` per brief, OR re-run the brief work item with new framing. Reject all → call \`cancel_variants\` and start over.
93
-
94
- 6. **Call \`approve_variant_briefs({ sessionId, briefIds: [all chosen briefs] })\`**. Response: \`{ stage: 'work_items_ready', codeGenWorkItemIds: [...] }\` — one work item per approved brief.
95
-
96
- 7. **Lease the work** with \`continue_variants({ sessionId, action: 'request_work' })\`. Response has \`leaseId\`, \`leaseTtlMs\`, and \`leasedWorkItems[]\` — one per approved brief (plus a preceding \`scaffold_base\` for fresh-project; lease scaffold first, succeed it, then re-lease for the code-gens).
97
-
98
- 8. **Run all leased code-gen items IN PARALLEL** via parallel tool calls in a single response. For each:
99
- - Read \`input.briefBody\` and \`input.target\`
100
- - Edit files in \`input.worktreePath\` (each variant has its own isolated worktree)
101
- - Call \`report_variant_complete({ sessionId, workItemId, leaseId, attempt, status: 'succeeded' })\`. On failure, status \`'failed'\` with error description.
102
-
103
- 9. **When all variants are done (\`stage: 'ready'\` or \`'degraded'\`), tell the user the variants are ready and explain how to compare them.** Each variant has its own dev server running in an isolated worktree. The Rivet iframe shows a chip at the bottom-center: prev/label/next/check/dismiss. The user cycles between the live, running variants by clicking prev/next (the iframe re-mounts onto the variant's dev server in ~50ms via proxy retarget). When they like one, they click the check on the chip — that commits the variant.
104
- Example reply:
105
- > Variants are ready — open the Rivet preview and use the chip at the bottom of the iframe to cycle between them. Click the checkmark on the one you want and I'll apply it.
106
-
107
- You do NOT need to print diffs in chat. The user picks visually in the iframe.
108
-
109
- 10. **Watch for the user's pick.** Either:
110
- a) Use \`watch_for_changes({ sessionId })\` (existing tool) which blocks until the user clicks the check on the chip, OR
111
- b) Poll \`get_pending_changes({ sessionId })\` periodically.
112
- When \`hasChanges: true\`, you'll see a \`VariantChangeItem\` in \`changes[]\`.
113
-
114
- 11. **Apply the variant.** From the \`VariantChangeItem\` payload:
115
- - \`payload.kind === 'diff'\` → \`git apply\` the unified diff against the user's project root
116
- - \`payload.kind === 'new-project'\` → copy the contents of \`payload.sourceWorktreePath\` to \`destinationPath\`
117
- Tell the user which variant you applied (use \`variantLabel\` from the change item).
118
-
119
- You can also call \`commit_variant({ sessionId, variantId })\` yourself if the user expressed their pick in chat instead of clicking the chip ("go with #2", "the spring one") — same effect, just routed through the agent rather than the chip.
120
-
121
- ### Rules
122
-
123
- - **Never** generate variants natively (Task tool, parallel tool calls, your own creative process) without going through \`propose_variants\` first.
124
- - Always pass the user's prompt verbatim — don't paraphrase.
125
- - Briefs are shown as PLAIN TEXT in chat. Do not render UI, open a browser tab, or fabricate a URL.
126
- - The user picks AFTER seeing the variants render LIVE in the iframe, not before. Step 4 is "look good or adjust the briefs?"; step 9 hands off to the iframe chip for visual cycling + commit.
127
- - Don't dump diffs in chat by default. The iframe chip is the primary review surface. If the user explicitly asks "show me the diffs", then print them.
128
- - Step 8 (parallel code-gen) is the only step where you fan out — every other step is one tool call.
129
- - For fresh-project, \`scaffold_base\` runs first; only after it succeeds are the \`code_gen\` items leasable. Loop \`continue_variants(action='request_work')\` after each transition.
64
+ ${AGENT_VARIANTS_SECTION}
130
65
  `;
131
66
  //# sourceMappingURL=cursor-rules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cursor-rules.js","sourceRoot":"","sources":["../../../src/utils/skills/cursor-rules.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,EAAE,CAAC;AAC1B,QAAA,qBAAqB,GAAG,WAAW,CAAC;AACjD,MAAM,2BAA2B,GAAG,wBAAwB,4BAAoB,EAAE,CAAC;AAEtE,QAAA,oBAAoB,GAAG;;;;OAI7B,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuHjC,CAAC"}
1
+ {"version":3,"file":"cursor-rules.js","sourceRoot":"","sources":["../../../src/utils/skills/cursor-rules.ts"],"names":[],"mappings":";;;AAAA,yEAGoC;AAEvB,QAAA,oBAAoB,GAAG,EAAE,CAAC;AAC1B,QAAA,qBAAqB,GAAG,WAAW,CAAC;AACjD,MAAM,2BAA2B,GAAG,wBAAwB,4BAAoB,EAAE,CAAC;AAEnF,MAAM,sBAAsB,GAAG,IAAA,oDAAyB,EAAC;IACvD,cAAc,EAAE,SAAS;IACzB,KAAK,EAAE;;;iKAGwJ;IAC/J,YAAY,EAAE,iFAAiF;IAC/F,cAAc,EAAE,WAAW;CAC5B,CAAC,CAAC;AAEU,QAAA,oBAAoB,GAAG;;;;OAI7B,2BAA2B;;;;;;;EAOhC,iDAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCtB,sBAAsB;CACvB,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Canonical brief format instruction — single source of truth.
3
+ * Imported by claude-skill.ts, cursor-rules.ts, and tools.ts so the
4
+ * wording can never silently diverge between agents.
5
+ */
6
+ export declare const BRIEF_FORMAT_INSTRUCTION: string;
7
+ /** Routing table — identical in every agent skill file */
8
+ export declare const PICKING_THE_FLOW_TABLE = "## Picking the flow\n\n| User says | Flow |\n|---|---|\n| \"open rivet\", \"make a visual change to X\" | **Visual editor** (below) |\n| \"create variants of X\", \"show me 3-5 options for X\", \"explore approaches to X\" | **Agent variants \u2014 existing project** (`start_variants`, `mode='existing'`) |\n| \"build me a settings page from scratch\", \"add a feature for Y\" | **Agent variants \u2014 existing project** (`start_variants`, no `target`) |\n| \"create a new Vite todo app\", \"scaffold a fresh dashboard\" | **Agent variants \u2014 fresh project** (`start_variants`, `mode='zero_to_one'`) |\n| \"build me a dashboard like stripe.com\", \"use this URL as inspiration\" | **Agent variants \u2014 fresh, source-grounded** (`extract_inspiration_context` \u2192 `start_variants`, `mode='zero_to_one'`) |";
9
+ /**
10
+ * Builds the full Agent Variants flow section, parameterised on the small
11
+ * number of lines that differ between Claude Code and Cursor.
12
+ */
13
+ export declare function buildAgentVariantsSection(opts: {
14
+ /** "IN THIS CHAT" for Claude Code, "in chat" for Cursor */
15
+ inChatEmphasis: string;
16
+ /** Full text of the parallel code-gen step (mechanism differs per agent) */
17
+ step9: string;
18
+ /** Closing sentence of the watch step (how changes are surfaced differs slightly) */
19
+ step11Suffix: string;
20
+ /** Label used in the "never generate natively" rule, e.g. "Task sub-agents" or "Task tool" */
21
+ nativeGenLabel: string;
22
+ }): string;
23
+ //# sourceMappingURL=shared-variants-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-variants-protocol.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/shared-variants-protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAGgF,CAAC;AAEtH,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB,mzBAQoK,CAAC;AAExM;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,2DAA2D;IAC3D,cAAc,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,qFAAqF;IACrF,YAAY,EAAE,MAAM,CAAC;IACrB,8FAA8F;IAC9F,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,MAAM,CAsGT"}
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PICKING_THE_FLOW_TABLE = exports.BRIEF_FORMAT_INSTRUCTION = void 0;
4
+ exports.buildAgentVariantsSection = buildAgentVariantsSection;
5
+ /**
6
+ * Canonical brief format instruction — single source of truth.
7
+ * Imported by claude-skill.ts, cursor-rules.ts, and tools.ts so the
8
+ * wording can never silently diverge between agents.
9
+ */
10
+ exports.BRIEF_FORMAT_INSTRUCTION = 'Label: ≤ 4 words, clear and descriptive title (e.g. "Soft spring blur", "Crisp linear motion"). ' +
11
+ 'Body: exactly ONE sentence, ≤ 12 words — a single evocative descriptor of the direction ' +
12
+ '(e.g. "Apple-style spring physics with ambient blur and soft edges"). No bullet points, no lists, no line breaks.';
13
+ /** Routing table — identical in every agent skill file */
14
+ exports.PICKING_THE_FLOW_TABLE = `## Picking the flow
15
+
16
+ | User says | Flow |
17
+ |---|---|
18
+ | "open rivet", "make a visual change to X" | **Visual editor** (below) |
19
+ | "create variants of X", "show me 3-5 options for X", "explore approaches to X" | **Agent variants — existing project** (\`start_variants\`, \`mode='existing'\`) |
20
+ | "build me a settings page from scratch", "add a feature for Y" | **Agent variants — existing project** (\`start_variants\`, no \`target\`) |
21
+ | "create a new Vite todo app", "scaffold a fresh dashboard" | **Agent variants — fresh project** (\`start_variants\`, \`mode='zero_to_one'\`) |
22
+ | "build me a dashboard like stripe.com", "use this URL as inspiration" | **Agent variants — fresh, source-grounded** (\`extract_inspiration_context\` → \`start_variants\`, \`mode='zero_to_one'\`) |`;
23
+ /**
24
+ * Builds the full Agent Variants flow section, parameterised on the small
25
+ * number of lines that differ between Claude Code and Cursor.
26
+ */
27
+ function buildAgentVariantsSection(opts) {
28
+ return `## Agent Variants flow
29
+
30
+ For requests like *"create variants of X"*, *"show me 3-5 options for the dropdown"*, *"build me a settings page"*, or *"create a new Vite todo app"* — DO NOT generate variants natively via the ${opts.nativeGenLabel} or parallel tool calls. Use this protocol so the user sees variants render in parallel and picks based on the rendered code, not text descriptions ${opts.inChatEmphasis}.
31
+
32
+ There are three sub-flows. Pick by project state:
33
+
34
+ - **Existing project** → \`start_variants({ mode: 'existing' })\` — single-call kickoff, no in-chat approval gate.
35
+ - **Fresh project (prompt-only)** → \`start_variants({ mode: 'zero_to_one' })\` — same single-call kickoff, server derives the destination path and opens the editor. Use this when the user just describes the app ("build me a Vite todo app", "make a Pomodoro timer").
36
+ - **Fresh project (source-grounded, inspiration URLs)** → call \`extract_inspiration_context\` first, then \`start_variants({ mode: 'zero_to_one' })\` with the returned \`designContext\` + \`sourceContext\` forwarded as-is. Same single-call kickoff, no in-chat approval gate. Use this when the user gives a URL to mimic, attaches design context, or asks for "something like \\<site\\>".
37
+
38
+ ---
39
+
40
+ ### Sub-flow A: Existing project — use \`start_variants({ mode: 'existing' })\`
41
+
42
+ 1. **Call \`start_variants\`** with:
43
+ - \`prompt\`: the user's request verbatim
44
+ - \`briefs\`: an array of N \`{ label, body }\` objects, one per variant. \`briefs.length\` sets the variant count (3-5, default 4) — do NOT also pass \`count\`. ${exports.BRIEF_FORMAT_INSTRUCTION} Each brief MUST describe a DIFFERENT direction; do NOT copy the user's prompt verbatim into bodies. The UI renders \`label\` as the variant card title and \`body\` as its description, so this is what the user sees and compares.
45
+ - \`mode\`: \`'existing'\`
46
+ - \`target\` (optional): \`{ type: 'element'|'file'|'route', ref }\` — set this for refinement requests pinned to a specific element/file/route
47
+ - \`projectPath\` (optional): defaults to the MCP server's cwd; pass explicitly if the variants target a different directory
48
+
49
+ Response: \`{ sessionId, stage: 'work_items_ready', mode: 'existing', leaseId, leaseTtlMs, variants: [{ variantId, briefId, label, workItem }], project: { projectPath, framework }, visualEditor? }\`. The server already detected the framework, opened the Rivet visual editor (share \`visualEditor.url\` with the user immediately), and leased every variant — you do NOT need to call \`detect_project\`, \`open_visual_editor\`, or \`continue_variants(request_work)\`. Each \`variants[i].workItem\` carries \`input.worktreePath\` (where to edit files) and \`attempt\`.
50
+
51
+ 2. ${opts.step9}
52
+
53
+ **The FIRST LINE of each variant's output stream MUST be a ≤4-word label** (matching the \`BRIEF_FORMAT_INSTRUCTION\` shape — e.g. "Spring blur", "Linear sharp") so the user recognises the direction as variants stream in. The code body follows. Use the \`leaseId\` from the start_variants response on every \`report_variant_complete\` call.
54
+
55
+ 3. **When all variants reach \`stage: 'ready'\` or \`'degraded'\`, tell the user the variants are ready** and explain how to compare them. Each variant has its own dev server running in an isolated worktree. The Rivet iframe shows a chip at the bottom-center: prev/label/next/check/dismiss. The user cycles between the live, running variants by clicking prev/next (the iframe re-mounts onto the variant's dev server in ~50ms via proxy retarget). When they like one, they click the check on the chip — that commits the variant.
56
+
57
+ You do NOT need to print diffs in chat. The user picks visually in the iframe. You also do NOT need to call \`cancel_variant\` yourself — the iframe surfaces a cancel button per variant card, and the UI calls \`cancel_variant\` directly when the user clicks it.
58
+
59
+ 4. **Watch for the user's pick.** Either:
60
+ a) Use \`watch_for_changes({ sessionId })\` which blocks until the user clicks the check on the chip, OR
61
+ b) Poll \`get_pending_changes({ sessionId })\` periodically.
62
+ ${opts.step11Suffix}
63
+
64
+ 5. **Apply the variant.** From the \`VariantChangeItem\` payload:
65
+ - \`payload.kind === 'diff-applied'\` → the server already \`git apply\`'d the unified diff to the user's working tree (uncommitted). DO NOT re-apply — just acknowledge the variant and let the user review.
66
+ - \`payload.kind === 'diff'\` → (legacy) \`git apply\` the unified diff against the user's project root
67
+ - \`payload.kind === 'project-created'\` → the server already materialized and committed the destination project; continue from \`destinationPath\` (optionally run \`npm install\`)
68
+
69
+ Tell the user which variant was applied (use \`variantLabel\` from the change item). You can also call \`commit_variant({ sessionId, variantId, confirmedByUser: true })\` yourself if the user expressed their pick in chat ("go with #2", "the spring one") — same effect, just routed through the agent rather than the chip.
70
+
71
+ ---
72
+
73
+ ### Sub-flow B: Fresh project (prompt-only) — use \`start_variants({ mode: 'zero_to_one' })\`
74
+
75
+ For brand-new projects the user describes from scratch ("build me a Vite todo app", "make a Pomodoro timer", "scaffold a kanban board"), use the same single-call kickoff. The server derives the destination directory, opens the editor on it, leases all variants, and returns everything in one response. No in-chat approval gate.
76
+
77
+ 1. **Call \`start_variants\`** with:
78
+ - \`prompt\`: the user's request verbatim
79
+ - \`briefs\`: an array of N \`{ label, body }\` objects, one per variant. \`briefs.length\` sets the variant count (3-5, default 4) — do NOT also pass \`count\`. ${exports.BRIEF_FORMAT_INSTRUCTION} Each brief MUST describe a DIFFERENT direction; do NOT copy the user's prompt verbatim into bodies. The UI renders \`label\` as the variant card title and \`body\` as its description.
80
+ - \`mode\`: \`'zero_to_one'\`
81
+ - \`framework\` (optional, defaults to \`'vite'\`)
82
+ - \`destinationParent\` (optional, absolute path; defaults to the user's home dir)
83
+
84
+ Response: \`{ sessionId, stage: 'work_items_ready', mode: 'zero_to_one', leaseId, leaseTtlMs, variants: [...], scaffoldBaseWorkItemId, destinationPath, visualEditor? }\`. The server opened the editor for you if \`visualEditor\` is present — share \`visualEditor.url\` with the user immediately ("Generating variants — watch here: <url>"). Skip the manual \`detect_project\` / \`open_visual_editor\` step (the destination project doesn't exist yet, so \`detect_project\` would fail). Each \`variants[i].workItem\` carries \`input\` and \`attempt\`.
85
+
86
+ 2. **From here, follow Sub-flow A steps 2-5** (parallel code-gen with first-line label using each variant's \`workItem.input.worktreePath\` and the shared \`leaseId\`, then ready, watch, apply). The work items are \`static_preview\` for zero-to-one — agent output must be passed to \`report_variant_complete\` as a JSON **object** with shape \`{ html: string, css?: string, js?: string }\` (self-contained HTML, no React/Vite-only imports). Do NOT stringify it — pass \`output: { html: "<!doctype html>..." }\`, not \`output: "{\\"html\\": \\"...\\"}"\`. On commit, the apply payload is \`payload.kind === 'project-created'\` — the server materialized the chosen variant to \`destinationPath\`.
87
+
88
+ ---
89
+
90
+ ### Sub-flow C: Fresh project (source-grounded) — \`extract_inspiration_context\` → \`start_variants({ mode: 'zero_to_one' })\`
91
+
92
+ For brand-new projects where the user provides inspiration URLs ("build me a dashboard like stripe.com"), reference designs, or custom design context. Two calls total — no in-chat approval gate, no multi-step brief protocol.
93
+
94
+ 1. **Call \`extract_inspiration_context\`** with:
95
+ - \`prompt\`: the user's request verbatim
96
+ - \`count\`: the same value you plan to pass to \`start_variants\`
97
+ - \`urls\`: every inspiration URL the user provided
98
+ - \`preserveBrand\` (optional): true when the user wants brand colors/type/voice preserved exactly
99
+ - \`sourceArtifacts\` (optional): pasted briefs, screenshot notes, or written design context
100
+
101
+ Rivet fetches each URL server-side, extracts per-slot design context, and returns \`{ designContext, warnings, sourceContext }\`. Surface any \`warnings\` to the user (e.g. "couldn't fetch site X — proceeding without it").
102
+
103
+ 2. **Call \`start_variants\`** with:
104
+ - \`prompt\`, \`mode: 'zero_to_one'\`
105
+ - \`briefs\`: an array of N \`{ label, body }\` objects, one per variant. \`briefs.length\` sets the variant count (3-5, default 4) — do NOT also pass \`count\`. ${exports.BRIEF_FORMAT_INSTRUCTION} Bodies should diverge per slot based on the \`designContext\` from step 1; do NOT copy the user's prompt verbatim.
106
+ - \`framework\` (optional, defaults to \`'vite'\`)
107
+ - \`destinationParent\` (optional)
108
+ - \`designContext\`: the array returned by step 1
109
+ - \`sourceContext\`: the object returned by step 1 (forward as-is)
110
+
111
+ Same response shape as Sub-flow B — \`{ sessionId, stage: 'work_items_ready', leaseId, variants, destinationPath, visualEditor? }\`. No \`awaiting_briefs\`/\`awaiting_approval\`, no in-chat approval gate.
112
+
113
+ 3. **From here, follow Sub-flow B step 2** (parallel code-gen with the shared \`leaseId\`, then ready, watch, apply). The work items are \`static_preview\`, output is self-contained HTML/CSS/JS, and the apply payload is \`payload.kind === 'project-created'\`.
114
+
115
+ ---
116
+
117
+ ### Rules
118
+
119
+ - **Never** generate variants natively (${opts.nativeGenLabel}, parallel tool calls, your own creative process) without going through \`start_variants\` first.
120
+ - Always pass the user's prompt verbatim — don't paraphrase.
121
+ - Prefer \`start_variants\` (with the matching \`mode\`) over the older \`propose_variants\` → \`report_variant_briefs\` → \`approve_variant_briefs\` chain. The unified call also handles \`detect_project\`, \`open_visual_editor\`, and \`continue_variants(request_work)\` server-side. The older tools and standalone \`detect_project\` / \`open_visual_editor\` stay registered for the Visual Editor flow (point-and-click changes without variants).
122
+ - For source-grounded fresh projects, run \`extract_inspiration_context\` FIRST and forward its output into \`start_variants\` — don't try to pack inspiration URLs into \`start_variants\` directly without extraction.
123
+ - Briefs (when shown via \`propose_variants\` legacy flow) are PLAIN TEXT in chat. Do not render UI, open a browser tab, or fabricate a URL.
124
+ - The user picks AFTER seeing the variants render LIVE in the iframe, not before. Hand off to the iframe chip for visual cycling + commit.
125
+ - Don't dump diffs in chat by default. The iframe chip is the primary review surface. If the user explicitly asks "show me the diffs", then print them.
126
+ - Parallel code-gen is the only step where you fan out — every other step is one tool call.
127
+ - **Per-variant cancel** is handled by the iframe — the UI calls \`cancel_variant({ sessionId, variantId })\` when the user clicks the cancel button on a card. You do not need to call this from the agent side. Use \`cancel_variants\` (plural) only to kill an entire session.
128
+ - Quality bar is mandatory: avoid generic hero-card pages; preserve source depth, realistic workflow detail, and responsive interaction states unless the user explicitly asks for a lighter build.`;
129
+ }
130
+ //# sourceMappingURL=shared-variants-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-variants-protocol.js","sourceRoot":"","sources":["../../../src/utils/skills/shared-variants-protocol.ts"],"names":[],"mappings":";;;AAyBA,8DA+GC;AAxID;;;;GAIG;AACU,QAAA,wBAAwB,GACnC,kGAAkG;IAClG,0FAA0F;IAC1F,mHAAmH,CAAC;AAEtH,0DAA0D;AAC7C,QAAA,sBAAsB,GAAG;;;;;;;;uMAQiK,CAAC;AAExM;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,IASzC;IACC,OAAO;;oMAE2L,IAAI,CAAC,cAAc,uJAAuJ,IAAI,CAAC,cAAc;;;;;;;;;;;;;;uKAc1N,gCAAwB;;;;;;;KAO1L,IAAI,CAAC,KAAK;;;;;;;;;;;KAWV,IAAI,CAAC,YAAY;;;;;;;;;;;;;;;;;uKAiBiJ,gCAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;uKA0BxB,gCAAwB;;;;;;;;;;;;;;0CAcrJ,IAAI,CAAC,cAAc;;;;;;;;;oMASuI,CAAC;AACrM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rivet-design",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
4
4
  "description": "Local visual web development tool with AI-powered code modification",
5
5
  "main": "dist/index.js",
6
6
  "workspaces": [
@@ -13,7 +13,8 @@
13
13
  "rivet": "./bin/rivet.js"
14
14
  },
15
15
  "scripts": {
16
- "build": "tsc && npm run build:ui && npm run build:bin",
16
+ "build": "tsc && npm run build:assets && npm run build:ui && npm run build:bin",
17
+ "build:assets": "mkdir -p dist/services/templates/designmd && cp src/services/templates/designmd/*.md dist/services/templates/designmd/",
17
18
  "build:ui": "cd src/ui && vite build",
18
19
  "build:bin": "mkdir -p bin && cp src/bin-template.js bin/rivet.js && chmod +x bin/rivet.js",
19
20
  "dev": "tsc --watch",
@@ -37,9 +38,8 @@
37
38
  "ratchet": "tsx scripts/ratchet.ts",
38
39
  "bench": "tsx benchmarks/bench.ts",
39
40
  "bench:run": "tsx benchmarks/runner.ts",
40
- "bench:annotate": "tsx benchmarks/annotator.ts",
41
- "bench:progress": "tsx benchmarks/progress.ts",
42
- "bench:improve": "tsx benchmarks/improve.ts",
41
+ "bench:review": "tsx benchmarks/review/server.ts",
42
+ "bench:list": "tsx benchmarks/list.ts",
43
43
  "check:pre-commit": "npx lint-staged && yarn build && cd src/ui && yarn typecheck && cd ../.. && cd src/proxy && yarn build && cd ../.. && cd desktop/renderer && yarn build && cd ../..",
44
44
  "check:pre-push": "yarn test",
45
45
  "desktop": "yarn build && cd desktop && yarn dev",
@@ -170,7 +170,7 @@
170
170
  "access": "public"
171
171
  },
172
172
  "engines": {
173
- "node": ">=16.0.0"
173
+ "node": ">=24.0.0"
174
174
  },
175
175
  "prettier": {
176
176
  "printWidth": 80,