deepline 0.3.502 → 0.3.504

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 (211) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +26 -0
  2. package/dist/bundling-sources/sdk/src/index.ts +1 -0
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/types.ts +9 -0
  5. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +35 -0
  6. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +1 -1
  7. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +13 -0
  8. package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +0 -8
  9. package/dist/bundling-sources/shared_libs/observability/dlq.ts +174 -0
  10. package/dist/bundling-sources/shared_libs/observability/queue-health.ts +9 -0
  11. package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
  12. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +18 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +20 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +62 -2
  15. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +667 -62
  16. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +55 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +20 -2
  18. package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +46 -0
  19. package/dist/bundling-sources/shared_libs/play-runtime/execution-gateway-invocation-fence.ts +80 -4
  20. package/dist/bundling-sources/shared_libs/play-runtime/fixture-egress-fetch.ts +95 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +292 -45
  22. package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +15 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +3 -0
  24. package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +7 -3
  25. package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-semantics.ts +31 -1
  26. package/dist/bundling-sources/shared_libs/play-runtime/post-code-recovery-policy.ts +231 -0
  27. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +4 -0
  28. package/dist/bundling-sources/shared_libs/play-runtime/run-ending-event.ts +55 -0
  29. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +126 -0
  30. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +38 -1
  31. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +2 -9
  32. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +51 -19
  33. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/local-process.ts +9 -4
  34. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +2 -0
  35. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +2 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +12 -1
  37. package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +3 -0
  38. package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +42 -0
  39. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +7 -0
  40. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +26 -1
  41. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +13 -0
  42. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-deadline-reconciliation.ts +53 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +631 -19
  44. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-inventory.ts +719 -0
  45. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-sql.ts +206 -0
  46. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/latest-cache-result.ts +83 -0
  47. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +1432 -157
  48. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +61 -0
  49. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +29 -8
  50. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-queue-health.ts +27 -2
  51. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +45 -0
  52. package/dist/bundling-sources/shared_libs/play-runtime/tool-cache-policy.ts +18 -0
  53. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +129 -14
  54. package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +2 -0
  55. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +10 -1
  56. package/dist/cli/{auth-EFHLOVG4.mjs → auth-3L5AA5AX.mjs} +5 -5
  57. package/dist/cli/auth-UPK4IIIN.js +43 -0
  58. package/dist/cli/{billing-Q5XKEYPP.mjs → billing-E7EASVPO.mjs} +19 -12
  59. package/dist/cli/{billing-SKT2VE34.js → billing-HOGXVE2V.js} +92 -85
  60. package/dist/cli/{chunk-L5CTJY74.mjs → chunk-22OCKCYS.mjs} +2 -2
  61. package/dist/cli/{chunk-YWOQYYYS.mjs → chunk-2ABRDH3B.mjs} +2 -2
  62. package/dist/cli/{chunk-IL666WJE.js → chunk-2W77YCKH.js} +5 -5
  63. package/dist/cli/{chunk-2MVIS2UI.mjs → chunk-3MLFFWDM.mjs} +2 -2
  64. package/dist/cli/{chunk-HMZF2CSP.mjs → chunk-4CC67XH5.mjs} +2 -2
  65. package/dist/cli/{chunk-NXVYLX3F.mjs → chunk-5CHBIJIM.mjs} +10 -6
  66. package/dist/cli/chunk-5LUF4LAR.mjs +209 -0
  67. package/dist/cli/{chunk-JL6H4H3G.js → chunk-5Z6EULD5.js} +6 -6
  68. package/dist/cli/{chunk-32YQBJON.js → chunk-67OI26OE.js} +7 -7
  69. package/dist/cli/{chunk-LA3UYRVZ.js → chunk-6JNBMTCZ.js} +1 -1
  70. package/dist/cli/{chunk-DYHTXGLX.js → chunk-6SMR7LU7.js} +2 -2
  71. package/dist/cli/{chunk-OFBLT2LQ.mjs → chunk-7F4OEHQK.mjs} +1 -1
  72. package/dist/cli/{chunk-DRBD4IYQ.mjs → chunk-7MJYZ33I.mjs} +2 -6
  73. package/dist/cli/{chunk-UOANF3DR.js → chunk-7P2QVMBP.js} +26 -7
  74. package/dist/cli/{chunk-GINKIZ7S.js → chunk-A6LA42JY.js} +16 -16
  75. package/dist/cli/{chunk-FVM4PS5Q.js → chunk-BN5VKY4X.js} +25 -12
  76. package/dist/cli/{chunk-Z2H7OQ6E.mjs → chunk-BTWUNKKX.mjs} +2 -2
  77. package/dist/cli/{chunk-R5F7JXT4.mjs → chunk-BX45XMXZ.mjs} +2 -2
  78. package/dist/cli/{chunk-NKLM4J4X.mjs → chunk-DEAJVQEG.mjs} +1 -1
  79. package/dist/cli/{chunk-JFBJLNBI.js → chunk-FISP4LCK.js} +53 -53
  80. package/dist/cli/{chunk-OEUMXKR5.js → chunk-FTRVCIGC.js} +26 -26
  81. package/dist/cli/{chunk-YL2CCF6T.mjs → chunk-GGBXNQCR.mjs} +4 -4
  82. package/dist/cli/{chunk-YPTZJ7LO.js → chunk-GJ2DA35C.js} +100 -17
  83. package/dist/cli/{chunk-2S2F6YSI.js → chunk-GRAGUYIE.js} +41 -41
  84. package/dist/cli/{chunk-2JS3H6H6.mjs → chunk-HUX5DZO6.mjs} +3 -3
  85. package/dist/cli/{chunk-4CCMD7QM.mjs → chunk-IGNQKOWT.mjs} +32 -15
  86. package/dist/cli/{chunk-WKFAX2K7.js → chunk-IPAMOMGP.js} +21 -21
  87. package/dist/cli/{chunk-SAW3FBCA.mjs → chunk-ITJ7NB2D.mjs} +6 -0
  88. package/dist/cli/{chunk-Q3NM6ZL3.js → chunk-JPR2546F.js} +23 -21
  89. package/dist/cli/{chunk-X5MGQ7UT.js → chunk-KCKAFTPY.js} +10 -10
  90. package/dist/cli/{chunk-TAK3MVXY.js → chunk-KGUGNEKL.js} +284 -267
  91. package/dist/cli/{chunk-OVZOMSH2.js → chunk-LHXYCZYO.js} +8 -8
  92. package/dist/cli/{chunk-QOJBRCAS.js → chunk-MJTK6Q3G.js} +3 -3
  93. package/dist/cli/{chunk-MYUISF3P.mjs → chunk-MLMWM5DV.mjs} +5 -5
  94. package/dist/cli/{chunk-JO5FFSR7.js → chunk-NTLBZUHD.js} +6 -0
  95. package/dist/cli/{chunk-MP5QY4A2.mjs → chunk-NZ7Z7WNM.mjs} +2 -2
  96. package/dist/cli/{chunk-HIVRCTDR.mjs → chunk-OX2D6BG4.mjs} +20 -1
  97. package/dist/cli/{chunk-YDXEXVBV.js → chunk-QKKU2FH4.js} +7 -7
  98. package/dist/cli/{chunk-3KEZVGGV.mjs → chunk-QOLX2O2S.mjs} +4 -4
  99. package/dist/cli/{chunk-JFUXUSKB.mjs → chunk-R2VZVHJP.mjs} +15 -2
  100. package/dist/cli/chunk-R7J7CJPZ.js +209 -0
  101. package/dist/cli/{chunk-XMKUJ44Z.js → chunk-SMSQVRHE.js} +5 -5
  102. package/dist/cli/{chunk-54QXWK3C.mjs → chunk-SVFTZTCI.mjs} +1 -1
  103. package/dist/cli/{chunk-FWDAEWCD.js → chunk-TMQUMILM.js} +19 -23
  104. package/dist/cli/{chunk-TFFJ2PRN.mjs → chunk-UFYJTRSF.mjs} +98 -15
  105. package/dist/cli/{chunk-EUWRKWT4.js → chunk-UJMBG5JU.js} +5 -4
  106. package/dist/cli/{chunk-DKAMCJIT.js → chunk-USTJEEND.js} +17 -13
  107. package/dist/cli/{chunk-AJL2Q6IQ.js → chunk-UXQQPMYO.js} +2 -2
  108. package/dist/cli/{chunk-7ZYSXSJJ.mjs → chunk-VJVJWZ6I.mjs} +5 -5
  109. package/dist/cli/{chunk-JLYDLK6X.js → chunk-WBIDPDKJ.js} +3 -3
  110. package/dist/cli/{chunk-QNELA7SX.js → chunk-WZSFIJMG.js} +53 -53
  111. package/dist/cli/{chunk-NZXB27TP.mjs → chunk-XHZSPMNC.mjs} +4 -4
  112. package/dist/cli/{chunk-W5CHE5Q2.mjs → chunk-Y6XKCEPK.mjs} +1 -1
  113. package/dist/cli/{chunk-4WTC5SSN.mjs → chunk-Y7VEHKID.mjs} +10 -8
  114. package/dist/cli/{chunk-3MJSWVQ2.mjs → chunk-YOQ2NNDO.mjs} +2 -1
  115. package/dist/cli/{chunk-ZNB6GR3P.mjs → chunk-Z6FXUDIL.mjs} +1 -1
  116. package/dist/cli/command-docs.d.mts +2 -1
  117. package/dist/cli/command-docs.d.ts +2 -1
  118. package/dist/cli/command-docs.js +6 -2
  119. package/dist/cli/command-docs.mjs +5 -1
  120. package/dist/cli/{csv-OXGSCV75.js → csv-2XWGPITO.js} +13 -13
  121. package/dist/cli/{csv-6AEPKKCO.mjs → csv-433JEHLQ.mjs} +4 -4
  122. package/dist/cli/{db-K3KRK4CZ.mjs → db-K747DH43.mjs} +6 -6
  123. package/dist/cli/{db-6NVHDUZY.js → db-PJJMD4VH.js} +27 -27
  124. package/dist/cli/describe-OYS7LZJD.js +49 -0
  125. package/dist/cli/{describe-P3ZJS7TQ.mjs → describe-VEDDYW4P.mjs} +20 -20
  126. package/dist/cli/describe-core.d.mts +8 -4
  127. package/dist/cli/describe-core.d.ts +8 -4
  128. package/dist/cli/describe-core.js +4 -4
  129. package/dist/cli/describe-core.mjs +3 -3
  130. package/dist/cli/{executions-2C2FFG52.js → executions-HM5T72H6.js} +8 -8
  131. package/dist/cli/{executions-I7XW6WWK.mjs → executions-JWRX3XCT.mjs} +6 -6
  132. package/dist/cli/{feedback-47B57A5Y.js → feedback-34UG4BO3.js} +8 -8
  133. package/dist/cli/{feedback-RSTNBJAI.mjs → feedback-MNSIA63Y.mjs} +4 -4
  134. package/dist/cli/git-5YQJSJFR.js +25 -0
  135. package/dist/cli/{git-3G5AFKBT.mjs → git-ZKEOXV3A.mjs} +5 -5
  136. package/dist/cli/index.js +144 -142
  137. package/dist/cli/index.mjs +44 -42
  138. package/dist/cli/{legacy-noops-NQ262TKL.mjs → legacy-noops-5M4T4ZVT.mjs} +5 -5
  139. package/dist/cli/{legacy-noops-P665PBG4.js → legacy-noops-YXSI4FVU.js} +8 -8
  140. package/dist/cli/{monitors-KUPZODZS.mjs → monitors-C65OC4AW.mjs} +7 -7
  141. package/dist/cli/{monitors-IPWAD7LS.js → monitors-O25GDOYE.js} +95 -95
  142. package/dist/cli/{org-WFC3N672.js → org-2GSPLY2A.js} +72 -72
  143. package/dist/cli/{org-ZCQGEM3L.mjs → org-ZRMG5NS2.mjs} +6 -6
  144. package/dist/cli/{pages-N5BNC67L.js → pages-45DPADK6.js} +18 -18
  145. package/dist/cli/{pages-VE66IU7B.mjs → pages-TZZUFBRO.mjs} +6 -6
  146. package/dist/cli/{play-EIMDIAJB.mjs → play-3D7HH273.mjs} +138 -226
  147. package/dist/cli/{play-NKIRJSKX.js → play-RCGMND6X.js} +454 -542
  148. package/dist/cli/{providers-XU3AGY2F.js → providers-3N3ECMTY.js} +9 -9
  149. package/dist/cli/{providers-KDTJ63ED.mjs → providers-PSAKV6CJ.mjs} +6 -6
  150. package/dist/cli/{quickstart-TXFXUODF.mjs → quickstart-2A35SMGC.mjs} +4 -4
  151. package/dist/cli/{quickstart-OSCHOSXU.js → quickstart-6R6AIXM6.js} +6 -6
  152. package/dist/cli/{run-ODGML35U.mjs → run-F3TLDGUO.mjs} +25 -25
  153. package/dist/cli/{run-ET2KVTPK.js → run-F6ZXTASZ.js} +44 -44
  154. package/dist/cli/{search-DK67K6PR.mjs → search-CZLCY3D2.mjs} +7 -7
  155. package/dist/cli/search-R5VEWJO2.js +32 -0
  156. package/dist/cli/{search-output-6SOKQTCW.mjs → search-output-MQTSTLN5.mjs} +5 -5
  157. package/dist/cli/{search-output-KXP4FA62.js → search-output-R5XDNILW.js} +7 -7
  158. package/dist/cli/{secrets-C6SYTMU7.mjs → secrets-D3GF4B2Z.mjs} +6 -6
  159. package/dist/cli/{secrets-WPS6NMNK.js → secrets-DCJYHDSY.js} +15 -15
  160. package/dist/cli/{sessions-PXVOH34X.mjs → sessions-QGEQ2UYZ.mjs} +5 -5
  161. package/dist/cli/{sessions-IP562J5Z.js → sessions-Z4JYJSDP.js} +6 -6
  162. package/dist/cli/{settings-FBUQGYVJ.mjs → settings-G7QEXA4N.mjs} +11 -11
  163. package/dist/cli/{settings-SUDUIVMY.js → settings-UVXXAT4A.js} +78 -78
  164. package/dist/cli/{setup-I5H6IOEY.js → setup-5I42W7D4.js} +49 -49
  165. package/dist/cli/{setup-JSIMTR73.mjs → setup-QHJU3DUI.mjs} +9 -9
  166. package/dist/cli/{skills-FJQ3LX6N.mjs → skills-5LRF4UKX.mjs} +7 -7
  167. package/dist/cli/skills-FB6TV52O.js +36 -0
  168. package/dist/cli/tools-L2364RPA.js +56 -0
  169. package/dist/cli/{tools-IGBK4BVE.mjs → tools-PUT6STVG.mjs} +18 -18
  170. package/dist/cli/{update-7MTT6F5K.mjs → update-CJ2GA64X.mjs} +9 -9
  171. package/dist/cli/update-ESYJGYVZ.js +34 -0
  172. package/dist/cli/{workflow-PM2J2OU3.mjs → workflow-HVEWRTXD.mjs} +7 -7
  173. package/dist/cli/{workflow-UX3ZX6BQ.js → workflow-O67MEBCP.js} +17 -17
  174. package/dist/{client-Bn8FwKGO.d.ts → client-CIwenMFS.d.ts} +1 -1
  175. package/dist/{client-CfNRmjLK.d.mts → client-DYAfJpaN.d.mts} +1 -1
  176. package/dist/{client-core-B91EV0WS.d.ts → client-core-CRjtyMAI.d.ts} +25 -2
  177. package/dist/{client-core-BG8Cgrmk.d.mts → client-core-DlzP8vEs.d.mts} +25 -2
  178. package/dist/{compiler-manifest-DlXDyndN.d.mts → compiler-manifest-DaJrA2KV.d.mts} +1 -1
  179. package/dist/{compiler-manifest-DlXDyndN.d.ts → compiler-manifest-DaJrA2KV.d.ts} +1 -1
  180. package/dist/{errors-BtriA2ld.d.mts → errors-BKnSYueU.d.mts} +1 -1
  181. package/dist/{errors-DmcLykM7.d.ts → errors-KLga4bLr.d.ts} +1 -1
  182. package/dist/{index-DI0sR_fX.d.mts → index-C-8AFpWy.d.mts} +1 -1
  183. package/dist/{index--Jw-slHY.d.ts → index-C5nAZ-VS.d.ts} +1 -1
  184. package/dist/index.d.mts +7 -7
  185. package/dist/index.d.ts +7 -7
  186. package/dist/index.js +9 -9
  187. package/dist/index.mjs +6 -6
  188. package/dist/install-integrity.json +125 -116
  189. package/dist/plays/bundle-play-file.d.mts +3 -3
  190. package/dist/plays/bundle-play-file.d.ts +3 -3
  191. package/dist/plays/bundle-play-file.mjs +12 -5
  192. package/dist/plays/play-description.d.mts +2 -2
  193. package/dist/plays/play-description.d.ts +2 -2
  194. package/dist/plays/run-request.d.mts +2 -2
  195. package/dist/plays/run-request.d.ts +2 -2
  196. package/dist/release.d.mts +1 -1
  197. package/dist/release.d.ts +1 -1
  198. package/dist/release.js +2 -2
  199. package/dist/release.mjs +1 -1
  200. package/dist/server.d.mts +4 -4
  201. package/dist/server.d.ts +4 -4
  202. package/dist/server.js +5 -5
  203. package/dist/server.mjs +3 -3
  204. package/package.json +1 -1
  205. package/dist/cli/auth-VM3IKP5F.js +0 -43
  206. package/dist/cli/describe-JOUAXXPE.js +0 -49
  207. package/dist/cli/git-OPKIC6JQ.js +0 -25
  208. package/dist/cli/search-6U54Y3OK.js +0 -32
  209. package/dist/cli/skills-VHININXC.js +0 -36
  210. package/dist/cli/tools-XMBMHVKF.js +0 -56
  211. package/dist/cli/update-H7JVW43I.js +0 -34
