deepline 0.3.484 → 0.3.486
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 +91 -30
- package/dist/bundling-sources/sdk/src/compat.ts +13 -0
- package/dist/bundling-sources/sdk/src/plays/client-core.ts +4 -1
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +143 -9
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +31 -4
- package/dist/bundling-sources/sdk/src/tool-calls.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +7 -1
- package/dist/bundling-sources/shared_libs/play-data-plane/sheet-column-storage.ts +32 -3
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +126 -41
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +231 -25
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-runtime-config.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +130 -19
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +105 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execute-server-timing.ts +4 -2
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +194 -56
- package/dist/bundling-sources/shared_libs/play-runtime/ledger-safe-payload.ts +8 -4
- package/dist/bundling-sources/shared_libs/play-runtime/log-provenance.ts +11 -6
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/ports.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/postgres-adapter.ts +2 -1
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +30 -0
- package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +195 -2
- package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +20 -1
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +15 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +139 -67
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/progress-sidecar.ts +9 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-control-transport.ts +25 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +133 -82
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +58 -16
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-sandbox-absence.ts +171 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +69 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +100 -40
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +8 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +67 -9
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +5 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +6 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-errors.ts +14 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-writer.ts +87 -31
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/index.ts +19 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +14 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +206 -7
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +39 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +12 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +28 -9
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +44 -15
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +60 -11
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +656 -64
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +6 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +25 -33
- package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +21 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/source-authoring-edition.ts +1 -1
- package/dist/cli/auth-ARKH3OAU.js +43 -0
- package/dist/cli/{auth-EBFOTF7X.mjs → auth-B4DJO4FB.mjs} +5 -5
- package/dist/cli/{billing-G2G3EF3I.js → billing-GDWAMARK.js} +80 -80
- package/dist/cli/{billing-2ZOIMW5V.mjs → billing-IIQ3VNXU.mjs} +7 -7
- package/dist/cli/{chunk-YWC5AN26.mjs → chunk-2DVFQYPG.mjs} +62 -34
- package/dist/cli/{chunk-UWOY74RU.js → chunk-5DUP4ZUE.js} +21 -21
- package/dist/cli/{chunk-EACX7QXO.mjs → chunk-5QYZ4MEW.mjs} +2 -2
- package/dist/cli/{chunk-HEI3BWIV.mjs → chunk-5RLVCOKH.mjs} +1 -1
- package/dist/cli/{chunk-TIRSKEZH.mjs → chunk-5Y7LLRWO.mjs} +1 -1
- package/dist/cli/{chunk-IXWQOVNW.js → chunk-5YILTBF7.js} +87 -76
- package/dist/cli/{chunk-OHKKDPA5.js → chunk-7FTQKEZ6.js} +13 -13
- package/dist/cli/{chunk-TN2GW57M.mjs → chunk-A456YVDE.mjs} +1 -1
- package/dist/cli/{chunk-GVAENVIG.js → chunk-AUQQVDAB.js} +110 -21
- package/dist/cli/{chunk-3XQIVEAT.js → chunk-BJL7RYQN.js} +3 -3
- package/dist/cli/{chunk-2AWYJXBX.js → chunk-BNB2RK4L.js} +5 -5
- package/dist/cli/{chunk-U7IJAGWB.js → chunk-BYEDI5PM.js} +7 -7
- package/dist/cli/{chunk-RLLEH2SP.js → chunk-C4GFBB52.js} +26 -26
- package/dist/cli/{chunk-AK7UKQ5R.js → chunk-CSBMKHTV.js} +5 -5
- package/dist/cli/{chunk-UT4YMA2N.js → chunk-DFHS5XVZ.js} +5 -4
- package/dist/cli/{chunk-XZXIWPT3.mjs → chunk-F3G2HAUQ.mjs} +1 -1
- package/dist/cli/{chunk-C62NI2X6.js → chunk-FCAKAW6S.js} +5 -5
- package/dist/cli/{chunk-AF7MOUZP.mjs → chunk-FGPJXQEJ.mjs} +2 -2
- package/dist/cli/chunk-FSCOYTRV.js +42 -0
- package/dist/cli/{chunk-6GRZEYSG.js → chunk-GCEUOHJW.js} +7 -7
- package/dist/cli/{chunk-SD7QWZTV.mjs → chunk-INW22YP7.mjs} +1 -1
- package/dist/cli/{chunk-OWUZKXE7.mjs → chunk-J7EENGKJ.mjs} +1 -1
- package/dist/cli/{chunk-QIDDTIVZ.js → chunk-KPIVQFXZ.js} +322 -294
- package/dist/cli/{chunk-4IOY2SCQ.js → chunk-LOX3BISD.js} +4 -4
- package/dist/cli/{chunk-WYUCDLVR.mjs → chunk-MJ56FCYU.mjs} +2 -1
- package/dist/cli/{chunk-DBJ62RAO.js → chunk-NSPMJLYA.js} +3 -3
- package/dist/cli/{chunk-HNRELVCS.mjs → chunk-ONONSV2Q.mjs} +96 -7
- package/dist/cli/{chunk-PU52JXKA.mjs → chunk-P6KGYOCM.mjs} +13 -4
- package/dist/cli/{chunk-VEVGM6B5.js → chunk-PCYZDTDC.js} +14 -14
- package/dist/cli/{chunk-NW4QJE54.js → chunk-PHWFY26F.js} +2 -2
- package/dist/cli/{chunk-LTZXLYKE.mjs → chunk-PKOFEHZL.mjs} +93 -17
- package/dist/cli/{chunk-7K5CWKKZ.mjs → chunk-PQHDZHZG.mjs} +2 -2
- package/dist/cli/{chunk-UKM74PAA.js → chunk-PTM3QRAT.js} +37 -37
- package/dist/cli/{chunk-YGN77QA5.mjs → chunk-PV7AYBKQ.mjs} +3 -3
- package/dist/cli/{chunk-4OEOM6GP.mjs → chunk-PYDHVRAF.mjs} +5 -5
- package/dist/cli/{chunk-FRD5WFT4.js → chunk-QD22TY33.js} +323 -247
- package/dist/cli/{chunk-5KNRQWHE.js → chunk-QEQ3KHVY.js} +3 -3
- package/dist/cli/{chunk-KGOC6HGI.js → chunk-S5EYODEG.js} +53 -53
- package/dist/cli/{chunk-FQK7BULS.js → chunk-S7OILDJH.js} +1 -1
- package/dist/cli/{chunk-TRLDJNVE.mjs → chunk-T3Q6BMVH.mjs} +1 -1
- package/dist/cli/{chunk-5K5CAND4.mjs → chunk-TBE2K5W4.mjs} +4 -4
- package/dist/cli/{chunk-YHA3EV3I.mjs → chunk-TE2QT2MX.mjs} +15 -4
- package/dist/cli/{chunk-ZOKM7DVA.js → chunk-TNHY3ATN.js} +8 -8
- package/dist/cli/{chunk-4OVHIWE7.mjs → chunk-U23L57VU.mjs} +2 -2
- package/dist/cli/{chunk-5GOG5ZGC.mjs → chunk-UEJLWUJ3.mjs} +2 -2
- package/dist/cli/{chunk-6NPWXE32.mjs → chunk-VJLL5XIP.mjs} +1 -1
- package/dist/cli/{chunk-WXRM3UC6.mjs → chunk-WCOJH4W4.mjs} +3 -3
- package/dist/cli/{chunk-4SFC2XUF.mjs → chunk-XAZWUW6I.mjs} +5 -5
- package/dist/cli/{chunk-ZM2YPJQJ.js → chunk-XK5DMLZE.js} +5 -1
- package/dist/cli/{chunk-LJ5747UC.mjs → chunk-XRDXNAAY.mjs} +5 -1
- package/dist/cli/{chunk-V7JCMBLU.mjs → chunk-YIKHNZ6B.mjs} +4 -4
- package/dist/cli/{chunk-M4PG7FGC.js → chunk-YS6JOYYS.js} +2 -2
- package/dist/cli/{chunk-DEXSQGXB.mjs → chunk-ZMRZ3BXG.mjs} +5 -5
- package/dist/cli/{chunk-CYWBAV5H.js → chunk-ZQI26KE4.js} +16 -16
- package/dist/cli/{csv-S3CHUKI6.js → csv-3PSMPZM5.js} +13 -13
- package/dist/cli/{csv-NLWVWD3H.mjs → csv-LFCT3WQ4.mjs} +4 -4
- package/dist/cli/{db-OGRPAEEM.mjs → db-HULKVAMU.mjs} +7 -7
- package/dist/cli/{db-WBSKMMOH.js → db-R7I2PPTV.js} +28 -28
- package/dist/cli/{describe-FAD3Z7LN.mjs → describe-D55V42LH.mjs} +21 -21
- package/dist/cli/describe-H47BLOEP.js +49 -0
- package/dist/cli/describe-core.d.mts +3 -3
- package/dist/cli/describe-core.d.ts +3 -3
- package/dist/cli/describe-core.js +4 -4
- package/dist/cli/describe-core.mjs +3 -3
- package/dist/cli/{executions-LYCL344R.mjs → executions-ICVVOYVG.mjs} +7 -7
- package/dist/cli/{executions-SOAZHCY4.js → executions-O37FN2SK.js} +9 -9
- package/dist/cli/{feedback-AVF6V7SV.mjs → feedback-3K3QPGCQ.mjs} +4 -4
- package/dist/cli/{feedback-OROUPUNJ.js → feedback-MAZQ7C6S.js} +8 -8
- package/dist/cli/{git-J5N5M57H.mjs → git-2MMD5KJS.mjs} +5 -5
- package/dist/cli/git-RQ2XLFYZ.js +25 -0
- package/dist/cli/index.js +142 -139
- package/dist/cli/index.mjs +45 -42
- package/dist/cli/{legacy-noops-QAQMZMEG.js → legacy-noops-2OX2Y3Y2.js} +8 -8
- package/dist/cli/{legacy-noops-ENRRM7BL.mjs → legacy-noops-VLSWJ6VE.mjs} +5 -5
- package/dist/cli/{monitors-CKQ65WRL.mjs → monitors-2NODQQWG.mjs} +8 -8
- package/dist/cli/{monitors-SFMQ5LFR.js → monitors-UCSV5FOR.js} +92 -92
- package/dist/cli/{org-3UNTDLT2.js → org-4YY73VTW.js} +73 -73
- package/dist/cli/{org-K4UIEU5P.mjs → org-W7AUQCDE.mjs} +7 -7
- package/dist/cli/{pages-NKZTGB4C.js → pages-FBZEUMXK.js} +18 -18
- package/dist/cli/{pages-6GPGBIAH.mjs → pages-ZRP7U5PO.mjs} +7 -7
- package/dist/cli/{play-BDEADESI.js → play-LFCTQJXA.js} +858 -632
- package/dist/cli/{play-62BEE7IX.mjs → play-XF2BSGTP.mjs} +372 -146
- package/dist/cli/{providers-SXGP44GH.js → providers-5456JNHP.js} +10 -10
- package/dist/cli/{providers-X3CUWMFP.mjs → providers-SICAPKGI.mjs} +7 -7
- package/dist/cli/{quickstart-XQ4426M4.js → quickstart-2KLLIPIU.js} +6 -6
- package/dist/cli/{quickstart-7LN22BKX.mjs → quickstart-IBVG6GX6.mjs} +4 -4
- package/dist/cli/{run-PBJ4ZJ4W.js → run-DNLDGJRC.js} +41 -41
- package/dist/cli/{run-XXSN3B5A.mjs → run-XPIZIQ7H.mjs} +26 -26
- package/dist/cli/search-2KQA65LH.js +32 -0
- package/dist/cli/{search-M75VMADD.mjs → search-PW22AEAL.mjs} +8 -8
- package/dist/cli/{search-output-F6HCFYEI.js → search-output-H6F6QMRF.js} +22 -16
- package/dist/cli/{search-output-NUQAKWDM.mjs → search-output-JFD53H2N.mjs} +14 -8
- package/dist/cli/{secrets-J2H6V33R.mjs → secrets-542CTZRZ.mjs} +7 -7
- package/dist/cli/{secrets-LRYY4QPE.js → secrets-LCCRRAN7.js} +16 -16
- package/dist/cli/{sessions-YPF62CZE.js → sessions-5FYDQE3N.js} +6 -6
- package/dist/cli/{sessions-IMT336UV.mjs → sessions-CALLS2XD.mjs} +5 -5
- package/dist/cli/{settings-PDWVQIGH.mjs → settings-GSKPHUEC.mjs} +12 -12
- package/dist/cli/{settings-35YYC5WA.js → settings-ORGKOBP6.js} +79 -79
- package/dist/cli/{setup-UR7GOR7H.js → setup-4BUWJKB6.js} +47 -47
- package/dist/cli/{setup-DG5DISSE.mjs → setup-V57GHVAF.mjs} +9 -9
- package/dist/cli/skills-KYZPPGSN.js +33 -0
- package/dist/cli/{skills-U6NJD5J7.mjs → skills-NGLCFQFT.mjs} +7 -7
- package/dist/cli/tools-AFYXUEMD.js +56 -0
- package/dist/cli/{tools-2HGEOELR.mjs → tools-G2YNCFNX.mjs} +19 -19
- package/dist/cli/{update-FRAYBAHK.mjs → update-IZ3Z5T5C.mjs} +9 -9
- package/dist/cli/update-T6JJ7A3K.js +33 -0
- package/dist/cli/{workflow-JKKLOMBX.js → workflow-7AHST2XV.js} +18 -18
- package/dist/cli/{workflow-DDKVTF36.mjs → workflow-L7ROQIM7.mjs} +8 -8
- package/dist/{client-DJ3r8VQJ.d.mts → client-BkbDHRIg.d.mts} +1 -1
- package/dist/{client-JPSNljtj.d.ts → client-D3hVHXjK.d.ts} +1 -1
- package/dist/{client-core-3SJlNsKU.d.mts → client-core-BZoSMKcY.d.mts} +30 -15
- package/dist/{client-core-rCoQ5Xz3.d.ts → client-core-DUdVqO_m.d.ts} +30 -15
- package/dist/{compiler-manifest-gkO9ZkVg.d.mts → compiler-manifest-BFTwq1HI.d.mts} +1 -1
- package/dist/{compiler-manifest-gkO9ZkVg.d.ts → compiler-manifest-BFTwq1HI.d.ts} +1 -1
- package/dist/{errors-Cc92LKH-.d.ts → errors-c3pMsylw.d.ts} +1 -1
- package/dist/{errors-CeCCOKSA.d.mts → errors-w31ybrQM.d.mts} +1 -1
- package/dist/{index-DJQKdV76.d.ts → index-CQ-15-QL.d.ts} +1 -1
- package/dist/{index-DsqWJL3Q.d.mts → index-DvNtxucX.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +10 -10
- package/dist/index.mjs +7 -7
- package/dist/install-integrity.json +117 -116
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/bundle-play-file.mjs +2 -2
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/plays/run-request.js +12 -2
- package/dist/plays/run-request.mjs +11 -1
- 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 +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +6 -6
- package/dist/server.mjs +4 -4
- package/package.json +1 -1
- package/dist/cli/auth-L5CSV3UO.js +0 -43
- package/dist/cli/chunk-KA2LNIUP.js +0 -33
- package/dist/cli/describe-UIAYCHWW.js +0 -49
- package/dist/cli/git-ATMWC27D.js +0 -25
- package/dist/cli/search-IGHLRLBD.js +0 -32
- package/dist/cli/skills-4U5WC4MJ.js +0 -33
- package/dist/cli/tools-PYJTQVVS.js +0 -56
- package/dist/cli/update-344OTRFM.js +0 -33
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RuntimeSheetAdmissionRequestTooLargeError } from './runtime-sheet-errors';
|
|
1
2
|
import {
|
|
2
3
|
DatasetRowInputView,
|
|
3
4
|
assertDatasetAdmissionHistory,
|
|
@@ -674,6 +675,7 @@ const toolExecutionOverrides = new AsyncLocalStorage<{ force: boolean }>();
|
|
|
674
675
|
const PROGRESS_HEARTBEAT_INTERVAL_MS = 1_000;
|
|
675
676
|
|
|
676
677
|
const PURE_JS_HEARTBEAT_ROW_INTERVAL = 250;
|
|
678
|
+
const MAPPED_RESOLVER_HOST_TURN_BUDGET_MS = 16;
|
|
677
679
|
/** Executed-row sheet persistence chunking: rows AND bytes, whichever first. */
|
|
678
680
|
const MAP_PERSIST_CHUNK_ROWS = 2_000;
|
|
679
681
|
const MAP_PERSIST_CHUNK_BYTES = 8 * 1024 * 1024;
|
|
@@ -2934,6 +2936,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
2934
2936
|
/** Last completed map step — for post-map recordStep calls (e.g. run_javascript). */
|
|
2935
2937
|
private lastDatasetStep: Extract<PlayStep, { type: 'dataset' }> | null = null;
|
|
2936
2938
|
private pureMapExecutionActive = false;
|
|
2939
|
+
// One host-turn budget spans concurrent rows, rather than letting every
|
|
2940
|
+
// worker spend a separate slice before timers and cancellation can run.
|
|
2941
|
+
private mappedResolverHostTurnAt: number | null = null;
|
|
2942
|
+
private mappedResolverHostTurn: Promise<void> | null = null;
|
|
2937
2943
|
/**
|
|
2938
2944
|
* Active per-map collector of cell meta patches keyed by row key. Fed by
|
|
2939
2945
|
* emitScopedRowUpdate during a map so executed rows persist with their
|
|
@@ -9231,7 +9237,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
9231
9237
|
let failedCount = 0;
|
|
9232
9238
|
let duplicateReuseCount = 0;
|
|
9233
9239
|
let executedCount = 0;
|
|
9234
|
-
let sourceRowsCount =
|
|
9240
|
+
let sourceRowsCount = totalInputCount;
|
|
9235
9241
|
const failureSamples: Array<{ rowLabel: string; error: string }> = [];
|
|
9236
9242
|
const failureSampleErrors = new Set<string>();
|
|
9237
9243
|
const previewRows: Record<string, unknown>[] = [];
|
|
@@ -9332,11 +9338,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
9332
9338
|
};
|
|
9333
9339
|
|
|
9334
9340
|
const preparePage = async (page: {
|
|
9335
|
-
rows:
|
|
9341
|
+
rows: Record<string, unknown>[];
|
|
9336
9342
|
offset: number;
|
|
9337
9343
|
}): Promise<PreparedPage> => {
|
|
9338
9344
|
this.assertRowAdmissionOpen();
|
|
9339
|
-
sourceRowsCount += page.rows.length;
|
|
9340
9345
|
const pageRawItems = page.rows.map((item, index) => {
|
|
9341
9346
|
const row = this.toOutputRow(item as Record<string, unknown>);
|
|
9342
9347
|
const sourceIdentity = getPlayDatasetSourceRowIdentityAt(
|
|
@@ -9421,6 +9426,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
9421
9426
|
: seededItems;
|
|
9422
9427
|
if (options?.mode === 'net_new') {
|
|
9423
9428
|
totalInputCount += admittedSeededItems.length;
|
|
9429
|
+
sourceRowsCount += admittedSeededItems.length;
|
|
9424
9430
|
}
|
|
9425
9431
|
|
|
9426
9432
|
const rowsToExecuteByKey = new Map<
|
|
@@ -9809,6 +9815,13 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
9809
9815
|
},
|
|
9810
9816
|
},
|
|
9811
9817
|
);
|
|
9818
|
+
const preparedPages: AsyncIterable<PreparedPage> = {
|
|
9819
|
+
async *[Symbol.asyncIterator]() {
|
|
9820
|
+
for await (const page of sourcePages) {
|
|
9821
|
+
yield await preparePage(page);
|
|
9822
|
+
}
|
|
9823
|
+
},
|
|
9824
|
+
};
|
|
9812
9825
|
|
|
9813
9826
|
if (pipelinePages) {
|
|
9814
9827
|
// One worker pool for the whole source. Once page N's last row has
|
|
@@ -9830,10 +9843,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
9830
9843
|
latestPageMemoryEstimate = prepared.memoryEstimate;
|
|
9831
9844
|
rowFeed.append(prepared.rows.length);
|
|
9832
9845
|
};
|
|
9833
|
-
const pageIterator =
|
|
9846
|
+
const pageIterator = preparedPages[Symbol.asyncIterator]();
|
|
9834
9847
|
const firstPage = await pageIterator.next();
|
|
9835
9848
|
if (!firstPage.done) {
|
|
9836
|
-
appendPreparedPage(
|
|
9849
|
+
appendPreparedPage(firstPage.value);
|
|
9837
9850
|
}
|
|
9838
9851
|
const pump = (async () => {
|
|
9839
9852
|
try {
|
|
@@ -9842,7 +9855,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
9842
9855
|
await rowFeed.waitUntilDrained();
|
|
9843
9856
|
const next = await pageIterator.next();
|
|
9844
9857
|
if (next.done) break;
|
|
9845
|
-
appendPreparedPage(
|
|
9858
|
+
appendPreparedPage(next.value);
|
|
9846
9859
|
}
|
|
9847
9860
|
}
|
|
9848
9861
|
rowFeed.close();
|
|
@@ -9870,8 +9883,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
9870
9883
|
await pump;
|
|
9871
9884
|
}
|
|
9872
9885
|
} else {
|
|
9873
|
-
for await (const
|
|
9874
|
-
const prepared = await preparePage(page);
|
|
9886
|
+
for await (const prepared of preparedPages) {
|
|
9875
9887
|
await runPreparedRows({
|
|
9876
9888
|
rows: prepared.rows,
|
|
9877
9889
|
rowKeys: prepared.rowKeys,
|
|
@@ -10790,11 +10802,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
10790
10802
|
);
|
|
10791
10803
|
const durableCompletedRows = durableProgress.completedRows;
|
|
10792
10804
|
const durableFailedRows = durableProgress.failedRows;
|
|
10805
|
+
// Duplicate inputs reuse their representative's outcome; they do not
|
|
10806
|
+
// establish a successful row when that representative failed.
|
|
10807
|
+
const allAdmittedRowsFailed =
|
|
10808
|
+
durableFailedRows > 0 && durableCompletedRows - reusedCount === 0;
|
|
10793
10809
|
const terminalFrame = this.checkpoint.mapFrames?.[mapScope.mapInvocationId];
|
|
10794
10810
|
if (terminalFrame) {
|
|
10795
10811
|
this.setMapFrame({
|
|
10796
10812
|
...terminalFrame,
|
|
10797
|
-
status: 'completed',
|
|
10813
|
+
status: allAdmittedRowsFailed ? 'failed' : 'completed',
|
|
10798
10814
|
// Incremental rows add keys after their commit. Pure maps use the
|
|
10799
10815
|
// durable aggregate count below instead of materializing up to millions
|
|
10800
10816
|
// of keys only to mark the terminal frame.
|
|
@@ -10812,7 +10828,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
10812
10828
|
});
|
|
10813
10829
|
}
|
|
10814
10830
|
this.emitExecutionEvent({
|
|
10815
|
-
type: 'map.completed',
|
|
10831
|
+
type: allAdmittedRowsFailed ? 'map.failed' : 'map.completed',
|
|
10816
10832
|
mapInvocationId: mapScope.mapInvocationId,
|
|
10817
10833
|
mapNodeId: mapScope.mapNodeId ?? null,
|
|
10818
10834
|
logicalNamespace: mapScope.logicalNamespace,
|
|
@@ -10882,6 +10898,17 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
10882
10898
|
staticPipeline: this.currentStaticPipeline,
|
|
10883
10899
|
});
|
|
10884
10900
|
|
|
10901
|
+
// In-memory inputs have the same failure contract as streamed inputs:
|
|
10902
|
+
// preserve every failed row, then fail rather than return an empty success.
|
|
10903
|
+
if (allAdmittedRowsFailed) {
|
|
10904
|
+
throw new AllAdmittedRowsFailedError({
|
|
10905
|
+
mapName: normalizedMapNamespace,
|
|
10906
|
+
failedCount: durableFailedRows,
|
|
10907
|
+
totalInputCount: durableFailedRows,
|
|
10908
|
+
samples: mapResult.failureSamples,
|
|
10909
|
+
});
|
|
10910
|
+
}
|
|
10911
|
+
|
|
10885
10912
|
// This map's terminal rows have already crossed the persistence barrier
|
|
10886
10913
|
// above. Keep that verified snapshot as the authored return value instead
|
|
10887
10914
|
// of immediately re-reading the Runtime Sheet projection. A second read
|
|
@@ -11682,7 +11709,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
11682
11709
|
currentCellMeta &&
|
|
11683
11710
|
typeof currentCellMeta === 'object' &&
|
|
11684
11711
|
!Array.isArray(currentCellMeta)
|
|
11685
|
-
? (currentCellMeta as {
|
|
11712
|
+
? (currentCellMeta as {
|
|
11713
|
+
status?: unknown;
|
|
11714
|
+
reused?: unknown;
|
|
11715
|
+
completedAt?: unknown;
|
|
11716
|
+
})
|
|
11686
11717
|
: null;
|
|
11687
11718
|
const currentCellStatus = currentCellRecord?.status ?? null;
|
|
11688
11719
|
if (currentCellStatus === 'skipped') {
|
|
@@ -11720,7 +11751,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
11720
11751
|
status: cellWasReused ? 'cached' : 'completed',
|
|
11721
11752
|
stage: cellWasReused ? 'cached' : 'completed',
|
|
11722
11753
|
...(cellWasReused ? { reused: true } : {}),
|
|
11723
|
-
completedAt:
|
|
11754
|
+
completedAt:
|
|
11755
|
+
cellWasReused &&
|
|
11756
|
+
typeof currentCellRecord?.completedAt === 'number' &&
|
|
11757
|
+
Number.isFinite(currentCellRecord.completedAt)
|
|
11758
|
+
? currentCellRecord.completedAt
|
|
11759
|
+
: Date.now(),
|
|
11724
11760
|
dataPatch: shouldPersistMapCellField(fieldName)
|
|
11725
11761
|
? { [fieldName]: cellValue }
|
|
11726
11762
|
: {},
|
|
@@ -11789,12 +11825,25 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
11789
11825
|
});
|
|
11790
11826
|
// Each row retains its own deadline. Provider names are not rate
|
|
11791
11827
|
// scopes: two credentials for one provider can recover separately.
|
|
11828
|
+
const observedNowMs = Date.now();
|
|
11829
|
+
const localRetryAtMs = error.localRetryAtMs ?? error.retryAtMs;
|
|
11830
|
+
const readyAtMs =
|
|
11831
|
+
localRetryAtMs <= observedNowMs
|
|
11832
|
+
? observedNowMs + 1_000
|
|
11833
|
+
: localRetryAtMs;
|
|
11792
11834
|
retryAfterRelease.pending = {
|
|
11793
11835
|
rowIndex: idx,
|
|
11794
11836
|
provider: error.provider,
|
|
11795
11837
|
retryAtMs: error.retryAtMs,
|
|
11796
|
-
|
|
11797
|
-
|
|
11838
|
+
// Honor a future provider deadline without extending its hold.
|
|
11839
|
+
// Only expired deadlines need the anti-spin retry backoff.
|
|
11840
|
+
readyAtMs,
|
|
11841
|
+
// This queue bit forces idle handoff for a spent call whose
|
|
11842
|
+
// provider deadline already expired. A future deadline can use
|
|
11843
|
+
// the map's separate bounded idle wait without renewing the
|
|
11844
|
+
// logical call's sticky resident-wait budget.
|
|
11845
|
+
...(error.residentWaitBudgetExhausted &&
|
|
11846
|
+
localRetryAtMs <= observedNowMs
|
|
11798
11847
|
? { residentWaitBudgetExhausted: true }
|
|
11799
11848
|
: {}),
|
|
11800
11849
|
};
|
|
@@ -11823,6 +11872,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
11823
11872
|
provider: error.provider,
|
|
11824
11873
|
retry_at: new Date(error.retryAtMs).toISOString(),
|
|
11825
11874
|
wait_ms: Math.max(0, error.retryAtMs - Date.now()),
|
|
11875
|
+
...(error.localRetryAtMs !== undefined
|
|
11876
|
+
? {
|
|
11877
|
+
local_retry_at: new Date(
|
|
11878
|
+
error.localRetryAtMs,
|
|
11879
|
+
).toISOString(),
|
|
11880
|
+
}
|
|
11881
|
+
: {}),
|
|
11882
|
+
ready_at: new Date(readyAtMs).toISOString(),
|
|
11883
|
+
resident_wait_budget_exhausted: error.residentWaitBudgetExhausted,
|
|
11826
11884
|
row_key_digest: stableDigest(rowKey),
|
|
11827
11885
|
field: fieldName,
|
|
11828
11886
|
})}`,
|
|
@@ -11979,8 +12037,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
11979
12037
|
? parkedProviderRows.takeReady(Date.now())
|
|
11980
12038
|
: providerRowRetries.takeReady(Date.now());
|
|
11981
12039
|
if (!providerRetry && nextRowIndex >= items.length) {
|
|
11982
|
-
// Spent
|
|
11983
|
-
//
|
|
12040
|
+
// Spent zero/expired holds may join productive work, but cannot keep
|
|
12041
|
+
// an otherwise idle sandbox waiting past the artificial ready floor.
|
|
11984
12042
|
const nextRetry = nextProviderRetry(mapProgress.activeResolvers > 0);
|
|
11985
12043
|
if (
|
|
11986
12044
|
nextRetry &&
|
|
@@ -12331,11 +12389,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
12331
12389
|
const parkedHold = parkedProviderRows.peek();
|
|
12332
12390
|
const earliestHold =
|
|
12333
12391
|
!residentHold ||
|
|
12334
|
-
(parkedHold && parkedHold.
|
|
12392
|
+
(parkedHold && parkedHold.readyAtMs < residentHold.readyAtMs)
|
|
12335
12393
|
? parkedHold
|
|
12336
12394
|
: residentHold;
|
|
12337
12395
|
const providerWakeAtMs = earliestHold
|
|
12338
|
-
? Math.max(Date.now() + 1_000, earliestHold.
|
|
12396
|
+
? Math.max(Date.now() + 1_000, earliestHold.readyAtMs)
|
|
12339
12397
|
: null;
|
|
12340
12398
|
const checkpointUpdates = this.activeMapCheckpointUpdatesForTable(
|
|
12341
12399
|
normalizedTableNamespace,
|
|
@@ -13165,9 +13223,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
13165
13223
|
requests: ToolCallRequest[];
|
|
13166
13224
|
laneKeys: Set<string>;
|
|
13167
13225
|
nextDeadlineMs: number | null;
|
|
13226
|
+
pendingResolverHostTurn: Promise<void> | null;
|
|
13168
13227
|
} {
|
|
13169
13228
|
if (this.toolCallQueue.length === 0) {
|
|
13170
|
-
return {
|
|
13229
|
+
return {
|
|
13230
|
+
requests: [],
|
|
13231
|
+
laneKeys: new Set(),
|
|
13232
|
+
nextDeadlineMs: null,
|
|
13233
|
+
pendingResolverHostTurn: null,
|
|
13234
|
+
};
|
|
13171
13235
|
}
|
|
13172
13236
|
|
|
13173
13237
|
const laneCounts = new Map<string, number>();
|
|
@@ -13224,6 +13288,27 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
13224
13288
|
remainingLaneKeys.add(lane.key);
|
|
13225
13289
|
}
|
|
13226
13290
|
}
|
|
13291
|
+
// A CPU fairness yield can interrupt admission of an already-ready row
|
|
13292
|
+
// cohort. Keep full groups moving, but do not split its native-batch tail
|
|
13293
|
+
// merely because those same-run resolvers are joining their host turn.
|
|
13294
|
+
// This joins the existing yield, never a provider or another run's work.
|
|
13295
|
+
if (
|
|
13296
|
+
requests.length > 0 &&
|
|
13297
|
+
requests.length < this.governor.policy.concurrency.toolCalls &&
|
|
13298
|
+
this.mappedResolverHostTurn &&
|
|
13299
|
+
requests.some(
|
|
13300
|
+
(request) =>
|
|
13301
|
+
(this.#options.getBatchOperationStrategy?.(request.toolId)
|
|
13302
|
+
?.maxBatchSize ?? 1) > 1,
|
|
13303
|
+
)
|
|
13304
|
+
) {
|
|
13305
|
+
return {
|
|
13306
|
+
requests: [],
|
|
13307
|
+
laneKeys: new Set(),
|
|
13308
|
+
nextDeadlineMs: null,
|
|
13309
|
+
pendingResolverHostTurn: this.mappedResolverHostTurn,
|
|
13310
|
+
};
|
|
13311
|
+
}
|
|
13227
13312
|
this.toolCallQueue = remaining;
|
|
13228
13313
|
const selectedLaneKeys = new Set(selectedByLane.keys());
|
|
13229
13314
|
for (const laneKey of selectedLaneKeys) {
|
|
@@ -13231,7 +13316,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
13231
13316
|
this.toolDispatchQueuedAtByLane.delete(laneKey);
|
|
13232
13317
|
}
|
|
13233
13318
|
}
|
|
13234
|
-
return {
|
|
13319
|
+
return {
|
|
13320
|
+
requests,
|
|
13321
|
+
laneKeys: selectedLaneKeys,
|
|
13322
|
+
nextDeadlineMs,
|
|
13323
|
+
pendingResolverHostTurn: null,
|
|
13324
|
+
};
|
|
13235
13325
|
}
|
|
13236
13326
|
|
|
13237
13327
|
private waitForToolDispatcherWake(deadlineMs: number | null): Promise<void> {
|
|
@@ -13434,6 +13524,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
13434
13524
|
promises: Promise<T>[],
|
|
13435
13525
|
earlyExitCheck?: () => RuntimeToolDrainExit | null,
|
|
13436
13526
|
): Promise<void> {
|
|
13527
|
+
const dispatcherStartedAt = performance.now();
|
|
13437
13528
|
// One dispatcher owns ready work, fixed lane coalescing deadlines, and the
|
|
13438
13529
|
// bounded in-flight registry. A row resumes after its own receipt persists;
|
|
13439
13530
|
// it never waits for unrelated sibling calls from the previous column.
|
|
@@ -13493,6 +13584,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
13493
13584
|
// handle open without polling scheduler state; actual work wakes the
|
|
13494
13585
|
// dispatcher through queue/in-flight/row-settlement signals.
|
|
13495
13586
|
const keepAlive = setInterval(() => undefined, 1_000);
|
|
13587
|
+
let dispatchedAny = false;
|
|
13496
13588
|
try {
|
|
13497
13589
|
let pass = 0;
|
|
13498
13590
|
while (true) {
|
|
@@ -13540,12 +13632,18 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
13540
13632
|
requests: [] as ToolCallRequest[],
|
|
13541
13633
|
laneKeys: new Set<string>(),
|
|
13542
13634
|
nextDeadlineMs: null,
|
|
13635
|
+
pendingResolverHostTurn: null,
|
|
13543
13636
|
}
|
|
13544
13637
|
: this.takeDispatchableToolCalls(
|
|
13545
13638
|
this.toolBatchDispatcherNowMs(),
|
|
13546
13639
|
blockedLaneKeys,
|
|
13547
13640
|
);
|
|
13641
|
+
if (dispatchable.pendingResolverHostTurn) {
|
|
13642
|
+
await dispatchable.pendingResolverHostTurn;
|
|
13643
|
+
continue;
|
|
13644
|
+
}
|
|
13548
13645
|
if (dispatchable.requests.length > 0) {
|
|
13646
|
+
dispatchedAny = true;
|
|
13549
13647
|
pass += 1;
|
|
13550
13648
|
this.runtimeLog(` Batch pass ${pass}`);
|
|
13551
13649
|
this.runtimeLog(
|
|
@@ -13622,9 +13720,43 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
13622
13720
|
}
|
|
13623
13721
|
} finally {
|
|
13624
13722
|
clearInterval(keepAlive);
|
|
13723
|
+
if (dispatchedAny) {
|
|
13724
|
+
this.logRunnerDiagnostic(
|
|
13725
|
+
`[perf-trace] ${JSON.stringify({
|
|
13726
|
+
ts: Date.now(),
|
|
13727
|
+
source: 'runner',
|
|
13728
|
+
runId: this.currentRunId,
|
|
13729
|
+
phase: 'runner.map_work_drain.total',
|
|
13730
|
+
ms: Math.max(0, performance.now() - dispatcherStartedAt),
|
|
13731
|
+
})}`,
|
|
13732
|
+
);
|
|
13733
|
+
}
|
|
13625
13734
|
}
|
|
13626
13735
|
}
|
|
13627
13736
|
|
|
13737
|
+
private mappedResolverHostPause(): Promise<void> | null {
|
|
13738
|
+
if (this.mappedResolverHostTurn) return this.mappedResolverHostTurn;
|
|
13739
|
+
const now = performance.now();
|
|
13740
|
+
this.mappedResolverHostTurnAt ??= now;
|
|
13741
|
+
if (
|
|
13742
|
+
now - this.mappedResolverHostTurnAt <
|
|
13743
|
+
MAPPED_RESOLVER_HOST_TURN_BUDGET_MS
|
|
13744
|
+
)
|
|
13745
|
+
return null;
|
|
13746
|
+
let resolveTurn!: () => void;
|
|
13747
|
+
const turn = new Promise<void>((resolve) => {
|
|
13748
|
+
resolveTurn = resolve;
|
|
13749
|
+
});
|
|
13750
|
+
this.mappedResolverHostTurn = turn;
|
|
13751
|
+
const resume = () => {
|
|
13752
|
+
this.mappedResolverHostTurnAt = performance.now();
|
|
13753
|
+
this.mappedResolverHostTurn = null;
|
|
13754
|
+
resolveTurn();
|
|
13755
|
+
};
|
|
13756
|
+
setTimeout(resume, 0);
|
|
13757
|
+
return turn;
|
|
13758
|
+
}
|
|
13759
|
+
|
|
13628
13760
|
private async resolveMapFieldValue<T>(
|
|
13629
13761
|
resolver: MapFieldResolver<T>,
|
|
13630
13762
|
row: T,
|
|
@@ -13636,6 +13768,16 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
13636
13768
|
return resolver;
|
|
13637
13769
|
}
|
|
13638
13770
|
|
|
13771
|
+
for (;;) {
|
|
13772
|
+
const pause = this.mappedResolverHostPause();
|
|
13773
|
+
if (pause === null) break;
|
|
13774
|
+
await pause;
|
|
13775
|
+
// Each resumed worker rechecks the shared budget before calling user
|
|
13776
|
+
// code. A row-local cancellation must never reject the shared barrier.
|
|
13777
|
+
// Admission deadlines still allow already-admitted rows to finish.
|
|
13778
|
+
this.assertNoPendingDurableSuspension();
|
|
13779
|
+
}
|
|
13780
|
+
|
|
13639
13781
|
let value: unknown;
|
|
13640
13782
|
try {
|
|
13641
13783
|
value = await resolver(row, this, fields, index, previousCell);
|
|
@@ -14016,6 +14158,32 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
14016
14158
|
if (freshness.source !== 'executed') {
|
|
14017
14159
|
const row = rowContext.getStore();
|
|
14018
14160
|
if (row?.fieldName && row.tableNamespace && row.rowKey) {
|
|
14161
|
+
// Recovery resumes this intended call. Its durable trace may
|
|
14162
|
+
// already contain the producer; appending it again would count
|
|
14163
|
+
// every replay as another logical call. A new reusable-result
|
|
14164
|
+
// read still records its own cached attempt.
|
|
14165
|
+
let recoveredAttempt: PlayCellProducerAttempt | undefined;
|
|
14166
|
+
if (freshness.source === 'operation_recovery') {
|
|
14167
|
+
const { producers = [] } = this.resolveCellProducers(
|
|
14168
|
+
row.rowKey,
|
|
14169
|
+
row.fieldName,
|
|
14170
|
+
);
|
|
14171
|
+
for (let index = producers.length - 1; index >= 0; index -= 1) {
|
|
14172
|
+
const attempt = producers[index]!;
|
|
14173
|
+
if (
|
|
14174
|
+
attempt.kind === 'tool' &&
|
|
14175
|
+
attempt.id === normalizedKey &&
|
|
14176
|
+
attempt.toolId === toolId
|
|
14177
|
+
) {
|
|
14178
|
+
recoveredAttempt = attempt;
|
|
14179
|
+
break;
|
|
14180
|
+
}
|
|
14181
|
+
}
|
|
14182
|
+
}
|
|
14183
|
+
if (recoveredAttempt?.outcome === 'running') {
|
|
14184
|
+
recoveredAttempt.outcome = 'cached';
|
|
14185
|
+
delete recoveredAttempt.waiting;
|
|
14186
|
+
}
|
|
14019
14187
|
this.emitScopedFieldMetaUpdate({
|
|
14020
14188
|
rowId: row.rowId,
|
|
14021
14189
|
key: row.rowKey,
|
|
@@ -14027,6 +14195,28 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
14027
14195
|
provider: null,
|
|
14028
14196
|
error: null,
|
|
14029
14197
|
reused: true,
|
|
14198
|
+
// Reuse bypasses the dispatcher that normally records the
|
|
14199
|
+
// cell's producer. Keep the source observation's timestamp;
|
|
14200
|
+
// reading a receipt is not a new provider observation.
|
|
14201
|
+
completedAt: freshness.completedAt,
|
|
14202
|
+
producer: {
|
|
14203
|
+
kind: 'tool',
|
|
14204
|
+
id: normalizedKey,
|
|
14205
|
+
toolId,
|
|
14206
|
+
displayName: displayNameFromProducerId(toolId),
|
|
14207
|
+
},
|
|
14208
|
+
...(!recoveredAttempt
|
|
14209
|
+
? {
|
|
14210
|
+
producerAttempt: {
|
|
14211
|
+
kind: 'tool' as const,
|
|
14212
|
+
id: normalizedKey,
|
|
14213
|
+
toolId,
|
|
14214
|
+
at: freshness.completedAt,
|
|
14215
|
+
outcome: 'cached' as const,
|
|
14216
|
+
durationMs: 0,
|
|
14217
|
+
},
|
|
14218
|
+
}
|
|
14219
|
+
: {}),
|
|
14030
14220
|
dataPatch: {},
|
|
14031
14221
|
});
|
|
14032
14222
|
}
|
|
@@ -16943,6 +17133,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
16943
17133
|
observeRuntimeGatewayResponse(meta: RuntimeApiResponseMeta): void {
|
|
16944
17134
|
const timing = meta.serverTiming ?? null;
|
|
16945
17135
|
this.resourceGovernor.observe({
|
|
17136
|
+
gatewayAction: meta.action,
|
|
17137
|
+
gatewayResponseFlightMs: meta.responseFlightMs ?? null,
|
|
17138
|
+
gatewayResponseHeadersMs: meta.responseHeadersMs ?? null,
|
|
17139
|
+
gatewayResponseBodyDecodeMs: meta.responseBodyDecodeMs ?? null,
|
|
16946
17140
|
gatewayRoundTripMs: meta.roundTripMs ?? null,
|
|
16947
17141
|
gatewayAuthLaunchMs: timing?.authLaunchMs ?? null,
|
|
16948
17142
|
gatewayAuthVerifyMs: timing?.authVerifyMs ?? null,
|
|
@@ -19318,13 +19512,16 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
19318
19512
|
networkScope: null,
|
|
19319
19513
|
},
|
|
19320
19514
|
);
|
|
19321
|
-
const observeProviderWait = (
|
|
19515
|
+
const observeProviderWait = (
|
|
19516
|
+
retryAtMs: number,
|
|
19517
|
+
noProgressRetryAtMs = retryAtMs,
|
|
19518
|
+
) => {
|
|
19322
19519
|
const startedAtMsByScope =
|
|
19323
19520
|
(this.checkpoint.providerNoProgressStartedAtMsByScope ??= {});
|
|
19324
19521
|
const outcome = observeProviderNoProgress({
|
|
19325
19522
|
startedAtMsByScope,
|
|
19326
19523
|
scope: providerNoProgressScope,
|
|
19327
|
-
retryAtMs,
|
|
19524
|
+
retryAtMs: noProgressRetryAtMs,
|
|
19328
19525
|
nowMs: Date.now(),
|
|
19329
19526
|
});
|
|
19330
19527
|
if (!outcome.exhausted) return;
|
|
@@ -20939,11 +21136,17 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
20939
21136
|
}
|
|
20940
21137
|
if (error instanceof ProviderExhaustedError) {
|
|
20941
21138
|
const retryAtMs = Date.parse(error.retryAt);
|
|
21139
|
+
const localRetryAtMs = error.localRetryAtMs ?? retryAtMs;
|
|
20942
21140
|
observeProviderWait(
|
|
20943
21141
|
Number.isFinite(retryAtMs) ? retryAtMs : Date.now() + 1_000,
|
|
21142
|
+
Number.isFinite(localRetryAtMs)
|
|
21143
|
+
? localRetryAtMs
|
|
21144
|
+
: Number.isFinite(retryAtMs)
|
|
21145
|
+
? retryAtMs
|
|
21146
|
+
: Date.now() + 1_000,
|
|
20944
21147
|
);
|
|
20945
|
-
const waitMs = Number.isFinite(
|
|
20946
|
-
? Math.max(0, Math.ceil(
|
|
21148
|
+
const waitMs = Number.isFinite(localRetryAtMs)
|
|
21149
|
+
? Math.max(0, Math.ceil(localRetryAtMs - Date.now()))
|
|
20947
21150
|
: 1_000;
|
|
20948
21151
|
if (
|
|
20949
21152
|
!this.#options.durableBoundaries ||
|
|
@@ -20964,6 +21167,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
20964
21167
|
error.provider,
|
|
20965
21168
|
Number.isFinite(retryAtMs) ? retryAtMs : Date.now(),
|
|
20966
21169
|
markProviderResidentWaitBudgetExhausted(),
|
|
21170
|
+
error.localRetryAtMs,
|
|
20967
21171
|
);
|
|
20968
21172
|
}
|
|
20969
21173
|
// This is a provider admission hold, not a row outcome.
|
|
@@ -20973,7 +21177,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
20973
21177
|
// reusable and this tool can re-admit safely.
|
|
20974
21178
|
await this.waitForProviderBackpressure(
|
|
20975
21179
|
error.provider,
|
|
20976
|
-
Number.isFinite(
|
|
21180
|
+
Number.isFinite(localRetryAtMs)
|
|
21181
|
+
? localRetryAtMs
|
|
21182
|
+
: Date.now(),
|
|
20977
21183
|
);
|
|
20978
21184
|
continue;
|
|
20979
21185
|
}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import type { Daytona } from '@daytonaio/sdk';
|
|
2
|
+
import type { PlaySandboxSize } from '../plays/sandbox-runtime-limits';
|
|
2
3
|
|
|
3
4
|
export const DAYTONA_DEFAULT_WORKDIR = '/home/daytona';
|
|
4
5
|
|
|
6
|
+
// Daytona snapshots carry fixed resource allocations. Select the provider
|
|
7
|
+
// snapshot for the validated profile instead of resizing a snapshot create.
|
|
8
|
+
export const DAYTONA_SNAPSHOT_BY_PLAY_SANDBOX_SIZE = {
|
|
9
|
+
standard: 'daytona-small',
|
|
10
|
+
large: 'daytona-medium',
|
|
11
|
+
xlarge: 'daytona-large',
|
|
12
|
+
} as const satisfies Record<PlaySandboxSize, string>;
|
|
13
|
+
|
|
5
14
|
export type DaytonaClientOptions = NonNullable<
|
|
6
15
|
ConstructorParameters<typeof Daytona>[0]
|
|
7
16
|
>;
|