deepline 0.3.484 → 0.3.485

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 (209) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +91 -30
  2. package/dist/bundling-sources/sdk/src/compat.ts +13 -0
  3. package/dist/bundling-sources/sdk/src/plays/client-core.ts +4 -1
  4. package/dist/bundling-sources/sdk/src/plays/run-request.ts +143 -9
  5. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  6. package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +31 -4
  7. package/dist/bundling-sources/sdk/src/tool-calls.ts +1 -1
  8. package/dist/bundling-sources/sdk/src/types.ts +7 -1
  9. package/dist/bundling-sources/shared_libs/play-data-plane/sheet-column-storage.ts +32 -3
  10. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +126 -41
  11. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +231 -25
  12. package/dist/bundling-sources/shared_libs/play-runtime/daytona-runtime-config.ts +9 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +130 -19
  14. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +105 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/execute-server-timing.ts +4 -2
  16. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +194 -56
  17. package/dist/bundling-sources/shared_libs/play-runtime/log-provenance.ts +11 -6
  18. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +3 -0
  19. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/ports.ts +2 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/postgres-adapter.ts +2 -1
  21. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +30 -0
  22. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +195 -2
  23. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +20 -1
  24. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +15 -0
  25. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +2 -2
  26. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +102 -23
  27. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/progress-sidecar.ts +9 -1
  28. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-control-transport.ts +25 -5
  29. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +133 -82
  30. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +58 -16
  31. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-sandbox-absence.ts +171 -0
  32. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +69 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +100 -40
  34. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +8 -0
  35. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +67 -9
  36. package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +5 -5
  37. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +6 -3
  38. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-errors.ts +14 -0
  39. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-writer.ts +87 -31
  40. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +18 -0
  41. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/index.ts +19 -0
  42. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +14 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +204 -6
  44. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +39 -0
  45. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +12 -1
  46. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +26 -0
  47. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +44 -15
  48. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +60 -11
  49. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +649 -38
  50. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +6 -1
  51. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +17 -0
  52. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +25 -33
  53. package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +12 -0
  54. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +21 -0
  55. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +1 -1
  56. package/dist/bundling-sources/shared_libs/plays/source-authoring-edition.ts +1 -1
  57. package/dist/cli/auth-ABZBH55L.js +43 -0
  58. package/dist/cli/{auth-EBFOTF7X.mjs → auth-OWMUENCU.mjs} +5 -5
  59. package/dist/cli/{billing-G2G3EF3I.js → billing-2FMNQGOX.js} +80 -80
  60. package/dist/cli/{billing-2ZOIMW5V.mjs → billing-JX4H3VFF.mjs} +7 -7
  61. package/dist/cli/{chunk-M4PG7FGC.js → chunk-2ILND7XX.js} +2 -2
  62. package/dist/cli/{chunk-WXRM3UC6.mjs → chunk-2ZEQ43B7.mjs} +3 -3
  63. package/dist/cli/{chunk-PU52JXKA.mjs → chunk-3DBW6C7M.mjs} +13 -4
  64. package/dist/cli/{chunk-4OVHIWE7.mjs → chunk-3DYU3JQN.mjs} +2 -2
  65. package/dist/cli/{chunk-QIDDTIVZ.js → chunk-3OF7NSGR.js} +322 -294
  66. package/dist/cli/{chunk-YWC5AN26.mjs → chunk-3Z24NKW7.mjs} +62 -34
  67. package/dist/cli/{chunk-RLLEH2SP.js → chunk-5DCQWQCP.js} +26 -26
  68. package/dist/cli/{chunk-DEXSQGXB.mjs → chunk-62PJ6PK7.mjs} +5 -5
  69. package/dist/cli/{chunk-6NPWXE32.mjs → chunk-676NZ7K4.mjs} +1 -1
  70. package/dist/cli/{chunk-FRD5WFT4.js → chunk-775AZTO7.js} +323 -247
  71. package/dist/cli/{chunk-4OEOM6GP.mjs → chunk-ACTUAZYP.mjs} +5 -5
  72. package/dist/cli/{chunk-ZOKM7DVA.js → chunk-AFADYKFE.js} +8 -8
  73. package/dist/cli/{chunk-GVAENVIG.js → chunk-AUQQVDAB.js} +110 -21
  74. package/dist/cli/{chunk-U7IJAGWB.js → chunk-BSKPQB2P.js} +7 -7
  75. package/dist/cli/chunk-C6QWRSMQ.js +42 -0
  76. package/dist/cli/{chunk-AK7UKQ5R.js → chunk-CSBMKHTV.js} +5 -5
  77. package/dist/cli/{chunk-YHA3EV3I.mjs → chunk-CW6TAQBF.mjs} +15 -4
  78. package/dist/cli/{chunk-UT4YMA2N.js → chunk-DMNVM34J.js} +5 -4
  79. package/dist/cli/{chunk-XZXIWPT3.mjs → chunk-E73JXJA3.mjs} +1 -1
  80. package/dist/cli/{chunk-5KNRQWHE.js → chunk-EC2CVPN5.js} +3 -3
  81. package/dist/cli/{chunk-IXWQOVNW.js → chunk-ECIXZNSW.js} +87 -76
  82. package/dist/cli/{chunk-LTZXLYKE.mjs → chunk-FJY6K3BG.mjs} +93 -17
  83. package/dist/cli/{chunk-TRLDJNVE.mjs → chunk-G5PI3RNT.mjs} +1 -1
  84. package/dist/cli/{chunk-WYUCDLVR.mjs → chunk-GHHJWCMD.mjs} +2 -1
  85. package/dist/cli/{chunk-FQK7BULS.js → chunk-HKGXGGIV.js} +1 -1
  86. package/dist/cli/{chunk-2AWYJXBX.js → chunk-IHMYIHF4.js} +5 -5
  87. package/dist/cli/{chunk-SD7QWZTV.mjs → chunk-INW22YP7.mjs} +1 -1
  88. package/dist/cli/{chunk-OWUZKXE7.mjs → chunk-J7EENGKJ.mjs} +1 -1
  89. package/dist/cli/{chunk-TIRSKEZH.mjs → chunk-JD6HKNKD.mjs} +1 -1
  90. package/dist/cli/{chunk-OHKKDPA5.js → chunk-JQXUWYWX.js} +13 -13
  91. package/dist/cli/{chunk-EACX7QXO.mjs → chunk-KZTNNLIL.mjs} +2 -2
  92. package/dist/cli/{chunk-7K5CWKKZ.mjs → chunk-L352NOE3.mjs} +2 -2
  93. package/dist/cli/{chunk-KGOC6HGI.js → chunk-L7IQ3DFH.js} +53 -53
  94. package/dist/cli/{chunk-4IOY2SCQ.js → chunk-LOX3BISD.js} +4 -4
  95. package/dist/cli/{chunk-6GRZEYSG.js → chunk-NKPTM7SK.js} +7 -7
  96. package/dist/cli/{chunk-VEVGM6B5.js → chunk-NLRTFJGH.js} +14 -14
  97. package/dist/cli/{chunk-UKM74PAA.js → chunk-NRNWPWBW.js} +37 -37
  98. package/dist/cli/{chunk-HNRELVCS.mjs → chunk-ONONSV2Q.mjs} +96 -7
  99. package/dist/cli/{chunk-CYWBAV5H.js → chunk-OW4OTEFF.js} +16 -16
  100. package/dist/cli/{chunk-5K5CAND4.mjs → chunk-RZE5I2XJ.mjs} +4 -4
  101. package/dist/cli/{chunk-3XQIVEAT.js → chunk-S3WQJ5VG.js} +3 -3
  102. package/dist/cli/{chunk-4SFC2XUF.mjs → chunk-SR6S4EYG.mjs} +5 -5
  103. package/dist/cli/{chunk-UWOY74RU.js → chunk-T4G2T5DS.js} +21 -21
  104. package/dist/cli/{chunk-TN2GW57M.mjs → chunk-TMCC7ORQ.mjs} +1 -1
  105. package/dist/cli/{chunk-HEI3BWIV.mjs → chunk-TSCUWWTM.mjs} +1 -1
  106. package/dist/cli/{chunk-DBJ62RAO.js → chunk-TVW6USSG.js} +3 -3
  107. package/dist/cli/{chunk-NW4QJE54.js → chunk-U6WEGDD3.js} +2 -2
  108. package/dist/cli/{chunk-V7JCMBLU.mjs → chunk-UPHXGZCE.mjs} +4 -4
  109. package/dist/cli/{chunk-C62NI2X6.js → chunk-UQ3LQ6IF.js} +5 -5
  110. package/dist/cli/{chunk-5GOG5ZGC.mjs → chunk-VZYTLWOM.mjs} +2 -2
  111. package/dist/cli/{chunk-AF7MOUZP.mjs → chunk-W33OL4F2.mjs} +2 -2
  112. package/dist/cli/{chunk-ZM2YPJQJ.js → chunk-XK5DMLZE.js} +5 -1
  113. package/dist/cli/{chunk-LJ5747UC.mjs → chunk-XRDXNAAY.mjs} +5 -1
  114. package/dist/cli/{chunk-YGN77QA5.mjs → chunk-YDA3PMKK.mjs} +3 -3
  115. package/dist/cli/{csv-S3CHUKI6.js → csv-HFEQPGNY.js} +13 -13
  116. package/dist/cli/{csv-NLWVWD3H.mjs → csv-OHF3Y5KB.mjs} +4 -4
  117. package/dist/cli/{db-OGRPAEEM.mjs → db-M456OUXD.mjs} +7 -7
  118. package/dist/cli/{db-WBSKMMOH.js → db-VLQKCYQS.js} +28 -28
  119. package/dist/cli/describe-CP35DZ5Z.js +49 -0
  120. package/dist/cli/{describe-FAD3Z7LN.mjs → describe-M6VXFYVL.mjs} +21 -21
  121. package/dist/cli/describe-core.d.mts +3 -3
  122. package/dist/cli/describe-core.d.ts +3 -3
  123. package/dist/cli/describe-core.js +4 -4
  124. package/dist/cli/describe-core.mjs +3 -3
  125. package/dist/cli/{executions-LYCL344R.mjs → executions-4FGRBPJF.mjs} +7 -7
  126. package/dist/cli/{executions-SOAZHCY4.js → executions-GKINJZI6.js} +9 -9
  127. package/dist/cli/{feedback-AVF6V7SV.mjs → feedback-D2WMGK3V.mjs} +4 -4
  128. package/dist/cli/{feedback-OROUPUNJ.js → feedback-ZH5K7WV7.js} +8 -8
  129. package/dist/cli/git-IDALMZDN.js +25 -0
  130. package/dist/cli/{git-J5N5M57H.mjs → git-OCIJ5ME4.mjs} +5 -5
  131. package/dist/cli/index.js +142 -139
  132. package/dist/cli/index.mjs +45 -42
  133. package/dist/cli/{legacy-noops-QAQMZMEG.js → legacy-noops-QNIVP7LO.js} +8 -8
  134. package/dist/cli/{legacy-noops-ENRRM7BL.mjs → legacy-noops-V6Q2X34P.mjs} +5 -5
  135. package/dist/cli/{monitors-CKQ65WRL.mjs → monitors-2USHTG5G.mjs} +8 -8
  136. package/dist/cli/{monitors-SFMQ5LFR.js → monitors-5DNK7W2K.js} +92 -92
  137. package/dist/cli/{org-3UNTDLT2.js → org-RPGM5AN4.js} +73 -73
  138. package/dist/cli/{org-K4UIEU5P.mjs → org-TL2YPYSE.mjs} +7 -7
  139. package/dist/cli/{pages-NKZTGB4C.js → pages-PNUKPFWV.js} +18 -18
  140. package/dist/cli/{pages-6GPGBIAH.mjs → pages-XDEW6EE3.mjs} +7 -7
  141. package/dist/cli/{play-BDEADESI.js → play-F5LHRKV5.js} +858 -632
  142. package/dist/cli/{play-62BEE7IX.mjs → play-WINNQ4HZ.mjs} +372 -146
  143. package/dist/cli/{providers-SXGP44GH.js → providers-BD4IS5U5.js} +10 -10
  144. package/dist/cli/{providers-X3CUWMFP.mjs → providers-PXGL3FRE.mjs} +7 -7
  145. package/dist/cli/{quickstart-XQ4426M4.js → quickstart-7LVF6HZF.js} +6 -6
  146. package/dist/cli/{quickstart-7LN22BKX.mjs → quickstart-XTH3UQWZ.mjs} +4 -4
  147. package/dist/cli/{run-XXSN3B5A.mjs → run-MBMUENR7.mjs} +26 -26
  148. package/dist/cli/{run-PBJ4ZJ4W.js → run-NH2BAWPA.js} +41 -41
  149. package/dist/cli/{search-M75VMADD.mjs → search-BMRWBV66.mjs} +8 -8
  150. package/dist/cli/search-R3MQJQMT.js +32 -0
  151. package/dist/cli/{search-output-F6HCFYEI.js → search-output-5NNT337U.js} +22 -16
  152. package/dist/cli/{search-output-NUQAKWDM.mjs → search-output-QKKRD4MF.mjs} +14 -8
  153. package/dist/cli/{secrets-J2H6V33R.mjs → secrets-AWEXBTJV.mjs} +7 -7
  154. package/dist/cli/{secrets-LRYY4QPE.js → secrets-KQSTOREN.js} +16 -16
  155. package/dist/cli/{sessions-YPF62CZE.js → sessions-DSPLZYCJ.js} +6 -6
  156. package/dist/cli/{sessions-IMT336UV.mjs → sessions-RO25Q67X.mjs} +5 -5
  157. package/dist/cli/{settings-35YYC5WA.js → settings-7JXIKNKI.js} +79 -79
  158. package/dist/cli/{settings-PDWVQIGH.mjs → settings-JMGXGK4Z.mjs} +12 -12
  159. package/dist/cli/{setup-UR7GOR7H.js → setup-5QFAQQRW.js} +47 -47
  160. package/dist/cli/{setup-DG5DISSE.mjs → setup-ZQZ47FHB.mjs} +9 -9
  161. package/dist/cli/skills-EDZXY7DV.js +33 -0
  162. package/dist/cli/{skills-U6NJD5J7.mjs → skills-W3H2DL56.mjs} +7 -7
  163. package/dist/cli/{tools-2HGEOELR.mjs → tools-2BZCVNBS.mjs} +19 -19
  164. package/dist/cli/tools-2EY2ETCZ.js +56 -0
  165. package/dist/cli/{update-FRAYBAHK.mjs → update-GAWYMGAW.mjs} +9 -9
  166. package/dist/cli/update-UKDQKNBY.js +33 -0
  167. package/dist/cli/{workflow-DDKVTF36.mjs → workflow-M6LLHQ2I.mjs} +8 -8
  168. package/dist/cli/{workflow-JKKLOMBX.js → workflow-ZPTDFPKW.js} +18 -18
  169. package/dist/{client-DJ3r8VQJ.d.mts → client-BkbDHRIg.d.mts} +1 -1
  170. package/dist/{client-JPSNljtj.d.ts → client-D3hVHXjK.d.ts} +1 -1
  171. package/dist/{client-core-3SJlNsKU.d.mts → client-core-BZoSMKcY.d.mts} +30 -15
  172. package/dist/{client-core-rCoQ5Xz3.d.ts → client-core-DUdVqO_m.d.ts} +30 -15
  173. package/dist/{compiler-manifest-gkO9ZkVg.d.mts → compiler-manifest-BFTwq1HI.d.mts} +1 -1
  174. package/dist/{compiler-manifest-gkO9ZkVg.d.ts → compiler-manifest-BFTwq1HI.d.ts} +1 -1
  175. package/dist/{errors-Cc92LKH-.d.ts → errors-c3pMsylw.d.ts} +1 -1
  176. package/dist/{errors-CeCCOKSA.d.mts → errors-w31ybrQM.d.mts} +1 -1
  177. package/dist/{index-DJQKdV76.d.ts → index-CQ-15-QL.d.ts} +1 -1
  178. package/dist/{index-DsqWJL3Q.d.mts → index-DvNtxucX.d.mts} +1 -1
  179. package/dist/index.d.mts +7 -7
  180. package/dist/index.d.ts +7 -7
  181. package/dist/index.js +10 -10
  182. package/dist/index.mjs +7 -7
  183. package/dist/install-integrity.json +117 -116
  184. package/dist/plays/bundle-play-file.d.mts +3 -3
  185. package/dist/plays/bundle-play-file.d.ts +3 -3
  186. package/dist/plays/bundle-play-file.mjs +2 -2
  187. package/dist/plays/play-description.d.mts +2 -2
  188. package/dist/plays/play-description.d.ts +2 -2
  189. package/dist/plays/run-request.d.mts +2 -2
  190. package/dist/plays/run-request.d.ts +2 -2
  191. package/dist/plays/run-request.js +12 -2
  192. package/dist/plays/run-request.mjs +11 -1
  193. package/dist/release.d.mts +1 -1
  194. package/dist/release.d.ts +1 -1
  195. package/dist/release.js +2 -2
  196. package/dist/release.mjs +1 -1
  197. package/dist/server.d.mts +4 -4
  198. package/dist/server.d.ts +4 -4
  199. package/dist/server.js +6 -6
  200. package/dist/server.mjs +4 -4
  201. package/package.json +1 -1
  202. package/dist/cli/auth-L5CSV3UO.js +0 -43
  203. package/dist/cli/chunk-KA2LNIUP.js +0 -33
  204. package/dist/cli/describe-UIAYCHWW.js +0 -49
  205. package/dist/cli/git-ATMWC27D.js +0 -25
  206. package/dist/cli/search-IGHLRLBD.js +0 -32
  207. package/dist/cli/skills-4U5WC4MJ.js +0 -33
  208. package/dist/cli/tools-PYJTQVVS.js +0 -56
  209. package/dist/cli/update-344OTRFM.js +0 -33
