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
@@ -0,0 +1,188 @@
1
+ import { request } from 'node:http';
2
+ import { getVercelOidcToken } from '@vercel/oidc';
3
+
4
+ export const PREVIEW_R2_BROKER_URL =
5
+ 'https://deepline-preview-r2-broker.chirag-d94.workers.dev';
6
+ export const PREVIEW_RECEIPT_R2_BUCKET = 'plays-receipts-v1-preview';
7
+ export const PREVIEW_PLAY_ARTIFACT_R2_BUCKET = 'plays-artifacts-v1-preview';
8
+ export const PREVIEW_APP_UPLOAD_R2_BUCKET = 'deepline-app-uploads-v1-preview';
9
+ const AUDIENCE = 'urn:deepline:preview:r2';
10
+
11
+ async function githubIdentity(env: NodeJS.ProcessEnv): Promise<string> {
12
+ if (
13
+ !env.ACTIONS_ID_TOKEN_REQUEST_URL ||
14
+ !env.ACTIONS_ID_TOKEN_REQUEST_TOKEN
15
+ ) {
16
+ throw new Error('The Preview R2 workflow requires id-token: write.');
17
+ }
18
+ const url = new URL(env.ACTIONS_ID_TOKEN_REQUEST_URL);
19
+ if (
20
+ url.protocol !== 'https:' ||
21
+ !url.hostname.endsWith('.actions.githubusercontent.com')
22
+ ) {
23
+ throw new Error('Unexpected GitHub Actions identity provider.');
24
+ }
25
+ url.searchParams.set('audience', AUDIENCE);
26
+ const response = await fetch(url, {
27
+ headers: { authorization: `Bearer ${env.ACTIONS_ID_TOKEN_REQUEST_TOKEN}` },
28
+ redirect: 'error',
29
+ signal: AbortSignal.timeout(8_000),
30
+ });
31
+ if (!response.ok)
32
+ throw new Error(
33
+ `GitHub workload identity failed (HTTP ${response.status}).`,
34
+ );
35
+ const result: unknown = await response.json();
36
+ if (
37
+ result &&
38
+ typeof result === 'object' &&
39
+ 'value' in result &&
40
+ typeof result.value === 'string'
41
+ ) {
42
+ return result.value;
43
+ }
44
+ throw new Error('GitHub returned no workload identity.');
45
+ }
46
+
47
+ function flyIdentity(): Promise<string> {
48
+ return new Promise((resolve, reject) => {
49
+ const body = JSON.stringify({ aud: AUDIENCE });
50
+ const req = request(
51
+ {
52
+ socketPath: '/.fly/api',
53
+ path: '/v1/tokens/oidc',
54
+ method: 'POST',
55
+ headers: {
56
+ 'content-type': 'application/json',
57
+ 'content-length': Buffer.byteLength(body),
58
+ },
59
+ signal: AbortSignal.timeout(8_000),
60
+ },
61
+ (response) => {
62
+ if (response.statusCode !== 200) {
63
+ response.resume();
64
+ reject(
65
+ new Error(
66
+ `Fly machine identity failed (HTTP ${response.statusCode}).`,
67
+ ),
68
+ );
69
+ return;
70
+ }
71
+ let received = '';
72
+ response
73
+ .setEncoding('utf8')
74
+ .on('data', (chunk: string) => {
75
+ received += chunk;
76
+ if (received.length > 16384) {
77
+ req.destroy(
78
+ new Error(
79
+ 'Fly machine identity response exceeds its size limit.',
80
+ ),
81
+ );
82
+ }
83
+ })
84
+ .on('error', reject)
85
+ .on('end', () => {
86
+ const raw = received.trim();
87
+ const token = raw.startsWith('"') ? raw.slice(1, -1) : raw;
88
+ if (
89
+ /^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(token)
90
+ ) {
91
+ resolve(token);
92
+ } else {
93
+ reject(new Error('Fly returned no machine identity.'));
94
+ }
95
+ });
96
+ },
97
+ );
98
+ req.on('error', reject).end(body);
99
+ });
100
+ }
101
+
102
+ function identityToken(env: NodeJS.ProcessEnv): Promise<string> {
103
+ if (env.GITHUB_ACTIONS === 'true') return githubIdentity(env);
104
+ if (env.FLY_APP_NAME) return flyIdentity();
105
+ if (env.VERCEL_ENV === 'preview') return getVercelOidcToken();
106
+ throw new Error(
107
+ 'No supported workload identity is available for Preview R2.',
108
+ );
109
+ }
110
+
111
+ export function previewR2CredentialProvider(bucket: string, env = process.env) {
112
+ if (!env.DEEPLINE_PREVIEW_R2_BROKER_URL) return undefined;
113
+ if (
114
+ env.DEEPLINE_PREVIEW_R2_BROKER_URL !== PREVIEW_R2_BROKER_URL ||
115
+ (env.VERCEL_ENV !== 'preview' && env.DEEPLINE_ENV !== 'preview') ||
116
+ env.VERCEL_ENV === 'production' ||
117
+ /^(prod|production|live)$/i.test(env.DEEPLINE_ENV ?? '') ||
118
+ env.CLOUDFLARE_R2_ENDPOINT !==
119
+ 'https://d948cd70fbe8d4b4eb10b0de60b45f45.r2.cloudflarestorage.com'
120
+ )
121
+ throw new Error(
122
+ 'The R2 workload identity broker requires the isolated Preview target.',
123
+ );
124
+
125
+ const githubArtifacts =
126
+ env.GITHUB_ACTIONS === 'true' && bucket === PREVIEW_PLAY_ARTIFACT_R2_BUCKET;
127
+ if (
128
+ githubArtifacts &&
129
+ !/^preview-pr-[1-9][0-9]*$/.test(env.DEEPLINE_PLAY_ARTIFACT_R2_PREFIX ?? '')
130
+ ) {
131
+ throw new Error('GitHub Preview artifacts require a PR storage prefix.');
132
+ }
133
+
134
+ const resource =
135
+ bucket === PREVIEW_RECEIPT_R2_BUCKET
136
+ ? 'receipts'
137
+ : bucket === PREVIEW_PLAY_ARTIFACT_R2_BUCKET
138
+ ? githubArtifacts
139
+ ? 'pr-artifacts'
140
+ : 'artifacts'
141
+ : bucket === PREVIEW_APP_UPLOAD_R2_BUCKET
142
+ ? 'uploads'
143
+ : null;
144
+ if (!resource)
145
+ throw new Error(
146
+ 'The Preview R2 broker only serves its configured Preview buckets.',
147
+ );
148
+
149
+ return async () => {
150
+ const response = await fetch(
151
+ `${PREVIEW_R2_BROKER_URL}/v1/credentials/${resource}`,
152
+ {
153
+ method: 'POST',
154
+ headers: { authorization: `Bearer ${await identityToken(env)}` },
155
+ redirect: 'error',
156
+ signal: AbortSignal.timeout(8_000),
157
+ },
158
+ );
159
+ if (!response.ok)
160
+ throw new Error(
161
+ `Preview R2 credential exchange failed (HTTP ${response.status}).`,
162
+ );
163
+ const result: unknown = await response.json();
164
+ if (
165
+ !result ||
166
+ typeof result !== 'object' ||
167
+ !('accessKeyId' in result) ||
168
+ typeof result.accessKeyId !== 'string' ||
169
+ !('secretAccessKey' in result) ||
170
+ typeof result.secretAccessKey !== 'string' ||
171
+ !('sessionToken' in result) ||
172
+ typeof result.sessionToken !== 'string' ||
173
+ !('expiresAt' in result) ||
174
+ typeof result.expiresAt !== 'number' ||
175
+ !Number.isSafeInteger(result.expiresAt) ||
176
+ result.expiresAt * 1000 <= Date.now()
177
+ )
178
+ throw new Error(
179
+ 'Preview R2 broker returned invalid credential metadata.',
180
+ );
181
+ return {
182
+ accessKeyId: result.accessKeyId,
183
+ secretAccessKey: result.secretAccessKey,
184
+ sessionToken: result.sessionToken,
185
+ expiration: new Date(result.expiresAt * 1000),
186
+ };
187
+ };
188
+ }
@@ -4,17 +4,29 @@ import {
4
4
  GetObjectCommand,
5
5
  HeadObjectCommand,
6
6
  DeleteObjectCommand,
7
+ DeleteObjectsCommand,
8
+ ListObjectsV2Command,
7
9
  } from '@aws-sdk/client-s3';
