deepline 0.3.542 → 0.3.544
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 +112 -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/monitor-fleet-contract.ts +3 -1
- package/dist/bundling-sources/shared_libs/integration-contracts/tool-connection.ts +13 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +108 -1
- 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/durable-summary-events.ts +29 -0
- 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 +43 -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 +49 -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 +229 -144
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +2 -2
- 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-ENBXAKQS.js +43 -0
- package/dist/cli/{auth-IGBGOB4E.mjs → auth-IMWJAHPU.mjs} +5 -5
- package/dist/cli/{billing-IB2TWE74.js → billing-Y55PR2PV.js} +101 -101
- package/dist/cli/{billing-N37W2I62.mjs → billing-YQMW3QJI.mjs} +12 -12
- package/dist/cli/chunk-22OBDYHP.js +455 -0
- 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-D44DP4KJ.js → chunk-3I26HMJ7.js} +37 -17
- package/dist/cli/{chunk-B5NP3SHX.mjs → chunk-3JDA23NN.mjs} +2 -2
- package/dist/cli/{chunk-QXNOSCYL.js → chunk-3KGMM4KS.js} +1 -1
- package/dist/cli/{chunk-6WQDHEVF.mjs → chunk-456RRXAP.mjs} +5 -5
- package/dist/cli/{chunk-V4EYJKGJ.js → chunk-4JQEAYN3.js} +156 -17
- package/dist/cli/{chunk-FGGPCAGC.js → chunk-4PKHFW56.js} +18 -18
- package/dist/cli/{chunk-QONO7FRF.mjs → chunk-57G4NYOL.mjs} +1 -1
- package/dist/cli/{chunk-46V7QSJE.mjs → chunk-5PR4VLLL.mjs} +3 -3
- package/dist/cli/{chunk-OLH2PHMC.mjs → chunk-6P7TGCHQ.mjs} +1 -1
- package/dist/cli/{chunk-AKY7KZRJ.js → chunk-7GNZEOTH.js} +6 -6
- package/dist/cli/{chunk-LFMQVSEI.js → chunk-7HMMTSDA.js} +5 -5
- package/dist/cli/{chunk-ORA5TMML.mjs → chunk-BEQ7RQLT.mjs} +5 -5
- package/dist/cli/{chunk-KQSTV4MW.js → chunk-BLYW6FFB.js} +60 -18
- package/dist/cli/{chunk-GM73TZ2W.js → chunk-C4P2KLWT.js} +41 -41
- package/dist/cli/{chunk-DNGACHFX.js → chunk-COJHT2KF.js} +22 -22
- package/dist/cli/{chunk-6SLEHAXX.js → chunk-DF2X7GJG.js} +5 -5
- package/dist/cli/{chunk-TT4JUUC3.mjs → chunk-DVDWAC2M.mjs} +7 -3
- package/dist/cli/{chunk-5CAVURVS.js → chunk-DYDHLBSK.js} +53 -53
- package/dist/cli/{chunk-UNDLNT3V.js → chunk-ECWOIXAV.js} +1 -1
- package/dist/cli/{chunk-EHLCWGWN.js → chunk-G26VJCNT.js} +4 -4
- package/dist/cli/{chunk-WL2GUGNZ.js → chunk-GQHRGBHV.js} +7 -7
- package/dist/cli/{chunk-DADH3WPE.mjs → chunk-GV45TTI6.mjs} +2 -2
- package/dist/cli/{chunk-OVX3Q5Q3.mjs → chunk-GWNYLIF7.mjs} +1 -1
- package/dist/cli/{chunk-EGOCGWCI.mjs → chunk-H4SAHB3Q.mjs} +3 -3
- package/dist/cli/{chunk-FX4OWXKK.mjs → chunk-HAQRF6DJ.mjs} +2 -2
- package/dist/cli/{chunk-NLZHLEHD.mjs → chunk-HBSWATOU.mjs} +6 -6
- package/dist/cli/{chunk-ACVTMAW4.mjs → chunk-HVJQF5BI.mjs} +2 -2
- package/dist/cli/{chunk-L2VKAASU.mjs → chunk-HXIR3VQL.mjs} +21 -0
- package/dist/cli/{chunk-Z5YRKX7K.mjs → chunk-HXM2JUGD.mjs} +1 -1
- package/dist/cli/{chunk-JPT6VE54.js → chunk-IFIJ4DBJ.js} +2 -2
- package/dist/cli/{chunk-HAITCPCG.js → chunk-JBWOE6AP.js} +16 -16
- package/dist/cli/{chunk-AWLPERL3.js → chunk-JWVG7ZPX.js} +3 -3
- package/dist/cli/{chunk-3XXXMSSP.js → chunk-KE6CSCUF.js} +44 -44
- package/dist/cli/{chunk-2ZGSHVZE.mjs → chunk-LPUBBUKX.mjs} +24 -4
- package/dist/cli/{chunk-PLIKPGOO.mjs → chunk-LQ6RRYXN.mjs} +5 -5
- package/dist/cli/{chunk-FFDZT255.mjs → chunk-LW274RO7.mjs} +1 -1
- package/dist/cli/{chunk-Z2XA6YU4.mjs → chunk-LX35AXTN.mjs} +1 -0
- package/dist/cli/{chunk-FANIRW74.mjs → chunk-NIPLY25A.mjs} +0 -2
- package/dist/cli/{chunk-VHJUH3TB.js → chunk-ON56ISO6.js} +3 -3
- package/dist/cli/{chunk-4I47NCRI.js → chunk-PDJ4UDCO.js} +498 -328
- package/dist/cli/{chunk-SWO5QOXB.mjs → chunk-PFGOCUH3.mjs} +1 -1
- package/dist/cli/{chunk-Q7WDXLYO.js → chunk-PKRW76XG.js} +2 -2
- package/dist/cli/{chunk-YK7NNZD4.mjs → chunk-PMW5YP72.mjs} +37 -190
- package/dist/cli/{chunk-5APOJWJF.mjs → chunk-Q7ZOWNKR.mjs} +183 -13
- package/dist/cli/{chunk-WACIN4PR.mjs → chunk-REEOMNCO.mjs} +3 -3
- package/dist/cli/{chunk-DMXLZ57N.js → chunk-RG34YBDE.js} +2 -2
- package/dist/cli/{chunk-3LEUSRV3.mjs → chunk-RJPDCSTD.mjs} +4 -4
- package/dist/cli/{chunk-IPVRMYWT.js → chunk-RKF263LR.js} +5 -5
- package/dist/cli/{chunk-AUFE624T.js → chunk-RUFR4PUO.js} +10 -10
- package/dist/cli/{chunk-I5EAIFGO.mjs → chunk-SK3HPU2J.mjs} +1 -1
- package/dist/cli/{chunk-ZVNYBQ77.mjs → chunk-SKS53WM6.mjs} +4 -4
- package/dist/cli/{chunk-CQDQNZGH.js → chunk-SL6MYJYM.js} +1 -0
- package/dist/cli/{chunk-E4CABWXL.js → chunk-TI6DTURF.js} +22 -1
- package/dist/cli/{chunk-CFZCRM6R.js → chunk-UHIAQPVA.js} +26 -26
- package/dist/cli/{chunk-D7GWEBMF.js → chunk-UNMNGRPB.js} +7 -7
- package/dist/cli/{chunk-GWHA4DAC.js → chunk-UV4RU2TE.js} +0 -2
- package/dist/cli/{chunk-TTBHOMAA.js → chunk-W7X4KH45.js} +316 -469
- package/dist/cli/chunk-WBSGPLH5.mjs +455 -0
- package/dist/cli/{chunk-SCLP5H4P.mjs → chunk-WUEORIOY.mjs} +1 -1
- package/dist/cli/{chunk-IDDKNMFX.mjs → chunk-Y3T5GWYK.mjs} +153 -14
- package/dist/cli/{chunk-P4MDTBAA.mjs → chunk-YIRVKMON.mjs} +1 -1
- package/dist/cli/{chunk-NDNEARE3.js → chunk-Z44YTSTA.js} +13 -13
- package/dist/cli/{chunk-F6QV42MC.mjs → chunk-Z7SXGOIQ.mjs} +1 -1
- package/dist/cli/{chunk-2VRKBHMD.mjs → chunk-ZHY4T5M6.mjs} +1 -1
- package/dist/cli/{chunk-E7B73LGT.js → chunk-ZY6FL4O4.js} +24 -20
- package/dist/cli/command-docs.js +3 -3
- package/dist/cli/command-docs.mjs +2 -2
- package/dist/cli/{concurrent-runs-help-DIBGMEIN.mjs → concurrent-runs-help-KBWPKSTP.mjs} +7 -7
- package/dist/cli/concurrent-runs-help-TOMLCMV7.js +21 -0
- package/dist/cli/{csv-CAVA3EMS.mjs → csv-M5EBEMZH.mjs} +4 -4
- package/dist/cli/{csv-XZAM7EYZ.js → csv-XGGDZTQI.js} +13 -13
- package/dist/cli/{db-PPGEOBNG.js → db-CVPR54XK.js} +29 -29
- package/dist/cli/{db-HD332QI7.mjs → db-M6FJ6J6E.mjs} +8 -8
- package/dist/cli/describe-RUODIS6M.js +50 -0
- package/dist/cli/describe-X6QA2U3C.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-AFEOLB4A.mjs → executions-EHTS2XJX.mjs} +8 -8
- package/dist/cli/{executions-4ZKBL7IC.js → executions-VJEEWN22.js} +10 -10
- package/dist/cli/{feedback-J2YPLKMF.mjs → feedback-76VGY4GP.mjs} +6 -6
- package/dist/cli/{feedback-M6Y33JKT.js → feedback-DQPUCUXO.js} +14 -14
- package/dist/cli/{git-632RYEF6.mjs → git-IY6DKKLR.mjs} +5 -5
- package/dist/cli/git-RLHTSYRY.js +25 -0
- package/dist/cli/index.js +150 -146
- package/dist/cli/index.mjs +49 -45
- package/dist/cli/integrations-242LE3TQ.mjs +98 -0
- package/dist/cli/integrations-CQSTIKFY.js +98 -0
- package/dist/cli/{legacy-noops-KWZMXYAU.mjs → legacy-noops-SWTSTMRY.mjs} +6 -6
- package/dist/cli/{legacy-noops-4Y62TKPC.js → legacy-noops-U72DO6ZF.js} +9 -9
- package/dist/cli/{mcp-PESLHAAC.mjs → mcp-JJH6JR52.mjs} +72 -15
- package/dist/cli/{mcp-35QA6YG7.js → mcp-L473BKLJ.js} +89 -32
- package/dist/cli/{monitors-4DTUZLAI.js → monitors-3TF2DOFD.js} +119 -104
- package/dist/cli/{monitors-YVBKBJBU.mjs → monitors-VSYHUBKC.mjs} +26 -11
- package/dist/cli/{org-DJNKMFCZ.mjs → org-S5VIKU2E.mjs} +8 -8
- package/dist/cli/{org-FWCBZMER.js → org-YKVI2ZTI.js} +90 -90
- package/dist/cli/{play-PHVQEEEZ.mjs → play-C7T5A3QM.mjs} +44 -25
- package/dist/cli/{play-FZ45M4KD.js → play-DOWEG45Y.js} +374 -355
- package/dist/cli/{providers-46E67QG7.mjs → providers-BMVVX3VD.mjs} +10 -9
- package/dist/cli/{providers-QJU6FMDD.js → providers-TAZPPFTB.js} +13 -12
- package/dist/cli/{quickstart-6HMJJ4RR.mjs → quickstart-A3WKMKTW.mjs} +4 -4
- package/dist/cli/{quickstart-HOL7H5FS.js → quickstart-HD6FQXGR.js} +6 -6
- package/dist/cli/{run-WKSIRXEC.js → run-BVVV2UX7.js} +49 -48
- package/dist/cli/{run-2W2TJ6QA.mjs → run-FV7TWNOC.mjs} +28 -27
- package/dist/cli/{search-Y2CFLSYB.mjs → search-MGK6WIKS.mjs} +9 -9
- package/dist/cli/search-VJFCWUZN.js +32 -0
- package/dist/cli/{search-output-2IK6ZZDY.js → search-output-6Y7KEPIE.js} +6 -6
- package/dist/cli/{search-output-FCZ35PHF.mjs → search-output-GM7LDZKE.mjs} +4 -4
- package/dist/cli/{secrets-PNPNUZLX.mjs → secrets-4RFAR7YI.mjs} +8 -8
- package/dist/cli/{secrets-JVJIHGU4.js → secrets-SISXIXSZ.js} +17 -17
- package/dist/cli/{sessions-GY5VVQGO.mjs → sessions-CE3OMEG7.mjs} +6 -6
- package/dist/cli/sessions-OWWZJZXH.js +22 -0
- package/dist/cli/{settings-5WHMFRNQ.js → settings-4HPM3K4A.js} +89 -89
- package/dist/cli/{settings-YQOPF3AI.mjs → settings-E22IDSX2.mjs} +16 -16
- package/dist/cli/{setup-3VJMKDEU.js → setup-BDRSNLKX.js} +49 -49
- package/dist/cli/{setup-O5U5IEVW.mjs → setup-BK65MDZ6.mjs} +9 -9
- package/dist/cli/{skills-G6J5PF35.mjs → skills-FI2GZMR4.mjs} +7 -7
- package/dist/cli/skills-ZLBFUAFR.js +36 -0
- package/dist/cli/tools-3K72VE33.js +57 -0
- package/dist/cli/{tools-AG7SWL5Y.mjs → tools-HMMWYUNW.mjs} +20 -19
- package/dist/cli/update-QZV6DH5V.js +34 -0
- package/dist/cli/{update-K73DD6CR.mjs → update-WDKBSXV5.mjs} +9 -9
- package/dist/cli/{views-4D2OTLIO.js → views-775AUDWQ.js} +23 -23
- package/dist/cli/{views-MO6DIOMR.mjs → views-JYIJCO23.mjs} +8 -8
- package/dist/cli/{workflow-ZEMFCS4Y.js → workflow-4H6KQRFQ.js} +19 -19
- package/dist/cli/{workflow-MMZMAELI.mjs → workflow-FKKHE3IU.mjs} +9 -9
- package/dist/{client-DLG9mHDh.d.mts → client-ANT3pyoa.d.mts} +1 -1
- package/dist/{client-X-FJD5Dp.d.ts → client-DD_FyJVd.d.ts} +1 -1
- package/dist/{client-core-WtnqyBwY.d.mts → client-core-Dg9tKhdB.d.mts} +339 -3
- package/dist/{client-core-0jmHfFBv.d.ts → client-core-QHmo73k1.d.ts} +339 -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,3 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COMPUTE_BILLED_SANDBOX_RESOURCE_KIND_LIST_SQL,
|
|
3
|
+
MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL,
|
|
4
|
+
managedSandboxKindForProviderSql,
|
|
5
|
+
managedSandboxProviderSql,
|
|
6
|
+
managedSandboxRoutingDomainForProviderSql,
|
|
7
|
+
managedSandboxRoutingDomainSql,
|
|
8
|
+
} from './managed-sandbox-resource-sql';
|
|
1
9
|
import {
|
|
2
10
|
PLATFORM_RECOVERY_ACTIVITY_ID,
|
|
3
11
|
SANDBOX_CAPACITY_ACTIVITY_ID,
|
|
@@ -80,6 +88,8 @@ import {
|
|
|
80
88
|
runtimeSandboxOperationStateSqlType,
|
|
81
89
|
runtimeSandboxOperationTargetState,
|
|
82
90
|
runtimeSandboxProviderForResourceKind,
|
|
91
|
+
runtimeSandboxRoutingDomainForResource,
|
|
92
|
+
type ManagedSandboxResourceKind,
|
|
83
93
|
} from './runtime-sandbox-operation';
|
|
84
94
|
import {
|
|
85
95
|
AmbiguousModalCreateStatus,
|
|
@@ -301,6 +311,7 @@ import {
|
|
|
301
311
|
} from '../runtime-telemetry';
|
|
302
312
|
import {
|
|
303
313
|
emitPlayRunFinished,
|
|
314
|
+
sandboxProviderOfRunnerResult,
|
|
304
315
|
playRunFailureDetailsOf,
|
|
305
316
|
} from '../durable-summary-events';
|
|
306
317
|
import { buildAbsurdPlayRunTask } from './absurd-play-run-task';
|
|
@@ -448,7 +459,31 @@ const POSTGRES_SCHEDULER_SCHEMA_INIT_STATEMENT_TIMEOUT_MS = 60_000;
|
|
|
448
459
|
// (`runtime_scheduler_runs_staged_input_expiry_idx`). It is an optional
|
|
449
460
|
// optimization built concurrently, absent from the readiness shape, and this
|
|
450
461
|
// marker records deployment work, never a runtime schema floor.
|
|
451
|
-
|
|
462
|
+
// v68 widens the `provider` CHECK on the four managed-sandbox tables
|
|
463
|
+
// (capacity leases, operation ledger, cleanup jobs and cleanup events) to admit
|
|
464
|
+
// `vercel` beside `daytona` and `modal`. Expand only: no writer emits it yet,
|
|
465
|
+
// every existing row already satisfies the wider check, and older workers only
|
|
466
|
+
// claim cleanup for their own providers. Nothing reads this marker at runtime.
|
|
467
|
+
export const POSTGRES_SCHEDULER_SCHEMA_VERSION = 68;
|
|
468
|
+
/**
|
|
469
|
+
* Providers the managed-sandbox tables admit. A new provider is added here
|
|
470
|
+
* (and so to every `provider` CHECK) before any writer records it.
|
|
471
|
+
*/
|
|
472
|
+
const POSTGRES_SCHEDULER_SANDBOX_PROVIDERS = [
|
|
473
|
+
'daytona',
|
|
474
|
+
'modal',
|
|
475
|
+
'vercel',
|
|
476
|
+
] as const;
|
|
477
|
+
const POSTGRES_SCHEDULER_SANDBOX_PROVIDER_CHECK_SQL = `provider IN (${POSTGRES_SCHEDULER_SANDBOX_PROVIDERS.map(
|
|
478
|
+
(provider) => `'${provider}'`,
|
|
479
|
+
).join(', ')})`;
|
|
480
|
+
/** Tables whose `provider` CHECK follows `POSTGRES_SCHEDULER_SANDBOX_PROVIDERS`. */
|
|
481
|
+
const POSTGRES_SCHEDULER_SANDBOX_PROVIDER_TABLES = [
|
|
482
|
+
'runtime_sandbox_capacity_leases',
|
|
483
|
+
'runtime_sandbox_operations',
|
|
484
|
+
'sandbox_cleanup_jobs_v2',
|
|
485
|
+
'sandbox_cleanup_events_v2',
|
|
486
|
+
] as const;
|
|
452
487
|
const POSTGRES_SCHEDULER_SCHEMA_MIGRATIONS_TABLE =
|
|
453
488
|
'scheduler_schema_migrations';
|
|
454
489
|
export const POSTGRES_SCHEDULER_OPEN_RECOVERY_INDEX =
|
|
@@ -1152,6 +1187,11 @@ function quoteIdent(value: string): string {
|
|
|
1152
1187
|
return `"${value.replace(/"/g, '""')}"`;
|
|
1153
1188
|
}
|
|
1154
1189
|
|
|
1190
|
+
/** A SQL string literal for trusted, code-owned DDL text. */
|
|
1191
|
+
function quoteLiteral(value: string): string {
|
|
1192
|
+
return `'${value.replace(/'/g, "''")}'`;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1155
1195
|
function schemaName(
|
|
1156
1196
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
1157
1197
|
): string {
|
|
@@ -2477,12 +2517,91 @@ export async function ensurePostgresSchedulerOnlineAdditiveExpansion(
|
|
|
2477
2517
|
await ensurePostgresSchedulerRunLogStorageExpansion(client, options);
|
|
2478
2518
|
await ensurePostgresSchedulerArrayInputIntentExpansion(client, options);
|
|
2479
2519
|
await ensurePostgresSchedulerGatewayReaderFenceSchema(client, options);
|
|
2520
|
+
await ensurePostgresSchedulerSandboxProviderCheckExpansion(client, options);
|
|
2480
2521
|
await ensurePostgresSchedulerSandboxCapacityAdmissionFunctions(
|
|
2481
2522
|
client,
|
|
2482
2523
|
options,
|
|
2483
2524
|
);
|
|
2484
2525
|
}
|
|
2485
2526
|
|
|
2527
|
+
/**
|
|
2528
|
+
* Deployment-owned v68 expansion: widen each managed-sandbox table's
|
|
2529
|
+
* `provider` CHECK to `POSTGRES_SCHEDULER_SANDBOX_PROVIDERS`.
|
|
2530
|
+
*
|
|
2531
|
+
* Expand only. The narrower check is replaced by a wider one added `NOT
|
|
2532
|
+
* VALID` (a brief catalog lock, no scan), then validated in its own statement,
|
|
2533
|
+
* which scans without blocking writers. Every existing row already satisfies
|
|
2534
|
+
* the wider check. Each statement is idempotent and enters the deployment
|
|
2535
|
+
* caller's own bounded transaction, so a rerun or an interrupted run resumes
|
|
2536
|
+
* without touching a table that is already expanded. A table that does not
|
|
2537
|
+
* exist yet is skipped. The bootstrap still creates these tables with their
|
|
2538
|
+
* original (Daytona/Modal) checks, unchanged for the shared-schema DDL gate,
|
|
2539
|
+
* and widens them through this expansion before writing the marker.
|
|
2540
|
+
*/
|
|
2541
|
+
export async function ensurePostgresSchedulerSandboxProviderCheckExpansion(
|
|
2542
|
+
client: PostgresSchedulerQueryClient,
|
|
2543
|
+
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
2544
|
+
): Promise<void> {
|
|
2545
|
+
for (const table of POSTGRES_SCHEDULER_SANDBOX_PROVIDER_TABLES) {
|
|
2546
|
+
const relation = tableName(table, options);
|
|
2547
|
+
const constraint = quoteIdent(`${table}_provider_check`);
|
|
2548
|
+
await client.query(`
|
|
2549
|
+
DO $$
|
|
2550
|
+
DECLARE
|
|
2551
|
+
relation regclass := to_regclass(${quoteLiteral(relation)});
|
|
2552
|
+
drops text;
|
|
2553
|
+
BEGIN
|
|
2554
|
+
IF relation IS NULL OR EXISTS (
|
|
2555
|
+
SELECT 1 FROM pg_constraint
|
|
2556
|
+
WHERE conrelid = relation
|
|
2557
|
+
AND contype = 'c'
|
|
2558
|
+
AND pg_get_constraintdef(oid) LIKE '%(provider = ANY (%'
|
|
2559
|
+
${POSTGRES_SCHEDULER_SANDBOX_PROVIDERS.map(
|
|
2560
|
+
(provider) =>
|
|
2561
|
+
`AND pg_get_constraintdef(oid) LIKE ${quoteLiteral(`%'${provider}'%`)}`,
|
|
2562
|
+
).join('\n ')}
|
|
2563
|
+
) THEN
|
|
2564
|
+
RETURN;
|
|
2565
|
+
END IF;
|
|
2566
|
+
SELECT string_agg(format('DROP CONSTRAINT %I, ', conname), '')
|
|
2567
|
+
INTO drops
|
|
2568
|
+
FROM pg_constraint
|
|
2569
|
+
WHERE conrelid = relation
|
|
2570
|
+
AND contype = 'c'
|
|
2571
|
+
AND pg_get_constraintdef(oid) LIKE '%(provider = ANY (%';
|
|
2572
|
+
-- One statement: the narrower check is never absent while the wider
|
|
2573
|
+
-- one is missing.
|
|
2574
|
+
EXECUTE format(
|
|
2575
|
+
'ALTER TABLE %s %sADD CONSTRAINT %s CHECK (%s) NOT VALID',
|
|
2576
|
+
relation,
|
|
2577
|
+
coalesce(drops, ''),
|
|
2578
|
+
${quoteLiteral(constraint)},
|
|
2579
|
+
${quoteLiteral(POSTGRES_SCHEDULER_SANDBOX_PROVIDER_CHECK_SQL)}
|
|
2580
|
+
);
|
|
2581
|
+
END $$
|
|
2582
|
+
`);
|
|
2583
|
+
await client.query(`
|
|
2584
|
+
DO $$
|
|
2585
|
+
DECLARE
|
|
2586
|
+
relation regclass := to_regclass(${quoteLiteral(relation)});
|
|
2587
|
+
BEGIN
|
|
2588
|
+
IF relation IS NOT NULL AND EXISTS (
|
|
2589
|
+
SELECT 1 FROM pg_constraint
|
|
2590
|
+
WHERE conrelid = relation
|
|
2591
|
+
AND conname = ${quoteLiteral(`${table}_provider_check`)}
|
|
2592
|
+
AND NOT convalidated
|
|
2593
|
+
) THEN
|
|
2594
|
+
EXECUTE format(
|
|
2595
|
+
'ALTER TABLE %s VALIDATE CONSTRAINT %s',
|
|
2596
|
+
relation,
|
|
2597
|
+
${quoteLiteral(constraint)}
|
|
2598
|
+
);
|
|
2599
|
+
END IF;
|
|
2600
|
+
END $$
|
|
2601
|
+
`);
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2486
2605
|
/** Deployment-owned v64 expansion; absent values retain legacy behavior. */
|
|
2487
2606
|
async function ensurePostgresSchedulerArrayInputIntentExpansion(
|
|
2488
2607
|
client: PostgresSchedulerQueryClient,
|
|
@@ -3433,6 +3552,16 @@ export async function ensurePostgresSchedulerSchema(
|
|
|
3433
3552
|
concurrently: false,
|
|
3434
3553
|
});
|
|
3435
3554
|
}
|
|
3555
|
+
// The current-shape probe does not read the provider checks, so a v67
|
|
3556
|
+
// schema takes this path; widen them before the v68 marker is written.
|
|
3557
|
+
// Once the marker is recorded the deploy migration owns them, so a
|
|
3558
|
+
// worker cold start never takes table locks for this.
|
|
3559
|
+
if (!appliedVersion.rows[0]?.applied) {
|
|
3560
|
+
await ensurePostgresSchedulerSandboxProviderCheckExpansion(
|
|
3561
|
+
client,
|
|
3562
|
+
options,
|
|
3563
|
+
);
|
|
3564
|
+
}
|
|
3436
3565
|
await ensurePostgresSchedulerSandboxCapacityAdmissionFunctions(
|
|
3437
3566
|
client,
|
|
3438
3567
|
options,
|
|
@@ -3887,6 +4016,10 @@ export async function ensurePostgresSchedulerSchema(
|
|
|
3887
4016
|
END IF;
|
|
3888
4017
|
END $$
|
|
3889
4018
|
`);
|
|
4019
|
+
// The managed-sandbox tables are still created with their original
|
|
4020
|
+
// (Daytona/Modal) provider checks, which a shared database keeps; every
|
|
4021
|
+
// bootstrap then widens them through the same v68 expansion.
|
|
4022
|
+
await ensurePostgresSchedulerSandboxProviderCheckExpansion(client, options);
|
|
3890
4023
|
await client.query(`
|
|
3891
4024
|
DROP INDEX IF EXISTS ${quoteIdent(schemaName(options))}.${quoteIdent(
|
|
3892
4025
|
'runtime_scheduler_sandbox_operations_reconcile_idx',
|
|
@@ -9225,7 +9358,7 @@ export async function failPostgresSchedulerScheduledChildWaits(
|
|
|
9225
9358
|
ELSE (
|
|
9226
9359
|
SELECT jsonb_agg(
|
|
9227
9360
|
CASE
|
|
9228
|
-
WHEN resource->>'kind' IN
|
|
9361
|
+
WHEN resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
9229
9362
|
THEN resource || jsonb_build_object(
|
|
9230
9363
|
'billingEndedAt',
|
|
9231
9364
|
extract(
|
|
@@ -9266,10 +9399,7 @@ export async function failPostgresSchedulerScheduledChildWaits(
|
|
|
9266
9399
|
provider, sandbox_id, run_id, attempt, environment, routing_domain
|
|
9267
9400
|
)
|
|
9268
9401
|
SELECT DISTINCT
|
|
9269
|
-
|
|
9270
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
9271
|
-
ELSE 'daytona'
|
|
9272
|
-
END,
|
|
9402
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
9273
9403
|
resource->>'sandboxId',
|
|
9274
9404
|
terminal_attempts.run_id,
|
|
9275
9405
|
terminal_attempts.attempt,
|
|
@@ -9278,10 +9408,7 @@ export async function failPostgresSchedulerScheduledChildWaits(
|
|
|
9278
9408
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
9279
9409
|
'production'
|
|
9280
9410
|
),
|
|
9281
|
-
|
|
9282
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
9283
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
9284
|
-
END
|
|
9411
|
+
${managedSandboxRoutingDomainSql('resource')}
|
|
9285
9412
|
FROM terminal_attempts
|
|
9286
9413
|
CROSS JOIN LATERAL jsonb_array_elements(
|
|
9287
9414
|
CASE
|
|
@@ -9291,7 +9418,7 @@ export async function failPostgresSchedulerScheduledChildWaits(
|
|
|
9291
9418
|
END
|
|
9292
9419
|
) AS resource
|
|
9293
9420
|
WHERE terminal_attempts.resource_json IS NOT NULL
|
|
9294
|
-
AND resource->>'kind' IN
|
|
9421
|
+
AND resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
9295
9422
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
9296
9423
|
ON CONFLICT (provider, sandbox_id, routing_domain_key) DO NOTHING
|
|
9297
9424
|
), compute_billing_job AS (
|
|
@@ -9308,7 +9435,7 @@ export async function failPostgresSchedulerScheduledChildWaits(
|
|
|
9308
9435
|
) AS resource
|
|
9309
9436
|
WHERE resource->>'kind' IN ('compute_session', 'local_process')
|
|
9310
9437
|
OR (
|
|
9311
|
-
resource->>'kind' IN
|
|
9438
|
+
resource->>'kind' IN ${COMPUTE_BILLED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
9312
9439
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
9313
9440
|
)
|
|
9314
9441
|
ON CONFLICT (run_id) DO NOTHING
|
|
@@ -11811,10 +11938,22 @@ export async function recordPostgresSchedulerSignal(
|
|
|
11811
11938
|
eventKey: string;
|
|
11812
11939
|
boundaryId?: string | null;
|
|
11813
11940
|
payload: unknown;
|
|
11941
|
+
deliveryId?: string;
|
|
11814
11942
|
},
|
|
11815
11943
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
11816
11944
|
): Promise<PostgresSchedulerSignalRecord> {
|
|
11817
|
-
const signalId =
|
|
11945
|
+
const signalId = input.deliveryId
|
|
11946
|
+
? `signal:delivery:${createHash('sha256')
|
|
11947
|
+
.update(
|
|
11948
|
+
JSON.stringify([
|
|
11949
|
+
input.runId,
|
|
11950
|
+
input.eventKey,
|
|
11951
|
+
input.boundaryId ?? null,
|
|
11952
|
+
input.deliveryId,
|
|
11953
|
+
]),
|
|
11954
|
+
)
|
|
11955
|
+
.digest('hex')}`
|
|
11956
|
+
: `signal:${randomUUID()}`;
|
|
11818
11957
|
const inserted = await client.query<{
|
|
11819
11958
|
signal_id: string;
|
|
11820
11959
|
run_id: string;
|
|
@@ -11831,6 +11970,7 @@ export async function recordPostgresSchedulerSignal(
|
|
|
11831
11970
|
payload_json
|
|
11832
11971
|
)
|
|
11833
11972
|
VALUES ($1, $2, $3, $4, $5::jsonb)
|
|
11973
|
+
ON CONFLICT (signal_id) DO UPDATE SET signal_id = EXCLUDED.signal_id
|
|
11834
11974
|
RETURNING signal_id, run_id, event_key, boundary_id, payload_json
|
|
11835
11975
|
`,
|
|
11836
11976
|
[
|
|
@@ -11901,17 +12041,14 @@ export async function recordPostgresSchedulerManagedSandboxOperationLive(
|
|
|
11901
12041
|
attempt: number;
|
|
11902
12042
|
leaseToken: string;
|
|
11903
12043
|
resource: PlayRunnerRuntimeResource & {
|
|
11904
|
-
kind:
|
|
12044
|
+
kind: ManagedSandboxResourceKind;
|
|
11905
12045
|
sandboxCapacityLeaseId: string;
|
|
11906
12046
|
};
|
|
11907
12047
|
},
|
|
11908
12048
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
11909
12049
|
): Promise<boolean> {
|
|
11910
12050
|
const provider = runtimeSandboxProviderForResourceKind(input.resource.kind);
|
|
11911
|
-
const routingDomain =
|
|
11912
|
-
input.resource.kind === 'daytona_sandbox'
|
|
11913
|
-
? input.resource.daytonaOrganizationId?.trim() || null
|
|
11914
|
-
: input.resource.modalAppId?.trim() || null;
|
|
12051
|
+
const routingDomain = runtimeSandboxRoutingDomainForResource(input.resource);
|
|
11915
12052
|
const environment =
|
|
11916
12053
|
input.resource.runtimeEnvironment ??
|
|
11917
12054
|
input.resource.daytonaEnvironment ??
|
|
@@ -12589,17 +12726,14 @@ export async function recordPostgresSchedulerLateManagedSandboxOperationForClean
|
|
|
12589
12726
|
attempt: number;
|
|
12590
12727
|
leaseToken: string;
|
|
12591
12728
|
resource: PlayRunnerRuntimeResource & {
|
|
12592
|
-
kind:
|
|
12729
|
+
kind: ManagedSandboxResourceKind;
|
|
12593
12730
|
sandboxCapacityLeaseId: string;
|
|
12594
12731
|
};
|
|
12595
12732
|
},
|
|
12596
12733
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
12597
12734
|
): Promise<boolean> {
|
|
12598
12735
|
const provider = runtimeSandboxProviderForResourceKind(input.resource.kind);
|
|
12599
|
-
const routingDomain =
|
|
12600
|
-
input.resource.kind === 'daytona_sandbox'
|
|
12601
|
-
? input.resource.daytonaOrganizationId?.trim() || null
|
|
12602
|
-
: input.resource.modalAppId?.trim() || null;
|
|
12736
|
+
const routingDomain = runtimeSandboxRoutingDomainForResource(input.resource);
|
|
12603
12737
|
const environment =
|
|
12604
12738
|
input.resource.runtimeEnvironment ??
|
|
12605
12739
|
input.resource.daytonaEnvironment ??
|
|
@@ -12778,7 +12912,7 @@ export async function markPostgresSchedulerRuntimeResourceDetached(
|
|
|
12778
12912
|
SET resource_json = (
|
|
12779
12913
|
SELECT jsonb_agg(
|
|
12780
12914
|
CASE
|
|
12781
|
-
WHEN resource->>'kind' IN
|
|
12915
|
+
WHEN resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
12782
12916
|
AND resource->>'sandboxId' = $4
|
|
12783
12917
|
THEN resource || jsonb_build_object(
|
|
12784
12918
|
'executionDetachedAt',
|
|
@@ -12801,7 +12935,7 @@ export async function markPostgresSchedulerRuntimeResourceDetached(
|
|
|
12801
12935
|
AND EXISTS (
|
|
12802
12936
|
SELECT 1
|
|
12803
12937
|
FROM jsonb_array_elements(resource_json) AS candidate
|
|
12804
|
-
WHERE candidate->>'kind' IN
|
|
12938
|
+
WHERE candidate->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
12805
12939
|
AND candidate->>'sandboxId' = $4
|
|
12806
12940
|
)
|
|
12807
12941
|
RETURNING run_id
|
|
@@ -12885,8 +13019,8 @@ export async function settlePostgresSchedulerRuntimeResources(
|
|
|
12885
13019
|
SELECT COALESCE(
|
|
12886
13020
|
jsonb_agg(
|
|
12887
13021
|
CASE
|
|
12888
|
-
WHEN elem->>'kind' IN
|
|
12889
|
-
AND NOT ${protectedManagedSandboxSql({ runId: '$1', provider: "
|
|
13022
|
+
WHEN elem->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13023
|
+
AND NOT ${protectedManagedSandboxSql({ runId: '$1', provider: managedSandboxProviderSql("elem->>'kind'"), sandboxId: "elem->>'sandboxId'", routingDomain: managedSandboxRoutingDomainSql('elem') }, options, true)}
|
|
12890
13024
|
AND (
|
|
12891
13025
|
elem->'billingEndedAt' IS NULL
|
|
12892
13026
|
OR elem->'billingEndedAt' = 'null'::jsonb
|
|
@@ -12915,7 +13049,7 @@ export async function settlePostgresSchedulerRuntimeResources(
|
|
|
12915
13049
|
AND EXISTS (
|
|
12916
13050
|
SELECT 1
|
|
12917
13051
|
FROM jsonb_array_elements(resource_json) AS candidate
|
|
12918
|
-
WHERE candidate->>'kind' IN
|
|
13052
|
+
WHERE candidate->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
12919
13053
|
AND (
|
|
12920
13054
|
candidate->'billingEndedAt' IS NULL
|
|
12921
13055
|
OR candidate->'billingEndedAt' = 'null'::jsonb
|
|
@@ -12983,7 +13117,7 @@ export async function recordPostgresSchedulerRunnerTerminal(
|
|
|
12983
13117
|
SELECT COALESCE(
|
|
12984
13118
|
jsonb_agg(
|
|
12985
13119
|
CASE
|
|
12986
|
-
WHEN resource->>'kind' IN
|
|
13120
|
+
WHEN resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
12987
13121
|
AND (
|
|
12988
13122
|
resource->'billingEndedAt' IS NULL
|
|
12989
13123
|
OR resource->'billingEndedAt' = 'null'::jsonb
|
|
@@ -13251,7 +13385,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13251
13385
|
SELECT COALESCE(
|
|
13252
13386
|
jsonb_agg(
|
|
13253
13387
|
CASE
|
|
13254
|
-
WHEN elem->>'kind' IN
|
|
13388
|
+
WHEN elem->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13255
13389
|
AND (
|
|
13256
13390
|
elem->'billingEndedAt' IS NULL
|
|
13257
13391
|
OR elem->'billingEndedAt' = 'null'::jsonb
|
|
@@ -13333,7 +13467,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13333
13467
|
SELECT COALESCE(
|
|
13334
13468
|
jsonb_agg(
|
|
13335
13469
|
CASE
|
|
13336
|
-
WHEN elem->>'kind' IN
|
|
13470
|
+
WHEN elem->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13337
13471
|
AND (
|
|
13338
13472
|
elem->'billingEndedAt' IS NULL
|
|
13339
13473
|
OR elem->'billingEndedAt' = 'null'::jsonb
|
|
@@ -13391,10 +13525,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13391
13525
|
provider, sandbox_id, run_id, attempt, environment, routing_domain
|
|
13392
13526
|
)
|
|
13393
13527
|
SELECT DISTINCT
|
|
13394
|
-
|
|
13395
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
13396
|
-
ELSE 'daytona'
|
|
13397
|
-
END,
|
|
13528
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
13398
13529
|
resource->>'sandboxId',
|
|
13399
13530
|
all_settled_resources.run_id,
|
|
13400
13531
|
all_settled_resources.attempt,
|
|
@@ -13403,10 +13534,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13403
13534
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
13404
13535
|
'production'
|
|
13405
13536
|
),
|
|
13406
|
-
|
|
13407
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
13408
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
13409
|
-
END
|
|
13537
|
+
${managedSandboxRoutingDomainSql('resource')}
|
|
13410
13538
|
FROM all_settled_resources
|
|
13411
13539
|
CROSS JOIN LATERAL jsonb_array_elements(
|
|
13412
13540
|
CASE
|
|
@@ -13416,7 +13544,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13416
13544
|
END
|
|
13417
13545
|
) AS resource
|
|
13418
13546
|
WHERE all_settled_resources.resource_json IS NOT NULL
|
|
13419
|
-
AND resource->>'kind' IN
|
|
13547
|
+
AND resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13420
13548
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
13421
13549
|
ON CONFLICT (provider, sandbox_id, routing_domain_key) DO NOTHING
|
|
13422
13550
|
),
|
|
@@ -13448,7 +13576,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13448
13576
|
) AS resource
|
|
13449
13577
|
WHERE resource->>'kind' IN ('compute_session', 'local_process')
|
|
13450
13578
|
OR (
|
|
13451
|
-
resource->>'kind' IN
|
|
13579
|
+
resource->>'kind' IN ${COMPUTE_BILLED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13452
13580
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
13453
13581
|
)
|
|
13454
13582
|
ON CONFLICT (run_id) DO NOTHING
|
|
@@ -13585,7 +13713,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13585
13713
|
SELECT COALESCE(
|
|
13586
13714
|
jsonb_agg(
|
|
13587
13715
|
CASE
|
|
13588
|
-
WHEN elem->>'kind' IN
|
|
13716
|
+
WHEN elem->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13589
13717
|
AND (
|
|
13590
13718
|
elem->'billingEndedAt' IS NULL
|
|
13591
13719
|
OR elem->'billingEndedAt' = 'null'::jsonb
|
|
@@ -13646,10 +13774,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13646
13774
|
provider, sandbox_id, run_id, attempt, environment, routing_domain
|
|
13647
13775
|
)
|
|
13648
13776
|
SELECT DISTINCT
|
|
13649
|
-
|
|
13650
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
13651
|
-
ELSE 'daytona'
|
|
13652
|
-
END,
|
|
13777
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
13653
13778
|
resource->>'sandboxId',
|
|
13654
13779
|
stale_attempt.run_id,
|
|
13655
13780
|
stale_attempt.attempt,
|
|
@@ -13658,10 +13783,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13658
13783
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
13659
13784
|
'production'
|
|
13660
13785
|
),
|
|
13661
|
-
|
|
13662
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
13663
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
13664
|
-
END
|
|
13786
|
+
${managedSandboxRoutingDomainSql('resource')}
|
|
13665
13787
|
FROM stale_attempt
|
|
13666
13788
|
CROSS JOIN LATERAL jsonb_array_elements(
|
|
13667
13789
|
CASE
|
|
@@ -13671,7 +13793,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13671
13793
|
END
|
|
13672
13794
|
) AS resource
|
|
13673
13795
|
WHERE stale_attempt.resource_json IS NOT NULL
|
|
13674
|
-
AND resource->>'kind' IN
|
|
13796
|
+
AND resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13675
13797
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
13676
13798
|
ON CONFLICT (provider, sandbox_id, routing_domain_key) DO NOTHING
|
|
13677
13799
|
),
|
|
@@ -13748,7 +13870,7 @@ export async function ensurePostgresSchedulerTerminalComputeBillingJob(
|
|
|
13748
13870
|
AND (
|
|
13749
13871
|
resource->>'kind' IN ('compute_session', 'local_process')
|
|
13750
13872
|
OR (
|
|
13751
|
-
resource->>'kind' IN
|
|
13873
|
+
resource->>'kind' IN ${COMPUTE_BILLED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13752
13874
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
13753
13875
|
)
|
|
13754
13876
|
)
|
|
@@ -13817,7 +13939,7 @@ async function backfillPostgresSchedulerTerminalComputeBillingJobBatch(
|
|
|
13817
13939
|
AND (
|
|
13818
13940
|
resource->>'kind' IN ('compute_session', 'local_process')
|
|
13819
13941
|
OR (
|
|
13820
|
-
resource->>'kind' IN
|
|
13942
|
+
resource->>'kind' IN ${COMPUTE_BILLED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13821
13943
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
13822
13944
|
)
|
|
13823
13945
|
)
|
|
@@ -14560,12 +14682,8 @@ function protectedDetachedSandboxSql(
|
|
|
14560
14682
|
AND detached_attempt.status IN ('claimed', 'running', 'waiting')
|
|
14561
14683
|
AND detached_attempt.runner_result_json IS NULL
|
|
14562
14684
|
AND detached_resource ->> 'sandboxId' = ${identity.sandboxId}
|
|
14563
|
-
AND
|
|
14564
|
-
|
|
14565
|
-
WHEN 'modal_sandbox' THEN 'modal' END = ${identity.provider}
|
|
14566
|
-
AND (CASE detached_resource ->> 'kind'
|
|
14567
|
-
WHEN 'modal_sandbox' THEN NULLIF(detached_resource ->> 'modalAppId', '')
|
|
14568
|
-
ELSE NULLIF(detached_resource ->> 'daytonaOrganizationId', '') END)
|
|
14685
|
+
AND ${managedSandboxProviderSql("detached_resource ->> 'kind'")} = ${identity.provider}
|
|
14686
|
+
AND (${managedSandboxRoutingDomainSql('detached_resource')})
|
|
14569
14687
|
IS NOT DISTINCT FROM ${identity.routingDomain}
|
|
14570
14688
|
AND (
|
|
14571
14689
|
(detached_run.suspension_json ->> 'kind' = 'detached_runner'
|
|
@@ -14592,11 +14710,9 @@ function protectedDetachedResourceSql(
|
|
|
14592
14710
|
return protectedDetachedSandboxSql(
|
|
14593
14711
|
{
|
|
14594
14712
|
runId,
|
|
14595
|
-
provider:
|
|
14596
|
-
"(CASE resource->>'kind' WHEN 'modal_sandbox' THEN 'modal' ELSE 'daytona' END)",
|
|
14713
|
+
provider: managedSandboxProviderSql("resource->>'kind'"),
|
|
14597
14714
|
sandboxId: "resource->>'sandboxId'",
|
|
14598
|
-
routingDomain:
|
|
14599
|
-
"(CASE resource->>'kind' WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '') ELSE NULLIF(resource->>'daytonaOrganizationId', '') END)",
|
|
14715
|
+
routingDomain: managedSandboxRoutingDomainSql('resource'),
|
|
14600
14716
|
},
|
|
14601
14717
|
options,
|
|
14602
14718
|
locked,
|
|
@@ -14605,7 +14721,7 @@ function protectedDetachedResourceSql(
|
|
|
14605
14721
|
|
|
14606
14722
|
export type PostgresSchedulerSandboxCleanupJob = {
|
|
14607
14723
|
status: typeof SandboxCleanupJobStatus.Deleting;
|
|
14608
|
-
provider: 'daytona' | 'modal';
|
|
14724
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
14609
14725
|
sandboxId: string;
|
|
14610
14726
|
runId: string;
|
|
14611
14727
|
attempt: number;
|
|
@@ -14642,10 +14758,7 @@ export async function enqueuePostgresSchedulerSandboxCleanupForAttempt(
|
|
|
14642
14758
|
provider, sandbox_id, run_id, attempt, environment, routing_domain
|
|
14643
14759
|
)
|
|
14644
14760
|
SELECT DISTINCT
|
|
14645
|
-
|
|
14646
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
14647
|
-
ELSE 'daytona'
|
|
14648
|
-
END,
|
|
14761
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
14649
14762
|
resource->>'sandboxId',
|
|
14650
14763
|
attempt_resources.run_id,
|
|
14651
14764
|
attempt_resources.attempt,
|
|
@@ -14654,10 +14767,7 @@ export async function enqueuePostgresSchedulerSandboxCleanupForAttempt(
|
|
|
14654
14767
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
14655
14768
|
'production'
|
|
14656
14769
|
),
|
|
14657
|
-
|
|
14658
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
14659
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
14660
|
-
END
|
|
14770
|
+
${managedSandboxRoutingDomainSql('resource')}
|
|
14661
14771
|
FROM attempt_resources
|
|
14662
14772
|
CROSS JOIN LATERAL jsonb_array_elements(
|
|
14663
14773
|
CASE
|
|
@@ -14666,7 +14776,7 @@ export async function enqueuePostgresSchedulerSandboxCleanupForAttempt(
|
|
|
14666
14776
|
ELSE jsonb_build_array(attempt_resources.resource_json)
|
|
14667
14777
|
END
|
|
14668
14778
|
) AS resource
|
|
14669
|
-
WHERE resource->>'kind' IN
|
|
14779
|
+
WHERE resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
14670
14780
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
14671
14781
|
AND NOT ${protectedDetachedResourceSql('$1', options, true)}
|
|
14672
14782
|
ON CONFLICT (provider, sandbox_id, routing_domain_key) DO NOTHING
|
|
@@ -14693,10 +14803,7 @@ export async function enqueuePostgresSchedulerSandboxCleanupForRun(
|
|
|
14693
14803
|
provider, sandbox_id, run_id, attempt, environment, routing_domain
|
|
14694
14804
|
)
|
|
14695
14805
|
SELECT DISTINCT
|
|
14696
|
-
|
|
14697
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
14698
|
-
ELSE 'daytona'
|
|
14699
|
-
END,
|
|
14806
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
14700
14807
|
resource->>'sandboxId',
|
|
14701
14808
|
attempt.run_id,
|
|
14702
14809
|
attempt.attempt,
|
|
@@ -14705,10 +14812,7 @@ export async function enqueuePostgresSchedulerSandboxCleanupForRun(
|
|
|
14705
14812
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
14706
14813
|
'production'
|
|
14707
14814
|
),
|
|
14708
|
-
|
|
14709
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
14710
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
14711
|
-
END
|
|
14815
|
+
${managedSandboxRoutingDomainSql('resource')}
|
|
14712
14816
|
FROM custody_attempts AS attempt
|
|
14713
14817
|
CROSS JOIN (SELECT count(*) FROM custody_operations) AS operation_locks
|
|
14714
14818
|
CROSS JOIN LATERAL jsonb_array_elements(
|
|
@@ -14721,7 +14825,7 @@ export async function enqueuePostgresSchedulerSandboxCleanupForRun(
|
|
|
14721
14825
|
WHERE attempt.run_id = $1
|
|
14722
14826
|
AND ($2::integer IS NULL OR attempt.attempt <= $2)
|
|
14723
14827
|
AND attempt.resource_json IS NOT NULL
|
|
14724
|
-
AND resource->>'kind' IN
|
|
14828
|
+
AND resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
14725
14829
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
14726
14830
|
AND NOT ${protectedDetachedResourceSql('$1', options, true)}
|
|
14727
14831
|
UNION ALL
|
|
@@ -14870,7 +14974,7 @@ export async function readPostgresSchedulerSandboxRetirement(
|
|
|
14870
14974
|
runId: string;
|
|
14871
14975
|
attempt: number;
|
|
14872
14976
|
leaseToken: string;
|
|
14873
|
-
provider: 'daytona' | 'modal';
|
|
14977
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
14874
14978
|
sandboxId: string;
|
|
14875
14979
|
routingDomain: string | null;
|
|
14876
14980
|
},
|
|
@@ -14928,7 +15032,7 @@ export async function readPostgresSchedulerSandboxRetirement(
|
|
|
14928
15032
|
export async function readPostgresSchedulerSandboxCleanupClaim(
|
|
14929
15033
|
client: PostgresSchedulerQueryClient,
|
|
14930
15034
|
input: {
|
|
14931
|
-
provider: 'daytona' | 'modal';
|
|
15035
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
14932
15036
|
sandboxId: string;
|
|
14933
15037
|
routingDomain: string | null;
|
|
14934
15038
|
runId: string;
|
|
@@ -14977,7 +15081,7 @@ export async function claimPostgresSchedulerSandboxCleanupJobs(
|
|
|
14977
15081
|
input: {
|
|
14978
15082
|
leaseOwner: string;
|
|
14979
15083
|
exactResource?: {
|
|
14980
|
-
provider: 'daytona' | 'modal';
|
|
15084
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
14981
15085
|
sandboxId: string;
|
|
14982
15086
|
routingDomain: string | null;
|
|
14983
15087
|
attempt: number;
|
|
@@ -14987,7 +15091,7 @@ export async function claimPostgresSchedulerSandboxCleanupJobs(
|
|
|
14987
15091
|
limit?: number;
|
|
14988
15092
|
leaseSeconds?: number;
|
|
14989
15093
|
environment?: string | null;
|
|
14990
|
-
providers?: Array<'daytona' | 'modal'>;
|
|
15094
|
+
providers?: Array<'daytona' | 'modal' | 'vercel'>;
|
|
14991
15095
|
},
|
|
14992
15096
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
14993
15097
|
): Promise<PostgresSchedulerSandboxCleanupJob[]> {
|
|
@@ -15271,7 +15375,7 @@ export async function claimPostgresSchedulerSandboxCleanupJobs(
|
|
|
15271
15375
|
if (!claimable) return [];
|
|
15272
15376
|
const claimed = await client.query<{
|
|
15273
15377
|
status: unknown;
|
|
15274
|
-
provider: 'daytona' | 'modal';
|
|
15378
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
15275
15379
|
sandbox_id: string;
|
|
15276
15380
|
run_id: string;
|
|
15277
15381
|
attempt: number;
|
|
@@ -15479,7 +15583,7 @@ export async function claimPostgresSchedulerSandboxCleanupJobs(
|
|
|
15479
15583
|
export async function recordPostgresSchedulerSandboxCrashDiagnostic(
|
|
15480
15584
|
client: PostgresSchedulerQueryClient,
|
|
15481
15585
|
input: {
|
|
15482
|
-
provider: 'daytona' | 'modal';
|
|
15586
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
15483
15587
|
sandboxId: string;
|
|
15484
15588
|
routingDomain: string | null;
|
|
15485
15589
|
runId: string;
|
|
@@ -15559,7 +15663,7 @@ export async function recordPostgresSchedulerSandboxCrashDiagnostic(
|
|
|
15559
15663
|
export async function recordPostgresSchedulerSandboxCleanupEvent(
|
|
15560
15664
|
client: PostgresSchedulerQueryClient,
|
|
15561
15665
|
input: {
|
|
15562
|
-
provider?: 'daytona' | 'modal';
|
|
15666
|
+
provider?: 'daytona' | 'modal' | 'vercel';
|
|
15563
15667
|
sandboxId: string;
|
|
15564
15668
|
routingDomain: string | null;
|
|
15565
15669
|
runId: string;
|
|
@@ -15612,7 +15716,7 @@ export type PostgresSchedulerSandboxDeleteAcceptance = {
|
|
|
15612
15716
|
export async function readPostgresSchedulerSandboxDeleteAcceptance(
|
|
15613
15717
|
client: PostgresSchedulerQueryClient,
|
|
15614
15718
|
input: {
|
|
15615
|
-
provider: 'daytona' | 'modal';
|
|
15719
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
15616
15720
|
sandboxId: string;
|
|
15617
15721
|
routingDomain: string | null;
|
|
15618
15722
|
runId: string;
|
|
@@ -15658,7 +15762,7 @@ export async function readPostgresSchedulerSandboxDeleteAcceptance(
|
|
|
15658
15762
|
export async function completePostgresSchedulerSandboxCleanupJob(
|
|
15659
15763
|
client: PostgresSchedulerQueryClient,
|
|
15660
15764
|
input: {
|
|
15661
|
-
provider?: 'daytona' | 'modal';
|
|
15765
|
+
provider?: 'daytona' | 'modal' | 'vercel';
|
|
15662
15766
|
sandboxId: string;
|
|
15663
15767
|
routingDomain: string | null;
|
|
15664
15768
|
runId: string;
|
|
@@ -15782,8 +15886,8 @@ export async function completePostgresSchedulerSandboxCleanupJob(
|
|
|
15782
15886
|
SET resource_json = (
|
|
15783
15887
|
SELECT jsonb_agg(
|
|
15784
15888
|
CASE
|
|
15785
|
-
WHEN resource->>'kind' =
|
|
15786
|
-
AND (
|
|
15889
|
+
WHEN resource->>'kind' = ${managedSandboxKindForProviderSql('$8::text')}
|
|
15890
|
+
AND ${managedSandboxRoutingDomainForProviderSql('$8::text', 'resource')} IS NOT DISTINCT FROM $9::text
|
|
15787
15891
|
AND resource->>'sandboxId' = $1
|
|
15788
15892
|
AND resource->>'lateAcquired' = 'true'
|
|
15789
15893
|
AND (
|
|
@@ -15829,8 +15933,8 @@ export async function completePostgresSchedulerSandboxCleanupJob(
|
|
|
15829
15933
|
ELSE jsonb_build_array(attempt.resource_json)
|
|
15830
15934
|
END
|
|
15831
15935
|
) AS candidate
|
|
15832
|
-
WHERE candidate->>'kind' =
|
|
15833
|
-
AND (
|
|
15936
|
+
WHERE candidate->>'kind' = ${managedSandboxKindForProviderSql('$8::text')}
|
|
15937
|
+
AND ${managedSandboxRoutingDomainForProviderSql('$8::text', 'candidate')} IS NOT DISTINCT FROM $9::text
|
|
15834
15938
|
AND candidate->>'sandboxId' = $1
|
|
15835
15939
|
AND candidate->>'lateAcquired' = 'true'
|
|
15836
15940
|
)
|
|
@@ -16005,7 +16109,7 @@ export async function completePostgresSchedulerSandboxCleanupJob(
|
|
|
16005
16109
|
export async function retryPostgresSchedulerSandboxCleanupJob(
|
|
16006
16110
|
client: PostgresSchedulerQueryClient,
|
|
16007
16111
|
input: {
|
|
16008
|
-
provider?: 'daytona' | 'modal';
|
|
16112
|
+
provider?: 'daytona' | 'modal' | 'vercel';
|
|
16009
16113
|
sandboxId: string;
|
|
16010
16114
|
routingDomain: string | null;
|
|
16011
16115
|
leaseOwner: string;
|
|
@@ -16098,7 +16202,7 @@ export async function retryPostgresSchedulerSandboxCleanupJob(
|
|
|
16098
16202
|
export async function blockPostgresSchedulerSandboxCleanupJob(
|
|
16099
16203
|
client: PostgresSchedulerQueryClient,
|
|
16100
16204
|
input: {
|
|
16101
|
-
provider?: 'daytona' | 'modal';
|
|
16205
|
+
provider?: 'daytona' | 'modal' | 'vercel';
|
|
16102
16206
|
sandboxId: string;
|
|
16103
16207
|
routingDomain: string | null;
|
|
16104
16208
|
leaseOwner: string;
|
|
@@ -16334,7 +16438,7 @@ export async function listPostgresSchedulerCompletedRunnerTerminals(
|
|
|
16334
16438
|
|
|
16335
16439
|
/** A parked detached runner whose heartbeat is stale beyond its own lease. */
|
|
16336
16440
|
export type PostgresSchedulerStaleDetachedRunner = {
|
|
16337
|
-
provider: 'daytona' | 'modal';
|
|
16441
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
16338
16442
|
releaseId: string | null;
|
|
16339
16443
|
runId: string;
|
|
16340
16444
|
attempt: number;
|
|
@@ -16370,7 +16474,7 @@ export async function listPostgresSchedulerDetachedRunnerLivenessWork(
|
|
|
16370
16474
|
input: {
|
|
16371
16475
|
limit: number;
|
|
16372
16476
|
defaultHeartbeatTimeoutMs: number;
|
|
16373
|
-
afterRunIds: Partial<Record<'daytona' | 'modal', string | null>>;
|
|
16477
|
+
afterRunIds: Partial<Record<'daytona' | 'modal' | 'vercel', string | null>>;
|
|
16374
16478
|
},
|
|
16375
16479
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
16376
16480
|
): Promise<{
|
|
@@ -16379,7 +16483,7 @@ export async function listPostgresSchedulerDetachedRunnerLivenessWork(
|
|
|
16379
16483
|
}> {
|
|
16380
16484
|
const rows = await client.query<{
|
|
16381
16485
|
work: 'inspect' | 'settle';
|
|
16382
|
-
provider: 'daytona' | 'modal';
|
|
16486
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
16383
16487
|
absurd_release_id: string | null;
|
|
16384
16488
|
run_id: string;
|
|
16385
16489
|
attempt: number;
|
|
@@ -16435,7 +16539,7 @@ export async function listPostgresSchedulerDetachedRunnerLivenessWork(
|
|
|
16435
16539
|
detached.*,
|
|
16436
16540
|
row_number() OVER (PARTITION BY provider ORDER BY run_id ASC) AS provider_rank
|
|
16437
16541
|
FROM detached
|
|
16438
|
-
WHERE provider IN ('daytona', 'modal')
|
|
16542
|
+
WHERE provider IN ('daytona', 'modal', 'vercel')
|
|
16439
16543
|
AND no_runner_result
|
|
16440
16544
|
AND attempt_status = 'waiting'
|
|
16441
16545
|
AND run_status = 'waiting'
|
|
@@ -17069,7 +17173,7 @@ export async function completePostgresSchedulerAttempt(
|
|
|
17069
17173
|
ELSE (
|
|
17070
17174
|
SELECT jsonb_agg(
|
|
17071
17175
|
CASE
|
|
17072
|
-
WHEN resource->>'kind' IN
|
|
17176
|
+
WHEN resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17073
17177
|
AND (
|
|
17074
17178
|
resource->'billingEndedAt' IS NULL
|
|
17075
17179
|
OR resource->'billingEndedAt' = 'null'::jsonb
|
|
@@ -17120,7 +17224,7 @@ export async function completePostgresSchedulerAttempt(
|
|
|
17120
17224
|
ELSE (
|
|
17121
17225
|
SELECT jsonb_agg(
|
|
17122
17226
|
CASE
|
|
17123
|
-
WHEN resource->>'kind' IN
|
|
17227
|
+
WHEN resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17124
17228
|
AND (
|
|
17125
17229
|
resource->'billingEndedAt' IS NULL
|
|
17126
17230
|
OR resource->'billingEndedAt' = 'null'::jsonb
|
|
@@ -17160,10 +17264,7 @@ export async function completePostgresSchedulerAttempt(
|
|
|
17160
17264
|
provider, sandbox_id, run_id, attempt, environment, routing_domain
|
|
17161
17265
|
)
|
|
17162
17266
|
SELECT DISTINCT
|
|
17163
|
-
|
|
17164
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
17165
|
-
ELSE 'daytona'
|
|
17166
|
-
END,
|
|
17267
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
17167
17268
|
resource->>'sandboxId',
|
|
17168
17269
|
all_settled_resources.run_id,
|
|
17169
17270
|
all_settled_resources.attempt,
|
|
@@ -17172,10 +17273,7 @@ export async function completePostgresSchedulerAttempt(
|
|
|
17172
17273
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
17173
17274
|
'production'
|
|
17174
17275
|
),
|
|
17175
|
-
|
|
17176
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
17177
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
17178
|
-
END
|
|
17276
|
+
${managedSandboxRoutingDomainSql('resource')}
|
|
17179
17277
|
FROM all_settled_resources
|
|
17180
17278
|
CROSS JOIN LATERAL jsonb_array_elements(
|
|
17181
17279
|
CASE
|
|
@@ -17185,7 +17283,7 @@ export async function completePostgresSchedulerAttempt(
|
|
|
17185
17283
|
END
|
|
17186
17284
|
) AS resource
|
|
17187
17285
|
WHERE all_settled_resources.resource_json IS NOT NULL
|
|
17188
|
-
AND resource->>'kind' IN
|
|
17286
|
+
AND resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17189
17287
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
17190
17288
|
ON CONFLICT (provider, sandbox_id, routing_domain_key) DO NOTHING
|
|
17191
17289
|
),
|
|
@@ -17217,7 +17315,7 @@ export async function completePostgresSchedulerAttempt(
|
|
|
17217
17315
|
) AS resource
|
|
17218
17316
|
WHERE resource->>'kind' IN ('compute_session', 'local_process')
|
|
17219
17317
|
OR (
|
|
17220
|
-
resource->>'kind' IN
|
|
17318
|
+
resource->>'kind' IN ${COMPUTE_BILLED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17221
17319
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
17222
17320
|
)
|
|
17223
17321
|
ON CONFLICT (run_id) DO NOTHING
|
|
@@ -17402,7 +17500,7 @@ export async function failPostgresSchedulerAttempt(
|
|
|
17402
17500
|
ELSE (
|
|
17403
17501
|
SELECT jsonb_agg(
|
|
17404
17502
|
CASE
|
|
17405
|
-
WHEN resource->>'kind' IN
|
|
17503
|
+
WHEN resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17406
17504
|
AND (
|
|
17407
17505
|
resource->'billingEndedAt' IS NULL
|
|
17408
17506
|
OR resource->'billingEndedAt' = 'null'::jsonb
|
|
@@ -17494,7 +17592,7 @@ export async function failPostgresSchedulerAttempt(
|
|
|
17494
17592
|
ELSE (
|
|
17495
17593
|
SELECT jsonb_agg(
|
|
17496
17594
|
CASE
|
|
17497
|
-
WHEN resource->>'kind' IN
|
|
17595
|
+
WHEN resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17498
17596
|
AND (
|
|
17499
17597
|
resource->'billingEndedAt' IS NULL
|
|
17500
17598
|
OR resource->'billingEndedAt' = 'null'::jsonb
|
|
@@ -17549,10 +17647,7 @@ export async function failPostgresSchedulerAttempt(
|
|
|
17549
17647
|
available_at
|
|
17550
17648
|
)
|
|
17551
17649
|
SELECT DISTINCT
|
|
17552
|
-
|
|
17553
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
17554
|
-
ELSE 'daytona'
|
|
17555
|
-
END,
|
|
17650
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
17556
17651
|
resource->>'sandboxId',
|
|
17557
17652
|
all_settled_resources.run_id,
|
|
17558
17653
|
all_settled_resources.attempt,
|
|
@@ -17561,10 +17656,7 @@ export async function failPostgresSchedulerAttempt(
|
|
|
17561
17656
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
17562
17657
|
'production'
|
|
17563
17658
|
),
|
|
17564
|
-
|
|
17565
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
17566
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
17567
|
-
END,
|
|
17659
|
+
${managedSandboxRoutingDomainSql('resource')},
|
|
17568
17660
|
CASE
|
|
17569
17661
|
WHEN resource->>'kind' = 'daytona_sandbox'
|
|
17570
17662
|
AND resource->>'sandboxId' = $10::jsonb ->> 'sandboxId'
|
|
@@ -17586,7 +17678,7 @@ export async function failPostgresSchedulerAttempt(
|
|
|
17586
17678
|
END
|
|
17587
17679
|
) AS resource
|
|
17588
17680
|
WHERE all_settled_resources.resource_json IS NOT NULL
|
|
17589
|
-
AND resource->>'kind' IN
|
|
17681
|
+
AND resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17590
17682
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
17591
17683
|
ON CONFLICT (provider, sandbox_id, routing_domain_key) DO UPDATE
|
|
17592
17684
|
SET diagnostic_json = COALESCE(
|
|
@@ -17630,7 +17722,7 @@ export async function failPostgresSchedulerAttempt(
|
|
|
17630
17722
|
) AS resource
|
|
17631
17723
|
WHERE resource->>'kind' IN ('compute_session', 'local_process')
|
|
17632
17724
|
OR (
|
|
17633
|
-
resource->>'kind' IN
|
|
17725
|
+
resource->>'kind' IN ${COMPUTE_BILLED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17634
17726
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
17635
17727
|
)
|
|
17636
17728
|
ON CONFLICT (run_id) DO NOTHING
|
|
@@ -17893,23 +17985,17 @@ export async function cancelPostgresSchedulerRun(
|
|
|
17893
17985
|
ELSE (
|
|
17894
17986
|
SELECT jsonb_agg(
|
|
17895
17987
|
CASE
|
|
17896
|
-
WHEN elem->>'kind' IN
|
|
17988
|
+
WHEN elem->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17897
17989
|
AND (elem->'billingEndedAt' IS NULL OR elem->'billingEndedAt' = 'null'::jsonb)
|
|
17898
17990
|
THEN elem || jsonb_build_object(
|
|
17899
17991
|
'billingEndedAt', COALESCE(
|
|
17900
17992
|
(
|
|
17901
17993
|
SELECT extract(epoch FROM cleanup.deleted_at) * 1000
|
|
17902
17994
|
FROM ${tableName('sandbox_cleanup_jobs_v2', options)} AS cleanup
|
|
17903
|
-
WHERE cleanup.provider =
|
|
17904
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
17905
|
-
ELSE 'daytona'
|
|
17906
|
-
END
|
|
17995
|
+
WHERE cleanup.provider = ${managedSandboxProviderSql("elem->>'kind'")}
|
|
17907
17996
|
AND cleanup.sandbox_id = elem->>'sandboxId'
|
|
17908
17997
|
AND cleanup.routing_domain_key = COALESCE(
|
|
17909
|
-
|
|
17910
|
-
WHEN 'modal_sandbox' THEN NULLIF(elem->>'modalAppId', '')
|
|
17911
|
-
ELSE NULLIF(elem->>'daytonaOrganizationId', '')
|
|
17912
|
-
END,
|
|
17998
|
+
${managedSandboxRoutingDomainSql('elem')},
|
|
17913
17999
|
''
|
|
17914
18000
|
)
|
|
17915
18001
|
AND cleanup.status = 'deleted'
|
|
@@ -17944,7 +18030,7 @@ export async function cancelPostgresSchedulerRun(
|
|
|
17944
18030
|
) AS resource
|
|
17945
18031
|
WHERE resource->>'kind' IN ('compute_session', 'local_process')
|
|
17946
18032
|
OR (
|
|
17947
|
-
resource->>'kind' IN
|
|
18033
|
+
resource->>'kind' IN ${COMPUTE_BILLED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17948
18034
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
17949
18035
|
)
|
|
17950
18036
|
ON CONFLICT (run_id) DO NOTHING
|
|
@@ -17954,10 +18040,7 @@ export async function cancelPostgresSchedulerRun(
|
|
|
17954
18040
|
provider, sandbox_id, run_id, attempt, environment, routing_domain
|
|
17955
18041
|
)
|
|
17956
18042
|
SELECT DISTINCT
|
|
17957
|
-
|
|
17958
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
17959
|
-
ELSE 'daytona'
|
|
17960
|
-
END,
|
|
18043
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
17961
18044
|
resource->>'sandboxId',
|
|
17962
18045
|
attempt_resources.run_id,
|
|
17963
18046
|
attempt_resources.attempt,
|
|
@@ -17966,10 +18049,7 @@ export async function cancelPostgresSchedulerRun(
|
|
|
17966
18049
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
17967
18050
|
'production'
|
|
17968
18051
|
),
|
|
17969
|
-
|
|
17970
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
17971
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
17972
|
-
END
|
|
18052
|
+
${managedSandboxRoutingDomainSql('resource')}
|
|
17973
18053
|
FROM ${tableName('attempts', options)} AS attempt_resources
|
|
17974
18054
|
CROSS JOIN LATERAL jsonb_array_elements(
|
|
17975
18055
|
CASE
|
|
@@ -17982,7 +18062,7 @@ export async function cancelPostgresSchedulerRun(
|
|
|
17982
18062
|
SELECT run_id FROM cancelled_run
|
|
17983
18063
|
)
|
|
17984
18064
|
AND attempt_resources.resource_json IS NOT NULL
|
|
17985
|
-
AND resource->>'kind' IN
|
|
18065
|
+
AND resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17986
18066
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
17987
18067
|
ON CONFLICT (provider, sandbox_id, routing_domain_key) DO NOTHING
|
|
17988
18068
|
),
|
|
@@ -19032,6 +19112,7 @@ export async function executePostgresSchedulerClaim(
|
|
|
19032
19112
|
outcome: 'completed',
|
|
19033
19113
|
failure: null,
|
|
19034
19114
|
runtimeBackend: claim.launch.runtimeBackend ?? null,
|
|
19115
|
+
sandboxProvider: sandboxProviderOfRunnerResult(output),
|
|
19035
19116
|
triggerSource: claim.launch.triggerSource ?? null,
|
|
19036
19117
|
committedBy: 'worker',
|
|
19037
19118
|
});
|
|
@@ -19127,6 +19208,7 @@ export async function executePostgresSchedulerClaim(
|
|
|
19127
19208
|
outcome: 'failed',
|
|
19128
19209
|
failure: playRunFailureDetailsOf(terminalFailureResult),
|
|
19129
19210
|
runtimeBackend: claim.launch.runtimeBackend ?? null,
|
|
19211
|
+
sandboxProvider: sandboxProviderOfRunnerResult(terminalFailureResult),
|
|
19130
19212
|
triggerSource: claim.launch.triggerSource ?? null,
|
|
19131
19213
|
committedBy: 'worker',
|
|
19132
19214
|
});
|
|
@@ -19320,6 +19402,9 @@ export function buildPostgresSchedulerRunnerContext(
|
|
|
19320
19402
|
runActor: playRunActor(launch.runtimeAuthority),
|
|
19321
19403
|
force: launch.force === true,
|
|
19322
19404
|
forceToolRefresh: launch.forceToolRefresh === true,
|
|
19405
|
+
...(typeof launch.cacheReuseWindowSeconds === 'number'
|
|
19406
|
+
? { cacheReuseWindowSeconds: launch.cacheReuseWindowSeconds }
|
|
19407
|
+
: {}),
|
|
19323
19408
|
...(asyncAncestryPlayIds?.length
|
|
19324
19409
|
? {
|
|
19325
19410
|
governance: {
|