@@ -1,3 +1,4 @@
1
+ import { resolve4 } from 'node:dns/promises';
1
2
  import type { CreateSandboxFromSnapshotParams, Sandbox } from '@daytonaio/sdk';
2
3
  import {
3
4
  boundedDaytonaProviderTextForLog,
@@ -84,7 +85,7 @@ export type DaytonaDeleteRetryAuthorization = {
84
85
 
85
86
  export type DaytonaClient = {
86
87
  create(
87
- params: CreateSandboxFromSnapshotParams & DaytonaDomainAllowListParam,
88
+ params: CreateSandboxFromSnapshotParams,
88
89
  options: { timeout: number },
89
90
  ): Promise<Sandbox>;
90
91
  get?(name: string): Promise<Sandbox>;
@@ -548,29 +549,55 @@ export function filterIpv4CidrAllowList(raw: string | null): string | null {
548
549
  return ipv4.length > 0 ? ipv4.join(',') : null;
549
550
  }
550
551
 
551
- /** Daytona create accepts a comma-separated domain allow-list beside CIDRs. */
552
- export type DaytonaDomainAllowListParam = { domainAllowList?: string };
553
-
554
552
  /**
555
553
  * A run pinned to an app-hosted Runtime gateway reaches that immutable
556
- * deployment by hostname, whose addresses cannot be enumerated as CIDRs. When
557
- * egress is already restricted to an allow-list, add exactly the pinned host;
558
- * an unrestricted sandbox needs nothing (adding a domain list would restrict
559
- * it). Unpinned runs return null.
554
+ * deployment by hostname, whose addresses cannot be enumerated ahead of time.
555
+ * Daytona accepts a CIDR `networkAllowList` or a `domainAllowList`, never
556
+ * both ("mutually exclusive"), and a restricted sandbox already carries the
557
+ * CIDR list. So when egress is already restricted, add the /24 around each
558
+ * IPv4 address the pinned host resolves to, to that same list: the sandbox
559
+ * resolves the same name and may be answered with a different address in the
560
+ * same Vercel range. An unrestricted sandbox needs nothing (a list would
561
+ * restrict it), and an unpinned run is returned unchanged.
560
562
  */
561
- export function runtimeGatewayDaytonaDomainAllowList(input: {
563
+ export async function runtimeGatewayDaytonaNetworkAllowList(input: {
562
564
  credentialScope:
563
565
  | PlayRunnerExecutionConfig['context']['runtimeGatewayCredentialScope']
564
566
  | undefined;
565
567
  networkAllowList: string | null;
566
- }): string | null {
568
+ resolveIpv4?: (hostname: string) => Promise<string[]>;
569
+ }): Promise<string | null> {
567
570
  const scope = input.credentialScope;
568
- if (!scope || !input.networkAllowList) return null;
571
+ if (!scope || !input.networkAllowList) return input.networkAllowList;
569
572
  const hostname = new URL(scope.origin).hostname;
570
573
  if (!hostname) {
571
574
  throw new Error('Runtime gateway credential scope has no hostname.');
572
575
  }
573
- return hostname;
576
+ const addresses = await (input.resolveIpv4 ?? resolve4)(hostname);
577
+ const networks = [
578
+ ...new Set(
579
+ addresses
580
+ .map((address) => address.split('.'))
581
+ .filter(
582
+ (octets) =>
583
+ octets.length === 4 &&
584
+ octets.every((octet) => /^\d{1,3}$/.test(octet)),
585
+ )
586
+ .map((octets) => `${octets[0]}.${octets[1]}.${octets[2]}.0/24`),
587
+ ),
588
+ ];
589
+ if (networks.length === 0) {
590
+ throw new Error(
591
+ `Runtime gateway host ${hostname} resolved to no IPv4 address; refusing to start a pinned sandbox that could not reach it.`,
592
+ );
593
+ }
594
+ const existing = input.networkAllowList
595
+ .split(',')
596
+ .map((entry) => entry.trim());
597
+ return [
598
+ ...existing,
599
+ ...networks.filter((network) => !existing.includes(network)),
600
+ ].join(',');
574
601
  }
575
602
 
576
603
  export function resolveDaytonaSandboxNetworkPolicy(input: {
@@ -640,13 +667,19 @@ async function createOneShotDaytonaSandbox(input: {
640
667
  if (runId) labels.runId = runId;
641
668
  if (input.providerOperationToken)
642
669
  labels.operationKey = input.providerOperationToken;
643
- const { networkAllowList } = resolveDaytonaSandboxNetworkPolicy({
670
+ const policy = resolveDaytonaSandboxNetworkPolicy({
644
671
  runtimeSchedulerSchema: input.context.runtimeSchedulerSchema ?? null,
645
672
  });
646
- const domainAllowList = runtimeGatewayDaytonaDomainAllowList({
647
- credentialScope: input.context.runtimeGatewayCredentialScope,
648
- networkAllowList,
649
- });
673
+ // Only a pinned, already-restricted sandbox resolves anything; every other
674
+ // run keeps the exact synchronous path it had before.
675
+ const credentialScope = input.context.runtimeGatewayCredentialScope;
676
+ const networkAllowList =
677
+ credentialScope && policy.networkAllowList
678
+ ? await runtimeGatewayDaytonaNetworkAllowList({
679
+ credentialScope,
680
+ networkAllowList: policy.networkAllowList,
681
+ })
682
+ : policy.networkAllowList;
650
683
 
651
684
  const commonParams = {
652
685
  name: input.sandboxName,
@@ -664,11 +697,10 @@ async function createOneShotDaytonaSandbox(input: {
664
697
  // A non-empty `networkAllowList` IS the "block all egress except these
665
698
  // CIDRs" control; Daytona rejects create when `networkBlockAll: true` is
666
699
  // combined with a non-empty allow-list ("networkBlockAll: true cannot be
667
- // combined with a non-empty networkAllowList or domainAllowList"). Pass
700
+ // combined with a non-empty networkAllowList"). Pass
668
701
  // the allow-list alone so the egress restriction holds without the
669
702
  // contradictory flag.
670
703
  ...(networkAllowList ? { networkAllowList } : {}),
671
- ...(domainAllowList ? { domainAllowList } : {}),
672
704
  };
673
705
  return input.daytona.create(commonParams, {
674
706
  timeout: DAYTONA_CREATE_TIMEOUT_SECONDS,
@@ -1,3 +1,4 @@
1
+ import { computeBillingSessionId } from '../../run-ending-event';
1
2
  import { preparePlayRunnerConfigForTransport } from '../../protocol';
2
3
  import { randomUUID } from 'node:crypto';
3
4
  import { spawn } from 'node:child_process';
@@ -347,8 +348,10 @@ export const localProcessPlayRunnerBackend: PlayRunnerBackend = {
347
348
  await upsertComputeBillingSessionViaAppRuntime(
348
349
  runtimeApiContextForConfig(config),
349
350
  {
350
- sessionId:
351
+ sessionId: computeBillingSessionId(
351
352
  config.context.workflowId ?? config.context.runId ?? 'unknown',
353
+ config.context.resumeEpoch,
354
+ ),
352
355
  orgId: config.context.orgId ?? 'unknown',
353
356
  userId: null,
354
357
  operation: 'workflow_run',
@@ -625,10 +628,12 @@ export const localProcessPlayRunnerBackend: PlayRunnerBackend = {
625
628
  await recordComputeBillingItemViaAppRuntime(
626
629
  runtimeApiContextForConfig(config),
627
630
  {
628
- sessionId:
631
+ sessionId: computeBillingSessionId(
629
632
  config.context.workflowId ??
630
- config.context.runId ??
631
- workspaceRoot,
633
+ config.context.runId ??
634
+ workspaceRoot,
635
+ config.context.resumeEpoch,
636
+ ),
632
637
  orgId: config.context.orgId ?? 'unknown',
633
638
  userId: null,
634
639
  operation: 'workflow_run',
@@ -985,6 +985,7 @@ export async function inspectDetachedModalRunner(input: {
985
985
  exitCode: number | null;
986
986
  result: PlayRunnerResult | null;
987
987
  diagnosis: { stage: string; detail: string | null };
988
+ providerReturnCode?: number | null;
988
989
  }> {
989
990
  const expectedAppId = input.expectedAppId?.trim() || null;
990
991
  if (!expectedAppId) {
@@ -1040,6 +1041,7 @@ export async function inspectDetachedModalRunner(input: {
1040
1041
  stage: 'sandbox_stopped',
1041
1042
  detail: `Modal sandbox ended with return code ${state.returnCode}.`,
1042
1043
  },
1044
+ providerReturnCode: state.returnCode,
1043
1045
  };
1044
1046
  }
1045
1047
  if (input.skipCapturedOutput) {
@@ -57,6 +57,8 @@ export type RuntimeSandboxDetachedRunnerInspection = {
57
57
  exitCode: number | null;
58
58
  result: PlayRunnerResult | null;
59
59
  diagnosis: { stage: string; detail: string | null };
60
+ /** The stopped sandbox's own return code, when the provider reports one. */
61
+ providerReturnCode?: number | null;
60
62
  };
61
63
 
62
64
  export type RuntimeSandboxDetachedInspectionOptions = {
@@ -1,6 +1,6 @@
1
1
  import type { ComputeBillingItem } from './worker-api-types';
2
2
  import type { DbLogicalTable, DbSessionOperation } from './db-session';
3
- import type { PlayRowUpdate } from './ctx-types';
3
+ import type { PlayRowUpdate, PublishLatestCacheResultInput } from './ctx-types';
4
4
  import type { PlaySheetContract } from '../plays/static-pipeline';
5
5
  import type { PlayRunLedgerEvent } from './run-ledger';
6
6
  import type { WorkReceiptFailureKind } from './work-receipts';
@@ -164,6 +164,17 @@ export type RuntimeReceiptAction =
164
164
  output: unknown;
165
165
  inlineFields?: RuntimeReceiptValueInlineFields;
166
166
  }
167
+ | {
168
+ /**
169
+ * Newest-wins write of a `ctx:{org}:cache:v1:*` shared read result. The
170
+ * receiver stamps `recordedAtMs` from its database clock.
171
+ */
172
+ action: 'publish_latest_cache_result';
173
+ playName: string;
174
+ runId: string;
175
+ key: string;
176
+ output: PublishLatestCacheResultInput['output'];
177
+ }
167
178
  | {
168
179
  action: 'release_runtime_step_receipt';
169
180
  playName: string;
@@ -152,6 +152,7 @@ export function runtimeAuthorityMintInput(
152
152
  descriptor: RuntimeAuthorityDescriptor,
153
153
  input: {
154
154
  runAttempt?: number | null;
155
+ resumeEpoch?: number | null;
155
156
  runLeaseToken?: string | null;
156
157
  terminalContract?: DirectCompletedTerminalContract | null;
157
158
  capabilities?: readonly RuntimeExecutionCapability[];
@@ -176,6 +177,7 @@ export function runtimeAuthorityMintInput(
176
177
  actorEmail: descriptor.actorEmail,
177
178
  schedulerSchema: descriptor.schedulerSchema,
178
179
  runAttempt: input.runAttempt,
180
+ resumeEpoch: input.resumeEpoch,
179
181
  runLeaseToken: input.runLeaseToken,
180
182
  terminalContract: input.terminalContract,
181
183
  capabilities: input.capabilities ?? descriptor.capabilities,
@@ -186,6 +188,7 @@ export function runtimeAuthorityMintInput(
186
188
  export async function mintPlayRunAttemptRuntimeToken(input: {
187
189
  descriptor: RuntimeAuthorityDescriptor;
188
190
  runAttempt?: number | null;
191
+ resumeEpoch?: number | null;
189
192
  runLeaseToken?: string | null;
190
193
  terminalContract?: DirectCompletedTerminalContract | null;
191
194
  capabilities?: readonly RuntimeExecutionCapability[];
@@ -20,6 +20,8 @@ export const RUNTIME_TEST_FAULT_IDS = [
20
20
  'modal_sandbox_create_resource_exhausted',
21
21
  'runtime_sheet_page_tail_hold_ms',
22
22
  'runner_heartbeat_silence_ms',
23
+ 'runner_sandbox_delete_ms',
24
+ 'fence_commit_abandon_ms',
23
25
  ] as const;
24
26
 
25
27
  export type RuntimeTestFaultName = (typeof RUNTIME_TEST_FAULT_IDS)[number];
@@ -385,6 +387,46 @@ export const RUNTIME_INCIDENT_DRILL_CATALOG: readonly RuntimeIncidentDrill[] = [
385
387
  target: 'silent-runner-liveness-e2e',
386
388
  },
387
389
  },
390
+ {
391
+ id: 'runner_sandbox_delete_ms',
392
+ description:
393
+ "Delete a parked detached runner's sandbox a bounded time after it parks, as a provider outage would, once per run.",
394
+ topologies: LOCAL_AND_PREVIEW_TOPOLOGIES,
395
+ control: {
396
+ kind: 'runtime_test_fault',
397
+ defaultValue: 30_000,
398
+ valueMeaning: 'milliseconds',
399
+ },
400
+ expected: {
401
+ outcome:
402
+ 'The worker proves the runner lost, retries the same run from its checkpoint, and every call the run recorded returns from its history.',
403
+ safetyFacts: ['same_logical_run', 'bounded_provider_execution'],
404
+ },
405
+ verification: {
406
+ kind: 'preview_black_box',
407
+ target: 'durable-crash-recovery-e2e',
408
+ },
409
+ },
410
+ {
411
+ id: 'fence_commit_abandon_ms',
412
+ description:
413
+ "On a run's first attempt, abandon a fenced call after the provider ran and before the gateway commits it, as a gateway crash would; the run's abandoned calls go stale after the given time.",
414
+ topologies: ['preview_fly'],
415
+ control: {
416
+ kind: 'runtime_test_fault',
417
+ defaultValue: 60_000,
418
+ valueMeaning: 'milliseconds',
419
+ },
420
+ expected: {
421
+ outcome:
422
+ 'A newer attempt of the same run finds the call stale and unknown, takes it over, and sends it once more with the same key; the run completes.',
423
+ safetyFacts: ['same_logical_run', 'bounded_provider_execution'],
424
+ },
425
+ verification: {
426
+ kind: 'preview_black_box',
427
+ target: 'durable-gateway-crash-recovery-e2e',
428
+ },
429
+ },
388
430
  ];
389
431
 
390
432
  export type RuntimeTestFaultDrill = Omit<
@@ -75,6 +75,7 @@ export const RUNTIME_OPERATION_CAPABILITIES = {
75
75
  fail_runtime_step_receipts: 'receipt.write',
76
76
  heartbeat_runtime_step_receipts: 'receipt.write',
77
77
  skip_runtime_step_receipt: 'receipt.write',
78
+ publish_latest_cache_result: 'receipt.write',
78
79
  ensure_sheet: 'sheet.write',
79
80
  apply_row_updates: 'sheet.write',
80
81
  create_db_session: 'db.session',
@@ -114,6 +115,12 @@ export const RUNTIME_OPERATION_CONTRACT: DeployedOperationContract =
114
115
  kind: 'feature-unavailable',
115
116
  code: 'PAGES_UNAVAILABLE',
116
117
  },
118
+ // The shared read cache is only an optimization: an older receiver
119
+ // writes nothing and the runner treats the publish as a no-op.
120
+ publish_latest_cache_result: {
121
+ kind: 'feature-unavailable',
122
+ code: 'SHARED_READ_CACHE_UNAVAILABLE',
123
+ },
117
124
  project_run_events: {
118
125
  kind: 'equivalent-fallback',
119
126
  action: 'append_run_events',
@@ -5,6 +5,8 @@ import type {
5
5
  CompleteRuntimeStepReceiptsByReferenceInput,
6
6
  ContextOptions,
7
7
  FailRuntimeStepReceiptInput,
8
+ PublishLatestCacheResultInput,
9
+ PublishLatestCacheResultOutcome,
8
10
  ReleaseRuntimeReceiptExecutionLockInput,
9
11
  ReleaseRuntimeStepReceiptInput,
10
12
  RuntimeStepReceipt,
@@ -25,6 +27,7 @@ import {
25
27
  getRuntimeStepReceiptsViaAppRuntime,
26
28
  heartbeatRuntimeStepReceiptsViaAppRuntime,
27
29
  isAppRuntimeApiCapacityError,
30
+ publishLatestCacheResultViaAppRuntime,
28
31
  releaseRuntimeReceiptExecutionLockViaAppRuntime,
29
32
  releaseRuntimeStepReceiptViaAppRuntime,
30
33
  skipRuntimeStepReceiptViaAppRuntime,
@@ -41,7 +44,8 @@ type ReceiptOutput =
41
44
  | RuntimeStepReceipt
42
45
  | null
43
46
  | boolean
44
- | { ownerExecutionId: string; expiresAt: string };
47
+ | { ownerExecutionId: string; expiresAt: string }
48
+ | PublishLatestCacheResultOutcome;
45
49
 
46
50
  type ReceiptCommand =
47
51
  | {
@@ -97,6 +101,11 @@ type ReceiptCommand =
97
101
  kind: 'release_execution_lock';
98
102
  input: ReleaseRuntimeReceiptExecutionLockInput;
99
103
  serial: number;
104
+ }
105
+ | {
106
+ kind: 'publish_latest_cache_result';
107
+ input: PublishLatestCacheResultInput;
108
+ serial: number;
100
109
  };
101
110
 
102
111
  type ReceiptHandlerName =
@@ -109,6 +118,7 @@ type ReceiptHandlerName =
109
118
  | 'completeRuntimeStepReceipt'
110
119
  | 'completeRuntimeStepReceipts'
111
120
  | 'completeRuntimeStepReceiptsByReference'
121
+ | 'publishLatestCacheResult'
112
122
  | 'releaseRuntimeStepReceipt'
113
123
  | 'failRuntimeStepReceipt'
114
124
  | 'failRuntimeStepReceipts'
@@ -327,6 +337,12 @@ export class RuntimeReceiptStoreAdapter {
327
337
  input,
328
338
  })),
329
339
  ),
340
+ publishLatestCacheResult: (input) =>
341
+ write({
342
+ kind: 'publish_latest_cache_result',
343
+ input,
344
+ serial: this.#nextSerial(),
345
+ }),
330
346
  releaseRuntimeStepReceipt: (input) =>
331
347
  write({
332
348
  kind: 'settle',
@@ -506,6 +522,7 @@ function receiptCommandBatchKey(command: ReceiptCommand): string {
506
522
  ]);
507
523
  case 'acquire_execution_lock':
508
524
  case 'release_execution_lock':
525
+ case 'publish_latest_cache_result':
509
526
  return `${command.kind}:${command.serial}`;
510
527
  }
511
528
  }
@@ -535,6 +552,7 @@ function receiptCommandOrderingKeys(
535
552
  case 'heartbeat':
536
553
  case 'acquire_execution_lock':
537
554
  case 'release_execution_lock':
555
+ case 'publish_latest_cache_result':
538
556
  return [command.input.key];
539
557
  case 'settle':
540
558
  return [command.input.key];
@@ -722,5 +740,12 @@ async function sendReceiptCommands(input: {
722
740
  ...first.input,
723
741
  }),
724
742
  ];
743
+ case 'publish_latest_cache_result':
744
+ return [
745
+ await publishLatestCacheResultViaAppRuntime(input.context, {
746
+ playName: input.playName,
747
+ ...first.input,
748
+ }),
749
+ ];
725
750
  }
726
751
  }
@@ -101,6 +101,19 @@ export type PlaySchedulerSubmitInput = RetainedPipelineCarrier & {
101
101
  inputBytes?: number;
102
102
  inputSha256?: string;
103
103
  replayedFromRunId?: string | null;
104
+ /**
105
+ * Server-derived launch fact: derive run-scoped history, SQL and provider
106
+ * idempotency keys from the executing run instead of an inline child's
107
+ * composition namespace. Absent on older launches, which keep their keys.
108
+ */
109
+ runScopedKeys?: boolean;
110
+ /**
111
+ * How many times `runs resume` has continued this run (absent means 0).
112
+ * Written only by the resume statement; orders the run's endings.
113
+ */
114
+ resumeEpoch?: number;
115
+ /** First attempt of the current resume epoch; absent at epoch 0. */
116
+ resumeEpochFirstAttempt?: number;
104
117
  /** Start a fresh run graph and recompute runtime-sheet rows. */
105
118
  force?: boolean;
106
119
  /** Explicit cache bypass for completed ctx.tools.execute receipts. */
@@ -1,5 +1,8 @@
1
+ import { CANCELLATION_CLEANUP_ACTIVITY_ID } from '../activity-observation';
2
+ import { normalizeResumeEpoch } from '../run-ending-event';
1
3
  import {
2
4
  abandonUnstartedModalCancellationReservations,
5
+ appendPostgresRunLedgerEvents,
3
6
  cancelPostgresSchedulerRun,
4
7
  enqueuePostgresSchedulerSandboxCleanupForRun,
5
8
  hasPendingPostgresSchedulerSandboxCleanupForRun,
@@ -73,6 +76,56 @@ async function finalizeCancelledRunAfterCleanup(input: {
73
76
  input.schedulerOptions,
74
77
  )
75
78
  ) {
79
+ const facts = await input.client.query<{
80
+ org_id: string;
81
+ resume_epoch: unknown;
82
+ requested_at: string | null;
83
+ }>(
84
+ `SELECT run.org_id, run.launch_json->'resumeEpoch' AS resume_epoch,
85
+ request.value->>'requestedAt' AS requested_at
86
+ FROM ${input.schedulerSchema}.runs AS run
87
+ JOIN ${input.schedulerSchema}.control AS request ON request.key = $2
88
+ WHERE run.run_id = $1`,
89
+ [input.runId, input.controlKey],
90
+ );
91
+ const fact = facts.rows[0];
92
+ if (!fact)
93
+ throw new Error(
94
+ 'Pending cancellation lost its durable run/request identity.',
95
+ );
96
+ // All current request writers retain this clock. Historical requests
97
+ // lacking it keep their existing cleanup behavior; never invent a fresh
98
+ // event each poll or reinterpret their saved request.
99
+ const requestedAt = Date.parse(fact.requested_at ?? '');
100
+ if (Number.isFinite(requestedAt)) {
101
+ await appendPostgresRunLedgerEvents(
102
+ input.client,
103
+ {
104
+ orgId: fact.org_id,
105
+ runId: input.runId,
106
+ events: [
107
+ {
108
+ type: 'activity.observed',
109
+ runId: input.runId,
110
+ source: 'system',
111
+ occurredAt: requestedAt,
112
+ resumeEpoch: normalizeResumeEpoch(fact.resume_epoch),
113
+ observation: {
114
+ activityId: CANCELLATION_CLEANUP_ACTIVITY_ID,
115
+ target: {
116
+ kind: 'capacity',
117
+ pool: 'runner',
118
+ label: 'Play cancellation cleanup',
119
+ },
120
+ state: { kind: 'active' },
121
+ observedAt: requestedAt,
122
+ },
123
+ },
124
+ ],
125
+ },
126
+ input.schedulerOptions,
127
+ );
128
+ }
76
129
  await input.client.query('COMMIT');
77
130
  return 'pending';
78
131
  }