deepline 0.3.519 → 0.3.521
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/plays/client-core.ts +16 -45
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +0 -18
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +0 -155
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +160 -2
- package/dist/bundling-sources/shared_libs/play-runtime/execute-server-timing.ts +22 -0
- package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +24 -0
- package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +1 -54
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +2 -7
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +0 -13
- package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +0 -56
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +10 -21
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +2 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +2 -37
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +3 -74
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-runtime-watchdog.ts +2 -226
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +3 -36
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +0 -26
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +1 -9
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +0 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-environment.ts +9 -49
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-oidc.ts +11 -447
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +5 -4
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +12 -207
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +3 -17
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-progress-registry.ts +0 -9
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +2 -18
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +15 -175
- package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +0 -4
- package/dist/cli/{artifacts-YRKH7KNC.js → artifacts-JGH464N2.js} +20 -20
- package/dist/cli/{artifacts-ZZULJ6X5.mjs → artifacts-TYPU37IU.mjs} +8 -8
- package/dist/cli/auth-JWR3VSNT.js +43 -0
- package/dist/cli/{auth-WU2BDO3T.mjs → auth-XPQT6NUB.mjs} +5 -5
- package/dist/cli/{billing-DG62VVXW.mjs → billing-47AMHOMP.mjs} +8 -8
- package/dist/cli/{billing-MUMMBMQK.js → billing-6D4KXBFJ.js} +81 -81
- package/dist/cli/{chunk-R3OAKFHJ.mjs → chunk-2DQPB5HT.mjs} +5 -5
- package/dist/cli/{chunk-6Y3DDRRN.js → chunk-2KHUFWTK.js} +3 -3
- package/dist/cli/{chunk-XUCAH3LN.js → chunk-3Q7HEEH2.js} +10 -10
- package/dist/cli/{chunk-MI5DKOBD.mjs → chunk-4DB6JV7X.mjs} +2 -2
- package/dist/cli/{chunk-J4X4RNSP.mjs → chunk-4GGXAYKI.mjs} +3 -3
- package/dist/cli/{chunk-AXA5DFY5.mjs → chunk-4I7I5CGB.mjs} +1 -1
- package/dist/cli/{chunk-I3ICKVYH.js → chunk-4MN65FRF.js} +53 -53
- package/dist/cli/{chunk-Y7D6L4M7.mjs → chunk-4MONKWYE.mjs} +5 -5
- package/dist/cli/{chunk-3CUIIVGR.mjs → chunk-5T7QKHQL.mjs} +1 -1
- package/dist/cli/{chunk-UMPHUAGZ.js → chunk-6DCBTJZP.js} +3 -3
- package/dist/cli/{chunk-LKYLIZ5X.js → chunk-6N72GHAV.js} +2 -2
- package/dist/cli/{chunk-RHQKDHCX.mjs → chunk-6UHYXNCP.mjs} +2 -2
- package/dist/cli/{chunk-RU5JRQKJ.mjs → chunk-6V2RI3AL.mjs} +3 -3
- package/dist/cli/{chunk-NIJE62ZD.mjs → chunk-7AUXX6M5.mjs} +1 -1
- package/dist/cli/{chunk-NH22WUUG.mjs → chunk-7IYDCHTG.mjs} +2 -2
- package/dist/cli/{chunk-FEJKDR67.mjs → chunk-7LRALARF.mjs} +1 -1
- package/dist/cli/{chunk-N3LUYBOB.mjs → chunk-A2B5AAU3.mjs} +11 -11
- package/dist/cli/{chunk-CRE3OGHH.mjs → chunk-A6USUS4L.mjs} +2 -2
- package/dist/cli/{chunk-ZQ23WQP3.js → chunk-AMVKLEPH.js} +2 -2
- package/dist/cli/{chunk-RQ2BHYUM.mjs → chunk-CBBCUYIN.mjs} +2 -2
- package/dist/cli/{chunk-CBMTBMIJ.mjs → chunk-DQURY3WH.mjs} +1 -1
- package/dist/cli/{chunk-EMV6EHK2.js → chunk-DY6634MN.js} +14 -14
- package/dist/cli/{chunk-5A2SIIPH.mjs → chunk-E4ZS2B2J.mjs} +1 -1
- package/dist/cli/{chunk-BQYXIAJM.js → chunk-EILHJRPW.js} +3 -3
- package/dist/cli/{chunk-RQDD2VV3.js → chunk-EW3EAEWZ.js} +5 -5
- package/dist/cli/{chunk-A7W3CCU5.mjs → chunk-EZNZDOAG.mjs} +5 -5
- package/dist/cli/{chunk-HT675XNR.mjs → chunk-FKD3KL5Q.mjs} +1 -1
- package/dist/cli/{chunk-FJAGGBDR.mjs → chunk-FQJFONFT.mjs} +59 -90
- package/dist/cli/{chunk-C7ZD4LXZ.js → chunk-FTZX4QZN.js} +2 -2
- package/dist/cli/{chunk-F6XD4CRW.js → chunk-GNYSODBR.js} +1 -1
- package/dist/cli/{chunk-4PWBHYH4.js → chunk-HD3KYCDC.js} +7 -7
- package/dist/cli/{chunk-IMIHYCJ5.mjs → chunk-HHBJJYKL.mjs} +5 -5
- package/dist/cli/{chunk-YRU46P7H.mjs → chunk-HRWVEIAX.mjs} +1 -1
- package/dist/cli/{chunk-TT2XB433.js → chunk-HSFLMTED.js} +4 -4
- package/dist/cli/{chunk-E6YWCXII.js → chunk-JFQJNYTB.js} +16 -16
- package/dist/cli/{chunk-XBS4RDKU.js → chunk-LGU2NIOT.js} +98 -98
- package/dist/cli/{chunk-SBF4K3QF.mjs → chunk-LNBMEFOI.mjs} +4 -4
- package/dist/cli/{chunk-G2QD575P.js → chunk-MD43YAL6.js} +6 -6
- package/dist/cli/{chunk-S7R4O62I.js → chunk-MRU4N33M.js} +6 -6
- package/dist/cli/{chunk-UB2REJPL.mjs → chunk-NNDAVVBG.mjs} +2 -2
- package/dist/cli/{chunk-ORNLTNBN.js → chunk-PUKWFJXW.js} +44 -44
- package/dist/cli/{chunk-O655PVT4.js → chunk-QGTWGHYD.js} +88 -119
- package/dist/cli/{chunk-AL7FDMD6.mjs → chunk-TBIWR7M2.mjs} +1 -1
- package/dist/cli/{chunk-PK6VYYEY.js → chunk-UAZKOH3J.js} +5 -5
- package/dist/cli/{chunk-BMCRTI6Z.mjs → chunk-UBKA33KY.mjs} +1 -22
- package/dist/cli/{chunk-4ECU5DI3.js → chunk-ULW2KBKL.js} +26 -26
- package/dist/cli/{chunk-52DFTRVC.js → chunk-VSH3AE5E.js} +16 -16
- package/dist/cli/{chunk-P62S3ZMS.js → chunk-VYY5V4M5.js} +11 -11
- package/dist/cli/{chunk-HXPHRSNM.js → chunk-WL6WPW6X.js} +14 -14
- package/dist/cli/{chunk-WSGXBROE.js → chunk-XDVT3GOM.js} +1 -22
- package/dist/cli/{chunk-GO467AXG.js → chunk-Y23TOHNV.js} +41 -41
- package/dist/cli/{chunk-FTJ2D3XD.mjs → chunk-Y7IR4LBU.mjs} +3 -3
- package/dist/cli/{chunk-25WXWSFS.js → chunk-YROP3H6T.js} +22 -22
- package/dist/cli/{chunk-HKKC7J6K.mjs → chunk-ZO2XJVFH.mjs} +6 -6
- package/dist/cli/{csv-BKWIYPMK.js → csv-5TM2OSYP.js} +13 -13
- package/dist/cli/{csv-3TUJHAOW.mjs → csv-PM3WDXDF.mjs} +4 -4
- package/dist/cli/{db-EJMJDKDA.js → db-3LJ32FZM.js} +29 -29
- package/dist/cli/{db-I75IQ7XI.mjs → db-5P72NPRL.mjs} +8 -8
- package/dist/cli/describe-GRS3IRSX.js +50 -0
- package/dist/cli/{describe-RUFLLRIN.mjs → describe-ZLCMBGHG.mjs} +20 -20
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/{executions-TQJCMUUG.js → executions-4AJ5TQVY.js} +10 -10
- package/dist/cli/{executions-VW3MYJEE.mjs → executions-JMFL6AV7.mjs} +8 -8
- package/dist/cli/{feedback-76342G7E.mjs → feedback-DKMG2QB7.mjs} +5 -5
- package/dist/cli/{feedback-UFAEXH5B.js → feedback-I2BLXMGH.js} +10 -10
- package/dist/cli/git-2LNT43A2.js +25 -0
- package/dist/cli/{git-L5XKAODI.mjs → git-ARG223MY.mjs} +5 -5
- package/dist/cli/index.js +141 -141
- package/dist/cli/index.mjs +43 -43
- package/dist/cli/{legacy-noops-DKAZ7JG3.mjs → legacy-noops-24LOAOZN.mjs} +6 -6
- package/dist/cli/{legacy-noops-DM66YISP.js → legacy-noops-N7SVA7PL.js} +9 -9
- package/dist/cli/{monitors-QXEJI54B.mjs → monitors-RYQFWM2T.mjs} +9 -9
- package/dist/cli/{monitors-NKDIH4TY.js → monitors-XNCYLOJM.js} +102 -102
- package/dist/cli/{org-NKIIBUNO.js → org-I33TKZXF.js} +74 -74
- package/dist/cli/{org-KZQCVREB.mjs → org-ORIH56E5.mjs} +8 -8
- package/dist/cli/{pages-UJUFCJEL.js → pages-2UXXGIMF.js} +20 -20
- package/dist/cli/{pages-E7IT5SWT.mjs → pages-ME43HSBL.mjs} +8 -8
- package/dist/cli/{play-SPI5MO67.js → play-F4QOFU37.js} +338 -338
- package/dist/cli/{play-AKL5E2DF.mjs → play-XEKNY46M.mjs} +21 -21
- package/dist/cli/{providers-4NVQ3FSC.js → providers-E7DPCBNX.js} +11 -11
- package/dist/cli/{providers-6HSSVI74.mjs → providers-XKU44G74.mjs} +8 -8
- package/dist/cli/{quickstart-FEQD7S4Z.js → quickstart-ICLF2F6A.js} +6 -6
- package/dist/cli/{quickstart-EHLEHSMI.mjs → quickstart-J7NVEXV5.mjs} +4 -4
- package/dist/cli/{run-GH6ECTJF.js → run-HJMHUQBN.js} +43 -43
- package/dist/cli/{run-IWVM7BD6.mjs → run-MQ5ZONGL.mjs} +25 -25
- package/dist/cli/run-identity-G257GQED.js +25 -0
- package/dist/cli/{run-identity-MNRZS2N3.mjs → run-identity-MRNCEGV2.mjs} +3 -9
- package/dist/cli/{search-X4CDMN7J.mjs → search-GGRC77CV.mjs} +10 -10
- package/dist/cli/search-V6IBJ4TX.js +33 -0
- package/dist/cli/{search-output-IIYMGZTQ.js → search-output-MXZTZI2P.js} +6 -6
- package/dist/cli/{search-output-PJ7N5WUQ.mjs → search-output-NY4GDBRU.mjs} +4 -4
- package/dist/cli/{secrets-4YPMC7XZ.mjs → secrets-FA37G4Q2.mjs} +8 -8
- package/dist/cli/{secrets-QPP2FXID.js → secrets-PFESG72B.js} +17 -17
- package/dist/cli/{sessions-BEOI47VZ.mjs → sessions-BLLXPETU.mjs} +6 -6
- package/dist/cli/sessions-DNFTQOQH.js +18 -0
- package/dist/cli/{settings-FZDONKPW.js → settings-32VPG4Z2.js} +88 -88
- package/dist/cli/{settings-VHULXNY3.mjs → settings-U26S7MPH.mjs} +15 -15
- package/dist/cli/{setup-5IV3NHGD.mjs → setup-4AXBCX7C.mjs} +10 -10
- package/dist/cli/{setup-LZ6IN5JS.js → setup-R6NSENH7.js} +50 -50
- package/dist/cli/skills-G4ZE3OS5.js +37 -0
- package/dist/cli/{skills-FZAFBW5J.mjs → skills-JUH7AVUL.mjs} +8 -8
- package/dist/cli/tools-27LHZFJD.js +57 -0
- package/dist/cli/{tools-TLBH3RFK.mjs → tools-FOYLU3FH.mjs} +19 -19
- package/dist/cli/{update-KPLIZYOV.mjs → update-FUVX22VM.mjs} +10 -10
- package/dist/cli/update-KNZ7N242.js +35 -0
- package/dist/cli/{workflow-ACHPT3DD.js → workflow-JACZW4GJ.js} +19 -19
- package/dist/cli/{workflow-GYJOYYWK.mjs → workflow-QLT22BLT.mjs} +9 -9
- package/dist/{client-CswZYCGj.d.ts → client-B-2Am2y6.d.ts} +1 -1
- package/dist/{client-CpSiHSti.d.mts → client-DA71-2_u.d.mts} +1 -1
- package/dist/{client-core-C1xVOg8Y.d.mts → client-core-BXbds1cb.d.mts} +1 -20
- package/dist/{client-core-D2pLt36Q.d.ts → client-core-C0IzDKMJ.d.ts} +1 -20
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +19 -19
- package/dist/index.mjs +8 -8
- package/dist/install-integrity.json +114 -122
- package/dist/plays/play-description.d.mts +1 -1
- package/dist/plays/play-description.d.ts +1 -1
- package/dist/plays/run-request.d.mts +1 -1
- package/dist/plays/run-request.d.ts +1 -1
- package/dist/plays/run-request.js +3 -3
- package/dist/plays/run-request.mjs +2 -2
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +7 -7
- package/dist/server.mjs +5 -5
- package/package.json +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-app-transport.ts +0 -374
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-egress.ts +0 -55
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-profile.ts +0 -329
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-sandbox-credential.ts +0 -338
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-staging.ts +0 -417
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-attempt.ts +0 -81
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-staging-journal.ts +0 -708
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-staging-teardown.ts +0 -160
- package/dist/cli/auth-DF6WJLN2.js +0 -43
- package/dist/cli/describe-EAK3MPTG.js +0 -50
- package/dist/cli/git-OOCPCIGZ.js +0 -25
- package/dist/cli/run-identity-HFYABUJS.js +0 -31
- package/dist/cli/search-NIRYA3VL.js +0 -33
- package/dist/cli/sessions-5I2IFTW7.js +0 -18
- package/dist/cli/skills-WJWLFSHI.js +0 -37
- package/dist/cli/tools-SH35NRGU.js +0 -57
- package/dist/cli/update-MA46YSGR.js +0 -35
|
@@ -35,7 +35,6 @@ 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';
|
|
39
38
|
import { decodePlayRunPublicStatus } from '../../../shared_libs/play-runtime/run-lifecycle-policy.js';
|
|
40
39
|
|
|
41
40
|
export function normalizePlayRunIntegrationMode(
|
|
@@ -83,14 +82,17 @@ function resolvePlayRunRuntimeSelection(
|
|
|
83
82
|
const configuredToken = env.DEEPLINE_RUNTIME_ENVIRONMENT_TOKEN?.trim();
|
|
84
83
|
const configuredPlacementPolicy =
|
|
85
84
|
env.DEEPLINE_RUNTIME_SANDBOX_PLACEMENT_POLICY?.trim();
|
|
86
|
-
|
|
85
|
+
if (env.DEEPLINE_RUNTIME_GATEWAY_PROFILE?.trim()) {
|
|
86
|
+
// The vercel_app@1 gateway profile was removed. Refuse rather than run on
|
|
87
|
+
// the default gateways while the caller believes a profile applies.
|
|
88
|
+
throw new DeeplineError(
|
|
89
|
+
'DEEPLINE_RUNTIME_GATEWAY_PROFILE was removed: Runtime gateway profiles (vercel_app@1) are no longer available. Unset it to run on the default gateways.',
|
|
90
|
+
undefined,
|
|
91
|
+
'RUNTIME_GATEWAY_PROFILE_REMOVED',
|
|
92
|
+
);
|
|
93
|
+
}
|
|
87
94
|
if (!configured) {
|
|
88
|
-
if (
|
|
89
|
-
configuredNamespace ||
|
|
90
|
-
configuredToken ||
|
|
91
|
-
configuredPlacementPolicy ||
|
|
92
|
-
configuredGatewayProfile
|
|
93
|
-
) {
|
|
95
|
+
if (configuredNamespace || configuredToken || configuredPlacementPolicy) {
|
|
94
96
|
// Name the variables that are actually set. This branch is almost always
|
|
95
97
|
// hit by a stale value auto-loaded from a .env/.env.local rather than by
|
|
96
98
|
// a deliberate export, so the message has to say where to look and how
|
|
@@ -101,9 +103,6 @@ function resolvePlayRunRuntimeSelection(
|
|
|
101
103
|
if (configuredPlacementPolicy) {
|
|
102
104
|
present.push('DEEPLINE_RUNTIME_SANDBOX_PLACEMENT_POLICY');
|
|
103
105
|
}
|
|
104
|
-
if (configuredGatewayProfile) {
|
|
105
|
-
present.push('DEEPLINE_RUNTIME_GATEWAY_PROFILE');
|
|
106
|
-
}
|
|
107
106
|
const isPlural = present.length > 1;
|
|
108
107
|
throw new DeeplineError(
|
|
109
108
|
[
|
|
@@ -118,47 +117,20 @@ function resolvePlayRunRuntimeSelection(
|
|
|
118
117
|
}
|
|
119
118
|
return undefined;
|
|
120
119
|
}
|
|
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
|
-
: {};
|
|
136
120
|
if (configured === 'native') {
|
|
137
121
|
// The app's own runtime on a named placement policy. The server decides
|
|
138
122
|
// from the API key's account whether this caller may ask for it.
|
|
139
|
-
const sandboxPlacementPolicy =
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (
|
|
143
|
-
configuredNamespace ||
|
|
144
|
-
(configuredPlacementPolicy && !sandboxPlacementPolicy) ||
|
|
145
|
-
(!sandboxPlacementPolicy && !selectedGatewayProfile)
|
|
146
|
-
) {
|
|
123
|
+
const sandboxPlacementPolicy = normalizePlayRuntimeSandboxPlacementPolicy(
|
|
124
|
+
configuredPlacementPolicy,
|
|
125
|
+
);
|
|
126
|
+
if (configuredNamespace || !sandboxPlacementPolicy) {
|
|
147
127
|
throw new DeeplineError(
|
|
148
|
-
'DEEPLINE_RUNTIME_ENVIRONMENT=native requires DEEPLINE_RUNTIME_SANDBOX_PLACEMENT_POLICY (such as modal_only@1) and
|
|
128
|
+
'DEEPLINE_RUNTIME_ENVIRONMENT=native requires DEEPLINE_RUNTIME_SANDBOX_PLACEMENT_POLICY (such as modal_only@1) and no DEEPLINE_RUNTIME_NAMESPACE.',
|
|
149
129
|
undefined,
|
|
150
130
|
'INVALID_RUNTIME_ENVIRONMENT',
|
|
151
131
|
);
|
|
152
132
|
}
|
|
153
|
-
|
|
154
|
-
if (sandboxPlacementPolicy) {
|
|
155
|
-
return {
|
|
156
|
-
environment: 'native',
|
|
157
|
-
sandboxPlacementPolicy,
|
|
158
|
-
...gatewayProfile,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
return { environment: 'native', gatewayProfile: selectedGatewayProfile! };
|
|
133
|
+
return { environment: 'native', sandboxPlacementPolicy };
|
|
162
134
|
}
|
|
163
135
|
const environment = normalizePlayRuntimeEnvironment(configured);
|
|
164
136
|
if (!environment) {
|
|
@@ -205,7 +177,6 @@ function resolvePlayRunRuntimeSelection(
|
|
|
205
177
|
...(configuredPlacementPolicy
|
|
206
178
|
? { sandboxPlacementPolicy: configuredPlacementPolicy }
|
|
207
179
|
: {}),
|
|
208
|
-
...gatewayProfile,
|
|
209
180
|
};
|
|
210
181
|
}
|
|
211
182
|
|
|
@@ -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.521',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -928,24 +928,6 @@
|
|
|
928
928
|
"failureAlert": "vercel_route_wrapper",
|
|
929
929
|
"domainReportRequired": true
|
|
930
930
|
},
|
|
931
|
-
{
|
|
932
|
-
"id": "vercel.runtime-gateway-staging-retirement",
|
|
933
|
-
"name": "Runtime gateway staged-body retirement",
|
|
934
|
-
"scheduler": "vercel_cron",
|
|
935
|
-
"cadence": "7,22,37,52 * * * *",
|
|
936
|
-
"timezone": "UTC",
|
|
937
|
-
"source": "apps/deepline-api/vercel.json",
|
|
938
|
-
"locator": "/api/v2/cron/runtime-gateway-staging-retirement",
|
|
939
|
-
"owner": "runtime",
|
|
940
|
-
"criticality": "maintenance",
|
|
941
|
-
"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.",
|
|
942
|
-
"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.",
|
|
943
|
-
"failureDefinition": "A schema's journal probe, claim or prune fails, or target discovery fails, leaving due staged bodies unretired.",
|
|
944
|
-
"startGraceMs": 300000,
|
|
945
|
-
"runTimeoutMs": 300000,
|
|
946
|
-
"failureAlert": "vercel_route_wrapper",
|
|
947
|
-
"domainReportRequired": true
|
|
948
|
-
},
|
|
949
931
|
{
|
|
950
932
|
"id": "vercel.scheduled-work-health-snapshot",
|
|
951
933
|
"name": "Scheduled-work health snapshot",
|
|
@@ -79,18 +79,6 @@ 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
|
-
|
|
94
82
|
export function getR2Config(kind: R2BucketKind = 'default') {
|
|
95
83
|
return {
|
|
96
84
|
endpoint: requireEnv('CLOUDFLARE_R2_ENDPOINT'),
|
|
@@ -203,14 +191,12 @@ export async function r2ObjectExists(
|
|
|
203
191
|
export async function confirmR2ObjectAbsent(
|
|
204
192
|
key: string,
|
|
205
193
|
kind: R2BucketKind = 'default',
|
|
206
|
-
options?: { abortSignal?: AbortSignal },
|
|
207
194
|
): Promise<boolean> {
|
|
208
195
|
const config = getR2Config(kind);
|
|
209
196
|
const client = getR2Client(config);
|
|
210
197
|
try {
|
|
211
198
|
await client.send(
|
|
212
199
|
new HeadObjectCommand({ Bucket: config.bucket, Key: key }),
|
|
213
|
-
{ abortSignal: options?.abortSignal },
|
|
214
200
|
);
|
|
215
201
|
return false;
|
|
216
202
|
} catch (error) {
|
|
@@ -326,7 +312,6 @@ export async function listR2Keys(
|
|
|
326
312
|
export async function deleteR2Object(
|
|
327
313
|
key: string,
|
|
328
314
|
kind: R2BucketKind = 'default',
|
|
329
|
-
options?: { abortSignal?: AbortSignal },
|
|
330
315
|
): Promise<void> {
|
|
331
316
|
const startedAt = Date.now();
|
|
332
317
|
const config = getR2Config(kind);
|
|
@@ -336,7 +321,6 @@ export async function deleteR2Object(
|
|
|
336
321
|
Bucket: config.bucket,
|
|
337
322
|
Key: key,
|
|
338
323
|
}),
|
|
339
|
-
{ abortSignal: options?.abortSignal },
|
|
340
324
|
);
|
|
341
325
|
logR2Perf('delete', key, startedAt, { kind });
|
|
342
326
|
}
|
|
@@ -408,142 +392,3 @@ export async function createSignedR2WriteUrl(input: {
|
|
|
408
392
|
expiresAt: new Date(Date.now() + expiresInSeconds * 1000).toISOString(),
|
|
409
393
|
};
|
|
410
394
|
}
|
|
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
|
-
}
|
|
@@ -692,6 +692,127 @@ const authoredStepContext = new AsyncLocalStorage<{
|
|
|
692
692
|
invocationId?: string;
|
|
693
693
|
}>();
|
|
694
694
|
const toolExecutionOverrides = new AsyncLocalStorage<{ force: boolean }>();
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Diagnostic split of one direct tool call, recorded only in the existing
|
|
698
|
+
* `DEEPLINE_RUNTIME_RECEIPT_TRACE=1` mode. It observes wall clocks around
|
|
699
|
+
* awaits that already happen; it never changes what is awaited or in which
|
|
700
|
+
* order. Receipt and admission times are summed over possibly overlapping
|
|
701
|
+
* calls, so they are labelled `_summed` and are not subtracted blindly.
|
|
702
|
+
*/
|
|
703
|
+
type ToolCallPhaseClock = {
|
|
704
|
+
startedAt: number;
|
|
705
|
+
firstDispatchAt: number | null;
|
|
706
|
+
lastResponseParsedAt: number | null;
|
|
707
|
+
providerDispatches: number;
|
|
708
|
+
receiptCallsBeforeDispatch: number;
|
|
709
|
+
receiptMsBeforeDispatch: number;
|
|
710
|
+
receiptCallsAfterResponse: number;
|
|
711
|
+
receiptMsAfterResponse: number;
|
|
712
|
+
budgetChargeMs: number;
|
|
713
|
+
providerPermitMs: number;
|
|
714
|
+
};
|
|
715
|
+
const toolCallPhaseClock = new AsyncLocalStorage<ToolCallPhaseClock>();
|
|
716
|
+
|
|
717
|
+
function newToolCallPhaseClock(): ToolCallPhaseClock {
|
|
718
|
+
return {
|
|
719
|
+
startedAt: performance.now(),
|
|
720
|
+
firstDispatchAt: null,
|
|
721
|
+
lastResponseParsedAt: null,
|
|
722
|
+
providerDispatches: 0,
|
|
723
|
+
receiptCallsBeforeDispatch: 0,
|
|
724
|
+
receiptMsBeforeDispatch: 0,
|
|
725
|
+
receiptCallsAfterResponse: 0,
|
|
726
|
+
receiptMsAfterResponse: 0,
|
|
727
|
+
budgetChargeMs: 0,
|
|
728
|
+
providerPermitMs: 0,
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
function recordToolCallReceiptWall(startedAt: number): void {
|
|
733
|
+
const clock = toolCallPhaseClock.getStore();
|
|
734
|
+
if (!clock) return;
|
|
735
|
+
const elapsed = performance.now() - startedAt;
|
|
736
|
+
if (clock.firstDispatchAt === null) {
|
|
737
|
+
clock.receiptCallsBeforeDispatch += 1;
|
|
738
|
+
clock.receiptMsBeforeDispatch += elapsed;
|
|
739
|
+
} else if (clock.lastResponseParsedAt !== null) {
|
|
740
|
+
clock.receiptCallsAfterResponse += 1;
|
|
741
|
+
clock.receiptMsAfterResponse += elapsed;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
const TRACED_RECEIPT_HANDLERS = [
|
|
746
|
+
'getRuntimeStepReceipt',
|
|
747
|
+
'getRuntimeStepReceipts',
|
|
748
|
+
'claimRuntimeStepReceipt',
|
|
749
|
+
'claimRuntimeStepReceipts',
|
|
750
|
+
'markRuntimeStepReceiptRunning',
|
|
751
|
+
'markRuntimeStepReceiptsRunning',
|
|
752
|
+
'completeRuntimeStepReceipt',
|
|
753
|
+
'completeRuntimeStepReceipts',
|
|
754
|
+
'completeRuntimeStepReceiptsByReference',
|
|
755
|
+
'publishLatestCacheResult',
|
|
756
|
+
'acquireRuntimeReceiptExecutionLock',
|
|
757
|
+
'releaseRuntimeReceiptExecutionLock',
|
|
758
|
+
] as const satisfies ReadonlyArray<keyof ContextOptions>;
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* Time each receipt handler call into the calling tool call's clock. A handler
|
|
762
|
+
* keeps its exact return value (sync or promise) and its errors; only a
|
|
763
|
+
* settlement callback is attached.
|
|
764
|
+
*/
|
|
765
|
+
function traceReceiptHandlers(options: ContextOptions): ContextOptions {
|
|
766
|
+
const traced: Record<string, unknown> = { ...options };
|
|
767
|
+
for (const name of TRACED_RECEIPT_HANDLERS) {
|
|
768
|
+
const handler = options[name] as
|
|
769
|
+
| ((...args: unknown[]) => unknown)
|
|
770
|
+
| undefined;
|
|
771
|
+
if (typeof handler !== 'function') continue;
|
|
772
|
+
traced[name] = (...args: unknown[]) => {
|
|
773
|
+
const startedAt = performance.now();
|
|
774
|
+
// Keep the receiver: a handler may be a method of its options object.
|
|
775
|
+
const result = handler.apply(options, args);
|
|
776
|
+
if (
|
|
777
|
+
result !== null &&
|
|
778
|
+
typeof result === 'object' &&
|
|
779
|
+
typeof (result as PromiseLike<unknown>).then === 'function'
|
|
780
|
+
) {
|
|
781
|
+
void Promise.resolve(result).then(
|
|
782
|
+
() => recordToolCallReceiptWall(startedAt),
|
|
783
|
+
() => recordToolCallReceiptWall(startedAt),
|
|
784
|
+
);
|
|
785
|
+
} else {
|
|
786
|
+
recordToolCallReceiptWall(startedAt);
|
|
787
|
+
}
|
|
788
|
+
return result;
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
return traced as ContextOptions;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
function formatToolCallPhaseSplit(
|
|
795
|
+
toolId: string,
|
|
796
|
+
clock: ToolCallPhaseClock,
|
|
797
|
+
): string | null {
|
|
798
|
+
if (clock.firstDispatchAt === null || clock.lastResponseParsedAt === null)
|
|
799
|
+
return null;
|
|
800
|
+
const now = performance.now();
|
|
801
|
+
const ms = (value: number) => Math.max(0, Math.round(value));
|
|
802
|
+
return (
|
|
803
|
+
`[perf] tool call id=${toolId} phase=call_split ` +
|
|
804
|
+
`total_ms=${ms(now - clock.startedAt)} ` +
|
|
805
|
+
`pre_dispatch_ms=${ms(clock.firstDispatchAt - clock.startedAt)} ` +
|
|
806
|
+
`post_response_ms=${ms(now - clock.lastResponseParsedAt)} ` +
|
|
807
|
+
`provider_dispatches=${clock.providerDispatches} ` +
|
|
808
|
+
`receipt_calls_pre=${clock.receiptCallsBeforeDispatch} ` +
|
|
809
|
+
`receipt_ms_pre_summed=${ms(clock.receiptMsBeforeDispatch)} ` +
|
|
810
|
+
`receipt_calls_post=${clock.receiptCallsAfterResponse} ` +
|
|
811
|
+
`receipt_ms_post_summed=${ms(clock.receiptMsAfterResponse)} ` +
|
|
812
|
+
`budget_charge_ms=${ms(clock.budgetChargeMs)} ` +
|
|
813
|
+
`provider_permit_ms_summed=${ms(clock.providerPermitMs)}`
|
|
814
|
+
);
|
|
815
|
+
}
|
|
695
816
|
const PROGRESS_HEARTBEAT_INTERVAL_MS = 1_000;
|
|
696
817
|
|
|
697
818
|
const PURE_JS_HEARTBEAT_ROW_INTERVAL = 250;
|
|
@@ -2919,6 +3040,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
2919
3040
|
{ resolve: (value: unknown) => void; reject: (reason: unknown) => void }
|
|
2920
3041
|
>();
|
|
2921
3042
|
#options: ContextOptions;
|
|
3043
|
+
/** Per-call phase split under the existing receipt trace mode. */
|
|
3044
|
+
#callSplitTrace = false;
|
|
2922
3045
|
private readonly rootRuntimeContract: PlayArtifactRuntimeContract;
|
|
2923
3046
|
private readonly datasetRowInputs = new DatasetRowInputView();
|
|
2924
3047
|
private readonly executionScope: RunExecutionScope;
|
|
@@ -3572,7 +3695,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
3572
3695
|
...options,
|
|
3573
3696
|
fixtureBehavior: fixtureBehavior.behavior,
|
|
3574
3697
|
};
|
|
3575
|
-
this.#
|
|
3698
|
+
this.#callSplitTrace = process.env.DEEPLINE_RUNTIME_RECEIPT_TRACE === '1';
|
|
3699
|
+
this.#options = this.#callSplitTrace
|
|
3700
|
+
? traceReceiptHandlers(options)
|
|
3701
|
+
: options;
|
|
3576
3702
|
this.checkpoint = options.checkpoint ?? emptyCheckpoint();
|
|
3577
3703
|
this.mapFrames = new MapExecutionFrameStore(this.checkpoint, (event) =>
|
|
3578
3704
|
this.emitExecutionEvent(event),
|
|
@@ -14456,8 +14582,16 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
14456
14582
|
tool: toolId,
|
|
14457
14583
|
};
|
|
14458
14584
|
let result: unknown;
|
|
14585
|
+
// Direct calls only: a dataset row's calls can share dispatch groups, so
|
|
14586
|
+
// an async-context clock would not belong to one call.
|
|
14587
|
+
const phaseClock =
|
|
14588
|
+
this.#callSplitTrace && !row ? newToolCallPhaseClock() : null;
|
|
14459
14589
|
try {
|
|
14460
|
-
result =
|
|
14590
|
+
result = phaseClock
|
|
14591
|
+
? await toolCallPhaseClock.run(phaseClock, () =>
|
|
14592
|
+
this.executeToolInternal(key, toolId, input, options),
|
|
14593
|
+
)
|
|
14594
|
+
: await this.executeToolInternal(key, toolId, input, options);
|
|
14461
14595
|
} catch (error) {
|
|
14462
14596
|
// Parking is control flow, not a failed tool execution.
|
|
14463
14597
|
if (
|
|
@@ -14510,6 +14644,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
14510
14644
|
duration_ms: Math.max(0, Date.now() - startedAt),
|
|
14511
14645
|
}),
|
|
14512
14646
|
);
|
|
14647
|
+
const split = phaseClock
|
|
14648
|
+
? formatToolCallPhaseSplit(toolId, phaseClock)
|
|
14649
|
+
: null;
|
|
14650
|
+
if (split) this.runtimeLog(split);
|
|
14513
14651
|
return result;
|
|
14514
14652
|
}
|
|
14515
14653
|
|
|
@@ -20997,6 +21135,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
20997
21135
|
const acquireProviderPermit = async (signal?: AbortSignal) => {
|
|
20998
21136
|
options?.onProviderAdmissionPending?.();
|
|
20999
21137
|
logProvider429RetryPhase('provider_permit_wait_started');
|
|
21138
|
+
const permitStartedAt = performance.now();
|
|
21000
21139
|
const permit = await this.resourceGovernor.acquireProviderPermit({
|
|
21001
21140
|
toolId,
|
|
21002
21141
|
signal,
|
|
@@ -21010,6 +21149,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21010
21149
|
providerPacingGrant = permit.pacingGrant ?? null;
|
|
21011
21150
|
providerGatewayDispatchProof = permit.gatewayDispatchProof ?? null;
|
|
21012
21151
|
providerTelemetryKey = permit.provider;
|
|
21152
|
+
const phaseClock = toolCallPhaseClock.getStore();
|
|
21153
|
+
if (phaseClock)
|
|
21154
|
+
phaseClock.providerPermitMs +=
|
|
21155
|
+
performance.now() - permitStartedAt;
|
|
21013
21156
|
logProvider429RetryPhase('provider_permit_acquired');
|
|
21014
21157
|
return permit;
|
|
21015
21158
|
};
|
|
@@ -21018,7 +21161,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21018
21161
|
// transport loop. A budget breach is a run-control outcome, never a
|
|
21019
21162
|
// transport failure that may be retried or row-isolated.
|
|
21020
21163
|
if (!toolCallCharged) {
|
|
21164
|
+
const budgetStartedAt = performance.now();
|
|
21021
21165
|
await this.resourceGovernor.chargeToolCall();
|
|
21166
|
+
const phaseClock = toolCallPhaseClock.getStore();
|
|
21167
|
+
if (phaseClock)
|
|
21168
|
+
phaseClock.budgetChargeMs += performance.now() - budgetStartedAt;
|
|
21022
21169
|
toolCallCharged = true;
|
|
21023
21170
|
}
|
|
21024
21171
|
|
|
@@ -21409,6 +21556,14 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21409
21556
|
true;
|
|
21410
21557
|
if (!dispatchedWithProviderPermit)
|
|
21411
21558
|
recordProviderDispatch();
|
|
21559
|
+
const dispatchPhaseClock =
|
|
21560
|
+
toolCallPhaseClock.getStore();
|
|
21561
|
+
if (dispatchPhaseClock) {
|
|
21562
|
+
dispatchPhaseClock.firstDispatchAt ??=
|
|
21563
|
+
performance.now();
|
|
21564
|
+
dispatchPhaseClock.providerDispatches += 1;
|
|
21565
|
+
dispatchPhaseClock.lastResponseParsedAt = null;
|
|
21566
|
+
}
|
|
21412
21567
|
const dispatchedResponse = await fetch(
|
|
21413
21568
|
dispatchedWithProviderPermit
|
|
21414
21569
|
? `${url}${TOOL_EXECUTE_PROVIDER_PERMIT_PATH_SUFFIX}`
|
|
@@ -21721,6 +21876,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21721
21876
|
}
|
|
21722
21877
|
activeProviderRequest?.release();
|
|
21723
21878
|
activeProviderRequest = null;
|
|
21879
|
+
if (dispatchPhaseClock)
|
|
21880
|
+
dispatchPhaseClock.lastResponseParsedAt =
|
|
21881
|
+
performance.now();
|
|
21724
21882
|
return {
|
|
21725
21883
|
response: dispatchedResponse,
|
|
21726
21884
|
responseData: dispatchedResponseData,
|
|
@@ -52,6 +52,19 @@ export const EXECUTE_SERVER_TIMING_STAGES = [
|
|
|
52
52
|
'execute',
|
|
53
53
|
'identity',
|
|
54
54
|
'usage_schedule',
|
|
55
|
+
// Handler slices that previously had no stage of their own. Each is a
|
|
56
|
+
// disjoint wall inside `total`; none overlaps the stages above.
|
|
57
|
+
// - `request_parse` body read/JSON parse, actor and route params, and the
|
|
58
|
+
// gateway attestation HMAC checks, after `auth`
|
|
59
|
+
// - `entitlements` tool entitlement read (only tools with tool limits)
|
|
60
|
+
// - `response_build` success-path async metadata, managed-create metadata
|
|
61
|
+
// and response serialization, after billing settlement
|
|
62
|
+
// - `call_evidence` runner calls only: clone, parse and re-serialize the
|
|
63
|
+
// response to attach provider call evidence
|
|
64
|
+
'request_parse',
|
|
65
|
+
'entitlements',
|
|
66
|
+
'response_build',
|
|
67
|
+
'call_evidence',
|
|
55
68
|
// Managed AI inference slices: `ai_prepare` includes request preparation and
|
|
56
69
|
// contains `ai_billing_authorize`; `ai_provider_work_start` is the durable
|
|
57
70
|
// pre-call transition; `ai_gateway_first_output` is the time to the first
|
|
@@ -92,6 +105,15 @@ export const EXECUTE_SERVER_TIMING_STAGES = [
|
|
|
92
105
|
'body_parse',
|
|
93
106
|
'dispatch_pool',
|
|
94
107
|
'dispatch_callback',
|
|
108
|
+
// Relay pre-dispatch slices: upstream admission queueing, the
|
|
109
|
+
// retired-attempt fence (a refresh can wait up to 250 ms), and gateway-side
|
|
110
|
+
// provider permit validation. The relay appends them only when the request
|
|
111
|
+
// took that step. Like the relay stages above, the app handler's own header
|
|
112
|
+
// lists every stage at zero, and the later relay entry wins for a reader, so
|
|
113
|
+
// a zero here can also mean the relay did not take the step.
|
|
114
|
+
'relay_admission',
|
|
115
|
+
'attempt_fence',
|
|
116
|
+
'permit_validate',
|
|
95
117
|
// The execution relay measures its own upstream fetch. `upstream_headers`
|
|
96
118
|
// contains the app handler's `total`; subtracting those two clocks leaves
|
|
97
119
|
// only the Vercel/platform-or-transit boundary, never a made-up provider
|
|
@@ -798,6 +798,30 @@ export type FixtureExecuteBoundaryCounts = {
|
|
|
798
798
|
unprovenResponses: number;
|
|
799
799
|
};
|
|
800
800
|
|
|
801
|
+
/** Test-only terminal HTTP evidence; identities are full scoped SHA-256 digests. */
|
|
802
|
+
export type FixtureBoundaryCompletion = {
|
|
803
|
+
kind: 'fixture_boundary_completion';
|
|
804
|
+
orgId: string;
|
|
805
|
+
runId: string;
|
|
806
|
+
logicalCallSha256: string | null;
|
|
807
|
+
outcome:
|
|
808
|
+
| 'success'
|
|
809
|
+
| 'other_success'
|
|
810
|
+
| 'released_refusal'
|
|
811
|
+
| 'failure'
|
|
812
|
+
| 'expected_failure'
|
|
813
|
+
| 'unproven';
|
|
814
|
+
};
|
|
815
|
+
|
|
816
|
+
/** Every finished counter ordinal has exactly one detail, written atomically. */
|
|
817
|
+
export function fixtureBoundaryCompletionPrefix(input: {
|
|
818
|
+
orgId: string;
|
|
819
|
+
runId: string;
|
|
820
|
+
shard: number;
|
|
821
|
+
}): string {
|
|
822
|
+
return `${fixtureRunCallCounterKey({ ...input, kind: 'boundary_finished' })}:completion:`;
|
|
823
|
+
}
|
|
824
|
+
|
|
801
825
|
/** Fixture-only evidence; no provider payload, identity, or resource path. */
|
|
802
826
|
export type FixtureReplaySelectionWitness = {
|
|
803
827
|
kind: 'retained_response' | 'synthetic_fallback' | 'unproven';
|