deepline 0.3.484 → 0.3.486

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 (210) 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/ledger-safe-payload.ts +8 -4
  18. package/dist/bundling-sources/shared_libs/play-runtime/log-provenance.ts +11 -6
  19. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +3 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/ports.ts +2 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/postgres-adapter.ts +2 -1
  22. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +30 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +195 -2
  24. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +20 -1
  25. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +15 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +2 -2
  27. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +139 -67
  28. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/progress-sidecar.ts +9 -1
  29. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-control-transport.ts +25 -5
  30. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +133 -82
  31. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +58 -16
  32. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-sandbox-absence.ts +171 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +69 -0
  34. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +100 -40
  35. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +8 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +67 -9
  37. package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +5 -5
  38. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +6 -3
  39. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-errors.ts +14 -0
  40. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-writer.ts +87 -31
  41. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +18 -0
  42. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/index.ts +19 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +14 -0
  44. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +206 -7
  45. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +39 -0
  46. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +12 -1
  47. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +28 -9
  48. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +44 -15
  49. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +60 -11
  50. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +656 -64
  51. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +6 -1
  52. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +17 -0
  53. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +25 -33
  54. package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +12 -0
  55. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +21 -0
  56. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +1 -1
  57. package/dist/bundling-sources/shared_libs/plays/source-authoring-edition.ts +1 -1
  58. package/dist/cli/auth-ARKH3OAU.js +43 -0
  59. package/dist/cli/{auth-EBFOTF7X.mjs → auth-B4DJO4FB.mjs} +5 -5
  60. package/dist/cli/{billing-G2G3EF3I.js → billing-GDWAMARK.js} +80 -80
  61. package/dist/cli/{billing-2ZOIMW5V.mjs → billing-IIQ3VNXU.mjs} +7 -7
  62. package/dist/cli/{chunk-YWC5AN26.mjs → chunk-2DVFQYPG.mjs} +62 -34
  63. package/dist/cli/{chunk-UWOY74RU.js → chunk-5DUP4ZUE.js} +21 -21
  64. package/dist/cli/{chunk-EACX7QXO.mjs → chunk-5QYZ4MEW.mjs} +2 -2
  65. package/dist/cli/{chunk-HEI3BWIV.mjs → chunk-5RLVCOKH.mjs} +1 -1
  66. package/dist/cli/{chunk-TIRSKEZH.mjs → chunk-5Y7LLRWO.mjs} +1 -1
  67. package/dist/cli/{chunk-IXWQOVNW.js → chunk-5YILTBF7.js} +87 -76
  68. package/dist/cli/{chunk-OHKKDPA5.js → chunk-7FTQKEZ6.js} +13 -13
  69. package/dist/cli/{chunk-TN2GW57M.mjs → chunk-A456YVDE.mjs} +1 -1
  70. package/dist/cli/{chunk-GVAENVIG.js → chunk-AUQQVDAB.js} +110 -21
  71. package/dist/cli/{chunk-3XQIVEAT.js → chunk-BJL7RYQN.js} +3 -3
  72. package/dist/cli/{chunk-2AWYJXBX.js → chunk-BNB2RK4L.js} +5 -5
  73. package/dist/cli/{chunk-U7IJAGWB.js → chunk-BYEDI5PM.js} +7 -7
  74. package/dist/cli/{chunk-RLLEH2SP.js → chunk-C4GFBB52.js} +26 -26
  75. package/dist/cli/{chunk-AK7UKQ5R.js → chunk-CSBMKHTV.js} +5 -5
  76. package/dist/cli/{chunk-UT4YMA2N.js → chunk-DFHS5XVZ.js} +5 -4
  77. package/dist/cli/{chunk-XZXIWPT3.mjs → chunk-F3G2HAUQ.mjs} +1 -1
  78. package/dist/cli/{chunk-C62NI2X6.js → chunk-FCAKAW6S.js} +5 -5
  79. package/dist/cli/{chunk-AF7MOUZP.mjs → chunk-FGPJXQEJ.mjs} +2 -2
  80. package/dist/cli/chunk-FSCOYTRV.js +42 -0
  81. package/dist/cli/{chunk-6GRZEYSG.js → chunk-GCEUOHJW.js} +7 -7
  82. package/dist/cli/{chunk-SD7QWZTV.mjs → chunk-INW22YP7.mjs} +1 -1
  83. package/dist/cli/{chunk-OWUZKXE7.mjs → chunk-J7EENGKJ.mjs} +1 -1
  84. package/dist/cli/{chunk-QIDDTIVZ.js → chunk-KPIVQFXZ.js} +322 -294
  85. package/dist/cli/{chunk-4IOY2SCQ.js → chunk-LOX3BISD.js} +4 -4
  86. package/dist/cli/{chunk-WYUCDLVR.mjs → chunk-MJ56FCYU.mjs} +2 -1
  87. package/dist/cli/{chunk-DBJ62RAO.js → chunk-NSPMJLYA.js} +3 -3
  88. package/dist/cli/{chunk-HNRELVCS.mjs → chunk-ONONSV2Q.mjs} +96 -7
  89. package/dist/cli/{chunk-PU52JXKA.mjs → chunk-P6KGYOCM.mjs} +13 -4
  90. package/dist/cli/{chunk-VEVGM6B5.js → chunk-PCYZDTDC.js} +14 -14
  91. package/dist/cli/{chunk-NW4QJE54.js → chunk-PHWFY26F.js} +2 -2
  92. package/dist/cli/{chunk-LTZXLYKE.mjs → chunk-PKOFEHZL.mjs} +93 -17
  93. package/dist/cli/{chunk-7K5CWKKZ.mjs → chunk-PQHDZHZG.mjs} +2 -2
  94. package/dist/cli/{chunk-UKM74PAA.js → chunk-PTM3QRAT.js} +37 -37
  95. package/dist/cli/{chunk-YGN77QA5.mjs → chunk-PV7AYBKQ.mjs} +3 -3
  96. package/dist/cli/{chunk-4OEOM6GP.mjs → chunk-PYDHVRAF.mjs} +5 -5
  97. package/dist/cli/{chunk-FRD5WFT4.js → chunk-QD22TY33.js} +323 -247
  98. package/dist/cli/{chunk-5KNRQWHE.js → chunk-QEQ3KHVY.js} +3 -3
  99. package/dist/cli/{chunk-KGOC6HGI.js → chunk-S5EYODEG.js} +53 -53
  100. package/dist/cli/{chunk-FQK7BULS.js → chunk-S7OILDJH.js} +1 -1
  101. package/dist/cli/{chunk-TRLDJNVE.mjs → chunk-T3Q6BMVH.mjs} +1 -1
  102. package/dist/cli/{chunk-5K5CAND4.mjs → chunk-TBE2K5W4.mjs} +4 -4
  103. package/dist/cli/{chunk-YHA3EV3I.mjs → chunk-TE2QT2MX.mjs} +15 -4
  104. package/dist/cli/{chunk-ZOKM7DVA.js → chunk-TNHY3ATN.js} +8 -8
  105. package/dist/cli/{chunk-4OVHIWE7.mjs → chunk-U23L57VU.mjs} +2 -2
  106. package/dist/cli/{chunk-5GOG5ZGC.mjs → chunk-UEJLWUJ3.mjs} +2 -2
  107. package/dist/cli/{chunk-6NPWXE32.mjs → chunk-VJLL5XIP.mjs} +1 -1
  108. package/dist/cli/{chunk-WXRM3UC6.mjs → chunk-WCOJH4W4.mjs} +3 -3
  109. package/dist/cli/{chunk-4SFC2XUF.mjs → chunk-XAZWUW6I.mjs} +5 -5
  110. package/dist/cli/{chunk-ZM2YPJQJ.js → chunk-XK5DMLZE.js} +5 -1
  111. package/dist/cli/{chunk-LJ5747UC.mjs → chunk-XRDXNAAY.mjs} +5 -1
  112. package/dist/cli/{chunk-V7JCMBLU.mjs → chunk-YIKHNZ6B.mjs} +4 -4
  113. package/dist/cli/{chunk-M4PG7FGC.js → chunk-YS6JOYYS.js} +2 -2
  114. package/dist/cli/{chunk-DEXSQGXB.mjs → chunk-ZMRZ3BXG.mjs} +5 -5
  115. package/dist/cli/{chunk-CYWBAV5H.js → chunk-ZQI26KE4.js} +16 -16
  116. package/dist/cli/{csv-S3CHUKI6.js → csv-3PSMPZM5.js} +13 -13
  117. package/dist/cli/{csv-NLWVWD3H.mjs → csv-LFCT3WQ4.mjs} +4 -4
  118. package/dist/cli/{db-OGRPAEEM.mjs → db-HULKVAMU.mjs} +7 -7
  119. package/dist/cli/{db-WBSKMMOH.js → db-R7I2PPTV.js} +28 -28
  120. package/dist/cli/{describe-FAD3Z7LN.mjs → describe-D55V42LH.mjs} +21 -21
  121. package/dist/cli/describe-H47BLOEP.js +49 -0
  122. package/dist/cli/describe-core.d.mts +3 -3
  123. package/dist/cli/describe-core.d.ts +3 -3
  124. package/dist/cli/describe-core.js +4 -4
  125. package/dist/cli/describe-core.mjs +3 -3
  126. package/dist/cli/{executions-LYCL344R.mjs → executions-ICVVOYVG.mjs} +7 -7
  127. package/dist/cli/{executions-SOAZHCY4.js → executions-O37FN2SK.js} +9 -9
  128. package/dist/cli/{feedback-AVF6V7SV.mjs → feedback-3K3QPGCQ.mjs} +4 -4
  129. package/dist/cli/{feedback-OROUPUNJ.js → feedback-MAZQ7C6S.js} +8 -8
  130. package/dist/cli/{git-J5N5M57H.mjs → git-2MMD5KJS.mjs} +5 -5
  131. package/dist/cli/git-RQ2XLFYZ.js +25 -0
  132. package/dist/cli/index.js +142 -139
  133. package/dist/cli/index.mjs +45 -42
  134. package/dist/cli/{legacy-noops-QAQMZMEG.js → legacy-noops-2OX2Y3Y2.js} +8 -8
  135. package/dist/cli/{legacy-noops-ENRRM7BL.mjs → legacy-noops-VLSWJ6VE.mjs} +5 -5
  136. package/dist/cli/{monitors-CKQ65WRL.mjs → monitors-2NODQQWG.mjs} +8 -8
  137. package/dist/cli/{monitors-SFMQ5LFR.js → monitors-UCSV5FOR.js} +92 -92
  138. package/dist/cli/{org-3UNTDLT2.js → org-4YY73VTW.js} +73 -73
  139. package/dist/cli/{org-K4UIEU5P.mjs → org-W7AUQCDE.mjs} +7 -7
  140. package/dist/cli/{pages-NKZTGB4C.js → pages-FBZEUMXK.js} +18 -18
  141. package/dist/cli/{pages-6GPGBIAH.mjs → pages-ZRP7U5PO.mjs} +7 -7
  142. package/dist/cli/{play-BDEADESI.js → play-LFCTQJXA.js} +858 -632
  143. package/dist/cli/{play-62BEE7IX.mjs → play-XF2BSGTP.mjs} +372 -146
  144. package/dist/cli/{providers-SXGP44GH.js → providers-5456JNHP.js} +10 -10
  145. package/dist/cli/{providers-X3CUWMFP.mjs → providers-SICAPKGI.mjs} +7 -7
  146. package/dist/cli/{quickstart-XQ4426M4.js → quickstart-2KLLIPIU.js} +6 -6
  147. package/dist/cli/{quickstart-7LN22BKX.mjs → quickstart-IBVG6GX6.mjs} +4 -4
  148. package/dist/cli/{run-PBJ4ZJ4W.js → run-DNLDGJRC.js} +41 -41
  149. package/dist/cli/{run-XXSN3B5A.mjs → run-XPIZIQ7H.mjs} +26 -26
  150. package/dist/cli/search-2KQA65LH.js +32 -0
  151. package/dist/cli/{search-M75VMADD.mjs → search-PW22AEAL.mjs} +8 -8
  152. package/dist/cli/{search-output-F6HCFYEI.js → search-output-H6F6QMRF.js} +22 -16
  153. package/dist/cli/{search-output-NUQAKWDM.mjs → search-output-JFD53H2N.mjs} +14 -8
  154. package/dist/cli/{secrets-J2H6V33R.mjs → secrets-542CTZRZ.mjs} +7 -7
  155. package/dist/cli/{secrets-LRYY4QPE.js → secrets-LCCRRAN7.js} +16 -16
  156. package/dist/cli/{sessions-YPF62CZE.js → sessions-5FYDQE3N.js} +6 -6
  157. package/dist/cli/{sessions-IMT336UV.mjs → sessions-CALLS2XD.mjs} +5 -5
  158. package/dist/cli/{settings-PDWVQIGH.mjs → settings-GSKPHUEC.mjs} +12 -12
  159. package/dist/cli/{settings-35YYC5WA.js → settings-ORGKOBP6.js} +79 -79
  160. package/dist/cli/{setup-UR7GOR7H.js → setup-4BUWJKB6.js} +47 -47
  161. package/dist/cli/{setup-DG5DISSE.mjs → setup-V57GHVAF.mjs} +9 -9
  162. package/dist/cli/skills-KYZPPGSN.js +33 -0
  163. package/dist/cli/{skills-U6NJD5J7.mjs → skills-NGLCFQFT.mjs} +7 -7
  164. package/dist/cli/tools-AFYXUEMD.js +56 -0
  165. package/dist/cli/{tools-2HGEOELR.mjs → tools-G2YNCFNX.mjs} +19 -19
  166. package/dist/cli/{update-FRAYBAHK.mjs → update-IZ3Z5T5C.mjs} +9 -9
  167. package/dist/cli/update-T6JJ7A3K.js +33 -0
  168. package/dist/cli/{workflow-JKKLOMBX.js → workflow-7AHST2XV.js} +18 -18
  169. package/dist/cli/{workflow-DDKVTF36.mjs → workflow-L7ROQIM7.mjs} +8 -8
  170. package/dist/{client-DJ3r8VQJ.d.mts → client-BkbDHRIg.d.mts} +1 -1
  171. package/dist/{client-JPSNljtj.d.ts → client-D3hVHXjK.d.ts} +1 -1
  172. package/dist/{client-core-3SJlNsKU.d.mts → client-core-BZoSMKcY.d.mts} +30 -15
  173. package/dist/{client-core-rCoQ5Xz3.d.ts → client-core-DUdVqO_m.d.ts} +30 -15
  174. package/dist/{compiler-manifest-gkO9ZkVg.d.mts → compiler-manifest-BFTwq1HI.d.mts} +1 -1
  175. package/dist/{compiler-manifest-gkO9ZkVg.d.ts → compiler-manifest-BFTwq1HI.d.ts} +1 -1
  176. package/dist/{errors-Cc92LKH-.d.ts → errors-c3pMsylw.d.ts} +1 -1
  177. package/dist/{errors-CeCCOKSA.d.mts → errors-w31ybrQM.d.mts} +1 -1
  178. package/dist/{index-DJQKdV76.d.ts → index-CQ-15-QL.d.ts} +1 -1
  179. package/dist/{index-DsqWJL3Q.d.mts → index-DvNtxucX.d.mts} +1 -1
  180. package/dist/index.d.mts +7 -7
  181. package/dist/index.d.ts +7 -7
  182. package/dist/index.js +10 -10
  183. package/dist/index.mjs +7 -7
  184. package/dist/install-integrity.json +117 -116
  185. package/dist/plays/bundle-play-file.d.mts +3 -3
  186. package/dist/plays/bundle-play-file.d.ts +3 -3
  187. package/dist/plays/bundle-play-file.mjs +2 -2
  188. package/dist/plays/play-description.d.mts +2 -2
  189. package/dist/plays/play-description.d.ts +2 -2
  190. package/dist/plays/run-request.d.mts +2 -2
  191. package/dist/plays/run-request.d.ts +2 -2
  192. package/dist/plays/run-request.js +12 -2
  193. package/dist/plays/run-request.mjs +11 -1
  194. package/dist/release.d.mts +1 -1
  195. package/dist/release.d.ts +1 -1
  196. package/dist/release.js +2 -2
  197. package/dist/release.mjs +1 -1
  198. package/dist/server.d.mts +4 -4
  199. package/dist/server.d.ts +4 -4
  200. package/dist/server.js +6 -6
  201. package/dist/server.mjs +4 -4
  202. package/package.json +1 -1
  203. package/dist/cli/auth-L5CSV3UO.js +0 -43
  204. package/dist/cli/chunk-KA2LNIUP.js +0 -33
  205. package/dist/cli/describe-UIAYCHWW.js +0 -49
  206. package/dist/cli/git-ATMWC27D.js +0 -25
  207. package/dist/cli/search-IGHLRLBD.js +0 -32
  208. package/dist/cli/skills-4U5WC4MJ.js +0 -33
  209. package/dist/cli/tools-PYJTQVVS.js +0 -56
  210. package/dist/cli/update-344OTRFM.js +0 -33
