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
|
@@ -340,6 +340,7 @@ import {
|
|
|
340
340
|
import {
|
|
341
341
|
CtxFetchHttpError,
|
|
342
342
|
LEGACY_PLAY_AUTHORING_CONTRACT_EDITION,
|
|
343
|
+
isToolConnectionName,
|
|
343
344
|
PLAY_AUTHORING_CONTRACT_EDITION,
|
|
344
345
|
normalizePlayAuthoringCustomerDbStatement,
|
|
345
346
|
validateOptionalPlayAuthoringField,
|
|
@@ -402,6 +403,7 @@ import {
|
|
|
402
403
|
isQueryResultDatasetTool,
|
|
403
404
|
} from './query-result-dataset';
|
|
404
405
|
import {
|
|
406
|
+
applyCacheReuseWindow,
|
|
405
407
|
isAlwaysFreshIntegrationTool,
|
|
406
408
|
isAlwaysFreshIntegrationWriteTool,
|
|
407
409
|
reusableWindowEligibility,
|
|
@@ -751,6 +753,14 @@ const authoredStepContext = new AsyncLocalStorage<{
|
|
|
751
753
|
invocationId?: string;
|
|
752
754
|
}>();
|
|
753
755
|
const toolExecutionOverrides = new AsyncLocalStorage<{ force: boolean }>();
|
|
756
|
+
const namedWorkspaceTool = new AsyncLocalStorage<{
|
|
757
|
+
toolId: string;
|
|
758
|
+
name: string;
|
|
759
|
+
id: string;
|
|
760
|
+
grantGeneration: number;
|
|
761
|
+
digest: string;
|
|
762
|
+
rateScope: { bucketId: string; token: string };
|
|
763
|
+
}>();
|
|
754
764
|
/**
|
|
755
765
|
* `ctx.runSteps` passes each `runIf` leg to `ctx.step` with a receipt gate
|
|
756
766
|
* keyed by the leg's body. Unless the run's checkpoint already holds the
|
|
@@ -3390,9 +3400,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
3390
3400
|
Promise<ResolvedPlayExecutor>
|
|
3391
3401
|
>();
|
|
3392
3402
|
readonly tools = {
|
|
3403
|
+
namedWorkspaceConnections: true,
|
|
3393
3404
|
execute: <TOutput = unknown>(request: {
|
|
3394
3405
|
id: string;
|
|
3395
3406
|
tool: string;
|
|
3407
|
+
connection?: string;
|
|
3396
3408
|
input: Record<string, unknown>;
|
|
3397
3409
|
description?: string;
|
|
3398
3410
|
force?: boolean;
|
|
@@ -3407,6 +3419,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
3407
3419
|
'ctx.tools.execute requires a request object: ctx.tools.execute({ id, tool, input, description }).',
|
|
3408
3420
|
);
|
|
3409
3421
|
}
|
|
3422
|
+
if (request.connection !== undefined) {
|
|
3423
|
+
const { connection, ...call } = request;
|
|
3424
|
+
return this.withNamedWorkspaceTool(call.tool, connection, () =>
|
|
3425
|
+
this.tools.execute<TOutput>(call),
|
|
3426
|
+
);
|
|
3427
|
+
}
|
|
3410
3428
|
validatePlayAuthoringField('ctx.tools.execute.id', request.id);
|
|
3411
3429
|
validatePlayAuthoringField('ctx.tools.execute.tool', request.tool);
|
|
3412
3430
|
validatePlayAuthoringField('ctx.tools.execute.input', request.input);
|
|
@@ -3886,7 +3904,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
3886
3904
|
options.getToolQueueHints,
|
|
3887
3905
|
options.getToolProvider,
|
|
3888
3906
|
),
|
|
3889
|
-
resolveRateScope:
|
|
3907
|
+
resolveRateScope: (toolId, provider) => {
|
|
3908
|
+
const named = namedWorkspaceTool.getStore();
|
|
3909
|
+
return named?.toolId === toolId
|
|
3910
|
+
? named.rateScope
|
|
3911
|
+
: (options.getToolRateScope?.(toolId, provider) ?? null);
|
|
3912
|
+
},
|
|
3890
3913
|
maxConcurrentExternalCalls: options.maxConcurrentExternalCalls,
|
|
3891
3914
|
maxConcurrentRows: options.maxConcurrentRows,
|
|
3892
3915
|
// A root run keeps depth 0 (its first child play is depth 1) but still
|
|
@@ -4390,6 +4413,33 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
4390
4413
|
return callOrder.id;
|
|
4391
4414
|
}
|
|
4392
4415
|
|
|
4416
|
+
/**
|
|
4417
|
+
* Whether the run's internal reuse window may lengthen this call's window.
|
|
4418
|
+
* The Play author never accepted reuse, so only a catalog read qualifies:
|
|
4419
|
+
* effect `read`, no invocation-scoped idempotency, no execution fence. A
|
|
4420
|
+
* write, send or purchase keeps its authored window, as does a tool whose
|
|
4421
|
+
* effect is unknown or whose metadata lookup fails.
|
|
4422
|
+
*/
|
|
4423
|
+
private async cacheReuseWindowAdmits(
|
|
4424
|
+
toolId: string,
|
|
4425
|
+
input: Record<string, unknown>,
|
|
4426
|
+
): Promise<boolean> {
|
|
4427
|
+
try {
|
|
4428
|
+
const [scope, retry, effect] = await Promise.all([
|
|
4429
|
+
this.#options.getToolIdempotencyScope?.(toolId),
|
|
4430
|
+
this.#options.getToolRetryPolicy?.(toolId, input),
|
|
4431
|
+
this.#options.getToolEffect?.(toolId),
|
|
4432
|
+
]);
|
|
4433
|
+
return (
|
|
4434
|
+
effect === 'read' &&
|
|
4435
|
+
scope !== 'invocation' &&
|
|
4436
|
+
retry?.requiresExecutionFence !== true
|
|
4437
|
+
);
|
|
4438
|
+
} catch {
|
|
4439
|
+
return false;
|
|
4440
|
+
}
|
|
4441
|
+
}
|
|
4442
|
+
|
|
4393
4443
|
/**
|
|
4394
4444
|
* A tool is a read on replay mismatch only when its metadata proves it: no
|
|
4395
4445
|
* invocation-scoped idempotency, no execution fence, not SQL, and either a
|
|
@@ -7355,6 +7405,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
7355
7405
|
private async resolveToolAuthScopeDigest(
|
|
7356
7406
|
toolId: string,
|
|
7357
7407
|
): Promise<string | null> {
|
|
7408
|
+
const named = namedWorkspaceTool.getStore();
|
|
7409
|
+
if (named?.toolId === toolId) return named.digest;
|
|
7358
7410
|
const configured = await this.#options.getToolAuthScopeDigest?.(toolId);
|
|
7359
7411
|
if (typeof configured === 'string' && configured.trim()) {
|
|
7360
7412
|
return configured.trim();
|
|
@@ -7366,6 +7418,73 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
7366
7418
|
this.#options.invalidateToolAuthScopeDigest?.(toolId);
|
|
7367
7419
|
}
|
|
7368
7420
|
|
|
7421
|
+
private async withNamedWorkspaceTool<T>(
|
|
7422
|
+
toolId: string,
|
|
7423
|
+
name: string,
|
|
7424
|
+
execute: () => Promise<T>,
|
|
7425
|
+
): Promise<T> {
|
|
7426
|
+
if (!isToolConnectionName(name)) {
|
|
7427
|
+
throw new Error('Choose a valid workspace connection name.');
|
|
7428
|
+
}
|
|
7429
|
+
if (
|
|
7430
|
+
rowContext.getStore() ||
|
|
7431
|
+
authoredStepContext.getStore() ||
|
|
7432
|
+
this.activeInlineComposition ||
|
|
7433
|
+
this.pureMapExecutionActive
|
|
7434
|
+
) {
|
|
7435
|
+
throw new Error(
|
|
7436
|
+
'Named workspace connections currently require a tool call in the Play entry function.',
|
|
7437
|
+
);
|
|
7438
|
+
}
|
|
7439
|
+
const { baseUrl, executorToken } = this.#options;
|
|
7440
|
+
if (!baseUrl || !executorToken)
|
|
7441
|
+
throw new Error(
|
|
7442
|
+
'Named workspace connections require a Deepline Play run.',
|
|
7443
|
+
);
|
|
7444
|
+
const path = `/api/v2/plays/runtime-tools/${encodeURIComponent(toolId)}/auth-scope`;
|
|
7445
|
+
const url = new URL(path, baseUrl);
|
|
7446
|
+
url.searchParams.set('connection', name);
|
|
7447
|
+
const response = await fetch(url, {
|
|
7448
|
+
headers: {
|
|
7449
|
+
Authorization: `Bearer ${executorToken}`,
|
|
7450
|
+
...(await this.vercelProtectionHeaders()),
|
|
7451
|
+
},
|
|
7452
|
+
redirect: 'error',
|
|
7453
|
+
signal: AbortSignal.timeout(15_000),
|
|
7454
|
+
});
|
|
7455
|
+
const result = await response.json().catch(() => null);
|
|
7456
|
+
const binding = result?.workspaceConnection;
|
|
7457
|
+
if (!response.ok)
|
|
7458
|
+
throw new Error(
|
|
7459
|
+
typeof result?.error === 'string'
|
|
7460
|
+
? result.error
|
|
7461
|
+
: 'Could not resolve the named workspace connection.',
|
|
7462
|
+
);
|
|
7463
|
+
if (
|
|
7464
|
+
binding?.name !== name ||
|
|
7465
|
+
typeof binding.id !== 'string' ||
|
|
7466
|
+
!Number.isSafeInteger(binding.grantGeneration) ||
|
|
7467
|
+
typeof result?.digest !== 'string' ||
|
|
7468
|
+
!result.digest ||
|
|
7469
|
+
typeof result?.rateScope?.bucketId !== 'string' ||
|
|
7470
|
+
typeof result.rateScope.token !== 'string'
|
|
7471
|
+
)
|
|
7472
|
+
throw new Error(
|
|
7473
|
+
'The runtime gateway did not confirm the named workspace connection.',
|
|
7474
|
+
);
|
|
7475
|
+
return namedWorkspaceTool.run(
|
|
7476
|
+
{
|
|
7477
|
+
toolId,
|
|
7478
|
+
name,
|
|
7479
|
+
id: binding.id,
|
|
7480
|
+
grantGeneration: binding.grantGeneration,
|
|
7481
|
+
digest: result.digest,
|
|
7482
|
+
rateScope: result.rateScope,
|
|
7483
|
+
},
|
|
7484
|
+
execute,
|
|
7485
|
+
);
|
|
7486
|
+
}
|
|
7487
|
+
|
|
7369
7488
|
#replayUnsafeMarker: Promise<void> | null = null;
|
|
7370
7489
|
|
|
7371
7490
|
/**
|
|
@@ -15103,14 +15222,44 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
15103
15222
|
'Call the Google Calendar booking tool directly in the admitted Play.',
|
|
15104
15223
|
);
|
|
15105
15224
|
}
|
|
15225
|
+
const refreshed =
|
|
15226
|
+
this.#options.cachePolicy?.forceToolRefresh === true ||
|
|
15227
|
+
toolExecutionOverrides.getStore()?.force === true;
|
|
15228
|
+
// The run's internal reuse window (`cacheReuseWindowSeconds`). A refresh
|
|
15229
|
+
// and an authored `force` still win over it.
|
|
15230
|
+
const reuseWindow =
|
|
15231
|
+
refreshed || options?.force === true
|
|
15232
|
+
? undefined
|
|
15233
|
+
: this.#options.cachePolicy?.cacheReuseWindowSeconds;
|
|
15106
15234
|
if (!this.usesExplicitFreshness) {
|
|
15107
15235
|
this.reuseCountSupported = false;
|
|
15108
|
-
|
|
15236
|
+
let legacyOptions = options;
|
|
15237
|
+
if (reuseWindow) {
|
|
15238
|
+
const eventWait = Boolean(
|
|
15239
|
+
await this.#options.getIntegrationEventWaitHandler?.(toolId),
|
|
15240
|
+
);
|
|
15241
|
+
const verdict = reusableWindowEligibility({
|
|
15242
|
+
kind: 'tool',
|
|
15243
|
+
toolId,
|
|
15244
|
+
input,
|
|
15245
|
+
eventWait,
|
|
15246
|
+
});
|
|
15247
|
+
if (
|
|
15248
|
+
!('message' in verdict) &&
|
|
15249
|
+
(await this.cacheReuseWindowAdmits(toolId, input))
|
|
15250
|
+
) {
|
|
15251
|
+
legacyOptions = {
|
|
15252
|
+
...options,
|
|
15253
|
+
staleAfterSeconds: applyCacheReuseWindow(
|
|
15254
|
+
options?.staleAfterSeconds,
|
|
15255
|
+
reuseWindow,
|
|
15256
|
+
),
|
|
15257
|
+
};
|
|
15258
|
+
}
|
|
15259
|
+
}
|
|
15260
|
+
return this.executeToolLegacyInternal(key, toolId, input, legacyOptions);
|
|
15109
15261
|
}
|
|
15110
15262
|
const policy = resolveExplicitDurableCallPolicy(options ?? {});
|
|
15111
|
-
const refreshed =
|
|
15112
|
-
this.#options.cachePolicy?.forceToolRefresh === true ||
|
|
15113
|
-
toolExecutionOverrides.getStore()?.force === true;
|
|
15114
15263
|
// A refresh of an authored reusable read still publishes its fresh result
|
|
15115
15264
|
// as the request's newest shared result. An authored 0 never does.
|
|
15116
15265
|
const refreshMayPublish =
|
|
@@ -15177,7 +15326,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
15177
15326
|
throw new Error(reuseVerdict.message);
|
|
15178
15327
|
}
|
|
15179
15328
|
const eventWait =
|
|
15180
|
-
policy.effective === 0 && !refreshMayPublish
|
|
15329
|
+
policy.effective === 0 && !refreshMayPublish && !reuseWindow
|
|
15181
15330
|
? null
|
|
15182
15331
|
: ((await this.#options.getIntegrationEventWaitHandler?.(toolId)) ??
|
|
15183
15332
|
null);
|
|
@@ -15195,6 +15344,13 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
15195
15344
|
throw new Error(effectiveVerdict.message);
|
|
15196
15345
|
}
|
|
15197
15346
|
const mustExecuteEveryTime = 'message' in effectiveVerdict;
|
|
15347
|
+
if (
|
|
15348
|
+
reuseWindow &&
|
|
15349
|
+
!mustExecuteEveryTime &&
|
|
15350
|
+
(await this.cacheReuseWindowAdmits(toolId, input))
|
|
15351
|
+
) {
|
|
15352
|
+
policy.effective = applyCacheReuseWindow(policy.effective, reuseWindow);
|
|
15353
|
+
}
|
|
15198
15354
|
// A refresh of a reusable call still publishes its fresh result as the
|
|
15199
15355
|
// request's newest shared result; an authored 0 never does.
|
|
15200
15356
|
const publishLatestOnRefresh = refreshMayPublish && !mustExecuteEveryTime;
|
|
@@ -16838,7 +16994,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
16838
16994
|
} catch (error) {
|
|
16839
16995
|
if (
|
|
16840
16996
|
!(error instanceof ToolExecuteAuthScopeChangedError) ||
|
|
16841
|
-
authScopeAttempt > 0
|
|
16997
|
+
authScopeAttempt > 0 ||
|
|
16998
|
+
namedWorkspaceTool.getStore() !== undefined
|
|
16842
16999
|
) {
|
|
16843
17000
|
throw error;
|
|
16844
17001
|
}
|
|
@@ -16974,7 +17131,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
16974
17131
|
// durable can still repeat the finalizer on a later attempt.
|
|
16975
17132
|
if (timeoutFinalizedAt === undefined && handler.onTimeout) {
|
|
16976
17133
|
try {
|
|
16977
|
-
await handler.onTimeout({
|
|
17134
|
+
const finalized = await handler.onTimeout({
|
|
16978
17135
|
payload: input,
|
|
16979
17136
|
context: eventContext,
|
|
16980
17137
|
boundary: {
|
|
@@ -16995,6 +17152,29 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
16995
17152
|
...(timeoutPolicy ? { timeoutPolicy } : {}),
|
|
16996
17153
|
},
|
|
16997
17154
|
});
|
|
17155
|
+
if (finalized && finalized.resolvedOutput) {
|
|
17156
|
+
// The provider owner arbitrates a reply racing the scheduler's
|
|
17157
|
+
// timeout. Persist its winning outcome before the Play consumes it.
|
|
17158
|
+
existing.output = finalized.resolvedOutput;
|
|
17159
|
+
this.checkpoint.resolvedBoundaries = {
|
|
17160
|
+
...(this.checkpoint.resolvedBoundaries ?? {}),
|
|
17161
|
+
[preparedBoundary.boundaryId]: {
|
|
17162
|
+
...existing,
|
|
17163
|
+
timeoutFinalizedAt: Date.now(),
|
|
17164
|
+
},
|
|
17165
|
+
};
|
|
17166
|
+
this.#options.onBatchComplete?.(this.checkpoint);
|
|
17167
|
+
return await this.wrapToolExecutionResult({
|
|
17168
|
+
toolId,
|
|
17169
|
+
status: 'completed',
|
|
17170
|
+
result: existing.output,
|
|
17171
|
+
toolResponse: { rawV2: existing.output, view: 'rawV2' },
|
|
17172
|
+
execution: toolExecutionMetadataForOutcome({
|
|
17173
|
+
kind: 'checkpoint',
|
|
17174
|
+
cacheKey: `integration_event:${preparedBoundary.boundaryId}`,
|
|
17175
|
+
}),
|
|
17176
|
+
});
|
|
17177
|
+
}
|
|
16998
17178
|
timeoutFinalizedAt = Date.now();
|
|
16999
17179
|
} catch (error) {
|
|
17000
17180
|
this.recordSlackHitlTimeoutFailure(error);
|
|
@@ -17051,6 +17231,27 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
17051
17231
|
this.runtimeLog(
|
|
17052
17232
|
`Integration event ${preparedBoundary.boundaryId}: recovered response from checkpoint`,
|
|
17053
17233
|
);
|
|
17234
|
+
const outputProjection =
|
|
17235
|
+
existing.outputProjection ?? preparedBoundary.outputProjection;
|
|
17236
|
+
const eventOutput = recordOrNull(existing.output);
|
|
17237
|
+
if (
|
|
17238
|
+
outputProjection === 'event_payload' &&
|
|
17239
|
+
eventOutput?.timed_out !== true &&
|
|
17240
|
+
eventOutput &&
|
|
17241
|
+
'event_payload' in eventOutput
|
|
17242
|
+
) {
|
|
17243
|
+
const providerOutput = recordOrNull(eventOutput.event_payload);
|
|
17244
|
+
if (!providerOutput)
|
|
17245
|
+
throw new Error(
|
|
17246
|
+
'The integration event has no provider reply payload.',
|
|
17247
|
+
);
|
|
17248
|
+
existing.output = providerOutput;
|
|
17249
|
+
this.checkpoint.resolvedBoundaries = {
|
|
17250
|
+
...(this.checkpoint.resolvedBoundaries ?? {}),
|
|
17251
|
+
[preparedBoundary.boundaryId]: { ...existing, outputProjection },
|
|
17252
|
+
};
|
|
17253
|
+
this.#options.onBatchComplete?.(this.checkpoint);
|
|
17254
|
+
}
|
|
17054
17255
|
// Wrapped like every other tool result (toolOutput.raw, getters) — the
|
|
17055
17256
|
// non-suspending runtimes (workers' synthetic wait interception) hand
|
|
17056
17257
|
// plays a wrapped ToolExecuteResult, so the resume replay must too.
|
|
@@ -17095,7 +17296,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
17095
17296
|
});
|
|
17096
17297
|
// An unanswered checkpoint suspends above without re-arming the provider.
|
|
17097
17298
|
// New boundaries receive one absolute expiry, persisted for later replays.
|
|
17098
|
-
const eventExpiresAtMs =
|
|
17299
|
+
const eventExpiresAtMs =
|
|
17300
|
+
boundary.eventExpiresAtMs ?? Date.now() + boundary.timeoutMs;
|
|
17099
17301
|
|
|
17100
17302
|
if (boundary.resolvedOutput) {
|
|
17101
17303
|
this.checkpoint.resolvedBoundaries = {
|
|
@@ -17108,6 +17310,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
17108
17310
|
provider: boundary.provider,
|
|
17109
17311
|
toolId: boundary.toolId,
|
|
17110
17312
|
output: boundary.resolvedOutput,
|
|
17313
|
+
...(boundary.outputProjection
|
|
17314
|
+
? { outputProjection: boundary.outputProjection }
|
|
17315
|
+
: {}),
|
|
17111
17316
|
...(boundary.timeoutPolicy
|
|
17112
17317
|
? { timeoutPolicy: boundary.timeoutPolicy }
|
|
17113
17318
|
: {}),
|
|
@@ -17157,6 +17362,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
17157
17362
|
eventExpiresAtMs,
|
|
17158
17363
|
provider: boundary.provider,
|
|
17159
17364
|
toolId: boundary.toolId,
|
|
17365
|
+
...(boundary.outputProjection
|
|
17366
|
+
? { outputProjection: boundary.outputProjection }
|
|
17367
|
+
: {}),
|
|
17160
17368
|
...(boundary.requestKey ? { requestKey: boundary.requestKey } : {}),
|
|
17161
17369
|
...(boundary.interactionId
|
|
17162
17370
|
? { interactionId: boundary.interactionId }
|
|
@@ -21550,6 +21758,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21550
21758
|
'executorToken and baseUrl are required for tool API calls (cloud execution only)',
|
|
21551
21759
|
);
|
|
21552
21760
|
}
|
|
21761
|
+
const selected = namedWorkspaceTool.getStore();
|
|
21762
|
+
const named = selected?.toolId === toolId ? selected : undefined;
|
|
21553
21763
|
const requestsDurableInvocationFence =
|
|
21554
21764
|
this.#options.requestDurableInvocationFence === true ||
|
|
21555
21765
|
this.#options.durableInvocationFence === true;
|
|
@@ -21605,8 +21815,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21605
21815
|
// Keep receipts, runner heartbeats, terminals, sheets, and runtime control
|
|
21606
21816
|
// on baseUrl (the receipt gateway). Only the potentially long-lived
|
|
21607
21817
|
// provider request may use the separately managed execution relay.
|
|
21608
|
-
const executionBaseUrl =
|
|
21609
|
-
|
|
21818
|
+
const executionBaseUrl = named
|
|
21819
|
+
? this.#options.baseUrl
|
|
21820
|
+
: this.#options.executionGatewayBaseUrl?.trim() || this.#options.baseUrl;
|
|
21610
21821
|
const toolErrorSchemaVersion = this.currentToolErrorSchemaVersion;
|
|
21611
21822
|
const providerNoProgressScope = stableDigest(
|
|
21612
21823
|
`${provider}\u0000${executionAuthScopeDigest ?? ''}`,
|
|
@@ -21794,6 +22005,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21794
22005
|
// support execute-fenced-v2 while ordinary provider calls continue
|
|
21795
22006
|
// through /execute with no durable-operation metadata at all.
|
|
21796
22007
|
const usesDurableInvocationFence =
|
|
22008
|
+
!named &&
|
|
21797
22009
|
requestsDurableInvocationFence &&
|
|
21798
22010
|
requiresExecutionFence &&
|
|
21799
22011
|
!uncachedAsyncLifecycleCall;
|
|
@@ -21832,7 +22044,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21832
22044
|
DURABLE_INVOCATION_FENCE_VERSION,
|
|
21833
22045
|
)
|
|
21834
22046
|
: 'execute';
|
|
21835
|
-
const
|
|
22047
|
+
const executePath = named
|
|
22048
|
+
? `/api/v2/tools/${encodeURIComponent(toolId)}/execute-with-connection`
|
|
22049
|
+
: integrationExecutePath(toolId, executeSuffix);
|
|
22050
|
+
const url = `${executionBaseUrl.replace(/\/$/, '')}${executePath}`;
|
|
21836
22051
|
const fixtureReplaySafe = this.#options.integrationMode === 'fixture';
|
|
21837
22052
|
const readOnlyQuery = isQueryResultDatasetReadRequest(
|
|
21838
22053
|
toolId,
|
|
@@ -22063,6 +22278,13 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
22063
22278
|
} | null = null;
|
|
22064
22279
|
const serializedRequestBody = (invocationAttempt: number) =>
|
|
22065
22280
|
JSON.stringify({
|
|
22281
|
+
...(named
|
|
22282
|
+
? {
|
|
22283
|
+
connection: named.name,
|
|
22284
|
+
connectionId: named.id,
|
|
22285
|
+
authorizationVersion: named.grantGeneration,
|
|
22286
|
+
}
|
|
22287
|
+
: {}),
|
|
22066
22288
|
payload: shouldResolveAsyncOperationInRuntime
|
|
22067
22289
|
? asyncOperationLaunchInput(asyncContract!, toolInputSnapshot)
|
|
22068
22290
|
: toolInputSnapshot,
|
|
@@ -23064,6 +23286,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
23064
23286
|
// actual receiver. Older gateways refuse this path
|
|
23065
23287
|
// before admission; direct app routes do not serve it.
|
|
23066
23288
|
dispatchedWithProviderPermit =
|
|
23289
|
+
!named &&
|
|
23067
23290
|
!providerPermitReceiverUnavailable &&
|
|
23068
23291
|
providerGatewayDispatchProof?.dispatchValidationSupported ===
|
|
23069
23292
|
true;
|
|
@@ -693,6 +693,8 @@ export type PlayExecutionEvent =
|
|
|
693
693
|
* than repeated — or invented — per row.
|
|
694
694
|
*/
|
|
695
695
|
bornFrom?: PlayDatasetBornFrom;
|
|
696
|
+
/** Stored column names in the order the run wrote them (row keys, then withColumns). Absent from older runs. */
|
|
697
|
+
columns?: string[];
|
|
696
698
|
at: number;
|
|
697
699
|
}
|
|
698
700
|
| {
|
|
@@ -806,6 +808,8 @@ export type IntegrationEventWaitBoundary = {
|
|
|
806
808
|
boundaryId: string;
|
|
807
809
|
eventKey: string;
|
|
808
810
|
timeoutMs: number;
|
|
811
|
+
/** Owner's absolute deadline; old providers may omit it. */
|
|
812
|
+
eventExpiresAtMs?: number;
|
|
809
813
|
provider: string;
|
|
810
814
|
toolId: string;
|
|
811
815
|
messageRef?: {
|
|
@@ -817,6 +821,8 @@ export type IntegrationEventWaitBoundary = {
|
|
|
817
821
|
interactionId?: string;
|
|
818
822
|
/** A previously completed identical request can resolve without parking. */
|
|
819
823
|
resolvedOutput?: Record<string, unknown>;
|
|
824
|
+
/** Absent preserves the historical scheduler event envelope. */
|
|
825
|
+
outputProjection?: 'event_payload';
|
|
820
826
|
/**
|
|
821
827
|
* Optional control-plane timeout behavior. Missing preserves the legacy
|
|
822
828
|
* "return the timed_out result" replay behavior for older app deployments.
|
|
@@ -856,7 +862,7 @@ export type IntegrationEventWaitHandler = {
|
|
|
856
862
|
payload: Record<string, unknown>;
|
|
857
863
|
context: IntegrationEventWaitRuntimeContext;
|
|
858
864
|
boundary: IntegrationEventWaitBoundary;
|
|
859
|
-
}) => Promise<void>;
|
|
865
|
+
}) => Promise<void | { resolvedOutput: Record<string, unknown> }>;
|
|
860
866
|
/**
|
|
861
867
|
* When set, timeout finalization is side-effect-only: the Play stays parked
|
|
862
868
|
* instead of consuming a `timed_out` result.
|
|
@@ -973,11 +979,16 @@ export interface ContextOptions {
|
|
|
973
979
|
* runs; a resumed attempt of the current run reuses its completed receipts.
|
|
974
980
|
* forceFailedToolRefresh reclaims only failed receipts, preserving completed
|
|
975
981
|
* provider-call idempotency while allowing forced repair runs to make progress.
|
|
982
|
+
* cacheReuseWindowSeconds (internal, `play_run.cache_reuse_window`) lets each
|
|
983
|
+
* tool call that `reusableWindowEligibility` allows reuse completed results
|
|
984
|
+
* up to this many seconds old, an authored 0 included. forceToolRefresh and
|
|
985
|
+
* an authored `force` win over it.
|
|
976
986
|
*/
|
|
977
987
|
cachePolicy?: {
|
|
978
988
|
forceStepRefresh?: boolean;
|
|
979
989
|
forceToolRefresh?: boolean;
|
|
980
990
|
forceFailedToolRefresh?: boolean;
|
|
991
|
+
cacheReuseWindowSeconds?: number;
|
|
981
992
|
};
|
|
982
993
|
/** Called after each durable batch completes for scheduler checkpointing. */
|
|
983
994
|
onBatchComplete?: (checkpoint: PlayCheckpoint) => void;
|
|
@@ -1164,6 +1175,13 @@ export interface ContextOptions {
|
|
|
1164
1175
|
getToolReusableResultSupport?: (
|
|
1165
1176
|
toolId: string,
|
|
1166
1177
|
) => Promise<{ supported: boolean; unavailableReason: string | null }>;
|
|
1178
|
+
/**
|
|
1179
|
+
* What one call can change, from the catalog. Null when the metadata
|
|
1180
|
+
* predates the field: callers treat that as a write.
|
|
1181
|
+
*/
|
|
1182
|
+
getToolEffect?: (
|
|
1183
|
+
toolId: string,
|
|
1184
|
+
) => Promise<'read' | 'write' | 'destructive' | null>;
|
|
1167
1185
|
getToolRetryPolicy?: (
|
|
1168
1186
|
toolId: string,
|
|
1169
1187
|
input: Record<string, unknown>,
|
|
@@ -1449,6 +1467,7 @@ export interface PlayCheckpoint {
|
|
|
1449
1467
|
* Missing fields preserve legacy checkpoint replay behavior.
|
|
1450
1468
|
*/
|
|
1451
1469
|
timeoutPolicy?: IntegrationEventWaitBoundary['timeoutPolicy'];
|
|
1470
|
+
outputProjection?: IntegrationEventWaitBoundary['outputProjection'];
|
|
1452
1471
|
output?: unknown;
|
|
1453
1472
|
completedAt?: number;
|
|
1454
1473
|
/** Timestamp of the successful provider timeout finalizer, if any. */
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { createRateLimitedRuntimeLogger } from '../observability/runtime-console';
|
|
2
|
+
import {
|
|
3
|
+
startFleetSandboxSweepTimers,
|
|
4
|
+
type FleetSandboxSweepAdapter,
|
|
5
|
+
} from './/fleet-sandbox-sweep';
|
|
2
6
|
import { withRuntimeSchedulerClient } from './/scheduler-backends/postgres-pool';
|
|
3
7
|
import { RUNTIME_CAPACITY_POLICY } from './/runtime-capacity-policy';
|
|
4
8
|
import { isIsolatedRuntimeSchedulerSchema } from './/runtime-scheduler-topology';
|
|
@@ -20,41 +24,43 @@ export type DaytonaSandboxJanitorOptions = {
|
|
|
20
24
|
};
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
|
-
*
|
|
27
|
+
* The Daytona Adapter for the Fleet Sandbox Sweep, or null when this process
|
|
28
|
+
* must not sweep Daytona.
|
|
24
29
|
*
|
|
25
30
|
* Sandboxes have a source-scoped label shared by production, previews, and
|
|
26
31
|
* worktrees. An isolated schema cannot authoritatively distinguish its own
|
|
27
32
|
* sandboxes from the others, so it must never sweep. The fixed runtime
|
|
28
|
-
* controller is the one production owner;
|
|
33
|
+
* controller is the one production owner; keeping it there makes the Daytona
|
|
29
34
|
* list/read traffic constant with fleet size.
|
|
35
|
+
*
|
|
36
|
+
* Enumeration is the Daytona label list; termination restores the durable
|
|
37
|
+
* Sandbox Cleanup obligation through the exact operation ledger
|
|
38
|
+
* (`reapOrphanDaytonaSandboxes`), never an unledgered provider delete.
|
|
30
39
|
*/
|
|
31
|
-
export function
|
|
40
|
+
export function createDaytonaFleetSandboxSweepAdapter(
|
|
32
41
|
options: DaytonaSandboxJanitorOptions,
|
|
33
|
-
):
|
|
42
|
+
): FleetSandboxSweepAdapter | null {
|
|
34
43
|
if (!process.env.DAYTONA_API_KEY?.trim()) {
|
|
35
44
|
console.info('[daytona-janitor.controller] disabled (no DAYTONA_API_KEY)');
|
|
36
|
-
return
|
|
45
|
+
return null;
|
|
37
46
|
}
|
|
38
47
|
if (isIsolatedRuntimeSchedulerSchema(options.schema)) {
|
|
39
48
|
console.info('[daytona-janitor.controller] disabled (isolated schema)', {
|
|
40
49
|
schema: options.schema,
|
|
41
50
|
});
|
|
42
|
-
return
|
|
51
|
+
return null;
|
|
43
52
|
}
|
|
44
53
|
|
|
45
|
-
let running = false;
|
|
46
54
|
// Spans passes, so it cannot live in the per-pass reaper.
|
|
47
55
|
const reportStaleList = createRateLimitedRuntimeLogger({
|
|
48
56
|
log: (...args) => console.warn(...args),
|
|
49
57
|
intervalMs: DAYTONA_STALE_LIST_ALERT_INTERVAL_MS,
|
|
50
58
|
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
running = true;
|
|
57
|
-
try {
|
|
59
|
+
return {
|
|
60
|
+
provider: 'daytona',
|
|
61
|
+
scope: 'provider_inventory',
|
|
62
|
+
intervalMs: DAYTONA_JANITOR_INTERVAL_MS,
|
|
63
|
+
async runPass() {
|
|
58
64
|
const [
|
|
59
65
|
{ listDaytonaControlSandboxes },
|
|
60
66
|
{ loadDaytonaRequiredConfig },
|
|
@@ -94,31 +100,34 @@ export function startDaytonaSandboxJanitor(
|
|
|
94
100
|
}),
|
|
95
101
|
options: { reportStaleList },
|
|
96
102
|
});
|
|
97
|
-
}
|
|
103
|
+
},
|
|
104
|
+
reportPassFailure(error) {
|
|
98
105
|
// This is a best-effort resource backstop. A failed sweep must never
|
|
99
106
|
// terminate the controller that scales and recovers customer work.
|
|
100
107
|
console.warn('[daytona-janitor.controller] pass failed', {
|
|
101
108
|
error: error instanceof Error ? error.message : String(error),
|
|
102
109
|
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
110
|
+
},
|
|
111
|
+
reportOverlap() {
|
|
112
|
+
console.info('[daytona-janitor.controller] skip (previous pass running)');
|
|
113
|
+
},
|
|
106
114
|
};
|
|
115
|
+
}
|
|
107
116
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Start the production-only Daytona orphan sweep on the Fleet Sandbox Sweep's
|
|
119
|
+
* timer-driven owner: one pass now, then one every
|
|
120
|
+
* `DAYTONA_JANITOR_INTERVAL_MS`.
|
|
121
|
+
*/
|
|
122
|
+
export function startDaytonaSandboxJanitor(
|
|
123
|
+
options: DaytonaSandboxJanitorOptions,
|
|
124
|
+
): { stop: () => void } {
|
|
125
|
+
const adapter = createDaytonaFleetSandboxSweepAdapter(options);
|
|
126
|
+
if (!adapter) return { stop: () => undefined };
|
|
127
|
+
const { stop } = startFleetSandboxSweepTimers({ adapters: [adapter] });
|
|
116
128
|
console.info('[daytona-janitor.controller] scheduled', {
|
|
117
129
|
intervalMs: DAYTONA_JANITOR_INTERVAL_MS,
|
|
118
130
|
schema: options.schema,
|
|
119
131
|
});
|
|
120
|
-
|
|
121
|
-
return {
|
|
122
|
-
stop: () => clearInterval(interval),
|
|
123
|
-
};
|
|
132
|
+
return { stop };
|
|
124
133
|
}
|
|
@@ -2,6 +2,10 @@ import { sha256Hex } from '../plays/row-identity';
|
|
|
2
2
|
import { readProvenanceTag } from './log-provenance';
|
|
3
3
|
import type { PlayRunFailureDetails } from './run-failure';
|
|
4
4
|
import { emitPlayTelemetry } from './runtime-telemetry';
|
|
5
|
+
import {
|
|
6
|
+
isRuntimeSandboxProviderId,
|
|
7
|
+
type RuntimeSandboxProviderId,
|
|
8
|
+
} from './runtime-sandbox-provider-profile';
|
|
5
9
|
import {
|
|
6
10
|
TOOL_CALL_ERROR_ORIGINS,
|
|
7
11
|
TOOL_CALL_NETWORK_KINDS,
|
|
@@ -574,10 +578,31 @@ export function playRunFailureDetailsOf(
|
|
|
574
578
|
return typeof code === 'string' ? (first as PlayRunFailureDetails) : null;
|
|
575
579
|
}
|
|
576
580
|
|
|
581
|
+
/**
|
|
582
|
+
* The sandbox provider a runner result proves it ran on (`stats.sandboxProvider`,
|
|
583
|
+
* set by the runner backend that created the sandbox), or null when the
|
|
584
|
+
* result carries none: a failure before any sandbox, or an older runner.
|
|
585
|
+
*/
|
|
586
|
+
export function sandboxProviderOfRunnerResult(
|
|
587
|
+
result: unknown,
|
|
588
|
+
): RuntimeSandboxProviderId | null {
|
|
589
|
+
if (!result || typeof result !== 'object') return null;
|
|
590
|
+
const stats = (result as { stats?: unknown }).stats;
|
|
591
|
+
if (!stats || typeof stats !== 'object') return null;
|
|
592
|
+
const provider = (stats as { sandboxProvider?: unknown }).sandboxProvider;
|
|
593
|
+
return isRuntimeSandboxProviderId(provider) ? provider : null;
|
|
594
|
+
}
|
|
595
|
+
|
|
577
596
|
/**
|
|
578
597
|
* One line per run that reached a terminal state: `play.run.finished`.
|
|
579
598
|
* Emitted by the process that committed the terminal transition, after it
|
|
580
599
|
* committed, so a run is reported once.
|
|
600
|
+
*
|
|
601
|
+
* `runtimeBackend` is the run's logical lane (its placement policy's
|
|
602
|
+
* compatibility backend), not where it ran: `daytona_modal_canary@1` and
|
|
603
|
+
* `modal_then_daytona@1` are Daytona-lane policies whose runs mostly execute
|
|
604
|
+
* on Modal. `sandboxProvider` is the provider the run's sandbox was actually
|
|
605
|
+
* created on, from the runner's own proof, or null when there is none.
|
|
581
606
|
*/
|
|
582
607
|
export function emitPlayRunFinished(input: {
|
|
583
608
|
orgId: string | null;
|
|
@@ -587,6 +612,7 @@ export function emitPlayRunFinished(input: {
|
|
|
587
612
|
outcome: PlayRunOutcome;
|
|
588
613
|
failure: PlayRunFailureDetails | null;
|
|
589
614
|
runtimeBackend: string | null;
|
|
615
|
+
sandboxProvider: RuntimeSandboxProviderId | null;
|
|
590
616
|
triggerSource: string | null;
|
|
591
617
|
/** Where the terminal was committed. */
|
|
592
618
|
committedBy: 'worker' | 'gateway';
|
|
@@ -610,6 +636,9 @@ export function emitPlayRunFinished(input: {
|
|
|
610
636
|
failureCategory: oneOf(failure?.category, TOOL_CATEGORIES),
|
|
611
637
|
failureName: token(failure?.name, CLASS_NAME),
|
|
612
638
|
runtimeBackend: token(input.runtimeBackend, TOKEN),
|
|
639
|
+
sandboxProvider: isRuntimeSandboxProviderId(input.sandboxProvider)
|
|
640
|
+
? input.sandboxProvider
|
|
641
|
+
: null,
|
|
613
642
|
triggerSource: token(input.triggerSource, TOKEN),
|
|
614
643
|
committedBy: input.committedBy,
|
|
615
644
|
},
|