deepline 0.3.551 → 0.3.553
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 +130 -12
- package/dist/bundling-sources/sdk/src/compat.ts +239 -87
- package/dist/bundling-sources/sdk/src/config.ts +113 -2
- package/dist/bundling-sources/sdk/src/errors.ts +2 -0
- package/dist/bundling-sources/sdk/src/http-core.ts +124 -10
- package/dist/bundling-sources/sdk/src/index.ts +2 -0
- package/dist/bundling-sources/sdk/src/integrations.ts +6 -4
- package/dist/bundling-sources/sdk/src/play.ts +3 -0
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +1 -1
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +66 -30
- package/dist/bundling-sources/sdk/src/tool-calls.ts +2 -1
- package/dist/bundling-sources/sdk/src/tool-failure-hint.ts +104 -0
- package/dist/bundling-sources/sdk/src/types.ts +9 -1
- package/dist/bundling-sources/shared_libs/integration-contracts/billing-entitlements.ts +4 -2
- package/dist/bundling-sources/shared_libs/integration-contracts/billing-plan-skus.ts +25 -0
- package/dist/bundling-sources/shared_libs/monitors/action-actor.ts +2 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/credit-recovery.ts +58 -4
- package/dist/bundling-sources/shared_libs/monitors/billing/policy-builders.ts +8 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/pricing.ts +11 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/types.ts +13 -0
- package/dist/bundling-sources/shared_libs/monitors/deactivation-reasons.ts +103 -5
- package/dist/bundling-sources/shared_libs/monitors/fleets/converge-admission.ts +133 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/fence-attention.ts +165 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/fence-release.ts +726 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/fence-walk.ts +274 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/issues.ts +1 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +28 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/provider-bulk-wait.ts +126 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/shared-payload.ts +189 -0
- package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +28 -0
- package/dist/bundling-sources/shared_libs/monitors/inbound-publish-key.ts +4 -0
- package/dist/bundling-sources/shared_libs/monitors/inventory-counter-errors.ts +25 -0
- package/dist/bundling-sources/shared_libs/monitors/org-monitor-limits.ts +65 -0
- package/dist/bundling-sources/shared_libs/monitors/package.json +11 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +152 -1
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +6 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts +390 -10
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts +34 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +66 -30
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-state.ts +30 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +80 -13
- package/dist/bundling-sources/shared_libs/monitors/provider-resource-failure.ts +26 -3
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +41 -13
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/raw-receipt-causes.ts +219 -0
- package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +21 -10
- package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +13 -0
- package/dist/bundling-sources/shared_libs/monitors/tamradar-countries.ts +285 -0
- package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +6 -0
- package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +13 -0
- package/dist/bundling-sources/shared_libs/observability/dlq.ts +1 -1
- package/dist/bundling-sources/shared_libs/observability/log-metadata.ts +5 -3
- package/dist/bundling-sources/shared_libs/observability/queue-health.ts +10 -1
- package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
- package/dist/bundling-sources/shared_libs/observability/redaction.ts +24 -1
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +312 -41
- package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +1 -2
- package/dist/bundling-sources/shared_libs/play-data-plane/preview-r2-oidc.ts +188 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +170 -16
- package/dist/bundling-sources/shared_libs/play-data-plane/runtime-sheet-storage-contract.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +68 -2
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +568 -26
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-fetch-caller-deadline.ts +200 -0
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-topology.ts +21 -1
- package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +3 -2
- package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +14 -2
- package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +70 -2
- package/dist/bundling-sources/shared_libs/play-runtime/durable-tool-identity.ts +3 -3
- package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +16 -0
- package/dist/bundling-sources/shared_libs/play-runtime/experiment-switches.ts +92 -16
- package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +7 -1
- package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +62 -0
- package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +74 -3
- package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +31 -3
- package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +8 -0
- package/dist/bundling-sources/shared_libs/play-runtime/query-result-dataset.ts +19 -0
- package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +39 -2
- package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +9 -1
- package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +33 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +24 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +300 -57
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +87 -6
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +241 -10
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox-egress.ts +161 -14
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +16 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-compression.ts +37 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +298 -46
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +13 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +39 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +62 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-speed-profile.ts +206 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +42 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +185 -64
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-slot-ledger.ts +157 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +110 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-listener-hint.ts +323 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/executor-attempt-standing.ts +72 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/integration-operation-value-storage.ts +23 -4
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +32 -10
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-workspace-purge.ts +199 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +632 -66
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +517 -16
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-value-storage.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +599 -2
- package/dist/bundling-sources/shared_libs/play-runtime/secret-resolution-retry-policy.ts +26 -1
- package/dist/bundling-sources/shared_libs/play-runtime/startup-read-tool-ids.ts +60 -0
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +51 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call-retry-facts.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +113 -3
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +5 -7
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +37 -7
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +3 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +40 -5
- package/dist/bundling-sources/shared_libs/plays/deploy/api-client.ts +3 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/control-plane-types.ts +16 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/run-deployment.ts +10 -41
- package/dist/bundling-sources/shared_libs/plays/extension-bridge.ts +33 -0
- package/dist/bundling-sources/shared_libs/plays/row-identity.ts +18 -1
- package/dist/bundling-sources/shared_libs/plays/tool-execution-error.ts +108 -0
- package/dist/bundling-sources/shared_libs/plays/trigger-config-contract.ts +14 -0
- package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +171 -0
- package/dist/bundling-sources/shared_libs/product-notifications/events.ts +27 -1
- package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +9 -24
- package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +178 -5
- package/dist/bundling-sources/shared_libs/security/signup-email-dns-screen.ts +148 -0
- package/dist/bundling-sources/shared_libs/tool-execution-error.ts +108 -0
- package/dist/cli/{auth-E7BH4GMJ.mjs → auth-I3QAU4RV.mjs} +8 -7
- package/dist/cli/auth-MQCN7WGZ.js +44 -0
- package/dist/cli/{billing-OXKU462W.mjs → billing-3IC54OQQ.mjs} +202 -59
- package/dist/cli/{billing-DNQAZGX7.js → billing-YGFFVAIC.js} +302 -159
- package/dist/cli/{chunk-COGREZAO.js → chunk-2B5B5KAW.js} +210 -128
- package/dist/cli/{chunk-UBKA33KY.mjs → chunk-2MGZAI54.mjs} +17 -0
- package/dist/cli/{chunk-T2B5BVZE.js → chunk-3NTP2OSG.js} +13 -13
- package/dist/cli/{chunk-FOTGUFVK.mjs → chunk-45OAVGU6.mjs} +5 -5
- package/dist/cli/{chunk-54EEYLTF.js → chunk-4747TPLV.js} +3 -3
- package/dist/cli/{chunk-CLRAANWH.mjs → chunk-4BFTDNHU.mjs} +1 -1
- package/dist/cli/{chunk-BGBJV26E.mjs → chunk-4HYNMXXF.mjs} +4 -4
- package/dist/cli/{chunk-5S6PHKRV.mjs → chunk-4SMCFQ23.mjs} +1 -1
- package/dist/cli/{chunk-VWLHRZFG.mjs → chunk-55F6HNOY.mjs} +5 -5
- package/dist/cli/{chunk-LX35AXTN.mjs → chunk-5TYLSS4Q.mjs} +6 -6
- package/dist/cli/{chunk-VTGG2RT3.js → chunk-6NE3RRRY.js} +1 -1
- package/dist/cli/{chunk-EITMD3A5.js → chunk-6VLFQZK6.js} +8 -8
- package/dist/cli/{chunk-MNSTCJMX.mjs → chunk-72V4PDH5.mjs} +18 -18
- package/dist/cli/{chunk-ZCDKE4UH.js → chunk-74RES4DS.js} +5 -5
- package/dist/cli/{chunk-WKBHUB6R.js → chunk-7GEMELKI.js} +366 -320
- package/dist/cli/{chunk-C4CUZH57.js → chunk-7O6J6A7P.js} +1871 -92
- package/dist/cli/{chunk-7RSIFA72.js → chunk-7SERLBNR.js} +161 -53
- package/dist/cli/{chunk-3G6QZACZ.js → chunk-7YRJ5UC4.js} +21 -21
- package/dist/cli/{chunk-I4VKGNAQ.mjs → chunk-A7DLBE5K.mjs} +136 -54
- package/dist/cli/{chunk-GGB3JYCW.mjs → chunk-AGICYWGN.mjs} +299 -69
- package/dist/cli/{chunk-44KSACJW.mjs → chunk-AGIQDA2T.mjs} +12 -12
- package/dist/cli/{chunk-PACD5DGC.js → chunk-AGLR6QVN.js} +255 -109
- package/dist/cli/{chunk-NURW5XH4.mjs → chunk-ASB47RXJ.mjs} +1 -1
- package/dist/cli/{chunk-4OMAGJ6U.js → chunk-BVDKFS2T.js} +2 -2
- package/dist/cli/{chunk-LPJPCGT3.js → chunk-CACFJODG.js} +190 -134
- package/dist/cli/{chunk-GVYLCCKN.mjs → chunk-CAEBJOYU.mjs} +1 -1
- package/dist/cli/{chunk-XDVT3GOM.js → chunk-CFJFUVX2.js} +18 -1
- package/dist/cli/{chunk-POLUE7D5.js → chunk-DP2VH7CO.js} +12 -12
- package/dist/cli/{chunk-D6M5HFBB.mjs → chunk-DP64MD6U.mjs} +1 -1
- package/dist/cli/{chunk-W425ERWN.mjs → chunk-DZA7RFGL.mjs} +5 -5
- package/dist/cli/{chunk-R7J7CJPZ.js → chunk-E2G2DNAB.js} +4 -1
- package/dist/cli/{chunk-GGGAEVCX.mjs → chunk-E7WZOX2A.mjs} +22 -18
- package/dist/cli/{chunk-44I675YK.js → chunk-FM7LPUPA.js} +41 -41
- package/dist/cli/{chunk-2UXDHFSF.mjs → chunk-GAVZ4EOD.mjs} +1 -1
- package/dist/cli/{chunk-Z2FIOG3V.js → chunk-HEBO3XNZ.js} +27 -31
- package/dist/cli/{chunk-6PWJKMFQ.mjs → chunk-HSJ6X2AQ.mjs} +4 -4
- package/dist/cli/{chunk-UPMRIVZB.js → chunk-HVI55MTK.js} +61 -10
- package/dist/cli/{chunk-KWSH5T7K.js → chunk-IH6GDNKW.js} +21 -21
- package/dist/cli/{chunk-3KYBDAR3.js → chunk-IMX7J4DU.js} +8 -8
- package/dist/cli/{chunk-HEHVGEZV.mjs → chunk-INEMTYMT.mjs} +8 -8
- package/dist/cli/{chunk-5VVSEU67.js → chunk-IUOGII7D.js} +6 -7
- package/dist/cli/{chunk-MXGA6JFI.mjs → chunk-JJGWHITQ.mjs} +5 -5
- package/dist/cli/{chunk-QM6Y6S4E.js → chunk-JLGP5XAJ.js} +5 -5
- package/dist/cli/{chunk-V6SCP4B7.mjs → chunk-LFOERUQY.mjs} +69 -3
- package/dist/cli/{chunk-BBTKAASQ.js → chunk-LFQJW4S2.js} +42 -1
- package/dist/cli/{chunk-ZMNGZ6XS.mjs → chunk-LH5PZKER.mjs} +80 -24
- package/dist/cli/{chunk-MR5LTVHD.js → chunk-LRDHPOZW.js} +69 -69
- package/dist/cli/{chunk-5LUF4LAR.mjs → chunk-LRZGS6RZ.mjs} +3 -0
- package/dist/cli/{chunk-SL6MYJYM.js → chunk-MJTVX4QK.js} +35 -35
- package/dist/cli/{chunk-UDXULACQ.js → chunk-MLABYI4M.js} +90 -24
- package/dist/cli/{chunk-S7IZWGUA.mjs → chunk-NDNHYONK.mjs} +17 -21
- package/dist/cli/{chunk-4D3WIZST.mjs → chunk-OTV2UUKW.mjs} +164 -18
- package/dist/cli/{chunk-XYE5XPGF.js → chunk-Q6Z6N3A7.js} +18 -18
- package/dist/cli/{chunk-7WQNWJQW.mjs → chunk-QG6JIWUL.mjs} +151 -43
- package/dist/cli/{chunk-3T65J5RG.mjs → chunk-QI5S5HWB.mjs} +2 -2
- package/dist/cli/{chunk-CBV7AKWM.js → chunk-R6DZ6NQ2.js} +5 -5
- package/dist/cli/{chunk-PM7MO62Y.mjs → chunk-RMNOZKRI.mjs} +3 -3
- package/dist/cli/{chunk-NMWGZD6Y.js → chunk-RTV4RF7N.js} +36 -36
- package/dist/cli/{chunk-CQ6JYQSW.js → chunk-SBH4CKPN.js} +11 -11
- package/dist/cli/{chunk-BIIJATTX.mjs → chunk-SG3LUONJ.mjs} +3 -3
- package/dist/cli/{chunk-2WFPHBR4.js → chunk-TFEXSHPM.js} +22 -18
- package/dist/cli/{chunk-5IL7SC45.mjs → chunk-TN4TY6TT.mjs} +6 -7
- package/dist/cli/{chunk-WEHCBH5R.mjs → chunk-UEVKMZLR.mjs} +54 -3
- package/dist/cli/{chunk-RE5MJBEV.mjs → chunk-UVQJYV76.mjs} +2 -2
- package/dist/cli/{chunk-FSIVF2SI.mjs → chunk-VZGLIK5U.mjs} +1 -1
- package/dist/cli/{chunk-W2ZWQUHT.js → chunk-WOCHZCUJ.js} +2 -2
- package/dist/cli/{chunk-ZDQFBJPO.js → chunk-XLIHTJVM.js} +348 -118
- package/dist/cli/{chunk-2ZYRBMQM.js → chunk-Y6SP3JMI.js} +22 -22
- package/dist/cli/{chunk-PPSDCN6C.js → chunk-YUA6HA6D.js} +2 -2
- package/dist/cli/{chunk-JL2OTMSG.mjs → chunk-Z3A2S3QM.mjs} +41 -0
- package/dist/cli/{chunk-E64HFB4L.mjs → chunk-Z6XPSHKM.mjs} +87 -41
- package/dist/cli/{chunk-7DOQ3OEX.mjs → chunk-Z7AOIHFE.mjs} +1870 -91
- package/dist/cli/command-docs.js +3 -3
- package/dist/cli/command-docs.mjs +2 -2
- package/dist/cli/concurrent-runs-help-CFJH4KXV.js +22 -0
- package/dist/cli/{concurrent-runs-help-C6L6I5OR.mjs → concurrent-runs-help-DNV2X5AZ.mjs} +9 -8
- package/dist/cli/{csv-QMF4FWE7.js → csv-SA6ELJY6.js} +16 -15
- package/dist/cli/{csv-SYSDXFEM.mjs → csv-ZXZGHWOM.mjs} +7 -6
- package/dist/cli/{db-Q7HURWRZ.mjs → db-A54SP6AD.mjs} +16 -16
- package/dist/cli/{db-YSHPPA4H.js → db-JHFEIQBU.js} +43 -43
- package/dist/cli/describe-PHQ33AGS.mjs +50 -0
- package/dist/cli/describe-RHJ4XRFI.js +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 +6 -6
- package/dist/cli/describe-core.mjs +5 -5
- package/dist/cli/{executions-G7U3VUXN.mjs → executions-HL2M2DFU.mjs} +10 -10
- package/dist/cli/{executions-MWBC5TAW.js → executions-TLFZRHBJ.js} +12 -12
- package/dist/cli/{feedback-SD55OY6H.js → feedback-5UEX5UZK.js} +17 -16
- package/dist/cli/{feedback-GMHIFLBJ.mjs → feedback-QMBTNXVG.mjs} +9 -8
- package/dist/cli/git-4JWOOHBG.js +26 -0
- package/dist/cli/{git-HPE45OPD.mjs → git-LKGXVIVC.mjs} +8 -7
- package/dist/cli/index.js +170 -158
- package/dist/cli/index.mjs +60 -48
- package/dist/cli/{integrations-HFKVBY6G.js → integrations-6RUTLMN7.js} +23 -27
- package/dist/cli/{integrations-2W4MGIQR.mjs → integrations-FGGRVUJ7.mjs} +15 -19
- package/dist/cli/{legacy-noops-SXVNDEXN.js → legacy-noops-J3Z7QRWZ.js} +12 -11
- package/dist/cli/{legacy-noops-GZYKNU2Z.mjs → legacy-noops-YIPRMVXZ.mjs} +9 -8
- package/dist/cli/{mcp-PJRHQHHU.js → mcp-6LWFP7RW.js} +121 -48
- package/dist/cli/{mcp-BWA6KULG.mjs → mcp-CHDYFO7F.mjs} +100 -27
- package/dist/cli/{monitors-K2WSI6CR.js → monitors-STM6A7OU.js} +221 -186
- package/dist/cli/{monitors-SYQKCATO.mjs → monitors-UGRY2BXI.mjs} +58 -23
- package/dist/cli/org-3SYOUQCX.mjs +2289 -0
- package/dist/cli/org-ZOBSNSIB.js +2289 -0
- package/dist/cli/outcomes-H4YYAT5X.js +2865 -0
- package/dist/cli/outcomes-Z3P2JE67.mjs +2865 -0
- package/dist/cli/{play-SZXY2F2S.js → play-SM4CW2GS.js} +1116 -846
- package/dist/cli/{play-TTMABJEI.mjs → play-SN5YWLS7.mjs} +375 -105
- package/dist/cli/{providers-GQIOMRQO.mjs → providers-WZ4YBR5Y.mjs} +10 -10
- package/dist/cli/{providers-YDHCTZAF.js → providers-WZARYMCF.js} +13 -13
- package/dist/cli/{quickstart-PHSSMKCA.mjs → quickstart-2575BNKA.mjs} +7 -6
- package/dist/cli/{quickstart-BNYOXQXG.js → quickstart-PS4YHQJ6.js} +9 -8
- package/dist/cli/{run-GFIAZXVL.js → run-FLZ6OTM7.js} +51 -51
- package/dist/cli/{run-74C3C75C.mjs → run-ZUHCZOJS.mjs} +31 -31
- package/dist/cli/run-identity-LMLFMACS.js +31 -0
- package/dist/cli/{run-identity-MRNCEGV2.mjs → run-identity-MAZ7ANH5.mjs} +9 -3
- package/dist/cli/{search-3SWUB7KX.mjs → search-HLPPKQEO.mjs} +11 -11
- package/dist/cli/search-JJWVHR3N.js +32 -0
- package/dist/cli/{search-output-K2SWHVHQ.mjs → search-output-PDAXNOGP.mjs} +9 -8
- package/dist/cli/{search-output-6JF3S4TP.js → search-output-RXJLU36B.js} +12 -11
- package/dist/cli/{secrets-2M4XWEKE.mjs → secrets-CGELYQ3H.mjs} +11 -11
- package/dist/cli/{secrets-2SAKLH2H.js → secrets-QJNG7G2Y.js} +20 -20
- package/dist/cli/sessions-DHTBT2GN.js +23 -0
- package/dist/cli/{sessions-A64BCXTO.mjs → sessions-ELMWVR4M.mjs} +9 -8
- package/dist/cli/{settings-HV64WIJF.js → settings-44I44P5F.js} +89 -89
- package/dist/cli/{settings-SVGEC3FI.mjs → settings-RR3LZXL7.mjs} +16 -16
- package/dist/cli/{setup-EDC3NEJ3.mjs → setup-KGWRWH4B.mjs} +20 -19
- package/dist/cli/{setup-FHXOLQGQ.js → setup-KTEYOCJO.js} +60 -59
- package/dist/cli/skills-EPZPEXI2.js +37 -0
- package/dist/cli/{skills-3HGHZMXB.mjs → skills-FPRID2I5.mjs} +10 -9
- package/dist/cli/tools-IGQQ5TML.js +57 -0
- package/dist/cli/{tools-P2QS6A6Q.mjs → tools-PI4WMDLY.mjs} +23 -23
- package/dist/cli/update-4RNCVYGE.js +37 -0
- package/dist/cli/{update-552BYQM4.mjs → update-VJOJAZ7B.mjs} +14 -11
- package/dist/cli/{views-PA25NAE3.js → views-NTUOLNQU.js} +62 -64
- package/dist/cli/{views-LD5HXJYY.mjs → views-OVPSINZO.mjs} +47 -49
- package/dist/cli/{workflow-FIDBUQV6.js → workflow-2UDYDM6F.js} +23 -23
- package/dist/cli/{workflow-LDYFGBYP.mjs → workflow-7OEFNXZC.mjs} +13 -13
- package/dist/{client-DuDFiJDU.d.mts → client-B8f7RNF8.d.mts} +1 -1
- package/dist/{client-t9HZAkFD.d.ts → client-C5TgXmJQ.d.ts} +1 -1
- package/dist/{client-core-DydMQOft.d.mts → client-core-SLLGBTht.d.mts} +285 -23
- package/dist/{client-core-CJRzLanv.d.ts → client-core-p0sOxnkl.d.ts} +285 -23
- package/dist/{compiler-manifest-BqwVrOri.d.mts → compiler-manifest-D_zZEh9Q.d.mts} +70 -5
- package/dist/{compiler-manifest-BqwVrOri.d.ts → compiler-manifest-D_zZEh9Q.d.ts} +70 -5
- package/dist/{errors-BU8FB99X.d.mts → errors-CZCrBFrQ.d.mts} +1 -1
- package/dist/{errors-DfVN_FUG.d.ts → errors-DsUkLrdZ.d.ts} +1 -1
- package/dist/{index-BGnvtYGc.d.ts → index-B6RTOZGC.d.ts} +1 -1
- package/dist/{index-DjZgwpGw.d.mts → index-DeOVrEmX.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +66 -55
- package/dist/index.mjs +25 -14
- package/dist/install-integrity.json +162 -142
- 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/csv-data-input.js +3 -3
- package/dist/plays/csv-data-input.mjs +2 -2
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/plays/run-request.js +4 -4
- package/dist/plays/run-request.mjs +3 -3
- 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 +15 -13
- package/dist/server.mjs +9 -7
- package/package.json +1 -1
- package/dist/cli/auth-B4PI7GVY.js +0 -43
- package/dist/cli/concurrent-runs-help-JEFQZTJI.js +0 -21
- package/dist/cli/describe-PXTSBJTL.js +0 -50
- package/dist/cli/describe-YGMQBV44.mjs +0 -50
- package/dist/cli/git-I3JV7IGH.js +0 -25
- package/dist/cli/org-5KD7X7IA.mjs +0 -1282
- package/dist/cli/org-YQ2CR32B.js +0 -1282
- package/dist/cli/run-identity-G257GQED.js +0 -25
- package/dist/cli/search-2RRRF4LW.js +0 -32
- package/dist/cli/sessions-SBH27JNW.js +0 -22
- package/dist/cli/skills-Y3SRLOYD.js +0 -36
- package/dist/cli/tools-OFYPUPUV.js +0 -57
- package/dist/cli/update-SOUSCLB7.js +0 -34
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
EARLY_SANDBOX_START,
|
|
8
8
|
EARLY_SANDBOX_SWEEP_INTERVAL_MS,
|
|
9
9
|
EARLY_SANDBOX_SWEEP_JITTER_RATIO,
|
|
10
|
+
earlySandboxKey,
|
|
10
11
|
earlySandboxRequiredCapabilities,
|
|
11
12
|
PREBOOT_RUNNER_IN_EARLY_SANDBOX,
|
|
12
13
|
startEarlySandbox,
|
|
@@ -30,6 +31,13 @@ import {
|
|
|
30
31
|
runtimeSandboxPlacementPoliciesRunnableByWorker,
|
|
31
32
|
} from './absurd-worker-required-env';
|
|
32
33
|
import { CLAIM_AFFINITY_FOR_EARLY_SANDBOX } from './early-sandbox-claim-affinity';
|
|
34
|
+
import {
|
|
35
|
+
createEarlySandboxListenerHintDesk,
|
|
36
|
+
EARLY_SANDBOX_LISTENER_HINT,
|
|
37
|
+
type EarlySandboxListenerHintDesk,
|
|
38
|
+
type EarlySandboxListenerHintRefusal,
|
|
39
|
+
type EarlySandboxListenerLeadership,
|
|
40
|
+
} from './early-sandbox-listener-hint';
|
|
33
41
|
|
|
34
42
|
/**
|
|
35
43
|
* Early-sandbox Adapter selection for a worker lane. The Runtime Sandbox
|
|
@@ -80,7 +88,9 @@ export class EarlySandboxAdapterSelectionError extends Error {
|
|
|
80
88
|
export type EarlySandboxHintRefusal =
|
|
81
89
|
| 'worker_draining'
|
|
82
90
|
| 'no_idle_slot'
|
|
83
|
-
| 'outstanding_cap'
|
|
91
|
+
| 'outstanding_cap'
|
|
92
|
+
| 'listener_unavailable'
|
|
93
|
+
| `listener_${EarlySandboxListenerHintRefusal}`;
|
|
84
94
|
|
|
85
95
|
/**
|
|
86
96
|
* The worker's own state a hint is admitted against. Each refusal is one
|
|
@@ -274,6 +284,15 @@ export function startWorkerLaneEarlySandbox(
|
|
|
274
284
|
sandboxPlacementPolicyId?: string | null;
|
|
275
285
|
/** The worker's drain and claim-slot state; absent checks neither. */
|
|
276
286
|
capacity?: EarlySandboxWorkerCapacity | null;
|
|
287
|
+
/**
|
|
288
|
+
* LH: the hint's queue and listener generation, and this worker's desk.
|
|
289
|
+
* A run with LH on starts only when the desk admits it.
|
|
290
|
+
*/
|
|
291
|
+
listenerHint?: {
|
|
292
|
+
desk: EarlySandboxListenerHintDesk | null;
|
|
293
|
+
queue: string | null;
|
|
294
|
+
listenerGeneration: string | null;
|
|
295
|
+
} | null;
|
|
277
296
|
env?: Readonly<Record<string, string | undefined>>;
|
|
278
297
|
adapters?: Readonly<
|
|
279
298
|
Partial<Record<RuntimeSandboxProviderId, EarlySandboxAdapter>>
|
|
@@ -335,12 +354,45 @@ export function startWorkerLaneEarlySandbox(
|
|
|
335
354
|
outstanding,
|
|
336
355
|
});
|
|
337
356
|
}
|
|
338
|
-
|
|
357
|
+
const request = {
|
|
339
358
|
workflowId: input.workflowId,
|
|
340
359
|
orgId: input.orgId ?? null,
|
|
341
360
|
runtimeSchedulerSchema: input.runtimeSchedulerSchema,
|
|
342
361
|
experimentSwitchOverrides: input.experimentSwitchOverrides ?? null,
|
|
362
|
+
};
|
|
363
|
+
if (
|
|
364
|
+
!resolveExperimentSwitch(
|
|
365
|
+
'LH',
|
|
366
|
+
input.experimentSwitchOverrides,
|
|
367
|
+
EARLY_SANDBOX_LISTENER_HINT,
|
|
368
|
+
)
|
|
369
|
+
) {
|
|
370
|
+
return startEarlySandbox(adapter, request);
|
|
371
|
+
}
|
|
372
|
+
// LH: admitted only by this worker's desk, bound to the hint's queue,
|
|
373
|
+
// this worker's current listener generation and one free slot.
|
|
374
|
+
const desk = input.listenerHint?.desk ?? null;
|
|
375
|
+
const orgId = input.orgId?.trim();
|
|
376
|
+
if (!desk || !orgId || adapter.startUnavailable(request) !== null) {
|
|
377
|
+
return refuseEarlySandboxHint({ ...hint, reason: 'listener_unavailable' });
|
|
378
|
+
}
|
|
379
|
+
const key = earlySandboxKey({
|
|
380
|
+
orgId,
|
|
381
|
+
workflowId: input.workflowId,
|
|
382
|
+
...adapter.scope(request),
|
|
343
383
|
});
|
|
384
|
+
const refusal = desk.admit({
|
|
385
|
+
key,
|
|
386
|
+
workflowId: input.workflowId,
|
|
387
|
+
queue: input.listenerHint?.queue ?? '',
|
|
388
|
+
listenerGeneration: input.listenerHint?.listenerGeneration ?? '',
|
|
389
|
+
});
|
|
390
|
+
if (refusal) {
|
|
391
|
+
return refuseEarlySandboxHint({ ...hint, reason: `listener_${refusal}` });
|
|
392
|
+
}
|
|
393
|
+
const started = startEarlySandbox(adapter, request);
|
|
394
|
+
if (!started) desk.released(key);
|
|
395
|
+
return started;
|
|
344
396
|
}
|
|
345
397
|
|
|
346
398
|
/**
|
|
@@ -406,3 +458,59 @@ export function earlySandboxFleetSweepAdapter(input: {
|
|
|
406
458
|
},
|
|
407
459
|
};
|
|
408
460
|
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* LH: one worker host's listener desk, as `startRuntimeWorkerHost` wires it.
|
|
464
|
+
* - Admits hints against the host's leadership and its live free slots.
|
|
465
|
+
* - A run's authoritative claim (its play-run handler started here) or a
|
|
466
|
+
* launch's take from a registry frees the run's reservation. Neither touches
|
|
467
|
+
* the sandbox: slot release is not provider deletion.
|
|
468
|
+
* - Expiry, handover and stop free the slot and log `listener_unadopted`;
|
|
469
|
+
* the sandbox is left to the 90 s reaper and Fleet Sandbox Sweep, because
|
|
470
|
+
* another worker may have adopted it by tag.
|
|
471
|
+
*/
|
|
472
|
+
export function wireEarlySandboxListenerHost(input: {
|
|
473
|
+
leadership: EarlySandboxListenerLeadership;
|
|
474
|
+
draining: boolean;
|
|
475
|
+
freeSlots: () => number;
|
|
476
|
+
adapters?: Readonly<
|
|
477
|
+
Partial<Record<RuntimeSandboxProviderId, EarlySandboxAdapter>>
|
|
478
|
+
>;
|
|
479
|
+
log?: (line: string) => void;
|
|
480
|
+
now?: () => number;
|
|
481
|
+
}): {
|
|
482
|
+
desk: EarlySandboxListenerHintDesk;
|
|
483
|
+
onPlayRunStarted(runId: string): void;
|
|
484
|
+
stop(): void;
|
|
485
|
+
} {
|
|
486
|
+
const now = input.now ?? Date.now;
|
|
487
|
+
const log = input.log ?? ((line: string) => console.info(line));
|
|
488
|
+
const desk = createEarlySandboxListenerHintDesk({
|
|
489
|
+
leadership: input.leadership,
|
|
490
|
+
capacity: { draining: input.draining, idleSlots: input.freeSlots },
|
|
491
|
+
onUnadopted: (reservation, reason) =>
|
|
492
|
+
log(
|
|
493
|
+
JSON.stringify({
|
|
494
|
+
event: 'play-runner.early.listener_unadopted',
|
|
495
|
+
reason,
|
|
496
|
+
workflowId: reservation.workflowId,
|
|
497
|
+
generation: reservation.generation,
|
|
498
|
+
heldMs: now() - reservation.acceptedAtMs,
|
|
499
|
+
}),
|
|
500
|
+
),
|
|
501
|
+
now,
|
|
502
|
+
});
|
|
503
|
+
const unsubscribes = Object.values(
|
|
504
|
+
input.adapters ?? EARLY_SANDBOX_ADAPTERS,
|
|
505
|
+
).flatMap((adapter) =>
|
|
506
|
+
adapter ? [adapter.registry.subscribeTake((key) => desk.adopted(key))] : [],
|
|
507
|
+
);
|
|
508
|
+
return {
|
|
509
|
+
desk,
|
|
510
|
+
onPlayRunStarted: (runId) => desk.claimed(runId),
|
|
511
|
+
stop: () => {
|
|
512
|
+
for (const unsubscribe of unsubscribes) unsubscribe();
|
|
513
|
+
desk.stop();
|
|
514
|
+
},
|
|
515
|
+
};
|
|
516
|
+
}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Preview experiment LH: listener-directed early-sandbox hints.
|
|
5
|
+
*
|
|
6
|
+
* Production elects one direct-LISTEN worker per release queue (a session
|
|
7
|
+
* advisory lock, `createAbsurdWorkerWakeHook`). The run's enqueue NOTIFY wakes
|
|
8
|
+
* that listener, while the other workers find work through a 1 s standby
|
|
9
|
+
* probe. LH sends a run's E2/PB hint to the worker holding that election, so
|
|
10
|
+
* the worker that starts the early sandbox is usually the one that claims the
|
|
11
|
+
* run, without any claim gate, task param or extra claim-path read. "Usually"
|
|
12
|
+
* is not a guarantee: the listener can change, be saturated, or lose the race
|
|
13
|
+
* to a standby probe. Every such miss falls back to the normal launch, which
|
|
14
|
+
* creates its own sandbox, and the hinted sandbox is reaped early (below).
|
|
15
|
+
*
|
|
16
|
+
* Binding, all checked on the worker at hint time:
|
|
17
|
+
* - queue: the hint names the run's release queue; a worker for any other
|
|
18
|
+
* queue (another release lane, an older release, another suffix) refuses.
|
|
19
|
+
* - leadership generation: the gateway reads each worker's in-memory status
|
|
20
|
+
* and sends the hint only when exactly one worker is listening for that
|
|
21
|
+
* queue, naming that worker's generation. The worker refuses a hint whose
|
|
22
|
+
* generation is not its current one, so a hint chosen before a handover is
|
|
23
|
+
* never started by a worker that no longer holds the election.
|
|
24
|
+
* - idle slot: an accepted hint reserves one free claim slot until it is
|
|
25
|
+
* adopted, released or expired; a worker never holds more reservations than
|
|
26
|
+
* it has free slots.
|
|
27
|
+
*
|
|
28
|
+
* Cost bound: an accepted sandbox is never terminated early. Another worker
|
|
29
|
+
* may adopt it by tag (the miss case: a standby claims the run, or the
|
|
30
|
+
* listener hands over), and only the existing 90 s exact-id reaper, outside
|
|
31
|
+
* the 60 s adoption window, can tell. So a reservation that is not adopted
|
|
32
|
+
* here within `EARLY_SANDBOX_LISTENER_RESERVATION_MS`, or that outlives its
|
|
33
|
+
* leadership, only gives its slot back; the sandbox is left to the 90 s
|
|
34
|
+
* reaper and the Fleet Sandbox Sweep, the same bound as any E2 sandbox today.
|
|
35
|
+
*
|
|
36
|
+
* Off: every LH hint path is behind this per-run switch. The in-memory
|
|
37
|
+
* leadership tracker and desk exist on every host with a wake hook, but hold
|
|
38
|
+
* nothing, read nothing and log nothing until an LH hint is admitted.
|
|
39
|
+
*/
|
|
40
|
+
export const EARLY_SANDBOX_LISTENER_HINT = false;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* How long an accepted listener hint holds its slot and sandbox for adoption.
|
|
44
|
+
* Admission enqueues ~0.4 s after the hint (slow admissions ~2 s) and the
|
|
45
|
+
* listener claims within milliseconds of the NOTIFY; past this the run is
|
|
46
|
+
* queued behind other work or claimed elsewhere, so the sandbox is reaped and
|
|
47
|
+
* the launch creates its own.
|
|
48
|
+
*/
|
|
49
|
+
export const EARLY_SANDBOX_LISTENER_RESERVATION_MS = 10_000;
|
|
50
|
+
|
|
51
|
+
/** A worker's hold on its queue's listener election. */
|
|
52
|
+
export type EarlySandboxListenerLeadership = {
|
|
53
|
+
/** The release queue this worker claims from. */
|
|
54
|
+
readonly queue: string;
|
|
55
|
+
/** This process's current listener generation, or null when not listening. */
|
|
56
|
+
generation(): string | null;
|
|
57
|
+
/** Feed every listening/not-listening transition of the wake hook. */
|
|
58
|
+
onListening(listening: boolean): void;
|
|
59
|
+
/** Called with the generation that ended, after each loss of leadership. */
|
|
60
|
+
subscribeLoss(handler: (endedGeneration: string) => void): () => void;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export function createEarlySandboxListenerLeadership(input: {
|
|
64
|
+
queue: string;
|
|
65
|
+
nonce?: string;
|
|
66
|
+
}): EarlySandboxListenerLeadership {
|
|
67
|
+
// Unique per tracker (so per process and per host restart): two trackers
|
|
68
|
+
// never share a generation string.
|
|
69
|
+
const nonce = input.nonce ?? randomUUID().slice(0, 12);
|
|
70
|
+
let wins = 0;
|
|
71
|
+
let current: string | null = null;
|
|
72
|
+
const lossHandlers = new Set<(ended: string) => void>();
|
|
73
|
+
return {
|
|
74
|
+
queue: input.queue,
|
|
75
|
+
generation: () => current,
|
|
76
|
+
onListening: (listening) => {
|
|
77
|
+
if (listening) {
|
|
78
|
+
if (current === null) {
|
|
79
|
+
wins += 1;
|
|
80
|
+
current = `${nonce}:${wins}`;
|
|
81
|
+
}
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (current === null) return;
|
|
85
|
+
const ended = current;
|
|
86
|
+
current = null;
|
|
87
|
+
for (const handler of lossHandlers) handler(ended);
|
|
88
|
+
},
|
|
89
|
+
subscribeLoss: (handler) => {
|
|
90
|
+
lossHandlers.add(handler);
|
|
91
|
+
return () => lossHandlers.delete(handler);
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** What a worker reports to the gateway; in memory only, no reads. */
|
|
97
|
+
export type EarlySandboxListenerStatus = {
|
|
98
|
+
queue: string;
|
|
99
|
+
generation: string | null;
|
|
100
|
+
draining: boolean;
|
|
101
|
+
/** Free slots not already reserved by an accepted listener hint. */
|
|
102
|
+
unreservedSlots: number;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export type EarlySandboxListenerHintRefusal =
|
|
106
|
+
| 'foreign_queue'
|
|
107
|
+
| 'not_listener'
|
|
108
|
+
| 'stale_generation'
|
|
109
|
+
| 'worker_draining'
|
|
110
|
+
| 'no_idle_slot'
|
|
111
|
+
| 'duplicate_hint';
|
|
112
|
+
|
|
113
|
+
export type EarlySandboxListenerReservation = {
|
|
114
|
+
/** The run's early-sandbox registry key (`earlySandboxKey`). */
|
|
115
|
+
key: string;
|
|
116
|
+
workflowId: string;
|
|
117
|
+
generation: string;
|
|
118
|
+
acceptedAtMs: number;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* One worker's listener-hint admission: binds each accepted hint to the queue,
|
|
123
|
+
* the generation and one free slot, and releases it exactly once.
|
|
124
|
+
*/
|
|
125
|
+
export type EarlySandboxListenerHintDesk = {
|
|
126
|
+
status(): EarlySandboxListenerStatus;
|
|
127
|
+
/** Null when accepted (the slot is reserved), else why not. */
|
|
128
|
+
admit(hint: {
|
|
129
|
+
key: string;
|
|
130
|
+
workflowId: string;
|
|
131
|
+
queue: string;
|
|
132
|
+
listenerGeneration: string;
|
|
133
|
+
}): EarlySandboxListenerHintRefusal | null;
|
|
134
|
+
/** The launch took the run's sandbox here: release, keep the sandbox. */
|
|
135
|
+
adopted(key: string): void;
|
|
136
|
+
/**
|
|
137
|
+
* The run's handler started on this worker (its authoritative claim):
|
|
138
|
+
* release its slot reservation. The sandbox is untouched; the launch adopts
|
|
139
|
+
* it or the 90 s reaper settles it.
|
|
140
|
+
*/
|
|
141
|
+
claimed(workflowId: string): void;
|
|
142
|
+
/** The start failed or was refused downstream: release, nothing to reap. */
|
|
143
|
+
released(key: string): void;
|
|
144
|
+
reservations(): readonly EarlySandboxListenerReservation[];
|
|
145
|
+
stop(): void;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export function createEarlySandboxListenerHintDesk(input: {
|
|
149
|
+
leadership: EarlySandboxListenerLeadership;
|
|
150
|
+
capacity: {
|
|
151
|
+
readonly draining: boolean;
|
|
152
|
+
/** Free claim slots right now (0 when the claim loop is saturated). */
|
|
153
|
+
idleSlots(): number;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* A reservation ended without a local adoption (expiry, handover or stop).
|
|
157
|
+
* Its slot is free again; its sandbox is left to the 90 s reaper, because
|
|
158
|
+
* another worker may have adopted it.
|
|
159
|
+
*/
|
|
160
|
+
onUnadopted?: (
|
|
161
|
+
reservation: EarlySandboxListenerReservation,
|
|
162
|
+
reason: 'handover' | 'expired' | 'stopped',
|
|
163
|
+
) => void;
|
|
164
|
+
reservationMs?: number;
|
|
165
|
+
now?: () => number;
|
|
166
|
+
setTimer?: (callback: () => void, ms: number) => unknown;
|
|
167
|
+
clearTimer?: (timer: unknown) => void;
|
|
168
|
+
}): EarlySandboxListenerHintDesk {
|
|
169
|
+
const now = input.now ?? Date.now;
|
|
170
|
+
const reservationMs =
|
|
171
|
+
input.reservationMs ?? EARLY_SANDBOX_LISTENER_RESERVATION_MS;
|
|
172
|
+
const setTimer =
|
|
173
|
+
input.setTimer ??
|
|
174
|
+
((callback: () => void, ms: number) => {
|
|
175
|
+
const timer = setTimeout(callback, ms);
|
|
176
|
+
timer.unref?.();
|
|
177
|
+
return timer;
|
|
178
|
+
});
|
|
179
|
+
const clearTimer =
|
|
180
|
+
input.clearTimer ??
|
|
181
|
+
((timer: unknown) => clearTimeout(timer as ReturnType<typeof setTimeout>));
|
|
182
|
+
const held = new Map<
|
|
183
|
+
string,
|
|
184
|
+
{ reservation: EarlySandboxListenerReservation; timer: unknown }
|
|
185
|
+
>();
|
|
186
|
+
|
|
187
|
+
const drop = (key: string) => {
|
|
188
|
+
const entry = held.get(key);
|
|
189
|
+
if (!entry) return null;
|
|
190
|
+
held.delete(key);
|
|
191
|
+
clearTimer(entry.timer);
|
|
192
|
+
return entry.reservation;
|
|
193
|
+
};
|
|
194
|
+
const unreservedSlots = () =>
|
|
195
|
+
Math.max(0, Math.floor(input.capacity.idleSlots()) - held.size);
|
|
196
|
+
|
|
197
|
+
const unsubscribe = input.leadership.subscribeLoss((ended) => {
|
|
198
|
+
for (const [key, entry] of [...held]) {
|
|
199
|
+
if (entry.reservation.generation !== ended) continue;
|
|
200
|
+
drop(key);
|
|
201
|
+
input.onUnadopted?.(entry.reservation, 'handover');
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
return {
|
|
206
|
+
status: () => ({
|
|
207
|
+
queue: input.leadership.queue,
|
|
208
|
+
generation: input.leadership.generation(),
|
|
209
|
+
draining: input.capacity.draining,
|
|
210
|
+
unreservedSlots: unreservedSlots(),
|
|
211
|
+
}),
|
|
212
|
+
admit: (hint) => {
|
|
213
|
+
if (hint.queue !== input.leadership.queue) return 'foreign_queue';
|
|
214
|
+
const generation = input.leadership.generation();
|
|
215
|
+
if (generation === null) return 'not_listener';
|
|
216
|
+
if (hint.listenerGeneration !== generation) return 'stale_generation';
|
|
217
|
+
if (input.capacity.draining) return 'worker_draining';
|
|
218
|
+
if (held.has(hint.key)) return 'duplicate_hint';
|
|
219
|
+
if (unreservedSlots() < 1) return 'no_idle_slot';
|
|
220
|
+
const reservation = {
|
|
221
|
+
key: hint.key,
|
|
222
|
+
workflowId: hint.workflowId,
|
|
223
|
+
generation,
|
|
224
|
+
acceptedAtMs: now(),
|
|
225
|
+
};
|
|
226
|
+
const timer = setTimer(() => {
|
|
227
|
+
if (held.get(hint.key)?.reservation !== reservation) return;
|
|
228
|
+
drop(hint.key);
|
|
229
|
+
input.onUnadopted?.(reservation, 'expired');
|
|
230
|
+
}, reservationMs);
|
|
231
|
+
held.set(hint.key, { reservation, timer });
|
|
232
|
+
return null;
|
|
233
|
+
},
|
|
234
|
+
adopted: (key) => {
|
|
235
|
+
drop(key);
|
|
236
|
+
},
|
|
237
|
+
claimed: (workflowId) => {
|
|
238
|
+
for (const [key, entry] of [...held]) {
|
|
239
|
+
if (entry.reservation.workflowId === workflowId) drop(key);
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
released: (key) => {
|
|
243
|
+
drop(key);
|
|
244
|
+
},
|
|
245
|
+
reservations: () => [...held.values()].map((entry) => entry.reservation),
|
|
246
|
+
stop: () => {
|
|
247
|
+
unsubscribe();
|
|
248
|
+
for (const key of [...held.keys()]) {
|
|
249
|
+
const reservation = drop(key);
|
|
250
|
+
if (reservation) input.onUnadopted?.(reservation, 'stopped');
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export type EarlySandboxListenerSelection =
|
|
257
|
+
| { target: number; generation: string }
|
|
258
|
+
| { refused: 'no_listener' | 'ambiguous_listeners' | 'listener_busy' };
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* The gateway's choice: the one worker listening for the run's queue, not
|
|
262
|
+
* draining, with an unreserved slot. Zero such workers, or more than one
|
|
263
|
+
* (an election in handover), sends no hint, and the launch proceeds as
|
|
264
|
+
* without one.
|
|
265
|
+
*/
|
|
266
|
+
export function selectEarlySandboxListener(input: {
|
|
267
|
+
queue: string;
|
|
268
|
+
statuses: readonly (EarlySandboxListenerStatus | null)[];
|
|
269
|
+
}): EarlySandboxListenerSelection {
|
|
270
|
+
const listening = input.statuses.flatMap((status, index) =>
|
|
271
|
+
status && status.queue === input.queue && status.generation !== null
|
|
272
|
+
? [{ index, status }]
|
|
273
|
+
: [],
|
|
274
|
+
);
|
|
275
|
+
if (listening.length > 1) return { refused: 'ambiguous_listeners' };
|
|
276
|
+
const only = listening[0];
|
|
277
|
+
if (!only) return { refused: 'no_listener' };
|
|
278
|
+
if (only.status.draining || only.status.unreservedSlots < 1)
|
|
279
|
+
return { refused: 'listener_busy' };
|
|
280
|
+
return { target: only.index, generation: only.status.generation! };
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const GENERATION_PATTERN = /^[0-9a-f-]{1,40}:[0-9]{1,12}$/;
|
|
284
|
+
const QUEUE_PATTERN = /^[a-z0-9_]{1,96}$/;
|
|
285
|
+
|
|
286
|
+
export function parseEarlySandboxListenerGeneration(
|
|
287
|
+
value: unknown,
|
|
288
|
+
): string | null {
|
|
289
|
+
if (typeof value !== 'string') return null;
|
|
290
|
+
const generation = value.trim();
|
|
291
|
+
return GENERATION_PATTERN.test(generation) ? generation : null;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export function parseEarlySandboxListenerQueue(value: unknown): string | null {
|
|
295
|
+
if (typeof value !== 'string') return null;
|
|
296
|
+
const queue = value.trim();
|
|
297
|
+
return QUEUE_PATTERN.test(queue) ? queue : null;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/** Parse a status reply; anything malformed counts as no status. */
|
|
301
|
+
export function parseEarlySandboxListenerStatus(
|
|
302
|
+
value: unknown,
|
|
303
|
+
): EarlySandboxListenerStatus | null {
|
|
304
|
+
if (!value || typeof value !== 'object') return null;
|
|
305
|
+
const record = value as Record<string, unknown>;
|
|
306
|
+
const queue = parseEarlySandboxListenerQueue(record.queue);
|
|
307
|
+
if (!queue) return null;
|
|
308
|
+
const generation =
|
|
309
|
+
record.generation === null
|
|
310
|
+
? null
|
|
311
|
+
: parseEarlySandboxListenerGeneration(record.generation);
|
|
312
|
+
if (record.generation !== null && generation === null) return null;
|
|
313
|
+
if (typeof record.draining !== 'boolean') return null;
|
|
314
|
+
const slots = record.unreservedSlots;
|
|
315
|
+
if (typeof slots !== 'number' || !Number.isSafeInteger(slots) || slots < 0)
|
|
316
|
+
return null;
|
|
317
|
+
return {
|
|
318
|
+
queue,
|
|
319
|
+
generation,
|
|
320
|
+
draining: record.draining,
|
|
321
|
+
unreservedSlots: slots,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the run and attempt an executor token names may still act. The
|
|
3
|
+
* receipt gateway's attempt fence and the app's runtime route both decide from
|
|
4
|
+
* `readPostgresSchedulerExecutorAttemptStanding`, so one rule covers every
|
|
5
|
+
* runtime call: the heartbeat would reject the same attempt.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type RunTerminalStatus = 'completed' | 'failed' | 'cancelled';
|
|
9
|
+
|
|
10
|
+
const TERMINAL_STATUSES: ReadonlySet<string> = new Set([
|
|
11
|
+
'completed',
|
|
12
|
+
'failed',
|
|
13
|
+
'cancelled',
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
/** The attempt statuses the runner heartbeat still renews. */
|
|
17
|
+
const ACTIVE_ATTEMPT_STATUSES: ReadonlySet<string> = new Set([
|
|
18
|
+
'claimed',
|
|
19
|
+
'running',
|
|
20
|
+
'waiting',
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
export type ExecutorAttemptStanding = {
|
|
24
|
+
runStatus: string;
|
|
25
|
+
attemptStatus: string | null;
|
|
26
|
+
superseded: boolean;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type ExecutorAttemptRefusal =
|
|
30
|
+
| { kind: 'run_terminal'; terminal: RunTerminalStatus }
|
|
31
|
+
| { kind: 'attempt_superseded' }
|
|
32
|
+
| { kind: 'attempt_retired'; attemptStatus: string };
|
|
33
|
+
|
|
34
|
+
export const RUNTIME_RUN_ALREADY_TERMINAL_CODE = 'RUNTIME_RUN_ALREADY_TERMINAL';
|
|
35
|
+
export const RUNTIME_ATTEMPT_SUPERSEDED_CODE = 'RUNTIME_ATTEMPT_SUPERSEDED';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Refuses only on a positive reading. A missing run (`null`) is never refused:
|
|
39
|
+
* the token may name a run this scheduler does not own. `permanent` marks a
|
|
40
|
+
* refusal that can never lift: a terminal run never reopens and a superseded
|
|
41
|
+
* attempt never returns.
|
|
42
|
+
*/
|
|
43
|
+
export function decideExecutorAttemptStanding(
|
|
44
|
+
standing: ExecutorAttemptStanding | null,
|
|
45
|
+
): { refusal: ExecutorAttemptRefusal | null; permanent: boolean } {
|
|
46
|
+
if (!standing) return { refusal: null, permanent: false };
|
|
47
|
+
if (TERMINAL_STATUSES.has(standing.runStatus)) {
|
|
48
|
+
return {
|
|
49
|
+
refusal: {
|
|
50
|
+
kind: 'run_terminal',
|
|
51
|
+
terminal: standing.runStatus as RunTerminalStatus,
|
|
52
|
+
},
|
|
53
|
+
permanent: true,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (standing.superseded) {
|
|
57
|
+
return { refusal: { kind: 'attempt_superseded' }, permanent: true };
|
|
58
|
+
}
|
|
59
|
+
if (
|
|
60
|
+
standing.attemptStatus !== null &&
|
|
61
|
+
!ACTIVE_ATTEMPT_STATUSES.has(standing.attemptStatus)
|
|
62
|
+
) {
|
|
63
|
+
return {
|
|
64
|
+
refusal: {
|
|
65
|
+
kind: 'attempt_retired',
|
|
66
|
+
attemptStatus: standing.attemptStatus,
|
|
67
|
+
},
|
|
68
|
+
permanent: false,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return { refusal: null, permanent: false };
|
|
72
|
+
}
|
|
@@ -41,7 +41,9 @@ type IntegrationOperationValueInput = {
|
|
|
41
41
|
export type IntegrationOperationValuePersister = ((
|
|
42
42
|
input: IntegrationOperationValueInput,
|
|
43
43
|
) => Promise<PersistedIntegrationOperationValue>) & {
|
|
44
|
-
prepare(
|
|
44
|
+
prepare(
|
|
45
|
+
input: IntegrationOperationValueInput,
|
|
46
|
+
): PreparedIntegrationOperationValue;
|
|
45
47
|
persistPrepared(
|
|
46
48
|
input: PreparedIntegrationOperationValue,
|
|
47
49
|
): Promise<PersistedIntegrationOperationValue>;
|
|
@@ -97,6 +99,17 @@ function bindings(input: { orgId: string; operationKey: string }): {
|
|
|
97
99
|
};
|
|
98
100
|
}
|
|
99
101
|
|
|
102
|
+
/** Every Integration Operation value one workspace owns. */
|
|
103
|
+
export function integrationOperationValueOrgStoragePrefix(
|
|
104
|
+
orgId: string,
|
|
105
|
+
): string {
|
|
106
|
+
const { orgBinding } = bindings({
|
|
107
|
+
orgId: nonempty(orgId, 'orgId'),
|
|
108
|
+
operationKey: '',
|
|
109
|
+
});
|
|
110
|
+
return `runtime/integration-operation-values/v1/${orgBinding}/`;
|
|
111
|
+
}
|
|
112
|
+
|
|
100
113
|
export function integrationOperationValueStorageKey(input: {
|
|
101
114
|
orgId: string;
|
|
102
115
|
operationKey: string;
|
|
@@ -207,7 +220,10 @@ export function createIntegrationOperationValuePersister(
|
|
|
207
220
|
): IntegrationOperationValuePersister {
|
|
208
221
|
const inlineMaxBytes =
|
|
209
222
|
input.inlineMaxBytes ?? INTEGRATION_OPERATION_VALUE_INLINE_MAX_BYTES;
|
|
210
|
-
type Write = Extract<
|
|
223
|
+
type Write = Extract<
|
|
224
|
+
PreparedIntegrationOperationValue,
|
|
225
|
+
{ kind: 'reference' }
|
|
226
|
+
>;
|
|
211
227
|
const writes = new BoundedBatchFunction<
|
|
212
228
|
Write,
|
|
213
229
|
PersistedIntegrationOperationValue,
|
|
@@ -260,7 +276,9 @@ export async function deleteIntegrationOperationValue(input: {
|
|
|
260
276
|
store?: RuntimeValueBlobStore;
|
|
261
277
|
}): Promise<void> {
|
|
262
278
|
if (!isIntegrationOperationValueReference(input.reference)) {
|
|
263
|
-
throw new Error(
|
|
279
|
+
throw new Error(
|
|
280
|
+
'Integration Operation value deletion has an invalid reference.',
|
|
281
|
+
);
|
|
264
282
|
}
|
|
265
283
|
const store = requireRuntimeValueBlobStore(input.store);
|
|
266
284
|
try {
|
|
@@ -305,7 +323,8 @@ export function createIntegrationOperationValueRetirer(
|
|
|
305
323
|
),
|
|
306
324
|
),
|
|
307
325
|
});
|
|
308
|
-
return async ({ reference }) =>
|
|
326
|
+
return async ({ reference }) =>
|
|
327
|
+
await deletes.submit({ key: 'r2', value: reference });
|
|
309
328
|
}
|
|
310
329
|
|
|
311
330
|
function assertScope(input: {
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts
CHANGED
|
@@ -1907,7 +1907,8 @@ async function acquireWithConcurrency(
|
|
|
1907
1907
|
requested: number,
|
|
1908
1908
|
): Promise<InternalAcquireOutcome> {
|
|
1909
1909
|
let probeBaselineSupported = true;
|
|
1910
|
-
|
|
1910
|
+
const requesterId = normalizeRequesterId(input);
|
|
1911
|
+
if (rateStateCollapsedAcquireEnabled(requesterId)) {
|
|
1911
1912
|
while (true) {
|
|
1912
1913
|
try {
|
|
1913
1914
|
return await collapsedGrantWithConcurrency(
|
|
@@ -1933,7 +1934,7 @@ async function acquireWithConcurrency(
|
|
|
1933
1934
|
while (true) {
|
|
1934
1935
|
const lockSql = `SELECT bucket_id FROM ${scopeHoldTableName(input)}
|
|
1935
1936
|
WHERE bucket_id = $1 FOR UPDATE`;
|
|
1936
|
-
const singleTripOpening = rateStateSingleTripEnabled()
|
|
1937
|
+
const singleTripOpening = rateStateSingleTripEnabled(requesterId)
|
|
1937
1938
|
? renderRateStateStatementForSingleTrip(lockSql, [input.bucketId])
|
|
1938
1939
|
: null;
|
|
1939
1940
|
if (singleTripOpening === null) {
|
|
@@ -2023,7 +2024,7 @@ async function collapsedGrantWithConcurrency(
|
|
|
2023
2024
|
const grant = renderRateStateStatementForSingleTrip(
|
|
2024
2025
|
sql,
|
|
2025
2026
|
parameters,
|
|
2026
|
-
rateStateRenderOptions(),
|
|
2027
|
+
rateStateRenderOptions(normalizeRequesterId(input)),
|
|
2027
2028
|
);
|
|
2028
2029
|
if (grant === null) {
|
|
2029
2030
|
open = true;
|
|
@@ -2243,10 +2244,27 @@ function rateStateArrayParameterText(
|
|
|
2243
2244
|
return `{${elements.join(',')}}`;
|
|
2244
2245
|
}
|
|
2245
2246
|
|
|
2246
|
-
|
|
2247
|
+
/**
|
|
2248
|
+
* Whether this acquire's requester is an organization listed in
|
|
2249
|
+
* `rateStateOneRequestOrgIds`. A call with no requester, or a run-only
|
|
2250
|
+
* requester, is never listed.
|
|
2251
|
+
*/
|
|
2252
|
+
function rateStateOneRequestOrgListed(
|
|
2253
|
+
requesterId: string | null | undefined,
|
|
2254
|
+
): boolean {
|
|
2255
|
+
if (!requesterId?.startsWith('org:')) return false;
|
|
2256
|
+
const orgIds: readonly string[] =
|
|
2257
|
+
DURABLE_RUNS_ROLLOUT.rateStateOneRequestOrgIds;
|
|
2258
|
+
return orgIds.includes(requesterId.slice('org:'.length));
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
function rateStateCollapsedAcquireEnabled(
|
|
2262
|
+
requesterId: string | null = null,
|
|
2263
|
+
): boolean {
|
|
2247
2264
|
const enabled: boolean =
|
|
2248
|
-
DURABLE_RUNS_ROLLOUT.rateStateCollapsedAcquire &&
|
|
2249
|
-
|
|
2265
|
+
(DURABLE_RUNS_ROLLOUT.rateStateCollapsedAcquire &&
|
|
2266
|
+
DURABLE_RUNS_ROLLOUT.rateStateSingleTripTransactions) ||
|
|
2267
|
+
rateStateOneRequestOrgListed(requesterId);
|
|
2250
2268
|
return enabled;
|
|
2251
2269
|
}
|
|
2252
2270
|
|
|
@@ -2255,17 +2273,21 @@ function rateStateCollapsedAcquireEnabled(): boolean {
|
|
|
2255
2273
|
* rate-state statement binds the bucket id (text) as `$1`; it is compared with
|
|
2256
2274
|
* and written to text columns only, so its uses may stay uncast.
|
|
2257
2275
|
*/
|
|
2258
|
-
function rateStateRenderOptions(): {
|
|
2276
|
+
function rateStateRenderOptions(requesterId: string | null = null): {
|
|
2259
2277
|
arrays?: boolean;
|
|
2260
2278
|
textParameters?: readonly number[];
|
|
2261
2279
|
} {
|
|
2262
|
-
return rateStateCollapsedAcquireEnabled()
|
|
2280
|
+
return rateStateCollapsedAcquireEnabled(requesterId)
|
|
2263
2281
|
? { arrays: true, textParameters: [1] }
|
|
2264
2282
|
: {};
|
|
2265
2283
|
}
|
|
2266
2284
|
|
|
2267
|
-
function rateStateSingleTripEnabled(
|
|
2268
|
-
|
|
2285
|
+
function rateStateSingleTripEnabled(
|
|
2286
|
+
requesterId: string | null = null,
|
|
2287
|
+
): boolean {
|
|
2288
|
+
const enabled: boolean =
|
|
2289
|
+
DURABLE_RUNS_ROLLOUT.rateStateSingleTripTransactions ||
|
|
2290
|
+
rateStateOneRequestOrgListed(requesterId);
|
|
2269
2291
|
return enabled;
|
|
2270
2292
|
}
|
|
2271
2293
|
|