@@ -1,3 +1,4 @@
1
+ import { RuntimeSheetAdmissionRequestTooLargeError } from './runtime-sheet-errors';
1
2
  import {
2
3
  DatasetRowInputView,
3
4
  assertDatasetAdmissionHistory,
@@ -674,6 +675,7 @@ const toolExecutionOverrides = new AsyncLocalStorage<{ force: boolean }>();
674
675
  const PROGRESS_HEARTBEAT_INTERVAL_MS = 1_000;
675
676
 
676
677
  const PURE_JS_HEARTBEAT_ROW_INTERVAL = 250;
678
+ const MAPPED_RESOLVER_HOST_TURN_BUDGET_MS = 16;
677
679
  /** Executed-row sheet persistence chunking: rows AND bytes, whichever first. */
678
680
  const MAP_PERSIST_CHUNK_ROWS = 2_000;
679
681
  const MAP_PERSIST_CHUNK_BYTES = 8 * 1024 * 1024;
@@ -2934,6 +2936,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
2934
2936
  /** Last completed map step — for post-map recordStep calls (e.g. run_javascript). */
2935
2937
  private lastDatasetStep: Extract<PlayStep, { type: 'dataset' }> | null = null;
2936
2938
  private pureMapExecutionActive = false;
2939
+ // One host-turn budget spans concurrent rows, rather than letting every
2940
+ // worker spend a separate slice before timers and cancellation can run.
2941
+ private mappedResolverHostTurnAt: number | null = null;
2942
+ private mappedResolverHostTurn: Promise<void> | null = null;
2937
2943
  /**
2938
2944
  * Active per-map collector of cell meta patches keyed by row key. Fed by
2939
2945
  * emitScopedRowUpdate during a map so executed rows persist with their
@@ -9231,7 +9237,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
9231
9237
  let failedCount = 0;
9232
9238
  let duplicateReuseCount = 0;
9233
9239
  let executedCount = 0;
9234
- let sourceRowsCount = 0;
9240
+ let sourceRowsCount = totalInputCount;
9235
9241
  const failureSamples: Array<{ rowLabel: string; error: string }> = [];
9236
9242
  const failureSampleErrors = new Set<string>();
9237
9243
  const previewRows: Record<string, unknown>[] = [];
@@ -9332,11 +9338,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
9332
9338
  };
9333
9339
 
9334
9340
  const preparePage = async (page: {
9335
- rows: T[];
9341
+ rows: Record<string, unknown>[];
9336
9342
  offset: number;
9337
9343
  }): Promise<PreparedPage> => {
9338
9344
  this.assertRowAdmissionOpen();
9339
- sourceRowsCount += page.rows.length;
9340
9345
  const pageRawItems = page.rows.map((item, index) => {
9341
9346
  const row = this.toOutputRow(item as Record<string, unknown>);
9342
9347
  const sourceIdentity = getPlayDatasetSourceRowIdentityAt(
@@ -9421,6 +9426,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
9421
9426
  : seededItems;
9422
9427
  if (options?.mode === 'net_new') {
9423
9428
  totalInputCount += admittedSeededItems.length;
9429
+ sourceRowsCount += admittedSeededItems.length;
9424
9430
  }
9425
9431
 
9426
9432
  const rowsToExecuteByKey = new Map<
@@ -9809,6 +9815,13 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
9809
9815
  },
9810
9816
  },
9811
9817
  );
9818
+ const preparedPages: AsyncIterable<PreparedPage> = {
9819
+ async *[Symbol.asyncIterator]() {
9820
+ for await (const page of sourcePages) {
9821
+ yield await preparePage(page);
9822
+ }
9823
+ },
9824
+ };
9812
9825
 
9813
9826
  if (pipelinePages) {
9814
9827
  // One worker pool for the whole source. Once page N's last row has
@@ -9830,10 +9843,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
9830
9843
  latestPageMemoryEstimate = prepared.memoryEstimate;
9831
9844
  rowFeed.append(prepared.rows.length);
9832
9845
  };
9833
- const pageIterator = sourcePages[Symbol.asyncIterator]();
9846
+ const pageIterator = preparedPages[Symbol.asyncIterator]();
9834
9847
  const firstPage = await pageIterator.next();
9835
9848
  if (!firstPage.done) {
9836
- appendPreparedPage(await preparePage(firstPage.value));
9849
+ appendPreparedPage(firstPage.value);
9837
9850
  }
9838
9851
  const pump = (async () => {
9839
9852
  try {
@@ -9842,7 +9855,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
9842
9855
  await rowFeed.waitUntilDrained();
9843
9856
  const next = await pageIterator.next();
9844
9857
  if (next.done) break;
9845
- appendPreparedPage(await preparePage(next.value));
9858
+ appendPreparedPage(next.value);
9846
9859
  }
9847
9860
  }
9848
9861
  rowFeed.close();
@@ -9870,8 +9883,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
9870
9883
  await pump;
9871
9884
  }
9872
9885
  } else {
9873
- for await (const page of sourcePages) {
9874
- const prepared = await preparePage(page);
9886
+ for await (const prepared of preparedPages) {
9875
9887
  await runPreparedRows({
9876
9888
  rows: prepared.rows,
9877
9889
  rowKeys: prepared.rowKeys,
@@ -10790,11 +10802,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10790
10802
  );
10791
10803
  const durableCompletedRows = durableProgress.completedRows;
10792
10804
  const durableFailedRows = durableProgress.failedRows;
10805
+ // Duplicate inputs reuse their representative's outcome; they do not
10806
+ // establish a successful row when that representative failed.
10807
+ const allAdmittedRowsFailed =
10808
+ durableFailedRows > 0 && durableCompletedRows - reusedCount === 0;
10793
10809
  const terminalFrame = this.checkpoint.mapFrames?.[mapScope.mapInvocationId];
10794
10810
  if (terminalFrame) {
10795
10811
  this.setMapFrame({
10796
10812
  ...terminalFrame,
10797
- status: 'completed',
10813
+ status: allAdmittedRowsFailed ? 'failed' : 'completed',
10798
10814
  // Incremental rows add keys after their commit. Pure maps use the
10799
10815
  // durable aggregate count below instead of materializing up to millions
10800
10816
  // of keys only to mark the terminal frame.
@@ -10812,7 +10828,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10812
10828
  });
10813
10829
  }
10814
10830
  this.emitExecutionEvent({
10815
- type: 'map.completed',
10831
+ type: allAdmittedRowsFailed ? 'map.failed' : 'map.completed',
10816
10832
  mapInvocationId: mapScope.mapInvocationId,
10817
10833
  mapNodeId: mapScope.mapNodeId ?? null,
10818
10834
  logicalNamespace: mapScope.logicalNamespace,
@@ -10882,6 +10898,17 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10882
10898
  staticPipeline: this.currentStaticPipeline,
10883
10899
  });
10884
10900
 
10901
+ // In-memory inputs have the same failure contract as streamed inputs:
10902
+ // preserve every failed row, then fail rather than return an empty success.
10903
+ if (allAdmittedRowsFailed) {
10904
+ throw new AllAdmittedRowsFailedError({
10905
+ mapName: normalizedMapNamespace,
10906
+ failedCount: durableFailedRows,
10907
+ totalInputCount: durableFailedRows,
10908
+ samples: mapResult.failureSamples,
10909
+ });
10910
+ }
10911
+
10885
10912
  // This map's terminal rows have already crossed the persistence barrier
10886
10913
  // above. Keep that verified snapshot as the authored return value instead
10887
10914
  // of immediately re-reading the Runtime Sheet projection. A second read
@@ -11682,7 +11709,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
11682
11709
  currentCellMeta &&
11683
11710
  typeof currentCellMeta === 'object' &&
11684
11711
  !Array.isArray(currentCellMeta)
11685
- ? (currentCellMeta as { status?: unknown; reused?: unknown })
11712
+ ? (currentCellMeta as {
11713
+ status?: unknown;
11714
+ reused?: unknown;
11715
+ completedAt?: unknown;
11716
+ })
11686
11717
  : null;
11687
11718
  const currentCellStatus = currentCellRecord?.status ?? null;
11688
11719
  if (currentCellStatus === 'skipped') {
@@ -11720,7 +11751,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
11720
11751
  status: cellWasReused ? 'cached' : 'completed',
11721
11752
  stage: cellWasReused ? 'cached' : 'completed',
11722
11753
  ...(cellWasReused ? { reused: true } : {}),
11723
- completedAt: Date.now(),
11754
+ completedAt:
11755
+ cellWasReused &&
11756
+ typeof currentCellRecord?.completedAt === 'number' &&
11757
+ Number.isFinite(currentCellRecord.completedAt)
11758
+ ? currentCellRecord.completedAt
11759
+ : Date.now(),
11724
11760
  dataPatch: shouldPersistMapCellField(fieldName)
11725
11761
  ? { [fieldName]: cellValue }
11726
11762
  : {},
@@ -11789,12 +11825,25 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
11789
11825
  });
11790
11826
  // Each row retains its own deadline. Provider names are not rate
11791
11827
  // scopes: two credentials for one provider can recover separately.
11828
+ const observedNowMs = Date.now();
11829
+ const localRetryAtMs = error.localRetryAtMs ?? error.retryAtMs;
11830
+ const readyAtMs =
11831
+ localRetryAtMs <= observedNowMs
11832
+ ? observedNowMs + 1_000
11833
+ : localRetryAtMs;
11792
11834
  retryAfterRelease.pending = {
11793
11835
  rowIndex: idx,
11794
11836
  provider: error.provider,
11795
11837
  retryAtMs: error.retryAtMs,
11796
- readyAtMs: Math.max(Date.now() + 1_000, error.retryAtMs),
11797
- ...(error.residentWaitBudgetExhausted
11838
+ // Honor a future provider deadline without extending its hold.
11839
+ // Only expired deadlines need the anti-spin retry backoff.
11840
+ readyAtMs,
11841
+ // This queue bit forces idle handoff for a spent call whose
11842
+ // provider deadline already expired. A future deadline can use
11843
+ // the map's separate bounded idle wait without renewing the
11844
+ // logical call's sticky resident-wait budget.
11845
+ ...(error.residentWaitBudgetExhausted &&
11846
+ localRetryAtMs <= observedNowMs
11798
11847
  ? { residentWaitBudgetExhausted: true }
11799
11848
  : {}),
11800
11849
  };
@@ -11823,6 +11872,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
11823
11872
  provider: error.provider,
11824
11873
  retry_at: new Date(error.retryAtMs).toISOString(),
11825
11874
  wait_ms: Math.max(0, error.retryAtMs - Date.now()),
11875
+ ...(error.localRetryAtMs !== undefined
11876
+ ? {
11877
+ local_retry_at: new Date(
11878
+ error.localRetryAtMs,
11879
+ ).toISOString(),
11880
+ }
11881
+ : {}),
11882
+ ready_at: new Date(readyAtMs).toISOString(),
11883
+ resident_wait_budget_exhausted: error.residentWaitBudgetExhausted,
11826
11884
  row_key_digest: stableDigest(rowKey),
11827
11885
  field: fieldName,
11828
11886
  })}`,
@@ -11979,8 +12037,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
11979
12037
  ? parkedProviderRows.takeReady(Date.now())
11980
12038
  : providerRowRetries.takeReady(Date.now());
11981
12039
  if (!providerRetry && nextRowIndex >= items.length) {
11982
- // Spent calls may join productive work, but only an unspent call can
11983
- // keep an otherwise idle sandbox waiting for its next deadline.
12040
+ // Spent zero/expired holds may join productive work, but cannot keep
12041
+ // an otherwise idle sandbox waiting past the artificial ready floor.
11984
12042
  const nextRetry = nextProviderRetry(mapProgress.activeResolvers > 0);
11985
12043
  if (
11986
12044
  nextRetry &&
@@ -12331,11 +12389,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
12331
12389
  const parkedHold = parkedProviderRows.peek();
12332
12390
  const earliestHold =
12333
12391
  !residentHold ||
12334
- (parkedHold && parkedHold.retryAtMs < residentHold.retryAtMs)
12392
+ (parkedHold && parkedHold.readyAtMs < residentHold.readyAtMs)
12335
12393
  ? parkedHold
12336
12394
  : residentHold;
12337
12395
  const providerWakeAtMs = earliestHold
12338
- ? Math.max(Date.now() + 1_000, earliestHold.retryAtMs)
12396
+ ? Math.max(Date.now() + 1_000, earliestHold.readyAtMs)
12339
12397
  : null;
12340
12398
  const checkpointUpdates = this.activeMapCheckpointUpdatesForTable(
12341
12399
  normalizedTableNamespace,
@@ -13165,9 +13223,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
13165
13223
  requests: ToolCallRequest[];
13166
13224
  laneKeys: Set<string>;
13167
13225
  nextDeadlineMs: number | null;
13226
+ pendingResolverHostTurn: Promise<void> | null;
13168
13227
  } {
13169
13228
  if (this.toolCallQueue.length === 0) {
13170
- return { requests: [], laneKeys: new Set(), nextDeadlineMs: null };
13229
+ return {
13230
+ requests: [],
13231
+ laneKeys: new Set(),
13232
+ nextDeadlineMs: null,
13233
+ pendingResolverHostTurn: null,
13234
+ };
13171
13235
  }
13172
13236
 
13173
13237
  const laneCounts = new Map<string, number>();
@@ -13224,6 +13288,27 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
13224
13288
  remainingLaneKeys.add(lane.key);
13225
13289
  }
13226
13290
  }
13291
+ // A CPU fairness yield can interrupt admission of an already-ready row
13292
+ // cohort. Keep full groups moving, but do not split its native-batch tail
13293
+ // merely because those same-run resolvers are joining their host turn.
13294
+ // This joins the existing yield, never a provider or another run's work.
13295
+ if (
13296
+ requests.length > 0 &&
13297
+ requests.length < this.governor.policy.concurrency.toolCalls &&
13298
+ this.mappedResolverHostTurn &&
13299
+ requests.some(
13300
+ (request) =>
13301
+ (this.#options.getBatchOperationStrategy?.(request.toolId)
13302
+ ?.maxBatchSize ?? 1) > 1,
13303
+ )
13304
+ ) {
13305
+ return {
13306
+ requests: [],
13307
+ laneKeys: new Set(),
13308
+ nextDeadlineMs: null,
13309
+ pendingResolverHostTurn: this.mappedResolverHostTurn,
13310
+ };
13311
+ }
13227
13312
  this.toolCallQueue = remaining;
13228
13313
  const selectedLaneKeys = new Set(selectedByLane.keys());
13229
13314
  for (const laneKey of selectedLaneKeys) {
@@ -13231,7 +13316,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
13231
13316
  this.toolDispatchQueuedAtByLane.delete(laneKey);
13232
13317
  }
13233
13318
  }
13234
- return { requests, laneKeys: selectedLaneKeys, nextDeadlineMs };
13319
+ return {
13320
+ requests,
13321
+ laneKeys: selectedLaneKeys,
13322
+ nextDeadlineMs,
13323
+ pendingResolverHostTurn: null,
13324
+ };
13235
13325
  }
13236
13326
 
13237
13327
  private waitForToolDispatcherWake(deadlineMs: number | null): Promise<void> {
@@ -13434,6 +13524,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
13434
13524
  promises: Promise<T>[],
13435
13525
  earlyExitCheck?: () => RuntimeToolDrainExit | null,
13436
13526
  ): Promise<void> {
13527
+ const dispatcherStartedAt = performance.now();
13437
13528
  // One dispatcher owns ready work, fixed lane coalescing deadlines, and the
13438
13529
  // bounded in-flight registry. A row resumes after its own receipt persists;
13439
13530
  // it never waits for unrelated sibling calls from the previous column.
@@ -13493,6 +13584,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
13493
13584
  // handle open without polling scheduler state; actual work wakes the
13494
13585
  // dispatcher through queue/in-flight/row-settlement signals.
13495
13586
  const keepAlive = setInterval(() => undefined, 1_000);
13587
+ let dispatchedAny = false;
13496
13588
  try {
13497
13589
  let pass = 0;
13498
13590
  while (true) {
@@ -13540,12 +13632,18 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
13540
13632
  requests: [] as ToolCallRequest[],
13541
13633
  laneKeys: new Set<string>(),
13542
13634
  nextDeadlineMs: null,
13635
+ pendingResolverHostTurn: null,
13543
13636
  }
13544
13637
  : this.takeDispatchableToolCalls(
13545
13638
  this.toolBatchDispatcherNowMs(),
13546
13639
  blockedLaneKeys,
13547
13640
  );
13641
+ if (dispatchable.pendingResolverHostTurn) {
13642
+ await dispatchable.pendingResolverHostTurn;
13643
+ continue;
13644
+ }
13548
13645
  if (dispatchable.requests.length > 0) {
13646
+ dispatchedAny = true;
13549
13647
  pass += 1;
13550
13648
  this.runtimeLog(` Batch pass ${pass}`);
13551
13649
  this.runtimeLog(
@@ -13622,9 +13720,43 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
13622
13720
  }
13623
13721
  } finally {
13624
13722
  clearInterval(keepAlive);
13723
+ if (dispatchedAny) {
13724
+ this.logRunnerDiagnostic(
13725
+ `[perf-trace] ${JSON.stringify({
13726
+ ts: Date.now(),
13727
+ source: 'runner',
13728
+ runId: this.currentRunId,
13729
+ phase: 'runner.map_work_drain.total',
13730
+ ms: Math.max(0, performance.now() - dispatcherStartedAt),
13731
+ })}`,
13732
+ );
13733
+ }
13625
13734
  }
13626
13735
  }
13627
13736
 
13737
+ private mappedResolverHostPause(): Promise<void> | null {
13738
+ if (this.mappedResolverHostTurn) return this.mappedResolverHostTurn;
13739
+ const now = performance.now();
13740
+ this.mappedResolverHostTurnAt ??= now;
13741
+ if (
13742
+ now - this.mappedResolverHostTurnAt <
13743
+ MAPPED_RESOLVER_HOST_TURN_BUDGET_MS
13744
+ )
13745
+ return null;
13746
+ let resolveTurn!: () => void;
13747
+ const turn = new Promise<void>((resolve) => {
13748
+ resolveTurn = resolve;
13749
+ });
13750
+ this.mappedResolverHostTurn = turn;
13751
+ const resume = () => {
13752
+ this.mappedResolverHostTurnAt = performance.now();
13753
+ this.mappedResolverHostTurn = null;
13754
+ resolveTurn();
13755
+ };
13756
+ setTimeout(resume, 0);
13757
+ return turn;
13758
+ }
13759
+
13628
13760
  private async resolveMapFieldValue<T>(
13629
13761
  resolver: MapFieldResolver<T>,
13630
13762
  row: T,
@@ -13636,6 +13768,16 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
13636
13768
  return resolver;
13637
13769
  }
13638
13770
 
13771
+ for (;;) {
13772
+ const pause = this.mappedResolverHostPause();
13773
+ if (pause === null) break;
13774
+ await pause;
13775
+ // Each resumed worker rechecks the shared budget before calling user
13776
+ // code. A row-local cancellation must never reject the shared barrier.
13777
+ // Admission deadlines still allow already-admitted rows to finish.
13778
+ this.assertNoPendingDurableSuspension();
13779
+ }
13780
+
13639
13781
  let value: unknown;
13640
13782
  try {
13641
13783
  value = await resolver(row, this, fields, index, previousCell);
@@ -14016,6 +14158,32 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
14016
14158
  if (freshness.source !== 'executed') {
14017
14159
  const row = rowContext.getStore();
14018
14160
  if (row?.fieldName && row.tableNamespace && row.rowKey) {
14161
+ // Recovery resumes this intended call. Its durable trace may
14162
+ // already contain the producer; appending it again would count
14163
+ // every replay as another logical call. A new reusable-result
14164
+ // read still records its own cached attempt.
14165
+ let recoveredAttempt: PlayCellProducerAttempt | undefined;
14166
+ if (freshness.source === 'operation_recovery') {
14167
+ const { producers = [] } = this.resolveCellProducers(
14168
+ row.rowKey,
14169
+ row.fieldName,
14170
+ );
14171
+ for (let index = producers.length - 1; index >= 0; index -= 1) {
14172
+ const attempt = producers[index]!;
14173
+ if (
14174
+ attempt.kind === 'tool' &&
14175
+ attempt.id === normalizedKey &&
14176
+ attempt.toolId === toolId
14177
+ ) {
14178
+ recoveredAttempt = attempt;
14179
+ break;
14180
+ }
14181
+ }
14182
+ }
14183
+ if (recoveredAttempt?.outcome === 'running') {
14184
+ recoveredAttempt.outcome = 'cached';
14185
+ delete recoveredAttempt.waiting;
14186
+ }
14019
14187
  this.emitScopedFieldMetaUpdate({
14020
14188
  rowId: row.rowId,
14021
14189
  key: row.rowKey,
@@ -14027,6 +14195,28 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
14027
14195
  provider: null,
14028
14196
  error: null,
14029
14197
  reused: true,
14198
+ // Reuse bypasses the dispatcher that normally records the
14199
+ // cell's producer. Keep the source observation's timestamp;
14200
+ // reading a receipt is not a new provider observation.
14201
+ completedAt: freshness.completedAt,
14202
+ producer: {
14203
+ kind: 'tool',
14204
+ id: normalizedKey,
14205
+ toolId,
14206
+ displayName: displayNameFromProducerId(toolId),
14207
+ },
14208
+ ...(!recoveredAttempt
14209
+ ? {
14210
+ producerAttempt: {
14211
+ kind: 'tool' as const,
14212
+ id: normalizedKey,
14213
+ toolId,
14214
+ at: freshness.completedAt,
14215
+ outcome: 'cached' as const,
14216
+ durationMs: 0,
14217
+ },
14218
+ }
14219
+ : {}),
14030
14220
  dataPatch: {},
14031
14221
  });
14032
14222
  }
@@ -16943,6 +17133,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
16943
17133
  observeRuntimeGatewayResponse(meta: RuntimeApiResponseMeta): void {
16944
17134
  const timing = meta.serverTiming ?? null;
16945
17135
  this.resourceGovernor.observe({
17136
+ gatewayAction: meta.action,
17137
+ gatewayResponseFlightMs: meta.responseFlightMs ?? null,
17138
+ gatewayResponseHeadersMs: meta.responseHeadersMs ?? null,
17139
+ gatewayResponseBodyDecodeMs: meta.responseBodyDecodeMs ?? null,
16946
17140
  gatewayRoundTripMs: meta.roundTripMs ?? null,
16947
17141
  gatewayAuthLaunchMs: timing?.authLaunchMs ?? null,
16948
17142
  gatewayAuthVerifyMs: timing?.authVerifyMs ?? null,
@@ -19318,13 +19512,16 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
19318
19512
  networkScope: null,
19319
19513
  },
19320
19514
  );
19321
- const observeProviderWait = (retryAtMs: number) => {
19515
+ const observeProviderWait = (
19516
+ retryAtMs: number,
19517
+ noProgressRetryAtMs = retryAtMs,
19518
+ ) => {
19322
19519
  const startedAtMsByScope =
19323
19520
  (this.checkpoint.providerNoProgressStartedAtMsByScope ??= {});
19324
19521
  const outcome = observeProviderNoProgress({
19325
19522
  startedAtMsByScope,
19326
19523
  scope: providerNoProgressScope,
19327
- retryAtMs,
19524
+ retryAtMs: noProgressRetryAtMs,
19328
19525
  nowMs: Date.now(),
19329
19526
  });
19330
19527
  if (!outcome.exhausted) return;
@@ -20939,11 +21136,17 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
20939
21136
  }
20940
21137
  if (error instanceof ProviderExhaustedError) {
20941
21138
  const retryAtMs = Date.parse(error.retryAt);
21139
+ const localRetryAtMs = error.localRetryAtMs ?? retryAtMs;
20942
21140
  observeProviderWait(
20943
21141
  Number.isFinite(retryAtMs) ? retryAtMs : Date.now() + 1_000,
21142
+ Number.isFinite(localRetryAtMs)
21143
+ ? localRetryAtMs
21144
+ : Number.isFinite(retryAtMs)
21145
+ ? retryAtMs
21146
+ : Date.now() + 1_000,
20944
21147
  );
20945
- const waitMs = Number.isFinite(retryAtMs)
20946
- ? Math.max(0, Math.ceil(retryAtMs - Date.now()))
21148
+ const waitMs = Number.isFinite(localRetryAtMs)
21149
+ ? Math.max(0, Math.ceil(localRetryAtMs - Date.now()))
20947
21150
  : 1_000;
20948
21151
  if (
20949
21152
  !this.#options.durableBoundaries ||
@@ -20964,6 +21167,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
20964
21167
  error.provider,
20965
21168
  Number.isFinite(retryAtMs) ? retryAtMs : Date.now(),
20966
21169
  markProviderResidentWaitBudgetExhausted(),
21170
+ error.localRetryAtMs,
20967
21171
  );
20968
21172
  }
20969
21173
  // This is a provider admission hold, not a row outcome.
@@ -20973,7 +21177,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
20973
21177
  // reusable and this tool can re-admit safely.
20974
21178
  await this.waitForProviderBackpressure(
20975
21179
  error.provider,
20976
- Number.isFinite(retryAtMs) ? retryAtMs : Date.now(),
21180
+ Number.isFinite(localRetryAtMs)
21181
+ ? localRetryAtMs
21182
+ : Date.now(),
20977
21183
  );
20978
21184
  continue;
20979
21185
  }
@@ -1,7 +1,16 @@
1
1
  import type { Daytona } from '@daytonaio/sdk';
2
+ import type { PlaySandboxSize } from '../plays/sandbox-runtime-limits';
2
3
 
3
4
  export const DAYTONA_DEFAULT_WORKDIR = '/home/daytona';
4
5
 
6
+ // Daytona snapshots carry fixed resource allocations. Select the provider
7
+ // snapshot for the validated profile instead of resizing a snapshot create.
8
+ export const DAYTONA_SNAPSHOT_BY_PLAY_SANDBOX_SIZE = {
9
+ standard: 'daytona-small',
10
+ large: 'daytona-medium',
11
+ xlarge: 'daytona-large',
12
+ } as const satisfies Record<PlaySandboxSize, string>;
13
+
5
14
  export type DaytonaClientOptions = NonNullable<
6
15
  ConstructorParameters<typeof Daytona>[0]
7
16
  >;