veryfront 0.1.1237 → 0.1.1239

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 (493) hide show
  1. package/esm/cli/auth/login.d.ts +24 -2
  2. package/esm/cli/auth/login.d.ts.map +1 -1
  3. package/esm/cli/auth/login.js +444 -35
  4. package/esm/cli/commands/build/error-handler.d.ts.map +1 -1
  5. package/esm/cli/commands/build/error-handler.js +41 -3
  6. package/esm/cli/commands/build/handler.d.ts.map +1 -1
  7. package/esm/cli/commands/build/handler.js +1 -1
  8. package/esm/cli/commands/dev/command.d.ts.map +1 -1
  9. package/esm/cli/commands/dev/command.js +14 -1
  10. package/esm/cli/commands/dev/inference-status.d.ts +6 -0
  11. package/esm/cli/commands/dev/inference-status.d.ts.map +1 -1
  12. package/esm/cli/commands/dev/inference-status.js +14 -2
  13. package/esm/cli/commands/generate/command.d.ts.map +1 -1
  14. package/esm/cli/commands/generate/command.js +61 -0
  15. package/esm/cli/commands/init/init-command.d.ts.map +1 -1
  16. package/esm/cli/commands/init/init-command.js +23 -31
  17. package/esm/cli/commands/install/registry.d.ts.map +1 -1
  18. package/esm/cli/commands/install/registry.js +6 -9
  19. package/esm/cli/commands/login/command-help.d.ts.map +1 -1
  20. package/esm/cli/commands/login/command-help.js +3 -1
  21. package/esm/cli/commands/pull/command.d.ts +1 -0
  22. package/esm/cli/commands/pull/command.d.ts.map +1 -1
  23. package/esm/cli/commands/pull/command.js +49 -6
  24. package/esm/cli/commands/push/command-help.d.ts.map +1 -1
  25. package/esm/cli/commands/push/command-help.js +7 -0
  26. package/esm/cli/commands/push/command.d.ts +23 -12
  27. package/esm/cli/commands/push/command.d.ts.map +1 -1
  28. package/esm/cli/commands/push/command.js +461 -44
  29. package/esm/cli/commands/push/plan.d.ts +35 -0
  30. package/esm/cli/commands/push/plan.d.ts.map +1 -0
  31. package/esm/cli/commands/push/plan.js +96 -0
  32. package/esm/cli/commands/schedule/handler.d.ts +21 -2
  33. package/esm/cli/commands/schedule/handler.d.ts.map +1 -1
  34. package/esm/cli/commands/schedule/handler.js +74 -27
  35. package/esm/cli/commands/schema/command-help.js +1 -1
  36. package/esm/cli/commands/up/command.js +1 -1
  37. package/esm/cli/commands/webhook/handler.d.ts.map +1 -1
  38. package/esm/cli/commands/webhook/handler.js +3 -1
  39. package/esm/cli/router.d.ts.map +1 -1
  40. package/esm/cli/router.js +27 -5
  41. package/esm/cli/shared/args.d.ts +15 -1
  42. package/esm/cli/shared/args.d.ts.map +1 -1
  43. package/esm/cli/shared/args.js +56 -3
  44. package/esm/cli/shared/config.d.ts +11 -2
  45. package/esm/cli/shared/config.d.ts.map +1 -1
  46. package/esm/cli/shared/config.js +72 -27
  47. package/esm/cli/shared/project-creation.js +1 -1
  48. package/esm/cli/sync/state.d.ts +20 -0
  49. package/esm/cli/sync/state.d.ts.map +1 -0
  50. package/esm/cli/sync/state.js +193 -0
  51. package/esm/deno.js +2 -2
  52. package/esm/extensions/ext-llm-anthropic/src/anthropic-request-builder.d.ts.map +1 -1
  53. package/esm/extensions/ext-llm-anthropic/src/anthropic-request-builder.js +852 -21
  54. package/esm/extensions/ext-observability-sentry/src/policy.d.ts +2 -0
  55. package/esm/extensions/ext-observability-sentry/src/policy.d.ts.map +1 -1
  56. package/esm/extensions/ext-observability-sentry/src/policy.js +214 -3
  57. package/esm/src/agent/conversation/delegation-policy.d.ts +2 -0
  58. package/esm/src/agent/conversation/delegation-policy.d.ts.map +1 -1
  59. package/esm/src/agent/conversation/delegation-policy.js +13 -3
  60. package/esm/src/agent/conversation/hosted-terminal.d.ts.map +1 -1
  61. package/esm/src/agent/conversation/hosted-terminal.js +6 -2
  62. package/esm/src/agent/conversation/run-chunk-mirror.d.ts.map +1 -1
  63. package/esm/src/agent/conversation/run-chunk-mirror.js +14 -2
  64. package/esm/src/agent/factory.d.ts.map +1 -1
  65. package/esm/src/agent/factory.js +22 -11
  66. package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts +2 -0
  67. package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts.map +1 -1
  68. package/esm/src/agent/hosted/chat-runtime-tool-assembly.js +6 -1
  69. package/esm/src/agent/hosted/child-fork-execution-runner.d.ts +2 -1
  70. package/esm/src/agent/hosted/child-fork-execution-runner.d.ts.map +1 -1
  71. package/esm/src/agent/hosted/child-fork-execution-runner.js +6 -3
  72. package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts +12 -3
  73. package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts.map +1 -1
  74. package/esm/src/agent/hosted/child-fork-step-message-preparation.js +16 -3
  75. package/esm/src/agent/hosted/cloud-agent-chat-execution.d.ts +1 -1
  76. package/esm/src/agent/hosted/cloud-agent-chat-execution.d.ts.map +1 -1
  77. package/esm/src/agent/hosted/cloud-agent-chat-execution.js +3 -3
  78. package/esm/src/agent/hosted/cloud-agent-child-tools.d.ts +11 -0
  79. package/esm/src/agent/hosted/cloud-agent-child-tools.d.ts.map +1 -1
  80. package/esm/src/agent/hosted/cloud-agent-child-tools.js +2 -3
  81. package/esm/src/agent/hosted/cloud-agent-config.d.ts +1 -0
  82. package/esm/src/agent/hosted/cloud-agent-config.d.ts.map +1 -1
  83. package/esm/src/agent/hosted/cloud-runtime-system-messages.d.ts +16 -1
  84. package/esm/src/agent/hosted/cloud-runtime-system-messages.d.ts.map +1 -1
  85. package/esm/src/agent/hosted/cloud-runtime-system-messages.js +13 -3
  86. package/esm/src/agent/hosted/default-chat-runtime.d.ts +2 -1
  87. package/esm/src/agent/hosted/default-chat-runtime.d.ts.map +1 -1
  88. package/esm/src/agent/hosted/default-chat-runtime.js +18 -7
  89. package/esm/src/agent/hosted/default-invoke-agent-tool.d.ts +2 -1
  90. package/esm/src/agent/hosted/default-invoke-agent-tool.d.ts.map +1 -1
  91. package/esm/src/agent/hosted/default-invoke-agent-tool.js +11 -3
  92. package/esm/src/agent/hosted/default-project-steering-refresh.d.ts +2 -1
  93. package/esm/src/agent/hosted/default-project-steering-refresh.d.ts.map +1 -1
  94. package/esm/src/agent/hosted/default-project-steering-refresh.js +4 -1
  95. package/esm/src/agent/hosted/runtime-state-resolver.d.ts +6 -4
  96. package/esm/src/agent/hosted/runtime-state-resolver.d.ts.map +1 -1
  97. package/esm/src/agent/hosted/runtime-state-resolver.js +8 -11
  98. package/esm/src/agent/index.d.ts +3 -3
  99. package/esm/src/agent/index.d.ts.map +1 -1
  100. package/esm/src/agent/project/agent-runtime.d.ts.map +1 -1
  101. package/esm/src/agent/project/agent-runtime.js +6 -3
  102. package/esm/src/agent/runtime/agent-definition.d.ts +68 -66
  103. package/esm/src/agent/runtime/agent-definition.d.ts.map +1 -1
  104. package/esm/src/agent/runtime/agent-definition.js +15 -2
  105. package/esm/src/agent/runtime/agent-invocation-contract.d.ts +2 -0
  106. package/esm/src/agent/runtime/agent-invocation-contract.d.ts.map +1 -1
  107. package/esm/src/agent/runtime/agent-markdown-adapter.js +1 -1
  108. package/esm/src/agent/runtime/agent-runtime-step.d.ts +11 -5
  109. package/esm/src/agent/runtime/agent-runtime-step.d.ts.map +1 -1
  110. package/esm/src/agent/runtime/agent-runtime-step.js +23 -6
  111. package/esm/src/agent/runtime/call-context.d.ts +42 -11
  112. package/esm/src/agent/runtime/call-context.d.ts.map +1 -1
  113. package/esm/src/agent/runtime/call-context.js +480 -42
  114. package/esm/src/agent/runtime/chat-stream-handler.d.ts +18 -0
  115. package/esm/src/agent/runtime/chat-stream-handler.d.ts.map +1 -1
  116. package/esm/src/agent/runtime/chat-stream-handler.js +38 -18
  117. package/esm/src/agent/runtime/effective-agent-system.d.ts +13 -4
  118. package/esm/src/agent/runtime/effective-agent-system.d.ts.map +1 -1
  119. package/esm/src/agent/runtime/effective-agent-system.js +29 -0
  120. package/esm/src/agent/runtime/index.d.ts +1 -0
  121. package/esm/src/agent/runtime/index.d.ts.map +1 -1
  122. package/esm/src/agent/runtime/index.js +638 -53
  123. package/esm/src/agent/runtime/load-skill-tool.d.ts +33 -3
  124. package/esm/src/agent/runtime/load-skill-tool.d.ts.map +1 -1
  125. package/esm/src/agent/runtime/load-skill-tool.js +152 -21
  126. package/esm/src/agent/runtime/model-resolution.d.ts +3 -0
  127. package/esm/src/agent/runtime/model-resolution.d.ts.map +1 -1
  128. package/esm/src/agent/runtime/model-resolution.js +14 -0
  129. package/esm/src/agent/runtime/model-transport.d.ts +1 -0
  130. package/esm/src/agent/runtime/model-transport.d.ts.map +1 -1
  131. package/esm/src/agent/runtime/model-transport.js +5 -2
  132. package/esm/src/agent/runtime/run-runtime-context.d.ts +4 -0
  133. package/esm/src/agent/runtime/run-runtime-context.d.ts.map +1 -1
  134. package/esm/src/agent/runtime/run-runtime-context.js +9 -3
  135. package/esm/src/agent/runtime/runtime-tool-config.d.ts +1 -0
  136. package/esm/src/agent/runtime/runtime-tool-config.d.ts.map +1 -1
  137. package/esm/src/agent/runtime/skill-prompt.d.ts +3 -0
  138. package/esm/src/agent/runtime/skill-prompt.d.ts.map +1 -1
  139. package/esm/src/agent/runtime/skill-prompt.js +113 -25
  140. package/esm/src/agent/runtime/streamed-assistant-message.d.ts +22 -2
  141. package/esm/src/agent/runtime/streamed-assistant-message.d.ts.map +1 -1
  142. package/esm/src/agent/runtime/streamed-assistant-message.js +26 -5
  143. package/esm/src/agent/runtime/tool-inventory.d.ts.map +1 -1
  144. package/esm/src/agent/runtime/tool-inventory.js +13 -9
  145. package/esm/src/agent/runtime/tool-result-continuation.d.ts +4 -2
  146. package/esm/src/agent/runtime/tool-result-continuation.d.ts.map +1 -1
  147. package/esm/src/agent/runtime/tool-result-continuation.js +24 -20
  148. package/esm/src/agent/schemas/agent.schema.d.ts +2 -2
  149. package/esm/src/agent/service/runtime.js +1 -1
  150. package/esm/src/agent/streaming/fork-runtime-stream.d.ts +5 -4
  151. package/esm/src/agent/streaming/fork-runtime-stream.d.ts.map +1 -1
  152. package/esm/src/agent/types.d.ts +14 -1
  153. package/esm/src/agent/types.d.ts.map +1 -1
  154. package/esm/src/chat/chat-ui-message-helpers.d.ts.map +1 -1
  155. package/esm/src/chat/chat-ui-message-helpers.js +75 -16
  156. package/esm/src/config/loader.d.ts.map +1 -1
  157. package/esm/src/config/loader.js +37 -1
  158. package/esm/src/errors/catalog/build-errors.d.ts.map +1 -1
  159. package/esm/src/errors/catalog/build-errors.js +14 -0
  160. package/esm/src/errors/error-registry/build.d.ts +2 -0
  161. package/esm/src/errors/error-registry/build.d.ts.map +1 -1
  162. package/esm/src/errors/error-registry/build.js +8 -0
  163. package/esm/src/errors/error-registry/deploy.d.ts +4 -0
  164. package/esm/src/errors/error-registry/deploy.d.ts.map +1 -1
  165. package/esm/src/errors/error-registry/deploy.js +16 -0
  166. package/esm/src/errors/error-registry.d.ts +3 -0
  167. package/esm/src/errors/error-registry.d.ts.map +1 -1
  168. package/esm/src/errors/index.d.ts +2 -1
  169. package/esm/src/errors/index.d.ts.map +1 -1
  170. package/esm/src/errors/index.js +4 -3
  171. package/esm/src/errors/tenant-classification.d.ts +25 -0
  172. package/esm/src/errors/tenant-classification.d.ts.map +1 -0
  173. package/esm/src/errors/tenant-classification.js +61 -0
  174. package/esm/src/extensions/builtin-extensions.d.ts +10 -15
  175. package/esm/src/extensions/builtin-extensions.d.ts.map +1 -1
  176. package/esm/src/extensions/builtin-extensions.js +32 -26
  177. package/esm/src/extensions/deferred-extension.d.ts +4 -4
  178. package/esm/src/extensions/deferred-extension.js +4 -4
  179. package/esm/src/extensions/index.d.ts +1 -0
  180. package/esm/src/extensions/index.d.ts.map +1 -1
  181. package/esm/src/extensions/index.js +1 -0
  182. package/esm/src/html/hydration-script-builder/hydration-runtime.generated.js +1 -1
  183. package/esm/src/integrations/_data.d.ts.map +1 -1
  184. package/esm/src/integrations/_data.js +6 -0
  185. package/esm/src/integrations/schema.d.ts +8 -0
  186. package/esm/src/integrations/schema.d.ts.map +1 -1
  187. package/esm/src/integrations/schema.js +3 -0
  188. package/esm/src/integrations/types.d.ts +2 -0
  189. package/esm/src/integrations/types.d.ts.map +1 -1
  190. package/esm/src/internal-agents/run-stream.d.ts.map +1 -1
  191. package/esm/src/internal-agents/run-stream.js +35 -20
  192. package/esm/src/internal-agents/run-system-prompt.d.ts +7 -2
  193. package/esm/src/internal-agents/run-system-prompt.d.ts.map +1 -1
  194. package/esm/src/internal-agents/run-system-prompt.js +19 -13
  195. package/esm/src/internal-agents/schema.d.ts +2 -0
  196. package/esm/src/internal-agents/schema.d.ts.map +1 -1
  197. package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
  198. package/esm/src/modules/react-loader/ssr-module-loader/loader.js +2 -18
  199. package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.d.ts +11 -0
  200. package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.d.ts.map +1 -1
  201. package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.js +53 -6
  202. package/esm/src/observability/application-error-contract.d.ts +4 -0
  203. package/esm/src/observability/application-error-contract.d.ts.map +1 -1
  204. package/esm/src/observability/application-errors.d.ts.map +1 -1
  205. package/esm/src/observability/application-errors.js +64 -3
  206. package/esm/src/platform/adapters/runtime/deno/http-server.d.ts.map +1 -1
  207. package/esm/src/platform/adapters/runtime/deno/http-server.js +2 -10
  208. package/esm/src/platform/adapters/runtime/shared/request-peer.d.ts +14 -0
  209. package/esm/src/platform/adapters/runtime/shared/request-peer.d.ts.map +1 -1
  210. package/esm/src/platform/adapters/runtime/shared/request-peer.js +82 -0
  211. package/esm/src/platform/compat/http/pinned-fetch.d.ts +1 -1
  212. package/esm/src/provider/runtime-loader/provider-http.d.ts +5 -1
  213. package/esm/src/provider/runtime-loader/provider-http.d.ts.map +1 -1
  214. package/esm/src/provider/runtime-loader/provider-http.js +55 -17
  215. package/esm/src/provider/shared/index.d.ts +1 -0
  216. package/esm/src/provider/shared/index.d.ts.map +1 -1
  217. package/esm/src/provider/shared/index.js +2 -0
  218. package/esm/src/provider/types.d.ts +1 -0
  219. package/esm/src/provider/types.d.ts.map +1 -1
  220. package/esm/src/react/components/ui/adapter/builtin/combobox.d.ts +3 -0
  221. package/esm/src/react/components/ui/adapter/builtin/combobox.d.ts.map +1 -0
  222. package/esm/src/react/components/ui/adapter/builtin/combobox.js +204 -0
  223. package/esm/src/react/components/ui/adapter/builtin/dialog.d.ts +3 -0
  224. package/esm/src/react/components/ui/adapter/builtin/dialog.d.ts.map +1 -0
  225. package/esm/src/react/components/ui/adapter/builtin/dialog.js +20 -0
  226. package/esm/src/react/components/ui/adapter/builtin/drawer.d.ts +3 -0
  227. package/esm/src/react/components/ui/adapter/builtin/drawer.d.ts.map +1 -0
  228. package/esm/src/react/components/ui/adapter/builtin/drawer.js +21 -0
  229. package/esm/src/react/components/ui/adapter/builtin/index.d.ts.map +1 -1
  230. package/esm/src/react/components/ui/adapter/builtin/index.js +10 -0
  231. package/esm/src/react/components/ui/adapter/builtin/popover.d.ts +3 -0
  232. package/esm/src/react/components/ui/adapter/builtin/popover.d.ts.map +1 -0
  233. package/esm/src/react/components/ui/adapter/builtin/popover.js +28 -0
  234. package/esm/src/react/components/ui/adapter/builtin/tabs.d.ts +3 -0
  235. package/esm/src/react/components/ui/adapter/builtin/tabs.d.ts.map +1 -0
  236. package/esm/src/react/components/ui/adapter/builtin/tabs.js +73 -0
  237. package/esm/src/react/components/ui/adapter/context.d.ts.map +1 -1
  238. package/esm/src/react/components/ui/adapter/context.js +10 -0
  239. package/esm/src/react/components/ui/adapter/contract.d.ts +212 -0
  240. package/esm/src/react/components/ui/adapter/contract.d.ts.map +1 -1
  241. package/esm/src/react/components/ui/adapter/token-scope.d.ts +24 -0
  242. package/esm/src/react/components/ui/adapter/token-scope.d.ts.map +1 -0
  243. package/esm/src/react/components/ui/adapter/token-scope.js +26 -0
  244. package/esm/src/react/components/ui/alert-dialog.d.ts +101 -0
  245. package/esm/src/react/components/ui/alert-dialog.d.ts.map +1 -0
  246. package/esm/src/react/components/ui/alert-dialog.js +181 -0
  247. package/esm/src/react/components/ui/aspect-ratio.d.ts +18 -0
  248. package/esm/src/react/components/ui/aspect-ratio.d.ts.map +1 -0
  249. package/esm/src/react/components/ui/aspect-ratio.js +13 -0
  250. package/esm/src/react/components/ui/autocomplete.d.ts +67 -0
  251. package/esm/src/react/components/ui/autocomplete.d.ts.map +1 -0
  252. package/esm/src/react/components/ui/autocomplete.js +59 -0
  253. package/esm/src/react/components/ui/breadcrumb.d.ts +86 -0
  254. package/esm/src/react/components/ui/breadcrumb.d.ts.map +1 -0
  255. package/esm/src/react/components/ui/breadcrumb.js +67 -0
  256. package/esm/src/react/components/ui/calendar.d.ts +40 -0
  257. package/esm/src/react/components/ui/calendar.d.ts.map +1 -0
  258. package/esm/src/react/components/ui/calendar.js +170 -0
  259. package/esm/src/react/components/ui/combobox.d.ts +74 -0
  260. package/esm/src/react/components/ui/combobox.d.ts.map +1 -0
  261. package/esm/src/react/components/ui/combobox.js +100 -0
  262. package/esm/src/react/components/ui/context-menu.d.ts +116 -0
  263. package/esm/src/react/components/ui/context-menu.d.ts.map +1 -0
  264. package/esm/src/react/components/ui/context-menu.js +168 -0
  265. package/esm/src/react/components/ui/date-picker.d.ts +69 -0
  266. package/esm/src/react/components/ui/date-picker.d.ts.map +1 -0
  267. package/esm/src/react/components/ui/date-picker.js +96 -0
  268. package/esm/src/react/components/ui/dialog.d.ts +41 -11
  269. package/esm/src/react/components/ui/dialog.d.ts.map +1 -1
  270. package/esm/src/react/components/ui/dialog.js +47 -28
  271. package/esm/src/react/components/ui/drawer.d.ts +31 -8
  272. package/esm/src/react/components/ui/drawer.d.ts.map +1 -1
  273. package/esm/src/react/components/ui/drawer.js +33 -22
  274. package/esm/src/react/components/ui/dropdown-menu.d.ts.map +1 -1
  275. package/esm/src/react/components/ui/dropdown-menu.js +7 -75
  276. package/esm/src/react/components/ui/field.d.ts +70 -0
  277. package/esm/src/react/components/ui/field.d.ts.map +1 -0
  278. package/esm/src/react/components/ui/field.js +161 -0
  279. package/esm/src/react/components/ui/file-type.d.ts +9 -8
  280. package/esm/src/react/components/ui/file-type.d.ts.map +1 -1
  281. package/esm/src/react/components/ui/file-type.js +8 -8
  282. package/esm/src/react/components/ui/hover-card.d.ts +82 -0
  283. package/esm/src/react/components/ui/hover-card.d.ts.map +1 -0
  284. package/esm/src/react/components/ui/hover-card.js +140 -0
  285. package/esm/src/react/components/ui/index.d.ts +23 -2
  286. package/esm/src/react/components/ui/index.d.ts.map +1 -1
  287. package/esm/src/react/components/ui/index.js +21 -0
  288. package/esm/src/react/components/ui/input-otp.d.ts +37 -0
  289. package/esm/src/react/components/ui/input-otp.d.ts.map +1 -0
  290. package/esm/src/react/components/ui/input-otp.js +42 -0
  291. package/esm/src/react/components/ui/menu-keyboard.d.ts +8 -0
  292. package/esm/src/react/components/ui/menu-keyboard.d.ts.map +1 -0
  293. package/esm/src/react/components/ui/menu-keyboard.js +76 -0
  294. package/esm/src/react/components/ui/menubar.d.ts +98 -0
  295. package/esm/src/react/components/ui/menubar.d.ts.map +1 -0
  296. package/esm/src/react/components/ui/menubar.js +173 -0
  297. package/esm/src/react/components/ui/meter.d.ts +45 -0
  298. package/esm/src/react/components/ui/meter.d.ts.map +1 -0
  299. package/esm/src/react/components/ui/meter.js +59 -0
  300. package/esm/src/react/components/ui/modal-surface.d.ts +7 -1
  301. package/esm/src/react/components/ui/modal-surface.d.ts.map +1 -1
  302. package/esm/src/react/components/ui/modal-surface.js +23 -6
  303. package/esm/src/react/components/ui/navigation-menu.d.ts +101 -0
  304. package/esm/src/react/components/ui/navigation-menu.d.ts.map +1 -0
  305. package/esm/src/react/components/ui/navigation-menu.js +195 -0
  306. package/esm/src/react/components/ui/number-field.d.ts +46 -0
  307. package/esm/src/react/components/ui/number-field.d.ts.map +1 -0
  308. package/esm/src/react/components/ui/number-field.js +121 -0
  309. package/esm/src/react/components/ui/pagination.d.ts +77 -0
  310. package/esm/src/react/components/ui/pagination.d.ts.map +1 -0
  311. package/esm/src/react/components/ui/pagination.js +62 -0
  312. package/esm/src/react/components/ui/popover.d.ts +42 -13
  313. package/esm/src/react/components/ui/popover.d.ts.map +1 -1
  314. package/esm/src/react/components/ui/popover.js +25 -12
  315. package/esm/src/react/components/ui/scroll-area.d.ts +38 -0
  316. package/esm/src/react/components/ui/scroll-area.d.ts.map +1 -0
  317. package/esm/src/react/components/ui/scroll-area.js +35 -0
  318. package/esm/src/react/components/ui/separator.d.ts +20 -0
  319. package/esm/src/react/components/ui/separator.d.ts.map +1 -0
  320. package/esm/src/react/components/ui/separator.js +13 -0
  321. package/esm/src/react/components/ui/slider.d.ts +44 -0
  322. package/esm/src/react/components/ui/slider.d.ts.map +1 -0
  323. package/esm/src/react/components/ui/slider.js +46 -0
  324. package/esm/src/react/components/ui/status.d.ts +6 -5
  325. package/esm/src/react/components/ui/status.d.ts.map +1 -1
  326. package/esm/src/react/components/ui/status.js +4 -4
  327. package/esm/src/react/components/ui/tabs.d.ts +32 -9
  328. package/esm/src/react/components/ui/tabs.d.ts.map +1 -1
  329. package/esm/src/react/components/ui/tabs.js +46 -22
  330. package/esm/src/react/components/ui/toggle.d.ts +26 -0
  331. package/esm/src/react/components/ui/toggle.d.ts.map +1 -0
  332. package/esm/src/react/components/ui/toggle.js +29 -0
  333. package/esm/src/react/components/ui/use-isomorphic-layout-effect.d.ts +2 -1
  334. package/esm/src/react/components/ui/use-isomorphic-layout-effect.d.ts.map +1 -1
  335. package/esm/src/react/components/ui/use-isomorphic-layout-effect.js +6 -3
  336. package/esm/src/rendering/chunk-optimizer/source-imports.d.ts.map +1 -1
  337. package/esm/src/rendering/chunk-optimizer/source-imports.js +4 -114
  338. package/esm/src/rendering/orchestrator/css-candidate-manifest.d.ts.map +1 -1
  339. package/esm/src/rendering/orchestrator/css-candidate-manifest.js +30 -1
  340. package/esm/src/rendering/orchestrator/module-loader/build-failure.d.ts +10 -0
  341. package/esm/src/rendering/orchestrator/module-loader/build-failure.d.ts.map +1 -1
  342. package/esm/src/rendering/orchestrator/module-loader/build-failure.js +50 -3
  343. package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts +2 -0
  344. package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts.map +1 -1
  345. package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.js +21 -6
  346. package/esm/src/rendering/orchestrator/module-loader/index.d.ts +2 -1
  347. package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
  348. package/esm/src/rendering/orchestrator/module-loader/index.js +190 -7
  349. package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts +4 -0
  350. package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts.map +1 -1
  351. package/esm/src/rendering/orchestrator/module-loader/module-persistence.js +374 -7
  352. package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
  353. package/esm/src/rendering/orchestrator/pipeline.js +12 -1
  354. package/esm/src/runs/runs-client.d.ts +2 -4
  355. package/esm/src/runs/runs-client.d.ts.map +1 -1
  356. package/esm/src/runs/schemas.d.ts +18 -8
  357. package/esm/src/runs/schemas.d.ts.map +1 -1
  358. package/esm/src/runs/schemas.js +26 -0
  359. package/esm/src/runtime/model-call-context.d.ts +6 -1
  360. package/esm/src/runtime/model-call-context.d.ts.map +1 -1
  361. package/esm/src/runtime/runtime-bridge.d.ts.map +1 -1
  362. package/esm/src/runtime/runtime-bridge.js +133 -15
  363. package/esm/src/schedule/factory.d.ts +8 -2
  364. package/esm/src/schedule/factory.d.ts.map +1 -1
  365. package/esm/src/schedule/factory.js +0 -8
  366. package/esm/src/schedule/index.d.ts +10 -1
  367. package/esm/src/schedule/index.d.ts.map +1 -1
  368. package/esm/src/schedule/index.js +9 -0
  369. package/esm/src/schedule/types.d.ts +30 -11
  370. package/esm/src/schedule/types.d.ts.map +1 -1
  371. package/esm/src/schedule/validation.d.ts +17 -0
  372. package/esm/src/schedule/validation.d.ts.map +1 -1
  373. package/esm/src/schedule/validation.js +93 -5
  374. package/esm/src/security/sandbox/worker-pool.d.ts.map +1 -1
  375. package/esm/src/security/sandbox/worker-pool.js +6 -1
  376. package/esm/src/server/bootstrap.d.ts.map +1 -1
  377. package/esm/src/server/bootstrap.js +6 -0
  378. package/esm/src/server/dev-server/index.d.ts +1 -1
  379. package/esm/src/server/dev-server/index.d.ts.map +1 -1
  380. package/esm/src/server/dev-server/server.d.ts +7 -3
  381. package/esm/src/server/dev-server/server.d.ts.map +1 -1
  382. package/esm/src/server/dev-server/server.js +12 -3
  383. package/esm/src/server/dev-server/types.d.ts +7 -1
  384. package/esm/src/server/dev-server/types.d.ts.map +1 -1
  385. package/esm/src/server/dev-server.d.ts +1 -1
  386. package/esm/src/server/dev-server.d.ts.map +1 -1
  387. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
  388. package/esm/src/server/handlers/dev/framework-candidates.generated.js +2509 -34
  389. package/esm/src/server/handlers/dev/projects/index.d.ts.map +1 -1
  390. package/esm/src/server/handlers/dev/projects/index.js +3 -0
  391. package/esm/src/server/handlers/request/agent-stream.handler.d.ts.map +1 -1
  392. package/esm/src/server/handlers/request/agent-stream.handler.js +29 -24
  393. package/esm/src/server/index.d.ts +3 -3
  394. package/esm/src/server/index.d.ts.map +1 -1
  395. package/esm/src/server/index.js +10 -5
  396. package/esm/src/server/node-handler.d.ts.map +1 -1
  397. package/esm/src/server/node-handler.js +4 -1
  398. package/esm/src/server/production-server.d.ts.map +1 -1
  399. package/esm/src/server/production-server.js +2 -1
  400. package/esm/src/server/project-env/cache.d.ts +17 -0
  401. package/esm/src/server/project-env/cache.d.ts.map +1 -1
  402. package/esm/src/server/project-env/cache.js +78 -2
  403. package/esm/src/server/project-env/fetcher.d.ts.map +1 -1
  404. package/esm/src/server/project-env/fetcher.js +24 -14
  405. package/esm/src/server/project-env/index.d.ts +1 -1
  406. package/esm/src/server/project-env/index.d.ts.map +1 -1
  407. package/esm/src/server/project-env/index.js +1 -1
  408. package/esm/src/server/project-env/internal-authorization.d.ts +7 -0
  409. package/esm/src/server/project-env/internal-authorization.d.ts.map +1 -0
  410. package/esm/src/server/project-env/internal-authorization.js +32 -0
  411. package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
  412. package/esm/src/server/runtime-handler/index.js +1 -1
  413. package/esm/src/server/runtime-handler/projects-handler.d.ts +1 -1
  414. package/esm/src/server/runtime-handler/projects-handler.d.ts.map +1 -1
  415. package/esm/src/server/runtime-handler/projects-handler.js +4 -2
  416. package/esm/src/transforms/esm/http-bundler.d.ts.map +1 -1
  417. package/esm/src/transforms/esm/http-bundler.js +6 -5
  418. package/esm/src/transforms/esm/http-cache-helpers.d.ts +11 -0
  419. package/esm/src/transforms/esm/http-cache-helpers.d.ts.map +1 -1
  420. package/esm/src/transforms/esm/http-cache-helpers.js +35 -0
  421. package/esm/src/transforms/esm/http-cache.d.ts.map +1 -1
  422. package/esm/src/transforms/esm/http-cache.js +16 -10
  423. package/esm/src/transforms/esm/specifier-resolver.d.ts.map +1 -1
  424. package/esm/src/transforms/esm/specifier-resolver.js +87 -7
  425. package/esm/src/transforms/import-rewriter/strategies/alias-strategy.d.ts +2 -0
  426. package/esm/src/transforms/import-rewriter/strategies/alias-strategy.d.ts.map +1 -1
  427. package/esm/src/transforms/import-rewriter/strategies/alias-strategy.js +11 -6
  428. package/esm/src/transforms/md/compiler/md-compiler.d.ts.map +1 -1
  429. package/esm/src/transforms/md/compiler/md-compiler.js +12 -5
  430. package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts +2 -0
  431. package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts.map +1 -1
  432. package/esm/src/transforms/mdx/compiler/frontmatter-extractor.js +33 -1
  433. package/esm/src/transforms/mdx/compiler/mdx-compiler.d.ts.map +1 -1
  434. package/esm/src/transforms/mdx/compiler/mdx-compiler.js +46 -7
  435. package/esm/src/transforms/mdx/esm-module-loader/cache/index.d.ts.map +1 -1
  436. package/esm/src/transforms/mdx/esm-module-loader/cache/index.js +8 -2
  437. package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts +1 -0
  438. package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts.map +1 -1
  439. package/esm/src/transforms/mdx/esm-module-loader/cache-format.js +3 -0
  440. package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.d.ts +4 -0
  441. package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.d.ts.map +1 -1
  442. package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.js +44 -8
  443. package/esm/src/transforms/mdx/esm-module-loader/missing-module.d.ts +2 -0
  444. package/esm/src/transforms/mdx/esm-module-loader/missing-module.d.ts.map +1 -1
  445. package/esm/src/transforms/mdx/esm-module-loader/missing-module.js +4 -0
  446. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.d.ts.map +1 -1
  447. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.js +5 -1
  448. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.d.ts +2 -0
  449. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.d.ts.map +1 -1
  450. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.js +50 -11
  451. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts +24 -12
  452. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts.map +1 -1
  453. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.js +201 -18
  454. package/esm/src/transforms/mdx/esm-module-loader/types.d.ts +5 -0
  455. package/esm/src/transforms/mdx/esm-module-loader/types.d.ts.map +1 -1
  456. package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.d.ts +22 -2
  457. package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.d.ts.map +1 -1
  458. package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.js +2080 -129
  459. package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.d.ts +11 -1
  460. package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.d.ts.map +1 -1
  461. package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.js +32 -15
  462. package/esm/src/transforms/pipeline/stages/compile.d.ts.map +1 -1
  463. package/esm/src/transforms/pipeline/stages/compile.js +44 -0
  464. package/esm/src/transforms/shared/specifier-suffix.d.ts +25 -0
  465. package/esm/src/transforms/shared/specifier-suffix.d.ts.map +1 -0
  466. package/esm/src/transforms/shared/specifier-suffix.js +43 -0
  467. package/esm/src/trigger/index.d.ts +2 -2
  468. package/esm/src/trigger/index.d.ts.map +1 -1
  469. package/esm/src/trigger/index.js +1 -1
  470. package/esm/src/trigger/local-runner.d.ts +2 -2
  471. package/esm/src/trigger/local-runner.d.ts.map +1 -1
  472. package/esm/src/trigger/local-runner.js +11 -4
  473. package/esm/src/trigger/target.d.ts +97 -5
  474. package/esm/src/trigger/target.d.ts.map +1 -1
  475. package/esm/src/trigger/target.js +175 -5
  476. package/esm/src/utils/version-constant.d.ts +1 -1
  477. package/esm/src/utils/version-constant.js +1 -1
  478. package/esm/src/webhook/types.d.ts +21 -6
  479. package/esm/src/webhook/types.d.ts.map +1 -1
  480. package/esm/src/webhook/validation.d.ts.map +1 -1
  481. package/esm/src/webhook/validation.js +27 -39
  482. package/esm/templates/index.d.ts +1 -1
  483. package/esm/templates/index.d.ts.map +1 -1
  484. package/esm/templates/loader.d.ts +6 -6
  485. package/esm/templates/loader.d.ts.map +1 -1
  486. package/esm/templates/loader.js +34 -18
  487. package/esm/templates/manifest.generated.d.ts +3 -0
  488. package/esm/templates/manifest.generated.d.ts.map +1 -0
  489. package/esm/templates/manifest.generated.js +2 -0
  490. package/package.json +8 -8
  491. package/esm/templates/manifest.d.ts +0 -664
  492. package/esm/templates/manifest.d.ts.map +0 -1
  493. package/esm/templates/manifest.js +0 -662
