deepline 0.3.460 → 0.3.462

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 (297) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +7593 -0
  2. package/dist/bundling-sources/sdk/src/client.ts +8 -7366
  3. package/dist/bundling-sources/sdk/src/http-core.ts +1239 -0
  4. package/dist/bundling-sources/sdk/src/http.ts +6 -1231
  5. package/dist/bundling-sources/sdk/src/index.ts +4 -1
  6. package/dist/bundling-sources/sdk/src/play.ts +5 -5
  7. package/dist/bundling-sources/sdk/src/plays/client-core.ts +437 -0
  8. package/dist/bundling-sources/sdk/src/plays/client.ts +4 -421
  9. package/dist/bundling-sources/sdk/src/plays/input-example.ts +3 -4
  10. package/dist/bundling-sources/sdk/src/plays/play-description.ts +1 -1
  11. package/dist/bundling-sources/sdk/src/plays/run-request.ts +1 -1
  12. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  13. package/dist/bundling-sources/sdk/src/server.ts +43 -0
  14. package/dist/bundling-sources/sdk/src/types.ts +15 -5
  15. package/dist/bundling-sources/shared_libs/integration-contracts/billing-entitlements.ts +15 -0
  16. package/dist/bundling-sources/shared_libs/monitors/billing/state.ts +28 -0
  17. package/dist/bundling-sources/shared_libs/monitors/callback-security.ts +0 -307
  18. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +3 -0
  19. package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +3 -2
  20. package/dist/bundling-sources/shared_libs/monitors/package.json +2 -0
  21. package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +34 -0
  22. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +59 -0
  23. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +94 -1
  24. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +35 -1
  25. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-failure-codes.ts +24 -0
  26. package/dist/bundling-sources/shared_libs/observability/dlq.ts +32 -0
  27. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +57 -3
  28. package/dist/bundling-sources/shared_libs/observability/scheduled-work.ts +1 -0
  29. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +66 -1
  30. package/dist/bundling-sources/shared_libs/play-data-plane/sheet-column-storage.ts +36 -7
  31. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +250 -11
  32. package/dist/bundling-sources/shared_libs/play-runtime/array-input-store.ts +319 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +991 -359
  34. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +17 -0
  35. package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-janitor.ts +13 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-reaper.ts +110 -0
  37. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +155 -6
  38. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +110 -6
  39. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +127 -13
  40. package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +14 -1
  41. package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +57 -1
  42. package/dist/bundling-sources/shared_libs/play-runtime/free-company-lookup-batching.ts +218 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/gateway-postgres-admission.ts +42 -5
  44. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-budget-state-backend.ts +6 -1
  45. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +92 -31
  46. package/dist/bundling-sources/shared_libs/play-runtime/governor/block-reserving-budget-state-backend.ts +69 -14
  47. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +93 -23
  48. package/dist/bundling-sources/shared_libs/play-runtime/governor/in-memory-rate-state-backend.ts +15 -4
  49. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +22 -18
  50. package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +5 -0
  51. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +2 -0
  52. package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +190 -14
  53. package/dist/bundling-sources/shared_libs/play-runtime/memory-ledger.ts +131 -0
  54. package/dist/bundling-sources/shared_libs/play-runtime/modal-runtime-config.ts +77 -2
  55. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +271 -2
  56. package/dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts +51 -0
  57. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/contracts.ts +2 -0
  58. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +27 -1
  59. package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +2 -0
  60. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -0
  61. package/dist/bundling-sources/shared_libs/play-runtime/provider-text-for-log.ts +63 -0
  62. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +19 -0
  63. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-event-transport.ts +112 -16
  64. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +104 -2
  65. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +265 -151
  66. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-gateway-transport.ts +17 -0
  67. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +35 -14
  68. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-sheet-persistence-retry.ts +12 -1
  69. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-control-transport.ts +4 -0
  70. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-labels.ts +36 -0
  71. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +136 -70
  72. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +237 -36
  73. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-runtime-watchdog.ts +148 -4
  74. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +6 -0
  75. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +285 -32
  76. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +251 -56
  77. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +29 -4
  78. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/sandbox-create-outcome.ts +27 -0
  79. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +22 -1
  80. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +1397 -382
  81. package/dist/bundling-sources/shared_libs/play-runtime/runtime-array-input-receipts.ts +920 -0
  82. package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +16 -0
  83. package/dist/bundling-sources/shared_libs/play-runtime/runtime-environment.ts +38 -0
  84. package/dist/bundling-sources/shared_libs/play-runtime/runtime-flow.ts +6 -0
  85. package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +26 -1
  86. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +30 -0
  87. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +14 -3
  88. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-writer.ts +31 -4
  89. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +47 -0
  90. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-compute-usage.ts +20 -7
  91. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +12 -0
  92. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/index.ts +9 -0
  93. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +10 -0
  94. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +4 -0
  95. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +1496 -320
  96. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-required-env.ts +31 -1
  97. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +1389 -129
  98. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +36 -0
  99. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-dispatch-authority.ts +4 -0
  100. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +162 -23
  101. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +499 -115
  102. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +377 -9
  103. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-ledger-reconciliation.ts +117 -8
  104. package/dist/bundling-sources/shared_libs/play-runtime/secret-resolution-retry-policy.ts +25 -0
  105. package/dist/bundling-sources/shared_libs/play-runtime/terminal-runtime-performance.ts +391 -0
  106. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +40 -0
  107. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/index.ts +6 -0
  108. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/mapped-calls.ts +171 -0
  109. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/receipt-cohort.ts +16 -1
  110. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +26 -3
  111. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +16 -2
  112. package/dist/bundling-sources/shared_libs/play-runtime/transport-error-diagnostics.ts +28 -0
  113. package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +55 -5
  114. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +41 -1
  115. package/dist/bundling-sources/shared_libs/plays/contracts.ts +4 -0
  116. package/dist/bundling-sources/shared_libs/plays/dataset.ts +9 -3
  117. package/dist/bundling-sources/shared_libs/plays/deploy/manifest-contract.ts +2 -0
  118. package/dist/bundling-sources/shared_libs/plays/deploy/manifest.ts +3 -2
  119. package/dist/bundling-sources/shared_libs/plays/deploy/project-serializer.ts +2 -2
  120. package/dist/bundling-sources/shared_libs/plays/run-output-summary.ts +66 -0
  121. package/dist/bundling-sources/shared_libs/plays/script-entry.ts +1 -1
  122. package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +43 -1
  123. package/dist/bundling-sources/shared_libs/product-notifications/content.ts +9 -0
  124. package/dist/bundling-sources/shared_libs/product-notifications/email.ts +91 -13
  125. package/dist/bundling-sources/shared_libs/product-notifications/events.ts +3 -0
  126. package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +41 -24
  127. package/dist/bundling-sources/shared_libs/security/attested-client-ip.ts +91 -0
  128. package/dist/bundling-sources/shared_libs/security/internal-actor.ts +0 -11
  129. package/dist/cli/{auth-HKA6ZVHQ.mjs → auth-JDLEY7VU.mjs} +5 -4
  130. package/dist/cli/auth-UXKY6TCC.js +41 -0
  131. package/dist/cli/{billing-MTO2ZZ3G.js → billing-HXAXB3XZ.js} +152 -78
  132. package/dist/cli/{billing-26G44S5N.mjs → billing-SDHLBLMV.mjs} +84 -10
  133. package/dist/cli/{chunk-BHGII2D6.js → chunk-3ACMRZRV.js} +8 -6
  134. package/dist/cli/{chunk-S4Q2XCGM.mjs → chunk-3KZCFOZ6.mjs} +1 -1
  135. package/dist/cli/chunk-4KQ6SIBC.mjs +1038 -0
  136. package/dist/cli/{chunk-Z2GUFYT6.js → chunk-5LEAXRHV.js} +11 -11
  137. package/dist/cli/{chunk-XAYO3Q2X.mjs → chunk-6NNVJDVR.mjs} +7 -5
  138. package/dist/cli/{chunk-NMJ4D2WO.js → chunk-6PMCRYDA.js} +216 -91
  139. package/dist/cli/{chunk-OMM54B3X.mjs → chunk-6RNQGWFD.mjs} +16 -806
  140. package/dist/cli/{chunk-EBU7LQ64.js → chunk-6V7KVRR5.js} +3 -3
  141. package/dist/cli/{chunk-RDPTDDKX.js → chunk-7LFIMWMW.js} +2 -2
  142. package/dist/cli/chunk-7MJ6VI2T.mjs +19 -0
  143. package/dist/cli/chunk-7SWNPNML.js +1039 -0
  144. package/dist/cli/{chunk-CTRPCARW.mjs → chunk-7U3XNPOA.mjs} +267 -38
  145. package/dist/cli/{chunk-RBTTUYZZ.js → chunk-7VZHXVOQ.js} +1 -1
  146. package/dist/cli/{chunk-YVBWO647.mjs → chunk-AT636LLU.mjs} +2 -2
  147. package/dist/cli/{chunk-VTODQWQA.js → chunk-BGTPIMSM.js} +392 -261
  148. package/dist/cli/{chunk-KADIT5NV.mjs → chunk-CKSOY47X.mjs} +2 -2
  149. package/dist/cli/{chunk-7DH2FD7Y.mjs → chunk-D464JW3N.mjs} +5 -85
  150. package/dist/cli/chunk-D6DXOUTO.mjs +827 -0
  151. package/dist/cli/{describe-QW54QQNB.js → chunk-EM4TXCCI.js} +27 -44
  152. package/dist/cli/chunk-F6QV42MC.mjs +91 -0
  153. package/dist/cli/chunk-FKVYR3QA.mjs +1039 -0
  154. package/dist/cli/{chunk-LMAULZLF.js → chunk-GEGW5HPZ.js} +29 -27
  155. package/dist/cli/{chunk-M52JQSLK.js → chunk-HUB3CCM2.js} +13 -4
  156. package/dist/cli/{chunk-YHTQM5XI.js → chunk-I6VHOU5O.js} +27 -27
  157. package/dist/cli/{chunk-Z2XUZC34.js → chunk-IAYSWZDJ.js} +188 -76
  158. package/dist/cli/chunk-JF3TLIMQ.js +19 -0
  159. package/dist/cli/{chunk-HDFRJ4IT.mjs → chunk-JVHOS3K3.mjs} +177 -65
  160. package/dist/cli/{chunk-LAWEURCT.mjs → chunk-LFXLQEZN.mjs} +1 -1
  161. package/dist/cli/{chunk-2PBN4SZE.js → chunk-LROWFPGN.js} +16 -16
  162. package/dist/cli/{chunk-SLEUWLJE.mjs → chunk-MSY22NQW.mjs} +5 -5
  163. package/dist/cli/{chunk-LVJOFUU7.mjs → chunk-MUUQZIOF.mjs} +23 -49
  164. package/dist/cli/{chunk-2XHWOQF4.js → chunk-NBLSCHKK.js} +52 -50
  165. package/dist/cli/{chunk-526R2HON.mjs → chunk-NHRWZPWZ.mjs} +4 -2
  166. package/dist/cli/{chunk-KXMNM4AQ.js → chunk-NMU3VR5U.js} +4 -5
  167. package/dist/cli/{chunk-W3BE3CHK.mjs → chunk-O2RX5A66.mjs} +14 -12
  168. package/dist/cli/{chunk-UKFZT7RF.js → chunk-OMQ23IXL.js} +2 -2
  169. package/dist/cli/{chunk-LJTFZOHU.js → chunk-OPJAJBD4.js} +28 -54
  170. package/dist/cli/{chunk-MLFR6DVF.mjs → chunk-PHSEINNH.mjs} +5 -5
  171. package/dist/cli/{chunk-3DNKFH2G.mjs → chunk-PKHVSIJG.mjs} +19 -1
  172. package/dist/cli/{chunk-WIYWSYDS.mjs → chunk-Q2EIZKVX.mjs} +3 -3
  173. package/dist/cli/{chunk-VJAEA4CS.js → chunk-QJZ6WNWD.js} +8 -8
  174. package/dist/cli/{chunk-EIMG75BT.mjs → chunk-S3A4IXBQ.mjs} +4 -5
  175. package/dist/cli/{chunk-RZSTT45F.mjs → chunk-S42YIQNE.mjs} +13 -8
  176. package/dist/cli/{chunk-YULBYKAK.mjs → chunk-S6UAJR6V.mjs} +3 -3
  177. package/dist/cli/{chunk-G7L27KZB.mjs → chunk-TKAQR3IB.mjs} +31 -21
  178. package/dist/cli/{chunk-QWRHGGUH.js → chunk-UAJFWWZE.js} +20 -2
  179. package/dist/cli/{chunk-ZR2RLI4O.mjs → chunk-UDRPEZ5F.mjs} +223 -92
  180. package/dist/cli/{chunk-QGAWTBIR.js → chunk-ULK7JGGI.js} +511 -282
  181. package/dist/cli/chunk-V335HGX5.js +1038 -0
  182. package/dist/cli/{chunk-NH6JSJW6.mjs → chunk-V3MEA7NB.mjs} +7 -5
  183. package/dist/cli/{chunk-NRGGFVVB.js → chunk-VFGVXXZP.js} +37 -35
  184. package/dist/cli/chunk-VLEVVDWG.js +91 -0
  185. package/dist/cli/{chunk-R2GLGLDR.mjs → chunk-VPHN2HAL.mjs} +216 -91
  186. package/dist/cli/{chunk-CFUTOWE4.js → chunk-WG3KGAII.js} +8 -88
  187. package/dist/cli/{describe-TOMIAT37.mjs → chunk-WIY6U6GD.mjs} +19 -36
  188. package/dist/cli/{chunk-YS2YBSJB.js → chunk-XANRM3QA.js} +6 -6
  189. package/dist/cli/{chunk-KGQNIA37.js → chunk-XQCTG5OO.js} +44 -34
  190. package/dist/cli/{chunk-EJGBLXDZ.mjs → chunk-XZAFIOUQ.mjs} +1 -1
  191. package/dist/cli/chunk-Y4DPU4OM.js +827 -0
  192. package/dist/cli/chunk-YT5EODJO.js +920 -0
  193. package/dist/cli/{chunk-2WRO2UJ5.js → chunk-ZGQSFYD2.js} +56 -51
  194. package/dist/cli/{chunk-OJ6RUKVT.mjs → chunk-ZUK6LIJB.mjs} +10 -1
  195. package/dist/cli/command-docs.d.mts +5 -0
  196. package/dist/cli/command-docs.d.ts +5 -0
  197. package/dist/cli/command-docs.js +2 -2
  198. package/dist/cli/command-docs.mjs +1 -1
  199. package/dist/cli/{csv-6FNFYJUC.js → csv-C56GSCEU.js} +13 -12
  200. package/dist/cli/{csv-MDHT4BKK.mjs → csv-L54JS7TF.mjs} +4 -3
  201. package/dist/cli/{db-D6AMVOEW.js → db-MOGRMZTA.js} +30 -27
  202. package/dist/cli/{db-74O3RFWY.mjs → db-YVBUW2DX.mjs} +10 -7
  203. package/dist/cli/describe-KYEULWPG.js +48 -0
  204. package/dist/cli/describe-NLZKKT7C.mjs +48 -0
  205. package/dist/cli/describe-core.d.mts +153 -5
  206. package/dist/cli/describe-core.d.ts +153 -5
  207. package/dist/cli/describe-core.js +9 -5
  208. package/dist/cli/describe-core.mjs +10 -6
  209. package/dist/cli/{executions-N4FMGVSC.js → executions-A7L4ULPP.js} +9 -7
  210. package/dist/cli/{executions-PVSF4HUF.mjs → executions-ZBGSTT37.mjs} +7 -5
  211. package/dist/cli/{feedback-OB7NANZW.mjs → feedback-G6GU37FD.mjs} +6 -5
  212. package/dist/cli/{feedback-WFSPCAI2.js → feedback-OHLY7RYD.js} +10 -9
  213. package/dist/cli/getting-started.d.mts +6 -6
  214. package/dist/cli/getting-started.d.ts +6 -6
  215. package/dist/cli/getting-started.js +2 -2
  216. package/dist/cli/getting-started.mjs +1 -1
  217. package/dist/cli/git-P76N4NDQ.js +25 -0
  218. package/dist/cli/{git-FHUSPAEU.mjs → git-PKZW3QD5.mjs} +5 -4
  219. package/dist/cli/index.js +152 -142
  220. package/dist/cli/index.mjs +56 -46
  221. package/dist/cli/{legacy-noops-ECHNA5HN.js → legacy-noops-5LM3D724.js} +8 -7
  222. package/dist/cli/{legacy-noops-HMK4BSCI.mjs → legacy-noops-LJJYG6YA.mjs} +5 -4
  223. package/dist/cli/{monitors-U7VQ3EZM.mjs → monitors-72QV4ALO.mjs} +19 -6
  224. package/dist/cli/{monitors-XLLFNENH.js → monitors-UX3H5DC2.js} +103 -90
  225. package/dist/cli/{org-6H3USO5M.mjs → org-6RRRKOCP.mjs} +9 -6
  226. package/dist/cli/{org-QX6ER2HN.js → org-IF7ISUVB.js} +70 -67
  227. package/dist/cli/pages-3SU3HKL7.js +252 -0
  228. package/dist/cli/pages-DXDYYKEK.mjs +252 -0
  229. package/dist/cli/{play-MOB2WYOR.mjs → play-AHASKRLA.mjs} +512 -1508
  230. package/dist/cli/{play-WNB7HBZK.js → play-EUIUVLUH.js} +1090 -2086
  231. package/dist/cli/{providers-CXEZ23E2.mjs → providers-GWGE3WY3.mjs} +7 -5
  232. package/dist/cli/{providers-7M3DISKX.js → providers-V5WU4VXJ.js} +10 -8
  233. package/dist/cli/{quickstart-ZFCHKHF6.mjs → quickstart-OXKQ5ZST.mjs} +5 -4
  234. package/dist/cli/{quickstart-CLJT4AZL.js → quickstart-QP65I5PF.js} +13 -12
  235. package/dist/cli/run-6MM72IGL.mjs +443 -0
  236. package/dist/cli/run-F3FTYS56.js +443 -0
  237. package/dist/cli/search-OYKOOI7A.js +32 -0
  238. package/dist/cli/{search-FVYWYIC3.mjs → search-ZMEBVJZB.mjs} +8 -6
  239. package/dist/cli/{secrets-YRLKZQS5.js → secrets-ACND5N6A.js} +16 -14
  240. package/dist/cli/{secrets-WAMPTQFC.mjs → secrets-XRCJFF3L.mjs} +7 -5
  241. package/dist/cli/{sessions-IQ332BJH.mjs → sessions-RTK3CEW6.mjs} +5 -4
  242. package/dist/cli/{sessions-44J6WIVU.js → sessions-ZGRJPCFF.js} +6 -5
  243. package/dist/cli/{settings-4IJR2I2T.js → settings-PD5KWQQZ.js} +80 -77
  244. package/dist/cli/{settings-22S6NIFQ.mjs → settings-XDRBPRDE.mjs} +14 -11
  245. package/dist/cli/{setup-OZUPKKPW.mjs → setup-3HPYAOCC.mjs} +12 -10
  246. package/dist/cli/{setup-3FWSRNOX.js → setup-E2Q6PXHC.js} +53 -51
  247. package/dist/cli/{skills-5CW3NFP3.mjs → skills-OOQFMPOV.mjs} +7 -6
  248. package/dist/cli/skills-XYWV52KB.js +31 -0
  249. package/dist/cli/tools-ASCDZJCK.js +55 -0
  250. package/dist/cli/tools-C5ZT3UIC.mjs +55 -0
  251. package/dist/cli/update-5RQSEIFM.js +33 -0
  252. package/dist/cli/{update-IBULOV7P.mjs → update-ZWJTADIW.mjs} +9 -8
  253. package/dist/cli/{workflow-MVZT7MWT.mjs → workflow-23NMPAJ7.mjs} +10 -8
  254. package/dist/cli/{workflow-Z7FW6GT2.js → workflow-TCXU5YJV.js} +20 -18
  255. package/dist/client-DS2IWYZF.d.ts +10 -0
  256. package/dist/client-DTwnz_AW.d.mts +10 -0
  257. package/dist/{client-CYqG23K1.d.ts → client-core-B_6HAIBy.d.ts} +385 -12
  258. package/dist/{client-BbU5_j7n.d.mts → client-core-DzBSlY1U.d.mts} +385 -12
  259. package/dist/{compiler-manifest-CWz_sNOQ.d.mts → compiler-manifest-Dcyd3-Zd.d.mts} +43 -1
  260. package/dist/{compiler-manifest-CWz_sNOQ.d.ts → compiler-manifest-Dcyd3-Zd.d.ts} +43 -1
  261. package/dist/errors-d-sTrZhe.d.mts +142 -0
  262. package/dist/errors-yQwfgrcX.d.ts +142 -0
  263. package/dist/{index-BF2JB_Ug.d.mts → index-C6oXchjN.d.mts} +1 -1
  264. package/dist/{index-4NPXDzlD.d.ts → index-P56zy_z5.d.ts} +1 -1
  265. package/dist/index.d.mts +11 -147
  266. package/dist/index.d.ts +11 -147
  267. package/dist/index.js +15 -11
  268. package/dist/index.mjs +14 -10
  269. package/dist/install-integrity.json +141 -104
  270. package/dist/plays/bundle-play-file.d.mts +3 -3
  271. package/dist/plays/bundle-play-file.d.ts +3 -3
  272. package/dist/plays/bundle-play-file.mjs +2 -1
  273. package/dist/plays/play-description.d.mts +2 -2
  274. package/dist/plays/play-description.d.ts +2 -2
  275. package/dist/plays/play-description.js +2 -2
  276. package/dist/plays/play-description.mjs +1 -1
  277. package/dist/plays/run-request.d.mts +2 -2
  278. package/dist/plays/run-request.d.ts +2 -2
  279. package/dist/release.d.mts +1 -1
  280. package/dist/release.d.ts +1 -1
  281. package/dist/release.js +2 -2
  282. package/dist/release.mjs +1 -1
  283. package/dist/server.d.mts +17 -0
  284. package/dist/server.d.ts +17 -0
  285. package/dist/server.js +76 -0
  286. package/dist/server.mjs +76 -0
  287. package/package.json +6 -1
  288. package/dist/cli/auth-VDOCNR7H.js +0 -40
  289. package/dist/cli/chunk-PQUUWFXY.js +0 -95
  290. package/dist/cli/chunk-QJLKYYPX.js +0 -1710
  291. package/dist/cli/chunk-YBWAG72P.mjs +0 -95
  292. package/dist/cli/git-4PMBJSH5.js +0 -24
  293. package/dist/cli/search-4CCQCTVD.js +0 -30
  294. package/dist/cli/skills-LMNM6B5F.js +0 -30
  295. package/dist/cli/tools-AGBBDJ7P.js +0 -45
  296. package/dist/cli/tools-NOPBDRGW.mjs +0 -45
  297. package/dist/cli/update-U3W6USVD.js +0 -32
