deepline 0.3.582 → 0.4.0
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/client-core.ts +79 -36
- package/dist/bundling-sources/sdk/src/index.ts +2 -0
- package/dist/bundling-sources/sdk/src/release.ts +7 -3
- package/dist/bundling-sources/sdk/src/types.ts +37 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +22 -3
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +94 -5
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +66 -12
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-topology.ts +6 -1
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-tuple-recovery.ts +9 -3
- package/dist/bundling-sources/shared_libs/play-runtime/docflow-node-io.ts +86 -20
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +17 -6
- package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +22 -6
- package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +14 -0
- package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +54 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/postgres-adapter.ts +2 -1
- package/dist/bundling-sources/shared_libs/play-runtime/row-failure-summary.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +4 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +62 -6
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +14 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +197 -19
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-writer.ts +25 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +140 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-wake-policy.ts +419 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +47 -4
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +24 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +36 -19
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +380 -51
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +21 -10
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +32 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +6 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/api-client.ts +3 -1
- package/dist/bundling-sources/shared_libs/plays/deploy/run-deployment.ts +34 -4
- package/dist/bundling-sources/shared_libs/plays/docflow-recording-lint.ts +512 -0
- package/dist/bundling-sources/shared_libs/plays/docflow-requirement.ts +346 -0
- package/dist/bundling-sources/shared_libs/plays/docflow-rule-codes.ts +38 -0
- package/dist/bundling-sources/shared_libs/plays/docflow-unreached-reason.ts +42 -2
- package/dist/bundling-sources/shared_libs/plays/docflow.ts +223 -32
- package/dist/bundling-sources/shared_libs/plays/play-check-compact.ts +14 -1
- package/dist/bundling-sources/shared_libs/plays/run-result.ts +35 -0
- package/dist/cli/{agents-UAXDG4FS.mjs → agents-AHXB7N7Y.mjs} +68 -4
- package/dist/cli/{agents-2L73CJHH.js → agents-KBZ7OUZS.js} +95 -31
- package/dist/cli/{auth-3B2QB4UH.mjs → auth-3CACO52T.mjs} +5 -5
- package/dist/cli/auth-UOHCO5K6.js +44 -0
- package/dist/cli/{billing-E7FO622G.js → billing-5KXPGKMO.js} +105 -105
- package/dist/cli/{billing-CPBRWG3M.mjs → billing-TSTK63NB.mjs} +9 -9
- package/dist/cli/{chunk-3DVWSTAI.mjs → chunk-2GWKBQJZ.mjs} +1 -1
- package/dist/cli/{chunk-PNQVB4UD.mjs → chunk-3DJMPID5.mjs} +11 -11
- package/dist/cli/{chunk-FBSPHBAF.js → chunk-3ET6NRXP.js} +7 -3
- package/dist/cli/{chunk-NZR5PBNP.mjs → chunk-3MWTAM3F.mjs} +3 -3
- package/dist/cli/{chunk-ROUNT4NX.mjs → chunk-4ANDW2OT.mjs} +1 -1
- package/dist/cli/{chunk-ZH23XGJO.js → chunk-4BSCSQ6I.js} +4 -4
- package/dist/cli/{chunk-7QX5PCHP.mjs → chunk-4UEXAMDU.mjs} +2 -2
- package/dist/cli/{chunk-3EOET5UB.js → chunk-5XGLDVSD.js} +100 -100
- package/dist/cli/{chunk-MRSYC74T.js → chunk-7XXJJVSI.js} +5 -5
- package/dist/cli/{chunk-NJGXYYHN.js → chunk-7ZCD7OPO.js} +5 -5
- package/dist/cli/{chunk-JF4DUC2F.mjs → chunk-AJJSKKH4.mjs} +2 -2
- package/dist/cli/{chunk-XYQMOXP4.mjs → chunk-BHF5UW34.mjs} +1 -1
- package/dist/cli/{chunk-POYADK77.js → chunk-BO2TXH5Y.js} +20 -20
- package/dist/cli/{chunk-RNZXMOA6.mjs → chunk-BUC2TNF2.mjs} +2 -2
- package/dist/cli/{chunk-EGH4JNJP.js → chunk-BUUAFSSN.js} +68 -50
- package/dist/cli/{chunk-GZBXN56A.js → chunk-C45E47KC.js} +23 -23
- package/dist/cli/{chunk-HP6A3JCX.js → chunk-D4R3AL4F.js} +5 -5
- package/dist/cli/{chunk-ABJZQHON.mjs → chunk-DAZRIAXW.mjs} +4 -4
- package/dist/cli/{chunk-SKKRESFB.js → chunk-DNOZQGJF.js} +3 -3
- package/dist/cli/{chunk-DPLYQITT.js → chunk-DUL6UQ2T.js} +2 -2
- package/dist/cli/{chunk-U2QQQNWW.mjs → chunk-ES3S6UXR.mjs} +2 -2
- package/dist/cli/{chunk-4TTEAUZV.mjs → chunk-FDAYUP3M.mjs} +3 -3
- package/dist/cli/{chunk-V54YQHPV.js → chunk-FEVUIT2U.js} +6 -6
- package/dist/cli/{chunk-KDITCSPN.mjs → chunk-FSPEUU3V.mjs} +68 -6
- package/dist/cli/{chunk-OUFOJTEJ.mjs → chunk-FZZMCVOS.mjs} +5 -5
- package/dist/cli/{chunk-ISN4F6AY.js → chunk-GHOB72U6.js} +13 -13
- package/dist/cli/{chunk-LHA45DNY.mjs → chunk-GLYWRTEL.mjs} +3 -3
- package/dist/cli/{chunk-LDMCTV2Z.mjs → chunk-HNTIGYRT.mjs} +1 -1
- package/dist/cli/{chunk-EB2YLLZJ.js → chunk-IGPHYKEJ.js} +41 -41
- package/dist/cli/{chunk-VA35T3AF.js → chunk-ISSYN3DJ.js} +20 -20
- package/dist/cli/{chunk-DSHIB2XQ.mjs → chunk-JKQPITEE.mjs} +54 -36
- package/dist/cli/{chunk-ZARGHLZZ.mjs → chunk-KMLACXI2.mjs} +7 -3
- package/dist/cli/{chunk-DI5MULNX.js → chunk-KQXACHYA.js} +26 -26
- package/dist/cli/{chunk-CPZL6Z7D.js → chunk-LW2GKYZW.js} +2 -2
- package/dist/cli/{chunk-G5YU6RJ4.mjs → chunk-O2KSPI2M.mjs} +2 -2
- package/dist/cli/{chunk-H3KVMALU.js → chunk-O6GT6JD7.js} +9 -9
- package/dist/cli/{chunk-4ZAWRCB6.mjs → chunk-OCXWUWUI.mjs} +5 -5
- package/dist/cli/{chunk-YPP436NM.js → chunk-QKRDAJ3T.js} +53 -53
- package/dist/cli/{chunk-KQEW3EAU.js → chunk-QQESWF6D.js} +16 -16
- package/dist/cli/{chunk-CYZSHD66.js → chunk-REX5SUYU.js} +2 -2
- package/dist/cli/{chunk-Z3IAEHID.js → chunk-RXIQWG2N.js} +48 -48
- package/dist/cli/{chunk-5436ZJPH.js → chunk-S33BN7GZ.js} +3 -3
- package/dist/cli/{chunk-JD7P73ZW.mjs → chunk-SGRJJLNV.mjs} +1 -1
- package/dist/cli/{chunk-2K6EIL2D.mjs → chunk-TCNYSNVU.mjs} +1 -1
- package/dist/cli/{chunk-I5J6HGVR.mjs → chunk-TFPMVSGK.mjs} +2 -2
- package/dist/cli/{chunk-6NEMTKTA.mjs → chunk-V73WDQEA.mjs} +5 -5
- package/dist/cli/{chunk-Y36SQMSN.js → chunk-VYERVFGB.js} +68 -6
- package/dist/cli/{chunk-SYWLWTWM.mjs → chunk-WBRSVML3.mjs} +4 -4
- package/dist/cli/{chunk-NVHICORD.mjs → chunk-WW52ANX4.mjs} +2 -2
- package/dist/cli/{chunk-3HIJNXRB.js → chunk-XZS35M3Y.js} +10 -10
- package/dist/cli/{chunk-ZL3O7F5J.js → chunk-YNYHYL5C.js} +15 -15
- package/dist/cli/{chunk-FWB3QR7W.mjs → chunk-ZHE5E2WJ.mjs} +1 -1
- package/dist/cli/{chunk-D7J33HTK.mjs → chunk-ZJ2H77VV.mjs} +5 -5
- package/dist/cli/{chunk-JUZIMW4S.js → chunk-ZX6UVPGZ.js} +7 -7
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/concurrent-runs-help-H5SZUA5J.js +22 -0
- package/dist/cli/{concurrent-runs-help-UFNYQYU2.mjs → concurrent-runs-help-IYELSCHB.mjs} +6 -6
- package/dist/cli/{csv-QSDRGLQH.mjs → csv-ENEC3APZ.mjs} +4 -4
- package/dist/cli/{csv-ZI5LYFHF.js → csv-X6CP57R4.js} +13 -13
- package/dist/cli/{db-ZDL6Q53U.js → db-6HLRSE2M.js} +27 -27
- package/dist/cli/{db-WVWXNNMO.mjs → db-YGKRFK4T.mjs} +6 -6
- package/dist/cli/{describe-UUQBKUVL.mjs → describe-4SGQEX7K.mjs} +18 -18
- package/dist/cli/describe-Q2OYHDVZ.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-SCGHTWTC.js → executions-IC55YJ67.js} +8 -8
- package/dist/cli/{executions-QN3OYJKT.mjs → executions-PO2IOSZ7.mjs} +6 -6
- package/dist/cli/{feedback-7QPHLXGU.mjs → feedback-6BUD5F4I.mjs} +6 -6
- package/dist/cli/{feedback-6QQ7ONLW.js → feedback-BCGQLZ5T.js} +14 -14
- package/dist/cli/git-5X3MLBIP.js +26 -0
- package/dist/cli/{git-HFPJX573.mjs → git-IN4IBL2K.mjs} +5 -5
- package/dist/cli/index.js +148 -148
- package/dist/cli/index.mjs +47 -47
- package/dist/cli/{integrations-ND2HULSH.js → integrations-R2Z2MDO3.js} +29 -29
- package/dist/cli/{integrations-4SZ5O24P.mjs → integrations-ZMGB6NQA.mjs} +7 -7
- package/dist/cli/{legacy-noops-WUP3TBR2.mjs → legacy-noops-GIC5OZKP.mjs} +6 -6
- package/dist/cli/{legacy-noops-GQF6AYP5.js → legacy-noops-X4JPRPTJ.js} +9 -9
- package/dist/cli/{mcp-3GUFYGCQ.mjs → mcp-G4IRJIKK.mjs} +4 -4
- package/dist/cli/{mcp-L3YYVEU6.js → mcp-USZKTVL2.js} +24 -24
- package/dist/cli/{monitors-OFCVJSH5.mjs → monitors-SNFZPSCY.mjs} +7 -7
- package/dist/cli/{monitors-CVZZN5WG.js → monitors-T7LRP7OB.js} +100 -100
- package/dist/cli/{org-MQ5AUN7I.js → org-2L2ZZL2P.js} +121 -121
- package/dist/cli/{org-3DTAYA52.mjs → org-YTXLKW52.mjs} +6 -6
- package/dist/cli/{outcomes-42W24EXG.mjs → outcomes-CJWBIFTA.mjs} +6 -6
- package/dist/cli/{outcomes-MGDUYHUD.js → outcomes-O63F57JF.js} +14 -14
- package/dist/cli/{play-PD45RNYZ.mjs → play-6UWPUHC6.mjs} +331 -70
- package/dist/cli/{play-IMAD7QTV.js → play-T353SULJ.js} +930 -669
- package/dist/cli/{providers-DYKHG7NV.mjs → providers-LZABK2UW.mjs} +6 -6
- package/dist/cli/{providers-WONHPTRG.js → providers-XORJH2VW.js} +9 -9
- package/dist/cli/{quickstart-5QPGHLEX.mjs → quickstart-O4RF7J55.mjs} +4 -4
- package/dist/cli/{quickstart-6AAFULGC.js → quickstart-QBNUNPZR.js} +6 -6
- package/dist/cli/{run-WOW7QO3W.js → run-2CPMFC6W.js} +44 -44
- package/dist/cli/{run-4K6ZU7H7.mjs → run-GBRPFC6P.mjs} +23 -23
- package/dist/cli/{search-CKVFWVXQ.mjs → search-G7TS7OFB.mjs} +7 -7
- package/dist/cli/search-M3AHFCKQ.js +32 -0
- package/dist/cli/{search-output-WWB25JWA.mjs → search-output-BIIJRUCP.mjs} +4 -4
- package/dist/cli/{search-output-B5QE7ZNK.js → search-output-NRKLNWSD.js} +6 -6
- package/dist/cli/{secrets-SVZB6TSW.mjs → secrets-DN3XEZNH.mjs} +6 -6
- package/dist/cli/{secrets-WKIMR346.js → secrets-FUXYSEL5.js} +15 -15
- package/dist/cli/{sessions-P3QENG6T.mjs → sessions-PMUTPCTT.mjs} +6 -6
- package/dist/cli/sessions-VMBMBGVJ.js +23 -0
- package/dist/cli/{settings-V5ABL6D2.mjs → settings-N6GNS2KA.mjs} +12 -12
- package/dist/cli/{settings-UIFRGJW3.js → settings-ZDTWCQ6B.js} +85 -85
- package/dist/cli/{setup-E67NJTEF.mjs → setup-LJ3KWPSA.mjs} +9 -9
- package/dist/cli/{setup-A5MIJU3S.js → setup-PN5TSSJE.js} +49 -49
- package/dist/cli/{skills-WLHOQ4DO.mjs → skills-7J42K6VC.mjs} +7 -7
- package/dist/cli/skills-CXDENBLF.js +37 -0
- package/dist/cli/{tools-EG4KL3BB.mjs → tools-M3S6D6DA.mjs} +17 -17
- package/dist/cli/tools-WY2GMOC7.js +57 -0
- package/dist/cli/{update-IPFBE6SA.mjs → update-XTVFG74E.mjs} +9 -9
- package/dist/cli/update-ZB2IBGXG.js +37 -0
- package/dist/cli/{views-ZIBY2RVB.js → views-B4X2FWTF.js} +21 -21
- package/dist/cli/{views-XDN6SEWY.mjs → views-UFYRDO4X.mjs} +6 -6
- package/dist/cli/{workflow-BLKPBRBT.js → workflow-I2RM2J2J.js} +53 -29
- package/dist/cli/{workflow-O2XPMOVL.mjs → workflow-ZLMS3PDE.mjs} +42 -18
- package/dist/{client-QznpkWrk.d.ts → client-2QWMJInp.d.ts} +1 -1
- package/dist/{client-CmG8MT0x.d.mts → client-7H8TXmLa.d.mts} +1 -1
- package/dist/{client-core-CY0jNW0e.d.mts → client-core-BraEuxbg.d.mts} +67 -4
- package/dist/{client-core-CXDqfeiB.d.ts → client-core-DRglY5xa.d.ts} +67 -4
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +125 -120
- package/dist/plays/bundle-play-file.mjs +5 -0
- 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/release.d.mts +3 -3
- package/dist/release.d.ts +3 -3
- 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 +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-ALBG5LF4.js +0 -44
- package/dist/cli/concurrent-runs-help-E3YMAO5Q.js +0 -22
- package/dist/cli/describe-QB5T47B3.js +0 -50
- package/dist/cli/git-4FXTWHXT.js +0 -26
- package/dist/cli/search-YZIJS7QU.js +0 -32
- package/dist/cli/sessions-VQPGPXMU.js +0 -23
- package/dist/cli/skills-GTBK33MV.js +0 -37
- package/dist/cli/tools-GPAIPRPQ.js +0 -57
- package/dist/cli/update-QLWS32WR.js +0 -37
|
@@ -173,7 +173,8 @@ export function createRuntimeTuplePanicRecovery(input: {
|
|
|
173
173
|
internalToken: string;
|
|
174
174
|
vercelProtectionBypassToken?: string;
|
|
175
175
|
vercel: Readonly<{
|
|
176
|
-
|
|
176
|
+
/** A getter is read at each request, for short-lived (OIDC) tokens. */
|
|
177
|
+
token: string | (() => string);
|
|
177
178
|
teamId: string;
|
|
178
179
|
projectId: string;
|
|
179
180
|
productionDomain?: string;
|
|
@@ -304,13 +305,18 @@ export function createRuntimeTuplePanicRecovery(input: {
|
|
|
304
305
|
}
|
|
305
306
|
};
|
|
306
307
|
|
|
308
|
+
const vercelToken = (): string =>
|
|
309
|
+
typeof input.vercel.token === 'function'
|
|
310
|
+
? input.vercel.token()
|
|
311
|
+
: input.vercel.token;
|
|
312
|
+
|
|
307
313
|
const restoreAndVerifyPublicApplication = async (
|
|
308
314
|
publication: RuntimeTuplePanicPublication,
|
|
309
315
|
): Promise<void> => {
|
|
310
316
|
const activeDeploymentId = async (): Promise<string | null> => {
|
|
311
317
|
const alias = await fetchImpl(
|
|
312
318
|
`https://api.vercel.com/v4/aliases/${encodeURIComponent(productionDomain)}?teamId=${encodeURIComponent(input.vercel.teamId)}`,
|
|
313
|
-
{ headers: { authorization: `Bearer ${
|
|
319
|
+
{ headers: { authorization: `Bearer ${vercelToken()}` } },
|
|
314
320
|
);
|
|
315
321
|
if (!alias.ok) {
|
|
316
322
|
await errorWithResponse('Read Vercel Production alias', alias);
|
|
@@ -346,7 +352,7 @@ export function createRuntimeTuplePanicRecovery(input: {
|
|
|
346
352
|
fetchImpl,
|
|
347
353
|
projectId: input.vercel.projectId,
|
|
348
354
|
teamId: input.vercel.teamId,
|
|
349
|
-
token:
|
|
355
|
+
token: vercelToken(),
|
|
350
356
|
});
|
|
351
357
|
if (!response.ok && response.status !== 202) {
|
|
352
358
|
const body = await response.text();
|
|
@@ -200,6 +200,9 @@ function previewValue(
|
|
|
200
200
|
depth: number;
|
|
201
201
|
ancestors: WeakSet<object>;
|
|
202
202
|
redactor?: PreviewOptions['redactor'];
|
|
203
|
+
/** Shallower than `DOCFLOW_NODE_IO_LIMITS.maxDepth`, for a value that
|
|
204
|
+
* does not fit the phase at full depth (`fittingPreview`). */
|
|
205
|
+
maxDepth?: number;
|
|
203
206
|
},
|
|
204
207
|
): PlayDocflowNodeValuePreview {
|
|
205
208
|
if (value === null) return { kind: 'null' };
|
|
@@ -289,12 +292,50 @@ function previewValue(
|
|
|
289
292
|
if (input.ancestors.has(value)) {
|
|
290
293
|
return { kind: 'unavailable', reason: 'cycle' };
|
|
291
294
|
}
|
|
292
|
-
if (input.depth >= DOCFLOW_NODE_IO_LIMITS.maxDepth) {
|
|
295
|
+
if (input.depth >= (input.maxDepth ?? DOCFLOW_NODE_IO_LIMITS.maxDepth)) {
|
|
293
296
|
return { kind: 'unavailable', reason: 'depth' };
|
|
294
297
|
}
|
|
295
298
|
|
|
296
299
|
input.ancestors.add(value);
|
|
297
300
|
try {
|
|
301
|
+
// A Map holds its entries in an internal slot, not as fields, so it read
|
|
302
|
+
// as `{}`; a Set likewise read as `{}`. Read them through the built-in
|
|
303
|
+
// iterators (never an authored override) as the same object and array
|
|
304
|
+
// previews a plain record and a list give: no new preview kind.
|
|
305
|
+
if (value instanceof Map) {
|
|
306
|
+
const entries = [...Map.prototype.entries.call(value)];
|
|
307
|
+
const selected = entries.slice(0, DOCFLOW_NODE_IO_LIMITS.maxObjectFields);
|
|
308
|
+
const fields: Record<string, PlayDocflowNodeValuePreview> = {};
|
|
309
|
+
for (const [key, entry] of selected) {
|
|
310
|
+
const name = typeof key === 'string' ? key : String(key);
|
|
311
|
+
fields[
|
|
312
|
+
truncateUtf8(
|
|
313
|
+
ledgerSafeDocflowPreviewKey(
|
|
314
|
+
input.redactor?.redactRegisteredSecrets(name) ?? name,
|
|
315
|
+
),
|
|
316
|
+
DOCFLOW_NODE_IO_LIMITS.maxStringBytes,
|
|
317
|
+
)
|
|
318
|
+
] = previewValue(entry, { ...input, depth: input.depth + 1 });
|
|
319
|
+
}
|
|
320
|
+
return {
|
|
321
|
+
kind: 'object',
|
|
322
|
+
fields,
|
|
323
|
+
totalFields: entries.length,
|
|
324
|
+
...(entries.length > selected.length ? { truncated: true } : {}),
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
if (value instanceof Set) {
|
|
328
|
+
const all = [...Set.prototype.values.call(value)];
|
|
329
|
+
const items = all
|
|
330
|
+
.slice(0, DOCFLOW_NODE_IO_LIMITS.maxArrayItems)
|
|
331
|
+
.map((item) => previewValue(item, { ...input, depth: input.depth + 1 }));
|
|
332
|
+
return {
|
|
333
|
+
kind: 'array',
|
|
334
|
+
items,
|
|
335
|
+
totalItems: all.length,
|
|
336
|
+
...(all.length > items.length ? { truncated: true } : {}),
|
|
337
|
+
};
|
|
338
|
+
}
|
|
298
339
|
if (Array.isArray(value)) {
|
|
299
340
|
const items: PlayDocflowNodeValuePreview[] = [];
|
|
300
341
|
for (
|
|
@@ -362,6 +403,38 @@ function previewValue(
|
|
|
362
403
|
}
|
|
363
404
|
}
|
|
364
405
|
|
|
406
|
+
/**
|
|
407
|
+
* A value's preview that fits beside the previews already taken, read at full
|
|
408
|
+
* depth, then shallower: a long list of records keeps its count and its first
|
|
409
|
+
* items' top-level fields rather than being dropped whole. Null when not even
|
|
410
|
+
* its top level fits.
|
|
411
|
+
*/
|
|
412
|
+
function fittingPreview(
|
|
413
|
+
value: unknown,
|
|
414
|
+
taken: PlayDocflowNodeIoPreviewMap,
|
|
415
|
+
path: string,
|
|
416
|
+
redactor: PreviewOptions['redactor'],
|
|
417
|
+
): PlayDocflowNodeValuePreview | null {
|
|
418
|
+
for (
|
|
419
|
+
let maxDepth = DOCFLOW_NODE_IO_LIMITS.maxDepth;
|
|
420
|
+
maxDepth >= 1;
|
|
421
|
+
maxDepth -= 1
|
|
422
|
+
) {
|
|
423
|
+
const preview = previewValue(value, {
|
|
424
|
+
depth: 0,
|
|
425
|
+
ancestors: new WeakSet(),
|
|
426
|
+
redactor,
|
|
427
|
+
maxDepth,
|
|
428
|
+
});
|
|
429
|
+
if (
|
|
430
|
+
utf8Bytes(JSON.stringify({ ...taken, [path]: preview })) <=
|
|
431
|
+
DOCFLOW_NODE_IO_LIMITS.maxPhaseBytes
|
|
432
|
+
)
|
|
433
|
+
return preview;
|
|
434
|
+
}
|
|
435
|
+
return null;
|
|
436
|
+
}
|
|
437
|
+
|
|
365
438
|
export function buildPlayDocflowNodeIoPreviewMap(
|
|
366
439
|
values: Record<string, unknown>,
|
|
367
440
|
options: PreviewOptions = {},
|
|
@@ -388,16 +461,13 @@ export function buildPlayDocflowNodeIoPreviewMap(
|
|
|
388
461
|
),
|
|
389
462
|
DOCFLOW_NODE_IO_LIMITS.maxStringBytes,
|
|
390
463
|
);
|
|
391
|
-
const preview =
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
if (
|
|
398
|
-
utf8Bytes(JSON.stringify(candidate)) >
|
|
399
|
-
DOCFLOW_NODE_IO_LIMITS.maxPhaseBytes
|
|
400
|
-
) {
|
|
464
|
+
const preview = fittingPreview(
|
|
465
|
+
value,
|
|
466
|
+
previews,
|
|
467
|
+
safePath,
|
|
468
|
+
options.redactor,
|
|
469
|
+
);
|
|
470
|
+
if (!preview) {
|
|
401
471
|
truncated = true;
|
|
402
472
|
break;
|
|
403
473
|
}
|
|
@@ -477,17 +547,13 @@ export function buildPlayDocflowNodeInputPreviewMap(
|
|
|
477
547
|
),
|
|
478
548
|
DOCFLOW_NODE_IO_LIMITS.maxStringBytes,
|
|
479
549
|
);
|
|
480
|
-
const preview: PlayDocflowNodeValuePreview = available
|
|
481
|
-
?
|
|
482
|
-
depth: 0,
|
|
483
|
-
ancestors: new WeakSet(),
|
|
484
|
-
redactor: options.redactor,
|
|
485
|
-
})
|
|
550
|
+
const preview: PlayDocflowNodeValuePreview | null = available
|
|
551
|
+
? fittingPreview(current, values, safePath, options.redactor)
|
|
486
552
|
: { kind: 'unavailable', reason: 'access_error' };
|
|
487
|
-
const candidate = { ...values, [safePath]: preview };
|
|
488
553
|
if (
|
|
489
|
-
|
|
490
|
-
|
|
554
|
+
!preview ||
|
|
555
|
+
utf8Bytes(JSON.stringify({ ...values, [safePath]: preview })) >
|
|
556
|
+
DOCFLOW_NODE_IO_LIMITS.maxPhaseBytes
|
|
491
557
|
) {
|
|
492
558
|
truncated = true;
|
|
493
559
|
break;
|
|
@@ -164,6 +164,8 @@ export type RuntimeReceiptHydrationGate = {
|
|
|
164
164
|
/** Abort the queue wait; the signal's reason is what rejects. */
|
|
165
165
|
signal?: AbortSignal;
|
|
166
166
|
}): Promise<RuntimeReceiptHydrationTurn>;
|
|
167
|
+
/** Typical nonzero response size once sampled. Cold misses cannot price an unknown body. */
|
|
168
|
+
measuredOutputBytesPerKey(): number | undefined;
|
|
167
169
|
snapshot(): RuntimeReceiptHydrationGateSnapshot;
|
|
168
170
|
/**
|
|
169
171
|
* Release the admission timer and reject every still-queued turn. A closed
|
|
@@ -370,18 +372,19 @@ export function createRuntimeReceiptHydrationGate(input: {
|
|
|
370
372
|
if (slot < sampleReservoirSize) perKeySamples[slot] = bytesPerKey;
|
|
371
373
|
};
|
|
372
374
|
|
|
375
|
+
const measuredBytesPerKey = (): number | undefined =>
|
|
376
|
+
perKeySamples.length >= sampleTurns
|
|
377
|
+
? (percentile(perKeySamples, 0.9) ?? undefined)
|
|
378
|
+
: undefined;
|
|
379
|
+
|
|
373
380
|
/** Ledger bytes one receipt key is expected to cost. */
|
|
374
381
|
const priceKey = (occupancy: RuntimeMemoryOccupancy): number => {
|
|
375
|
-
const measured =
|
|
376
|
-
perKeySamples.length >= sampleTurns
|
|
377
|
-
? percentile(perKeySamples, 0.9)
|
|
378
|
-
: null;
|
|
379
382
|
// The lane's own measurement is what a receipt read costs. Before it has
|
|
380
383
|
// one, a receipt key is priced as a row: the ledger's settled p90 per
|
|
381
384
|
// owner, or the unmeasured prior behind it. That is an overestimate for a
|
|
382
385
|
// claim that returns no output, and deliberately so — the alternative is
|
|
383
386
|
// admitting an unknown payload against a budget it may not fit.
|
|
384
|
-
return
|
|
387
|
+
return measuredBytesPerKey() ?? occupancy.ownerReserveLedgerBytes;
|
|
385
388
|
};
|
|
386
389
|
|
|
387
390
|
/** Prefer a manifest's exact serialized body size over the conservative prior. */
|
|
@@ -587,6 +590,10 @@ export function createRuntimeReceiptHydrationGate(input: {
|
|
|
587
590
|
}
|
|
588
591
|
|
|
589
592
|
return {
|
|
593
|
+
measuredOutputBytesPerKey() {
|
|
594
|
+
const measured = measuredBytesPerKey();
|
|
595
|
+
return measured === 0 ? undefined : measured;
|
|
596
|
+
},
|
|
590
597
|
acquire(request) {
|
|
591
598
|
const requestedKeys = request?.receiptKeys;
|
|
592
599
|
const receiptKeys =
|
|
@@ -834,7 +841,11 @@ export type DurableReceiptExecutionStore = {
|
|
|
834
841
|
*/
|
|
835
842
|
getMany(
|
|
836
843
|
receiptKeys: string[],
|
|
837
|
-
options?: {
|
|
844
|
+
options?: {
|
|
845
|
+
hydrateOutput?: boolean;
|
|
846
|
+
/** Known decoded output sizes; they size read batches only. */
|
|
847
|
+
expectedOutputBytes?: ReadonlyMap<string, number>;
|
|
848
|
+
},
|
|
838
849
|
): Promise<Map<string, RuntimeStepReceipt>>;
|
|
839
850
|
claim(
|
|
840
851
|
receiptKey: string,
|
|
@@ -679,12 +679,19 @@ export async function executeWithFreshnessReceipt<T>(input: {
|
|
|
679
679
|
measure?.([receipt]);
|
|
680
680
|
return completedCall(receipt);
|
|
681
681
|
});
|
|
682
|
-
const readMany = (
|
|
682
|
+
const readMany = (
|
|
683
|
+
keys: readonly string[],
|
|
684
|
+
expectedBytes?: number,
|
|
685
|
+
expectedOutputBytes?: ReadonlyMap<string, number>,
|
|
686
|
+
) =>
|
|
683
687
|
input.withHydration(
|
|
684
688
|
async (measure) => {
|
|
685
689
|
const getMany = input.store.getMany;
|
|
686
690
|
const receipts = getMany
|
|
687
|
-
? await getMany(
|
|
691
|
+
? await getMany(
|
|
692
|
+
[...keys],
|
|
693
|
+
expectedOutputBytes ? { expectedOutputBytes } : undefined,
|
|
694
|
+
).then((byKey) =>
|
|
688
695
|
keys.map((key) => byKey.get(key) ?? null),
|
|
689
696
|
)
|
|
690
697
|
: await Promise.all(keys.map((key) => input.store.get(key)));
|
|
@@ -730,11 +737,20 @@ export async function executeWithFreshnessReceipt<T>(input: {
|
|
|
730
737
|
}
|
|
731
738
|
return [...manifests];
|
|
732
739
|
}
|
|
733
|
-
const
|
|
740
|
+
const expectedOutputBytes = new Map<string, number>();
|
|
741
|
+
for (const key of bodiless) {
|
|
734
742
|
const bytes = manifests[keys.indexOf(key)]?.outputByteLength;
|
|
735
|
-
|
|
736
|
-
}
|
|
737
|
-
const
|
|
743
|
+
if (Number.isSafeInteger(bytes)) expectedOutputBytes.set(key, bytes!);
|
|
744
|
+
}
|
|
745
|
+
const expectedBytes = [...expectedOutputBytes.values()].reduce(
|
|
746
|
+
(total, bytes) => total + bytes,
|
|
747
|
+
0,
|
|
748
|
+
);
|
|
749
|
+
const hydrated = await readMany(
|
|
750
|
+
bodiless,
|
|
751
|
+
expectedBytes,
|
|
752
|
+
expectedOutputBytes,
|
|
753
|
+
);
|
|
738
754
|
return keys.map((key, index) => {
|
|
739
755
|
const at = bodiless.indexOf(key);
|
|
740
756
|
return at === -1 ? manifests[index]! : (hydrated[at] ?? null);
|
|
@@ -372,6 +372,13 @@ export type WorkflowRunExecutionTokenClaims =
|
|
|
372
372
|
* number: a projector uses it only within its own bound.
|
|
373
373
|
*/
|
|
374
374
|
run_ledger_terminal_backlog_prefix_facts?: number;
|
|
375
|
+
/**
|
|
376
|
+
* The issuing build serves `project_run_events_prefixed`. Minted beside
|
|
377
|
+
* `run_ledger_ingress_prefix_origin` by builds that serve that action and
|
|
378
|
+
* never by older ones, so it is the projector's opt-in for multi-fact
|
|
379
|
+
* receipts to a mutable receiver.
|
|
380
|
+
*/
|
|
381
|
+
run_ledger_prefixed_projection?: true;
|
|
375
382
|
};
|
|
376
383
|
|
|
377
384
|
export type RuntimeRateScopeTokenClaims = {
|
|
@@ -698,6 +705,8 @@ function isValidWorkflowClaimsShape(
|
|
|
698
705
|
isValidRuntimeOrigin(claims.run_ledger_ingress_prefix_origin)) &&
|
|
699
706
|
(claims.run_ledger_terminal_backlog_prefix_facts === undefined ||
|
|
700
707
|
typeof claims.run_ledger_terminal_backlog_prefix_facts === 'number') &&
|
|
708
|
+
(claims.run_ledger_prefixed_projection === undefined ||
|
|
709
|
+
claims.run_ledger_prefixed_projection === true) &&
|
|
701
710
|
Array.isArray(claims.capabilities) &&
|
|
702
711
|
claims.capabilities.length > 0 &&
|
|
703
712
|
claims.capabilities.every(isRuntimeExecutionCapability) &&
|
|
@@ -932,6 +941,11 @@ export async function mintWorkflowRunExecutionToken(input: {
|
|
|
932
941
|
// the facts its verifier proves (run-ledger-projection-contract).
|
|
933
942
|
run_ledger_terminal_backlog_prefix_facts:
|
|
934
943
|
RUN_LEDGER_TERMINAL_BACKLOG_PREFIX_MAX_FACTS,
|
|
944
|
+
// This build serves `project_run_events_prefixed`. A projector may
|
|
945
|
+
// send this run's multi-fact receipts to a mutable receiver only on
|
|
946
|
+
// this claim: an older app never mints it, so a runtime deployed
|
|
947
|
+
// first, or an app rolled back past this build, opts no new run in.
|
|
948
|
+
run_ledger_prefixed_projection: true,
|
|
935
949
|
}
|
|
936
950
|
: {}),
|
|
937
951
|
sub: input.subject ?? 'workflow_executor',
|
|
@@ -107,6 +107,22 @@ export const RUNTIME_RECEIPT_GATEWAY_BATCH_MAX_BYTES = 12 * 1024 * 1024;
|
|
|
107
107
|
* gateway writer behind one request.
|
|
108
108
|
*/
|
|
109
109
|
export const RUNTIME_RECEIPT_WRITER_TARGET_BATCH_BYTES = 8 * 1024 * 1024;
|
|
110
|
+
/**
|
|
111
|
+
* Receipt reads are bounded by what they return, not only by key count. On
|
|
112
|
+
* 1 December 2026 a map of page bodies coalesced 200 full reads into one
|
|
113
|
+
* request; each ran past the 30 s Postgres read timeout and every retry asked
|
|
114
|
+
* for the same 200 bodies. A read batch closes before its expected decoded
|
|
115
|
+
* output passes this budget. One receipt larger than it still reads alone.
|
|
116
|
+
*/
|
|
117
|
+
export const RUNTIME_RECEIPT_READ_TARGET_RESPONSE_BYTES = 4 * 1024 * 1024;
|
|
118
|
+
/**
|
|
119
|
+
* Price of a full read whose size the caller does not know. A manifest read
|
|
120
|
+
* gives the exact size first; this prior only bounds reads without one, so an
|
|
121
|
+
* unpriced batch holds at most 128 keys.
|
|
122
|
+
*/
|
|
123
|
+
export const RUNTIME_RECEIPT_READ_UNKNOWN_OUTPUT_BYTES = 32 * 1024;
|
|
124
|
+
/** A manifest carries status, lease facts and a size: never the body. */
|
|
125
|
+
export const RUNTIME_RECEIPT_MANIFEST_RESPONSE_BYTES = 1024;
|
|
110
126
|
/**
|
|
111
127
|
* Batching window for runtime step receipt completions.
|
|
112
128
|
*
|
|
@@ -1019,6 +1035,11 @@ function compactRunListPreviewValue(
|
|
|
1019
1035
|
if (!isPlainObject(value)) {
|
|
1020
1036
|
return { value: String(value), truncated: true };
|
|
1021
1037
|
}
|
|
1038
|
+
// A dataset handle is fixed-size once its internals (`_metadata`: work
|
|
1039
|
+
// progress, cardinality, …) are left out: keep it whole, so the run list
|
|
1040
|
+
// can say "3 rows" and open them instead of losing the output.
|
|
1041
|
+
const handle = compactRunListDatasetHandle(value);
|
|
1042
|
+
if (handle) return { value: handle, truncated: false };
|
|
1022
1043
|
|
|
1023
1044
|
const output: Record<string, unknown> = Object.create(null) as Record<
|
|
1024
1045
|
string,
|
|
@@ -1046,6 +1067,37 @@ function compactRunListPreviewValue(
|
|
|
1046
1067
|
};
|
|
1047
1068
|
}
|
|
1048
1069
|
|
|
1070
|
+
/** The fields a dataset handle keeps in a run-list preview, scalars only. */
|
|
1071
|
+
const RUN_LIST_DATASET_HANDLE_FIELDS = [
|
|
1072
|
+
'datasetId',
|
|
1073
|
+
'tableNamespace',
|
|
1074
|
+
'name',
|
|
1075
|
+
'rowCount',
|
|
1076
|
+
'count',
|
|
1077
|
+
] as const;
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* `{ kind: 'dataset', datasetId, tableNamespace?, name?, rowCount?, count? }`
|
|
1081
|
+
* for a dataset handle (bounded strings, finite counts), else null.
|
|
1082
|
+
*/
|
|
1083
|
+
function compactRunListDatasetHandle(
|
|
1084
|
+
value: Record<string, unknown>,
|
|
1085
|
+
): Record<string, unknown> | null {
|
|
1086
|
+
if (value.kind !== 'dataset') return null;
|
|
1087
|
+
const handle: Record<string, unknown> = { kind: 'dataset' };
|
|
1088
|
+
for (const key of RUN_LIST_DATASET_HANDLE_FIELDS) {
|
|
1089
|
+
const field = value[key];
|
|
1090
|
+
if (typeof field === 'number' && Number.isFinite(field))
|
|
1091
|
+
handle[key] = field;
|
|
1092
|
+
else if (typeof field === 'string')
|
|
1093
|
+
handle[key] = compactRunListPreviewString(field).value;
|
|
1094
|
+
}
|
|
1095
|
+
return typeof handle.datasetId === 'string' ||
|
|
1096
|
+
typeof handle.tableNamespace === 'string'
|
|
1097
|
+
? handle
|
|
1098
|
+
: null;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1049
1101
|
function runListPreviewFieldBytes(
|
|
1050
1102
|
key: string,
|
|
1051
1103
|
value: unknown,
|
|
@@ -1084,6 +1136,8 @@ export function buildBoundedRunListOutputPreview(
|
|
|
1084
1136
|
truncated = true;
|
|
1085
1137
|
continue;
|
|
1086
1138
|
}
|
|
1139
|
+
// The output's own bookkeeping is never a value a reader reads.
|
|
1140
|
+
if (key === '_metadata') continue;
|
|
1087
1141
|
const compacted = compactRunListPreviewValue(child, 0);
|
|
1088
1142
|
truncated ||= compacted.truncated;
|
|
1089
1143
|
let previewValue = compacted.value;
|
package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/postgres-adapter.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ABSURD_WAKE_CHANNEL } from '@deepline/absurd/sdk';
|
|
|
2
2
|
|
|
3
3
|
import { absurdRunnerTerminalEventName } from '../../scheduler-backends/absurd-shared';
|
|
4
4
|
import {
|
|
5
|
+
absurdEngineWakeEchoSql,
|
|
5
6
|
directCompletePostgresSchedulerRunnerTerminal,
|
|
6
7
|
recordPostgresSchedulerRunnerTerminal,
|
|
7
8
|
type PostgresSchedulerQueryClient,
|
|
@@ -60,7 +61,7 @@ export function createPostgresPlayRunTerminalPorts(input: {
|
|
|
60
61
|
`WITH emitted AS (
|
|
61
62
|
SELECT absurd.emit_event($1, $2, 'null'::jsonb)
|
|
62
63
|
)
|
|
63
|
-
SELECT
|
|
64
|
+
SELECT ${absurdEngineWakeEchoSql(options, `'${ABSURD_WAKE_CHANNEL}'`, '$1')} FROM emitted`,
|
|
64
65
|
[
|
|
65
66
|
terminal.queueName,
|
|
66
67
|
absurdRunnerTerminalEventName(terminal.runId, terminal.attempt),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { playRunResult } from '../plays/run-result';
|
|
1
2
|
import {
|
|
2
3
|
projectPlayStepProgressCounters,
|
|
3
4
|
resolveTimingWindow,
|
|
@@ -345,7 +346,9 @@ export function buildPlayRunStatusSnapshot(input: {
|
|
|
345
346
|
updatedAt: input.run.updatedAt ?? null,
|
|
346
347
|
finishedAt: input.run.finishedAt ?? null,
|
|
347
348
|
});
|
|
348
|
-
const terminalRunLogTail = extractTerminalRunLogTail(
|
|
349
|
+
const terminalRunLogTail = extractTerminalRunLogTail(
|
|
350
|
+
playRunResult(input.run),
|
|
351
|
+
);
|
|
349
352
|
const projectedSnapshot =
|
|
350
353
|
terminalRunLogTail &&
|
|
351
354
|
terminalRunLogTail.totalLogCount > ledgerSnapshot.totalLogCount
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createHash,
|
|
3
|
+
createHmac,
|
|
4
|
+
randomBytes,
|
|
5
|
+
timingSafeEqual,
|
|
6
|
+
} from 'node:crypto';
|
|
2
7
|
import {
|
|
3
8
|
earlySandboxCapUnits,
|
|
4
9
|
type PlaySandboxRuntimeLimits,
|
|
@@ -164,7 +169,8 @@ export const MODAL_SANDBOX_TAGS_MAX_BYTES = 512;
|
|
|
164
169
|
/** Bytes Modal counts toward that cap: every tag name and value (UTF-8). */
|
|
165
170
|
export function modalSandboxTagsBytes(tags: Record<string, string>): number {
|
|
166
171
|
return Object.entries(tags).reduce(
|
|
167
|
-
(sum, [name, value]) =>
|
|
172
|
+
(sum, [name, value]) =>
|
|
173
|
+
sum + Buffer.byteLength(name) + Buffer.byteLength(value),
|
|
168
174
|
0,
|
|
169
175
|
);
|
|
170
176
|
}
|
|
@@ -252,7 +258,12 @@ export function verifyEarlyPrebootPlan(input: {
|
|
|
252
258
|
nowMs: number;
|
|
253
259
|
}):
|
|
254
260
|
| { plan: EarlyPrebootPlan }
|
|
255
|
-
| {
|
|
261
|
+
| {
|
|
262
|
+
refused:
|
|
263
|
+
| 'preboot_plan_missing'
|
|
264
|
+
| 'preboot_plan_invalid'
|
|
265
|
+
| 'preboot_stale';
|
|
266
|
+
} {
|
|
256
267
|
const value = input.tags[EARLY_PREBOOT_TAG];
|
|
257
268
|
// `1` (the create-time claim) or absent: not published (yet). Any other
|
|
258
269
|
// plan form (an older or newer build's) is refused, never guessed at.
|
|
@@ -668,6 +679,18 @@ export type EarlySandboxAdapter<
|
|
|
668
679
|
}): Promise<EarlySandboxSweepOutcome | { skipped: string }>;
|
|
669
680
|
};
|
|
670
681
|
|
|
682
|
+
/**
|
|
683
|
+
* An advisory check run inside the fire-and-forget create, before any
|
|
684
|
+
* provider call: a skip names why this run would not adopt in time (its
|
|
685
|
+
* org's sandbox capacity is full, so the run will queue past the adoption
|
|
686
|
+
* window). A null reason passes with details (logged `create_gate_open`, so
|
|
687
|
+
* the decision is visible). Null, or a rejected check, creates as before.
|
|
688
|
+
*/
|
|
689
|
+
export type EarlySandboxCreateGate = () => Promise<{
|
|
690
|
+
reason: string | null;
|
|
691
|
+
[detail: string]: unknown;
|
|
692
|
+
} | null>;
|
|
693
|
+
|
|
671
694
|
/**
|
|
672
695
|
* Start (fire and forget) the early sandbox for an admitted run. Idempotent
|
|
673
696
|
* per process; a second hint for the same run is ignored.
|
|
@@ -675,6 +698,7 @@ export type EarlySandboxAdapter<
|
|
|
675
698
|
export function startEarlySandbox<TSandbox extends EarlySandboxHandle>(
|
|
676
699
|
adapter: EarlySandboxAdapter<TSandbox>,
|
|
677
700
|
input: EarlySandboxStartRequest,
|
|
701
|
+
options: { createGate?: EarlySandboxCreateGate } = {},
|
|
678
702
|
): boolean {
|
|
679
703
|
if (
|
|
680
704
|
!resolveExperimentSwitch(
|
|
@@ -700,14 +724,46 @@ export function startEarlySandbox<TSandbox extends EarlySandboxHandle>(
|
|
|
700
724
|
});
|
|
701
725
|
if (adapter.registry.hinted(key)) return false;
|
|
702
726
|
const hintAtMs = Date.now();
|
|
703
|
-
const
|
|
704
|
-
|
|
727
|
+
const createGate = options.createGate;
|
|
728
|
+
const started = (async () => {
|
|
729
|
+
if (createGate) {
|
|
730
|
+
const skip = await createGate().catch((error: unknown) => {
|
|
731
|
+
// Advisory: a failed check creates exactly as before.
|
|
732
|
+
logEarlySandbox(adapter.logScope, 'create_gate_failed', {
|
|
733
|
+
key,
|
|
734
|
+
orgId,
|
|
735
|
+
error: error instanceof Error ? error.message : String(error),
|
|
736
|
+
});
|
|
737
|
+
return null;
|
|
738
|
+
});
|
|
739
|
+
if (skip?.reason) {
|
|
740
|
+
// Resolves null like a failed create: the registry releases the
|
|
741
|
+
// entry's units and the launch creates its own sandbox.
|
|
742
|
+
logEarlySandbox(adapter.logScope, 'create_skipped', {
|
|
743
|
+
key,
|
|
744
|
+
orgId,
|
|
745
|
+
workflowId: input.workflowId,
|
|
746
|
+
...skip,
|
|
747
|
+
});
|
|
748
|
+
return null;
|
|
749
|
+
}
|
|
750
|
+
if (skip) {
|
|
751
|
+
const { reason: _open, ...details } = skip;
|
|
752
|
+
logEarlySandbox(adapter.logScope, 'create_gate_open', {
|
|
753
|
+
key,
|
|
754
|
+
orgId,
|
|
755
|
+
...details,
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
return await adapter.createEarly({
|
|
705
760
|
...input,
|
|
706
761
|
key,
|
|
707
762
|
orgId,
|
|
708
763
|
hintAtMs,
|
|
709
764
|
scope,
|
|
710
|
-
})
|
|
765
|
+
});
|
|
766
|
+
})().catch((error: unknown) => {
|
|
711
767
|
logEarlySandbox(adapter.logScope, 'create_failed', {
|
|
712
768
|
key,
|
|
713
769
|
orgId,
|
|
@@ -85,6 +85,11 @@ export const RUNTIME_OPERATION_CAPABILITIES = {
|
|
|
85
85
|
repair_runtime_storage_grants: 'sheet.write',
|
|
86
86
|
append_run_events: 'run.progress',
|
|
87
87
|
project_run_events: 'run.progress',
|
|
88
|
+
// A multi-fact Run Ledger receipt for a run.events prefix. Identical to
|
|
89
|
+
// project_run_events at a receiver that proves prefixes; its own name is
|
|
90
|
+
// the capability fence, so an older app refuses it instead of reading a
|
|
91
|
+
// multi-fact receipt with single-fact proof.
|
|
92
|
+
project_run_events_prefixed: 'run.progress',
|
|
88
93
|
save_results: 'run.progress',
|
|
89
94
|
start_run: 'run.progress',
|
|
90
95
|
record_first_claim_latency: 'run.progress',
|
|
@@ -135,6 +140,13 @@ export const RUNTIME_OPERATION_CONTRACT: DeployedOperationContract =
|
|
|
135
140
|
kind: 'equivalent-fallback',
|
|
136
141
|
action: 'append_run_events',
|
|
137
142
|
},
|
|
143
|
+
// Never degrade to project_run_events: that would hand a multi-fact
|
|
144
|
+
// receipt to a receiver without prefix proof. The projector retains
|
|
145
|
+
// the claimed facts and retries after the newer app promotes.
|
|
146
|
+
project_run_events_prefixed: {
|
|
147
|
+
kind: 'feature-unavailable',
|
|
148
|
+
code: 'RUN_LEDGER_PREFIX_RECEIPT_UNAVAILABLE',
|
|
149
|
+
},
|
|
138
150
|
// The runner retains the complete result before attempting this
|
|
139
151
|
// compact completion. An older app receiver reports the action as
|
|
140
152
|
// unsupported, and the adapter retries the established full-payload
|
|
@@ -175,6 +187,7 @@ const BLOCKED_ACCOUNT_COMPLETION_OPERATIONS = new Set<string>([
|
|
|
175
187
|
'heartbeat_runtime_step_receipts',
|
|
176
188
|
'append_run_events',
|
|
177
189
|
'project_run_events',
|
|
190
|
+
'project_run_events_prefixed',
|
|
178
191
|
'save_results',
|
|
179
192
|
'compute_billing_upsert',
|
|
180
193
|
'compute_billing_record_item',
|
|
@@ -241,6 +254,7 @@ export function runtimeOperationCapabilityForRequest(
|
|
|
241
254
|
capabilities.length !== 1 ||
|
|
242
255
|
![
|
|
243
256
|
'project_run_events',
|
|
257
|
+
'project_run_events_prefixed',
|
|
244
258
|
'project_run_created',
|
|
245
259
|
'append_run_events',
|
|
246
260
|
'start_run',
|