deepline 0.3.500 → 0.3.502

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 (190) hide show
  1. package/dist/bundling-sources/sdk/src/plays/client-core.ts +45 -7
  2. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  3. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +20 -2
  4. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +155 -0
  5. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +7 -1
  6. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +2 -1
  7. package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts +29 -14
  8. package/dist/bundling-sources/shared_libs/play-runtime/durable-invocation-fence.ts +3 -1
  9. package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +54 -1
  10. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +12 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/prebuilt-result-quality.ts +264 -0
  12. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +18 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +56 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +53 -10
  15. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +1 -1
  16. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +1 -2
  17. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +1 -1
  18. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +9 -2
  19. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +31 -1
  20. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +74 -3
  21. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-runtime-watchdog.ts +226 -2
  22. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +41 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +5 -1
  24. package/dist/bundling-sources/shared_libs/play-runtime/runtime-app-transport.ts +374 -0
  25. package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +5 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/runtime-environment.ts +49 -9
  27. package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-oidc.ts +55 -11
  28. package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-profile.ts +12 -1
  29. package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-sandbox-credential.ts +338 -0
  30. package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-staging.ts +417 -0
  31. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +15 -0
  32. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +184 -11
  33. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +17 -3
  34. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-progress-registry.ts +9 -0
  35. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +18 -2
  36. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +198 -20
  37. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-attempt.ts +81 -0
  38. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-staging-journal.ts +708 -0
  39. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-staging-teardown.ts +160 -0
  40. package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +4 -0
  41. package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +2 -0
  42. package/dist/cli/{auth-WK3FDPRP.mjs → auth-EFHLOVG4.mjs} +5 -5
  43. package/dist/cli/auth-VM3IKP5F.js +43 -0
  44. package/dist/cli/{billing-O3LVKXE7.mjs → billing-Q5XKEYPP.mjs} +8 -8
  45. package/dist/cli/{billing-K7UHZUF4.js → billing-SKT2VE34.js} +81 -81
  46. package/dist/cli/{chunk-4CJWOLOS.mjs → chunk-2JS3H6H6.mjs} +3 -3
  47. package/dist/cli/{chunk-CIV5GJAE.mjs → chunk-2MVIS2UI.mjs} +2 -2
  48. package/dist/cli/{chunk-LNMY2T5S.js → chunk-2S2F6YSI.js} +41 -41
  49. package/dist/cli/{chunk-RAZ3TMOS.js → chunk-32YQBJON.js} +7 -7
  50. package/dist/cli/{chunk-JHNFUCVT.mjs → chunk-3KEZVGGV.mjs} +4 -4
  51. package/dist/cli/{chunk-5JXGYSXH.mjs → chunk-3MJSWVQ2.mjs} +1 -1
  52. package/dist/cli/{chunk-5TVY5OEH.mjs → chunk-4CCMD7QM.mjs} +21 -20
  53. package/dist/cli/{chunk-T4AGTOKQ.mjs → chunk-4WTC5SSN.mjs} +7 -7
  54. package/dist/cli/{chunk-XCBOOB73.mjs → chunk-54QXWK3C.mjs} +1 -1
  55. package/dist/cli/{chunk-5AC7NUQN.mjs → chunk-7ZYSXSJJ.mjs} +5 -5
  56. package/dist/cli/{chunk-PHGMC33I.js → chunk-AJL2Q6IQ.js} +2 -2
  57. package/dist/cli/{chunk-UBKA33KY.mjs → chunk-BMCRTI6Z.mjs} +22 -1
  58. package/dist/cli/{chunk-74VKLBJD.js → chunk-DKAMCJIT.js} +14 -14
  59. package/dist/cli/{chunk-C5R3UH5V.mjs → chunk-DRBD4IYQ.mjs} +1 -1
  60. package/dist/cli/{chunk-Z5LE7NXM.js → chunk-DYHTXGLX.js} +2 -2
  61. package/dist/cli/{chunk-TOGCDNMH.js → chunk-EUWRKWT4.js} +4 -4
  62. package/dist/cli/{chunk-GBICEYUA.js → chunk-FVM4PS5Q.js} +116 -8
  63. package/dist/cli/{chunk-I42EOZKQ.js → chunk-FWDAEWCD.js} +5 -5
  64. package/dist/cli/{chunk-GOO4VI5M.js → chunk-GINKIZ7S.js} +16 -16
  65. package/dist/cli/{chunk-56QAHX2K.mjs → chunk-HIVRCTDR.mjs} +90 -30
  66. package/dist/cli/{chunk-XUOZYAP5.mjs → chunk-HMZF2CSP.mjs} +2 -2
  67. package/dist/cli/{chunk-5KAZGZG7.js → chunk-IL666WJE.js} +5 -5
  68. package/dist/cli/{chunk-G3NA4R7M.js → chunk-JFBJLNBI.js} +53 -53
  69. package/dist/cli/{chunk-KSHAFYYG.mjs → chunk-JFUXUSKB.mjs} +112 -4
  70. package/dist/cli/{chunk-RHE4YI4H.js → chunk-JL6H4H3G.js} +6 -6
  71. package/dist/cli/{chunk-K3BHKRMS.js → chunk-JLYDLK6X.js} +3 -3
  72. package/dist/cli/{chunk-QRKCCY4L.mjs → chunk-L5CTJY74.mjs} +1 -1
  73. package/dist/cli/{chunk-W64Y7GE7.js → chunk-LA3UYRVZ.js} +1 -1
  74. package/dist/cli/{chunk-HI2BFS5S.mjs → chunk-MP5QY4A2.mjs} +2 -2
  75. package/dist/cli/{chunk-V7MZYIA7.mjs → chunk-MYUISF3P.mjs} +5 -5
  76. package/dist/cli/{chunk-CS2AEAD6.mjs → chunk-N4TR6QRI.mjs} +1 -1
  77. package/dist/cli/{chunk-C7355NMU.mjs → chunk-NKLM4J4X.mjs} +1 -1
  78. package/dist/cli/{chunk-FJZUG633.mjs → chunk-NXVYLX3F.mjs} +3 -3
  79. package/dist/cli/{chunk-L7X6ADNM.mjs → chunk-NZXB27TP.mjs} +4 -4
  80. package/dist/cli/{chunk-VLCY4F6E.js → chunk-OEUMXKR5.js} +26 -26
  81. package/dist/cli/{chunk-SRS2D27G.mjs → chunk-OFBLT2LQ.mjs} +1 -1
  82. package/dist/cli/{chunk-SNPZ2QWL.js → chunk-OVZOMSH2.js} +8 -8
  83. package/dist/cli/{chunk-KEBNXJSK.js → chunk-Q3NM6ZL3.js} +19 -19
  84. package/dist/cli/{chunk-GBRI644Y.js → chunk-QNELA7SX.js} +53 -53
  85. package/dist/cli/{chunk-IX2DPYIV.js → chunk-QOJBRCAS.js} +3 -3
  86. package/dist/cli/{chunk-IZ6YWXIK.mjs → chunk-R5F7JXT4.mjs} +2 -2
  87. package/dist/cli/{chunk-EQR5O2D2.js → chunk-RNSHCJME.js} +3 -3
  88. package/dist/cli/{chunk-Q2FXZ4Z5.js → chunk-TAK3MVXY.js} +272 -271
  89. package/dist/cli/{chunk-BIE57V6K.js → chunk-UOANF3DR.js} +360 -300
  90. package/dist/cli/{chunk-CBZTKDXW.mjs → chunk-W5CHE5Q2.mjs} +1 -1
  91. package/dist/cli/{chunk-U5GFP26N.js → chunk-WKFAX2K7.js} +21 -21
  92. package/dist/cli/{chunk-XDVT3GOM.js → chunk-WSGXBROE.js} +22 -1
  93. package/dist/cli/{chunk-X7ODM2LK.js → chunk-X5MGQ7UT.js} +6 -6
  94. package/dist/cli/{chunk-REIKJREB.js → chunk-XMKUJ44Z.js} +5 -5
  95. package/dist/cli/{chunk-SNJNPRIV.js → chunk-YDXEXVBV.js} +7 -7
  96. package/dist/cli/{chunk-X5SO7RV5.mjs → chunk-YL2CCF6T.mjs} +4 -4
  97. package/dist/cli/{chunk-VPVEPGYS.mjs → chunk-YWOQYYYS.mjs} +2 -2
  98. package/dist/cli/{chunk-MAHLIWOF.mjs → chunk-Z2H7OQ6E.mjs} +2 -2
  99. package/dist/cli/{chunk-PGRPNRP6.mjs → chunk-ZNB6GR3P.mjs} +1 -1
  100. package/dist/cli/{csv-DEUOSTEB.mjs → csv-6AEPKKCO.mjs} +4 -4
  101. package/dist/cli/{csv-MWCWNIBJ.js → csv-OXGSCV75.js} +13 -13
  102. package/dist/cli/{db-Q6IRXTTG.js → db-6NVHDUZY.js} +29 -29
  103. package/dist/cli/{db-QM5R5BRY.mjs → db-K3KRK4CZ.mjs} +8 -8
  104. package/dist/cli/describe-JOUAXXPE.js +49 -0
  105. package/dist/cli/describe-P3ZJS7TQ.mjs +49 -0
  106. package/dist/cli/describe-core.d.mts +2 -2
  107. package/dist/cli/describe-core.d.ts +2 -2
  108. package/dist/cli/describe-core.js +3 -4
  109. package/dist/cli/describe-core.mjs +2 -3
  110. package/dist/cli/{executions-DCCDXSQI.js → executions-2C2FFG52.js} +10 -10
  111. package/dist/cli/{executions-SWBKFCY2.mjs → executions-I7XW6WWK.mjs} +8 -8
  112. package/dist/cli/{feedback-EU3EYF4V.js → feedback-47B57A5Y.js} +8 -8
  113. package/dist/cli/{feedback-Q27HN3SB.mjs → feedback-RSTNBJAI.mjs} +4 -4
  114. package/dist/cli/{git-SEQFTQ4N.mjs → git-3G5AFKBT.mjs} +5 -5
  115. package/dist/cli/git-OPKIC6JQ.js +25 -0
  116. package/dist/cli/index.js +137 -137
  117. package/dist/cli/index.mjs +40 -40
  118. package/dist/cli/{legacy-noops-XKH4VREG.mjs → legacy-noops-NQ262TKL.mjs} +5 -5
  119. package/dist/cli/{legacy-noops-LCQDEVA3.js → legacy-noops-P665PBG4.js} +8 -8
  120. package/dist/cli/{monitors-DJCID6X5.js → monitors-IPWAD7LS.js} +97 -97
  121. package/dist/cli/{monitors-4XWBV46I.mjs → monitors-KUPZODZS.mjs} +9 -9
  122. package/dist/cli/{org-BU4FG5PN.js → org-WFC3N672.js} +74 -74
  123. package/dist/cli/{org-PSBGXBRW.mjs → org-ZCQGEM3L.mjs} +8 -8
  124. package/dist/cli/{pages-3PHJYXYB.js → pages-N5BNC67L.js} +20 -20
  125. package/dist/cli/{pages-7QLXLJGQ.mjs → pages-VE66IU7B.mjs} +8 -8
  126. package/dist/cli/{play-4OLYXRCG.mjs → play-EIMDIAJB.mjs} +20 -20
  127. package/dist/cli/{play-S3CWPQKB.js → play-NKIRJSKX.js} +336 -336
  128. package/dist/cli/{providers-JT7C2QTC.mjs → providers-KDTJ63ED.mjs} +8 -8
  129. package/dist/cli/{providers-U4JUMLB2.js → providers-XU3AGY2F.js} +11 -11
  130. package/dist/cli/{quickstart-OUSMXLYZ.js → quickstart-OSCHOSXU.js} +6 -6
  131. package/dist/cli/{quickstart-DQF5CF2I.mjs → quickstart-TXFXUODF.mjs} +4 -4
  132. package/dist/cli/{run-6XXHLB4X.js → run-ET2KVTPK.js} +45 -46
  133. package/dist/cli/{run-RECNI77K.mjs → run-ODGML35U.mjs} +26 -27
  134. package/dist/cli/run-identity-HFYABUJS.js +31 -0
  135. package/dist/cli/{run-identity-MRNCEGV2.mjs → run-identity-MNRZS2N3.mjs} +9 -3
  136. package/dist/cli/search-6U54Y3OK.js +32 -0
  137. package/dist/cli/{search-JN7K3GC6.mjs → search-DK67K6PR.mjs} +9 -9
  138. package/dist/cli/{search-output-L6PC5SPM.mjs → search-output-6SOKQTCW.mjs} +53 -75
  139. package/dist/cli/{search-output-JGNYXDWZ.js → search-output-KXP4FA62.js} +58 -80
  140. package/dist/cli/{secrets-UOXZWHBY.mjs → secrets-C6SYTMU7.mjs} +8 -8
  141. package/dist/cli/{secrets-TX6PCZ77.js → secrets-WPS6NMNK.js} +17 -17
  142. package/dist/cli/{sessions-GCEIX4KB.js → sessions-IP562J5Z.js} +6 -6
  143. package/dist/cli/{sessions-DTE733EH.mjs → sessions-PXVOH34X.mjs} +5 -5
  144. package/dist/cli/{settings-ZGIMRCTC.mjs → settings-FBUQGYVJ.mjs} +13 -13
  145. package/dist/cli/{settings-UGXSDHR5.js → settings-SUDUIVMY.js} +80 -80
  146. package/dist/cli/{setup-JYB6Z376.js → setup-I5H6IOEY.js} +49 -49
  147. package/dist/cli/{setup-UT7AO53D.mjs → setup-JSIMTR73.mjs} +9 -9
  148. package/dist/cli/{skills-4QJCMN7J.mjs → skills-FJQ3LX6N.mjs} +7 -7
  149. package/dist/cli/skills-VHININXC.js +36 -0
  150. package/dist/cli/{tools-RGNXIAA6.mjs → tools-IGBK4BVE.mjs} +19 -20
  151. package/dist/cli/tools-XMBMHVKF.js +56 -0
  152. package/dist/cli/{update-Q62EVSXZ.mjs → update-7MTT6F5K.mjs} +9 -9
  153. package/dist/cli/update-H7JVW43I.js +34 -0
  154. package/dist/cli/{workflow-YNIOWM7J.mjs → workflow-PM2J2OU3.mjs} +9 -9
  155. package/dist/cli/{workflow-GENV47RD.js → workflow-UX3ZX6BQ.js} +19 -19
  156. package/dist/{client-Cj3UqrCZ.d.ts → client-Bn8FwKGO.d.ts} +1 -1
  157. package/dist/{client-DSCTVVRj.d.mts → client-CfNRmjLK.d.mts} +1 -1
  158. package/dist/{client-core-dI4KTuWS.d.ts → client-core-B91EV0WS.d.ts} +19 -0
  159. package/dist/{client-core-B-8DTIN1.d.mts → client-core-BG8Cgrmk.d.mts} +19 -0
  160. package/dist/index.d.mts +3 -3
  161. package/dist/index.d.ts +3 -3
  162. package/dist/index.js +19 -19
  163. package/dist/index.mjs +8 -8
  164. package/dist/install-integrity.json +119 -114
  165. package/dist/plays/play-description.d.mts +1 -1
  166. package/dist/plays/play-description.d.ts +1 -1
  167. package/dist/plays/run-request.d.mts +1 -1
  168. package/dist/plays/run-request.d.ts +1 -1
  169. package/dist/plays/run-request.js +3 -3
  170. package/dist/plays/run-request.mjs +2 -2
  171. package/dist/release.d.mts +1 -1
  172. package/dist/release.d.ts +1 -1
  173. package/dist/release.js +2 -2
  174. package/dist/release.mjs +1 -1
  175. package/dist/server.d.mts +2 -2
  176. package/dist/server.d.ts +2 -2
  177. package/dist/server.js +7 -7
  178. package/dist/server.mjs +5 -5
  179. package/package.json +1 -1
  180. package/dist/cli/auth-H4PCVUN3.js +0 -43
  181. package/dist/cli/chunk-XK5DMLZE.js +0 -111
  182. package/dist/cli/chunk-XRDXNAAY.mjs +0 -111
  183. package/dist/cli/describe-BZ544347.js +0 -50
  184. package/dist/cli/describe-CQZ7TBOG.mjs +0 -50
  185. package/dist/cli/git-NW6BAXX2.js +0 -25
  186. package/dist/cli/run-identity-G257GQED.js +0 -25
  187. package/dist/cli/search-BIQ62ZBE.js +0 -32
  188. package/dist/cli/skills-53LCPB5R.js +0 -36
  189. package/dist/cli/tools-HKJK6UNJ.js +0 -57
  190. package/dist/cli/update-QMZSFTFZ.js +0 -34