@@ -107,6 +107,12 @@ export type StoredPlayArtifactPayload = {
107
107
  export type RuntimeStatusUpdate = {
108
108
  playId: string;
109
109
  status: string;
110
+ /**
111
+ * Set by a progress reporter's live flush only. Run Ledger intake then
112
+ * fences the batch on `liveLogProducerAttempt`; any runner-result finalize
113
+ * leaves it unset because it is designed to land after the terminal.
114
+ */
115
+ liveProgress?: boolean;
110
116
  error?: string;
111
117
  runtimeBackend?: string | null;
112
118
  artifactHash?: string | null;
@@ -206,6 +212,8 @@ type RuntimeApiRequest =
206
212
  action: 'append_run_events' | 'project_run_events';
207
213
  playId: string;
208
214
  events: PlayRunLedgerIngressEvent[];
215
+ /** Live progress only: intake commits while this attempt is current. */
216
+ progressAttempt?: number;
209
217
  idempotencyKey?: string;
210
218
  deliveryIdempotencyKey?: string;
211
219
  deliveryLeaseOwner?: string;
@@ -374,6 +382,10 @@ export type WorkerRuntimeApiContext = {
374
382
  executorToken: string;
375
383
  /** Exact ingress-prefix verifier advertised by the immutable launch receiver. */
376
384
  runLedgerIngressPrefixBatching?: true;
385
+ /** The launch receiver advertised that it stores retained pipeline graphs. */
386
+ retainedPipelineGraphs?: true;
387
+ /** `fetch` invokes the receiver in-process, so no ingress body limit applies. */
388
+ bypassesIngressLimit?: true;
377
389
  boundary?: 'app_runtime' | 'receipt_gateway';
378
390
  integrationMode?: 'live' | 'eval_stub' | 'fixture' | null;
379
391
  vercelProtectionBypassToken?: string | null;
@@ -449,6 +461,12 @@ export type RuntimeApiResponseMeta = {
449
461
  requestId: string | null;
450
462
  /** Client-measured wall of the responding attempt: request send to response. */
451
463
  roundTripMs?: number | null;
464
+ /** Final successful physical send to parsed JSON; excludes bypass handshakes. */
465
+ responseFlightMs?: number | null;
466
+ /** Final successful physical send to response headers. */
467
+ responseHeadersMs?: number | null;
468
+ /** Headers to parsed JSON, including body delivery and local decoding. */
469
+ responseBodyDecodeMs?: number | null;
452
470
  /** Absent when the gateway sent no `Server-Timing` header. */
453
471
  serverTiming?: RuntimeGatewayServerTiming | null;
454
472
  /**
@@ -578,10 +596,13 @@ export function parseRuntimeGatewayServerTiming(
578
596
  }
579
597
 
580
598
  const APP_RUNTIME_API_RETRY_DELAYS_MS = [100, 250, 500, 1_000] as const;
581
- // Vercel Function ingress rejects request bodies above 4.5 MB. Keep normal
582
- // map update requests well below it and leave room for a single large row.
599
+ // Vercel Function ingress rejects request bodies above 4.5 MB.
600
+ export const APP_RUNTIME_REQUEST_BODY_MAX_BYTES = 4_450_000;
601
+ // Keep normal map update requests well below it and leave room for a single
602
+ // large row.
583
603
  const APP_RUNTIME_ROW_UPDATE_BATCH_TARGET_BYTES = 3 * 1024 * 1024;
584
- const APP_RUNTIME_ROW_UPDATE_REQUEST_MAX_BYTES = 4_450_000;
604
+ const APP_RUNTIME_ROW_UPDATE_REQUEST_MAX_BYTES =
605
+ APP_RUNTIME_REQUEST_BODY_MAX_BYTES;
585
606
  const APP_RUNTIME_JSON_ENCODER = new TextEncoder();
586
607
  const APP_RUNTIME_API_RECEIPT_RETRY_DELAYS_MS = [
587
608
  250, 500, 1_000, 2_000, 4_000, 8_000, 12_000,
@@ -712,12 +733,19 @@ async function suppressBulkClaimResponseUntilTimeout(
712
733
 
713
734
  async function appendRunEventBatchesViaAppRuntime(
714
735
  context: WorkerRuntimeApiContext,
715
- input: { playId: string; events: readonly PlayRunLedgerEvent[] },
736
+ input: {
737
+ playId: string;
738
+ events: readonly PlayRunLedgerEvent[];
739
+ progressAttempt?: number;
740
+ },
716
741
  ): Promise<void> {
717
742
  for (const events of partitionRunEventsForAppRuntime(input.events)) {
718
743
  await appendRunEventsViaAppRuntimeRaw(context, {
719
744
  playId: input.playId,
720
745
  events,
746
+ ...(input.progressAttempt === undefined
747
+ ? {}
748
+ : { progressAttempt: input.progressAttempt }),
721
749
  });
722
750
  }
723
751
  }
@@ -1367,6 +1395,7 @@ async function retryAppRuntimeBodyTimeoutOrThrow(input: {
1367
1395
  attempts: input.attempt,
1368
1396
  transportAttemptId: input.transportAttemptId,
1369
1397
  cause: input.error,
1398
+ responseReceived: true,
1370
1399
  boundaryLabel: input.boundaryLabel,
1371
1400
  });
1372
1401
  }
@@ -1383,12 +1412,15 @@ export class AppRuntimeApiTransportError extends Error {
1383
1412
  readonly action: RuntimeApiRequest['action'];
1384
1413
  readonly attempts: number;
1385
1414
  readonly transportAttemptId: string | null;
1415
+ /** True when headers arrived before transport exhaustion; old callers omit it. */
1416
+ readonly responseReceived?: boolean;
1386
1417
 
1387
1418
  constructor(input: {
1388
1419
  action: RuntimeApiRequest['action'];
1389
1420
  attempts: number;
1390
1421
  transportAttemptId?: string | null;
1391
1422
  cause: unknown;
1423
+ responseReceived?: boolean;
1392
1424
  boundaryLabel?: string;
1393
1425
  }) {
1394
1426
  const causeMessage =
@@ -1404,6 +1436,7 @@ export class AppRuntimeApiTransportError extends Error {
1404
1436
  this.action = input.action;
1405
1437
  this.attempts = input.attempts;
1406
1438
  this.transportAttemptId = input.transportAttemptId ?? null;
1439
+ this.responseReceived = input.responseReceived;
1407
1440
  }
1408
1441
  }
1409
1442
 
@@ -1413,6 +1446,17 @@ export class AppRuntimeApiTransportError extends Error {
1413
1446
  * Keep the response contract structured here so durable callers can decide
1414
1447
  * whether to retry or block a delivery without parsing an error message.
1415
1448
  */
1449
+ /** Run Ledger intake refused a live progress batch whose attempt ended. */
1450
+ export function isRunnerProgressAttemptSupersededResponse(
1451
+ error: unknown,
1452
+ ): boolean {
1453
+ return (
1454
+ error instanceof AppRuntimeApiResponseError &&
1455
+ error.status === 409 &&
1456
+ error.code === 'RUNNER_PROGRESS_ATTEMPT_SUPERSEDED'
1457
+ );
1458
+ }
1459
+
1416
1460
  export class AppRuntimeApiResponseError extends Error {
1417
1461
  readonly action: RuntimeApiRequest['action'];
1418
1462
  readonly status: number;
@@ -1723,49 +1767,58 @@ async function postAppRuntimeApiAttempts<TResponse>(
1723
1767
  ? AbortSignal.any([context.signal, AbortSignal.timeout(requestTimeoutMs)])
1724
1768
  : AbortSignal.timeout(requestTimeoutMs);
1725
1769
  let response: Response;
1770
+ let responseHeadersAtMs: number | undefined;
1771
+ let responseSendStartedAtMs: number | undefined;
1726
1772
  const runtimeTestFaultHeader = runtimeTestFaultHeaderForRequest({
1727
1773
  body,
1728
1774
  runtimeTestFaultHeader: context.runtimeTestFaultHeader,
1729
1775
  });
1730
1776
  try {
1731
- const sendRequest = (protectionHeaders: Record<string, string>) =>
1732
- runtimeFetch(resolveAppRuntimeApiUrl(context), {
1733
- method: 'POST',
1734
- headers: {
1735
- // The payload is JSON either way; `content-encoding` describes only
1736
- // how those JSON bytes were packed for the wire.
1737
- 'content-type': 'application/json',
1738
- ...(wireBody.contentEncoding
1739
- ? { 'content-encoding': wireBody.contentEncoding }
1740
- : {}),
1741
- authorization: `Bearer ${token}`,
1742
- [LEGACY_RUNTIME_RECEIPT_WIRE_HEADER]: String(
1743
- LEGACY_RUNTIME_RECEIPT_WIRE_FORMAT,
1744
- ),
1745
- [PLAY_RUNTIME_TRANSPORT_ATTEMPT_HEADER]: transportAttemptId,
1746
- ...protectionHeaders,
1747
- ...(context.preferredReceiptGatewayMachineId?.trim()
1748
- ? {
1749
- 'fly-force-instance-id':
1750
- context.preferredReceiptGatewayMachineId.trim(),
1751
- }
1752
- : {}),
1753
- ...(runtimeTestFaultHeader
1754
- ? {
1755
- [PLAY_RUNTIME_TEST_FAULT_HEADER]: runtimeTestFaultHeader,
1756
- }
1757
- : {}),
1777
+ const sendRequest = async (protectionHeaders: Record<string, string>) => {
1778
+ responseSendStartedAtMs = Date.now();
1779
+ const sentResponse = await runtimeFetch(
1780
+ resolveAppRuntimeApiUrl(context),
1781
+ {
1782
+ method: 'POST',
1783
+ headers: {
1784
+ // The payload is JSON either way; `content-encoding` describes only
1785
+ // how those JSON bytes were packed for the wire.
1786
+ 'content-type': 'application/json',
1787
+ ...(wireBody.contentEncoding
1788
+ ? { 'content-encoding': wireBody.contentEncoding }
1789
+ : {}),
1790
+ authorization: `Bearer ${token}`,
1791
+ [LEGACY_RUNTIME_RECEIPT_WIRE_HEADER]: String(
1792
+ LEGACY_RUNTIME_RECEIPT_WIRE_FORMAT,
1793
+ ),
1794
+ [PLAY_RUNTIME_TRANSPORT_ATTEMPT_HEADER]: transportAttemptId,
1795
+ ...protectionHeaders,
1796
+ ...(context.preferredReceiptGatewayMachineId?.trim()
1797
+ ? {
1798
+ 'fly-force-instance-id':
1799
+ context.preferredReceiptGatewayMachineId.trim(),
1800
+ }
1801
+ : {}),
1802
+ ...(runtimeTestFaultHeader
1803
+ ? {
1804
+ [PLAY_RUNTIME_TEST_FAULT_HEADER]: runtimeTestFaultHeader,
1805
+ }
1806
+ : {}),
1807
+ },
1808
+ // DOM fetch accepts ArrayBuffer, while Node 24 deliberately rejects a
1809
+ // Uint8Array backed by an arbitrary ArrayBufferLike. Copy only the
1810
+ // compressed branch into an exact ArrayBuffer; its wire bytes remain
1811
+ // identical and the plain JSON fast path stays allocation-free.
1812
+ body:
1813
+ typeof wireBody.body === 'string'
1814
+ ? wireBody.body
1815
+ : Uint8Array.from(wireBody.body).buffer,
1816
+ signal: requestSignal,
1758
1817
  },
1759
- // DOM fetch accepts ArrayBuffer, while Node 24 deliberately rejects a
1760
- // Uint8Array backed by an arbitrary ArrayBufferLike. Copy only the
1761
- // compressed branch into an exact ArrayBuffer; its wire bytes remain
1762
- // identical and the plain JSON fast path stays allocation-free.
1763
- body:
1764
- typeof wireBody.body === 'string'
1765
- ? wireBody.body
1766
- : Uint8Array.from(wireBody.body).buffer,
1767
- signal: requestSignal,
1768
- });
1818
+ );
1819
+ responseHeadersAtMs = Date.now();
1820
+ return sentResponse;
1821
+ };
1769
1822
  response = fastRunLedgerBypass
1770
1823
  ? await fetchWithVercelProtectionBypass({
1771
1824
  baseUrl,
@@ -1858,6 +1911,7 @@ async function postAppRuntimeApiAttempts<TResponse>(
1858
1911
  if (response.ok) {
1859
1912
  try {
1860
1913
  const parsed = (await response.json()) as TResponse;
1914
+ const responseDecodedAtMs = Date.now();
1861
1915
  if (
1862
1916
  shouldSuppressBulkClaimResponse({
1863
1917
  body,
@@ -1884,6 +1938,19 @@ async function postAppRuntimeApiAttempts<TResponse>(
1884
1938
  // gateway's own timings are subtracted from this to leave the
1885
1939
  // network and TLS cost of the hop.
1886
1940
  roundTripMs: Date.now() - attemptStartedAt,
1941
+ responseFlightMs:
1942
+ responseSendStartedAtMs === undefined
1943
+ ? null
1944
+ : responseDecodedAtMs - responseSendStartedAtMs,
1945
+ responseHeadersMs:
1946
+ responseHeadersAtMs === undefined ||
1947
+ responseSendStartedAtMs === undefined
1948
+ ? null
1949
+ : responseHeadersAtMs - responseSendStartedAtMs,
1950
+ responseBodyDecodeMs:
1951
+ responseHeadersAtMs === undefined
1952
+ ? null
1953
+ : responseDecodedAtMs - responseHeadersAtMs,
1887
1954
  serverTiming: parseRuntimeGatewayServerTiming(
1888
1955
  response.headers.get('server-timing'),
1889
1956
  ),
@@ -2721,11 +2788,23 @@ async function updateRunStatusViaAppRuntimeUnlocked(
2721
2788
  return;
2722
2789
  }
2723
2790
  const combinedEvents = [...events, ...terminalLogEvents];
2791
+ // Only a patch the producer marks as live progress asks intake to fence on
2792
+ // its attempt. A runner-result finalize can arrive as `running` with no
2793
+ // replay lines, so status and log shape cannot identify it; it is designed
2794
+ // to land after the terminal and stays unfenced.
2795
+ const progressAttempt =
2796
+ update.liveProgress === true &&
2797
+ update.status === 'running' &&
2798
+ terminalLogEvents.length === 0 &&
2799
+ typeof update.liveLogProducerAttempt === 'number'
2800
+ ? update.liveLogProducerAttempt
2801
+ : undefined;
2724
2802
  if (partitionRunEventsForAppRuntime(combinedEvents).length === 1) {
2725
2803
  // Preserve the single-mutation fast path for ordinary bounded updates.
2726
2804
  await appendRunEventsViaAppRuntime(context, {
2727
2805
  playId: update.playId,
2728
2806
  events: combinedEvents,
2807
+ ...(progressAttempt === undefined ? {} : { progressAttempt }),
2729
2808
  });
2730
2809
  } else {
2731
2810
  // Persist terminal lifecycle first so an oversized or interrupted
@@ -2735,6 +2814,7 @@ async function updateRunStatusViaAppRuntimeUnlocked(
2735
2814
  await appendRunEventBatchesViaAppRuntime(context, {
2736
2815
  playId: update.playId,
2737
2816
  events,
2817
+ ...(progressAttempt === undefined ? {} : { progressAttempt }),
2738
2818
  });
2739
2819
  await appendRunEventBatchesViaAppRuntime(context, {
2740
2820
  playId: update.playId,
@@ -2761,6 +2841,7 @@ async function appendRunEventsViaAppRuntimeRaw(
2761
2841
  input: {
2762
2842
  playId: string;
2763
2843
  events: PlayRunLedgerIngressEvent[];
2844
+ progressAttempt?: number;
2764
2845
  idempotencyKey?: string;
2765
2846
  },
2766
2847
  ): Promise<void> {
@@ -2891,6 +2972,7 @@ export async function appendRunEventsViaAppRuntime(
2891
2972
  input: {
2892
2973
  playId: string;
2893
2974
  events: PlayRunLedgerIngressEvent[];
2975
+ progressAttempt?: number;
2894
2976
  idempotencyKey?: string;
2895
2977
  },
2896
2978
  ): Promise<void> {
@@ -2926,6 +3008,9 @@ export async function appendRunEventsViaAppRuntime(
2926
3008
  await appendRunEventsViaAppRuntimeRaw(context, {
2927
3009
  playId: input.playId,
2928
3010
  events: batches[index]!,
3011
+ ...(input.progressAttempt === undefined
3012
+ ? {}
3013
+ : { progressAttempt: input.progressAttempt }),
2929
3014
  ...(input.idempotencyKey && index === idempotencyBatchIndex
2930
3015
  ? { idempotencyKey: input.idempotencyKey }
2931
3016
  : {}),