rivet-design 0.17.4 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (938) hide show
  1. package/bin/rivet.js +0 -16
  2. package/dist/agent-variants/SessionStore.d.ts +5 -240
  3. package/dist/agent-variants/SessionStore.d.ts.map +1 -1
  4. package/dist/agent-variants/SessionStore.js +42 -371
  5. package/dist/agent-variants/SessionStore.js.map +1 -1
  6. package/dist/agent-variants/VariantWorkspaceManager.d.ts +0 -10
  7. package/dist/agent-variants/VariantWorkspaceManager.d.ts.map +1 -1
  8. package/dist/agent-variants/VariantWorkspaceManager.js +0 -17
  9. package/dist/agent-variants/VariantWorkspaceManager.js.map +1 -1
  10. package/dist/agent-variants/WorkerExecutorService.d.ts +1 -105
  11. package/dist/agent-variants/WorkerExecutorService.d.ts.map +1 -1
  12. package/dist/agent-variants/WorkerExecutorService.js +11 -182
  13. package/dist/agent-variants/WorkerExecutorService.js.map +1 -1
  14. package/dist/agent-variants/WorktreeOrchestrator.d.ts +6 -598
  15. package/dist/agent-variants/WorktreeOrchestrator.d.ts.map +1 -1
  16. package/dist/agent-variants/WorktreeOrchestrator.js +55 -1288
  17. package/dist/agent-variants/WorktreeOrchestrator.js.map +1 -1
  18. package/dist/agent-variants/WorktreeOrchestrator.testHelpers.d.ts +0 -6
  19. package/dist/agent-variants/WorktreeOrchestrator.testHelpers.d.ts.map +1 -1
  20. package/dist/agent-variants/WorktreeOrchestrator.testHelpers.js +0 -23
  21. package/dist/agent-variants/WorktreeOrchestrator.testHelpers.js.map +1 -1
  22. package/dist/agent-variants/briefContent.d.ts +0 -11
  23. package/dist/agent-variants/briefContent.d.ts.map +1 -1
  24. package/dist/agent-variants/briefContent.js +0 -12
  25. package/dist/agent-variants/briefContent.js.map +1 -1
  26. package/dist/agent-variants/contextAssets.d.ts +0 -3
  27. package/dist/agent-variants/contextAssets.d.ts.map +1 -1
  28. package/dist/agent-variants/contextAssets.js +0 -3
  29. package/dist/agent-variants/contextAssets.js.map +1 -1
  30. package/dist/agent-variants/contracts.d.ts +2016 -600
  31. package/dist/agent-variants/contracts.d.ts.map +1 -1
  32. package/dist/agent-variants/contracts.js +10 -174
  33. package/dist/agent-variants/contracts.js.map +1 -1
  34. package/dist/agent-variants/createProjectArtifacts.d.ts +0 -17
  35. package/dist/agent-variants/createProjectArtifacts.d.ts.map +1 -1
  36. package/dist/agent-variants/createProjectArtifacts.js +0 -10
  37. package/dist/agent-variants/createProjectArtifacts.js.map +1 -1
  38. package/dist/agent-variants/diffQa.d.ts +0 -1
  39. package/dist/agent-variants/diffQa.d.ts.map +1 -1
  40. package/dist/agent-variants/diffQa.js +0 -1
  41. package/dist/agent-variants/diffQa.js.map +1 -1
  42. package/dist/agent-variants/directionAuthoring.d.ts +0 -13
  43. package/dist/agent-variants/directionAuthoring.d.ts.map +1 -1
  44. package/dist/agent-variants/directionAuthoring.js +12 -46
  45. package/dist/agent-variants/directionAuthoring.js.map +1 -1
  46. package/dist/agent-variants/elementRefToTarget.d.ts +0 -17
  47. package/dist/agent-variants/elementRefToTarget.d.ts.map +1 -1
  48. package/dist/agent-variants/elementRefToTarget.js +0 -17
  49. package/dist/agent-variants/elementRefToTarget.js.map +1 -1
  50. package/dist/agent-variants/generatedDestination.d.ts +0 -3
  51. package/dist/agent-variants/generatedDestination.d.ts.map +1 -1
  52. package/dist/agent-variants/generatedDestination.js +0 -3
  53. package/dist/agent-variants/generatedDestination.js.map +1 -1
  54. package/dist/agent-variants/previewQa.d.ts +0 -6
  55. package/dist/agent-variants/previewQa.d.ts.map +1 -1
  56. package/dist/agent-variants/previewQa.js +0 -5
  57. package/dist/agent-variants/previewQa.js.map +1 -1
  58. package/dist/agent-variants/runLabel.d.ts +0 -15
  59. package/dist/agent-variants/runLabel.d.ts.map +1 -1
  60. package/dist/agent-variants/runLabel.js +0 -19
  61. package/dist/agent-variants/runLabel.js.map +1 -1
  62. package/dist/agent-variants/runPlan.d.ts +3 -84
  63. package/dist/agent-variants/runPlan.d.ts.map +1 -1
  64. package/dist/agent-variants/runPlan.js +0 -51
  65. package/dist/agent-variants/runPlan.js.map +1 -1
  66. package/dist/agent-variants/sourceContext.d.ts +0 -10
  67. package/dist/agent-variants/sourceContext.d.ts.map +1 -1
  68. package/dist/agent-variants/sourceContext.js +0 -36
  69. package/dist/agent-variants/sourceContext.js.map +1 -1
  70. package/dist/agent-variants/variantContext.d.ts +6 -7
  71. package/dist/agent-variants/variantContext.d.ts.map +1 -1
  72. package/dist/agent-variants/variantContext.js +69 -10
  73. package/dist/agent-variants/variantContext.js.map +1 -1
  74. package/dist/agent-variants/videoKeyframes.d.ts +0 -7
  75. package/dist/agent-variants/videoKeyframes.d.ts.map +1 -1
  76. package/dist/agent-variants/videoKeyframes.js +0 -7
  77. package/dist/agent-variants/videoKeyframes.js.map +1 -1
  78. package/dist/agent-variants/workItemBriefing.d.ts +0 -21
  79. package/dist/agent-variants/workItemBriefing.d.ts.map +1 -1
  80. package/dist/agent-variants/workItemBriefing.js +0 -49
  81. package/dist/agent-variants/workItemBriefing.js.map +1 -1
  82. package/dist/agent-variants/workerRuntime.d.ts +1 -137
  83. package/dist/agent-variants/workerRuntime.d.ts.map +1 -1
  84. package/dist/agent-variants/workerRuntime.js +8 -147
  85. package/dist/agent-variants/workerRuntime.js.map +1 -1
  86. package/dist/cli/browser.d.ts +0 -1
  87. package/dist/cli/browser.d.ts.map +1 -1
  88. package/dist/cli/browser.js +0 -1
  89. package/dist/cli/browser.js.map +1 -1
  90. package/dist/cli/callerRunnerPaths.d.ts +0 -50
  91. package/dist/cli/callerRunnerPaths.d.ts.map +1 -1
  92. package/dist/cli/callerRunnerPaths.js +0 -59
  93. package/dist/cli/callerRunnerPaths.js.map +1 -1
  94. package/dist/cli/client.d.ts +0 -18
  95. package/dist/cli/client.d.ts.map +1 -1
  96. package/dist/cli/client.js +0 -28
  97. package/dist/cli/client.js.map +1 -1
  98. package/dist/cli/commandNames.d.ts +0 -7
  99. package/dist/cli/commandNames.d.ts.map +1 -1
  100. package/dist/cli/commandNames.js +1 -7
  101. package/dist/cli/commandNames.js.map +1 -1
  102. package/dist/cli/commands/auth.d.ts +0 -6
  103. package/dist/cli/commands/auth.d.ts.map +1 -1
  104. package/dist/cli/commands/auth.js +0 -6
  105. package/dist/cli/commands/auth.js.map +1 -1
  106. package/dist/cli/commands/elementSelector.d.ts +0 -6
  107. package/dist/cli/commands/elementSelector.d.ts.map +1 -1
  108. package/dist/cli/commands/elementSelector.js +0 -7
  109. package/dist/cli/commands/elementSelector.js.map +1 -1
  110. package/dist/cli/commands/evidence.d.ts +0 -6
  111. package/dist/cli/commands/evidence.d.ts.map +1 -1
  112. package/dist/cli/commands/evidence.js +0 -6
  113. package/dist/cli/commands/evidence.js.map +1 -1
  114. package/dist/cli/commands/libraryOpen.d.ts +0 -1
  115. package/dist/cli/commands/libraryOpen.d.ts.map +1 -1
  116. package/dist/cli/commands/libraryOpen.js +0 -4
  117. package/dist/cli/commands/libraryOpen.js.map +1 -1
  118. package/dist/cli/commands/mcpServe.d.ts +0 -24
  119. package/dist/cli/commands/mcpServe.d.ts.map +1 -1
  120. package/dist/cli/commands/mcpServe.js +126 -106
  121. package/dist/cli/commands/mcpServe.js.map +1 -1
  122. package/dist/cli/commands/open.d.ts +0 -8
  123. package/dist/cli/commands/open.d.ts.map +1 -1
  124. package/dist/cli/commands/open.js +0 -57
  125. package/dist/cli/commands/open.js.map +1 -1
  126. package/dist/cli/commands/profile.d.ts +3 -0
  127. package/dist/cli/commands/profile.d.ts.map +1 -0
  128. package/dist/cli/commands/profile.js +192 -0
  129. package/dist/cli/commands/profile.js.map +1 -0
  130. package/dist/cli/commands/reference.d.ts +0 -5
  131. package/dist/cli/commands/reference.d.ts.map +1 -1
  132. package/dist/cli/commands/reference.js +4 -27
  133. package/dist/cli/commands/reference.js.map +1 -1
  134. package/dist/cli/commands/serve.d.ts +0 -5
  135. package/dist/cli/commands/serve.d.ts.map +1 -1
  136. package/dist/cli/commands/serve.js +0 -34
  137. package/dist/cli/commands/serve.js.map +1 -1
  138. package/dist/cli/commands/shared.d.ts +0 -16
  139. package/dist/cli/commands/shared.d.ts.map +1 -1
  140. package/dist/cli/commands/shared.js +0 -19
  141. package/dist/cli/commands/shared.js.map +1 -1
  142. package/dist/cli/commands/status.d.ts +0 -6
  143. package/dist/cli/commands/status.d.ts.map +1 -1
  144. package/dist/cli/commands/status.js +0 -11
  145. package/dist/cli/commands/status.js.map +1 -1
  146. package/dist/cli/commands/stop.d.ts +0 -5
  147. package/dist/cli/commands/stop.d.ts.map +1 -1
  148. package/dist/cli/commands/stop.js +0 -6
  149. package/dist/cli/commands/stop.js.map +1 -1
  150. package/dist/cli/commands/update.d.ts +0 -1
  151. package/dist/cli/commands/update.d.ts.map +1 -1
  152. package/dist/cli/commands/update.js +0 -1
  153. package/dist/cli/commands/update.js.map +1 -1
  154. package/dist/cli/commands/variants.d.ts +0 -1
  155. package/dist/cli/commands/variants.d.ts.map +1 -1
  156. package/dist/cli/commands/variants.js +13 -32
  157. package/dist/cli/commands/variants.js.map +1 -1
  158. package/dist/cli/commands/wait.d.ts +0 -21
  159. package/dist/cli/commands/wait.d.ts.map +1 -1
  160. package/dist/cli/commands/wait.js +0 -23
  161. package/dist/cli/commands/wait.js.map +1 -1
  162. package/dist/cli/entry.d.ts +0 -10
  163. package/dist/cli/entry.d.ts.map +1 -1
  164. package/dist/cli/entry.js +0 -13
  165. package/dist/cli/entry.js.map +1 -1
  166. package/dist/cli/envelope.d.ts +1 -25
  167. package/dist/cli/envelope.d.ts.map +1 -1
  168. package/dist/cli/envelope.js +0 -19
  169. package/dist/cli/envelope.js.map +1 -1
  170. package/dist/cli/flags.d.ts +0 -7
  171. package/dist/cli/flags.d.ts.map +1 -1
  172. package/dist/cli/flags.js +0 -7
  173. package/dist/cli/flags.js.map +1 -1
  174. package/dist/cli/handoff.d.ts +0 -33
  175. package/dist/cli/handoff.d.ts.map +1 -1
  176. package/dist/cli/handoff.js +0 -42
  177. package/dist/cli/handoff.js.map +1 -1
  178. package/dist/cli/handoffStore.d.ts +0 -11
  179. package/dist/cli/handoffStore.d.ts.map +1 -1
  180. package/dist/cli/handoffStore.js +0 -10
  181. package/dist/cli/handoffStore.js.map +1 -1
  182. package/dist/cli/hostWorkNextAction.d.ts +0 -11
  183. package/dist/cli/hostWorkNextAction.d.ts.map +1 -1
  184. package/dist/cli/hostWorkNextAction.js +0 -4
  185. package/dist/cli/hostWorkNextAction.js.map +1 -1
  186. package/dist/cli/io.d.ts +0 -9
  187. package/dist/cli/io.d.ts.map +1 -1
  188. package/dist/cli/io.js +0 -1
  189. package/dist/cli/io.js.map +1 -1
  190. package/dist/cli/resolveDefaultNodeEnv.d.ts +0 -5
  191. package/dist/cli/resolveDefaultNodeEnv.d.ts.map +1 -1
  192. package/dist/cli/resolveDefaultNodeEnv.js +0 -5
  193. package/dist/cli/resolveDefaultNodeEnv.js.map +1 -1
  194. package/dist/cli/router.d.ts +0 -21
  195. package/dist/cli/router.d.ts.map +1 -1
  196. package/dist/cli/router.js +8 -46
  197. package/dist/cli/router.js.map +1 -1
  198. package/dist/cli/runnerSelection.d.ts +0 -58
  199. package/dist/cli/runnerSelection.d.ts.map +1 -1
  200. package/dist/cli/runnerSelection.js +0 -16
  201. package/dist/cli/runnerSelection.js.map +1 -1
  202. package/dist/cli/serverHandshake.d.ts +0 -36
  203. package/dist/cli/serverHandshake.d.ts.map +1 -1
  204. package/dist/cli/serverHandshake.js +0 -29
  205. package/dist/cli/serverHandshake.js.map +1 -1
  206. package/dist/cli/serverUnavailable.d.ts +0 -1
  207. package/dist/cli/serverUnavailable.d.ts.map +1 -1
  208. package/dist/cli/serverUnavailable.js +0 -1
  209. package/dist/cli/serverUnavailable.js.map +1 -1
  210. package/dist/cli/serverVersion.d.ts +0 -22
  211. package/dist/cli/serverVersion.d.ts.map +1 -1
  212. package/dist/cli/serverVersion.js +0 -12
  213. package/dist/cli/serverVersion.js.map +1 -1
  214. package/dist/cli/telemetry.d.ts +0 -4
  215. package/dist/cli/telemetry.d.ts.map +1 -1
  216. package/dist/cli/telemetry.js +0 -4
  217. package/dist/cli/telemetry.js.map +1 -1
  218. package/dist/config/evaluateFlags.d.ts +0 -4
  219. package/dist/config/evaluateFlags.d.ts.map +1 -1
  220. package/dist/config/evaluateFlags.js +0 -11
  221. package/dist/config/evaluateFlags.js.map +1 -1
  222. package/dist/config/featureFlagUserKey.d.ts +0 -3
  223. package/dist/config/featureFlagUserKey.d.ts.map +1 -1
  224. package/dist/config/featureFlagUserKey.js +0 -3
  225. package/dist/config/featureFlagUserKey.js.map +1 -1
  226. package/dist/config/flags.d.ts +0 -14
  227. package/dist/config/flags.d.ts.map +1 -1
  228. package/dist/config/flags.js +0 -27
  229. package/dist/config/flags.js.map +1 -1
  230. package/dist/config/proxy.d.ts +0 -3
  231. package/dist/config/proxy.d.ts.map +1 -1
  232. package/dist/config/proxy.js +0 -11
  233. package/dist/config/proxy.js.map +1 -1
  234. package/dist/config/telemetry.d.ts +0 -13
  235. package/dist/config/telemetry.d.ts.map +1 -1
  236. package/dist/config/telemetry.js +0 -13
  237. package/dist/config/telemetry.js.map +1 -1
  238. package/dist/config/telemetryContract.d.ts +0 -1
  239. package/dist/config/telemetryContract.d.ts.map +1 -1
  240. package/dist/config/telemetryContract.js +0 -1
  241. package/dist/config/telemetryContract.js.map +1 -1
  242. package/dist/hosts/workerDefaults.d.ts +0 -69
  243. package/dist/hosts/workerDefaults.d.ts.map +1 -1
  244. package/dist/hosts/workerDefaults.js +0 -68
  245. package/dist/hosts/workerDefaults.js.map +1 -1
  246. package/dist/index-core.d.ts.map +1 -1
  247. package/dist/index-core.js +0 -2
  248. package/dist/index-core.js.map +1 -1
  249. package/dist/index.d.ts +0 -20
  250. package/dist/index.d.ts.map +1 -1
  251. package/dist/index.js +2 -105
  252. package/dist/index.js.map +1 -1
  253. package/dist/install/allowlists.d.ts +0 -32
  254. package/dist/install/allowlists.d.ts.map +1 -1
  255. package/dist/install/allowlists.js +0 -44
  256. package/dist/install/allowlists.js.map +1 -1
  257. package/dist/install/automaticCliUpdate.d.ts +0 -6
  258. package/dist/install/automaticCliUpdate.d.ts.map +1 -1
  259. package/dist/install/automaticCliUpdate.js +0 -13
  260. package/dist/install/automaticCliUpdate.js.map +1 -1
  261. package/dist/install/channelCli.d.ts +0 -1
  262. package/dist/install/channelCli.d.ts.map +1 -1
  263. package/dist/install/channelCli.js +0 -3
  264. package/dist/install/channelCli.js.map +1 -1
  265. package/dist/install/channelManager.d.ts +0 -14
  266. package/dist/install/channelManager.d.ts.map +1 -1
  267. package/dist/install/channelManager.js +0 -22
  268. package/dist/install/channelManager.js.map +1 -1
  269. package/dist/install/codexGuidance.d.ts +0 -1
  270. package/dist/install/codexGuidance.d.ts.map +1 -1
  271. package/dist/install/codexGuidance.js +0 -7
  272. package/dist/install/codexGuidance.js.map +1 -1
  273. package/dist/install/globalBootstrap.d.ts +0 -25
  274. package/dist/install/globalBootstrap.d.ts.map +1 -1
  275. package/dist/install/globalBootstrap.js +0 -10
  276. package/dist/install/globalBootstrap.js.map +1 -1
  277. package/dist/install/harnesses.d.ts +0 -66
  278. package/dist/install/harnesses.d.ts.map +1 -1
  279. package/dist/install/harnesses.js +0 -60
  280. package/dist/install/harnesses.js.map +1 -1
  281. package/dist/install/installationChannel.d.ts +0 -1
  282. package/dist/install/installationChannel.d.ts.map +1 -1
  283. package/dist/install/installationChannel.js +0 -1
  284. package/dist/install/installationChannel.js.map +1 -1
  285. package/dist/install/legacyMcp.d.ts +0 -23
  286. package/dist/install/legacyMcp.d.ts.map +1 -1
  287. package/dist/install/legacyMcp.js +3 -46
  288. package/dist/install/legacyMcp.js.map +1 -1
  289. package/dist/install/mcpRegistration.d.ts +0 -41
  290. package/dist/install/mcpRegistration.d.ts.map +1 -1
  291. package/dist/install/mcpRegistration.js +2 -70
  292. package/dist/install/mcpRegistration.js.map +1 -1
  293. package/dist/library/HubClient.d.ts +1 -2
  294. package/dist/library/HubClient.d.ts.map +1 -1
  295. package/dist/library/HubClient.js +11 -5
  296. package/dist/library/HubClient.js.map +1 -1
  297. package/dist/library/HubServer.d.ts +0 -1
  298. package/dist/library/HubServer.d.ts.map +1 -1
  299. package/dist/library/HubServer.js +19 -1
  300. package/dist/library/HubServer.js.map +1 -1
  301. package/dist/library/StaticPreviewServer.d.ts +0 -1
  302. package/dist/library/StaticPreviewServer.d.ts.map +1 -1
  303. package/dist/library/StaticPreviewServer.js +0 -1
  304. package/dist/library/StaticPreviewServer.js.map +1 -1
  305. package/dist/library/http.d.ts +0 -2
  306. package/dist/library/http.d.ts.map +1 -1
  307. package/dist/library/http.js +0 -2
  308. package/dist/library/http.js.map +1 -1
  309. package/dist/library/importFiles.d.ts +0 -6
  310. package/dist/library/importFiles.d.ts.map +1 -1
  311. package/dist/library/importFiles.js +45 -11
  312. package/dist/library/importFiles.js.map +1 -1
  313. package/dist/mcp/changeBatchClassification.d.ts +0 -40
  314. package/dist/mcp/changeBatchClassification.d.ts.map +1 -1
  315. package/dist/mcp/changeBatchClassification.js +0 -34
  316. package/dist/mcp/changeBatchClassification.js.map +1 -1
  317. package/dist/prompts/commentVariationPrompts.d.ts +0 -5
  318. package/dist/prompts/commentVariationPrompts.d.ts.map +1 -1
  319. package/dist/prompts/commentVariationPrompts.js +0 -5
  320. package/dist/prompts/commentVariationPrompts.js.map +1 -1
  321. package/dist/prototype-host.js +0 -15
  322. package/dist/prototype-host.js.map +1 -1
  323. package/dist/proxy-middleware/preview-bridge.d.ts +0 -2
  324. package/dist/proxy-middleware/preview-bridge.d.ts.map +1 -1
  325. package/dist/proxy-middleware/preview-bridge.js +0 -2
  326. package/dist/proxy-middleware/preview-bridge.js.map +1 -1
  327. package/dist/proxy-middleware/preview-connections.d.ts +0 -1
  328. package/dist/proxy-middleware/preview-connections.d.ts.map +1 -1
  329. package/dist/proxy-middleware/preview-connections.js +0 -1
  330. package/dist/proxy-middleware/preview-connections.js.map +1 -1
  331. package/dist/proxy-middleware/proxy-config.d.ts +0 -12
  332. package/dist/proxy-middleware/proxy-config.d.ts.map +1 -1
  333. package/dist/proxy-middleware/proxy-config.js +2 -49
  334. package/dist/proxy-middleware/proxy-config.js.map +1 -1
  335. package/dist/routes/account.d.ts +0 -1
  336. package/dist/routes/account.d.ts.map +1 -1
  337. package/dist/routes/account.js +0 -2
  338. package/dist/routes/account.js.map +1 -1
  339. package/dist/routes/agentVariants.d.ts +0 -15
  340. package/dist/routes/agentVariants.d.ts.map +1 -1
  341. package/dist/routes/agentVariants.js +132 -329
  342. package/dist/routes/agentVariants.js.map +1 -1
  343. package/dist/routes/cli.d.ts +0 -17
  344. package/dist/routes/cli.d.ts.map +1 -1
  345. package/dist/routes/cli.js +0 -13
  346. package/dist/routes/cli.js.map +1 -1
  347. package/dist/routes/emptyStatePage.d.ts +0 -12
  348. package/dist/routes/emptyStatePage.d.ts.map +1 -1
  349. package/dist/routes/emptyStatePage.js +0 -12
  350. package/dist/routes/emptyStatePage.js.map +1 -1
  351. package/dist/routes/git.d.ts.map +1 -1
  352. package/dist/routes/git.js +0 -13
  353. package/dist/routes/git.js.map +1 -1
  354. package/dist/routes/inlineStartTracker.d.ts +0 -16
  355. package/dist/routes/inlineStartTracker.d.ts.map +1 -1
  356. package/dist/routes/inlineStartTracker.js.map +1 -1
  357. package/dist/routes/integrations.d.ts +0 -6
  358. package/dist/routes/integrations.d.ts.map +1 -1
  359. package/dist/routes/integrations.js +0 -6
  360. package/dist/routes/integrations.js.map +1 -1
  361. package/dist/routes/library/app.d.ts +0 -1
  362. package/dist/routes/library/app.d.ts.map +1 -1
  363. package/dist/routes/library/app.js +1 -3
  364. package/dist/routes/library/app.js.map +1 -1
  365. package/dist/routes/library/index.d.ts +0 -1
  366. package/dist/routes/library/index.d.ts.map +1 -1
  367. package/dist/routes/library/index.js +3 -1
  368. package/dist/routes/library/index.js.map +1 -1
  369. package/dist/routes/library/middleware.d.ts +0 -3
  370. package/dist/routes/library/middleware.d.ts.map +1 -1
  371. package/dist/routes/library/middleware.js +0 -4
  372. package/dist/routes/library/middleware.js.map +1 -1
  373. package/dist/routes/library/navigation.d.ts +0 -1
  374. package/dist/routes/library/navigation.d.ts.map +1 -1
  375. package/dist/routes/library/navigation.js +0 -1
  376. package/dist/routes/library/navigation.js.map +1 -1
  377. package/dist/routes/library/profiles.d.ts +5 -0
  378. package/dist/routes/library/profiles.d.ts.map +1 -0
  379. package/dist/routes/library/profiles.js +182 -0
  380. package/dist/routes/library/profiles.js.map +1 -0
  381. package/dist/routes/library/projects.d.ts +0 -1
  382. package/dist/routes/library/projects.d.ts.map +1 -1
  383. package/dist/routes/library/projects.js +0 -1
  384. package/dist/routes/library/projects.js.map +1 -1
  385. package/dist/routes/library/schemas.d.ts +2 -2
  386. package/dist/routes/library/staticPreview.d.ts +0 -1
  387. package/dist/routes/library/staticPreview.d.ts.map +1 -1
  388. package/dist/routes/library/staticPreview.js +0 -1
  389. package/dist/routes/library/staticPreview.js.map +1 -1
  390. package/dist/routes/library/types.d.ts +2 -0
  391. package/dist/routes/library/types.d.ts.map +1 -1
  392. package/dist/routes/library/variants.d.ts +0 -1
  393. package/dist/routes/library/variants.d.ts.map +1 -1
  394. package/dist/routes/library/variants.js +0 -1
  395. package/dist/routes/library/variants.js.map +1 -1
  396. package/dist/routes/mcp.d.ts +0 -3
  397. package/dist/routes/mcp.d.ts.map +1 -1
  398. package/dist/routes/mcp.js +0 -5
  399. package/dist/routes/mcp.js.map +1 -1
  400. package/dist/routes/prototypeHost.d.ts +0 -2
  401. package/dist/routes/prototypeHost.d.ts.map +1 -1
  402. package/dist/routes/prototypeHost.js +6 -32
  403. package/dist/routes/prototypeHost.js.map +1 -1
  404. package/dist/routes/static.d.ts +0 -3
  405. package/dist/routes/static.d.ts.map +1 -1
  406. package/dist/routes/static.js +0 -6
  407. package/dist/routes/static.js.map +1 -1
  408. package/dist/routes/support.d.ts +0 -3
  409. package/dist/routes/support.d.ts.map +1 -1
  410. package/dist/routes/support.js +0 -3
  411. package/dist/routes/support.js.map +1 -1
  412. package/dist/server.d.ts +0 -42
  413. package/dist/server.d.ts.map +1 -1
  414. package/dist/server.js +1 -129
  415. package/dist/server.js.map +1 -1
  416. package/dist/services/AuthService.d.ts +0 -76
  417. package/dist/services/AuthService.d.ts.map +1 -1
  418. package/dist/services/AuthService.js +0 -112
  419. package/dist/services/AuthService.js.map +1 -1
  420. package/dist/services/BrowserAgentClient.d.ts +1 -21
  421. package/dist/services/BrowserAgentClient.d.ts.map +1 -1
  422. package/dist/services/BrowserAgentClient.js +0 -10
  423. package/dist/services/BrowserAgentClient.js.map +1 -1
  424. package/dist/services/BundleStore.d.ts +0 -18
  425. package/dist/services/BundleStore.d.ts.map +1 -1
  426. package/dist/services/BundleStore.js +0 -10
  427. package/dist/services/BundleStore.js.map +1 -1
  428. package/dist/services/CliLogForwarder.d.ts +0 -26
  429. package/dist/services/CliLogForwarder.d.ts.map +1 -1
  430. package/dist/services/CliLogForwarder.js +1 -33
  431. package/dist/services/CliLogForwarder.js.map +1 -1
  432. package/dist/services/CommitMessageGenerator.d.ts +0 -6
  433. package/dist/services/CommitMessageGenerator.d.ts.map +1 -1
  434. package/dist/services/CommitMessageGenerator.js +0 -3
  435. package/dist/services/CommitMessageGenerator.js.map +1 -1
  436. package/dist/services/ComponentSearchService.d.ts +2 -16
  437. package/dist/services/ComponentSearchService.d.ts.map +1 -1
  438. package/dist/services/ComponentSearchService.js +2 -56
  439. package/dist/services/ComponentSearchService.js.map +1 -1
  440. package/dist/services/ConfigManager.d.ts +0 -113
  441. package/dist/services/ConfigManager.d.ts.map +1 -1
  442. package/dist/services/ConfigManager.js +0 -101
  443. package/dist/services/ConfigManager.js.map +1 -1
  444. package/dist/services/DependencyPreparationService.d.ts +0 -6
  445. package/dist/services/DependencyPreparationService.d.ts.map +1 -1
  446. package/dist/services/DependencyPreparationService.js +0 -22
  447. package/dist/services/DependencyPreparationService.js.map +1 -1
  448. package/dist/services/DevServerRuntimeService.d.ts +0 -20
  449. package/dist/services/DevServerRuntimeService.d.ts.map +1 -1
  450. package/dist/services/DevServerRuntimeService.js +0 -46
  451. package/dist/services/DevServerRuntimeService.js.map +1 -1
  452. package/dist/services/FeatureFlagService.d.ts +0 -15
  453. package/dist/services/FeatureFlagService.d.ts.map +1 -1
  454. package/dist/services/FeatureFlagService.js +0 -23
  455. package/dist/services/FeatureFlagService.js.map +1 -1
  456. package/dist/services/GatewayClient.d.ts +0 -27
  457. package/dist/services/GatewayClient.d.ts.map +1 -1
  458. package/dist/services/GatewayClient.js +0 -25
  459. package/dist/services/GatewayClient.js.map +1 -1
  460. package/dist/services/HistoryReplayService.d.ts +0 -31
  461. package/dist/services/HistoryReplayService.d.ts.map +1 -1
  462. package/dist/services/HistoryReplayService.js +2 -55
  463. package/dist/services/HistoryReplayService.js.map +1 -1
  464. package/dist/services/HubDiscovery.d.ts +0 -8
  465. package/dist/services/HubDiscovery.d.ts.map +1 -1
  466. package/dist/services/HubDiscovery.js +0 -8
  467. package/dist/services/HubDiscovery.js.map +1 -1
  468. package/dist/services/HubNavigation.d.ts +0 -6
  469. package/dist/services/HubNavigation.d.ts.map +1 -1
  470. package/dist/services/HubNavigation.js +5 -8
  471. package/dist/services/HubNavigation.js.map +1 -1
  472. package/dist/services/IntegrationsClient.d.ts +20 -38
  473. package/dist/services/IntegrationsClient.d.ts.map +1 -1
  474. package/dist/services/IntegrationsClient.js +71 -31
  475. package/dist/services/IntegrationsClient.js.map +1 -1
  476. package/dist/services/LocalGitService.d.ts +0 -57
  477. package/dist/services/LocalGitService.d.ts.map +1 -1
  478. package/dist/services/LocalGitService.js +4 -85
  479. package/dist/services/LocalGitService.js.map +1 -1
  480. package/dist/services/MCPOnboardingTelemetry.d.ts +0 -9
  481. package/dist/services/MCPOnboardingTelemetry.d.ts.map +1 -1
  482. package/dist/services/MCPOnboardingTelemetry.js +0 -9
  483. package/dist/services/MCPOnboardingTelemetry.js.map +1 -1
  484. package/dist/services/MCPVariantsTelemetry.d.ts +0 -2
  485. package/dist/services/MCPVariantsTelemetry.d.ts.map +1 -1
  486. package/dist/services/MCPVariantsTelemetry.js +0 -2
  487. package/dist/services/MCPVariantsTelemetry.js.map +1 -1
  488. package/dist/services/OperatingSystemServices.d.ts +0 -12
  489. package/dist/services/OperatingSystemServices.d.ts.map +1 -1
  490. package/dist/services/OperatingSystemServices.js +0 -7
  491. package/dist/services/OperatingSystemServices.js.map +1 -1
  492. package/dist/services/PRTitleGenerator.d.ts +0 -7
  493. package/dist/services/PRTitleGenerator.d.ts.map +1 -1
  494. package/dist/services/PRTitleGenerator.js +0 -3
  495. package/dist/services/PRTitleGenerator.js.map +1 -1
  496. package/dist/services/ProjectCardPreviews.d.ts +0 -5
  497. package/dist/services/ProjectCardPreviews.d.ts.map +1 -1
  498. package/dist/services/ProjectCardPreviews.js +0 -5
  499. package/dist/services/ProjectCardPreviews.js.map +1 -1
  500. package/dist/services/ProjectDetectionService.d.ts +0 -4
  501. package/dist/services/ProjectDetectionService.d.ts.map +1 -1
  502. package/dist/services/ProjectDetectionService.js +2 -44
  503. package/dist/services/ProjectDetectionService.js.map +1 -1
  504. package/dist/services/ProjectFolderPicker.d.ts +0 -3
  505. package/dist/services/ProjectFolderPicker.d.ts.map +1 -1
  506. package/dist/services/ProjectFolderPicker.js +0 -4
  507. package/dist/services/ProjectFolderPicker.js.map +1 -1
  508. package/dist/services/ProjectImport.d.ts +0 -1
  509. package/dist/services/ProjectImport.d.ts.map +1 -1
  510. package/dist/services/ProjectImport.js +0 -3
  511. package/dist/services/ProjectImport.js.map +1 -1
  512. package/dist/services/ProjectLibrary.d.ts +0 -18
  513. package/dist/services/ProjectLibrary.d.ts.map +1 -1
  514. package/dist/services/ProjectLibrary.js +0 -20
  515. package/dist/services/ProjectLibrary.js.map +1 -1
  516. package/dist/services/ProjectMetadataStore.d.ts +0 -73
  517. package/dist/services/ProjectMetadataStore.d.ts.map +1 -1
  518. package/dist/services/ProjectMetadataStore.js +0 -90
  519. package/dist/services/ProjectMetadataStore.js.map +1 -1
  520. package/dist/services/ProjectPackageManager.d.ts +0 -12
  521. package/dist/services/ProjectPackageManager.d.ts.map +1 -1
  522. package/dist/services/ProjectPackageManager.js +0 -16
  523. package/dist/services/ProjectPackageManager.js.map +1 -1
  524. package/dist/services/ProjectRegistry.d.ts +2 -18
  525. package/dist/services/ProjectRegistry.d.ts.map +1 -1
  526. package/dist/services/ProjectRegistry.js +0 -18
  527. package/dist/services/ProjectRegistry.js.map +1 -1
  528. package/dist/services/ProjectRuntimeService.d.ts +0 -4
  529. package/dist/services/ProjectRuntimeService.d.ts.map +1 -1
  530. package/dist/services/ProjectRuntimeService.js +0 -5
  531. package/dist/services/ProjectRuntimeService.js.map +1 -1
  532. package/dist/services/ProjectScreenshotService.d.ts +0 -5
  533. package/dist/services/ProjectScreenshotService.d.ts.map +1 -1
  534. package/dist/services/ProjectScreenshotService.js +0 -6
  535. package/dist/services/ProjectScreenshotService.js.map +1 -1
  536. package/dist/services/ProjectStorage.d.ts +0 -4
  537. package/dist/services/ProjectStorage.d.ts.map +1 -1
  538. package/dist/services/ProjectStorage.js +0 -4
  539. package/dist/services/ProjectStorage.js.map +1 -1
  540. package/dist/services/PrototypeBuildService.d.ts +1 -23
  541. package/dist/services/PrototypeBuildService.d.ts.map +1 -1
  542. package/dist/services/PrototypeBuildService.js +6 -31
  543. package/dist/services/PrototypeBuildService.js.map +1 -1
  544. package/dist/services/PrototypeDeployService.d.ts +0 -20
  545. package/dist/services/PrototypeDeployService.d.ts.map +1 -1
  546. package/dist/services/PrototypeDeployService.js +1 -24
  547. package/dist/services/PrototypeDeployService.js.map +1 -1
  548. package/dist/services/RequestAuthContext.d.ts +0 -5
  549. package/dist/services/RequestAuthContext.d.ts.map +1 -1
  550. package/dist/services/RequestAuthContext.js +0 -5
  551. package/dist/services/RequestAuthContext.js.map +1 -1
  552. package/dist/services/SessionBridgeService.d.ts.map +1 -1
  553. package/dist/services/SessionBridgeService.js +0 -2
  554. package/dist/services/SessionBridgeService.js.map +1 -1
  555. package/dist/services/SessionService.d.ts +0 -4
  556. package/dist/services/SessionService.d.ts.map +1 -1
  557. package/dist/services/SessionService.js +1 -22
  558. package/dist/services/SessionService.js.map +1 -1
  559. package/dist/services/StaticFileService.d.ts +0 -9
  560. package/dist/services/StaticFileService.d.ts.map +1 -1
  561. package/dist/services/StaticFileService.js +0 -11
  562. package/dist/services/StaticFileService.js.map +1 -1
  563. package/dist/services/StaticLibraryPreviews.d.ts +0 -3
  564. package/dist/services/StaticLibraryPreviews.d.ts.map +1 -1
  565. package/dist/services/StaticLibraryPreviews.js +0 -3
  566. package/dist/services/StaticLibraryPreviews.js.map +1 -1
  567. package/dist/services/StaticPreviewServer.d.ts +0 -16
  568. package/dist/services/StaticPreviewServer.d.ts.map +1 -1
  569. package/dist/services/StaticPreviewServer.js +2 -28
  570. package/dist/services/StaticPreviewServer.js.map +1 -1
  571. package/dist/services/SupabaseAuthService.d.ts +0 -11
  572. package/dist/services/SupabaseAuthService.d.ts.map +1 -1
  573. package/dist/services/SupabaseAuthService.js +0 -11
  574. package/dist/services/SupabaseAuthService.js.map +1 -1
  575. package/dist/services/SupportTicketService.d.ts +0 -4
  576. package/dist/services/SupportTicketService.d.ts.map +1 -1
  577. package/dist/services/SupportTicketService.js +0 -4
  578. package/dist/services/SupportTicketService.js.map +1 -1
  579. package/dist/services/TelemetryService.d.ts +9 -182
  580. package/dist/services/TelemetryService.d.ts.map +1 -1
  581. package/dist/services/TelemetryService.js +11 -195
  582. package/dist/services/TelemetryService.js.map +1 -1
  583. package/dist/services/TreeStore.d.ts +0 -72
  584. package/dist/services/TreeStore.d.ts.map +1 -1
  585. package/dist/services/TreeStore.js +0 -93
  586. package/dist/services/TreeStore.js.map +1 -1
  587. package/dist/services/VariantGenerationService.d.ts +1 -32
  588. package/dist/services/VariantGenerationService.d.ts.map +1 -1
  589. package/dist/services/VariantGenerationService.js +36 -66
  590. package/dist/services/VariantGenerationService.js.map +1 -1
  591. package/dist/services/VariantHistoryService.d.ts +12 -114
  592. package/dist/services/VariantHistoryService.d.ts.map +1 -1
  593. package/dist/services/VariantHistoryService.js +56 -144
  594. package/dist/services/VariantHistoryService.js.map +1 -1
  595. package/dist/services/VariantRunService.d.ts +6 -31
  596. package/dist/services/VariantRunService.d.ts.map +1 -1
  597. package/dist/services/VariantRunService.js +86 -37
  598. package/dist/services/VariantRunService.js.map +1 -1
  599. package/dist/services/VariantsRuntime.d.ts +0 -3
  600. package/dist/services/VariantsRuntime.d.ts.map +1 -1
  601. package/dist/services/VariantsRuntime.js +2 -5
  602. package/dist/services/VariantsRuntime.js.map +1 -1
  603. package/dist/services/WorktreeManager.d.ts +0 -217
  604. package/dist/services/WorktreeManager.d.ts.map +1 -1
  605. package/dist/services/WorktreeManager.js +3 -321
  606. package/dist/services/WorktreeManager.js.map +1 -1
  607. package/dist/services/accessTokenRefresh.d.ts +0 -25
  608. package/dist/services/accessTokenRefresh.d.ts.map +1 -1
  609. package/dist/services/accessTokenRefresh.js +0 -25
  610. package/dist/services/accessTokenRefresh.js.map +1 -1
  611. package/dist/services/adapters/TailwindTokenAdapter.d.ts +0 -29
  612. package/dist/services/adapters/TailwindTokenAdapter.d.ts.map +1 -1
  613. package/dist/services/adapters/TailwindTokenAdapter.js +1 -46
  614. package/dist/services/adapters/TailwindTokenAdapter.js.map +1 -1
  615. package/dist/services/createAgentVariantsOrchestrator.d.ts +0 -18
  616. package/dist/services/createAgentVariantsOrchestrator.d.ts.map +1 -1
  617. package/dist/services/createAgentVariantsOrchestrator.js +0 -22
  618. package/dist/services/createAgentVariantsOrchestrator.js.map +1 -1
  619. package/dist/services/extractors/CSSVariableExtractor.d.ts +0 -25
  620. package/dist/services/extractors/CSSVariableExtractor.d.ts.map +1 -1
  621. package/dist/services/extractors/CSSVariableExtractor.js +1 -42
  622. package/dist/services/extractors/CSSVariableExtractor.js.map +1 -1
  623. package/dist/services/historyRoots.d.ts +0 -12
  624. package/dist/services/historyRoots.d.ts.map +1 -1
  625. package/dist/services/historyRoots.js +0 -13
  626. package/dist/services/historyRoots.js.map +1 -1
  627. package/dist/services/libraryErrors.d.ts +0 -1
  628. package/dist/services/libraryErrors.d.ts.map +1 -1
  629. package/dist/services/libraryErrors.js +0 -1
  630. package/dist/services/libraryErrors.js.map +1 -1
  631. package/dist/services/pendingLogin.d.ts +0 -13
  632. package/dist/services/pendingLogin.d.ts.map +1 -1
  633. package/dist/services/pendingLogin.js +0 -3
  634. package/dist/services/pendingLogin.js.map +1 -1
  635. package/dist/services/profiles/DesignProfiles.d.ts +446 -0
  636. package/dist/services/profiles/DesignProfiles.d.ts.map +1 -0
  637. package/dist/services/profiles/DesignProfiles.js +552 -0
  638. package/dist/services/profiles/DesignProfiles.js.map +1 -0
  639. package/dist/services/profiles/MemoryModelService.d.ts +14 -0
  640. package/dist/services/profiles/MemoryModelService.d.ts.map +1 -0
  641. package/dist/services/profiles/MemoryModelService.js +113 -0
  642. package/dist/services/profiles/MemoryModelService.js.map +1 -0
  643. package/dist/services/profiles/MemoryRuntime.d.ts +26 -0
  644. package/dist/services/profiles/MemoryRuntime.d.ts.map +1 -0
  645. package/dist/services/profiles/MemoryRuntime.js +192 -0
  646. package/dist/services/profiles/MemoryRuntime.js.map +1 -0
  647. package/dist/services/profiles/ProfileAgent.d.ts +20 -0
  648. package/dist/services/profiles/ProfileAgent.d.ts.map +1 -0
  649. package/dist/services/profiles/ProfileAgent.js +196 -0
  650. package/dist/services/profiles/ProfileAgent.js.map +1 -0
  651. package/dist/services/profiles/ProfileAnalysis.d.ts +23 -0
  652. package/dist/services/profiles/ProfileAnalysis.d.ts.map +1 -0
  653. package/dist/services/profiles/ProfileAnalysis.js +114 -0
  654. package/dist/services/profiles/ProfileAnalysis.js.map +1 -0
  655. package/dist/services/profiles/ProfileImportSchedule.d.ts +15 -0
  656. package/dist/services/profiles/ProfileImportSchedule.d.ts.map +1 -0
  657. package/dist/services/profiles/ProfileImportSchedule.js +40 -0
  658. package/dist/services/profiles/ProfileImportSchedule.js.map +1 -0
  659. package/dist/services/profiles/ProfileImports.d.ts +47 -0
  660. package/dist/services/profiles/ProfileImports.d.ts.map +1 -0
  661. package/dist/services/profiles/ProfileImports.js +248 -0
  662. package/dist/services/profiles/ProfileImports.js.map +1 -0
  663. package/dist/services/profiles/ProfileIndex.d.ts +18 -0
  664. package/dist/services/profiles/ProfileIndex.d.ts.map +1 -0
  665. package/dist/services/profiles/ProfileIndex.js +119 -0
  666. package/dist/services/profiles/ProfileIndex.js.map +1 -0
  667. package/dist/services/profiles/ProfileMedia.d.ts +10 -0
  668. package/dist/services/profiles/ProfileMedia.d.ts.map +1 -0
  669. package/dist/services/profiles/ProfileMedia.js +76 -0
  670. package/dist/services/profiles/ProfileMedia.js.map +1 -0
  671. package/dist/services/profiles/ProfilePreparation.d.ts +17 -0
  672. package/dist/services/profiles/ProfilePreparation.d.ts.map +1 -0
  673. package/dist/services/profiles/ProfilePreparation.js +214 -0
  674. package/dist/services/profiles/ProfilePreparation.js.map +1 -0
  675. package/dist/services/profiles/ProfileVariants.d.ts +33 -0
  676. package/dist/services/profiles/ProfileVariants.d.ts.map +1 -0
  677. package/dist/services/profiles/ProfileVariants.js +129 -0
  678. package/dist/services/profiles/ProfileVariants.js.map +1 -0
  679. package/dist/services/profiles/analysisBatch.d.ts +53 -0
  680. package/dist/services/profiles/analysisBatch.d.ts.map +1 -0
  681. package/dist/services/profiles/analysisBatch.js +86 -0
  682. package/dist/services/profiles/analysisBatch.js.map +1 -0
  683. package/dist/services/profiles/boardPage.d.ts +12 -0
  684. package/dist/services/profiles/boardPage.d.ts.map +1 -0
  685. package/dist/services/profiles/boardPage.js +156 -0
  686. package/dist/services/profiles/boardPage.js.map +1 -0
  687. package/dist/services/profiles/engineAccess.d.ts +2 -0
  688. package/dist/services/profiles/engineAccess.d.ts.map +1 -0
  689. package/dist/services/profiles/engineAccess.js +55 -0
  690. package/dist/services/profiles/engineAccess.js.map +1 -0
  691. package/dist/services/profiles/memoryComponents.d.ts +7 -0
  692. package/dist/services/profiles/memoryComponents.d.ts.map +1 -0
  693. package/dist/services/profiles/memoryComponents.js +105 -0
  694. package/dist/services/profiles/memoryComponents.js.map +1 -0
  695. package/dist/services/profiles/modelContract.d.ts +14 -0
  696. package/dist/services/profiles/modelContract.d.ts.map +1 -0
  697. package/dist/services/profiles/modelContract.js +124 -0
  698. package/dist/services/profiles/modelContract.js.map +1 -0
  699. package/dist/services/profiles/nativeImages.d.ts +3 -0
  700. package/dist/services/profiles/nativeImages.d.ts.map +1 -0
  701. package/dist/services/profiles/nativeImages.js +72 -0
  702. package/dist/services/profiles/nativeImages.js.map +1 -0
  703. package/dist/services/profiles/profileAccount.d.ts +4 -0
  704. package/dist/services/profiles/profileAccount.d.ts.map +1 -0
  705. package/dist/services/profiles/profileAccount.js +21 -0
  706. package/dist/services/profiles/profileAccount.js.map +1 -0
  707. package/dist/services/profiles/profileContext.d.ts +18 -0
  708. package/dist/services/profiles/profileContext.d.ts.map +1 -0
  709. package/dist/services/profiles/profileContext.js +189 -0
  710. package/dist/services/profiles/profileContext.js.map +1 -0
  711. package/dist/services/profiles/profileEvidence.d.ts +3 -0
  712. package/dist/services/profiles/profileEvidence.d.ts.map +1 -0
  713. package/dist/services/profiles/profileEvidence.js +15 -0
  714. package/dist/services/profiles/profileEvidence.js.map +1 -0
  715. package/dist/services/profiles/profileQueries.d.ts +2 -0
  716. package/dist/services/profiles/profileQueries.d.ts.map +1 -0
  717. package/dist/services/profiles/profileQueries.js +23 -0
  718. package/dist/services/profiles/profileQueries.js.map +1 -0
  719. package/dist/services/profiles/profileSelection.d.ts +29 -0
  720. package/dist/services/profiles/profileSelection.d.ts.map +1 -0
  721. package/dist/services/profiles/profileSelection.js +43 -0
  722. package/dist/services/profiles/profileSelection.js.map +1 -0
  723. package/dist/services/profiles/xPage.d.ts +4 -0
  724. package/dist/services/profiles/xPage.d.ts.map +1 -0
  725. package/dist/services/profiles/xPage.js +58 -0
  726. package/dist/services/profiles/xPage.js.map +1 -0
  727. package/dist/services/referenceImages.d.ts +17 -0
  728. package/dist/services/referenceImages.d.ts.map +1 -0
  729. package/dist/services/referenceImages.js +138 -0
  730. package/dist/services/referenceImages.js.map +1 -0
  731. package/dist/services/staticProjectTarget.d.ts +0 -4
  732. package/dist/services/staticProjectTarget.d.ts.map +1 -1
  733. package/dist/services/staticProjectTarget.js +0 -4
  734. package/dist/services/staticProjectTarget.js.map +1 -1
  735. package/dist/services/staticStarter.d.ts +0 -20
  736. package/dist/services/staticStarter.d.ts.map +1 -1
  737. package/dist/services/staticStarter.js +0 -20
  738. package/dist/services/staticStarter.js.map +1 -1
  739. package/dist/services/templates/designCatalog.d.ts +0 -11
  740. package/dist/services/templates/designCatalog.d.ts.map +1 -1
  741. package/dist/services/templates/designCatalog.js +0 -26
  742. package/dist/services/templates/designCatalog.js.map +1 -1
  743. package/dist/services/templates/viteReactTs.d.ts +0 -26
  744. package/dist/services/templates/viteReactTs.d.ts.map +1 -1
  745. package/dist/services/templates/viteReactTs.js +0 -20
  746. package/dist/services/templates/viteReactTs.js.map +1 -1
  747. package/dist/storage/library/BundleMetadataStore.d.ts +0 -16
  748. package/dist/storage/library/BundleMetadataStore.d.ts.map +1 -1
  749. package/dist/storage/library/BundleMetadataStore.js +0 -17
  750. package/dist/storage/library/BundleMetadataStore.js.map +1 -1
  751. package/dist/storage/library/CoordinatorRecords.d.ts +0 -9
  752. package/dist/storage/library/CoordinatorRecords.d.ts.map +1 -1
  753. package/dist/storage/library/CoordinatorRecords.js +0 -9
  754. package/dist/storage/library/CoordinatorRecords.js.map +1 -1
  755. package/dist/storage/library/ProjectPreviewCache.d.ts +0 -4
  756. package/dist/storage/library/ProjectPreviewCache.d.ts.map +1 -1
  757. package/dist/storage/library/ProjectPreviewCache.js +0 -4
  758. package/dist/storage/library/ProjectPreviewCache.js.map +1 -1
  759. package/dist/storage/library/ProjectRecords.d.ts +0 -17
  760. package/dist/storage/library/ProjectRecords.d.ts.map +1 -1
  761. package/dist/storage/library/ProjectRecords.js +0 -17
  762. package/dist/storage/library/ProjectRecords.js.map +1 -1
  763. package/dist/storage/library/database.d.ts +0 -3
  764. package/dist/storage/library/database.d.ts.map +1 -1
  765. package/dist/storage/library/database.js +0 -3
  766. package/dist/storage/library/database.js.map +1 -1
  767. package/dist/storage/library/migrations.d.ts +0 -2
  768. package/dist/storage/library/migrations.d.ts.map +1 -1
  769. package/dist/storage/library/migrations.js +0 -2
  770. package/dist/storage/library/migrations.js.map +1 -1
  771. package/dist/storage/library/sourcePresentation.d.ts +0 -1
  772. package/dist/storage/library/sourcePresentation.d.ts.map +1 -1
  773. package/dist/storage/library/sourcePresentation.js +0 -1
  774. package/dist/storage/library/sourcePresentation.js.map +1 -1
  775. package/dist/storage/profiles/ProfileRecords.d.ts +199 -0
  776. package/dist/storage/profiles/ProfileRecords.d.ts.map +1 -0
  777. package/dist/storage/profiles/ProfileRecords.js +659 -0
  778. package/dist/storage/profiles/ProfileRecords.js.map +1 -0
  779. package/dist/storage/profiles/contextReceipts.d.ts +14 -0
  780. package/dist/storage/profiles/contextReceipts.d.ts.map +1 -0
  781. package/dist/storage/profiles/contextReceipts.js +52 -0
  782. package/dist/storage/profiles/contextReceipts.js.map +1 -0
  783. package/dist/storage/profiles/migrations.d.ts +4 -0
  784. package/dist/storage/profiles/migrations.d.ts.map +1 -0
  785. package/dist/storage/profiles/migrations.js +41 -0
  786. package/dist/storage/profiles/migrations.js.map +1 -0
  787. package/dist/storage/profiles/schema.d.ts +961 -0
  788. package/dist/storage/profiles/schema.d.ts.map +1 -0
  789. package/dist/storage/profiles/schema.js +102 -0
  790. package/dist/storage/profiles/schema.js.map +1 -0
  791. package/dist/storage/project-metadata/ProjectMetadataRecords.d.ts +0 -11
  792. package/dist/storage/project-metadata/ProjectMetadataRecords.d.ts.map +1 -1
  793. package/dist/storage/project-metadata/ProjectMetadataRecords.js +0 -13
  794. package/dist/storage/project-metadata/ProjectMetadataRecords.js.map +1 -1
  795. package/dist/storage/project-metadata/database.d.ts +0 -1
  796. package/dist/storage/project-metadata/database.d.ts.map +1 -1
  797. package/dist/storage/project-metadata/database.js +0 -7
  798. package/dist/storage/project-metadata/database.js.map +1 -1
  799. package/dist/storage/project-metadata/migrations.d.ts +0 -42
  800. package/dist/storage/project-metadata/migrations.d.ts.map +1 -1
  801. package/dist/storage/project-metadata/migrations.js +0 -41
  802. package/dist/storage/project-metadata/migrations.js.map +1 -1
  803. package/dist/types/account.d.ts +0 -1
  804. package/dist/types/account.d.ts.map +1 -1
  805. package/dist/types/change-request-types.d.ts +5 -167
  806. package/dist/types/change-request-types.d.ts.map +1 -1
  807. package/dist/types/change-types.d.ts +0 -1
  808. package/dist/types/change-types.d.ts.map +1 -1
  809. package/dist/types/change-types.js +0 -1
  810. package/dist/types/change-types.js.map +1 -1
  811. package/dist/types/design-profile.d.ts +570 -0
  812. package/dist/types/design-profile.d.ts.map +1 -0
  813. package/dist/types/design-profile.js +127 -0
  814. package/dist/types/design-profile.js.map +1 -0
  815. package/dist/types/project-library.d.ts +0 -1
  816. package/dist/types/project-library.d.ts.map +1 -1
  817. package/dist/types/style-manipulation-types.d.ts +0 -69
  818. package/dist/types/style-manipulation-types.d.ts.map +1 -1
  819. package/dist/types/style-manipulation-types.js +0 -26
  820. package/dist/types/style-manipulation-types.js.map +1 -1
  821. package/dist/types/token-types.d.ts +0 -30
  822. package/dist/types/token-types.d.ts.map +1 -1
  823. package/dist/types/token-types.js +0 -1
  824. package/dist/types/token-types.js.map +1 -1
  825. package/dist/types/variant-history.d.ts +3 -39
  826. package/dist/types/variant-history.d.ts.map +1 -1
  827. package/dist/types/variant-reference.d.ts +46 -0
  828. package/dist/types/variant-reference.d.ts.map +1 -0
  829. package/dist/types/variant-reference.js +58 -0
  830. package/dist/types/variant-reference.js.map +1 -0
  831. package/dist/types/x-bookmarks.d.ts +352 -0
  832. package/dist/types/x-bookmarks.d.ts.map +1 -0
  833. package/dist/types/x-bookmarks.js +56 -0
  834. package/dist/types/x-bookmarks.js.map +1 -0
  835. package/dist/utils/ProviderRateLimit.d.ts +7 -0
  836. package/dist/utils/ProviderRateLimit.d.ts.map +1 -0
  837. package/dist/utils/ProviderRateLimit.js +36 -0
  838. package/dist/utils/ProviderRateLimit.js.map +1 -0
  839. package/dist/utils/branchNames.d.ts +0 -1
  840. package/dist/utils/branchNames.d.ts.map +1 -1
  841. package/dist/utils/branchNames.js +0 -2
  842. package/dist/utils/branchNames.js.map +1 -1
  843. package/dist/utils/cloneOrCopyDirSync.d.ts +0 -12
  844. package/dist/utils/cloneOrCopyDirSync.d.ts.map +1 -1
  845. package/dist/utils/cloneOrCopyDirSync.js +0 -16
  846. package/dist/utils/cloneOrCopyDirSync.js.map +1 -1
  847. package/dist/utils/devServerCommand.d.ts +0 -23
  848. package/dist/utils/devServerCommand.d.ts.map +1 -1
  849. package/dist/utils/devServerCommand.js +0 -24
  850. package/dist/utils/devServerCommand.js.map +1 -1
  851. package/dist/utils/devServerError.d.ts +0 -16
  852. package/dist/utils/devServerError.d.ts.map +1 -1
  853. package/dist/utils/devServerError.js +0 -17
  854. package/dist/utils/devServerError.js.map +1 -1
  855. package/dist/utils/displayLocale.d.ts +0 -2
  856. package/dist/utils/displayLocale.d.ts.map +1 -1
  857. package/dist/utils/displayLocale.js +0 -2
  858. package/dist/utils/displayLocale.js.map +1 -1
  859. package/dist/utils/elementFileHintSignals.d.ts +0 -5
  860. package/dist/utils/elementFileHintSignals.d.ts.map +1 -1
  861. package/dist/utils/elementFileHintSignals.js +0 -5
  862. package/dist/utils/elementFileHintSignals.js.map +1 -1
  863. package/dist/utils/formatElementTargetingContext.d.ts +0 -6
  864. package/dist/utils/formatElementTargetingContext.d.ts.map +1 -1
  865. package/dist/utils/formatElementTargetingContext.js +3 -9
  866. package/dist/utils/formatElementTargetingContext.js.map +1 -1
  867. package/dist/utils/hostAgentEnv.d.ts +0 -17
  868. package/dist/utils/hostAgentEnv.d.ts.map +1 -1
  869. package/dist/utils/hostAgentEnv.js +0 -17
  870. package/dist/utils/hostAgentEnv.js.map +1 -1
  871. package/dist/utils/htmlDocument.d.ts +0 -5
  872. package/dist/utils/htmlDocument.d.ts.map +1 -1
  873. package/dist/utils/htmlDocument.js +2 -7
  874. package/dist/utils/htmlDocument.js.map +1 -1
  875. package/dist/utils/internalGitIdentity.d.ts +0 -5
  876. package/dist/utils/internalGitIdentity.d.ts.map +1 -1
  877. package/dist/utils/internalGitIdentity.js +0 -5
  878. package/dist/utils/internalGitIdentity.js.map +1 -1
  879. package/dist/utils/logger.d.ts +0 -5
  880. package/dist/utils/logger.d.ts.map +1 -1
  881. package/dist/utils/logger.js +2 -19
  882. package/dist/utils/logger.js.map +1 -1
  883. package/dist/utils/loginShellPath.d.ts +0 -9
  884. package/dist/utils/loginShellPath.d.ts.map +1 -1
  885. package/dist/utils/loginShellPath.js +0 -69
  886. package/dist/utils/loginShellPath.js.map +1 -1
  887. package/dist/utils/loopback.d.ts +0 -1
  888. package/dist/utils/loopback.d.ts.map +1 -1
  889. package/dist/utils/loopback.js +0 -1
  890. package/dist/utils/loopback.js.map +1 -1
  891. package/dist/utils/pid.d.ts +0 -1
  892. package/dist/utils/pid.d.ts.map +1 -1
  893. package/dist/utils/pid.js +0 -1
  894. package/dist/utils/pid.js.map +1 -1
  895. package/dist/utils/portUtils.d.ts +0 -15
  896. package/dist/utils/portUtils.d.ts.map +1 -1
  897. package/dist/utils/portUtils.js +0 -21
  898. package/dist/utils/portUtils.js.map +1 -1
  899. package/dist/utils/queueAccess.d.ts +0 -9
  900. package/dist/utils/queueAccess.d.ts.map +1 -1
  901. package/dist/utils/queueAccess.js +0 -9
  902. package/dist/utils/queueAccess.js.map +1 -1
  903. package/dist/utils/skillWriter.d.ts +0 -17
  904. package/dist/utils/skillWriter.d.ts.map +1 -1
  905. package/dist/utils/skillWriter.js +0 -20
  906. package/dist/utils/skillWriter.js.map +1 -1
  907. package/dist/utils/skills/claude-skill.d.ts +0 -5
  908. package/dist/utils/skills/claude-skill.d.ts.map +1 -1
  909. package/dist/utils/skills/claude-skill.js +0 -5
  910. package/dist/utils/skills/claude-skill.js.map +1 -1
  911. package/dist/utils/skills/cli-guidance.d.ts +1 -9
  912. package/dist/utils/skills/cli-guidance.d.ts.map +1 -1
  913. package/dist/utils/skills/cli-guidance.js +6 -10
  914. package/dist/utils/skills/cli-guidance.js.map +1 -1
  915. package/dist/utils/skills/cursor-rules.d.ts +0 -6
  916. package/dist/utils/skills/cursor-rules.d.ts.map +1 -1
  917. package/dist/utils/skills/cursor-rules.js +0 -6
  918. package/dist/utils/skills/cursor-rules.js.map +1 -1
  919. package/dist/utils/variantPreviewPort.d.ts +0 -3
  920. package/dist/utils/variantPreviewPort.d.ts.map +1 -1
  921. package/dist/utils/variantPreviewPort.js +0 -3
  922. package/dist/utils/variantPreviewPort.js.map +1 -1
  923. package/dist/utils/windowPlacement.d.ts +0 -4
  924. package/dist/utils/windowPlacement.d.ts.map +1 -1
  925. package/dist/utils/windowPlacement.js +0 -4
  926. package/dist/utils/windowPlacement.js.map +1 -1
  927. package/package.json +13 -13
  928. package/scripts/verify-node-version.cjs +0 -3
  929. package/src/ui/dist/assets/{LibraryApp-qbLqcNxM.js → LibraryApp-Bu7hVbt_.js} +1 -1
  930. package/src/ui/dist/assets/main-CHyx_rEa.css +1 -0
  931. package/src/ui/dist/assets/main-CuiPb_rl.js +438 -0
  932. package/src/ui/dist/index.html +2 -2
  933. package/dist/utils/skills/describe-motion-protocol.d.ts +0 -10
  934. package/dist/utils/skills/describe-motion-protocol.d.ts.map +0 -1
  935. package/dist/utils/skills/describe-motion-protocol.js +0 -231
  936. package/dist/utils/skills/describe-motion-protocol.js.map +0 -1
  937. package/src/ui/dist/assets/main-BUZjlAHd.css +0 -1
  938. package/src/ui/dist/assets/main-touv07Dk.js +0 -438