@@ -0,0 +1,374 @@
1
+ /**
2
+ * The one owner of "how does this caller reach the app".
3
+ *
4
+ * Every code-owned call from a worker, a gateway, or a sandbox to the app's
5
+ * runtime API resolves its transport here. The decision comes from the
6
+ * executor token's `runtime_gateway_deployment_id` claim and the launch pin,
7
+ * never from caller convention:
8
+ *
9
+ * - `direct`: the launch's runtime API origin over the network (Fly, every
10
+ * unpinned launch, and the primary/dispatch/internal tokens). A token that
11
+ * carries a gateway pin claim is refused here
12
+ * (`runtime_gateway_transport_unpinned`): the app accepts it only inside its
13
+ * pinned deployment's gateway, so a direct call would be a 403.
14
+ * - `pinned_gateway`: a worker holding a pinned attempt token reaches the app
15
+ * through the pinned receipt gateway, with an OIDC credential it mints and
16
+ * staged bodies above the inline limit (the sandbox's contract).
17
+ * - `in_process`: inside an app-hosted gateway, the gateway's own deployment
18
+ * is called in process and never receives the protection-bypass credential.
19
+ * - `sandbox`: the sandbox runner's credentialed fetch, installed once, and an
20
+ * explicit wrapper for callers that do not use the global fetch
21
+ * (`safeOutboundFetch`).
22
+ *
23
+ * Unpinned callers get exactly what they had before this module existed.
24
+ * Generated sandbox scripts (watchdog, crash terminal pusher) cannot import;
25
+ * they embed `runtimeGatewayOidcRequestHeaders` and are allowlisted in
26
+ * `scripts/check-runtime-app-transport-boundary.ts`.
27
+ */
28
+ import type { WorkflowRunExecutionTokenClaims } from './internal-bootstrap-token';
29
+ import {
30
+ readRuntimeGatewayLaunchPin,
31
+ RuntimeGatewayLaunchError,
32
+ type RuntimeGatewayLaunchFields,
33
+ type RuntimeGatewayLaunchPin,
34
+ } from './runtime-gateway-profile';
35
+ import {
36
+ mintRuntimeGatewayOidcToken,
37
+ RUNTIME_GATEWAY_OIDC_FILE_ENV,
38
+ RUNTIME_GATEWAY_OIDC_PRIVATE_KEY_ENV,
39
+ RUNTIME_GATEWAY_OIDC_RENEW_AFTER_SECONDS,
40
+ RuntimeGatewayOidcError,
41
+ type RuntimeGatewayOidcSigningKey,
42
+ } from './runtime-gateway-oidc';
43
+ import {
44
+ createRuntimeGatewayCredentialFetch,
45
+ currentRuntimeGatewayOidcToken,
46
+ runtimeGatewayCredentialScopeFromPin,
47
+ type RuntimeGatewaySandboxContext,
48
+ } from './runtime-gateway-sandbox-credential';
49
+ import { runtimeApiBaseUrlFromLaunch } from './scheduler-backends/runtime-api-origin';
50
+
51
+ export type RuntimeAppTransportKind =
52
+ | 'direct'
53
+ | 'pinned_gateway'
54
+ | 'in_process'
55
+ | 'sandbox';
56
+
57
+ export type RuntimeAppTransport = Readonly<{
58
+ kind: RuntimeAppTransportKind;
59
+ baseUrl: string;
60
+ /** Absent: the global fetch (the direct transport's historical default). */
61
+ fetch?: typeof fetch;
62
+ vercelProtectionBypassToken: string | null;
63
+ }>;
64
+
65
+ type TransportLaunch = RuntimeGatewayLaunchFields & {
66
+ runId: string;
67
+ executorToken: string;
68
+ baseUrl: string;
69
+ runtimeApiBaseUrl?: string | null;
70
+ vercelProtectionBypassToken?: string | null;
71
+ };
72
+
73
+ /**
74
+ * Read an executor token's claims without verifying its signature. Only for
75
+ * a holder deciding how to use its own token; the receiver always verifies.
76
+ */
77
+ export function readExecutorTokenClaimsUnverified(
78
+ token: string,
79
+ ): Partial<WorkflowRunExecutionTokenClaims> | null {
80
+ try {
81
+ const payload = token.split('.')[1];
82
+ const decoded: unknown = payload
83
+ ? JSON.parse(Buffer.from(payload, 'base64url').toString('utf8'))
84
+ : null;
85
+ return decoded && typeof decoded === 'object' && !Array.isArray(decoded)
86
+ ? (decoded as Partial<WorkflowRunExecutionTokenClaims>)
87
+ : null;
88
+ } catch {
89
+ return null;
90
+ }
91
+ }
92
+
93
+ function tokenGatewayDeploymentId(token: string): string | undefined {
94
+ return readExecutorTokenClaimsUnverified(token)
95
+ ?.runtime_gateway_deployment_id;
96
+ }
97
+
98
+ /** Mint the OIDC credential for one attempt of a pinned run, loudly. */
99
+ export function mintRuntimeGatewayAttemptOidcToken(input: {
100
+ pin: RuntimeGatewayLaunchPin;
101
+ runId: string;
102
+ attempt: number;
103
+ nowMs: number;
104
+ signingKey: RuntimeGatewayOidcSigningKey | null;
105
+ }): string {
106
+ if (!input.signingKey) {
107
+ throw new RuntimeGatewayLaunchError(
108
+ 'runtime_gateway_oidc_unavailable',
109
+ `This worker has no ${RUNTIME_GATEWAY_OIDC_PRIVATE_KEY_ENV}; it cannot start a run pinned to ${input.pin.deploymentId}.`,
110
+ );
111
+ }
112
+ try {
113
+ return mintRuntimeGatewayOidcToken({
114
+ signingKey: input.signingKey,
115
+ deploymentId: input.pin.deploymentId,
116
+ runId: input.runId,
117
+ attempt: input.attempt,
118
+ nowMs: input.nowMs,
119
+ });
120
+ } catch (error) {
121
+ // A secret that is not this environment's published key (or not a key
122
+ // at all) can never mint a credential the pinned gateway accepts.
123
+ if (error instanceof RuntimeGatewayOidcError) {
124
+ throw new RuntimeGatewayLaunchError(
125
+ 'runtime_gateway_oidc_unavailable',
126
+ `This worker cannot sign a gateway credential for a run pinned to ${input.pin.deploymentId}: ${error.message}`,
127
+ );
128
+ }
129
+ throw error;
130
+ }
131
+ }
132
+
133
+ export class RuntimeAppTransportError extends Error {
134
+ readonly code = 'runtime_gateway_transport_unpinned';
135
+ constructor(message: string) {
136
+ super(`runtime_gateway_transport_unpinned: ${message}`);
137
+ this.name = 'RuntimeAppTransportError';
138
+ }
139
+ }
140
+
141
+ function directTransport(
142
+ launch: Pick<
143
+ TransportLaunch,
144
+ 'baseUrl' | 'runtimeApiBaseUrl' | 'vercelProtectionBypassToken'
145
+ >,
146
+ executorToken: string,
147
+ ): RuntimeAppTransport {
148
+ if (tokenGatewayDeploymentId(executorToken) !== undefined) {
149
+ throw new RuntimeAppTransportError(
150
+ 'a token pinned to an app-hosted gateway deployment cannot call the app directly; resolve it as a worker or in-gateway caller.',
151
+ );
152
+ }
153
+ return {
154
+ kind: 'direct',
155
+ baseUrl: runtimeApiBaseUrlFromLaunch(launch),
156
+ vercelProtectionBypassToken: launch.vercelProtectionBypassToken ?? null,
157
+ };
158
+ }
159
+
160
+ /**
161
+ * A worker's transport for one launch. The primary launch token carries no
162
+ * pin claim and stays direct; a pinned attempt token goes through the pinned
163
+ * receipt gateway with a credential minted here and staged large bodies.
164
+ */
165
+ function workerTransport(input: {
166
+ launch: TransportLaunch;
167
+ signingKey: () => RuntimeGatewayOidcSigningKey | null;
168
+ nowMs?: () => number;
169
+ fetch?: typeof fetch;
170
+ }): RuntimeAppTransport {
171
+ const { launch } = input;
172
+ const pin = readRuntimeGatewayLaunchPin(launch);
173
+ const claims = readExecutorTokenClaimsUnverified(launch.executorToken);
174
+ if (!pin || claims?.runtime_gateway_deployment_id === undefined) {
175
+ return directTransport(launch, launch.executorToken);
176
+ }
177
+ const attempt = claims.run_attempt;
178
+ if (
179
+ claims.runtime_gateway_deployment_id !== pin.deploymentId ||
180
+ typeof attempt !== 'number' ||
181
+ !Number.isSafeInteger(attempt)
182
+ ) {
183
+ throw new RuntimeGatewayLaunchError(
184
+ 'runtime_gateway_executor_token_unpinned',
185
+ `The worker's executor token for run ${launch.runId} does not name pinned deployment ${pin.deploymentId} with an attempt.`,
186
+ );
187
+ }
188
+ const now = input.nowMs ?? Date.now;
189
+ let credential: { token: string; mintedAtMs: number } | null = null;
190
+ const currentToken = (): string => {
191
+ const nowMs = now();
192
+ if (
193
+ !credential ||
194
+ nowMs - credential.mintedAtMs >=
195
+ RUNTIME_GATEWAY_OIDC_RENEW_AFTER_SECONDS * 1_000
196
+ ) {
197
+ credential = {
198
+ token: mintRuntimeGatewayAttemptOidcToken({
199
+ pin,
200
+ runId: launch.runId,
201
+ attempt,
202
+ nowMs,
203
+ signingKey: input.signingKey(),
204
+ }),
205
+ mintedAtMs: nowMs,
206
+ };
207
+ }
208
+ return credential.token;
209
+ };
210
+ return {
211
+ kind: 'pinned_gateway',
212
+ baseUrl: pin.receiptGatewayBaseUrl,
213
+ fetch: createRuntimeGatewayCredentialFetch({
214
+ scope: runtimeGatewayCredentialScopeFromPin(pin),
215
+ // Late-bound so a stubbed global fetch is honored per call.
216
+ send: input.fetch ?? ((url, init) => fetch(url, init)),
217
+ currentToken,
218
+ }),
219
+ // The gateway is the pinned immutable deployment, reached with OIDC.
220
+ vercelProtectionBypassToken: null,
221
+ };
222
+ }
223
+
224
+ /**
225
+ * Inside a gateway. App-hosted (an upstream fetch is present): the gateway's
226
+ * own deployment, in process, without the bypass credential. Fly: the
227
+ * launch's network transport, unchanged.
228
+ *
229
+ * `baseUrl: 'launch_callback'` keeps the data-plane context on the launch's
230
+ * callback URL, as the Fly gateway always has (the in-process dispatcher
231
+ * selects a handler by path only, so it does not matter there).
232
+ */
233
+ function inGatewayTransport(input: {
234
+ upstreamFetch: typeof fetch | undefined;
235
+ launch?: Pick<
236
+ TransportLaunch,
237
+ 'baseUrl' | 'runtimeApiBaseUrl' | 'vercelProtectionBypassToken'
238
+ >;
239
+ baseUrl?: 'runtime_api' | 'launch_callback';
240
+ }): RuntimeAppTransport {
241
+ const baseUrl = !input.launch
242
+ ? ''
243
+ : input.baseUrl === 'launch_callback'
244
+ ? input.launch.baseUrl
245
+ : runtimeApiBaseUrlFromLaunch(input.launch);
246
+ return input.upstreamFetch
247
+ ? {
248
+ kind: 'in_process',
249
+ baseUrl,
250
+ fetch: input.upstreamFetch,
251
+ vercelProtectionBypassToken: null,
252
+ }
253
+ : {
254
+ kind: 'direct',
255
+ baseUrl,
256
+ vercelProtectionBypassToken:
257
+ input.launch?.vercelProtectionBypassToken ?? null,
258
+ };
259
+ }
260
+
261
+ export type RuntimeAppTransportCaller =
262
+ | {
263
+ caller: 'direct';
264
+ launch: Pick<
265
+ TransportLaunch,
266
+ 'baseUrl' | 'runtimeApiBaseUrl' | 'vercelProtectionBypassToken'
267
+ >;
268
+ /** The token the call carries (primary, dispatch, or internal). */
269
+ executorToken: string;
270
+ }
271
+ | {
272
+ caller: 'worker';
273
+ launch: TransportLaunch;
274
+ signingKey: () => RuntimeGatewayOidcSigningKey | null;
275
+ nowMs?: () => number;
276
+ fetch?: typeof fetch;
277
+ }
278
+ | {
279
+ caller: 'in_gateway';
280
+ upstreamFetch: typeof fetch | undefined;
281
+ launch?: Pick<
282
+ TransportLaunch,
283
+ 'baseUrl' | 'runtimeApiBaseUrl' | 'vercelProtectionBypassToken'
284
+ >;
285
+ baseUrl?: 'runtime_api' | 'launch_callback';
286
+ };
287
+
288
+ export function resolveRuntimeAppTransport(
289
+ caller: RuntimeAppTransportCaller,
290
+ ): RuntimeAppTransport {
291
+ switch (caller.caller) {
292
+ case 'direct':
293
+ return directTransport(caller.launch, caller.executorToken);
294
+ case 'worker':
295
+ return workerTransport(caller);
296
+ case 'in_gateway':
297
+ return inGatewayTransport(caller);
298
+ }
299
+ }
300
+
301
+ /**
302
+ * Fields a runtime API context spreads in. Direct: nothing (the context keeps
303
+ * its own network defaults byte for byte). Otherwise the transport's fetch
304
+ * and its bypass decision.
305
+ */
306
+ export function runtimeAppTransportContextFields(
307
+ transport: RuntimeAppTransport,
308
+ ): { fetch?: typeof fetch; vercelProtectionBypassToken?: string | null } {
309
+ return transport.kind === 'direct'
310
+ ? {}
311
+ : {
312
+ ...(transport.fetch ? { fetch: transport.fetch } : {}),
313
+ vercelProtectionBypassToken: transport.vercelProtectionBypassToken,
314
+ };
315
+ }
316
+
317
+ // ---------------------------------------------------------------------------
318
+ // Sandbox
319
+
320
+ let sandboxCredential: {
321
+ context: RuntimeGatewaySandboxContext;
322
+ currentToken: () => string | null;
323
+ } | null = null;
324
+
325
+ /**
326
+ * Sandbox runner entrypoint only: route this process's gateway traffic,
327
+ * global fetch and every `sandboxRuntimeAppFetch`-wrapped sender, through
328
+ * the credential. A no-op for unpinned runs. Returns a restore function.
329
+ */
330
+ export function installSandboxRuntimeAppTransport(
331
+ context: RuntimeGatewaySandboxContext,
332
+ env: Readonly<Record<string, string | undefined>> = process.env,
333
+ ): () => void {
334
+ const scope = context.runtimeGatewayCredentialScope;
335
+ if (!scope || !context.runtimeGatewayOidcToken) {
336
+ return () => undefined;
337
+ }
338
+ const filePath = env[RUNTIME_GATEWAY_OIDC_FILE_ENV] ?? null;
339
+ const installed = {
340
+ context,
341
+ currentToken: () =>
342
+ currentRuntimeGatewayOidcToken(context.runtimeGatewayOidcToken, filePath),
343
+ };
344
+ sandboxCredential = installed;
345
+ const original = globalThis.fetch;
346
+ globalThis.fetch = createRuntimeGatewayCredentialFetch({
347
+ scope,
348
+ send: original,
349
+ currentToken: installed.currentToken,
350
+ });
351
+ return () => {
352
+ globalThis.fetch = original;
353
+ if (sandboxCredential === installed) sandboxCredential = null;
354
+ };
355
+ }
356
+
357
+ /**
358
+ * Wrap a sender that does not go through the global fetch (the runner's
359
+ * `safeOutboundFetch`) so gateway requests carry the installed credential.
360
+ * Requests outside the pinned gateway, and every request on an unpinned run,
361
+ * pass through untouched.
362
+ */
363
+ export function sandboxRuntimeAppFetch(send: typeof fetch): typeof fetch {
364
+ return ((input, init) => {
365
+ const installed = sandboxCredential;
366
+ const scope = installed?.context.runtimeGatewayCredentialScope;
367
+ if (!installed || !scope) return send(input, init);
368
+ return createRuntimeGatewayCredentialFetch({
369
+ scope,
370
+ send,
371
+ currentToken: installed.currentToken,
372
+ })(input, init);
373
+ }) as typeof fetch;
374
+ }
@@ -190,10 +190,15 @@ export async function mintPlayRunAttemptRuntimeToken(input: {
190
190
  terminalContract?: DirectCompletedTerminalContract | null;
191
191
  capabilities?: readonly RuntimeExecutionCapability[];
192
192
  runtimeOrigin?: string | null;
193
+ /** Runtime gateway pin claims; both or neither. Absent on unpinned runs. */
194
+ runtimeGatewayDeploymentId?: string | null;
195
+ runtimeGatewayProfileId?: string | null;
193
196
  runLedgerIngressPrefixOrigin?: string | null;
194
197
  }): Promise<string> {
195
198
  return await mintWorkflowExecutorToken({
196
199
  ...runtimeAuthorityMintInput(input.descriptor, input),
200
+ runtimeGatewayDeploymentId: input.runtimeGatewayDeploymentId,
201
+ runtimeGatewayProfileId: input.runtimeGatewayProfileId,
197
202
  runLedgerIngressPrefixOrigin: input.runLedgerIngressPrefixOrigin,
198
203
  });
199
204
  }
