deepline 0.3.500 → 0.3.501
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 +18 -0
- 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/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/protocol.ts +13 -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 +21 -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 +25 -3
- 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 +176 -16
- 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/cli/{auth-WK3FDPRP.mjs → auth-6ECHXOI4.mjs} +5 -5
- package/dist/cli/auth-VP7PMXKQ.js +43 -0
- package/dist/cli/{billing-O3LVKXE7.mjs → billing-75NZYRXA.mjs} +8 -8
- package/dist/cli/{billing-K7UHZUF4.js → billing-QRR7O6BD.js} +81 -81
- package/dist/cli/{chunk-RAZ3TMOS.js → chunk-463ZOO2L.js} +7 -7
- package/dist/cli/{chunk-W64Y7GE7.js → chunk-4OXHLTCP.js} +1 -1
- package/dist/cli/{chunk-5TVY5OEH.mjs → chunk-5S7MLAI7.mjs} +11 -11
- package/dist/cli/{chunk-SNJNPRIV.js → chunk-5X4AUFYW.js} +7 -7
- package/dist/cli/{chunk-CIV5GJAE.mjs → chunk-66XDYH5T.mjs} +2 -2
- package/dist/cli/{chunk-SRS2D27G.mjs → chunk-7L6QNHUL.mjs} +1 -1
- package/dist/cli/{chunk-GBRI644Y.js → chunk-APAHMCGR.js} +53 -53
- package/dist/cli/{chunk-UBKA33KY.mjs → chunk-BMCRTI6Z.mjs} +22 -1
- package/dist/cli/{chunk-K3BHKRMS.js → chunk-BOFCF4L7.js} +3 -3
- package/dist/cli/{chunk-KEBNXJSK.js → chunk-CJJ7JBM2.js} +16 -16
- package/dist/cli/{chunk-5JXGYSXH.mjs → chunk-EHVFBD36.mjs} +1 -1
- package/dist/cli/{chunk-5KAZGZG7.js → chunk-EKF4DKUA.js} +5 -5
- package/dist/cli/{chunk-IX2DPYIV.js → chunk-EKZQ5LQO.js} +3 -3
- package/dist/cli/{chunk-JHNFUCVT.mjs → chunk-EOO7OSS4.mjs} +4 -4
- package/dist/cli/{chunk-GOO4VI5M.js → chunk-FS7XYDOF.js} +16 -16
- package/dist/cli/{chunk-G3NA4R7M.js → chunk-HDKXSHGA.js} +53 -53
- package/dist/cli/{chunk-PHGMC33I.js → chunk-J6SVNKRP.js} +2 -2
- package/dist/cli/{chunk-L7X6ADNM.mjs → chunk-J74N375S.mjs} +4 -4
- package/dist/cli/{chunk-X7ODM2LK.js → chunk-KTOAJP4N.js} +6 -6
- package/dist/cli/{chunk-CBZTKDXW.mjs → chunk-MADTHS56.mjs} +1 -1
- package/dist/cli/{chunk-IZ6YWXIK.mjs → chunk-MSLXAVVK.mjs} +2 -2
- package/dist/cli/{chunk-Q2FXZ4Z5.js → chunk-N2TJJNCW.js} +96 -96
- package/dist/cli/{chunk-CS2AEAD6.mjs → chunk-N4TR6QRI.mjs} +1 -1
- package/dist/cli/{chunk-XCBOOB73.mjs → chunk-NA3J3F2Z.mjs} +1 -1
- package/dist/cli/{chunk-QRKCCY4L.mjs → chunk-O3DDVP7Z.mjs} +1 -1
- package/dist/cli/{chunk-XUOZYAP5.mjs → chunk-OKOXB3LY.mjs} +2 -2
- package/dist/cli/{chunk-SNPZ2QWL.js → chunk-PNF2ZU4R.js} +8 -8
- package/dist/cli/{chunk-X5SO7RV5.mjs → chunk-PXIF74UJ.mjs} +4 -4
- package/dist/cli/{chunk-74VKLBJD.js → chunk-QQ3JJYE2.js} +14 -14
- package/dist/cli/{chunk-4CJWOLOS.mjs → chunk-RFV7PPLS.mjs} +3 -3
- package/dist/cli/{chunk-EQR5O2D2.js → chunk-RNSHCJME.js} +3 -3
- package/dist/cli/{chunk-REIKJREB.js → chunk-RU5ROUFO.js} +5 -5
- package/dist/cli/{chunk-TOGCDNMH.js → chunk-SV2TEZ2M.js} +4 -4
- package/dist/cli/{chunk-MAHLIWOF.mjs → chunk-T4U245E4.mjs} +2 -2
- package/dist/cli/{chunk-T4AGTOKQ.mjs → chunk-T7E3XEPG.mjs} +6 -6
- package/dist/cli/{chunk-RHE4YI4H.js → chunk-TOE7LHEA.js} +6 -6
- package/dist/cli/{chunk-FJZUG633.mjs → chunk-UJRN6YP6.mjs} +3 -3
- package/dist/cli/{chunk-BIE57V6K.js → chunk-UR7JOSLT.js} +360 -300
- package/dist/cli/{chunk-5AC7NUQN.mjs → chunk-V5NHEYU7.mjs} +5 -5
- package/dist/cli/{chunk-PGRPNRP6.mjs → chunk-VD2374K7.mjs} +1 -1
- package/dist/cli/{chunk-VLCY4F6E.js → chunk-VL72UKNW.js} +26 -26
- package/dist/cli/{chunk-56QAHX2K.mjs → chunk-VTDAJZIJ.mjs} +90 -30
- package/dist/cli/{chunk-Z5LE7NXM.js → chunk-VVEMPC2I.js} +2 -2
- package/dist/cli/{chunk-U5GFP26N.js → chunk-W6JTHVPF.js} +21 -21
- package/dist/cli/{chunk-C7355NMU.mjs → chunk-WJUDAHIQ.mjs} +1 -1
- package/dist/cli/{chunk-XDVT3GOM.js → chunk-WSGXBROE.js} +22 -1
- package/dist/cli/{chunk-LNMY2T5S.js → chunk-XEBFJ2PH.js} +41 -41
- package/dist/cli/{chunk-HI2BFS5S.mjs → chunk-Z6AUOV7D.mjs} +2 -2
- package/dist/cli/{chunk-VPVEPGYS.mjs → chunk-ZUOKIBLJ.mjs} +2 -2
- package/dist/cli/{chunk-V7MZYIA7.mjs → chunk-ZUQHQGC5.mjs} +5 -5
- package/dist/cli/{csv-MWCWNIBJ.js → csv-JXX2LXK5.js} +13 -13
- package/dist/cli/{csv-DEUOSTEB.mjs → csv-RZJ4SOIL.mjs} +4 -4
- package/dist/cli/{db-QM5R5BRY.mjs → db-MUTT2NWI.mjs} +8 -8
- package/dist/cli/{db-Q6IRXTTG.js → db-T2KJNONM.js} +29 -29
- package/dist/cli/{describe-CQZ7TBOG.mjs → describe-K3UMAAVO.mjs} +19 -19
- package/dist/cli/describe-SEXUJLE4.js +50 -0
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/{executions-DCCDXSQI.js → executions-7HSLDRHR.js} +10 -10
- package/dist/cli/{executions-SWBKFCY2.mjs → executions-PHS4R2OX.mjs} +8 -8
- package/dist/cli/{feedback-EU3EYF4V.js → feedback-BJZRM637.js} +8 -8
- package/dist/cli/{feedback-Q27HN3SB.mjs → feedback-RWMDCIDF.mjs} +4 -4
- package/dist/cli/git-VNS7UQWN.js +25 -0
- package/dist/cli/{git-SEQFTQ4N.mjs → git-YW6VHYZG.mjs} +5 -5
- package/dist/cli/index.js +137 -137
- package/dist/cli/index.mjs +40 -40
- package/dist/cli/{legacy-noops-LCQDEVA3.js → legacy-noops-2WUV2XD7.js} +8 -8
- package/dist/cli/{legacy-noops-XKH4VREG.mjs → legacy-noops-5UBSUPGG.mjs} +5 -5
- package/dist/cli/{monitors-4XWBV46I.mjs → monitors-HWOQO3OK.mjs} +9 -9
- package/dist/cli/{monitors-DJCID6X5.js → monitors-YZZRKSTG.js} +97 -97
- package/dist/cli/{org-BU4FG5PN.js → org-JY7HLHBA.js} +74 -74
- package/dist/cli/{org-PSBGXBRW.mjs → org-NCXT6RB4.mjs} +8 -8
- package/dist/cli/{pages-3PHJYXYB.js → pages-6ZOHXL6X.js} +20 -20
- package/dist/cli/{pages-7QLXLJGQ.mjs → pages-QJO53QAT.mjs} +8 -8
- package/dist/cli/{play-4OLYXRCG.mjs → play-SQRS7JN3.mjs} +20 -20
- package/dist/cli/{play-S3CWPQKB.js → play-TAYGSR35.js} +336 -336
- package/dist/cli/{providers-JT7C2QTC.mjs → providers-3IR3N5DT.mjs} +8 -8
- package/dist/cli/{providers-U4JUMLB2.js → providers-4Q5LOIQ5.js} +11 -11
- package/dist/cli/{quickstart-OUSMXLYZ.js → quickstart-ITNUZENY.js} +6 -6
- package/dist/cli/{quickstart-DQF5CF2I.mjs → quickstart-KCZCYO6B.mjs} +4 -4
- package/dist/cli/{run-RECNI77K.mjs → run-JCWRWDSK.mjs} +24 -24
- package/dist/cli/{run-6XXHLB4X.js → run-YQ57LMKN.js} +42 -42
- 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-JN7K3GC6.mjs → search-FUM27HQP.mjs} +9 -9
- package/dist/cli/search-I425FRTK.js +32 -0
- package/dist/cli/{search-output-L6PC5SPM.mjs → search-output-EWEYT34M.mjs} +4 -4
- package/dist/cli/{search-output-JGNYXDWZ.js → search-output-XAMWKRJH.js} +6 -6
- package/dist/cli/{secrets-TX6PCZ77.js → secrets-2IRRRZBL.js} +17 -17
- package/dist/cli/{secrets-UOXZWHBY.mjs → secrets-YTI4IAKR.mjs} +8 -8
- package/dist/cli/{sessions-DTE733EH.mjs → sessions-EFS4KUPF.mjs} +5 -5
- package/dist/cli/{sessions-GCEIX4KB.js → sessions-HWTRDXBQ.js} +6 -6
- package/dist/cli/{settings-UGXSDHR5.js → settings-FRVEIOKR.js} +80 -80
- package/dist/cli/{settings-ZGIMRCTC.mjs → settings-NTOO42DY.mjs} +13 -13
- package/dist/cli/{setup-JYB6Z376.js → setup-6ZIOAE2V.js} +49 -49
- package/dist/cli/{setup-UT7AO53D.mjs → setup-PAVQPALX.mjs} +9 -9
- package/dist/cli/{skills-4QJCMN7J.mjs → skills-3O3XTPUM.mjs} +7 -7
- package/dist/cli/skills-6ZNMO2PR.js +36 -0
- package/dist/cli/{tools-RGNXIAA6.mjs → tools-7QSB65UL.mjs} +18 -18
- package/dist/cli/tools-DPV2JES6.js +57 -0
- package/dist/cli/update-Q5GUDEAW.js +34 -0
- package/dist/cli/{update-Q62EVSXZ.mjs → update-T6CYS5ZT.mjs} +9 -9
- package/dist/cli/{workflow-GENV47RD.js → workflow-4KMJBMGX.js} +19 -19
- package/dist/cli/{workflow-YNIOWM7J.mjs → workflow-OMSXZ73T.mjs} +9 -9
- 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 +114 -108
- 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/describe-BZ544347.js +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
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
normalizePlayRunRuntimeSelection,
|
|
36
36
|
type PlayRunRuntimeSelection,
|
|
37
37
|
} from '../../../shared_libs/play-runtime/runtime-environment.js';
|
|
38
|
+
import { normalizeRuntimeGatewayProfileId } from '../../../shared_libs/play-runtime/runtime-gateway-profile.js';
|
|
38
39
|
import { decodePlayRunPublicStatus } from '../../../shared_libs/play-runtime/run-lifecycle-policy.js';
|
|
39
40
|
|
|
40
41
|
export function normalizePlayRunIntegrationMode(
|
|
@@ -82,8 +83,14 @@ function resolvePlayRunRuntimeSelection(
|
|
|
82
83
|
const configuredToken = env.DEEPLINE_RUNTIME_ENVIRONMENT_TOKEN?.trim();
|
|
83
84
|
const configuredPlacementPolicy =
|
|
84
85
|
env.DEEPLINE_RUNTIME_SANDBOX_PLACEMENT_POLICY?.trim();
|
|
86
|
+
const configuredGatewayProfile = env.DEEPLINE_RUNTIME_GATEWAY_PROFILE?.trim();
|
|
85
87
|
if (!configured) {
|
|
86
|
-
if (
|
|
88
|
+
if (
|
|
89
|
+
configuredNamespace ||
|
|
90
|
+
configuredToken ||
|
|
91
|
+
configuredPlacementPolicy ||
|
|
92
|
+
configuredGatewayProfile
|
|
93
|
+
) {
|
|
87
94
|
// Name the variables that are actually set. This branch is almost always
|
|
88
95
|
// hit by a stale value auto-loaded from a .env/.env.local rather than by
|
|
89
96
|
// a deliberate export, so the message has to say where to look and how
|
|
@@ -94,6 +101,9 @@ function resolvePlayRunRuntimeSelection(
|
|
|
94
101
|
if (configuredPlacementPolicy) {
|
|
95
102
|
present.push('DEEPLINE_RUNTIME_SANDBOX_PLACEMENT_POLICY');
|
|
96
103
|
}
|
|
104
|
+
if (configuredGatewayProfile) {
|
|
105
|
+
present.push('DEEPLINE_RUNTIME_GATEWAY_PROFILE');
|
|
106
|
+
}
|
|
97
107
|
const isPlural = present.length > 1;
|
|
98
108
|
throw new DeeplineError(
|
|
99
109
|
[
|
|
@@ -108,20 +118,47 @@ function resolvePlayRunRuntimeSelection(
|
|
|
108
118
|
}
|
|
109
119
|
return undefined;
|
|
110
120
|
}
|
|
121
|
+
// Validated only once a runtime environment is configured: a stale value
|
|
122
|
+
// without one gets the "unset them" guidance above instead.
|
|
123
|
+
const selectedGatewayProfile = configuredGatewayProfile
|
|
124
|
+
? normalizeRuntimeGatewayProfileId(configuredGatewayProfile)
|
|
125
|
+
: undefined;
|
|
126
|
+
if (configuredGatewayProfile && !selectedGatewayProfile) {
|
|
127
|
+
throw new DeeplineError(
|
|
128
|
+
`DEEPLINE_RUNTIME_GATEWAY_PROFILE must be a supported versioned gateway profile id such as vercel_app@1. Received "${configuredGatewayProfile}".`,
|
|
129
|
+
undefined,
|
|
130
|
+
'INVALID_RUNTIME_GATEWAY_PROFILE',
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
const gatewayProfile = selectedGatewayProfile
|
|
134
|
+
? { gatewayProfile: selectedGatewayProfile }
|
|
135
|
+
: {};
|
|
111
136
|
if (configured === 'native') {
|
|
112
137
|
// The app's own runtime on a named placement policy. The server decides
|
|
113
138
|
// from the API key's account whether this caller may ask for it.
|
|
114
|
-
const sandboxPlacementPolicy =
|
|
115
|
-
configuredPlacementPolicy
|
|
116
|
-
|
|
117
|
-
if (
|
|
139
|
+
const sandboxPlacementPolicy = configuredPlacementPolicy
|
|
140
|
+
? normalizePlayRuntimeSandboxPlacementPolicy(configuredPlacementPolicy)
|
|
141
|
+
: undefined;
|
|
142
|
+
if (
|
|
143
|
+
configuredNamespace ||
|
|
144
|
+
(configuredPlacementPolicy && !sandboxPlacementPolicy) ||
|
|
145
|
+
(!sandboxPlacementPolicy && !selectedGatewayProfile)
|
|
146
|
+
) {
|
|
118
147
|
throw new DeeplineError(
|
|
119
|
-
'DEEPLINE_RUNTIME_ENVIRONMENT=native requires DEEPLINE_RUNTIME_SANDBOX_PLACEMENT_POLICY (such as modal_only@1) and no DEEPLINE_RUNTIME_NAMESPACE.',
|
|
148
|
+
'DEEPLINE_RUNTIME_ENVIRONMENT=native requires DEEPLINE_RUNTIME_SANDBOX_PLACEMENT_POLICY (such as modal_only@1) and/or DEEPLINE_RUNTIME_GATEWAY_PROFILE (such as vercel_app@1), and no DEEPLINE_RUNTIME_NAMESPACE.',
|
|
120
149
|
undefined,
|
|
121
150
|
'INVALID_RUNTIME_ENVIRONMENT',
|
|
122
151
|
);
|
|
123
152
|
}
|
|
124
|
-
|
|
153
|
+
// The guard above leaves at least one of the two selected.
|
|
154
|
+
if (sandboxPlacementPolicy) {
|
|
155
|
+
return {
|
|
156
|
+
environment: 'native',
|
|
157
|
+
sandboxPlacementPolicy,
|
|
158
|
+
...gatewayProfile,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return { environment: 'native', gatewayProfile: selectedGatewayProfile! };
|
|
125
162
|
}
|
|
126
163
|
const environment = normalizePlayRuntimeEnvironment(configured);
|
|
127
164
|
if (!environment) {
|
|
@@ -168,6 +205,7 @@ function resolvePlayRunRuntimeSelection(
|
|
|
168
205
|
...(configuredPlacementPolicy
|
|
169
206
|
? { sandboxPlacementPolicy: configuredPlacementPolicy }
|
|
170
207
|
: {}),
|
|
208
|
+
...gatewayProfile,
|
|
171
209
|
};
|
|
172
210
|
}
|
|
173
211
|
|
|
@@ -205,7 +205,7 @@ export const SDK_RELEASE = {
|
|
|
205
205
|
// getters keep their established compatibility behavior.
|
|
206
206
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
207
207
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
208
|
-
version: '0.3.
|
|
208
|
+
version: '0.3.501',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -910,6 +910,24 @@
|
|
|
910
910
|
"failureAlert": "vercel_route_wrapper",
|
|
911
911
|
"domainReportRequired": true
|
|
912
912
|
},
|
|
913
|
+
{
|
|
914
|
+
"id": "vercel.runtime-gateway-staging-retirement",
|
|
915
|
+
"name": "Runtime gateway staged-body retirement",
|
|
916
|
+
"scheduler": "vercel_cron",
|
|
917
|
+
"cadence": "7,22,37,52 * * * *",
|
|
918
|
+
"timezone": "UTC",
|
|
919
|
+
"source": "apps/deepline-api/vercel.json",
|
|
920
|
+
"locator": "/api/v2/cron/runtime-gateway-staging-retirement",
|
|
921
|
+
"owner": "runtime",
|
|
922
|
+
"criticality": "maintenance",
|
|
923
|
+
"purpose": "Retire app-hosted Runtime gateway staged bodies past their retirement time: delete each exact object, confirm it absent, then mark its custody row deleted; prune long-deleted rows.",
|
|
924
|
+
"successDefinition": "Every scheduler schema served by the deployment was probed; each due row was either confirmed absent and marked deleted or released for the next pass; an idle journal is a valid no-op.",
|
|
925
|
+
"failureDefinition": "A schema's journal probe, claim or prune fails, or target discovery fails, leaving due staged bodies unretired.",
|
|
926
|
+
"startGraceMs": 300000,
|
|
927
|
+
"runTimeoutMs": 300000,
|
|
928
|
+
"failureAlert": "vercel_route_wrapper",
|
|
929
|
+
"domainReportRequired": true
|
|
930
|
+
},
|
|
913
931
|
{
|
|
914
932
|
"id": "vercel.scheduled-work-health-snapshot",
|
|
915
933
|
"name": "Scheduled-work health snapshot",
|
|
@@ -79,6 +79,18 @@ function resolveBucket(kind: R2BucketKind): string {
|
|
|
79
79
|
return requireEnv('CLOUDFLARE_R2_BUCKET_NAME');
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Nonsecret identity of the bucket a configuration addresses: SHA-256 of the
|
|
84
|
+
* bucket name and the endpoint host. Two processes address the same bucket
|
|
85
|
+
* only when their fingerprints match. Resolves no credentials.
|
|
86
|
+
*/
|
|
87
|
+
export function getR2BucketFingerprint(kind: R2BucketKind = 'default'): string {
|
|
88
|
+
const host = new URL(requireEnv('CLOUDFLARE_R2_ENDPOINT')).host.toLowerCase();
|
|
89
|
+
return createHash('sha256')
|
|
90
|
+
.update(`${resolveBucket(kind)}\n${host}`)
|
|
91
|
+
.digest('hex');
|
|
92
|
+
}
|
|
93
|
+
|
|
82
94
|
export function getR2Config(kind: R2BucketKind = 'default') {
|
|
83
95
|
return {
|
|
84
96
|
endpoint: requireEnv('CLOUDFLARE_R2_ENDPOINT'),
|
|
@@ -191,12 +203,14 @@ export async function r2ObjectExists(
|
|
|
191
203
|
export async function confirmR2ObjectAbsent(
|
|
192
204
|
key: string,
|
|
193
205
|
kind: R2BucketKind = 'default',
|
|
206
|
+
options?: { abortSignal?: AbortSignal },
|
|
194
207
|
): Promise<boolean> {
|
|
195
208
|
const config = getR2Config(kind);
|
|
196
209
|
const client = getR2Client(config);
|
|
197
210
|
try {
|
|
198
211
|
await client.send(
|
|
199
212
|
new HeadObjectCommand({ Bucket: config.bucket, Key: key }),
|
|
213
|
+
{ abortSignal: options?.abortSignal },
|
|
200
214
|
);
|
|
201
215
|
return false;
|
|
202
216
|
} catch (error) {
|
|
@@ -312,6 +326,7 @@ export async function listR2Keys(
|
|
|
312
326
|
export async function deleteR2Object(
|
|
313
327
|
key: string,
|
|
314
328
|
kind: R2BucketKind = 'default',
|
|
329
|
+
options?: { abortSignal?: AbortSignal },
|
|
315
330
|
): Promise<void> {
|
|
316
331
|
const startedAt = Date.now();
|
|
317
332
|
const config = getR2Config(kind);
|
|
@@ -321,6 +336,7 @@ export async function deleteR2Object(
|
|
|
321
336
|
Bucket: config.bucket,
|
|
322
337
|
Key: key,
|
|
323
338
|
}),
|
|
339
|
+
{ abortSignal: options?.abortSignal },
|
|
324
340
|
);
|
|
325
341
|
logR2Perf('delete', key, startedAt, { kind });
|
|
326
342
|
}
|
|
@@ -392,3 +408,142 @@ export async function createSignedR2WriteUrl(input: {
|
|
|
392
408
|
expiresAt: new Date(Date.now() + expiresInSeconds * 1000).toISOString(),
|
|
393
409
|
};
|
|
394
410
|
}
|
|
411
|
+
|
|
412
|
+
/** Ceiling for a create-once upload grant: 15 minutes. */
|
|
413
|
+
export const R2_CREATE_ONCE_UPLOAD_MAX_EXPIRES_SECONDS = 15 * 60;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Sign an exact-size, create-once PUT (`If-None-Match: *`) valid for at most
|
|
417
|
+
* 15 minutes. This bounds what the URL can write; it does not verify the
|
|
418
|
+
* digest or retire the object. The caller persists custody before calling
|
|
419
|
+
* this, verifies the stored bytes before use, and deletes the key only after
|
|
420
|
+
* the URL has expired (until then the URL could recreate a deleted key).
|
|
421
|
+
*/
|
|
422
|
+
export async function createSignedR2CreateOnceUrl(input: {
|
|
423
|
+
key: string;
|
|
424
|
+
kind?: R2BucketKind;
|
|
425
|
+
contentType: string;
|
|
426
|
+
byteLength: number;
|
|
427
|
+
maxBytes: number;
|
|
428
|
+
expiresInSeconds: number;
|
|
429
|
+
}): Promise<{
|
|
430
|
+
url: string;
|
|
431
|
+
expiresAt: string;
|
|
432
|
+
headers: {
|
|
433
|
+
'content-type': string;
|
|
434
|
+
'content-length': string;
|
|
435
|
+
'if-none-match': '*';
|
|
436
|
+
};
|
|
437
|
+
}> {
|
|
438
|
+
if (!input.key || !input.contentType) {
|
|
439
|
+
throw new Error('R2 create-once upload requires a key and content type.');
|
|
440
|
+
}
|
|
441
|
+
if (
|
|
442
|
+
!Number.isSafeInteger(input.byteLength) ||
|
|
443
|
+
!Number.isSafeInteger(input.maxBytes) ||
|
|
444
|
+
input.byteLength < 0 ||
|
|
445
|
+
input.maxBytes < 0 ||
|
|
446
|
+
input.byteLength > input.maxBytes
|
|
447
|
+
) {
|
|
448
|
+
throw new Error('R2 create-once upload size exceeds its allowed bound.');
|
|
449
|
+
}
|
|
450
|
+
if (
|
|
451
|
+
!Number.isSafeInteger(input.expiresInSeconds) ||
|
|
452
|
+
input.expiresInSeconds < 1 ||
|
|
453
|
+
input.expiresInSeconds > R2_CREATE_ONCE_UPLOAD_MAX_EXPIRES_SECONDS
|
|
454
|
+
) {
|
|
455
|
+
throw new Error(
|
|
456
|
+
`R2 create-once upload expiry must be between 1 and ${R2_CREATE_ONCE_UPLOAD_MAX_EXPIRES_SECONDS} seconds.`,
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
const kind = input.kind ?? 'default';
|
|
460
|
+
const config = getR2Config(kind);
|
|
461
|
+
const client = createR2Client(config);
|
|
462
|
+
const command = new PutObjectCommand({
|
|
463
|
+
Bucket: config.bucket,
|
|
464
|
+
Key: input.key,
|
|
465
|
+
ContentType: input.contentType,
|
|
466
|
+
ContentLength: input.byteLength,
|
|
467
|
+
IfNoneMatch: '*',
|
|
468
|
+
});
|
|
469
|
+
// SigV4 timestamps have whole-second precision. Report that exact deadline.
|
|
470
|
+
const signingDate = new Date(Math.floor(Date.now() / 1000) * 1000);
|
|
471
|
+
const url = await getSignedUrl(
|
|
472
|
+
client as R2PresignerClient,
|
|
473
|
+
command as R2PresignerCommand,
|
|
474
|
+
{
|
|
475
|
+
expiresIn: input.expiresInSeconds,
|
|
476
|
+
signingDate,
|
|
477
|
+
signableHeaders: new Set([
|
|
478
|
+
'content-length',
|
|
479
|
+
'content-type',
|
|
480
|
+
'if-none-match',
|
|
481
|
+
]),
|
|
482
|
+
},
|
|
483
|
+
);
|
|
484
|
+
return {
|
|
485
|
+
url,
|
|
486
|
+
expiresAt: new Date(
|
|
487
|
+
signingDate.getTime() + input.expiresInSeconds * 1000,
|
|
488
|
+
).toISOString(),
|
|
489
|
+
headers: {
|
|
490
|
+
'content-type': input.contentType,
|
|
491
|
+
'content-length': String(input.byteLength),
|
|
492
|
+
'if-none-match': '*',
|
|
493
|
+
},
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/** R2 answered that the key does not exist (as opposed to failing). */
|
|
498
|
+
export function isR2NotFoundError(error: unknown): boolean {
|
|
499
|
+
const details = error as {
|
|
500
|
+
name?: string;
|
|
501
|
+
Code?: string;
|
|
502
|
+
$metadata?: { httpStatusCode?: number };
|
|
503
|
+
} | null;
|
|
504
|
+
return (
|
|
505
|
+
!!details &&
|
|
506
|
+
(details.$metadata?.httpStatusCode === 404 ||
|
|
507
|
+
details.name === 'NotFound' ||
|
|
508
|
+
details.name === 'NoSuchKey' ||
|
|
509
|
+
details.Code === 'NotFound' ||
|
|
510
|
+
details.Code === 'NoSuchKey')
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Read one object, refusing before buffering when it is larger than
|
|
516
|
+
* `maxBytes`. Returns null only when R2 says the key does not exist; every
|
|
517
|
+
* other failure throws, so callers never mistake an outage for absence.
|
|
518
|
+
*/
|
|
519
|
+
export async function getBoundedBufferFromR2(
|
|
520
|
+
key: string,
|
|
521
|
+
maxBytes: number,
|
|
522
|
+
kind: R2BucketKind = 'default',
|
|
523
|
+
): Promise<Buffer | null> {
|
|
524
|
+
const startedAt = Date.now();
|
|
525
|
+
const config = getR2Config(kind);
|
|
526
|
+
const client = getR2Client(config);
|
|
527
|
+
let response;
|
|
528
|
+
try {
|
|
529
|
+
response = await client.send(
|
|
530
|
+
new GetObjectCommand({ Bucket: config.bucket, Key: key }),
|
|
531
|
+
);
|
|
532
|
+
} catch (error) {
|
|
533
|
+
if (isR2NotFoundError(error)) return null;
|
|
534
|
+
throw error;
|
|
535
|
+
}
|
|
536
|
+
if (
|
|
537
|
+
typeof response.ContentLength === 'number' &&
|
|
538
|
+
response.ContentLength > maxBytes
|
|
539
|
+
) {
|
|
540
|
+
(response.Body as { destroy?: () => void } | undefined)?.destroy?.();
|
|
541
|
+
throw new Error(`R2 object ${key} exceeds ${maxBytes} bytes.`);
|
|
542
|
+
}
|
|
543
|
+
const bytes = await response.Body!.transformToByteArray();
|
|
544
|
+
if (bytes.byteLength > maxBytes) {
|
|
545
|
+
throw new Error(`R2 object ${key} exceeds ${maxBytes} bytes.`);
|
|
546
|
+
}
|
|
547
|
+
logR2Perf('get-bounded', key, startedAt, { kind, bytes: bytes.byteLength });
|
|
548
|
+
return Buffer.from(bytes);
|
|
549
|
+
}
|
|
@@ -1007,8 +1007,14 @@ function appRuntimeProjectionMismatch(
|
|
|
1007
1007
|
}
|
|
1008
1008
|
}
|
|
1009
1009
|
|
|
1010
|
+
/**
|
|
1011
|
+
* A 500 body that names a transient failure. `INTERNAL_FUNCTION_INVOCATION_FAILED`
|
|
1012
|
+
* is Vercel's own platform error page (the function was not invoked or its
|
|
1013
|
+
* invocation was lost inside Vercel), not an app outcome; only replay-safe
|
|
1014
|
+
* actions reach this check, so retrying it is safe.
|
|
1015
|
+
*/
|
|
1010
1016
|
export function isTransientAppRuntimeFailureBody(body: string): boolean {
|
|
1011
|
-
return
|
|
1017
|
+
return /\bINTERNAL_FUNCTION_INVOCATION_FAILED\b|WorkerOverloaded|"\s*code\s*"\s*:\s*"\s*InternalServerError\s*"|Your request couldn't be completed\. Try again later\.|timeout exceeded when trying to connect|timed out|fetch failed|ECONNRESET|ECONNREFUSED|UND_ERR_CONNECT_TIMEOUT|tuple concurrently updated|RUNTIME_SCHEDULER_(?:SATURATED|UNAVAILABLE|SCHEMA_NOT_READY)|Runtime scheduler DB pool is saturated|Runtime scheduler DB circuit breaker is open|Runtime scheduler schema .* is not ready|OptimisticConcurrencyControlFailure|changed while this mutation was being run|Documents read from or written to the .* table changed while this mutation/i.test(
|
|
1012
1018
|
body,
|
|
1013
1019
|
);
|
|
1014
1020
|
}
|
|
@@ -98,6 +98,7 @@ import {
|
|
|
98
98
|
resolveMapRowOutcomeKey,
|
|
99
99
|
} from './map-row-outcome';
|
|
100
100
|
import {
|
|
101
|
+
integrationExecutePath,
|
|
101
102
|
PLAY_RUNTIME_API_COMPAT_PATH,
|
|
102
103
|
PLAY_RUNTIME_OPERATION_ATTEMPT_HEADER,
|
|
103
104
|
PLAY_RUNTIME_OPERATION_ID_HEADER,
|
|
@@ -19660,7 +19661,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
19660
19661
|
DURABLE_INVOCATION_FENCE_VERSION,
|
|
19661
19662
|
)
|
|
19662
19663
|
: 'execute';
|
|
19663
|
-
const url = `${executionBaseUrl.replace(/\/$/, '')}
|
|
19664
|
+
const url = `${executionBaseUrl.replace(/\/$/, '')}${integrationExecutePath(toolId, executeSuffix)}`;
|
|
19664
19665
|
const fixtureReplaySafe = this.#options.integrationMode === 'fixture';
|
|
19665
19666
|
const readOnlyQuery = isQueryResultDatasetReadRequest(
|
|
19666
19667
|
toolId,
|
|
@@ -66,6 +66,8 @@ export function durableInvocationFenceAttestationHeaders(): Record<
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
export function durableInvocationFenceExecutePath(
|
|
69
|
+
export function durableInvocationFenceExecutePath(
|
|
70
|
+
version: 1 | 2,
|
|
71
|
+
): 'execute-fenced-v1' | 'execute-fenced-v2' {
|
|
70
72
|
return `execute-fenced-v${version}`;
|
|
71
73
|
}
|
|
@@ -302,6 +302,14 @@ type WorkflowInternalTokenBaseClaims = {
|
|
|
302
302
|
v: typeof INTERNAL_BOOTSTRAP_TOKEN_VERSION;
|
|
303
303
|
};
|
|
304
304
|
|
|
305
|
+
/** Vercel deployment id shape carried by `runtime_gateway_deployment_id`. */
|
|
306
|
+
const RUNTIME_GATEWAY_DEPLOYMENT_ID_CLAIM_PATTERN = /^dpl_[A-Za-z0-9]+$/;
|
|
307
|
+
/**
|
|
308
|
+
* Versioned profile id shape. Membership is checked by the gateway that serves
|
|
309
|
+
* the profile, so a token naming a newer profile still verifies here.
|
|
310
|
+
*/
|
|
311
|
+
const RUNTIME_GATEWAY_PROFILE_CLAIM_PATTERN = /^[a-z][a-z0-9_]*@[1-9][0-9]*$/;
|
|
312
|
+
|
|
305
313
|
export type WorkflowRunExecutionTokenClaims =
|
|
306
314
|
WorkflowInternalTokenBaseClaims & {
|
|
307
315
|
purpose: typeof INTERNAL_WORKFLOW_EXECUTION_PURPOSE;
|
|
@@ -349,6 +357,13 @@ export type WorkflowRunExecutionTokenClaims =
|
|
|
349
357
|
capabilities: RuntimeExecutionCapability[];
|
|
350
358
|
/** Trusted deployment origin that issued this run token. */
|
|
351
359
|
runtime_origin?: string;
|
|
360
|
+
/**
|
|
361
|
+
* Runtime gateway pin: the immutable app deployment (`dpl_...`) whose
|
|
362
|
+
* in-process gateway alone may accept this token. Absent on unpinned runs.
|
|
363
|
+
*/
|
|
364
|
+
runtime_gateway_deployment_id?: string;
|
|
365
|
+
/** Runtime gateway profile id paired with `runtime_gateway_deployment_id`. */
|
|
366
|
+
runtime_gateway_profile?: string;
|
|
352
367
|
/** Immutable receiver advertising leased Run Ledger ingress-prefix support. */
|
|
353
368
|
run_ledger_ingress_prefix_origin?: string;
|
|
354
369
|
};
|
|
@@ -665,6 +680,18 @@ function isValidWorkflowClaimsShape(
|
|
|
665
680
|
typeof claims.terminal_contract === 'string') &&
|
|
666
681
|
(claims.runtime_origin === undefined ||
|
|
667
682
|
isValidRuntimeOrigin(claims.runtime_origin)) &&
|
|
683
|
+
(claims.runtime_gateway_deployment_id === undefined ||
|
|
684
|
+
(typeof claims.runtime_gateway_deployment_id === 'string' &&
|
|
685
|
+
RUNTIME_GATEWAY_DEPLOYMENT_ID_CLAIM_PATTERN.test(
|
|
686
|
+
claims.runtime_gateway_deployment_id,
|
|
687
|
+
))) &&
|
|
688
|
+
(claims.runtime_gateway_profile === undefined ||
|
|
689
|
+
(typeof claims.runtime_gateway_profile === 'string' &&
|
|
690
|
+
RUNTIME_GATEWAY_PROFILE_CLAIM_PATTERN.test(
|
|
691
|
+
claims.runtime_gateway_profile,
|
|
692
|
+
))) &&
|
|
693
|
+
(claims.runtime_gateway_deployment_id === undefined) ===
|
|
694
|
+
(claims.runtime_gateway_profile === undefined) &&
|
|
668
695
|
(claims.run_ledger_ingress_prefix_origin === undefined ||
|
|
669
696
|
isValidRuntimeOrigin(claims.run_ledger_ingress_prefix_origin)) &&
|
|
670
697
|
Array.isArray(claims.capabilities) &&
|
|
@@ -761,12 +788,32 @@ export async function mintWorkflowRunExecutionToken(input: {
|
|
|
761
788
|
terminalContract?: DirectCompletedTerminalContract | null;
|
|
762
789
|
capabilities?: readonly RuntimeExecutionCapability[];
|
|
763
790
|
runtimeOrigin?: string | null;
|
|
791
|
+
/** Both or neither: the pinned deployment and its gateway profile id. */
|
|
792
|
+
runtimeGatewayDeploymentId?: string | null;
|
|
793
|
+
runtimeGatewayProfileId?: string | null;
|
|
764
794
|
runLedgerIngressPrefixOrigin?: string | null;
|
|
765
795
|
subject?: string | null;
|
|
766
796
|
nowMs?: number;
|
|
767
797
|
}): Promise<string> {
|
|
768
798
|
const fixtureBehavior = validateFixtureBehavior(input.fixtureBehavior);
|
|
769
|
-
|
|
799
|
+
const runtimeGatewayDeploymentId =
|
|
800
|
+
input.runtimeGatewayDeploymentId?.trim() || null;
|
|
801
|
+
const runtimeGatewayProfileId = input.runtimeGatewayProfileId?.trim() || null;
|
|
802
|
+
if (
|
|
803
|
+
(runtimeGatewayDeploymentId === null) !==
|
|
804
|
+
(runtimeGatewayProfileId === null) ||
|
|
805
|
+
(runtimeGatewayDeploymentId !== null &&
|
|
806
|
+
!RUNTIME_GATEWAY_DEPLOYMENT_ID_CLAIM_PATTERN.test(
|
|
807
|
+
runtimeGatewayDeploymentId,
|
|
808
|
+
)) ||
|
|
809
|
+
(runtimeGatewayProfileId !== null &&
|
|
810
|
+
!RUNTIME_GATEWAY_PROFILE_CLAIM_PATTERN.test(runtimeGatewayProfileId))
|
|
811
|
+
) {
|
|
812
|
+
throw new Error(
|
|
813
|
+
'Runtime gateway token claims require a valid deployment id and profile id together.',
|
|
814
|
+
);
|
|
815
|
+
}
|
|
816
|
+
if (fixtureBehavior.ok === false) throw new Error(fixtureBehavior.error);
|
|
770
817
|
if (fixtureBehavior.behavior && input.integrationMode !== 'fixture') {
|
|
771
818
|
throw new Error(
|
|
772
819
|
'fixtureBehavior requires workflow integration mode "fixture".',
|
|
@@ -841,6 +888,12 @@ export async function mintWorkflowRunExecutionToken(input: {
|
|
|
841
888
|
...(input.runtimeOrigin?.trim()
|
|
842
889
|
? { runtime_origin: new URL(input.runtimeOrigin).origin }
|
|
843
890
|
: {}),
|
|
891
|
+
...(runtimeGatewayDeploymentId && runtimeGatewayProfileId
|
|
892
|
+
? {
|
|
893
|
+
runtime_gateway_deployment_id: runtimeGatewayDeploymentId,
|
|
894
|
+
runtime_gateway_profile: runtimeGatewayProfileId,
|
|
895
|
+
}
|
|
896
|
+
: {}),
|
|
844
897
|
...(input.runLedgerIngressPrefixOrigin?.trim()
|
|
845
898
|
? {
|
|
846
899
|
run_ledger_ingress_prefix_origin: new URL(
|
|
@@ -73,6 +73,18 @@ export const PLAY_LAUNCH_ENVELOPE_FIELD_ROLES: {
|
|
|
73
73
|
runLedgerExecutorToken: 'detail',
|
|
74
74
|
runtimeAuthority: 'detail',
|
|
75
75
|
runtimeApiBaseUrl: 'detail',
|
|
76
|
+
// Runtime gateway pin: hosting/transport, not customer intent. The URLs,
|
|
77
|
+
// deployment id and pin time name whichever deployment admitted the run, so
|
|
78
|
+
// a retry of the same launch through another deployment must deduplicate to
|
|
79
|
+
// the first admission (whose pin stands) rather than conflict. The profile
|
|
80
|
+
// id follows them: a profile changes where gateways run, never what the run
|
|
81
|
+
// computes, and keeping it out of the digest leaves every existing launch
|
|
82
|
+
// digest byte-identical.
|
|
83
|
+
runtimeGatewayProfileId: 'detail',
|
|
84
|
+
runtimeReceiptGatewayBaseUrl: 'detail',
|
|
85
|
+
runtimeExecutionGatewayBaseUrl: 'detail',
|
|
86
|
+
runtimeGatewayDeploymentId: 'detail',
|
|
87
|
+
runtimeGatewayPinnedAtMs: 'detail',
|
|
76
88
|
arrayInputTerminalRetirementSupported: 'detail',
|
|
77
89
|
arrayInputTerminalProjectionOrigin: 'detail',
|
|
78
90
|
runtimeTokenOrigin: 'detail',
|
|
@@ -245,6 +245,19 @@ export interface PlayRunnerContextConfig extends RetainedPipelineCarrier {
|
|
|
245
245
|
*/
|
|
246
246
|
executionGatewayBaseUrl?: string | null;
|
|
247
247
|
receiptGatewayBaseUrl?: string | null;
|
|
248
|
+
/**
|
|
249
|
+
* Runtime gateway profile pin (`runtime-gateway-profile.ts`). Absent on
|
|
250
|
+
* unpinned runs. Set only by the worker from a validated launch pin; the
|
|
251
|
+
* gateway URLs above then name the pinned deployment.
|
|
252
|
+
*/
|
|
253
|
+
runtimeGatewayProfileId?: string | null;
|
|
254
|
+
runtimeGatewayDeploymentId?: string | null;
|
|
255
|
+
/** Exact origin and gateway path prefixes that may receive the OIDC token. */
|
|
256
|
+
runtimeGatewayCredentialScope?:
|
|
257
|
+
| import('./runtime-gateway-sandbox-credential').RuntimeGatewayCredentialScope
|
|
258
|
+
| null;
|
|
259
|
+
/** Short-lived edge credential for the pinned gateway; renewed by the watchdog. */
|
|
260
|
+
runtimeGatewayOidcToken?: string | null;
|
|
248
261
|
/**
|
|
249
262
|
* Internal fixture-canary pin for a cordoned receipt-gateway candidate. This
|
|
250
263
|
* is a signed launch fact, never a customer-authored or sandbox-supplied
|
|
@@ -229,3 +229,59 @@ export function buildAsyncPlayRequestFingerprint(input: {
|
|
|
229
229
|
}),
|
|
230
230
|
);
|
|
231
231
|
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Longest run id any runtime scope accepts. Play names are Postgres
|
|
235
|
+
* identifiers (at most 63 characters), so every built id is far below it.
|
|
236
|
+
*/
|
|
237
|
+
export const PLAY_RUN_ID_MAX_LENGTH = 256;
|
|
238
|
+
|
|
239
|
+
const RUNTIME_SCOPE_RUN_ID_PATTERN = /^[A-Za-z0-9_.:@/-]+$/;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* The one run-id check that may gate a request: a non-empty id of at most
|
|
243
|
+
* `PLAY_RUN_ID_MAX_LENGTH` characters from the path-safe alphabet. Run ids are
|
|
244
|
+
* path-shaped (`play/<family>/run/<suffix>`), so `/` is allowed. It is
|
|
245
|
+
* deliberately permissive: it never parses the id, so a scheduler row with an
|
|
246
|
+
* older or foreign id shape is still served.
|
|
247
|
+
*/
|
|
248
|
+
export function isRuntimeScopeRunId(value: unknown): value is string {
|
|
249
|
+
return (
|
|
250
|
+
typeof value === 'string' &&
|
|
251
|
+
value.length > 0 &&
|
|
252
|
+
value.length <= PLAY_RUN_ID_MAX_LENGTH &&
|
|
253
|
+
RUNTIME_SCOPE_RUN_ID_PATTERN.test(value)
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export type ParsedPlayRunId = Readonly<{
|
|
258
|
+
familyKey: string;
|
|
259
|
+
startedAtMs: number;
|
|
260
|
+
kind: 'root' | 'caller' | 'async' | 'rerun';
|
|
261
|
+
}>;
|
|
262
|
+
|
|
263
|
+
const PLAY_RUN_ID_PATTERN =
|
|
264
|
+
/^play\/([a-z0-9-]+(?:\/[a-z0-9-]+)*)\/run\/\d{8}t\d{6}-\d{3}(?:-[a-z0-9]{8}(-caller-[a-f0-9]{64})?|(-async-[a-f0-9]{20})|(-rerun-[a-f0-9]{20}))?$/;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Parse an id built by this module's builders. Diagnostic only: use
|
|
268
|
+
* `isRuntimeScopeRunId` to admit or refuse a request.
|
|
269
|
+
*/
|
|
270
|
+
export function parsePlayRunId(value: unknown): ParsedPlayRunId | null {
|
|
271
|
+
if (!isRuntimeScopeRunId(value)) return null;
|
|
272
|
+
const match = PLAY_RUN_ID_PATTERN.exec(value);
|
|
273
|
+
if (!match) return null;
|
|
274
|
+
const startedAtMs = canonicalPlayRunStartedAtMs(value);
|
|
275
|
+
if (startedAtMs === null) return null;
|
|
276
|
+
return Object.freeze({
|
|
277
|
+
familyKey: match[1]!,
|
|
278
|
+
startedAtMs,
|
|
279
|
+
kind: match[2]
|
|
280
|
+
? 'caller'
|
|
281
|
+
: match[3]
|
|
282
|
+
? 'async'
|
|
283
|
+
: match[4]
|
|
284
|
+
? 'rerun'
|
|
285
|
+
: 'root',
|
|
286
|
+
});
|
|
287
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { runtimeToolPath } from '../runtime-api-paths';
|
|
1
2
|
import {
|
|
2
3
|
emptyRowFailureCounts,
|
|
3
4
|
readRowFailureCounts,
|
|
@@ -9,6 +10,10 @@ import { appendFileSync, createReadStream, writeFileSync } from 'node:fs';
|
|
|
9
10
|
import { readFile } from 'node:fs/promises';
|
|
10
11
|
import { dirname, isAbsolute, resolve } from 'node:path';
|
|
11
12
|
import { createRequire } from 'node:module';
|
|
13
|
+
import {
|
|
14
|
+
installSandboxRuntimeAppTransport,
|
|
15
|
+
sandboxRuntimeAppFetch,
|
|
16
|
+
} from '../runtime-app-transport';
|
|
12
17
|
import { createHash, randomUUID } from 'node:crypto';
|
|
13
18
|
import { formatWithOptions } from 'node:util';
|
|
14
19
|
import { compileFunction } from 'node:vm';
|
|
@@ -215,21 +220,23 @@ export function createReceiptGatewayResponseObserver(): {
|
|
|
215
220
|
};
|
|
216
221
|
}
|
|
217
222
|
|
|
218
|
-
|
|
223
|
+
// `safeOutboundFetch` sends with node:http, not the global fetch, so the
|
|
224
|
+
// pinned-run gateway credential is applied explicitly by the transport owner.
|
|
225
|
+
const safeNodeOutboundFetch = sandboxRuntimeAppFetch((async (
|
|
219
226
|
input: string | URL,
|
|
220
227
|
init?: RequestInit,
|
|
221
|
-
): Promise<Response> {
|
|
228
|
+
): Promise<Response> => {
|
|
222
229
|
const { safeOutboundFetch } = await loadSafeOutboundFetch();
|
|
223
230
|
return safeOutboundFetch(input, init);
|
|
224
|
-
}
|
|
231
|
+
}) as typeof fetch);
|
|
225
232
|
|
|
226
|
-
|
|
233
|
+
const safeNodeStreamingOutboundFetch = sandboxRuntimeAppFetch((async (
|
|
227
234
|
input: string | URL,
|
|
228
235
|
init?: RequestInit,
|
|
229
|
-
): Promise<Response> {
|
|
236
|
+
): Promise<Response> => {
|
|
230
237
|
const { safeOutboundFetch } = await loadSafeOutboundFetch();
|
|
231
238
|
return safeOutboundFetch(input, init, { streamResponseBody: true });
|
|
232
|
-
}
|
|
239
|
+
}) as typeof fetch);
|
|
233
240
|
|
|
234
241
|
import {
|
|
235
242
|
resolveSheetContractForTableNamespace,
|
|
@@ -709,7 +716,7 @@ function createRuntimeToolMetadataResolver(config: PlayRunnerExecutionConfig) {
|
|
|
709
716
|
}
|
|
710
717
|
|
|
711
718
|
const promise = (async () => {
|
|
712
|
-
const url = `${config.context.baseUrl}
|
|
719
|
+
const url = `${config.context.baseUrl}${runtimeToolPath(normalizedToolId, 'metadata')}`;
|
|
713
720
|
const response = await fetchRunnerRuntimeControl({
|
|
714
721
|
url,
|
|
715
722
|
description: `Runtime metadata lookup for tool ${normalizedToolId}`,
|
|
@@ -758,7 +765,7 @@ export function createAppRuntimeToolAuthScopeDigestResolver(
|
|
|
758
765
|
`Runtime auth scope lookup for tool ${normalizedToolId || '<empty>'} requires executorToken and baseUrl.`,
|
|
759
766
|
);
|
|
760
767
|
}
|
|
761
|
-
const url = `${config.context.baseUrl}
|
|
768
|
+
const url = `${config.context.baseUrl}${runtimeToolPath(normalizedToolId, 'auth_scope')}`;
|
|
762
769
|
const response = await fetchRunnerRuntimeControl({
|
|
763
770
|
url,
|
|
764
771
|
description: `Runtime auth scope lookup for tool ${normalizedToolId}`,
|
|
@@ -857,7 +864,7 @@ export function createAppRuntimeToolAuthScopeDigestResolver(
|
|
|
857
864
|
if (!proof) {
|
|
858
865
|
proof = (async () => {
|
|
859
866
|
const response = await fetchRunnerRuntimeControl({
|
|
860
|
-
url: `${executionBase}
|
|
867
|
+
url: `${executionBase}${runtimeToolPath(normalized, 'auth_scope')}`,
|
|
861
868
|
description: `Runtime async recovery capability for tool ${normalized}`,
|
|
862
869
|
retrySafe: true,
|
|
863
870
|
init: {
|
|
@@ -963,7 +970,7 @@ export function createRuntimeEventWaitHandler(
|
|
|
963
970
|
boundary: IntegrationEventWaitBoundary;
|
|
964
971
|
},
|
|
965
972
|
): Promise<IntegrationEventWaitBoundary> {
|
|
966
|
-
const url = `${config.context.baseUrl}
|
|
973
|
+
const url = `${config.context.baseUrl}${runtimeToolPath(normalizedToolId, 'event_wait')}`;
|
|
967
974
|
const response = await fetchRunnerRuntimeControl({
|
|
968
975
|
url,
|
|
969
976
|
description: `Event wait runtime call for tool ${normalizedToolId}`,
|
|
@@ -4125,6 +4132,10 @@ async function main() {
|
|
|
4125
4132
|
? gunzipSync(configBuffer).toString('utf-8')
|
|
4126
4133
|
: configBuffer.toString('utf-8');
|
|
4127
4134
|
const parsedConfig = JSON.parse(configJson) as PlayRunnerExecutionConfig;
|
|
4135
|
+
// Pinned runs only: code-owned requests to the pinned gateway origin and
|
|
4136
|
+
// paths carry the watchdog-renewed OIDC credential. Other targets, signed
|
|
4137
|
+
// object URLs included, are untouched. Unpinned configs install nothing.
|
|
4138
|
+
installSandboxRuntimeAppTransport(parsedConfig.context);
|
|
4128
4139
|
writeRunnerStartupDiagnostic(
|
|
4129
4140
|
process.env.DEEPLINE_PLAY_RUNNER_STARTUP_DIAGNOSTIC_PATH,
|
|
4130
4141
|
{ phase: 'booted' },
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { APP_RUNTIME_COMPAT_PATH } from '../runtime-api-paths';
|
|
1
2
|
import { RUNTIME_CLAIM_HEARTBEAT_DIVISOR } from '../runtime-constants';
|
|
2
3
|
import { PLAY_RUNTIME_TRANSPORT_ATTEMPT_HEADER } from '../runtime-contract';
|
|
3
4
|
import {
|
|
@@ -106,7 +107,6 @@ export interface RunnerHeartbeatLoopHandle {
|
|
|
106
107
|
lastSuccessAtMs: () => number;
|
|
107
108
|
}
|
|
108
109
|
|
|
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.
|