deepline 0.3.519 → 0.3.521

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 (186) hide show
  1. package/dist/bundling-sources/sdk/src/plays/client-core.ts +16 -45
  2. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  3. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +0 -18
  4. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +0 -155
  5. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +160 -2
  6. package/dist/bundling-sources/shared_libs/play-runtime/execute-server-timing.ts +22 -0
  7. package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +24 -0
  8. package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +1 -54
  9. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +2 -7
  10. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +0 -13
  11. package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +0 -56
  12. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +10 -21
  13. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +1 -1
  14. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +2 -1
  15. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +1 -1
  16. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +2 -37
  17. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +3 -74
  18. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-runtime-watchdog.ts +2 -226
  19. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +3 -36
  20. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +0 -26
  21. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +1 -9
  22. package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +0 -5
  23. package/dist/bundling-sources/shared_libs/play-runtime/runtime-environment.ts +9 -49
  24. package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-oidc.ts +11 -447
  25. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +5 -4
  26. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +12 -207
  27. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +3 -17
  28. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-progress-registry.ts +0 -9
  29. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +2 -18
  30. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +15 -175
  31. package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +0 -4
  32. package/dist/cli/{artifacts-YRKH7KNC.js → artifacts-JGH464N2.js} +20 -20
  33. package/dist/cli/{artifacts-ZZULJ6X5.mjs → artifacts-TYPU37IU.mjs} +8 -8
  34. package/dist/cli/auth-JWR3VSNT.js +43 -0
  35. package/dist/cli/{auth-WU2BDO3T.mjs → auth-XPQT6NUB.mjs} +5 -5
  36. package/dist/cli/{billing-DG62VVXW.mjs → billing-47AMHOMP.mjs} +8 -8
  37. package/dist/cli/{billing-MUMMBMQK.js → billing-6D4KXBFJ.js} +81 -81
  38. package/dist/cli/{chunk-R3OAKFHJ.mjs → chunk-2DQPB5HT.mjs} +5 -5
  39. package/dist/cli/{chunk-6Y3DDRRN.js → chunk-2KHUFWTK.js} +3 -3
  40. package/dist/cli/{chunk-XUCAH3LN.js → chunk-3Q7HEEH2.js} +10 -10
  41. package/dist/cli/{chunk-MI5DKOBD.mjs → chunk-4DB6JV7X.mjs} +2 -2
  42. package/dist/cli/{chunk-J4X4RNSP.mjs → chunk-4GGXAYKI.mjs} +3 -3
  43. package/dist/cli/{chunk-AXA5DFY5.mjs → chunk-4I7I5CGB.mjs} +1 -1
  44. package/dist/cli/{chunk-I3ICKVYH.js → chunk-4MN65FRF.js} +53 -53
  45. package/dist/cli/{chunk-Y7D6L4M7.mjs → chunk-4MONKWYE.mjs} +5 -5
  46. package/dist/cli/{chunk-3CUIIVGR.mjs → chunk-5T7QKHQL.mjs} +1 -1
  47. package/dist/cli/{chunk-UMPHUAGZ.js → chunk-6DCBTJZP.js} +3 -3
  48. package/dist/cli/{chunk-LKYLIZ5X.js → chunk-6N72GHAV.js} +2 -2
  49. package/dist/cli/{chunk-RHQKDHCX.mjs → chunk-6UHYXNCP.mjs} +2 -2
  50. package/dist/cli/{chunk-RU5JRQKJ.mjs → chunk-6V2RI3AL.mjs} +3 -3
  51. package/dist/cli/{chunk-NIJE62ZD.mjs → chunk-7AUXX6M5.mjs} +1 -1
  52. package/dist/cli/{chunk-NH22WUUG.mjs → chunk-7IYDCHTG.mjs} +2 -2
  53. package/dist/cli/{chunk-FEJKDR67.mjs → chunk-7LRALARF.mjs} +1 -1
  54. package/dist/cli/{chunk-N3LUYBOB.mjs → chunk-A2B5AAU3.mjs} +11 -11
  55. package/dist/cli/{chunk-CRE3OGHH.mjs → chunk-A6USUS4L.mjs} +2 -2
  56. package/dist/cli/{chunk-ZQ23WQP3.js → chunk-AMVKLEPH.js} +2 -2
  57. package/dist/cli/{chunk-RQ2BHYUM.mjs → chunk-CBBCUYIN.mjs} +2 -2
  58. package/dist/cli/{chunk-CBMTBMIJ.mjs → chunk-DQURY3WH.mjs} +1 -1
  59. package/dist/cli/{chunk-EMV6EHK2.js → chunk-DY6634MN.js} +14 -14
  60. package/dist/cli/{chunk-5A2SIIPH.mjs → chunk-E4ZS2B2J.mjs} +1 -1
  61. package/dist/cli/{chunk-BQYXIAJM.js → chunk-EILHJRPW.js} +3 -3
  62. package/dist/cli/{chunk-RQDD2VV3.js → chunk-EW3EAEWZ.js} +5 -5
  63. package/dist/cli/{chunk-A7W3CCU5.mjs → chunk-EZNZDOAG.mjs} +5 -5
  64. package/dist/cli/{chunk-HT675XNR.mjs → chunk-FKD3KL5Q.mjs} +1 -1
  65. package/dist/cli/{chunk-FJAGGBDR.mjs → chunk-FQJFONFT.mjs} +59 -90
  66. package/dist/cli/{chunk-C7ZD4LXZ.js → chunk-FTZX4QZN.js} +2 -2
  67. package/dist/cli/{chunk-F6XD4CRW.js → chunk-GNYSODBR.js} +1 -1
  68. package/dist/cli/{chunk-4PWBHYH4.js → chunk-HD3KYCDC.js} +7 -7
  69. package/dist/cli/{chunk-IMIHYCJ5.mjs → chunk-HHBJJYKL.mjs} +5 -5
  70. package/dist/cli/{chunk-YRU46P7H.mjs → chunk-HRWVEIAX.mjs} +1 -1
  71. package/dist/cli/{chunk-TT2XB433.js → chunk-HSFLMTED.js} +4 -4
  72. package/dist/cli/{chunk-E6YWCXII.js → chunk-JFQJNYTB.js} +16 -16
  73. package/dist/cli/{chunk-XBS4RDKU.js → chunk-LGU2NIOT.js} +98 -98
  74. package/dist/cli/{chunk-SBF4K3QF.mjs → chunk-LNBMEFOI.mjs} +4 -4
  75. package/dist/cli/{chunk-G2QD575P.js → chunk-MD43YAL6.js} +6 -6
  76. package/dist/cli/{chunk-S7R4O62I.js → chunk-MRU4N33M.js} +6 -6
  77. package/dist/cli/{chunk-UB2REJPL.mjs → chunk-NNDAVVBG.mjs} +2 -2
  78. package/dist/cli/{chunk-ORNLTNBN.js → chunk-PUKWFJXW.js} +44 -44
  79. package/dist/cli/{chunk-O655PVT4.js → chunk-QGTWGHYD.js} +88 -119
  80. package/dist/cli/{chunk-AL7FDMD6.mjs → chunk-TBIWR7M2.mjs} +1 -1
  81. package/dist/cli/{chunk-PK6VYYEY.js → chunk-UAZKOH3J.js} +5 -5
  82. package/dist/cli/{chunk-BMCRTI6Z.mjs → chunk-UBKA33KY.mjs} +1 -22
  83. package/dist/cli/{chunk-4ECU5DI3.js → chunk-ULW2KBKL.js} +26 -26
  84. package/dist/cli/{chunk-52DFTRVC.js → chunk-VSH3AE5E.js} +16 -16
  85. package/dist/cli/{chunk-P62S3ZMS.js → chunk-VYY5V4M5.js} +11 -11
  86. package/dist/cli/{chunk-HXPHRSNM.js → chunk-WL6WPW6X.js} +14 -14
  87. package/dist/cli/{chunk-WSGXBROE.js → chunk-XDVT3GOM.js} +1 -22
  88. package/dist/cli/{chunk-GO467AXG.js → chunk-Y23TOHNV.js} +41 -41
  89. package/dist/cli/{chunk-FTJ2D3XD.mjs → chunk-Y7IR4LBU.mjs} +3 -3
  90. package/dist/cli/{chunk-25WXWSFS.js → chunk-YROP3H6T.js} +22 -22
  91. package/dist/cli/{chunk-HKKC7J6K.mjs → chunk-ZO2XJVFH.mjs} +6 -6
  92. package/dist/cli/{csv-BKWIYPMK.js → csv-5TM2OSYP.js} +13 -13
  93. package/dist/cli/{csv-3TUJHAOW.mjs → csv-PM3WDXDF.mjs} +4 -4
  94. package/dist/cli/{db-EJMJDKDA.js → db-3LJ32FZM.js} +29 -29
  95. package/dist/cli/{db-I75IQ7XI.mjs → db-5P72NPRL.mjs} +8 -8
  96. package/dist/cli/describe-GRS3IRSX.js +50 -0
  97. package/dist/cli/{describe-RUFLLRIN.mjs → describe-ZLCMBGHG.mjs} +20 -20
  98. package/dist/cli/describe-core.d.mts +2 -2
  99. package/dist/cli/describe-core.d.ts +2 -2
  100. package/dist/cli/{executions-TQJCMUUG.js → executions-4AJ5TQVY.js} +10 -10
  101. package/dist/cli/{executions-VW3MYJEE.mjs → executions-JMFL6AV7.mjs} +8 -8
  102. package/dist/cli/{feedback-76342G7E.mjs → feedback-DKMG2QB7.mjs} +5 -5
  103. package/dist/cli/{feedback-UFAEXH5B.js → feedback-I2BLXMGH.js} +10 -10
  104. package/dist/cli/git-2LNT43A2.js +25 -0
  105. package/dist/cli/{git-L5XKAODI.mjs → git-ARG223MY.mjs} +5 -5
  106. package/dist/cli/index.js +141 -141
  107. package/dist/cli/index.mjs +43 -43
  108. package/dist/cli/{legacy-noops-DKAZ7JG3.mjs → legacy-noops-24LOAOZN.mjs} +6 -6
  109. package/dist/cli/{legacy-noops-DM66YISP.js → legacy-noops-N7SVA7PL.js} +9 -9
  110. package/dist/cli/{monitors-QXEJI54B.mjs → monitors-RYQFWM2T.mjs} +9 -9
  111. package/dist/cli/{monitors-NKDIH4TY.js → monitors-XNCYLOJM.js} +102 -102
  112. package/dist/cli/{org-NKIIBUNO.js → org-I33TKZXF.js} +74 -74
  113. package/dist/cli/{org-KZQCVREB.mjs → org-ORIH56E5.mjs} +8 -8
  114. package/dist/cli/{pages-UJUFCJEL.js → pages-2UXXGIMF.js} +20 -20
  115. package/dist/cli/{pages-E7IT5SWT.mjs → pages-ME43HSBL.mjs} +8 -8
  116. package/dist/cli/{play-SPI5MO67.js → play-F4QOFU37.js} +338 -338
  117. package/dist/cli/{play-AKL5E2DF.mjs → play-XEKNY46M.mjs} +21 -21
  118. package/dist/cli/{providers-4NVQ3FSC.js → providers-E7DPCBNX.js} +11 -11
  119. package/dist/cli/{providers-6HSSVI74.mjs → providers-XKU44G74.mjs} +8 -8
  120. package/dist/cli/{quickstart-FEQD7S4Z.js → quickstart-ICLF2F6A.js} +6 -6
  121. package/dist/cli/{quickstart-EHLEHSMI.mjs → quickstart-J7NVEXV5.mjs} +4 -4
  122. package/dist/cli/{run-GH6ECTJF.js → run-HJMHUQBN.js} +43 -43
  123. package/dist/cli/{run-IWVM7BD6.mjs → run-MQ5ZONGL.mjs} +25 -25
  124. package/dist/cli/run-identity-G257GQED.js +25 -0
  125. package/dist/cli/{run-identity-MNRZS2N3.mjs → run-identity-MRNCEGV2.mjs} +3 -9
  126. package/dist/cli/{search-X4CDMN7J.mjs → search-GGRC77CV.mjs} +10 -10
  127. package/dist/cli/search-V6IBJ4TX.js +33 -0
  128. package/dist/cli/{search-output-IIYMGZTQ.js → search-output-MXZTZI2P.js} +6 -6
  129. package/dist/cli/{search-output-PJ7N5WUQ.mjs → search-output-NY4GDBRU.mjs} +4 -4
  130. package/dist/cli/{secrets-4YPMC7XZ.mjs → secrets-FA37G4Q2.mjs} +8 -8
  131. package/dist/cli/{secrets-QPP2FXID.js → secrets-PFESG72B.js} +17 -17
  132. package/dist/cli/{sessions-BEOI47VZ.mjs → sessions-BLLXPETU.mjs} +6 -6
  133. package/dist/cli/sessions-DNFTQOQH.js +18 -0
  134. package/dist/cli/{settings-FZDONKPW.js → settings-32VPG4Z2.js} +88 -88
  135. package/dist/cli/{settings-VHULXNY3.mjs → settings-U26S7MPH.mjs} +15 -15
  136. package/dist/cli/{setup-5IV3NHGD.mjs → setup-4AXBCX7C.mjs} +10 -10
  137. package/dist/cli/{setup-LZ6IN5JS.js → setup-R6NSENH7.js} +50 -50
  138. package/dist/cli/skills-G4ZE3OS5.js +37 -0
  139. package/dist/cli/{skills-FZAFBW5J.mjs → skills-JUH7AVUL.mjs} +8 -8
  140. package/dist/cli/tools-27LHZFJD.js +57 -0
  141. package/dist/cli/{tools-TLBH3RFK.mjs → tools-FOYLU3FH.mjs} +19 -19
  142. package/dist/cli/{update-KPLIZYOV.mjs → update-FUVX22VM.mjs} +10 -10
  143. package/dist/cli/update-KNZ7N242.js +35 -0
  144. package/dist/cli/{workflow-ACHPT3DD.js → workflow-JACZW4GJ.js} +19 -19
  145. package/dist/cli/{workflow-GYJOYYWK.mjs → workflow-QLT22BLT.mjs} +9 -9
  146. package/dist/{client-CswZYCGj.d.ts → client-B-2Am2y6.d.ts} +1 -1
  147. package/dist/{client-CpSiHSti.d.mts → client-DA71-2_u.d.mts} +1 -1
  148. package/dist/{client-core-C1xVOg8Y.d.mts → client-core-BXbds1cb.d.mts} +1 -20
  149. package/dist/{client-core-D2pLt36Q.d.ts → client-core-C0IzDKMJ.d.ts} +1 -20
  150. package/dist/index.d.mts +3 -3
  151. package/dist/index.d.ts +3 -3
  152. package/dist/index.js +19 -19
  153. package/dist/index.mjs +8 -8
  154. package/dist/install-integrity.json +114 -122
  155. package/dist/plays/play-description.d.mts +1 -1
  156. package/dist/plays/play-description.d.ts +1 -1
  157. package/dist/plays/run-request.d.mts +1 -1
  158. package/dist/plays/run-request.d.ts +1 -1
  159. package/dist/plays/run-request.js +3 -3
  160. package/dist/plays/run-request.mjs +2 -2
  161. package/dist/release.d.mts +1 -1
  162. package/dist/release.d.ts +1 -1
  163. package/dist/release.js +2 -2
  164. package/dist/release.mjs +1 -1
  165. package/dist/server.d.mts +2 -2
  166. package/dist/server.d.ts +2 -2
  167. package/dist/server.js +7 -7
  168. package/dist/server.mjs +5 -5
  169. package/package.json +1 -1
  170. package/dist/bundling-sources/shared_libs/play-runtime/runtime-app-transport.ts +0 -374
  171. package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-egress.ts +0 -55
  172. package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-profile.ts +0 -329
  173. package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-sandbox-credential.ts +0 -338
  174. package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-staging.ts +0 -417
  175. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-attempt.ts +0 -81
  176. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-staging-journal.ts +0 -708
  177. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-staging-teardown.ts +0 -160
  178. package/dist/cli/auth-DF6WJLN2.js +0 -43
  179. package/dist/cli/describe-EAK3MPTG.js +0 -50
  180. package/dist/cli/git-OOCPCIGZ.js +0 -25
  181. package/dist/cli/run-identity-HFYABUJS.js +0 -31
  182. package/dist/cli/search-NIRYA3VL.js +0 -33
  183. package/dist/cli/sessions-5I2IFTW7.js +0 -18
  184. package/dist/cli/skills-WJWLFSHI.js +0 -37
  185. package/dist/cli/tools-SH35NRGU.js +0 -57
  186. package/dist/cli/update-MA46YSGR.js +0 -35
