rivet-design 0.17.3 → 0.17.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (798) hide show
  1. package/bin/rivet.js +0 -16
  2. package/dist/agent-variants/SessionStore.d.ts +0 -239
  3. package/dist/agent-variants/SessionStore.d.ts.map +1 -1
  4. package/dist/agent-variants/SessionStore.js +10 -368
  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 +9 -611
  15. package/dist/agent-variants/WorktreeOrchestrator.d.ts.map +1 -1
  16. package/dist/agent-variants/WorktreeOrchestrator.js +111 -1468
  17. package/dist/agent-variants/WorktreeOrchestrator.js.map +1 -1
  18. package/dist/agent-variants/WorktreeOrchestrator.testHelpers.d.ts +0 -7
  19. package/dist/agent-variants/WorktreeOrchestrator.testHelpers.d.ts.map +1 -1
  20. package/dist/agent-variants/WorktreeOrchestrator.testHelpers.js +2 -25
  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 +5 -493
  31. package/dist/agent-variants/contracts.d.ts.map +1 -1
  32. package/dist/agent-variants/contracts.js +2 -167
  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 +0 -6
  71. package/dist/agent-variants/variantContext.d.ts.map +1 -1
  72. package/dist/agent-variants/variantContext.js +0 -9
  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 +0 -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 +3 -3
  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 +31 -102
  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/reference.d.ts +0 -5
  127. package/dist/cli/commands/reference.d.ts.map +1 -1
  128. package/dist/cli/commands/reference.js +0 -27
  129. package/dist/cli/commands/reference.js.map +1 -1
  130. package/dist/cli/commands/serve.d.ts +0 -5
  131. package/dist/cli/commands/serve.d.ts.map +1 -1
  132. package/dist/cli/commands/serve.js +0 -34
  133. package/dist/cli/commands/serve.js.map +1 -1
  134. package/dist/cli/commands/shared.d.ts +0 -16
  135. package/dist/cli/commands/shared.d.ts.map +1 -1
  136. package/dist/cli/commands/shared.js +0 -19
  137. package/dist/cli/commands/shared.js.map +1 -1
  138. package/dist/cli/commands/status.d.ts +0 -6
  139. package/dist/cli/commands/status.d.ts.map +1 -1
  140. package/dist/cli/commands/status.js +0 -11
  141. package/dist/cli/commands/status.js.map +1 -1
  142. package/dist/cli/commands/stop.d.ts +0 -5
  143. package/dist/cli/commands/stop.d.ts.map +1 -1
  144. package/dist/cli/commands/stop.js +0 -6
  145. package/dist/cli/commands/stop.js.map +1 -1
  146. package/dist/cli/commands/update.d.ts +0 -1
  147. package/dist/cli/commands/update.d.ts.map +1 -1
  148. package/dist/cli/commands/update.js +0 -1
  149. package/dist/cli/commands/update.js.map +1 -1
  150. package/dist/cli/commands/variants.d.ts +0 -1
  151. package/dist/cli/commands/variants.d.ts.map +1 -1
  152. package/dist/cli/commands/variants.js +0 -31
  153. package/dist/cli/commands/variants.js.map +1 -1
  154. package/dist/cli/commands/wait.d.ts +0 -21
  155. package/dist/cli/commands/wait.d.ts.map +1 -1
  156. package/dist/cli/commands/wait.js +0 -23
  157. package/dist/cli/commands/wait.js.map +1 -1
  158. package/dist/cli/entry.d.ts +0 -10
  159. package/dist/cli/entry.d.ts.map +1 -1
  160. package/dist/cli/entry.js +0 -13
  161. package/dist/cli/entry.js.map +1 -1
  162. package/dist/cli/envelope.d.ts +1 -25
  163. package/dist/cli/envelope.d.ts.map +1 -1
  164. package/dist/cli/envelope.js +0 -19
  165. package/dist/cli/envelope.js.map +1 -1
  166. package/dist/cli/flags.d.ts +0 -7
  167. package/dist/cli/flags.d.ts.map +1 -1
  168. package/dist/cli/flags.js +0 -7
  169. package/dist/cli/flags.js.map +1 -1
  170. package/dist/cli/handoff.d.ts +0 -33
  171. package/dist/cli/handoff.d.ts.map +1 -1
  172. package/dist/cli/handoff.js +0 -42
  173. package/dist/cli/handoff.js.map +1 -1
  174. package/dist/cli/handoffStore.d.ts +0 -11
  175. package/dist/cli/handoffStore.d.ts.map +1 -1
  176. package/dist/cli/handoffStore.js +0 -10
  177. package/dist/cli/handoffStore.js.map +1 -1
  178. package/dist/cli/hostWorkNextAction.d.ts +0 -11
  179. package/dist/cli/hostWorkNextAction.d.ts.map +1 -1
  180. package/dist/cli/hostWorkNextAction.js +0 -4
  181. package/dist/cli/hostWorkNextAction.js.map +1 -1
  182. package/dist/cli/io.d.ts +0 -9
  183. package/dist/cli/io.d.ts.map +1 -1
  184. package/dist/cli/io.js +0 -1
  185. package/dist/cli/io.js.map +1 -1
  186. package/dist/cli/resolveDefaultNodeEnv.d.ts +0 -5
  187. package/dist/cli/resolveDefaultNodeEnv.d.ts.map +1 -1
  188. package/dist/cli/resolveDefaultNodeEnv.js +0 -5
  189. package/dist/cli/resolveDefaultNodeEnv.js.map +1 -1
  190. package/dist/cli/router.d.ts +0 -21
  191. package/dist/cli/router.d.ts.map +1 -1
  192. package/dist/cli/router.js +0 -46
  193. package/dist/cli/router.js.map +1 -1
  194. package/dist/cli/runnerSelection.d.ts +0 -58
  195. package/dist/cli/runnerSelection.d.ts.map +1 -1
  196. package/dist/cli/runnerSelection.js +0 -16
  197. package/dist/cli/runnerSelection.js.map +1 -1
  198. package/dist/cli/serverHandshake.d.ts +0 -36
  199. package/dist/cli/serverHandshake.d.ts.map +1 -1
  200. package/dist/cli/serverHandshake.js +0 -29
  201. package/dist/cli/serverHandshake.js.map +1 -1
  202. package/dist/cli/serverUnavailable.d.ts +0 -1
  203. package/dist/cli/serverUnavailable.d.ts.map +1 -1
  204. package/dist/cli/serverUnavailable.js +0 -1
  205. package/dist/cli/serverUnavailable.js.map +1 -1
  206. package/dist/cli/serverVersion.d.ts +0 -22
  207. package/dist/cli/serverVersion.d.ts.map +1 -1
  208. package/dist/cli/serverVersion.js +0 -12
  209. package/dist/cli/serverVersion.js.map +1 -1
  210. package/dist/cli/telemetry.d.ts +0 -4
  211. package/dist/cli/telemetry.d.ts.map +1 -1
  212. package/dist/cli/telemetry.js +0 -4
  213. package/dist/cli/telemetry.js.map +1 -1
  214. package/dist/config/evaluateFlags.d.ts +0 -4
  215. package/dist/config/evaluateFlags.d.ts.map +1 -1
  216. package/dist/config/evaluateFlags.js +0 -11
  217. package/dist/config/evaluateFlags.js.map +1 -1
  218. package/dist/config/featureFlagUserKey.d.ts +0 -3
  219. package/dist/config/featureFlagUserKey.d.ts.map +1 -1
  220. package/dist/config/featureFlagUserKey.js +0 -3
  221. package/dist/config/featureFlagUserKey.js.map +1 -1
  222. package/dist/config/flags.d.ts +0 -14
  223. package/dist/config/flags.d.ts.map +1 -1
  224. package/dist/config/flags.js +0 -27
  225. package/dist/config/flags.js.map +1 -1
  226. package/dist/config/proxy.d.ts +0 -3
  227. package/dist/config/proxy.d.ts.map +1 -1
  228. package/dist/config/proxy.js +0 -11
  229. package/dist/config/proxy.js.map +1 -1
  230. package/dist/config/telemetry.d.ts +0 -13
  231. package/dist/config/telemetry.d.ts.map +1 -1
  232. package/dist/config/telemetry.js +0 -13
  233. package/dist/config/telemetry.js.map +1 -1
  234. package/dist/config/telemetryContract.d.ts +0 -1
  235. package/dist/config/telemetryContract.d.ts.map +1 -1
  236. package/dist/config/telemetryContract.js +0 -1
  237. package/dist/config/telemetryContract.js.map +1 -1
  238. package/dist/hosts/workerDefaults.d.ts +0 -69
  239. package/dist/hosts/workerDefaults.d.ts.map +1 -1
  240. package/dist/hosts/workerDefaults.js +0 -68
  241. package/dist/hosts/workerDefaults.js.map +1 -1
  242. package/dist/index-core.d.ts.map +1 -1
  243. package/dist/index-core.js +0 -2
  244. package/dist/index-core.js.map +1 -1
  245. package/dist/index.d.ts +0 -20
  246. package/dist/index.d.ts.map +1 -1
  247. package/dist/index.js +2 -105
  248. package/dist/index.js.map +1 -1
  249. package/dist/install/allowlists.d.ts +0 -32
  250. package/dist/install/allowlists.d.ts.map +1 -1
  251. package/dist/install/allowlists.js +0 -44
  252. package/dist/install/allowlists.js.map +1 -1
  253. package/dist/install/automaticCliUpdate.d.ts +0 -6
  254. package/dist/install/automaticCliUpdate.d.ts.map +1 -1
  255. package/dist/install/automaticCliUpdate.js +0 -13
  256. package/dist/install/automaticCliUpdate.js.map +1 -1
  257. package/dist/install/channelCli.d.ts +0 -1
  258. package/dist/install/channelCli.d.ts.map +1 -1
  259. package/dist/install/channelCli.js +0 -3
  260. package/dist/install/channelCli.js.map +1 -1
  261. package/dist/install/channelManager.d.ts +0 -14
  262. package/dist/install/channelManager.d.ts.map +1 -1
  263. package/dist/install/channelManager.js +0 -22
  264. package/dist/install/channelManager.js.map +1 -1
  265. package/dist/install/codexGuidance.d.ts +0 -1
  266. package/dist/install/codexGuidance.d.ts.map +1 -1
  267. package/dist/install/codexGuidance.js +0 -7
  268. package/dist/install/codexGuidance.js.map +1 -1
  269. package/dist/install/globalBootstrap.d.ts +0 -25
  270. package/dist/install/globalBootstrap.d.ts.map +1 -1
  271. package/dist/install/globalBootstrap.js +0 -10
  272. package/dist/install/globalBootstrap.js.map +1 -1
  273. package/dist/install/harnesses.d.ts +0 -66
  274. package/dist/install/harnesses.d.ts.map +1 -1
  275. package/dist/install/harnesses.js +0 -60
  276. package/dist/install/harnesses.js.map +1 -1
  277. package/dist/install/installationChannel.d.ts +0 -1
  278. package/dist/install/installationChannel.d.ts.map +1 -1
  279. package/dist/install/installationChannel.js +0 -1
  280. package/dist/install/installationChannel.js.map +1 -1
  281. package/dist/install/legacyMcp.d.ts +0 -23
  282. package/dist/install/legacyMcp.d.ts.map +1 -1
  283. package/dist/install/legacyMcp.js +3 -46
  284. package/dist/install/legacyMcp.js.map +1 -1
  285. package/dist/install/mcpRegistration.d.ts +0 -41
  286. package/dist/install/mcpRegistration.d.ts.map +1 -1
  287. package/dist/install/mcpRegistration.js +2 -70
  288. package/dist/install/mcpRegistration.js.map +1 -1
  289. package/dist/library/HubClient.d.ts +0 -2
  290. package/dist/library/HubClient.d.ts.map +1 -1
  291. package/dist/library/HubClient.js +0 -4
  292. package/dist/library/HubClient.js.map +1 -1
  293. package/dist/library/HubServer.d.ts +0 -1
  294. package/dist/library/HubServer.d.ts.map +1 -1
  295. package/dist/library/HubServer.js +0 -1
  296. package/dist/library/HubServer.js.map +1 -1
  297. package/dist/library/StaticPreviewServer.d.ts +0 -1
  298. package/dist/library/StaticPreviewServer.d.ts.map +1 -1
  299. package/dist/library/StaticPreviewServer.js +0 -1
  300. package/dist/library/StaticPreviewServer.js.map +1 -1
  301. package/dist/library/http.d.ts +0 -2
  302. package/dist/library/http.d.ts.map +1 -1
  303. package/dist/library/http.js +0 -2
  304. package/dist/library/http.js.map +1 -1
  305. package/dist/library/importFiles.d.ts +0 -6
  306. package/dist/library/importFiles.d.ts.map +1 -1
  307. package/dist/library/importFiles.js +45 -11
  308. package/dist/library/importFiles.js.map +1 -1
  309. package/dist/mcp/changeBatchClassification.d.ts +0 -40
  310. package/dist/mcp/changeBatchClassification.d.ts.map +1 -1
  311. package/dist/mcp/changeBatchClassification.js +0 -34
  312. package/dist/mcp/changeBatchClassification.js.map +1 -1
  313. package/dist/prompts/commentVariationPrompts.d.ts +0 -5
  314. package/dist/prompts/commentVariationPrompts.d.ts.map +1 -1
  315. package/dist/prompts/commentVariationPrompts.js +0 -5
  316. package/dist/prompts/commentVariationPrompts.js.map +1 -1
  317. package/dist/prototype-host.js +0 -15
  318. package/dist/prototype-host.js.map +1 -1
  319. package/dist/proxy-middleware/preview-bridge.d.ts +0 -2
  320. package/dist/proxy-middleware/preview-bridge.d.ts.map +1 -1
  321. package/dist/proxy-middleware/preview-bridge.js +7 -7
  322. package/dist/proxy-middleware/preview-bridge.js.map +1 -1
  323. package/dist/proxy-middleware/preview-connections.d.ts +8 -0
  324. package/dist/proxy-middleware/preview-connections.d.ts.map +1 -0
  325. package/dist/proxy-middleware/preview-connections.js +29 -0
  326. package/dist/proxy-middleware/preview-connections.js.map +1 -0
  327. package/dist/proxy-middleware/proxy-config.d.ts +0 -12
  328. package/dist/proxy-middleware/proxy-config.d.ts.map +1 -1
  329. package/dist/proxy-middleware/proxy-config.js +41 -90
  330. package/dist/proxy-middleware/proxy-config.js.map +1 -1
  331. package/dist/routes/account.d.ts +0 -1
  332. package/dist/routes/account.d.ts.map +1 -1
  333. package/dist/routes/account.js +0 -2
  334. package/dist/routes/account.js.map +1 -1
  335. package/dist/routes/agentVariants.d.ts +0 -15
  336. package/dist/routes/agentVariants.d.ts.map +1 -1
  337. package/dist/routes/agentVariants.js +14 -325
  338. package/dist/routes/agentVariants.js.map +1 -1
  339. package/dist/routes/cli.d.ts +0 -17
  340. package/dist/routes/cli.d.ts.map +1 -1
  341. package/dist/routes/cli.js +0 -13
  342. package/dist/routes/cli.js.map +1 -1
  343. package/dist/routes/emptyStatePage.d.ts +0 -12
  344. package/dist/routes/emptyStatePage.d.ts.map +1 -1
  345. package/dist/routes/emptyStatePage.js +0 -12
  346. package/dist/routes/emptyStatePage.js.map +1 -1
  347. package/dist/routes/git.d.ts.map +1 -1
  348. package/dist/routes/git.js +0 -13
  349. package/dist/routes/git.js.map +1 -1
  350. package/dist/routes/inlineStartTracker.d.ts +0 -16
  351. package/dist/routes/inlineStartTracker.d.ts.map +1 -1
  352. package/dist/routes/inlineStartTracker.js.map +1 -1
  353. package/dist/routes/integrations.d.ts +0 -6
  354. package/dist/routes/integrations.d.ts.map +1 -1
  355. package/dist/routes/integrations.js +0 -6
  356. package/dist/routes/integrations.js.map +1 -1
  357. package/dist/routes/library/app.d.ts +0 -1
  358. package/dist/routes/library/app.d.ts.map +1 -1
  359. package/dist/routes/library/app.js +0 -1
  360. package/dist/routes/library/app.js.map +1 -1
  361. package/dist/routes/library/index.d.ts +0 -1
  362. package/dist/routes/library/index.d.ts.map +1 -1
  363. package/dist/routes/library/index.js +0 -1
  364. package/dist/routes/library/index.js.map +1 -1
  365. package/dist/routes/library/middleware.d.ts +0 -3
  366. package/dist/routes/library/middleware.d.ts.map +1 -1
  367. package/dist/routes/library/middleware.js +0 -4
  368. package/dist/routes/library/middleware.js.map +1 -1
  369. package/dist/routes/library/navigation.d.ts +0 -1
  370. package/dist/routes/library/navigation.d.ts.map +1 -1
  371. package/dist/routes/library/navigation.js +0 -1
  372. package/dist/routes/library/navigation.js.map +1 -1
  373. package/dist/routes/library/projects.d.ts +0 -1
  374. package/dist/routes/library/projects.d.ts.map +1 -1
  375. package/dist/routes/library/projects.js +0 -1
  376. package/dist/routes/library/projects.js.map +1 -1
  377. package/dist/routes/library/staticPreview.d.ts +0 -1
  378. package/dist/routes/library/staticPreview.d.ts.map +1 -1
  379. package/dist/routes/library/staticPreview.js +0 -1
  380. package/dist/routes/library/staticPreview.js.map +1 -1
  381. package/dist/routes/library/variants.d.ts +0 -1
  382. package/dist/routes/library/variants.d.ts.map +1 -1
  383. package/dist/routes/library/variants.js +0 -1
  384. package/dist/routes/library/variants.js.map +1 -1
  385. package/dist/routes/mcp.d.ts +0 -3
  386. package/dist/routes/mcp.d.ts.map +1 -1
  387. package/dist/routes/mcp.js +3 -4
  388. package/dist/routes/mcp.js.map +1 -1
  389. package/dist/routes/prototypeHost.d.ts +0 -2
  390. package/dist/routes/prototypeHost.d.ts.map +1 -1
  391. package/dist/routes/prototypeHost.js +6 -32
  392. package/dist/routes/prototypeHost.js.map +1 -1
  393. package/dist/routes/static.d.ts +0 -3
  394. package/dist/routes/static.d.ts.map +1 -1
  395. package/dist/routes/static.js +0 -6
  396. package/dist/routes/static.js.map +1 -1
  397. package/dist/routes/support.d.ts +0 -3
  398. package/dist/routes/support.d.ts.map +1 -1
  399. package/dist/routes/support.js +0 -3
  400. package/dist/routes/support.js.map +1 -1
  401. package/dist/server.d.ts +0 -42
  402. package/dist/server.d.ts.map +1 -1
  403. package/dist/server.js +1 -129
  404. package/dist/server.js.map +1 -1
  405. package/dist/services/AuthService.d.ts +0 -76
  406. package/dist/services/AuthService.d.ts.map +1 -1
  407. package/dist/services/AuthService.js +0 -112
  408. package/dist/services/AuthService.js.map +1 -1
  409. package/dist/services/BrowserAgentClient.d.ts +1 -21
  410. package/dist/services/BrowserAgentClient.d.ts.map +1 -1
  411. package/dist/services/BrowserAgentClient.js +0 -10
  412. package/dist/services/BrowserAgentClient.js.map +1 -1
  413. package/dist/services/BundleStore.d.ts +0 -18
  414. package/dist/services/BundleStore.d.ts.map +1 -1
  415. package/dist/services/BundleStore.js +0 -10
  416. package/dist/services/BundleStore.js.map +1 -1
  417. package/dist/services/CliLogForwarder.d.ts +0 -26
  418. package/dist/services/CliLogForwarder.d.ts.map +1 -1
  419. package/dist/services/CliLogForwarder.js +1 -33
  420. package/dist/services/CliLogForwarder.js.map +1 -1
  421. package/dist/services/CommitMessageGenerator.d.ts +0 -6
  422. package/dist/services/CommitMessageGenerator.d.ts.map +1 -1
  423. package/dist/services/CommitMessageGenerator.js +0 -3
  424. package/dist/services/CommitMessageGenerator.js.map +1 -1
  425. package/dist/services/ComponentSearchService.d.ts +2 -16
  426. package/dist/services/ComponentSearchService.d.ts.map +1 -1
  427. package/dist/services/ComponentSearchService.js +2 -56
  428. package/dist/services/ComponentSearchService.js.map +1 -1
  429. package/dist/services/ConfigManager.d.ts +0 -113
  430. package/dist/services/ConfigManager.d.ts.map +1 -1
  431. package/dist/services/ConfigManager.js +0 -101
  432. package/dist/services/ConfigManager.js.map +1 -1
  433. package/dist/services/DependencyPreparationService.d.ts +28 -0
  434. package/dist/services/DependencyPreparationService.d.ts.map +1 -0
  435. package/dist/services/DependencyPreparationService.js +322 -0
  436. package/dist/services/DependencyPreparationService.js.map +1 -0
  437. package/dist/services/DevServerRuntimeService.d.ts +0 -20
  438. package/dist/services/DevServerRuntimeService.d.ts.map +1 -1
  439. package/dist/services/DevServerRuntimeService.js +0 -46
  440. package/dist/services/DevServerRuntimeService.js.map +1 -1
  441. package/dist/services/FeatureFlagService.d.ts +0 -15
  442. package/dist/services/FeatureFlagService.d.ts.map +1 -1
  443. package/dist/services/FeatureFlagService.js +0 -23
  444. package/dist/services/FeatureFlagService.js.map +1 -1
  445. package/dist/services/GatewayClient.d.ts +0 -27
  446. package/dist/services/GatewayClient.d.ts.map +1 -1
  447. package/dist/services/GatewayClient.js +0 -25
  448. package/dist/services/GatewayClient.js.map +1 -1
  449. package/dist/services/HistoryReplayService.d.ts +2 -32
  450. package/dist/services/HistoryReplayService.d.ts.map +1 -1
  451. package/dist/services/HistoryReplayService.js +55 -65
  452. package/dist/services/HistoryReplayService.js.map +1 -1
  453. package/dist/services/HubDiscovery.d.ts +0 -8
  454. package/dist/services/HubDiscovery.d.ts.map +1 -1
  455. package/dist/services/HubDiscovery.js +0 -8
  456. package/dist/services/HubDiscovery.js.map +1 -1
  457. package/dist/services/HubNavigation.d.ts +0 -6
  458. package/dist/services/HubNavigation.d.ts.map +1 -1
  459. package/dist/services/HubNavigation.js +5 -8
  460. package/dist/services/HubNavigation.js.map +1 -1
  461. package/dist/services/IntegrationsClient.d.ts +0 -34
  462. package/dist/services/IntegrationsClient.d.ts.map +1 -1
  463. package/dist/services/IntegrationsClient.js +0 -27
  464. package/dist/services/IntegrationsClient.js.map +1 -1
  465. package/dist/services/LocalGitService.d.ts +0 -57
  466. package/dist/services/LocalGitService.d.ts.map +1 -1
  467. package/dist/services/LocalGitService.js +4 -85
  468. package/dist/services/LocalGitService.js.map +1 -1
  469. package/dist/services/MCPOnboardingTelemetry.d.ts +0 -9
  470. package/dist/services/MCPOnboardingTelemetry.d.ts.map +1 -1
  471. package/dist/services/MCPOnboardingTelemetry.js +0 -9
  472. package/dist/services/MCPOnboardingTelemetry.js.map +1 -1
  473. package/dist/services/MCPVariantsTelemetry.d.ts +0 -2
  474. package/dist/services/MCPVariantsTelemetry.d.ts.map +1 -1
  475. package/dist/services/MCPVariantsTelemetry.js +0 -2
  476. package/dist/services/MCPVariantsTelemetry.js.map +1 -1
  477. package/dist/services/OperatingSystemServices.d.ts +0 -22
  478. package/dist/services/OperatingSystemServices.d.ts.map +1 -1
  479. package/dist/services/OperatingSystemServices.js +22 -80
  480. package/dist/services/OperatingSystemServices.js.map +1 -1
  481. package/dist/services/PRTitleGenerator.d.ts +0 -7
  482. package/dist/services/PRTitleGenerator.d.ts.map +1 -1
  483. package/dist/services/PRTitleGenerator.js +0 -3
  484. package/dist/services/PRTitleGenerator.js.map +1 -1
  485. package/dist/services/ProjectCardPreviews.d.ts +0 -5
  486. package/dist/services/ProjectCardPreviews.d.ts.map +1 -1
  487. package/dist/services/ProjectCardPreviews.js +0 -5
  488. package/dist/services/ProjectCardPreviews.js.map +1 -1
  489. package/dist/services/ProjectDetectionService.d.ts +0 -4
  490. package/dist/services/ProjectDetectionService.d.ts.map +1 -1
  491. package/dist/services/ProjectDetectionService.js +2 -44
  492. package/dist/services/ProjectDetectionService.js.map +1 -1
  493. package/dist/services/ProjectFolderPicker.d.ts +0 -3
  494. package/dist/services/ProjectFolderPicker.d.ts.map +1 -1
  495. package/dist/services/ProjectFolderPicker.js +0 -4
  496. package/dist/services/ProjectFolderPicker.js.map +1 -1
  497. package/dist/services/ProjectImport.d.ts +0 -1
  498. package/dist/services/ProjectImport.d.ts.map +1 -1
  499. package/dist/services/ProjectImport.js +0 -3
  500. package/dist/services/ProjectImport.js.map +1 -1
  501. package/dist/services/ProjectLibrary.d.ts +0 -18
  502. package/dist/services/ProjectLibrary.d.ts.map +1 -1
  503. package/dist/services/ProjectLibrary.js +0 -20
  504. package/dist/services/ProjectLibrary.js.map +1 -1
  505. package/dist/services/ProjectMetadataStore.d.ts +0 -73
  506. package/dist/services/ProjectMetadataStore.d.ts.map +1 -1
  507. package/dist/services/ProjectMetadataStore.js +0 -90
  508. package/dist/services/ProjectMetadataStore.js.map +1 -1
  509. package/dist/services/ProjectPackageManager.d.ts +23 -0
  510. package/dist/services/ProjectPackageManager.d.ts.map +1 -0
  511. package/dist/services/ProjectPackageManager.js +185 -0
  512. package/dist/services/ProjectPackageManager.js.map +1 -0
  513. package/dist/services/ProjectRegistry.d.ts +0 -16
  514. package/dist/services/ProjectRegistry.d.ts.map +1 -1
  515. package/dist/services/ProjectRegistry.js +0 -18
  516. package/dist/services/ProjectRegistry.js.map +1 -1
  517. package/dist/services/ProjectRuntimeService.d.ts +0 -4
  518. package/dist/services/ProjectRuntimeService.d.ts.map +1 -1
  519. package/dist/services/ProjectRuntimeService.js +0 -5
  520. package/dist/services/ProjectRuntimeService.js.map +1 -1
  521. package/dist/services/ProjectScreenshotService.d.ts +0 -5
  522. package/dist/services/ProjectScreenshotService.d.ts.map +1 -1
  523. package/dist/services/ProjectScreenshotService.js +0 -6
  524. package/dist/services/ProjectScreenshotService.js.map +1 -1
  525. package/dist/services/ProjectStorage.d.ts +0 -4
  526. package/dist/services/ProjectStorage.d.ts.map +1 -1
  527. package/dist/services/ProjectStorage.js +0 -4
  528. package/dist/services/ProjectStorage.js.map +1 -1
  529. package/dist/services/PrototypeBuildService.d.ts +1 -23
  530. package/dist/services/PrototypeBuildService.d.ts.map +1 -1
  531. package/dist/services/PrototypeBuildService.js +6 -31
  532. package/dist/services/PrototypeBuildService.js.map +1 -1
  533. package/dist/services/PrototypeDeployService.d.ts +0 -20
  534. package/dist/services/PrototypeDeployService.d.ts.map +1 -1
  535. package/dist/services/PrototypeDeployService.js +1 -24
  536. package/dist/services/PrototypeDeployService.js.map +1 -1
  537. package/dist/services/RequestAuthContext.d.ts +0 -5
  538. package/dist/services/RequestAuthContext.d.ts.map +1 -1
  539. package/dist/services/RequestAuthContext.js +0 -5
  540. package/dist/services/RequestAuthContext.js.map +1 -1
  541. package/dist/services/SessionBridgeService.d.ts.map +1 -1
  542. package/dist/services/SessionBridgeService.js +0 -2
  543. package/dist/services/SessionBridgeService.js.map +1 -1
  544. package/dist/services/SessionService.d.ts +0 -4
  545. package/dist/services/SessionService.d.ts.map +1 -1
  546. package/dist/services/SessionService.js +1 -22
  547. package/dist/services/SessionService.js.map +1 -1
  548. package/dist/services/StaticFileService.d.ts +0 -9
  549. package/dist/services/StaticFileService.d.ts.map +1 -1
  550. package/dist/services/StaticFileService.js +0 -11
  551. package/dist/services/StaticFileService.js.map +1 -1
  552. package/dist/services/StaticLibraryPreviews.d.ts +0 -3
  553. package/dist/services/StaticLibraryPreviews.d.ts.map +1 -1
  554. package/dist/services/StaticLibraryPreviews.js +0 -3
  555. package/dist/services/StaticLibraryPreviews.js.map +1 -1
  556. package/dist/services/StaticPreviewServer.d.ts +0 -16
  557. package/dist/services/StaticPreviewServer.d.ts.map +1 -1
  558. package/dist/services/StaticPreviewServer.js +2 -28
  559. package/dist/services/StaticPreviewServer.js.map +1 -1
  560. package/dist/services/SupabaseAuthService.d.ts +0 -11
  561. package/dist/services/SupabaseAuthService.d.ts.map +1 -1
  562. package/dist/services/SupabaseAuthService.js +0 -11
  563. package/dist/services/SupabaseAuthService.js.map +1 -1
  564. package/dist/services/SupportTicketService.d.ts +0 -4
  565. package/dist/services/SupportTicketService.d.ts.map +1 -1
  566. package/dist/services/SupportTicketService.js +0 -4
  567. package/dist/services/SupportTicketService.js.map +1 -1
  568. package/dist/services/TelemetryService.d.ts +0 -182
  569. package/dist/services/TelemetryService.d.ts.map +1 -1
  570. package/dist/services/TelemetryService.js +0 -193
  571. package/dist/services/TelemetryService.js.map +1 -1
  572. package/dist/services/TreeStore.d.ts +0 -72
  573. package/dist/services/TreeStore.d.ts.map +1 -1
  574. package/dist/services/TreeStore.js +2 -101
  575. package/dist/services/TreeStore.js.map +1 -1
  576. package/dist/services/VariantGenerationService.d.ts +0 -32
  577. package/dist/services/VariantGenerationService.d.ts.map +1 -1
  578. package/dist/services/VariantGenerationService.js +5 -62
  579. package/dist/services/VariantGenerationService.js.map +1 -1
  580. package/dist/services/VariantHistoryService.d.ts +0 -114
  581. package/dist/services/VariantHistoryService.d.ts.map +1 -1
  582. package/dist/services/VariantHistoryService.js +2 -144
  583. package/dist/services/VariantHistoryService.js.map +1 -1
  584. package/dist/services/VariantRunService.d.ts +0 -31
  585. package/dist/services/VariantRunService.d.ts.map +1 -1
  586. package/dist/services/VariantRunService.js +0 -35
  587. package/dist/services/VariantRunService.js.map +1 -1
  588. package/dist/services/VariantsRuntime.d.ts +0 -3
  589. package/dist/services/VariantsRuntime.d.ts.map +1 -1
  590. package/dist/services/VariantsRuntime.js +0 -5
  591. package/dist/services/VariantsRuntime.js.map +1 -1
  592. package/dist/services/WorktreeManager.d.ts +1 -220
  593. package/dist/services/WorktreeManager.d.ts.map +1 -1
  594. package/dist/services/WorktreeManager.js +75 -372
  595. package/dist/services/WorktreeManager.js.map +1 -1
  596. package/dist/services/accessTokenRefresh.d.ts +0 -25
  597. package/dist/services/accessTokenRefresh.d.ts.map +1 -1
  598. package/dist/services/accessTokenRefresh.js +0 -25
  599. package/dist/services/accessTokenRefresh.js.map +1 -1
  600. package/dist/services/adapters/TailwindTokenAdapter.d.ts +0 -29
  601. package/dist/services/adapters/TailwindTokenAdapter.d.ts.map +1 -1
  602. package/dist/services/adapters/TailwindTokenAdapter.js +1 -46
  603. package/dist/services/adapters/TailwindTokenAdapter.js.map +1 -1
  604. package/dist/services/createAgentVariantsOrchestrator.d.ts +0 -18
  605. package/dist/services/createAgentVariantsOrchestrator.d.ts.map +1 -1
  606. package/dist/services/createAgentVariantsOrchestrator.js +0 -22
  607. package/dist/services/createAgentVariantsOrchestrator.js.map +1 -1
  608. package/dist/services/extractors/CSSVariableExtractor.d.ts +0 -25
  609. package/dist/services/extractors/CSSVariableExtractor.d.ts.map +1 -1
  610. package/dist/services/extractors/CSSVariableExtractor.js +1 -42
  611. package/dist/services/extractors/CSSVariableExtractor.js.map +1 -1
  612. package/dist/services/historyRoots.d.ts +0 -12
  613. package/dist/services/historyRoots.d.ts.map +1 -1
  614. package/dist/services/historyRoots.js +0 -13
  615. package/dist/services/historyRoots.js.map +1 -1
  616. package/dist/services/libraryErrors.d.ts +0 -1
  617. package/dist/services/libraryErrors.d.ts.map +1 -1
  618. package/dist/services/libraryErrors.js +0 -1
  619. package/dist/services/libraryErrors.js.map +1 -1
  620. package/dist/services/pendingLogin.d.ts +0 -13
  621. package/dist/services/pendingLogin.d.ts.map +1 -1
  622. package/dist/services/pendingLogin.js +0 -3
  623. package/dist/services/pendingLogin.js.map +1 -1
  624. package/dist/services/staticProjectTarget.d.ts +0 -4
  625. package/dist/services/staticProjectTarget.d.ts.map +1 -1
  626. package/dist/services/staticProjectTarget.js +0 -4
  627. package/dist/services/staticProjectTarget.js.map +1 -1
  628. package/dist/services/staticStarter.d.ts +0 -20
  629. package/dist/services/staticStarter.d.ts.map +1 -1
  630. package/dist/services/staticStarter.js +0 -20
  631. package/dist/services/staticStarter.js.map +1 -1
  632. package/dist/services/templates/designCatalog.d.ts +0 -11
  633. package/dist/services/templates/designCatalog.d.ts.map +1 -1
  634. package/dist/services/templates/designCatalog.js +0 -26
  635. package/dist/services/templates/designCatalog.js.map +1 -1
  636. package/dist/services/templates/viteReactTs.d.ts +0 -26
  637. package/dist/services/templates/viteReactTs.d.ts.map +1 -1
  638. package/dist/services/templates/viteReactTs.js +0 -20
  639. package/dist/services/templates/viteReactTs.js.map +1 -1
  640. package/dist/storage/library/BundleMetadataStore.d.ts +0 -16
  641. package/dist/storage/library/BundleMetadataStore.d.ts.map +1 -1
  642. package/dist/storage/library/BundleMetadataStore.js +0 -17
  643. package/dist/storage/library/BundleMetadataStore.js.map +1 -1
  644. package/dist/storage/library/CoordinatorRecords.d.ts +0 -9
  645. package/dist/storage/library/CoordinatorRecords.d.ts.map +1 -1
  646. package/dist/storage/library/CoordinatorRecords.js +0 -9
  647. package/dist/storage/library/CoordinatorRecords.js.map +1 -1
  648. package/dist/storage/library/ProjectPreviewCache.d.ts +0 -4
  649. package/dist/storage/library/ProjectPreviewCache.d.ts.map +1 -1
  650. package/dist/storage/library/ProjectPreviewCache.js +0 -4
  651. package/dist/storage/library/ProjectPreviewCache.js.map +1 -1
  652. package/dist/storage/library/ProjectRecords.d.ts +0 -17
  653. package/dist/storage/library/ProjectRecords.d.ts.map +1 -1
  654. package/dist/storage/library/ProjectRecords.js +0 -17
  655. package/dist/storage/library/ProjectRecords.js.map +1 -1
  656. package/dist/storage/library/database.d.ts +0 -3
  657. package/dist/storage/library/database.d.ts.map +1 -1
  658. package/dist/storage/library/database.js +0 -3
  659. package/dist/storage/library/database.js.map +1 -1
  660. package/dist/storage/library/migrations.d.ts +0 -2
  661. package/dist/storage/library/migrations.d.ts.map +1 -1
  662. package/dist/storage/library/migrations.js +0 -2
  663. package/dist/storage/library/migrations.js.map +1 -1
  664. package/dist/storage/library/sourcePresentation.d.ts +0 -1
  665. package/dist/storage/library/sourcePresentation.d.ts.map +1 -1
  666. package/dist/storage/library/sourcePresentation.js +0 -1
  667. package/dist/storage/library/sourcePresentation.js.map +1 -1
  668. package/dist/storage/project-metadata/ProjectMetadataRecords.d.ts +0 -11
  669. package/dist/storage/project-metadata/ProjectMetadataRecords.d.ts.map +1 -1
  670. package/dist/storage/project-metadata/ProjectMetadataRecords.js +0 -13
  671. package/dist/storage/project-metadata/ProjectMetadataRecords.js.map +1 -1
  672. package/dist/storage/project-metadata/database.d.ts +0 -1
  673. package/dist/storage/project-metadata/database.d.ts.map +1 -1
  674. package/dist/storage/project-metadata/database.js +0 -7
  675. package/dist/storage/project-metadata/database.js.map +1 -1
  676. package/dist/storage/project-metadata/migrations.d.ts +0 -42
  677. package/dist/storage/project-metadata/migrations.d.ts.map +1 -1
  678. package/dist/storage/project-metadata/migrations.js +0 -41
  679. package/dist/storage/project-metadata/migrations.js.map +1 -1
  680. package/dist/types/account.d.ts +0 -1
  681. package/dist/types/account.d.ts.map +1 -1
  682. package/dist/types/change-request-types.d.ts +0 -167
  683. package/dist/types/change-request-types.d.ts.map +1 -1
  684. package/dist/types/change-types.d.ts +0 -1
  685. package/dist/types/change-types.d.ts.map +1 -1
  686. package/dist/types/change-types.js +0 -1
  687. package/dist/types/change-types.js.map +1 -1
  688. package/dist/types/project-library.d.ts +0 -1
  689. package/dist/types/project-library.d.ts.map +1 -1
  690. package/dist/types/style-manipulation-types.d.ts +0 -69
  691. package/dist/types/style-manipulation-types.d.ts.map +1 -1
  692. package/dist/types/style-manipulation-types.js +0 -26
  693. package/dist/types/style-manipulation-types.js.map +1 -1
  694. package/dist/types/token-types.d.ts +0 -30
  695. package/dist/types/token-types.d.ts.map +1 -1
  696. package/dist/types/token-types.js +0 -1
  697. package/dist/types/token-types.js.map +1 -1
  698. package/dist/types/variant-history.d.ts +0 -39
  699. package/dist/types/variant-history.d.ts.map +1 -1
  700. package/dist/utils/branchNames.d.ts +0 -1
  701. package/dist/utils/branchNames.d.ts.map +1 -1
  702. package/dist/utils/branchNames.js +0 -2
  703. package/dist/utils/branchNames.js.map +1 -1
  704. package/dist/utils/cloneOrCopyDirSync.d.ts +0 -12
  705. package/dist/utils/cloneOrCopyDirSync.d.ts.map +1 -1
  706. package/dist/utils/cloneOrCopyDirSync.js +1 -15
  707. package/dist/utils/cloneOrCopyDirSync.js.map +1 -1
  708. package/dist/utils/devServerCommand.d.ts +0 -23
  709. package/dist/utils/devServerCommand.d.ts.map +1 -1
  710. package/dist/utils/devServerCommand.js +0 -24
  711. package/dist/utils/devServerCommand.js.map +1 -1
  712. package/dist/utils/devServerError.d.ts +2 -16
  713. package/dist/utils/devServerError.d.ts.map +1 -1
  714. package/dist/utils/devServerError.js +4 -17
  715. package/dist/utils/devServerError.js.map +1 -1
  716. package/dist/utils/displayLocale.d.ts +0 -2
  717. package/dist/utils/displayLocale.d.ts.map +1 -1
  718. package/dist/utils/displayLocale.js +0 -2
  719. package/dist/utils/displayLocale.js.map +1 -1
  720. package/dist/utils/elementFileHintSignals.d.ts +0 -5
  721. package/dist/utils/elementFileHintSignals.d.ts.map +1 -1
  722. package/dist/utils/elementFileHintSignals.js +0 -5
  723. package/dist/utils/elementFileHintSignals.js.map +1 -1
  724. package/dist/utils/formatElementTargetingContext.d.ts +0 -6
  725. package/dist/utils/formatElementTargetingContext.d.ts.map +1 -1
  726. package/dist/utils/formatElementTargetingContext.js +3 -9
  727. package/dist/utils/formatElementTargetingContext.js.map +1 -1
  728. package/dist/utils/hostAgentEnv.d.ts +0 -17
  729. package/dist/utils/hostAgentEnv.d.ts.map +1 -1
  730. package/dist/utils/hostAgentEnv.js +0 -17
  731. package/dist/utils/hostAgentEnv.js.map +1 -1
  732. package/dist/utils/htmlDocument.d.ts +2 -8
  733. package/dist/utils/htmlDocument.d.ts.map +1 -1
  734. package/dist/utils/htmlDocument.js +20 -16
  735. package/dist/utils/htmlDocument.js.map +1 -1
  736. package/dist/utils/internalGitIdentity.d.ts +2 -0
  737. package/dist/utils/internalGitIdentity.d.ts.map +1 -0
  738. package/dist/utils/internalGitIdentity.js +12 -0
  739. package/dist/utils/internalGitIdentity.js.map +1 -0
  740. package/dist/utils/logger.d.ts +0 -5
  741. package/dist/utils/logger.d.ts.map +1 -1
  742. package/dist/utils/logger.js +2 -19
  743. package/dist/utils/logger.js.map +1 -1
  744. package/dist/utils/loginShellPath.d.ts +0 -9
  745. package/dist/utils/loginShellPath.d.ts.map +1 -1
  746. package/dist/utils/loginShellPath.js +0 -69
  747. package/dist/utils/loginShellPath.js.map +1 -1
  748. package/dist/utils/loopback.d.ts +0 -1
  749. package/dist/utils/loopback.d.ts.map +1 -1
  750. package/dist/utils/loopback.js +0 -1
  751. package/dist/utils/loopback.js.map +1 -1
  752. package/dist/utils/pid.d.ts +0 -1
  753. package/dist/utils/pid.d.ts.map +1 -1
  754. package/dist/utils/pid.js +0 -1
  755. package/dist/utils/pid.js.map +1 -1
  756. package/dist/utils/portUtils.d.ts +1 -14
  757. package/dist/utils/portUtils.d.ts.map +1 -1
  758. package/dist/utils/portUtils.js +1 -21
  759. package/dist/utils/portUtils.js.map +1 -1
  760. package/dist/utils/queueAccess.d.ts +0 -9
  761. package/dist/utils/queueAccess.d.ts.map +1 -1
  762. package/dist/utils/queueAccess.js +0 -9
  763. package/dist/utils/queueAccess.js.map +1 -1
  764. package/dist/utils/skillWriter.d.ts +0 -17
  765. package/dist/utils/skillWriter.d.ts.map +1 -1
  766. package/dist/utils/skillWriter.js +0 -20
  767. package/dist/utils/skillWriter.js.map +1 -1
  768. package/dist/utils/skills/claude-skill.d.ts +0 -5
  769. package/dist/utils/skills/claude-skill.d.ts.map +1 -1
  770. package/dist/utils/skills/claude-skill.js +0 -5
  771. package/dist/utils/skills/claude-skill.js.map +1 -1
  772. package/dist/utils/skills/cli-guidance.d.ts +0 -8
  773. package/dist/utils/skills/cli-guidance.d.ts.map +1 -1
  774. package/dist/utils/skills/cli-guidance.js +0 -8
  775. package/dist/utils/skills/cli-guidance.js.map +1 -1
  776. package/dist/utils/skills/cursor-rules.d.ts +0 -6
  777. package/dist/utils/skills/cursor-rules.d.ts.map +1 -1
  778. package/dist/utils/skills/cursor-rules.js +0 -6
  779. package/dist/utils/skills/cursor-rules.js.map +1 -1
  780. package/dist/utils/variantPreviewPort.d.ts +0 -3
  781. package/dist/utils/variantPreviewPort.d.ts.map +1 -1
  782. package/dist/utils/variantPreviewPort.js +0 -3
  783. package/dist/utils/variantPreviewPort.js.map +1 -1
  784. package/dist/utils/windowPlacement.d.ts +0 -4
  785. package/dist/utils/windowPlacement.d.ts.map +1 -1
  786. package/dist/utils/windowPlacement.js +0 -4
  787. package/dist/utils/windowPlacement.js.map +1 -1
  788. package/package.json +15 -14
  789. package/scripts/verify-node-version.cjs +0 -3
  790. package/src/ui/dist/assets/{LibraryApp-PQNnarmo.js → LibraryApp-x6PbzlGr.js} +1 -1
  791. package/src/ui/dist/assets/{main-C7hdsU-C.js → main-BW1Odsqp.js} +76 -76
  792. package/src/ui/dist/assets/main-DDQRZm89.css +1 -0
  793. package/src/ui/dist/index.html +2 -2
  794. package/dist/utils/skills/describe-motion-protocol.d.ts +0 -10
  795. package/dist/utils/skills/describe-motion-protocol.d.ts.map +0 -1
  796. package/dist/utils/skills/describe-motion-protocol.js +0 -231
  797. package/dist/utils/skills/describe-motion-protocol.js.map +0 -1
  798. package/src/ui/dist/assets/main-BUZjlAHd.css +0 -1
