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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { APP_RUNTIME_COMPAT_PATH } from '../../runtime-api-paths';
|
|
2
1
|
import {
|
|
3
2
|
STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS,
|
|
4
3
|
MAX_PLAY_SANDBOX_RUNTIME_LIMITS,
|
|
@@ -13,30 +12,6 @@ import {
|
|
|
13
12
|
RUNTIME_MEMORY_LEDGER_PATH_ENV,
|
|
14
13
|
RUNTIME_MEMORY_PRESSURE_PATH_ENV,
|
|
15
14
|
} from '../../memory-pressure-signal';
|
|
16
|
-
import {
|
|
17
|
-
RUNTIME_GATEWAY_OIDC_FILE_ENV,
|
|
18
|
-
RUNTIME_GATEWAY_OIDC_RENEW_AFTER_SECONDS,
|
|
19
|
-
RUNTIME_GATEWAY_OIDC_RENEW_PATH,
|
|
20
|
-
RUNTIME_GATEWAY_OIDC_RENEW_RESPONSE_FIELD,
|
|
21
|
-
} from '../../runtime-gateway-oidc';
|
|
22
|
-
import {
|
|
23
|
-
RUNTIME_GATEWAY_OIDC_FILE_SUFFIX,
|
|
24
|
-
RUNTIME_GATEWAY_OIDC_RENEW_RETRY_BASE_MS,
|
|
25
|
-
RUNTIME_GATEWAY_OIDC_RENEW_RETRY_MAX_MS,
|
|
26
|
-
runtimeGatewayOidcRequestHeaders,
|
|
27
|
-
isRuntimeGatewayOidcRenewalFatal,
|
|
28
|
-
startRuntimeGatewayOidcRenewalLoop,
|
|
29
|
-
} from '../../runtime-gateway-sandbox-credential';
|
|
30
|
-
|
|
31
|
-
/** Termination reason when the watchdog cannot keep the gateway credential valid. */
|
|
32
|
-
export const RUNTIME_GATEWAY_OIDC_RENEWAL_FAILED_REASON =
|
|
33
|
-
'runtime_gateway_oidc_renewal_failed';
|
|
34
|
-
/**
|
|
35
|
-
* Renewal retries stop, and the runner is stopped loudly, once the current
|
|
36
|
-
* credential has less than this left. The remainder lets the crash epilogue
|
|
37
|
-
* still deliver the terminal through the pinned gateway.
|
|
38
|
-
*/
|
|
39
|
-
export const RUNTIME_GATEWAY_OIDC_RENEW_EXPIRY_MARGIN_SECONDS = 90;
|
|
40
15
|
|
|
41
16
|
/** Exit code reserved for the external runner watchdog's runtime deadline. */
|
|
42
17
|
export const DAYTONA_RUNTIME_WATCHDOG_EXIT_CODE = 124;
|
|
@@ -273,34 +248,11 @@ export function accumulateSampledCgroupMemoryUsage(
|
|
|
273
248
|
* 1 runnerPath, 2 configPath, 3 runtimeStartedPath, 4 runtimeCompletedPath,
|
|
274
249
|
* 5 limitMs, 6 startupLimitMs, 7 terminalGraceMs, 8 runtimeLimitMarkerPath,
|
|
275
250
|
* 9 terminationDiagnosticPath, 10 memoryLedgerPath, 11 memoryPressurePath,
|
|
276
|
-
* 12 cgroupRoot, 13 runnerPidPath
|
|
277
|
-
*
|
|
278
|
-
* `runtimeGatewayCredential` is `RUNTIME_GATEWAY_CREDENTIAL_WATCHDOG_FLAG`
|
|
279
|
-
* only for a pinned run (the worker passes it when the config carries a
|
|
280
|
-
* credential scope; `runtimeGatewayCredentialWatchdogArgs`). Without it the
|
|
281
|
-
* watchdog never reads or parses the runner config at startup.
|
|
282
|
-
*/
|
|
283
|
-
/** argv 14 of the watchdog: this run carries a Runtime gateway credential. */
|
|
284
|
-
export const RUNTIME_GATEWAY_CREDENTIAL_WATCHDOG_FLAG =
|
|
285
|
-
'runtime-gateway-credential';
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* The trailing watchdog argument for a run, given its runner context: the
|
|
289
|
-
* flag when a credential scope exists, nothing otherwise.
|
|
251
|
+
* 12 cgroupRoot, 13 runnerPidPath.
|
|
290
252
|
*/
|
|
291
|
-
export function runtimeGatewayCredentialWatchdogArgs(context: {
|
|
292
|
-
runtimeGatewayCredentialScope?: unknown;
|
|
293
|
-
}): string[] {
|
|
294
|
-
return context.runtimeGatewayCredentialScope
|
|
295
|
-
? [RUNTIME_GATEWAY_CREDENTIAL_WATCHDOG_FLAG]
|
|
296
|
-
: [];
|
|
297
|
-
}
|
|
298
|
-
|
|
299
253
|
export function buildDaytonaRuntimeWatchdogSource(
|
|
300
254
|
sandboxRuntimeLimits: PlaySandboxRuntimeLimits = STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS,
|
|
301
255
|
memoryLimitMiB?: number,
|
|
302
|
-
/** First renewal retry delay of a pinned run's watchdog (tests shorten it). */
|
|
303
|
-
runtimeGatewayOidcRenewRetryBaseMs: number = RUNTIME_GATEWAY_OIDC_RENEW_RETRY_BASE_MS,
|
|
304
256
|
): string {
|
|
305
257
|
const nodeExecArgv = playRunnerNodeExecArgvForLimits(
|
|
306
258
|
sandboxRuntimeLimits,
|
|
@@ -329,39 +281,7 @@ const memoryLedgerPath = process.argv[10] || '';
|
|
|
329
281
|
const memoryPressurePath = process.argv[11] || '';
|
|
330
282
|
const cgroupRoot = process.argv[12] || ${JSON.stringify(RUNNER_MEMORY_CGROUP_ROOT)};
|
|
331
283
|
const runnerPidPath = process.argv[13] || '';
|
|
332
|
-
const runtimeGatewayCredentialFlagged = process.argv[14] === ${JSON.stringify(RUNTIME_GATEWAY_CREDENTIAL_WATCHDOG_FLAG)};
|
|
333
284
|
const runtimeLimitSeconds = Math.max(1, Math.ceil(limitMs / 1_000));
|
|
334
|
-
|
|
335
|
-
// --- Runtime gateway credential (pinned runs only) -------------------------
|
|
336
|
-
// A run pinned to an app-hosted gateway presents a short-lived OIDC token to
|
|
337
|
-
// that exact origin and gateway paths. This process renews it and shares the
|
|
338
|
-
// latest token with the runner through a file beside the config. Only a run
|
|
339
|
-
// the worker flagged (argv 14) reads the config here; unpinned runs do none
|
|
340
|
-
// of this.
|
|
341
|
-
const runtimeGatewayOidcRequestHeaders = (${runtimeGatewayOidcRequestHeaders.toString()});
|
|
342
|
-
const runtimeGatewayOidcFilePath = configPath + ${JSON.stringify(RUNTIME_GATEWAY_OIDC_FILE_SUFFIX)};
|
|
343
|
-
const runtimeGatewayOidc = !runtimeGatewayCredentialFlagged ? null : (() => {
|
|
344
|
-
// Flagged as pinned: an unreadable config fails loudly below.
|
|
345
|
-
let context = {};
|
|
346
|
-
try {
|
|
347
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
348
|
-
context = (config && config.context) || {};
|
|
349
|
-
} catch {}
|
|
350
|
-
const renewUrl = String(context.receiptGatewayBaseUrl || '').replace(/\\/$/, '') +
|
|
351
|
-
${JSON.stringify(RUNTIME_GATEWAY_OIDC_RENEW_PATH)};
|
|
352
|
-
const scope = context.runtimeGatewayCredentialScope;
|
|
353
|
-
const token = context.runtimeGatewayOidcToken;
|
|
354
|
-
if (
|
|
355
|
-
typeof context.executorToken !== 'string' ||
|
|
356
|
-
!context.executorToken ||
|
|
357
|
-
!runtimeGatewayOidcRequestHeaders(scope, token, renewUrl)
|
|
358
|
-
) {
|
|
359
|
-
// The worker validated the pin; an unusable one here must not run quietly.
|
|
360
|
-
process.stderr.write('${RUNTIME_GATEWAY_OIDC_RENEWAL_FAILED_REASON}: pinned runner config has no usable gateway credential.\\n');
|
|
361
|
-
process.exit(1);
|
|
362
|
-
}
|
|
363
|
-
return { scope, token, renewUrl, executorToken: context.executorToken, runId: context.runId };
|
|
364
|
-
})();
|
|
365
285
|
const child = spawn(
|
|
366
286
|
process.execPath,
|
|
367
287
|
[${nodeExecArgv.map((flag) => JSON.stringify(flag)).join(', ')}, runnerPath, configPath],
|
|
@@ -374,9 +294,6 @@ const child = spawn(
|
|
|
374
294
|
...(memoryPressurePath
|
|
375
295
|
? { ${JSON.stringify(RUNTIME_MEMORY_PRESSURE_PATH_ENV)}: memoryPressurePath }
|
|
376
296
|
: {}),
|
|
377
|
-
...(runtimeGatewayOidc
|
|
378
|
-
? { ${JSON.stringify(RUNTIME_GATEWAY_OIDC_FILE_ENV)}: runtimeGatewayOidcFilePath }
|
|
379
|
-
: {}),
|
|
380
297
|
},
|
|
381
298
|
stdio: 'inherit',
|
|
382
299
|
},
|
|
@@ -630,20 +547,13 @@ async function runnerHeartbeatTick() {
|
|
|
630
547
|
const sandboxHealth = takeSandboxHealth();
|
|
631
548
|
try {
|
|
632
549
|
const response = await fetch(
|
|
633
|
-
config.gatewayBaseUrl + '
|
|
550
|
+
config.gatewayBaseUrl + '/api/v2/plays/runtime',
|
|
634
551
|
{
|
|
635
552
|
method: 'POST',
|
|
636
553
|
headers: {
|
|
637
554
|
'content-type': 'application/json',
|
|
638
555
|
authorization: 'Bearer ' + config.executorToken,
|
|
639
556
|
${JSON.stringify(PLAY_RUNTIME_TRANSPORT_ATTEMPT_HEADER)}: require('node:crypto').randomUUID(),
|
|
640
|
-
...(runtimeGatewayOidc
|
|
641
|
-
? runtimeGatewayOidcRequestHeaders(
|
|
642
|
-
runtimeGatewayOidc.scope,
|
|
643
|
-
runtimeGatewayOidc.token,
|
|
644
|
-
config.gatewayBaseUrl + '${APP_RUNTIME_COMPAT_PATH}',
|
|
645
|
-
) || {}
|
|
646
|
-
: {}),
|
|
647
557
|
},
|
|
648
558
|
body: JSON.stringify({
|
|
649
559
|
action: 'runner_heartbeat',
|
|
@@ -729,139 +639,6 @@ async function runnerHeartbeatTick() {
|
|
|
729
639
|
}
|
|
730
640
|
}
|
|
731
641
|
|
|
732
|
-
const startRuntimeGatewayOidcRenewalLoop = (${startRuntimeGatewayOidcRenewalLoop.toString()});
|
|
733
|
-
const isRuntimeGatewayOidcRenewalFatal = (${isRuntimeGatewayOidcRenewalFatal.toString()});
|
|
734
|
-
let runtimeGatewayOidcRenewalLoop = null;
|
|
735
|
-
|
|
736
|
-
function readRuntimeGatewayOidcClaims(token) {
|
|
737
|
-
if (typeof token !== 'string' || token.length > 4096 || token.split('.').length !== 3) return null;
|
|
738
|
-
try {
|
|
739
|
-
const claims = JSON.parse(Buffer.from(token.split('.')[1], 'base64url').toString('utf8'));
|
|
740
|
-
return claims && Number.isSafeInteger(claims.iat) && Number.isSafeInteger(claims.exp) ? claims : null;
|
|
741
|
-
} catch {
|
|
742
|
-
return null;
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
async function renewRuntimeGatewayOidcOnce() {
|
|
747
|
-
const credential = runtimeGatewayOidc;
|
|
748
|
-
const prior = readRuntimeGatewayOidcClaims(credential.token);
|
|
749
|
-
const controller = new AbortController();
|
|
750
|
-
const timeout = setTimeout(() => controller.abort(), ${RUNNER_HEARTBEAT_REQUEST_TIMEOUT_MS});
|
|
751
|
-
try {
|
|
752
|
-
const response = await fetch(credential.renewUrl, {
|
|
753
|
-
method: 'POST',
|
|
754
|
-
headers: {
|
|
755
|
-
'content-type': 'application/json',
|
|
756
|
-
authorization: 'Bearer ' + credential.executorToken,
|
|
757
|
-
...(runtimeGatewayOidcRequestHeaders(credential.scope, credential.token, credential.renewUrl) || {}),
|
|
758
|
-
},
|
|
759
|
-
body: JSON.stringify({ runId: credential.runId }),
|
|
760
|
-
redirect: 'manual',
|
|
761
|
-
signal: controller.signal,
|
|
762
|
-
});
|
|
763
|
-
if (!response.ok) {
|
|
764
|
-
const refusal = await response.json().catch(() => null);
|
|
765
|
-
// The gateway names why it refused. After a sandbox network cut the
|
|
766
|
-
// runner heartbeat may still be stale when the first renewal lands;
|
|
767
|
-
// only that refusal (attempt_not_live) is retried within the
|
|
768
|
-
// credential's remaining life. Every other refusal is definitive.
|
|
769
|
-
const detail = refusal && typeof refusal.detail === 'string' && /^[a-z_]{1,64}$/.test(refusal.detail) ? '_' + refusal.detail : '';
|
|
770
|
-
// The gateway clock, so the renewal loop can judge the initial
|
|
771
|
-
// credential's age despite sandbox clock skew.
|
|
772
|
-
const serverNowMs = Date.parse(response.headers.get('date') || '');
|
|
773
|
-
throw Object.assign(new Error('renewal_http_error'), {
|
|
774
|
-
code: 'http_' + response.status + detail,
|
|
775
|
-
...(Number.isFinite(serverNowMs) ? { serverNowMs } : {}),
|
|
776
|
-
});
|
|
777
|
-
}
|
|
778
|
-
const body = await response.json().catch(() => null);
|
|
779
|
-
const nextToken = body && body[${JSON.stringify(RUNTIME_GATEWAY_OIDC_RENEW_RESPONSE_FIELD)}];
|
|
780
|
-
const next = readRuntimeGatewayOidcClaims(nextToken);
|
|
781
|
-
if (
|
|
782
|
-
!prior ||
|
|
783
|
-
!next ||
|
|
784
|
-
next.exp <= prior.exp ||
|
|
785
|
-
['iss', 'aud', 'sub', 'deployment_id', 'run_id', 'run_attempt'].some((field) => prior[field] !== next[field]) ||
|
|
786
|
-
!runtimeGatewayOidcRequestHeaders(credential.scope, nextToken, credential.renewUrl)
|
|
787
|
-
) {
|
|
788
|
-
throw Object.assign(new Error('renewal_scope_mismatch'), { code: 'renewal_scope_mismatch' });
|
|
789
|
-
}
|
|
790
|
-
const temporary = runtimeGatewayOidcFilePath + '.' + require('node:crypto').randomUUID();
|
|
791
|
-
try {
|
|
792
|
-
fs.writeFileSync(temporary, nextToken, { mode: 0o600, flag: 'wx' });
|
|
793
|
-
fs.renameSync(temporary, runtimeGatewayOidcFilePath);
|
|
794
|
-
} finally {
|
|
795
|
-
try { fs.unlinkSync(temporary); } catch {}
|
|
796
|
-
}
|
|
797
|
-
credential.token = nextToken;
|
|
798
|
-
process.stderr.write(
|
|
799
|
-
'[play-runner.oidc] watchdog_oidc_renewed ' +
|
|
800
|
-
JSON.stringify({ runId: credential.runId, issuedAt: next.iat, expiresAt: next.exp }) +
|
|
801
|
-
'\\n',
|
|
802
|
-
);
|
|
803
|
-
return { iatS: next.iat, expS: next.exp };
|
|
804
|
-
} catch (error) {
|
|
805
|
-
throw controller.signal.aborted
|
|
806
|
-
? Object.assign(new Error('renewal_timeout'), { code: 'TimeoutError' })
|
|
807
|
-
: error;
|
|
808
|
-
} finally {
|
|
809
|
-
clearTimeout(timeout);
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
function runtimeGatewayOidcRenewalErrorCode(error) {
|
|
814
|
-
return error && (error.code === 'renewal_scope_mismatch' || error.code === 'TimeoutError' || /^http_/.test(String(error.code)))
|
|
815
|
-
? error.code
|
|
816
|
-
: runnerHeartbeatErrorCode(error);
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
if (runtimeGatewayOidc) {
|
|
820
|
-
const initialClaims = readRuntimeGatewayOidcClaims(runtimeGatewayOidc.token);
|
|
821
|
-
runtimeGatewayOidcRenewalLoop = startRuntimeGatewayOidcRenewalLoop({
|
|
822
|
-
// An unreadable initial token is due at once (after the retry base);
|
|
823
|
-
// its renewal then fails loudly.
|
|
824
|
-
initial: initialClaims
|
|
825
|
-
? { iatS: initialClaims.iat, expS: initialClaims.exp }
|
|
826
|
-
: { iatS: 0, expS: 0 },
|
|
827
|
-
renewAfterSeconds: ${RUNTIME_GATEWAY_OIDC_RENEW_AFTER_SECONDS},
|
|
828
|
-
expiryMarginSeconds: ${RUNTIME_GATEWAY_OIDC_RENEW_EXPIRY_MARGIN_SECONDS},
|
|
829
|
-
retryBaseMs: ${Math.max(1, Math.floor(runtimeGatewayOidcRenewRetryBaseMs))},
|
|
830
|
-
retryMaxMs: ${RUNTIME_GATEWAY_OIDC_RENEW_RETRY_MAX_MS},
|
|
831
|
-
now: () => Date.now(),
|
|
832
|
-
random: () => Math.random(),
|
|
833
|
-
setTimer: (run, delayMs) => {
|
|
834
|
-
const timer = setTimeout(run, delayMs);
|
|
835
|
-
timer.unref?.();
|
|
836
|
-
return timer;
|
|
837
|
-
},
|
|
838
|
-
clearTimer: (timer) => clearTimeout(timer),
|
|
839
|
-
renew: renewRuntimeGatewayOidcOnce,
|
|
840
|
-
// A definitive refusal (lost lease, cancelled, wrong scope) ends this
|
|
841
|
-
// attempt now, loudly, while the crash epilogue can still reach the
|
|
842
|
-
// gateway. It never silently outlives its credential.
|
|
843
|
-
isFatal: (error) => isRuntimeGatewayOidcRenewalFatal(runtimeGatewayOidcRenewalErrorCode(error)),
|
|
844
|
-
isStopped: () => settled || stopRequested,
|
|
845
|
-
onRetry: (error, diagnostic) => {
|
|
846
|
-
process.stderr.write('[play-runner.oidc] watchdog_oidc_renewal_retry ' + JSON.stringify({
|
|
847
|
-
runId: runtimeGatewayOidc.runId,
|
|
848
|
-
errorCode: runtimeGatewayOidcRenewalErrorCode(error),
|
|
849
|
-
...diagnostic,
|
|
850
|
-
}) + '\\n');
|
|
851
|
-
},
|
|
852
|
-
onFatal: (error, diagnostic) => {
|
|
853
|
-
const details = {
|
|
854
|
-
runId: runtimeGatewayOidc.runId,
|
|
855
|
-
errorCode: runtimeGatewayOidcRenewalErrorCode(error),
|
|
856
|
-
failures: diagnostic.failures,
|
|
857
|
-
remainingSeconds: diagnostic.remainingSeconds,
|
|
858
|
-
};
|
|
859
|
-
process.stderr.write('${RUNTIME_GATEWAY_OIDC_RENEWAL_FAILED_REASON}: ' + JSON.stringify(details) + '\\n');
|
|
860
|
-
stopChild('${RUNTIME_GATEWAY_OIDC_RENEWAL_FAILED_REASON}', details);
|
|
861
|
-
},
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
|
|
865
642
|
function writeTerminationDiagnostic(reason, details = {}) {
|
|
866
643
|
if (!terminationDiagnosticPath) return;
|
|
867
644
|
try {
|
|
@@ -1156,7 +933,6 @@ function finish(code, signal) {
|
|
|
1156
933
|
clearInterval(runtimeBoundaryPoll);
|
|
1157
934
|
clearInterval(memoryWatch);
|
|
1158
935
|
clearInterval(stallWatch);
|
|
1159
|
-
if (runtimeGatewayOidcRenewalLoop) runtimeGatewayOidcRenewalLoop.stop();
|
|
1160
936
|
stopRunnerHeartbeat();
|
|
1161
937
|
clearTimeout(startupTimer);
|
|
1162
938
|
if (runtimeTimer) clearTimeout(runtimeTimer);
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
withModalCallSignal,
|
|
27
27
|
} from '../../modal-runtime-config';
|
|
28
28
|
import type { PlaySandboxRuntimeLimits } from '../../../plays/sandbox-runtime-limits';
|
|
29
|
-
import { withRuntimeGatewayEgressCidrs } from '../../runtime-gateway-egress';
|
|
30
29
|
import { validateDaytonaExecutionContext } from './daytona-lifecycle';
|
|
31
30
|
import {
|
|
32
31
|
stageRunnerPayload,
|
|
@@ -343,21 +342,6 @@ async function persistLateModalSandboxResource(input: {
|
|
|
343
342
|
);
|
|
344
343
|
}
|
|
345
344
|
|
|
346
|
-
/** DNS failures that a later attempt can outrun (not "no such record"). */
|
|
347
|
-
const TRANSIENT_RESOLVER_ERROR_CODES: ReadonlySet<string> = new Set([
|
|
348
|
-
'EAI_AGAIN',
|
|
349
|
-
'ETIMEOUT',
|
|
350
|
-
'ESERVFAIL',
|
|
351
|
-
'ECONNREFUSED',
|
|
352
|
-
'ECONNRESET',
|
|
353
|
-
'ECANCELLED',
|
|
354
|
-
]);
|
|
355
|
-
|
|
356
|
-
function isTransientResolverError(error: unknown): boolean {
|
|
357
|
-
const code = (error as { code?: unknown } | null)?.code;
|
|
358
|
-
return typeof code === 'string' && TRANSIENT_RESOLVER_ERROR_CODES.has(code);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
345
|
export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
362
346
|
async execute(config, callbacks) {
|
|
363
347
|
let runtimeResourceRegistrationError: unknown;
|
|
@@ -390,25 +374,6 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
390
374
|
runtimeSchedulerSchema: config.context.runtimeSchedulerSchema,
|
|
391
375
|
limits: config.context.sandboxRuntimeLimits,
|
|
392
376
|
});
|
|
393
|
-
// A run pinned to an app-hosted Runtime gateway must reach that host
|
|
394
|
-
// through a restricted sandbox's CIDR list, by the same rule as Daytona.
|
|
395
|
-
// Only a pinned, already-restricted sandbox resolves anything; every
|
|
396
|
-
// other run keeps the exact list and path it had before.
|
|
397
|
-
const credentialScope = config.context.runtimeGatewayCredentialScope;
|
|
398
|
-
const outboundCidrAllowlist =
|
|
399
|
-
credentialScope && modalConfig.outboundCidrAllowlist
|
|
400
|
-
? await withRuntimeGatewayEgressCidrs({
|
|
401
|
-
credentialScope,
|
|
402
|
-
cidrs: modalConfig.outboundCidrAllowlist,
|
|
403
|
-
}).catch((error: unknown) => {
|
|
404
|
-
// A resolver hiccup is not the run's fault and no sandbox exists
|
|
405
|
-
// yet: defer like any runner that could not reach its gateway.
|
|
406
|
-
// A host with no IPv4 address still fails loudly.
|
|
407
|
-
throw isTransientResolverError(error)
|
|
408
|
-
? recoveryForRunnerStartupNotLive(error)
|
|
409
|
-
: error;
|
|
410
|
-
})
|
|
411
|
-
: modalConfig.outboundCidrAllowlist;
|
|
412
377
|
const resources = modalSandboxResourcesForPlay(modalConfig.limits);
|
|
413
378
|
const memoryPolicy = resolveModalSandboxMemoryPolicy({
|
|
414
379
|
limits: modalConfig.limits,
|
|
@@ -497,7 +462,9 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
497
462
|
idleTimeoutMs: modalSandboxLifetimeMs(modalConfig.limits),
|
|
498
463
|
workdir: modalConfig.workdir,
|
|
499
464
|
tags: createTags,
|
|
500
|
-
...(outboundCidrAllowlist
|
|
465
|
+
...(modalConfig.outboundCidrAllowlist
|
|
466
|
+
? { outboundCidrAllowlist: modalConfig.outboundCidrAllowlist }
|
|
467
|
+
: {}),
|
|
501
468
|
}),
|
|
502
469
|
onLateSuccess: async (lateSandbox) => {
|
|
503
470
|
logSandboxCreateOutcome({
|
|
@@ -22,32 +22,6 @@ export const PLAY_RUNTIME_HARNESS_ALLOWED_PATH_PREFIXES = [
|
|
|
22
22
|
'/api/v2/integrations/',
|
|
23
23
|
] as const;
|
|
24
24
|
|
|
25
|
-
/**
|
|
26
|
-
* Paths the runner, watchdog, and gateways send. Senders and the gateway
|
|
27
|
-
* route table (`@deepline/runtime-gateway/routes`) share these builders, so a
|
|
28
|
-
* sent path and its route cannot drift apart.
|
|
29
|
-
*/
|
|
30
|
-
export const APP_RUNTIME_COMPAT_PATH = '/api/v2/plays/runtime';
|
|
31
|
-
/** Pre-split runners posted runtime actions to `/runtime` on the gateway. */
|
|
32
|
-
export const LEGACY_GATEWAY_RUNTIME_PATH = '/runtime';
|
|
33
|
-
export const PLAY_RUN_START_PATH = '/api/v2/plays/run';
|
|
34
|
-
export const RUNTIME_EXECUTOR_JWKS_PATH =
|
|
35
|
-
'/.well-known/deepline-runtime-jwks.json';
|
|
36
|
-
|
|
37
|
-
export type RuntimeToolPathKind = 'metadata' | 'auth_scope' | 'event_wait';
|
|
38
|
-
|
|
39
|
-
export function runtimeToolPath(
|
|
40
|
-
toolId: string,
|
|
41
|
-
kind: RuntimeToolPathKind,
|
|
42
|
-
): string {
|
|
43
|
-
const base = `/api/v2/plays/runtime-tools/${encodeURIComponent(toolId)}`;
|
|
44
|
-
return kind === 'metadata'
|
|
45
|
-
? base
|
|
46
|
-
: kind === 'auth_scope'
|
|
47
|
-
? `${base}/auth-scope`
|
|
48
|
-
: `${base}/event-wait`;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
25
|
export type IntegrationExecuteSuffix =
|
|
52
26
|
| 'execute'
|
|
53
27
|
| 'stream'
|
|
@@ -195,7 +195,6 @@ import {
|
|
|
195
195
|
import type { RuntimeTestFaultName } from './runtime-incident-drills';
|
|
196
196
|
import { COMPLETED_RECEIPT_CACHE_INSERT_LEASE_ID } from './durable-receipt-execution';
|
|
197
197
|
import { vercelProtectionBypassHeader } from './vercel-protection';
|
|
198
|
-
import { isRuntimeGatewayLaunchError } from './runtime-gateway-profile';
|
|
199
198
|
import {
|
|
200
199
|
isRuntimePostgresAdmissionError,
|
|
201
200
|
RuntimePostgresAdmission,
|
|
@@ -214,10 +213,6 @@ type RuntimeApiContext = {
|
|
|
214
213
|
dbSessionStrategy?: 'preloaded' | 'gateway_only' | 'trusted_dynamic' | null;
|
|
215
214
|
preloadedDbSessions?: PreloadedRuntimeDbSession[] | null;
|
|
216
215
|
vercelProtectionBypassToken?: string | null;
|
|
217
|
-
/** App transport; an app-hosted gateway passes its in-process dispatch so
|
|
218
|
-
* calls carrying a deployment-pinned token stay inside that deployment.
|
|
219
|
-
* Absent uses fetch. */
|
|
220
|
-
fetch?: typeof fetch;
|
|
221
216
|
runtimeTestFaultHeader?: string | null;
|
|
222
217
|
disablePostgresPoolCache?: boolean | null;
|
|
223
218
|
postgresSessionUnwrapKey?: string | null;
|
|
@@ -1042,7 +1037,7 @@ async function postRuntimeApi<TResponse>(
|
|
|
1042
1037
|
Math.min(runtimeApiRequestTimeoutMs(body.action), operationRemainingMs),
|
|
1043
1038
|
);
|
|
1044
1039
|
try {
|
|
1045
|
-
response = await
|
|
1040
|
+
response = await fetch(url, {
|
|
1046
1041
|
method: 'POST',
|
|
1047
1042
|
headers: resolveRuntimeApiHeaders(context, vercelHeaders),
|
|
1048
1043
|
body:
|
|
@@ -1081,9 +1076,6 @@ async function postRuntimeApi<TResponse>(
|
|
|
1081
1076
|
if (context.abortSignal?.aborted) {
|
|
1082
1077
|
throw context.abortSignal.reason ?? error;
|
|
1083
1078
|
}
|
|
1084
|
-
// A pinned gateway credential that cannot be minted is deterministic;
|
|
1085
|
-
// it is not a network cut, so retrying only stalls the caller.
|
|
1086
|
-
if (isRuntimeGatewayLaunchError(error)) throw error;
|
|
1087
1079
|
const message = error instanceof Error ? error.message : String(error);
|
|
1088
1080
|
if (response) {
|
|
1089
1081
|
// A status line arrived and then its body failed or stalled. The
|
|
@@ -193,15 +193,10 @@ export async function mintPlayRunAttemptRuntimeToken(input: {
|
|
|
193
193
|
terminalContract?: DirectCompletedTerminalContract | null;
|
|
194
194
|
capabilities?: readonly RuntimeExecutionCapability[];
|
|
195
195
|
runtimeOrigin?: string | null;
|
|
196
|
-
/** Runtime gateway pin claims; both or neither. Absent on unpinned runs. */
|
|
197
|
-
runtimeGatewayDeploymentId?: string | null;
|
|
198
|
-
runtimeGatewayProfileId?: string | null;
|
|
199
196
|
runLedgerIngressPrefixOrigin?: string | null;
|
|
200
197
|
}): Promise<string> {
|
|
201
198
|
return await mintWorkflowExecutorToken({
|
|
202
199
|
...runtimeAuthorityMintInput(input.descriptor, input),
|
|
203
|
-
runtimeGatewayDeploymentId: input.runtimeGatewayDeploymentId,
|
|
204
|
-
runtimeGatewayProfileId: input.runtimeGatewayProfileId,
|
|
205
200
|
runLedgerIngressPrefixOrigin: input.runLedgerIngressPrefixOrigin,
|
|
206
201
|
});
|
|
207
202
|
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { PLAY_RUNTIME_BACKENDS, type PlayRuntimeBackendId } from './backend';
|
|
2
|
-
import {
|
|
3
|
-
normalizeRuntimeGatewayProfileId,
|
|
4
|
-
type RuntimeGatewayProfileId,
|
|
5
|
-
} from './runtime-gateway-profile';
|
|
6
2
|
|
|
7
3
|
export const PLAY_RUNTIME_ENVIRONMENTS = ['preview'] as const;
|
|
8
4
|
|
|
@@ -16,21 +12,8 @@ export type PlayRuntimeSelection = {
|
|
|
16
12
|
backend?: Extract<PlayRuntimeBackendId, 'daytona' | 'modal'>;
|
|
17
13
|
/** Durable placement contract for the selected Preview worker lane. */
|
|
18
14
|
sandboxPlacementPolicy?: string;
|
|
19
|
-
/** Where this run's receipt/execution gateways are hosted. Absent: Fly. */
|
|
20
|
-
gatewayProfile?: RuntimeGatewayProfileId;
|
|
21
15
|
};
|
|
22
16
|
|
|
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
|
-
|
|
34
17
|
const PLAY_RUNTIME_NAMESPACE_PATTERN = /^[a-z][a-z0-9-]{0,30}$/;
|
|
35
18
|
const PLAY_RUNTIME_SANDBOX_PLACEMENT_POLICY_PATTERN =
|
|
36
19
|
/^[a-z][a-z0-9_]*@[1-9][0-9]*$/;
|
|
@@ -68,15 +51,12 @@ export function normalizePlayRuntimeSelection(
|
|
|
68
51
|
key !== 'environment' &&
|
|
69
52
|
key !== 'namespace' &&
|
|
70
53
|
key !== 'backend' &&
|
|
71
|
-
key !== 'sandboxPlacementPolicy'
|
|
72
|
-
key !== 'gatewayProfile',
|
|
54
|
+
key !== 'sandboxPlacementPolicy',
|
|
73
55
|
) ||
|
|
74
56
|
record.environment !== 'preview'
|
|
75
57
|
) {
|
|
76
58
|
return null;
|
|
77
59
|
}
|
|
78
|
-
const gatewayProfile = selectedGatewayProfile(record.gatewayProfile);
|
|
79
|
-
if (gatewayProfile === null) return null;
|
|
80
60
|
const namespace = normalizePlayRuntimeNamespace(record.namespace);
|
|
81
61
|
if (!namespace) return null;
|
|
82
62
|
const sandboxPlacementPolicy =
|
|
@@ -103,7 +83,6 @@ export function normalizePlayRuntimeSelection(
|
|
|
103
83
|
namespace,
|
|
104
84
|
...(record.backend === undefined ? {} : { backend: record.backend }),
|
|
105
85
|
...(sandboxPlacementPolicy ? { sandboxPlacementPolicy } : {}),
|
|
106
|
-
...(gatewayProfile ? { gatewayProfile } : {}),
|
|
107
86
|
};
|
|
108
87
|
}
|
|
109
88
|
|
|
@@ -112,18 +91,10 @@ export function normalizePlayRuntimeSelection(
|
|
|
112
91
|
* the `play_run.sandbox_placement` capability in
|
|
113
92
|
* `@deepline/auth/internal-capabilities` decides who may send it.
|
|
114
93
|
*/
|
|
115
|
-
export type PlayNativeRuntimeSelection =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
};
|
|
94
|
+
export type PlayNativeRuntimeSelection = {
|
|
95
|
+
environment: 'native';
|
|
96
|
+
sandboxPlacementPolicy: string;
|
|
97
|
+
};
|
|
127
98
|
|
|
128
99
|
/** Every `runtime` value a Play run accepts. */
|
|
129
100
|
export type PlayRunRuntimeSelection =
|
|
@@ -140,28 +111,17 @@ export function normalizePlayRunRuntimeSelection(
|
|
|
140
111
|
}
|
|
141
112
|
if (
|
|
142
113
|
Object.keys(record).some(
|
|
143
|
-
(key) =>
|
|
144
|
-
key !== 'environment' &&
|
|
145
|
-
key !== 'sandboxPlacementPolicy' &&
|
|
146
|
-
key !== 'gatewayProfile',
|
|
114
|
+
(key) => key !== 'environment' && key !== 'sandboxPlacementPolicy',
|
|
147
115
|
)
|
|
148
116
|
) {
|
|
149
117
|
return null;
|
|
150
118
|
}
|
|
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
|
-
}
|
|
156
119
|
const sandboxPlacementPolicy = normalizePlayRuntimeSandboxPlacementPolicy(
|
|
157
120
|
record.sandboxPlacementPolicy,
|
|
158
121
|
);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
sandboxPlacementPolicy,
|
|
163
|
-
...(gatewayProfile ? { gatewayProfile } : {}),
|
|
164
|
-
};
|
|
122
|
+
return sandboxPlacementPolicy
|
|
123
|
+
? { environment: 'native', sandboxPlacementPolicy }
|
|
124
|
+
: null;
|
|
165
125
|
}
|
|
166
126
|
|
|
167
127
|
export function normalizePlayRuntimeEnvironment(
|