@@ -16,7 +16,7 @@ import { createApiClient, resolveConfigWithAuthDetails, } from "../../shared/con
16
16
  import { canPersistAlternativeSlug, getErrorStatus, projectApiReference, ProjectReferenceNotFoundError, resolveOrCreateProject, shouldPersistProjectLink, slugConflictAction, } from "../../shared/project-resolution.js";
17
17
  import { ProjectSlugConflictError, reserveProjectSlug } from "../../shared/reserve-slug.js";
18
18
  import { isVerbose, logInfo, logSuccess } from "../../utils/index.js";
19
- import { INVALID_ARGUMENT, PREVIEW_HOSTNAME_TOO_LONG } from "../../../src/errors/index.js";
19
+ import { INVALID_ARGUMENT, PREVIEW_HOSTNAME_TOO_LONG, PUSH_CONFLICT, VeryfrontError, } from "../../../src/errors/index.js";
20
20
  import { brand, createNoopSpinner, createSpinner, formatDuration } from "../../ui/index.js";
21
21
  import { withSpan } from "../../../src/observability/tracing/otlp-setup.js";
22
22
  import { createIgnoreChecker, loadIgnorePatterns } from "../../sync/ignore.js";
@@ -26,6 +26,8 @@ import { isNotFoundError, lstat } from "../../../src/fs/index.js";
26
26
  import { areSourceFilesTracked, clearPushReceipt, computeSourceDigest, getProjectTarget, normalizeControlPlane, resolveGitSource, writePushReceipt, } from "../../shared/deployment-provenance.js";