@@ -5,6 +5,8 @@ import {
5
5
  daytonaErrorStatusForLog,
6
6
  daytonaProviderDetailForRunError,
7
7
  daytonaProviderMessageForRunError,
8
+ daytonaSandboxPlacementForLog,
9
+ daytonaSandboxStateForLog,
8
10
  isDaytonaProviderError,
9
11
  redactDaytonaErrorDetail,
10
12
  withoutDaytonaProviderDetail,
@@ -28,6 +30,7 @@ import {
28
30
  } from '../types';
29
31
  import { buildPlayRunnerBundle } from '../bundle';
30
32
  import { findPlayRunnerResult, parsePlayRunnerEvents } from '../runner-events';
33
+ import { logSandboxCreateOutcome } from '../sandbox-create-outcome';
31
34
  import type {
32
35
  PlayRunnerExecutionConfig,
33
36
  PlayRunnerRuntimeTiming,
@@ -57,6 +60,7 @@ import {
57
60
  import {
58
61
  isPlayRunRecoveryError,
59
62
  recoveryForDaytonaSandboxTransitionPending,
63
+ recoveryForRunnerStartupNotLive,
60
64
  } from '../../play-run-recovery-policy';
61
65
  import {
62
66
  stageDaytonaRunnerPayload,
@@ -844,6 +848,8 @@ export async function inspectDetachedDaytonaRunner(input: {
844
848
  exitCodePath: string;
845
849
  /** Refuse to read a sandbox outside the launch-pinned Daytona organization. */
846
850
  expectedOrganizationId?: string | null;
851
+ /** Answer from the sandbox's state alone. See the reconciliation seam. */
852
+ skipCapturedOutput?: boolean;
847
853
  }): Promise<{
848
854
  exitCode: number | null;
849
855
  result: PlayRunnerResult | null;
@@ -853,6 +859,7 @@ export async function inspectDetachedDaytonaRunner(input: {
853
859
  | 'command_running'
854
860
  | 'result_missing'
855
861
  | 'command_inspection_failed'
862
+ | 'sandbox_not_ended'
856
863
  | 'sandbox_stopped'
857
864
  | 'sandbox_missing'
858
865
  | 'sandbox_lookup_failed'
@@ -880,6 +887,20 @@ export async function inspectDetachedDaytonaRunner(input: {
880
887
  },
881
888
  };
882
889
  }
890
+ if (input.skipCapturedOutput) {
891
+ return {
892
+ exitCode: null,
893
+ result: null,
894
+ diagnosis: {
895
+ stage: DAYTONA_SANDBOX_STOPPED_STATES.has(
896
+ String(sandbox.state ?? '').toLowerCase(),
897
+ )
898
+ ? 'sandbox_stopped'
899
+ : 'sandbox_not_ended',
900
+ detail: daytonaSandboxStateForLog(sandbox.state),
901
+ },
902
+ };
903
+ }
883
904
  let exitCode: number | null = null;
884
905
  let commandFound = false;
885
906
  let commandInspectionError: string | null = null;
@@ -900,6 +921,18 @@ export async function inspectDetachedDaytonaRunner(input: {
900
921
  error: error instanceof Error ? error.message : String(error),
901
922
  });
902
923
  }
924
+ // The control API can answer while the sandbox itself does not. This is
925
+ // Daytona's account of a silent sandbox, and it is lost with the sandbox.
926
+ console.warn(
927
+ '[play-runner.daytona.detached_provider_snapshot]',
928
+ JSON.stringify({
929
+ sandboxId: input.sandboxId,
930
+ cmdId: input.cmdId,
931
+ toolboxResponded: commandInspectionError === null,
932
+ state: daytonaSandboxStateForLog(sandbox.state),
933
+ ...daytonaSandboxPlacementForLog(control.providerData(sandbox)),
934
+ }),
935
+ );
903
936
  const stopped = DAYTONA_SANDBOX_STOPPED_STATES.has(
904
937
  String(sandbox.state ?? '').toLowerCase(),
905
938
  );
@@ -954,13 +987,24 @@ export async function inspectDetachedDaytonaRunner(input: {
954
987
  cmdId: input.cmdId,
955
988
  failure,
956
989
  });
990
+ // A key for another organization gets not-found for every live sandbox, so
991
+ // a 404 proves loss only under the launch's own organization, as in delete.
992
+ const expectedOrganizationId = input.expectedOrganizationId?.trim() || null;
993
+ const configuredOrganizationId =
994
+ process.env.DAYTONA_ORGANIZATION_ID?.trim() || null;
995
+ const notFoundInLaunchOrganization =
996
+ failure.httpStatus === 404 &&
997
+ expectedOrganizationId !== null &&
998
+ (configuredOrganizationId === null ||
999
+ configuredOrganizationId === expectedOrganizationId);
957
1000
  return {
958
1001
  exitCode: null,
959
1002
  result: null,
960
1003
  diagnosis: {
961
- stage:
962
- failure.httpStatus === 404
963
- ? 'sandbox_missing'
1004
+ stage: notFoundInLaunchOrganization
1005
+ ? 'sandbox_missing'
1006
+ : failure.httpStatus === 404 && expectedOrganizationId !== null
1007
+ ? 'wrong_routing_domain'
964
1008
  : 'sandbox_lookup_failed',
965
1009
  detail: failure.detail,
966
1010
  },
@@ -1026,6 +1070,14 @@ export type DaytonaSandboxDeleteOutcome =
1026
1070
  kind: 'deleted' | 'already_absent';
1027
1071
  organizationId: string | null;
1028
1072
  }
1073
+ | {
1074
+ kind: 'delete_pending';
1075
+ organizationId: string | null;
1076
+ code: string;
1077
+ detail: string;
1078
+ /** A delete has been accepted, so only the 404 is outstanding. */
1079
+ deleteAccepted: boolean;
1080
+ }
1029
1081
  | {
1030
1082
  kind: 'timed_out' | 'rate_limited' | 'failed';
1031
1083
  organizationId: string | null;
@@ -1033,11 +1085,23 @@ export type DaytonaSandboxDeleteOutcome =
1033
1085
  detail: string;
1034
1086
  };
1035
1087
 
1088
+ /** Daytona has already accepted a delete, so another adds nothing. */
1089
+ const DAYTONA_SANDBOX_DELETING_STATES = new Set(['destroying', 'destroyed']);
1090
+
1091
+ /**
1092
+ * An accepted DELETE only starts the provider's work: on Oct 30 sandboxes
1093
+ * recorded deleted stayed in Daytona's inventory for minutes, and one process
1094
+ * kept posting 8 minutes later. Only a 404 for this exact sandbox settles it.
1095
+ * That 404 reads Daytona's database rather than the host, so it proves the
1096
+ * record is gone, which is the agreed bar.
1097
+ */
1036
1098
  export async function deleteDaytonaSandboxByIdWithOutcome(input: {
1037
1099
  sandboxId: string;
1038
1100
  timeoutSeconds?: number;
1039
1101
  expectedOrganizationId?: string | null;
1040
1102
  allowUnscopedAlreadyAbsent?: boolean;
1103
+ /** Durable proof that Daytona accepted this delete on an earlier pass. */
1104
+ deleteAcceptance?: { organizationId: string | null } | null;
1041
1105
  }): Promise<DaytonaSandboxDeleteOutcome> {
1042
1106
  const sandboxId = input.sandboxId?.trim();
1043
1107
  const expectedOrganizationId = input.expectedOrganizationId?.trim() || null;
@@ -1050,6 +1114,7 @@ export async function deleteDaytonaSandboxByIdWithOutcome(input: {
1050
1114
  };
1051
1115
  }
1052
1116
  let control: ReturnType<typeof createDaytonaControlClient> | undefined;
1117
+ let observedOrganizationId: string | null = null;
1053
1118
  try {
1054
1119
  const { clientOptions } = loadDaytonaRequiredConfig();
1055
1120
  control = daytonaSdkClientFactory.createControl(
@@ -1057,7 +1122,7 @@ export async function deleteDaytonaSandboxByIdWithOutcome(input: {
1057
1122
  (input.timeoutSeconds ?? 30) * 1_000,
1058
1123
  );
1059
1124
  const sandbox = await control.get(sandboxId);
1060
- const observedOrganizationId = sandbox.organizationId?.trim() || null;
1125
+ observedOrganizationId = sandbox.organizationId?.trim() || null;
1061
1126
  if (
1062
1127
  expectedOrganizationId &&
1063
1128
  observedOrganizationId !== expectedOrganizationId
@@ -1069,10 +1134,19 @@ export async function deleteDaytonaSandboxByIdWithOutcome(input: {
1069
1134
  detail: 'Sandbox belongs to a different Daytona organization.',
1070
1135
  };
1071
1136
  }
1072
- await control.delete(sandbox);
1137
+ if (
1138
+ !DAYTONA_SANDBOX_DELETING_STATES.has(
1139
+ String(sandbox.state ?? '').toLowerCase(),
1140
+ )
1141
+ ) {
1142
+ await control.delete(sandbox);
1143
+ }
1073
1144
  return {
1074
- kind: 'deleted',
1145
+ kind: 'delete_pending',
1075
1146
  organizationId: observedOrganizationId,
1147
+ code: 'daytona_delete_unconfirmed',
1148
+ detail: `Daytona still returns sandbox ${sandboxId}; only a 404 confirms deletion.`,
1149
+ deleteAccepted: true,
1076
1150
  };
1077
1151
  } catch (error) {
1078
1152
  const failure = describeDaytonaLookupFailure(error);
@@ -1087,6 +1161,27 @@ export async function deleteDaytonaSandboxByIdWithOutcome(input: {
1087
1161
  if (failure.httpStatus === 404) {
1088
1162
  const configuredOrganizationId =
1089
1163
  process.env.DAYTONA_ORGANIZATION_ID?.trim() || null;
1164
+ if (input.deleteAcceptance) {
1165
+ // The read-back confirming an accepted delete: a provider confirmation,
1166
+ // so it may establish a legacy job's domain, which plain absence cannot.
1167
+ const acceptedOrganizationId =
1168
+ input.deleteAcceptance.organizationId?.trim() ||
1169
+ expectedOrganizationId;
1170
+ if (
1171
+ configuredOrganizationId &&
1172
+ acceptedOrganizationId &&
1173
+ configuredOrganizationId !== acceptedOrganizationId
1174
+ ) {
1175
+ return {
1176
+ kind: 'failed',
1177
+ organizationId: configuredOrganizationId,
1178
+ code: 'wrong_routing_domain',
1179
+ detail:
1180
+ 'Daytona returned not-found from outside the organization that accepted the delete.',
1181
+ };
1182
+ }
1183
+ return { kind: 'deleted', organizationId: acceptedOrganizationId };
1184
+ }
1090
1185
  if (
1091
1186
  !input.allowUnscopedAlreadyAbsent &&
1092
1187
  (!expectedOrganizationId ||
@@ -1112,6 +1207,23 @@ export async function deleteDaytonaSandboxByIdWithOutcome(input: {
1112
1207
  configuredOrganizationId ?? expectedOrganizationId ?? null,
1113
1208
  };
1114
1209
  }
1210
+ if (failure.httpStatus === 409) {
1211
+ // A state change is in progress. Daytona took no delete, and nothing is
1212
+ // wrong, so this waits for its next read without reporting a failure.
1213
+ console.info(
1214
+ '[play-runner.daytona.reclaim_sandbox_state_change_pending]',
1215
+ {
1216
+ sandboxId,
1217
+ },
1218
+ );
1219
+ return {
1220
+ kind: 'delete_pending',
1221
+ organizationId: observedOrganizationId ?? expectedOrganizationId,
1222
+ code: 'daytona_state_change_in_progress',
1223
+ detail: failure.detail,
1224
+ deleteAccepted: false,
1225
+ };
1226
+ }
1115
1227
  console.warn('[play-runner.daytona.reclaim_sandbox_delete_failed]', {
1116
1228
  sandboxId,
1117
1229
  failure,
@@ -1147,7 +1259,11 @@ export async function deleteDaytonaSandboxById(input: {
1147
1259
  ...input,
1148
1260
  allowUnscopedAlreadyAbsent: true,
1149
1261
  });
1150
- return outcome.kind === 'deleted' || outcome.kind === 'already_absent';
1262
+ return (
1263
+ outcome.kind === 'deleted' ||
1264
+ outcome.kind === 'already_absent' ||
1265
+ (outcome.kind === 'delete_pending' && outcome.deleteAccepted)
1266
+ );
1151
1267
  }
1152
1268
 
1153
1269
  export function formatDaytonaError(error: unknown): string {
@@ -1360,6 +1476,96 @@ function isRetryableDaytonaInfrastructureFailure(error: unknown): boolean {
1360
1476
  return DAYTONA_INFRASTRUCTURE_RETRY_PATTERN.test(message);
1361
1477
  }
1362
1478
 
1479
+ // A new sandbox can outrun these: the sandbox is gone or busy, the request
1480
+ // timed out, or Daytona is limiting. Other 4xx answers, a refused credential
1481
+ // among them, would fail the same way on every sandbox and stay loud.
1482
+ const DAYTONA_REPLACEABLE_START_STATUSES: ReadonlySet<number> = new Set([
1483
+ 404, 408, 409, 429,
1484
+ ]);
1485
+ // Codes that mean the request got no answer.
1486
+ const DAYTONA_UNANSWERED_REQUEST_CODES: ReadonlySet<string> = new Set([
1487
+ 'ECONNABORTED',
1488
+ 'ECONNREFUSED',
1489
+ 'ECONNRESET',
1490
+ 'EAI_AGAIN',
1491
+ 'EPIPE',
1492
+ 'ERR_NETWORK',
1493
+ 'ETIMEDOUT',
1494
+ ]);
1495
+
1496
+ /**
1497
+ * Daytona failed a step of starting the runner: the payload upload, the
1498
+ * session, the command, or a read of a runner that never reported live. No
1499
+ * runner has been released yet, so a new sandbox cannot repeat customer work.
1500
+ * Only Daytona's own failures count: anything else here is our bundle or
1501
+ * config, which fails the same way on every sandbox. A stalled upload stays
1502
+ * loud too, because its input may be too large for any sandbox.
1503
+ */
1504
+ function isFailedDaytonaRunnerStart(error: unknown): boolean {
1505
+ if (error instanceof DaytonaControlTimeoutError) return true;
1506
+ if (!isDaytonaProviderError(error)) return false;
1507
+ const status = daytonaErrorStatusForLog(error);
1508
+ if (status !== null) {
1509
+ return status >= 500 || DAYTONA_REPLACEABLE_START_STATUSES.has(status);
1510
+ }
1511
+ // A missing status is not proof of a missing answer: the SDK raises
1512
+ // status-less errors for local failures too, such as a module it cannot
1513
+ // load. The 56 October uploads to bad hosts ended in a bare `DaytonaError`
1514
+ // with no status, no code and no message.
1515
+ return (
1516
+ error.name === 'DaytonaConnectionError' ||
1517
+ error.name === 'DaytonaTimeoutError' ||
1518
+ DAYTONA_UNANSWERED_REQUEST_CODES.has(daytonaErrorCodeForLog(error) ?? '') ||
1519
+ error.message === '' ||
1520
+ DAYTONA_INFRASTRUCTURE_RETRY_PATTERN.test(error.message)
1521
+ );
1522
+ }
1523
+
1524
+ /** Which failure ended a start, for the stage log: the run error has less. */
1525
+ function startFailureForLog(error: unknown) {
1526
+ const diagnostic =
1527
+ error instanceof DaytonaRunnerInitializationError
1528
+ ? error.startupDiagnostic
1529
+ : null;
1530
+ const startup = diagnostic?.runnerStartup;
1531
+ return {
1532
+ errorName: error instanceof Error ? error.name : null,
1533
+ providerStatus: daytonaErrorStatusForLog(error),
1534
+ providerCode: daytonaErrorCodeForLog(error),
1535
+ ...(diagnostic
1536
+ ? {
1537
+ // Retain the already-sanitized evidence before sandbox retirement.
1538
+ // Omit inspection messages, process names and the growing state map.
1539
+ startupDiagnostic: {
1540
+ schedulerReadinessObserved: diagnostic.schedulerReadinessObserved,
1541
+ schedulerReadinessResponses: diagnostic.schedulerReadinessResponses,
1542
+ commandFound: diagnostic.commandFound,
1543
+ exitCode: diagnostic.exitCode,
1544
+ sessionFound: diagnostic.sessionFound,
1545
+ sessionCommandCount: diagnostic.sessionCommandCount,
1546
+ exitCodeFile: diagnostic.exitCodeFile,
1547
+ processSummary: diagnostic.processSummary
1548
+ ? {
1549
+ total: diagnostic.processSummary.total,
1550
+ node: diagnostic.processSummary.node,
1551
+ }
1552
+ : null,
1553
+ runnerStartup: startup
1554
+ ? {
1555
+ phase: startup.phase,
1556
+ outcome: startup.outcome,
1557
+ status: startup.status,
1558
+ errorCode: startup.errorCode,
1559
+ transportAttemptId: startup.transportAttemptId,
1560
+ }
1561
+ : null,
1562
+ inspectionErrorCount: diagnostic.errors.length,
1563
+ },
1564
+ }
1565
+ : {}),
1566
+ };
1567
+ }
1568
+
1363
1569
  function isRetryableUnstartedDaytonaRunner(
1364
1570
  error: unknown,
1365
1571
  ): error is DaytonaRunnerInitializationError {
@@ -1396,12 +1602,22 @@ function prepareDaytonaExecution(
1396
1602
  context: input.context,
1397
1603
  emitStage: (stage, extra) =>
1398
1604
  emitDaytonaStage(callbacks, input.context, stage, extra),
1399
- observeCreateCall: callbacks?.onRuntimeLifecycleEvent,
1605
+ observeCreateCall: (event) => {
1606
+ if (event.type === 'daytona_create_call_succeeded') {
1607
+ logSandboxCreateOutcome({
1608
+ provider: 'daytona',
1609
+ outcome: 'succeeded',
1610
+ runId: input.context.runId,
1611
+ });
1612
+ }
1613
+ return callbacks?.onRuntimeLifecycleEvent?.(event);
1614
+ },
1400
1615
  reserveSandboxCapacity: callbacks?.reserveSandboxCapacity
1401
1616
  ? (providerAttempt) =>
1402
1617
  callbacks.reserveSandboxCapacity!('daytona', providerAttempt)
1403
1618
  : undefined,
1404
1619
  releaseSandboxCapacity: callbacks?.releaseSandboxCapacity,
1620
+ recordCleanupIntent: callbacks?.recordDaytonaCleanupIntent,
1405
1621
  startAdmission: daytonaSandboxStartAdmission,
1406
1622
  cancellationSignal: callbacks?.cancellationSignal,
1407
1623
  });
@@ -1626,6 +1842,9 @@ export const daytonaPlayRunnerBackend: PlayRunnerBackend = {
1626
1842
  ) {
1627
1843
  let sandboxForAttempt: DaytonaSandbox | null = null;
1628
1844
  let resourceAccounting: Promise<void> | null = null;
1845
+ // How far this sandbox's start got. The retry decision below reads it.
1846
+ let commandSent = false;
1847
+ let parkStarted = false;
1629
1848
  const attemptStartedAt = Date.now();
1630
1849
  try {
1631
1850
  const acquiredSandbox = await Promise.race([
@@ -1705,6 +1924,9 @@ export const daytonaPlayRunnerBackend: PlayRunnerBackend = {
1705
1924
  }
1706
1925
  },
1707
1926
  cancellation: cancellationPromise,
1927
+ onCommandSending: () => {
1928
+ commandSent = true;
1929
+ },
1708
1930
  onCommandAccepted: async () => {
1709
1931
  commandAcceptedAtMs = Date.now();
1710
1932
  emitDaytonaStage(callbacks, config.context, 'execute:accepted', {
@@ -1716,6 +1938,7 @@ export const daytonaPlayRunnerBackend: PlayRunnerBackend = {
1716
1938
  });
1717
1939
  },
1718
1940
  onReady: async (ready) => {
1941
+ parkStarted = true;
1719
1942
  const heartbeatReadyAtMs = Date.now();
1720
1943
  emitDaytonaStage(
1721
1944
  callbacks,
@@ -1922,44 +2145,74 @@ export const daytonaPlayRunnerBackend: PlayRunnerBackend = {
1922
2145
  }
1923
2146
  const retryReason = isRetryableUnstartedDaytonaRunner(error)
1924
2147
  ? 'runner_startup_not_live'
1925
- : isRetryableDaytonaInfrastructureFailure(error)
1926
- ? 'daytona_infrastructure'
1927
- : null;
2148
+ : sandboxForAttempt &&
2149
+ !parkStarted &&
2150
+ isFailedDaytonaRunnerStart(error)
2151
+ ? 'runner_start_failed'
2152
+ : isRetryableDaytonaInfrastructureFailure(error)
2153
+ ? 'daytona_infrastructure'
2154
+ : null;
2155
+ const retireSandboxForAttempt = async () => {
2156
+ if (!sandboxForAttempt) return;
2157
+ activeAcquiredResource!.billingEndedAt = Date.now();
2158
+ await reportRetiringRuntimeResource(activeAcquiredResource!);
2159
+ try {
2160
+ await sandboxCleanup.stashActiveSandboxForRetry();
2161
+ } catch (retirementError) {
2162
+ if (runtimeResourceReportErrors.has(retirementError))
2163
+ throw retirementError;
2164
+ // Preserve both causes without feeding a retryable startup
2165
+ // cause back into replacement admission. The cleanup manager
2166
+ // retains the active resource and its single retirement promise.
2167
+ const failure = new Error(
2168
+ `Daytona sandbox retirement unconfirmed: ${formatDaytonaError(retirementError)}. Original startup failure: ${formatDaytonaError(error)}`,
2169
+ { cause: error },
2170
+ );
2171
+ failure.name = 'DaytonaSandboxRetirementUnconfirmedError';
2172
+ Object.assign(failure, { retirementError });
2173
+ throw failure;
2174
+ }
2175
+ };
2176
+ // A sandbox that never got a command has no runner, so this attempt
2177
+ // can replace it. Once a command went out, a runner may live until
2178
+ // Daytona finishes a delete it has only accepted, and a replacement
2179
+ // here would pass the same attempt fence and could be released with
2180
+ // it. That sandbox moves to a new attempt, whose fence rejects it.
1928
2181
  if (
1929
2182
  executionAttempt < DAYTONA_INFRASTRUCTURE_MAX_ATTEMPTS &&
1930
- retryReason
2183
+ retryReason &&
2184
+ !commandSent
1931
2185
  ) {
1932
2186
  emitDaytonaStage(callbacks, config.context, 'execute:retry', {
1933
2187
  sandboxId: sandboxForAttempt?.id ?? null,
1934
2188
  attempt: executionAttempt + 1,
1935
2189
  reason: retryReason,
1936
2190
  error: error instanceof Error ? error.message : String(error),
2191
+ ...startFailureForLog(error),
1937
2192
  elapsedMs: Date.now() - startedAt,
1938
2193
  });
1939
- if (sandboxForAttempt) {
1940
- activeAcquiredResource!.billingEndedAt = Date.now();
1941
- await reportRetiringRuntimeResource(activeAcquiredResource!);
1942
- try {
1943
- await sandboxCleanup.stashActiveSandboxForRetry();
1944
- } catch (retirementError) {
1945
- if (runtimeResourceReportErrors.has(retirementError))
1946
- throw retirementError;
1947
- // Preserve both causes without feeding a retryable startup
1948
- // cause back into replacement admission. The cleanup manager
1949
- // retains the active resource and its single retirement promise.
1950
- const failure = new Error(
1951
- `Daytona sandbox retirement unconfirmed: ${formatDaytonaError(retirementError)}. Original startup failure: ${formatDaytonaError(error)}`,
1952
- { cause: error },
1953
- );
1954
- failure.name = 'DaytonaSandboxRetirementUnconfirmedError';
1955
- Object.assign(failure, { retirementError });
1956
- throw failure;
1957
- }
1958
- }
2194
+ await retireSandboxForAttempt();
1959
2195
  throwIfCancellationRequested();
1960
2196
  acquiredSandboxPromise = sandboxLifecycle.createFreshSandbox();
1961
2197
  continue;
1962
2198
  }
2199
+ if (
2200
+ retryReason === 'runner_startup_not_live' ||
2201
+ retryReason === 'runner_start_failed'
2202
+ ) {
2203
+ // No runner was released. Retire this sandbox first: the new
2204
+ // attempt starts clean.
2205
+ emitDaytonaStage(callbacks, config.context, 'execute:deferred', {
2206
+ sandboxId: sandboxForAttempt?.id ?? null,
2207
+ attempt: executionAttempt,
2208
+ reason: retryReason,
2209
+ ...startFailureForLog(error),
2210
+ elapsedMs: Date.now() - startedAt,
2211
+ });
2212
+ await retireSandboxForAttempt();
2213
+ throwIfCancellationRequested();
2214
+ throw recoveryForRunnerStartupNotLive(error);
2215
+ }
1963
2216
  throw error;
1964
2217
  }
1965
2218
  }