deepline 0.3.552 → 0.3.554

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 (323) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +107 -12
  2. package/dist/bundling-sources/sdk/src/compat.ts +239 -87
  3. package/dist/bundling-sources/sdk/src/config.ts +113 -2
  4. package/dist/bundling-sources/sdk/src/errors.ts +2 -0
  5. package/dist/bundling-sources/sdk/src/http-core.ts +118 -8
  6. package/dist/bundling-sources/sdk/src/index.ts +2 -0
  7. package/dist/bundling-sources/sdk/src/integrations.ts +6 -4
  8. package/dist/bundling-sources/sdk/src/play.ts +3 -0
  9. package/dist/bundling-sources/sdk/src/plays/run-request.ts +1 -1
  10. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  11. package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +8 -1
  12. package/dist/bundling-sources/sdk/src/tool-calls.ts +2 -1
  13. package/dist/bundling-sources/sdk/src/tool-failure-hint.ts +104 -0
  14. package/dist/bundling-sources/sdk/src/types.ts +9 -1
  15. package/dist/bundling-sources/shared_libs/integration-contracts/billing-entitlements.ts +4 -2
  16. package/dist/bundling-sources/shared_libs/integration-contracts/billing-plan-skus.ts +25 -0
  17. package/dist/bundling-sources/shared_libs/monitors/action-actor.ts +2 -0
  18. package/dist/bundling-sources/shared_libs/monitors/billing/credit-recovery.ts +58 -4
  19. package/dist/bundling-sources/shared_libs/monitors/billing/policy-builders.ts +8 -0
  20. package/dist/bundling-sources/shared_libs/monitors/billing/pricing.ts +11 -0
  21. package/dist/bundling-sources/shared_libs/monitors/billing/types.ts +13 -0
  22. package/dist/bundling-sources/shared_libs/monitors/deactivation-reasons.ts +103 -5
  23. package/dist/bundling-sources/shared_libs/monitors/fleets/converge-admission.ts +133 -0
  24. package/dist/bundling-sources/shared_libs/monitors/fleets/fence-attention.ts +165 -0
  25. package/dist/bundling-sources/shared_libs/monitors/fleets/fence-release.ts +726 -0
  26. package/dist/bundling-sources/shared_libs/monitors/fleets/fence-walk.ts +274 -0
  27. package/dist/bundling-sources/shared_libs/monitors/fleets/issues.ts +1 -0
  28. package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +28 -0
  29. package/dist/bundling-sources/shared_libs/monitors/fleets/provider-bulk-wait.ts +126 -0
  30. package/dist/bundling-sources/shared_libs/monitors/fleets/shared-payload.ts +189 -0
  31. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +28 -0
  32. package/dist/bundling-sources/shared_libs/monitors/inbound-publish-key.ts +4 -0
  33. package/dist/bundling-sources/shared_libs/monitors/inventory-counter-errors.ts +25 -0
  34. package/dist/bundling-sources/shared_libs/monitors/org-monitor-limits.ts +65 -0
  35. package/dist/bundling-sources/shared_libs/monitors/package.json +9 -0
  36. package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +152 -1
  37. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +6 -0
  38. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts +390 -10
  39. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts +34 -0
  40. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +66 -30
  41. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-state.ts +30 -0
  42. package/dist/bundling-sources/shared_libs/monitors/provider-resource-failure.ts +26 -3
  43. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +41 -13
  44. package/dist/bundling-sources/shared_libs/monitors/signal-radars/raw-receipt-causes.ts +219 -0
  45. package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +21 -10
  46. package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +13 -0
  47. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +6 -0
  48. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +13 -0
  49. package/dist/bundling-sources/shared_libs/observability/dlq.ts +1 -1
  50. package/dist/bundling-sources/shared_libs/observability/log-metadata.ts +5 -3
  51. package/dist/bundling-sources/shared_libs/observability/queue-health.ts +10 -1
  52. package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
  53. package/dist/bundling-sources/shared_libs/observability/redaction.ts +24 -1
  54. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +168 -41
  55. package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +1 -2
  56. package/dist/bundling-sources/shared_libs/play-data-plane/preview-r2-oidc.ts +188 -0
  57. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +170 -16
  58. package/dist/bundling-sources/shared_libs/play-data-plane/runtime-sheet-storage-contract.ts +5 -0
  59. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +68 -2
  60. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +444 -39
  61. package/dist/bundling-sources/shared_libs/play-runtime/ctx-fetch-caller-deadline.ts +200 -0
  62. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +6 -0
  63. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-topology.ts +21 -1
  64. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +3 -2
  65. package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +70 -2
  66. package/dist/bundling-sources/shared_libs/play-runtime/durable-tool-identity.ts +3 -3
  67. package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +16 -0
  68. package/dist/bundling-sources/shared_libs/play-runtime/experiment-switches.ts +72 -0
  69. package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +1 -0
  70. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +7 -1
  71. package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +62 -0
  72. package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +74 -3
  73. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +31 -3
  74. package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +6 -0
  75. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +8 -0
  76. package/dist/bundling-sources/shared_libs/play-runtime/query-result-dataset.ts +19 -0
  77. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +39 -2
  78. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +9 -1
  79. package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +33 -0
  80. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +24 -0
  81. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +254 -44
  82. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +87 -6
  83. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +241 -10
  84. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox-egress.ts +161 -14
  85. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +16 -3
  86. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-compression.ts +37 -0
  87. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +9 -0
  88. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +259 -52
  89. package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +13 -0
  90. package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +30 -0
  91. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +62 -1
  92. package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +36 -0
  93. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +36 -0
  94. package/dist/bundling-sources/shared_libs/play-runtime/runtime-speed-profile.ts +206 -2
  95. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +42 -0
  96. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +185 -64
  97. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-slot-ledger.ts +157 -0
  98. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +110 -2
  99. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-listener-hint.ts +323 -0
  100. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/executor-attempt-standing.ts +72 -0
  101. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/integration-operation-value-storage.ts +23 -4
  102. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-workspace-purge.ts +199 -0
  103. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +632 -66
  104. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +517 -16
  105. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +1 -1
  106. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-value-storage.ts +9 -0
  107. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +599 -2
  108. package/dist/bundling-sources/shared_libs/play-runtime/secret-resolution-retry-policy.ts +26 -1
  109. package/dist/bundling-sources/shared_libs/play-runtime/startup-read-tool-ids.ts +60 -0
  110. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +51 -0
  111. package/dist/bundling-sources/shared_libs/play-runtime/tool-call-retry-facts.ts +2 -0
  112. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +113 -3
  113. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +5 -7
  114. package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +2 -0
  115. package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +3 -0
  116. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +40 -5
  117. package/dist/bundling-sources/shared_libs/plays/deploy/api-client.ts +3 -0
  118. package/dist/bundling-sources/shared_libs/plays/deploy/control-plane-types.ts +16 -0
  119. package/dist/bundling-sources/shared_libs/plays/deploy/run-deployment.ts +10 -41
  120. package/dist/bundling-sources/shared_libs/plays/extension-bridge.ts +33 -0
  121. package/dist/bundling-sources/shared_libs/plays/row-identity.ts +18 -1
  122. package/dist/bundling-sources/shared_libs/plays/tool-execution-error.ts +108 -0
  123. package/dist/bundling-sources/shared_libs/plays/trigger-config-contract.ts +14 -0
  124. package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +171 -0
  125. package/dist/bundling-sources/shared_libs/product-notifications/events.ts +27 -1
  126. package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +9 -24
  127. package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +178 -5
  128. package/dist/bundling-sources/shared_libs/security/signup-email-dns-screen.ts +148 -0
  129. package/dist/bundling-sources/shared_libs/tool-execution-error.ts +108 -0
  130. package/dist/cli/{auth-KVSBJZOX.mjs → auth-HJUNW7T2.mjs} +8 -7
  131. package/dist/cli/auth-SP6SKZJZ.js +44 -0
  132. package/dist/cli/{billing-FQREA7UA.js → billing-4TSA5HEC.js} +297 -161
  133. package/dist/cli/{billing-54RHFEBI.mjs → billing-SJYRJAQ2.mjs} +197 -61
  134. package/dist/cli/{chunk-4MK42735.js → chunk-2HMN5H54.js} +215 -130
  135. package/dist/cli/{chunk-UBKA33KY.mjs → chunk-2MGZAI54.mjs} +17 -0
  136. package/dist/cli/{chunk-EOPEYCY7.mjs → chunk-2ORPFQUA.mjs} +18 -18
  137. package/dist/cli/{chunk-RQZQVFCJ.js → chunk-2OVHNHCF.js} +2 -2
  138. package/dist/cli/{chunk-QX7LFGJR.mjs → chunk-33WRQSQ2.mjs} +1874 -91
  139. package/dist/cli/{chunk-UPMRIVZB.js → chunk-3IKGZ4CG.js} +74 -13
  140. package/dist/cli/{chunk-EUPVF4SU.mjs → chunk-3Z4VFCXO.mjs} +8 -8
  141. package/dist/cli/{chunk-GKYAYLRI.js → chunk-4DOFGIEJ.js} +27 -31
  142. package/dist/cli/{chunk-4TALT2M3.mjs → chunk-52Q5KETX.mjs} +69 -3
  143. package/dist/cli/{chunk-RBEUVDZF.js → chunk-5CYZHOKI.js} +249 -107
  144. package/dist/cli/{chunk-LX35AXTN.mjs → chunk-5TYLSS4Q.mjs} +6 -6
  145. package/dist/cli/{chunk-IYSTRCLX.mjs → chunk-62AUAWQV.mjs} +4 -4
  146. package/dist/cli/{chunk-ZIAXDBXX.mjs → chunk-62HWJXST.mjs} +17 -21
  147. package/dist/cli/{chunk-QY3ZNU6Z.mjs → chunk-6EXOAT6T.mjs} +2 -2
  148. package/dist/cli/{chunk-EITMD3A5.js → chunk-6VLFQZK6.js} +8 -8
  149. package/dist/cli/{chunk-ADRC5I3R.js → chunk-7OWI736E.js} +30 -30
  150. package/dist/cli/{chunk-NURW5XH4.mjs → chunk-ASB47RXJ.mjs} +1 -1
  151. package/dist/cli/{chunk-PTVD2GVQ.mjs → chunk-B6HO2XWH.mjs} +13 -13
  152. package/dist/cli/{chunk-YJHE3O5M.mjs → chunk-BOZAP2EM.mjs} +141 -56
  153. package/dist/cli/chunk-BVXIGOBZ.js +32 -0
  154. package/dist/cli/{chunk-XDVT3GOM.js → chunk-CFJFUVX2.js} +18 -1
  155. package/dist/cli/{chunk-WE5HES3H.mjs → chunk-D6Z6POKE.mjs} +151 -43
  156. package/dist/cli/{chunk-AZQ264ID.mjs → chunk-DSKSFFK2.mjs} +1 -1
  157. package/dist/cli/{chunk-SHLFOPD6.js → chunk-DUBXUAAO.js} +5 -5
  158. package/dist/cli/{chunk-V436Z54K.js → chunk-E2G2DNAB.js} +3 -1
  159. package/dist/cli/{chunk-HO3XK3R7.js → chunk-E74KGKFZ.js} +8 -8
  160. package/dist/cli/{chunk-77AAAGVB.js → chunk-ECHKAC7M.js} +2 -2
  161. package/dist/cli/{chunk-KWSH5T7K.js → chunk-EN5NHCCQ.js} +21 -21
  162. package/dist/cli/{chunk-6RZOWL2V.mjs → chunk-F7CMRKSK.mjs} +1 -1
  163. package/dist/cli/{chunk-JWUAX6OP.js → chunk-FBAFX43W.js} +11 -11
  164. package/dist/cli/{chunk-AQWQ2BFX.mjs → chunk-FXQ3JKE3.mjs} +1 -1
  165. package/dist/cli/{chunk-QPKH23EC.mjs → chunk-GA2M3G3Y.mjs} +5 -5
  166. package/dist/cli/{chunk-G4O75EXF.js → chunk-GHT2NDL7.js} +18 -18
  167. package/dist/cli/{chunk-MF2GHZDO.js → chunk-GRZENGNE.js} +2 -2
  168. package/dist/cli/{chunk-4UUR4TCH.js → chunk-IVZKMJUK.js} +1875 -92
  169. package/dist/cli/{chunk-FTJLJCE5.mjs → chunk-KVBQY4ST.mjs} +3 -3
  170. package/dist/cli/{chunk-S5S355UY.mjs → chunk-KZHBDMGF.mjs} +12 -12
  171. package/dist/cli/{chunk-BBTKAASQ.js → chunk-LFQJW4S2.js} +42 -1
  172. package/dist/cli/{chunk-6ZORHRKB.mjs → chunk-LRZGS6RZ.mjs} +2 -0
  173. package/dist/cli/{chunk-2WFPHBR4.js → chunk-LY5MMXFF.js} +47 -29
  174. package/dist/cli/{chunk-BAIST2BR.js → chunk-M7STM3MZ.js} +36 -36
  175. package/dist/cli/{chunk-SL6MYJYM.js → chunk-MJTVX4QK.js} +35 -35
  176. package/dist/cli/{chunk-45PVGZST.js → chunk-OPTV7D2V.js} +508 -361
  177. package/dist/cli/{chunk-PFO3ISXA.js → chunk-OVEYWO4H.js} +174 -129
  178. package/dist/cli/{chunk-BGBJV26E.mjs → chunk-PC2FTUCP.mjs} +4 -4
  179. package/dist/cli/{chunk-WLN3SUIA.js → chunk-PQQMPUCZ.js} +3 -3
  180. package/dist/cli/{chunk-HYC4MKGK.mjs → chunk-Q7ACILL2.mjs} +5 -5
  181. package/dist/cli/{chunk-CBV7AKWM.js → chunk-R6DZ6NQ2.js} +5 -5
  182. package/dist/cli/{chunk-57VZVF5D.mjs → chunk-RBBTCYQB.mjs} +3 -3
  183. package/dist/cli/{chunk-F2LH7TGF.js → chunk-RTHMGSZX.js} +21 -21
  184. package/dist/cli/{chunk-YLTMXJFC.mjs → chunk-S6W6SJ6E.mjs} +158 -16
  185. package/dist/cli/chunk-STXDSVQZ.mjs +32 -0
  186. package/dist/cli/{chunk-WEHCBH5R.mjs → chunk-TGUQET3O.mjs} +67 -6
  187. package/dist/cli/{chunk-IHRKLXZN.js → chunk-TJ6HLN56.js} +5 -5
  188. package/dist/cli/{chunk-3FD5EQ62.js → chunk-TOO3YM5N.js} +6 -7
  189. package/dist/cli/{chunk-QILKGXYF.mjs → chunk-UBBYHB2B.mjs} +2 -2
  190. package/dist/cli/{chunk-6PRW5UBA.mjs → chunk-UC4BDZKI.mjs} +299 -69
  191. package/dist/cli/{chunk-634ZDA3F.js → chunk-UNNOZKRT.js} +1 -1
  192. package/dist/cli/{chunk-IDVVIXPJ.js → chunk-UOT7HPBH.js} +41 -41
  193. package/dist/cli/{chunk-6YCA5NKJ.js → chunk-UYCZFQYQ.js} +12 -12
  194. package/dist/cli/{chunk-7IKQKKNX.js → chunk-VIUUTEHY.js} +90 -24
  195. package/dist/cli/{chunk-Z5TSLLOW.mjs → chunk-VLO5NFH2.mjs} +63 -18
  196. package/dist/cli/{chunk-U7QRMBIY.mjs → chunk-VQ75KX7G.mjs} +5 -5
  197. package/dist/cli/{chunk-4NQF6KJ3.js → chunk-VV4XGZ24.js} +13 -13
  198. package/dist/cli/{chunk-FSIVF2SI.mjs → chunk-VZGLIK5U.mjs} +1 -1
  199. package/dist/cli/{chunk-S46HWQKO.js → chunk-W6CZDTIR.js} +69 -69
  200. package/dist/cli/{chunk-XVB7V4N7.js → chunk-WL7P32PI.js} +161 -53
  201. package/dist/cli/{chunk-DJ2JDK4O.mjs → chunk-XD3MFTHA.mjs} +1 -1
  202. package/dist/cli/{chunk-GGGAEVCX.mjs → chunk-XFZX6FNM.mjs} +40 -22
  203. package/dist/cli/{chunk-AWJPDPMA.mjs → chunk-XU6QNM4D.mjs} +1 -1
  204. package/dist/cli/{chunk-QAORXEY3.mjs → chunk-YCOGPOUX.mjs} +6 -7
  205. package/dist/cli/{chunk-VQALXEXO.js → chunk-YQKCH4R7.js} +348 -118
  206. package/dist/cli/{chunk-6O5HOODW.mjs → chunk-YY55NYAH.mjs} +207 -60
  207. package/dist/cli/{chunk-JL2OTMSG.mjs → chunk-Z3A2S3QM.mjs} +41 -0
  208. package/dist/cli/command-docs.js +3 -3
  209. package/dist/cli/command-docs.mjs +2 -2
  210. package/dist/cli/{concurrent-runs-help-Q4KPAUJX.mjs → concurrent-runs-help-O3Q5IPLF.mjs} +9 -8
  211. package/dist/cli/concurrent-runs-help-ZFRZWX5V.js +22 -0
  212. package/dist/cli/{csv-F5VAGX4K.js → csv-4ZQ2RATI.js} +16 -15
  213. package/dist/cli/{csv-2PTVDNO6.mjs → csv-Y3BFPEM6.mjs} +7 -6
  214. package/dist/cli/{db-IEDXAUF7.mjs → db-3JYY4JNN.mjs} +17 -17
  215. package/dist/cli/{db-Z3OIUFMM.js → db-VEIFS4M7.js} +45 -45
  216. package/dist/cli/describe-EVJ4MFVU.mjs +50 -0
  217. package/dist/cli/describe-FG625QPF.js +50 -0
  218. package/dist/cli/describe-core.d.mts +3 -3
  219. package/dist/cli/describe-core.d.ts +3 -3
  220. package/dist/cli/describe-core.js +7 -7
  221. package/dist/cli/describe-core.mjs +6 -6
  222. package/dist/cli/{executions-H6H5655J.js → executions-HPZXOOVX.js} +12 -12
  223. package/dist/cli/{executions-R3LP74QN.mjs → executions-PCXZKEHM.mjs} +10 -10
  224. package/dist/cli/{feedback-WL3MRVT5.mjs → feedback-Y6VKZNY6.mjs} +9 -8
  225. package/dist/cli/{feedback-VFOUR66B.js → feedback-ZKFHFVL6.js} +17 -16
  226. package/dist/cli/git-RUBMALLH.js +26 -0
  227. package/dist/cli/{git-YX2J4GCI.mjs → git-UMPR2QYC.mjs} +8 -7
  228. package/dist/cli/index.js +170 -158
  229. package/dist/cli/index.mjs +60 -48
  230. package/dist/cli/{integrations-E2JZYKHS.js → integrations-3GQCTRTF.js} +23 -27
  231. package/dist/cli/{integrations-5ZK5KLVP.mjs → integrations-V3TM6XAB.mjs} +15 -19
  232. package/dist/cli/{legacy-noops-SMN3GSXY.mjs → legacy-noops-JZBUD7ZE.mjs} +9 -8
  233. package/dist/cli/{legacy-noops-3VW4IJTH.js → legacy-noops-VYCO7NGW.js} +12 -11
  234. package/dist/cli/{mcp-UQV2K4EW.js → mcp-4OIWTCE6.js} +121 -48
  235. package/dist/cli/{mcp-V6MGCYAG.mjs → mcp-PH4KZ76P.mjs} +100 -27
  236. package/dist/cli/{monitors-R3BBDCRC.js → monitors-E2A6VPBY.js} +221 -186
  237. package/dist/cli/{monitors-GGKS5W6M.mjs → monitors-SSMGIDGX.mjs} +58 -23
  238. package/dist/cli/org-SFDKSK5D.mjs +2289 -0
  239. package/dist/cli/org-WUDZGWBT.js +2289 -0
  240. package/dist/cli/outcomes-QT7LQBPK.mjs +2865 -0
  241. package/dist/cli/outcomes-Y7SZTLSL.js +2865 -0
  242. package/dist/cli/{play-MDWPR4XG.mjs → play-EK7KSFPL.mjs} +376 -106
  243. package/dist/cli/{play-2MVO27VO.js → play-GDNHCRRR.js} +1150 -880
  244. package/dist/cli/{providers-AKDYFZJZ.mjs → providers-FVZLRXAU.mjs} +10 -10
  245. package/dist/cli/{providers-2AACRUZH.js → providers-ZKOSECLV.js} +13 -13
  246. package/dist/cli/{quickstart-H6IV3PV3.js → quickstart-KSDKIXYD.js} +9 -8
  247. package/dist/cli/{quickstart-QDGRJFZY.mjs → quickstart-UJZ6PIQV.mjs} +7 -6
  248. package/dist/cli/{run-RTSQNGRD.mjs → run-E7MZ7P35.mjs} +35 -33
  249. package/dist/cli/{run-2634REDK.js → run-PD2BBG6S.js} +55 -53
  250. package/dist/cli/run-identity-LMLFMACS.js +31 -0
  251. package/dist/cli/{run-identity-MRNCEGV2.mjs → run-identity-MAZ7ANH5.mjs} +9 -3
  252. package/dist/cli/search-TKSPTPHA.js +32 -0
  253. package/dist/cli/{search-6AOJ4XPP.mjs → search-VTFUFTOY.mjs} +11 -11
  254. package/dist/cli/{search-output-S5ODBL5E.js → search-output-G2AGDCOY.js} +13 -12
  255. package/dist/cli/{search-output-6ADMTOU5.mjs → search-output-PFVXQCWA.mjs} +10 -9
  256. package/dist/cli/{secrets-TFIFBFB3.mjs → secrets-7CIMEMX7.mjs} +11 -11
  257. package/dist/cli/{secrets-LHCIIHMT.js → secrets-BCOQ4U7U.js} +20 -20
  258. package/dist/cli/sessions-4CO556VD.js +23 -0
  259. package/dist/cli/{sessions-WHBVUHVW.mjs → sessions-IUCQZEF7.mjs} +9 -8
  260. package/dist/cli/{settings-EBONWL5C.mjs → settings-KZN62UQK.mjs} +16 -16
  261. package/dist/cli/{settings-CP4FVK2W.js → settings-REL4736M.js} +89 -89
  262. package/dist/cli/{setup-I5AZE3IU.mjs → setup-2P7OG3OU.mjs} +22 -24
  263. package/dist/cli/{setup-LFGHTNLQ.js → setup-2XIVBBCS.js} +62 -64
  264. package/dist/cli/skills-JYT5DEY6.js +37 -0
  265. package/dist/cli/{skills-W76AO5XE.mjs → skills-VIGNDJKI.mjs} +10 -9
  266. package/dist/cli/tools-NTVUQ2TG.js +57 -0
  267. package/dist/cli/{tools-7IJHGF6W.mjs → tools-W3QT5EJY.mjs} +24 -24
  268. package/dist/cli/{update-GFOPZTHY.mjs → update-GZVBVMY3.mjs} +14 -11
  269. package/dist/cli/update-TWJZPUZM.js +37 -0
  270. package/dist/cli/{views-D4NX4SBG.mjs → views-BOGEH424.mjs} +47 -49
  271. package/dist/cli/{views-BPL2TQJ4.js → views-TOLJNLSV.js} +62 -64
  272. package/dist/cli/{workflow-ZYNAUCKC.js → workflow-ENWFRK5M.js} +23 -23
  273. package/dist/cli/{workflow-YXP42FUI.mjs → workflow-VDG2FDQV.mjs} +13 -13
  274. package/dist/{client-CyXGrO4D.d.mts → client-B8f7RNF8.d.mts} +1 -1
  275. package/dist/{client-Bf3IpUKN.d.ts → client-C5TgXmJQ.d.ts} +1 -1
  276. package/dist/{client-core-BxsLnXlm.d.mts → client-core-SLLGBTht.d.mts} +268 -23
  277. package/dist/{client-core-BWd0lX0Z.d.ts → client-core-p0sOxnkl.d.ts} +268 -23
  278. package/dist/{compiler-manifest-BqwVrOri.d.ts → compiler-manifest-D_zZEh9Q.d.mts} +70 -5
  279. package/dist/{compiler-manifest-BqwVrOri.d.mts → compiler-manifest-D_zZEh9Q.d.ts} +70 -5
  280. package/dist/{errors-BU8FB99X.d.mts → errors-CZCrBFrQ.d.mts} +1 -1
  281. package/dist/{errors-DfVN_FUG.d.ts → errors-DsUkLrdZ.d.ts} +1 -1
  282. package/dist/{index-BGnvtYGc.d.ts → index-B6RTOZGC.d.ts} +1 -1
  283. package/dist/{index-DjZgwpGw.d.mts → index-DeOVrEmX.d.mts} +1 -1
  284. package/dist/index.d.mts +7 -7
  285. package/dist/index.d.ts +7 -7
  286. package/dist/index.js +66 -55
  287. package/dist/index.mjs +25 -14
  288. package/dist/install-integrity.json +163 -144
  289. package/dist/plays/bundle-play-file.d.mts +3 -3
  290. package/dist/plays/bundle-play-file.d.ts +3 -3
  291. package/dist/plays/bundle-play-file.mjs +23 -4
  292. package/dist/plays/csv-data-input.js +3 -3
  293. package/dist/plays/csv-data-input.mjs +2 -2
  294. package/dist/plays/play-description.d.mts +2 -2
  295. package/dist/plays/play-description.d.ts +2 -2
  296. package/dist/plays/run-request.d.mts +2 -2
  297. package/dist/plays/run-request.d.ts +2 -2
  298. package/dist/plays/run-request.js +4 -4
  299. package/dist/plays/run-request.mjs +3 -3
  300. package/dist/release.d.mts +1 -1
  301. package/dist/release.d.ts +1 -1
  302. package/dist/release.js +2 -2
  303. package/dist/release.mjs +1 -1
  304. package/dist/server.d.mts +4 -4
  305. package/dist/server.d.ts +4 -4
  306. package/dist/server.js +15 -13
  307. package/dist/server.mjs +9 -7
  308. package/package.json +1 -1
  309. package/dist/cli/auth-MMNVWATX.js +0 -43
  310. package/dist/cli/chunk-AID3OYVJ.js +0 -8
  311. package/dist/cli/chunk-OVDNJAJN.mjs +0 -8
  312. package/dist/cli/concurrent-runs-help-FQAIHKKC.js +0 -21
  313. package/dist/cli/describe-QDANCTS3.mjs +0 -50
  314. package/dist/cli/describe-VUTT5ZKU.js +0 -50
  315. package/dist/cli/git-ETB3GH3K.js +0 -25
  316. package/dist/cli/org-GRYVMNSW.js +0 -1282
  317. package/dist/cli/org-Z37NGJV4.mjs +0 -1282
  318. package/dist/cli/run-identity-G257GQED.js +0 -25
  319. package/dist/cli/search-VTW2YNBS.js +0 -32
  320. package/dist/cli/sessions-CJ4FJ2WB.js +0 -22
  321. package/dist/cli/skills-R7EBXREW.js +0 -36
  322. package/dist/cli/tools-V7U2BDXM.js +0 -57
  323. package/dist/cli/update-4COPZETK.js +0 -34
