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
@@ -108,11 +108,17 @@ import {
108
108
  import {
109
109
  assertEarlySandboxEgress,
110
110
  earlySandboxEgressKey,
111
+ earlySandboxEgressRefusal,
111
112
  earlySandboxEnvironment,
112
113
  earlySandboxGatewayHosts,
113
114
  EarlySandboxEnvironmentError,
114
115
  EarlySandboxGatewayAddressWatch,
116
+ EARLY_SANDBOX_NARROW_MIN_STABLE_MS,
117
+ EARLY_SANDBOX_NARROW_PREFIX,
118
+ narrowEarlySandboxAllowlist,
115
119
  type EarlySandboxEgressRefusal,
120
+ type EarlySandboxNarrowedAllowlist,
121
+ type EarlySandboxNarrowRefusal,
116
122
  type EarlySandboxEnvironment,
117
123
  type EarlySandboxScope,
118
124
  } from '../early-sandbox-egress';
@@ -1792,11 +1798,18 @@ async function createEarlyModalSandbox(
1792
1798
  ),
1793
1799
  })
1794
1800
  : baseImage;
1801
+ // EN: the same choice as the hint's, derived again here. A gateway change
1802
+ // since the hint changes the egress key, and the scope check below refuses.
1803
+ const earlyAllowlist = earlyModalEgressNarrowWanted(
1804
+ input.experimentSwitchOverrides,
1805
+ )
1806
+ ? earlyModalEarlyAllowlistOrThrow(modalConfig.outboundCidrAllowlist)
1807
+ : modalConfig.outboundCidrAllowlist;
1795
1808
  const earlyParams = earlyModalSandboxCreateParams({
1796
1809
  limits: modalConfig.limits,
1797
1810
  memoryPolicy,
1798
1811
  workdir: modalConfig.workdir,
1799
- outboundCidrAllowlist: modalConfig.outboundCidrAllowlist,
1812
+ outboundCidrAllowlist: earlyAllowlist,
1800
1813
  supervisorSidecar,
1801
1814
  });
1802
1815
  // The key names the scope the hint was accepted for; the create must carry
@@ -2005,12 +2018,166 @@ export function startEarlyModalSandboxEgressWatch(): void {
2005
2018
  earlyModalGatewayAddresses.start();
2006
2019
  }
2007
2020
 