@@ -4,6 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createAgentVariantsRouter = exports.stampWatcherLiveness = exports.nestedFreshSessionWorkdirs = void 0;
7
+ const referenceImages_1 = require("../services/referenceImages");
8
+ const variant_reference_1 = require("../types/variant-reference");
9
+ const contracts_1 = require("../agent-variants/contracts");
10
+ const crypto_1 = require("crypto");
7
11
  const historyRoots_1 = require("../services/historyRoots");
8
12
  var historyRoots_2 = require("../services/historyRoots");
9
13
  Object.defineProperty(exports, "nestedFreshSessionWorkdirs", { enumerable: true, get: function () { return historyRoots_2.nestedFreshSessionWorkdirs; } });
@@ -13,7 +17,7 @@ const express_1 = require("express");
13
17
  const v3_1 = require("zod/v3");
14
18
  const logger_1 = require("../utils/logger");
15
19
  const agent_variants_1 = require("../agent-variants");
16
- const contracts_1 = require("../agent-variants/contracts");
20
+ const contracts_2 = require("../agent-variants/contracts");
17
21
  const changeBatchClassification_1 = require("../mcp/changeBatchClassification");
18
22
  const createAgentVariantsOrchestrator_1 = require("../services/createAgentVariantsOrchestrator");
19
23
  const VariantHistoryService_1 = require("../services/VariantHistoryService");
