deepline 0.3.484 → 0.3.485
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/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 +102 -23
- 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 +204 -6
- 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 +26 -0
- 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 +649 -38
- 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-ABZBH55L.js +43 -0
- package/dist/cli/{auth-EBFOTF7X.mjs → auth-OWMUENCU.mjs} +5 -5
- package/dist/cli/{billing-G2G3EF3I.js → billing-2FMNQGOX.js} +80 -80
- package/dist/cli/{billing-2ZOIMW5V.mjs → billing-JX4H3VFF.mjs} +7 -7
- package/dist/cli/{chunk-M4PG7FGC.js → chunk-2ILND7XX.js} +2 -2
- package/dist/cli/{chunk-WXRM3UC6.mjs → chunk-2ZEQ43B7.mjs} +3 -3
- package/dist/cli/{chunk-PU52JXKA.mjs → chunk-3DBW6C7M.mjs} +13 -4
- package/dist/cli/{chunk-4OVHIWE7.mjs → chunk-3DYU3JQN.mjs} +2 -2
- package/dist/cli/{chunk-QIDDTIVZ.js → chunk-3OF7NSGR.js} +322 -294
- package/dist/cli/{chunk-YWC5AN26.mjs → chunk-3Z24NKW7.mjs} +62 -34
- package/dist/cli/{chunk-RLLEH2SP.js → chunk-5DCQWQCP.js} +26 -26
- package/dist/cli/{chunk-DEXSQGXB.mjs → chunk-62PJ6PK7.mjs} +5 -5
- package/dist/cli/{chunk-6NPWXE32.mjs → chunk-676NZ7K4.mjs} +1 -1
- package/dist/cli/{chunk-FRD5WFT4.js → chunk-775AZTO7.js} +323 -247
- package/dist/cli/{chunk-4OEOM6GP.mjs → chunk-ACTUAZYP.mjs} +5 -5
- package/dist/cli/{chunk-ZOKM7DVA.js → chunk-AFADYKFE.js} +8 -8
- package/dist/cli/{chunk-GVAENVIG.js → chunk-AUQQVDAB.js} +110 -21
- package/dist/cli/{chunk-U7IJAGWB.js → chunk-BSKPQB2P.js} +7 -7
- package/dist/cli/chunk-C6QWRSMQ.js +42 -0
- package/dist/cli/{chunk-AK7UKQ5R.js → chunk-CSBMKHTV.js} +5 -5
- package/dist/cli/{chunk-YHA3EV3I.mjs → chunk-CW6TAQBF.mjs} +15 -4
- package/dist/cli/{chunk-UT4YMA2N.js → chunk-DMNVM34J.js} +5 -4
- package/dist/cli/{chunk-XZXIWPT3.mjs → chunk-E73JXJA3.mjs} +1 -1
- package/dist/cli/{chunk-5KNRQWHE.js → chunk-EC2CVPN5.js} +3 -3
- package/dist/cli/{chunk-IXWQOVNW.js → chunk-ECIXZNSW.js} +87 -76
- package/dist/cli/{chunk-LTZXLYKE.mjs → chunk-FJY6K3BG.mjs} +93 -17
- package/dist/cli/{chunk-TRLDJNVE.mjs → chunk-G5PI3RNT.mjs} +1 -1
- package/dist/cli/{chunk-WYUCDLVR.mjs → chunk-GHHJWCMD.mjs} +2 -1
- package/dist/cli/{chunk-FQK7BULS.js → chunk-HKGXGGIV.js} +1 -1
- package/dist/cli/{chunk-2AWYJXBX.js → chunk-IHMYIHF4.js} +5 -5
- 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-TIRSKEZH.mjs → chunk-JD6HKNKD.mjs} +1 -1
- package/dist/cli/{chunk-OHKKDPA5.js → chunk-JQXUWYWX.js} +13 -13
- package/dist/cli/{chunk-EACX7QXO.mjs → chunk-KZTNNLIL.mjs} +2 -2
- package/dist/cli/{chunk-7K5CWKKZ.mjs → chunk-L352NOE3.mjs} +2 -2
- package/dist/cli/{chunk-KGOC6HGI.js → chunk-L7IQ3DFH.js} +53 -53
- package/dist/cli/{chunk-4IOY2SCQ.js → chunk-LOX3BISD.js} +4 -4
- package/dist/cli/{chunk-6GRZEYSG.js → chunk-NKPTM7SK.js} +7 -7
- package/dist/cli/{chunk-VEVGM6B5.js → chunk-NLRTFJGH.js} +14 -14
- package/dist/cli/{chunk-UKM74PAA.js → chunk-NRNWPWBW.js} +37 -37
- package/dist/cli/{chunk-HNRELVCS.mjs → chunk-ONONSV2Q.mjs} +96 -7
- package/dist/cli/{chunk-CYWBAV5H.js → chunk-OW4OTEFF.js} +16 -16
- package/dist/cli/{chunk-5K5CAND4.mjs → chunk-RZE5I2XJ.mjs} +4 -4
- package/dist/cli/{chunk-3XQIVEAT.js → chunk-S3WQJ5VG.js} +3 -3
- package/dist/cli/{chunk-4SFC2XUF.mjs → chunk-SR6S4EYG.mjs} +5 -5
- package/dist/cli/{chunk-UWOY74RU.js → chunk-T4G2T5DS.js} +21 -21
- package/dist/cli/{chunk-TN2GW57M.mjs → chunk-TMCC7ORQ.mjs} +1 -1
- package/dist/cli/{chunk-HEI3BWIV.mjs → chunk-TSCUWWTM.mjs} +1 -1
- package/dist/cli/{chunk-DBJ62RAO.js → chunk-TVW6USSG.js} +3 -3
- package/dist/cli/{chunk-NW4QJE54.js → chunk-U6WEGDD3.js} +2 -2
- package/dist/cli/{chunk-V7JCMBLU.mjs → chunk-UPHXGZCE.mjs} +4 -4
- package/dist/cli/{chunk-C62NI2X6.js → chunk-UQ3LQ6IF.js} +5 -5
- package/dist/cli/{chunk-5GOG5ZGC.mjs → chunk-VZYTLWOM.mjs} +2 -2
- package/dist/cli/{chunk-AF7MOUZP.mjs → chunk-W33OL4F2.mjs} +2 -2
- 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-YGN77QA5.mjs → chunk-YDA3PMKK.mjs} +3 -3
- package/dist/cli/{csv-S3CHUKI6.js → csv-HFEQPGNY.js} +13 -13
- package/dist/cli/{csv-NLWVWD3H.mjs → csv-OHF3Y5KB.mjs} +4 -4
- package/dist/cli/{db-OGRPAEEM.mjs → db-M456OUXD.mjs} +7 -7
- package/dist/cli/{db-WBSKMMOH.js → db-VLQKCYQS.js} +28 -28
- package/dist/cli/describe-CP35DZ5Z.js +49 -0
- package/dist/cli/{describe-FAD3Z7LN.mjs → describe-M6VXFYVL.mjs} +21 -21
- 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-4FGRBPJF.mjs} +7 -7
- package/dist/cli/{executions-SOAZHCY4.js → executions-GKINJZI6.js} +9 -9
- package/dist/cli/{feedback-AVF6V7SV.mjs → feedback-D2WMGK3V.mjs} +4 -4
- package/dist/cli/{feedback-OROUPUNJ.js → feedback-ZH5K7WV7.js} +8 -8
- package/dist/cli/git-IDALMZDN.js +25 -0
- package/dist/cli/{git-J5N5M57H.mjs → git-OCIJ5ME4.mjs} +5 -5
- package/dist/cli/index.js +142 -139
- package/dist/cli/index.mjs +45 -42
- package/dist/cli/{legacy-noops-QAQMZMEG.js → legacy-noops-QNIVP7LO.js} +8 -8
- package/dist/cli/{legacy-noops-ENRRM7BL.mjs → legacy-noops-V6Q2X34P.mjs} +5 -5
- package/dist/cli/{monitors-CKQ65WRL.mjs → monitors-2USHTG5G.mjs} +8 -8
- package/dist/cli/{monitors-SFMQ5LFR.js → monitors-5DNK7W2K.js} +92 -92
- package/dist/cli/{org-3UNTDLT2.js → org-RPGM5AN4.js} +73 -73
- package/dist/cli/{org-K4UIEU5P.mjs → org-TL2YPYSE.mjs} +7 -7
- package/dist/cli/{pages-NKZTGB4C.js → pages-PNUKPFWV.js} +18 -18
- package/dist/cli/{pages-6GPGBIAH.mjs → pages-XDEW6EE3.mjs} +7 -7
- package/dist/cli/{play-BDEADESI.js → play-F5LHRKV5.js} +858 -632
- package/dist/cli/{play-62BEE7IX.mjs → play-WINNQ4HZ.mjs} +372 -146
- package/dist/cli/{providers-SXGP44GH.js → providers-BD4IS5U5.js} +10 -10
- package/dist/cli/{providers-X3CUWMFP.mjs → providers-PXGL3FRE.mjs} +7 -7
- package/dist/cli/{quickstart-XQ4426M4.js → quickstart-7LVF6HZF.js} +6 -6
- package/dist/cli/{quickstart-7LN22BKX.mjs → quickstart-XTH3UQWZ.mjs} +4 -4
- package/dist/cli/{run-XXSN3B5A.mjs → run-MBMUENR7.mjs} +26 -26
- package/dist/cli/{run-PBJ4ZJ4W.js → run-NH2BAWPA.js} +41 -41
- package/dist/cli/{search-M75VMADD.mjs → search-BMRWBV66.mjs} +8 -8
- package/dist/cli/search-R3MQJQMT.js +32 -0
- package/dist/cli/{search-output-F6HCFYEI.js → search-output-5NNT337U.js} +22 -16
- package/dist/cli/{search-output-NUQAKWDM.mjs → search-output-QKKRD4MF.mjs} +14 -8
- package/dist/cli/{secrets-J2H6V33R.mjs → secrets-AWEXBTJV.mjs} +7 -7
- package/dist/cli/{secrets-LRYY4QPE.js → secrets-KQSTOREN.js} +16 -16
- package/dist/cli/{sessions-YPF62CZE.js → sessions-DSPLZYCJ.js} +6 -6
- package/dist/cli/{sessions-IMT336UV.mjs → sessions-RO25Q67X.mjs} +5 -5
- package/dist/cli/{settings-35YYC5WA.js → settings-7JXIKNKI.js} +79 -79
- package/dist/cli/{settings-PDWVQIGH.mjs → settings-JMGXGK4Z.mjs} +12 -12
- package/dist/cli/{setup-UR7GOR7H.js → setup-5QFAQQRW.js} +47 -47
- package/dist/cli/{setup-DG5DISSE.mjs → setup-ZQZ47FHB.mjs} +9 -9
- package/dist/cli/skills-EDZXY7DV.js +33 -0
- package/dist/cli/{skills-U6NJD5J7.mjs → skills-W3H2DL56.mjs} +7 -7
- package/dist/cli/{tools-2HGEOELR.mjs → tools-2BZCVNBS.mjs} +19 -19
- package/dist/cli/tools-2EY2ETCZ.js +56 -0
- package/dist/cli/{update-FRAYBAHK.mjs → update-GAWYMGAW.mjs} +9 -9
- package/dist/cli/update-UKDQKNBY.js +33 -0
- package/dist/cli/{workflow-DDKVTF36.mjs → workflow-M6LLHQ2I.mjs} +8 -8
- package/dist/cli/{workflow-JKKLOMBX.js → workflow-ZPTDFPKW.js} +18 -18
- 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
|
@@ -171,6 +171,11 @@ export type RuntimeResourceObservation = {
|
|
|
171
171
|
gatewayCallbackMs?: number | null;
|
|
172
172
|
/** Client-measured wall of that same request, for the client/server split. */
|
|
173
173
|
gatewayRoundTripMs?: number | null;
|
|
174
|
+
/** One successful physical response, not one observation per receipt. */
|
|
175
|
+
gatewayAction?: string | null;
|
|
176
|
+
gatewayResponseFlightMs?: number | null;
|
|
177
|
+
gatewayResponseHeadersMs?: number | null;
|
|
178
|
+
gatewayResponseBodyDecodeMs?: number | null;
|
|
174
179
|
/** Runner CPU-path wall before the request starts: JSON serialization once. */
|
|
175
180
|
gatewayRequestSerializeMs?: number | null;
|
|
176
181
|
/** Runner CPU-path wall before the request starts: request wire packing. */
|
|
@@ -420,6 +425,16 @@ export type RuntimeResourceSnapshot = {
|
|
|
420
425
|
* verification, which the gateway's own action logs do not show.
|
|
421
426
|
*/
|
|
422
427
|
gateway: {
|
|
428
|
+
/**
|
|
429
|
+
* Successful responding physical flights only; failed retry attempts remain
|
|
430
|
+
* in retry telemetry. Fixed families never retain action strings or IDs.
|
|
431
|
+
* rowUpdates covers app-runtime apply_row_updates/save_results, not the
|
|
432
|
+
* separate native Runtime Sheet SQL transport. Older snapshots omit this.
|
|
433
|
+
*/
|
|
434
|
+
successfulFlights?: Record<
|
|
435
|
+
RuntimeGatewayOperationFamily,
|
|
436
|
+
RuntimeGatewayFlightTiming
|
|
437
|
+
>;
|
|
423
438
|
authSession: {
|
|
424
439
|
hit: number;
|
|
425
440
|
miss: number;
|
|
@@ -489,8 +504,8 @@ export type RuntimeResourceSnapshot = {
|
|
|
489
504
|
}
|
|
490
505
|
>;
|
|
491
506
|
/**
|
|
492
|
-
* Process-
|
|
493
|
-
*
|
|
507
|
+
* Process-lifetime totals at snapshot time, including work before this
|
|
508
|
+
* governor. These are not CPU deltas over a map or Run wall.
|
|
494
509
|
*/
|
|
495
510
|
process: {
|
|
496
511
|
cpuUserMs: number;
|
|
@@ -500,6 +515,18 @@ export type RuntimeResourceSnapshot = {
|
|
|
500
515
|
heapUsedBytes: number | null;
|
|
501
516
|
externalBytes: number | null;
|
|
502
517
|
} | null;
|
|
518
|
+
/**
|
|
519
|
+
* Process CPU observed while this governor exists, including concurrent
|
|
520
|
+
* work in the same process. Missing on older artifacts; no quota attribution.
|
|
521
|
+
*/
|
|
522
|
+
processCpuWindow?: {
|
|
523
|
+
scope: 'process_during_governor_lifetime';
|
|
524
|
+
startedAtEpochMs: number;
|
|
525
|
+
sampledAtEpochMs: number;
|
|
526
|
+
elapsedMs: number | null;
|
|
527
|
+
cpuUserMs: number | null;
|
|
528
|
+
cpuSystemMs: number | null;
|
|
529
|
+
};
|
|
503
530
|
/** Final heap-admission state of each map, keyed by table namespace. */
|
|
504
531
|
mapAdmission: Record<string, RuntimeMapHeapAdmissionSnapshot>;
|
|
505
532
|
/**
|
|
@@ -629,6 +656,98 @@ export type RuntimeExecuteStageTiming = {
|
|
|
629
656
|
maxMs: number | null;
|
|
630
657
|
};
|
|
631
658
|
|
|
659
|
+
type RuntimeGatewayOperationFamily =
|
|
660
|
+
| 'receiptClaim'
|
|
661
|
+
| 'receiptCompletion'
|
|
662
|
+
| 'receiptRead'
|
|
663
|
+
| 'rowUpdates'
|
|
664
|
+
| 'other';
|
|
665
|
+
|
|
666
|
+
type RuntimeGatewayFlightTiming = {
|
|
667
|
+
count: number;
|
|
668
|
+
/** Final successful physical send to parsed JSON, excluding bypass exchanges. */
|
|
669
|
+
roundTrip: RuntimeExecuteStageTiming;
|
|
670
|
+
headers: RuntimeExecuteStageTiming;
|
|
671
|
+
bodyDecode: RuntimeExecuteStageTiming;
|
|
672
|
+
/**
|
|
673
|
+
* Complete, nonoverlapping gateway stages only. Null when none were fully
|
|
674
|
+
* reported; partial/legacy headers never turn missing stages into zero.
|
|
675
|
+
* Its count can be below count above. Inflate and value persistence are
|
|
676
|
+
* nested stages and must not be added to this total.
|
|
677
|
+
*/
|
|
678
|
+
serverTotal: RuntimeExecuteStageTiming | null;
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
function runtimeGatewayOperationFamily(
|
|
682
|
+
action: string,
|
|
683
|
+
): RuntimeGatewayOperationFamily {
|
|
684
|
+
switch (action) {
|
|
685
|
+
case 'claim_runtime_step_receipt':
|
|
686
|
+
case 'claim_runtime_step_receipts':
|
|
687
|
+
case 'acquire_runtime_receipt_execution_lock':
|
|
688
|
+
return 'receiptClaim';
|
|
689
|
+
case 'complete_runtime_step_receipt':
|
|
690
|
+
case 'complete_runtime_step_receipts':
|
|
691
|
+
case 'complete_runtime_step_receipts_by_reference':
|
|
692
|
+
return 'receiptCompletion';
|
|
693
|
+
case 'get_runtime_step_receipt':
|
|
694
|
+
case 'get_runtime_step_receipts':
|
|
695
|
+
return 'receiptRead';
|
|
696
|
+
case 'apply_row_updates':
|
|
697
|
+
case 'save_results':
|
|
698
|
+
return 'rowUpdates';
|
|
699
|
+
default:
|
|
700
|
+
return 'other';
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
function createRuntimeGatewayFlightTiming() {
|
|
705
|
+
let count = 0;
|
|
706
|
+
const roundTrip = createExecuteStageAccumulator();
|
|
707
|
+
const headers = createExecuteStageAccumulator();
|
|
708
|
+
const bodyDecode = createExecuteStageAccumulator();
|
|
709
|
+
const serverTotal = createExecuteStageAccumulator();
|
|
710
|
+
const observe = (
|
|
711
|
+
metric: ReturnType<typeof createExecuteStageAccumulator>,
|
|
712
|
+
value: number | null | undefined,
|
|
713
|
+
) => {
|
|
714
|
+
if (value != null && Number.isFinite(value) && value >= 0)
|
|
715
|
+
metric.observe(value);
|
|
716
|
+
};
|
|
717
|
+
return {
|
|
718
|
+
observe(observation: RuntimeResourceObservation) {
|
|
719
|
+
count += 1;
|
|
720
|
+
observe(roundTrip, observation.gatewayResponseFlightMs);
|
|
721
|
+
observe(headers, observation.gatewayResponseHeadersMs);
|
|
722
|
+
observe(bodyDecode, observation.gatewayResponseBodyDecodeMs);
|
|
723
|
+
const stages = [
|
|
724
|
+
observation.gatewayAuthLaunchMs,
|
|
725
|
+
observation.gatewayAuthVerifyMs,
|
|
726
|
+
observation.gatewayBodyParseMs,
|
|
727
|
+
observation.gatewayPoolWaitMs,
|
|
728
|
+
observation.gatewayCallbackMs,
|
|
729
|
+
];
|
|
730
|
+
if (
|
|
731
|
+
stages.every(
|
|
732
|
+
(value): value is number =>
|
|
733
|
+
value != null && Number.isFinite(value) && value >= 0,
|
|
734
|
+
)
|
|
735
|
+
)
|
|
736
|
+
serverTotal.observe(stages.reduce((sum, value) => sum + value, 0));
|
|
737
|
+
},
|
|
738
|
+
snapshot(): RuntimeGatewayFlightTiming {
|
|
739
|
+
const server = serverTotal.snapshot();
|
|
740
|
+
return {
|
|
741
|
+
count,
|
|
742
|
+
roundTrip: roundTrip.snapshot(),
|
|
743
|
+
headers: headers.snapshot(),
|
|
744
|
+
bodyDecode: bodyDecode.snapshot(),
|
|
745
|
+
serverTotal: server.count > 0 ? server : null,
|
|
746
|
+
};
|
|
747
|
+
},
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
|
|
632
751
|
/** A fixed set of named execute stages with one run-level request count. */
|
|
633
752
|
export type RuntimeExecuteStageGroup<Stage extends ExecuteServerTimingStage> = {
|
|
634
753
|
count: number;
|
|
@@ -1060,6 +1179,59 @@ function readProcessUsage(): RuntimeResourceSnapshot['process'] {
|
|
|
1060
1179
|
}
|
|
1061
1180
|
}
|
|
1062
1181
|
|
|
1182
|
+
function readProcessCpuSample() {
|
|
1183
|
+
const epochMs = Date.now();
|
|
1184
|
+
let monotonicMs: number | null = null;
|
|
1185
|
+
let cpu: { user: number; system: number } | null = null;
|
|
1186
|
+
try {
|
|
1187
|
+
const now = performance.now();
|
|
1188
|
+
if (Number.isFinite(now) && now >= 0) monotonicMs = now;
|
|
1189
|
+
} catch {
|
|
1190
|
+
// A missing monotonic clock cannot establish an elapsed CPU window.
|
|
1191
|
+
}
|
|
1192
|
+
try {
|
|
1193
|
+
const usage = process.cpuUsage();
|
|
1194
|
+
if (
|
|
1195
|
+
Number.isFinite(usage.user) &&
|
|
1196
|
+
usage.user >= 0 &&
|
|
1197
|
+
Number.isFinite(usage.system) &&
|
|
1198
|
+
usage.system >= 0
|
|
1199
|
+
)
|
|
1200
|
+
cpu = usage;
|
|
1201
|
+
} catch {
|
|
1202
|
+
// CPU counters are diagnostic; unavailable is distinct from zero usage.
|
|
1203
|
+
}
|
|
1204
|
+
return { epochMs, monotonicMs, cpu };
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
function processCpuWindow(
|
|
1208
|
+
start: ReturnType<typeof readProcessCpuSample>,
|
|
1209
|
+
): NonNullable<RuntimeResourceSnapshot['processCpuWindow']> {
|
|
1210
|
+
const end = readProcessCpuSample();
|
|
1211
|
+
const elapsedMs =
|
|
1212
|
+
start.monotonicMs !== null &&
|
|
1213
|
+
end.monotonicMs !== null &&
|
|
1214
|
+
end.monotonicMs >= start.monotonicMs
|
|
1215
|
+
? end.monotonicMs - start.monotonicMs
|
|
1216
|
+
: null;
|
|
1217
|
+
const countersValid =
|
|
1218
|
+
elapsedMs !== null &&
|
|
1219
|
+
start.cpu !== null &&
|
|
1220
|
+
end.cpu !== null &&
|
|
1221
|
+
end.cpu.user >= start.cpu.user &&
|
|
1222
|
+
end.cpu.system >= start.cpu.system;
|
|
1223
|
+
return {
|
|
1224
|
+
scope: 'process_during_governor_lifetime',
|
|
1225
|
+
startedAtEpochMs: start.epochMs,
|
|
1226
|
+
sampledAtEpochMs: end.epochMs,
|
|
1227
|
+
elapsedMs,
|
|
1228
|
+
cpuUserMs: countersValid ? (end.cpu!.user - start.cpu!.user) / 1_000 : null,
|
|
1229
|
+
cpuSystemMs: countersValid
|
|
1230
|
+
? (end.cpu!.system - start.cpu!.system) / 1_000
|
|
1231
|
+
: null,
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1063
1235
|
function resourceKey(input?: string | null): string {
|
|
1064
1236
|
const trimmed = input?.trim();
|
|
1065
1237
|
return trimmed || 'unknown';
|
|
@@ -1074,6 +1246,7 @@ export function createRuntimeResourceGovernor(input: {
|
|
|
1074
1246
|
*/
|
|
1075
1247
|
memoryLedger?: RuntimeMemoryLedger | null;
|
|
1076
1248
|
}): RuntimeResourceGovernor {
|
|
1249
|
+
const processCpuStart = readProcessCpuSample();
|
|
1077
1250
|
const rowAdmissionWait = createEwma();
|
|
1078
1251
|
const toolAdmissionWait = createEwma();
|
|
1079
1252
|
const sheetFlushLatency = createEwma();
|
|
@@ -1156,6 +1329,13 @@ export function createRuntimeResourceGovernor(input: {
|
|
|
1156
1329
|
rawBytes: 0,
|
|
1157
1330
|
wireBytes: 0,
|
|
1158
1331
|
};
|
|
1332
|
+
const gatewaySuccessfulFlights = {
|
|
1333
|
+
receiptClaim: createRuntimeGatewayFlightTiming(),
|
|
1334
|
+
receiptCompletion: createRuntimeGatewayFlightTiming(),
|
|
1335
|
+
receiptRead: createRuntimeGatewayFlightTiming(),
|
|
1336
|
+
rowUpdates: createRuntimeGatewayFlightTiming(),
|
|
1337
|
+
other: createRuntimeGatewayFlightTiming(),
|
|
1338
|
+
};
|
|
1159
1339
|
const providers = new Map<
|
|
1160
1340
|
string,
|
|
1161
1341
|
{
|
|
@@ -1524,6 +1704,10 @@ export function createRuntimeResourceGovernor(input: {
|
|
|
1524
1704
|
);
|
|
1525
1705
|
phases.gatewayCallback.observe(observation.gatewayCallbackMs);
|
|
1526
1706
|
phases.gatewayRoundTrip.observe(observation.gatewayRoundTripMs);
|
|
1707
|
+
if (observation.gatewayAction != null)
|
|
1708
|
+
gatewaySuccessfulFlights[
|
|
1709
|
+
runtimeGatewayOperationFamily(observation.gatewayAction)
|
|
1710
|
+
].observe(observation);
|
|
1527
1711
|
phases.gatewayRequestSerialize.observe(
|
|
1528
1712
|
observation.gatewayRequestSerializeMs,
|
|
1529
1713
|
);
|
|
@@ -1908,6 +2092,7 @@ export function createRuntimeResourceGovernor(input: {
|
|
|
1908
2092
|
}
|
|
1909
2093
|
: {}),
|
|
1910
2094
|
process: readProcessUsage(),
|
|
2095
|
+
processCpuWindow: processCpuWindow(processCpuStart),
|
|
1911
2096
|
mapAdmission: { ...mapAdmission },
|
|
1912
2097
|
memory: readMemorySnapshot(),
|
|
1913
2098
|
// Distributions ride only on the run-level phases. Per-provider
|
|
@@ -1957,6 +2142,14 @@ export function createRuntimeResourceGovernor(input: {
|
|
|
1957
2142
|
gatewayRequestPack: phases.gatewayRequestPack.distribution(),
|
|
1958
2143
|
},
|
|
1959
2144
|
gateway: {
|
|
2145
|
+
successfulFlights: {
|
|
2146
|
+
receiptClaim: gatewaySuccessfulFlights.receiptClaim.snapshot(),
|
|
2147
|
+
receiptCompletion:
|
|
2148
|
+
gatewaySuccessfulFlights.receiptCompletion.snapshot(),
|
|
2149
|
+
receiptRead: gatewaySuccessfulFlights.receiptRead.snapshot(),
|
|
2150
|
+
rowUpdates: gatewaySuccessfulFlights.rowUpdates.snapshot(),
|
|
2151
|
+
other: gatewaySuccessfulFlights.other.snapshot(),
|
|
2152
|
+
},
|
|
1960
2153
|
authSession: { ...gatewayAuthSessionCounters },
|
|
1961
2154
|
requestBody: { ...gatewayRequestBodyCounters },
|
|
1962
2155
|
},
|
|
@@ -275,7 +275,19 @@ export class ProviderExhaustedError extends Error {
|
|
|
275
275
|
readonly publicDetails: ToolExecutionError['publicDetails'];
|
|
276
276
|
/** ISO 8601 retry deadline (from the server Retry-After / cooldown). */
|
|
277
277
|
readonly retryAt: string;
|
|
278
|
-
|
|
278
|
+
#localRetryAtMs?: number;
|
|
279
|
+
|
|
280
|
+
/** In-process scheduling evidence; never part of the canonical provider deadline. */
|
|
281
|
+
get localRetryAtMs(): number | undefined {
|
|
282
|
+
return this.#localRetryAtMs;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
constructor(input: {
|
|
286
|
+
provider: string;
|
|
287
|
+
retryAtMs: number;
|
|
288
|
+
cause?: unknown;
|
|
289
|
+
localRetryAtMs?: number;
|
|
290
|
+
}) {
|
|
279
291
|
// Prefix the code token so `String(error)` and any persisted error string
|
|
280
292
|
// carry it across the serialization boundary back to the CLI, exactly like
|
|
281
293
|
// WorkspaceStorageNotReadyError.
|
|
@@ -294,6 +306,13 @@ export class ProviderExhaustedError extends Error {
|
|
|
294
306
|
this.retryAt = Number.isFinite(Number(input.retryAtMs))
|
|
295
307
|
? new Date(Number(input.retryAtMs)).toISOString()
|
|
296
308
|
: new Date(0).toISOString();
|
|
309
|
+
if (
|
|
310
|
+
typeof input.localRetryAtMs === 'number' &&
|
|
311
|
+
Number.isSafeInteger(input.localRetryAtMs) &&
|
|
312
|
+
input.localRetryAtMs >= 0
|
|
313
|
+
) {
|
|
314
|
+
this.#localRetryAtMs = input.localRetryAtMs;
|
|
315
|
+
}
|
|
297
316
|
if (input.cause !== undefined) {
|
|
298
317
|
(this as { cause?: unknown }).cause = input.cause;
|
|
299
318
|
}
|
|
@@ -177,6 +177,21 @@ export function isRunLedgerProjectionLeaseLostReason(
|
|
|
177
177
|
);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
/**
|
|
181
|
+
* A live progress batch reached Run Ledger intake after its attempt stopped
|
|
182
|
+
* being current: the run is terminal, a newer attempt exists, or this attempt
|
|
183
|
+
* already recorded its runner result. The terminal tail carries any in-flight
|
|
184
|
+
* batch, so the late copy is refused rather than stored after the end.
|
|
185
|
+
*/
|
|
186
|
+
export class RunLedgerProgressAttemptSupersededError extends Error {
|
|
187
|
+
readonly code = 'RUNNER_PROGRESS_ATTEMPT_SUPERSEDED';
|
|
188
|
+
|
|
189
|
+
constructor() {
|
|
190
|
+
super('Runner progress attempt is no longer current.');
|
|
191
|
+
this.name = 'RunLedgerProgressAttemptSupersededError';
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
180
195
|
export class RunLedgerProjectionLeaseLostError extends Error {
|
|
181
196
|
readonly reason: RunLedgerProjectionLeaseLostReason;
|
|
182
197
|
readonly projectionMismatch: RunLedgerProjectionMismatchDiagnostic | null;
|
|
@@ -100,8 +100,8 @@ export type PlayRunLiveSnapshot = {
|
|
|
100
100
|
logsTruncated?: boolean;
|
|
101
101
|
/**
|
|
102
102
|
* The canonical log store could not be read for this snapshot. The run
|
|
103
|
-
* status remains authoritative; callers
|
|
104
|
-
*
|
|
103
|
+
* status remains authoritative; callers can retry logs separately or use
|
|
104
|
+
* the paginated logs endpoint. The log cursor does not advance.
|
|
105
105
|
*/
|
|
106
106
|
logsUnavailable?: true;
|
|
107
107
|
activeArtifactTableNamespace: string | null;
|
|
@@ -29,6 +29,7 @@ import { AppRuntimeRateStateBackend } from '../governor/app-runtime-rate-state-b
|
|
|
29
29
|
import { AppRuntimeBudgetStateBackend } from '../governor/app-runtime-budget-state-backend';
|
|
30
30
|
import {
|
|
31
31
|
parseCtxFetchHttpFailureDiagnostic,
|
|
32
|
+
tagLogProvenance,
|
|
32
33
|
type CtxFetchHttpFailureDiagnostic,
|
|
33
34
|
} from '../log-provenance';
|
|
34
35
|
import type {
|
|
@@ -585,16 +586,18 @@ export async function fetchRunnerRuntimeControl(input: {
|
|
|
585
586
|
const fetchImpl = input.fetchImpl ?? fetch;
|
|
586
587
|
const sleepImpl = input.sleepImpl ?? sleepRunnerRuntimeControlRetry;
|
|
587
588
|
const startedAt = Date.now();
|
|
588
|
-
//
|
|
589
|
-
//
|
|
589
|
+
// Header/body retries and no-response retries use independent ordinary
|
|
590
|
+
// budgets. Classified network cuts can also use the bounded outage budget.
|
|
590
591
|
let respondedAttempts = 0;
|
|
591
|
-
|
|
592
|
+
let noResponseAttempts = 0;
|
|
593
|
+
for (;;) {
|
|
592
594
|
const timeoutMs =
|
|
593
595
|
input.timeoutMs ?? RUNNER_RUNTIME_CONTROL_REQUEST_TIMEOUT_MS;
|
|
594
596
|
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
595
597
|
const signal = input.init.signal
|
|
596
598
|
? AbortSignal.any([input.init.signal, timeoutSignal])
|
|
597
599
|
: timeoutSignal;
|
|
600
|
+
let responseReceived = false;
|
|
598
601
|
try {
|
|
599
602
|
// Never follow redirects on the sandbox -> receipt-gateway control plane.
|
|
600
603
|
// Every runtime-control call from the Daytona sandbox targets the gateway
|
|
@@ -609,6 +612,7 @@ export async function fetchRunnerRuntimeControl(input: {
|
|
|
609
612
|
redirect: 'manual',
|
|
610
613
|
signal,
|
|
611
614
|
});
|
|
615
|
+
responseReceived = true;
|
|
612
616
|
if (response.status >= 300 && response.status < 400) {
|
|
613
617
|
const location = response.headers.get('location') ?? '<none>';
|
|
614
618
|
await response.text().catch(() => '');
|
|
@@ -659,22 +663,26 @@ export async function fetchRunnerRuntimeControl(input: {
|
|
|
659
663
|
`${input.description} transport failed: ${transportMessage}`,
|
|
660
664
|
);
|
|
661
665
|
if (!input.retrySafe || input.init.signal?.aborted) throw failure;
|
|
666
|
+
if (!responseReceived) noResponseAttempts += 1;
|
|
667
|
+
const retryAttempt = responseReceived
|
|
668
|
+
? respondedAttempts
|
|
669
|
+
: noResponseAttempts;
|
|
662
670
|
const delayMs =
|
|
663
|
-
RUNNER_RUNTIME_CONTROL_RETRY_DELAYS_MS[
|
|
671
|
+
RUNNER_RUNTIME_CONTROL_RETRY_DELAYS_MS[retryAttempt - 1] ??
|
|
664
672
|
Math.min(
|
|
665
673
|
8_000,
|
|
666
|
-
1_000 *
|
|
674
|
+
1_000 *
|
|
675
|
+
(retryAttempt - RUNNER_RUNTIME_CONTROL_RETRY_DELAYS_MS.length),
|
|
667
676
|
);
|
|
668
677
|
const outageRetryAllowed =
|
|
678
|
+
!responseReceived &&
|
|
669
679
|
(timeoutSignal.aborted || isRunnerGatewayNoResponseError(error)) &&
|
|
670
680
|
Date.now() - startedAt + delayMs <=
|
|
671
681
|
RUNNER_GATEWAY_CONNECTION_RETRY_BUDGET_MS;
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
)
|
|
676
|
-
throw failure;
|
|
677
|
-
}
|
|
682
|
+
const normalRetryAllowed = responseReceived
|
|
683
|
+
? respondedAttempts < RUNNER_RUNTIME_CONTROL_MAX_ATTEMPTS
|
|
684
|
+
: noResponseAttempts < RUNNER_RUNTIME_CONTROL_MAX_ATTEMPTS;
|
|
685
|
+
if (!normalRetryAllowed && !outageRetryAllowed) throw failure;
|
|
678
686
|
await sleepImpl(delayMs);
|
|
679
687
|
}
|
|
680
688
|
}
|
|
@@ -890,10 +898,9 @@ export function createAppRuntimeToolAuthScopeDigestResolver(
|
|
|
890
898
|
|
|
891
899
|
function createRateStateBackendForConfig(
|
|
892
900
|
config: PlayRunnerExecutionConfig,
|
|
893
|
-
): Pick<
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
> {
|
|
901
|
+
): Pick<ContextOptions, 'budgetState' | 'requireSharedRateState'> & {
|
|
902
|
+
rateState?: AppRuntimeRateStateBackend;
|
|
903
|
+
} {
|
|
897
904
|
const backend = config.context.rateStateBackend;
|
|
898
905
|
if (!backend || backend.kind === 'in_memory') return {};
|
|
899
906
|
const baseUrl = config.context.baseUrl?.trim();
|
|
@@ -1255,6 +1262,8 @@ async function createStreamingCsvDataset(input: {
|
|
|
1255
1262
|
|
|
1256
1263
|
export interface ExecutePlayRunnerOptions {
|
|
1257
1264
|
emitEvent?: (event: PlayRunnerEvent) => void;
|
|
1265
|
+
/** Bounded phase values collected for the direct-runner timing summary. */
|
|
1266
|
+
runnerPhaseTimingsMs?: RunnerPhaseTimingsMs;
|
|
1258
1267
|
signal?: AbortSignal;
|
|
1259
1268
|
/** Stops future row admission while already admitted rows can persist. */
|
|
1260
1269
|
rowAdmissionSignal?: AbortSignal;
|
|
@@ -1266,6 +1275,31 @@ export interface ExecutePlayRunnerOptions {
|
|
|
1266
1275
|
}) => void;
|
|
1267
1276
|
}
|
|
1268
1277
|
|
|
1278
|
+
const RUNNER_PHASE_NAMES = [
|
|
1279
|
+
'process main',
|
|
1280
|
+
'config load',
|
|
1281
|
+
'artifact materialize',
|
|
1282
|
+
'context setup',
|
|
1283
|
+
'artifact compile',
|
|
1284
|
+
'user function returned',
|
|
1285
|
+
'play body returned',
|
|
1286
|
+
] as const;
|
|
1287
|
+
|
|
1288
|
+
type RunnerPhaseName = (typeof RUNNER_PHASE_NAMES)[number];
|
|
1289
|
+
type RunnerPhaseTimingsMs = Partial<Record<RunnerPhaseName, number>>;
|
|
1290
|
+
|
|
1291
|
+
function recordRunnerPhaseTiming(
|
|
1292
|
+
timings: RunnerPhaseTimingsMs,
|
|
1293
|
+
line: string,
|
|
1294
|
+
): void {
|
|
1295
|
+
const match = /^\[perf\] (.+) elapsed_ms=(\d+(?:\.\d+)?)$/.exec(line);
|
|
1296
|
+
if (!match) return;
|
|
1297
|
+
const phase = match[1] as RunnerPhaseName;
|
|
1298
|
+
if (!RUNNER_PHASE_NAMES.includes(phase)) return;
|
|
1299
|
+
const value = Number(match[2]);
|
|
1300
|
+
if (Number.isFinite(value) && value >= 0) timings[phase] = value;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1269
1303
|
function emitRunnerEvent(
|
|
1270
1304
|
event: PlayRunnerEvent,
|
|
1271
1305
|
options?: ExecutePlayRunnerOptions,
|
|
@@ -1330,6 +1364,16 @@ function emitWorkerLog(line: string, options?: ExecutePlayRunnerOptions): void {
|
|
|
1330
1364
|
);
|
|
1331
1365
|
}
|
|
1332
1366
|
|
|
1367
|
+
function emitRunnerTiming(
|
|
1368
|
+
line: string,
|
|
1369
|
+
options: ExecutePlayRunnerOptions | undefined,
|
|
1370
|
+
): void {
|
|
1371
|
+
emitWorkerLog(line, options);
|
|
1372
|
+
if (options?.runnerPhaseTimingsMs) {
|
|
1373
|
+
recordRunnerPhaseTiming(options.runnerPhaseTimingsMs, line);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1333
1377
|
function emitSystemLog(line: string, options?: ExecutePlayRunnerOptions): void {
|
|
1334
1378
|
emitRunnerEvent(
|
|
1335
1379
|
{
|
|
@@ -1861,7 +1905,7 @@ async function executeRuntimePlayCode(input: {
|
|
|
1861
1905
|
input.artifact.virtualFilename,
|
|
1862
1906
|
dirname(input.artifact.virtualFilename),
|
|
1863
1907
|
);
|
|
1864
|
-
|
|
1908
|
+
emitRunnerTiming(
|
|
1865
1909
|
`[perf] artifact compile elapsed_ms=${Date.now() - compileStartedAt}`,
|
|
1866
1910
|
input.options,
|
|
1867
1911
|
);
|
|
@@ -1890,7 +1934,7 @@ async function executeRuntimePlayCode(input: {
|
|
|
1890
1934
|
// whose Slack-card replacement was confirmed. Provider capacity remains a
|
|
1891
1935
|
// normal typed waterfall miss.
|
|
1892
1936
|
input.ctx.assertNoRunFatalToolFailure();
|
|
1893
|
-
|
|
1937
|
+
emitRunnerTiming(
|
|
1894
1938
|
`[perf] user function returned elapsed_ms=${Date.now() - userFunctionStartedAt}`,
|
|
1895
1939
|
input.options,
|
|
1896
1940
|
);
|
|
@@ -2735,7 +2779,6 @@ async function run(
|
|
|
2735
2779
|
assertPlayRunnerRuntimeSheetPersistenceContext(config.context);
|
|
2736
2780
|
const { baseUrl, orgId } = config.context;
|
|
2737
2781
|
const startedAt = Date.now();
|
|
2738
|
-
totalRows += items.length;
|
|
2739
2782
|
const userEmail = config.context.userEmail;
|
|
2740
2783
|
const playName = mapContext.playName ?? config.context.playName;
|
|
2741
2784
|
const runId =
|
|
@@ -3238,6 +3281,11 @@ async function run(
|
|
|
3238
3281
|
};
|
|
3239
3282
|
},
|
|
3240
3283
|
});
|
|
3284
|
+
rateStateBackend.rateState?.setDiagnosticSink((fields) =>
|
|
3285
|
+
ctx.logRunnerDiagnostic(
|
|
3286
|
+
`[runtime.provider.rate_state.decision] ${JSON.stringify(fields)}`,
|
|
3287
|
+
),
|
|
3288
|
+
);
|
|
3241
3289
|
receiptGatewayResponseObserver.attach(ctx);
|
|
3242
3290
|
|
|
3243
3291
|
const csvSourceCache = new Map<string, ReplayableCsvSource>();
|
|
@@ -3374,7 +3422,7 @@ async function run(
|
|
|
3374
3422
|
csvDatasetCache.set(datasetCacheKey, dataset);
|
|
3375
3423
|
return dataset;
|
|
3376
3424
|
};
|
|
3377
|
-
|
|
3425
|
+
emitRunnerTiming(
|
|
3378
3426
|
`[perf] context setup elapsed_ms=${Date.now() - contextSetupStartedAt}`,
|
|
3379
3427
|
options,
|
|
3380
3428
|
);
|
|
@@ -3484,7 +3532,7 @@ async function run(
|
|
|
3484
3532
|
// catch that error, so the context keeps a sticky handoff that remains
|
|
3485
3533
|
// authoritative until this invocation returns it to the scheduler.
|
|
3486
3534
|
ctx.assertNoPendingDurableSuspension();
|
|
3487
|
-
|
|
3535
|
+
emitRunnerTiming(
|
|
3488
3536
|
`[perf] play body returned elapsed_ms=${Date.now() - runStartedAt}`,
|
|
3489
3537
|
options,
|
|
3490
3538
|
);
|
|
@@ -4056,7 +4104,12 @@ export async function materializeTransportedArtifact(
|
|
|
4056
4104
|
}
|
|
4057
4105
|
|
|
4058
4106
|
async function main() {
|
|
4059
|
-
|
|
4107
|
+
const runnerPhaseTimingsMs: RunnerPhaseTimingsMs = {};
|
|
4108
|
+
const emitStartupRunnerTiming = (line: string) => {
|
|
4109
|
+
recordRunnerPhaseTiming(runnerPhaseTimingsMs, line);
|
|
4110
|
+
emitWorkerLog(line);
|
|
4111
|
+
};
|
|
4112
|
+
emitStartupRunnerTiming(
|
|
4060
4113
|
`[perf] process main elapsed_ms=${Math.round(performance.now())}`,
|
|
4061
4114
|
);
|
|
4062
4115
|
const waitForConfig = process.argv[2] === '--wait-config';
|
|
@@ -4079,7 +4132,7 @@ async function main() {
|
|
|
4079
4132
|
process.env.DEEPLINE_PLAY_RUNNER_STARTUP_DIAGNOSTIC_PATH,
|
|
4080
4133
|
{ phase: 'booted' },
|
|
4081
4134
|
);
|
|
4082
|
-
|
|
4135
|
+
emitStartupRunnerTiming(
|
|
4083
4136
|
`[perf] config load elapsed_ms=${Date.now() - configLoadStartedAt}`,
|
|
4084
4137
|
);
|
|
4085
4138
|
|
|
@@ -4103,7 +4156,7 @@ async function main() {
|
|
|
4103
4156
|
parsedConfig,
|
|
4104
4157
|
heartbeat,
|
|
4105
4158
|
);
|
|
4106
|
-
|
|
4159
|
+
emitStartupRunnerTiming(
|
|
4107
4160
|
`[perf] artifact materialize elapsed_ms=${Date.now() - artifactMaterializeStartedAt}`,
|
|
4108
4161
|
);
|
|
4109
4162
|
|
|
@@ -4158,6 +4211,9 @@ async function main() {
|
|
|
4158
4211
|
let executionError: unknown = undefined;
|
|
4159
4212
|
try {
|
|
4160
4213
|
result = await executePlayRunner(config, {
|
|
4214
|
+
...(config.context.runtimeLogIdentity === 'origin'
|
|
4215
|
+
? { runnerPhaseTimingsMs }
|
|
4216
|
+
: {}),
|
|
4161
4217
|
signal: executionController.signal,
|
|
4162
4218
|
rowAdmissionSignal: rowAdmissionController.signal,
|
|
4163
4219
|
executionDrainAtMs: runtimeDeadline.drainAtMs,
|
|
@@ -4200,6 +4256,29 @@ async function main() {
|
|
|
4200
4256
|
if (!result) {
|
|
4201
4257
|
throw new Error('Play runner completed without a result.');
|
|
4202
4258
|
}
|
|
4259
|
+
const runId = config.context.runId ?? config.context.workflowId;
|
|
4260
|
+
const playBodyMs = runnerPhaseTimingsMs['play body returned'];
|
|
4261
|
+
if (
|
|
4262
|
+
config.context.runtimeLogIdentity === 'origin' &&
|
|
4263
|
+
result.status === 'completed' &&
|
|
4264
|
+
runId &&
|
|
4265
|
+
typeof playBodyMs === 'number' &&
|
|
4266
|
+
Number.isFinite(playBodyMs)
|
|
4267
|
+
) {
|
|
4268
|
+
emitWorkerLog(
|
|
4269
|
+
tagLogProvenance(
|
|
4270
|
+
'infra',
|
|
4271
|
+
`[perf-trace] ${JSON.stringify({
|
|
4272
|
+
ts: Date.now(),
|
|
4273
|
+
source: 'runner',
|
|
4274
|
+
runId,
|
|
4275
|
+
phase: 'runner.phase_summary',
|
|
4276
|
+
ms: playBodyMs,
|
|
4277
|
+
phaseDurationsMs: runnerPhaseTimingsMs,
|
|
4278
|
+
})}`,
|
|
4279
|
+
),
|
|
4280
|
+
);
|
|
4281
|
+
}
|
|
4203
4282
|
(
|
|
4204
4283
|
result as PlayRunnerResult & { workCompletedAtMs?: number }
|
|
4205
4284
|
).workCompletedAtMs = workCompletedAtMs;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PlayRunnerEvent } from '../protocol';
|
|
2
|
+
import { readProvenanceTag } from '../log-provenance';
|
|
2
3
|
|
|
3
4
|
export const PLAY_RUNNER_STDOUT_EVENT_MODE_ENV =
|
|
4
5
|
'DEEPLINE_PLAY_RUNNER_STDOUT_EVENT_MODE';
|
|
@@ -15,10 +16,17 @@ const PROGRESS_SIDECAR_LOG_PATTERNS = [
|
|
|
15
16
|
/^\[perf\] runtime receipt /i,
|
|
16
17
|
/^\[perf\] runtime state(?:[ =])/i,
|
|
17
18
|
/^\[perf\]\[worker\.receipt_writer\.retry\] /i,
|
|
19
|
+
/^\[perf-trace\] \{"ts":\d+,"source":"runner","runId":"[^"]+","phase":"runner\.phase_summary","ms":\d+(?:\.\d+)?,"phaseDurationsMs":\{/,
|
|
18
20
|
] as const;
|
|
19
21
|
|
|
20
22
|
function shouldEmitProgressSidecarLog(line: string): boolean {
|
|
21
|
-
|
|
23
|
+
const tagged = readProvenanceTag(line);
|
|
24
|
+
if (tagged.provenance !== null && tagged.provenance !== 'infra') {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return PROGRESS_SIDECAR_LOG_PATTERNS.some((pattern) =>
|
|
28
|
+
pattern.test(tagged.line),
|
|
29
|
+
);
|
|
22
30
|
}
|
|
23
31
|
|
|
24
32
|
export function shouldEmitProgressSidecarEvent(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { deleteDaytonaSandboxAndConfirmAbsence } from './daytona-sandbox-absence';
|
|
1
2
|
import {
|
|
2
3
|
Configuration,
|
|
3
4
|
SandboxApi,
|
|
@@ -6,6 +7,7 @@ import {
|
|
|
6
7
|
} from '@daytona/api-client';
|
|
7
8
|
import { Daytona, Sandbox } from '@daytonaio/sdk';
|
|
8
9
|
import axios from 'axios';
|
|
10
|
+
import type { DaytonaDeleteRetryAuthorization } from './daytona-lifecycle';
|
|
9
11
|
import type { DaytonaClientOptions } from '../../daytona-runtime-config';
|
|
10
12
|
|
|
11
13
|
/** Control-plane recovery must not inherit the SDK's 24-hour HTTP timeout. */
|
|
@@ -150,11 +152,29 @@ export function createDaytonaControlClient(
|
|
|
150
152
|
);
|
|
151
153
|
return { fs: recovery.fs };
|
|
152
154
|
},
|
|
153
|
-
async delete(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
async delete(
|
|
156
|
+
sandbox: Pick<Sandbox, 'id'>,
|
|
157
|
+
retry?: DaytonaDeleteRetryAuthorization,
|
|
158
|
+
): Promise<void> {
|
|
159
|
+
const owned = sandboxData.get(sandbox as Sandbox);
|
|
160
|
+
if (owned?.id !== sandbox.id || !owned.organizationId?.trim()) {
|
|
161
|
+
throw new Error(
|
|
162
|
+
'Daytona deletion requires this client’s exact owned sandbox and organization.',
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
await deleteDaytonaSandboxAndConfirmAbsence({
|
|
166
|
+
retry,
|
|
167
|
+
delete: () => call(() => api.deleteSandbox(owned.id)),
|
|
168
|
+
sandboxId: owned.id,
|
|
169
|
+
organizationId: owned.organizationId.trim(),
|
|
170
|
+
signal: controller.signal,
|
|
171
|
+
assertWithinDeadline: () => {
|
|
172
|
+
if (Date.now() >= deadlineAtMs)
|
|
173
|
+
controller.abort(new DaytonaControlTimeoutError());
|
|
174
|
+
controller.signal.throwIfAborted();
|
|
175
|
+
},
|
|
176
|
+
read: async () => (await call(() => api.getSandbox(owned.id))).data,
|
|
177
|
+
});
|
|
158
178
|
},
|
|
159
179
|
dispose(): void {
|
|
160
180
|
clearTimeout(timer);
|