deepline 0.3.551 → 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 (324) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +130 -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 +124 -10
  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 +66 -30
  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 +11 -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-monitor-upstream-identity.ts +80 -13
  43. package/dist/bundling-sources/shared_libs/monitors/provider-resource-failure.ts +26 -3
  44. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +41 -13
  45. package/dist/bundling-sources/shared_libs/monitors/signal-radars/raw-receipt-causes.ts +219 -0
  46. package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +21 -10
  47. package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +13 -0
  48. package/dist/bundling-sources/shared_libs/monitors/tamradar-countries.ts +285 -0
  49. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +6 -0
  50. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +13 -0
  51. package/dist/bundling-sources/shared_libs/observability/dlq.ts +1 -1
  52. package/dist/bundling-sources/shared_libs/observability/log-metadata.ts +5 -3
  53. package/dist/bundling-sources/shared_libs/observability/queue-health.ts +10 -1
  54. package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
  55. package/dist/bundling-sources/shared_libs/observability/redaction.ts +24 -1
  56. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +312 -41
  57. package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +1 -2
  58. package/dist/bundling-sources/shared_libs/play-data-plane/preview-r2-oidc.ts +188 -0
  59. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +170 -16
  60. package/dist/bundling-sources/shared_libs/play-data-plane/runtime-sheet-storage-contract.ts +5 -0
  61. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +68 -2
  62. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +568 -26
  63. package/dist/bundling-sources/shared_libs/play-runtime/ctx-fetch-caller-deadline.ts +200 -0
  64. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +6 -0
  65. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-topology.ts +21 -1
  66. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +3 -2
  67. package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +14 -2
  68. package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +70 -2
  69. package/dist/bundling-sources/shared_libs/play-runtime/durable-tool-identity.ts +3 -3
  70. package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +16 -0
  71. package/dist/bundling-sources/shared_libs/play-runtime/experiment-switches.ts +92 -16
  72. package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +1 -0
  73. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +7 -1
  74. package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +62 -0
  75. package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +74 -3
  76. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +31 -3
  77. package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +6 -0
  78. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +8 -0
  79. package/dist/bundling-sources/shared_libs/play-runtime/query-result-dataset.ts +19 -0
  80. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +39 -2
  81. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +9 -1
  82. package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +33 -0
  83. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +24 -0
  84. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +300 -57
  85. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +87 -6
  86. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +241 -10
  87. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox-egress.ts +161 -14
  88. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +16 -3
  89. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-compression.ts +37 -0
  90. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +9 -0
  91. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +298 -46
  92. package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +13 -0
  93. package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +39 -0
  94. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +62 -1
  95. package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +36 -0
  96. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +36 -0
  97. package/dist/bundling-sources/shared_libs/play-runtime/runtime-speed-profile.ts +206 -2
  98. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +42 -0
  99. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +185 -64
  100. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-slot-ledger.ts +157 -0
  101. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +110 -2
  102. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-listener-hint.ts +323 -0
  103. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/executor-attempt-standing.ts +72 -0
  104. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/integration-operation-value-storage.ts +23 -4
  105. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +32 -10
  106. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-workspace-purge.ts +199 -0
  107. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +632 -66
  108. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +517 -16
  109. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +1 -1
  110. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-value-storage.ts +9 -0
  111. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +599 -2
  112. package/dist/bundling-sources/shared_libs/play-runtime/secret-resolution-retry-policy.ts +26 -1
  113. package/dist/bundling-sources/shared_libs/play-runtime/startup-read-tool-ids.ts +60 -0
  114. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +51 -0
  115. package/dist/bundling-sources/shared_libs/play-runtime/tool-call-retry-facts.ts +2 -0
  116. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +113 -3
  117. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +5 -7
  118. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +37 -7
  119. package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +2 -0
  120. package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +3 -0
  121. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +40 -5
  122. package/dist/bundling-sources/shared_libs/plays/deploy/api-client.ts +3 -0
  123. package/dist/bundling-sources/shared_libs/plays/deploy/control-plane-types.ts +16 -0
  124. package/dist/bundling-sources/shared_libs/plays/deploy/run-deployment.ts +10 -41
  125. package/dist/bundling-sources/shared_libs/plays/extension-bridge.ts +33 -0
  126. package/dist/bundling-sources/shared_libs/plays/row-identity.ts +18 -1
  127. package/dist/bundling-sources/shared_libs/plays/tool-execution-error.ts +108 -0
  128. package/dist/bundling-sources/shared_libs/plays/trigger-config-contract.ts +14 -0
  129. package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +171 -0
  130. package/dist/bundling-sources/shared_libs/product-notifications/events.ts +27 -1
  131. package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +9 -24
  132. package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +178 -5
  133. package/dist/bundling-sources/shared_libs/security/signup-email-dns-screen.ts +148 -0
  134. package/dist/bundling-sources/shared_libs/tool-execution-error.ts +108 -0
  135. package/dist/cli/{auth-E7BH4GMJ.mjs → auth-I3QAU4RV.mjs} +8 -7
  136. package/dist/cli/auth-MQCN7WGZ.js +44 -0
  137. package/dist/cli/{billing-OXKU462W.mjs → billing-3IC54OQQ.mjs} +202 -59
  138. package/dist/cli/{billing-DNQAZGX7.js → billing-YGFFVAIC.js} +302 -159
  139. package/dist/cli/{chunk-COGREZAO.js → chunk-2B5B5KAW.js} +210 -128
  140. package/dist/cli/{chunk-UBKA33KY.mjs → chunk-2MGZAI54.mjs} +17 -0
  141. package/dist/cli/{chunk-T2B5BVZE.js → chunk-3NTP2OSG.js} +13 -13
  142. package/dist/cli/{chunk-FOTGUFVK.mjs → chunk-45OAVGU6.mjs} +5 -5
  143. package/dist/cli/{chunk-54EEYLTF.js → chunk-4747TPLV.js} +3 -3
  144. package/dist/cli/{chunk-CLRAANWH.mjs → chunk-4BFTDNHU.mjs} +1 -1
  145. package/dist/cli/{chunk-BGBJV26E.mjs → chunk-4HYNMXXF.mjs} +4 -4
  146. package/dist/cli/{chunk-5S6PHKRV.mjs → chunk-4SMCFQ23.mjs} +1 -1
  147. package/dist/cli/{chunk-VWLHRZFG.mjs → chunk-55F6HNOY.mjs} +5 -5
  148. package/dist/cli/{chunk-LX35AXTN.mjs → chunk-5TYLSS4Q.mjs} +6 -6
  149. package/dist/cli/{chunk-VTGG2RT3.js → chunk-6NE3RRRY.js} +1 -1
  150. package/dist/cli/{chunk-EITMD3A5.js → chunk-6VLFQZK6.js} +8 -8
  151. package/dist/cli/{chunk-MNSTCJMX.mjs → chunk-72V4PDH5.mjs} +18 -18
  152. package/dist/cli/{chunk-ZCDKE4UH.js → chunk-74RES4DS.js} +5 -5
  153. package/dist/cli/{chunk-WKBHUB6R.js → chunk-7GEMELKI.js} +366 -320
  154. package/dist/cli/{chunk-C4CUZH57.js → chunk-7O6J6A7P.js} +1871 -92
  155. package/dist/cli/{chunk-7RSIFA72.js → chunk-7SERLBNR.js} +161 -53
  156. package/dist/cli/{chunk-3G6QZACZ.js → chunk-7YRJ5UC4.js} +21 -21
  157. package/dist/cli/{chunk-I4VKGNAQ.mjs → chunk-A7DLBE5K.mjs} +136 -54
  158. package/dist/cli/{chunk-GGB3JYCW.mjs → chunk-AGICYWGN.mjs} +299 -69
  159. package/dist/cli/{chunk-44KSACJW.mjs → chunk-AGIQDA2T.mjs} +12 -12
  160. package/dist/cli/{chunk-PACD5DGC.js → chunk-AGLR6QVN.js} +255 -109
  161. package/dist/cli/{chunk-NURW5XH4.mjs → chunk-ASB47RXJ.mjs} +1 -1
  162. package/dist/cli/{chunk-4OMAGJ6U.js → chunk-BVDKFS2T.js} +2 -2
  163. package/dist/cli/{chunk-LPJPCGT3.js → chunk-CACFJODG.js} +190 -134
  164. package/dist/cli/{chunk-GVYLCCKN.mjs → chunk-CAEBJOYU.mjs} +1 -1
  165. package/dist/cli/{chunk-XDVT3GOM.js → chunk-CFJFUVX2.js} +18 -1
  166. package/dist/cli/{chunk-POLUE7D5.js → chunk-DP2VH7CO.js} +12 -12
  167. package/dist/cli/{chunk-D6M5HFBB.mjs → chunk-DP64MD6U.mjs} +1 -1
  168. package/dist/cli/{chunk-W425ERWN.mjs → chunk-DZA7RFGL.mjs} +5 -5
  169. package/dist/cli/{chunk-R7J7CJPZ.js → chunk-E2G2DNAB.js} +4 -1
  170. package/dist/cli/{chunk-GGGAEVCX.mjs → chunk-E7WZOX2A.mjs} +22 -18
  171. package/dist/cli/{chunk-44I675YK.js → chunk-FM7LPUPA.js} +41 -41
  172. package/dist/cli/{chunk-2UXDHFSF.mjs → chunk-GAVZ4EOD.mjs} +1 -1
  173. package/dist/cli/{chunk-Z2FIOG3V.js → chunk-HEBO3XNZ.js} +27 -31
  174. package/dist/cli/{chunk-6PWJKMFQ.mjs → chunk-HSJ6X2AQ.mjs} +4 -4
  175. package/dist/cli/{chunk-UPMRIVZB.js → chunk-HVI55MTK.js} +61 -10
  176. package/dist/cli/{chunk-KWSH5T7K.js → chunk-IH6GDNKW.js} +21 -21
  177. package/dist/cli/{chunk-3KYBDAR3.js → chunk-IMX7J4DU.js} +8 -8
  178. package/dist/cli/{chunk-HEHVGEZV.mjs → chunk-INEMTYMT.mjs} +8 -8
  179. package/dist/cli/{chunk-5VVSEU67.js → chunk-IUOGII7D.js} +6 -7
  180. package/dist/cli/{chunk-MXGA6JFI.mjs → chunk-JJGWHITQ.mjs} +5 -5
  181. package/dist/cli/{chunk-QM6Y6S4E.js → chunk-JLGP5XAJ.js} +5 -5
  182. package/dist/cli/{chunk-V6SCP4B7.mjs → chunk-LFOERUQY.mjs} +69 -3
  183. package/dist/cli/{chunk-BBTKAASQ.js → chunk-LFQJW4S2.js} +42 -1
  184. package/dist/cli/{chunk-ZMNGZ6XS.mjs → chunk-LH5PZKER.mjs} +80 -24
  185. package/dist/cli/{chunk-MR5LTVHD.js → chunk-LRDHPOZW.js} +69 -69
  186. package/dist/cli/{chunk-5LUF4LAR.mjs → chunk-LRZGS6RZ.mjs} +3 -0
  187. package/dist/cli/{chunk-SL6MYJYM.js → chunk-MJTVX4QK.js} +35 -35
  188. package/dist/cli/{chunk-UDXULACQ.js → chunk-MLABYI4M.js} +90 -24
  189. package/dist/cli/{chunk-S7IZWGUA.mjs → chunk-NDNHYONK.mjs} +17 -21
  190. package/dist/cli/{chunk-4D3WIZST.mjs → chunk-OTV2UUKW.mjs} +164 -18
  191. package/dist/cli/{chunk-XYE5XPGF.js → chunk-Q6Z6N3A7.js} +18 -18
  192. package/dist/cli/{chunk-7WQNWJQW.mjs → chunk-QG6JIWUL.mjs} +151 -43
  193. package/dist/cli/{chunk-3T65J5RG.mjs → chunk-QI5S5HWB.mjs} +2 -2
  194. package/dist/cli/{chunk-CBV7AKWM.js → chunk-R6DZ6NQ2.js} +5 -5
  195. package/dist/cli/{chunk-PM7MO62Y.mjs → chunk-RMNOZKRI.mjs} +3 -3
  196. package/dist/cli/{chunk-NMWGZD6Y.js → chunk-RTV4RF7N.js} +36 -36
  197. package/dist/cli/{chunk-CQ6JYQSW.js → chunk-SBH4CKPN.js} +11 -11
  198. package/dist/cli/{chunk-BIIJATTX.mjs → chunk-SG3LUONJ.mjs} +3 -3
  199. package/dist/cli/{chunk-2WFPHBR4.js → chunk-TFEXSHPM.js} +22 -18
  200. package/dist/cli/{chunk-5IL7SC45.mjs → chunk-TN4TY6TT.mjs} +6 -7
  201. package/dist/cli/{chunk-WEHCBH5R.mjs → chunk-UEVKMZLR.mjs} +54 -3
  202. package/dist/cli/{chunk-RE5MJBEV.mjs → chunk-UVQJYV76.mjs} +2 -2
  203. package/dist/cli/{chunk-FSIVF2SI.mjs → chunk-VZGLIK5U.mjs} +1 -1
  204. package/dist/cli/{chunk-W2ZWQUHT.js → chunk-WOCHZCUJ.js} +2 -2
  205. package/dist/cli/{chunk-ZDQFBJPO.js → chunk-XLIHTJVM.js} +348 -118
  206. package/dist/cli/{chunk-2ZYRBMQM.js → chunk-Y6SP3JMI.js} +22 -22
  207. package/dist/cli/{chunk-PPSDCN6C.js → chunk-YUA6HA6D.js} +2 -2
  208. package/dist/cli/{chunk-JL2OTMSG.mjs → chunk-Z3A2S3QM.mjs} +41 -0
  209. package/dist/cli/{chunk-E64HFB4L.mjs → chunk-Z6XPSHKM.mjs} +87 -41
  210. package/dist/cli/{chunk-7DOQ3OEX.mjs → chunk-Z7AOIHFE.mjs} +1870 -91
  211. package/dist/cli/command-docs.js +3 -3
  212. package/dist/cli/command-docs.mjs +2 -2
  213. package/dist/cli/concurrent-runs-help-CFJH4KXV.js +22 -0
  214. package/dist/cli/{concurrent-runs-help-C6L6I5OR.mjs → concurrent-runs-help-DNV2X5AZ.mjs} +9 -8
  215. package/dist/cli/{csv-QMF4FWE7.js → csv-SA6ELJY6.js} +16 -15
  216. package/dist/cli/{csv-SYSDXFEM.mjs → csv-ZXZGHWOM.mjs} +7 -6
  217. package/dist/cli/{db-Q7HURWRZ.mjs → db-A54SP6AD.mjs} +16 -16
  218. package/dist/cli/{db-YSHPPA4H.js → db-JHFEIQBU.js} +43 -43
  219. package/dist/cli/describe-PHQ33AGS.mjs +50 -0
  220. package/dist/cli/describe-RHJ4XRFI.js +50 -0
  221. package/dist/cli/describe-core.d.mts +3 -3
  222. package/dist/cli/describe-core.d.ts +3 -3
  223. package/dist/cli/describe-core.js +6 -6
  224. package/dist/cli/describe-core.mjs +5 -5
  225. package/dist/cli/{executions-G7U3VUXN.mjs → executions-HL2M2DFU.mjs} +10 -10
  226. package/dist/cli/{executions-MWBC5TAW.js → executions-TLFZRHBJ.js} +12 -12
  227. package/dist/cli/{feedback-SD55OY6H.js → feedback-5UEX5UZK.js} +17 -16
  228. package/dist/cli/{feedback-GMHIFLBJ.mjs → feedback-QMBTNXVG.mjs} +9 -8
  229. package/dist/cli/git-4JWOOHBG.js +26 -0
  230. package/dist/cli/{git-HPE45OPD.mjs → git-LKGXVIVC.mjs} +8 -7
  231. package/dist/cli/index.js +170 -158
  232. package/dist/cli/index.mjs +60 -48
  233. package/dist/cli/{integrations-HFKVBY6G.js → integrations-6RUTLMN7.js} +23 -27
  234. package/dist/cli/{integrations-2W4MGIQR.mjs → integrations-FGGRVUJ7.mjs} +15 -19
  235. package/dist/cli/{legacy-noops-SXVNDEXN.js → legacy-noops-J3Z7QRWZ.js} +12 -11
  236. package/dist/cli/{legacy-noops-GZYKNU2Z.mjs → legacy-noops-YIPRMVXZ.mjs} +9 -8
  237. package/dist/cli/{mcp-PJRHQHHU.js → mcp-6LWFP7RW.js} +121 -48
  238. package/dist/cli/{mcp-BWA6KULG.mjs → mcp-CHDYFO7F.mjs} +100 -27
  239. package/dist/cli/{monitors-K2WSI6CR.js → monitors-STM6A7OU.js} +221 -186
  240. package/dist/cli/{monitors-SYQKCATO.mjs → monitors-UGRY2BXI.mjs} +58 -23
  241. package/dist/cli/org-3SYOUQCX.mjs +2289 -0
  242. package/dist/cli/org-ZOBSNSIB.js +2289 -0
  243. package/dist/cli/outcomes-H4YYAT5X.js +2865 -0
  244. package/dist/cli/outcomes-Z3P2JE67.mjs +2865 -0
  245. package/dist/cli/{play-SZXY2F2S.js → play-SM4CW2GS.js} +1116 -846
  246. package/dist/cli/{play-TTMABJEI.mjs → play-SN5YWLS7.mjs} +375 -105
  247. package/dist/cli/{providers-GQIOMRQO.mjs → providers-WZ4YBR5Y.mjs} +10 -10
  248. package/dist/cli/{providers-YDHCTZAF.js → providers-WZARYMCF.js} +13 -13
  249. package/dist/cli/{quickstart-PHSSMKCA.mjs → quickstart-2575BNKA.mjs} +7 -6
  250. package/dist/cli/{quickstart-BNYOXQXG.js → quickstart-PS4YHQJ6.js} +9 -8
  251. package/dist/cli/{run-GFIAZXVL.js → run-FLZ6OTM7.js} +51 -51
  252. package/dist/cli/{run-74C3C75C.mjs → run-ZUHCZOJS.mjs} +31 -31
  253. package/dist/cli/run-identity-LMLFMACS.js +31 -0
  254. package/dist/cli/{run-identity-MRNCEGV2.mjs → run-identity-MAZ7ANH5.mjs} +9 -3
  255. package/dist/cli/{search-3SWUB7KX.mjs → search-HLPPKQEO.mjs} +11 -11
  256. package/dist/cli/search-JJWVHR3N.js +32 -0
  257. package/dist/cli/{search-output-K2SWHVHQ.mjs → search-output-PDAXNOGP.mjs} +9 -8
  258. package/dist/cli/{search-output-6JF3S4TP.js → search-output-RXJLU36B.js} +12 -11
  259. package/dist/cli/{secrets-2M4XWEKE.mjs → secrets-CGELYQ3H.mjs} +11 -11
  260. package/dist/cli/{secrets-2SAKLH2H.js → secrets-QJNG7G2Y.js} +20 -20
  261. package/dist/cli/sessions-DHTBT2GN.js +23 -0
  262. package/dist/cli/{sessions-A64BCXTO.mjs → sessions-ELMWVR4M.mjs} +9 -8
  263. package/dist/cli/{settings-HV64WIJF.js → settings-44I44P5F.js} +89 -89
  264. package/dist/cli/{settings-SVGEC3FI.mjs → settings-RR3LZXL7.mjs} +16 -16
  265. package/dist/cli/{setup-EDC3NEJ3.mjs → setup-KGWRWH4B.mjs} +20 -19
  266. package/dist/cli/{setup-FHXOLQGQ.js → setup-KTEYOCJO.js} +60 -59
  267. package/dist/cli/skills-EPZPEXI2.js +37 -0
  268. package/dist/cli/{skills-3HGHZMXB.mjs → skills-FPRID2I5.mjs} +10 -9
  269. package/dist/cli/tools-IGQQ5TML.js +57 -0
  270. package/dist/cli/{tools-P2QS6A6Q.mjs → tools-PI4WMDLY.mjs} +23 -23
  271. package/dist/cli/update-4RNCVYGE.js +37 -0
  272. package/dist/cli/{update-552BYQM4.mjs → update-VJOJAZ7B.mjs} +14 -11
  273. package/dist/cli/{views-PA25NAE3.js → views-NTUOLNQU.js} +62 -64
  274. package/dist/cli/{views-LD5HXJYY.mjs → views-OVPSINZO.mjs} +47 -49
  275. package/dist/cli/{workflow-FIDBUQV6.js → workflow-2UDYDM6F.js} +23 -23
  276. package/dist/cli/{workflow-LDYFGBYP.mjs → workflow-7OEFNXZC.mjs} +13 -13
  277. package/dist/{client-DuDFiJDU.d.mts → client-B8f7RNF8.d.mts} +1 -1
  278. package/dist/{client-t9HZAkFD.d.ts → client-C5TgXmJQ.d.ts} +1 -1
  279. package/dist/{client-core-DydMQOft.d.mts → client-core-SLLGBTht.d.mts} +285 -23
  280. package/dist/{client-core-CJRzLanv.d.ts → client-core-p0sOxnkl.d.ts} +285 -23
  281. package/dist/{compiler-manifest-BqwVrOri.d.mts → compiler-manifest-D_zZEh9Q.d.mts} +70 -5
  282. package/dist/{compiler-manifest-BqwVrOri.d.ts → compiler-manifest-D_zZEh9Q.d.ts} +70 -5
  283. package/dist/{errors-BU8FB99X.d.mts → errors-CZCrBFrQ.d.mts} +1 -1
  284. package/dist/{errors-DfVN_FUG.d.ts → errors-DsUkLrdZ.d.ts} +1 -1
  285. package/dist/{index-BGnvtYGc.d.ts → index-B6RTOZGC.d.ts} +1 -1
  286. package/dist/{index-DjZgwpGw.d.mts → index-DeOVrEmX.d.mts} +1 -1
  287. package/dist/index.d.mts +7 -7
  288. package/dist/index.d.ts +7 -7
  289. package/dist/index.js +66 -55
  290. package/dist/index.mjs +25 -14
  291. package/dist/install-integrity.json +162 -142
  292. package/dist/plays/bundle-play-file.d.mts +3 -3
  293. package/dist/plays/bundle-play-file.d.ts +3 -3
  294. package/dist/plays/bundle-play-file.mjs +23 -4
  295. package/dist/plays/csv-data-input.js +3 -3
  296. package/dist/plays/csv-data-input.mjs +2 -2
  297. package/dist/plays/play-description.d.mts +2 -2
  298. package/dist/plays/play-description.d.ts +2 -2
  299. package/dist/plays/run-request.d.mts +2 -2
  300. package/dist/plays/run-request.d.ts +2 -2
  301. package/dist/plays/run-request.js +4 -4
  302. package/dist/plays/run-request.mjs +3 -3
  303. package/dist/release.d.mts +1 -1
  304. package/dist/release.d.ts +1 -1
  305. package/dist/release.js +2 -2
  306. package/dist/release.mjs +1 -1
  307. package/dist/server.d.mts +4 -4
  308. package/dist/server.d.ts +4 -4
  309. package/dist/server.js +15 -13
  310. package/dist/server.mjs +9 -7
  311. package/package.json +1 -1
  312. package/dist/cli/auth-B4PI7GVY.js +0 -43
  313. package/dist/cli/concurrent-runs-help-JEFQZTJI.js +0 -21
  314. package/dist/cli/describe-PXTSBJTL.js +0 -50
  315. package/dist/cli/describe-YGMQBV44.mjs +0 -50
  316. package/dist/cli/git-I3JV7IGH.js +0 -25
  317. package/dist/cli/org-5KD7X7IA.mjs +0 -1282
  318. package/dist/cli/org-YQ2CR32B.js +0 -1282
  319. package/dist/cli/run-identity-G257GQED.js +0 -25
  320. package/dist/cli/search-2RRRF4LW.js +0 -32
  321. package/dist/cli/sessions-SBH27JNW.js +0 -22
  322. package/dist/cli/skills-Y3SRLOYD.js +0 -36
  323. package/dist/cli/tools-OFYPUPUV.js +0 -57
  324. package/dist/cli/update-SOUSCLB7.js +0 -34