8
10
  import { createHash } from 'node:crypto';
9
11
  import { NodeHttpHandler } from '@smithy/node-http-handler';
10
12
  import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
11
13
  import { Agent as HttpsAgent } from 'node:https';
12
14
  import { isBuildContext } from '../observability/build-context';
15
+ import {
16
+ PREVIEW_APP_UPLOAD_R2_BUCKET,
17
+ PREVIEW_PLAY_ARTIFACT_R2_BUCKET,
18
+ PREVIEW_RECEIPT_R2_BUCKET,
19
+ previewR2CredentialProvider,
20
+ } from './preview-r2-oidc';
13
21
 
14
22
  type R2PresignerClient = Parameters<typeof getSignedUrl>[0];
15
23
  type R2PresignerCommand = Parameters<typeof getSignedUrl>[1];
16
24
 
17
- export type R2BucketKind = 'default' | 'playArtifacts';
25
+ export type R2BucketKind = 'default' | 'playArtifacts' | 'uploads';
26
+
27
+ export { PREVIEW_RECEIPT_R2_BUCKET } from './preview-r2-oidc';
28
+
29
+ const PREVIEW_UPLOADS_ORIGIN = 'https://preview-uploads.deeplinedeveloper.com';
18
30
 
19
31
  const PLAY_ARTIFACT_BUCKETS = {
20
32
  dev: 'plays-artifacts-v1-dev',
@@ -59,6 +71,16 @@ function getRuntimeEnv(): keyof typeof PLAY_ARTIFACT_BUCKETS {
59
71
 
60
72
  function resolvePlayArtifactStorage() {
61
73
  const environment = getRuntimeEnv();
74
+ const bucket = process.env.CLOUDFLARE_R2_BUCKET_NAME?.trim();
75
+ if (
76
+ environment === 'dev' &&
77
+ (process.env.VERCEL_ENV === 'preview' ||
78
+ process.env.DEEPLINE_ENV === 'preview') &&
79
+ (bucket === PREVIEW_RECEIPT_R2_BUCKET ||
80
+ bucket === PREVIEW_PLAY_ARTIFACT_R2_BUCKET)
81
+ ) {
82
+ return { environment, bucket: PREVIEW_PLAY_ARTIFACT_R2_BUCKET };
83
+ }
62
84
  return { environment, bucket: PLAY_ARTIFACT_BUCKETS[environment] };
63
85
  }
64
86
 
@@ -75,16 +97,29 @@ function resolveBucket(kind: R2BucketKind): string {
75
97
  if (kind === 'playArtifacts') {
76
98
  return resolvePlayArtifactStorage().bucket;
77
99
  }
100
+ if (kind === 'uploads' && process.env.DEEPLINE_PREVIEW_R2_BROKER_URL) {
101
+ return PREVIEW_APP_UPLOAD_R2_BUCKET;
102
+ }
78
103
  return requireEnv('CLOUDFLARE_R2_BUCKET_NAME');
79
104
  }
80
105
 
81
106
  export function getR2Config(kind: R2BucketKind = 'default') {
107
+ const bucket = resolveBucket(kind);
108
+ const federated = previewR2CredentialProvider(bucket);
109
+ const previewUploadsOrigin = process.env.DEEPLINE_PREVIEW_R2_UPLOADS_URL;
110
+ const publicUrl = federated
111
+ ? kind === 'uploads' && previewUploadsOrigin === PREVIEW_UPLOADS_ORIGIN
112
+ ? previewUploadsOrigin
113
+ : undefined
114
+ : requireEnv('CLOUDFLARE_R2_PUBLIC_URL');
82
115
  return {
83
116
  endpoint: requireEnv('CLOUDFLARE_R2_ENDPOINT'),
84
- accessKeyId: requireEnv('CLOUDFLARE_R2_ACCESS_KEY_ID'),
85
- secretAccessKey: requireEnv('CLOUDFLARE_R2_SECRET_ACCESS_KEY'),
86
- bucket: resolveBucket(kind),
87
- publicUrl: requireEnv('CLOUDFLARE_R2_PUBLIC_URL'),
117
+ credentials: federated ?? {
118
+ accessKeyId: requireEnv('CLOUDFLARE_R2_ACCESS_KEY_ID'),
119
+ secretAccessKey: requireEnv('CLOUDFLARE_R2_SECRET_ACCESS_KEY'),
120
+ },
121
+ bucket,
122
+ publicUrl,
88
123
  };
89
124
  }
90
125
 
@@ -93,13 +128,31 @@ export type R2TransportPolicy = {
93
128
  socketIdleTimeoutMs: number;
94
129
  };
95
130
 
131
+ // The SDK default (3 attempts) spends at most ~0.3 s of jittered backoff, and
132
+ // brief Cloudflare R2 503 bursts outlast it: a completed provider call whose
133
+ // response could not be stored became a 409 "outcome unknown" (68 times in
134
+ // Production, Oct 20-Nov 19 2026). Every R2 object operation here is
135
+ // idempotent by key, so six attempts (~3 s expected, ~6 s worst-case backoff)
136
+ // is safe to retry.
137
+ const R2_MAX_ATTEMPTS = 6;
138
+
96
139
  const DEFAULT_R2_TRANSPORT_POLICY: Readonly<R2TransportPolicy> = {
97
140
  connectionTimeoutMs: 10_000,
98
141
  socketIdleTimeoutMs: 30_000,
99
142
  };
100
143
 
144
+ type R2ClientConfig =
145
+ | ReturnType<typeof getR2Config>
146
+ | {
147
+ endpoint: string;
148
+ accessKeyId: string;
149
+ secretAccessKey: string;
150
+ bucket?: string;
151
+ publicUrl?: string;
152
+ };
153
+
101
154
  export function createR2Client(
102
- config: ReturnType<typeof getR2Config>,
155
+ config: R2ClientConfig,
103
156
  transportPolicy: Readonly<R2TransportPolicy> = DEFAULT_R2_TRANSPORT_POLICY,
104
157
  ): S3Client {
105
158
  for (const timeout of [
@@ -113,10 +166,14 @@ export function createR2Client(
113
166
  return new S3Client({
114
167
  region: 'auto',
115
168
  endpoint: config.endpoint,
116
- credentials: {
117
- accessKeyId: config.accessKeyId,
118
- secretAccessKey: config.secretAccessKey,
119
- },
169
+ maxAttempts: R2_MAX_ATTEMPTS,
170
+ credentials:
171
+ 'credentials' in config
172
+ ? config.credentials
173
+ : {
174
+ accessKeyId: config.accessKeyId,
175
+ secretAccessKey: config.secretAccessKey,
176
+ },
120
177
  requestHandler: new NodeHttpHandler({
121
178
  // Bound connection acquisition/connect and stalled I/O separately. A
122
179
  // large upload that keeps moving must not hit a small total deadline.
@@ -134,7 +191,11 @@ export function createR2Client(
134
191
  const r2ClientMemo = new Map<string, S3Client>();
135
192
 
136
193
  function getR2Client(config: ReturnType<typeof getR2Config>): S3Client {
137
- const key = `${config.endpoint}|${config.bucket}|${config.accessKeyId}`;
194
+ const keyIdentity =
195
+ typeof config.credentials === 'function'
196
+ ? 'oidc'
197
+ : config.credentials.accessKeyId;
198
+ const key = `${config.endpoint}|${config.bucket}|${keyIdentity}`;
138
199
  const existing = r2ClientMemo.get(key);
139
200
  if (existing) {
140
201
  return existing;
@@ -269,7 +330,11 @@ export async function uploadBufferToR2(input: {
269
330
  retryDelayMs: result.$metadata.totalRetryDelay ?? null,
270
331
  });
271
332
 
272
- if (bucketKind === 'playArtifacts') {
333
+ if (
334
+ bucketKind === 'playArtifacts' ||
335
+ config.bucket === PREVIEW_RECEIPT_R2_BUCKET ||
336
+ !config.publicUrl
337
+ ) {
273
338
  return `r2://${config.bucket}/${input.key}`;
274
339
  }
275
340
  return `${config.publicUrl.replace(/\/+$/, '')}/${input.key}`;
@@ -316,6 +381,89 @@ export async function deleteR2Object(
316
381
  logR2Perf('delete', key, startedAt, { kind });
317
382
  }
318
383
 
384
+ /**
385
+ * Delete every object under `prefix`, one listed page (up to 1,000 keys) at a
386
+ * time, until a listing returns nothing or `deadline` passes. `done` means a
387
+ * listing after the last delete found the prefix empty.
388
+ */
389
+ export async function deleteR2Prefix(input: {
390
+ prefix: string;
391
+ kind: R2BucketKind;
392
+ deadline: number;
393
+ }): Promise<{ done: boolean; deleted: number }> {
394
+ if (!input.prefix.endsWith('/') || input.prefix === '/') {
395
+ throw new Error('deleteR2Prefix needs a non-root prefix ending in "/".');
396
+ }
397
+ const config = getR2Config(input.kind);
398
+ const client = getR2Client(config);
399
+ let deleted = 0;
400
+ while (Date.now() < input.deadline) {
401
+ const listed = await client.send(
402
+ new ListObjectsV2Command({
403
+ Bucket: config.bucket,
404
+ Prefix: input.prefix,
405
+ MaxKeys: 1000,
406
+ }),
407
+ );
408
+ const keys = (listed.Contents ?? []).flatMap((object) =>
409
+ object.Key ? [{ Key: object.Key }] : [],
410
+ );
411
+ if (keys.length === 0) return { done: true, deleted };
412
+ const result = await client.send(
413
+ new DeleteObjectsCommand({
414
+ Bucket: config.bucket,
415
+ Delete: { Objects: keys, Quiet: true },
416
+ }),
417
+ );
418
+ if (result.Errors?.length) {
419
+ const first = result.Errors[0];
420
+ throw new Error(
421
+ `R2 refused ${result.Errors.length} deletes under ${input.prefix}: ${first?.Code ?? 'unknown'} ${first?.Message ?? ''}`.trim(),
422
+ );
423
+ }
424
+ deleted += keys.length;
425
+ }
426
+ return { done: false, deleted };
427
+ }
428
+
429
+ /** Objects under `prefix`, listing at most `max`. Reads only. */
430
+ export async function countR2Prefix(input: {
431
+ prefix: string;
432
+ kind: R2BucketKind;
433
+ max: number;
434
+ }): Promise<{ count: number; more: boolean }> {
435
+ const config = getR2Config(input.kind);
436
+ const client = getR2Client(config);
437
+ let count = 0;
438
+ let token: string | undefined;
439
+ do {
440
+ const listed = await client.send(
441
+ new ListObjectsV2Command({
442
+ Bucket: config.bucket,
443
+ Prefix: input.prefix,
444
+ MaxKeys: 1000,
445
+ ...(token ? { ContinuationToken: token } : {}),
446
+ }),
447
+ );
448
+ count += listed.KeyCount ?? listed.Contents?.length ?? 0;
449
+ token = listed.IsTruncated ? listed.NextContinuationToken : undefined;
450
+ } while (token && count < input.max);
451
+ return { count, more: Boolean(token) };
452
+ }
453
+
454
+ async function signedUrlLifetime(client: S3Client, requestedLifetime: number) {
455
+ const requestedSeconds = Math.max(1, Math.floor(requestedLifetime));
456
+ const credentials = await client.config.credentials();
457
+ if (!credentials.expiration) return requestedSeconds;
458
+ const remaining =
459
+ Math.floor((credentials.expiration.getTime() - Date.now()) / 1000) - 5;
460
+ if (remaining < 1)
461
+ throw new Error(
462
+ 'R2 session is too close to expiration to sign an object URL.',
463
+ );
464
+ return Math.min(requestedSeconds, remaining);
465
+ }
466
+
319
467
  export async function createSignedR2ReadUrl(input: {
320
468
  key: string;
321
469
  kind?: R2BucketKind;
@@ -324,8 +472,11 @@ export async function createSignedR2ReadUrl(input: {
324
472
  const startedAt = Date.now();
325
473
  const kind = input.kind ?? 'default';
326
474
  const config = getR2Config(kind);
327
- const client = createR2Client(config);
328
- const expiresInSeconds = Math.max(1, Math.floor(input.expiresInSeconds));
475
+ const client = getR2Client(config);
476
+ const expiresInSeconds = await signedUrlLifetime(
477
+ client,
478
+ input.expiresInSeconds,
479
+ );
329
480
  const command = new GetObjectCommand({
330
481
  Bucket: config.bucket,
331
482
  Key: input.key,
@@ -362,8 +513,11 @@ export async function createSignedR2WriteUrl(input: {
362
513
  const startedAt = Date.now();
363
514
  const kind = input.kind ?? 'default';
364
515
  const config = getR2Config(kind);
365
- const client = createR2Client(config);
366
- const expiresInSeconds = Math.max(1, Math.floor(input.expiresInSeconds));
516
+ const client = getR2Client(config);
517
+ const expiresInSeconds = await signedUrlLifetime(
518
+ client,
519
+ input.expiresInSeconds,
520
+ );
367
521
  const command = new PutObjectCommand({
368
522
  Bucket: config.bucket,
369
523
  Key: input.key,
@@ -47,6 +47,11 @@ export function isRuntimeSheetCellMetaColumnReady(
47
47
  );
48
48
  }
49
49
 
50
+ export const RUNTIME_SHEET_SUMMARY_TABLE = '_deepline_sheet_summaries';
51
+ export const RUNTIME_SHEET_COLUMN_SUMMARY_TABLE =
52
+ '_deepline_sheet_column_summaries';
53
+ export const RUNTIME_RUN_DATASET_CATALOG_TABLE = '_deepline_run_datasets';
54
+
50
55
  /** Expand-only immutable history. Writers enable after tenant migration proof. */
51
56
  export const RUNTIME_SHEET_RUN_MEMBERSHIP_TABLE =
52
57
  '_deepline_run_row_memberships';
@@ -68,6 +68,7 @@ import {
68
68
  buildRunLedgerEventsIdempotencyKey,
69
69
  isRunLedgerProjectionMismatchDiagnostic,
70
70
  isRunLedgerProjectionLeaseLostReason,
71
+ RUN_LEDGER_TERMINAL_BACKLOG_PREFIX_MAX_FACTS,
71
72
  type RunLedgerProjectionChunk,
72
73
  type RunLedgerProjectionLeaseLostReason,
73
74
  type RunLedgerProjectionMismatchDiagnostic,
@@ -388,6 +389,12 @@ export type WorkerRuntimeApiContext = {
388
389
  executorToken: string;
389
390
  /** Exact ingress-prefix verifier advertised by the immutable launch receiver. */
390
391
  runLedgerIngressPrefixBatching?: true;
392
+ /**
393
+ * Facts the receiver proves in one terminal backlog receipt
394
+ * (run-ledger-projection-contract). Set only from that receiver's own
395
+ * advertisement; absent, receipts keep eight facts.
396
+ */
397
+ runLedgerTerminalBacklogFacts?: number;
391
398
  /** The launch receiver advertised that it stores retained pipeline graphs. */
392
399
  retainedPipelineGraphs?: true;
393
400
  /** `fetch` invokes the receiver in-process, so no ingress body limit applies. */
@@ -826,7 +833,10 @@ function isRetryableAppRuntimeResponse(input: {
826
833
  // than reducing every 4xx to permanent at the worker boundary.
827
834
  const explicitRetryable = appRuntimeExplicitRetryable(input.body);
828
835
  if (explicitRetryable !== null) return explicitRetryable;
829
- if (isComputeBillingTooManyWritesResponse(input)) {
836
+ if (
837
+ isComputeBillingTooManyWritesResponse(input) ||
838
+ isComputeBillingPausedDeploymentResponse(input)
839
+ ) {
830
840
  return true;
831
841
  }
832
842
  if (
@@ -918,6 +928,31 @@ function isComputeBillingTooManyWritesResponse(input: {
918
928
  }
919
929
  }
920
930
 
931
+ /** Convex's refusal while a deployment is paused. */
932
+ export const COMPUTE_BILLING_PAUSED_DEPLOYMENT_SIGNATURE =
933
+ 'Cannot run functions while this deployment is paused';
934
+
935
+ /**
936
+ * A paused Convex deployment (a Preview branch deployment that cleanup paused)
937
+ * refuses every function before running it, so nothing was written. The same
938
+ * request succeeds once the deployment resumes. Treating this 500 as permanent
939
+ * quarantined a durable compute-billing job forever (PR #10955's Preview
940
+ * estate). Only the replay-safe compute actions accept this signature.
941
+ */
942
+ function isComputeBillingPausedDeploymentResponse(input: {
943
+ action: RuntimeApiRequest['action'];
944
+ status: number;
945
+ body: string;
946
+ }): boolean {
947
+ return (
948
+ input.status === 500 &&
949
+ (input.action === 'compute_billing_upsert' ||
950
+ input.action === 'compute_billing_record_item' ||
951
+ input.action === 'compute_billing_finalize') &&
952
+ input.body.includes(COMPUTE_BILLING_PAUSED_DEPLOYMENT_SIGNATURE)
953
+ );
954
+ }
955
+
921
956
  function isRetryableAppRuntimeResponseStatus(status: number): boolean {
922
957
  return (
923
958
  status === 429 ||
@@ -2467,7 +2502,7 @@ export type PlayViewLink = {
2467
2502
  url: string;
2468
2503
  /** Opens the view at the run that asked. */
2469
2504
  runUrl: string;
2470
- access: 'workspace' | 'public';
2505
+ access: 'workspace' | 'org' | 'public';
2471
2506
  };
2472
2507
 
2473
2508
  export async function listViewsViaAppRuntime(
@@ -2868,8 +2903,36 @@ export async function projectRunEventsViaAppRuntime(
2868
2903
  idempotencyKey: string;
2869
2904
  deliveryLeaseOwner: string;
2870
2905
  beforeBatch: () => Promise<void>;
2906
+ /**
2907
+ * Outbox facts in this receipt, sent only above the eight every receiver
2908
+ * proves, and only to a receiver that advertised it
2909
+ * (`runLedgerTerminalBacklogFacts`) or for a frozen ingress receipt.
2910
+ */
2911
+ deliveryPrefixFacts?: number;
2912
+ /**
2913
+ * An earlier claim froze this ingress receipt's membership: its receiver
2914
+ * accepts only these exact facts. It is sent whole even when this
2915
+ * receiver did not advertise its size (a projector may lose the
2916
+ * advertisement after the freeze); a receiver that cannot prove it
2917
+ * refuses it as a retryable lease loss without committing. A receipt the
2918
+ * current claim froze is not marked; its size stays within what this
2919
+ * receiver advertised.
2920
+ */
2921
+ frozenIngressReceipt?: boolean;
2871
2922
  },
2872
2923
  ): Promise<void> {
2924
+ const provableFacts =
2925
+ input.frozenIngressReceipt === true
2926
+ ? RUN_LEDGER_TERMINAL_BACKLOG_PREFIX_MAX_FACTS
2927
+ : context.runLedgerTerminalBacklogFacts;
2928
+ if (
2929
+ input.deliveryPrefixFacts !== undefined &&
2930
+ (provableFacts === undefined || input.deliveryPrefixFacts > provableFacts)
2931
+ ) {
2932
+ throw new Error(
2933
+ `A ${input.deliveryPrefixFacts}-fact Run Ledger receipt needs a receiver that proves that many; this one advertised ${context.runLedgerTerminalBacklogFacts ?? 'none'}.`,
2934
+ );
2935
+ }
2873
2936
  const batches = partitionRunEventsForAppRuntime(input.events);
2874
2937
  const receiptBatch = runLedgerReceiptBatchIndex(batches);
2875
2938
  for (const [index, events] of batches.entries()) {
@@ -2896,6 +2959,9 @@ export async function projectRunEventsViaAppRuntime(
2896
2959
  ...(batches.length > 1
2897
2960
  ? { projectionChunk: { index, count: batches.length } }
2898
2961
  : {}),
2962
+ ...(input.deliveryPrefixFacts === undefined
2963
+ ? {}
2964
+ : { deliveryPrefixFacts: input.deliveryPrefixFacts }),
2899
2965
  };
2900
2966
  // The durable outbox owns recovery; this helper does not retry OCCs or
2901
2967
  // other delivery failures inside an already-leased invocation.