rivet-design 0.10.6 → 0.10.8

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 (136) hide show
  1. package/dist/index.d.ts +7 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +42 -23
  4. package/dist/index.js.map +1 -1
  5. package/dist/mcp/agent-variants/SessionStore.d.ts +11 -0
  6. package/dist/mcp/agent-variants/SessionStore.d.ts.map +1 -1
  7. package/dist/mcp/agent-variants/SessionStore.js +44 -14
  8. package/dist/mcp/agent-variants/SessionStore.js.map +1 -1
  9. package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts +68 -3
  10. package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts.map +1 -1
  11. package/dist/mcp/agent-variants/WorktreeOrchestrator.js +411 -98
  12. package/dist/mcp/agent-variants/WorktreeOrchestrator.js.map +1 -1
  13. package/dist/mcp/agent-variants/WorktreeOrchestrator.testHelpers.d.ts +5 -0
  14. package/dist/mcp/agent-variants/WorktreeOrchestrator.testHelpers.d.ts.map +1 -1
  15. package/dist/mcp/agent-variants/WorktreeOrchestrator.testHelpers.js +18 -4
  16. package/dist/mcp/agent-variants/WorktreeOrchestrator.testHelpers.js.map +1 -1
  17. package/dist/mcp/agent-variants/contracts.d.ts +40 -0
  18. package/dist/mcp/agent-variants/contracts.d.ts.map +1 -1
  19. package/dist/mcp/agent-variants/contracts.js.map +1 -1
  20. package/dist/mcp/agent-variants/createZeroToOneTool.d.ts +47 -265
  21. package/dist/mcp/agent-variants/createZeroToOneTool.d.ts.map +1 -1
  22. package/dist/mcp/agent-variants/createZeroToOneTool.js +147 -207
  23. package/dist/mcp/agent-variants/createZeroToOneTool.js.map +1 -1
  24. package/dist/mcp/agent-variants/generatedDestination.d.ts +75 -0
  25. package/dist/mcp/agent-variants/generatedDestination.d.ts.map +1 -0
  26. package/dist/mcp/agent-variants/generatedDestination.js +104 -0
  27. package/dist/mcp/agent-variants/generatedDestination.js.map +1 -0
  28. package/dist/mcp/agent-variants/index.d.ts +1 -2
  29. package/dist/mcp/agent-variants/index.d.ts.map +1 -1
  30. package/dist/mcp/agent-variants/index.js +1 -3
  31. package/dist/mcp/agent-variants/index.js.map +1 -1
  32. package/dist/mcp/agent-variants/pinterestSourceContext.d.ts +18 -0
  33. package/dist/mcp/agent-variants/pinterestSourceContext.d.ts.map +1 -0
  34. package/dist/mcp/agent-variants/pinterestSourceContext.js +144 -0
  35. package/dist/mcp/agent-variants/pinterestSourceContext.js.map +1 -0
  36. package/dist/mcp/agent-variants/runPlan.d.ts +107 -0
  37. package/dist/mcp/agent-variants/runPlan.d.ts.map +1 -0
  38. package/dist/mcp/agent-variants/runPlan.js +97 -0
  39. package/dist/mcp/agent-variants/runPlan.js.map +1 -0
  40. package/dist/mcp/agent-variants/tools.d.ts +48 -3
  41. package/dist/mcp/agent-variants/tools.d.ts.map +1 -1
  42. package/dist/mcp/agent-variants/tools.js +61 -52
  43. package/dist/mcp/agent-variants/tools.js.map +1 -1
  44. package/dist/mcp/integrations/tools.d.ts +14 -0
  45. package/dist/mcp/integrations/tools.d.ts.map +1 -0
  46. package/dist/mcp/integrations/tools.js +38 -0
  47. package/dist/mcp/integrations/tools.js.map +1 -0
  48. package/dist/mcp/server.d.ts.map +1 -1
  49. package/dist/mcp/server.js +31 -25
  50. package/dist/mcp/server.js.map +1 -1
  51. package/dist/routes/agentVariants.d.ts +2 -1
  52. package/dist/routes/agentVariants.d.ts.map +1 -1
  53. package/dist/routes/agentVariants.js +272 -19
  54. package/dist/routes/agentVariants.js.map +1 -1
  55. package/dist/routes/design.d.ts.map +1 -1
  56. package/dist/routes/design.js +0 -122
  57. package/dist/routes/design.js.map +1 -1
  58. package/dist/server.d.ts +6 -0
  59. package/dist/server.d.ts.map +1 -1
  60. package/dist/server.js +11 -6
  61. package/dist/server.js.map +1 -1
  62. package/dist/services/AgentSessionService.d.ts +5 -1
  63. package/dist/services/AgentSessionService.d.ts.map +1 -1
  64. package/dist/services/AgentSessionService.js +11 -4
  65. package/dist/services/AgentSessionService.js.map +1 -1
  66. package/dist/services/InlineVariantGenerationService.d.ts +2 -3
  67. package/dist/services/InlineVariantGenerationService.d.ts.map +1 -1
  68. package/dist/services/InlineVariantGenerationService.js +7 -5
  69. package/dist/services/InlineVariantGenerationService.js.map +1 -1
  70. package/dist/services/IntegrationsClient.d.ts +78 -0
  71. package/dist/services/IntegrationsClient.d.ts.map +1 -0
  72. package/dist/services/IntegrationsClient.js +139 -0
  73. package/dist/services/IntegrationsClient.js.map +1 -0
  74. package/dist/services/TelemetryService.d.ts +2 -0
  75. package/dist/services/TelemetryService.d.ts.map +1 -1
  76. package/dist/services/TelemetryService.js +2 -0
  77. package/dist/services/TelemetryService.js.map +1 -1
  78. package/dist/services/VariantHistoryService.d.ts +8 -0
  79. package/dist/services/VariantHistoryService.d.ts.map +1 -1
  80. package/dist/services/VariantHistoryService.js +23 -0
  81. package/dist/services/VariantHistoryService.js.map +1 -1
  82. package/dist/services/VariantRunService.d.ts +56 -0
  83. package/dist/services/VariantRunService.d.ts.map +1 -0
  84. package/dist/services/VariantRunService.js +56 -0
  85. package/dist/services/VariantRunService.js.map +1 -0
  86. package/dist/services/VariantsRuntime.d.ts +22 -0
  87. package/dist/services/VariantsRuntime.d.ts.map +1 -0
  88. package/dist/services/VariantsRuntime.js +32 -0
  89. package/dist/services/VariantsRuntime.js.map +1 -0
  90. package/dist/services/VisualVariantAgentRunner.d.ts +20 -0
  91. package/dist/services/VisualVariantAgentRunner.d.ts.map +1 -0
  92. package/dist/services/VisualVariantAgentRunner.js +66 -0
  93. package/dist/services/VisualVariantAgentRunner.js.map +1 -0
  94. package/dist/services/WorktreeManager.d.ts +34 -0
  95. package/dist/services/WorktreeManager.d.ts.map +1 -1
  96. package/dist/services/WorktreeManager.js +172 -23
  97. package/dist/services/WorktreeManager.js.map +1 -1
  98. package/dist/services/createAgentVariantsOrchestrator.d.ts.map +1 -1
  99. package/dist/services/createAgentVariantsOrchestrator.js +2 -0
  100. package/dist/services/createAgentVariantsOrchestrator.js.map +1 -1
  101. package/dist/services/staticStarter.d.ts +1 -1
  102. package/dist/services/staticStarter.d.ts.map +1 -1
  103. package/dist/services/staticStarter.js +76 -19
  104. package/dist/services/staticStarter.js.map +1 -1
  105. package/dist/utils/devServerCommand.d.ts +11 -4
  106. package/dist/utils/devServerCommand.d.ts.map +1 -1
  107. package/dist/utils/devServerCommand.js +17 -8
  108. package/dist/utils/devServerCommand.js.map +1 -1
  109. package/dist/utils/devServerError.d.ts +34 -0
  110. package/dist/utils/devServerError.d.ts.map +1 -0
  111. package/dist/utils/devServerError.js +39 -0
  112. package/dist/utils/devServerError.js.map +1 -0
  113. package/dist/utils/elementRefToContext.d.ts +4 -0
  114. package/dist/utils/elementRefToContext.d.ts.map +1 -0
  115. package/dist/utils/elementRefToContext.js +63 -0
  116. package/dist/utils/elementRefToContext.js.map +1 -0
  117. package/dist/utils/skills/describe-motion-protocol.d.ts +1 -1
  118. package/dist/utils/skills/describe-motion-protocol.d.ts.map +1 -1
  119. package/dist/utils/skills/describe-motion-protocol.js +11 -11
  120. package/dist/utils/skills/shared-variants-protocol.d.ts.map +1 -1
  121. package/dist/utils/skills/shared-variants-protocol.js +6 -4
  122. package/dist/utils/skills/shared-variants-protocol.js.map +1 -1
  123. package/package.json +3 -1
  124. package/src/ui/dist/assets/main-WqlDU4Ou.js +645 -0
  125. package/src/ui/dist/assets/main-auZA25j4.css +1 -0
  126. package/src/ui/dist/index.html +2 -2
  127. package/dist/services/CommentVariationService.d.ts +0 -34
  128. package/dist/services/CommentVariationService.d.ts.map +0 -1
  129. package/dist/services/CommentVariationService.js +0 -136
  130. package/dist/services/CommentVariationService.js.map +0 -1
  131. package/dist/services/VariantCodeGeneratorService.d.ts +0 -39
  132. package/dist/services/VariantCodeGeneratorService.d.ts.map +0 -1
  133. package/dist/services/VariantCodeGeneratorService.js +0 -109
  134. package/dist/services/VariantCodeGeneratorService.js.map +0 -1
  135. package/src/ui/dist/assets/main-B54sNpwl.css +0 -1
  136. package/src/ui/dist/assets/main-B9BHMA4s.js +0 -646