2021
+ /**
2022
+ * EN (per-run; granted only through a per-organization fast_launch@7 pin): an early sandbox without the sidecar
2023
+ * carries a narrowed allowlist (`narrowEarlySandboxAllowlist`: each gateway
2024
+ * IPv4 as a /32, contained in the deployment's, from an address set stable
2025
+ * for EARLY_SANDBOX_NARROW_MIN_STABLE_MS) instead of the deployment's. Its
2026
+ * egress key names that list, so only a launch whose own fresh derivation
2027
+ * gives the same list adopts it; any other launch misses and creates its own
2028
+ * sandbox with the deployment's allowlist, byte-identical to today.
2029
+ */
2030
+ export const NARROW_EARLY_SANDBOX_EGRESS = false;
2031
+
2032
+ /** Whether this run's early sandbox (and its adoption) uses EN. */
2033
+ export function earlyModalEgressNarrowWanted(
2034
+ overrides: EarlySandboxStartRequest['experimentSwitchOverrides'],
2035
+ ): boolean {
2036
+ return (
2037
+ !DURABLE_RUNS_ROLLOUT.modalSupervisorSidecar &&
2038
+ resolveExperimentSwitch('EN', overrides, NARROW_EARLY_SANDBOX_EGRESS)
2039
+ );
2040
+ }
2041
+
2042
+ /**
2043
+ * The allowlist an early create carries: EN's narrowed list when it can be
2044
+ * derived now, otherwise the deployment's (exactly today's). The gate, the
2045
+ * key and the create all use this, so they agree; a launch derives the same
2046
+ * choice with `earlyModalAdoptionEgress`.
2047
+ */
2048
+ export function earlyModalEarlyAllowlist(input: {
2049
+ narrow: boolean;
2050
+ outboundCidrAllowlist: string[] | null;
2051
+ gateway?: EarlySandboxGatewayAddressWatch;
2052
+ nowMs?: number;
2053
+ }): {
2054
+ allowlist: string[] | null;
2055
+ narrowRefusal: EarlySandboxNarrowRefusal | null;
2056
+ /**
2057
+ * With a narrowing refusal: the gate's verdict on the deployment list for
2058
+ * the same gateway state and time. A caller never keys or creates with a
2059
+ * fallback list the gate refuses.
2060
+ */
2061
+ deploymentRefusal: EarlySandboxEgressRefusal | null;
2062
+ } {
2063
+ if (!input.narrow)
2064
+ return {
2065
+ allowlist: input.outboundCidrAllowlist,
2066
+ narrowRefusal: null,
2067
+ deploymentRefusal: null,
2068
+ };
2069
+ const gateway = input.gateway ?? earlyModalGatewayAddresses;
2070
+ const nowMs = input.nowMs ?? Date.now();
2071
+ const narrowed = earlyModalNarrowedAllowlist({ ...input, gateway, nowMs });
2072
+ if (!('refused' in narrowed))
2073
+ return {
2074
+ allowlist: narrowed.allowlist,
2075
+ narrowRefusal: null,
2076
+ deploymentRefusal: null,
2077
+ };
2078
+ return {
2079
+ allowlist: input.outboundCidrAllowlist,
2080
+ narrowRefusal: narrowed.refused,
2081
+ deploymentRefusal: earlySandboxEgressRefusal({
2082
+ outboundCidrAllowlist: input.outboundCidrAllowlist,
2083
+ gatewayHosts: earlySandboxGatewayHosts(),
2084
+ gateway: gateway.state(),
2085
+ nowMs,
2086
+ }),
2087
+ };
2088
+ }
2089
+
2090
+ /**
2091
+ * The early create's allowlist under EN, or a throw when neither the
2092
+ * narrowed nor the deployment list passes the gate now (the gate passed a
2093
+ * moment earlier, so this is a state change, never a policy outcome).
2094
+ */
2095
+ function earlyModalEarlyAllowlistOrThrow(
2096
+ outboundCidrAllowlist: string[] | null,
2097
+ ): string[] | null {
2098
+ const early = earlyModalEarlyAllowlist({
2099
+ narrow: true,
2100
+ outboundCidrAllowlist,
2101
+ });
2102
+ if (early.deploymentRefusal)
2103
+ throw new Error(
2104
+ `EARLY_MODAL_SANDBOX_SCOPE_CHANGED: narrowing is refused (${early.narrowRefusal}) and so is the deployment list (${early.deploymentRefusal}); no early sandbox was created.`,
2105
+ );
2106
+ return early.allowlist;
2107
+ }
2108
+
2109
+ /** EN's narrowed list from this process's current gateway resolution. */
2110
+ export function earlyModalNarrowedAllowlist(input: {
2111
+ outboundCidrAllowlist: readonly string[] | null;
2112
+ gateway?: EarlySandboxGatewayAddressWatch;
2113
+ nowMs?: number;
2114
+ }): EarlySandboxNarrowedAllowlist {
2115
+ const gateway = input.gateway ?? earlyModalGatewayAddresses;
2116
+ gateway.start();
2117
+ return narrowEarlySandboxAllowlist({
2118
+ outboundCidrAllowlist: input.outboundCidrAllowlist,
2119
+ prefix: EARLY_SANDBOX_NARROW_PREFIX,
2120
+ minStableMs: EARLY_SANDBOX_NARROW_MIN_STABLE_MS,
2121
+ gatewayHosts: earlySandboxGatewayHosts(),
2122
+ gateway: gateway.state(),
2123
+ nowMs: input.nowMs ?? Date.now(),
2124
+ });
2125
+ }
2126
+
2127
+ /**
2128
+ * The egress parameters a launch adopts an early sandbox under. Without EN,
2129
+ * the launch's own create parameters (today). With EN, the list this launch
2130
+ * derives now: equal to the early create's only when the gateways have not
2131
+ * changed since, so a changed address set is an egress-key miss and the
2132
+ * launch creates its own sandbox with `sandboxParams`. A launch with a CSV
2133
+ * source URL (fetched inside the sandbox, from a host that is not a gateway)
2134
+ * or a sidecar never expects a narrowed sandbox. The fallback create always
2135
+ * uses `sandboxParams`; this only chooses what adoption expects.
2136
+ */
2137
+ export function earlyModalAdoptionEgress(input: {
2138
+ narrowWanted: boolean;
2139
+ supervisorSidecar: boolean;
2140
+ csvSourceUrl: string | null | undefined;
2141
+ sandboxParams: Pick<ModalSandboxCreateParams, 'outboundCidrAllowlist'>;
2142
+ narrow: (
2143
+ allowlist: readonly string[] | null,
2144
+ ) => EarlySandboxNarrowedAllowlist;
2145
+ }): {
2146
+ params: Pick<ModalSandboxCreateParams, 'outboundCidrAllowlist'>;
2147
+ narrowed: boolean;
2148
+ refusal: EarlySandboxNarrowRefusal | 'csv_source_url' | 'sidecar' | null;
2149
+ } {
2150
+ if (!input.narrowWanted)
2151
+ return { params: input.sandboxParams, narrowed: false, refusal: null };
2152
+ const refusal = input.supervisorSidecar
2153
+ ? ('sidecar' as const)
2154
+ : input.csvSourceUrl?.trim()
2155
+ ? ('csv_source_url' as const)
2156
+ : null;
2157
+ if (refusal) return { params: input.sandboxParams, narrowed: false, refusal };
2158
+ const narrowed = input.narrow(
2159
+ input.sandboxParams.outboundCidrAllowlist ?? null,
2160
+ );
2161
+ if ('refused' in narrowed)
2162
+ return {
2163
+ params: input.sandboxParams,
2164
+ narrowed: false,
2165
+ refusal: narrowed.refused,
2166
+ };
2167
+ return {
2168
+ params: { outboundCidrAllowlist: narrowed.allowlist },
2169
+ narrowed: true,
2170
+ refusal: null,
2171
+ };
2172
+ }
2173
+
2008
2174
  /**
2009
2175
  * The fail-closed egress gate for an early sandbox without the sidecar (see
2010
2176
  * `../early-sandbox-egress.ts`): refuse, loudly, unless the early create's
2011
2177
  * allowlist is non-empty, no entry is wider than /24, and every resolved IPv4
2012
2178
  * address of both gateways is covered. A refusal starts nothing; the launch
2013
- * creates its own sandbox, as today.
2179
+ * creates its own sandbox, as today. With `narrow` (EN), the list checked is
2180
+ * the narrowed one, and a narrowing refusal is the gate's refusal.
2014
2181
  */
