deepline 0.3.520 → 0.3.522
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/durable-runs-rollout.ts +8 -1
- 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-4DSPSIU5.js → artifacts-GIZZH5VA.js} +20 -20
- package/dist/cli/{artifacts-D6PU7SBC.mjs → artifacts-RY2MK74N.mjs} +8 -8
- package/dist/cli/auth-JSES2JOQ.js +43 -0
- package/dist/cli/{auth-MXKNPUXW.mjs → auth-YIBY5IKT.mjs} +5 -5
- package/dist/cli/{billing-SQ26NKGH.mjs → billing-G3IX3SNY.mjs} +8 -8
- package/dist/cli/{billing-WEYCNJIR.js → billing-UDKL53GI.js} +81 -81
- package/dist/cli/{chunk-6Y3DDRRN.js → chunk-2KHUFWTK.js} +3 -3
- package/dist/cli/{chunk-4VR5OTYP.js → chunk-37SXIFIU.js} +44 -44
- package/dist/cli/{chunk-QSWPDYOP.mjs → chunk-3KMGVOBM.mjs} +4 -4
- package/dist/cli/{chunk-7VJKHJY7.js → chunk-4DFWDA2Q.js} +14 -14
- package/dist/cli/{chunk-VSPNBBRT.js → chunk-4MF44THR.js} +66 -119
- package/dist/cli/{chunk-NLIO6QLP.mjs → chunk-4TUMKJZX.mjs} +2 -2
- package/dist/cli/{chunk-KKSMHTQO.mjs → chunk-52MHE7B4.mjs} +1 -1
- package/dist/cli/{chunk-AVW2LKRF.js → chunk-534YYHIF.js} +6 -6
- package/dist/cli/{chunk-QQGRQRCS.mjs → chunk-5477PEHL.mjs} +1 -1
- package/dist/cli/{chunk-YHHLLONU.js → chunk-5BQPEHEP.js} +14 -14
- package/dist/cli/{chunk-GVTHFDKN.js → chunk-5H22VJPE.js} +6 -6
- package/dist/cli/{chunk-LUIPBI6P.js → chunk-6SJPZV5E.js} +2 -2
- package/dist/cli/{chunk-NNUJQ5O2.mjs → chunk-7J5PLHII.mjs} +1 -1
- package/dist/cli/{chunk-I4GBCKBL.js → chunk-7JEN3FX4.js} +5 -5
- package/dist/cli/{chunk-VSLU4JZV.mjs → chunk-BONXEWYF.mjs} +3 -3
- package/dist/cli/{chunk-AM7HMWNA.js → chunk-BZY335JP.js} +5 -5
- package/dist/cli/{chunk-YP3G2CP6.mjs → chunk-C6WGMODR.mjs} +2 -2
- package/dist/cli/{chunk-V6BUWQBI.mjs → chunk-CFXERH7F.mjs} +1 -1
- package/dist/cli/{chunk-ORAWUIMN.js → chunk-DARD7TJ7.js} +53 -53
- package/dist/cli/{chunk-BHAP6FIZ.js → chunk-DLDWAPA5.js} +4 -4
- package/dist/cli/{chunk-FWGTBR3W.js → chunk-DNJJ3ULJ.js} +2 -2
- package/dist/cli/{chunk-Y5QYWFRI.js → chunk-DRDZBRXV.js} +7 -7
- package/dist/cli/{chunk-JO2MQ6XR.js → chunk-EJBW7Y6Z.js} +98 -98
- package/dist/cli/{chunk-2EDGA7OE.mjs → chunk-ENWJFUWK.mjs} +2 -2
- package/dist/cli/{chunk-6XJA23MZ.js → chunk-F5D623KO.js} +26 -26
- package/dist/cli/{chunk-HT675XNR.mjs → chunk-FKD3KL5Q.mjs} +1 -1
- package/dist/cli/{chunk-2BJILUE3.js → chunk-FNHUDCJE.js} +10 -10
- package/dist/cli/{chunk-XU57CH42.mjs → chunk-FQQAAR3Q.mjs} +1 -1
- package/dist/cli/{chunk-6T2LB43P.mjs → chunk-G65FJ5JX.mjs} +2 -2
- package/dist/cli/{chunk-UA4MXESL.js → chunk-GMYDVW7Z.js} +3 -3
- package/dist/cli/{chunk-74MOIEDC.js → chunk-GVKW3LCA.js} +11 -11
- package/dist/cli/{chunk-D5VTWJ7K.js → chunk-ISUUSSS4.js} +16 -16
- package/dist/cli/{chunk-KTAOVRXT.js → chunk-KMBF3N2Z.js} +16 -16
- package/dist/cli/{chunk-5TEXJM6F.mjs → chunk-LFSOBW7E.mjs} +11 -11
- package/dist/cli/{chunk-A5VR463F.mjs → chunk-MD524MRB.mjs} +1 -1
- package/dist/cli/{chunk-NPRSGUHB.mjs → chunk-NDNG3MAT.mjs} +5 -5
- package/dist/cli/{chunk-NWSKBWQM.mjs → chunk-OAQIVJFY.mjs} +2 -2
- package/dist/cli/{chunk-6VY2SJ6B.mjs → chunk-PDLRUZ42.mjs} +5 -5
- package/dist/cli/{chunk-M6YHS5V7.mjs → chunk-RDJTCW3I.mjs} +3 -3
- package/dist/cli/{chunk-3YHS4BLB.js → chunk-RI672VNY.js} +2 -2
- package/dist/cli/{chunk-TQTQ3YYA.mjs → chunk-RKE5YTHY.mjs} +5 -5
- package/dist/cli/{chunk-SHB2BNI6.mjs → chunk-SFMCKB57.mjs} +37 -90
- package/dist/cli/{chunk-BMCRTI6Z.mjs → chunk-UBKA33KY.mjs} +1 -22
- package/dist/cli/{chunk-6GI7BYSL.mjs → chunk-UV6XCHOZ.mjs} +1 -1
- package/dist/cli/{chunk-U5646OVV.mjs → chunk-VFCVH2LV.mjs} +5 -5
- package/dist/cli/{chunk-7QAX5VBT.js → chunk-VIM6I7RC.js} +41 -41
- package/dist/cli/{chunk-WSGXBROE.js → chunk-XDVT3GOM.js} +1 -22
- package/dist/cli/{chunk-KCISDDNK.mjs → chunk-XR6TN5DT.mjs} +6 -6
- package/dist/cli/{chunk-XXDY7K7F.js → chunk-XT25FX6T.js} +3 -3
- package/dist/cli/{chunk-ASGGZ6BI.mjs → chunk-XXY4E57R.mjs} +2 -2
- package/dist/cli/{chunk-YVQLXMJU.mjs → chunk-Y3LDRCMB.mjs} +3 -3
- package/dist/cli/{chunk-5ECMRQCL.js → chunk-ZUAKRBZB.js} +1 -1
- package/dist/cli/{chunk-DQQ6FDE6.mjs → chunk-ZZ7U4YJS.mjs} +1 -1
- package/dist/cli/{chunk-LYIJ3YUP.js → chunk-ZZLZCO6Y.js} +22 -22
- package/dist/cli/{csv-VJNR6FOZ.js → csv-3HIE4VCO.js} +13 -13
- package/dist/cli/{csv-T7HIELZ2.mjs → csv-PE35WGRO.mjs} +4 -4
- package/dist/cli/{db-OE2EXZXL.mjs → db-L7ZMMQKW.mjs} +8 -8
- package/dist/cli/{db-JF2I54V7.js → db-O2YRTTDO.js} +29 -29
- package/dist/cli/describe-EB336DAO.js +50 -0
- package/dist/cli/{describe-HXZZC3LC.mjs → describe-NI324Y2M.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-4BXRIJFF.mjs → executions-T6KU2OKK.mjs} +8 -8
- package/dist/cli/{executions-UQ2H6MJZ.js → executions-VH4DKLFI.js} +10 -10
- package/dist/cli/{feedback-TXF5CQKA.mjs → feedback-SCSJC3FX.mjs} +5 -5
- package/dist/cli/{feedback-MKFN7DYY.js → feedback-ZLC6G5OK.js} +10 -10
- package/dist/cli/git-23T7TXAH.js +25 -0
- package/dist/cli/{git-MG3NAV65.mjs → git-I4LVQCID.mjs} +5 -5
- package/dist/cli/index.js +141 -141
- package/dist/cli/index.mjs +43 -43
- package/dist/cli/{legacy-noops-XSDY46XD.mjs → legacy-noops-44FQ2256.mjs} +6 -6
- package/dist/cli/{legacy-noops-R76I2OWW.js → legacy-noops-UPFWEHPG.js} +9 -9
- package/dist/cli/{monitors-FS3DIDM7.js → monitors-JN6IQGK6.js} +102 -102
- package/dist/cli/{monitors-NVT5YQKV.mjs → monitors-LMSASWXE.mjs} +9 -9
- package/dist/cli/{org-SBI6FC6D.js → org-F7O3ZU5O.js} +74 -74
- package/dist/cli/{org-XU7JONWS.mjs → org-QYLVEE7A.mjs} +8 -8
- package/dist/cli/{pages-AFB5DVBR.mjs → pages-5XE4LBZN.mjs} +8 -8
- package/dist/cli/{pages-2CZFJJV6.js → pages-KEL3Y4L4.js} +20 -20
- package/dist/cli/{play-EQEIT5S4.mjs → play-MWQG3G32.mjs} +21 -21
- package/dist/cli/{play-WZH72UGC.js → play-OURHH6KV.js} +338 -338
- package/dist/cli/{providers-3VXTATHF.mjs → providers-IQY7LUBB.mjs} +8 -8
- package/dist/cli/{providers-SHSVUQA3.js → providers-ZCBWPE3C.js} +11 -11
- package/dist/cli/{quickstart-45YS4SOD.mjs → quickstart-L45NGRMI.mjs} +4 -4
- package/dist/cli/{quickstart-KPVPK3VL.js → quickstart-O53OXTN6.js} +6 -6
- package/dist/cli/{run-XEHRZT57.mjs → run-VCSIWLEU.mjs} +25 -25
- package/dist/cli/{run-U5RWBX5J.js → run-W745Z3Z5.js} +43 -43
- 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-R6K7ZAMU.js +33 -0
- package/dist/cli/{search-V7XIWBQ2.mjs → search-THELKULN.mjs} +10 -10
- package/dist/cli/{search-output-3KAJUV2A.mjs → search-output-N7MJLYYD.mjs} +4 -4
- package/dist/cli/{search-output-ZNIICV5Z.js → search-output-SJW7LEOM.js} +6 -6
- package/dist/cli/{secrets-SCSG3QXJ.mjs → secrets-44ST3FJH.mjs} +8 -8
- package/dist/cli/{secrets-53TUV6JK.js → secrets-GDXPX3KB.js} +17 -17
- package/dist/cli/sessions-2V5ZFOWL.js +18 -0
- package/dist/cli/{sessions-MCTHLLK3.mjs → sessions-LYCBI77S.mjs} +6 -6
- package/dist/cli/{settings-ZNOXOIX2.js → settings-3WOFF642.js} +88 -88
- package/dist/cli/{settings-Q2HKACSE.mjs → settings-GXPDMJFG.mjs} +15 -15
- package/dist/cli/{setup-GO4EULLY.js → setup-YHLMBJP4.js} +50 -50
- package/dist/cli/{setup-WKM35SZJ.mjs → setup-YM6JEB64.mjs} +10 -10
- package/dist/cli/{skills-DZZLW6OV.mjs → skills-WX4XWEAT.mjs} +8 -8
- package/dist/cli/skills-XNGADDO6.js +37 -0
- package/dist/cli/{tools-EKVSK6X4.mjs → tools-K24VSQ7S.mjs} +19 -19
- package/dist/cli/tools-ROUMCB7B.js +57 -0
- package/dist/cli/{update-FPHYVHSC.mjs → update-PSSCF5AT.mjs} +10 -10
- package/dist/cli/update-RXURGIRW.js +35 -0
- package/dist/cli/{workflow-5YAZK5EI.mjs → workflow-DGOPYATO.mjs} +9 -9
- package/dist/cli/{workflow-27H3NCNY.js → workflow-FPVI3NIA.js} +19 -19
- package/dist/{client-DhEOE19l.d.ts → client-B-2Am2y6.d.ts} +1 -1
- package/dist/{client-lJmz2QwF.d.mts → client-DA71-2_u.d.mts} +1 -1
- package/dist/{client-core-BGiSMrBD.d.mts → client-core-BXbds1cb.d.mts} +0 -19
- package/dist/{client-core-DYCGaRBZ.d.ts → client-core-C0IzDKMJ.d.ts} +0 -19
- 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-TH4JV6BH.js +0 -43
- package/dist/cli/describe-4FLGKRCA.js +0 -50
- package/dist/cli/git-B2QO3SLK.js +0 -25
- package/dist/cli/run-identity-HFYABUJS.js +0 -31
- package/dist/cli/search-Z2V43OPM.js +0 -33
- package/dist/cli/sessions-BOJCVLR7.js +0 -18
- package/dist/cli/skills-B4BAH2B2.js +0 -37
- package/dist/cli/tools-Z5NCKIAB.js +0 -57
- package/dist/cli/update-XCL7F5T6.js +0 -35
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { APP_RUNTIME_COMPAT_PATH } from '../runtime-api-paths';
|
|
2
1
|
import { RUNTIME_CLAIM_HEARTBEAT_DIVISOR } from '../runtime-constants';
|
|
3
2
|
import { PLAY_RUNTIME_TRANSPORT_ATTEMPT_HEADER } from '../runtime-contract';
|
|
4
3
|
import {
|
|
@@ -107,6 +106,7 @@ export interface RunnerHeartbeatLoopHandle {
|
|
|
107
106
|
lastSuccessAtMs: () => number;
|
|
108
107
|
}
|
|
109
108
|
|
|
109
|
+
const APP_RUNTIME_COMPAT_PATH = '/api/v2/plays/runtime';
|
|
110
110
|
export const RUNNER_HEARTBEAT_REQUEST_TIMEOUT_MS = 10_000;
|
|
111
111
|
// The detached startup deadline is shorter than the normal 40s cadence.
|
|
112
112
|
// Retry initial transport failures while customer execution remains fenced.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { APP_RUNTIME_COMPAT_PATH } from '../runtime-api-paths';
|
|
2
1
|
import type { PlayRunnerEvent } from '../protocol';
|
|
3
2
|
import { isDurableDirectRunnerLog } from '../log-provenance';
|
|
4
3
|
import { jsonByteLengthUpTo } from '../output-size-limits';
|
|
@@ -29,6 +28,8 @@ export const RUNNER_PROGRESS_PUSH_MAX_BATCH = 500;
|
|
|
29
28
|
*/
|
|
30
29
|
export const RUNNER_PROGRESS_PUSH_STOP_TIMEOUT_MS = 5_000;
|
|
31
30
|
|
|
31
|
+
const APP_RUNTIME_COMPAT_PATH = '/api/v2/plays/runtime';
|
|
32
|
+
|
|
32
33
|
export interface RunnerProgressPusher {
|
|
33
34
|
snapshot: () => {
|
|
34
35
|
retainedBytes: number;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { APP_RUNTIME_COMPAT_PATH } from '../runtime-api-paths';
|
|
2
1
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
3
2
|
import {
|
|
4
3
|
RUNNER_TERMINAL_CHECKPOINT_DISPOSITION,
|
|
@@ -46,6 +45,7 @@ const TERMINAL_PUSH_MAX_ATTEMPTS =
|
|
|
46
45
|
const TERMINAL_PUSH_RETRY_DELAYS_MS = [500, 1_000, 2_000, 4_000] as const;
|
|
47
46
|
const TERMINAL_PUSH_REQUEST_TIMEOUT_MS =
|
|
48
47
|
RUNTIME_RELIABILITY_POLICY.gateway.terminalPushRequestTimeoutMs;
|
|
48
|
+
const APP_RUNTIME_COMPAT_PATH = '/api/v2/plays/runtime';
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* A terminal result reserves its 5 MiB customer budget for the authored
|
package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts
CHANGED
|
@@ -17,7 +17,6 @@ import type {
|
|
|
17
17
|
PlayRunnerResult,
|
|
18
18
|
} from '../../protocol';
|
|
19
19
|
import { isIsolatedRuntimeSchedulerSchema } from '../../runtime-scheduler-topology';
|
|
20
|
-
import { withRuntimeGatewayEgressCidrs } from '../../runtime-gateway-egress';
|
|
21
20
|
import { PLAY_RUNNER_TIMEOUT_SECONDS } from '../../runtime-constants';
|
|
22
21
|
import {
|
|
23
22
|
STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS,
|
|
@@ -563,30 +562,6 @@ export function filterIpv4CidrAllowList(raw: string | null): string | null {
|
|
|
563
562
|
return ipv4.length > 0 ? ipv4.join(',') : null;
|
|
564
563
|
}
|
|
565
564
|
|
|
566
|
-
/**
|
|
567
|
-
* Daytona's form of the shared pinned-host egress rule
|
|
568
|
-
* (`withRuntimeGatewayEgressCidrs`): its `networkAllowList` is one
|
|
569
|
-
* comma-separated CIDR string. An unrestricted sandbox and an unpinned run
|
|
570
|
-
* are returned unchanged, without resolving.
|
|
571
|
-
*/
|
|
572
|
-
export async function runtimeGatewayDaytonaNetworkAllowList(input: {
|
|
573
|
-
credentialScope:
|
|
574
|
-
| PlayRunnerExecutionConfig['context']['runtimeGatewayCredentialScope']
|
|
575
|
-
| undefined;
|
|
576
|
-
networkAllowList: string | null;
|
|
577
|
-
resolveIpv4?: (hostname: string) => Promise<string[]>;
|
|
578
|
-
}): Promise<string | null> {
|
|
579
|
-
if (!input.credentialScope || !input.networkAllowList) {
|
|
580
|
-
return input.networkAllowList;
|
|
581
|
-
}
|
|
582
|
-
const cidrs = await withRuntimeGatewayEgressCidrs({
|
|
583
|
-
credentialScope: input.credentialScope,
|
|
584
|
-
cidrs: input.networkAllowList.split(','),
|
|
585
|
-
...(input.resolveIpv4 ? { resolveIpv4: input.resolveIpv4 } : {}),
|
|
586
|
-
});
|
|
587
|
-
return cidrs ? cidrs.join(',') : null;
|
|
588
|
-
}
|
|
589
|
-
|
|
590
565
|
export function resolveDaytonaSandboxNetworkPolicy(input: {
|
|
591
566
|
runtimeSchedulerSchema: string | null | undefined;
|
|
592
567
|
env?: NodeJS.ProcessEnv;
|
|
@@ -654,19 +629,9 @@ async function createOneShotDaytonaSandbox(input: {
|
|
|
654
629
|
if (runId) labels.runId = runId;
|
|
655
630
|
if (input.providerOperationToken)
|
|
656
631
|
labels.operationKey = input.providerOperationToken;
|
|
657
|
-
const
|
|
632
|
+
const { networkAllowList } = resolveDaytonaSandboxNetworkPolicy({
|
|
658
633
|
runtimeSchedulerSchema: input.context.runtimeSchedulerSchema ?? null,
|
|
659
634
|
});
|
|
660
|
-
// Only a pinned, already-restricted sandbox resolves anything; every other
|
|
661
|
-
// run keeps the exact synchronous path it had before.
|
|
662
|
-
const credentialScope = input.context.runtimeGatewayCredentialScope;
|
|
663
|
-
const networkAllowList =
|
|
664
|
-
credentialScope && policy.networkAllowList
|
|
665
|
-
? await runtimeGatewayDaytonaNetworkAllowList({
|
|
666
|
-
credentialScope,
|
|
667
|
-
networkAllowList: policy.networkAllowList,
|
|
668
|
-
})
|
|
669
|
-
: policy.networkAllowList;
|
|
670
635
|
|
|
671
636
|
const commonParams = {
|
|
672
637
|
name: input.sandboxName,
|
|
@@ -684,7 +649,7 @@ async function createOneShotDaytonaSandbox(input: {
|
|
|
684
649
|
// A non-empty `networkAllowList` IS the "block all egress except these
|
|
685
650
|
// CIDRs" control; Daytona rejects create when `networkBlockAll: true` is
|
|
686
651
|
// combined with a non-empty allow-list ("networkBlockAll: true cannot be
|
|
687
|
-
// combined with a non-empty networkAllowList"). Pass
|
|
652
|
+
// combined with a non-empty networkAllowList or domainAllowList"). Pass
|
|
688
653
|
// the allow-list alone so the egress restriction holds without the
|
|
689
654
|
// contradictory flag.
|
|
690
655
|
...(networkAllowList ? { networkAllowList } : {}),
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { APP_RUNTIME_COMPAT_PATH } from '../../runtime-api-paths';
|
|
2
1
|
import { preparePlayRunnerConfigForTransport } from '../../protocol';
|
|
3
2
|
import { randomUUID } from 'node:crypto';
|
|
4
3
|
import { readFile } from 'node:fs/promises';
|
|
@@ -36,15 +35,6 @@ import {
|
|
|
36
35
|
} from '../../daytona-payload-contract';
|
|
37
36
|
export { buildDaytonaPayloadMaterializerSource } from '../../daytona-payload-contract';
|
|
38
37
|
import { compactPlayArtifactForRuntimeTransport } from '../../../plays/artifact-transport';
|
|
39
|
-
import {
|
|
40
|
-
RUNTIME_GATEWAY_OIDC_FILE_SUFFIX,
|
|
41
|
-
runtimeGatewayOidcRequestHeaders,
|
|
42
|
-
} from '../../runtime-gateway-sandbox-credential';
|
|
43
|
-
import {
|
|
44
|
-
runtimeGatewayStagedSend,
|
|
45
|
-
runtimeGatewayStagedSendTimeoutMs,
|
|
46
|
-
runtimeGatewayStagingClientLimits,
|
|
47
|
-
} from '../../runtime-gateway-staging';
|
|
48
38
|
import type {
|
|
49
39
|
DaytonaExecutionContext,
|
|
50
40
|
DaytonaSandbox,
|
|
@@ -52,10 +42,8 @@ import type {
|
|
|
52
42
|
} from './daytona-lifecycle';
|
|
53
43
|
import {
|
|
54
44
|
buildDaytonaRuntimeWatchdogSource,
|
|
55
|
-
runtimeGatewayCredentialWatchdogArgs,
|
|
56
45
|
PLAY_RUNNER_UV_THREADPOOL_SIZE,
|
|
57
46
|
RUNNER_MEMORY_CGROUP_ROOT,
|
|
58
|
-
RUNTIME_GATEWAY_OIDC_RENEWAL_FAILED_REASON,
|
|
59
47
|
RUNTIME_SANDBOX_MEMORY_ABORT_REASON,
|
|
60
48
|
} from './daytona-runtime-watchdog';
|
|
61
49
|
|
|
@@ -211,37 +199,6 @@ const memoryEventsPath = process.argv[7] || '/sys/fs/cgroup/memory.events';
|
|
|
211
199
|
const terminationDiagnosticPath = process.argv[8] || '';
|
|
212
200
|
const runtimeCompletedPath = process.argv[9] || '';
|
|
213
201
|
const exitCode = Number.isFinite(exitCodeRaw) ? exitCodeRaw : null;
|
|
214
|
-
const runtimeGatewayOidcRequestHeaders = (${runtimeGatewayOidcRequestHeaders.toString()});
|
|
215
|
-
// Pinned runs only: an app-hosted gateway takes bodies above Vercel's cap
|
|
216
|
-
// through a staged upload. Unpinned runs call fetch exactly as before.
|
|
217
|
-
const runtimeGatewayStagedSend = (${runtimeGatewayStagedSend.toString()});
|
|
218
|
-
const runtimeGatewayStagedSendTimeoutMs = (${runtimeGatewayStagedSendTimeoutMs.toString()});
|
|
219
|
-
|
|
220
|
-
// Pinned runs only: the watchdog's latest renewed credential, else the
|
|
221
|
-
// initial one. Unpinned configs carry neither and send no credential.
|
|
222
|
-
function currentRuntimeGatewayOidcToken(context) {
|
|
223
|
-
if (!context.runtimeGatewayOidcToken) return null;
|
|
224
|
-
try {
|
|
225
|
-
const renewed = fs.readFileSync(configPath + ${JSON.stringify(RUNTIME_GATEWAY_OIDC_FILE_SUFFIX)}, 'utf8').trim();
|
|
226
|
-
if (renewed) return renewed;
|
|
227
|
-
} catch {}
|
|
228
|
-
return context.runtimeGatewayOidcToken;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
function watchdogRuntimeGatewayOidcFailure() {
|
|
232
|
-
try {
|
|
233
|
-
if (!terminationDiagnosticPath) return null;
|
|
234
|
-
const diagnostic = JSON.parse(fs.readFileSync(terminationDiagnosticPath, 'utf8'));
|
|
235
|
-
if (
|
|
236
|
-
diagnostic &&
|
|
237
|
-
diagnostic.schemaVersion === 1 &&
|
|
238
|
-
diagnostic.reason === ${JSON.stringify(RUNTIME_GATEWAY_OIDC_RENEWAL_FAILED_REASON)}
|
|
239
|
-
) {
|
|
240
|
-
return diagnostic;
|
|
241
|
-
}
|
|
242
|
-
} catch {}
|
|
243
|
-
return null;
|
|
244
|
-
}
|
|
245
202
|
const MAX_OUTPUT_BYTES = ${DAYTONA_CRASH_PUSHER_OUTPUT_TAIL_MAX_BYTES};
|
|
246
203
|
const MAX_POST_TERMINAL_DIAGNOSTIC_BYTES = ${RUNNER_POST_TERMINAL_DIAGNOSTIC_MAX_BYTES};
|
|
247
204
|
let postTerminalDiagnosticBytesRemaining = MAX_POST_TERMINAL_DIAGNOSTIC_BYTES;
|
|
@@ -459,12 +416,8 @@ async function main() {
|
|
|
459
416
|
// V8 aborts itself on heap exhaustion. SIGABRT alone is also authored
|
|
460
417
|
// program output, so 134 needs the explicit allocation signature.
|
|
461
418
|
(exitCode === 134 && explicitOomSignature));
|
|
462
|
-
const runtimeGatewayOidcFailure = watchdogRuntimeGatewayOidcFailure();
|
|
463
419
|
const synthesizedError = runtimeLimitExceeded
|
|
464
420
|
? 'RUNTIME_LIMIT_EXCEEDED: ' + ${JSON.stringify(runtimeLimitMessage)}
|
|
465
|
-
: runtimeGatewayOidcFailure
|
|
466
|
-
? ${JSON.stringify(RUNTIME_GATEWAY_OIDC_RENEWAL_FAILED_REASON)} + ': the sandbox could not renew its Runtime gateway credential (' +
|
|
467
|
-
String(runtimeGatewayOidcFailure.errorCode) + ') and was stopped before it expired.'
|
|
468
421
|
: memoryAbort
|
|
469
422
|
? memoryAbortCause(memoryAbort)
|
|
470
423
|
: sandboxOom
|
|
@@ -532,16 +485,11 @@ async function main() {
|
|
|
532
485
|
? { finalProgressLogOffset: parsedResultEvent.finalProgressLogOffset }
|
|
533
486
|
: {}),
|
|
534
487
|
});
|
|
535
|
-
// A pinned run may stage a body up to 16 MiB through object storage, so
|
|
536
|
-
// its deadline scales with the body (bounded). Unpinned runs keep 10 s.
|
|
537
|
-
const pushTimeoutMs = context.runtimeGatewayCredentialScope
|
|
538
|
-
? runtimeGatewayStagedSendTimeoutMs(Buffer.byteLength(requestBody))
|
|
539
|
-
: 10000;
|
|
540
488
|
for (let attempt = 1; attempt <= 3; attempt += 1) {
|
|
541
489
|
const controller = new AbortController();
|
|
542
|
-
const timer = setTimeout(() => controller.abort(),
|
|
490
|
+
const timer = setTimeout(() => controller.abort(), 10000);
|
|
543
491
|
try {
|
|
544
|
-
const
|
|
492
|
+
const response = await fetch(gateway + '/api/v2/plays/runtime', {
|
|
545
493
|
method: 'POST',
|
|
546
494
|
headers: {
|
|
547
495
|
'content-type': 'application/json',
|
|
@@ -549,27 +497,11 @@ async function main() {
|
|
|
549
497
|
...(preferredGatewayMachineId
|
|
550
498
|
? { 'fly-force-instance-id': preferredGatewayMachineId }
|
|
551
499
|
: {}),
|
|
552
|
-
...(runtimeGatewayOidcRequestHeaders(
|
|
553
|
-
context.runtimeGatewayCredentialScope,
|
|
554
|
-
currentRuntimeGatewayOidcToken(context),
|
|
555
|
-
gateway + '${APP_RUNTIME_COMPAT_PATH}',
|
|
556
|
-
) || {}),
|
|
557
500
|
},
|
|
558
501
|
body: requestBody,
|
|
559
502
|
signal: controller.signal,
|
|
560
503
|
redirect: 'manual',
|
|
561
|
-
};
|
|
562
|
-
const response = context.runtimeGatewayCredentialScope
|
|
563
|
-
? await runtimeGatewayStagedSend(
|
|
564
|
-
fetch,
|
|
565
|
-
gateway + '${APP_RUNTIME_COMPAT_PATH}',
|
|
566
|
-
terminalRequest,
|
|
567
|
-
Object.assign(
|
|
568
|
-
${JSON.stringify({ ...runtimeGatewayStagingClientLimits([]), pathPrefixes: undefined })},
|
|
569
|
-
{ pathPrefixes: context.runtimeGatewayCredentialScope.pathPrefixes },
|
|
570
|
-
),
|
|
571
|
-
)
|
|
572
|
-
: await fetch(gateway + '${APP_RUNTIME_COMPAT_PATH}', terminalRequest);
|
|
504
|
+
});
|
|
573
505
|
// Keep the HTTP deadline through body consumption so retries do not
|
|
574
506
|
// leave an unread socket behind. The status already acknowledges the
|
|
575
507
|
// durable terminal even if its diagnostic response body is interrupted.
|
|
@@ -855,9 +787,6 @@ export async function stageRunnerPayload(input: {
|
|
|
855
787
|
shellQuote(memoryPressurePath),
|
|
856
788
|
shellQuote(RUNNER_MEMORY_CGROUP_ROOT),
|
|
857
789
|
shellQuote(runnerPidPath),
|
|
858
|
-
...runtimeGatewayCredentialWatchdogArgs(remoteConfig.context).map(
|
|
859
|
-
shellQuote,
|
|
860
|
-
),
|
|
861
790
|
].join(' ');
|
|
862
791
|
const runnerCommand = `${nodeMaterializePayloadCommand({
|
|
863
792
|
envelopePath,
|
|
@@ -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
|