@@ -13,26 +13,35 @@ exports.FRAMEWORK_DEV_CONFIG = {
13
13
  };
14
14
  /**
15
15
  * Build the shell command to start a framework's dev server on a specific
16
- * port. Honors how each framework actually accepts a port:
17
- * - CRA reads from the PORT env var (no CLI flag)
18
- * - npm passes flags after `--` separator: `npm run dev -- --port N`
19
- * - yarn / pnpm pass them inline: `yarn dev --port N`
16
+ * port. Carries the port over BOTH channels a dev server might honor:
17
+ * - the `PORT` env var respected by CRA, Next.js, and most custom
18
+ * `node server.js` setups; and
19
+ * - a CLI `--port` flag respected by Vite/Next/etc.
20
+ * (npm needs it after the `--` separator: `npm run dev -- --port N`;
21
+ * yarn/pnpm pass it inline: `yarn dev --port N`).
22
+ *
23
+ * Passing PORT in the env (not just the flag) is what lets us reliably move a
24
+ * dev server off an occupied default: a project whose `dev` script doesn't
25
+ * forward the flag (a custom server, a wrapper script) still picks up PORT and
26
+ * binds where we told it, instead of falling back to 3000 and colliding.
20
27
  */
21
28
  function buildDevServerCommand(framework, packageManager, devCommand, port) {
29
+ const env = { PORT: String(port) };
22
30
  if (framework === 'cra') {
31
+ // CRA has no port flag — it reads PORT from the env exclusively.
23
32
  const args = packageManager === 'npm' ? ['run', devCommand] : [devCommand];
24
- return { cmd: packageManager, args, env: { PORT: String(port) } };
33
+ return { cmd: packageManager, args, env };
25
34
  }
26
35
  if (packageManager === 'npm') {
27
36
  return {
28
37
  cmd: 'npm',
29
38
  args: ['run', devCommand, '--', '--port', String(port)],
30
- env: {},
39
+ env,
31
40
  };
32
41
  }
33
42
  if (packageManager === 'yarn') {
34
- return { cmd: 'yarn', args: [devCommand, '--port', String(port)], env: {} };
43
+ return { cmd: 'yarn', args: [devCommand, '--port', String(port)], env };
35
44
  }
36
- return { cmd: 'pnpm', args: [devCommand, '--port', String(port)], env: {} };
45
+ return { cmd: 'pnpm', args: [devCommand, '--port', String(port)], env };
37
46
  }
38
47
  //# sourceMappingURL=devServerCommand.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"devServerCommand.js","sourceRoot":"","sources":["../../src/utils/devServerCommand.ts"],"names":[],"mappings":";;;AAsBA,sDAqBC;AAzCD,wEAAwE;AAC3D,QAAA,oBAAoB,GAG7B;IACF,MAAM,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE;IAChD,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE;IAC9C,GAAG,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE;IAC/C,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE;IAC/C,MAAM,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE;IAChD,MAAM,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE;CAC3C,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,qBAAqB,CACnC,SAAoB,EACpB,cAAsB,EACtB,UAAkB,EAClB,IAAY;IAEZ,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QAC3E,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;IACpE,CAAC;IACD,IAAI,cAAc,KAAK,KAAK,EAAE,CAAC;QAC7B,OAAO;YACL,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;YACvD,GAAG,EAAE,EAAE;SACR,CAAC;IACJ,CAAC;IACD,IAAI,cAAc,KAAK,MAAM,EAAE,CAAC;QAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IAC9E,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AAC9E,CAAC"}