@@ -31,16 +31,6 @@ const htmlDocument_1 = require("../utils/htmlDocument");
31
31
  const log = (0, logger_1.createLogger)('AgentVariantsRouter');
32
32
  const DIRECTION_TITLE_MAX_WORDS = 5;
33
33
  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
34
  const PREVIEW_CDN_HOSTS = [
45
35
  'https://unpkg.com',
46
36
  'https://cdn.jsdelivr.net',
@@ -48,40 +38,6 @@ const PREVIEW_CDN_HOSTS = [
48
38
  'https://esm.sh',
49
39
  'https://cdn.skypack.dev',
50
40
  ].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
41
  const buildStaticPreviewCsp = (parentFrameOrigin, libraryOrigin) => {
86
42
  const frameAncestors = ["'self'", parentFrameOrigin, libraryOrigin]
87
43
  .filter(Boolean)
@@ -100,6 +56,7 @@ const buildStaticPreviewCsp = (parentFrameOrigin, libraryOrigin) => {
100
56
  };
101
57
  const previewPortBody = v3_1.z.object({
102
58
  variantId: v3_1.z.string().min(1).nullable(),
59
+ retry: v3_1.z.boolean().optional(),
103
60
  });
104
61
  const commitBody = v3_1.z.object({
105
62
  variantId: v3_1.z.string().min(1),
@@ -252,9 +209,7 @@ const inlineVariantBody = v3_1.z.object({
252
209
  .passthrough())
253
210
  .min(1),
254
211
  sourceFiles: v3_1.z.array(v3_1.z.string()).optional(),
255
- /** Vary on an existing variant: attaches to the active session. */
256
212
  target: inlineVariantTargetSchema.optional(),
257
- /** Vary on an HTML-only static preview: forks it via the refine flow. */
258
213
  staticPreviewTarget: inlineStaticPreviewTargetSchema.optional(),
259
214
  telemetryContext: v3_1.z
260
215
  .object({
@@ -265,9 +220,6 @@ const inlineVariantBody = v3_1.z.object({
265
220
  traceId: v3_1.z.string().optional(),
266
221
  agentRunId: v3_1.z.string().optional(),
267
222
  initiator: inlineInitiatorSchema,
268
- /** Explicit per-request worker runtime choice ("run my workers on opus
269
- * from this Codex session"). Flag-relayed by the host agent, never
270
- * inferred — see WorkerSelection in change-request-types. */
271
223
  workerSelection: v3_1.z
272
224
  .object({
273
225
  provider: v3_1.z.enum(['claude', 'codex', 'cursor']).optional(),
@@ -287,17 +239,12 @@ const hostVariantCompleteBody = v3_1.z.object({
287
239
  title: v3_1.z.string().min(1).max(120).optional(),
288
240
  description: v3_1.z.string().min(1).max(400).optional(),
289
241
  });
290
- // Shared by the active-session and history rename routes. Trim first so a
291
- // whitespace-only title is rejected, and cap the length so an over-long label
292
- // can't bloat the snapshot or the on-disk manifest.
293
242
  const renameLabelSchema = v3_1.z.preprocess((v) => (typeof v === 'string' ? v.trim() : v), v3_1.z.string().min(1).max(120));
294
243
  const renameBody = v3_1.z.object({
295
244
  label: renameLabelSchema,
296
245
  projectPath: v3_1.z.string().optional(),
297
246
  });
298
247
  const RENAME_VALIDATION_MESSAGE = 'Invalid rename — `label` must be a non-empty string of at most 120 characters.';
299
- // Run-folder rename — one call re-homes one session request batch, live and
300
- // history alike; the client never fans out per-variant.
301
248
  const renameRunBody = v3_1.z.object({
302
249
  sessionId: v3_1.z.string().min(1),
303
250
  requestId: v3_1.z.string().min(1).optional(),
@@ -305,10 +252,6 @@ const renameRunBody = v3_1.z.object({
305
252
  label: renameLabelSchema,
306
253
  projectPath: v3_1.z.string().optional(),
307
254
  });
308
- // The variants panel's UI arrangement (pinned items + user-arranged order),
309
- // persisted as one metadata_state row in the project's rivet.db. Keys are
310
- // panel-owned opaque strings (`row:…`/`group:…` pin keys, group keys, row
311
- // keys); the caps only bound a runaway payload, not the shape's semantics.
312
255
  const uiStateKeySchema = v3_1.z.string().min(1).max(500);
313
256
  const uiStateSchema = v3_1.z.object({
314
257
  pinned: v3_1.z.array(uiStateKeySchema).max(1000),
@@ -325,20 +268,6 @@ const uiStatePutBody = v3_1.z.object({
325
268
  uiState: uiStateSchema,
326
269
  projectPath: v3_1.z.string().optional(),
327
270
  });
328
- /**
329
- * Express routes that back the iframe variants chip.
330
- *
331
- * - GET /api/variants/active — current active session state for the chip
332
- * - GET /api/variants/:sessionId — explicit session lookup
333
- * - POST /api/variants/:sessionId/preview-port — switch proxy to a variant's
334
- * dev server (or null to restore the user's default dev server)
335
- * - GET /api/variants/:sessionId/static/:variantId — serve static preview HTML
336
- * - GET /api/variants/:sessionId/design-md/:artifactId — serve raw DESIGN.md
337
- * - GET /api/variants/:sessionId/design-md/:artifactId/view — serve DesignMD page
338
- * - POST /api/variants/:sessionId/commit — user picked this variant in the
339
- * chip; orchestrator enqueues the diff onto pending changes
340
- * - POST /api/variants/:sessionId/cancel — dismiss the variants session
341
- */
342
271
  const HISTORY_STATUSES = new Set([
343
272
  'completed',
344
273
  'committed',
@@ -363,16 +292,10 @@ const escapeHtml = (value) => value.replace(/[&<>"']/g, (char) => {
363
292
  return char;
364
293
  }
365
294
  });
366
- /**
367
- * Selects the best persisted human label to describe a public variant share.
368
- */
369
295
  const getVariantShareTitle = (manifest) => {
370
296
  const title = [manifest.label, manifest.brief, manifest.sessionPrompt].find((candidate) => candidate.trim().length > 0);
371
297
  return (0, PrototypeDeployService_1.normalizePrototypeShareTitle)(title) ?? VARIANT_SHARE_TITLE_FALLBACK;
372
298
  };
373
- /**
374
- * Selects the run prompt for a public canvas share, with a stable fallback.
375
- */
376
299
  const getCanvasShareTitle = (sessionPrompt) => {
377
300
  return ((0, PrototypeDeployService_1.normalizePrototypeShareTitle)(sessionPrompt) ?? CANVAS_SHARE_TITLE_FALLBACK);
378
301
  };
@@ -380,9 +303,6 @@ const CANVAS_IFRAME_SANDBOX = 'allow-scripts allow-forms allow-popups';
380
303
  const RIVET_SOCIAL_IMAGE_URL = 'https://rivet.design/images/rivet-social.png';
381
304
  const RIVET_DEFAULT_SHARE_DESCRIPTION = 'Built with Rivet — the visual editor for design';
382
305
  const UNSUPPORTED_PROTOTYPE_DEPLOY_MESSAGE = "This prototype can't be deployed — only buildable app directions or static previews are supported.";
383
- /**
384
- * Render a public canvas page that puts every deployed direction in one shareable view.
385
- */
386
306
  const buildCanvasShareHtml = (args) => {
387
307
  const prompt = args.sessionPrompt.trim();
388
308
  const variantCards = args.variants
@@ -538,7 +458,6 @@ ${variantCards}
538
458
  </body>
539
459
  </html>`;
540
460
  };
541
- /** Resolve a Rivet-generated subproject path to the workspace that owns variant history. */
542
461
  const generatedProjectWorkspaceRoot = (projectPath) => {
543
462
  const normalized = path_1.default.normalize(projectPath);
544
463
  const segments = normalized.split(path_1.default.sep);
@@ -549,14 +468,6 @@ const generatedProjectWorkspaceRoot = (projectPath) => {
549
468
  const rootPath = segments.slice(0, rivetIndex).join(path_1.default.sep);
550
469
  return path_1.default.resolve(rootPath || path_1.default.parse(normalized).root);
551
470
  };
552
- /**
553
- * Stamp the live {@link WatcherLiveness} onto a variants snapshot so the UI can
554
- * detect a stale host-agent watch loop off real queue/waiter state. Applied to
555
- * BOTH active and inactive snapshots — a change can strand with no variants
556
- * session active — while the variant FIFO depth (`pendingVariantRequests`) is
557
- * still only stamped on active snapshots, preserving prior behavior. Returns
558
- * the snapshot untouched when no liveness is available (no bridge).
559
- */
560
471
  const stampWatcherLiveness = (snapshot, liveness, pendingVariantRequestCount, activeLeases = []) => {
561
472
  if (!liveness || typeof snapshot !== 'object' || snapshot === null) {
562
473
  return snapshot;
@@ -578,19 +489,11 @@ const stampWatcherLiveness = (snapshot, liveness, pendingVariantRequestCount, ac
578
489
  exports.stampWatcherLiveness = stampWatcherLiveness;
579
490
  const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHistoryOverride, deployServiceOverride, variantRunService, historyReplayOverride, previewBridge, inlineStartTrackerOverride) => {
580
491
  const router = (0, express_1.Router)();
581
- // `agent_variants.*` events from this router (preview switches, active-project
582
- // transitions) must carry the browser's PostHog $session_id to link to a
583
- // session replay; the bridge holds it. Falls back to raw telemetry when no
584
- // bridge is wired (e.g. demo mounts), where no browser session is available.
585
492
  const variantsTelemetry = telemetry && bridge
586
493
  ? (0, createAgentVariantsOrchestrator_1.withVariantsSessionReplayLinking)(telemetry, bridge)
587
494
  : telemetry;
588
495
  const variantHistory = variantHistoryOverride ?? new VariantHistoryService_1.VariantHistoryService();
589
496
  const deployService = deployServiceOverride ?? new PrototypeDeployService_1.PrototypeDeployService();
590
- // Replay shares the orchestrator's WorktreeManager instance: the
591
- // reserved-but-not-yet-bound port set is per-instance, so a separate
592
- // manager could hand a live variant's pending port to a replay
593
- // (EADDRINUSE for whichever binds second).
594
497
  const historyReplay = historyReplayOverride ??
595
498
  new HistoryReplayService_1.HistoryReplayService({
596
499
  history: variantHistory,
@@ -612,11 +515,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
612
515
  }
613
516
  next();
614
517
  });
615
- /**
616
- * Stamp the live watcher liveness onto a snapshot before it leaves the server.
617
- * The `typeof` guards keep partial bridge mocks (and a missing bridge) from
618
- * throwing — production always has the real bridge methods.
619
- */
620
518
  const stampLiveness = (snapshot) => (0, exports.stampWatcherLiveness)(snapshot, bridge && typeof bridge.getWatcherLiveness === 'function'
621
519
  ? bridge.getWatcherLiveness()
622
520
  : null, bridge && typeof bridge.pendingVariantRequestCount === 'function'
@@ -630,7 +528,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
630
528
  }
631
529
  return bridge?.getProjectPath() ?? null;
632
530
  };
633
- /** Resolve every project root that can own history for the requested route. */
634
531
  const resolveHistoryProjectPaths = (params) => {
635
532
  const seen = new Set();
636
533
  const candidates = [];
@@ -655,15 +552,10 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
655
552
  }
656
553
  }
657
554
  catch {
658
- // Persisted sessions may outlive in-memory orchestrator state.
659
555
  }
660
556
  }
661
557
  const upwardRoot = generatedProjectWorkspaceRoot(params.projectPath);
662
558
  addCandidate(upwardRoot);
663
- // Rediscover fresh-session workdirs nested under a repo root. Without this,
664
- // a stop/restart drops the in-memory session (and its `workspacePath`), so
665
- // reopening the root — whose own `.rivet/variants` is empty — would surface
666
- // none of the directions stored under `<root>/.rivet/<slug>/.rivet/variants`.
667
559
  for (const scanRoot of [params.projectPath, upwardRoot]) {
668
560
  if (!scanRoot)
669
561
  continue;
@@ -700,15 +592,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
700
592
  }
701
593
  return { kind: 'existing', projectPath: args.projectPath };
702
594
  };
703
- /**
704
- * Resolve a variant reference whose session is no longer active from
705
- * persisted history and adopt it — into the usable active session, or a
706
- * fresh one — so targeted requests keep working after restarts and newer
707
- * runs. This is the same adoption flow the editor uses when a past
708
- * direction is edited; the CLI/agent path simply reuses it.
709
- */
710
- /** @effect Rejects a request that would displace or mutate an actively
711
- * generating session. Ready/terminal sessions rotate normally. */
712
595
  const rejectBlockedVariantSession = (res, snapshot) => {
713
596
  if (!(0, variantSessionStart_1.isVariantSessionStartBlocked)(snapshot))
714
597
  return false;
@@ -716,9 +599,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
716
599
  const sessionId = snapshot.active === true ? snapshot.sessionId : undefined;
717
600
  res.status(400).json({
718
601
  error: 'Variants session already active',
719
- // Name the blocker so callers are not flying blind, and never
720
- // recommend cancel as remediation: cancelling to unblock destroys
721
- // the user's in-progress work. Only a human should decide that.
722
602
  details: `A variants session is active${sessionId
723
603
  ? ` (session ${sessionId}${stage ? `, stage ${stage}` : ''})`
724
604
  : ''}. Wait for it to settle (poll status), target it with --target to refine it, or ask the user before cancelling anything.`,
@@ -762,8 +642,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
762
642
  'its artifact instead.',
763
643
  };
764
644
  }
765
- // The history lookup is async — a run may have started meanwhile. Never
766
- // adopt into (or displace) a session that is actively generating.
767
645
  const raceSnapshot = orchestrator.buildActiveSnapshot();
768
646
  if ((0, variantSessionStart_1.isVariantSessionStartBlocked)(raceSnapshot)) {
769
647
  return { ok: false, kind: 'blocked', snapshot: raceSnapshot };
@@ -799,9 +677,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
799
677
  });
800
678
  return true;
801
679
  };
802
- /**
803
- * Resolve the saved app directory a deploy build should run from.
804
- */
805
680
  const resolveDeployableAppDir = async (args) => {
806
681
  const manifest = args.variant.manifest;
807
682
  if (manifest.projectKind === 'fresh' &&
@@ -824,9 +699,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
824
699
  }
825
700
  return appDir;
826
701
  };
827
- /**
828
- * Deploy one persisted variant and append the returned public URL to history.
829
- */
830
702
  const deployPersistedVariant = async (args) => {
831
703
  const existingDeployments = args.variant.manifest.deployments ?? [];
832
704
  const latestDeployment = existingDeployments.length > 0
@@ -848,8 +720,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
848
720
  const title = getVariantShareTitle(args.variant.manifest);
849
721
  let result;
850
722
  if (preview.kind === 'static') {
851
- // Already a built static bundle (e.g. a history static-preview variant)
852
- // — upload files/ directly, no build needed.
853
723
  result = await deployService.deployStatic(filesDir, {
854
724
  title,
855
725
  entryPath: preview.entryPath,
@@ -909,13 +779,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
909
779
  });
910
780
  return;
911
781
  }
912
- // Resolve a variant target that points at an HTML-only static preview:
913
- // those requests fork through the refine flow rather than code-gen (a
914
- // static preview has no worktree to edit). Gate on the TRUE work-item kind
915
- // — never on HTML presence or the client's claim: an existing-project
916
- // `code_gen` variant materialized as a static preview serves HTML and
917
- // displays as `static_artifact`, but owns a worktree and MUST fork via the
918
- // code_gen path (the static fork would reject it with VARIANT_NOT_EDITABLE).
919
782
  const batchTarget = parsed.data.target;
920
783
  const claimedStaticTarget = parsed.data.staticPreviewTarget ??
921
784
  (batchTarget
@@ -954,20 +817,10 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
954
817
  return;
955
818
  }
956
819
  const activeVariantsSession = orchestrator.buildActiveSnapshot();
957
- // A targeted request against the CURRENTLY active session attaches to it
958
- // directly. A reference to any other session — the originating session
959
- // ended, the server restarted, or a newer run replaced it — resolves
960
- // through persisted history: adopt the snapshot (into the usable active
961
- // session, or a fresh one) and retarget the request at the adopted live
962
- // variant. Copied variant references stay actionable for their whole
963
- // lifetime, not just while their session is in memory.
964
820
  let effectiveTarget = batchTarget ?? staticPreviewTarget;
965
821
  const isPersistedTargetRequest = Boolean(effectiveTarget &&
966
822
  (activeVariantsSession.active !== true ||
967
823
  effectiveTarget.sessionId !== activeVariantsSession.sessionId));
968
- // Adoption creates or mutates a session, so persisted-target requests
969
- // follow the same intake rules as untargeted starts: never displace an
970
- // actively generating session, and never race an in-flight start.
971
824
  if ((isPersistedTargetRequest || !effectiveTarget) &&
972
825
  rejectBlockedVariantSession(res, activeVariantsSession)) {
973
826
  return;
@@ -1028,10 +881,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1028
881
  variantId: adoption.workItemId,
1029
882
  }
1030
883
  : undefined;
1031
- // Rewrite EVERY pointer at the dead reference — the batch-level
1032
- // fields and the per-change `target`/`staticPreviewTarget` pair the
1033
- // editor sends (the refine flow prefers the per-change static target,
1034
- // so leaving it stale would aim the refine at the ended session).
1035
884
  const matchesStaleTarget = (candidate) => Boolean(candidate &&
1036
885
  candidate.sessionId === staleTarget.sessionId &&
1037
886
  candidate.variantId === staleTarget.variantId);
@@ -1061,16 +910,17 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1061
910
  };
1062
911
  effectiveTarget = liveTarget;
1063
912
  }
913
+ const refineStaticPreviewBatch = variantRunService.refineStaticPreviewBatch?.bind(variantRunService);
1064
914
  const isStaticPreviewFork = Boolean(request.staticPreviewTarget);
1065
- if (isStaticPreviewFork && !variantRunService.refineStaticPreviewBatch) {
915
+ if (isStaticPreviewFork && !refineStaticPreviewBatch) {
1066
916
  res.status(503).json({
1067
917
  error: 'Static preview refinement unavailable',
1068
918
  reason: 'inline_variants_unavailable',
1069
919
  });
1070
920
  return;
1071
921
  }
1072
- const result = isStaticPreviewFork
1073
- ? await variantRunService.refineStaticPreviewBatch(request)
922
+ const result = isStaticPreviewFork && refineStaticPreviewBatch
923
+ ? await refineStaticPreviewBatch(request)
1074
924
  : await variantRunService.startElementVariants(request);
1075
925
  if (!result.success) {
1076
926
  res.status(500).json({
@@ -1146,16 +996,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1146
996
  starting: inlineStartTracker.isStarting(),
1147
997
  }));
1148
998
  });
1149
- /**
1150
- * Server-Sent Events stream for the iframe chip. Pushes a fresh
1151
- * ActiveSnapshot whenever the orchestrator's state changes (propose,
1152
- * approve, report-complete, dev-server-up, terminal, cancel, commit) so
1153
- * the chip never has to poll.
1154
- *
1155
- * Heartbeats every 30s as comments (`: heartbeat\n\n`) to keep
1156
- * intermediate proxies from killing the connection on idle. EventSource
1157
- * auto-reconnects on disconnect.
1158
- */
1159
999
  router.get('/variants/events', (req, res) => {
1160
1000
  if (rejectNonLocalRequest(req, res))
1161
1001
  return;
@@ -1166,10 +1006,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1166
1006
  'X-Accel-Buffering': 'no',
1167
1007
  });
1168
1008
  res.flushHeaders?.();
1169
- // Stamp each snapshot with the live variant-request FIFO depth + watcher
1170
- // liveness. Both live on the bridge (not the orchestrator), so
1171
- // buildActiveSnapshot() can't fill them in — we add them here at write time
1172
- // so the initial state and every subscribed update carry them.
1173
1009
  const writeSnapshot = (snapshot) => {
1174
1010
  try {
1175
1011
  const activeSnapshot = snapshot && typeof snapshot === 'object'
@@ -1184,20 +1020,13 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1184
1020
  log.warn('SSE write failed (client likely disconnected)', err);
1185
1021
  }
1186
1022
  };
1187
- // Initial state so the chip can render immediately.
1188
1023
  writeSnapshot(orchestrator.buildActiveSnapshot());
1189
1024
  const unsubscribe = orchestrator.subscribeToEvents(writeSnapshot);
1190
- // Re-push on bridge queue/waiter changes too. A change the user sends with
1191
- // no host agent draining it never produces an orchestrator event, so
1192
- // without this the stale-watcher banner would never see the strand.
1193
1025
  const unsubscribeLiveness = bridge && typeof bridge.onWatcherLivenessChange === 'function'
1194
1026
  ? bridge.onWatcherLivenessChange(() => {
1195
1027
  writeSnapshot(orchestrator.buildActiveSnapshot());
1196
1028
  })
1197
1029
  : undefined;
1198
- // A live SSE subscriber means a Rivet page is open; track it so the MCP
1199
- // server can skip re-opening a duplicate browser tab when the variants flow
1200
- // re-enters an already-active editor session.
1201
1030
  const releaseUiClient = orchestrator.registerUiClient();
1202
1031
  const heartbeat = setInterval(() => {
1203
1032
  try {
@@ -1205,7 +1034,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1205
1034
  res.write(': heartbeat\n\n');
1206
1035
  }
1207
1036
  catch {
1208
- // ignore — close handler will clean up
1209
1037
  }
1210
1038
  }, 30_000);
1211
1039
  req.on('close', () => {
@@ -1217,7 +1045,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1217
1045
  res.end();
1218
1046
  }
1219
1047
  catch {
1220
- // already ended
1221
1048
  }
1222
1049
  });
1223
1050
  });
@@ -1253,11 +1080,7 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1253
1080
  return;
1254
1081
  }
1255
1082
  try {
1256
- const entries = (await Promise.all(resolveHistoryProjectPaths({ projectPath }).map((historyProjectPath) =>
1257
- // Reads the SQLite metadata index when it's usable and falls
1258
- // back to the manifest walk otherwise — same entries, faster
1259
- // list. Detail/preview routes stay manifest/file-backed.
1260
- variantHistory.listVariantsFromIndex({
1083
+ const entries = (await Promise.all(resolveHistoryProjectPaths({ projectPath }).map((historyProjectPath) => variantHistory.listVariantsFromIndex({
1261
1084
  projectPath: historyProjectPath,
1262
1085
  status: statusParam,
1263
1086
  })))).flat();
@@ -1267,10 +1090,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1267
1090
  }
1268
1091
  const uniqueEntries = Array.from(entriesById.values()).sort((a, b) => b.manifest.createdAt.localeCompare(a.manifest.createdAt));
1269
1092
  const limitedEntries = limit !== undefined ? uniqueEntries.slice(0, limit) : uniqueEntries;
1270
- // Removed and cancelled variants are retained on disk but never surfaced
1271
- // in the default history list. Keeps dismissed and cancelled directions
1272
- // hidden once the session is no longer active, matching the
1273
- // list_past_variants MCP tool.
1274
1093
  const visibleEntries = statusParam === 'removed'
1275
1094
  ? limitedEntries
1276
1095
  : limitedEntries.filter((entry) => entry.manifest.status !== 'removed' &&
@@ -1295,14 +1114,8 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1295
1114
  preview: entry.manifest.preview,
1296
1115
  artifact: entry.manifest.artifact,
1297
1116
  parentVariant: entry.manifest.parentVariant,
1298
- // Tree-store fields (absent on legacy entries): `serve` tells the
1299
- // panel how a tree-backed entry previews (static → history preview
1300
- // route; dev-server → the replay run route), `hasTree` marks the
1301
- // entry as snapshot-backed at all.
1302
1117
  ...(entry.manifest.serve ? { serve: entry.manifest.serve } : {}),
1303
1118
  hasTree: Boolean(entry.manifest.tree),
1304
- // The runtime that built this direction (vendor/model/effort) —
1305
- // absent on legacy entries and host-agent-executed variants.
1306
1119
  ...(entry.manifest.runtime
1307
1120
  ? { runtime: entry.manifest.runtime }
1308
1121
  : {}),
@@ -1313,10 +1126,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1313
1126
  sendError(res, err);
1314
1127
  }
1315
1128
  });
1316
- // The variants panel's UI arrangement (pins + custom order). Stored in the
1317
- // project's rivet.db metadata_state — per-project and shared across
1318
- // browsers, unlike the panel's other localStorage preferences. Not
1319
- // rebuildable: losing the database resets the arrangement.
1320
1129
  router.get('/variants/ui-state', async (req, res) => {
1321
1130
  if (rejectNonLocalRequest(req, res))
1322
1131
  return;
@@ -1336,7 +1145,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1336
1145
  stored = JSON.parse(raw);
1337
1146
  }
1338
1147
  catch {
1339
- // A corrupt row reads as "nothing stored" — the next PUT heals it.
1340
1148
  }
1341
1149
  }
1342
1150
  const parsed = uiStateSchema.safeParse(stored);
@@ -1376,13 +1184,8 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1376
1184
  sendError(res, err);
1377
1185
  }
1378
1186
  });
1379
- // The entry route resolves the saved document's canonical URL. HTML files
1380
- // served below that URL receive the document policy and preview bridge.
1381
1187
  router.get('/variants/history/:sessionId/:variantId/preview', async (req, res) => serveHistoryPreview(req, res, variantHistory, resolveProjectPath, resolveHistoryProjectPaths, { isDocument: true }, previewBridge));
1382
1188
  router.get('/variants/history/:sessionId/:variantId/preview/{*assetPath}', async (req, res) => serveHistoryPreview(req, res, variantHistory, resolveProjectPath, resolveHistoryProjectPaths, { isDocument: false }, previewBridge));
1383
- // Stop history replay servers. Registered before the
1384
- // parameterized history routes purely for clarity — method+arity keep it
1385
- // unambiguous either way.
1386
1189
  router.post('/variants/history/replay/stop', async (req, res) => {
1387
1190
  if (rejectNonLocalRequest(req, res))
1388
1191
  return;
@@ -1396,12 +1199,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1396
1199
  }
1397
1200
  res.json({ stopped: true });
1398
1201
  });
1399
- /**
1400
- * Boot a past dev-server variant from its tree-store ref: materialize the
1401
- * exact tree, overlay runtime (.env / node_modules), start the persisted
1402
- * serve recipe, and optionally retarget the main preview proxy at the new
1403
- * port. See docs/variant-history-tree-store-design.md.
1404
- */
1405
1202
  router.post('/variants/history/:sessionId/:variantId/run', async (req, res) => {
1406
1203
  if (rejectNonLocalRequest(req, res))
1407
1204
  return;
@@ -1553,7 +1350,7 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1553
1350
  }
1554
1351
  let port = orchestrator.getDevServerPort(sessionId, parsed.data.variantId);
1555
1352
  if (typeof port !== 'number') {
1556
- port = await orchestrator.restoreVariantPreview(sessionId, parsed.data.variantId);
1353
+ port = await orchestrator.restoreVariantPreview(sessionId, parsed.data.variantId, { retryFailed: parsed.data.retry === true });
1557
1354
  }
1558
1355
  variantsTelemetry?.trackAgentVariantsPreviewSwitchStarted({
1559
1356
  sessionId,
@@ -1602,13 +1399,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1602
1399
  sendError(res, err);
1603
1400
  }
1604
1401
  });
1605
- /**
1606
- * Adopt a PAST (history) variant into the active session as a first-class
1607
- * succeeded variant, so the user's first edit on a selected past direction
1608
- * routes to a real session member. Resolves the persisted snapshot from
1609
- * history, then hands the rehydration `files/` dir to the orchestrator. The
1610
- * UI calls this on first comment/Vary against a selected past variant.
1611
- */
1612
1402
  router.post('/variants/adopt-past', async (req, res) => {
1613
1403
  if (rejectNonLocalRequest(req, res))
1614
1404
  return;
@@ -1754,43 +1544,21 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1754
1544
  });
1755
1545
  return;
1756
1546
  }
1757
- // Only inject `<base href>` when the variant actually has sibling
1758
- // assets to serve. Otherwise the inlined HTML is self-contained and
1759
- // the base tag would only serve to mis-resolve any incidental
1760
- // relative URLs (e.g. `<a href="something">`) against the asset
1761
- // sub-path. The hasAssets check also avoids the trailing-slash
1762
- // fragment-link quirk for the common no-assets case.
1763
1547
  const hasAssets = orchestrator.hasStaticPreviewAssets(sessionId, variantId);
1764
1548
  if (hasAssets &&
1765
1549
  !req.originalUrl.includes('?') &&
1766
1550
  !req.originalUrl.endsWith('/')) {
1767
- // Document URL must end in `/` so the browser's `document.URL` and
1768
- // the `<base href>` agree. Otherwise fragment-only links
1769
- // (`<a href="#section">`) resolve to the base-href URL — different
1770
- // from the current URL — and the browser does a full navigation,
1771
- // hitting the asset route with an empty path → 404. Redirect to
1772
- // the canonical trailing-slash form before serving.
1773
1551
  res.redirect(301, req.originalUrl + '/');
1774
1552
  return;
1775
1553
  }
1776
1554
  const withBaseHref = hasAssets
1777
- ? injectBaseHref(html,
1778
- // Trailing slash is required so `./avatar.glb` resolves to
1779
- // `.../static/<vid>/avatar.glb`, not `.../static/avatar.glb`.
1780
- `/api/variants/${encodeURIComponent(sessionId)}/static/${encodeURIComponent(variantId)}/`)
1555
+ ? injectBaseHref(html, `/api/variants/${encodeURIComponent(sessionId)}/static/${encodeURIComponent(variantId)}/`)
1781
1556
  : html;
1782
- // In embedded mode the visual editor drives this iframe over the preview
1783
- // bridge; without the injected listener, selecting/commenting on the
1784
- // variant times out (`Preview bridge timed out`) and the comment input
1785
- // never opens. Mirror the base static route (`routes/static.ts`).
1786
1557
  const finalHtml = previewBridge?.isEnabled
1787
1558
  ? (0, preview_bridge_1.injectPreviewBridge)(withBaseHref, {
1788
1559
  expectedParentOrigin: previewBridge.expectedParentOrigin,
1789
1560
  })
1790
1561
  : withBaseHref;
1791
- // Constrain the blast radius of agent-generated scripts. See
1792
- // buildStaticPreviewCsp for the policy and the isolated-origin migration
1793
- // that will eventually let us drop the per-CDN allowlist.
1794
1562
  res
1795
1563
  .status(200)
1796
1564
  .type('html')
@@ -1870,13 +1638,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1870
1638
  sendError(res, err);
1871
1639
  }
1872
1640
  });
1873
- /**
1874
- * Serve sibling assets the variant's HTML references (e.g. `./avatar.glb`,
1875
- * `./hero.png`). The agent reports `output.assetBase` alongside the inline
1876
- * HTML; the orchestrator sandboxes it inside the fresh-session workspace
1877
- * and exposes a resolver. Path-traversal-rejected requests + missing files
1878
- * return 404. Loopback-only.
1879
- */
1880
1641
  router.get('/variants/:sessionId/static/:variantId/{*assetPath}', (req, res) => {
1881
1642
  if (rejectNonLocalRequest(req, res))
1882
1643
  return;
@@ -1894,10 +1655,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1894
1655
  });
1895
1656
  return;
1896
1657
  }
1897
- // `dotfiles: 'allow'` because workspacePath is typically nested
1898
- // under a `.rivet/` directory (Rivet's per-project state dir) —
1899
- // sendFile's default 'ignore' setting 404s anything with a hidden
1900
- // segment, which would always trigger here.
1901
1658
  res.sendFile(abs, {
1902
1659
  dotfiles: 'allow',
1903
1660
  headers: { 'Cache-Control': 'no-store' },
@@ -1956,14 +1713,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
1956
1713
  }
1957
1714
  try {
1958
1715
  bridge.rebindProjectPath(result.destinationPath);
1959
- // Do NOT call switchPreviewPort(null) here on the fresh vite_app
1960
- // path: commitVariant has already spawned a fresh dev server at
1961
- // destinationPath and retargeted the proxy to its port via the
1962
- // orchestrator's switchPreviewPort callback. Calling null here
1963
- // would route the proxy to the default upstream (the user's repo,
1964
- // which has no dev server) and the iframe would show "preview
1965
- // disconnected" — exactly the regression we're fixing. The
1966
- // committed dev server lives until the next propose / shutdown.
1967
1716
  await orchestrator.cleanupCommittedSession(sessionId);
1968
1717
  variantsTelemetry?.trackAgentVariantsActiveProjectTransition({
1969
1718
  sessionId,
@@ -2001,18 +1750,10 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2001
1750
  sendError(res, err);
2002
1751
  }
2003
1752
  });
2004
- /**
2005
- * Deploy a fresh-project (Vite) variant to the public Prototype Preview Host
2006
- * and return a shareable URL. Builds locally, uploads the static bundle with
2007
- * the user's Rivet JWT, and records the deployment in the variant manifest so
2008
- * the chip can re-show ("Copy link") without rebuilding.
2009
- */
2010
1753
  router.post('/variants/:sessionId/deploy', async (req, res) => {
2011
1754
  if (rejectNonLocalRequest(req, res))
2012
1755
  return;
2013
1756
  const sessionId = req.params.sessionId;
2014
- // Gated behind the `deployPrototype` flag (default off). Mirrors the UI
2015
- // gate so the endpoint can't be driven while the feature is dark.
2016
1757
  const flags = await (0, evaluateFlags_1.getFeatureFlags)({
2017
1758
  userKey: (0, featureFlagUserKey_1.getConfigFeatureFlagUserKey)({ headers: req.headers }),
2018
1759
  });
@@ -2081,11 +1822,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2081
1822
  });
2082
1823
  }
2083
1824
  });
2084
- /**
2085
- * Deploy a fresh-project canvas to the public Prototype Preview Host. The
2086
- * canvas page embeds every requested direction so one public URL can be used
2087
- * for review instead of sharing one URL per variant.
2088
- */
2089
1825
  router.post('/variants/:sessionId/canvas/deploy', async (req, res) => {
2090
1826
  if (rejectNonLocalRequest(req, res))
2091
1827
  return;
@@ -2247,9 +1983,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2247
1983
  sendError(res, err);
2248
1984
  }
2249
1985
  });
2250
- // Remove a single variant from the UI: hides it from the active snapshot for
2251
- // good while retaining it in `.rivet/variants/` as `removed`. Distinct from
2252
- // /cancel (which tears down the whole session).
2253
1986
  router.post('/variants/:sessionId/:variantId/remove', async (req, res) => {
2254
1987
  if (rejectNonLocalRequest(req, res))
2255
1988
  return;
@@ -2262,8 +1995,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2262
1995
  sendError(res, err);
2263
1996
  }
2264
1997
  });
2265
- // Rename a live (active-session) variant. Patches the in-memory work item and
2266
- // its on-disk manifest, then re-pushes the snapshot over SSE.
2267
1998
  router.post('/variants/:sessionId/:variantId/rename', async (req, res) => {
2268
1999
  if (rejectNonLocalRequest(req, res))
2269
2000
  return;
@@ -2288,8 +2019,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2288
2019
  sendError(res, err);
2289
2020
  }
2290
2021
  });
2291
- // Rename one run request batch across live state and every resolved history
2292
- // root in one call.
2293
2022
  router.post('/variants/runs/rename', async (req, res) => {
2294
2023
  if (rejectNonLocalRequest(req, res))
2295
2024
  return;
@@ -2313,8 +2042,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2313
2042
  });
2314
2043
  liveRenamedCount = result.renamedCount;
2315
2044
  }
2316
- // History is best-effort even without a resolvable project path — a
2317
- // fresh-session run may have nothing persisted yet.
2318
2045
  const projectPath = resolveProjectPath(parsed.data.projectPath);
2319
2046
  let historyRenamedCount = 0;
2320
2047
  if (projectPath) {
@@ -2338,9 +2065,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2338
2065
  sendError(res, err);
2339
2066
  }
2340
2067
  });
2341
- // Rename a past (history) variant — no active session involved, so this writes
2342
- // straight to the persisted manifest. Takes the workspace projectPath the same
2343
- // way the history list/preview routes do.
2344
2068
  router.post('/variants/history/:sessionId/:variantId/rename', async (req, res) => {
2345
2069
  if (rejectNonLocalRequest(req, res))
2346
2070
  return;
@@ -2386,10 +2110,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2386
2110
  sendError(res, err);
2387
2111
  }
2388
2112
  });
2389
- // Remove a past (history) variant — flips its persisted manifest to `removed`
2390
- // so it drops out of the default history list. Non-destructive: the snapshot
2391
- // stays on disk, matching the active-session remove flow. Takes the workspace
2392
- // projectPath the same way the other history routes do.
2393
2113
  router.post('/variants/history/:sessionId/:variantId/remove', async (req, res) => {
2394
2114
  if (rejectNonLocalRequest(req, res))
2395
2115
  return;
@@ -2423,13 +2143,6 @@ const createAgentVariantsRouter = (orchestrator, bridge, telemetry, variantHisto
2423
2143
  return router;
2424
2144
  };
2425
2145
  exports.createAgentVariantsRouter = createAgentVariantsRouter;
2426
- /**
2427
- * Serve one saved static preview file from a variant history snapshot.
2428
- *
2429
- * The entry route redirects to the saved HTML filename so relative embeds,
2430
- * assets and fragment links resolve naturally. HTML responses carry the
2431
- * preview CSP and bridge; other sibling assets carry neither.
2432
- */
2433
2146
  const serveHistoryPreview = async (req, res, variantHistory, resolveProjectPath, resolveHistoryProjectPaths, { isDocument }, previewBridge) => {
2434
2147
  if (rejectNonLocalRequest(req, res))
2435
2148
  return;
@@ -2487,17 +2200,11 @@ const serveHistoryPreview = async (req, res, variantHistory, resolveProjectPath,
2487
2200
  return;
2488
2201
  }
2489
2202
  if (isDocument) {
2490
- // Give the history entry its saved filename as the browser's document URL:
2491
- // /preview -> /preview/pages/index.html makes ./demo.html resolve under
2492
- // /preview/pages/. A <base> tag would also retarget fragment-only links
2493
- // such as #details, which must stay within the displayed document.
2494
2203
  const previewRoot = `/api/variants/history/${encodeURIComponent(sessionId)}/${encodeURIComponent(variantId)}/preview/`;
2495
- // Encode filenames (including spaces and #) without encoding directory separators.
2496
2204
  const entryPath = file.relativePath
2497
2205
  .split('/')
2498
2206
  .map(encodeURIComponent)
2499
2207
  .join('/');
2500
- // Keep preview options and project lookup parameters through the redirect.
2501
2208
  const queryIndex = req.originalUrl.indexOf('?');
2502
2209
  const query = queryIndex === -1 ? '' : req.originalUrl.slice(queryIndex);
2503
2210
  res
@@ -2507,16 +2214,11 @@ const serveHistoryPreview = async (req, res, variantHistory, resolveProjectPath,
2507
2214
  }
2508
2215
  const contentType = path_1.default.extname(file.absolutePath) || 'html';
2509
2216
  res.status(200).type(contentType).set('Cache-Control', 'no-store');
2510
- // HTML siblings can be embedded documents too, so they need the same
2511
- // permissions as the entry. CSS, scripts and images retain their raw bytes.
2512
2217
  if (/\.html?$/i.test(file.relativePath)) {
2513
2218
  const html = file.body.toString('utf8');
2514
2219
  res
2515
2220
  .set('Content-Security-Policy', buildStaticPreviewCsp(previewBridge?.expectedParentOrigin, previewBridge?.resolveLibraryOrigin?.()))
2516
2221
  .set('X-Content-Type-Options', 'nosniff');
2517
- // Embedded mode drives this snapshot iframe over the preview bridge; the
2518
- // listener must be present or selecting/commenting on a past variant
2519
- // times out (`Preview bridge timed out`). Matches the live static route.
2520
2222
  if (previewBridge?.isEnabled) {
2521
2223
  res.send((0, preview_bridge_1.injectPreviewBridge)(html, {
2522
2224
  expectedParentOrigin: previewBridge.expectedParentOrigin,
@@ -2539,10 +2241,6 @@ const serveHistoryPreview = async (req, res, variantHistory, resolveProjectPath,
2539
2241
  sendError(res, err);
2540
2242
  }
2541
2243
  };
2542
- /**
2543
- * Validates the raw history-preview URL suffix before Express can normalize an
2544
- * encoded traversal segment away from req.params.
2545
- */
2546
2244
  const getInvalidRawHistoryPreviewAssetPath = (req) => {
2547
2245
  const rawPath = req.originalUrl.split('?')[0] ?? '';
2548
2246
  const marker = '/preview/';
@@ -2564,9 +2262,6 @@ const getInvalidRawHistoryPreviewAssetPath = (req) => {
2564
2262
  }
2565
2263
  return null;
2566
2264
  };
2567
- /**
2568
- * Resolve a child path while rejecting paths that escape the intended root.
2569
- */
2570
2265
  const resolvePathWithinRoot = (rootPath, childPath) => {
2571
2266
  const absolutePath = path_1.default.resolve(rootPath, childPath);
2572
2267
  const relativePath = path_1.default.relative(rootPath, absolutePath);
@@ -2638,21 +2333,15 @@ const toActiveProjectContext = (projectContext) => {
2638
2333
  : {}),
2639
2334
  };
2640
2335
  };
2641
- /** Map persisted artifact shape to the public history summary kind. */
2642
2336
  const manifestKind = (manifest) => {
2643
2337
  return manifest.artifact.kind === 'diff' ? 'diff' : 'project-created';
2644
2338
  };
2645
- /**
2646
- * Inject a `<base href>` tag into the variant HTML so relative URLs
2647
- * resolve against the asset-serving sub-path. Idempotent: if the HTML
2648
- * already declares a `<base>` tag we leave it alone (the agent opted in
2649
- * to its own resolution rules). Documents without a head tag receive the base
2650
- * after their html tag or doctype, outside any embedded markup.
2651
- */
2652
- const injectBaseHref = (html, baseHref) => (0, htmlDocument_1.insertHtmlHeadElement)(html, {
2653
- tagName: 'base',
2654
- markup: `<base href="${baseHref.replace(/"/g, '&quot;')}">`,
2655
- });
2339
+ const injectBaseHref = (html, baseHref) => (0, htmlDocument_1.insertHtmlHeadElements)(html, [
2340
+ {
2341
+ tagName: 'base',
2342
+ markup: `<base href="${baseHref.replace(/"/g, '&quot;')}">`,
2343
+ },
2344
+ ]);
2656
2345
  function sendError(res, err) {
2657
2346
  if (err instanceof agent_variants_1.AgentVariantsError) {
2658
2347
  log.warn(`agent-variants route error: ${err.code}: ${err.detail}`);