@@ -1,57 +1,19 @@
1
- import {
2
- createPrivateKey,
3
- createPublicKey,
4
- sign,
5
- verify,
6
- type JsonWebKey,
7
- type KeyObject,
8
- } from 'node:crypto';
9
- import { isRuntimeGatewayDeploymentId } from './runtime-gateway-profile';
10
- import { isRuntimeScopeRunId } from './run-identity';
11
- import { isTestOnlyRuntime } from './runtime-env';
1
+ import type { JsonWebKey } from 'node:crypto';
12
2
 
13
3
  /**
14
- * Edge credential for sandbox -> pinned app-deployment gateway traffic.
15
- *
16
- * One durable, code-owned issuer signs short-lived RS256 tokens scoped to one
17
- * deployment, run and attempt. Vercel Trusted Sources admits the request at
18
- * the edge from `x-vercel-trusted-oidc-idp-token`; the gateway handler checks
19
- * the same token from `x-deepline-runtime-oidc` against the exact run and
20
- * deployment. The executor token remains the request's authorization.
21
- *
22
- * Preview and Production never accept each other's tokens. Every token
23
- * carries `deepline_env`; each environment signs with and trusts only its
24
- * own kids, and verification requires the deployment's own environment in
25
- * both the kid and the claim. The published JWKS is the union of both
26
- * environments' keys, so one issuer serves both.
4
+ * Retired Runtime gateway OIDC issuer: discovery document and public keys
5
+ * only. The `vercel_app@1` gateway profile that signed tokens for it was
6
+ * removed. The issuer stays published, inert, because Vercel Trusted Sources
7
+ * on the deepline-api project still lists it and must be removed by the
8
+ * owner first; deleting these routes earlier would only break that entry's
9
+ * discovery fetch. Nothing signs or verifies a token any more. Delete this
10
+ * file, the two routes under `src/app/runtime-gateway-oidc`, the
11
+ * `runtime-gateway-oidc` legacy-redirect preserve prefix and their test once
12
+ * the Trusted Sources entries are gone.
27
13
  */