@@ -1,4 +1,8 @@
1
1
  import { PLAY_RUNTIME_BACKENDS, type PlayRuntimeBackendId } from './backend';
2
+ import {
3
+ normalizeRuntimeGatewayProfileId,
4
+ type RuntimeGatewayProfileId,
5
+ } from './runtime-gateway-profile';
2
6
 
3
7
  export const PLAY_RUNTIME_ENVIRONMENTS = ['preview'] as const;
4
8
 
@@ -12,8 +16,21 @@ export type PlayRuntimeSelection = {
12
16
  backend?: Extract<PlayRuntimeBackendId, 'daytona' | 'modal'>;
13
17
  /** Durable placement contract for the selected Preview worker lane. */
14
18
  sandboxPlacementPolicy?: string;
19
+ /** Where this run's receipt/execution gateways are hosted. Absent: Fly. */
20
+ gatewayProfile?: RuntimeGatewayProfileId;
15
21
  };
16
22
 
23
+ /**
24
+ * Absent stays absent (undefined); a present value must name a known profile
25
+ * or the whole selector is invalid (null).
26
+ */
27
+ function selectedGatewayProfile(
28
+ value: unknown,
29
+ ): RuntimeGatewayProfileId | undefined | null {
30
+ if (value === undefined) return undefined;
31
+ return normalizeRuntimeGatewayProfileId(value) ?? null;
32
+ }
33
+
17
34
  const PLAY_RUNTIME_NAMESPACE_PATTERN = /^[a-z][a-z0-9-]{0,30}$/;