@@ -31,16 +35,6 @@ const htmlDocument_1 = require("../utils/htmlDocument");
31
35
  const log = (0, logger_1.createLogger)('AgentVariantsRouter');
32
36
  const DIRECTION_TITLE_MAX_WORDS = 5;
33
37
  const DIRECTION_SUBTITLE_MAX_WORDS = 10;
34
- /**
35
- * Public CDN hosts agent-generated previews are allowed to load code/assets
36
- * from. We don't control which CDN the agent emits: p5.js, three.js, and
37
- * friends get pulled from cdnjs / jsdelivr / esm.sh / skypack at least as often
38
- * as unpkg. An unpkg-only allowlist silently CSP-blocked those scripts, leaving
39
- * WebGL/canvas sketches blank — and because the violation fires inside the
40
- * cross-origin preview iframe, it never surfaced in our telemetry (parent saw
41
- * zero console errors). Keep this list as the de-facto set; add hosts as we
42
- * observe them rather than reaching for a wildcard.
43
- */
44
38
  const PREVIEW_CDN_HOSTS = [
45
39
  'https://unpkg.com',
46
40
  'https://cdn.jsdelivr.net',
@@ -48,40 +42,6 @@ const PREVIEW_CDN_HOSTS = [
48
42
  'https://esm.sh',
49
43
  'https://cdn.skypack.dev',
50
44
  ].join(' ');
51
- /**
52
- * CSP for agent-generated static previews. Shared by the live static-preview
53
- * route and the variant-history preview route so a variant renders identically
54
- * whether it's served fresh or replayed from a snapshot.
55
- *
56
- * Previews are served same-origin (the Rivet core server) and embedded in an
57
- * iframe that deliberately keeps `allow-same-origin` (the visual editor reaches
58
- * into the iframe DOM), so agent JS runs with the Rivet origin's privileges.
59
- * This policy is the main thing bounding that blast radius — note the absence
60
- * of `'unsafe-eval'` and of any wildcard host. `connect-src` is intentionally
61
- * NOT `*`: it stops agent JS from exfiltrating anything it can read to an
62
- * arbitrary server.
63
- *
64
- * THE RIGHT LONG-TERM FIX is to stop allowlisting CDNs entirely by serving
65
- * previews from an ISOLATED ORIGIN (separate port/origin, drop
66
- * `allow-same-origin`) and driving the visual editor over `postMessage`. The
67
- * embedded-mode preview bridge (`src/proxy-middleware/preview-bridge.ts`)
68
- * already implements exactly this handshake — migrating the default static
69
- * preview onto it is the work. Once the preview no longer shares Rivet's origin
70
- * or storage, this CSP can be loosened to `script-src https:` (or dropped)
71
- * without widening blast radius, and the per-CDN allowlist above goes away.
72
- * Until that migration lands, broadening PREVIEW_CDN_HOSTS is the stopgap.
73
- */
74
- /**
75
- * CSP for agent-generated static previews. Previews are served same-origin on
76
- * the isolated preview port, so `'self'` resolves to the preview document's own
77
- * origin and its sibling assets (CSS/JS/GLB/textures) load normally.
78
- *
79
- * `frame-ancestors` must also allow the editor origin: with the isolated
80
- * preview origin the editor lives on a different origin than the preview, so
81
- * `'self'` alone would block the editor from framing the variant preview
82
- * (`frame-ancestors 'self' → refused to connect`). See
83
- * docs/preview-target-addressing-design.md.
84
- */
85
45
  const buildStaticPreviewCsp = (parentFrameOrigin, libraryOrigin) => {
86
46
  const frameAncestors = ["'self'", parentFrameOrigin, libraryOrigin]
87
47
  .filter(Boolean)
@@ -158,7 +118,7 @@ const inlineStaticPreviewTargetSchema = v3_1.z.object({
158
118
  sessionId: v3_1.z.string().min(1),
159
119
  variantId: v3_1.z.string().min(1),
160
120
  });
161
- const inlineVariantBriefSchema = contracts_1.startVariantsBriefContent.superRefine((brief, context) => {
121
+ const inlineVariantBriefSchema = contracts_2.startVariantsBriefContent.superRefine((brief, context) => {
162
122
  const titleWordCount = brief.label.trim().split(/\s+/).length;
163
123
  const subtitleWordCount = brief.body.trim().split(/\s+/).length;
164
124
  if (titleWordCount > DIRECTION_TITLE_MAX_WORDS) {
@@ -178,19 +138,20 @@ const inlineVariantBriefSchema = contracts_1.startVariantsBriefContent.superRefi
178
138
  });
179
139
  const inlineVariantRequestSchema = v3_1.z
180
140
  .object({
181
- count: v3_1.z.number().int().min(contracts_1.VARIANT_COUNT_MIN).max(contracts_1.VARIANT_COUNT_MAX),
141
+ count: v3_1.z.number().int().min(contracts_2.VARIANT_COUNT_MIN).max(contracts_2.VARIANT_COUNT_MAX),
182
142
  mode: v3_1.z.enum(['existing', 'zero_to_one']).optional(),
183
- runLabel: contracts_1.runLabelSchema,
143
+ profile: v3_1.z.enum(['auto', 'off']).optional(),
144
+ runLabel: contracts_2.runLabelSchema,
184
145
  fidelity: v3_1.z.enum(['low', 'medium', 'high']).optional(),
185
146
  briefs: v3_1.z
186
147
  .array(inlineVariantBriefSchema)
187
- .min(contracts_1.VARIANT_COUNT_MIN)
188
- .max(contracts_1.VARIANT_COUNT_MAX)
148
+ .min(contracts_2.VARIANT_COUNT_MIN)
149
+ .max(contracts_2.VARIANT_COUNT_MAX)
189
150
  .optional(),
190
151
  contextAssets: v3_1.z
191
- .array(contracts_1.contextAssetInputSchema)
152
+ .array(contracts_2.contextAssetInputSchema)
192
153
  .min(1)
193
- .max(contracts_1.CONTEXT_ASSET_MAX_ITEMS)
154
+ .max(contracts_2.CONTEXT_ASSET_MAX_ITEMS)
194
155
  .optional(),
195
156
  referencePages: v3_1.z
196
157
  .array(v3_1.z.object({
@@ -253,9 +214,7 @@ const inlineVariantBody = v3_1.z.object({
253
214
  .passthrough())
254
215
  .min(1),
255
216
  sourceFiles: v3_1.z.array(v3_1.z.string()).optional(),
256
- /** Vary on an existing variant: attaches to the active session. */
257
217
  target: inlineVariantTargetSchema.optional(),
258
- /** Vary on an HTML-only static preview: forks it via the refine flow. */
259
218
  staticPreviewTarget: inlineStaticPreviewTargetSchema.optional(),
260
219
  telemetryContext: v3_1.z
261
220
  .object({
@@ -266,9 +225,6 @@ const inlineVariantBody = v3_1.z.object({
266
225
  traceId: v3_1.z.string().optional(),
267
226
  agentRunId: v3_1.z.string().optional(),
268
227
  initiator: inlineInitiatorSchema,
269
- /** Explicit per-request worker runtime choice ("run my workers on opus
270
- * from this Codex session"). Flag-relayed by the host agent, never
271
- * inferred — see WorkerSelection in change-request-types. */
272
228
  workerSelection: v3_1.z
273
229
  .object({
274
230
  provider: v3_1.z.enum(['claude', 'codex', 'cursor']).optional(),
@@ -288,17 +244,12 @@ const hostVariantCompleteBody = v3_1.z.object({
288
244
  title: v3_1.z.string().min(1).max(120).optional(),
289
245
  description: v3_1.z.string().min(1).max(400).optional(),
290
246
  });
291
- // Shared by the active-session and history rename routes. Trim first so a
292
- // whitespace-only title is rejected, and cap the length so an over-long label
293
- // can't bloat the snapshot or the on-disk manifest.
294
247
  const renameLabelSchema = v3_1.z.preprocess((v) => (typeof v === 'string' ? v.trim() : v), v3_1.z.string().min(1).max(120));
295
248
  const renameBody = v3_1.z.object({
296
249
  label: renameLabelSchema,
297
250
  projectPath: v3_1.z.string().optional(),
298
251
  });
299
252
  const RENAME_VALIDATION_MESSAGE = 'Invalid rename — `label` must be a non-empty string of at most 120 characters.';
300
- // Run-folder rename — one call re-homes one session request batch, live and
301
- // history alike; the client never fans out per-variant.
302
253
  const renameRunBody = v3_1.z.object({
303
254
  sessionId: v3_1.z.string().min(1),
304
255
  requestId: v3_1.z.string().min(1).optional(),
@@ -306,10 +257,6 @@ const renameRunBody = v3_1.z.object({
306
257
  label: renameLabelSchema,
307
258
  projectPath: v3_1.z.string().optional(),
308
259
  });
309
- // The variants panel's UI arrangement (pinned items + user-arranged order),
310
- // persisted as one metadata_state row in the project's rivet.db. Keys are
311
- // panel-owned opaque strings (`row:…`/`group:…` pin keys, group keys, row
312
- // keys); the caps only bound a runaway payload, not the shape's semantics.
313
260
  const uiStateKeySchema = v3_1.z.string().min(1).max(500);
314
261
  const uiStateSchema = v3_1.z.object({
315
262
  pinned: v3_1.z.array(uiStateKeySchema).max(1000),
@@ -326,20 +273,6 @@ const uiStatePutBody = v3_1.z.object({
326
273
  uiState: uiStateSchema,
327
274
  projectPath: v3_1.z.string().optional(),
328
275
  });
329
- /**
330
- * Express routes that back the iframe variants chip.
331
- *
332
- * - GET /api/variants/active — current active session state for the chip
333
- * - GET /api/variants/:sessionId — explicit session lookup
334
- * - POST /api/variants/:sessionId/preview-port — switch proxy to a variant's
335
- * dev server (or null to restore the user's default dev server)
336
- * - GET /api/variants/:sessionId/static/:variantId — serve static preview HTML
337
- * - GET /api/variants/:sessionId/design-md/:artifactId — serve raw DESIGN.md
338
- * - GET /api/variants/:sessionId/design-md/:artifactId/view — serve DesignMD page
339
- * - POST /api/variants/:sessionId/commit — user picked this variant in the
340
- * chip; orchestrator enqueues the diff onto pending changes
341
- * - POST /api/variants/:sessionId/cancel — dismiss the variants session
342
- */
343
276
  const HISTORY_STATUSES = new Set([
344
277
  'completed',
345
278
  'committed',
@@ -364,16 +297,10 @@ const escapeHtml = (value) => value.replace(/[&<>"']/g, (char) => {
364
297
  return char;
365
298
  }
366
299
  });
367
- /**
368
- * Selects the best persisted human label to describe a public variant share.
369
- */
370
300
  const getVariantShareTitle = (manifest) => {
371
301
  const title = [manifest.label, manifest.brief, manifest.sessionPrompt].find((candidate) => candidate.trim().length > 0);
372
302
  return (0, PrototypeDeployService_1.normalizePrototypeShareTitle)(title) ?? VARIANT_SHARE_TITLE_FALLBACK;
373
303
  };
374
- /**
375
- * Selects the run prompt for a public canvas share, with a stable fallback.
376
- */
377
304
  const getCanvasShareTitle = (sessionPrompt) => {
378
305
  return ((0, PrototypeDeployService_1.normalizePrototypeShareTitle)(sessionPrompt) ?? CANVAS_SHARE_TITLE_FALLBACK);
379
306
  };
@@ -381,9 +308,6 @@ const CANVAS_IFRAME_SANDBOX = 'allow-scripts allow-forms allow-popups';
381
308
  const RIVET_SOCIAL_IMAGE_URL = 'https://rivet.design/images/rivet-social.png';
382
309
  const RIVET_DEFAULT_SHARE_DESCRIPTION = 'Built with Rivet — the visual editor for design';
383
310
  const UNSUPPORTED_PROTOTYPE_DEPLOY_MESSAGE = "This prototype can't be deployed — only buildable app directions or static previews are supported.";
384
- /**
385
- * Render a public canvas page that puts every deployed direction in one shareable view.
386
- */
387
311
  const buildCanvasShareHtml = (args) => {
388
312
  const prompt = args.sessionPrompt.trim();
389
313
  const variantCards = args.variants
@@ -539,7 +463,6 @@ ${variantCards}
539
463
  </body>
540
464
  </html>`;
541
465
  };
542
- /** Resolve a Rivet-generated subproject path to the workspace that owns variant history. */
543
466
  const generatedProjectWorkspaceRoot = (projectPath) => {
544
467
  const normalized = path_1.default.normalize(projectPath);
545
468
  const segments = normalized.split(path_1.default.sep);
@@ -550,14 +473,6 @@ const generatedProjectWorkspaceRoot = (projectPath) => {
550
473
  const rootPath = segments.slice(0, rivetIndex).join(path_1.default.sep);
551
474
  return path_1.default.resolve(rootPath || path_1.default.parse(normalized).root);
552
475
  };
553
- /**
554
- * Stamp the live {@link WatcherLiveness} onto a variants snapshot so the UI can
555
- * detect a stale host-agent watch loop off real queue/waiter state. Applied to
556
- * BOTH active and inactive snapshots — a change can strand with no variants
557
- * session active — while the variant FIFO depth (`pendingVariantRequests`) is
558
- * still only stamped on active snapshots, preserving prior behavior. Returns
559
- * the snapshot untouched when no liveness is available (no bridge).
560
- */
561
476
  const stampWatcherLiveness = (snapshot, liveness, pendingVariantRequestCount, activeLeases = []) => {
562
477
  if (!liveness || typeof snapshot !== 'object' || snapshot === null) {
563
478
  return snapshot;
@@ -579,19 +494,11 @@ const stampWatcherLiveness = (snapshot, liveness, pendingVariantRequestCount, ac
579
494
  exports.stampWatcherLiveness = stampWatcherLiveness;
580
495
  const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHistoryOverride, deployServiceOverride, variantRunService, historyReplayOverride, previewBridge, inlineStartTrackerOverride) => {
581
496
  const router = (0, express_1.Router)();
582
- // `agent_variants.*` events from this router (preview switches, active-project
583
- // transitions) must carry the browser's PostHog $session_id to link to a
584
- // session replay; the bridge holds it. Falls back to raw telemetry when no
585
- // bridge is wired (e.g. demo mounts), where no browser session is available.
586
497
  const variantsTelemetry = telemetry && bridge
587
498
  ? (0, createAgentVariantsOrchestrator_1.withVariantsSessionReplayLinking)(telemetry, bridge)
588
499
  : telemetry;
589
500
  const variantHistory = variantHistoryOverride ?? new VariantHistoryService_1.VariantHistoryService();
590
501
  const deployService = deployServiceOverride ?? new PrototypeDeployService_1.PrototypeDeployService();
591
- // Replay shares the orchestrator's WorktreeManager instance: the
592
- // reserved-but-not-yet-bound port set is per-instance, so a separate
593
- // manager could hand a live variant's pending port to a replay
594
- // (EADDRINUSE for whichever binds second).
595
502
  const historyReplay = historyReplayOverride ??
596
503
  new HistoryReplayService_1.HistoryReplayService({
597
504
  history: variantHistory,
@@ -613,11 +520,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
613
520
  }
614
521
  next();
615
522
  });
616
- /**
617
- * Stamp the live watcher liveness onto a snapshot before it leaves the server.
618
- * The `typeof` guards keep partial bridge mocks (and a missing bridge) from
619
- * throwing — production always has the real bridge methods.
620
- */
621
523
  const stampLiveness = (snapshot) => (0, exports.stampWatcherLiveness)(snapshot, bridge && typeof bridge.getWatcherLiveness === 'function'
622
524
  ? bridge.getWatcherLiveness()
623
525
  : null, bridge && typeof bridge.pendingVariantRequestCount === 'function'
@@ -631,7 +533,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
631
533
  }
632
534
  return bridge?.getProjectPath() ?? null;
633
535
  };
634
- /** Resolve every project root that can own history for the requested route. */
635
536
  const resolveHistoryProjectPaths = (params) => {
636
537
  const seen = new Set();
637
538
  const candidates = [];
@@ -656,15 +557,10 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
656
557
  }
657
558
  }
658
559
  catch {
659
- // Persisted sessions may outlive in-memory orchestrator state.
660
560
  }
661
561
  }
662
562
  const upwardRoot = generatedProjectWorkspaceRoot(params.projectPath);
663
563
  addCandidate(upwardRoot);
664
- // Rediscover fresh-session workdirs nested under a repo root. Without this,
665
- // a stop/restart drops the in-memory session (and its `workspacePath`), so
666
- // reopening the root — whose own `.rivet/variants` is empty — would surface
667
- // none of the directions stored under `<root>/.rivet/<slug>/.rivet/variants`.
668
564
  for (const scanRoot of [params.projectPath, upwardRoot]) {
669
565
  if (!scanRoot)
670
566
  continue;
@@ -701,15 +597,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
701
597
  }
702
598
  return { kind: 'existing', projectPath: args.projectPath };
703
599
  };
704
- /**
705
- * Resolve a variant reference whose session is no longer active from
706
- * persisted history and adopt it — into the usable active session, or a
707
- * fresh one — so targeted requests keep working after restarts and newer
708
- * runs. This is the same adoption flow the editor uses when a past
709
- * direction is edited; the CLI/agent path simply reuses it.
710
- */
711
- /** @effect Rejects a request that would displace or mutate an actively
712
- * generating session. Ready/terminal sessions rotate normally. */
713
600
  const rejectBlockedVariantSession = (res, snapshot) => {
714
601
  if (!(0, variantSessionStart_1.isVariantSessionStartBlocked)(snapshot))
715
602
  return false;
@@ -717,9 +604,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
717
604
  const sessionId = snapshot.active === true ? snapshot.sessionId : undefined;
718
605
  res.status(400).json({
719
606
  error: 'Variants session already active',
720
- // Name the blocker so callers are not flying blind, and never
721
- // recommend cancel as remediation: cancelling to unblock destroys
722
- // the user's in-progress work. Only a human should decide that.
723
607
  details: `A variants session is active${sessionId
724
608
  ? ` (session ${sessionId}${stage ? `, stage ${stage}` : ''})`
725
609
  : ''}. Wait for it to settle (poll status), target it with --target to refine it, or ask the user before cancelling anything.`,
@@ -763,8 +647,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
763
647
  'its artifact instead.',
764
648
  };
765
649
  }
766
- // The history lookup is async — a run may have started meanwhile. Never
767
- // adopt into (or displace) a session that is actively generating.
768
650
  const raceSnapshot = orchestrator.buildActiveSnapshot();
769
651
  if ((0, variantSessionStart_1.isVariantSessionStartBlocked)(raceSnapshot)) {
770
652
  return { ok: false, kind: 'blocked', snapshot: raceSnapshot };
@@ -776,6 +658,7 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
776
658
  entryPath: preview.entryPath,
777
659
  label: detail.manifest.label,
778
660
  description: detail.manifest.brief,
661
+ references: detail.manifest.references,
779
662
  runLabel: detail.manifest.runLabel ??
780
663
  (0, runLabel_1.deriveRunLabel)(detail.manifest.sessionPrompt),
781
664
  prompt: detail.manifest.sessionPrompt,
@@ -800,9 +683,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
800
683
  });
801
684
  return true;
802
685
  };
803
- /**
804
- * Resolve the saved app directory a deploy build should run from.
805
- */
806
686
  const resolveDeployableAppDir = async (args) => {
807
687
  const manifest = args.variant.manifest;
808
688
  if (manifest.projectKind === 'fresh' &&
@@ -825,9 +705,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
825
705
  }
826
706
  return appDir;
827
707
  };
828
- /**
829
- * Deploy one persisted variant and append the returned public URL to history.
830
- */
831
708
  const deployPersistedVariant = async (args) => {
832
709
  const existingDeployments = args.variant.manifest.deployments ?? [];
833
710
  const latestDeployment = existingDeployments.length > 0
@@ -849,8 +726,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
849
726
  const title = getVariantShareTitle(args.variant.manifest);
850
727
  let result;
851
728
  if (preview.kind === 'static') {
852
- // Already a built static bundle (e.g. a history static-preview variant)
853
- // — upload files/ directly, no build needed.
854
729
  result = await deployService.deployStatic(filesDir, {
855
730
  title,
856
731
  entryPath: preview.entryPath,
@@ -910,13 +785,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
910
785
  });
911
786
  return;
912
787
  }
913
- // Resolve a variant target that points at an HTML-only static preview:
914
- // those requests fork through the refine flow rather than code-gen (a
915
- // static preview has no worktree to edit). Gate on the TRUE work-item kind
916
- // — never on HTML presence or the client's claim: an existing-project
917
- // `code_gen` variant materialized as a static preview serves HTML and
918
- // displays as `static_artifact`, but owns a worktree and MUST fork via the
919
- // code_gen path (the static fork would reject it with VARIANT_NOT_EDITABLE).
920
788
  const batchTarget = parsed.data.target;
921
789
  const claimedStaticTarget = parsed.data.staticPreviewTarget ??
922
790
  (batchTarget
@@ -955,20 +823,10 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
955
823
  return;
956
824
  }
957
825
  const activeVariantsSession = orchestrator.buildActiveSnapshot();
958
- // A targeted request against the CURRENTLY active session attaches to it
959
- // directly. A reference to any other session — the originating session
960
- // ended, the server restarted, or a newer run replaced it — resolves
961
- // through persisted history: adopt the snapshot (into the usable active
962
- // session, or a fresh one) and retarget the request at the adopted live
963
- // variant. Copied variant references stay actionable for their whole
964
- // lifetime, not just while their session is in memory.
965
826
  let effectiveTarget = batchTarget ?? staticPreviewTarget;
966
827
  const isPersistedTargetRequest = Boolean(effectiveTarget &&
967
828
  (activeVariantsSession.active !== true ||
968
829
  effectiveTarget.sessionId !== activeVariantsSession.sessionId));
969
- // Adoption creates or mutates a session, so persisted-target requests
970
- // follow the same intake rules as untargeted starts: never displace an
971
- // actively generating session, and never race an in-flight start.
972
830
  if ((isPersistedTargetRequest || !effectiveTarget) &&
973
831
  rejectBlockedVariantSession(res, activeVariantsSession)) {
974
832
  return;
@@ -1029,10 +887,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1029
887
  variantId: adoption.workItemId,
1030
888
  }
1031
889
  : undefined;
1032
- // Rewrite EVERY pointer at the dead reference — the batch-level
1033
- // fields and the per-change `target`/`staticPreviewTarget` pair the
1034
- // editor sends (the refine flow prefers the per-change static target,
1035
- // so leaving it stale would aim the refine at the ended session).
1036
890
  const matchesStaleTarget = (candidate) => Boolean(candidate &&
1037
891
  candidate.sessionId === staleTarget.sessionId &&
1038
892
  candidate.variantId === staleTarget.variantId);
@@ -1062,16 +916,17 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1062
916
  };
1063
917
  effectiveTarget = liveTarget;
1064
918
  }
919
+ const refineStaticPreviewBatch = variantRunService.refineStaticPreviewBatch?.bind(variantRunService);
1065
920
  const isStaticPreviewFork = Boolean(request.staticPreviewTarget);
1066
- if (isStaticPreviewFork && !variantRunService.refineStaticPreviewBatch) {
921
+ if (isStaticPreviewFork && !refineStaticPreviewBatch) {
1067
922
  res.status(503).json({
1068
923
  error: 'Static preview refinement unavailable',
1069
924
  reason: 'inline_variants_unavailable',
1070
925
  });
1071
926
  return;
1072
927
  }
1073
- const result = isStaticPreviewFork
1074
- ? await variantRunService.refineStaticPreviewBatch(request)
928
+ const result = isStaticPreviewFork && refineStaticPreviewBatch
929
+ ? await refineStaticPreviewBatch(request)
1075
930
  : await variantRunService.startElementVariants(request);
1076
931
  if (!result.success) {
1077
932
  res.status(500).json({
@@ -1080,7 +935,14 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1080
935
  });
1081
936
  return;
1082
937
  }
1083
- res.status(200).json({ success: true });
938
+ res
939
+ .status(200)
940
+ .json({
941
+ success: true,
942
+ ...(result.profileContext
943
+ ? { profileContext: result.profileContext }
944
+ : {}),
945
+ });
1084
946
  }
1085
947
  catch (err) {
1086
948
  log.error('Inline variants run failed:', err);
@@ -1147,16 +1009,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1147
1009
  starting: inlineStartTracker.isStarting(),
1148
1010
  }));
1149
1011
  });
1150
- /**
1151
- * Server-Sent Events stream for the iframe chip. Pushes a fresh
1152
- * ActiveSnapshot whenever the orchestrator's state changes (propose,
1153
- * approve, report-complete, dev-server-up, terminal, cancel, commit) so
1154
- * the chip never has to poll.
1155
- *
1156
- * Heartbeats every 30s as comments (`: heartbeat\n\n`) to keep
1157
- * intermediate proxies from killing the connection on idle. EventSource
1158
- * auto-reconnects on disconnect.
1159
- */
1160
1012
  router.get('/variants/events', (req, res) => {
1161
1013
  if (rejectNonLocalRequest(req, res))
1162
1014
  return;
@@ -1167,10 +1019,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1167
1019
  'X-Accel-Buffering': 'no',
1168
1020
  });
1169
1021
  res.flushHeaders?.();
1170
- // Stamp each snapshot with the live variant-request FIFO depth + watcher
1171
- // liveness. Both live on the bridge (not the orchestrator), so
1172
- // buildActiveSnapshot() can't fill them in — we add them here at write time
1173
- // so the initial state and every subscribed update carry them.
1174
1022
  const writeSnapshot = (snapshot) => {
1175
1023
  try {
1176
1024
  const activeSnapshot = snapshot && typeof snapshot === 'object'
@@ -1185,20 +1033,13 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1185
1033
  log.warn('SSE write failed (client likely disconnected)', err);
1186
1034
  }
1187
1035
  };
1188
- // Initial state so the chip can render immediately.
1189
1036
  writeSnapshot(orchestrator.buildActiveSnapshot());
1190
1037
  const unsubscribe = orchestrator.subscribeToEvents(writeSnapshot);
1191
- // Re-push on bridge queue/waiter changes too. A change the user sends with
1192
- // no host agent draining it never produces an orchestrator event, so
1193
- // without this the stale-watcher banner would never see the strand.
1194
1038
  const unsubscribeLiveness = bridge && typeof bridge.onWatcherLivenessChange === 'function'
1195
1039
  ? bridge.onWatcherLivenessChange(() => {
1196
1040
  writeSnapshot(orchestrator.buildActiveSnapshot());
1197
1041
  })
1198
1042
  : undefined;
1199
- // A live SSE subscriber means a Rivet page is open; track it so the MCP
1200
- // server can skip re-opening a duplicate browser tab when the variants flow
1201
- // re-enters an already-active editor session.
1202
1043
  const releaseUiClient = orchestrator.registerUiClient();
1203
1044
  const heartbeat = setInterval(() => {
1204
1045
  try {
@@ -1206,7 +1047,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1206
1047
  res.write(': heartbeat\n\n');
1207
1048
  }
1208
1049
  catch {
1209
- // ignore — close handler will clean up
1210
1050
  }
1211
1051
  }, 30_000);
1212
1052
  req.on('close', () => {
@@ -1218,7 +1058,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1218
1058
  res.end();
1219
1059
  }
1220
1060
  catch {
1221
- // already ended
1222
1061
  }
1223
1062
  });
1224
1063
  });
@@ -1254,11 +1093,7 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1254
1093
  return;
1255
1094
  }
1256
1095
  try {
1257
- const entries = (await Promise.all(resolveHistoryProjectPaths({ projectPath }).map((historyProjectPath) =>
1258
- // Reads the SQLite metadata index when it's usable and falls
1259
- // back to the manifest walk otherwise — same entries, faster
1260
- // list. Detail/preview routes stay manifest/file-backed.
1261
- variantHistory.listVariantsFromIndex({
1096
+ const entries = (await Promise.all(resolveHistoryProjectPaths({ projectPath }).map((historyProjectPath) => variantHistory.listVariantsFromIndex({
1262
1097
  projectPath: historyProjectPath,
1263
1098
  status: statusParam,
1264
1099
  })))).flat();
@@ -1268,10 +1103,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1268
1103
  }
1269
1104
  const uniqueEntries = Array.from(entriesById.values()).sort((a, b) => b.manifest.createdAt.localeCompare(a.manifest.createdAt));
1270
1105
  const limitedEntries = limit !== undefined ? uniqueEntries.slice(0, limit) : uniqueEntries;
1271
- // Removed and cancelled variants are retained on disk but never surfaced
1272
- // in the default history list. Keeps dismissed and cancelled directions
1273
- // hidden once the session is no longer active, matching the
1274
- // list_past_variants MCP tool.
1275
1106
  const visibleEntries = statusParam === 'removed'
1276
1107
  ? limitedEntries
1277
1108
  : limitedEntries.filter((entry) => entry.manifest.status !== 'removed' &&
@@ -1284,6 +1115,7 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1284
1115
  requestId: entry.manifest.requestId,
1285
1116
  label: entry.manifest.label,
1286
1117
  brief: entry.manifest.brief,
1118
+ references: entry.manifest.references,
1287
1119
  runLabel: entry.manifest.runLabel ??
1288
1120
  (0, runLabel_1.deriveRunLabel)(entry.manifest.sessionPrompt),
1289
1121
  kind: manifestKind(entry.manifest),
@@ -1296,14 +1128,8 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1296
1128
  preview: entry.manifest.preview,
1297
1129
  artifact: entry.manifest.artifact,
1298
1130
  parentVariant: entry.manifest.parentVariant,
1299
- // Tree-store fields (absent on legacy entries): `serve` tells the
1300
- // panel how a tree-backed entry previews (static → history preview
1301
- // route; dev-server → the replay run route), `hasTree` marks the
1302
- // entry as snapshot-backed at all.
1303
1131
  ...(entry.manifest.serve ? { serve: entry.manifest.serve } : {}),
1304
1132
  hasTree: Boolean(entry.manifest.tree),
1305
- // The runtime that built this direction (vendor/model/effort) —
1306
- // absent on legacy entries and host-agent-executed variants.
1307
1133
  ...(entry.manifest.runtime
1308
1134
  ? { runtime: entry.manifest.runtime }
1309
1135
  : {}),
@@ -1314,10 +1140,107 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1314
1140
  sendError(res, err);
1315
1141
  }
1316
1142
  });
1317
- // The variants panel's UI arrangement (pins + custom order). Stored in the
1318
- // project's rivet.db metadata_state — per-project and shared across
1319
- // browsers, unlike the panel's other localStorage preferences. Not
1320
- // rebuildable: losing the database resets the arrangement.
1143
+ router.get('/variants/:sessionId/:variantId/references/:referenceId/image', async (req, res) => {
1144
+ if (rejectNonLocalRequest(req, res))
1145
+ return;
1146
+ const targetSchema = v3_1.z.object({
1147
+ sessionId: v3_1.z.string().regex(/^[A-Za-z0-9_-]+$/),
1148
+ variantId: v3_1.z.string().regex(/^[A-Za-z0-9_-]+$/),
1149
+ });
1150
+ const parsed = targetSchema
1151
+ .extend({ referenceId: v3_1.z.string().min(1).max(512) })
1152
+ .safeParse(req.params);
1153
+ if (!parsed.success) {
1154
+ res.status(400).json({ error: 'Invalid reference identity' });
1155
+ return;
1156
+ }
1157
+ const projectPath = resolveProjectPath(req.query.projectPath);
1158
+ if (!projectPath) {
1159
+ res.status(400).json({ error: 'Project path is required' });
1160
+ return;
1161
+ }
1162
+ const inputSchema = v3_1.z.object({
1163
+ references: v3_1.z.array(variant_reference_1.variantReferenceSchema).optional(),
1164
+ context: contracts_1.variantWorkItemContextSchema.optional(),
1165
+ adoptedFrom: targetSchema.optional(),
1166
+ sourceVariantId: v3_1.z
1167
+ .string()
1168
+ .regex(/^[A-Za-z0-9_-]+$/)
1169
+ .optional(),
1170
+ });
1171
+ const visited = new Set();
1172
+ const readImage = async (target) => {
1173
+ const key = `${target.sessionId}:${target.variantId}`;
1174
+ if (visited.has(key))
1175
+ return null;
1176
+ visited.add(key);
1177
+ const found = await findHistoryVariant({ projectPath, ...target });
1178
+ if (found) {
1179
+ return variantHistory.getReferenceImage({
1180
+ projectPath: found.projectPath,
1181
+ ...target,
1182
+ referenceId: parsed.data.referenceId,
1183
+ });
1184
+ }
1185
+ let raw;
1186
+ try {
1187
+ raw = orchestrator.getWorkItemInput(target.sessionId, target.variantId);
1188
+ }
1189
+ catch (error) {
1190
+ if (error instanceof agent_variants_1.AgentVariantsError &&
1191
+ ['SESSION_NOT_FOUND', 'WORK_ITEM_NOT_FOUND'].includes(error.code))
1192
+ return null;
1193
+ throw error;
1194
+ }
1195
+ const input = inputSchema.safeParse(raw);
1196
+ if (!input.success)
1197
+ return null;
1198
+ const reference = (0, variant_reference_1.mergeVariantReferences)(input.data.references)?.find((item) => item.id === parsed.data.referenceId);
1199
+ if (!reference?.image)
1200
+ return null;
1201
+ const current = await (0, referenceImages_1.readContextReferenceImage)({
1202
+ reference,
1203
+ context: input.data.context,
1204
+ roots: resolveHistoryProjectPaths({
1205
+ projectPath,
1206
+ sessionId: target.sessionId,
1207
+ }).map((candidate) => path_1.default.join(variantHistory.store.storage.resolve(candidate).dataDirectory, 'variant-context')),
1208
+ });
1209
+ if (current)
1210
+ return current;
1211
+ const parent = input.data.adoptedFrom ??
1212
+ (input.data.sourceVariantId
1213
+ ? {
1214
+ sessionId: target.sessionId,
1215
+ variantId: input.data.sourceVariantId,
1216
+ }
1217
+ : undefined);
1218
+ if (!parent)
1219
+ return null;
1220
+ const inherited = await readImage(parent);
1221
+ return inherited &&
1222
+ inherited.mimeType === reference.image.mimeType &&
1223
+ (0, crypto_1.createHash)('sha256').update(inherited.body).digest('hex') ===
1224
+ reference.image.hash
1225
+ ? inherited
1226
+ : null;
1227
+ };
1228
+ try {
1229
+ const image = await readImage(parsed.data);
1230
+ if (!image) {
1231
+ res.status(404).json({ error: 'Reference image is unavailable' });
1232
+ return;
1233
+ }
1234
+ res
1235
+ .type(image.mimeType)
1236
+ .set('Cache-Control', 'private, no-store')
1237
+ .set('X-Content-Type-Options', 'nosniff')
1238
+ .send(image.body);
1239
+ }
1240
+ catch (error) {
1241
+ sendError(res, error);
1242
+ }
1243
+ });
1321
1244
  router.get('/variants/ui-state', async (req, res) => {
1322
1245
  if (rejectNonLocalRequest(req, res))
1323
1246
  return;
@@ -1337,7 +1260,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1337
1260
  stored = JSON.parse(raw);
1338
1261
  }
1339
1262
  catch {
1340
- // A corrupt row reads as "nothing stored" — the next PUT heals it.
1341
1263
  }
1342
1264
  }
1343
1265
  const parsed = uiStateSchema.safeParse(stored);
@@ -1377,13 +1299,8 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1377
1299
  sendError(res, err);
1378
1300
  }
1379
1301
  });
1380
- // The entry route resolves the saved document's canonical URL. HTML files
1381
- // served below that URL receive the document policy and preview bridge.
1382
1302
  router.get('/variants/history/:sessionId/:variantId/preview', async (req, res) => serveHistoryPreview(req, res, variantHistory, resolveProjectPath, resolveHistoryProjectPaths, { isDocument: true }, previewBridge));
1383
1303
  router.get('/variants/history/:sessionId/:variantId/preview/{*assetPath}', async (req, res) => serveHistoryPreview(req, res, variantHistory, resolveProjectPath, resolveHistoryProjectPaths, { isDocument: false }, previewBridge));
1384
- // Stop history replay servers. Registered before the
1385
- // parameterized history routes purely for clarity — method+arity keep it
1386
- // unambiguous either way.
1387
1304
  router.post('/variants/history/replay/stop', async (req, res) => {
1388
1305
  if (rejectNonLocalRequest(req, res))
1389
1306
  return;
@@ -1397,12 +1314,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1397
1314
  }
1398
1315
  res.json({ stopped: true });
1399
1316
  });
1400
- /**
1401
- * Boot a past dev-server variant from its tree-store ref: materialize the
1402
- * exact tree, overlay runtime (.env / node_modules), start the persisted
1403
- * serve recipe, and optionally retarget the main preview proxy at the new
1404
- * port. See docs/variant-history-tree-store-design.md.
1405
- */
1406
1317
  router.post('/variants/history/:sessionId/:variantId/run', async (req, res) => {
1407
1318
  if (rejectNonLocalRequest(req, res))
1408
1319
  return;
@@ -1603,13 +1514,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1603
1514
  sendError(res, err);
1604
1515
  }
1605
1516
  });
1606
- /**
1607
- * Adopt a PAST (history) variant into the active session as a first-class
1608
- * succeeded variant, so the user's first edit on a selected past direction
1609
- * routes to a real session member. Resolves the persisted snapshot from
1610
- * history, then hands the rehydration `files/` dir to the orchestrator. The
1611
- * UI calls this on first comment/Vary against a selected past variant.
1612
- */
1613
1517
  router.post('/variants/adopt-past', async (req, res) => {
1614
1518
  if (rejectNonLocalRequest(req, res))
1615
1519
  return;
@@ -1658,6 +1562,7 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1658
1562
  entryPath: preview.entryPath,
1659
1563
  label: detail.manifest.label,
1660
1564
  description: detail.manifest.brief,
1565
+ references: detail.manifest.references,
1661
1566
  runLabel: detail.manifest.runLabel ??
1662
1567
  (0, runLabel_1.deriveRunLabel)(detail.manifest.sessionPrompt),
1663
1568
  prompt: detail.manifest.sessionPrompt,
@@ -1729,6 +1634,7 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1729
1634
  entryPath: preview.entryPath,
1730
1635
  label: detail.manifest.label,
1731
1636
  description: detail.manifest.brief,
1637
+ references: detail.manifest.references,
1732
1638
  runLabel: detail.manifest.runLabel ??
1733
1639
  (0, runLabel_1.deriveRunLabel)(detail.manifest.sessionPrompt),
1734
1640
  });
@@ -1755,43 +1661,21 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1755
1661
  });
1756
1662
  return;
1757
1663
  }
1758
- // Only inject `<base href>` when the variant actually has sibling
1759
- // assets to serve. Otherwise the inlined HTML is self-contained and
1760
- // the base tag would only serve to mis-resolve any incidental
1761
- // relative URLs (e.g. `<a href="something">`) against the asset
1762
- // sub-path. The hasAssets check also avoids the trailing-slash
1763
- // fragment-link quirk for the common no-assets case.
1764
1664
  const hasAssets = orchestrator.hasStaticPreviewAssets(sessionId, variantId);
1765
1665
  if (hasAssets &&
1766
1666
  !req.originalUrl.includes('?') &&
1767
1667
  !req.originalUrl.endsWith('/')) {
1768
- // Document URL must end in `/` so the browser's `document.URL` and
1769
- // the `<base href>` agree. Otherwise fragment-only links
1770
- // (`<a href="#section">`) resolve to the base-href URL — different
1771
- // from the current URL — and the browser does a full navigation,
1772
- // hitting the asset route with an empty path → 404. Redirect to
1773
- // the canonical trailing-slash form before serving.
1774
1668
  res.redirect(301, req.originalUrl + '/');
1775
1669
  return;
1776
1670
  }
1777
1671
  const withBaseHref = hasAssets
1778
- ? injectBaseHref(html,
1779
- // Trailing slash is required so `./avatar.glb` resolves to
1780
- // `.../static/<vid>/avatar.glb`, not `.../static/avatar.glb`.
1781
- `/api/variants/${encodeURIComponent(sessionId)}/static/${encodeURIComponent(variantId)}/`)
1672
+ ? injectBaseHref(html, `/api/variants/${encodeURIComponent(sessionId)}/static/${encodeURIComponent(variantId)}/`)
1782
1673
  : html;
1783
- // In embedded mode the visual editor drives this iframe over the preview
1784
- // bridge; without the injected listener, selecting/commenting on the
1785
- // variant times out (`Preview bridge timed out`) and the comment input
1786
- // never opens. Mirror the base static route (`routes/static.ts`).
1787
1674
  const finalHtml = previewBridge?.isEnabled
1788
1675
  ? (0, preview_bridge_1.injectPreviewBridge)(withBaseHref, {
1789
1676
  expectedParentOrigin: previewBridge.expectedParentOrigin,
1790
1677
  })
1791
1678
  : withBaseHref;
1792
- // Constrain the blast radius of agent-generated scripts. See
1793
- // buildStaticPreviewCsp for the policy and the isolated-origin migration
1794
- // that will eventually let us drop the per-CDN allowlist.
1795
1679
  res
1796
1680
  .status(200)
1797
1681
  .type('html')
@@ -1871,13 +1755,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1871
1755
  sendError(res, err);
1872
1756
  }
1873
1757
  });
1874
- /**
1875
- * Serve sibling assets the variant's HTML references (e.g. `./avatar.glb`,
1876
- * `./hero.png`). The agent reports `output.assetBase` alongside the inline
1877
- * HTML; the orchestrator sandboxes it inside the fresh-session workspace
1878
- * and exposes a resolver. Path-traversal-rejected requests + missing files
1879
- * return 404. Loopback-only.
1880
- */
1881
1758
  router.get('/variants/:sessionId/static/:variantId/{*assetPath}', (req, res) => {
1882
1759
  if (rejectNonLocalRequest(req, res))
1883
1760
  return;
@@ -1895,10 +1772,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1895
1772
  });
1896
1773
  return;
1897
1774
  }
1898
- // `dotfiles: 'allow'` because workspacePath is typically nested
1899
- // under a `.rivet/` directory (Rivet's per-project state dir) —
1900
- // sendFile's default 'ignore' setting 404s anything with a hidden
1901
- // segment, which would always trigger here.
1902
1775
  res.sendFile(abs, {
1903
1776
  dotfiles: 'allow',
1904
1777
  headers: { 'Cache-Control': 'no-store' },
@@ -1957,14 +1830,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1957
1830
  }
1958
1831
  try {
1959
1832
  bridge.rebindProjectPath(result.destinationPath);
1960
- // Do NOT call switchPreviewPort(null) here on the fresh vite_app
1961
- // path: commitVariant has already spawned a fresh dev server at
1962
- // destinationPath and retargeted the proxy to its port via the
1963
- // orchestrator's switchPreviewPort callback. Calling null here
1964
- // would route the proxy to the default upstream (the user's repo,
1965
- // which has no dev server) and the iframe would show "preview
1966
- // disconnected" — exactly the regression we're fixing. The
1967
- // committed dev server lives until the next propose / shutdown.
1968
1833
  await orchestrator.cleanupCommittedSession(sessionId);
1969
1834
  variantsTelemetry?.trackAgentVariantsActiveProjectTransition({
1970
1835
  sessionId,
@@ -2002,18 +1867,10 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2002
1867
  sendError(res, err);
2003
1868
  }
2004
1869
  });
2005
- /**
2006
- * Deploy a fresh-project (Vite) variant to the public Prototype Preview Host
2007
- * and return a shareable URL. Builds locally, uploads the static bundle with
2008
- * the user's Rivet JWT, and records the deployment in the variant manifest so
2009
- * the chip can re-show ("Copy link") without rebuilding.
2010
- */
2011
1870
  router.post('/variants/:sessionId/deploy', async (req, res) => {
2012
1871
  if (rejectNonLocalRequest(req, res))
2013
1872
  return;
2014
1873
  const sessionId = req.params.sessionId;
2015
- // Gated behind the `deployPrototype` flag (default off). Mirrors the UI
2016
- // gate so the endpoint can't be driven while the feature is dark.
2017
1874
  const flags = await (0, evaluateFlags_1.getFeatureFlags)({
2018
1875
  userKey: (0, featureFlagUserKey_1.getConfigFeatureFlagUserKey)({ headers: req.headers }),
2019
1876
  });
@@ -2082,11 +1939,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2082
1939
  });
2083
1940
  }
2084
1941
  });
2085
- /**
2086
- * Deploy a fresh-project canvas to the public Prototype Preview Host. The
2087
- * canvas page embeds every requested direction so one public URL can be used
2088
- * for review instead of sharing one URL per variant.
2089
- */
2090
1942
  router.post('/variants/:sessionId/canvas/deploy', async (req, res) => {
2091
1943
  if (rejectNonLocalRequest(req, res))
2092
1944
  return;
@@ -2248,9 +2100,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2248
2100
  sendError(res, err);
2249
2101
  }
2250
2102
  });
2251
- // Remove a single variant from the UI: hides it from the active snapshot for
2252
- // good while retaining it in `.rivet/variants/` as `removed`. Distinct from
2253
- // /cancel (which tears down the whole session).
2254
2103
  router.post('/variants/:sessionId/:variantId/remove', async (req, res) => {
2255
2104
  if (rejectNonLocalRequest(req, res))
2256
2105
  return;
@@ -2263,8 +2112,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2263
2112
  sendError(res, err);
2264
2113
  }
2265
2114
  });
2266
- // Rename a live (active-session) variant. Patches the in-memory work item and
2267
- // its on-disk manifest, then re-pushes the snapshot over SSE.
2268
2115
  router.post('/variants/:sessionId/:variantId/rename', async (req, res) => {
2269
2116
  if (rejectNonLocalRequest(req, res))
2270
2117
  return;
@@ -2289,8 +2136,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2289
2136
  sendError(res, err);
2290
2137
  }
2291
2138
  });
2292
- // Rename one run request batch across live state and every resolved history
2293
- // root in one call.
2294
2139
  router.post('/variants/runs/rename', async (req, res) => {
2295
2140
  if (rejectNonLocalRequest(req, res))
2296
2141
  return;
@@ -2314,8 +2159,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2314
2159
  });
2315
2160
  liveRenamedCount = result.renamedCount;
2316
2161
  }
2317
- // History is best-effort even without a resolvable project path — a
2318
- // fresh-session run may have nothing persisted yet.
2319
2162
  const projectPath = resolveProjectPath(parsed.data.projectPath);
2320
2163
  let historyRenamedCount = 0;
2321
2164
  if (projectPath) {
@@ -2339,9 +2182,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2339
2182
  sendError(res, err);
2340
2183
  }
2341
2184
  });
2342
- // Rename a past (history) variant — no active session involved, so this writes
2343
- // straight to the persisted manifest. Takes the workspace projectPath the same
2344
- // way the history list/preview routes do.
2345
2185
  router.post('/variants/history/:sessionId/:variantId/rename', async (req, res) => {
2346
2186
  if (rejectNonLocalRequest(req, res))
2347
2187
  return;
@@ -2387,10 +2227,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2387
2227
  sendError(res, err);
2388
2228
  }
2389
2229
  });
2390
- // Remove a past (history) variant — flips its persisted manifest to `removed`
2391
- // so it drops out of the default history list. Non-destructive: the snapshot
2392
- // stays on disk, matching the active-session remove flow. Takes the workspace
2393
- // projectPath the same way the other history routes do.
2394
2230
  router.post('/variants/history/:sessionId/:variantId/remove', async (req, res) => {
2395
2231
  if (rejectNonLocalRequest(req, res))
2396
2232
  return;
@@ -2424,13 +2260,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2424
2260
  return router;
2425
2261
  };
2426
2262
  exports.createAgentVariantsRouter = createAgentVariantsRouter;
2427
- /**
2428
- * Serve one saved static preview file from a variant history snapshot.
2429
- *
2430
- * The entry route redirects to the saved HTML filename so relative embeds,
2431
- * assets and fragment links resolve naturally. HTML responses carry the
2432
- * preview CSP and bridge; other sibling assets carry neither.
2433
- */
2434
2263
  const serveHistoryPreview = async (req, res, variantHistory, resolveProjectPath, resolveHistoryProjectPaths, { isDocument }, previewBridge) => {
2435
2264
  if (rejectNonLocalRequest(req, res))
2436
2265
  return;
@@ -2488,17 +2317,11 @@ const serveHistoryPreview = async (req, res, variantHistory, resolveProjectPath,
2488
2317
  return;
2489
2318
  }
2490
2319
  if (isDocument) {
2491
- // Give the history entry its saved filename as the browser's document URL:
2492
- // /preview -> /preview/pages/index.html makes ./demo.html resolve under
2493
- // /preview/pages/. A <base> tag would also retarget fragment-only links
2494
- // such as #details, which must stay within the displayed document.
2495
2320
  const previewRoot = `/api/variants/history/${encodeURIComponent(sessionId)}/${encodeURIComponent(variantId)}/preview/`;
2496
- // Encode filenames (including spaces and #) without encoding directory separators.
2497
2321
  const entryPath = file.relativePath
2498
2322
  .split('/')
2499
2323
  .map(encodeURIComponent)
2500
2324
  .join('/');
2501
- // Keep preview options and project lookup parameters through the redirect.
2502
2325
  const queryIndex = req.originalUrl.indexOf('?');
2503
2326
  const query = queryIndex === -1 ? '' : req.originalUrl.slice(queryIndex);
2504
2327
  res
@@ -2508,16 +2331,11 @@ const serveHistoryPreview = async (req, res, variantHistory, resolveProjectPath,
2508
2331
  }
2509
2332
  const contentType = path_1.default.extname(file.absolutePath) || 'html';
2510
2333
  res.status(200).type(contentType).set('Cache-Control', 'no-store');
2511
- // HTML siblings can be embedded documents too, so they need the same
2512
- // permissions as the entry. CSS, scripts and images retain their raw bytes.
2513
2334
  if (/\.html?$/i.test(file.relativePath)) {
2514
2335
  const html = file.body.toString('utf8');
2515
2336
  res
2516
2337
  .set('Content-Security-Policy', buildStaticPreviewCsp(previewBridge?.expectedParentOrigin, previewBridge?.resolveLibraryOrigin?.()))
2517
2338
  .set('X-Content-Type-Options', 'nosniff');
2518
- // Embedded mode drives this snapshot iframe over the preview bridge; the
2519
- // listener must be present or selecting/commenting on a past variant
2520
- // times out (`Preview bridge timed out`). Matches the live static route.
2521
2339
  if (previewBridge?.isEnabled) {
2522
2340
  res.send((0, preview_bridge_1.injectPreviewBridge)(html, {
2523
2341
  expectedParentOrigin: previewBridge.expectedParentOrigin,
@@ -2540,10 +2358,6 @@ const serveHistoryPreview = async (req, res, variantHistory, resolveProjectPath,
2540
2358
  sendError(res, err);
2541
2359
  }
2542
2360
  };
2543
- /**
2544
- * Validates the raw history-preview URL suffix before Express can normalize an
2545
- * encoded traversal segment away from req.params.
2546
- */
2547
2361
  const getInvalidRawHistoryPreviewAssetPath = (req) => {
2548
2362
  const rawPath = req.originalUrl.split('?')[0] ?? '';
2549
2363
  const marker = '/preview/';
@@ -2565,9 +2379,6 @@ const getInvalidRawHistoryPreviewAssetPath = (req) => {
2565
2379
  }
2566
2380
  return null;
2567
2381
  };
2568
- /**
2569
- * Resolve a child path while rejecting paths that escape the intended root.
2570
- */
2571
2382
  const resolvePathWithinRoot = (rootPath, childPath) => {
2572
2383
  const absolutePath = path_1.default.resolve(rootPath, childPath);
2573
2384
  const relativePath = path_1.default.relative(rootPath, absolutePath);
@@ -2639,17 +2450,9 @@ const toActiveProjectContext = (projectContext) => {
2639
2450
  : {}),
2640
2451
  };
2641
2452
  };
2642
- /** Map persisted artifact shape to the public history summary kind. */
2643
2453
  const manifestKind = (manifest) => {
2644
2454
  return manifest.artifact.kind === 'diff' ? 'diff' : 'project-created';
2645
2455
  };
2646
- /**
2647
- * Inject a `<base href>` tag into the variant HTML so relative URLs
2648
- * resolve against the asset-serving sub-path. Idempotent: if the HTML
2649
- * already declares a `<base>` tag we leave it alone (the agent opted in
2650
- * to its own resolution rules). Documents without a head tag receive the base
2651
- * after their html tag or doctype, outside any embedded markup.
2652
- */
2653
2456
  const injectBaseHref = (html, baseHref) => (0, htmlDocument_1.insertHtmlHeadElements)(html, [
2654
2457
  {
2655
2458
  tagName: 'base',