deepline 0.3.500 → 0.3.502
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/plays/client-core.ts +45 -7
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +20 -2
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +155 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +7 -1
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +2 -1
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts +29 -14
- package/dist/bundling-sources/shared_libs/play-runtime/durable-invocation-fence.ts +3 -1
- package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +54 -1
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/prebuilt-result-quality.ts +264 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +56 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +53 -10
- 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 +1 -2
- 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-launch-transport.ts +9 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +31 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +74 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-runtime-watchdog.ts +226 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +41 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +5 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-app-transport.ts +374 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-environment.ts +49 -9
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-oidc.ts +55 -11
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-profile.ts +12 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-sandbox-credential.ts +338 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-staging.ts +417 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +15 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +184 -11
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +17 -3
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-progress-registry.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +18 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +198 -20
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-attempt.ts +81 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-staging-journal.ts +708 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-staging-teardown.ts +160 -0
- package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +4 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +2 -0
- package/dist/cli/{auth-WK3FDPRP.mjs → auth-EFHLOVG4.mjs} +5 -5
- package/dist/cli/auth-VM3IKP5F.js +43 -0
- package/dist/cli/{billing-O3LVKXE7.mjs → billing-Q5XKEYPP.mjs} +8 -8
- package/dist/cli/{billing-K7UHZUF4.js → billing-SKT2VE34.js} +81 -81
- package/dist/cli/{chunk-4CJWOLOS.mjs → chunk-2JS3H6H6.mjs} +3 -3
- package/dist/cli/{chunk-CIV5GJAE.mjs → chunk-2MVIS2UI.mjs} +2 -2
- package/dist/cli/{chunk-LNMY2T5S.js → chunk-2S2F6YSI.js} +41 -41
- package/dist/cli/{chunk-RAZ3TMOS.js → chunk-32YQBJON.js} +7 -7
- package/dist/cli/{chunk-JHNFUCVT.mjs → chunk-3KEZVGGV.mjs} +4 -4
- package/dist/cli/{chunk-5JXGYSXH.mjs → chunk-3MJSWVQ2.mjs} +1 -1
- package/dist/cli/{chunk-5TVY5OEH.mjs → chunk-4CCMD7QM.mjs} +21 -20
- package/dist/cli/{chunk-T4AGTOKQ.mjs → chunk-4WTC5SSN.mjs} +7 -7
- package/dist/cli/{chunk-XCBOOB73.mjs → chunk-54QXWK3C.mjs} +1 -1
- package/dist/cli/{chunk-5AC7NUQN.mjs → chunk-7ZYSXSJJ.mjs} +5 -5
- package/dist/cli/{chunk-PHGMC33I.js → chunk-AJL2Q6IQ.js} +2 -2
- package/dist/cli/{chunk-UBKA33KY.mjs → chunk-BMCRTI6Z.mjs} +22 -1
- package/dist/cli/{chunk-74VKLBJD.js → chunk-DKAMCJIT.js} +14 -14
- package/dist/cli/{chunk-C5R3UH5V.mjs → chunk-DRBD4IYQ.mjs} +1 -1
- package/dist/cli/{chunk-Z5LE7NXM.js → chunk-DYHTXGLX.js} +2 -2
- package/dist/cli/{chunk-TOGCDNMH.js → chunk-EUWRKWT4.js} +4 -4
- package/dist/cli/{chunk-GBICEYUA.js → chunk-FVM4PS5Q.js} +116 -8
- package/dist/cli/{chunk-I42EOZKQ.js → chunk-FWDAEWCD.js} +5 -5
- package/dist/cli/{chunk-GOO4VI5M.js → chunk-GINKIZ7S.js} +16 -16
- package/dist/cli/{chunk-56QAHX2K.mjs → chunk-HIVRCTDR.mjs} +90 -30
- package/dist/cli/{chunk-XUOZYAP5.mjs → chunk-HMZF2CSP.mjs} +2 -2
- package/dist/cli/{chunk-5KAZGZG7.js → chunk-IL666WJE.js} +5 -5
- package/dist/cli/{chunk-G3NA4R7M.js → chunk-JFBJLNBI.js} +53 -53
- package/dist/cli/{chunk-KSHAFYYG.mjs → chunk-JFUXUSKB.mjs} +112 -4
- package/dist/cli/{chunk-RHE4YI4H.js → chunk-JL6H4H3G.js} +6 -6
- package/dist/cli/{chunk-K3BHKRMS.js → chunk-JLYDLK6X.js} +3 -3
- package/dist/cli/{chunk-QRKCCY4L.mjs → chunk-L5CTJY74.mjs} +1 -1
- package/dist/cli/{chunk-W64Y7GE7.js → chunk-LA3UYRVZ.js} +1 -1
- package/dist/cli/{chunk-HI2BFS5S.mjs → chunk-MP5QY4A2.mjs} +2 -2
- package/dist/cli/{chunk-V7MZYIA7.mjs → chunk-MYUISF3P.mjs} +5 -5
- package/dist/cli/{chunk-CS2AEAD6.mjs → chunk-N4TR6QRI.mjs} +1 -1
- package/dist/cli/{chunk-C7355NMU.mjs → chunk-NKLM4J4X.mjs} +1 -1
- package/dist/cli/{chunk-FJZUG633.mjs → chunk-NXVYLX3F.mjs} +3 -3
- package/dist/cli/{chunk-L7X6ADNM.mjs → chunk-NZXB27TP.mjs} +4 -4
- package/dist/cli/{chunk-VLCY4F6E.js → chunk-OEUMXKR5.js} +26 -26
- package/dist/cli/{chunk-SRS2D27G.mjs → chunk-OFBLT2LQ.mjs} +1 -1
- package/dist/cli/{chunk-SNPZ2QWL.js → chunk-OVZOMSH2.js} +8 -8
- package/dist/cli/{chunk-KEBNXJSK.js → chunk-Q3NM6ZL3.js} +19 -19
- package/dist/cli/{chunk-GBRI644Y.js → chunk-QNELA7SX.js} +53 -53
- package/dist/cli/{chunk-IX2DPYIV.js → chunk-QOJBRCAS.js} +3 -3
- package/dist/cli/{chunk-IZ6YWXIK.mjs → chunk-R5F7JXT4.mjs} +2 -2
- package/dist/cli/{chunk-EQR5O2D2.js → chunk-RNSHCJME.js} +3 -3
- package/dist/cli/{chunk-Q2FXZ4Z5.js → chunk-TAK3MVXY.js} +272 -271
- package/dist/cli/{chunk-BIE57V6K.js → chunk-UOANF3DR.js} +360 -300
- package/dist/cli/{chunk-CBZTKDXW.mjs → chunk-W5CHE5Q2.mjs} +1 -1
- package/dist/cli/{chunk-U5GFP26N.js → chunk-WKFAX2K7.js} +21 -21
- package/dist/cli/{chunk-XDVT3GOM.js → chunk-WSGXBROE.js} +22 -1
- package/dist/cli/{chunk-X7ODM2LK.js → chunk-X5MGQ7UT.js} +6 -6
- package/dist/cli/{chunk-REIKJREB.js → chunk-XMKUJ44Z.js} +5 -5
- package/dist/cli/{chunk-SNJNPRIV.js → chunk-YDXEXVBV.js} +7 -7
- package/dist/cli/{chunk-X5SO7RV5.mjs → chunk-YL2CCF6T.mjs} +4 -4
- package/dist/cli/{chunk-VPVEPGYS.mjs → chunk-YWOQYYYS.mjs} +2 -2
- package/dist/cli/{chunk-MAHLIWOF.mjs → chunk-Z2H7OQ6E.mjs} +2 -2
- package/dist/cli/{chunk-PGRPNRP6.mjs → chunk-ZNB6GR3P.mjs} +1 -1
- package/dist/cli/{csv-DEUOSTEB.mjs → csv-6AEPKKCO.mjs} +4 -4
- package/dist/cli/{csv-MWCWNIBJ.js → csv-OXGSCV75.js} +13 -13
- package/dist/cli/{db-Q6IRXTTG.js → db-6NVHDUZY.js} +29 -29
- package/dist/cli/{db-QM5R5BRY.mjs → db-K3KRK4CZ.mjs} +8 -8
- package/dist/cli/describe-JOUAXXPE.js +49 -0
- package/dist/cli/describe-P3ZJS7TQ.mjs +49 -0
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/describe-core.js +3 -4
- package/dist/cli/describe-core.mjs +2 -3
- package/dist/cli/{executions-DCCDXSQI.js → executions-2C2FFG52.js} +10 -10
- package/dist/cli/{executions-SWBKFCY2.mjs → executions-I7XW6WWK.mjs} +8 -8
- package/dist/cli/{feedback-EU3EYF4V.js → feedback-47B57A5Y.js} +8 -8
- package/dist/cli/{feedback-Q27HN3SB.mjs → feedback-RSTNBJAI.mjs} +4 -4
- package/dist/cli/{git-SEQFTQ4N.mjs → git-3G5AFKBT.mjs} +5 -5
- package/dist/cli/git-OPKIC6JQ.js +25 -0
- package/dist/cli/index.js +137 -137
- package/dist/cli/index.mjs +40 -40
- package/dist/cli/{legacy-noops-XKH4VREG.mjs → legacy-noops-NQ262TKL.mjs} +5 -5
- package/dist/cli/{legacy-noops-LCQDEVA3.js → legacy-noops-P665PBG4.js} +8 -8
- package/dist/cli/{monitors-DJCID6X5.js → monitors-IPWAD7LS.js} +97 -97
- package/dist/cli/{monitors-4XWBV46I.mjs → monitors-KUPZODZS.mjs} +9 -9
- package/dist/cli/{org-BU4FG5PN.js → org-WFC3N672.js} +74 -74
- package/dist/cli/{org-PSBGXBRW.mjs → org-ZCQGEM3L.mjs} +8 -8
- package/dist/cli/{pages-3PHJYXYB.js → pages-N5BNC67L.js} +20 -20
- package/dist/cli/{pages-7QLXLJGQ.mjs → pages-VE66IU7B.mjs} +8 -8
- package/dist/cli/{play-4OLYXRCG.mjs → play-EIMDIAJB.mjs} +20 -20
- package/dist/cli/{play-S3CWPQKB.js → play-NKIRJSKX.js} +336 -336
- package/dist/cli/{providers-JT7C2QTC.mjs → providers-KDTJ63ED.mjs} +8 -8
- package/dist/cli/{providers-U4JUMLB2.js → providers-XU3AGY2F.js} +11 -11
- package/dist/cli/{quickstart-OUSMXLYZ.js → quickstart-OSCHOSXU.js} +6 -6
- package/dist/cli/{quickstart-DQF5CF2I.mjs → quickstart-TXFXUODF.mjs} +4 -4
- package/dist/cli/{run-6XXHLB4X.js → run-ET2KVTPK.js} +45 -46
- package/dist/cli/{run-RECNI77K.mjs → run-ODGML35U.mjs} +26 -27
- package/dist/cli/run-identity-HFYABUJS.js +31 -0
- package/dist/cli/{run-identity-MRNCEGV2.mjs → run-identity-MNRZS2N3.mjs} +9 -3
- package/dist/cli/search-6U54Y3OK.js +32 -0
- package/dist/cli/{search-JN7K3GC6.mjs → search-DK67K6PR.mjs} +9 -9
- package/dist/cli/{search-output-L6PC5SPM.mjs → search-output-6SOKQTCW.mjs} +53 -75
- package/dist/cli/{search-output-JGNYXDWZ.js → search-output-KXP4FA62.js} +58 -80
- package/dist/cli/{secrets-UOXZWHBY.mjs → secrets-C6SYTMU7.mjs} +8 -8
- package/dist/cli/{secrets-TX6PCZ77.js → secrets-WPS6NMNK.js} +17 -17
- package/dist/cli/{sessions-GCEIX4KB.js → sessions-IP562J5Z.js} +6 -6
- package/dist/cli/{sessions-DTE733EH.mjs → sessions-PXVOH34X.mjs} +5 -5
- package/dist/cli/{settings-ZGIMRCTC.mjs → settings-FBUQGYVJ.mjs} +13 -13
- package/dist/cli/{settings-UGXSDHR5.js → settings-SUDUIVMY.js} +80 -80
- package/dist/cli/{setup-JYB6Z376.js → setup-I5H6IOEY.js} +49 -49
- package/dist/cli/{setup-UT7AO53D.mjs → setup-JSIMTR73.mjs} +9 -9
- package/dist/cli/{skills-4QJCMN7J.mjs → skills-FJQ3LX6N.mjs} +7 -7
- package/dist/cli/skills-VHININXC.js +36 -0
- package/dist/cli/{tools-RGNXIAA6.mjs → tools-IGBK4BVE.mjs} +19 -20
- package/dist/cli/tools-XMBMHVKF.js +56 -0
- package/dist/cli/{update-Q62EVSXZ.mjs → update-7MTT6F5K.mjs} +9 -9
- package/dist/cli/update-H7JVW43I.js +34 -0
- package/dist/cli/{workflow-YNIOWM7J.mjs → workflow-PM2J2OU3.mjs} +9 -9
- package/dist/cli/{workflow-GENV47RD.js → workflow-UX3ZX6BQ.js} +19 -19
- package/dist/{client-Cj3UqrCZ.d.ts → client-Bn8FwKGO.d.ts} +1 -1
- package/dist/{client-DSCTVVRj.d.mts → client-CfNRmjLK.d.mts} +1 -1
- package/dist/{client-core-dI4KTuWS.d.ts → client-core-B91EV0WS.d.ts} +19 -0
- package/dist/{client-core-B-8DTIN1.d.mts → client-core-BG8Cgrmk.d.mts} +19 -0
- 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 +119 -114
- 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/cli/auth-H4PCVUN3.js +0 -43
- package/dist/cli/chunk-XK5DMLZE.js +0 -111
- package/dist/cli/chunk-XRDXNAAY.mjs +0 -111
- package/dist/cli/describe-BZ544347.js +0 -50
- package/dist/cli/describe-CQZ7TBOG.mjs +0 -50
- package/dist/cli/git-NW6BAXX2.js +0 -25
- package/dist/cli/run-identity-G257GQED.js +0 -25
- package/dist/cli/search-BIQ62ZBE.js +0 -32
- package/dist/cli/skills-53LCPB5R.js +0 -36
- package/dist/cli/tools-HKJK6UNJ.js +0 -57
- package/dist/cli/update-QMZSFTFZ.js +0 -34
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { readPrebuiltResultQuality } from '../prebuilt-result-quality';
|
|
2
|
+
import { resolveRuntimeAppTransport } from '../runtime-app-transport';
|
|
1
3
|
import {
|
|
2
4
|
terminalRuntimePerformanceFromStats,
|
|
3
5
|
normalizeTerminalRuntimePerformance,
|
|
4
6
|
normalizeTerminalRuntimePerformanceUnavailableReason,
|
|
5
7
|
} from '../terminal-runtime-performance';
|
|
6
8
|
import { escapeLiteral } from 'pg';
|
|
9
|
+
import { readRuntimeGatewayLaunchPin } from '../runtime-gateway-profile';
|
|
10
|
+
import { RUNTIME_GATEWAY_OIDC_MAX_AGE_SECONDS } from '../runtime-gateway-oidc';
|
|
11
|
+
import { runtimeGatewayCredentialScopeFromPin } from '../runtime-gateway-sandbox-credential';
|
|
12
|
+
import { ensureRuntimeGatewayStagingSchema } from './runtime-gateway-staging-journal';
|
|
7
13
|
import { assertWorkReceiptKeyMutable } from '../work-receipt-storage-contract';
|
|
8
14
|
import {
|
|
9
15
|
schedulerWorkReceiptClaimTransition,
|
|
@@ -2412,6 +2418,8 @@ export async function ensurePostgresSchedulerOnlineAdditiveExpansion(
|
|
|
2412
2418
|
client,
|
|
2413
2419
|
options,
|
|
2414
2420
|
);
|
|
2421
|
+
// A separate table that no shape check, marker, or admission path reads.
|
|
2422
|
+
await ensureRuntimeGatewayStagingSchema(client, { schema });
|
|
2415
2423
|
}
|
|
2416
2424
|
|
|
2417
2425
|
/** Deployment-owned v64 expansion; absent values retain legacy behavior. */
|
|
@@ -3591,6 +3599,9 @@ export async function ensurePostgresSchedulerSchema(
|
|
|
3591
3599
|
// not prove that every receipt/execution gateway can decode canonical IO
|
|
3592
3600
|
// rows. Convex owns the source record; this is its local gateway mirror.
|
|
3593
3601
|
await ensurePostgresSchedulerGatewayReaderFenceSchema(client, options);
|
|
3602
|
+
// App-hosted gateway staged-body custody. Not part of the scheduler
|
|
3603
|
+
// shape: readiness and admission never read it.
|
|
3604
|
+
await ensureRuntimeGatewayStagingSchema(client, { schema });
|
|
3594
3605
|
await client.query(`
|
|
3595
3606
|
CREATE INDEX IF NOT EXISTS ${quoteIdent(
|
|
3596
3607
|
`${schema}_integration_invocation_state_updated_idx`,
|
|
@@ -9921,6 +9932,13 @@ const POSTGRES_SCHEDULER_ATTEMPT_AUTHORITY_FIELDS = [
|
|
|
9921
9932
|
'runtimeTokenOrigin',
|
|
9922
9933
|
'runtimeBackend',
|
|
9923
9934
|
'runtimeAuthority',
|
|
9935
|
+
// Optional Runtime gateway pin; null on unpinned launches. The executor-token
|
|
9936
|
+
// issuer reads it to require the reader flag and add the pinned claims.
|
|
9937
|
+
'runtimeGatewayProfileId',
|
|
9938
|
+
'runtimeReceiptGatewayBaseUrl',
|
|
9939
|
+
'runtimeExecutionGatewayBaseUrl',
|
|
9940
|
+
'runtimeGatewayDeploymentId',
|
|
9941
|
+
'runtimeGatewayPinnedAtMs',
|
|
9924
9942
|
] as const;
|
|
9925
9943
|
|
|
9926
9944
|
export type PostgresSchedulerAttemptAuthority = Pick<
|
|
@@ -9999,6 +10017,120 @@ export async function readPostgresSchedulerAttemptAuthorityForLease(
|
|
|
9999
10017
|
return parsePostgresSchedulerAuthorityRow(result.rows[0]);
|
|
10000
10018
|
}
|
|
10001
10019
|
|
|
10020
|
+
/**
|
|
10021
|
+
* Why a renewal fence refused. Only `attempt_not_live` can clear by itself
|
|
10022
|
+
* (a stale heartbeat while the runner catches up after a network cut); every
|
|
10023
|
+
* other reason is definitive and the sandbox stops at once.
|
|
10024
|
+
*/
|
|
10025
|
+
export type RuntimeGatewayOidcRenewalRefusal =
|
|
10026
|
+
| 'attempt_not_found'
|
|
10027
|
+
| 'lease_mismatch'
|
|
10028
|
+
| 'scope_mismatch'
|
|
10029
|
+
| 'attempt_cancelled'
|
|
10030
|
+
| 'attempt_superseded'
|
|
10031
|
+
| 'attempt_not_live';
|
|
10032
|
+
|
|
10033
|
+
export type RuntimeGatewayOidcRenewalFence =
|
|
10034
|
+
| { allowed: true }
|
|
10035
|
+
| { allowed: false; reason: RuntimeGatewayOidcRenewalRefusal };
|
|
10036
|
+
|
|
10037
|
+
/**
|
|
10038
|
+
* Renewal fence for a sandbox's Runtime gateway OIDC credential. A sandbox may
|
|
10039
|
+
* renew only while its exact attempt still holds the live lease of a run
|
|
10040
|
+
* pinned to `deploymentId`: the attempt is current (no successor) and no
|
|
10041
|
+
* cancellation is recorded. Liveness is then proven per phase:
|
|
10042
|
+
*
|
|
10043
|
+
* - Detached: the run's `detached_runner` suspension names this attempt, the
|
|
10044
|
+
* detached wait has not passed its deadline, and the runner heartbeat is
|
|
10045
|
+
* fresh.
|
|
10046
|
+
* - Starting (before the worker persists the detach): the run is `running`
|
|
10047
|
+
* with no suspension, and the attempt's claim or runner heartbeat is younger
|
|
10048
|
+
* than one credential lifetime. The worker minted the first credential when
|
|
10049
|
+
* it claimed the attempt, so sandbox create and upload may outlast the
|
|
10050
|
+
* renewal threshold; a start that outlives a whole credential lifetime has
|
|
10051
|
+
* no live credential left to renew.
|
|
10052
|
+
*
|
|
10053
|
+
* A refusal names its reason, checked in this order: no such attempt, wrong
|
|
10054
|
+
* lease, wrong org or deployment (including an unpinned run), cancelled,
|
|
10055
|
+
* superseded, and otherwise not live. One statement reads all of them.
|
|
10056
|
+
*/
|
|
10057
|
+
export async function canRenewPostgresDetachedRunnerIdentity(
|
|
10058
|
+
client: PostgresSchedulerQueryClient,
|
|
10059
|
+
input: {
|
|
10060
|
+
runId: string;
|
|
10061
|
+
attempt: number;
|
|
10062
|
+
leaseToken: string;
|
|
10063
|
+
orgId: string;
|
|
10064
|
+
deploymentId: string;
|
|
10065
|
+
},
|
|
10066
|
+
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
10067
|
+
): Promise<RuntimeGatewayOidcRenewalFence> {
|
|
10068
|
+
const result = await client.query<{
|
|
10069
|
+
lease_matches: boolean;
|
|
10070
|
+
scope_matches: boolean;
|
|
10071
|
+
cancelled: boolean;
|
|
10072
|
+
superseded: boolean;
|
|
10073
|
+
live: boolean;
|
|
10074
|
+
}>(
|
|
10075
|
+
`
|
|
10076
|
+
SELECT
|
|
10077
|
+
coalesce(attempt.lease_token = $3, false) AS lease_matches,
|
|
10078
|
+
coalesce(
|
|
10079
|
+
run.org_id = $4
|
|
10080
|
+
AND coalesce(run.admission_json, run.launch_json)->>'runtimeGatewayDeploymentId' = $5,
|
|
10081
|
+
false
|
|
10082
|
+
) AS scope_matches,
|
|
10083
|
+
(
|
|
10084
|
+
run.status = 'cancelled'
|
|
10085
|
+
OR EXISTS (
|
|
10086
|
+
SELECT 1 FROM ${tableName('control', options)} AS cancellation
|
|
10087
|
+
WHERE cancellation.key = 'runtime_cancel:' || $1
|
|
10088
|
+
)
|
|
10089
|
+
) AS cancelled,
|
|
10090
|
+
EXISTS (
|
|
10091
|
+
SELECT 1 FROM ${tableName('attempts', options)} AS successor
|
|
10092
|
+
WHERE successor.run_id = attempt.run_id AND successor.attempt > attempt.attempt
|
|
10093
|
+
) AS superseded,
|
|
10094
|
+
coalesce(
|
|
10095
|
+
(
|
|
10096
|
+
run.status IN ('running', 'waiting')
|
|
10097
|
+
AND attempt.status IN ('running', 'waiting')
|
|
10098
|
+
AND run.suspension_json->>'kind' = 'detached_runner'
|
|
10099
|
+
AND run.suspension_json->'runnerAttempt' = to_jsonb($2::integer)
|
|
10100
|
+
AND run.wait_deadline > clock_timestamp()
|
|
10101
|
+
AND attempt.heartbeat_at > clock_timestamp() - interval '120 seconds'
|
|
10102
|
+
)
|
|
10103
|
+
OR (
|
|
10104
|
+
run.status = 'running'
|
|
10105
|
+
AND attempt.status IN ('claimed', 'running')
|
|
10106
|
+
AND (run.suspension_json IS NULL OR jsonb_typeof(run.suspension_json) = 'null')
|
|
10107
|
+
AND attempt.heartbeat_at > clock_timestamp() - make_interval(secs => $6::integer)
|
|
10108
|
+
),
|
|
10109
|
+
false
|
|
10110
|
+
) AS live
|
|
10111
|
+
FROM ${tableName('runs', options)} AS run
|
|
10112
|
+
JOIN ${tableName('attempts', options)} AS attempt USING (run_id)
|
|
10113
|
+
WHERE run.run_id = $1 AND attempt.attempt = $2
|
|
10114
|
+
`,
|
|
10115
|
+
[
|
|
10116
|
+
input.runId,
|
|
10117
|
+
input.attempt,
|
|
10118
|
+
input.leaseToken,
|
|
10119
|
+
input.orgId,
|
|
10120
|
+
input.deploymentId,
|
|
10121
|
+
RUNTIME_GATEWAY_OIDC_MAX_AGE_SECONDS,
|
|
10122
|
+
],
|
|
10123
|
+
);
|
|
10124
|
+
const row = result.rows[0];
|
|
10125
|
+
if (!row) return { allowed: false, reason: 'attempt_not_found' };
|
|
10126
|
+
if (!row.lease_matches) return { allowed: false, reason: 'lease_mismatch' };
|
|
10127
|
+
if (!row.scope_matches) return { allowed: false, reason: 'scope_mismatch' };
|
|
10128
|
+
if (row.cancelled) return { allowed: false, reason: 'attempt_cancelled' };
|
|
10129
|
+
if (row.superseded) return { allowed: false, reason: 'attempt_superseded' };
|
|
10130
|
+
if (!row.live) return { allowed: false, reason: 'attempt_not_live' };
|
|
10131
|
+
return { allowed: true };
|
|
10132
|
+
}
|
|
10133
|
+
|
|
10002
10134
|
/**
|
|
10003
10135
|
* Absurd scheduler backend: persist the vendored engine's task id on the run
|
|
10004
10136
|
* row after `spawn`. Idempotent (last write wins); a re-submit under the same
|
|
@@ -11441,9 +11573,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
11441
11573
|
input.result,
|
|
11442
11574
|
{ logMetadata: input.completionLogMetadata ?? 'attach' },
|
|
11443
11575
|
);
|
|
11444
|
-
const resultSummary =
|
|
11445
|
-
(input.result as { rowOutcomes?: unknown }).rowOutcomes,
|
|
11446
|
-
);
|
|
11576
|
+
const resultSummary = completedResultSummary(input.result);
|
|
11447
11577
|
const terminalResult = assertTerminalRunResultWithinLimit(terminalOutput);
|
|
11448
11578
|
const ledgerTerminalResult = terminalRunResultForLedger(terminalResult, {
|
|
11449
11579
|
content: 'full',
|
|
@@ -15011,6 +15141,7 @@ export async function completePostgresSchedulerAttempt(
|
|
|
15011
15141
|
leaseToken: string;
|
|
15012
15142
|
output: unknown;
|
|
15013
15143
|
rowOutcomes?: unknown;
|
|
15144
|
+
prebuiltResultQuality?: unknown;
|
|
15014
15145
|
runtimeTiming?: PlayRunnerRuntimeTiming | null;
|
|
15015
15146
|
terminalLogLines?: readonly string[] | null;
|
|
15016
15147
|
terminalLogContexts?: readonly (PlayLogContext | null)[] | null;
|
|
@@ -15031,7 +15162,7 @@ export async function completePostgresSchedulerAttempt(
|
|
|
15031
15162
|
const ledgerTerminalResult = terminalRunResultForLedger(terminalResult, {
|
|
15032
15163
|
content: 'full',
|
|
15033
15164
|
});
|
|
15034
|
-
const resultSummary =
|
|
15165
|
+
const resultSummary = completedResultSummary(input);
|
|
15035
15166
|
if (
|
|
15036
15167
|
input.terminalLogContexts != null &&
|
|
15037
15168
|
input.terminalLogContexts.length !== (input.terminalLogLines ?? []).length
|
|
@@ -16241,13 +16372,7 @@ export async function finalizePostgresSchedulerComputeBilling(
|
|
|
16241
16372
|
runtimeResources: readonly unknown[],
|
|
16242
16373
|
runtimeApiOverride?: WorkerRuntimeApiContext,
|
|
16243
16374
|
): Promise<void> {
|
|
16244
|
-
const runtimeApi =
|
|
16245
|
-
runtimeApiOverride ??
|
|
16246
|
-
({
|
|
16247
|
-
baseUrl: runtimeApiBaseUrlFromLaunch(launch),
|
|
16248
|
-
executorToken: launch.executorToken,
|
|
16249
|
-
vercelProtectionBypassToken: launch.vercelProtectionBypassToken ?? null,
|
|
16250
|
-
} satisfies WorkerRuntimeApiContext);
|
|
16375
|
+
const runtimeApi = runtimeApiOverride ?? absurdDirectRuntimeApi(launch);
|
|
16251
16376
|
const ordinaryResources = runtimeResources.filter(
|
|
16252
16377
|
(resource) =>
|
|
16253
16378
|
!(
|
|
@@ -16358,6 +16483,16 @@ function finiteRunnerNumber(value: unknown): number | null {
|
|
|
16358
16483
|
: null;
|
|
16359
16484
|
}
|
|
16360
16485
|
|
|
16486
|
+
function completedResultSummary(value: unknown) {
|
|
16487
|
+
const result = value as {
|
|
16488
|
+
rowOutcomes?: unknown;
|
|
16489
|
+
prebuiltResultQuality?: unknown;
|
|
16490
|
+
} | null;
|
|
16491
|
+
const outcomes = terminalRowOutcomesSummary(result?.rowOutcomes);
|
|
16492
|
+
const quality = readPrebuiltResultQuality(result?.prebuiltResultQuality);
|
|
16493
|
+
return quality ? { ...outcomes, prebuiltResultQuality: quality } : outcomes;
|
|
16494
|
+
}
|
|
16495
|
+
|
|
16361
16496
|
function terminalRowOutcomesSummary(value: unknown): {
|
|
16362
16497
|
rowOutcomes: {
|
|
16363
16498
|
completedRows?: number;
|
|
@@ -16914,6 +17049,9 @@ export async function executePostgresSchedulerClaim(
|
|
|
16914
17049
|
output: terminalOutput,
|
|
16915
17050
|
terminalRuntimeStats: (output as { stats?: unknown } | null)?.stats,
|
|
16916
17051
|
rowOutcomes: (output as { rowOutcomes?: unknown } | null)?.rowOutcomes,
|
|
17052
|
+
prebuiltResultQuality: (
|
|
17053
|
+
output as { prebuiltResultQuality?: unknown } | null
|
|
17054
|
+
)?.prebuiltResultQuality,
|
|
16917
17055
|
runtimeTiming: extractRunnerRuntimeTiming(output),
|
|
16918
17056
|
terminalLogLines: terminalLogProjection.lines,
|
|
16919
17057
|
terminalLogContexts: terminalLogProjection.lineContexts,
|
|
@@ -17160,11 +17298,16 @@ export function buildPostgresSchedulerRunnerContext(
|
|
|
17160
17298
|
launch.vercelProtectionBypassToken?.trim() ||
|
|
17161
17299
|
process.env.VERCEL_PROTECTION_BYPASS_TOKEN?.trim() ||
|
|
17162
17300
|
null;
|
|
17163
|
-
|
|
17164
|
-
|
|
17165
|
-
const
|
|
17166
|
-
|
|
17167
|
-
receiptGatewayBaseUrl
|
|
17301
|
+
// A pinned launch names its gateways; it never falls back to this worker's
|
|
17302
|
+
// configured Fly gateways. Partial or unknown pins throw here.
|
|
17303
|
+
const gatewayPin = readRuntimeGatewayLaunchPin(launch);
|
|
17304
|
+
const receiptGatewayBaseUrl = gatewayPin
|
|
17305
|
+
? gatewayPin.receiptGatewayBaseUrl
|
|
17306
|
+
: process.env.DEEPLINE_RUNTIME_RECEIPT_GATEWAY_URL?.trim() || null;
|
|
17307
|
+
const executionGatewayBaseUrl = gatewayPin
|
|
17308
|
+
? gatewayPin.executionGatewayBaseUrl
|
|
17309
|
+
: process.env.DEEPLINE_RUNTIME_EXECUTION_GATEWAY_URL?.trim() ||
|
|
17310
|
+
receiptGatewayBaseUrl;
|
|
17168
17311
|
const asyncAncestryPlayIds = launch.asyncAncestryPlayIds?.map((playId) =>
|
|
17169
17312
|
playId.trim(),
|
|
17170
17313
|
);
|
|
@@ -17186,6 +17329,14 @@ export function buildPostgresSchedulerRunnerContext(
|
|
|
17186
17329
|
baseUrl: runtimeApiBaseUrlFromLaunch(launch),
|
|
17187
17330
|
executionGatewayBaseUrl,
|
|
17188
17331
|
receiptGatewayBaseUrl,
|
|
17332
|
+
...(gatewayPin
|
|
17333
|
+
? {
|
|
17334
|
+
runtimeGatewayProfileId: gatewayPin.profile.id,
|
|
17335
|
+
runtimeGatewayDeploymentId: gatewayPin.deploymentId,
|
|
17336
|
+
runtimeGatewayCredentialScope:
|
|
17337
|
+
runtimeGatewayCredentialScopeFromPin(gatewayPin),
|
|
17338
|
+
}
|
|
17339
|
+
: {}),
|
|
17189
17340
|
vercelProtectionBypassToken,
|
|
17190
17341
|
runtimeTestFaultHeader: launch.runtimeTestFaultHeader ?? null,
|
|
17191
17342
|
preferredReceiptGatewayMachineId:
|
|
@@ -17198,6 +17349,11 @@ export function buildPostgresSchedulerRunnerContext(
|
|
|
17198
17349
|
rootRunId,
|
|
17199
17350
|
runAttempt,
|
|
17200
17351
|
playName: launch.playName,
|
|
17352
|
+
...(launch.definitionScope === 'system' &&
|
|
17353
|
+
launch.playReference?.startsWith('prebuilt/') &&
|
|
17354
|
+
rootRunId === launch.runId
|
|
17355
|
+
? { prebuiltQualityReference: launch.playReference }
|
|
17356
|
+
: {}),
|
|
17201
17357
|
userEmail: launch.userEmail,
|
|
17202
17358
|
runActor: playRunActor(launch.runtimeAuthority),
|
|
17203
17359
|
force: launch.force === true,
|
|
@@ -19346,10 +19502,26 @@ export async function loadPostgresSchedulerStoredArtifact(
|
|
|
19346
19502
|
function runtimeApiContextFromLaunch(
|
|
19347
19503
|
launch: PlaySchedulerSubmitInput,
|
|
19348
19504
|
): WorkerRuntimeApiContext {
|
|
19505
|
+
return absurdDirectRuntimeApi(launch);
|
|
19506
|
+
}
|
|
19507
|
+
|
|
19508
|
+
/**
|
|
19509
|
+
* The launch's primary token on the owner's direct transport: the app at the
|
|
19510
|
+
* launch's runtime API origin. A gateway-pinned token is refused loudly here
|
|
19511
|
+
* (`runtime_gateway_transport_unpinned`) instead of drawing a 403.
|
|
19512
|
+
*/
|
|
19513
|
+
function absurdDirectRuntimeApi(
|
|
19514
|
+
launch: PlaySchedulerSubmitInput,
|
|
19515
|
+
): WorkerRuntimeApiContext {
|
|
19516
|
+
const transport = resolveRuntimeAppTransport({
|
|
19517
|
+
caller: 'direct',
|
|
19518
|
+
launch,
|
|
19519
|
+
executorToken: launch.executorToken,
|
|
19520
|
+
});
|
|
19349
19521
|
return {
|
|
19350
|
-
baseUrl:
|
|
19522
|
+
baseUrl: transport.baseUrl,
|
|
19351
19523
|
executorToken: launch.executorToken,
|
|
19352
|
-
vercelProtectionBypassToken:
|
|
19524
|
+
vercelProtectionBypassToken: transport.vercelProtectionBypassToken,
|
|
19353
19525
|
};
|
|
19354
19526
|
}
|
|
19355
19527
|
|
|
@@ -26421,9 +26593,15 @@ export async function requestComputeBillingDispatchToken(input: {
|
|
|
26421
26593
|
'Compute-billing recovery requires a valid dispatch lease and DEEPLINE_INTERNAL_TOKEN.',
|
|
26422
26594
|
);
|
|
26423
26595
|
}
|
|
26424
|
-
|
|
26596
|
+
// Signed with the internal token, which is never pinned.
|
|
26597
|
+
const appBaseUrl = resolveRuntimeAppTransport({
|
|
26598
|
+
caller: 'direct',
|
|
26599
|
+
launch: input.launch,
|
|
26600
|
+
executorToken: internalToken,
|
|
26601
|
+
}).baseUrl;
|
|
26602
|
+
const url = `${appBaseUrl.replace(/\/$/, '')}/api/v2/internal/play-runtime/compute-billing-dispatch-token`;
|
|
26425
26603
|
const vercelProtectionHeaders = await vercelProtectionBypassHeaders({
|
|
26426
|
-
baseUrl:
|
|
26604
|
+
baseUrl: appBaseUrl,
|
|
26427
26605
|
token: input.launch.vercelProtectionBypassToken,
|
|
26428
26606
|
});
|
|
26429
26607
|
const response = await fetch(url, {
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-attempt.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mintRuntimeGatewayAttemptOidcToken,
|
|
3
|
+
readExecutorTokenClaimsUnverified,
|
|
4
|
+
} from '../runtime-app-transport';
|
|
5
|
+
import {
|
|
6
|
+
assertRuntimeGatewayPinFresh,
|
|
7
|
+
readRuntimeGatewayLaunchPin,
|
|
8
|
+
RuntimeGatewayLaunchError,
|
|
9
|
+
type RuntimeGatewayLaunchFields,
|
|
10
|
+
type RuntimeGatewayLaunchPin,
|
|
11
|
+
} from '../runtime-gateway-profile';
|
|
12
|
+
import type { RuntimeGatewayOidcSigningKey } from '../runtime-gateway-oidc';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Worker-side checks for a pinned launch. Every function is a no-op (null)
|
|
16
|
+
* for unpinned launches, so the default path is unchanged.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** Attempt start / resume: refuse an expired or unreadable pin loudly. */
|
|
20
|
+
export function assertRuntimeGatewayAttemptStartable(
|
|
21
|
+
launch: RuntimeGatewayLaunchFields,
|
|
22
|
+
nowMs: number,
|
|
23
|
+
): RuntimeGatewayLaunchPin | null {
|
|
24
|
+
const pin = readRuntimeGatewayLaunchPin(launch);
|
|
25
|
+
if (pin) assertRuntimeGatewayPinFresh(pin, nowMs);
|
|
26
|
+
return pin;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The app minted the primary executor token. For a pinned launch it must
|
|
31
|
+
* carry `runtime_gateway_deployment_id` equal to the pin; an older app that
|
|
32
|
+
* ignored the pin would otherwise hand the sandbox a token the pinned gateway
|
|
33
|
+
* refuses, or quietly route the run elsewhere. The signature is verified by
|
|
34
|
+
* the gateway on use; here only the claim's presence and value are checked.
|
|
35
|
+
*/
|
|
36
|
+
export function assertExecutorTokenCarriesRuntimeGatewayPin(
|
|
37
|
+
executorToken: string,
|
|
38
|
+
pin: RuntimeGatewayLaunchPin,
|
|
39
|
+
): void {
|
|
40
|
+
const claims = readExecutorTokenClaimsUnverified(executorToken);
|
|
41
|
+
if (
|
|
42
|
+
claims?.runtime_gateway_deployment_id !== pin.deploymentId ||
|
|
43
|
+
claims?.runtime_gateway_profile !== pin.profile.id
|
|
44
|
+
) {
|
|
45
|
+
throw new RuntimeGatewayLaunchError(
|
|
46
|
+
'runtime_gateway_executor_token_unpinned',
|
|
47
|
+
`The executor token for a launch pinned to ${pin.deploymentId} (${pin.profile.id}) does not carry the matching runtime gateway claims; the issuing app does not support Runtime gateway profiles.`,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The runner config a sandbox launch receives. Unpinned launches return the
|
|
54
|
+
* same object. Pinned launches re-check pin age and carry a fresh credential.
|
|
55
|
+
*/
|
|
56
|
+
export function withRuntimeGatewayAttemptCredential<
|
|
57
|
+
T extends { context: { runtimeGatewayOidcToken?: string | null } },
|
|
58
|
+
>(input: {
|
|
59
|
+
config: T;
|
|
60
|
+
launch: RuntimeGatewayLaunchFields;
|
|
61
|
+
runId: string;
|
|
62
|
+
attempt: number;
|
|
63
|
+
nowMs: number;
|
|
64
|
+
signingKey: () => RuntimeGatewayOidcSigningKey | null;
|
|
65
|
+
}): T {
|
|
66
|
+
const pin = assertRuntimeGatewayAttemptStartable(input.launch, input.nowMs);
|
|
67
|
+
if (!pin) return input.config;
|
|
68
|
+
return {
|
|
69
|
+
...input.config,
|
|
70
|
+
context: {
|
|
71
|
+
...input.config.context,
|
|
72
|
+
runtimeGatewayOidcToken: mintRuntimeGatewayAttemptOidcToken({
|
|
73
|
+
pin,
|
|
74
|
+
runId: input.runId,
|
|
75
|
+
attempt: input.attempt,
|
|
76
|
+
nowMs: input.nowMs,
|
|
77
|
+
signingKey: input.signingKey(),
|
|
78
|
+
}),
|
|
79
|
+
},
|
|
80
|
+
} as T;
|
|
81
|
+
}
|