18
35
  const PLAY_RUNTIME_SANDBOX_PLACEMENT_POLICY_PATTERN =
19
36
  /^[a-z][a-z0-9_]*@[1-9][0-9]*$/;
@@ -51,12 +68,15 @@ export function normalizePlayRuntimeSelection(
51
68
  key !== 'environment' &&
52
69
  key !== 'namespace' &&
53
70
  key !== 'backend' &&
54
- key !== 'sandboxPlacementPolicy',
71
+ key !== 'sandboxPlacementPolicy' &&
72
+ key !== 'gatewayProfile',
55
73
  ) ||
56
74
  record.environment !== 'preview'
57
75
  ) {
58
76
  return null;
59
77
  }
78
+ const gatewayProfile = selectedGatewayProfile(record.gatewayProfile);
79
+ if (gatewayProfile === null) return null;
60
80
  const namespace = normalizePlayRuntimeNamespace(record.namespace);
61
81
  if (!namespace) return null;
62
82
  const sandboxPlacementPolicy =
@@ -83,6 +103,7 @@ export function normalizePlayRuntimeSelection(
83
103
  namespace,
84
104
  ...(record.backend === undefined ? {} : { backend: record.backend }),
85
105
  ...(sandboxPlacementPolicy ? { sandboxPlacementPolicy } : {}),
106
+ ...(gatewayProfile ? { gatewayProfile } : {}),
86
107
  };