27
27
  import { buildStudioUrl } from "../studio/command.js";
28
28
  import { isJsonMode, streamJsonLine } from "../../shared/json-output.js";
29
+ import { planPushChanges } from "./plan.js";
30
+ import { computeContentDigest, preflightSyncState, readSyncTarget, writeSyncTarget, } from "../../sync/state.js";
29
31
  const PREVIEW_BRANCH_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
30
32
  const BRANCH_SUFFIX_LENGTH = 6;
31
33
  const PREVIEW_BRANCH_ERROR = "Preview branches must use 1-63 lowercase letters, numbers, or hyphens.";
@@ -36,7 +38,7 @@ export const getPushArgsSchema = defineSchema((v) => v.object({
36
38
  projectSlug: v.string().optional(),
37
39
  projectDir: v.string().optional(),
38
40
  branch: v.string().regex(PREVIEW_BRANCH_PATTERN, PREVIEW_BRANCH_ERROR).default("main"),
39
- /** Deprecated compatibility flag; invoking push already authorizes the operation. */
41
+ /** Intentionally overwrite remote changes and bypass concurrency guards. */
40
42
  force: v.boolean().default(false),
41
43
  prune: v.boolean().default(false),
42
44
  dryRun: v.boolean().default(false),
@@ -274,27 +276,29 @@ async function getBranchByName(client, projectSlug, branchName) {
274
276
  }
275
277
  export async function ensureBranch(client, projectSlug, branchName) {
276
278
  try {
277
- return await createBranch(client, projectSlug, branchName);
279
+ return { ...await createBranch(client, projectSlug, branchName), created: true };
278
280
  }
279
281
  catch (error) {
280
282
  if (getErrorStatus(error) !== 409)
281
283
  throw error;
282
284
  const existingBranch = await getBranchByName(client, projectSlug, branchName);
283
285
  if (existingBranch)
284
- return existingBranch;
286
+ return { ...existingBranch, created: false };
285
287
  throw error;
286
288
  }
287
289
  }
288
290
  export async function resolvePushRemoteFiles(client, projectSlug, branchName, mainFiles) {
289
291
  const mainSource = { type: "main" };
290
- if (branchName === "main")
291
- return { branchId: null, remoteFiles: mainFiles, source: mainSource };
292
+ if (branchName === "main") {
293
+ return { branchId: null, remoteFiles: mainFiles, source: mainSource, branchExists: true };
294
+ }
292
295
  const existingBranch = await getBranchByName(client, projectSlug, branchName);
293
- if (!existingBranch)
294
- return { branchId: null, remoteFiles: mainFiles, source: mainSource };
296
+ if (!existingBranch) {
297
+ return { branchId: null, remoteFiles: mainFiles, source: mainSource, branchExists: false };
298
+ }
295
299
  const branchSource = { type: "branch", name: branchName };
296
300
  const remoteFiles = await listAllFiles(client, projectSlug, branchSource);
297
- return { branchId: existingBranch.id, remoteFiles, source: branchSource };
301
+ return { branchId: existingBranch.id, remoteFiles, source: branchSource, branchExists: true };
298
302
  }
299
303
  function buildFileUrl(projectSlug, path, branchId) {
300
304
  const encodedPath = encodeURIComponent(path);
@@ -304,6 +308,8 @@ function buildFileUrl(projectSlug, path, branchId) {
304
308
  export async function uploadFiles(client, projectSlug, branchId, ops, dryRun) {
305
309
  let uploaded = 0;
306
310
  let failed = 0;
311
+ const conflicts = [];
312
+ const applied = [];
307
313
  for (const op of ops) {
308
314
  if (dryRun) {
309
315
  if (!isJsonMode())
@@ -312,36 +318,81 @@ export async function uploadFiles(client, projectSlug, branchId, ops, dryRun) {
312
318
  continue;
313
319
  }
314
320
  try {
315
- await client.put(buildFileUrl(projectSlug, op.path, branchId), { content: op.content });
321
+ await client.put(buildFileUrl(projectSlug, op.path, branchId), {
322
+ content: op.content,
323
+ ...(op.expectedVersionId ? { expected_version_id: op.expectedVersionId } : {}),
324
+ ...(op.expectedAbsent ? { expected_absent: true } : {}),
325
+ }, op.expectedVersionId || op.expectedAbsent ? { retryPolicy: "none" } : undefined);
316
326
  uploaded++;
327
+ applied.push(op.path);
317
328
  }
318
329
  catch (error) {
330
+ if (getErrorStatus(error) === 409) {
331
+ conflicts.push(op.path);
332
+ break;
333
+ }
319
334
  cliLogger.error(`Failed to upload ${op.path}:`, error);
320
335
  failed++;
321
336
  }
322
337
  }
323
- return { uploaded, failed };
338
+ return { uploaded, failed, conflicts, applied };
324
339
  }
325
- export async function deleteFiles(client, projectSlug, branchId, paths, dryRun) {
340
+ export async function deleteFiles(client, projectSlug, branchId, ops, dryRun) {
326
341
  let deleted = 0;
327
342
  let failed = 0;
328
- for (const path of paths) {
343
+ const conflicts = [];
344
+ const applied = [];
345
+ for (const op of ops) {
329
346
  if (dryRun) {
330
347
  if (!isJsonMode())
331
- cliLogger.info(` Would delete: ${path}`);
348
+ cliLogger.info(` Would delete: ${op.path}`);
332
349
  deleted++;
333
350
  continue;
334
351
  }
335
352
  try {
336
- await client.delete(buildFileUrl(projectSlug, path, branchId));
353
+ const url = new URL(buildFileUrl(projectSlug, op.path, branchId), "https://veryfront.invalid");
354
+ if (op.expectedVersionId) {
355
+ url.searchParams.set("expected_version_id", op.expectedVersionId);
356
+ }
357
+ await client.delete(`${url.pathname}${url.search}`);
337
358
  deleted++;
359
+ applied.push(op.path);
338
360
  }
339
361
  catch (error) {
340
- cliLogger.error(`Failed to delete ${path}:`, error);
362
+ if (getErrorStatus(error) === 409) {
363
+ conflicts.push(op.path);
364
+ break;
365
+ }
366
+ cliLogger.error(`Failed to delete ${op.path}:`, error);
341
367
  failed++;
342
368
  }
343
369
  }
344
- return { deleted, failed };
370
+ return { deleted, failed, conflicts, applied };
371
+ }
372
+ async function deleteForcedPruneRemoteOnlyFiles(client, projectSlug, branchId, remoteFiles, ignoreChecker, plannedFiles) {
373
+ const plannedPaths = new Set(Object.keys(plannedFiles));
374
+ const remoteOnlyDeletes = remoteFiles
375
+ .filter((file) => ignoreChecker.isSupportedExtension(file.path) &&
376
+ !ignoreChecker.isIgnored(file.path) &&
377
+ !plannedPaths.has(file.path))
378
+ .map((file) => ({ path: file.path }));
379
+ if (remoteOnlyDeletes.length === 0) {
380
+ return { deleted: 0, failed: 0, conflicts: [], applied: [] };
381
+ }
382
+ return await deleteFiles(client, projectSlug, branchId, remoteOnlyDeletes, false);
383
+ }
384
+ async function uploadForcedPlannedFiles(client, projectSlug, branchId, remoteFiles, ignoreChecker, uploads) {
385
+ const remoteSnapshot = await buildManagedRemoteSnapshot(remoteFiles, ignoreChecker, false);
386
+ const restoreUploads = [];
387
+ for (const upload of uploads) {
388
+ if (remoteSnapshot.get(upload.path)?.digest !== await computeContentDigest(upload.content)) {
389
+ restoreUploads.push(upload);
390
+ }
391
+ }
392
+ if (restoreUploads.length === 0) {
393
+ return { uploaded: 0, failed: 0, conflicts: [], applied: [] };
394
+ }
395
+ return await uploadFiles(client, projectSlug, branchId, restoreUploads, false);
345
396
  }
346
397
  function formatParts(parts) {
347
398
  return parts.join(", ");
@@ -360,6 +411,96 @@ function buildSummaryParts(ops, toDelete) {
360
411
  function buildConfirmParts(ops, toDelete) {
361
412
  return buildOpParts(ops, toDelete, (count) => `upload ${count}`, (count) => `delete ${count}`);
362
413
  }
414
+ function pushConflictError(paths) {
415
+ const files = paths.map((path) => `"${path}"`).join(", ");
416
+ return PUSH_CONFLICT.create({
417
+ detail: `Push rejected because remote files changed since your last pull or push: ${files}. ` +
418
+ "Commit or stash local changes, run veryfront pull, reconcile the changes with Git, then push again. " +
419
+ "Use veryfront push --force only to intentionally overwrite remote changes.",
420
+ context: { paths: [...paths] },
421
+ });
422
+ }
423
+ function requireRemoteContent(file) {
424
+ if (typeof file.content === "string")
425
+ return file.content;
426
+ throw new Error(`Veryfront returned invalid content for remote file "${file.path}". No files were pushed.`);
427
+ }
428
+ async function buildManagedRemoteSnapshot(files, ignoreChecker, includeVersion = true) {
429
+ const snapshot = new Map();
430
+ for (const file of files) {
431
+ if (!ignoreChecker.isSupportedExtension(file.path) || ignoreChecker.isIgnored(file.path)) {
432
+ continue;
433
+ }
434
+ snapshot.set(file.path, {
435
+ digest: await computeContentDigest(requireRemoteContent(file)),
436
+ ...(includeVersion && file.version_id ? { versionId: file.version_id } : {}),
437
+ });
438
+ }
439
+ return snapshot;
440
+ }
441
+ function findRemoteSnapshotChanges(expected, actual) {
442
+ const paths = new Set([...expected.keys(), ...actual.keys()]);
443
+ const changed = [];
444
+ for (const path of paths) {
445
+ const expectedFile = expected.get(path);
446
+ const actualFile = actual.get(path);
447
+ if (!expectedFile ||
448
+ !actualFile ||
449
+ expectedFile.digest !== actualFile.digest ||
450
+ expectedFile.versionId !== actualFile.versionId) {
451
+ changed.push(path);
452
+ }
453
+ }
454
+ return changed.sort();
455
+ }
456
+ function buildSyncFileDigestSnapshot(files) {
457
+ return new Map(Object.entries(files)
458
+ .map(([path, file]) => [path, { digest: file.digest }]));
459
+ }
460
+ async function filterAppliedChangesStillMatchingRemote(latestRemoteSnapshot, appliedUploads, appliedDeletes) {
461
+ const uploads = [];
462
+ for (const upload of appliedUploads) {
463
+ if (latestRemoteSnapshot.get(upload.path)?.digest === await computeContentDigest(upload.content)) {
464
+ uploads.push(upload);
465
+ }
466
+ }
467
+ const deletes = appliedDeletes.filter((deletion) => !latestRemoteSnapshot.has(deletion.path));
468
+ return { uploads, deletes };
469
+ }
470
+ async function buildSyncFilesAfterAppliedChanges(remoteFiles, appliedUploads, appliedDeletes) {
471
+ const files = {};
472
+ for (const file of remoteFiles) {
473
+ files[file.path] = {
474
+ digest: await computeContentDigest(requireRemoteContent(file)),
475
+ ...(file.version_id ? { versionId: file.version_id } : {}),
476
+ };
477
+ }
478
+ for (const upload of appliedUploads) {
479
+ files[upload.path] = { digest: await computeContentDigest(upload.content) };
480
+ }
481
+ for (const deletion of appliedDeletes) {
482
+ delete files[deletion.path];
483
+ }
484
+ return files;
485
+ }
486
+ async function computePushedSourceDigest(localFiles, remoteFiles) {
487
+ const localPaths = new Set(localFiles.map((file) => file.path));
488
+ const preservedRemoteFiles = remoteFiles
489
+ .filter((file) => !localPaths.has(file.path))
490
+ .map((file) => ({ path: file.path, content: requireRemoteContent(file) }));
491
+ return await computeSourceDigest([...localFiles, ...preservedRemoteFiles]);
492
+ }
493
+ async function writeAppliedSyncTarget(projectDir, config, project, branch, remoteFiles, appliedUploads, appliedDeletes) {
494
+ if (!project || (appliedUploads.length === 0 && appliedDeletes.length === 0))
495
+ return;
496
+ await writeSyncTarget(projectDir, {
497
+ controlPlane: config.apiUrl,
498
+ projectId: project.id,
499
+ projectSlug: project.slug,
500
+ branch,
501
+ files: await buildSyncFilesAfterAppliedChanges(remoteFiles, appliedUploads, appliedDeletes),
502
+ });
503
+ }
363
504
  export async function recordPushReceipt(client, config, projectDir, branch, snapshot, ignoreChecker, pushedSourceDigest = snapshot.sourceDigest) {
364
505
  const project = await getProjectTarget(client, projectApiReference(config));
365
506
  let currentSnapshot;
@@ -384,7 +525,7 @@ export async function recordPushReceipt(client, config, projectDir, branch, snap
384
525
  }
385
526
  export function pushCommand(options = {}) {
386
527
  return withSpan("cli.command.push", async () => {
387
- const { projectSlug: slugOverride, projectDir = cwd(), branch = "main", dryRun = false, quiet = false, } = options;
528
+ const { projectSlug: slugOverride, projectDir = cwd(), branch = "main", force = false, dryRun = false, quiet = false, } = options;
388
529
  const pruneRemoteMissing = options.prune ?? false;
389
530
  assertPreviewBranchName(branch);
390
531
  const jsonOutput = isJsonMode();
@@ -408,6 +549,7 @@ export function pushCommand(options = {}) {
408
549
  config = { ...config, projectSlug: slugOverride };
409
550
  projectReferenceSource = { kind: "argument", name: "--project" };
410
551
  }
552
+ await preflightSyncState(projectDir);
411
553
  spinner.update("Loading ignore patterns...");
412
554
  const ignorePatterns = await loadIgnorePatterns(projectDir);
413
555
  const ignoreChecker = createIgnoreChecker(ignorePatterns);
@@ -493,13 +635,43 @@ export function pushCommand(options = {}) {
493
635
  }
494
636
  const ops = sourceSnapshot.files;
495
637
  const localPaths = new Set(ops.map((op) => op.path));
496
- const target = projectExists
638
+ let target = projectExists
497
639
  ? await resolvePushRemoteFiles(client, projectApiReference(config), branchName, mainFiles)
498
640
  : {
499
641
  branchId: null,
500
642
  remoteFiles: mainFiles,
501
643
  source: { type: "main" },
644
+ branchExists: isMainBranch,
502
645
  };
646
+ let remoteFilesAreBaseline = !isMainBranch && !target.branchExists;
647
+ if (!dryRun && !isMainBranch && !target.branchId) {
648
+ spinner.update(`Creating branch "${branchName}"...`);
649
+ try {
650
+ const preparedBranch = await ensureBranch(client, projectApiReference(config), branchName);
651
+ const branchSource = { type: "branch", name: branchName };
652
+ const branchRemoteFiles = await listAllFiles(client, projectApiReference(config), branchSource);
653
+ if (preparedBranch.created && !force) {
654
+ const conflicts = findRemoteSnapshotChanges(await buildManagedRemoteSnapshot(mainFiles, ignoreChecker, false), await buildManagedRemoteSnapshot(branchRemoteFiles, ignoreChecker, false));
655
+ if (conflicts.length > 0) {
656
+ throw pushConflictError(conflicts);
657
+ }
658
+ }
659
+ target = {
660
+ branchId: preparedBranch.id,
661
+ remoteFiles: branchRemoteFiles,
662
+ source: branchSource,
663
+ branchExists: true,
664
+ };
665
+ remoteFilesAreBaseline = preparedBranch.created;
666
+ }
667
+ catch (error) {
668
+ spinner.stop();
669
+ if (error instanceof VeryfrontError)
670
+ throw error;
671
+ const message = error instanceof Error ? error.message : String(error);
672
+ throw new Error(`Failed to prepare branch "${branchName}": ${message}`);
673
+ }
674
+ }
503
675
  const remoteFilesMissingLocally = target.remoteFiles
504
676
  .map((file) => file.path)
505
677
  .filter((path) => ignoreChecker.isSupportedExtension(path) &&
@@ -515,15 +687,100 @@ export function pushCommand(options = {}) {
515
687
  }
516
688
  return { path: file.path, content: file.content };
517
689
  });
518
- const pushedSourceDigest = preservedRemoteFiles.length === 0
690
+ let pushedSourceDigest = preservedRemoteFiles.length === 0
519
691
  ? sourceSnapshot.sourceDigest
520
692
  : await computeSourceDigest([...ops, ...preservedRemoteFiles]);
521
- if (ops.length === 0 && toDelete.length === 0) {
693
+ const project = outcome.kind === "planned-create" ? null : outcome.project;
694
+ const baseline = project
695
+ ? await readSyncTarget(projectDir, {
696
+ controlPlane: config.apiUrl,
697
+ projectId: project.id,
698
+ branch: branchName,
699
+ })
700
+ : null;
701
+ const managedRemoteFiles = target.remoteFiles.filter((file) => ignoreChecker.isSupportedExtension(file.path) && !ignoreChecker.isIgnored(file.path));
702
+ const plan = await planPushChanges({
703
+ localFiles: ops,
704
+ remoteFiles: managedRemoteFiles,
705
+ baselineFiles: baseline?.files ?? {},
706
+ deletePaths: toDelete,
707
+ force,
708
+ remoteFilesAreBaseline,
709
+ });
710
+ if (plan.conflicts.length > 0) {
711
+ spinner.stop();
712
+ throw pushConflictError(plan.conflicts);
713
+ }
714
+ const uploadOps = plan.uploads;
715
+ const deleteOps = plan.deletes;
716
+ const branchId = target.branchId;
717
+ let pushedSyncFiles = plan.nextFiles;
718
+ if (!dryRun && !force) {
719
+ spinner = quiet || jsonOutput
720
+ ? createNoopSpinner()
721
+ : createSpinner("Checking remote files...");
722
+ try {
723
+ const latestRemoteFiles = await listAllFiles(client, projectApiReference(config), target.source);
724
+ const conflicts = findRemoteSnapshotChanges(await buildManagedRemoteSnapshot(managedRemoteFiles, ignoreChecker), await buildManagedRemoteSnapshot(latestRemoteFiles, ignoreChecker));
725
+ if (conflicts.length > 0) {
726
+ throw pushConflictError(conflicts);
727
+ }
728
+ }
729
+ finally {
730
+ spinner.stop();
731
+ }
732
+ }
733
+ if (uploadOps.length === 0 && deleteOps.length === 0) {
734
+ let forcedPruneDeleteCount = 0;
522
735
  try {
523
736
  if (!dryRun) {
737
+ if (!force) {
738
+ spinner.update("Checking remote files...");
739
+ const latestRemoteFiles = await listAllFiles(client, projectApiReference(config), target.source);
740
+ const conflicts = findRemoteSnapshotChanges(await buildManagedRemoteSnapshot(managedRemoteFiles, ignoreChecker), await buildManagedRemoteSnapshot(latestRemoteFiles, ignoreChecker));
741
+ if (conflicts.length > 0) {
742
+ throw pushConflictError(conflicts);
743
+ }
744
+ pushedSourceDigest = await computePushedSourceDigest(ops, latestRemoteFiles);
745
+ }
746
+ else if (pruneRemoteMissing) {
747
+ spinner.update("Verifying push target...");
748
+ let latestRemoteFiles = await listAllFiles(client, projectApiReference(config), target.source);
749
+ const lateDeleteResult = await deleteForcedPruneRemoteOnlyFiles(client, projectApiReference(config), branchId, latestRemoteFiles, ignoreChecker, plan.nextFiles);
750
+ forcedPruneDeleteCount = lateDeleteResult.deleted;
751
+ if (lateDeleteResult.conflicts.length > 0) {
752
+ throw pushConflictError(lateDeleteResult.conflicts);
753
+ }
754
+ if (lateDeleteResult.failed > 0) {
755
+ throw new Error(`Push failed for ${lateDeleteResult.failed} file${lateDeleteResult.failed === 1 ? "" : "s"} during forced prune reconciliation`);
756
+ }
757
+ if (lateDeleteResult.deleted > 0) {
758
+ latestRemoteFiles = await listAllFiles(client, projectApiReference(config), target.source);
759
+ }
760
+ const conflicts = findRemoteSnapshotChanges(buildSyncFileDigestSnapshot(plan.nextFiles), await buildManagedRemoteSnapshot(latestRemoteFiles, ignoreChecker, false));
761
+ if (conflicts.length > 0) {
762
+ throw pushConflictError(conflicts);
763
+ }
764
+ pushedSourceDigest = await computePushedSourceDigest(ops, latestRemoteFiles);
765
+ }
766
+ else {
767
+ const latestRemoteFiles = await listAllFiles(client, projectApiReference(config), target.source);
768
+ pushedSourceDigest = await computePushedSourceDigest(ops, latestRemoteFiles);
769
+ pushedSyncFiles = await buildSyncFilesAfterAppliedChanges(latestRemoteFiles.filter((file) => ignoreChecker.isSupportedExtension(file.path) &&
770
+ !ignoreChecker.isIgnored(file.path)), [], []);
771
+ }
524
772
  await clearPushReceipt(projectDir);
525
773
  spinner.update("Verifying push target...");
526
774
  await recordPushReceipt(client, config, projectDir, branchName, sourceSnapshot, ignoreChecker, pushedSourceDigest);
775
+ if (project) {
776
+ await writeSyncTarget(projectDir, {
777
+ controlPlane: config.apiUrl,
778
+ projectId: project.id,
779
+ projectSlug: project.slug,
780
+ branch: branchName,
781
+ files: pushedSyncFiles,
782
+ });
783
+ }
527
784
  }
528
785
  }
529
786
  finally {
@@ -537,72 +794,232 @@ export function pushCommand(options = {}) {
537
794
  logInfo("Dry run complete. No files would change.");
538
795
  }
539
796
  else {
540
- outputPushResult(config.projectSlug, branchName, 0, 0, Date.now() - startTime);
797
+ outputPushResult(config.projectSlug, branchName, 0, forcedPruneDeleteCount, Date.now() - startTime);
541
798
  }
542
799
  }
543
800
  return;
544
801
  }
545
802
  spinner.stop();
546
803
  if (!quiet && !jsonOutput && (dryRun || isVerbose())) {
547
- const parts = buildSummaryParts(ops, toDelete);
804
+ const parts = buildSummaryParts(uploadOps, deleteOps.map((op) => op.path));
548
805
  cliLogger.info(`\nFound ${formatParts(parts)} for ${isMainBranch ? "main" : `branch "${branchName}"`}.`);
549
806
  }
550
807
  if (dryRun) {
551
- if (ops.length > 0) {
552
- await uploadFiles(client, projectApiReference(config), target.branchId, ops, true);
808
+ if (uploadOps.length > 0) {
809
+ await uploadFiles(client, projectApiReference(config), target.branchId, uploadOps, true);
553
810
  }
554
- if (toDelete.length > 0) {
555
- await deleteFiles(client, projectApiReference(config), target.branchId, toDelete, true);
811
+ if (deleteOps.length > 0) {
812
+ await deleteFiles(client, projectApiReference(config), target.branchId, deleteOps, true);
556
813
  }
557
814
  if (jsonOutput && !quiet) {
558
- outputPushDryRunResult(config.projectSlug, branchName, projectExists, ops.length, toDelete.length);
815
+ outputPushDryRunResult(config.projectSlug, branchName, projectExists, uploadOps.length, deleteOps.length);
559
816
  }
560
817
  else if (!quiet) {
561
- const parts = buildConfirmParts(ops, toDelete);
818
+ const parts = buildConfirmParts(uploadOps, deleteOps.map((op) => op.path));
562
819
  logInfo(`Dry run complete. Would ${parts.join(" and ")} files.`);
563
820
  }
564
821
  return;
565
822
  }
566
823
  await clearPushReceipt(projectDir);
567
- let branchId = target.branchId;
568
824
  const uploadMsg = isMainBranch
569
825
  ? "Pushing to main..."
570
826
  : branchId
571
827
  ? `Pushing to branch "${branchName}"...`
572
828
  : `Creating branch "${branchName}"...`;
573
829
  spinner = quiet || jsonOutput ? createNoopSpinner() : createSpinner(uploadMsg);
574
- if (!isMainBranch && !branchId) {
830
+ let uploadResult = {
831
+ uploaded: 0,
832
+ failed: 0,
833
+ conflicts: [],
834
+ applied: [],
835
+ };
836
+ let deleteResult = {
837
+ deleted: 0,
838
+ failed: 0,
839
+ conflicts: [],
840
+ applied: [],
841
+ };
842
+ const writeConfirmedAppliedSyncTarget = async () => {
843
+ const appliedUploads = new Set(uploadResult.applied);
844
+ const appliedDeletes = [...new Set(deleteResult.applied)]
845
+ .map((path) => ({ path }));
846
+ await writeAppliedSyncTarget(projectDir, config, project, branchName, managedRemoteFiles, uploadOps.filter((op) => appliedUploads.has(op.path)), appliedDeletes);
847
+ };
848
+ const listAllFilesForVerification = async () => {
575
849
  try {
576
- const preparedBranch = await ensureBranch(client, projectApiReference(config), branchName);
577
- branchId = preparedBranch.id;
850
+ return await listAllFiles(client, projectApiReference(config), target.source);
578
851
  }
579
852
  catch (error) {
580
- spinner.stop();
581
- const message = error instanceof Error ? error.message : String(error);
582
- throw new Error(`Failed to prepare branch "${branchName}": ${message}`);
853
+ await writeConfirmedAppliedSyncTarget();
854
+ throw error;
583
855
  }
584
- }
585
- let uploadResult = { uploaded: 0, failed: 0 };
586
- let deleteResult = { deleted: 0, failed: 0 };
587
- if (ops.length > 0) {
856
+ };
857
+ const writeVerifiedAppliedSyncTarget = async (knownRemoteFiles) => {
858
+ const latestRemoteFiles = knownRemoteFiles ?? await listAllFilesForVerification();
859
+ const latestRemoteSnapshot = await buildManagedRemoteSnapshot(latestRemoteFiles, ignoreChecker, false);
860
+ const appliedUploads = new Set(uploadResult.applied);
861
+ const appliedDeletes = [...new Set(deleteResult.applied)]
862
+ .map((path) => ({ path }));
863
+ const stillApplied = await filterAppliedChangesStillMatchingRemote(latestRemoteSnapshot, uploadOps.filter((op) => appliedUploads.has(op.path)), appliedDeletes);
864
+ await writeAppliedSyncTarget(projectDir, config, project, branchName, managedRemoteFiles, stillApplied.uploads, stillApplied.deletes);
865
+ };
866
+ if (uploadOps.length > 0) {
588
867
  spinner.update("Uploading files...");
589
- uploadResult = await uploadFiles(client, projectApiReference(config), branchId, ops, false);
868
+ uploadResult = await uploadFiles(client, projectApiReference(config), branchId, uploadOps, false);
869
+ }
870
+ if (uploadResult.conflicts.length > 0) {
871
+ spinner.stop();
872
+ const appliedUploads = new Set(uploadResult.applied);
873
+ await writeAppliedSyncTarget(projectDir, config, project, branchName, managedRemoteFiles, uploadOps.filter((op) => appliedUploads.has(op.path)), []);
874
+ throw pushConflictError(uploadResult.conflicts);
590
875
  }
591
876
  if (uploadResult.failed > 0) {
592
877
  spinner.stop();
878
+ const appliedUploads = new Set(uploadResult.applied);
879
+ await writeAppliedSyncTarget(projectDir, config, project, branchName, managedRemoteFiles, uploadOps.filter((op) => appliedUploads.has(op.path)), []);
593
880
  throw new Error(`Push failed for ${uploadResult.failed} file${uploadResult.failed === 1 ? "" : "s"}. Remote files were not deleted.`);
594
881
  }
595
- if (toDelete.length > 0) {
882
+ if (deleteOps.length > 0) {
596
883
  spinner.update("Deleting removed files...");
597
- deleteResult = await deleteFiles(client, projectApiReference(config), branchId, toDelete, false);
884
+ deleteResult = await deleteFiles(client, projectApiReference(config), branchId, deleteOps, false);
885
+ }
886
+ if (deleteResult.conflicts.length > 0) {
887
+ spinner.stop();
888
+ const appliedUploads = new Set(uploadResult.applied);
889
+ const appliedDeletes = new Set(deleteResult.applied);
890
+ await writeAppliedSyncTarget(projectDir, config, project, branchName, managedRemoteFiles, uploadOps.filter((op) => appliedUploads.has(op.path)), deleteOps.filter((op) => appliedDeletes.has(op.path)));
891
+ throw pushConflictError(deleteResult.conflicts);
598
892
  }
599
893
  if (deleteResult.failed > 0) {
600
894
  spinner.stop();
895
+ await writeVerifiedAppliedSyncTarget();
601
896
  throw new Error(`Push failed for ${deleteResult.failed} file${deleteResult.failed === 1 ? "" : "s"} during deletion`);
602
897
  }
603
898
  spinner.update("Verifying push target...");
604
899
  try {
605
- await recordPushReceipt(client, config, projectDir, branchName, sourceSnapshot, ignoreChecker, pushedSourceDigest);
900
+ if (!force) {
901
+ const latestRemoteFiles = await listAllFilesForVerification();
902
+ const latestRemoteSnapshot = await buildManagedRemoteSnapshot(latestRemoteFiles, ignoreChecker, false);
903
+ const conflicts = findRemoteSnapshotChanges(buildSyncFileDigestSnapshot(plan.nextFiles), latestRemoteSnapshot);
904
+ if (conflicts.length > 0) {
905
+ const appliedUploads = new Set(uploadResult.applied);
906
+ const appliedDeletes = new Set(deleteResult.applied);
907
+ const stillApplied = await filterAppliedChangesStillMatchingRemote(latestRemoteSnapshot, uploadOps.filter((op) => appliedUploads.has(op.path)), deleteOps.filter((op) => appliedDeletes.has(op.path)));
908
+ await writeAppliedSyncTarget(projectDir, config, project, branchName, managedRemoteFiles, stillApplied.uploads, stillApplied.deletes);
909
+ throw pushConflictError(conflicts);
910
+ }
911
+ pushedSourceDigest = await computePushedSourceDigest(ops, latestRemoteFiles);
912
+ }
913
+ else if (pruneRemoteMissing) {
914
+ const latestRemoteFiles = await listAllFilesForVerification();
915
+ let repaired = false;
916
+ const lateUploadResult = await uploadForcedPlannedFiles(client, projectApiReference(config), branchId, latestRemoteFiles, ignoreChecker, uploadOps);
917
+ if (lateUploadResult.uploaded > 0 ||
918
+ lateUploadResult.failed > 0 ||
919
+ lateUploadResult.conflicts.length > 0) {
920
+ repaired = true;
921
+ uploadResult = {
922
+ uploaded: uploadResult.uploaded + lateUploadResult.uploaded,
923
+ failed: uploadResult.failed + lateUploadResult.failed,
924
+ conflicts: [...uploadResult.conflicts, ...lateUploadResult.conflicts],
925
+ applied: [...uploadResult.applied, ...lateUploadResult.applied],
926
+ };
927
+ if (lateUploadResult.conflicts.length > 0) {
928
+ await writeVerifiedAppliedSyncTarget();
929
+ throw pushConflictError(lateUploadResult.conflicts);
930
+ }
931
+ if (lateUploadResult.failed > 0) {
932
+ await writeVerifiedAppliedSyncTarget();
933
+ throw new Error(`Push failed for ${lateUploadResult.failed} file${lateUploadResult.failed === 1 ? "" : "s"} during forced prune reconciliation`);
934
+ }
935
+ }
936
+ const lateDeleteResult = await deleteForcedPruneRemoteOnlyFiles(client, projectApiReference(config), branchId, latestRemoteFiles, ignoreChecker, plan.nextFiles);
937
+ if (lateDeleteResult.deleted > 0 ||
938
+ lateDeleteResult.failed > 0 ||
939
+ lateDeleteResult.conflicts.length > 0) {
940
+ repaired = true;
941
+ deleteResult = {
942
+ deleted: deleteResult.deleted + lateDeleteResult.deleted,
943
+ failed: deleteResult.failed + lateDeleteResult.failed,
944
+ conflicts: [...deleteResult.conflicts, ...lateDeleteResult.conflicts],
945
+ applied: [...deleteResult.applied, ...lateDeleteResult.applied],
946
+ };
947
+ if (lateDeleteResult.conflicts.length > 0) {
948
+ await writeVerifiedAppliedSyncTarget();
949
+ throw pushConflictError(lateDeleteResult.conflicts);
950
+ }
951
+ if (lateDeleteResult.failed > 0) {
952
+ await writeVerifiedAppliedSyncTarget();
953
+ throw new Error(`Push failed for ${lateDeleteResult.failed} file${lateDeleteResult.failed === 1 ? "" : "s"} during forced prune reconciliation`);
954
+ }
955
+ }
956
+ if (repaired) {
957
+ const repairedRemoteFiles = await listAllFilesForVerification();
958
+ const repairedConflicts = findRemoteSnapshotChanges(buildSyncFileDigestSnapshot(plan.nextFiles), await buildManagedRemoteSnapshot(repairedRemoteFiles, ignoreChecker, false));
959
+ if (repairedConflicts.length > 0) {
960
+ await writeVerifiedAppliedSyncTarget(repairedRemoteFiles);
961
+ throw pushConflictError(repairedConflicts);
962
+ }
963
+ pushedSourceDigest = await computePushedSourceDigest(ops, repairedRemoteFiles);
964
+ }
965
+ else {
966
+ pushedSourceDigest = await computePushedSourceDigest(ops, latestRemoteFiles);
967
+ }
968
+ }
969
+ else {
970
+ let latestRemoteFiles = await listAllFilesForVerification();
971
+ const repairUploadResult = await uploadForcedPlannedFiles(client, projectApiReference(config), branchId, latestRemoteFiles, ignoreChecker, uploadOps);
972
+ uploadResult = {
973
+ uploaded: uploadResult.uploaded + repairUploadResult.uploaded,
974
+ failed: uploadResult.failed + repairUploadResult.failed,
975
+ conflicts: [...uploadResult.conflicts, ...repairUploadResult.conflicts],
976
+ applied: [...uploadResult.applied, ...repairUploadResult.applied],
977
+ };
978
+ if (repairUploadResult.conflicts.length > 0) {
979
+ await writeVerifiedAppliedSyncTarget();
980
+ throw pushConflictError(repairUploadResult.conflicts);
981
+ }
982
+ if (repairUploadResult.failed > 0) {
983
+ await writeVerifiedAppliedSyncTarget();
984
+ throw new Error(`Push failed for ${repairUploadResult.failed} file${repairUploadResult.failed === 1 ? "" : "s"} during forced push verification`);
985
+ }
986
+ if (repairUploadResult.uploaded > 0) {
987
+ latestRemoteFiles = await listAllFilesForVerification();
988
+ }
989
+ const latestRemoteSnapshot = await buildManagedRemoteSnapshot(latestRemoteFiles, ignoreChecker, false);
990
+ const uploadPaths = new Set(uploadOps.map((upload) => upload.path));
991
+ const expectedUploadSnapshot = new Map([...buildSyncFileDigestSnapshot(plan.nextFiles)]
992
+ .filter(([path]) => uploadPaths.has(path)));
993
+ const actualUploadSnapshot = new Map([...latestRemoteSnapshot]
994
+ .filter(([path]) => uploadPaths.has(path)));
995
+ const conflicts = findRemoteSnapshotChanges(expectedUploadSnapshot, actualUploadSnapshot);
996
+ if (conflicts.length > 0) {
997
+ await writeVerifiedAppliedSyncTarget(latestRemoteFiles);
998
+ throw pushConflictError(conflicts);
999
+ }
1000
+ pushedSourceDigest = await computePushedSourceDigest(ops, latestRemoteFiles);
1001
+ pushedSyncFiles = await buildSyncFilesAfterAppliedChanges(latestRemoteFiles.filter((file) => ignoreChecker.isSupportedExtension(file.path) &&
1002
+ !ignoreChecker.isIgnored(file.path)), [], []);
1003
+ }
1004
+ const writePlannedSyncTarget = async () => {
1005
+ if (!project)
1006
+ return;
1007
+ await writeSyncTarget(projectDir, {
1008
+ controlPlane: config.apiUrl,
1009
+ projectId: project.id,
1010
+ projectSlug: project.slug,
1011
+ branch: branchName,
1012
+ files: pushedSyncFiles,
1013
+ });
1014
+ };
1015
+ try {
1016
+ await recordPushReceipt(client, config, projectDir, branchName, sourceSnapshot, ignoreChecker, pushedSourceDigest);
1017
+ }
1018
+ catch (error) {
1019
+ await writePlannedSyncTarget();
1020
+ throw error;
1021
+ }
1022
+ await writePlannedSyncTarget();
606
1023
  }
607
1024
  finally {
608
1025
  spinner.stop();