28
14
  export const RUNTIME_GATEWAY_OIDC_ISSUER =
29
15
  'https://code.deepline.com/runtime-gateway-oidc';
30
- export const RUNTIME_GATEWAY_OIDC_SUBJECT = 'deepline:runtime-gateway:daytona';
31
- export const RUNTIME_GATEWAY_OIDC_AUDIENCE = 'deepline:runtime-gateway';
32
- export const RUNTIME_GATEWAY_OIDC_MAX_AGE_SECONDS = 15 * 60;
33
- export const RUNTIME_GATEWAY_OIDC_RENEW_AFTER_SECONDS = 2 * 60;
34
- /** Appended to the pinned receipt gateway base URL. */
35
- export const RUNTIME_GATEWAY_OIDC_RENEW_PATH = '/renew-oidc';
36
- /** Header Vercel Trusted Sources reads at the edge. */
37
- export const RUNTIME_GATEWAY_OIDC_EDGE_HEADER =
38
- 'x-vercel-trusted-oidc-idp-token';
39
- /** Header the app verifies, independent of edge header handling. */
40
- export const RUNTIME_GATEWAY_OIDC_APP_HEADER = 'x-deepline-runtime-oidc';
41
- export const RUNTIME_GATEWAY_OIDC_DISCOVERY_PATH =
42
- '/.well-known/openid-configuration';
43
16
  export const RUNTIME_GATEWAY_OIDC_JWKS_PATH = '/.well-known/jwks.json';