87
108
  }
88
109
 
@@ -91,10 +112,18 @@ export function normalizePlayRuntimeSelection(
91
112
  * the `play_run.sandbox_placement` capability in
92
113
  * `@deepline/auth/internal-capabilities` decides who may send it.
93
114
  */
94
- export type PlayNativeRuntimeSelection = {
95
- environment: 'native';
96
- sandboxPlacementPolicy: string;
97
- };
115
+ export type PlayNativeRuntimeSelection =
116
+ | {
117
+ environment: 'native';
118
+ sandboxPlacementPolicy: string;
119
+ gatewayProfile?: RuntimeGatewayProfileId;
120
+ }
121
+ | {
122
+ environment: 'native';
123
+ sandboxPlacementPolicy?: undefined;
124
+ /** A native selection names at least one of the two. */
125
+ gatewayProfile: RuntimeGatewayProfileId;
126
+ };
98
127
 
99
128
  /** Every `runtime` value a Play run accepts. */
100
129
  export type PlayRunRuntimeSelection =
@@ -111,17 +140,28 @@ export function normalizePlayRunRuntimeSelection(
111
140
  }
112
141
  if (
113
142
  Object.keys(record).some(
114
- (key) => key !== 'environment' && key !== 'sandboxPlacementPolicy',
143
+ (key) =>
144
+ key !== 'environment' &&
145
+ key !== 'sandboxPlacementPolicy' &&
146
+ key !== 'gatewayProfile',
115
147
  )
116
148
  ) {
117
149
  return null;
118
150
  }
151
+ const gatewayProfile = selectedGatewayProfile(record.gatewayProfile);
152
+ if (gatewayProfile === null) return null;
153
+ if (record.sandboxPlacementPolicy === undefined) {
154
+ return gatewayProfile ? { environment: 'native', gatewayProfile } : null;
155
+ }
119
156
  const sandboxPlacementPolicy = normalizePlayRuntimeSandboxPlacementPolicy(
120
157
  record.sandboxPlacementPolicy,
121
158
  );
122
- return sandboxPlacementPolicy
123
- ? { environment: 'native', sandboxPlacementPolicy }
124
- : null;
159
+ if (!sandboxPlacementPolicy) return null;
160
+ return {
161
+ environment: 'native',
162
+ sandboxPlacementPolicy,
163
+ ...(gatewayProfile ? { gatewayProfile } : {}),
164
+ };
125
165
  }