@@ -38,6 +38,7 @@ import {
38
38
  export { buildDaytonaPayloadMaterializerSource } from '../../daytona-payload-contract';
39
39
  import { compactPlayArtifactForRuntimeTransport } from '../../../plays/artifact-transport';
40
40
  import { buildBakedRunnerVerifySource } from '../../baked-runner-image';
41
+ import { resolveExperimentSwitch } from '../../experiment-switches';
41
42
  import { DURABLE_RUNS_ROLLOUT } from '../../durable-runs-rollout';
42
43
  import type {
43
44
  DaytonaExecutionContext,
@@ -254,6 +255,36 @@ export function buildCombinedMaterializeAndWatchdogSource(
254
255
  return `{${buildDaytonaPayloadMaterializerSource()}}process.argv.splice(1,6);${watchdogSource}`;
255
256
  }
256
257
 
258
+ /**
259
+ * N1 (off): on the inline baked launch, one Node process verifies the baked
260
+ * runner, materializes the payload and becomes the runtime watchdog. Today
261
+ * that is three Node starts in series before the runner's own (the shell
262
+ * guard's `node -e` verify, the materializer, the watchdog); on the 0.5-core
263
+ * standard sandbox each start is a large share of command-accepted to
264
+ * heartbeat. The verdict line and its meaning are unchanged: it is written
265
+ * first, on the exec's stdout (fd 3, duplicated before the output capture),
266
+ * and any non-`ok` verdict exits 98 before the payload is materialized or the
267
+ * runner is started. The shell then exits 98 without running the
268
+ * crash-terminal epilogue, exactly as the shell guard did. Per-run capable
269
+ * (experiment switch N1). The combined process keeps the materializer's heap
270
+ * for the run (about 13 MiB in the #10002 comparison).
271
+ */
272
+ export const ONE_NODE_GUARDED_INLINE_LAUNCH = false;
273
+
274
+ /**
275
+ * The N1 verify block: reads the baked runner path, its expected sha256 and
276
+ * the pass marker path from argv[1..3]. On `ok` it first writes the pass
277
+ * marker (a failed write makes the verdict `unverified`, which is not `ok`).
278
+ * It then prints exactly one `baked-runner:<verdict>` line on fd 3 and closes
279
+ * it, and on any verdict but `ok` exits 98. The arguments are then removed, so
280
+ * the materializer and the watchdog read the positions they always had. The
281
+ * shell exits 98 unless the pass marker exists, so a guard that refused or
282
+ * died before a verdict never reaches the epilogue (as with the shell guard).
283
+ */
284
+ export function buildOneNodeBakedRunnerGuardSource(): string {
285
+ return `{const fs=require('node:fs');const c=require('node:crypto');let r='missing';try{r=c.createHash('sha256').update(fs.readFileSync(process.argv[1])).digest('hex')===process.argv[2]?'ok':'mismatch'}catch(e){}if(r==='ok'){try{fs.writeFileSync(process.argv[3],'ok')}catch(e){r='unverified'}}try{fs.writeSync(3,'baked-runner:'+r+'\\n');fs.closeSync(3)}catch(e){}if(r!=='ok')process.exit(${INLINE_BAKED_RUNNER_UNVERIFIED_EXIT_CODE})}process.argv.splice(1,3);`;
286
+ }
287
+
257
288
  /**
258
289
  * Crash-containment epilogue (push execution). The parked worker no longer
259
290
  * holds anything that returns when the runner process dies, so a runner that
@@ -727,8 +758,23 @@ function buildDetachedRunnerCommand(input: {
727
758
  artifactCodePath: string;
728
759
  artifactSourceMapPath: string;
729
760
  } | null;
730
- }): DetachedRunnerPaths & { command: string } {
761
+ /**
762
+ * N1: verify this baked runner inside the single materialize-and-watchdog
763
+ * Node process (verdict on fd 3) instead of a separate shell guard. Needs
764
+ * `materialize`.
765
+ */
766
+ oneNodeBakedGuard?: { path: string; hash: string };
767
+ }): DetachedRunnerPaths & {
768
+ command: string;
769
+ /** N1 only: the marker the guard writes once the baked runner verified. */
770
+ bakedPassMarkerPath?: string;
771
+ } {
731
772
  const { workDir, configPath, crashPusherPath, materialize } = input;
773
+ const oneNodeBakedGuard =
774
+ materialize !== null ? (input.oneNodeBakedGuard ?? null) : null;
775
+ const bakedPassMarkerPath = oneNodeBakedGuard
776
+ ? `${workDir}/deepline-play-baked-verified-${randomUUID()}.txt`
777
+ : null;
732
778
  const runtimeLimitSeconds = input.sandboxRuntimeLimits.timeoutSeconds;
733
779
  const outputPath = `${workDir}/deepline-play-output-${randomUUID()}.log`;
734
780
  const crashPusherLogPath = `${workDir}/deepline-play-crash-terminal-${randomUUID()}.log`;
@@ -759,7 +805,9 @@ function buildDetachedRunnerCommand(input: {
759
805
  ? shellQuote(input.nodeBinaryPath)
760
806
  : 'node';
761
807
  const singleNodeStart =
762
- materialize !== null && DURABLE_RUNS_ROLLOUT.singleNodeMaterializeWatchdog;
808
+ materialize !== null &&
809
+ (oneNodeBakedGuard !== null ||
810
+ DURABLE_RUNS_ROLLOUT.singleNodeMaterializeWatchdog);
763
811
  const watchdogSource = buildDaytonaRuntimeWatchdogSource(
764
812
  input.sandboxRuntimeLimits,
765
813
  input.memoryLimitMiB,
@@ -770,9 +818,17 @@ function buildDetachedRunnerCommand(input: {
770
818
  '-e',
771
819
  shellQuote(
772
820
  singleNodeStart
773
- ? buildCombinedMaterializeAndWatchdogSource(watchdogSource)
821
+ ? `${oneNodeBakedGuard ? buildOneNodeBakedRunnerGuardSource() : ''}${buildCombinedMaterializeAndWatchdogSource(watchdogSource)}`
774
822
  : watchdogSource,
775
823
  ),
824
+ // N1 guard arguments, consumed (and removed from argv) first.
825
+ ...(oneNodeBakedGuard && bakedPassMarkerPath
826
+ ? [
827
+ shellQuote(oneNodeBakedGuard.path),
828
+ shellQuote(oneNodeBakedGuard.hash),
829
+ shellQuote(bakedPassMarkerPath),
830
+ ]
831
+ : []),
776
832
  // Materializer arguments, consumed (and removed from argv) before the
777
833
  // watchdog reads its own.
778
834
  ...(singleNodeStart && materialize
@@ -821,10 +877,20 @@ function buildDetachedRunnerCommand(input: {
821
877
  // Its own retry diagnostics are kept in a separate log: appending them to
822
878
  // `outputPath` after a near-gateway-sized result could hide that result from
823
879
  // a later bounded-tail recovery read.
824
- const command = `rm -f ${shellQuote(outputPath)} ${shellQuote(crashPusherLogPath)} ${shellQuote(exitCodePath)} ${shellQuote(oomKillBaselinePath)} ${shellQuote(runnerPidPath)} ${shellQuote(runtimeStartedPath)} ${shellQuote(runtimeCompletedPath)} ${shellQuote(runtimeLimitMarkerPath)} ${shellQuote(terminationDiagnosticPath)} ${shellQuote(memoryLedgerPath)} ${shellQuote(`${memoryLedgerPath}.tmp`)} ${shellQuote(memoryPressurePath)} ${shellQuote(progressEventPath)} ${shellQuote(`${progressEventPath}.*`)} ${shellQuote(startupDiagnosticPath)}; ( awk '$1 == "oom_kill" { print $2 }' /sys/fs/cgroup/memory.events 2>/dev/null || true ) > ${shellQuote(oomKillBaselinePath)}; ( ${runnerCommand} ) > ${shellQuote(outputPath)} 2>&1; code=$?; printf '%s' "$code" > ${shellQuote(exitCodePath)}; ${runtimeReliabilityEnv}${nodeCommand} ${shellQuote(crashPusherPath)} ${shellQuote(configPath)} "$code" ${shellQuote(outputPath)} ${shellQuote(runtimeLimitMarkerPath)} ${shellQuote(oomKillBaselinePath)} /sys/fs/cgroup/memory.events ${shellQuote(terminationDiagnosticPath)} ${shellQuote(runtimeCompletedPath)} > ${shellQuote(crashPusherLogPath)} 2>&1 || true; printf 'deepline runner output captured: %s\\n' ${shellQuote(outputPath)}; exit "$code"`;
880
+ // N1: unless the guard proved the baked runner (its pass marker), exit 98
881
+ // here, before the epilogue, as the shell guard did: no crash terminal is
882
+ // pushed for a run whose launch falls back to the full upload.
883
+ const bakedRefusalExit = bakedPassMarkerPath
884
+ ? `if [ ! -e ${shellQuote(bakedPassMarkerPath)} ]; then exit ${INLINE_BAKED_RUNNER_UNVERIFIED_EXIT_CODE}; fi; `
885
+ : '';
886
+ const bakedRefusalCleanup = bakedPassMarkerPath
887
+ ? ` ${shellQuote(bakedPassMarkerPath)}`
888
+ : '';
889
+ const command = `rm -f${bakedRefusalCleanup} ${shellQuote(outputPath)} ${shellQuote(crashPusherLogPath)} ${shellQuote(exitCodePath)} ${shellQuote(oomKillBaselinePath)} ${shellQuote(runnerPidPath)} ${shellQuote(runtimeStartedPath)} ${shellQuote(runtimeCompletedPath)} ${shellQuote(runtimeLimitMarkerPath)} ${shellQuote(terminationDiagnosticPath)} ${shellQuote(memoryLedgerPath)} ${shellQuote(`${memoryLedgerPath}.tmp`)} ${shellQuote(memoryPressurePath)} ${shellQuote(progressEventPath)} ${shellQuote(`${progressEventPath}.*`)} ${shellQuote(startupDiagnosticPath)}; ( awk '$1 == "oom_kill" { print $2 }' /sys/fs/cgroup/memory.events 2>/dev/null || true ) > ${shellQuote(oomKillBaselinePath)}; ( ${runnerCommand} ) > ${shellQuote(outputPath)} 2>&1; code=$?; ${bakedRefusalExit}printf '%s' "$code" > ${shellQuote(exitCodePath)}; ${runtimeReliabilityEnv}${nodeCommand} ${shellQuote(crashPusherPath)} ${shellQuote(configPath)} "$code" ${shellQuote(outputPath)} ${shellQuote(runtimeLimitMarkerPath)} ${shellQuote(oomKillBaselinePath)} /sys/fs/cgroup/memory.events ${shellQuote(terminationDiagnosticPath)} ${shellQuote(runtimeCompletedPath)} > ${shellQuote(crashPusherLogPath)} 2>&1 || true; printf 'deepline runner output captured: %s\\n' ${shellQuote(outputPath)}; exit "$code"`;
825
890
 
826
891
  return {
827
892
  command,
893
+ ...(bakedPassMarkerPath ? { bakedPassMarkerPath } : {}),
828
894
  outputPath,
829
895
  exitCodePath,
830
896
  oomKillBaselinePath,
@@ -1221,6 +1287,18 @@ export async function stageRunnerPayload(input: {
1221
1287
  };
1222
1288
  }
1223
1289
 
1290
+ // N1: only the inline baked launch that verifies in its own command, so a
1291
+ // refusal still exits 98 before anything runs and selects the full upload.
1292
+ const oneNodeBakedGuard =
1293
+ inlineDelivery &&
1294
+ input.bakedRunner?.verifyInCommand === true &&
1295
+ resolveExperimentSwitch(
1296
+ 'N1',
1297
+ input.config.context.experimentSwitchOverrides,
1298
+ ONE_NODE_GUARDED_INLINE_LAUNCH,
1299
+ )
1300
+ ? { path: input.bakedRunner.path, hash: input.bakedRunner.hash }
1301
+ : null;
1224
1302
  const {
1225
1303
  command,
1226
1304
  outputPath,
@@ -1233,6 +1311,7 @@ export async function stageRunnerPayload(input: {
1233
1311
  progressEventPath,
1234
1312
  startupDiagnosticPath,
1235
1313
  } = buildDetachedRunnerCommand({
1314
+ ...(oneNodeBakedGuard ? { oneNodeBakedGuard } : {}),
1236
1315
  workDir,
1237
1316
  nodeBinaryPath: input.nodeBinaryPath,
1238
1317
  sandboxTarget: input.sandbox.target,
@@ -1263,11 +1342,13 @@ export async function stageRunnerPayload(input: {
1263
1342
  envelopePath,
1264
1343
  envelope: inlineEnvelope,
1265
1344
  base64,
1266
- inlineCommand: `${inlineEnvelopeCommandPrefix({
1345
+ // N1 writes its verdict on fd 3: the exec's stdout, duplicated before
1346
+ // the runner's output capture replaces fd 1.
1347
+ inlineCommand: `${oneNodeBakedGuard ? 'exec 3>&1; ' : ''}${inlineEnvelopeCommandPrefix({
1267
1348
  envelopePath,
1268
1349
  base64Length: base64.length,
1269
1350
  bytes: inlineEnvelope.byteLength,
1270
- ...(input.bakedRunner?.verifyInCommand
1351
+ ...(input.bakedRunner?.verifyInCommand && !oneNodeBakedGuard
1271
1352
  ? {
1272
1353
  verifyBakedRunner: {
1273
1354
  nodeCommand,
@@ -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,