44
- /** Secret env (base64 DER PKCS#8 RSA key) and its key id. */
45
- export const RUNTIME_GATEWAY_OIDC_PRIVATE_KEY_ENV =
46
- 'DEEPLINE_RUNTIME_GATEWAY_OIDC_PRIVATE_KEY';
47
- export const RUNTIME_GATEWAY_OIDC_KID_ENV = 'DEEPLINE_RUNTIME_GATEWAY_OIDC_KID';
48
- /** Sandbox-local file the watchdog rewrites with each renewed token. */
49
- export const RUNTIME_GATEWAY_OIDC_FILE_ENV =
50
- 'DEEPLINE_RUNTIME_GATEWAY_OIDC_FILE';
51
- /** Renewal response body field. */
52
- export const RUNTIME_GATEWAY_OIDC_RENEW_RESPONSE_FIELD = 'oidcToken';
53
- const RUNTIME_GATEWAY_OIDC_MAX_TOKEN_LENGTH = 4_096;
54
- const RUNTIME_GATEWAY_OIDC_CLOCK_SKEW_SECONDS = 30;
55
17
 
56
18
  export type RuntimeGatewayOidcPublicJwk = JsonWebKey & {
57
19
  kty: 'RSA';
@@ -62,11 +24,7 @@ export type RuntimeGatewayOidcPublicJwk = JsonWebKey & {
62
24
  e: string;
63
25
  };
64
26
 
65
- /**
66
- * Public keys trusted for verification. Rotation: add the new key first and
67
- * keep the previous one until every token it signed has expired (15 min),
68
- * then switch the signing secret, then remove the previous key.
69
- */
27
+ /** Public keys of the retired issuer, served unchanged while the entry lasts. */
70
28
  export const RUNTIME_GATEWAY_OIDC_PUBLIC_JWKS: Readonly<{
71
29
  keys: readonly RuntimeGatewayOidcPublicJwk[];
72
30
  }> = Object.freeze({
@@ -90,390 +48,6 @@ export const RUNTIME_GATEWAY_OIDC_PUBLIC_JWKS: Readonly<{
90
48
  ]),
91
49
  });
