deepline 0.3.541 → 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 +17 -1
- 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-WJXA7XGM.mjs → auth-ITAELTOA.mjs} +5 -5
- package/dist/cli/auth-S6B5WUU5.js +43 -0
- package/dist/cli/{billing-34IV5DSV.js → billing-33XVFDUJ.js} +101 -101
- package/dist/cli/{billing-SHS4HMWT.mjs → billing-WZ7RVZW4.mjs} +12 -12
- package/dist/cli/{chunk-UKO6POLZ.js → chunk-23D224GI.js} +37 -17
- package/dist/cli/{chunk-DF7ARQRB.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-FVZ5Y5L6.js → chunk-2KTGZKRE.js} +18 -18
- package/dist/cli/{chunk-6TZEDCN7.js → chunk-2LNTKICO.js} +3 -3
- package/dist/cli/{chunk-FYQWTENQ.js → chunk-2NCJQEZH.js} +53 -53
- package/dist/cli/{chunk-CNBPATLI.js → chunk-3JZXU5OB.js} +5 -5
- package/dist/cli/{chunk-323I5KQ5.js → chunk-46BEBZ3M.js} +497 -328
- package/dist/cli/{chunk-V4EYJKGJ.js → chunk-4JQEAYN3.js} +156 -17
- package/dist/cli/{chunk-XO2SGONT.mjs → chunk-4SKDSSPU.mjs} +2 -2
- package/dist/cli/{chunk-53QZ24DP.mjs → chunk-52YK3EII.mjs} +2 -2
- package/dist/cli/{chunk-S7NKIEHL.js → chunk-5MN3BKNB.js} +16 -16
- package/dist/cli/{chunk-XTR32PMA.mjs → chunk-5VIPTLRX.mjs} +1 -1
- package/dist/cli/{chunk-OLH2PHMC.mjs → chunk-6P7TGCHQ.mjs} +1 -1
- package/dist/cli/{chunk-QI76LGE3.mjs → chunk-6SJZMMD5.mjs} +37 -190
- package/dist/cli/chunk-7AUQTNLB.mjs +455 -0
- package/dist/cli/{chunk-GLINYHY7.mjs → chunk-AACKPOGA.mjs} +1 -1
- package/dist/cli/{chunk-Q66ADD4O.js → chunk-BGAUADV4.js} +41 -41
- package/dist/cli/{chunk-KQSTV4MW.js → chunk-BLYW6FFB.js} +60 -18
- package/dist/cli/{chunk-F3TLGM2U.js → chunk-C35NLLSA.js} +5 -5
- package/dist/cli/{chunk-LRPFCB2P.mjs → chunk-D6YAU3CF.mjs} +182 -13
- package/dist/cli/{chunk-FRPJSFNL.mjs → chunk-DH43ECTN.mjs} +7 -3
- package/dist/cli/{chunk-IZXMX65M.js → chunk-DI3GL3T6.js} +316 -469
- package/dist/cli/{chunk-OK4JMVTM.js → chunk-DUGTPVT7.js} +7 -7
- package/dist/cli/{chunk-UNDLNT3V.js → chunk-ECWOIXAV.js} +1 -1
- package/dist/cli/{chunk-KIYETQ6K.js → chunk-EHUG6EUT.js} +26 -26
- package/dist/cli/chunk-F6VSQ5LN.js +455 -0
- package/dist/cli/{chunk-JZNKEHXQ.mjs → chunk-FNW2SGPD.mjs} +2 -2
- package/dist/cli/{chunk-M6XIKHBS.js → chunk-GRCFX2EG.js} +4 -4
- package/dist/cli/{chunk-OVX3Q5Q3.mjs → chunk-GWNYLIF7.mjs} +1 -1
- package/dist/cli/{chunk-FTKX7OGB.mjs → chunk-HKJ26NRN.mjs} +5 -5
- package/dist/cli/{chunk-L2VKAASU.mjs → chunk-HXIR3VQL.mjs} +21 -0
- package/dist/cli/{chunk-POZPEDW7.js → chunk-J2F6F5GL.js} +7 -7
- package/dist/cli/{chunk-7AUQSK24.mjs → chunk-JXG7HWBA.mjs} +1 -1
- package/dist/cli/{chunk-Z2XA6YU4.mjs → chunk-LX35AXTN.mjs} +1 -0
- package/dist/cli/{chunk-WIV3E6Y7.js → chunk-MCBUWK5K.js} +22 -22
- package/dist/cli/{chunk-2TAGAPLL.js → chunk-NHKP2NSU.js} +2 -2
- package/dist/cli/{chunk-FANIRW74.mjs → chunk-NIPLY25A.mjs} +0 -2
- package/dist/cli/{chunk-UXXFCOE3.js → chunk-NLENABRU.js} +6 -6
- package/dist/cli/{chunk-DHC7EGI7.mjs → chunk-NR3O56FT.mjs} +5 -5
- package/dist/cli/{chunk-MPYM6TUO.js → chunk-O2KLWUNI.js} +44 -44
- package/dist/cli/{chunk-BMNLD63A.mjs → chunk-OAFKUHN5.mjs} +4 -4
- package/dist/cli/{chunk-RYYGNUNO.mjs → chunk-OELJKQOL.mjs} +24 -4
- package/dist/cli/{chunk-ZD673XAL.js → chunk-PX7XAVUC.js} +24 -20
- package/dist/cli/{chunk-FOCNY4GV.js → chunk-QFRMVI4S.js} +3 -3
- package/dist/cli/{chunk-AU7ZKXW5.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-BUCTWJBM.js → chunk-STXG2LFC.js} +2 -2
- package/dist/cli/{chunk-ECPCZVDM.mjs → chunk-SU4K4SUU.mjs} +1 -1
- package/dist/cli/{chunk-ABDXKELH.mjs → chunk-SYOPHFKB.mjs} +6 -6
- package/dist/cli/{chunk-H74CLEMB.mjs → chunk-SZNJENGT.mjs} +3 -3
- package/dist/cli/{chunk-5N4ENMYE.js → chunk-TBCNL2T5.js} +1 -1
- package/dist/cli/{chunk-E4CABWXL.js → chunk-TI6DTURF.js} +22 -1
- package/dist/cli/{chunk-C2LYJ3EX.js → chunk-UJ6GOV7K.js} +13 -13
- package/dist/cli/{chunk-GWHA4DAC.js → chunk-UV4RU2TE.js} +0 -2
- package/dist/cli/{chunk-6PJAC3P5.mjs → chunk-VSJEOSYL.mjs} +1 -1
- package/dist/cli/{chunk-NB4AIXEA.mjs → chunk-W2OPPSAZ.mjs} +3 -3
- package/dist/cli/{chunk-5LNWLEO3.mjs → chunk-XBM3KABD.mjs} +3 -3
- package/dist/cli/{chunk-VMIIUMAN.mjs → chunk-XFPVFWZR.mjs} +1 -1
- package/dist/cli/{chunk-UC5QFQGC.mjs → chunk-XSN6BAZT.mjs} +5 -5
- package/dist/cli/{chunk-IDDKNMFX.mjs → chunk-Y3T5GWYK.mjs} +153 -14
- package/dist/cli/{chunk-S6FF7Q5P.js → chunk-YE3T73BV.js} +10 -10
- package/dist/cli/{chunk-CY5LW6DW.js → chunk-YJYKZ2U3.js} +2 -2
- package/dist/cli/{chunk-F6QV42MC.mjs → chunk-Z7SXGOIQ.mjs} +1 -1
- package/dist/cli/{chunk-ZL2DER5D.mjs → chunk-ZRT2PNYY.mjs} +1 -1
- package/dist/cli/{chunk-WZMG2M65.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-ZJ77SAEU.mjs → concurrent-runs-help-Z6ODNL4E.mjs} +7 -7
- package/dist/cli/{csv-PX7F5YJN.mjs → csv-5QW2HPHT.mjs} +4 -4
- package/dist/cli/{csv-MJLIZZOR.js → csv-SSOFTXHU.js} +13 -13
- package/dist/cli/{db-BNCNAY4G.js → db-4LK5AJNO.js} +29 -29
- package/dist/cli/{db-KPKGTHPA.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-YNOFR7T2.js → executions-AATJQQAQ.js} +10 -10
- package/dist/cli/{executions-NMQY4GEY.mjs → executions-FY2XTX2W.mjs} +8 -8
- package/dist/cli/{feedback-LWYEO5LL.mjs → feedback-MKBPRGS6.mjs} +6 -6
- package/dist/cli/{feedback-RCP5DPO6.js → feedback-QPVJER75.js} +14 -14
- package/dist/cli/{git-3O4PFP3Q.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-KFP674JT.mjs → legacy-noops-DVL2RRKL.mjs} +6 -6
- package/dist/cli/{legacy-noops-ZPZRG366.js → legacy-noops-H7INM2QN.js} +9 -9
- package/dist/cli/{mcp-OCYUXQ6L.mjs → mcp-2Z2YVOLK.mjs} +72 -15
- package/dist/cli/{mcp-HCXDW6PL.js → mcp-33F7D7WI.js} +89 -32
- package/dist/cli/{monitors-7Q7YT22Y.js → monitors-KDUJHAKJ.js} +102 -102
- package/dist/cli/{monitors-V5KJIJJE.mjs → monitors-NZD2WIKK.mjs} +9 -9
- package/dist/cli/{org-S37K6QYH.js → org-4PQGHLEB.js} +164 -88
- package/dist/cli/{org-C3QLHX7U.mjs → org-EJW45RUA.mjs} +84 -8
- package/dist/cli/{play-MXQ2DKML.mjs → play-3CM5RT5J.mjs} +44 -25
- package/dist/cli/{play-MLREAYHJ.js → play-MLHMQL4G.js} +374 -355
- package/dist/cli/{providers-FDJ4ZOST.mjs → providers-BHYBJI4R.mjs} +10 -9
- package/dist/cli/{providers-PPDWY7DH.js → providers-YBJG7277.js} +13 -12
- package/dist/cli/{quickstart-2Z57AMB7.mjs → quickstart-LL3MR562.mjs} +4 -4
- package/dist/cli/{quickstart-BOWQM7S7.js → quickstart-O7L2NNGJ.js} +6 -6
- package/dist/cli/{run-66HXNJNV.js → run-HJ2AR6CM.js} +49 -48
- package/dist/cli/{run-5RNJGPQ2.mjs → run-OK545H5Q.mjs} +28 -27
- package/dist/cli/search-UUNS6BCC.js +32 -0
- package/dist/cli/{search-7G4FYQYO.mjs → search-Z5ZKMRTX.mjs} +9 -9
- package/dist/cli/{search-output-6K4FHCVI.mjs → search-output-Q5VHNUWG.mjs} +4 -4
- package/dist/cli/{search-output-L6ICQDBL.js → search-output-SVW4DETG.js} +6 -6
- package/dist/cli/{secrets-PWFJKF7G.js → secrets-ENQWMCB5.js} +17 -17
- package/dist/cli/{secrets-FTQPCU7O.mjs → secrets-QIKIEFWB.mjs} +8 -8
- package/dist/cli/{sessions-YSSAAQVJ.mjs → sessions-AETO22RF.mjs} +6 -6
- package/dist/cli/sessions-FNSUDERA.js +22 -0
- package/dist/cli/{settings-KN7GNZ5J.mjs → settings-G5RGRPFV.mjs} +16 -16
- package/dist/cli/{settings-CZEMF2WD.js → settings-OFLIFTMZ.js} +89 -89
- package/dist/cli/{setup-5WLHGH57.mjs → setup-G4N3X6KG.mjs} +9 -9
- package/dist/cli/{setup-RW4X6DX4.js → setup-QW7Y62XD.js} +49 -49
- package/dist/cli/skills-3IXIY2IV.js +36 -0
- package/dist/cli/{skills-DLVI7IZK.mjs → skills-QRFQGHNA.mjs} +7 -7
- package/dist/cli/{tools-JVYQF7P3.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-XKLXU7YS.mjs → update-SDGZLAGL.mjs} +9 -9
- package/dist/cli/{views-QRRCWP6B.mjs → views-3BIJFJMQ.mjs} +8 -8
- package/dist/cli/{views-YNUYFS3S.js → views-5QKAWYPI.js} +23 -23
- package/dist/cli/{workflow-YUKADKCJ.js → workflow-G67RPWVY.js} +19 -19
- package/dist/cli/{workflow-KYFMA4LM.mjs → workflow-QAK773FR.mjs} +9 -9
- package/dist/{client-B1fixtK1.d.ts → client-D1ga52xq.d.ts} +1 -1
- package/dist/{client-CE4QBVbp.d.mts → client-bd4QQIXo.d.mts} +1 -1
- package/dist/{client-core-C-3FVlVq.d.ts → client-core-B6eMVx8h.d.ts} +335 -4
- package/dist/{client-core-2BkNBgrx.d.mts → client-core-CqfWNf2Q.d.mts} +335 -4
- package/dist/{compiler-manifest-Cys06iYg.d.ts → compiler-manifest-BWFtsQIC.d.mts} +21 -0
- package/dist/{compiler-manifest-Cys06iYg.d.mts → 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-V76O674K.js +0 -43
- package/dist/cli/concurrent-runs-help-MFEPUP6Y.js +0 -21
- package/dist/cli/describe-5OUJA5TH.mjs +0 -49
- package/dist/cli/describe-7MF5AHIU.js +0 -49
- package/dist/cli/git-WLQ3BS6K.js +0 -25
- package/dist/cli/search-LTUIIV6W.js +0 -32
- package/dist/cli/sessions-2IVFGTPA.js +0 -22
- package/dist/cli/skills-WT42AZVH.js +0 -36
- package/dist/cli/tools-D6STYBQG.js +0 -56
- package/dist/cli/update-XTUKBC3J.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,
|
|
@@ -448,7 +458,31 @@ const POSTGRES_SCHEDULER_SCHEMA_INIT_STATEMENT_TIMEOUT_MS = 60_000;
|
|
|
448
458
|
// (`runtime_scheduler_runs_staged_input_expiry_idx`). It is an optional
|
|
449
459
|
// optimization built concurrently, absent from the readiness shape, and this
|
|
450
460
|
// marker records deployment work, never a runtime schema floor.
|
|
451
|
-
|
|
461
|
+
// v68 widens the `provider` CHECK on the four managed-sandbox tables
|
|
462
|
+
// (capacity leases, operation ledger, cleanup jobs and cleanup events) to admit
|
|
463
|
+
// `vercel` beside `daytona` and `modal`. Expand only: no writer emits it yet,
|
|
464
|
+
// every existing row already satisfies the wider check, and older workers only
|
|
465
|
+
// claim cleanup for their own providers. Nothing reads this marker at runtime.
|
|
466
|
+
export const POSTGRES_SCHEDULER_SCHEMA_VERSION = 68;
|
|
467
|
+
/**
|
|
468
|
+
* Providers the managed-sandbox tables admit. A new provider is added here
|
|
469
|
+
* (and so to every `provider` CHECK) before any writer records it.
|
|
470
|
+
*/
|
|
471
|
+
const POSTGRES_SCHEDULER_SANDBOX_PROVIDERS = [
|
|
472
|
+
'daytona',
|
|
473
|
+
'modal',
|
|
474
|
+
'vercel',
|
|
475
|
+
] as const;
|
|
476
|
+
const POSTGRES_SCHEDULER_SANDBOX_PROVIDER_CHECK_SQL = `provider IN (${POSTGRES_SCHEDULER_SANDBOX_PROVIDERS.map(
|
|
477
|
+
(provider) => `'${provider}'`,
|
|
478
|
+
).join(', ')})`;
|
|
479
|
+
/** Tables whose `provider` CHECK follows `POSTGRES_SCHEDULER_SANDBOX_PROVIDERS`. */
|
|
480
|
+
const POSTGRES_SCHEDULER_SANDBOX_PROVIDER_TABLES = [
|
|
481
|
+
'runtime_sandbox_capacity_leases',
|
|
482
|
+
'runtime_sandbox_operations',
|
|
483
|
+
'sandbox_cleanup_jobs_v2',
|
|
484
|
+
'sandbox_cleanup_events_v2',
|
|
485
|
+
] as const;
|
|
452
486
|
const POSTGRES_SCHEDULER_SCHEMA_MIGRATIONS_TABLE =
|
|
453
487
|
'scheduler_schema_migrations';
|
|
454
488
|
export const POSTGRES_SCHEDULER_OPEN_RECOVERY_INDEX =
|
|
@@ -1152,6 +1186,11 @@ function quoteIdent(value: string): string {
|
|
|
1152
1186
|
return `"${value.replace(/"/g, '""')}"`;
|
|
1153
1187
|
}
|
|
1154
1188
|
|
|
1189
|
+
/** A SQL string literal for trusted, code-owned DDL text. */
|
|
1190
|
+
function quoteLiteral(value: string): string {
|
|
1191
|
+
return `'${value.replace(/'/g, "''")}'`;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1155
1194
|
function schemaName(
|
|
1156
1195
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
1157
1196
|
): string {
|
|
@@ -2477,12 +2516,91 @@ export async function ensurePostgresSchedulerOnlineAdditiveExpansion(
|
|
|
2477
2516
|
await ensurePostgresSchedulerRunLogStorageExpansion(client, options);
|
|
2478
2517
|
await ensurePostgresSchedulerArrayInputIntentExpansion(client, options);
|
|
2479
2518
|
await ensurePostgresSchedulerGatewayReaderFenceSchema(client, options);
|
|
2519
|
+
await ensurePostgresSchedulerSandboxProviderCheckExpansion(client, options);
|
|
2480
2520
|
await ensurePostgresSchedulerSandboxCapacityAdmissionFunctions(
|
|
2481
2521
|
client,
|
|
2482
2522
|
options,
|
|
2483
2523
|
);
|
|
2484
2524
|
}
|
|
2485
2525
|
|
|
2526
|
+
/**
|
|
2527
|
+
* Deployment-owned v68 expansion: widen each managed-sandbox table's
|
|
2528
|
+
* `provider` CHECK to `POSTGRES_SCHEDULER_SANDBOX_PROVIDERS`.
|
|
2529
|
+
*
|
|
2530
|
+
* Expand only. The narrower check is replaced by a wider one added `NOT
|
|
2531
|
+
* VALID` (a brief catalog lock, no scan), then validated in its own statement,
|
|
2532
|
+
* which scans without blocking writers. Every existing row already satisfies
|
|
2533
|
+
* the wider check. Each statement is idempotent and enters the deployment
|
|
2534
|
+
* caller's own bounded transaction, so a rerun or an interrupted run resumes
|
|
2535
|
+
* without touching a table that is already expanded. A table that does not
|
|
2536
|
+
* exist yet is skipped. The bootstrap still creates these tables with their
|
|
2537
|
+
* original (Daytona/Modal) checks, unchanged for the shared-schema DDL gate,
|
|
2538
|
+
* and widens them through this expansion before writing the marker.
|
|
2539
|
+
*/
|
|
2540
|
+
export async function ensurePostgresSchedulerSandboxProviderCheckExpansion(
|
|
2541
|
+
client: PostgresSchedulerQueryClient,
|
|
2542
|
+
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
2543
|
+
): Promise<void> {
|
|
2544
|
+
for (const table of POSTGRES_SCHEDULER_SANDBOX_PROVIDER_TABLES) {
|
|
2545
|
+
const relation = tableName(table, options);
|
|
2546
|
+
const constraint = quoteIdent(`${table}_provider_check`);
|
|
2547
|
+
await client.query(`
|
|
2548
|
+
DO $$
|
|
2549
|
+
DECLARE
|
|
2550
|
+
relation regclass := to_regclass(${quoteLiteral(relation)});
|
|
2551
|
+
drops text;
|
|
2552
|
+
BEGIN
|
|
2553
|
+
IF relation IS NULL OR EXISTS (
|
|
2554
|
+
SELECT 1 FROM pg_constraint
|
|
2555
|
+
WHERE conrelid = relation
|
|
2556
|
+
AND contype = 'c'
|
|
2557
|
+
AND pg_get_constraintdef(oid) LIKE '%(provider = ANY (%'
|
|
2558
|
+
${POSTGRES_SCHEDULER_SANDBOX_PROVIDERS.map(
|
|
2559
|
+
(provider) =>
|
|
2560
|
+
`AND pg_get_constraintdef(oid) LIKE ${quoteLiteral(`%'${provider}'%`)}`,
|
|
2561
|
+
).join('\n ')}
|
|
2562
|
+
) THEN
|
|
2563
|
+
RETURN;
|
|
2564
|
+
END IF;
|
|
2565
|
+
SELECT string_agg(format('DROP CONSTRAINT %I, ', conname), '')
|
|
2566
|
+
INTO drops
|
|
2567
|
+
FROM pg_constraint
|
|
2568
|
+
WHERE conrelid = relation
|
|
2569
|
+
AND contype = 'c'
|
|
2570
|
+
AND pg_get_constraintdef(oid) LIKE '%(provider = ANY (%';
|
|
2571
|
+
-- One statement: the narrower check is never absent while the wider
|
|
2572
|
+
-- one is missing.
|
|
2573
|
+
EXECUTE format(
|
|
2574
|
+
'ALTER TABLE %s %sADD CONSTRAINT %s CHECK (%s) NOT VALID',
|
|
2575
|
+
relation,
|
|
2576
|
+
coalesce(drops, ''),
|
|
2577
|
+
${quoteLiteral(constraint)},
|
|
2578
|
+
${quoteLiteral(POSTGRES_SCHEDULER_SANDBOX_PROVIDER_CHECK_SQL)}
|
|
2579
|
+
);
|
|
2580
|
+
END $$
|
|
2581
|
+
`);
|
|
2582
|
+
await client.query(`
|
|
2583
|
+
DO $$
|
|
2584
|
+
DECLARE
|
|
2585
|
+
relation regclass := to_regclass(${quoteLiteral(relation)});
|
|
2586
|
+
BEGIN
|
|
2587
|
+
IF relation IS NOT NULL AND EXISTS (
|
|
2588
|
+
SELECT 1 FROM pg_constraint
|
|
2589
|
+
WHERE conrelid = relation
|
|
2590
|
+
AND conname = ${quoteLiteral(`${table}_provider_check`)}
|
|
2591
|
+
AND NOT convalidated
|
|
2592
|
+
) THEN
|
|
2593
|
+
EXECUTE format(
|
|
2594
|
+
'ALTER TABLE %s VALIDATE CONSTRAINT %s',
|
|
2595
|
+
relation,
|
|
2596
|
+
${quoteLiteral(constraint)}
|
|
2597
|
+
);
|
|
2598
|
+
END IF;
|
|
2599
|
+
END $$
|
|
2600
|
+
`);
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
|
|
2486
2604
|
/** Deployment-owned v64 expansion; absent values retain legacy behavior. */
|
|
2487
2605
|
async function ensurePostgresSchedulerArrayInputIntentExpansion(
|
|
2488
2606
|
client: PostgresSchedulerQueryClient,
|
|
@@ -3433,6 +3551,16 @@ export async function ensurePostgresSchedulerSchema(
|
|
|
3433
3551
|
concurrently: false,
|
|
3434
3552
|
});
|
|
3435
3553
|
}
|
|
3554
|
+
// The current-shape probe does not read the provider checks, so a v67
|
|
3555
|
+
// schema takes this path; widen them before the v68 marker is written.
|
|
3556
|
+
// Once the marker is recorded the deploy migration owns them, so a
|
|
3557
|
+
// worker cold start never takes table locks for this.
|
|
3558
|
+
if (!appliedVersion.rows[0]?.applied) {
|
|
3559
|
+
await ensurePostgresSchedulerSandboxProviderCheckExpansion(
|
|
3560
|
+
client,
|
|
3561
|
+
options,
|
|
3562
|
+
);
|
|
3563
|
+
}
|
|
3436
3564
|
await ensurePostgresSchedulerSandboxCapacityAdmissionFunctions(
|
|
3437
3565
|
client,
|
|
3438
3566
|
options,
|
|
@@ -3887,6 +4015,10 @@ export async function ensurePostgresSchedulerSchema(
|
|
|
3887
4015
|
END IF;
|
|
3888
4016
|
END $$
|
|
3889
4017
|
`);
|
|
4018
|
+
// The managed-sandbox tables are still created with their original
|
|
4019
|
+
// (Daytona/Modal) provider checks, which a shared database keeps; every
|
|
4020
|
+
// bootstrap then widens them through the same v68 expansion.
|
|
4021
|
+
await ensurePostgresSchedulerSandboxProviderCheckExpansion(client, options);
|
|
3890
4022
|
await client.query(`
|
|
3891
4023
|
DROP INDEX IF EXISTS ${quoteIdent(schemaName(options))}.${quoteIdent(
|
|
3892
4024
|
'runtime_scheduler_sandbox_operations_reconcile_idx',
|
|
@@ -9225,7 +9357,7 @@ export async function failPostgresSchedulerScheduledChildWaits(
|
|
|
9225
9357
|
ELSE (
|
|
9226
9358
|
SELECT jsonb_agg(
|
|
9227
9359
|
CASE
|
|
9228
|
-
WHEN resource->>'kind' IN
|
|
9360
|
+
WHEN resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
9229
9361
|
THEN resource || jsonb_build_object(
|
|
9230
9362
|
'billingEndedAt',
|
|
9231
9363
|
extract(
|
|
@@ -9266,10 +9398,7 @@ export async function failPostgresSchedulerScheduledChildWaits(
|
|
|
9266
9398
|
provider, sandbox_id, run_id, attempt, environment, routing_domain
|
|
9267
9399
|
)
|
|
9268
9400
|
SELECT DISTINCT
|
|
9269
|
-
|
|
9270
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
9271
|
-
ELSE 'daytona'
|
|
9272
|
-
END,
|
|
9401
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
9273
9402
|
resource->>'sandboxId',
|
|
9274
9403
|
terminal_attempts.run_id,
|
|
9275
9404
|
terminal_attempts.attempt,
|
|
@@ -9278,10 +9407,7 @@ export async function failPostgresSchedulerScheduledChildWaits(
|
|
|
9278
9407
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
9279
9408
|
'production'
|
|
9280
9409
|
),
|
|
9281
|
-
|
|
9282
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
9283
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
9284
|
-
END
|
|
9410
|
+
${managedSandboxRoutingDomainSql('resource')}
|
|
9285
9411
|
FROM terminal_attempts
|
|
9286
9412
|
CROSS JOIN LATERAL jsonb_array_elements(
|
|
9287
9413
|
CASE
|
|
@@ -9291,7 +9417,7 @@ export async function failPostgresSchedulerScheduledChildWaits(
|
|
|
9291
9417
|
END
|
|
9292
9418
|
) AS resource
|
|
9293
9419
|
WHERE terminal_attempts.resource_json IS NOT NULL
|
|
9294
|
-
AND resource->>'kind' IN
|
|
9420
|
+
AND resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
9295
9421
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
9296
9422
|
ON CONFLICT (provider, sandbox_id, routing_domain_key) DO NOTHING
|
|
9297
9423
|
), compute_billing_job AS (
|
|
@@ -9308,7 +9434,7 @@ export async function failPostgresSchedulerScheduledChildWaits(
|
|
|
9308
9434
|
) AS resource
|
|
9309
9435
|
WHERE resource->>'kind' IN ('compute_session', 'local_process')
|
|
9310
9436
|
OR (
|
|
9311
|
-
resource->>'kind' IN
|
|
9437
|
+
resource->>'kind' IN ${COMPUTE_BILLED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
9312
9438
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
9313
9439
|
)
|
|
9314
9440
|
ON CONFLICT (run_id) DO NOTHING
|
|
@@ -11811,10 +11937,22 @@ export async function recordPostgresSchedulerSignal(
|
|
|
11811
11937
|
eventKey: string;
|
|
11812
11938
|
boundaryId?: string | null;
|
|
11813
11939
|
payload: unknown;
|
|
11940
|
+
deliveryId?: string;
|
|
11814
11941
|
},
|
|
11815
11942
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
11816
11943
|
): Promise<PostgresSchedulerSignalRecord> {
|
|
11817
|
-
const signalId =
|
|
11944
|
+
const signalId = input.deliveryId
|
|
11945
|
+
? `signal:delivery:${createHash('sha256')
|
|
11946
|
+
.update(
|
|
11947
|
+
JSON.stringify([
|
|
11948
|
+
input.runId,
|
|
11949
|
+
input.eventKey,
|
|
11950
|
+
input.boundaryId ?? null,
|
|
11951
|
+
input.deliveryId,
|
|
11952
|
+
]),
|
|
11953
|
+
)
|
|
11954
|
+
.digest('hex')}`
|
|
11955
|
+
: `signal:${randomUUID()}`;
|
|
11818
11956
|
const inserted = await client.query<{
|
|
11819
11957
|
signal_id: string;
|
|
11820
11958
|
run_id: string;
|
|
@@ -11831,6 +11969,7 @@ export async function recordPostgresSchedulerSignal(
|
|
|
11831
11969
|
payload_json
|
|
11832
11970
|
)
|
|
11833
11971
|
VALUES ($1, $2, $3, $4, $5::jsonb)
|
|
11972
|
+
ON CONFLICT (signal_id) DO UPDATE SET signal_id = EXCLUDED.signal_id
|
|
11834
11973
|
RETURNING signal_id, run_id, event_key, boundary_id, payload_json
|
|
11835
11974
|
`,
|
|
11836
11975
|
[
|
|
@@ -11901,17 +12040,14 @@ export async function recordPostgresSchedulerManagedSandboxOperationLive(
|
|
|
11901
12040
|
attempt: number;
|
|
11902
12041
|
leaseToken: string;
|
|
11903
12042
|
resource: PlayRunnerRuntimeResource & {
|
|
11904
|
-
kind:
|
|
12043
|
+
kind: ManagedSandboxResourceKind;
|
|
11905
12044
|
sandboxCapacityLeaseId: string;
|
|
11906
12045
|
};
|
|
11907
12046
|
},
|
|
11908
12047
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
11909
12048
|
): Promise<boolean> {
|
|
11910
12049
|
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;
|
|
12050
|
+
const routingDomain = runtimeSandboxRoutingDomainForResource(input.resource);
|
|
11915
12051
|
const environment =
|
|
11916
12052
|
input.resource.runtimeEnvironment ??
|
|
11917
12053
|
input.resource.daytonaEnvironment ??
|
|
@@ -12589,17 +12725,14 @@ export async function recordPostgresSchedulerLateManagedSandboxOperationForClean
|
|
|
12589
12725
|
attempt: number;
|
|
12590
12726
|
leaseToken: string;
|
|
12591
12727
|
resource: PlayRunnerRuntimeResource & {
|
|
12592
|
-
kind:
|
|
12728
|
+
kind: ManagedSandboxResourceKind;
|
|
12593
12729
|
sandboxCapacityLeaseId: string;
|
|
12594
12730
|
};
|
|
12595
12731
|
},
|
|
12596
12732
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
12597
12733
|
): Promise<boolean> {
|
|
12598
12734
|
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;
|
|
12735
|
+
const routingDomain = runtimeSandboxRoutingDomainForResource(input.resource);
|
|
12603
12736
|
const environment =
|
|
12604
12737
|
input.resource.runtimeEnvironment ??
|
|
12605
12738
|
input.resource.daytonaEnvironment ??
|
|
@@ -12778,7 +12911,7 @@ export async function markPostgresSchedulerRuntimeResourceDetached(
|
|
|
12778
12911
|
SET resource_json = (
|
|
12779
12912
|
SELECT jsonb_agg(
|
|
12780
12913
|
CASE
|
|
12781
|
-
WHEN resource->>'kind' IN
|
|
12914
|
+
WHEN resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
12782
12915
|
AND resource->>'sandboxId' = $4
|
|
12783
12916
|
THEN resource || jsonb_build_object(
|
|
12784
12917
|
'executionDetachedAt',
|
|
@@ -12801,7 +12934,7 @@ export async function markPostgresSchedulerRuntimeResourceDetached(
|
|
|
12801
12934
|
AND EXISTS (
|
|
12802
12935
|
SELECT 1
|
|
12803
12936
|
FROM jsonb_array_elements(resource_json) AS candidate
|
|
12804
|
-
WHERE candidate->>'kind' IN
|
|
12937
|
+
WHERE candidate->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
12805
12938
|
AND candidate->>'sandboxId' = $4
|
|
12806
12939
|
)
|
|
12807
12940
|
RETURNING run_id
|
|
@@ -12885,8 +13018,8 @@ export async function settlePostgresSchedulerRuntimeResources(
|
|
|
12885
13018
|
SELECT COALESCE(
|
|
12886
13019
|
jsonb_agg(
|
|
12887
13020
|
CASE
|
|
12888
|
-
WHEN elem->>'kind' IN
|
|
12889
|
-
AND NOT ${protectedManagedSandboxSql({ runId: '$1', provider: "
|
|
13021
|
+
WHEN elem->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13022
|
+
AND NOT ${protectedManagedSandboxSql({ runId: '$1', provider: managedSandboxProviderSql("elem->>'kind'"), sandboxId: "elem->>'sandboxId'", routingDomain: managedSandboxRoutingDomainSql('elem') }, options, true)}
|
|
12890
13023
|
AND (
|
|
12891
13024
|
elem->'billingEndedAt' IS NULL
|
|
12892
13025
|
OR elem->'billingEndedAt' = 'null'::jsonb
|
|
@@ -12915,7 +13048,7 @@ export async function settlePostgresSchedulerRuntimeResources(
|
|
|
12915
13048
|
AND EXISTS (
|
|
12916
13049
|
SELECT 1
|
|
12917
13050
|
FROM jsonb_array_elements(resource_json) AS candidate
|
|
12918
|
-
WHERE candidate->>'kind' IN
|
|
13051
|
+
WHERE candidate->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
12919
13052
|
AND (
|
|
12920
13053
|
candidate->'billingEndedAt' IS NULL
|
|
12921
13054
|
OR candidate->'billingEndedAt' = 'null'::jsonb
|
|
@@ -12983,7 +13116,7 @@ export async function recordPostgresSchedulerRunnerTerminal(
|
|
|
12983
13116
|
SELECT COALESCE(
|
|
12984
13117
|
jsonb_agg(
|
|
12985
13118
|
CASE
|
|
12986
|
-
WHEN resource->>'kind' IN
|
|
13119
|
+
WHEN resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
12987
13120
|
AND (
|
|
12988
13121
|
resource->'billingEndedAt' IS NULL
|
|
12989
13122
|
OR resource->'billingEndedAt' = 'null'::jsonb
|
|
@@ -13251,7 +13384,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13251
13384
|
SELECT COALESCE(
|
|
13252
13385
|
jsonb_agg(
|
|
13253
13386
|
CASE
|
|
13254
|
-
WHEN elem->>'kind' IN
|
|
13387
|
+
WHEN elem->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13255
13388
|
AND (
|
|
13256
13389
|
elem->'billingEndedAt' IS NULL
|
|
13257
13390
|
OR elem->'billingEndedAt' = 'null'::jsonb
|
|
@@ -13333,7 +13466,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13333
13466
|
SELECT COALESCE(
|
|
13334
13467
|
jsonb_agg(
|
|
13335
13468
|
CASE
|
|
13336
|
-
WHEN elem->>'kind' IN
|
|
13469
|
+
WHEN elem->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13337
13470
|
AND (
|
|
13338
13471
|
elem->'billingEndedAt' IS NULL
|
|
13339
13472
|
OR elem->'billingEndedAt' = 'null'::jsonb
|
|
@@ -13391,10 +13524,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13391
13524
|
provider, sandbox_id, run_id, attempt, environment, routing_domain
|
|
13392
13525
|
)
|
|
13393
13526
|
SELECT DISTINCT
|
|
13394
|
-
|
|
13395
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
13396
|
-
ELSE 'daytona'
|
|
13397
|
-
END,
|
|
13527
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
13398
13528
|
resource->>'sandboxId',
|
|
13399
13529
|
all_settled_resources.run_id,
|
|
13400
13530
|
all_settled_resources.attempt,
|
|
@@ -13403,10 +13533,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13403
13533
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
13404
13534
|
'production'
|
|
13405
13535
|
),
|
|
13406
|
-
|
|
13407
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
13408
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
13409
|
-
END
|
|
13536
|
+
${managedSandboxRoutingDomainSql('resource')}
|
|
13410
13537
|
FROM all_settled_resources
|
|
13411
13538
|
CROSS JOIN LATERAL jsonb_array_elements(
|
|
13412
13539
|
CASE
|
|
@@ -13416,7 +13543,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13416
13543
|
END
|
|
13417
13544
|
) AS resource
|
|
13418
13545
|
WHERE all_settled_resources.resource_json IS NOT NULL
|
|
13419
|
-
AND resource->>'kind' IN
|
|
13546
|
+
AND resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13420
13547
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
13421
13548
|
ON CONFLICT (provider, sandbox_id, routing_domain_key) DO NOTHING
|
|
13422
13549
|
),
|
|
@@ -13448,7 +13575,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13448
13575
|
) AS resource
|
|
13449
13576
|
WHERE resource->>'kind' IN ('compute_session', 'local_process')
|
|
13450
13577
|
OR (
|
|
13451
|
-
resource->>'kind' IN
|
|
13578
|
+
resource->>'kind' IN ${COMPUTE_BILLED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13452
13579
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
13453
13580
|
)
|
|
13454
13581
|
ON CONFLICT (run_id) DO NOTHING
|
|
@@ -13585,7 +13712,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13585
13712
|
SELECT COALESCE(
|
|
13586
13713
|
jsonb_agg(
|
|
13587
13714
|
CASE
|
|
13588
|
-
WHEN elem->>'kind' IN
|
|
13715
|
+
WHEN elem->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13589
13716
|
AND (
|
|
13590
13717
|
elem->'billingEndedAt' IS NULL
|
|
13591
13718
|
OR elem->'billingEndedAt' = 'null'::jsonb
|
|
@@ -13646,10 +13773,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13646
13773
|
provider, sandbox_id, run_id, attempt, environment, routing_domain
|
|
13647
13774
|
)
|
|
13648
13775
|
SELECT DISTINCT
|
|
13649
|
-
|
|
13650
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
13651
|
-
ELSE 'daytona'
|
|
13652
|
-
END,
|
|
13776
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
13653
13777
|
resource->>'sandboxId',
|
|
13654
13778
|
stale_attempt.run_id,
|
|
13655
13779
|
stale_attempt.attempt,
|
|
@@ -13658,10 +13782,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13658
13782
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
13659
13783
|
'production'
|
|
13660
13784
|
),
|
|
13661
|
-
|
|
13662
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
13663
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
13664
|
-
END
|
|
13785
|
+
${managedSandboxRoutingDomainSql('resource')}
|
|
13665
13786
|
FROM stale_attempt
|
|
13666
13787
|
CROSS JOIN LATERAL jsonb_array_elements(
|
|
13667
13788
|
CASE
|
|
@@ -13671,7 +13792,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
|
|
|
13671
13792
|
END
|
|
13672
13793
|
) AS resource
|
|
13673
13794
|
WHERE stale_attempt.resource_json IS NOT NULL
|
|
13674
|
-
AND resource->>'kind' IN
|
|
13795
|
+
AND resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13675
13796
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
13676
13797
|
ON CONFLICT (provider, sandbox_id, routing_domain_key) DO NOTHING
|
|
13677
13798
|
),
|
|
@@ -13748,7 +13869,7 @@ export async function ensurePostgresSchedulerTerminalComputeBillingJob(
|
|
|
13748
13869
|
AND (
|
|
13749
13870
|
resource->>'kind' IN ('compute_session', 'local_process')
|
|
13750
13871
|
OR (
|
|
13751
|
-
resource->>'kind' IN
|
|
13872
|
+
resource->>'kind' IN ${COMPUTE_BILLED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13752
13873
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
13753
13874
|
)
|
|
13754
13875
|
)
|
|
@@ -13817,7 +13938,7 @@ async function backfillPostgresSchedulerTerminalComputeBillingJobBatch(
|
|
|
13817
13938
|
AND (
|
|
13818
13939
|
resource->>'kind' IN ('compute_session', 'local_process')
|
|
13819
13940
|
OR (
|
|
13820
|
-
resource->>'kind' IN
|
|
13941
|
+
resource->>'kind' IN ${COMPUTE_BILLED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
13821
13942
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
13822
13943
|
)
|
|
13823
13944
|
)
|
|
@@ -14560,12 +14681,8 @@ function protectedDetachedSandboxSql(
|
|
|
14560
14681
|
AND detached_attempt.status IN ('claimed', 'running', 'waiting')
|
|
14561
14682
|
AND detached_attempt.runner_result_json IS NULL
|
|
14562
14683
|
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)
|
|
14684
|
+
AND ${managedSandboxProviderSql("detached_resource ->> 'kind'")} = ${identity.provider}
|
|
14685
|
+
AND (${managedSandboxRoutingDomainSql('detached_resource')})
|
|
14569
14686
|
IS NOT DISTINCT FROM ${identity.routingDomain}
|
|
14570
14687
|
AND (
|
|
14571
14688
|
(detached_run.suspension_json ->> 'kind' = 'detached_runner'
|
|
@@ -14592,11 +14709,9 @@ function protectedDetachedResourceSql(
|
|
|
14592
14709
|
return protectedDetachedSandboxSql(
|
|
14593
14710
|
{
|
|
14594
14711
|
runId,
|
|
14595
|
-
provider:
|
|
14596
|
-
"(CASE resource->>'kind' WHEN 'modal_sandbox' THEN 'modal' ELSE 'daytona' END)",
|
|
14712
|
+
provider: managedSandboxProviderSql("resource->>'kind'"),
|
|
14597
14713
|
sandboxId: "resource->>'sandboxId'",
|
|
14598
|
-
routingDomain:
|
|
14599
|
-
"(CASE resource->>'kind' WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '') ELSE NULLIF(resource->>'daytonaOrganizationId', '') END)",
|
|
14714
|
+
routingDomain: managedSandboxRoutingDomainSql('resource'),
|
|
14600
14715
|
},
|
|
14601
14716
|
options,
|
|
14602
14717
|
locked,
|
|
@@ -14605,7 +14720,7 @@ function protectedDetachedResourceSql(
|
|
|
14605
14720
|
|
|
14606
14721
|
export type PostgresSchedulerSandboxCleanupJob = {
|
|
14607
14722
|
status: typeof SandboxCleanupJobStatus.Deleting;
|
|
14608
|
-
provider: 'daytona' | 'modal';
|
|
14723
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
14609
14724
|
sandboxId: string;
|
|
14610
14725
|
runId: string;
|
|
14611
14726
|
attempt: number;
|
|
@@ -14642,10 +14757,7 @@ export async function enqueuePostgresSchedulerSandboxCleanupForAttempt(
|
|
|
14642
14757
|
provider, sandbox_id, run_id, attempt, environment, routing_domain
|
|
14643
14758
|
)
|
|
14644
14759
|
SELECT DISTINCT
|
|
14645
|
-
|
|
14646
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
14647
|
-
ELSE 'daytona'
|
|
14648
|
-
END,
|
|
14760
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
14649
14761
|
resource->>'sandboxId',
|
|
14650
14762
|
attempt_resources.run_id,
|
|
14651
14763
|
attempt_resources.attempt,
|
|
@@ -14654,10 +14766,7 @@ export async function enqueuePostgresSchedulerSandboxCleanupForAttempt(
|
|
|
14654
14766
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
14655
14767
|
'production'
|
|
14656
14768
|
),
|
|
14657
|
-
|
|
14658
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
14659
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
14660
|
-
END
|
|
14769
|
+
${managedSandboxRoutingDomainSql('resource')}
|
|
14661
14770
|
FROM attempt_resources
|
|
14662
14771
|
CROSS JOIN LATERAL jsonb_array_elements(
|
|
14663
14772
|
CASE
|
|
@@ -14666,7 +14775,7 @@ export async function enqueuePostgresSchedulerSandboxCleanupForAttempt(
|
|
|
14666
14775
|
ELSE jsonb_build_array(attempt_resources.resource_json)
|
|
14667
14776
|
END
|
|
14668
14777
|
) AS resource
|
|
14669
|
-
WHERE resource->>'kind' IN
|
|
14778
|
+
WHERE resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
14670
14779
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
14671
14780
|
AND NOT ${protectedDetachedResourceSql('$1', options, true)}
|
|
14672
14781
|
ON CONFLICT (provider, sandbox_id, routing_domain_key) DO NOTHING
|
|
@@ -14693,10 +14802,7 @@ export async function enqueuePostgresSchedulerSandboxCleanupForRun(
|
|
|
14693
14802
|
provider, sandbox_id, run_id, attempt, environment, routing_domain
|
|
14694
14803
|
)
|
|
14695
14804
|
SELECT DISTINCT
|
|
14696
|
-
|
|
14697
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
14698
|
-
ELSE 'daytona'
|
|
14699
|
-
END,
|
|
14805
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
14700
14806
|
resource->>'sandboxId',
|
|
14701
14807
|
attempt.run_id,
|
|
14702
14808
|
attempt.attempt,
|
|
@@ -14705,10 +14811,7 @@ export async function enqueuePostgresSchedulerSandboxCleanupForRun(
|
|
|
14705
14811
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
14706
14812
|
'production'
|
|
14707
14813
|
),
|
|
14708
|
-
|
|
14709
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
14710
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
14711
|
-
END
|
|
14814
|
+
${managedSandboxRoutingDomainSql('resource')}
|
|
14712
14815
|
FROM custody_attempts AS attempt
|
|
14713
14816
|
CROSS JOIN (SELECT count(*) FROM custody_operations) AS operation_locks
|
|
14714
14817
|
CROSS JOIN LATERAL jsonb_array_elements(
|
|
@@ -14721,7 +14824,7 @@ export async function enqueuePostgresSchedulerSandboxCleanupForRun(
|
|
|
14721
14824
|
WHERE attempt.run_id = $1
|
|
14722
14825
|
AND ($2::integer IS NULL OR attempt.attempt <= $2)
|
|
14723
14826
|
AND attempt.resource_json IS NOT NULL
|
|
14724
|
-
AND resource->>'kind' IN
|
|
14827
|
+
AND resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
14725
14828
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
14726
14829
|
AND NOT ${protectedDetachedResourceSql('$1', options, true)}
|
|
14727
14830
|
UNION ALL
|
|
@@ -14870,7 +14973,7 @@ export async function readPostgresSchedulerSandboxRetirement(
|
|
|
14870
14973
|
runId: string;
|
|
14871
14974
|
attempt: number;
|
|
14872
14975
|
leaseToken: string;
|
|
14873
|
-
provider: 'daytona' | 'modal';
|
|
14976
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
14874
14977
|
sandboxId: string;
|
|
14875
14978
|
routingDomain: string | null;
|
|
14876
14979
|
},
|
|
@@ -14928,7 +15031,7 @@ export async function readPostgresSchedulerSandboxRetirement(
|
|
|
14928
15031
|
export async function readPostgresSchedulerSandboxCleanupClaim(
|
|
14929
15032
|
client: PostgresSchedulerQueryClient,
|
|
14930
15033
|
input: {
|
|
14931
|
-
provider: 'daytona' | 'modal';
|
|
15034
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
14932
15035
|
sandboxId: string;
|
|
14933
15036
|
routingDomain: string | null;
|
|
14934
15037
|
runId: string;
|
|
@@ -14977,7 +15080,7 @@ export async function claimPostgresSchedulerSandboxCleanupJobs(
|
|
|
14977
15080
|
input: {
|
|
14978
15081
|
leaseOwner: string;
|
|
14979
15082
|
exactResource?: {
|
|
14980
|
-
provider: 'daytona' | 'modal';
|
|
15083
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
14981
15084
|
sandboxId: string;
|
|
14982
15085
|
routingDomain: string | null;
|
|
14983
15086
|
attempt: number;
|
|
@@ -14987,7 +15090,7 @@ export async function claimPostgresSchedulerSandboxCleanupJobs(
|
|
|
14987
15090
|
limit?: number;
|
|
14988
15091
|
leaseSeconds?: number;
|
|
14989
15092
|
environment?: string | null;
|
|
14990
|
-
providers?: Array<'daytona' | 'modal'>;
|
|
15093
|
+
providers?: Array<'daytona' | 'modal' | 'vercel'>;
|
|
14991
15094
|
},
|
|
14992
15095
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
14993
15096
|
): Promise<PostgresSchedulerSandboxCleanupJob[]> {
|
|
@@ -15271,7 +15374,7 @@ export async function claimPostgresSchedulerSandboxCleanupJobs(
|
|
|
15271
15374
|
if (!claimable) return [];
|
|
15272
15375
|
const claimed = await client.query<{
|
|
15273
15376
|
status: unknown;
|
|
15274
|
-
provider: 'daytona' | 'modal';
|
|
15377
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
15275
15378
|
sandbox_id: string;
|
|
15276
15379
|
run_id: string;
|
|
15277
15380
|
attempt: number;
|
|
@@ -15479,7 +15582,7 @@ export async function claimPostgresSchedulerSandboxCleanupJobs(
|
|
|
15479
15582
|
export async function recordPostgresSchedulerSandboxCrashDiagnostic(
|
|
15480
15583
|
client: PostgresSchedulerQueryClient,
|
|
15481
15584
|
input: {
|
|
15482
|
-
provider: 'daytona' | 'modal';
|
|
15585
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
15483
15586
|
sandboxId: string;
|
|
15484
15587
|
routingDomain: string | null;
|
|
15485
15588
|
runId: string;
|
|
@@ -15559,7 +15662,7 @@ export async function recordPostgresSchedulerSandboxCrashDiagnostic(
|
|
|
15559
15662
|
export async function recordPostgresSchedulerSandboxCleanupEvent(
|
|
15560
15663
|
client: PostgresSchedulerQueryClient,
|
|
15561
15664
|
input: {
|
|
15562
|
-
provider?: 'daytona' | 'modal';
|
|
15665
|
+
provider?: 'daytona' | 'modal' | 'vercel';
|
|
15563
15666
|
sandboxId: string;
|
|
15564
15667
|
routingDomain: string | null;
|
|
15565
15668
|
runId: string;
|
|
@@ -15612,7 +15715,7 @@ export type PostgresSchedulerSandboxDeleteAcceptance = {
|
|
|
15612
15715
|
export async function readPostgresSchedulerSandboxDeleteAcceptance(
|
|
15613
15716
|
client: PostgresSchedulerQueryClient,
|
|
15614
15717
|
input: {
|
|
15615
|
-
provider: 'daytona' | 'modal';
|
|
15718
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
15616
15719
|
sandboxId: string;
|
|
15617
15720
|
routingDomain: string | null;
|
|
15618
15721
|
runId: string;
|
|
@@ -15658,7 +15761,7 @@ export async function readPostgresSchedulerSandboxDeleteAcceptance(
|
|
|
15658
15761
|
export async function completePostgresSchedulerSandboxCleanupJob(
|
|
15659
15762
|
client: PostgresSchedulerQueryClient,
|
|
15660
15763
|
input: {
|
|
15661
|
-
provider?: 'daytona' | 'modal';
|
|
15764
|
+
provider?: 'daytona' | 'modal' | 'vercel';
|
|
15662
15765
|
sandboxId: string;
|
|
15663
15766
|
routingDomain: string | null;
|
|
15664
15767
|
runId: string;
|
|
@@ -15782,8 +15885,8 @@ export async function completePostgresSchedulerSandboxCleanupJob(
|
|
|
15782
15885
|
SET resource_json = (
|
|
15783
15886
|
SELECT jsonb_agg(
|
|
15784
15887
|
CASE
|
|
15785
|
-
WHEN resource->>'kind' =
|
|
15786
|
-
AND (
|
|
15888
|
+
WHEN resource->>'kind' = ${managedSandboxKindForProviderSql('$8::text')}
|
|
15889
|
+
AND ${managedSandboxRoutingDomainForProviderSql('$8::text', 'resource')} IS NOT DISTINCT FROM $9::text
|
|
15787
15890
|
AND resource->>'sandboxId' = $1
|
|
15788
15891
|
AND resource->>'lateAcquired' = 'true'
|
|
15789
15892
|
AND (
|
|
@@ -15829,8 +15932,8 @@ export async function completePostgresSchedulerSandboxCleanupJob(
|
|
|
15829
15932
|
ELSE jsonb_build_array(attempt.resource_json)
|
|
15830
15933
|
END
|
|
15831
15934
|
) AS candidate
|
|
15832
|
-
WHERE candidate->>'kind' =
|
|
15833
|
-
AND (
|
|
15935
|
+
WHERE candidate->>'kind' = ${managedSandboxKindForProviderSql('$8::text')}
|
|
15936
|
+
AND ${managedSandboxRoutingDomainForProviderSql('$8::text', 'candidate')} IS NOT DISTINCT FROM $9::text
|
|
15834
15937
|
AND candidate->>'sandboxId' = $1
|
|
15835
15938
|
AND candidate->>'lateAcquired' = 'true'
|
|
15836
15939
|
)
|
|
@@ -16005,7 +16108,7 @@ export async function completePostgresSchedulerSandboxCleanupJob(
|
|
|
16005
16108
|
export async function retryPostgresSchedulerSandboxCleanupJob(
|
|
16006
16109
|
client: PostgresSchedulerQueryClient,
|
|
16007
16110
|
input: {
|
|
16008
|
-
provider?: 'daytona' | 'modal';
|
|
16111
|
+
provider?: 'daytona' | 'modal' | 'vercel';
|
|
16009
16112
|
sandboxId: string;
|
|
16010
16113
|
routingDomain: string | null;
|
|
16011
16114
|
leaseOwner: string;
|
|
@@ -16098,7 +16201,7 @@ export async function retryPostgresSchedulerSandboxCleanupJob(
|
|
|
16098
16201
|
export async function blockPostgresSchedulerSandboxCleanupJob(
|
|
16099
16202
|
client: PostgresSchedulerQueryClient,
|
|
16100
16203
|
input: {
|
|
16101
|
-
provider?: 'daytona' | 'modal';
|
|
16204
|
+
provider?: 'daytona' | 'modal' | 'vercel';
|
|
16102
16205
|
sandboxId: string;
|
|
16103
16206
|
routingDomain: string | null;
|
|
16104
16207
|
leaseOwner: string;
|
|
@@ -16334,7 +16437,7 @@ export async function listPostgresSchedulerCompletedRunnerTerminals(
|
|
|
16334
16437
|
|
|
16335
16438
|
/** A parked detached runner whose heartbeat is stale beyond its own lease. */
|
|
16336
16439
|
export type PostgresSchedulerStaleDetachedRunner = {
|
|
16337
|
-
provider: 'daytona' | 'modal';
|
|
16440
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
16338
16441
|
releaseId: string | null;
|
|
16339
16442
|
runId: string;
|
|
16340
16443
|
attempt: number;
|
|
@@ -16370,7 +16473,7 @@ export async function listPostgresSchedulerDetachedRunnerLivenessWork(
|
|
|
16370
16473
|
input: {
|
|
16371
16474
|
limit: number;
|
|
16372
16475
|
defaultHeartbeatTimeoutMs: number;
|
|
16373
|
-
afterRunIds: Partial<Record<'daytona' | 'modal', string | null>>;
|
|
16476
|
+
afterRunIds: Partial<Record<'daytona' | 'modal' | 'vercel', string | null>>;
|
|
16374
16477
|
},
|
|
16375
16478
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
16376
16479
|
): Promise<{
|
|
@@ -16379,7 +16482,7 @@ export async function listPostgresSchedulerDetachedRunnerLivenessWork(
|
|
|
16379
16482
|
}> {
|
|
16380
16483
|
const rows = await client.query<{
|
|
16381
16484
|
work: 'inspect' | 'settle';
|
|
16382
|
-
provider: 'daytona' | 'modal';
|
|
16485
|
+
provider: 'daytona' | 'modal' | 'vercel';
|
|
16383
16486
|
absurd_release_id: string | null;
|
|
16384
16487
|
run_id: string;
|
|
16385
16488
|
attempt: number;
|
|
@@ -16435,7 +16538,7 @@ export async function listPostgresSchedulerDetachedRunnerLivenessWork(
|
|
|
16435
16538
|
detached.*,
|
|
16436
16539
|
row_number() OVER (PARTITION BY provider ORDER BY run_id ASC) AS provider_rank
|
|
16437
16540
|
FROM detached
|
|
16438
|
-
WHERE provider IN ('daytona', 'modal')
|
|
16541
|
+
WHERE provider IN ('daytona', 'modal', 'vercel')
|
|
16439
16542
|
AND no_runner_result
|
|
16440
16543
|
AND attempt_status = 'waiting'
|
|
16441
16544
|
AND run_status = 'waiting'
|
|
@@ -17069,7 +17172,7 @@ export async function completePostgresSchedulerAttempt(
|
|
|
17069
17172
|
ELSE (
|
|
17070
17173
|
SELECT jsonb_agg(
|
|
17071
17174
|
CASE
|
|
17072
|
-
WHEN resource->>'kind' IN
|
|
17175
|
+
WHEN resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17073
17176
|
AND (
|
|
17074
17177
|
resource->'billingEndedAt' IS NULL
|
|
17075
17178
|
OR resource->'billingEndedAt' = 'null'::jsonb
|
|
@@ -17120,7 +17223,7 @@ export async function completePostgresSchedulerAttempt(
|
|
|
17120
17223
|
ELSE (
|
|
17121
17224
|
SELECT jsonb_agg(
|
|
17122
17225
|
CASE
|
|
17123
|
-
WHEN resource->>'kind' IN
|
|
17226
|
+
WHEN resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17124
17227
|
AND (
|
|
17125
17228
|
resource->'billingEndedAt' IS NULL
|
|
17126
17229
|
OR resource->'billingEndedAt' = 'null'::jsonb
|
|
@@ -17160,10 +17263,7 @@ export async function completePostgresSchedulerAttempt(
|
|
|
17160
17263
|
provider, sandbox_id, run_id, attempt, environment, routing_domain
|
|
17161
17264
|
)
|
|
17162
17265
|
SELECT DISTINCT
|
|
17163
|
-
|
|
17164
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
17165
|
-
ELSE 'daytona'
|
|
17166
|
-
END,
|
|
17266
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
17167
17267
|
resource->>'sandboxId',
|
|
17168
17268
|
all_settled_resources.run_id,
|
|
17169
17269
|
all_settled_resources.attempt,
|
|
@@ -17172,10 +17272,7 @@ export async function completePostgresSchedulerAttempt(
|
|
|
17172
17272
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
17173
17273
|
'production'
|
|
17174
17274
|
),
|
|
17175
|
-
|
|
17176
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
17177
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
17178
|
-
END
|
|
17275
|
+
${managedSandboxRoutingDomainSql('resource')}
|
|
17179
17276
|
FROM all_settled_resources
|
|
17180
17277
|
CROSS JOIN LATERAL jsonb_array_elements(
|
|
17181
17278
|
CASE
|
|
@@ -17185,7 +17282,7 @@ export async function completePostgresSchedulerAttempt(
|
|
|
17185
17282
|
END
|
|
17186
17283
|
) AS resource
|
|
17187
17284
|
WHERE all_settled_resources.resource_json IS NOT NULL
|
|
17188
|
-
AND resource->>'kind' IN
|
|
17285
|
+
AND resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17189
17286
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
17190
17287
|
ON CONFLICT (provider, sandbox_id, routing_domain_key) DO NOTHING
|
|
17191
17288
|
),
|
|
@@ -17217,7 +17314,7 @@ export async function completePostgresSchedulerAttempt(
|
|
|
17217
17314
|
) AS resource
|
|
17218
17315
|
WHERE resource->>'kind' IN ('compute_session', 'local_process')
|
|
17219
17316
|
OR (
|
|
17220
|
-
resource->>'kind' IN
|
|
17317
|
+
resource->>'kind' IN ${COMPUTE_BILLED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17221
17318
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
17222
17319
|
)
|
|
17223
17320
|
ON CONFLICT (run_id) DO NOTHING
|
|
@@ -17402,7 +17499,7 @@ export async function failPostgresSchedulerAttempt(
|
|
|
17402
17499
|
ELSE (
|
|
17403
17500
|
SELECT jsonb_agg(
|
|
17404
17501
|
CASE
|
|
17405
|
-
WHEN resource->>'kind' IN
|
|
17502
|
+
WHEN resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17406
17503
|
AND (
|
|
17407
17504
|
resource->'billingEndedAt' IS NULL
|
|
17408
17505
|
OR resource->'billingEndedAt' = 'null'::jsonb
|
|
@@ -17494,7 +17591,7 @@ export async function failPostgresSchedulerAttempt(
|
|
|
17494
17591
|
ELSE (
|
|
17495
17592
|
SELECT jsonb_agg(
|
|
17496
17593
|
CASE
|
|
17497
|
-
WHEN resource->>'kind' IN
|
|
17594
|
+
WHEN resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17498
17595
|
AND (
|
|
17499
17596
|
resource->'billingEndedAt' IS NULL
|
|
17500
17597
|
OR resource->'billingEndedAt' = 'null'::jsonb
|
|
@@ -17549,10 +17646,7 @@ export async function failPostgresSchedulerAttempt(
|
|
|
17549
17646
|
available_at
|
|
17550
17647
|
)
|
|
17551
17648
|
SELECT DISTINCT
|
|
17552
|
-
|
|
17553
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
17554
|
-
ELSE 'daytona'
|
|
17555
|
-
END,
|
|
17649
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
17556
17650
|
resource->>'sandboxId',
|
|
17557
17651
|
all_settled_resources.run_id,
|
|
17558
17652
|
all_settled_resources.attempt,
|
|
@@ -17561,10 +17655,7 @@ export async function failPostgresSchedulerAttempt(
|
|
|
17561
17655
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
17562
17656
|
'production'
|
|
17563
17657
|
),
|
|
17564
|
-
|
|
17565
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
17566
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
17567
|
-
END,
|
|
17658
|
+
${managedSandboxRoutingDomainSql('resource')},
|
|
17568
17659
|
CASE
|
|
17569
17660
|
WHEN resource->>'kind' = 'daytona_sandbox'
|
|
17570
17661
|
AND resource->>'sandboxId' = $10::jsonb ->> 'sandboxId'
|
|
@@ -17586,7 +17677,7 @@ export async function failPostgresSchedulerAttempt(
|
|
|
17586
17677
|
END
|
|
17587
17678
|
) AS resource
|
|
17588
17679
|
WHERE all_settled_resources.resource_json IS NOT NULL
|
|
17589
|
-
AND resource->>'kind' IN
|
|
17680
|
+
AND resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17590
17681
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
17591
17682
|
ON CONFLICT (provider, sandbox_id, routing_domain_key) DO UPDATE
|
|
17592
17683
|
SET diagnostic_json = COALESCE(
|
|
@@ -17630,7 +17721,7 @@ export async function failPostgresSchedulerAttempt(
|
|
|
17630
17721
|
) AS resource
|
|
17631
17722
|
WHERE resource->>'kind' IN ('compute_session', 'local_process')
|
|
17632
17723
|
OR (
|
|
17633
|
-
resource->>'kind' IN
|
|
17724
|
+
resource->>'kind' IN ${COMPUTE_BILLED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17634
17725
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
17635
17726
|
)
|
|
17636
17727
|
ON CONFLICT (run_id) DO NOTHING
|
|
@@ -17893,23 +17984,17 @@ export async function cancelPostgresSchedulerRun(
|
|
|
17893
17984
|
ELSE (
|
|
17894
17985
|
SELECT jsonb_agg(
|
|
17895
17986
|
CASE
|
|
17896
|
-
WHEN elem->>'kind' IN
|
|
17987
|
+
WHEN elem->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17897
17988
|
AND (elem->'billingEndedAt' IS NULL OR elem->'billingEndedAt' = 'null'::jsonb)
|
|
17898
17989
|
THEN elem || jsonb_build_object(
|
|
17899
17990
|
'billingEndedAt', COALESCE(
|
|
17900
17991
|
(
|
|
17901
17992
|
SELECT extract(epoch FROM cleanup.deleted_at) * 1000
|
|
17902
17993
|
FROM ${tableName('sandbox_cleanup_jobs_v2', options)} AS cleanup
|
|
17903
|
-
WHERE cleanup.provider =
|
|
17904
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
17905
|
-
ELSE 'daytona'
|
|
17906
|
-
END
|
|
17994
|
+
WHERE cleanup.provider = ${managedSandboxProviderSql("elem->>'kind'")}
|
|
17907
17995
|
AND cleanup.sandbox_id = elem->>'sandboxId'
|
|
17908
17996
|
AND cleanup.routing_domain_key = COALESCE(
|
|
17909
|
-
|
|
17910
|
-
WHEN 'modal_sandbox' THEN NULLIF(elem->>'modalAppId', '')
|
|
17911
|
-
ELSE NULLIF(elem->>'daytonaOrganizationId', '')
|
|
17912
|
-
END,
|
|
17997
|
+
${managedSandboxRoutingDomainSql('elem')},
|
|
17913
17998
|
''
|
|
17914
17999
|
)
|
|
17915
18000
|
AND cleanup.status = 'deleted'
|
|
@@ -17944,7 +18029,7 @@ export async function cancelPostgresSchedulerRun(
|
|
|
17944
18029
|
) AS resource
|
|
17945
18030
|
WHERE resource->>'kind' IN ('compute_session', 'local_process')
|
|
17946
18031
|
OR (
|
|
17947
|
-
resource->>'kind' IN
|
|
18032
|
+
resource->>'kind' IN ${COMPUTE_BILLED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17948
18033
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
17949
18034
|
)
|
|
17950
18035
|
ON CONFLICT (run_id) DO NOTHING
|
|
@@ -17954,10 +18039,7 @@ export async function cancelPostgresSchedulerRun(
|
|
|
17954
18039
|
provider, sandbox_id, run_id, attempt, environment, routing_domain
|
|
17955
18040
|
)
|
|
17956
18041
|
SELECT DISTINCT
|
|
17957
|
-
|
|
17958
|
-
WHEN 'modal_sandbox' THEN 'modal'
|
|
17959
|
-
ELSE 'daytona'
|
|
17960
|
-
END,
|
|
18042
|
+
${managedSandboxProviderSql("resource->>'kind'")},
|
|
17961
18043
|
resource->>'sandboxId',
|
|
17962
18044
|
attempt_resources.run_id,
|
|
17963
18045
|
attempt_resources.attempt,
|
|
@@ -17966,10 +18048,7 @@ export async function cancelPostgresSchedulerRun(
|
|
|
17966
18048
|
NULLIF(resource->>'daytonaEnvironment', ''),
|
|
17967
18049
|
'production'
|
|
17968
18050
|
),
|
|
17969
|
-
|
|
17970
|
-
WHEN 'modal_sandbox' THEN NULLIF(resource->>'modalAppId', '')
|
|
17971
|
-
ELSE NULLIF(resource->>'daytonaOrganizationId', '')
|
|
17972
|
-
END
|
|
18051
|
+
${managedSandboxRoutingDomainSql('resource')}
|
|
17973
18052
|
FROM ${tableName('attempts', options)} AS attempt_resources
|
|
17974
18053
|
CROSS JOIN LATERAL jsonb_array_elements(
|
|
17975
18054
|
CASE
|
|
@@ -17982,7 +18061,7 @@ export async function cancelPostgresSchedulerRun(
|
|
|
17982
18061
|
SELECT run_id FROM cancelled_run
|
|
17983
18062
|
)
|
|
17984
18063
|
AND attempt_resources.resource_json IS NOT NULL
|
|
17985
|
-
AND resource->>'kind' IN
|
|
18064
|
+
AND resource->>'kind' IN ${MANAGED_SANDBOX_RESOURCE_KIND_LIST_SQL}
|
|
17986
18065
|
AND NULLIF(resource->>'sandboxId', '') IS NOT NULL
|
|
17987
18066
|
ON CONFLICT (provider, sandbox_id, routing_domain_key) DO NOTHING
|
|
17988
18067
|
),
|
|
@@ -19320,6 +19399,9 @@ export function buildPostgresSchedulerRunnerContext(
|
|
|
19320
19399
|
runActor: playRunActor(launch.runtimeAuthority),
|
|
19321
19400
|
force: launch.force === true,
|
|
19322
19401
|
forceToolRefresh: launch.forceToolRefresh === true,
|
|
19402
|
+
...(typeof launch.cacheReuseWindowSeconds === 'number'
|
|
19403
|
+
? { cacheReuseWindowSeconds: launch.cacheReuseWindowSeconds }
|
|
19404
|
+
: {}),
|
|
19323
19405
|
...(asyncAncestryPlayIds?.length
|
|
19324
19406
|
? {
|
|
19325
19407
|
governance: {
|