deepline 0.3.542 → 0.3.543
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 +106 -2
- package/dist/bundling-sources/sdk/src/index.ts +7 -0
- package/dist/bundling-sources/sdk/src/integrations.ts +198 -0
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +3 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/tool-calls.ts +35 -11
- package/dist/bundling-sources/sdk/src/types.ts +10 -0
- package/dist/bundling-sources/shared_libs/integration-contracts/calendar-delegation.ts +132 -0
- package/dist/bundling-sources/shared_libs/integration-contracts/tool-connection.ts +13 -0
- package/dist/bundling-sources/shared_libs/monitors/package.json +1 -1
- package/dist/bundling-sources/shared_libs/observability/queue-health.ts +9 -0
- package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +5 -5
- package/dist/bundling-sources/shared_libs/play-data-plane/sheet-contract.ts +34 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +11 -5
- package/dist/bundling-sources/shared_libs/play-runtime/baked-runner-image.ts +9 -7
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +235 -12
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +20 -1
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-janitor.ts +39 -30
- package/dist/bundling-sources/shared_libs/play-runtime/event-wait-tools.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/experiment-switches.ts +10 -4
- package/dist/bundling-sources/shared_libs/play-runtime/fleet-sandbox-sweep.ts +209 -0
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts +24 -1
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/contracts.ts +2 -1
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +6 -1
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +37 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +42 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-tool-hooks.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-modal-fallback.ts +15 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +23 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +320 -836
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/vercel-sandbox.ts +1061 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +862 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +45 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/sandbox-create-outcome.ts +3 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +11 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sandbox-contract.ts +20 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sandbox-placement-policy.ts +71 -34
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sandbox-provider-profile.ts +286 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +4 -1
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +12 -3
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +46 -55
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-required-env.ts +127 -5
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +7 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +214 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/managed-sandbox-resource-sql.ts +118 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +226 -144
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +2 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-ledger-reconciliation.ts +11 -13
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-operation.ts +42 -7
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +2 -1
- package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/tool-cache-policy.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/vercel-sandbox-runtime-config.ts +217 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +23 -0
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +1 -0
- package/dist/bundling-sources/shared_libs/plays/script-entry.ts +76 -6
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +1 -0
- package/dist/bundling-sources/shared_libs/security/credential-revision.ts +50 -0
- package/dist/bundling-sources/shared_libs/security/internal-actor.ts +2 -1
- package/dist/bundling-sources/shared_libs/security/receipt-admission-token.ts +37 -0
- package/dist/cli/{auth-IGBGOB4E.mjs → auth-ITAELTOA.mjs} +5 -5
- package/dist/cli/auth-S6B5WUU5.js +43 -0
- package/dist/cli/{billing-IB2TWE74.js → billing-33XVFDUJ.js} +101 -101
- package/dist/cli/{billing-N37W2I62.mjs → billing-WZ7RVZW4.mjs} +12 -12
- package/dist/cli/{chunk-D44DP4KJ.js → chunk-23D224GI.js} +37 -17
- package/dist/cli/{chunk-B5NP3SHX.mjs → chunk-274WKLSY.mjs} +2 -2
- package/dist/cli/{chunk-GBAT5NMI.mjs → chunk-2HSZCQMT.mjs} +48 -6
- package/dist/cli/{chunk-VLEVVDWG.js → chunk-2JHYYB3F.js} +3 -3
- package/dist/cli/{chunk-FGGPCAGC.js → chunk-2KTGZKRE.js} +18 -18
- package/dist/cli/{chunk-AWLPERL3.js → chunk-2LNTKICO.js} +3 -3
- package/dist/cli/{chunk-5CAVURVS.js → chunk-2NCJQEZH.js} +53 -53
- package/dist/cli/{chunk-6SLEHAXX.js → chunk-3JZXU5OB.js} +5 -5
- package/dist/cli/{chunk-4I47NCRI.js → chunk-46BEBZ3M.js} +497 -328
- package/dist/cli/{chunk-V4EYJKGJ.js → chunk-4JQEAYN3.js} +156 -17
- package/dist/cli/{chunk-DADH3WPE.mjs → chunk-4SKDSSPU.mjs} +2 -2
- package/dist/cli/{chunk-FX4OWXKK.mjs → chunk-52YK3EII.mjs} +2 -2
- package/dist/cli/{chunk-HAITCPCG.js → chunk-5MN3BKNB.js} +16 -16
- package/dist/cli/{chunk-FFDZT255.mjs → chunk-5VIPTLRX.mjs} +1 -1
- package/dist/cli/{chunk-OLH2PHMC.mjs → chunk-6P7TGCHQ.mjs} +1 -1
- package/dist/cli/{chunk-YK7NNZD4.mjs → chunk-6SJZMMD5.mjs} +37 -190
- package/dist/cli/chunk-7AUQTNLB.mjs +455 -0
- package/dist/cli/{chunk-I5EAIFGO.mjs → chunk-AACKPOGA.mjs} +1 -1
- package/dist/cli/{chunk-GM73TZ2W.js → chunk-BGAUADV4.js} +41 -41
- package/dist/cli/{chunk-KQSTV4MW.js → chunk-BLYW6FFB.js} +60 -18
- package/dist/cli/{chunk-LFMQVSEI.js → chunk-C35NLLSA.js} +5 -5
- package/dist/cli/{chunk-5APOJWJF.mjs → chunk-D6YAU3CF.mjs} +182 -13
- package/dist/cli/{chunk-TT4JUUC3.mjs → chunk-DH43ECTN.mjs} +7 -3
- package/dist/cli/{chunk-TTBHOMAA.js → chunk-DI3GL3T6.js} +316 -469
- package/dist/cli/{chunk-D7GWEBMF.js → chunk-DUGTPVT7.js} +7 -7
- package/dist/cli/{chunk-UNDLNT3V.js → chunk-ECWOIXAV.js} +1 -1
- package/dist/cli/{chunk-CFZCRM6R.js → chunk-EHUG6EUT.js} +26 -26
- package/dist/cli/chunk-F6VSQ5LN.js +455 -0
- package/dist/cli/{chunk-ACVTMAW4.mjs → chunk-FNW2SGPD.mjs} +2 -2
- package/dist/cli/{chunk-EHLCWGWN.js → chunk-GRCFX2EG.js} +4 -4
- package/dist/cli/{chunk-OVX3Q5Q3.mjs → chunk-GWNYLIF7.mjs} +1 -1
- package/dist/cli/{chunk-6WQDHEVF.mjs → chunk-HKJ26NRN.mjs} +5 -5
- package/dist/cli/{chunk-L2VKAASU.mjs → chunk-HXIR3VQL.mjs} +21 -0
- package/dist/cli/{chunk-WL2GUGNZ.js → chunk-J2F6F5GL.js} +7 -7
- package/dist/cli/{chunk-2VRKBHMD.mjs → chunk-JXG7HWBA.mjs} +1 -1
- package/dist/cli/{chunk-Z2XA6YU4.mjs → chunk-LX35AXTN.mjs} +1 -0
- package/dist/cli/{chunk-DNGACHFX.js → chunk-MCBUWK5K.js} +22 -22
- package/dist/cli/{chunk-Q7WDXLYO.js → chunk-NHKP2NSU.js} +2 -2
- package/dist/cli/{chunk-FANIRW74.mjs → chunk-NIPLY25A.mjs} +0 -2
- package/dist/cli/{chunk-AKY7KZRJ.js → chunk-NLENABRU.js} +6 -6
- package/dist/cli/{chunk-ORA5TMML.mjs → chunk-NR3O56FT.mjs} +5 -5
- package/dist/cli/{chunk-3XXXMSSP.js → chunk-O2KLWUNI.js} +44 -44
- package/dist/cli/{chunk-ZVNYBQ77.mjs → chunk-OAFKUHN5.mjs} +4 -4
- package/dist/cli/{chunk-2ZGSHVZE.mjs → chunk-OELJKQOL.mjs} +24 -4
- package/dist/cli/{chunk-E7B73LGT.js → chunk-PX7XAVUC.js} +24 -20
- package/dist/cli/{chunk-VHJUH3TB.js → chunk-QFRMVI4S.js} +3 -3
- package/dist/cli/{chunk-Z5YRKX7K.mjs → chunk-R57UCXQG.mjs} +1 -1
- package/dist/cli/{chunk-IPVRMYWT.js → chunk-RKF263LR.js} +5 -5
- package/dist/cli/{chunk-CQDQNZGH.js → chunk-SL6MYJYM.js} +1 -0
- package/dist/cli/{chunk-JPT6VE54.js → chunk-STXG2LFC.js} +2 -2
- package/dist/cli/{chunk-SCLP5H4P.mjs → chunk-SU4K4SUU.mjs} +1 -1
- package/dist/cli/{chunk-NLZHLEHD.mjs → chunk-SYOPHFKB.mjs} +6 -6
- package/dist/cli/{chunk-WACIN4PR.mjs → chunk-SZNJENGT.mjs} +3 -3
- package/dist/cli/{chunk-QXNOSCYL.js → chunk-TBCNL2T5.js} +1 -1
- package/dist/cli/{chunk-E4CABWXL.js → chunk-TI6DTURF.js} +22 -1
- package/dist/cli/{chunk-NDNEARE3.js → chunk-UJ6GOV7K.js} +13 -13
- package/dist/cli/{chunk-GWHA4DAC.js → chunk-UV4RU2TE.js} +0 -2
- package/dist/cli/{chunk-P4MDTBAA.mjs → chunk-VSJEOSYL.mjs} +1 -1
- package/dist/cli/{chunk-EGOCGWCI.mjs → chunk-W2OPPSAZ.mjs} +3 -3
- package/dist/cli/{chunk-46V7QSJE.mjs → chunk-XBM3KABD.mjs} +3 -3
- package/dist/cli/{chunk-QONO7FRF.mjs → chunk-XFPVFWZR.mjs} +1 -1
- package/dist/cli/{chunk-PLIKPGOO.mjs → chunk-XSN6BAZT.mjs} +5 -5
- package/dist/cli/{chunk-IDDKNMFX.mjs → chunk-Y3T5GWYK.mjs} +153 -14
- package/dist/cli/{chunk-AUFE624T.js → chunk-YE3T73BV.js} +10 -10
- package/dist/cli/{chunk-DMXLZ57N.js → chunk-YJYKZ2U3.js} +2 -2
- package/dist/cli/{chunk-F6QV42MC.mjs → chunk-Z7SXGOIQ.mjs} +1 -1
- package/dist/cli/{chunk-SWO5QOXB.mjs → chunk-ZRT2PNYY.mjs} +1 -1
- package/dist/cli/{chunk-3LEUSRV3.mjs → chunk-ZSPBJB7I.mjs} +4 -4
- package/dist/cli/command-docs.js +3 -3
- package/dist/cli/command-docs.mjs +2 -2
- package/dist/cli/concurrent-runs-help-E4OYD3DS.js +21 -0
- package/dist/cli/{concurrent-runs-help-DIBGMEIN.mjs → concurrent-runs-help-Z6ODNL4E.mjs} +7 -7
- package/dist/cli/{csv-CAVA3EMS.mjs → csv-5QW2HPHT.mjs} +4 -4
- package/dist/cli/{csv-XZAM7EYZ.js → csv-SSOFTXHU.js} +13 -13
- package/dist/cli/{db-PPGEOBNG.js → db-4LK5AJNO.js} +29 -29
- package/dist/cli/{db-HD332QI7.mjs → db-K2JMR6EM.mjs} +8 -8
- package/dist/cli/describe-AC6PLEFP.js +50 -0
- package/dist/cli/describe-AXHQZHTT.mjs +50 -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 +3 -3
- package/dist/cli/describe-core.mjs +2 -2
- package/dist/cli/{executions-4ZKBL7IC.js → executions-AATJQQAQ.js} +10 -10
- package/dist/cli/{executions-AFEOLB4A.mjs → executions-FY2XTX2W.mjs} +8 -8
- package/dist/cli/{feedback-J2YPLKMF.mjs → feedback-MKBPRGS6.mjs} +6 -6
- package/dist/cli/{feedback-M6Y33JKT.js → feedback-QPVJER75.js} +14 -14
- package/dist/cli/{git-632RYEF6.mjs → git-AGRFZR3K.mjs} +5 -5
- package/dist/cli/git-RUYFQEJX.js +25 -0
- package/dist/cli/index.js +150 -146
- package/dist/cli/index.mjs +49 -45
- package/dist/cli/integrations-OUQ6U33M.mjs +98 -0
- package/dist/cli/integrations-R6OUFZXI.js +98 -0
- package/dist/cli/{legacy-noops-KWZMXYAU.mjs → legacy-noops-DVL2RRKL.mjs} +6 -6
- package/dist/cli/{legacy-noops-4Y62TKPC.js → legacy-noops-H7INM2QN.js} +9 -9
- package/dist/cli/{mcp-PESLHAAC.mjs → mcp-2Z2YVOLK.mjs} +72 -15
- package/dist/cli/{mcp-35QA6YG7.js → mcp-33F7D7WI.js} +89 -32
- package/dist/cli/{monitors-4DTUZLAI.js → monitors-KDUJHAKJ.js} +102 -102
- package/dist/cli/{monitors-YVBKBJBU.mjs → monitors-NZD2WIKK.mjs} +9 -9
- package/dist/cli/{org-FWCBZMER.js → org-4PQGHLEB.js} +90 -90
- package/dist/cli/{org-DJNKMFCZ.mjs → org-EJW45RUA.mjs} +8 -8
- package/dist/cli/{play-PHVQEEEZ.mjs → play-3CM5RT5J.mjs} +44 -25
- package/dist/cli/{play-FZ45M4KD.js → play-MLHMQL4G.js} +374 -355
- package/dist/cli/{providers-46E67QG7.mjs → providers-BHYBJI4R.mjs} +10 -9
- package/dist/cli/{providers-QJU6FMDD.js → providers-YBJG7277.js} +13 -12
- package/dist/cli/{quickstart-6HMJJ4RR.mjs → quickstart-LL3MR562.mjs} +4 -4
- package/dist/cli/{quickstart-HOL7H5FS.js → quickstart-O7L2NNGJ.js} +6 -6
- package/dist/cli/{run-WKSIRXEC.js → run-HJ2AR6CM.js} +49 -48
- package/dist/cli/{run-2W2TJ6QA.mjs → run-OK545H5Q.mjs} +28 -27
- package/dist/cli/search-UUNS6BCC.js +32 -0
- package/dist/cli/{search-Y2CFLSYB.mjs → search-Z5ZKMRTX.mjs} +9 -9
- package/dist/cli/{search-output-FCZ35PHF.mjs → search-output-Q5VHNUWG.mjs} +4 -4
- package/dist/cli/{search-output-2IK6ZZDY.js → search-output-SVW4DETG.js} +6 -6
- package/dist/cli/{secrets-JVJIHGU4.js → secrets-ENQWMCB5.js} +17 -17
- package/dist/cli/{secrets-PNPNUZLX.mjs → secrets-QIKIEFWB.mjs} +8 -8
- package/dist/cli/{sessions-GY5VVQGO.mjs → sessions-AETO22RF.mjs} +6 -6
- package/dist/cli/sessions-FNSUDERA.js +22 -0
- package/dist/cli/{settings-YQOPF3AI.mjs → settings-G5RGRPFV.mjs} +16 -16
- package/dist/cli/{settings-5WHMFRNQ.js → settings-OFLIFTMZ.js} +89 -89
- package/dist/cli/{setup-O5U5IEVW.mjs → setup-G4N3X6KG.mjs} +9 -9
- package/dist/cli/{setup-3VJMKDEU.js → setup-QW7Y62XD.js} +49 -49
- package/dist/cli/skills-3IXIY2IV.js +36 -0
- package/dist/cli/{skills-G6J5PF35.mjs → skills-QRFQGHNA.mjs} +7 -7
- package/dist/cli/{tools-AG7SWL5Y.mjs → tools-52BH7UTF.mjs} +20 -19
- package/dist/cli/tools-MYBUMPKH.js +57 -0
- package/dist/cli/update-GT7574UU.js +34 -0
- package/dist/cli/{update-K73DD6CR.mjs → update-SDGZLAGL.mjs} +9 -9
- package/dist/cli/{views-MO6DIOMR.mjs → views-3BIJFJMQ.mjs} +8 -8
- package/dist/cli/{views-4D2OTLIO.js → views-5QKAWYPI.js} +23 -23
- package/dist/cli/{workflow-ZEMFCS4Y.js → workflow-G67RPWVY.js} +19 -19
- package/dist/cli/{workflow-MMZMAELI.mjs → workflow-QAK773FR.mjs} +9 -9
- package/dist/{client-X-FJD5Dp.d.ts → client-D1ga52xq.d.ts} +1 -1
- package/dist/{client-DLG9mHDh.d.mts → client-bd4QQIXo.d.mts} +1 -1
- package/dist/{client-core-0jmHfFBv.d.ts → client-core-B6eMVx8h.d.ts} +334 -3
- package/dist/{client-core-WtnqyBwY.d.mts → client-core-CqfWNf2Q.d.mts} +334 -3
- package/dist/{compiler-manifest-Cys06iYg.d.mts → compiler-manifest-BWFtsQIC.d.mts} +21 -0
- package/dist/{compiler-manifest-Cys06iYg.d.ts → compiler-manifest-BWFtsQIC.d.ts} +21 -0
- package/dist/{errors-B6eMjKcr.d.mts → errors-CwKXXtuu.d.mts} +1 -1
- package/dist/{errors-rdOUqcU2.d.ts → errors-Lm9_vJHZ.d.ts} +1 -1
- package/dist/{index-ejWadAL5.d.ts → index-3vJ-V9yw.d.ts} +1 -1
- package/dist/{index-CZdYO81A.d.mts → index-DjwsAt82.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +12 -12
- package/dist/index.mjs +8 -8
- package/dist/install-integrity.json +147 -133
- 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 +23 -4
- 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 +2 -2
- package/dist/plays/run-request.mjs +1 -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 +7 -7
- package/dist/server.mjs +5 -5
- package/package.json +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal-resource-usage.ts +0 -222
- package/dist/cli/auth-2PH6RSKL.js +0 -43
- package/dist/cli/concurrent-runs-help-BNIDBKML.js +0 -21
- package/dist/cli/describe-5TFFB2PM.js +0 -49
- package/dist/cli/describe-THQU7N47.mjs +0 -49
- package/dist/cli/git-AQLQYWRI.js +0 -25
- package/dist/cli/search-YLJFCJTK.js +0 -32
- package/dist/cli/sessions-TZ33UCPS.js +0 -22
- package/dist/cli/skills-WZY3XDT3.js +0 -36
- package/dist/cli/tools-BXQBL72Q.js +0 -56
- package/dist/cli/update-XYP5EII6.js +0 -34
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { createRateLimitedRuntimeLogger } from '../observability/runtime-console';
|
|
2
|
+
import {
|
|
3
|
+
startFleetSandboxSweepTimers,
|
|
4
|
+
type FleetSandboxSweepAdapter,
|
|
5
|
+
} from './/fleet-sandbox-sweep';
|
|
2
6
|
import { withRuntimeSchedulerClient } from './/scheduler-backends/postgres-pool';
|
|
3
7
|
import { RUNTIME_CAPACITY_POLICY } from './/runtime-capacity-policy';
|
|
4
8
|
import { isIsolatedRuntimeSchedulerSchema } from './/runtime-scheduler-topology';
|
|
@@ -20,41 +24,43 @@ export type DaytonaSandboxJanitorOptions = {
|
|
|
20
24
|
};
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
|
-
*
|
|
27
|
+
* The Daytona Adapter for the Fleet Sandbox Sweep, or null when this process
|
|
28
|
+
* must not sweep Daytona.
|
|
24
29
|
*
|
|
25
30
|
* Sandboxes have a source-scoped label shared by production, previews, and
|
|
26
31
|
* worktrees. An isolated schema cannot authoritatively distinguish its own
|
|
27
32
|
* sandboxes from the others, so it must never sweep. The fixed runtime
|
|
28
|
-
* controller is the one production owner;
|
|
33
|
+
* controller is the one production owner; keeping it there makes the Daytona
|
|
29
34
|
* list/read traffic constant with fleet size.
|
|
35
|
+
*
|
|
36
|
+
* Enumeration is the Daytona label list; termination restores the durable
|
|
37
|
+
* Sandbox Cleanup obligation through the exact operation ledger
|
|
38
|
+
* (`reapOrphanDaytonaSandboxes`), never an unledgered provider delete.
|
|
30
39
|
*/
|
|
31
|
-
export function
|
|
40
|
+
export function createDaytonaFleetSandboxSweepAdapter(
|
|
32
41
|
options: DaytonaSandboxJanitorOptions,
|
|
33
|
-
):
|
|
42
|
+
): FleetSandboxSweepAdapter | null {
|
|
34
43
|
if (!process.env.DAYTONA_API_KEY?.trim()) {
|
|
35
44
|
console.info('[daytona-janitor.controller] disabled (no DAYTONA_API_KEY)');
|
|
36
|
-
return
|
|
45
|
+
return null;
|
|
37
46
|
}
|
|
38
47
|
if (isIsolatedRuntimeSchedulerSchema(options.schema)) {
|
|
39
48
|
console.info('[daytona-janitor.controller] disabled (isolated schema)', {
|
|
40
49
|
schema: options.schema,
|
|
41
50
|
});
|
|
42
|
-
return
|
|
51
|
+
return null;
|
|
43
52
|
}
|
|
44
53
|
|
|
45
|
-
let running = false;
|
|
46
54
|
// Spans passes, so it cannot live in the per-pass reaper.
|
|
47
55
|
const reportStaleList = createRateLimitedRuntimeLogger({
|
|
48
56
|
log: (...args) => console.warn(...args),
|
|
49
57
|
intervalMs: DAYTONA_STALE_LIST_ALERT_INTERVAL_MS,
|
|
50
58
|
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
running = true;
|
|
57
|
-
try {
|
|
59
|
+
return {
|
|
60
|
+
provider: 'daytona',
|
|
61
|
+
scope: 'provider_inventory',
|
|
62
|
+
intervalMs: DAYTONA_JANITOR_INTERVAL_MS,
|
|
63
|
+
async runPass() {
|
|
58
64
|
const [
|
|
59
65
|
{ listDaytonaControlSandboxes },
|
|
60
66
|
{ loadDaytonaRequiredConfig },
|
|
@@ -94,31 +100,34 @@ export function startDaytonaSandboxJanitor(
|
|
|
94
100
|
}),
|
|
95
101
|
options: { reportStaleList },
|
|
96
102
|
});
|
|
97
|
-
}
|
|
103
|
+
},
|
|
104
|
+
reportPassFailure(error) {
|
|
98
105
|
// This is a best-effort resource backstop. A failed sweep must never
|
|
99
106
|
// terminate the controller that scales and recovers customer work.
|
|
100
107
|
console.warn('[daytona-janitor.controller] pass failed', {
|
|
101
108
|
error: error instanceof Error ? error.message : String(error),
|
|
102
109
|
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
110
|
+
},
|
|
111
|
+
reportOverlap() {
|
|
112
|
+
console.info('[daytona-janitor.controller] skip (previous pass running)');
|
|
113
|
+
},
|
|
106
114
|
};
|
|
115
|
+
}
|
|
107
116
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Start the production-only Daytona orphan sweep on the Fleet Sandbox Sweep's
|
|
119
|
+
* timer-driven owner: one pass now, then one every
|
|
120
|
+
* `DAYTONA_JANITOR_INTERVAL_MS`.
|
|
121
|
+
*/
|
|
122
|
+
export function startDaytonaSandboxJanitor(
|
|
123
|
+
options: DaytonaSandboxJanitorOptions,
|
|
124
|
+
): { stop: () => void } {
|
|
125
|
+
const adapter = createDaytonaFleetSandboxSweepAdapter(options);
|
|
126
|
+
if (!adapter) return { stop: () => undefined };
|
|
127
|
+
const { stop } = startFleetSandboxSweepTimers({ adapters: [adapter] });
|
|
116
128
|
console.info('[daytona-janitor.controller] scheduled', {
|
|
117
129
|
intervalMs: DAYTONA_JANITOR_INTERVAL_MS,
|
|
118
130
|
schema: options.schema,
|
|
119
131
|
});
|
|
120
|
-
|
|
121
|
-
return {
|
|
122
|
-
stop: () => clearInterval(interval),
|
|
123
|
-
};
|
|
132
|
+
return { stop };
|
|
124
133
|
}
|
|
@@ -53,6 +53,7 @@ type ExperimentSwitchDefinition =
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
const MODAL = 'packages/play-runtime/runner-backends/backends/modal.ts';
|
|
56
|
+
const EARLY_SANDBOX = 'packages/play-runtime/runner-backends/early-sandbox.ts';
|
|
56
57
|
|
|
57
58
|
export const EXPERIMENT_SWITCHES = {
|
|
58
59
|
B: {
|
|
@@ -102,13 +103,13 @@ export const EXPERIMENT_SWITCHES = {
|
|
|
102
103
|
E2: {
|
|
103
104
|
perRun: true,
|
|
104
105
|
summary:
|
|
105
|
-
"Start the run's
|
|
106
|
+
"Start the run's sandbox at admission (app hint), on a lane whose providers support early start, and adopt it at launch (worker).",
|
|
106
107
|
constants: [
|
|
107
108
|
{
|
|
108
109
|
file: 'apps/deepline-api/src/lib/plays/early-sandbox-hint.ts',
|
|
109
110
|
name: 'PREVIEW_EARLY_SANDBOX_HINT',
|
|
110
111
|
},
|
|
111
|
-
{ file:
|
|
112
|
+
{ file: EARLY_SANDBOX, name: 'EARLY_SANDBOX_START' },
|
|
112
113
|
],
|
|
113
114
|
},
|
|
114
115
|
S1: {
|
|
@@ -122,14 +123,19 @@ export const EXPERIMENT_SWITCHES = {
|
|
|
122
123
|
summary:
|
|
123
124
|
'Adopting an in-process early sandbox checks the tags this process set instead of reading them back (worker).',
|
|
124
125
|
constants: [
|
|
125
|
-
{
|
|
126
|
+
{
|
|
127
|
+
file: EARLY_SANDBOX,
|
|
128
|
+
name: 'ADOPT_IN_PROCESS_EARLY_SANDBOX_WITHOUT_TAG_READ',
|
|
129
|
+
},
|
|
126
130
|
],
|
|
127
131
|
},
|
|
128
132
|
PB: {
|
|
129
133
|
perRun: true,
|
|
130
134
|
summary:
|
|
131
135
|
'With E2 and the baked image, start the baked runner (waiting for its config) on the early sandbox; the in-process launch delivers the envelope, config last (worker).',
|
|
132
|
-
constants: [
|
|
136
|
+
constants: [
|
|
137
|
+
{ file: EARLY_SANDBOX, name: 'PREBOOT_RUNNER_IN_EARLY_SANDBOX' },
|
|
138
|
+
],
|
|
133
139
|
},
|
|
134
140
|
PWM: {
|
|
135
141
|
perRun: true,
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fleet Sandbox Sweep: the one Module that runs every provider's orphan sweep.
|
|
3
|
+
*
|
|
4
|
+
* Durable cleanup deletes each sandbox the scheduler knows about. A sweep is
|
|
5
|
+
* the backstop for the ones it lost: a worker crash between create and the
|
|
6
|
+
* cleanup enqueue, or a sandbox started before any run row existed. Each
|
|
7
|
+
* provider plugs in an Adapter that enumerates its candidates and terminates
|
|
8
|
+
* (or restores the durable cleanup obligation for) the ones its policy proves
|
|
9
|
+
* dead. This Module owns what is common to every Adapter:
|
|
10
|
+
*
|
|
11
|
+
* - which sweeps a provider may run, checked against its Provider Profile:
|
|
12
|
+
* only a provider that supports `orphanEnumeration` may sweep its whole
|
|
13
|
+
* inventory;
|
|
14
|
+
* - cadence: each Adapter declares its interval, and a pass starts only when
|
|
15
|
+
* it is due;
|
|
16
|
+
* - single flight: a pass never overlaps the same provider's previous pass;
|
|
17
|
+
* - isolation: each provider's pass runs independently, so one provider's
|
|
18
|
+
* failure, slowness, or synchronous throw never suppresses another's pass;
|
|
19
|
+
* - containment: a failed pass is reported through the Adapter and never
|
|
20
|
+
* escapes into the process that hosts the sweep.
|
|
21
|
+
*
|
|
22
|
+
* Two owners host it. The fixed runtime controller runs timer-driven passes
|
|
23
|
+
* (`startFleetSandboxSweepTimers`), so provider list traffic stays constant
|
|
24
|
+
* with fleet size. A runtime worker runs loop-driven passes from its cleanup
|
|
25
|
+
* controller (`createFleetSandboxSweep(...).runDuePasses()`), never awaiting
|
|
26
|
+
* them, so a slow provider never holds up cleanup claims.
|
|
27
|
+
*/
|
|
28
|
+
import {
|
|
29
|
+
runtimeSandboxProviderProfile,
|
|
30
|
+
type RuntimeSandboxProviderId,
|
|
31
|
+
} from './/runtime-sandbox-provider-profile';
|
|
32
|
+
|
|
33
|
+
/** What an Adapter's pass enumerates. */
|
|
34
|
+
export type FleetSandboxSweepScope =
|
|
35
|
+
/** Every sandbox the provider holds for this fleet. Requires the profile's
|
|
36
|
+
* `orphanEnumeration`. */
|
|
37
|
+
| 'provider_inventory'
|
|
38
|
+
/** Only sandboxes created before any run row exists (early start). Their
|
|
39
|
+
* create tags are the cleanup obligation, so no inventory scan is needed. */
|
|
40
|
+
| 'unadopted_early_sandboxes';
|
|
41
|
+
|
|
42
|
+
export type FleetSandboxSweepAdapter = Readonly<{
|
|
43
|
+
provider: RuntimeSandboxProviderId;
|
|
44
|
+
scope: FleetSandboxSweepScope;
|
|
45
|
+
/** Minimum spacing between pass starts. */
|
|
46
|
+
intervalMs: number;
|
|
47
|
+
/**
|
|
48
|
+
* One pass: enumerate, apply the provider's age, ownership and dry-run
|
|
49
|
+
* policy, and terminate or restore cleanup for each dead sandbox. A
|
|
50
|
+
* rejection is reported through `reportPassFailure`.
|
|
51
|
+
*/
|
|
52
|
+
runPass: () => Promise<void>;
|
|
53
|
+
/** Receives a failed pass. Must not throw; a throw is swallowed. */
|
|
54
|
+
reportPassFailure: (error: unknown) => void;
|
|
55
|
+
/** Called when a timer-driven pass is due while the previous one runs. */
|
|
56
|
+
reportOverlap?: () => void;
|
|
57
|
+
}>;
|
|
58
|
+
|
|
59
|
+
export class FleetSandboxSweepAdapterError extends Error {
|
|
60
|
+
constructor(message: string) {
|
|
61
|
+
super(message);
|
|
62
|
+
this.name = 'FleetSandboxSweepAdapterError';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Fails loudly before any pass when an Adapter claims more than its profile
|
|
67
|
+
* supports or two Adapters claim the same provider. */
|
|
68
|
+
export function assertFleetSandboxSweepAdapters(
|
|
69
|
+
adapters: readonly FleetSandboxSweepAdapter[],
|
|
70
|
+
): void {
|
|
71
|
+
const seen = new Set<RuntimeSandboxProviderId>();
|
|
72
|
+
for (const adapter of adapters) {
|
|
73
|
+
if (seen.has(adapter.provider)) {
|
|
74
|
+
throw new FleetSandboxSweepAdapterError(
|
|
75
|
+
`Fleet sandbox sweep has two Adapters for ${adapter.provider}.`,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
seen.add(adapter.provider);
|
|
79
|
+
if (!Number.isSafeInteger(adapter.intervalMs) || adapter.intervalMs <= 0) {
|
|
80
|
+
throw new FleetSandboxSweepAdapterError(
|
|
81
|
+
`Fleet sandbox sweep for ${adapter.provider} needs a positive integer interval.`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
if (adapter.scope === 'provider_inventory') {
|
|
85
|
+
const support = runtimeSandboxProviderProfile(adapter.provider)
|
|
86
|
+
.capabilities.orphanEnumeration;
|
|
87
|
+
if ('reason' in support) {
|
|
88
|
+
throw new FleetSandboxSweepAdapterError(
|
|
89
|
+
`Fleet sandbox sweep cannot enumerate ${adapter.provider}: ${support.reason}`,
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
type PassState = {
|
|
97
|
+
adapter: FleetSandboxSweepAdapter;
|
|
98
|
+
running: Promise<void> | null;
|
|
99
|
+
nextDueAtMs: number;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type FleetSandboxSweep = {
|
|
103
|
+
/**
|
|
104
|
+
* Loop-driven owners: start every pass that is due and not already running,
|
|
105
|
+
* without awaiting it. A pass is due once its interval has elapsed since
|
|
106
|
+
* the previous pass started; the first call starts every pass.
|
|
107
|
+
*/
|
|
108
|
+
runDuePasses: () => void;
|
|
109
|
+
/** Timer-driven owners: start this provider's pass now unless one runs. */
|
|
110
|
+
runPassNow: (provider: RuntimeSandboxProviderId) => void;
|
|
111
|
+
/** Resolves when every in-flight pass has settled. */
|
|
112
|
+
settled: () => Promise<void>;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export function createFleetSandboxSweep(input: {
|
|
116
|
+
adapters: readonly FleetSandboxSweepAdapter[];
|
|
117
|
+
/** Injected clock; read on every call so fake timers apply. */
|
|
118
|
+
now?: () => number;
|
|
119
|
+
}): FleetSandboxSweep {
|
|
120
|
+
assertFleetSandboxSweepAdapters(input.adapters);
|
|
121
|
+
const now = input.now ?? (() => Date.now());
|
|
122
|
+
const states: PassState[] = input.adapters.map((adapter) => ({
|
|
123
|
+
adapter,
|
|
124
|
+
running: null,
|
|
125
|
+
nextDueAtMs: 0,
|
|
126
|
+
}));
|
|
127
|
+
|
|
128
|
+
const start = (state: PassState, startedAtMs: number): void => {
|
|
129
|
+
state.nextDueAtMs = startedAtMs + state.adapter.intervalMs;
|
|
130
|
+
// The async wrapper turns a synchronous throw into a rejection, so it is
|
|
131
|
+
// reported like any other failed pass and never reaches the next Adapter.
|
|
132
|
+
const pass: Promise<void> = (async () => {
|
|
133
|
+
await state.adapter.runPass();
|
|
134
|
+
})()
|
|
135
|
+
.catch((error: unknown) => {
|
|
136
|
+
try {
|
|
137
|
+
state.adapter.reportPassFailure(error);
|
|
138
|
+
} catch {
|
|
139
|
+
// A broken reporter must not fail the host process.
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
.finally(() => {
|
|
143
|
+
if (state.running === pass) state.running = null;
|
|
144
|
+
});
|
|
145
|
+
state.running = pass;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
return {
|
|
149
|
+
runDuePasses() {
|
|
150
|
+
for (const state of states) {
|
|
151
|
+
if (state.running) continue;
|
|
152
|
+
const nowMs = now();
|
|
153
|
+
if (nowMs < state.nextDueAtMs) continue;
|
|
154
|
+
start(state, nowMs);
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
runPassNow(provider) {
|
|
158
|
+
const state = states.find(
|
|
159
|
+
(candidate) => candidate.adapter.provider === provider,
|
|
160
|
+
);
|
|
161
|
+
if (!state) {
|
|
162
|
+
throw new FleetSandboxSweepAdapterError(
|
|
163
|
+
`Fleet sandbox sweep has no Adapter for ${provider}.`,
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
if (state.running) {
|
|
167
|
+
try {
|
|
168
|
+
state.adapter.reportOverlap?.();
|
|
169
|
+
} catch {
|
|
170
|
+
// Reporting only.
|
|
171
|
+
}
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
start(state, now());
|
|
175
|
+
},
|
|
176
|
+
async settled() {
|
|
177
|
+
await Promise.all(
|
|
178
|
+
states.flatMap((state) => (state.running ? [state.running] : [])),
|
|
179
|
+
);
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Timer-driven owner: run every Adapter's pass once now, then once per its
|
|
186
|
+
* interval, skipping (and reporting) a tick whose previous pass still runs.
|
|
187
|
+
* Timers are unref'd so the sweep never keeps a process alive.
|
|
188
|
+
*/
|
|
189
|
+
export function startFleetSandboxSweepTimers(input: {
|
|
190
|
+
adapters: readonly FleetSandboxSweepAdapter[];
|
|
191
|
+
}): { stop: () => void; sweep: FleetSandboxSweep } {
|
|
192
|
+
const sweep = createFleetSandboxSweep({ adapters: input.adapters });
|
|
193
|
+
const intervals = input.adapters.map((adapter) => {
|
|
194
|
+
const interval = setInterval(() => {
|
|
195
|
+
sweep.runPassNow(adapter.provider);
|
|
196
|
+
}, adapter.intervalMs);
|
|
197
|
+
interval.unref?.();
|
|
198
|
+
return interval;
|
|
199
|
+
});
|
|
200
|
+
// Run once immediately: a singleton controller has no fleet-start stampede
|
|
201
|
+
// to smooth, and an early pass shortens recovery after a deploy.
|
|
202
|
+
for (const adapter of input.adapters) sweep.runPassNow(adapter.provider);
|
|
203
|
+
return {
|
|
204
|
+
sweep,
|
|
205
|
+
stop: () => {
|
|
206
|
+
for (const interval of intervals) clearInterval(interval);
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
}
|
|
@@ -34,6 +34,10 @@ export const PLAY_LAUNCH_ENVELOPE_FIELD_ROLES: {
|
|
|
34
34
|
asyncRequestFingerprint: 'identity',
|
|
35
35
|
force: 'identity',
|
|
36
36
|
forceToolRefresh: 'identity',
|
|
37
|
+
// An internal reuse window only changes which completed receipts a call
|
|
38
|
+
// may reuse (an at-least-once cache); a retry that differs only here is the
|
|
39
|
+
// same launch, and the stored digest stays unchanged for older launches.
|
|
40
|
+
cacheReuseWindowSeconds: 'detail',
|
|
37
41
|
maxConcurrentExternalCalls: 'identity',
|
|
38
42
|
maxConcurrentRows: 'identity',
|
|
39
43
|
integrationMode: 'identity',
|
|
@@ -67,7 +67,8 @@ export type PlayRunRecoveryReason =
|
|
|
67
67
|
| 'runtime_initialization_transport_before_execution'
|
|
68
68
|
| 'runner_startup_not_live_before_execution'
|
|
69
69
|
| 'runtime_traffic_hold_before_execution'
|
|
70
|
-
| 'runtime_traffic_throttled_before_execution'
|
|
70
|
+
| 'runtime_traffic_throttled_before_execution'
|
|
71
|
+
| 'vercel_sandbox_unavailable_before_execution';
|
|
71
72
|
|
|
72
73
|
export type PlayRunRecoveryDecision = Readonly<{
|
|
73
74
|
/** A fresh sandbox is safe only before customer code can have started. */
|
|
@@ -492,6 +493,28 @@ export function recoveryForRunnerStartupNotLive(
|
|
|
492
493
|
});
|
|
493
494
|
}
|
|
494
495
|
|
|
496
|
+
/**
|
|
497
|
+
* Vercel Sandbox (Preview only) refused, rate limited, or did not settle a
|
|
498
|
+
* create before any runner command was sent. The Adapter has already recorded
|
|
499
|
+
* the deterministic sandbox name and asked for its confirmed deletion, so a
|
|
500
|
+
* fresh attempt on a new sandbox is safe. `runtime` scope: the Modal circuit
|
|
501
|
+
* must not open for a Vercel outage.
|
|
502
|
+
*/
|
|
503
|
+
export function recoveryForVercelSandboxUnavailable(
|
|
504
|
+
error: unknown,
|
|
505
|
+
): PlayRunRecoveryError {
|
|
506
|
+
return new PlayRunRecoveryError({
|
|
507
|
+
decision: {
|
|
508
|
+
stage: 'pre_code',
|
|
509
|
+
action: 'defer',
|
|
510
|
+
reason: 'vercel_sandbox_unavailable_before_execution',
|
|
511
|
+
dependency: 'runtime',
|
|
512
|
+
},
|
|
513
|
+
message: 'Vercel Sandbox was unavailable before customer execution began.',
|
|
514
|
+
cause: error,
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
|
|
495
518
|
/**
|
|
496
519
|
* A runner transport classifier has already proved that the result has no
|
|
497
520
|
* customer rows or steps. Keep its engine retry typed so an ordinary failed
|
package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/contracts.ts
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* after a resource fact and cleanup obligation exist; it neither creates a
|
|
4
4
|
* sandbox nor decides a Play Run terminal state.
|
|
5
5
|
*/
|
|
6
|
+
import type { RuntimeSandboxProviderId } from '../../runtime-sandbox-provider-profile';
|
|
6
7
|
|
|
7
8
|
export type SandboxCleanupResource = {
|
|
8
|
-
provider:
|
|
9
|
+
provider: RuntimeSandboxProviderId;
|
|
9
10
|
sandboxId: string;
|
|
10
11
|
routingDomain: string | null;
|
|
11
12
|
runId: string;
|
|
@@ -341,6 +341,11 @@ export interface PlayRunnerContextConfig extends RetainedPipelineCarrier {
|
|
|
341
341
|
startupReadToolIds?: string[] | null;
|
|
342
342
|
force?: boolean | null;
|
|
343
343
|
forceToolRefresh?: boolean | null;
|
|
344
|
+
/**
|
|
345
|
+
* Optional internal reuse window in seconds (`play_run.cache_reuse_window`).
|
|
346
|
+
* Absent on older launches, which keep authored freshness.
|
|
347
|
+
*/
|
|
348
|
+
cacheReuseWindowSeconds?: number | null;
|
|
344
349
|
/**
|
|
345
350
|
* Controls how scoped Postgres sessions enter the runner. `preloaded` means
|
|
346
351
|
* the launch config carries short-lived encrypted sessions minted before
|
|
@@ -392,7 +397,7 @@ export interface RunnerPushExecutionConfig {
|
|
|
392
397
|
runId: string;
|
|
393
398
|
/** The provider that acquired this sandbox, which a Daytona-selected launch
|
|
394
399
|
* can differ from after fallback. Absent from older workers. */
|
|
395
|
-
sandboxProvider?: 'daytona' | 'modal';
|
|
400
|
+
sandboxProvider?: 'daytona' | 'modal' | 'vercel';
|
|
396
401
|
/** Test drill only: how long the sandbox watchdog withholds heartbeats once
|
|
397
402
|
* customer code starts. Absent from every ordinary launch. */
|
|
398
403
|
heartbeatSilenceMs?: number;
|
|
@@ -155,6 +155,11 @@ export type PlayRunLedgerDatasetSnapshot = {
|
|
|
155
155
|
* back-filled from row counts, which would assert a lineage nobody observed.
|
|
156
156
|
*/
|
|
157
157
|
bornFrom?: PlayDatasetBornFrom | null;
|
|
158
|
+
/**
|
|
159
|
+
* Stored column names in the order the run wrote them: row keys as the Play
|
|
160
|
+
* built them, then each withColumn. Absent on runs from before the field.
|
|
161
|
+
*/
|
|
162
|
+
columns?: string[];
|
|
158
163
|
updatedAt: number;
|
|
159
164
|
};
|
|
160
165
|
|
|
@@ -388,6 +393,8 @@ export type PlayRunLedgerEvent =
|
|
|
388
393
|
complete?: boolean;
|
|
389
394
|
/** Dataset-grain row birth, stated once per dataset (ADR 0019). */
|
|
390
395
|
bornFrom?: PlayDatasetBornFrom;
|
|
396
|
+
/** Stored column names in the order the run wrote them. */
|
|
397
|
+
columns?: string[];
|
|
391
398
|
})
|
|
392
399
|
| (PlayRunLedgerBaseEvent & {
|
|
393
400
|
type: typeof RUN_EVENT_KIND.activityObserved;
|
|
@@ -1001,6 +1008,7 @@ export function normalizePlayRunLedgerSnapshot(
|
|
|
1001
1008
|
? rawDataset.phase
|
|
1002
1009
|
: 'registered';
|
|
1003
1010
|
const datasetBornFrom = normalizeDatasetBornFrom(rawDataset.bornFrom);
|
|
1011
|
+
const datasetColumns = normalizeDatasetColumns(rawDataset.columns);
|
|
1004
1012
|
datasetsById[datasetId] = {
|
|
1005
1013
|
datasetId,
|
|
1006
1014
|
path: optionalString(rawDataset.path) ?? `datasets.${datasetId}`,
|
|
@@ -1018,6 +1026,7 @@ export function normalizePlayRunLedgerSnapshot(
|
|
|
1018
1026
|
// dropped rather than half-admitted, so a dataset either states where its
|
|
1019
1027
|
// rows came from or says nothing.
|
|
1020
1028
|
...(datasetBornFrom ? { bornFrom: datasetBornFrom } : {}),
|
|
1029
|
+
...(datasetColumns ? { columns: datasetColumns } : {}),
|
|
1021
1030
|
updatedAt: finiteNumber(rawDataset.updatedAt) ?? 0,
|
|
1022
1031
|
};
|
|
1023
1032
|
}
|
|
@@ -2525,6 +2534,14 @@ export function reducePlayRunLedgerEvent(
|
|
|
2525
2534
|
current?.bornFrom,
|
|
2526
2535
|
event.bornFrom,
|
|
2527
2536
|
);
|
|
2537
|
+
// The longest order wins: each phase event restates the run's order so
|
|
2538
|
+
// far, and a later one (a page, or the terminal write's withColumns)
|
|
2539
|
+
// only extends it. An event without one keeps what was recorded.
|
|
2540
|
+
const eventColumns = normalizeDatasetColumns(event.columns);
|
|
2541
|
+
const columns =
|
|
2542
|
+
eventColumns && eventColumns.length >= (current?.columns?.length ?? 0)
|
|
2543
|
+
? eventColumns
|
|
2544
|
+
: current?.columns;
|
|
2528
2545
|
const next: PlayRunLedgerDatasetSnapshot = {
|
|
2529
2546
|
datasetId: event.datasetId,
|
|
2530
2547
|
path: event.path,
|
|
@@ -2555,6 +2572,7 @@ export function reducePlayRunLedgerEvent(
|
|
|
2555
2572
|
// record and must not erase the one that was witnessed; a paged
|
|
2556
2573
|
// dataset re-registers with a larger admitted-row count.
|
|
2557
2574
|
...(mergedBornFrom ? { bornFrom: mergedBornFrom } : {}),
|
|
2575
|
+
...(columns ? { columns } : {}),
|
|
2558
2576
|
updatedAt: occurredAt,
|
|
2559
2577
|
};
|
|
2560
2578
|
return withTiming({
|
|
@@ -3075,3 +3093,22 @@ export function buildPlayRunLedgerEventsFromStatusPatch(input: {
|
|
|
3075
3093
|
|
|
3076
3094
|
return events;
|
|
3077
3095
|
}
|
|
3096
|
+
|
|
3097
|
+
/**
|
|
3098
|
+
* A dataset's written column order, or undefined: a non-empty list of
|
|
3099
|
+
* distinct, non-empty strings. Anything else is treated as not stated, so an
|
|
3100
|
+
* older or malformed writer falls back to the table's own order.
|
|
3101
|
+
*/
|
|
3102
|
+
export function normalizeDatasetColumns(value: unknown): string[] | undefined {
|
|
3103
|
+
if (!Array.isArray(value) || value.length === 0) return undefined;
|
|
3104
|
+
const columns: string[] = [];
|
|
3105
|
+
const seen = new Set<string>();
|
|
3106
|
+
for (const entry of value) {
|
|
3107
|
+
if (typeof entry !== 'string' || !entry.trim() || seen.has(entry)) {
|
|
3108
|
+
return undefined;
|
|
3109
|
+
}
|
|
3110
|
+
seen.add(entry);
|
|
3111
|
+
columns.push(entry);
|
|
3112
|
+
}
|
|
3113
|
+
return columns;
|
|
3114
|
+
}
|
|
@@ -69,7 +69,10 @@ import {
|
|
|
69
69
|
normalizeToolHttpErrorMessage,
|
|
70
70
|
summarizeHtmlErrorBody,
|
|
71
71
|
} from '../tool-http-errors';
|
|
72
|
-
import {
|
|
72
|
+
import {
|
|
73
|
+
augmentSheetContractWithDatasetFields,
|
|
74
|
+
datasetWrittenColumnOrder,
|
|
75
|
+
} from '../../play-data-plane/sheet-contract';
|
|
73
76
|
import { nextWorkCounterInvocationSeq } from '../runtime-work-counters';
|
|
74
77
|
import type { RuntimeApiResponseMeta } from '../app-runtime-api';
|
|
75
78
|
import { onMemoryPressure } from '../memory-pressure-signal';
|
|
@@ -367,6 +370,7 @@ const RUNTIME_RECEIPT_GATEWAY_REQUEST_TIMEOUT_MS =
|
|
|
367
370
|
// or refuses an ambiguous unbound post, so transient gateway responses are safe
|
|
368
371
|
// to retry without creating a second card.
|
|
369
372
|
const RETRY_SAFE_EVENT_WAIT_ARM_TOOLS = new Set([
|
|
373
|
+
'resend_send_and_wait',
|
|
370
374
|
'test_wait_for_event',
|
|
371
375
|
'slack_wait_for_action',
|
|
372
376
|
]);
|
|
@@ -1154,12 +1158,14 @@ export function createRuntimeEventWaitHandler(
|
|
|
1154
1158
|
// Only a newer app advertises this phase. Do not send a new request to an
|
|
1155
1159
|
// older app during the rollout-skew window.
|
|
1156
1160
|
if (boundary.timeoutPolicy?.finalizeOnTimeout !== true) return;
|
|
1157
|
-
await callRuntimeEventWaitEndpoint({
|
|
1161
|
+
const result = await callRuntimeEventWaitEndpoint({
|
|
1158
1162
|
phase: 'timeout',
|
|
1159
1163
|
payload,
|
|
1160
1164
|
context,
|
|
1161
1165
|
boundary,
|
|
1162
1166
|
});
|
|
1167
|
+
if (result.resolvedOutput)
|
|
1168
|
+
return { resolvedOutput: result.resolvedOutput };
|
|
1163
1169
|
},
|
|
1164
1170
|
};
|
|
1165
1171
|
return handler;
|
|
@@ -1513,6 +1519,17 @@ function emitSystemLog(line: string, options?: ExecutePlayRunnerOptions): void {
|
|
|
1513
1519
|
|
|
1514
1520
|
export function playRunnerContextCachePolicy(
|
|
1515
1521
|
context: PlayRunnerExecutionConfig['context'],
|
|
1522
|
+
): ContextOptions['cachePolicy'] | undefined {
|
|
1523
|
+
const policy = playRunnerContextForcePolicy(context);
|
|
1524
|
+
const window = context.cacheReuseWindowSeconds;
|
|
1525
|
+
// Optional launch field: older launches carry none.
|
|
1526
|
+
if (typeof window !== 'number' || !Number.isSafeInteger(window) || window <= 0)
|
|
1527
|
+
return policy;
|
|
1528
|
+
return { ...policy, cacheReuseWindowSeconds: window };
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
function playRunnerContextForcePolicy(
|
|
1532
|
+
context: PlayRunnerExecutionConfig['context'],
|
|
1516
1533
|
): ContextOptions['cachePolicy'] | undefined {
|
|
1517
1534
|
// A person resumed this run after fixing what made it stop, so calls that
|
|
1518
1535
|
// failed before the resume run again. Successes stay recorded: only failed
|
|
@@ -2489,6 +2506,8 @@ async function run(
|
|
|
2489
2506
|
persistedRows: number;
|
|
2490
2507
|
succeededRows: number;
|
|
2491
2508
|
failedRows: number;
|
|
2509
|
+
/** Stored column names in the order this run wrote them. */
|
|
2510
|
+
columns?: string[];
|
|
2492
2511
|
}
|
|
2493
2512
|
>();
|
|
2494
2513
|
const runtimeSheetAttemptKey = (input: {
|
|
@@ -2825,6 +2844,9 @@ async function run(
|
|
|
2825
2844
|
succeededRows: settlement.succeededRows,
|
|
2826
2845
|
failedRows: settlement.failedRows,
|
|
2827
2846
|
complete: false,
|
|
2847
|
+
...(settlement.columns?.length
|
|
2848
|
+
? { columns: settlement.columns }
|
|
2849
|
+
: {}),
|
|
2828
2850
|
at: event.at,
|
|
2829
2851
|
},
|
|
2830
2852
|
},
|
|
@@ -3042,6 +3064,11 @@ async function run(
|
|
|
3042
3064
|
// terminal persistence, advertising 2N rows for an N-row Dataset Handle.
|
|
3043
3065
|
// `net_new` maps exclude these rows before execution, so they must not
|
|
3044
3066
|
// be counted here either.
|
|
3067
|
+
settlement.columns = datasetWrittenColumnOrder({
|
|
3068
|
+
contract: sheetContract,
|
|
3069
|
+
rows: items,
|
|
3070
|
+
existing: settlement.columns,
|
|
3071
|
+
});
|
|
3045
3072
|
runtimeMapDatasetSettlements.set(datasetId, settlement);
|
|
3046
3073
|
emitRunnerEvent(
|
|
3047
3074
|
{
|
|
@@ -3056,6 +3083,9 @@ async function run(
|
|
|
3056
3083
|
succeededRows: 0,
|
|
3057
3084
|
failedRows: 0,
|
|
3058
3085
|
complete: false,
|
|
3086
|
+
...(settlement.columns.length > 0
|
|
3087
|
+
? { columns: settlement.columns }
|
|
3088
|
+
: {}),
|
|
3059
3089
|
// ADR 0019 dataset-grain row birth. These rows entered from
|
|
3060
3090
|
// play-body code, so the only witnessed fact is how many arrived at
|
|
3061
3091
|
// this table — never a per-row source mapping, which the runtime
|
|
@@ -3426,6 +3456,12 @@ async function run(
|
|
|
3426
3456
|
settlement.persistedRows += committedTerminalRows;
|
|
3427
3457
|
settlement.succeededRows += succeededRows;
|
|
3428
3458
|
settlement.failedRows += failedRows;
|
|
3459
|
+
settlement.columns = datasetWrittenColumnOrder({
|
|
3460
|
+
contract: sheetContract,
|
|
3461
|
+
rows: input.rows,
|
|
3462
|
+
outputFields: input.outputFields,
|
|
3463
|
+
existing: settlement.columns,
|
|
3464
|
+
});
|
|
3429
3465
|
runtimeMapDatasetSettlements.set(datasetId, settlement);
|
|
3430
3466
|
emitWorkerLog(
|
|
3431
3467
|
`[perf] runtime map persist table=${input.tableNamespace} rows=${input.rows.length} updated=${result.updated} accepted=${committedTerminalRows} stale=${staleKeys.size} elapsed_ms=${Date.now() - persistStartedAt}`,
|
|
@@ -3709,6 +3745,9 @@ async function run(
|
|
|
3709
3745
|
succeededRows: settlement.succeededRows,
|
|
3710
3746
|
failedRows: settlement.failedRows,
|
|
3711
3747
|
complete: true,
|
|
3748
|
+
...(settlement.columns?.length
|
|
3749
|
+
? { columns: settlement.columns }
|
|
3750
|
+
: {}),
|
|
3712
3751
|
at: Date.now(),
|
|
3713
3752
|
},
|
|
3714
3753
|
},
|
|
@@ -4658,7 +4697,7 @@ let runnerTerminalPushContext: {
|
|
|
4658
4697
|
gatewayBaseUrl: string;
|
|
4659
4698
|
executorToken: string;
|
|
4660
4699
|
runId: string;
|
|
4661
|
-
sandboxProvider?: 'daytona' | 'modal';
|
|
4700
|
+
sandboxProvider?: 'daytona' | 'modal' | 'vercel';
|
|
4662
4701
|
} | null = null;
|
|
4663
4702
|
|
|
4664
4703
|
function terminalPushContextFromConfig(
|