92
50
 
93
- /** Which deployment class signs or accepts a token. */
94
- export type RuntimeGatewayOidcEnvironment = 'preview' | 'production';
95
-
96
- /**
97
- * The published kids each environment may sign with and accept. Disjoint, so
98
- * a Preview private key can never produce a token a Production deployment
99
- * accepts, and the reverse. Rotation adds the new kid to its environment
100
- * here and to the JWKS above in the same change.
101
- */
102
- export const RUNTIME_GATEWAY_OIDC_ENVIRONMENT_KIDS: Readonly<
103
- Record<RuntimeGatewayOidcEnvironment, readonly string[]>
104
- > = Object.freeze({
105
- production: Object.freeze(['rgw-oidc-2026-11-10']),
106
- preview: Object.freeze(['rgw-oidc-preview-2026-11-10']),
107
- });
108
-
109
- /**
110
- * This process's environment, from the same canonical test the internal
111
- * capabilities use (`isTestOnlyRuntime`): anything that is not Production is
112
- * Preview for this credential.
113
- */
114
- export function resolveRuntimeGatewayOidcEnvironment(): RuntimeGatewayOidcEnvironment {
115
- return isTestOnlyRuntime() ? 'preview' : 'production';
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
-
142
- /** Key material a caller trusts; defaults to the code-owned constants. */
143
- export type RuntimeGatewayOidcTrust = Readonly<{
144
- jwks: Readonly<{ keys: readonly RuntimeGatewayOidcPublicJwk[] }>;
145
- environmentKids: Readonly<
146
- Record<RuntimeGatewayOidcEnvironment, readonly string[]>
147
- >;
148
- }>;
149
-
150
- export const RUNTIME_GATEWAY_OIDC_TRUST: RuntimeGatewayOidcTrust =
151
- Object.freeze({
152
- jwks: RUNTIME_GATEWAY_OIDC_PUBLIC_JWKS,
153
- environmentKids: RUNTIME_GATEWAY_OIDC_ENVIRONMENT_KIDS,
154
- });
155
-
156
- function environmentJwk(
157
- trust: RuntimeGatewayOidcTrust,
158
- environment: RuntimeGatewayOidcEnvironment,
159
- kid: string,
160
- ): RuntimeGatewayOidcPublicJwk | null {
161
- if (!trust.environmentKids[environment].includes(kid)) return null;
162
- return trust.jwks.keys.find((candidate) => candidate.kid === kid) ?? null;
163
- }
164
-
165
- export type RuntimeGatewayOidcClaims = {
166
- iss: string;
167
- aud: string;
168
- sub: string;
169
- deployment_id: string;
170
- run_id: string;
171
- run_attempt: number;
172
- deepline_env: RuntimeGatewayOidcEnvironment;
173
- iat: number;
174
- exp: number;
175
- };
176
-
177
- export type RuntimeGatewayOidcSigningKey = Readonly<{
178
- kid: string;
179
- /** Base64 DER PKCS#8 RSA private key. */
180
- privateKeyPkcs8Base64: string;
181
- }>;
182
-
183
- export class RuntimeGatewayOidcError extends Error {
184
- constructor(
185
- readonly code:
186
- | 'signing_key_unavailable'
187
- | 'signing_key_invalid'
188
- | 'signing_key_not_published'
189
- | 'claims_invalid',
190
- message: string,
191
- ) {
192
- super(message);
193
- this.name = 'RuntimeGatewayOidcError';
194
- }
195
- }
196
-
197
- /** Read the secret signing key. Missing or partial configuration is null. */
198
- export function resolveRuntimeGatewayOidcSigningKey(
199
- env: Readonly<Record<string, string | undefined>>,
200
- ): RuntimeGatewayOidcSigningKey | null {
201
- const privateKeyPkcs8Base64 =
202
- env[RUNTIME_GATEWAY_OIDC_PRIVATE_KEY_ENV]?.trim();
203
- const kid = env[RUNTIME_GATEWAY_OIDC_KID_ENV]?.trim();
204
- if (!privateKeyPkcs8Base64 || !kid) return null;
205
- return { kid, privateKeyPkcs8Base64 };
206
- }
207
-
208
- function rsaPrivateKey(signingKey: RuntimeGatewayOidcSigningKey): KeyObject {
209
- let key: KeyObject;
210
- try {
211
- key = createPrivateKey({
212
- key: Buffer.from(signingKey.privateKeyPkcs8Base64, 'base64'),
213
- format: 'der',
214
- type: 'pkcs8',
215
- });
216
- } catch {
217
- throw new RuntimeGatewayOidcError(
218
- 'signing_key_invalid',
219
- 'Runtime gateway OIDC signing key is not a PKCS#8 private key.',
220
- );
221
- }
222
- if (
223
- key.asymmetricKeyType !== 'rsa' ||
224
- (key.asymmetricKeyDetails?.modulusLength ?? 0) < 2048
225
- ) {
226
- throw new RuntimeGatewayOidcError(
227
- 'signing_key_invalid',
228
- 'Runtime gateway OIDC signing key must be RSA with at least 2048 bits.',
229
- );
230
- }
231
- return key;
232
- }
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
-
255
- function encodeSegment(value: object): string {
256
- return Buffer.from(JSON.stringify(value)).toString('base64url');
257
- }
258
-
259
- /**
260
- * Refuse to sign unless `kid` is published for this environment and the
261
- * private key's public half is exactly that published key. A wrong or
262
- * stale secret fails here, loudly, instead of minting tokens every gateway
263
- * rejects.
264
- */
265
- function assertSigningKeyPublished(
266
- signingKey: RuntimeGatewayOidcSigningKey,
267
- key: KeyObject,
268
- environment: RuntimeGatewayOidcEnvironment,
269
- trust: RuntimeGatewayOidcTrust,
270
- ): void {
271
- const published = environmentJwk(trust, environment, signingKey.kid);
272
- if (!published) {
273
- throw new RuntimeGatewayOidcError(
274
- 'signing_key_not_published',
275
- `${RUNTIME_GATEWAY_OIDC_KID_ENV} "${signingKey.kid}" is not a published ${environment} Runtime gateway OIDC key id (published for ${environment}: ${trust.environmentKids[environment].join(', ') || 'none'}).`,
276
- );
277
- }
278
- const derived = createPublicKey(key).export({ format: 'jwk' });
279
- if (derived.n !== published.n || derived.e !== published.e) {
280
- throw new RuntimeGatewayOidcError(
281
- 'signing_key_not_published',
282
- `${RUNTIME_GATEWAY_OIDC_PRIVATE_KEY_ENV} does not match the published ${environment} key "${signingKey.kid}".`,
283
- );
284
- }
285
- }
286
-
287
- export function mintRuntimeGatewayOidcToken(input: {
288
- signingKey: RuntimeGatewayOidcSigningKey;
289
- deploymentId: string;
290
- runId: string;
291
- attempt: number;
292
- nowMs: number;
293
- /** Defaults to the environment the signing key is published for. */
294
- environment?: RuntimeGatewayOidcEnvironment;
295
- /** Defaults to the code-owned keys. */
296
- trust?: RuntimeGatewayOidcTrust;
297
- }): string {
298
- if (
299
- !isRuntimeGatewayDeploymentId(input.deploymentId) ||
300
- !isRuntimeScopeRunId(input.runId) ||
301
- !Number.isSafeInteger(input.attempt) ||
302
- input.attempt < 0 ||
303
- !Number.isFinite(input.nowMs)
304
- ) {
305
- throw new RuntimeGatewayOidcError(
306
- 'claims_invalid',
307
- 'Runtime gateway OIDC claims are invalid.',
308
- );
309
- }
310
- const trust = input.trust ?? RUNTIME_GATEWAY_OIDC_TRUST;
311
- const environment =
312
- input.environment ??
313
- runtimeGatewayOidcEnvironmentForKid(input.signingKey.kid, trust) ??
314
- resolveRuntimeGatewayOidcEnvironment();
315
- const key = rsaPrivateKey(input.signingKey);
316
- assertSigningKeyPublished(input.signingKey, key, environment, trust);
317
- const iat = Math.floor(input.nowMs / 1_000);
318
- const claims: RuntimeGatewayOidcClaims = {
319
- iss: RUNTIME_GATEWAY_OIDC_ISSUER,
320
- aud: RUNTIME_GATEWAY_OIDC_AUDIENCE,
321
- sub: RUNTIME_GATEWAY_OIDC_SUBJECT,
322
- deployment_id: input.deploymentId,
323
- run_id: input.runId,
324
- run_attempt: input.attempt,
325
- deepline_env: environment,
326
- iat,
327
- exp: iat + RUNTIME_GATEWAY_OIDC_MAX_AGE_SECONDS,
328
- };
329
- const signingInput = `${encodeSegment({
330
- alg: 'RS256',
331
- kid: input.signingKey.kid,
332
- typ: 'JWT',
333
- })}.${encodeSegment(claims)}`;
334
- const signature = sign('RSA-SHA256', Buffer.from(signingInput), key);
335
- return `${signingInput}.${signature.toString('base64url')}`;
336
- }
337
-
338
- function decodeSegment(segment: string): Record<string, unknown> | null {
339
- try {
340
- const value = JSON.parse(Buffer.from(segment, 'base64url').toString());
341
- return value && typeof value === 'object' && !Array.isArray(value)
342
- ? (value as Record<string, unknown>)
343
- : null;
344
- } catch {
345
- return null;
346
- }
347
- }
348
-
349
- function isTokenShape(token: unknown): token is string {
350
- return (
351
- typeof token === 'string' &&
352
- token.length <= RUNTIME_GATEWAY_OIDC_MAX_TOKEN_LENGTH &&
353
- /^[\w-]+\.[\w-]+\.[\w-]+$/.test(token)
354
- );
355
- }
356
-
357
- /** Unverified claim read for schedulers deciding when to renew. */
358
- export function readRuntimeGatewayOidcClaimsUnverified(
359
- token: unknown,
360
- ): RuntimeGatewayOidcClaims | null {
361
- if (!isTokenShape(token)) return null;
362
- const claims = decodeSegment(token.split('.')[1]!);
363
- return claims && isClaimsShape(claims) ? claims : null;
364
- }
365
-
366
- function isClaimsShape(
367
- claims: Record<string, unknown>,
368
- ): claims is RuntimeGatewayOidcClaims {
369
- return (
370
- typeof claims.iss === 'string' &&
371
- typeof claims.aud === 'string' &&
372
- typeof claims.sub === 'string' &&
373
- typeof claims.deployment_id === 'string' &&
374
- isRuntimeScopeRunId(claims.run_id) &&
375
- Number.isSafeInteger(claims.run_attempt) &&
376
- (claims.deepline_env === 'preview' ||
377
- claims.deepline_env === 'production') &&
378
- Number.isSafeInteger(claims.iat) &&
379
- Number.isSafeInteger(claims.exp)
380
- );
381
- }
382
-
383
- export type RuntimeGatewayOidcVerification =
384
- | { ok: true; claims: RuntimeGatewayOidcClaims }
385
- | {
386
- ok: false;
387
- reason:
388
- | 'malformed'
389
- | 'unknown_key'
390
- | 'bad_signature'
391
- | 'wrong_issuer'
392
- | 'wrong_audience'
393
- | 'wrong_subject'
394
- | 'wrong_scope'
395
- | 'wrong_environment'
396
- | 'expired'
397
- | 'not_yet_valid'
398
- | 'lifetime_too_long';
399
- };
400
-
401
- /**
402
- * Verify a token for one exact deployment, run and attempt, in this
403
- * deployment's environment: the kid must be one this environment trusts and
404
- * the `deepline_env` claim must name it. `environment` defaults to this
405
- * process's; `trust` defaults to the code-owned keys.
406
- */
407
- export function verifyRuntimeGatewayOidcToken(
408
- token: unknown,
409
- expected: { deploymentId: string; runId: string; attempt: number },
410
- options: {
411
- nowMs?: number;
412
- environment?: RuntimeGatewayOidcEnvironment;
413
- trust?: RuntimeGatewayOidcTrust;
414
- } = {},
415
- ): RuntimeGatewayOidcVerification {
416
- if (!isTokenShape(token)) return { ok: false, reason: 'malformed' };
417
- const [headerPart, claimsPart, signaturePart] = token.split('.') as [
418
- string,
419
- string,
420
- string,
421
- ];
422
- const header = decodeSegment(headerPart);
423
- const claims = decodeSegment(claimsPart);
424
- if (
425
- !header ||
426
- !claims ||
427
- header.alg !== 'RS256' ||
428
- typeof header.kid !== 'string' ||
429
- !isClaimsShape(claims)
430
- ) {
431
- return { ok: false, reason: 'malformed' };
432
- }
433
- const environment =
434
- options.environment ?? resolveRuntimeGatewayOidcEnvironment();
435
- const jwk = environmentJwk(
436
- options.trust ?? RUNTIME_GATEWAY_OIDC_TRUST,
437
- environment,
438
- header.kid,
439
- );
440
- if (!jwk) return { ok: false, reason: 'unknown_key' };
441
- let signatureValid = false;
442
- try {
443
- signatureValid = verify(
444
- 'RSA-SHA256',
445
- Buffer.from(`${headerPart}.${claimsPart}`),
446
- publicKeyObject(jwk),
447
- Buffer.from(signaturePart, 'base64url'),
448
- );
449
- } catch {
450
- signatureValid = false;
451
- }
452
- if (!signatureValid) return { ok: false, reason: 'bad_signature' };
453
- if (claims.iss !== RUNTIME_GATEWAY_OIDC_ISSUER)
454
- return { ok: false, reason: 'wrong_issuer' };
455
- if (claims.aud !== RUNTIME_GATEWAY_OIDC_AUDIENCE)
456
- return { ok: false, reason: 'wrong_audience' };
457
- if (claims.sub !== RUNTIME_GATEWAY_OIDC_SUBJECT)
458
- return { ok: false, reason: 'wrong_subject' };
459
- if (
460
- claims.deployment_id !== expected.deploymentId ||
461
- claims.run_id !== expected.runId ||
462
- claims.run_attempt !== expected.attempt
463
- ) {
464
- return { ok: false, reason: 'wrong_scope' };
465
- }
466
- if (claims.deepline_env !== environment)
467
- return { ok: false, reason: 'wrong_environment' };
468
- if (claims.exp - claims.iat > RUNTIME_GATEWAY_OIDC_MAX_AGE_SECONDS)
469
- return { ok: false, reason: 'lifetime_too_long' };
470
- const now = Math.floor((options.nowMs ?? Date.now()) / 1_000);
471
- if (claims.iat > now + RUNTIME_GATEWAY_OIDC_CLOCK_SKEW_SECONDS)
472
- return { ok: false, reason: 'not_yet_valid' };
473
- if (claims.exp <= now) return { ok: false, reason: 'expired' };
474
- return { ok: true, claims };
475
- }
476
-
477
51
  /** Discovery document served at `${ISSUER}/.well-known/openid-configuration`. */
478
52
  export function runtimeGatewayOidcDiscoveryDocument(): Readonly<{
479
53
  issuer: string;
@@ -502,13 +76,3 @@ export function runtimeGatewayOidcDiscoveryDocument(): Readonly<{
502
76
  ],
503
77
  };
504
78
  }