2015
2182
  export function earlyModalSandboxEgressRefusal(
2016
2183
  input: {
@@ -2018,8 +2185,9 @@ export function earlyModalSandboxEgressRefusal(
2018
2185
  gateway?: EarlySandboxGatewayAddressWatch;
2019
2186
  readAllowlist?: () => ModalOutboundCidrAllowlistRead;
2020
2187
  nowMs?: number;
2188
+ narrow?: boolean;
2021
2189
  } = {},
2022
- ): EarlySandboxEgressRefusal | null {
2190
+ ): EarlySandboxNarrowRefusal | null {
2023
2191
  const gateway = input.gateway ?? earlyModalGatewayAddresses;
2024
2192
  gateway.start();
2025
2193
  const read = (
@@ -2029,13 +2197,38 @@ export function earlyModalSandboxEgressRefusal(
2029
2197
  runtimeSchedulerSchema: input.runtimeSchedulerSchema ?? null,
2030
2198
  }))
2031
2199
  )();
2200
+ const nowMs = input.nowMs ?? Date.now();
2201
+ const early = earlyModalEarlyAllowlist({
2202
+ narrow: Boolean(input.narrow) && !read.error,
2203
+ outboundCidrAllowlist: read.allowlist,
2204
+ gateway,
2205
+ nowMs,
2206
+ });
2207
+ const allowlist = early.allowlist;
2208
+ if (early.narrowRefusal) {
2209
+ // Narrowing refused: the deployment list decides, exactly as without
2210
+ // EN. Only when it is refused too is the narrowing reason the refusal.
2211
+ const plain = early.deploymentRefusal;
2212
+ if (plain === null) return null;
2213
+ console.error(
2214
+ JSON.stringify({
2215
+ event: `${EARLY_MODAL_LOG_SCOPE}.egress_refused`,
2216
+ reason: early.narrowRefusal,
2217
+ narrowed: true,
2218
+ deploymentRefusal: plain,
2219
+ allowlistEntries: read.allowlist?.length ?? null,
2220
+ gatewayStatus: gateway.state().status,
2221
+ }),
2222
+ );
2223
+ return early.narrowRefusal;
2224
+ }
2032
2225
  return assertEarlySandboxEgress({
2033
2226
  logScope: EARLY_MODAL_LOG_SCOPE,
2034
- outboundCidrAllowlist: read.allowlist,
2227
+ outboundCidrAllowlist: allowlist,
2035
2228
  allowlistError: read.error,
2036
2229
  gatewayHosts: earlySandboxGatewayHosts(),
2037
2230
  gateway: gateway.state(),
2038
- nowMs: input.nowMs ?? Date.now(),
2231
+ nowMs,
2039
2232
  });