1
+ {"version":3,"file":"devServerCommand.js","sourceRoot":"","sources":["../../src/utils/devServerCommand.ts"],"names":[],"mappings":";;;AA6BA,sDAuBC;AAlDD,wEAAwE;AAC3D,QAAA,oBAAoB,GAG7B;IACF,MAAM,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE;IAChD,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE;IAC9C,GAAG,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE;IAC/C,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE;IAC/C,MAAM,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE;IAChD,MAAM,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE;CAC3C,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,SAAgB,qBAAqB,CACnC,SAAoB,EACpB,cAAsB,EACtB,UAAkB,EAClB,IAAY;IAEZ,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;IACnC,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QACxB,iEAAiE;QACjE,MAAM,IAAI,GAAG,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QAC3E,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IAC5C,CAAC;IACD,IAAI,cAAc,KAAK,KAAK,EAAE,CAAC;QAC7B,OAAO;YACL,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;YACvD,GAAG;SACJ,CAAC;IACJ,CAAC;IACD,IAAI,cAAc,KAAK,MAAM,EAAE,CAAC;QAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;IAC1E,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Error raised when a variant's preview dev server fails to come up. Carries
3
+ * enough structured detail for the orchestrator to (a) decide whether a retry
4
+ * on a fresh port could help and (b) emit actionable telemetry instead of an
5
+ * opaque `DEV_SERVER_START_FAILED`.
6
+ *
7
+ * Lives in its own dependency-light module so both WorktreeManager (which
8
+ * throws it) and WorktreeOrchestrator (which classifies it) can share the
9
+ * single class identity — `instanceof` works across both because they import
10
+ * the same module — without the orchestrator pulling in the concrete
11
+ * WorktreeManager it otherwise only depends on through an interface.
12
+ */
13
+ export type DevServerFailureReason = 'spawn_error' | 'exited' | 'timeout';
14
+ export declare function isPortInUseOutput(output: string): boolean;
15
+ export declare class DevServerStartError extends Error {
16
+ /** Why the start failed: never spawned, exited early, or never became ready. */
17
+ readonly reason: DevServerFailureReason;
18
+ /** True when the captured output indicates the target port was already taken. */
19
+ readonly portInUse: boolean;
20
+ /** Trimmed tail of the child's stdout/stderr, for logs and telemetry. */
21
+ readonly detail: string;
22
+ readonly exitCode: number | null;
23
+ readonly signal: NodeJS.Signals | null;
24
+ constructor(opts: {
25
+ message: string;
26
+ reason: DevServerFailureReason;
27
+ portInUse: boolean;
28
+ detail: string;
29
+ exitCode?: number | null;
30
+ signal?: NodeJS.Signals | null;
31
+ });
32
+ }
33
+ export declare function isDevServerStartError(err: unknown): err is DevServerStartError;
34
+ //# sourceMappingURL=devServerError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devServerError.d.ts","sourceRoot":"","sources":["../../src/utils/devServerError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG,QAAQ,GAAG,SAAS,CAAC;AAW1E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,gFAAgF;IAChF,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;IACxC,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;gBAE3B,IAAI,EAAE;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,sBAAsB,CAAC;QAC/B,SAAS,EAAE,OAAO,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;KAChC;CASF;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,OAAO,GACX,GAAG,IAAI,mBAAmB,CAE5B"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DevServerStartError = void 0;
4
+ exports.isPortInUseOutput = isPortInUseOutput;
5
+ exports.isDevServerStartError = isDevServerStartError;
6
+ /**
7
+ * Markers that mean "something is already bound to the port the dev server
8
+ * tried to use." Covers the raw OS error (EADDRINUSE), Node's human-readable
9
+ * form, and framework-specific guards (e.g. Next.js's "Another next dev server
10
+ * is already running").
11
+ */
12
+ const PORT_IN_USE_RE = /EADDRINUSE|address already in use|already running|already in use/i;
13
+ function isPortInUseOutput(output) {
14
+ return PORT_IN_USE_RE.test(output);
15
+ }
16
+ class DevServerStartError extends Error {
17
+ /** Why the start failed: never spawned, exited early, or never became ready. */
18
+ reason;
19
+ /** True when the captured output indicates the target port was already taken. */
20
+ portInUse;
21
+ /** Trimmed tail of the child's stdout/stderr, for logs and telemetry. */
22
+ detail;
23
+ exitCode;
24
+ signal;
25
+ constructor(opts) {
26
+ super(opts.message);
27
+ this.name = 'DevServerStartError';
28
+ this.reason = opts.reason;
29
+ this.portInUse = opts.portInUse;
30
+ this.detail = opts.detail;
31
+ this.exitCode = opts.exitCode ?? null;
32
+ this.signal = opts.signal ?? null;
33
+ }
34
+ }
35
+ exports.DevServerStartError = DevServerStartError;
36
+ function isDevServerStartError(err) {
37
+ return err instanceof DevServerStartError;
38
+ }
39
+ //# sourceMappingURL=devServerError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devServerError.js","sourceRoot":"","sources":["../../src/utils/devServerError.ts"],"names":[],"mappings":";;;AAuBA,8CAEC;AA8BD,sDAIC;AA7CD;;;;;GAKG;AACH,MAAM,cAAc,GAClB,mEAAmE,CAAC;AAEtE,SAAgB,iBAAiB,CAAC,MAAc;IAC9C,OAAO,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAED,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,gFAAgF;IACvE,MAAM,CAAyB;IACxC,iFAAiF;IACxE,SAAS,CAAU;IAC5B,yEAAyE;IAChE,MAAM,CAAS;IACf,QAAQ,CAAgB;IACxB,MAAM,CAAwB;IAEvC,YAAY,IAOX;QACC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC;IACpC,CAAC;CACF;AA1BD,kDA0BC;AAED,SAAgB,qBAAqB,CACnC,GAAY;IAEZ,OAAO,GAAG,YAAY,mBAAmB,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ElementContext } from '../types/change-types';
2
+ import type { ElementRef } from '../types/change-request-types';
3
+ export declare const elementRefToContext: (element: ElementRef) => ElementContext;
4
+ //# sourceMappingURL=elementRefToContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elementRefToContext.d.ts","sourceRoot":"","sources":["../../src/utils/elementRefToContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAmChE,eAAO,MAAM,mBAAmB,GAAI,SAAS,UAAU,KAAG,cA6BxD,CAAC"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.elementRefToContext = void 0;
4
+ const DEFAULT_BOUNDING_RECT = {
5
+ x: 0,
6
+ y: 0,
7
+ width: 0,
8
+ height: 0,
9
+ top: 0,
10
+ left: 0,
11
+ right: 0,
12
+ bottom: 0,
13
+ };
14
+ const COMPONENT_NODE_TYPES = new Set([
15
+ 'function',
16
+ 'class',
17
+ 'memo',
18
+ 'forwardRef',
19
+ 'context',
20
+ 'unknown',
21
+ ]);
22
+ const toComponentNode = (node) => {
23
+ const type = COMPONENT_NODE_TYPES.has(node.type)
24
+ ? node.type
25
+ : 'unknown';
26
+ return {
27
+ name: node.name,
28
+ type,
29
+ depth: node.depth ?? 0,
30
+ };
31
+ };
32
+ const elementRefToContext = (element) => ({
33
+ xpath: element.xpath,
34
+ tagName: element.tagName,
35
+ className: element.className,
36
+ id: element.id,
37
+ textContent: element.textContent ?? '',
38
+ innerHTML: '',
39
+ attributes: element.attributes ?? {},
40
+ computedStyles: {},
41
+ boundingRect: DEFAULT_BOUNDING_RECT,
42
+ ...(element.rivetId ? { rivetId: element.rivetId } : {}),
43
+ ...(element.componentTree
44
+ ? { componentTree: element.componentTree.map(toComponentNode) }
45
+ : {}),
46
+ ...(element.filePaths.length > 0
47
+ ? {
48
+ filePaths: element.filePaths.map((filePath) => ({
49
+ filePath,
50
+ })),
51
+ }
52
+ : {}),
53
+ ...(element.parentElementSummary
54
+ ? {
55
+ parentElementSummary: {
56
+ ...element.parentElementSummary,
57
+ id: '',
58
+ },
59
+ }
60
+ : {}),
61
+ });
62
+ exports.elementRefToContext = elementRefToContext;
63
+ //# sourceMappingURL=elementRefToContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elementRefToContext.js","sourceRoot":"","sources":["../../src/utils/elementRefToContext.ts"],"names":[],"mappings":";;;AAGA,MAAM,qBAAqB,GAAG;IAC5B,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAwB;IAC1D,UAAU;IACV,OAAO;IACP,MAAM;IACN,YAAY;IACZ,SAAS;IACT,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,CACtB,IAAsD,EACvC,EAAE;IACjB,MAAM,IAAI,GAAG,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,IAA6B,CAAC;QACvE,CAAC,CAAE,IAAI,CAAC,IAA8B;QACtC,CAAC,CAAC,SAAS,CAAC;IACd,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI;QACJ,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC;KACvB,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,mBAAmB,GAAG,CAAC,OAAmB,EAAkB,EAAE,CAAC,CAAC;IAC3E,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,OAAO,EAAE,OAAO,CAAC,OAAO;IACxB,SAAS,EAAE,OAAO,CAAC,SAAS;IAC5B,EAAE,EAAE,OAAO,CAAC,EAAE;IACd,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE;IACtC,SAAS,EAAE,EAAE;IACb,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;IACpC,cAAc,EAAE,EAAE;IAClB,YAAY,EAAE,qBAAqB;IACnC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACxD,GAAG,CAAC,OAAO,CAAC,aAAa;QACvB,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE;QAC/D,CAAC,CAAC,EAAE,CAAC;IACP,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC;QAC9B,CAAC,CAAC;YACE,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;gBAC9C,QAAQ;aACT,CAAC,CAAC;SACJ;QACH,CAAC,CAAC,EAAE,CAAC;IACP,GAAG,CAAC,OAAO,CAAC,oBAAoB;QAC9B,CAAC,CAAC;YACE,oBAAoB,EAAE;gBACpB,GAAG,OAAO,CAAC,oBAAoB;gBAC/B,EAAE,EAAE,EAAE;aACP;SACF;QACH,CAAC,CAAC,EAAE,CAAC;CACR,CAAC,CAAC;AA7BU,QAAA,mBAAmB,uBA6B7B"}
@@ -7,5 +7,5 @@
7
7
  * the spec in a shape that drops cleanly into a `motionBrief`
8
8
  * sourceArtifact.
9
9
  */
10
- export declare const DESCRIBE_MOTION_PROTOCOL = "### Describe Motion protocol (video / motion artifact -> motionBrief)\n\nUse this protocol when the user attaches a video, gif, screen recording, or\nframe sequence to a variants request. The output is a structured motion spec\nthe agent passes back to Rivet as a `sourceArtifacts` entry with\n`kind: 'motionBrief'`. Run this BEFORE `start_variants` so the spec is\navailable to per-variant briefs and codegen.\n\nIf the user provided ONLY a static image or a URL, this protocol is the wrong\ntool \u2014 describe the image as `visualBrief` / `screenshotNotes` instead.\n\n#### Step 1 \u2014 Get frames you can inspect\n\nGuessing from memory of a single playback is the most common failure mode.\nPull stills before describing anything.\n\n- **Video (.mov/.mp4/.webm):** `ffmpeg -i <input> -vf \"fps=30\" frames/%04d.png`\n to step through, or `ffmpeg -i <input> -ss <timestamp> -frames:v 1 frame.png`\n for a single frame around a state change.\n- **GIF:** `magick <input> -coalesce frames/%04d.png` (ImageMagick) for\n per-frame stills.\n- **Unknown framerate:** assume 30 or 60fps. 33ms per frame at 30fps,\n 16ms per frame at 60fps. Multiply frame count between state-change\n boundaries to get duration.\n- **Frame sequence already supplied:** read every frame. The middle frames\n carry the easing.\n\nIf you cannot extract frames in the current environment, say so explicitly in\nthe spec and mark timing / easing fields with `~estimated`.\n\n#### Step 2 \u2014 Five-phase pass\n\nRun these in order. Later phases depend on earlier observations.\n\n1. **Elements & trigger.** Which DOM nodes change between frames, what\n initiates the motion (`hover`, `click`, `focus`, `mount`, `unmount`,\n `scroll`, `intersection`, `drag`, `route change`, `state change`,\n `keypress`), and the direction (entrance / exit / hover / toggle / loop).\n2. **States.** Enumerate discrete states. Most interactions are A -> B\n or A -> B -> A. Some have intermediates (idle -> loading -> success).\n For each state, note every property that will animate.\n3. **Per-property motion.** For each animated property on each element:\n - **Property** \u2014 prefer compositor-friendly (`transform`, `opacity`).\n - **From -> to** \u2014 concrete values (`opacity: 0 -> 1`, `translateY: 8px -> 0`).\n - **Duration** \u2014 milliseconds, measured from frame count. Round to common\n UI durations when within 1 frame: 150, 200, 250, 300, 400, 500ms.\n - **Easing** \u2014 identify by shape (see easing guide below), not by guessing\n a cubic-bezier from memory.\n - **Delay** \u2014 t=0 or later?\n4. **Choreography.** How per-property animations relate across elements:\n parallel (default), sequence (B starts after A), stagger (siblings with a\n fixed offset \u2014 note interval and direction), overlap (B starts before A\n finishes \u2014 note overlap duration), anchor / transform origin if non-default.\n5. **Edge cases & quality.** Cover all of these, even if the answer is\n \"not visible in artifact \u2014 recommend default\":\n - **Reduced motion** \u2014 what `prefers-reduced-motion: reduce` should do.\n Default: skip transforms, keep opacity, shorten to ~0ms.\n - **Interrupt** \u2014 re-trigger mid-animation: snap, reverse from current,\n or queue?\n - **Exit symmetry** \u2014 is the exit the reverse of the entrance, or different?\n - **Loop** \u2014 one-shot, loop, ping-pong, or on-demand?\n - **Performance flags** \u2014 any property that would force layout\n (`height`, `width`, `top`)? Flag and suggest a transform alternative\n if visually equivalent.\n\n#### Easing identification guide\n\nWatch the speed across the animation, not just the endpoints.\n\n- **Linear** \u2014 constant speed. Mechanical-feeling. Rare in good UI.\n- **Ease-out** \u2014 fast start, slow end. Most common entrance.\n- **Ease-in** \u2014 slow start, fast end. Best for exits.\n- **Ease-in-out** \u2014 slow-fast-slow. For transitions between two non-home states.\n- **Spring** \u2014 overshoots, then settles. Look for any frame where the element\n passes its final position. Springs cross the target; ease-out approaches\n monotonically.\n- **Back-out / overshoot** \u2014 ease-out with a slight overshoot before settling.\n\n#### Library recommendation\n\nPick one based on what you observed; the downstream codegen may override.\n\n- **CSS transitions** \u2014 simple state change, single property, no interrupt\n complexity.\n- **CSS keyframes** \u2014 loops, multi-step sequences with fixed timing.\n- **Framer Motion** \u2014 springs, gestures, layout animations, exit animations\n via `AnimatePresence`, stagger via `staggerChildren`.\n- **React Spring** \u2014 physics-driven motion where spring feel matters more\n than precise timing.\n- **GSAP** \u2014 complex sequences, timeline choreography, SVG morphing.\n- **Native View Transitions API** \u2014 page / route transitions where browser\n support allows.\n\n#### Spec template (the motionBrief `content` payload)\n\nAlways produce this exact shape. If a field is not observable, write\n`not visible in artifact` \u2014 do not omit the field. The content string is\nwhat you pass as `sourceArtifacts[i].content`.\n\n```\n# Motion spec: <short name>\n\n## Source\n- Artifact: <filename or description>\n- Input type: video | gif | recording | frame-sequence\n- Frames inspected: <count or \"single playback only\">\n- Estimated framerate: <30 | 60 | unknown>\n\n## Trigger\n- Event: <hover | click | mount | scroll | intersection | ...>\n- Element receiving event: <selector or description>\n\n## Elements animated\n1. <element name> \u2014 role in interaction\n2. ...\n\n## States\n- A (initial): <description>\n- B (final): <description>\n- (intermediate states if any)\n\n## Per-property motion\n### <element 1>\n- \\`<property>\\`: <from> -> <to>, duration <ms>, easing <type>, delay <ms>\n- ...\n\n### <element 2>\n- ...\n\n## Choreography\n- <parallel | sequence | stagger | overlap with details>\n- Transform origin: <if non-default>\n\n## Edge cases\n- Reduced motion: <behavior>\n- Interrupt: <snap | reverse | queue>\n- Exit: <symmetric reverse | different \u2014 describe>\n- Loop: <one-shot | loop | ping-pong>\n- Performance flags: <any layout-thrashing properties>\n\n## Recommended implementation\n- Library: <css | framer-motion | gsap | react-spring | view-transitions>\n- Reason: <one line>\n\n## Confidence\n- High / Medium / Low on: <which fields>\n- Estimates flagged with ~ in the spec above\n```\n\n#### Working principles\n\n- **Numbers over adjectives.** \"Fast\" is useless; \"180ms\" is implementable.\n If you cannot get a number, write `~estimated` and a range.\n- **Frame counting beats vibes.** Snappy ~ 150-250ms; deliberate ~ 300-500ms.\n Measure when you can.\n- **Identify easing by shape, not by name.** Watch where the element sits\n at 25%, 50%, 75% of the duration. Even spacing = linear. Compressed at\n the end = ease-out.\n- **Distinguish observed from inferred.** Anything not seen in the artifact\n is inference. Mark it.\n- **One spec per interaction.** If the video shows three interactions,\n produce three motionBrief entries, not one merged blob.\n\n#### Handing the spec back to Rivet\n\nPass each finished spec as one entry in `sourceArtifacts`:\n\n```\nsourceArtifacts: [\n {\n kind: 'motionBrief',\n label: '<short interaction name, <= 60 chars>',\n content: '<the full spec from the template above>',\n },\n // ... one entry per distinct interaction in the video\n]\n```\n\n**Routing.** A request that carries any `sourceArtifacts` (motionBrief,\nvisualBrief, screenshotNotes, siteBrief, urlText) is source-grounded.\nSource-grounded fresh-project sessions go through\n`create_zero_to_one_project` \u2014 its tool description explicitly lists\n`motionBrief` alongside the other artifact kinds. Pass the artifacts under\n`sourceContext.sourceArtifacts` on that call.\n\nDo **NOT** call `start_variants({ mode: 'zero_to_one' })` directly with a\n`sourceContext` containing any `sourceArtifacts` \u2014 that handler rejects\nthe request with `INVALID_STAGE_ACTION` and instructs you to use\n`create_zero_to_one_project` instead, because the source-research\n(`source_plan`) and brief-approval hops are only wired into the\n`create_zero_to_one_project` path. `start_variants(mode='zero_to_one')`\nis for prompt-only fresh projects.\n\nIf the video is supplementary to an existing project (the user wants\nvariants of a specific element / file / route in their open project and\nattached a video for motion reference), use\n`start_variants({ mode: 'existing', target: ... })` instead and embed the\nmotion spec into each variant's `briefs[i].body` \u2014 `sourceArtifacts` are\nnot part of the existing-project flow.\n\nPer-variant briefs and codegen should treat the motionBrief as authoritative\ntiming / easing / choreography guidance \u2014 visual styling can diverge per\nvariant, motion fidelity should not.";
10
+ export declare const DESCRIBE_MOTION_PROTOCOL = "### Describe Motion protocol (video / motion artifact -> motionBrief)\n\nUse this protocol when the user attaches a video, gif, screen recording, or\nframe sequence to a variants request. The output is a structured motion spec\nthe agent passes back to Rivet as a `sourceArtifacts` entry with\n`kind: 'motionBrief'`. Run this BEFORE `start_variants` so the spec is\navailable to per-variant briefs and codegen.\n\nIf the user provided ONLY a static image or a URL, this protocol is the wrong\ntool \u2014 describe the image as `visualBrief` / `screenshotNotes` instead.\n\n#### Step 1 \u2014 Get frames you can inspect\n\nGuessing from memory of a single playback is the most common failure mode.\nPull stills before describing anything.\n\n- **Video (.mov/.mp4/.webm):** `ffmpeg -i <input> -vf \"fps=30\" frames/%04d.png`\n to step through, or `ffmpeg -i <input> -ss <timestamp> -frames:v 1 frame.png`\n for a single frame around a state change.\n- **GIF:** `magick <input> -coalesce frames/%04d.png` (ImageMagick) for\n per-frame stills.\n- **Unknown framerate:** assume 30 or 60fps. 33ms per frame at 30fps,\n 16ms per frame at 60fps. Multiply frame count between state-change\n boundaries to get duration.\n- **Frame sequence already supplied:** read every frame. The middle frames\n carry the easing.\n\nIf you cannot extract frames in the current environment, say so explicitly in\nthe spec and mark timing / easing fields with `~estimated`.\n\n#### Step 2 \u2014 Five-phase pass\n\nRun these in order. Later phases depend on earlier observations.\n\n1. **Elements & trigger.** Which DOM nodes change between frames, what\n initiates the motion (`hover`, `click`, `focus`, `mount`, `unmount`,\n `scroll`, `intersection`, `drag`, `route change`, `state change`,\n `keypress`), and the direction (entrance / exit / hover / toggle / loop).\n2. **States.** Enumerate discrete states. Most interactions are A -> B\n or A -> B -> A. Some have intermediates (idle -> loading -> success).\n For each state, note every property that will animate.\n3. **Per-property motion.** For each animated property on each element:\n - **Property** \u2014 prefer compositor-friendly (`transform`, `opacity`).\n - **From -> to** \u2014 concrete values (`opacity: 0 -> 1`, `translateY: 8px -> 0`).\n - **Duration** \u2014 milliseconds, measured from frame count. Round to common\n UI durations when within 1 frame: 150, 200, 250, 300, 400, 500ms.\n - **Easing** \u2014 identify by shape (see easing guide below), not by guessing\n a cubic-bezier from memory.\n - **Delay** \u2014 t=0 or later?\n4. **Choreography.** How per-property animations relate across elements:\n parallel (default), sequence (B starts after A), stagger (siblings with a\n fixed offset \u2014 note interval and direction), overlap (B starts before A\n finishes \u2014 note overlap duration), anchor / transform origin if non-default.\n5. **Edge cases & quality.** Cover all of these, even if the answer is\n \"not visible in artifact \u2014 recommend default\":\n - **Reduced motion** \u2014 what `prefers-reduced-motion: reduce` should do.\n Default: skip transforms, keep opacity, shorten to ~0ms.\n - **Interrupt** \u2014 re-trigger mid-animation: snap, reverse from current,\n or queue?\n - **Exit symmetry** \u2014 is the exit the reverse of the entrance, or different?\n - **Loop** \u2014 one-shot, loop, ping-pong, or on-demand?\n - **Performance flags** \u2014 any property that would force layout\n (`height`, `width`, `top`)? Flag and suggest a transform alternative\n if visually equivalent.\n\n#### Easing identification guide\n\nWatch the speed across the animation, not just the endpoints.\n\n- **Linear** \u2014 constant speed. Mechanical-feeling. Rare in good UI.\n- **Ease-out** \u2014 fast start, slow end. Most common entrance.\n- **Ease-in** \u2014 slow start, fast end. Best for exits.\n- **Ease-in-out** \u2014 slow-fast-slow. For transitions between two non-home states.\n- **Spring** \u2014 overshoots, then settles. Look for any frame where the element\n passes its final position. Springs cross the target; ease-out approaches\n monotonically.\n- **Back-out / overshoot** \u2014 ease-out with a slight overshoot before settling.\n\n#### Library recommendation\n\nPick one based on what you observed; the downstream codegen may override.\n\n- **CSS transitions** \u2014 simple state change, single property, no interrupt\n complexity.\n- **CSS keyframes** \u2014 loops, multi-step sequences with fixed timing.\n- **Framer Motion** \u2014 springs, gestures, layout animations, exit animations\n via `AnimatePresence`, stagger via `staggerChildren`.\n- **React Spring** \u2014 physics-driven motion where spring feel matters more\n than precise timing.\n- **GSAP** \u2014 complex sequences, timeline choreography, SVG morphing.\n- **Native View Transitions API** \u2014 page / route transitions where browser\n support allows.\n\n#### Spec template (the motionBrief `content` payload)\n\nAlways produce this exact shape. If a field is not observable, write\n`not visible in artifact` \u2014 do not omit the field. The content string is\nwhat you pass as `sourceArtifacts[i].content`.\n\n```\n# Motion spec: <short name>\n\n## Source\n- Artifact: <filename or description>\n- Input type: video | gif | recording | frame-sequence\n- Frames inspected: <count or \"single playback only\">\n- Estimated framerate: <30 | 60 | unknown>\n\n## Trigger\n- Event: <hover | click | mount | scroll | intersection | ...>\n- Element receiving event: <selector or description>\n\n## Elements animated\n1. <element name> \u2014 role in interaction\n2. ...\n\n## States\n- A (initial): <description>\n- B (final): <description>\n- (intermediate states if any)\n\n## Per-property motion\n### <element 1>\n- \\`<property>\\`: <from> -> <to>, duration <ms>, easing <type>, delay <ms>\n- ...\n\n### <element 2>\n- ...\n\n## Choreography\n- <parallel | sequence | stagger | overlap with details>\n- Transform origin: <if non-default>\n\n## Edge cases\n- Reduced motion: <behavior>\n- Interrupt: <snap | reverse | queue>\n- Exit: <symmetric reverse | different \u2014 describe>\n- Loop: <one-shot | loop | ping-pong>\n- Performance flags: <any layout-thrashing properties>\n\n## Recommended implementation\n- Library: <css | framer-motion | gsap | react-spring | view-transitions>\n- Reason: <one line>\n\n## Confidence\n- High / Medium / Low on: <which fields>\n- Estimates flagged with ~ in the spec above\n```\n\n#### Working principles\n\n- **Numbers over adjectives.** \"Fast\" is useless; \"180ms\" is implementable.\n If you cannot get a number, write `~estimated` and a range.\n- **Frame counting beats vibes.** Snappy ~ 150-250ms; deliberate ~ 300-500ms.\n Measure when you can.\n- **Identify easing by shape, not by name.** Watch where the element sits\n at 25%, 50%, 75% of the duration. Even spacing = linear. Compressed at\n the end = ease-out.\n- **Distinguish observed from inferred.** Anything not seen in the artifact\n is inference. Mark it.\n- **One spec per interaction.** If the video shows three interactions,\n produce three motionBrief entries, not one merged blob.\n\n#### Handing the spec back to Rivet\n\nPass each finished spec as one entry in `sourceArtifacts`:\n\n```\nsourceArtifacts: [\n {\n kind: 'motionBrief',\n label: '<short interaction name, <= 60 chars>',\n content: '<the full spec from the template above>',\n },\n // ... one entry per distinct interaction in the video\n]\n```\n\n**Routing.** A request that carries any `sourceArtifacts` (motionBrief,\nvisualBrief, screenshotNotes, siteBrief, urlText) is source-grounded.\nSource-grounded fresh-project sessions go through\n`start_variants({ mode: 'zero_to_one' })` \u2014 pass the artifacts under\n`sourceContext.sourceArtifacts`. start_variants detects the source-grounded\ninput and runs the source-research (`source_plan`) flow automatically,\nreturning `stage: 'awaiting_source_plan'` (rather than the prompt-only\nsingle-call `work_items_ready`).\n\nstart_variants is the single fresh-project entry point \u2014 there is **no**\nseparate source-grounded kickoff tool. A prompt-only `start_variants({ mode:\n'zero_to_one' })` call (no `sourceContext`) takes the single-call path and\nreturns `work_items_ready` directly; adding any `sourceArtifacts` /\n`sourceUrls` switches it to the multi-step source-research flow.\n\nIf the video is supplementary to an existing project (the user wants\nvariants of a specific element / file / route in their open project and\nattached a video for motion reference), use\n`start_variants({ mode: 'existing', target: ... })` instead and embed the\nmotion spec into each variant's `briefs[i].body` \u2014 `sourceArtifacts` are\nnot part of the existing-project flow.\n\nPer-variant briefs and codegen should treat the motionBrief as authoritative\ntiming / easing / choreography guidance \u2014 visual styling can diverge per\nvariant, motion fidelity should not.";
11
11
  //# sourceMappingURL=describe-motion-protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"describe-motion-protocol.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/describe-motion-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,gzRA0MA,CAAC"}
1
+ {"version":3,"file":"describe-motion-protocol.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/describe-motion-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,w1RA0MA,CAAC"}
@@ -191,17 +191,17 @@ sourceArtifacts: [
191
191
  **Routing.** A request that carries any \`sourceArtifacts\` (motionBrief,
192
192
  visualBrief, screenshotNotes, siteBrief, urlText) is source-grounded.
193
193
  Source-grounded fresh-project sessions go through
194
- \`create_zero_to_one_project\` — its tool description explicitly lists
195
- \`motionBrief\` alongside the other artifact kinds. Pass the artifacts under
196
- \`sourceContext.sourceArtifacts\` on that call.
197
-
198
- Do **NOT** call \`start_variants({ mode: 'zero_to_one' })\` directly with a
199
- \`sourceContext\` containing any \`sourceArtifacts\` — that handler rejects
200
- the request with \`INVALID_STAGE_ACTION\` and instructs you to use
201
- \`create_zero_to_one_project\` instead, because the source-research
202
- (\`source_plan\`) and brief-approval hops are only wired into the
203
- \`create_zero_to_one_project\` path. \`start_variants(mode='zero_to_one')\`
204
- is for prompt-only fresh projects.
194
+ \`start_variants({ mode: 'zero_to_one' })\` — pass the artifacts under
195
+ \`sourceContext.sourceArtifacts\`. start_variants detects the source-grounded
196
+ input and runs the source-research (\`source_plan\`) flow automatically,
197
+ returning \`stage: 'awaiting_source_plan'\` (rather than the prompt-only
198
+ single-call \`work_items_ready\`).
199
+
200
+ start_variants is the single fresh-project entry point there is **no**
201
+ separate source-grounded kickoff tool. A prompt-only \`start_variants({ mode:
202
+ 'zero_to_one' })\` call (no \`sourceContext\`) takes the single-call path and
203
+ returns \`work_items_ready\` directly; adding any \`sourceArtifacts\` /
204
+ \`sourceUrls\` switches it to the multi-step source-research flow.
205
205
 
206
206
  If the video is supplementary to an existing project (the user wants
207
207
  variants of a specific element / file / route in their open project and
@@ -1 +1 @@
1
- {"version":3,"file":"shared-variants-protocol.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/shared-variants-protocol.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAGgF,CAAC;AAEtH,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB,mjCAQoK,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,CA2GT"}
1
+ {"version":3,"file":"shared-variants-protocol.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/shared-variants-protocol.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAGgF,CAAC;AAEtH,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB,mjCAQoK,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,CA6GT"}
@@ -88,14 +88,15 @@ For brand-new projects the user describes from scratch ("build me a Vite todo ap
88
88
 
89
89
  ---
90
90
 
91
- ### Sub-flow C: Fresh project (source-grounded) — \`create_zero_to_one_project\`
91
+ ### Sub-flow C: Fresh project (source-grounded) — \`start_variants\`
92
92
 
93
93
  **Trigger:** the user provided inspiration URLs ("like stripe.com"), attached an image in chat (pasted screenshot/mockup), attached a video/gif/screen recording ("match this animation", "build the hover from this clip"), referenced an image or video file path (e.g. \`~/Desktop/mockup.png\`, \`~/Desktop/hover.mov\`), or supplied written design context. Image-only and video-only requests with no URLs are valid and belong in this sub-flow — do not fall back to Sub-flow B.
94
94
 
95
- Use \`create_zero_to_one_project\` for this sub-flow. \`start_variants({ mode: 'zero_to_one' })\` rejects any request whose \`sourceContext\` carries \`sourceUrls\`, \`sourceArtifacts\`, or \`sourceIntent\`that handler is prompt-only (Sub-flow B). The source-research hop is only wired into \`create_zero_to_one_project\`.
95
+ Use the same \`start_variants({ mode: 'zero_to_one' })\` entry point as Sub-flow B, but pass a \`sourceContext\`. When \`sourceContext\` carries \`sourceUrls\`, \`sourceArtifacts\`, or \`sourceIntent\`, start_variants detects the source-grounded input and runs the source-research flow automatically returning \`stage: 'awaiting_source_plan'\` instead of the prompt-only single-call \`work_items_ready\`. start_variants is the single fresh-project entry point — there is no separate source-grounded kickoff tool.
96
96
 
97
- 1. **Call \`create_zero_to_one_project\`** with:
97
+ 1. **Call \`start_variants\`** with:
98
98
  - \`prompt\`: the user's request verbatim
99
+ - \`mode\`: \`'zero_to_one'\`
99
100
  - \`framework\` (optional, defaults to \`'vite'\`)
100
101
  - \`destinationParent\` (optional, absolute path)
101
102
  - \`sourceContext\`:
@@ -103,7 +104,7 @@ Use \`create_zero_to_one_project\` for this sub-flow. \`start_variants({ mode: '
103
104
  - \`preserveBrand\` (optional): true when the user wants brand colors/type/voice preserved exactly
104
105
  - \`sourceArtifacts\` (optional): pasted briefs, screenshot notes, written design context, **agent-described images**, OR **agent-described videos**. If the user attached one or more images in chat OR referenced an image file path: for path references, open the file with your \`Read\` tool first; then in both cases describe what you see — layout, colour palette, typography, component patterns, voice — and pass each image as a \`sourceArtifacts\` entry with \`kind: 'visualBrief'\` (overall design system) or \`kind: 'screenshotNotes'\` (specific screen). If the user attached a video, gif, screen recording, or frame sequence OR referenced a video file path: run the **Describe Motion protocol** (see section below) to extract a structured motion spec, and pass each spec as a \`sourceArtifacts\` entry with \`kind: 'motionBrief'\`. One \`motionBrief\` per distinct interaction in the video — do not merge multiple interactions into one entry. Do not invent a URL for an image or video. \`sourceArtifacts\` can fully replace \`sourceUrls\` — image-only and video-only calls (no URLs) are supported.
105
106
 
106
- Response (source-grounded): \`{ sessionId, stage: 'awaiting_source_plan', sourcePlanWorkItem, nextAction: 'continue_variants', visualEditor? }\`. Share \`visualEditor.url\` with the user immediately.
107
+ Response (source-grounded): \`{ sessionId, stage: 'awaiting_source_plan', mode: 'zero_to_one', sourcePlanWorkItem, nextAction: 'continue_variants', destinationPath, visualEditor? }\`. Share \`visualEditor.url\` with the user immediately.
107
108
 
108
109
  2. **Process the source_plan work item.** Classify the inspiration sources, produce per-slot DESIGN.md, and choose \`executionPlan.mode\`:
109
110
  - DESIGN.md per slot matches the bundled catalog shape under \`src/services/templates/designmd/*.md\` (Visual Theme & Atmosphere → Color Palette & Roles → Typography Rules → Component Stylings → Layout Principles → Depth & Elevation → Do's & Don'ts → Responsive Behavior → Agent Prompt Guide). For sections you cannot determine from the source, write \`Not observed\` rather than inventing values.
@@ -131,6 +132,7 @@ ${describe_motion_protocol_1.DESCRIBE_MOTION_PROTOCOL}
131
132
  - 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.
132
133
  - Parallel code-gen is the only step where you fan out — every other step is one tool call.
133
134
  - **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.
135
+ - **Honor aborts mid-generation.** When the user removes or cancels a direction while it is still generating, the very next \`report_variant_complete\` for that work item returns \`{ aborted: true }\`. Treat that as a hard stop for that one direction: abandon it immediately, do NOT retry or re-report it, and keep going on the rest. For directions that take a while to build, send periodic \`status: 'running'\` heartbeats through \`report_variant_complete\` so an abort is caught early instead of after you have spent the work — a cleared lease surfacing as \`{ aborted: true }\` (rather than an error) is the signal to drop it.
134
136
  - 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.`;
135
137
  }
136
138
  //# sourceMappingURL=shared-variants-protocol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared-variants-protocol.js","sourceRoot":"","sources":["../../../src/utils/skills/shared-variants-protocol.ts"],"names":[],"mappings":";;;AA2BA,8DAoHC;AA/ID,yEAAsE;AAEtE;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuC7L,mDAAwB;;;;;;0CAMgB,IAAI,CAAC,cAAc;;;;;;;;;oMASuI,CAAC;AACrM,CAAC"}
1
+ {"version":3,"file":"shared-variants-protocol.js","sourceRoot":"","sources":["../../../src/utils/skills/shared-variants-protocol.ts"],"names":[],"mappings":";;;AA2BA,8DAsHC;AAjJD,yEAAsE;AAEtE;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwC7L,mDAAwB;;;;;;0CAMgB,IAAI,CAAC,cAAc;;;;;;;;;;oMAUuI,CAAC;AACrM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rivet-design",
3
- "version": "0.10.6",
3
+ "version": "0.10.8",
4
4
  "description": "Local visual web development tool with AI-powered code modification",
5
5
  "main": "dist/index.js",
6
6
  "workspaces": [
@@ -16,6 +16,8 @@
16
16
  "build": "tsc && npm run build:assets && npm run build:ui && npm run build:bin",
17
17
  "build:assets": "mkdir -p dist/services/templates/designmd && cp src/services/templates/designmd/*.md dist/services/templates/designmd/",
18
18
  "build:ui": "cd src/ui && vite build",
19
+ "storybook:ui": "yarn workspace @rivet/ui storybook",
20
+ "build-storybook:ui": "yarn workspace @rivet/ui build-storybook",
19
21
  "build:bin": "mkdir -p bin && cp src/bin-template.js bin/rivet.js && chmod +x bin/rivet.js",
20
22
  "dev": "tsc --watch",
21
23
  "clean": "rm -rf dist src/ui/dist bin",