@@ -1,4 +1,5 @@
1
1
  import { DURABLE_RUNS_ROLLOUT } from './durable-runs-rollout';
2
+ import { resolveExperimentSwitch } from './experiment-switches';
2
3
  import {
3
4
  createFencedCallDiagnosticsBudget,
4
5
  startFencedCallDiagnostics,
@@ -129,6 +130,7 @@ import {
129
130
  import { isImmutableRuntimeExecutionRecoveryOrigin } from './scheduler-backends/runtime-api-origin';
130
131
  import {
131
132
  isRetryableSecretResolutionStatus,
133
+ secretResolutionAccountAccessRetryDelayMs,
132
134
  secretResolutionGotNoResponse,
133
135
  secretResolutionOutageRetryDelayMs,
134
136
  secretResolutionRetryDecision,
@@ -136,6 +138,7 @@ import {
136
138
  SECRET_RESOLUTION_ATTEMPT_TIMEOUT_MS,
137
139
  type SecretResolutionRetryDecision,
138
140
  } from './secret-resolution-retry-policy';
141
+ import { isAccountAccessUnavailableResponse } from './runtime-constants';
139
142
  import {
140
143
  createRootRunExecutionScope,
141
144
  deriveChildRunExecutionScope,
@@ -144,7 +147,11 @@ import {
144
147
  import { DEFAULT_RUNTIME_EXECUTION_CAPABILITIES } from './execution-capabilities';
145
148
  import { vercelProtectionBypassHeader } from './vercel-protection';
146
149
  import { positiveTimeoutMs } from './runtime-reliability-policy';
147
- import { sendPlayHttpRequest } from './play-http-request';
150
+ import {
151
+ CtxFetchTimeoutError as PlayHttpTimeoutError,
152
+ sendPlayHttpRequest,
153
+ } from './play-http-request';
154
+ import { CtxFetchCallerDeadline } from './ctx-fetch-caller-deadline';
148
155
  export { CtxFetchTimeoutError } from './play-http-request';
149
156
  export {
150
157
  RuntimeSheetRowsBlockedError,
@@ -166,7 +173,10 @@ import {
166
173
  type RuntimeResourceSnapshot,
167
174
  type RuntimeProviderPermit,
168
175
  } from './resource-governor';
169
- import { CTX_FETCH_EGRESS_TOOL_ID } from './builtin-pacing';
176
+ import {
177
+ CTX_FETCH_EGRESS_PROVIDER,
178
+ CTX_FETCH_EGRESS_TOOL_ID,
179
+ } from './builtin-pacing';
170
180
  import {
171
181
  legacyRawFromToolResponseRawV2,
172
182
  RAW_V2_TOOL_RESPONSE_CONTRACT,
@@ -406,6 +416,7 @@ import {
406
416
  isCustomerDbDatasetTool,
407
417
  isQueryResultDatasetReadRequest,
408
418
  isQueryResultDatasetTool,
419
+ readQueryResultDatasetResultRef,
409
420
  } from './query-result-dataset';
410
421
  import {
411
422
  applyCacheReuseWindow,
@@ -470,6 +481,8 @@ import {
470
481
  createRuntimeMemoryOccupancyReader,
471
482
  createRuntimeMapMaterializationTracker,
472
483
  createRuntimeMapRetainedRowsTracker,
484
+ runtimeMapJsonByteLengthOfRecordEntry,
485
+ type RuntimeMapRecordEntryBytesCache,
473
486
  estimateRuntimeMapRowsMemory,
474
487
  NODE_RUNTIME_MAP_MATERIALIZED_MEMORY_MULTIPLIER,
475
488
  NODE_RUNTIME_MAP_ROW_OVERHEAD_BYTES,
@@ -929,6 +942,76 @@ const MAP_PERSIST_CHUNK_ROWS = 2_000;
929
942
  const MAP_PERSIST_CHUNK_BYTES = 8 * 1024 * 1024;
930
943
  const MAP_ROW_WRITER_BUFFER_BYTES = 16 * 1024 * 1024;
931
944
  const MAP_ROW_WRITER_MAX_FLUSH_MS = 1_000;
945
+ /**
946
+ * EXPERIMENT SO1 (experiment-switches.ts): serialize each dataset row once.
947
+ * Cell-meta bytes are charged per changed cell instead of re-serializing the
948
+ * row's whole record on every cell update; a terminal row's JSON size is
949
+ * measured once and shared by the retained-row tracker, the row writer and
950
+ * the persist chunker; the runner builds a map-row write from the rows'
951
+ * prepared JSON. Every charge and size check keeps its value and its unit.
952
+ */
953
+ export const SERIALIZE_DATASET_ROWS_ONCE = false;
954
+ /**
955
+ * EXPERIMENT PA1 (experiment-switches.ts): admit an in-memory dataset one
956
+ * execution page at a time on the streaming path, so the rows of the first
957
+ * page run while later pages are admitted, instead of admitting every row
958
+ * before any row runs. Per-page rerun admission, the run's single write
959
+ * intent and version, and fencing are the streaming path's own.
960
+ */
961
+ export const PIPELINE_ARRAY_DATASET_ADMISSION = false;
962
+
963
+ /** UTF-8 bytes of a string, without encoding it. */
964
+ function utf8ByteLength(value: string): number {
965
+ return Buffer.byteLength(value, 'utf8');
966
+ }
967
+
968
+ type MeasuredPersistableRow = {
969
+ /** `JSON.stringify(row).length`, the writer's and chunker's unit. */
970
+ length: number;
971
+ /** UTF-8 bytes of the same text, the memory trackers' unit. */
972
+ bytes: number;
973
+ };
974
+ // A terminal row is not changed after it is built (a later cell update makes
975
+ // a new record), so its one measurement serves every tracker that sizes it.
976
+ const measuredPersistableRows = new WeakMap<object, MeasuredPersistableRow>();
977
+
978
+ function measurePersistableMapRow(
979
+ row: PersistableMapRow,
980
+ ): MeasuredPersistableRow {
981
+ const cached = measuredPersistableRows.get(row);
982
+ if (cached) return cached;
983
+ const serialized = JSON.stringify(row);
984
+ const measured = {
985
+ length: serialized.length,
986
+ bytes: utf8ByteLength(serialized),
987
+ };
988
+ measuredPersistableRows.set(row, measured);
989
+ return measured;
990
+ }
991
+
992
+ /**
993
+ * `{ ...row, data: { ...row.data, ...patch } }` serializes exactly as `row`
994
+ * does when every patch entry restates an own value of `row.data`: the keys,
995
+ * their order and their values are unchanged. Such a copy takes the source
996
+ * row's measurement instead of being serialized again.
997
+ */
998
+ function inheritPersistableMapRowMeasurement(
999
+ from: PersistableMapRow,
1000
+ to: PersistableMapRow,
1001
+ patch: Record<string, unknown>,
1002
+ ): void {
1003
+ const data = from.data as Record<string, unknown>;
1004
+ for (const key of Object.keys(patch)) {
1005
+ if (
1006
+ !Object.prototype.hasOwnProperty.call(data, key) ||
1007
+ !Object.is(data[key], patch[key])
1008
+ ) {
1009
+ return;
1010
+ }
1011
+ }
1012
+ measuredPersistableRows.set(to, measurePersistableMapRow(from));
1013
+ }
1014
+
932
1015
  const MAP_STALL_LOG_INTERVAL_MS = 60_000;
933
1016
  // Once the persistence latch has tripped, nothing a map is still waiting on can
934
1017
  // change its outcome: the map fails and the run ends. What the wait can still
@@ -1620,12 +1703,13 @@ export async function reconcileNodeRuntimeMapResultsWithPersistedSheet(input: {
1620
1703
  committedRowKeys?: readonly string[];
1621
1704
  /**
1622
1705
  * Finished (enriched or failed) rows for the keys, whichever run owns them,
1623
- * or null when the reader cannot answer (an older runtime API). Null keeps
1624
- * the shortfall a failure.
1706
+ * plus the keys another run re-admitted and has not finished, or null when
1707
+ * the reader cannot answer (an older runtime API). Null keeps the shortfall
1708
+ * a failure.
1625
1709
  */
1626
1710
  readCommittedTerminalRows?: (
1627
1711
  keys: string[],
1628
- ) => Promise<readonly CommittedTerminalRow[] | null>;
1712
+ ) => Promise<CommittedRowsRead | null>;
1629
1713
  log?: (line: string) => void;
1630
1714
  }): Promise<Record<string, unknown>[]> {
1631
1715
  if (
@@ -1651,10 +1735,14 @@ export async function reconcileNodeRuntimeMapResultsWithPersistedSheet(input: {
1651
1735
 
1652
1736
  if (persistedRows.length < input.expectedRows) {
1653
1737
  const committed = await readCommittedRowsAcrossRuns(input);
1654
- if (committed && committed.takenOverRows > 0) {
1738
+ if (
1739
+ committed &&
1740
+ committed.takenOverRows + committed.supersededByTakeover > 0
1741
+ ) {
1655
1742
  if (
1656
1743
  committed.unfinishedKeys === 0 &&
1657
- committed.rows.length >= input.expectedRows
1744
+ committed.rows.length >=
1745
+ input.expectedRows - committed.supersededByTakeover
1658
1746
  ) {
1659
1747
  input.log?.(
1660
1748
  `Runtime sheet finalization recovered ctx.dataset("${input.mapName}") ` +
@@ -1662,11 +1750,18 @@ export async function reconcileNodeRuntimeMapResultsWithPersistedSheet(input: {
1662
1750
  `${persistedRows.length}/${input.expectedRows} terminal persisted row(s) are still owned by ` +
1663
1751
  `run ${input.runId ?? 'unknown'}.`,
1664
1752
  );
1753
+ if (committed.supersededByTakeover > 0) {
1754
+ input.log?.(
1755
+ `Runtime sheet finalization skipped ${committed.supersededByTakeover} committed row(s) of ` +
1756
+ `ctx.dataset("${input.mapName}") because a newer run of this dataset re-admitted them and has not finished them yet.`,
1757
+ );
1758
+ }
1665
1759
  return committed.rows;
1666
1760
  }
1667
1761
  input.log?.(
1668
1762
  `Runtime sheet finalization found ${committed.takenOverRows} committed row(s) of ctx.dataset("${input.mapName}") ` +
1669
- `finished by another run; ${committed.unfinishedKeys} committed row(s) have no finished row.`,
1763
+ `finished by another run and ${committed.supersededByTakeover} re-admitted by another run; ` +
1764
+ `${committed.unfinishedKeys} committed row(s) have no finished row.`,
1670
1765
  );
1671
1766
  }
1672
1767
  throw new Error(
@@ -1695,6 +1790,16 @@ export type CommittedTerminalRow = {
1695
1790
  ownedByOtherRun: boolean;
1696
1791
  };
1697
1792
 
1793
+ export type CommittedRowsRead = {
1794
+ rows: readonly CommittedTerminalRow[];
1795
+ /**
1796
+ * Keys another run re-admitted (moved to itself as pending) and has not
1797
+ * finished. A newer run took precedence over these rows, so finalization
1798
+ * leaves them out as superseded rather than lost. Absent from older readers.
1799
+ */
1800
+ unfinishedTakeoverKeys?: readonly string[];
1801
+ };
1802
+
1698
1803
  // Each answer carries full row bodies; keep one gateway response small.
1699
1804
  const RUNTIME_SHEET_TAKEOVER_KEY_BATCH = 100;
1700
1805
 
@@ -1707,28 +1812,35 @@ async function readCommittedRowsAcrossRuns(input: {
1707
1812
  committedRowKeys?: readonly string[];
1708
1813
  readCommittedTerminalRows?: (
1709
1814
  keys: string[],
1710
- ) => Promise<readonly CommittedTerminalRow[] | null>;
1815
+ ) => Promise<CommittedRowsRead | null>;
1711
1816
  }): Promise<{
1712
1817
  rows: Record<string, unknown>[];
1713
1818
  takenOverRows: number;
1819
+ supersededByTakeover: number;
1714
1820
  unfinishedKeys: number;
1715
1821
  } | null> {
1716
1822
  if (!input.committedRowKeys || !input.readCommittedTerminalRows) return null;
1717
1823
  const keys = [...new Set(input.committedRowKeys.filter(Boolean))];
1718
1824
  const byKey = new Map<string, CommittedTerminalRow>();
1825
+ const reAdmittedByOtherRun = new Set<string>();
1719
1826
  for (
1720
1827
  let offset = 0;
1721
1828
  offset < keys.length;
1722
1829
  offset += RUNTIME_SHEET_TAKEOVER_KEY_BATCH
1723
1830
  ) {
1724
1831
  const page = keys.slice(offset, offset + RUNTIME_SHEET_TAKEOVER_KEY_BATCH);
1725
- const rows = await input.readCommittedTerminalRows(page);
1726
- if (rows === null) return null;
1832
+ const read = await input.readCommittedTerminalRows(page);
1833
+ if (read === null) return null;
1727
1834
  const requested = new Set(page);
1728
- for (const row of rows) {
1835
+ for (const row of read.rows) {
1729
1836
  if (requested.has(row.key)) byKey.set(row.key, row);
1730
1837
  }
1838
+ for (const key of read.unfinishedTakeoverKeys ?? []) {
1839
+ if (requested.has(key)) reAdmittedByOtherRun.add(key);
1840
+ }
1731
1841
  }
1842
+ // A finished row wins over a re-admission report for the same key.
1843
+ for (const key of byKey.keys()) reAdmittedByOtherRun.delete(key);
1732
1844
  const slots = keys.flatMap((key) => {
1733
1845
  const row = byKey.get(key);
1734
1846
  return row ? [row] : [];
@@ -1746,7 +1858,8 @@ async function readCommittedRowsAcrossRuns(input: {
1746
1858
  row.ownedByOtherRun ? row.data : ownedInInputOrder[nextOwned++]!.data,
1747
1859
  ),
1748
1860
  takenOverRows: slots.length - ownedInInputOrder.length,
1749
- unfinishedKeys: keys.length - slots.length,
1861
+ supersededByTakeover: reAdmittedByOtherRun.size,
1862
+ unfinishedKeys: keys.length - slots.length - reAdmittedByOtherRun.size,
1750
1863
  };
1751
1864
  }
1752
1865
 
@@ -1783,6 +1896,7 @@ export function resolveToolRuntimeTimeoutMs(
1783
1896
  normalized === 'deeplineagent_ai_inference' ||
1784
1897
  normalized === 'ai_evaluate' ||
1785
1898
  normalized === 'deeplineagent_ai_evaluate' ||
1899
+ normalized === 'ai_decision' ||
1786
1900
  normalized === 'aiinference'
1787
1901
  ? DEEPLINEAGENT_TOOL_RUNTIME_TIMEOUT_MS
1788
1902
  : DEFAULT_TOOL_RUNTIME_TIMEOUT_MS;
@@ -2407,6 +2521,8 @@ type ToolExecutionApiOptions = {
2407
2521
  offset: number;
2408
2522
  pageSize: number;
2409
2523
  totalRows: number;
2524
+ /** Stored-result handle the first page reported; later pages read it. */
2525
+ resultRef?: string | null;
2410
2526
  };
2411
2527
  /**
2412
2528
  * Rows — and the column within each row — that will retain this call's
@@ -2480,6 +2596,43 @@ const LOG_RATE_LIMIT_MARKER_EVERY = 1_000;
2480
2596
 
2481
2597
  type LogRateLimitState = { seen: number; sampled: number; suppressed: number };
2482
2598
  const STEP_PROGRAM_MAP_DEFINITION = Symbol('deepline.stepProgramMapDefinition');
2599
+ /** The authored step program a step-program map definition wraps. */
2600
+ const STEP_PROGRAM_MAP_SOURCE = Symbol('deepline.stepProgramMapSource');
2601
+ /**
2602
+ * Source text of a column function that may call out of the row: a tool, a
2603
+ * Play, a wait or sleep, a fetch, or a suspension thrown directly.
2604
+ */
2605
+ const ROW_WORK_MAY_AWAIT_SOURCE =
2606
+ /\.tools\b|\btools\.|runPlay|\.wait|waitFor|\.sleep\(|\bfetch\(|Suspend|Backpressure|\[native code\]/;
2607
+
2608
+ /**
2609
+ * Whether any function reachable from a map definition's authored columns may
2610
+ * make the row wait on work outside it, which can suspend the map. A function
2611
+ * whose source cannot be read counts as one that may.
2612
+ */
2613
+ function mapDefinitionMayAwaitRowWork(definition: object): boolean {
2614
+ const program = (definition as Record<PropertyKey, unknown>)[
2615
+ STEP_PROGRAM_MAP_SOURCE
2616
+ ];
2617
+ const seen = new Set<object>();
2618
+ const visit = (value: unknown, depth: number): boolean => {
2619
+ if (typeof value === 'function') {
2620
+ let source: string;
2621
+ try {
2622
+ source = Function.prototype.toString.call(value);
2623
+ } catch {
2624
+ return true;
2625
+ }
2626
+ return ROW_WORK_MAY_AWAIT_SOURCE.test(source);
2627
+ }
2628
+ if (!value || typeof value !== 'object' || seen.has(value)) return false;
2629
+ if (depth > 8) return true;
2630
+ seen.add(value);
2631
+ const children = Array.isArray(value) ? value : Object.values(value);
2632
+ return children.some((child) => visit(child, depth + 1));
2633
+ };
2634
+ return visit(program ?? definition, 0);
2635
+ }
2483
2636
  const ACTIVE_MAP_CHECKPOINT_ROW_META_LEDGER_KEY = Symbol(
2484
2637
  'deepline.activeMapCheckpointRowMetaLedgerKey',
2485
2638
  );
@@ -2590,6 +2743,8 @@ function createRuntimeMapRowPersistence(
2590
2743
  prepareTerminalRow?: (row: PersistableMapRow) => PersistableMapRow;
2591
2744
  persistCheckpoint?: (updates: PlayRowUpdate[]) => Promise<void>;
2592
2745
  onFailure?: (error: unknown) => void;
2746
+ /** A terminal row's writer bytes; `persistableMapRowBytes` when absent. */
2747
+ estimateTerminalBytes?: (row: PersistableMapRow) => number;
2593
2748
  /**
2594
2749
  * A trip anywhere in the run — a receipt completion that could not be
2595
2750
  * stored, a sheet write this run no longer owns — fails this writer with
@@ -2625,7 +2780,8 @@ function createRuntimeMapRowPersistence(
2625
2780
  ...(incoming.cellMetaPatch ?? {}),
2626
2781
  },
2627
2782
  }),
2628
- estimateTerminalBytes: persistableMapRowBytes,
2783
+ estimateTerminalBytes:
2784
+ options?.estimateTerminalBytes ?? persistableMapRowBytes,
2629
2785
  estimateCheckpointBytes: (update) => JSON.stringify(update).length,
2630
2786
  maxBatchRows: MAP_PERSIST_CHUNK_ROWS,
2631
2787
  maxBatchBytes: MAP_PERSIST_CHUNK_BYTES,
@@ -3317,6 +3473,14 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
3317
3473
  private activeMapCellMeta: Map<string, Record<string, unknown>> | null = null;
3318
3474
  /** Exact serialized ownership of activeMapCellMeta, one current record per row. */
3319
3475
  private activeMapCellMetaBytesByKey: Map<string, number> | null = null;
3476
+ /**
3477
+ * SO1: each row's per-cell serialized shares and its key's, so a cell
3478
+ * update re-serializes only the cells whose value changed.
3479
+ */
3480
+ private activeMapCellMetaEntryBytes: RuntimeMapRecordEntryBytesCache | null =
3481
+ null;
3482
+ #serializeRowsOnce: boolean | undefined;
3483
+ #pipelineArrayAdmission: boolean | undefined;
3320
3484
  private activeMapCellMetaBytes = 0;
3321
3485
  private activeMapCellMetaMemory: RuntimeMemoryLedgerHandle | null = null;
3322
3486
  /**
@@ -4991,6 +5155,24 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
4991
5155
  );
4992
5156
  }
4993
5157
 
5158
+ /** SO1 for this run: the run's override, else the static default. */
5159
+ private serializeRowsOnce(): boolean {
5160
+ return (this.#serializeRowsOnce ??= resolveExperimentSwitch(
5161
+ 'SO1',
5162
+ this.#options.experimentSwitchOverrides,
5163
+ SERIALIZE_DATASET_ROWS_ONCE,
5164
+ ));
5165
+ }
5166
+
5167
+ /** PA1 for this run: the run's override, else the static default. */
5168
+ private pipelineArrayAdmission(): boolean {
5169
+ return (this.#pipelineArrayAdmission ??= resolveExperimentSwitch(
5170
+ 'PA1',
5171
+ this.#options.experimentSwitchOverrides,
5172
+ PIPELINE_ARRAY_DATASET_ADMISSION,
5173
+ ));
5174
+ }
5175
+
4994
5176
  private emitScopedRowUpdate(
4995
5177
  key: string | null,
4996
5178
  tableNamespace: string | null,
@@ -5091,7 +5273,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
5091
5273
  // Nested step values exist in cell patches, not the authored return row.
5092
5274
  // Commit them with the terminal row before clearing its checkpoint state,
5093
5275
  // without adding internal fields to the immediate authored result snapshot.
5094
- return patch ? { ...row, data: { ...row.data, ...patch } } : row;
5276
+ if (!patch) return row;
5277
+ const merged = { ...row, data: { ...row.data, ...patch } };
5278
+ if (this.serializeRowsOnce()) {
5279
+ inheritPersistableMapRowMeasurement(row, merged, patch);
5280
+ }
5281
+ return merged;
5095
5282
  }
5096
5283
 
5097
5284
  private clearActiveMapCheckpointUpdate(
@@ -5111,12 +5298,16 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
5111
5298
  this.clearActiveMapCellMeta();
5112
5299
  this.activeMapCellMeta = new Map();
5113
5300
  this.activeMapCellMetaBytesByKey = new Map();
5301
+ this.activeMapCellMetaEntryBytes = this.serializeRowsOnce()
5302
+ ? new Map()
5303
+ : null;
5114
5304
  this.activeMapCellMetaBytes = 0;
5115
5305
  }
5116
5306
 
5117
5307
  private clearActiveMapCellMeta(): void {
5118
5308
  this.activeMapCellMeta = null;
5119
5309
  this.activeMapCellMetaBytesByKey = null;
5310
+ this.activeMapCellMetaEntryBytes = null;
5120
5311
  this.activeMapCellMetaBytes = 0;
5121
5312
  this.activeMapCellMetaMemory?.release();
5122
5313
  this.activeMapCellMetaMemory = null;
@@ -5130,7 +5321,13 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
5130
5321
  const bytesByKey = this.activeMapCellMetaBytesByKey;
5131
5322
  if (!cellMeta || !bytesByKey) return;
5132
5323
  const previousBytes = bytesByKey.get(key) ?? 0;
5133
- const nextBytes = runtimeMapJsonByteLength({ [key]: value });
5324
+ const nextBytes = this.activeMapCellMetaEntryBytes
5325
+ ? runtimeMapJsonByteLengthOfRecordEntry(
5326
+ key,
5327
+ value,
5328
+ this.activeMapCellMetaEntryBytes,
5329
+ )
5330
+ : runtimeMapJsonByteLength({ [key]: value });
5134
5331
  cellMeta.set(key, value);
5135
5332
  bytesByKey.set(key, nextBytes);
5136
5333
  this.activeMapCellMetaBytes = Math.max(
@@ -5149,6 +5346,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
5149
5346
  if (previousBytes === undefined) return;
5150
5347
  this.activeMapCellMeta?.delete(key);
5151
5348
  this.activeMapCellMetaBytesByKey?.delete(key);
5349
+ this.activeMapCellMetaEntryBytes?.delete(key);
5152
5350
  this.activeMapCellMetaBytes = Math.max(
5153
5351
  0,
5154
5352
  this.activeMapCellMetaBytes - previousBytes,
@@ -5473,12 +5671,29 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
5473
5671
 
5474
5672
  const retryAfter = response.headers.get('retry-after');
5475
5673
  respondedAttempts += 1;
5476
- const retry = isRetryableSecretResolutionStatus(response.status)
5674
+ const ladder = isRetryableSecretResolutionStatus(response.status)
5477
5675
  ? secretResolutionRetryDecision({
5478
5676
  attempt: respondedAttempts,
5479
5677
  retryAfter,
5480
5678
  })
5481
5679
  : NO_SECRET_RESOLUTION_RETRY;
5680
+ // A declared account-access refusal ran before any route: keep
5681
+ // resending through a brief dependency blip within its own budget.
5682
+ const accountAccessRetryDelayMs =
5683
+ !ladder.retry && isAccountAccessUnavailableResponse(response)
5684
+ ? secretResolutionAccountAccessRetryDelayMs({
5685
+ respondedAttempts,
5686
+ elapsedMs: Date.now() - operationStartedAt,
5687
+ })
5688
+ : null;
5689
+ const retry =
5690
+ accountAccessRetryDelayMs === null
5691
+ ? ladder
5692
+ : {
5693
+ ...ladder,
5694
+ retry: true,
5695
+ retryDelayMs: accountAccessRetryDelayMs,
5696
+ };
5482
5697
  const responseDiagnostic = {
5483
5698
  stage: response.ok ? 'invalid_response' : 'http_response',
5484
5699
  secret_name: secret.name,
@@ -9463,6 +9678,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
9463
9678
  const originalRequestInput = requestInput as Record<string, unknown>;
9464
9679
  const datasetLimit =
9465
9680
  finitePositiveInteger(dataset.returned_limit) ?? totalRows;
9681
+ const storedResultRef = readQueryResultDatasetResultRef(dataset);
9466
9682
  const effectiveCount = Math.min(totalRows, datasetLimit);
9467
9683
  const previewRows = rows.slice(0, Math.min(rows.length, 25));
9468
9684
  const executionNonce =
@@ -9493,6 +9709,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
9493
9709
  offset,
9494
9710
  pageSize: Math.min(limit, QUERY_RESULT_DATASET_PAGE_SIZE),
9495
9711
  totalRows,
9712
+ resultRef: storedResultRef,
9496
9713
  },
9497
9714
  },
9498
9715
  );
@@ -10516,8 +10733,34 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10516
10733
  }
10517
10734
  }
10518
10735
  }
10736
+ // PA1: an in-memory array the materialized path would admit whole runs
10737
+ // on the streaming path instead, one execution page at a time with one
10738
+ // pool fed across pages, as a staged or cursor source already does. A
10739
+ // pure-JS fast-path definition pages serially there, and a suspended
10740
+ // materialized frame replays on its own path, so both keep theirs.
10741
+ // Only a fresh invocation whose columns cannot wait on outside work
10742
+ // pipelines: the streaming path re-reads an unsealed array on replay,
10743
+ // where the materialized path replays the inputs it checkpointed.
10744
+ const pipelinedArrayInput =
10745
+ sealedArrayInput === null &&
10746
+ Array.isArray(items) &&
10747
+ !replayMapFrame &&
10748
+ sourceArrayEstimate !== null &&
10749
+ // Below the size at which an array would be staged instead.
10750
+ sourceArrayEstimate.estimatedResidentBytes * 2 <=
10751
+ mapMemoryLimits.materializedBudgetBytes &&
10752
+ hasRuntimeSheetControls &&
10753
+ canReadPersistedMapResults &&
10754
+ Boolean(this.#options.onMapStartPages) &&
10755
+ this.pipelineArrayAdmission() &&
10756
+ !this.canUsePureJsMapFastPath(
10757
+ input as MapFieldDefinition<Record<string, unknown>>,
10758
+ ) &&
10759
+ !mapDefinitionMayAwaitRowWork(input);
10519
10760
  const shouldStreamRuntimeBackedDataset =
10520
- (isPlayDataset<T>(items) || sealedArrayInput !== null) &&
10761
+ (isPlayDataset<T>(items) ||
10762
+ sealedArrayInput !== null ||
10763
+ pipelinedArrayInput) &&
10521
10764
  hasRuntimeSheetControls;
10522
10765
  // A suspended map's admitted pending inputs remain authoritative even
10523
10766
  // when a stateful authored source returns fewer rows after a wake.
@@ -10579,9 +10822,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10579
10822
  // budget among the active page, sheet-admission copies, retained row
10580
10823
  // outcomes, and the optional immediate result cache. A cursor has no
10581
10824
  // resident source.
10582
- const arraySourceMemoryEstimate = sealedArrayInput
10583
- ? sourceArrayEstimate
10584
- : null;
10825
+ const arraySourceMemoryEstimate =
10826
+ sealedArrayInput || pipelinedArrayInput ? sourceArrayEstimate : null;
10585
10827
  if (
10586
10828
  arraySourceMemoryEstimate &&
10587
10829
  arraySourceMemoryEstimate.estimatedResidentBytes >
@@ -10596,9 +10838,16 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10596
10838
  }
10597
10839
  // Both explicit and implicit first-wins keys survive page settlement.
10598
10840
  // Reserve their bounded index apart from transient page allocations.
10841
+ // A pipelined array keeps the materialized path's first-wins implicit
10842
+ // keys across pages, so it reserves the same key index a sealed one does.
10843
+ const pagedArrayRows = sealedArrayInput
10844
+ ? sealedArrayInput.sourceRows
10845
+ : pipelinedArrayInput && Array.isArray(items)
10846
+ ? items.length
10847
+ : 0;
10599
10848
  const keyIndexBudgetBytes =
10600
- sealedArrayInput && !useSourceRowIdentity
10601
- ? sealedArrayInput.sourceRows *
10849
+ (sealedArrayInput || pipelinedArrayInput) && !useSourceRowIdentity
10850
+ ? pagedArrayRows *
10602
10851
  (explicitKeyResolver
10603
10852
  ? explicitKeyReservationBytesPerRow
10604
10853
  : implicitKeyReservationBytesPerRow)
@@ -10642,9 +10891,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10642
10891
  ? sealedArrayInput.sourceRows
10643
10892
  : isPlayDataset(items)
10644
10893
  ? await items.count()
10645
- : (() => {
10646
- throw new Error('Runtime-backed map source is missing.');
10647
- })();
10894
+ : pipelinedArrayInput && Array.isArray(items)
10895
+ ? items.length
10896
+ : (() => {
10897
+ throw new Error('Runtime-backed map source is missing.');
10898
+ })();
10648
10899
  const mapScope = this.createMapExecutionScope({
10649
10900
  logicalNamespace: normalizedMapNamespace,
10650
10901
  artifactTableNamespace: resolvedTableNamespace,
@@ -10760,7 +11011,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10760
11011
  chunkBytes = 0;
10761
11012
  };
10762
11013
  for (const row of rows) {
10763
- const rowBytes = persistableMapRowBytes(row);
11014
+ const rowBytes = this.serializeRowsOnce()
11015
+ ? measurePersistableMapRow(row).length
11016
+ : persistableMapRowBytes(row);
10764
11017
  if (
10765
11018
  chunk.length >= MAP_PERSIST_CHUNK_ROWS ||
10766
11019
  (chunkBytes + rowBytes > MAP_PERSIST_CHUNK_BYTES &&
@@ -10813,6 +11066,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10813
11066
  budgetBytes: pageBudgetBytes,
10814
11067
  });
10815
11068
  }
11069
+ // PA1: a key depends only on the row, its index and the namespace, so
11070
+ // the admitted rows below reuse the stamped keys unless admission
11071
+ // rebound the namespace.
11072
+ const stampNamespace = resolvedTableNamespace;
11073
+ const stampedRowKeys = pipelinedArrayInput
11074
+ ? pageRawItems.map((row, index) =>
11075
+ seedRowIdentity(row, page.offset + index),
11076
+ )
11077
+ : null;
10816
11078
  const pageStartRows = pageRawItems.map((row, index) => {
10817
11079
  const originalIndex = page.offset + index;
10818
11080
  return {
@@ -10821,7 +11083,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10821
11083
  ? { __deeplineSourceRow: getPlayDatasetSourceRowIdentity(row) }
10822
11084
  : {}),
10823
11085
  ...mapRowOutcomeRuntimeFields({
10824
- key: seedRowIdentity(row, originalIndex),
11086
+ key:
11087
+ stampedRowKeys?.[index] ?? seedRowIdentity(row, originalIndex),
10825
11088
  inputIndex: originalIndex,
10826
11089
  }),
10827
11090
  };
@@ -10855,9 +11118,14 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10855
11118
  const { pendingRowsByKey, completedRowsByKey, previousCellsByKey } =
10856
11119
  admission;
10857
11120
 
11121
+ const reusableRowKeys =
11122
+ stampedRowKeys && resolvedTableNamespace === stampNamespace
11123
+ ? stampedRowKeys
11124
+ : null;
10858
11125
  const seededItems = pageRawItems.map((row, index) => {
10859
11126
  const originalIndex = page.offset + index;
10860
- const rowKey = seedRowIdentity(row, originalIndex);
11127
+ const rowKey =
11128
+ reusableRowKeys?.[index] ?? seedRowIdentity(row, originalIndex);
10861
11129
  const persisted =
10862
11130
  pendingRowsByKey.get(rowKey) ?? completedRowsByKey.get(rowKey);
10863
11131
  return {
@@ -10919,7 +11187,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10919
11187
  }
10920
11188
  const rowKey = rowIdentity(row, index);
10921
11189
  if (
10922
- sealedArrayInput &&
11190
+ (sealedArrayInput || pipelinedArrayInput) &&
10923
11191
  !explicitKeyResolver &&
10924
11192
  !useSourceRowIdentity
10925
11193
  ) {
@@ -10998,6 +11266,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
10998
11266
  {
10999
11267
  prepareTerminalRow: (row) =>
11000
11268
  this.withPendingMapRowData(row, resolvedTableNamespace),
11269
+ ...(this.serializeRowsOnce()
11270
+ ? {
11271
+ estimateTerminalBytes: (row: PersistableMapRow) =>
11272
+ measurePersistableMapRow(row).length,
11273
+ }
11274
+ : {}),
11001
11275
  persistCheckpoint: this.#options.onMapRowsCheckpoint
11002
11276
  ? (updates) =>
11003
11277
  this.#options.onMapRowsCheckpoint!({
@@ -11330,6 +11604,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
11330
11604
  });
11331
11605
  } catch (error) {
11332
11606
  rowFeed.fail(error);
11607
+ if (pipelinedArrayInput && isPlayExecutionSuspendedError(error)) {
11608
+ // PA1 admits only columns that cannot wait on outside work. One
11609
+ // that suspended anyway would replay a re-read authored array,
11610
+ // not checkpointed inputs, so stop the run instead.
11611
+ throw new Error(
11612
+ `Dataset ${normalizedMapNamespace} suspended while its in-memory input was admitted page by page (experiment PA1); its inputs are not checkpointed for replay.`,
11613
+ { cause: error },
11614
+ );
11615
+ }
11333
11616
  throw error;
11334
11617
  } finally {
11335
11618
  await pump;
@@ -12087,7 +12370,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
12087
12370
  chunkBytes = 0;
12088
12371
  };
12089
12372
  for (const row of rows) {
12090
- const rowBytes = JSON.stringify(row).length;
12373
+ const rowBytes = this.serializeRowsOnce()
12374
+ ? measurePersistableMapRow(row).length
12375
+ : JSON.stringify(row).length;
12091
12376
  if (
12092
12377
  chunk.length >= MAP_PERSIST_CHUNK_ROWS ||
12093
12378
  (chunkBytes + rowBytes > MAP_PERSIST_CHUNK_BYTES && chunk.length > 0)
@@ -12103,6 +12388,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
12103
12388
  ? createRuntimeMapRowPersistence(persistMapRows, visibility, {
12104
12389
  prepareTerminalRow: (row) =>
12105
12390
  this.withPendingMapRowData(row, resolvedTableNamespace),
12391
+ ...(this.serializeRowsOnce()
12392
+ ? {
12393
+ estimateTerminalBytes: (row: PersistableMapRow) =>
12394
+ measurePersistableMapRow(row).length,
12395
+ }
12396
+ : {}),
12106
12397
  persistCheckpoint: this.#options.onMapRowsCheckpoint
12107
12398
  ? (updates) =>
12108
12399
  this.#options.onMapRowsCheckpoint!({
@@ -12320,7 +12611,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
12320
12611
  // already kept only keys this run still owned at that wake; the
12321
12612
  // others became reused inputs and left expectedRows. Takeovers after
12322
12613
  // that restore (or on a frame without superseded rows) remain here
12323
- // and must be proven finished by another run.
12614
+ // and must be proven finished by another run, or re-admitted and
12615
+ // still unfinished under another run (left out as superseded).
12324
12616
  committedRowKeys: [
12325
12617
  ...previouslyCompletedRowKeys,
12326
12618
  ...visibleCompletedRows.map((row) => row.key),
@@ -12352,7 +12644,14 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
12352
12644
  // carries rows from every run.
12353
12645
  return result.rowMode === 'terminalRowsAnyRun' &&
12354
12646
  Array.isArray(result.rows)
12355
- ? result.rows
12647
+ ? {
12648
+ rows: result.rows,
12649
+ unfinishedTakeoverKeys: Array.isArray(
12650
+ result.unfinishedTakeoverKeys,
12651
+ )
12652
+ ? result.unfinishedTakeoverKeys
12653
+ : [],
12654
+ }
12356
12655
  : null;
12357
12656
  }
12358
12657
  : undefined,
@@ -12733,7 +13032,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
12733
13032
  ): void => {
12734
13033
  if (!retainedRowsComplete) return;
12735
13034
  try {
12736
- retainedRowCharges.set(row, retainedRowsMemoryTracker.track(row));
13035
+ retainedRowCharges.set(
13036
+ row,
13037
+ retainedRowsMemoryTracker.track(
13038
+ row,
13039
+ this.serializeRowsOnce()
13040
+ ? measurePersistableMapRow(row).bytes
13041
+ : undefined,
13042
+ ),
13043
+ );
12737
13044
  target.push(row);
12738
13045
  trackMaterializedRowBytes();
12739
13046
  } catch (error) {
@@ -12930,7 +13237,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
12930
13237
  ...(this.#options.runtimeMapHeapProbe
12931
13238
  ? { heapProbe: this.#options.runtimeMapHeapProbe }
12932
13239
  : {}),
12933
- getEventLoopLagMs: () => this.resourceGovernor.eventLoopLagEwmaMs(),
13240
+ // Only lag sampled while this map runs: the run-wide EWMA still held the
13241
+ // runner's boot and row preparation when admission was quick, and cut
13242
+ // 10k-row maps to ~300 rows before they started (load round
13243
+ // 44282760713, stream js-10k).
13244
+ getEventLoopLagMs: this.resourceGovernor.eventLoopLagSinceNow(),
12934
13245
  callSlotBacklog: () =>
12935
13246
  this.resourceGovernor.externalExecutionBacklog?.() ?? null,
12936
13247
  onMemoryPressure: releaseCommittedRowsForMemoryPressure,
@@ -14064,6 +14375,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
14064
14375
  value: true,
14065
14376
  enumerable: false,
14066
14377
  });
14378
+ Object.defineProperty(definition, STEP_PROGRAM_MAP_SOURCE, {
14379
+ value: program,
14380
+ enumerable: false,
14381
+ });
14067
14382
  return definition;
14068
14383
  }
14069
14384
 
@@ -18396,6 +18711,52 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
18396
18711
  }
18397
18712
  }
18398
18713
 
18714
+ /**
18715
+ * A ctx.fetch that ended on a timeout or abort writes one runtime
18716
+ * `tool_call_failed` record, like a failed tool call, so it reaches
18717
+ * `play.call.finished`. It says whose deadline ended it and where the time
18718
+ * went: queued inside Deepline or in flight. Other failures are unchanged.
18719
+ */
18720
+ private observeCtxFetchEnded(input: {
18721
+ error: unknown;
18722
+ callerDeadline: CtxFetchCallerDeadline;
18723
+ key: string;
18724
+ }): void {
18725
+ // An ambiguous write keeps the timeout that ended it as its cause.
18726
+ const platformTimeout =
18727
+ input.error instanceof PlayHttpTimeoutError ||
18728
+ (input.error instanceof Error &&
18729
+ input.error.cause instanceof PlayHttpTimeoutError);
18730
+ const abortKind =
18731
+ input.callerDeadline.abortKind ??
18732
+ (platformTimeout ? 'platform_timeout' : null);
18733
+ if (!abortKind) return;
18734
+ const split = input.callerDeadline.timeSplit();
18735
+ const row = rowContext.getStore();
18736
+ this.runtimeLog(
18737
+ JSON.stringify({
18738
+ event: 'tool_call_failed',
18739
+ run_id: this.currentRunId,
18740
+ ...(row?.tableNamespace ? { dataset: row.tableNamespace } : {}),
18741
+ ...(row?.fieldName ? { column: row.fieldName } : {}),
18742
+ call_key: input.key,
18743
+ tool: 'ctx.fetch',
18744
+ provider: CTX_FETCH_EGRESS_PROVIDER,
18745
+ status: 'failed',
18746
+ duration_ms: split.queuedMs + split.inFlightMs,
18747
+ abort_kind: abortKind,
18748
+ ended_phase: split.phase,
18749
+ queued_ms: split.queuedMs,
18750
+ in_flight_ms: split.inFlightMs,
18751
+ sends: split.sends,
18752
+ retries: split.retries,
18753
+ ...(split.sends > 0 ? {} : { last_error_dispatched: false }),
18754
+ ...toolCallFailureLogFields(input.error),
18755
+ }),
18756
+ { level: 'warn' },
18757
+ );
18758
+ }
18759
+
18399
18760
  private logCtxFetchHttpFailure(input: {
18400
18761
  key: string;
18401
18762
  method: string;
@@ -19127,6 +19488,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
19127
19488
  // the requested auth header, and that transport must be TLS.
19128
19489
  assertSecretAuthUsesTls(secretAuth, input, 'ctx.fetch');
19129
19490
  const secretHeaderMarkers = secretAuthHeaderMarkers(secretAuth);
19491
+ // A signal that has already aborted fails the call before any receipt or
19492
+ // checkpoint reuse, as fetch does.
19493
+ init.signal?.throwIfAborted();
19494
+ // Time this request waits inside Deepline does not spend a caller's
19495
+ // AbortSignal.timeout budget; an explicit abort still cancels the request.
19496
+ const callerDeadline = new CtxFetchCallerDeadline(init.signal);
19130
19497
 
19131
19498
  const execution = this.executeWithRuntimeReceipt<PlayFetchResponse>(
19132
19499
  'fetch',
@@ -19196,7 +19563,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
19196
19563
  headers,
19197
19564
  Object.keys(secretHeaderMarkers),
19198
19565
  );
19199
- const fetchInit = { ...init, headers };
19566
+ const fetchInit = {
19567
+ ...init,
19568
+ headers,
19569
+ ...(callerDeadline.signal ? { signal: callerDeadline.signal } : {}),
19570
+ };
19200
19571
  delete fetchInit.auth;
19201
19572
  const boundaryId = this.durableBoundaryId(
19202
19573
  `fetch-${stableDigest(
@@ -19265,6 +19636,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
19265
19636
  orgId: this.#options.orgId ?? null,
19266
19637
  providerResourceKey: CTX_FETCH_EGRESS_TOOL_ID,
19267
19638
  toolId: CTX_FETCH_EGRESS_TOOL_ID,
19639
+ ...(callerDeadline.signal ? { signal: callerDeadline.signal } : {}),
19268
19640
  });
19269
19641
  retainExternalCallSlot(() => egressSlot.release());
19270
19642
  const finishFetchObservation =
@@ -19283,6 +19655,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
19283
19655
  log: (message) => this.runtimeLog(message),
19284
19656
  reportAmbiguousWrite:
19285
19657
  this.usesExplicitFreshness && !reusableReadMethod,
19658
+ queueClock: callerDeadline,
19286
19659
  });
19287
19660
  const rawJson = parseJsonOrNull(bodyText);
19288
19661
  const output: PlayFetchResponse =
@@ -19346,7 +19719,18 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
19346
19719
  },
19347
19720
  },
19348
19721
  );
19349
- return execution;
19722
+ try {
19723
+ return await execution;
19724
+ } catch (error) {
19725
+ this.observeCtxFetchEnded({
19726
+ error,
19727
+ callerDeadline,
19728
+ key: normalizedKey,
19729
+ });
19730
+ throw error;
19731
+ } finally {
19732
+ callerDeadline.dispose();
19733
+ }
19350
19734
  }
19351
19735
 
19352
19736
  async step<T>(
@@ -22756,6 +23140,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
22756
23140
  offset: options.customerDbDataset.offset,
22757
23141
  page_size: options.customerDbDataset.pageSize,
22758
23142
  total_rows: options.customerDbDataset.totalRows,
23143
+ ...(options.customerDbDataset.resultRef
23144
+ ? { result_ref: options.customerDbDataset.resultRef }
23145
+ : {}),
22759
23146
  },
22760
23147
  ...(isCustomerDbDatasetTool(toolId)
22761
23148
  ? {
@@ -24648,6 +25035,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
24648
25035
  Boolean(asyncExecutionRecovery),
24649
25036
  executionFenced: usesDurableInvocationFence,
24650
25037
  providerServerErrorReplay,
25038
+ errorCodeHeader: response.headers.get(
25039
+ 'x-deepline-error-code',
25040
+ ),
24651
25041
  });
24652
25042
  const failure =
24653
25043
  preclassifiedHttpFailure.current?.failure ??
@@ -24658,6 +25048,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
24658
25048
  bodyText: text,
24659
25049
  schemaVersion: toolErrorSchemaVersion,
24660
25050
  retryAfterHeader: response.headers.get('retry-after'),
25051
+ errorCodeHeader: response.headers.get(
25052
+ 'x-deepline-error-code',
25053
+ ),
24661
25054
  retryAtMs: parseToolExecuteExactProviderRetryAtMs(response),
24662
25055
  transientHttpRetrySafe:
24663
25056
  retrySafeTransientHttp ||
@@ -24722,7 +25115,13 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
24722
25115
  failure.reason === 'provider_pacing_wait' ||
24723
25116
  failure.reason === 'runtime_scheduler_capacity' ||
24724
25117
  failure.reason === 'billing_unavailable_before_dispatch' ||
24725
- failure.reason === 'gateway_invocation_in_progress';
25118
+ failure.reason === 'runtime_jwks_unavailable' ||
25119
+ failure.reason === 'account_access_unavailable' ||
25120
+ failure.reason === 'gateway_invocation_in_progress' ||
25121
+ // A Deepline limiter (a workspace's people-search rate, say)
25122
+ // refused before dispatch: the provider received nothing, so
25123
+ // it is not a send `retry.maximumAttempts` counts.
25124
+ (failure.reason === 'rate_limit' && failure.knownNotDispatched);
24726
25125
  if (!preDispatchRefusal) providerSendsThisBurst += 1;
24727
25126
  // The call's own `retry` may end this call's in-call retries: a
24728
25127
  // `nonRetryable` class, or `maximumAttempts` reached by every
@@ -24843,11 +25242,17 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
24843
25242
  // of the same attempt may have a row, so the attempt must not move.
24844
25243
  // A billing-plane refusal is the same: the charge for this
24845
25244
  // request identity may already be open, and the resend keeps both.
25245
+ // A gateway that could not fetch its signing keys refused before
25246
+ // any provider request and holds no invocation for this attempt.
25247
+ // An app account-access refusal ran before any route, and a
25248
+ // fenced gateway releases its claim as not dispatched.
24846
25249
  const shedKnownNotDispatched =
24847
25250
  failure.reason === 'concurrency_backpressure' ||
24848
25251
  failure.reason === 'provider_pacing_wait' ||
24849
25252
  failure.reason === 'runtime_scheduler_capacity' ||
24850
- failure.reason === 'billing_unavailable_before_dispatch';
25253
+ failure.reason === 'billing_unavailable_before_dispatch' ||
25254
+ failure.reason === 'runtime_jwks_unavailable' ||
25255
+ failure.reason === 'account_access_unavailable';
24851
25256
  if (
24852
25257
  failure.shouldRetry &&
24853
25258
  !stopInCallRetry &&