deepline 0.3.552 → 0.3.553

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 (319) 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-I3QAU4RV.mjs} +8 -7
  131. package/dist/cli/auth-MQCN7WGZ.js +44 -0
  132. package/dist/cli/{billing-54RHFEBI.mjs → billing-3IC54OQQ.mjs} +197 -61
  133. package/dist/cli/{billing-FQREA7UA.js → billing-YGFFVAIC.js} +297 -161
  134. package/dist/cli/{chunk-4MK42735.js → chunk-2B5B5KAW.js} +210 -128
  135. package/dist/cli/{chunk-UBKA33KY.mjs → chunk-2MGZAI54.mjs} +17 -0
  136. package/dist/cli/{chunk-4NQF6KJ3.js → chunk-3NTP2OSG.js} +13 -13
  137. package/dist/cli/{chunk-HYC4MKGK.mjs → chunk-45OAVGU6.mjs} +5 -5
  138. package/dist/cli/{chunk-WLN3SUIA.js → chunk-4747TPLV.js} +3 -3
  139. package/dist/cli/{chunk-AZQ264ID.mjs → chunk-4BFTDNHU.mjs} +1 -1
  140. package/dist/cli/{chunk-BGBJV26E.mjs → chunk-4HYNMXXF.mjs} +4 -4
  141. package/dist/cli/{chunk-DJ2JDK4O.mjs → chunk-4SMCFQ23.mjs} +1 -1
  142. package/dist/cli/{chunk-QPKH23EC.mjs → chunk-55F6HNOY.mjs} +5 -5
  143. package/dist/cli/{chunk-LX35AXTN.mjs → chunk-5TYLSS4Q.mjs} +6 -6
  144. package/dist/cli/{chunk-634ZDA3F.js → chunk-6NE3RRRY.js} +1 -1
  145. package/dist/cli/{chunk-EITMD3A5.js → chunk-6VLFQZK6.js} +8 -8
  146. package/dist/cli/{chunk-EOPEYCY7.mjs → chunk-72V4PDH5.mjs} +18 -18
  147. package/dist/cli/{chunk-IHRKLXZN.js → chunk-74RES4DS.js} +5 -5
  148. package/dist/cli/{chunk-45PVGZST.js → chunk-7GEMELKI.js} +366 -320
  149. package/dist/cli/{chunk-4UUR4TCH.js → chunk-7O6J6A7P.js} +1871 -92
  150. package/dist/cli/{chunk-XVB7V4N7.js → chunk-7SERLBNR.js} +161 -53
  151. package/dist/cli/{chunk-F2LH7TGF.js → chunk-7YRJ5UC4.js} +21 -21
  152. package/dist/cli/{chunk-YJHE3O5M.mjs → chunk-A7DLBE5K.mjs} +136 -54
  153. package/dist/cli/{chunk-6PRW5UBA.mjs → chunk-AGICYWGN.mjs} +299 -69
  154. package/dist/cli/{chunk-S5S355UY.mjs → chunk-AGIQDA2T.mjs} +12 -12
  155. package/dist/cli/{chunk-RBEUVDZF.js → chunk-AGLR6QVN.js} +249 -107
  156. package/dist/cli/{chunk-NURW5XH4.mjs → chunk-ASB47RXJ.mjs} +1 -1
  157. package/dist/cli/{chunk-RQZQVFCJ.js → chunk-BVDKFS2T.js} +2 -2
  158. package/dist/cli/{chunk-PFO3ISXA.js → chunk-CACFJODG.js} +174 -129
  159. package/dist/cli/{chunk-6RZOWL2V.mjs → chunk-CAEBJOYU.mjs} +1 -1
  160. package/dist/cli/{chunk-XDVT3GOM.js → chunk-CFJFUVX2.js} +18 -1
  161. package/dist/cli/{chunk-6YCA5NKJ.js → chunk-DP2VH7CO.js} +12 -12
  162. package/dist/cli/{chunk-AWJPDPMA.mjs → chunk-DP64MD6U.mjs} +1 -1
  163. package/dist/cli/{chunk-PTVD2GVQ.mjs → chunk-DZA7RFGL.mjs} +5 -5
  164. package/dist/cli/{chunk-V436Z54K.js → chunk-E2G2DNAB.js} +3 -1
  165. package/dist/cli/{chunk-GGGAEVCX.mjs → chunk-E7WZOX2A.mjs} +22 -18
  166. package/dist/cli/{chunk-IDVVIXPJ.js → chunk-FM7LPUPA.js} +41 -41
  167. package/dist/cli/{chunk-AQWQ2BFX.mjs → chunk-GAVZ4EOD.mjs} +1 -1
  168. package/dist/cli/{chunk-GKYAYLRI.js → chunk-HEBO3XNZ.js} +27 -31
  169. package/dist/cli/{chunk-IYSTRCLX.mjs → chunk-HSJ6X2AQ.mjs} +4 -4
  170. package/dist/cli/{chunk-UPMRIVZB.js → chunk-HVI55MTK.js} +61 -10
  171. package/dist/cli/{chunk-KWSH5T7K.js → chunk-IH6GDNKW.js} +21 -21
  172. package/dist/cli/{chunk-HO3XK3R7.js → chunk-IMX7J4DU.js} +8 -8
  173. package/dist/cli/{chunk-EUPVF4SU.mjs → chunk-INEMTYMT.mjs} +8 -8
  174. package/dist/cli/{chunk-3FD5EQ62.js → chunk-IUOGII7D.js} +6 -7
  175. package/dist/cli/{chunk-U7QRMBIY.mjs → chunk-JJGWHITQ.mjs} +5 -5
  176. package/dist/cli/{chunk-SHLFOPD6.js → chunk-JLGP5XAJ.js} +5 -5
  177. package/dist/cli/{chunk-4TALT2M3.mjs → chunk-LFOERUQY.mjs} +69 -3
  178. package/dist/cli/{chunk-BBTKAASQ.js → chunk-LFQJW4S2.js} +42 -1
  179. package/dist/cli/{chunk-Z5TSLLOW.mjs → chunk-LH5PZKER.mjs} +63 -18
  180. package/dist/cli/{chunk-S46HWQKO.js → chunk-LRDHPOZW.js} +69 -69
  181. package/dist/cli/{chunk-6ZORHRKB.mjs → chunk-LRZGS6RZ.mjs} +2 -0
  182. package/dist/cli/{chunk-SL6MYJYM.js → chunk-MJTVX4QK.js} +35 -35
  183. package/dist/cli/{chunk-7IKQKKNX.js → chunk-MLABYI4M.js} +90 -24
  184. package/dist/cli/{chunk-ZIAXDBXX.mjs → chunk-NDNHYONK.mjs} +17 -21
  185. package/dist/cli/{chunk-YLTMXJFC.mjs → chunk-OTV2UUKW.mjs} +158 -16
  186. package/dist/cli/{chunk-G4O75EXF.js → chunk-Q6Z6N3A7.js} +18 -18
  187. package/dist/cli/{chunk-WE5HES3H.mjs → chunk-QG6JIWUL.mjs} +151 -43
  188. package/dist/cli/{chunk-QY3ZNU6Z.mjs → chunk-QI5S5HWB.mjs} +2 -2
  189. package/dist/cli/{chunk-CBV7AKWM.js → chunk-R6DZ6NQ2.js} +5 -5
  190. package/dist/cli/{chunk-57VZVF5D.mjs → chunk-RMNOZKRI.mjs} +3 -3
  191. package/dist/cli/{chunk-BAIST2BR.js → chunk-RTV4RF7N.js} +36 -36
  192. package/dist/cli/{chunk-JWUAX6OP.js → chunk-SBH4CKPN.js} +11 -11
  193. package/dist/cli/{chunk-FTJLJCE5.mjs → chunk-SG3LUONJ.mjs} +3 -3
  194. package/dist/cli/{chunk-2WFPHBR4.js → chunk-TFEXSHPM.js} +22 -18
  195. package/dist/cli/{chunk-QAORXEY3.mjs → chunk-TN4TY6TT.mjs} +6 -7
  196. package/dist/cli/{chunk-WEHCBH5R.mjs → chunk-UEVKMZLR.mjs} +54 -3
  197. package/dist/cli/{chunk-QILKGXYF.mjs → chunk-UVQJYV76.mjs} +2 -2
  198. package/dist/cli/{chunk-FSIVF2SI.mjs → chunk-VZGLIK5U.mjs} +1 -1
  199. package/dist/cli/{chunk-MF2GHZDO.js → chunk-WOCHZCUJ.js} +2 -2
  200. package/dist/cli/{chunk-VQALXEXO.js → chunk-XLIHTJVM.js} +348 -118
  201. package/dist/cli/{chunk-ADRC5I3R.js → chunk-Y6SP3JMI.js} +22 -22
  202. package/dist/cli/{chunk-77AAAGVB.js → chunk-YUA6HA6D.js} +2 -2
  203. package/dist/cli/{chunk-JL2OTMSG.mjs → chunk-Z3A2S3QM.mjs} +41 -0
  204. package/dist/cli/{chunk-6O5HOODW.mjs → chunk-Z6XPSHKM.mjs} +87 -41
  205. package/dist/cli/{chunk-QX7LFGJR.mjs → chunk-Z7AOIHFE.mjs} +1870 -91
  206. package/dist/cli/command-docs.js +3 -3
  207. package/dist/cli/command-docs.mjs +2 -2
  208. package/dist/cli/concurrent-runs-help-CFJH4KXV.js +22 -0
  209. package/dist/cli/{concurrent-runs-help-Q4KPAUJX.mjs → concurrent-runs-help-DNV2X5AZ.mjs} +9 -8
  210. package/dist/cli/{csv-F5VAGX4K.js → csv-SA6ELJY6.js} +16 -15
  211. package/dist/cli/{csv-2PTVDNO6.mjs → csv-ZXZGHWOM.mjs} +7 -6
  212. package/dist/cli/{db-IEDXAUF7.mjs → db-A54SP6AD.mjs} +16 -16
  213. package/dist/cli/{db-Z3OIUFMM.js → db-JHFEIQBU.js} +43 -43
  214. package/dist/cli/describe-PHQ33AGS.mjs +50 -0
  215. package/dist/cli/describe-RHJ4XRFI.js +50 -0
  216. package/dist/cli/describe-core.d.mts +3 -3
  217. package/dist/cli/describe-core.d.ts +3 -3
  218. package/dist/cli/describe-core.js +6 -6
  219. package/dist/cli/describe-core.mjs +5 -5
  220. package/dist/cli/{executions-R3LP74QN.mjs → executions-HL2M2DFU.mjs} +10 -10
  221. package/dist/cli/{executions-H6H5655J.js → executions-TLFZRHBJ.js} +12 -12
  222. package/dist/cli/{feedback-VFOUR66B.js → feedback-5UEX5UZK.js} +17 -16
  223. package/dist/cli/{feedback-WL3MRVT5.mjs → feedback-QMBTNXVG.mjs} +9 -8
  224. package/dist/cli/git-4JWOOHBG.js +26 -0
  225. package/dist/cli/{git-YX2J4GCI.mjs → git-LKGXVIVC.mjs} +8 -7
  226. package/dist/cli/index.js +170 -158
  227. package/dist/cli/index.mjs +60 -48
  228. package/dist/cli/{integrations-E2JZYKHS.js → integrations-6RUTLMN7.js} +23 -27
  229. package/dist/cli/{integrations-5ZK5KLVP.mjs → integrations-FGGRVUJ7.mjs} +15 -19
  230. package/dist/cli/{legacy-noops-3VW4IJTH.js → legacy-noops-J3Z7QRWZ.js} +12 -11
  231. package/dist/cli/{legacy-noops-SMN3GSXY.mjs → legacy-noops-YIPRMVXZ.mjs} +9 -8
  232. package/dist/cli/{mcp-UQV2K4EW.js → mcp-6LWFP7RW.js} +121 -48
  233. package/dist/cli/{mcp-V6MGCYAG.mjs → mcp-CHDYFO7F.mjs} +100 -27
  234. package/dist/cli/{monitors-R3BBDCRC.js → monitors-STM6A7OU.js} +221 -186
  235. package/dist/cli/{monitors-GGKS5W6M.mjs → monitors-UGRY2BXI.mjs} +58 -23
  236. package/dist/cli/org-3SYOUQCX.mjs +2289 -0
  237. package/dist/cli/org-ZOBSNSIB.js +2289 -0
  238. package/dist/cli/outcomes-H4YYAT5X.js +2865 -0
  239. package/dist/cli/outcomes-Z3P2JE67.mjs +2865 -0
  240. package/dist/cli/{play-2MVO27VO.js → play-SM4CW2GS.js} +1116 -846
  241. package/dist/cli/{play-MDWPR4XG.mjs → play-SN5YWLS7.mjs} +375 -105
  242. package/dist/cli/{providers-AKDYFZJZ.mjs → providers-WZ4YBR5Y.mjs} +10 -10
  243. package/dist/cli/{providers-2AACRUZH.js → providers-WZARYMCF.js} +13 -13
  244. package/dist/cli/{quickstart-QDGRJFZY.mjs → quickstart-2575BNKA.mjs} +7 -6
  245. package/dist/cli/{quickstart-H6IV3PV3.js → quickstart-PS4YHQJ6.js} +9 -8
  246. package/dist/cli/{run-2634REDK.js → run-FLZ6OTM7.js} +51 -51
  247. package/dist/cli/{run-RTSQNGRD.mjs → run-ZUHCZOJS.mjs} +31 -31
  248. package/dist/cli/run-identity-LMLFMACS.js +31 -0
  249. package/dist/cli/{run-identity-MRNCEGV2.mjs → run-identity-MAZ7ANH5.mjs} +9 -3
  250. package/dist/cli/{search-6AOJ4XPP.mjs → search-HLPPKQEO.mjs} +11 -11
  251. package/dist/cli/search-JJWVHR3N.js +32 -0
  252. package/dist/cli/{search-output-6ADMTOU5.mjs → search-output-PDAXNOGP.mjs} +9 -8
  253. package/dist/cli/{search-output-S5ODBL5E.js → search-output-RXJLU36B.js} +12 -11
  254. package/dist/cli/{secrets-TFIFBFB3.mjs → secrets-CGELYQ3H.mjs} +11 -11
  255. package/dist/cli/{secrets-LHCIIHMT.js → secrets-QJNG7G2Y.js} +20 -20
  256. package/dist/cli/sessions-DHTBT2GN.js +23 -0
  257. package/dist/cli/{sessions-WHBVUHVW.mjs → sessions-ELMWVR4M.mjs} +9 -8
  258. package/dist/cli/{settings-CP4FVK2W.js → settings-44I44P5F.js} +89 -89
  259. package/dist/cli/{settings-EBONWL5C.mjs → settings-RR3LZXL7.mjs} +16 -16
  260. package/dist/cli/{setup-I5AZE3IU.mjs → setup-KGWRWH4B.mjs} +20 -19
  261. package/dist/cli/{setup-LFGHTNLQ.js → setup-KTEYOCJO.js} +60 -59
  262. package/dist/cli/skills-EPZPEXI2.js +37 -0
  263. package/dist/cli/{skills-W76AO5XE.mjs → skills-FPRID2I5.mjs} +10 -9
  264. package/dist/cli/tools-IGQQ5TML.js +57 -0
  265. package/dist/cli/{tools-7IJHGF6W.mjs → tools-PI4WMDLY.mjs} +23 -23
  266. package/dist/cli/update-4RNCVYGE.js +37 -0
  267. package/dist/cli/{update-GFOPZTHY.mjs → update-VJOJAZ7B.mjs} +14 -11
  268. package/dist/cli/{views-BPL2TQJ4.js → views-NTUOLNQU.js} +62 -64
  269. package/dist/cli/{views-D4NX4SBG.mjs → views-OVPSINZO.mjs} +47 -49
  270. package/dist/cli/{workflow-ZYNAUCKC.js → workflow-2UDYDM6F.js} +23 -23
  271. package/dist/cli/{workflow-YXP42FUI.mjs → workflow-7OEFNXZC.mjs} +13 -13
  272. package/dist/{client-CyXGrO4D.d.mts → client-B8f7RNF8.d.mts} +1 -1
  273. package/dist/{client-Bf3IpUKN.d.ts → client-C5TgXmJQ.d.ts} +1 -1
  274. package/dist/{client-core-BxsLnXlm.d.mts → client-core-SLLGBTht.d.mts} +268 -23
  275. package/dist/{client-core-BWd0lX0Z.d.ts → client-core-p0sOxnkl.d.ts} +268 -23
  276. package/dist/{compiler-manifest-BqwVrOri.d.ts → compiler-manifest-D_zZEh9Q.d.mts} +70 -5
  277. package/dist/{compiler-manifest-BqwVrOri.d.mts → compiler-manifest-D_zZEh9Q.d.ts} +70 -5
  278. package/dist/{errors-BU8FB99X.d.mts → errors-CZCrBFrQ.d.mts} +1 -1
  279. package/dist/{errors-DfVN_FUG.d.ts → errors-DsUkLrdZ.d.ts} +1 -1
  280. package/dist/{index-BGnvtYGc.d.ts → index-B6RTOZGC.d.ts} +1 -1
  281. package/dist/{index-DjZgwpGw.d.mts → index-DeOVrEmX.d.mts} +1 -1
  282. package/dist/index.d.mts +7 -7
  283. package/dist/index.d.ts +7 -7
  284. package/dist/index.js +66 -55
  285. package/dist/index.mjs +25 -14
  286. package/dist/install-integrity.json +161 -142
  287. package/dist/plays/bundle-play-file.d.mts +3 -3
  288. package/dist/plays/bundle-play-file.d.ts +3 -3
  289. package/dist/plays/bundle-play-file.mjs +23 -4
  290. package/dist/plays/csv-data-input.js +3 -3
  291. package/dist/plays/csv-data-input.mjs +2 -2
  292. package/dist/plays/play-description.d.mts +2 -2
  293. package/dist/plays/play-description.d.ts +2 -2
  294. package/dist/plays/run-request.d.mts +2 -2
  295. package/dist/plays/run-request.d.ts +2 -2
  296. package/dist/plays/run-request.js +4 -4
  297. package/dist/plays/run-request.mjs +3 -3
  298. package/dist/release.d.mts +1 -1
  299. package/dist/release.d.ts +1 -1
  300. package/dist/release.js +2 -2
  301. package/dist/release.mjs +1 -1
  302. package/dist/server.d.mts +4 -4
  303. package/dist/server.d.ts +4 -4
  304. package/dist/server.js +15 -13
  305. package/dist/server.mjs +9 -7
  306. package/package.json +1 -1
  307. package/dist/cli/auth-MMNVWATX.js +0 -43
  308. package/dist/cli/concurrent-runs-help-FQAIHKKC.js +0 -21
  309. package/dist/cli/describe-QDANCTS3.mjs +0 -50
  310. package/dist/cli/describe-VUTT5ZKU.js +0 -50
  311. package/dist/cli/git-ETB3GH3K.js +0 -25
  312. package/dist/cli/org-GRYVMNSW.js +0 -1282
  313. package/dist/cli/org-Z37NGJV4.mjs +0 -1282
  314. package/dist/cli/run-identity-G257GQED.js +0 -25
  315. package/dist/cli/search-VTW2YNBS.js +0 -32
  316. package/dist/cli/sessions-CJ4FJ2WB.js +0 -22
  317. package/dist/cli/skills-R7EBXREW.js +0 -36
  318. package/dist/cli/tools-V7U2BDXM.js +0 -57
  319. package/dist/cli/update-4COPZETK.js +0 -34
