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.
- package/dist/bundling-sources/sdk/src/plays/client-core.ts +16 -45
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +0 -18
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +0 -155
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +160 -2
- package/dist/bundling-sources/shared_libs/play-runtime/execute-server-timing.ts +22 -0
- package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +24 -0
- package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +1 -54
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +2 -7
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +0 -13
- package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +0 -56
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +10 -21
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +2 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +2 -37
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +3 -74
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-runtime-watchdog.ts +2 -226
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +3 -36
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +0 -26
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +1 -9
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +0 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-environment.ts +9 -49
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-oidc.ts +11 -447
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +5 -4
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +12 -207
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +3 -17
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-progress-registry.ts +0 -9
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +2 -18
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +15 -175
- package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +0 -4
- package/dist/cli/{artifacts-YRKH7KNC.js → artifacts-JGH464N2.js} +20 -20
- package/dist/cli/{artifacts-ZZULJ6X5.mjs → artifacts-TYPU37IU.mjs} +8 -8
- package/dist/cli/auth-JWR3VSNT.js +43 -0
- package/dist/cli/{auth-WU2BDO3T.mjs → auth-XPQT6NUB.mjs} +5 -5
- package/dist/cli/{billing-DG62VVXW.mjs → billing-47AMHOMP.mjs} +8 -8
- package/dist/cli/{billing-MUMMBMQK.js → billing-6D4KXBFJ.js} +81 -81
- package/dist/cli/{chunk-R3OAKFHJ.mjs → chunk-2DQPB5HT.mjs} +5 -5
- package/dist/cli/{chunk-6Y3DDRRN.js → chunk-2KHUFWTK.js} +3 -3
- package/dist/cli/{chunk-XUCAH3LN.js → chunk-3Q7HEEH2.js} +10 -10
- package/dist/cli/{chunk-MI5DKOBD.mjs → chunk-4DB6JV7X.mjs} +2 -2
- package/dist/cli/{chunk-J4X4RNSP.mjs → chunk-4GGXAYKI.mjs} +3 -3
- package/dist/cli/{chunk-AXA5DFY5.mjs → chunk-4I7I5CGB.mjs} +1 -1
- package/dist/cli/{chunk-I3ICKVYH.js → chunk-4MN65FRF.js} +53 -53
- package/dist/cli/{chunk-Y7D6L4M7.mjs → chunk-4MONKWYE.mjs} +5 -5
- package/dist/cli/{chunk-3CUIIVGR.mjs → chunk-5T7QKHQL.mjs} +1 -1
- package/dist/cli/{chunk-UMPHUAGZ.js → chunk-6DCBTJZP.js} +3 -3
- package/dist/cli/{chunk-LKYLIZ5X.js → chunk-6N72GHAV.js} +2 -2
- package/dist/cli/{chunk-RHQKDHCX.mjs → chunk-6UHYXNCP.mjs} +2 -2
- package/dist/cli/{chunk-RU5JRQKJ.mjs → chunk-6V2RI3AL.mjs} +3 -3
- package/dist/cli/{chunk-NIJE62ZD.mjs → chunk-7AUXX6M5.mjs} +1 -1
- package/dist/cli/{chunk-NH22WUUG.mjs → chunk-7IYDCHTG.mjs} +2 -2
- package/dist/cli/{chunk-FEJKDR67.mjs → chunk-7LRALARF.mjs} +1 -1
- package/dist/cli/{chunk-N3LUYBOB.mjs → chunk-A2B5AAU3.mjs} +11 -11
- package/dist/cli/{chunk-CRE3OGHH.mjs → chunk-A6USUS4L.mjs} +2 -2
- package/dist/cli/{chunk-ZQ23WQP3.js → chunk-AMVKLEPH.js} +2 -2
- package/dist/cli/{chunk-RQ2BHYUM.mjs → chunk-CBBCUYIN.mjs} +2 -2
- package/dist/cli/{chunk-CBMTBMIJ.mjs → chunk-DQURY3WH.mjs} +1 -1
- package/dist/cli/{chunk-EMV6EHK2.js → chunk-DY6634MN.js} +14 -14
- package/dist/cli/{chunk-5A2SIIPH.mjs → chunk-E4ZS2B2J.mjs} +1 -1
- package/dist/cli/{chunk-BQYXIAJM.js → chunk-EILHJRPW.js} +3 -3
- package/dist/cli/{chunk-RQDD2VV3.js → chunk-EW3EAEWZ.js} +5 -5
- package/dist/cli/{chunk-A7W3CCU5.mjs → chunk-EZNZDOAG.mjs} +5 -5
- package/dist/cli/{chunk-HT675XNR.mjs → chunk-FKD3KL5Q.mjs} +1 -1
- package/dist/cli/{chunk-FJAGGBDR.mjs → chunk-FQJFONFT.mjs} +59 -90
- package/dist/cli/{chunk-C7ZD4LXZ.js → chunk-FTZX4QZN.js} +2 -2
- package/dist/cli/{chunk-F6XD4CRW.js → chunk-GNYSODBR.js} +1 -1
- package/dist/cli/{chunk-4PWBHYH4.js → chunk-HD3KYCDC.js} +7 -7
- package/dist/cli/{chunk-IMIHYCJ5.mjs → chunk-HHBJJYKL.mjs} +5 -5
- package/dist/cli/{chunk-YRU46P7H.mjs → chunk-HRWVEIAX.mjs} +1 -1
- package/dist/cli/{chunk-TT2XB433.js → chunk-HSFLMTED.js} +4 -4
- package/dist/cli/{chunk-E6YWCXII.js → chunk-JFQJNYTB.js} +16 -16
- package/dist/cli/{chunk-XBS4RDKU.js → chunk-LGU2NIOT.js} +98 -98
- package/dist/cli/{chunk-SBF4K3QF.mjs → chunk-LNBMEFOI.mjs} +4 -4
- package/dist/cli/{chunk-G2QD575P.js → chunk-MD43YAL6.js} +6 -6
- package/dist/cli/{chunk-S7R4O62I.js → chunk-MRU4N33M.js} +6 -6
- package/dist/cli/{chunk-UB2REJPL.mjs → chunk-NNDAVVBG.mjs} +2 -2
- package/dist/cli/{chunk-ORNLTNBN.js → chunk-PUKWFJXW.js} +44 -44
- package/dist/cli/{chunk-O655PVT4.js → chunk-QGTWGHYD.js} +88 -119
- package/dist/cli/{chunk-AL7FDMD6.mjs → chunk-TBIWR7M2.mjs} +1 -1
- package/dist/cli/{chunk-PK6VYYEY.js → chunk-UAZKOH3J.js} +5 -5
- package/dist/cli/{chunk-BMCRTI6Z.mjs → chunk-UBKA33KY.mjs} +1 -22
- package/dist/cli/{chunk-4ECU5DI3.js → chunk-ULW2KBKL.js} +26 -26
- package/dist/cli/{chunk-52DFTRVC.js → chunk-VSH3AE5E.js} +16 -16
- package/dist/cli/{chunk-P62S3ZMS.js → chunk-VYY5V4M5.js} +11 -11
- package/dist/cli/{chunk-HXPHRSNM.js → chunk-WL6WPW6X.js} +14 -14
- package/dist/cli/{chunk-WSGXBROE.js → chunk-XDVT3GOM.js} +1 -22
- package/dist/cli/{chunk-GO467AXG.js → chunk-Y23TOHNV.js} +41 -41
- package/dist/cli/{chunk-FTJ2D3XD.mjs → chunk-Y7IR4LBU.mjs} +3 -3
- package/dist/cli/{chunk-25WXWSFS.js → chunk-YROP3H6T.js} +22 -22
- package/dist/cli/{chunk-HKKC7J6K.mjs → chunk-ZO2XJVFH.mjs} +6 -6
- package/dist/cli/{csv-BKWIYPMK.js → csv-5TM2OSYP.js} +13 -13
- package/dist/cli/{csv-3TUJHAOW.mjs → csv-PM3WDXDF.mjs} +4 -4
- package/dist/cli/{db-EJMJDKDA.js → db-3LJ32FZM.js} +29 -29
- package/dist/cli/{db-I75IQ7XI.mjs → db-5P72NPRL.mjs} +8 -8
- package/dist/cli/describe-GRS3IRSX.js +50 -0
- package/dist/cli/{describe-RUFLLRIN.mjs → describe-ZLCMBGHG.mjs} +20 -20
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/{executions-TQJCMUUG.js → executions-4AJ5TQVY.js} +10 -10
- package/dist/cli/{executions-VW3MYJEE.mjs → executions-JMFL6AV7.mjs} +8 -8
- package/dist/cli/{feedback-76342G7E.mjs → feedback-DKMG2QB7.mjs} +5 -5
- package/dist/cli/{feedback-UFAEXH5B.js → feedback-I2BLXMGH.js} +10 -10
- package/dist/cli/git-2LNT43A2.js +25 -0
- package/dist/cli/{git-L5XKAODI.mjs → git-ARG223MY.mjs} +5 -5
- package/dist/cli/index.js +141 -141
- package/dist/cli/index.mjs +43 -43
- package/dist/cli/{legacy-noops-DKAZ7JG3.mjs → legacy-noops-24LOAOZN.mjs} +6 -6
- package/dist/cli/{legacy-noops-DM66YISP.js → legacy-noops-N7SVA7PL.js} +9 -9
- package/dist/cli/{monitors-QXEJI54B.mjs → monitors-RYQFWM2T.mjs} +9 -9
- package/dist/cli/{monitors-NKDIH4TY.js → monitors-XNCYLOJM.js} +102 -102
- package/dist/cli/{org-NKIIBUNO.js → org-I33TKZXF.js} +74 -74
- package/dist/cli/{org-KZQCVREB.mjs → org-ORIH56E5.mjs} +8 -8
- package/dist/cli/{pages-UJUFCJEL.js → pages-2UXXGIMF.js} +20 -20
- package/dist/cli/{pages-E7IT5SWT.mjs → pages-ME43HSBL.mjs} +8 -8
- package/dist/cli/{play-SPI5MO67.js → play-F4QOFU37.js} +338 -338
- package/dist/cli/{play-AKL5E2DF.mjs → play-XEKNY46M.mjs} +21 -21
- package/dist/cli/{providers-4NVQ3FSC.js → providers-E7DPCBNX.js} +11 -11
- package/dist/cli/{providers-6HSSVI74.mjs → providers-XKU44G74.mjs} +8 -8
- package/dist/cli/{quickstart-FEQD7S4Z.js → quickstart-ICLF2F6A.js} +6 -6
- package/dist/cli/{quickstart-EHLEHSMI.mjs → quickstart-J7NVEXV5.mjs} +4 -4
- package/dist/cli/{run-GH6ECTJF.js → run-HJMHUQBN.js} +43 -43
- package/dist/cli/{run-IWVM7BD6.mjs → run-MQ5ZONGL.mjs} +25 -25
- package/dist/cli/run-identity-G257GQED.js +25 -0
- package/dist/cli/{run-identity-MNRZS2N3.mjs → run-identity-MRNCEGV2.mjs} +3 -9
- package/dist/cli/{search-X4CDMN7J.mjs → search-GGRC77CV.mjs} +10 -10
- package/dist/cli/search-V6IBJ4TX.js +33 -0
- package/dist/cli/{search-output-IIYMGZTQ.js → search-output-MXZTZI2P.js} +6 -6
- package/dist/cli/{search-output-PJ7N5WUQ.mjs → search-output-NY4GDBRU.mjs} +4 -4
- package/dist/cli/{secrets-4YPMC7XZ.mjs → secrets-FA37G4Q2.mjs} +8 -8
- package/dist/cli/{secrets-QPP2FXID.js → secrets-PFESG72B.js} +17 -17
- package/dist/cli/{sessions-BEOI47VZ.mjs → sessions-BLLXPETU.mjs} +6 -6
- package/dist/cli/sessions-DNFTQOQH.js +18 -0
- package/dist/cli/{settings-FZDONKPW.js → settings-32VPG4Z2.js} +88 -88
- package/dist/cli/{settings-VHULXNY3.mjs → settings-U26S7MPH.mjs} +15 -15
- package/dist/cli/{setup-5IV3NHGD.mjs → setup-4AXBCX7C.mjs} +10 -10
- package/dist/cli/{setup-LZ6IN5JS.js → setup-R6NSENH7.js} +50 -50
- package/dist/cli/skills-G4ZE3OS5.js +37 -0
- package/dist/cli/{skills-FZAFBW5J.mjs → skills-JUH7AVUL.mjs} +8 -8
- package/dist/cli/tools-27LHZFJD.js +57 -0
- package/dist/cli/{tools-TLBH3RFK.mjs → tools-FOYLU3FH.mjs} +19 -19
- package/dist/cli/{update-KPLIZYOV.mjs → update-FUVX22VM.mjs} +10 -10
- package/dist/cli/update-KNZ7N242.js +35 -0
- package/dist/cli/{workflow-ACHPT3DD.js → workflow-JACZW4GJ.js} +19 -19
- package/dist/cli/{workflow-GYJOYYWK.mjs → workflow-QLT22BLT.mjs} +9 -9
- package/dist/{client-CswZYCGj.d.ts → client-B-2Am2y6.d.ts} +1 -1
- package/dist/{client-CpSiHSti.d.mts → client-DA71-2_u.d.mts} +1 -1
- package/dist/{client-core-C1xVOg8Y.d.mts → client-core-BXbds1cb.d.mts} +1 -20
- package/dist/{client-core-D2pLt36Q.d.ts → client-core-C0IzDKMJ.d.ts} +1 -20
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +19 -19
- package/dist/index.mjs +8 -8
- package/dist/install-integrity.json +114 -122
- package/dist/plays/play-description.d.mts +1 -1
- package/dist/plays/play-description.d.ts +1 -1
- package/dist/plays/run-request.d.mts +1 -1
- package/dist/plays/run-request.d.ts +1 -1
- package/dist/plays/run-request.js +3 -3
- package/dist/plays/run-request.mjs +2 -2
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +7 -7
- package/dist/server.mjs +5 -5
- package/package.json +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-app-transport.ts +0 -374
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-egress.ts +0 -55
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-profile.ts +0 -329
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-sandbox-credential.ts +0 -338
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-staging.ts +0 -417
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-attempt.ts +0 -81
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-staging-journal.ts +0 -708
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-staging-teardown.ts +0 -160
- package/dist/cli/auth-DF6WJLN2.js +0 -43
- package/dist/cli/describe-EAK3MPTG.js +0 -50
- package/dist/cli/git-OOCPCIGZ.js +0 -25
- package/dist/cli/run-identity-HFYABUJS.js +0 -31
- package/dist/cli/search-NIRYA3VL.js +0 -33
- package/dist/cli/sessions-5I2IFTW7.js +0 -18
- package/dist/cli/skills-WJWLFSHI.js +0 -37
- package/dist/cli/tools-SH35NRGU.js +0 -57
- package/dist/cli/update-MA46YSGR.js +0 -35
package/dist/server.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DeeplineClient
|
|
3
|
-
} from "./cli/chunk-
|
|
3
|
+
} from "./cli/chunk-FQJFONFT.mjs";
|
|
4
4
|
import "./cli/chunk-L2VKAASU.mjs";
|
|
5
|
-
import "./cli/chunk-
|
|
5
|
+
import "./cli/chunk-FKD3KL5Q.mjs";
|
|
6
6
|
import "./cli/chunk-S3A4IXBQ.mjs";
|
|
7
|
-
import "./cli/chunk-
|
|
7
|
+
import "./cli/chunk-UBKA33KY.mjs";
|
|
8
8
|
import {
|
|
9
9
|
HttpClient
|
|
10
|
-
} from "./cli/chunk-
|
|
10
|
+
} from "./cli/chunk-E4ZS2B2J.mjs";
|
|
11
11
|
import {
|
|
12
12
|
AuthError,
|
|
13
13
|
ConfigError,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
isProviderUnavailable,
|
|
25
25
|
isProviderWaterfallUnavailableError
|
|
26
26
|
} from "./cli/chunk-ZPGGW27Q.mjs";
|
|
27
|
-
import "./cli/chunk-
|
|
27
|
+
import "./cli/chunk-7AUXX6M5.mjs";
|
|
28
28
|
import "./cli/chunk-WZYKRD7T.mjs";
|
|
29
29
|
import "./cli/chunk-KRD6H754.mjs";
|
|
30
30
|
|
package/package.json
CHANGED
|
@@ -1,374 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { resolve4 } from 'node:dns/promises';
|
|
2
|
-
import type { RuntimeGatewayCredentialScope } from './runtime-gateway-sandbox-credential';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Egress to the pinned Runtime gateway host for a sandbox whose outbound
|
|
6
|
-
* network is restricted to a CIDR list. Shared by every sandbox provider
|
|
7
|
-
* (Daytona `networkAllowList`, Modal `outboundCidrAllowlist`).
|
|
8
|
-
*
|
|
9
|
-
* A pinned run reaches its immutable app deployment by hostname, whose
|
|
10
|
-
* addresses cannot be enumerated ahead of time, and the providers accept a
|
|
11
|
-
* CIDR list (Daytona refuses a CIDR list and a domain list together). So when
|
|
12
|
-
* egress is already restricted, add the /24 around each IPv4 address the
|
|
13
|
-
* pinned host resolves to: the sandbox resolves the same name and may be
|
|
14
|
-
* answered with a different address in the same range. An unrestricted
|
|
15
|
-
* sandbox needs nothing (a list would restrict it), and an unpinned run is
|
|
16
|
-
* returned unchanged without resolving anything.
|
|
17
|
-
*/
|
|
18
|
-
export async function withRuntimeGatewayEgressCidrs(input: {
|
|
19
|
-
credentialScope: RuntimeGatewayCredentialScope | null | undefined;
|
|
20
|
-
/** The provider's CIDR allow-list; null or empty means unrestricted. */
|
|
21
|
-
cidrs: readonly string[] | null;
|
|
22
|
-
resolveIpv4?: (hostname: string) => Promise<string[]>;
|
|
23
|
-
}): Promise<string[] | null> {
|
|
24
|
-
const scope = input.credentialScope;
|
|
25
|
-
if (!scope || !input.cidrs || input.cidrs.length === 0) {
|
|
26
|
-
return input.cidrs ? [...input.cidrs] : null;
|
|
27
|
-
}
|
|
28
|
-
const hostname = new URL(scope.origin).hostname;
|
|
29
|
-
if (!hostname) {
|
|
30
|
-
throw new Error('Runtime gateway credential scope has no hostname.');
|
|
31
|
-
}
|
|
32
|
-
const addresses = await (input.resolveIpv4 ?? resolve4)(hostname);
|
|
33
|
-
const networks = [
|
|
34
|
-
...new Set(
|
|
35
|
-
addresses
|
|
36
|
-
.map((address) => address.split('.'))
|
|
37
|
-
.filter(
|
|
38
|
-
(octets) =>
|
|
39
|
-
octets.length === 4 &&
|
|
40
|
-
octets.every((octet) => /^\d{1,3}$/.test(octet)),
|
|
41
|
-
)
|
|
42
|
-
.map((octets) => `${octets[0]}.${octets[1]}.${octets[2]}.0/24`),
|
|
43
|
-
),
|
|
44
|
-
];
|
|
45
|
-
if (networks.length === 0) {
|
|
46
|
-
throw new Error(
|
|
47
|
-
`Runtime gateway host ${hostname} resolved to no IPv4 address; refusing to start a pinned sandbox that could not reach it.`,
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
const existing = input.cidrs.map((entry) => entry.trim());
|
|
51
|
-
return [
|
|
52
|
-
...existing,
|
|
53
|
-
...networks.filter((network) => !existing.includes(network)),
|
|
54
|
-
];
|
|
55
|
-
}
|