126
166
 
127
167
  export function normalizePlayRuntimeEnvironment(
@@ -7,6 +7,7 @@ import {
7
7
  type KeyObject,
8
8
  } from 'node:crypto';
9
9
  import { isRuntimeGatewayDeploymentId } from './runtime-gateway-profile';
10
+ import { isRuntimeScopeRunId } from './run-identity';
10
11
  import { isTestOnlyRuntime } from './runtime-env';
11
12
 
12
13
  /**
@@ -114,6 +115,30 @@ export function resolveRuntimeGatewayOidcEnvironment(): RuntimeGatewayOidcEnviro
114
115
  return isTestOnlyRuntime() ? 'preview' : 'production';
115
116
  }
116
117
 
118
+ /**
119
+ * The environment a signing key was published for, or null for an unpublished
120
+ * kid. A signer takes its environment from its own key: a Fly worker's
121
+ * `NODE_ENV` is inlined when its bundle is built, so the process test above
122
+ * reads "preview" there even in Production. The verifier is unaffected: a
123
+ * deployment still accepts only its own environment's kids and claim, so a
124
+ * Preview key cannot produce a credential Production accepts.
125
+ */
126
+ export function runtimeGatewayOidcEnvironmentForKid(
127
+ kid: string,
128
+ trust: RuntimeGatewayOidcTrust = RUNTIME_GATEWAY_OIDC_TRUST,
129
+ ): RuntimeGatewayOidcEnvironment | null {
130
+ const environments = (['production', 'preview'] as const).filter(
131
+ (environment) => trust.environmentKids[environment].includes(kid),
132
+ );
133
+ if (environments.length > 1) {
134
+ throw new RuntimeGatewayOidcError(
135
+ 'signing_key_not_published',
136
+ `Runtime gateway OIDC key id "${kid}" is published for both environments; every kid must belong to exactly one.`,
137
+ );
138
+ }
139
+ return environments[0] ?? null;
140
+ }
141
+
117
142
  /** Key material a caller trusts; defaults to the code-owned constants. */
118
143
  export type RuntimeGatewayOidcTrust = Readonly<{
119
144
  jwks: Readonly<{ keys: readonly RuntimeGatewayOidcPublicJwk[] }>;
@@ -206,6 +231,27 @@ function rsaPrivateKey(signingKey: RuntimeGatewayOidcSigningKey): KeyObject {
206
231
  return key;
207
232
  }
208
233
 
234
+ /**
235
+ * Parsed verification keys, by key material. Every app-gateway request
236
+ * verifies one credential; parsing the JWK into a KeyObject each time was
237
+ * per-request work. Bounded by the published (and, in tests, test) keys.
238
+ */
239
+ const publicKeyObjects = new Map<string, KeyObject>();
240
+ const PUBLIC_KEY_OBJECT_CACHE_MAX = 32;
241
+
242
+ function publicKeyObject(jwk: RuntimeGatewayOidcPublicJwk): KeyObject {
243
+ const cacheKey = `${jwk.kid}\u0000${jwk.n}\u0000${jwk.e}`;
244
+ let key = publicKeyObjects.get(cacheKey);
245
+ if (!key) {
246
+ key = createPublicKey({ key: jwk as JsonWebKey, format: 'jwk' });
247
+ if (publicKeyObjects.size >= PUBLIC_KEY_OBJECT_CACHE_MAX) {
248
+ publicKeyObjects.delete(publicKeyObjects.keys().next().value!);
249
+ }
250
+ publicKeyObjects.set(cacheKey, key);
251
+ }
252
+ return key;
253
+ }
254
+
209
255
  function encodeSegment(value: object): string {
210
256
  return Buffer.from(JSON.stringify(value)).toString('base64url');
211
257
  }
@@ -244,14 +290,14 @@ export function mintRuntimeGatewayOidcToken(input: {
244
290
  runId: string;
245
291
  attempt: number;
246
292
  nowMs: number;
247
- /** Defaults to this process's environment. */
293
+ /** Defaults to the environment the signing key is published for. */
248
294
  environment?: RuntimeGatewayOidcEnvironment;
249
295
  /** Defaults to the code-owned keys. */
250
296
  trust?: RuntimeGatewayOidcTrust;
251
297
  }): string {
252
298
  if (
253
299
  !isRuntimeGatewayDeploymentId(input.deploymentId) ||
254
- !input.runId.trim() ||
300
+ !isRuntimeScopeRunId(input.runId) ||
255
301
  !Number.isSafeInteger(input.attempt) ||
256
302
  input.attempt < 0 ||
257
303
  !Number.isFinite(input.nowMs)
@@ -261,15 +307,13 @@ export function mintRuntimeGatewayOidcToken(input: {
261
307
  'Runtime gateway OIDC claims are invalid.',
262
308
  );
263
309
  }
310
+ const trust = input.trust ?? RUNTIME_GATEWAY_OIDC_TRUST;
264
311
  const environment =
265
- input.environment ?? resolveRuntimeGatewayOidcEnvironment();
312
+ input.environment ??
313
+ runtimeGatewayOidcEnvironmentForKid(input.signingKey.kid, trust) ??
314
+ resolveRuntimeGatewayOidcEnvironment();
266
315
  const key = rsaPrivateKey(input.signingKey);
267
- assertSigningKeyPublished(
268
- input.signingKey,
269
- key,
270
- environment,
271
- input.trust ?? RUNTIME_GATEWAY_OIDC_TRUST,
272
- );
316
+ assertSigningKeyPublished(input.signingKey, key, environment, trust);
273
317
  const iat = Math.floor(input.nowMs / 1_000);
274
318
  const claims: RuntimeGatewayOidcClaims = {
275
319
  iss: RUNTIME_GATEWAY_OIDC_ISSUER,
@@ -327,7 +371,7 @@ function isClaimsShape(
327
371
  typeof claims.aud === 'string' &&
328
372
  typeof claims.sub === 'string' &&
329
373
  typeof claims.deployment_id === 'string' &&
330
- typeof claims.run_id === 'string' &&
374
+ isRuntimeScopeRunId(claims.run_id) &&
331
375
  Number.isSafeInteger(claims.run_attempt) &&
332
376
  (claims.deepline_env === 'preview' ||
333
377
  claims.deepline_env === 'production') &&
@@ -399,7 +443,7 @@ export function verifyRuntimeGatewayOidcToken(
399
443
  signatureValid = verify(
400
444
  'RSA-SHA256',
401
445
  Buffer.from(`${headerPart}.${claimsPart}`),
402
- createPublicKey({ key: jwk as JsonWebKey, format: 'jwk' }),
446
+ publicKeyObject(jwk),
403
447
  Buffer.from(signaturePart, 'base64url'),
404
448
  );
405
449
  } catch {
@@ -19,7 +19,18 @@ export type RuntimeGatewayProfile = Readonly<{
19
19
  hosting: 'admitting_app_deployment';
20
20
  receiptPath: '/api/receipt';
21
21
  executionPath: '/api/execution';
22
- /** Oldest pin a new attempt or resumed sandbox may still use. */
22
+ /**
23
+ * Oldest pin a new attempt or resumed sandbox may still use.
24
+ *
25
+ * Contract (`vercel_app@1`: 6 hours): the pin is checked only when an
26
+ * attempt starts or a sandbox resumes, never while one runs, so it must
27
+ * outlive the longest single attempt. A pinned run resumed or retried more
28
+ * than 6 hours after it was pinned (a long durable wait, a late retry)
29
+ * fails loudly with `runtime_gateway_pin_expired` instead of running on a
30
+ * deployment that may be gone; the Play must be re-run. The profile is
31
+ * Preview-only today. Enabling it in Production must revisit this bound
32
+ * against Production wait and retry horizons.
33
+ */
23
34
  maxPinAgeMs: number;
24
35
  /** Scheduler Postgres clients one gateway function instance may hold. */
25
36
  poolMaxClients: number;