@@ -159,6 +159,7 @@ import type { RUNTIME_SHEET_ADMISSION_CAPABILITIES } from './runtime-operation-c
159
159
  import {
160
160
  chunkPreparedRuntimeSheetRows,
161
161
  normalizeRuntimeMapInputIndex,
162
+ prepareRuntimeSheetRowJsonForTransport,
162
163
  prepareRuntimeSheetRowsForJsonTransport,
163
164
  prepareRuntimeSheetRowTransitions,
164
165
  type RuntimePreparedCompletedRow,
@@ -186,7 +187,9 @@ import {
186
187
  jsonByteLengthUpTo,
187
188
  RUNNER_TERMINAL_PUSH_MAX_BODY_BYTES,
188
189
  RUNTIME_SHEET_START_MAX_RESPONSE_ROWS,
190
+ RUNTIME_SHEET_START_SIZED_PAGE_MAX_ROWS,
189
191
  RUNTIME_SHEET_START_TARGET_BODY_BYTES,
192
+ RUNTIME_SHEET_START_TARGET_RESPONSE_BYTES,
190
193
  } from './output-size-limits';
191
194
  import {
192
195
  parseRuntimeTestFaultCounts,
@@ -944,6 +947,7 @@ function runtimeApiResponseByteLimit(
944
947
  async function readRuntimeApiResponseJson(input: {
945
948
  response: Response;
946
949
  action: RuntimeApiActionRequest['action'];
950
+ onBodyBytes?: (bytes: number) => void;
947
951
  }): Promise<unknown> {
948
952
  const limitBytes = runtimeApiResponseByteLimit(input.action);
949
953
  const declaredLength = Number(
@@ -988,6 +992,7 @@ async function readRuntimeApiResponseJson(input: {
988
992
  body.set(chunk, offset);
989
993
  offset += chunk.byteLength;
990
994
  }
995
+ input.onBodyBytes?.(bytes);
991
996
  if (body.byteLength === 0) return null;
992
997
  return JSON.parse(new TextDecoder().decode(body)) as unknown;
993
998
  }
@@ -996,6 +1001,8 @@ async function postRuntimeApi<TResponse>(
996
1001
  context: RuntimeApiContext,
997
1002
  body: RuntimeApiActionRequest,
998
1003
  preparedBodyJson?: string,
1004
+ /** Called with the decoded body bytes of the response this call returns. */
1005
+ observeResponseBytes?: (bytes: number) => void,
999
1006
  ): Promise<TResponse> {
1000
1007
  const url = resolveRuntimeApiUrl(context);
1001
1008
  const vercelHeaders = vercelProtectionBypassHeader(
@@ -1018,6 +1025,7 @@ async function postRuntimeApi<TResponse>(
1018
1025
  for (let attempt = 1; ; attempt += 1) {
1019
1026
  let response: Response | null = null;
1020
1027
  let parsed: Record<string, unknown> | null = null;
1028
+ let responseBytes = 0;
1021
1029
  const abortController = new AbortController();
1022
1030
  const previousAttemptUnreachable =
1023
1031
  budget.unreachableAttemptStartedAt !== null;
@@ -1052,6 +1060,9 @@ async function postRuntimeApi<TResponse>(
1052
1060
  parsedValue = await readRuntimeApiResponseJson({
1053
1061
  response,
1054
1062
  action: body.action,
1063
+ onBodyBytes: (bytes) => {
1064
+ responseBytes = bytes;
1065
+ },
1055
1066
  });
1056
1067
  } catch (error) {
1057
1068
  if (error instanceof RuntimeApiResponseTooLargeError) {
@@ -1115,6 +1126,7 @@ async function postRuntimeApi<TResponse>(
1115
1126
 
1116
1127
  if (response.ok) {
1117
1128
  if (parsed !== null) {
1129
+ observeResponseBytes?.(responseBytes);
1118
1130
  return parsed as TResponse;
1119
1131
  }
1120
1132
  // A proxy can deliver the successful status line and then truncate the
@@ -1516,7 +1528,10 @@ async function isRuntimeSheetSchemaReady(
1516
1528
  }
1517
1529
  return await withRuntimePostgres(session, query);
1518
1530
  } catch (error) {
1519
- if (isMissingRelationError(error)) {
1531
+ if (
1532
+ isMissingRelationError(error) ||
1533
+ isMissingRelationBehindRollbackFailure(error)
1534
+ ) {
1520
1535
  return false;
1521
1536
  }
1522
1537
  throw error;
@@ -2627,7 +2642,10 @@ async function rollbackRuntimePostgresTransaction(
2627
2642
  }
2628
2643
 
2629
2644
  class RuntimeSheetTransactionRollbackError extends AggregateError {
2630
- constructor(operationError: unknown, rollbackError: unknown) {
2645
+ constructor(
2646
+ readonly operationError: unknown,
2647
+ rollbackError: unknown,
2648
+ ) {
2631
2649
  super(
2632
2650
  [operationError, rollbackError],
2633
2651
  'Runtime Sheet transaction rollback failed; transaction state is unknown',
@@ -2637,6 +2655,29 @@ class RuntimeSheetTransactionRollbackError extends AggregateError {
2637
2655
  }
2638
2656
  }
2639
2657
 
2658
+ /**
2659
+ * True when a failed ROLLBACK hides a missing sheet relation or column.
2660
+ *
2661
+ * Postgres raised the 42P01/42703 itself, so the transaction was already
2662
+ * aborted: nothing in it can commit. `withRuntimePostgres` discards the client
2663
+ * whose rollback failed, so it never returns to the pool. The server releases
2664
+ * the abandoned transaction's locks once it notices the disconnect (at once on
2665
+ * a clean close, later after a partition). That stays harmless only while the
2666
+ * sheet statement fails before the operation writes any other table, which
2667
+ * holds for the probe and `writeRuntimeRows` today. So "not provisioned, ensure
2668
+ * and retry" is as safe here as after a clean rollback. A slow ROLLBACK must not
2669
+ * turn a Play's first run into a 500.
2670
+ */
2671
+ function isMissingRelationBehindRollbackFailure(error: unknown): boolean {
2672
+ if (!(error instanceof RuntimeSheetTransactionRollbackError)) return false;
2673
+ // A transaction managed inside the role transaction can fail its own
2674
+ // rollback first; the outer rollback then wraps that error again.
2675
+ return (
2676
+ isMissingRelationError(error.operationError) ||
2677
+ isMissingRelationBehindRollbackFailure(error.operationError)
2678
+ );
2679
+ }
2680
+
2640
2681
  async function withRuntimePostgres<T>(
2641
2682
  session: RuntimePostgresSession,
2642
2683
  fn: (
@@ -2936,8 +2977,16 @@ async function withRuntimeSheetProvisioningRetry<T>(
2936
2977
  retried: false,
2937
2978
  error: error instanceof Error ? error.message : String(error),
2938
2979
  });
2939
- if (error instanceof RuntimeSheetTransactionRollbackError) throw error;
2940
- if (isMissingRelationError(error)) {
2980
+ const missingRelation =
2981
+ isMissingRelationError(error) ||
2982
+ isMissingRelationBehindRollbackFailure(error);
2983
+ if (
2984
+ error instanceof RuntimeSheetTransactionRollbackError &&
2985
+ !missingRelation
2986
+ ) {
2987
+ throw error;
2988
+ }
2989
+ if (missingRelation) {
2941
2990
  const ensureStartedAt = Date.now();
2942
2991
  await ensureRuntimeSheet(context, {
2943
2992
  playName: input.playName,
@@ -7506,6 +7555,8 @@ async function postRuntimeSheetStartPageWithAdaptiveResponseLimit(
7506
7555
  context: RuntimeApiContext,
7507
7556
  input: RuntimeSheetDatasetStartInput,
7508
7557
  runPage: RuntimeSheetAdmissionPageRunner = (operation) => operation(),
7558
+ /** Decoded bytes of each admission response this page was answered with. */
7559
+ observeResponseBytes?: (bytes: number) => void,
7509
7560
  ): Promise<PrepareRuntimeSheetResult[]> {
7510
7561
  const request: RuntimeApiActionRequest = {
7511
7562
  action:
@@ -7524,6 +7575,7 @@ async function postRuntimeSheetStartPageWithAdaptiveResponseLimit(
7524
7575
  context,
7525
7576
  request,
7526
7577
  preparedBodyJson,
7578
+ observeResponseBytes,
7527
7579
  ),
7528
7580
  ),
7529
7581
  ];
@@ -7548,6 +7600,7 @@ async function postRuntimeSheetStartPageWithAdaptiveResponseLimit(
7548
7600
  context,
7549
7601
  { ...input, rows: input.rows.slice(0, splitAt) },
7550
7602
  runPage,
7603
+ observeResponseBytes,
7551
7604
  );
7552
7605
  const leftLast = left.at(-1);
7553
7606
  if (!leftLast) {
@@ -7564,6 +7617,7 @@ async function postRuntimeSheetStartPageWithAdaptiveResponseLimit(
7564
7617
  rows: input.rows.slice(splitAt),
7565
7618
  },
7566
7619
  runPage,
7620
+ observeResponseBytes,
7567
7621
  );
7568
7622
  const results = [...left, ...right];
7569
7623
  const [first, ...rest] = results;
@@ -7825,6 +7879,26 @@ type RuntimeSheetStartTransportPage = {
7825
7879
  rowsJson: string[];
7826
7880
  inputOffset?: number;
7827
7881
  };
7882
+ type RuntimeSheetStartTransportRow = {
7883
+ json: string;
7884
+ bytes: number;
7885
+ /** Source position of this row; a page starting here sends it as its offset. */
7886
+ pageOffset: number;
7887
+ };
7888
+
7889
+ /** Rows for the next stable-intent page, given the heaviest response row so far. */
7890
+ function runtimeSheetStartSizedPageRows(responseBytesPerRow: number): number {
7891
+ if (!(responseBytesPerRow > 0)) return RUNTIME_SHEET_START_MAX_RESPONSE_ROWS;
7892
+ return Math.max(
7893
+ RUNTIME_SHEET_START_MAX_RESPONSE_ROWS,
7894
+ Math.min(
7895
+ RUNTIME_SHEET_START_SIZED_PAGE_MAX_ROWS,
7896
+ Math.floor(
7897
+ RUNTIME_SHEET_START_TARGET_RESPONSE_BYTES / responseBytesPerRow,
7898
+ ),
7899
+ ),
7900
+ );
7901
+ }
7828
7902
 
7829
7903
  function serializeRuntimeSheetStartRequest(
7830
7904
  action: RuntimeSheetStartAction,
@@ -7900,17 +7974,19 @@ export async function* startRuntimeSheetDatasetPages(
7900
7974
  serializeRuntimeSheetStartRequest(action, frozenMetadata, []),
7901
7975
  'utf8',
7902
7976
  ) + rowBytes;
7903
- const pages: RuntimeSheetStartTransportPage[] = [];
7977
+ // Paged admission serializes and checks every row before it admits any page,
7978
+ // then cuts each page when it is sent, so a page can be sized from what the
7979
+ // earlier pages' responses cost.
7980
+ let pagedRows: Array<RuntimeSheetStartTransportRow | undefined> | null = null;
7981
+ let framingBytes = 0;
7904
7982
  let duplicateRows = 0;
7905
- if (
7983
+ // Keep every previously transportable admission as one transaction, with
7984
+ // its existing receiver-side deduplication and optional response fields.
7985
+ const singlePage =
7906
7986
  fullBytes <= RUNNER_TERMINAL_PUSH_MAX_BODY_BYTES &&
7907
7987
  (input.stableWriteIntent !== true ||
7908
- rowsJson.length <= RUNTIME_SHEET_START_MAX_RESPONSE_ROWS)
7909
- ) {
7910
- // Keep every previously transportable admission as one transaction, with
7911
- // its existing receiver-side deduplication and optional response fields.
7912
- pages.push({ rowsJson });
7913
- } else {
7988
+ rowsJson.length <= RUNTIME_SHEET_START_MAX_RESPONSE_ROWS);
7989
+ if (!singlePage) {
7914
7990
  frozenMetadata.attemptId = normalizeRuntimeSheetAttemptId(
7915
7991
  frozenMetadata.attemptId,
7916
7992
  );
@@ -7923,7 +7999,7 @@ export async function* startRuntimeSheetDatasetPages(
7923
7999
  }
7924
8000
  // Reserve the longest valid version/index before ANY page is admitted.
7925
8001
  // A late oversized row or contract must not leave earlier pages pending.
7926
- const framingBytes = Buffer.byteLength(
8002
+ framingBytes = Buffer.byteLength(
7927
8003
  serializeRuntimeSheetStartRequest(
7928
8004
  action,
7929
8005
  {
@@ -7936,8 +8012,7 @@ export async function* startRuntimeSheetDatasetPages(
7936
8012
  'utf8',
7937
8013
  );
7938
8014
  const seen = new Set<string>();
7939
- let page: RuntimeSheetStartTransportPage = { rowsJson: [] };
7940
- let pageBytes = framingBytes;
8015
+ const validatedRows: RuntimeSheetStartTransportRow[] = [];
7941
8016
  for (let index = 0; index < rowsJson.length; index += 1) {
7942
8017
  const row: unknown = JSON.parse(rowsJson[index]!);
7943
8018
  rowsJson[index] = '';
@@ -7969,40 +8044,64 @@ export async function* startRuntimeSheetDatasetPages(
7969
8044
  `Runtime sheet start row ${index} exceeds the ${RUNNER_TERMINAL_PUSH_MAX_BODY_BYTES} byte request-body limit.`,
7970
8045
  );
7971
8046
  }
8047
+ validatedRows.push({
8048
+ json: serialized,
8049
+ bytes,
8050
+ pageOffset: inputOffset + index,
8051
+ });
8052
+ }
8053
+ if (validatedRows.length === 0) {
8054
+ throw new Error(
8055
+ 'Runtime sheet start metadata exceeds the request-body limit.',
8056
+ );
8057
+ }
8058
+ pagedRows = validatedRows;
8059
+ }
8060
+
8061
+ // Stable-intent pages start at the conservative row count and then follow
8062
+ // the heaviest per-row response seen; a legacy admission pages by bytes only.
8063
+ const sizedPages = input.stableWriteIntent === true;
8064
+ let pageRowLimit = sizedPages
8065
+ ? RUNTIME_SHEET_START_MAX_RESPONSE_ROWS
8066
+ : Number.POSITIVE_INFINITY;
8067
+ let heaviestResponseBytesPerRow = 0;
8068
+ let nextRow = 0;
8069
+ const nextPage = (): RuntimeSheetStartTransportPage | null => {
8070
+ if (!pagedRows) {
8071
+ if (nextRow > 0) return null;
8072
+ nextRow = 1;
8073
+ return { rowsJson };
8074
+ }
8075
+ const first = pagedRows[nextRow];
8076
+ if (!first) return null;
8077
+ const page: RuntimeSheetStartTransportPage = {
8078
+ rowsJson: [],
8079
+ inputOffset: first.pageOffset,
8080
+ };
8081
+ let pageBytes = framingBytes;
8082
+ while (nextRow < pagedRows.length && page.rowsJson.length < pageRowLimit) {
8083
+ const row = pagedRows[nextRow]!;
7972
8084
  const separatorBytes = page.rowsJson.length > 0 ? 1 : 0;
7973
8085
  if (
7974
8086
  page.rowsJson.length > 0 &&
7975
- pageBytes + separatorBytes + bytes >
8087
+ pageBytes + separatorBytes + row.bytes >
7976
8088
  RUNTIME_SHEET_START_TARGET_BODY_BYTES
7977
8089
  ) {
7978
- pages.push(page);
7979
- page = { rowsJson: [] };
7980
- pageBytes = framingBytes;
7981
- }
7982
- if (page.rowsJson.length === 0) page.inputOffset = inputOffset + index;
7983
- pageBytes += bytes + (page.rowsJson.length > 0 ? 1 : 0);
7984
- page.rowsJson.push(serialized);
7985
- if (
7986
- input.stableWriteIntent === true &&
7987
- page.rowsJson.length >= RUNTIME_SHEET_START_MAX_RESPONSE_ROWS
7988
- ) {
7989
- pages.push(page);
7990
- page = { rowsJson: [] };
7991
- pageBytes = framingBytes;
8090
+ break;
7992
8091
  }
8092
+ pageBytes += row.bytes + separatorBytes;
8093
+ page.rowsJson.push(row.json);
8094
+ // The page now owns this row's JSON; keep only one copy resident.
8095
+ pagedRows[nextRow] = undefined;
8096
+ nextRow += 1;
7993
8097
  }
7994
- if (page.rowsJson.length > 0) pages.push(page);
7995
- if (pages.length === 0) {
7996
- throw new Error(
7997
- 'Runtime sheet start metadata exceeds the request-body limit.',
7998
- );
7999
- }
8000
- }
8098
+ return page;
8099
+ };
8001
8100
 
8002
8101
  let writeVersion = frozenMetadata.writeVersion;
8003
8102
  let membershipCapture: boolean | undefined;
8004
8103
  let admittedPageCount = 0;
8005
- for (const page of pages) {
8104
+ for (let page = nextPage(); page; page = nextPage()) {
8006
8105
  const pageMetadata = {
8007
8106
  ...frozenMetadata,
8008
8107
  ...(page.inputOffset !== undefined
@@ -8029,18 +8128,34 @@ export async function* startRuntimeSheetDatasetPages(
8029
8128
  (serialized) => JSON.parse(serialized) as Record<string, unknown>,
8030
8129
  ),
8031
8130
  };
8131
+ let pageResponseBytes = 0;
8032
8132
  const results = await postRuntimeSheetStartPageWithAdaptiveResponseLimit(
8033
8133
  context,
8034
8134
  pageInput,
8035
8135
  runPage,
8136
+ (bytes) => {
8137
+ pageResponseBytes += bytes;
8138
+ },
8036
8139
  );
8140
+ if (sizedPages) {
8141
+ // An unmeasured response is treated as heavy: it never grows a page.
8142
+ heaviestResponseBytesPerRow = Math.max(
8143
+ heaviestResponseBytesPerRow,
8144
+ pageResponseBytes > 0
8145
+ ? Math.ceil(pageResponseBytes / page.rowsJson.length)
8146
+ : Number.POSITIVE_INFINITY,
8147
+ );
8148
+ pageRowLimit = runtimeSheetStartSizedPageRows(
8149
+ heaviestResponseBytesPerRow,
8150
+ );
8151
+ }
8037
8152
  page.rowsJson.length = 0;
8038
8153
  for (const result of results) {
8039
8154
  if (includePreviousCells) {
8040
8155
  assertDatasetAdmissionHistory(result, previousCellsBudgetBytes);
8041
8156
  }
8042
8157
  if (
8043
- (input.stableWriteIntent === true || pages.length > 1) &&
8158
+ (input.stableWriteIntent === true || pagedRows !== null) &&
8044
8159
  admittedPageCount > 0
8045
8160
  ) {
8046
8161
  const admittedVersion = result.writeVersion;
@@ -10220,14 +10335,20 @@ async function postPreparedRuntimeMapRows(
10220
10335
  context: RuntimeApiContext & { playName: string },
10221
10336
  input: Parameters<typeof completeRuntimeMapRows>[1],
10222
10337
  submittedKeys: string[],
10338
+ /** The request's exact JSON, when it was built from the rows' prepared JSON. */
10339
+ preparedBodyJson?: string,
10223
10340
  ): Promise<RuntimeMapRowsWriteResult> {
10224
10341
  const result = await postRuntimeApi<
10225
10342
  Partial<RuntimeMapRowsWriteResult> &
10226
10343
  Pick<RuntimeMapRowsWriteResult, 'updated' | 'fencedKeys'>
10227
- >(context, {
10228
- action: 'runtime_sheet_complete_map_rows',
10229
- input,
10230
- });
10344
+ >(
10345
+ context,
10346
+ {
10347
+ action: 'runtime_sheet_complete_map_rows',
10348
+ input,
10349
+ },
10350
+ preparedBodyJson,
10351
+ );
10231
10352
  const staleKeys =
10232
10353
  result.staleKeys ?? result.staleDroppedKeys ?? result.fencedKeys;
10233
10354
  return {
@@ -10568,10 +10689,43 @@ export async function completeRuntimeMapRows(
10568
10689
  export function createCompleteRuntimeMapRowsOperation(
10569
10690
  context: RuntimeApiContext & { playName: string },
10570
10691
  input: Parameters<typeof completeRuntimeMapRows>[1],
10692
+ options?: {
10693
+ /**
10694
+ * EXPERIMENT SO1: send the request built from each row's prepared JSON,
10695
+ * byte for byte what serializing the parsed transport rows would send,
10696
+ * without parsing every row's data and cell metadata back to objects
10697
+ * and serializing them a second time.
10698
+ */
10699
+ preparedBody?: boolean;
10700
+ },
10571
10701
  ): () => Promise<RuntimeMapRowsWriteResult> {
10572
10702
  if (context.dbSessionStrategy !== 'gateway_only') {
10573
10703
  return () => completeRuntimeMapRows(context, input);
10574
10704
  }
10705
+ if (options?.preparedBody === true) {
10706
+ const transportRows = prepareRuntimeSheetRowJsonForTransport({
10707
+ rows: input.rows,
10708
+ runId: input.runId,
10709
+ outputFields: input.outputFields ?? [],
10710
+ });
10711
+ if (transportRows.length > 0) {
10712
+ // The rows travel only as `preparedBodyJson`; the request object keeps
10713
+ // its action and scope for the transport's own bookkeeping.
10714
+ const envelope = { ...input, rows: [] as RuntimeApiRowRecord[] };
10715
+ const preparedBodyJson = runtimeMapRowsRequestJson(
10716
+ envelope,
10717
+ transportRows.map((row) => row.json),
10718
+ );
10719
+ const submittedKeys = transportRows.map((row) => row.key);
10720
+ return () =>
10721
+ postPreparedRuntimeMapRows(
10722
+ context,
10723
+ envelope,
10724
+ submittedKeys,
10725
+ preparedBodyJson,
10726
+ );
10727
+ }
10728
+ }
10575
10729
  const frozenInput = {
10576
10730
  ...input,
10577
10731
  rows: prepareRuntimeSheetRowsForJsonTransport({
@@ -10591,6 +10745,31 @@ export function createCompleteRuntimeMapRowsOperation(
10591
10745
  : () => postPreparedRuntimeMapRows(context, frozenInput, submittedKeys);
10592
10746
  }
10593
10747
 
10748
+ /**
10749
+ * The exact JSON `postRuntimeApi` sends for a map-row write whose rows are
10750
+ * `rowsJson`: the envelope is serialized as that request would be, and the
10751
+ * rows array is spliced in where its serialization falls.
10752
+ */
10753
+ function runtimeMapRowsRequestJson(
10754
+ input: Parameters<typeof completeRuntimeMapRows>[1],
10755
+ rowsJson: readonly string[],
10756
+ ): string {
10757
+ const placeholder = `\u0000deepline-map-rows:${randomUUID()}`;
10758
+ const envelopeJson = JSON.stringify(
10759
+ prepareRetainedPlayPipelinesForTransport({
10760
+ action: 'runtime_sheet_complete_map_rows',
10761
+ input: { ...input, rows: placeholder },
10762
+ }),
10763
+ );
10764
+ const parts = envelopeJson.split(JSON.stringify(placeholder));
10765
+ if (parts.length !== 2) {
10766
+ throw new Error(
10767
+ 'Runtime map-row write envelope must hold its rows placeholder exactly once.',
10768
+ );
10769
+ }
10770
+ return `${parts[0]}[${rowsJson.join(',')}]${parts[1]}`;
10771
+ }
10772
+
10594
10773
  export type RuntimeSheetDatasetReadInput = {
10595
10774
  tableNamespace: string;
10596
10775
  runId?: string | null;
@@ -10938,6 +11117,12 @@ export type RuntimeSheetDatasetRowKeysResult = {
10938
11117
  inputIndex?: number;
10939
11118
  ownedByOtherRun: boolean;
10940
11119
  }>;
11120
+ /**
11121
+ * `terminalRowsAnyRun` only: requested keys whose row another run re-admitted
11122
+ * and has not finished yet (pending or running under that run). Absent from
11123
+ * older readers, which leaves such keys unproven.
11124
+ */
11125
+ unfinishedTakeoverKeys?: string[];
10941
11126
  rowMode?: 'terminalRowsAnyRun';
10942
11127
  };
10943
11128
 
@@ -10963,7 +11148,12 @@ export async function readRuntimeSheetDatasetRowKeys(
10963
11148
  ];
10964
11149
  if (keys.length === 0) {
10965
11150
  return input.rowMode === 'terminalRowsAnyRun'
10966
- ? { keys: [], rows: [], rowMode: 'terminalRowsAnyRun' }
11151
+ ? {
11152
+ keys: [],
11153
+ rows: [],
11154
+ unfinishedTakeoverKeys: [],
11155
+ rowMode: 'terminalRowsAnyRun',
11156
+ }
10967
11157
  : { keys: [] };
10968
11158
  }
10969
11159
  const session = requireRuntimePostgresSession(
@@ -10985,21 +11175,38 @@ export async function readRuntimeSheetDatasetRowKeys(
10985
11175
  // Finished rows for the requested keys, whichever run owns them now. A
10986
11176
  // later run's admission or write moves a row to itself, so run-scoped
10987
11177
  // reads omit it; finalization uses these rows to return what the earlier
10988
- // run committed. Pending or running rows are absent: an unfinished
10989
- // takeover is not a result. The response echoes the mode because an older
10990
- // reader answers an unknown mode as an `output` read of the caller's keys.
10991
- const terminalRows = await withRuntimePostgres(session, async (client) => {
10992
- const { rows: matchedRows } = await client.query<Record<string, unknown>>(
11178
+ // run committed. Pending or running rows are not results; the ones another
11179
+ // run re-admitted are listed by key so finalization can count them as
11180
+ // superseded by that newer run instead of lost. The response echoes the
11181
+ // mode because an older reader answers an unknown mode as an `output`
11182
+ // read of the caller's keys.
11183
+ // One statement, so both sets come from one snapshot: a row the newer run
11184
+ // finishes between two reads would otherwise appear in neither.
11185
+ const matchedRows = await withRuntimePostgres(session, async (client) => {
11186
+ const { rows } = await client.query<Record<string, unknown>>(
10993
11187
  `SELECT *
10994
11188
  FROM ${sheetTable(session)}
10995
11189
  WHERE _key = ANY($1::text[])
10996
- AND _status IN ('enriched', 'failed')`,
10997
- [keys],
11190
+ AND (
11191
+ _status IN ('enriched', 'failed')
11192
+ OR (
11193
+ _status IN ('pending', 'running')
11194
+ AND _run_id IS DISTINCT FROM $2::text
11195
+ )
11196
+ )`,
11197
+ [keys, input.runId],
10998
11198
  );
10999
- return matchedRows;
11199
+ return rows;
11000
11200
  });
11201
+ const terminalRows = matchedRows.filter(
11202
+ (raw) => raw._status === 'enriched' || raw._status === 'failed',
11203
+ );
11204
+ const unfinishedTakeoverKeys = matchedRows
11205
+ .filter((raw) => raw._status === 'pending' || raw._status === 'running')
11206
+ .map((raw) => String(raw._key));
11001
11207
  return {
11002
11208
  keys: terminalRows.map((raw) => String(raw._key)),
11209
+ unfinishedTakeoverKeys,
11003
11210
  rows: terminalRows.map((raw) => {
11004
11211
  const { data, inputIndex } = mapRuntimePostgresRow({ raw });
11005
11212
  return {
@@ -2,6 +2,7 @@ import type { PlayAuthoringRunActor } from '../plays/authoring-contract';
2
2
  import { mintWorkflowExecutorToken } from './/workflow-executor-auth';
3
3
  import {
4
4
  normalizeRuntimeExecutionCapabilities,
5
+ normalizeRuntimeTeamId,
5
6
  PLAY_RUNTIME_EXECUTION_CAPABILITIES,
6
7
  type CalendarBookingBinding,
7
8
  type ExecutionOperationPolicy,
@@ -40,6 +41,8 @@ export function deriveAsyncChildRuntimeAuthority(input: {
40
41
  ? { operationPolicy: input.parent.operationPolicy }
41
42
  : {}),
42
43
  orgId: input.parent.orgId,
44
+ // A child runs in its parent's team.
45
+ ...teamIdFields(input.parent.teamId),
43
46
  workflowId: input.workflowId,
44
47
  runId: input.runId,
45
48
  // The scheduler-owned parent launch resolves the billing owner to the
@@ -69,6 +72,12 @@ export function deriveAsyncChildRuntimeAuthority(input: {
69
72
  };
70
73
  }
71
74
 
75
+ /** Default-team launches keep the descriptor shape they had before teams. */
76
+ function teamIdFields(teamId: unknown): { teamId?: string } {
77
+ const named = normalizeRuntimeTeamId(teamId);
78
+ return named ? { teamId: named } : {};
79
+ }
80
+
72
81
  export async function mintPlayRunRuntimeAuthorityDescriptor(input: {
73
82
  descriptor: RuntimeAuthorityDescriptor;
74
83
  runtimeOrigin?: string | null;
@@ -98,6 +107,8 @@ export async function mintPlayRunRuntimeAuthority(input: {
98
107
  operationPolicy?: ExecutionOperationPolicy;
99
108
  calendarBookingBinding?: CalendarBookingBinding;
100
109
  orgId: string;
110
+ /** The run's team; absent or null is the org's default team. */
111
+ teamId?: string | null;
101
112
  workflowId: string;
102
113
  runId: string;
103
114
  billingRunId?: string | null;
@@ -125,6 +136,7 @@ export async function mintPlayRunRuntimeAuthority(input: {
125
136
  ? { calendarBookingBinding: input.calendarBookingBinding }
126
137
  : {}),
127
138
  orgId: input.orgId,
139
+ ...teamIdFields(input.teamId),
128
140
  workflowId: input.workflowId,
129
141
  runId: input.runId,
130
142
  billingRunId: input.billingRunId ?? null,
@@ -172,6 +184,7 @@ export function runtimeAuthorityMintInput(
172
184
  ? { calendarBookingBinding: descriptor.calendarBookingBinding }
173
185
  : {}),
174
186
  orgId: descriptor.orgId,
187
+ teamId: normalizeRuntimeTeamId(descriptor.teamId) ?? null,
175
188
  workflowId: descriptor.workflowId,
176
189
  runId: descriptor.runId,
177
190
  billingRunId: descriptor.billingRunId,
@@ -42,6 +42,36 @@ export const RUNNER_GATEWAY_CONNECTION_RETRY_BUDGET_MS =
42
42
  */
43
43
  export const RUNNER_GATEWAY_SCHEDULER_UNAVAILABLE_RETRY_BUDGET_MS = 3 * 60_000;
44
44
 
45
+ /**
46
+ * The app's pre-route account-access cutoff answers 503 with this code in
47
+ * `x-deepline-error-code` when it could not verify the caller (a dependency
48
+ * failed, not a block or a revocation). No route handler ran, so nothing was
49
+ * done and a resend is safe. Mirrors `AccountAccess.detail('unavailable').code`
50
+ * in `@deepline/auth/account-block`, which must not import this package.
51
+ */
52
+ export const ACCOUNT_ACCESS_UNAVAILABLE_CODE = 'ACCOUNT_ACCESS_UNAVAILABLE';
53
+
54
+ /**
55
+ * How long a retry-safe runtime read (a runtime-control lookup, a secret
56
+ * resolution) keeps retrying a declared `ACCOUNT_ACCESS_UNAVAILABLE` 503. On
57
+ * 2026-11-24 the cutoff's dependency failed for about 9 seconds and ~350 ms of
58
+ * retries turned it into 13 terminal runs. This outlasts such a blip a few
59
+ * times over, then fails loudly.
60
+ */
61
+ export const RUNNER_ACCOUNT_ACCESS_UNAVAILABLE_RETRY_BUDGET_MS = 30_000;
62
+
63
+ /** Only the cutoff's declared header qualifies; a body code proves nothing. */
64
+ export function isAccountAccessUnavailableResponse(response: {
65
+ status: number;
66
+ headers: Pick<Headers, 'get'>;
67
+ }): boolean {
68
+ return (
69
+ response.status === 503 &&
70
+ response.headers.get('x-deepline-error-code') ===
71
+ ACCOUNT_ACCESS_UNAVAILABLE_CODE
72
+ );
73
+ }
74
+
45
75
  /**
46
76
  * Runner timeout includes setup, cleanup, and billing headroom after the
47
77
  * user-code runtime cap.