505
-
506
- /** True once a token is old enough that the watchdog should renew it. */
507
- export function shouldRenewRuntimeGatewayOidcToken(
508
- token: unknown,
509
- nowMs: number,
510
- ): boolean {
511
- const claims = readRuntimeGatewayOidcClaimsUnverified(token);
512
- if (!claims) return true;
513
- return nowMs / 1_000 >= claims.iat + RUNTIME_GATEWAY_OIDC_RENEW_AFTER_SECONDS;
514
- }
@@ -214,10 +214,11 @@ export type PlaySchedulerSubmitInput = RetainedPipelineCarrier & {
214
214
  */
215
215
  runtimeSandboxPlacementPolicyId?: RuntimeSandboxPlacementPolicyId | null;
216
216
  /**
217
- * Optional Runtime gateway pin (`.//runtime-gateway-profile`).
218
- * All five are absent on unpinned launches, which keep the worker's
219
- * configured gateways. A present pin is read only through
220
- * `readRuntimeGatewayLaunchPin`, which refuses partial or unknown pins.
217
+ * Retired: the `vercel_app@1` gateway profile was removed and nothing writes
218
+ * these five fields. They stay typed because a stored launch admitted
219
+ * before the removal may still carry them, and the launch-identity field
220
+ * roles must keep classifying them. No reader acts on them: a run that
221
+ * still carries a pin continues on the default gateways.
221
222
  */
222
223
  runtimeGatewayProfileId?: string | null;
223
224
  /** `https://<admitting deployment>/api/receipt`. */