2040
2233
  }
2041
2234
 
@@ -2046,7 +2239,7 @@ export function earlyModalSandboxEgressRefusal(
2046
2239
  */
2047
2240
  export function earlyModalSandboxStartUnavailable(
2048
2241
  input: Parameters<typeof earlyModalSandboxEgressRefusal>[0] = {},
2049
- ): EarlySandboxEgressRefusal | null {
2242
+ ): EarlySandboxNarrowRefusal | 'environment_unknown' | null {
2050
2243
  try {
2051
2244
  earlySandboxEnvironment();
2052
2245
  } catch (error) {
@@ -2098,12 +2291,25 @@ export const modalEarlySandboxAdapter: EarlySandboxAdapter<ModalSandbox> = {
2098
2291
  provider: 'modal',
2099
2292
  logScope: EARLY_MODAL_LOG_SCOPE,
2100
2293
  registry: earlyModalSandboxes,
2101
- startUnavailable: () => earlyModalSandboxStartUnavailable(),
2294
+ startUnavailable: (input) =>
2295
+ earlyModalSandboxStartUnavailable({
2296
+ runtimeSchedulerSchema: input.runtimeSchedulerSchema,
2297
+ narrow: earlyModalEgressNarrowWanted(input.experimentSwitchOverrides),
2298
+ }),
2102
2299
  scope: (input) => {
2103
2300
  const read = readModalOutboundCidrAllowlist({
2104
2301
  runtimeSchedulerSchema: input.runtimeSchedulerSchema,
2105
2302
  });
2106
2303
  if (read.error) throw new Error(read.error);
2304
+ if (earlyModalEgressNarrowWanted(input.experimentSwitchOverrides)) {
2305
+ // Called synchronously right after the gate, so the same gateway state
2306
+ // and the same choice (narrowed, or the deployment list).
2307
+ // No list means no allowlist key, exactly as modalSandboxNetworkParams.
2308
+ return modalSandboxCreateScope({
2309
+ outboundCidrAllowlist:
2310
+ earlyModalEarlyAllowlistOrThrow(read.allowlist) ?? undefined,
2311
+ });
2312
+ }
2107
2313
  return modalSandboxCreateScope(
2108
2314
  modalSandboxNetworkParams({
2109
2315
  supervisorSidecar: DURABLE_RUNS_ROLLOUT.modalSupervisorSidecar,
@@ -2429,6 +2635,28 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
2429
2635
  const createParams = { ...sandboxParams, tags: createTags };
2430
2636
  const createSandbox = () =>
2431
2637
  modalConfig.client.sandboxes.create(app, image, createParams);
2638
+ const adoptionEgress = earlyAdoptionEnvironment
2639
+ ? earlyModalAdoptionEgress({
2640
+ narrowWanted: earlyModalEgressNarrowWanted(
2641
+ config.context.experimentSwitchOverrides,
2642
+ ),
2643
+ supervisorSidecar: supervisorPlan !== null,
2644
+ csvSourceUrl: config.csvSourceUrl,
2645
+ sandboxParams,
2646
+ narrow: (allowlist) =>
2647
+ earlyModalNarrowedAllowlist({
2648
+ outboundCidrAllowlist: allowlist,
2649
+ }),
2650
+ })
2651
+ : null;
2652
+ if (
2653
+ adoptionEgress &&
2654
+ (adoptionEgress.narrowed || adoptionEgress.refusal)
2655
+ )
2656
+ emitModalStage(config.context, 'early:egress', {
2657
+ narrowed: adoptionEgress.narrowed,
2658
+ reason: adoptionEgress.refusal,
2659
+ });
2432
2660
  sandbox = await awaitModalSandboxCreate({
2433
2661
  create:
2434
2662
  earlyAdoptionEnvironment && config.context.workflowId
@@ -2437,9 +2665,12 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
2437
2665
  modalAppId: app.appId,
2438
2666
  workflowId: config.context.workflowId,
2439
2667
  // The early create's scope builder, so the two cannot drift.
2440
- scope: modalSandboxCreateScope(sandboxParams, {
2441
- environment: earlyAdoptionEnvironment,
2442
- }),
2668
+ // EN changes only the egress adoption expects, never the
2669
+ // fallback create's.
2670
+ scope: modalSandboxCreateScope(
2671
+ adoptionEgress?.params ?? sandboxParams,
2672
+ { environment: earlyAdoptionEnvironment },
2673
+ ),
2443
2674
  expectedLimitsKey: modalSandboxLimitsKey(sandboxParams),
2444
2675
  createTags,
2445
2676
  context: config.context,
@@ -111,9 +111,8 @@ function parseIpv4Cidr(entry: string): Ipv4Cidr | null {
111
111
  }
112
112
 
113
113
  function cidrCovers(cidr: Ipv4Cidr, address: number): boolean {
114
- if (cidr.prefix === 0) return true;
115
- const mask = (0xffffffff << (32 - cidr.prefix)) >>> 0;
116
- return ((cidr.network & mask) >>> 0) === ((address & mask) >>> 0);
114
+ const mask = cidrMask(cidr.prefix);
115
+ return (cidr.network & mask) >>> 0 === (address & mask) >>> 0;
117
116
  }
118
117
 
119
118
  /** Gateway hostnames (or literal IPv4s) whose addresses the gate checks. */
@@ -147,6 +146,12 @@ export type EarlySandboxGatewayAddresses =
147
146
  /** Every IPv4 address of every host. */
148
147
  addresses: readonly string[];
149
148
  atMs: number;
149
+ /**
150
+ * When this exact address set was first resolved, carried across
151
+ * refreshes that return the same set; a failed refresh resets it.
152
+ * Absent on states built elsewhere, which narrowing then refuses.
153
+ */
154
+ stableSinceMs?: number;
150
155
  };
151
156
 
152
157
  /**
@@ -170,26 +175,157 @@ export function earlySandboxEgressRefusal(input: {
170
175
  return 'egress_allowlist_too_wide';
171
176
  cidrs.push(cidr);
172
177
  }
178
+ const fresh = freshGatewayAddresses(input);
179
+ if ('refused' in fresh) return fresh.refused;
180
+ for (const value of fresh.addresses) {
181
+ if (!cidrs.some((cidr) => cidrCovers(cidr, value)))
182
+ return 'egress_gateway_uncovered';
183
+ }
184
+ return null;
185
+ }
186
+
187
+ /**
188
+ * The gateways' current IPv4 addresses as integers, or why they cannot be
189
+ * trusted: unconfigured, not yet (or not for these hosts) resolved, failed,
190
+ * stale, empty or not IPv4.
191
+ */
192
+ function freshGatewayAddresses(input: {
193
+ gatewayHosts: readonly string[] | null;
194
+ gateway: EarlySandboxGatewayAddresses;
195
+ nowMs: number;
196
+ }): { addresses: number[] } | { refused: EarlySandboxEgressRefusal } {
173
197
  if (!input.gatewayHosts || input.gatewayHosts.length === 0)
174
- return 'egress_gateway_unconfigured';
198
+ return { refused: 'egress_gateway_unconfigured' };
175
199
  const gateway = input.gateway;
176
- if (gateway.status === 'pending') return 'egress_gateway_dns_pending';
177
- if (gateway.status === 'failed') return 'egress_gateway_dns_failed';
200
+ if (gateway.status === 'pending')
201
+ return { refused: 'egress_gateway_dns_pending' };
202
+ if (gateway.status === 'failed')
203
+ return { refused: 'egress_gateway_dns_failed' };
178
204
  // Resolved for other hosts (the env changed): not yet resolved for these.
179
205
  if (
180
206
  gateway.hosts.length !== input.gatewayHosts.length ||
181
207
  gateway.hosts.some((host, index) => host !== input.gatewayHosts![index])
182
208
  )
183
- return 'egress_gateway_dns_pending';
209
+ return { refused: 'egress_gateway_dns_pending' };
184
210
  if (input.nowMs - gateway.atMs > EARLY_SANDBOX_GATEWAY_DNS_MAX_AGE_MS)
185
- return 'egress_gateway_dns_stale';
186
- if (gateway.addresses.length === 0) return 'egress_gateway_dns_failed';
211
+ return { refused: 'egress_gateway_dns_stale' };
212
+ if (gateway.addresses.length === 0)
213
+ return { refused: 'egress_gateway_dns_failed' };
214
+ const addresses: number[] = [];
187
215
  for (const address of gateway.addresses) {
188
216
  const value = ipv4ToInt(address);
189
- if (value === null || !cidrs.some((cidr) => cidrCovers(cidr, value)))
190
- return 'egress_gateway_uncovered';
217
+ if (value === null) return { refused: 'egress_gateway_uncovered' };
218
+ addresses.push(value);
191
219
  }
192
- return null;
220
+ return { addresses };
221
+ }
222
+
223
+ function intToIpv4(value: number): string {
224
+ return [24, 16, 8, 0].map((shift) => (value >>> shift) & 255).join('.');
225
+ }
226
+
227
+ function cidrMask(prefix: number): number {
228
+ return prefix === 0 ? 0 : (0xffffffff << (32 - prefix)) >>> 0;
229
+ }
230
+
231
+ /** Whether every address of `inner` is in `outer`. */
232
+ function cidrContains(outer: Ipv4Cidr, inner: Ipv4Cidr): boolean {
233
+ return (
234
+ inner.prefix >= outer.prefix &&
235
+ (inner.network & cidrMask(outer.prefix)) >>> 0 ===
236
+ (outer.network & cidrMask(outer.prefix)) >>> 0
237
+ );
238
+ }
239
+
240
+ export type EarlySandboxNarrowedAllowlist =
241
+ | { allowlist: string[] }
242
+ | {
243
+ refused:
244
+ | EarlySandboxEgressRefusal
245
+ | 'egress_narrow_prefix_invalid'
246
+ | 'egress_narrow_uncontained'
247
+ | 'egress_narrow_unstable';
248
+ };
249
+
250
+ export type EarlySandboxNarrowRefusal = Extract<
251
+ EarlySandboxNarrowedAllowlist,
252
+ { refused: unknown }
253
+ >['refused'];
254
+
255
+ /** The narrowed list's prefix: each gateway address alone. */
256
+ export const EARLY_SANDBOX_NARROW_PREFIX = 32;
257
+
258
+ /**
259
+ * How long the gateways' address set must have stayed the same before a
260
+ * narrowed list is derived from it. An adopted sandbox keeps its list for its
261
+ * whole run, so a set that just changed is the likeliest to change again.
262
+ */
263
+ export const EARLY_SANDBOX_NARROW_MIN_STABLE_MS = 30 * 60_000;
264
+
265
+ /**
266
+ * An allowlist for one early sandbox that only shrinks the deployment's:
267
+ * each current gateway address masked to `prefix` (24..32), kept only when
268
+ * some deployment entry fully contains it. Pure, and refuses (fail closed)
269
+ * on anything the gate itself would refuse about the gateways, on an
270
+ * unusable deployment allowlist, and on a derived range the deployment
271
+ * allowlist does not contain. Whatever it returns passes
272
+ * `earlySandboxEgressRefusal` for the same gateway state.
273
+ *
274
+ * With `minStableMs`, it also refuses (`egress_narrow_unstable`) unless the
275
+ * gateway address set has stayed the same for at least that long.
276
+ *
277
+ * Used only behind the per-run EN switch (Modal early create and adoption),
278
+ * which only a per-organization fast_launch@7 pin grants.
279
+ */
280
+ export function narrowEarlySandboxAllowlist(input: {
281
+ outboundCidrAllowlist: readonly string[] | null | undefined;
282
+ prefix: number;
283
+ gatewayHosts: readonly string[] | null;
284
+ gateway: EarlySandboxGatewayAddresses;
285
+ nowMs: number;
286
+ minStableMs?: number;
287
+ }): EarlySandboxNarrowedAllowlist {
288
+ if (
289
+ !Number.isInteger(input.prefix) ||
290
+ input.prefix < EARLY_SANDBOX_EGRESS_MIN_PREFIX ||
291
+ input.prefix > 32
292
+ )
293
+ return { refused: 'egress_narrow_prefix_invalid' };
294
+ const allowlist = input.outboundCidrAllowlist;
295
+ if (!allowlist) return { refused: 'egress_allowlist_missing' };
296
+ if (allowlist.length === 0) return { refused: 'egress_allowlist_empty' };
297
+ const deployment: Ipv4Cidr[] = [];
298
+ for (const entry of allowlist) {
299
+ const cidr = parseIpv4Cidr(entry);
300
+ if (!cidr) return { refused: 'egress_allowlist_invalid' };
301
+ deployment.push(cidr);
302
+ }
303
+ const fresh = freshGatewayAddresses(input);
304
+ if ('refused' in fresh) return fresh;
305
+ if (input.minStableMs !== undefined) {
306
+ const stableSinceMs =
307
+ input.gateway.status === 'resolved'
308
+ ? input.gateway.stableSinceMs
309
+ : undefined;
310
+ if (
311
+ stableSinceMs === undefined ||
312
+ input.nowMs - stableSinceMs < input.minStableMs
313
+ )
314
+ return { refused: 'egress_narrow_unstable' };
315
+ }
316
+ const narrowed = new Set<string>();
317
+ for (const address of fresh.addresses) {
318
+ if (!deployment.some((cidr) => cidrCovers(cidr, address)))
319
+ return { refused: 'egress_gateway_uncovered' };
320
+ const derived = {
321
+ network: (address & cidrMask(input.prefix)) >>> 0,
322
+ prefix: input.prefix,
323
+ };
324
+ if (!deployment.some((cidr) => cidrContains(cidr, derived)))
325
+ return { refused: 'egress_narrow_uncontained' };
326
+ narrowed.add(`${intToIpv4(derived.network)}/${derived.prefix}`);
327
+ }
328
+ return { allowlist: [...narrowed].sort() };
193
329
  }
194
330
 
195
331
  export type ResolveIpv4 = (host: string) => Promise<string[]>;
@@ -266,11 +402,22 @@ export class EarlySandboxGatewayAddressWatch {
266
402
  throw new Error(`no IPv4 address for ${host}`);
267
403
  for (const address of resolved) addresses.add(address);
268
404
  }
405
+ const sorted = [...addresses].sort();
406
+ const previous = this.#state;
407
+ const atMs = this.#nowMs();
408
+ const unchanged =
409
+ previous.status === 'resolved' &&
410
+ previous.hosts.join(',') === hosts.join(',') &&
411
+ previous.addresses.join(',') === sorted.join(',');
269
412
  this.#state = {
270
413
  status: 'resolved',
271
414
  hosts,
272
- addresses: [...addresses].sort(),
273
- atMs: this.#nowMs(),
415
+ addresses: sorted,
416
+ atMs,
417
+ stableSinceMs:
418
+ unchanged && previous.stableSinceMs !== undefined
419
+ ? previous.stableSinceMs
420
+ : atMs,
274
421
  };
275
422
  } catch (error) {
276
423
  this.#state = {
@@ -213,10 +213,21 @@ export class EarlySandboxRegistry<
213
213
  take(key: string): Promise<EarlySandboxEntry<TSandbox> | null> | undefined {
214
214
  const entry = this.#entries.get(key);
215
215
  this.#entries.delete(key);
216
- if (entry) this.#release(entry);
216
+ if (entry) {
217
+ this.#release(entry);
218
+ for (const handler of this.#takeHandlers) handler(key);
219
+ }
217
220
  return entry;
218
221
  }
219
222
 
223
+ /** LH: told each key a launch (or a reap) takes from this registry. */
224
+ subscribeTake(handler: (key: string) => void): () => void {
225
+ this.#takeHandlers.add(handler);
226
+ return () => this.#takeHandlers.delete(handler);
227
+ }
228
+
229
+ readonly #takeHandlers = new Set<(key: string) => void>();
230
+
220
231
  /**
221
232
  * The reaper or sweep has settled this sandbox (terminated, or found it
222
233
  * adopted by a launch elsewhere): it no longer counts as outstanding. A
@@ -396,8 +407,10 @@ export type EarlySandboxAdapter<
396
407
  /**
397
408
  * Why this process cannot start an early sandbox on this provider now (a
398
409
  * provider precondition), or null. Checked after E2 resolves on; not logged.
410
+ * It gets the hinted run, whose per-run switches may change the egress
411
+ * policy the create would carry (Modal's EN).
399
412
  */
400
- startUnavailable(): string | null;
413
+ startUnavailable(input: EarlySandboxStartRequest): string | null;
401
414
  /**
402
415
  * The environment and egress policy this process's early create would
403
416
  * carry; part of the key. Called only after `startUnavailable` is null.
@@ -437,7 +450,7 @@ export function startEarlySandbox<TSandbox extends EarlySandboxHandle>(
437
450
  input.experimentSwitchOverrides,
438
451
  EARLY_SANDBOX_START,
439
452
  ) ||
440
- adapter.startUnavailable() !== null
453
+ adapter.startUnavailable(input) !== null
441
454
  )
442
455
  return false;
443
456
  // The key and the adoption check are org-scoped; a hint without an org
@@ -274,3 +274,40 @@ export async function gunzipRuntimeApiRequestBody(input: {
274
274
  throw error;
275
275
  }
276
276
  }
277
+
278
+ /** The existing runtime JSON transport, with cancellable compressed-body reads. */
279
+ export async function readRuntimeApiRequestJson(input: {
280
+ request: Request;
281
+ maxBytes: number;
282
+ signal?: AbortSignal;
283
+ }): Promise<unknown> {
284
+ const { request } = input;
285
+ if (!isGzipContentEncoding(request.headers.get('content-encoding')))
286
+ return request.json();
287
+ const signal = input.signal ?? request.signal;
288
+ const reader = request.body?.getReader();
289
+ if (!reader) throw new SyntaxError('Runtime request body is empty.');
290
+ const chunks: Buffer[] = [];
291
+ const onAbort = () => {
292
+ void reader.cancel(signal.reason).catch(() => undefined);
293
+ };
294
+ signal.addEventListener('abort', onAbort, { once: true });
295
+ try {
296
+ if (signal.aborted) throw signal.reason;
297
+ while (true) {
298
+ const { value, done } = await reader.read();
299
+ if (signal.aborted) throw signal.reason;
300
+ if (done) break;
301
+ chunks.push(Buffer.from(value));
302
+ }
303
+ } finally {
304
+ signal.removeEventListener('abort', onAbort);
305
+ reader.releaseLock();
306
+ }
307
+ const decoded = await gunzipRuntimeApiRequestBody({
308
+ body: Buffer.concat(chunks),
309
+ maxBytes: input.maxBytes,
310
+ });
311
+ if (signal.aborted) throw signal.reason;
312
+ return JSON.parse(decoded.toString('utf8')) as unknown;
313
+ }
@@ -36,3 +36,12 @@ export function integrationExecutePath(
36
36
  ): string {
37
37
  return `/api/v2/integrations/${encodeURIComponent(toolId)}/${suffix}`;
38
38
  }
39
+
40
+ /**
41
+ * One GET for a runner's park-fence startup reads: every named tool's
42
+ * metadata and auth-scope answer, as the two per-tool routes would give them
43
+ * (`startup-read-tool-ids.ts`). Not under `runtime-tools/`, so no tool id can
44
+ * shadow it.
45
+ */
46
+ export const PLAY_RUNTIME_TOOL_STARTUP_READS_PATH =
47
+ '/api/v2/plays/runtime-tool-startup-reads';