deepline 0.3.552 → 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 +107 -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 +118 -8
- 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 +8 -1
- 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 +9 -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-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/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 +168 -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 +444 -39
- 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-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 +72 -0
- 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 +254 -44
- 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 +259 -52
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +13 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +30 -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-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/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-KVSBJZOX.mjs → auth-I3QAU4RV.mjs} +8 -7
- package/dist/cli/auth-MQCN7WGZ.js +44 -0
- package/dist/cli/{billing-54RHFEBI.mjs → billing-3IC54OQQ.mjs} +197 -61
- package/dist/cli/{billing-FQREA7UA.js → billing-YGFFVAIC.js} +297 -161
- package/dist/cli/{chunk-4MK42735.js → chunk-2B5B5KAW.js} +210 -128
- package/dist/cli/{chunk-UBKA33KY.mjs → chunk-2MGZAI54.mjs} +17 -0
- package/dist/cli/{chunk-4NQF6KJ3.js → chunk-3NTP2OSG.js} +13 -13
- package/dist/cli/{chunk-HYC4MKGK.mjs → chunk-45OAVGU6.mjs} +5 -5
- package/dist/cli/{chunk-WLN3SUIA.js → chunk-4747TPLV.js} +3 -3
- package/dist/cli/{chunk-AZQ264ID.mjs → chunk-4BFTDNHU.mjs} +1 -1
- package/dist/cli/{chunk-BGBJV26E.mjs → chunk-4HYNMXXF.mjs} +4 -4
- package/dist/cli/{chunk-DJ2JDK4O.mjs → chunk-4SMCFQ23.mjs} +1 -1
- package/dist/cli/{chunk-QPKH23EC.mjs → chunk-55F6HNOY.mjs} +5 -5
- package/dist/cli/{chunk-LX35AXTN.mjs → chunk-5TYLSS4Q.mjs} +6 -6
- package/dist/cli/{chunk-634ZDA3F.js → chunk-6NE3RRRY.js} +1 -1
- package/dist/cli/{chunk-EITMD3A5.js → chunk-6VLFQZK6.js} +8 -8
- package/dist/cli/{chunk-EOPEYCY7.mjs → chunk-72V4PDH5.mjs} +18 -18
- package/dist/cli/{chunk-IHRKLXZN.js → chunk-74RES4DS.js} +5 -5
- package/dist/cli/{chunk-45PVGZST.js → chunk-7GEMELKI.js} +366 -320
- package/dist/cli/{chunk-4UUR4TCH.js → chunk-7O6J6A7P.js} +1871 -92
- package/dist/cli/{chunk-XVB7V4N7.js → chunk-7SERLBNR.js} +161 -53
- package/dist/cli/{chunk-F2LH7TGF.js → chunk-7YRJ5UC4.js} +21 -21
- package/dist/cli/{chunk-YJHE3O5M.mjs → chunk-A7DLBE5K.mjs} +136 -54
- package/dist/cli/{chunk-6PRW5UBA.mjs → chunk-AGICYWGN.mjs} +299 -69
- package/dist/cli/{chunk-S5S355UY.mjs → chunk-AGIQDA2T.mjs} +12 -12
- package/dist/cli/{chunk-RBEUVDZF.js → chunk-AGLR6QVN.js} +249 -107
- package/dist/cli/{chunk-NURW5XH4.mjs → chunk-ASB47RXJ.mjs} +1 -1
- package/dist/cli/{chunk-RQZQVFCJ.js → chunk-BVDKFS2T.js} +2 -2
- package/dist/cli/{chunk-PFO3ISXA.js → chunk-CACFJODG.js} +174 -129
- package/dist/cli/{chunk-6RZOWL2V.mjs → chunk-CAEBJOYU.mjs} +1 -1
- package/dist/cli/{chunk-XDVT3GOM.js → chunk-CFJFUVX2.js} +18 -1
- package/dist/cli/{chunk-6YCA5NKJ.js → chunk-DP2VH7CO.js} +12 -12
- package/dist/cli/{chunk-AWJPDPMA.mjs → chunk-DP64MD6U.mjs} +1 -1
- package/dist/cli/{chunk-PTVD2GVQ.mjs → chunk-DZA7RFGL.mjs} +5 -5
- package/dist/cli/{chunk-V436Z54K.js → chunk-E2G2DNAB.js} +3 -1
- package/dist/cli/{chunk-GGGAEVCX.mjs → chunk-E7WZOX2A.mjs} +22 -18
- package/dist/cli/{chunk-IDVVIXPJ.js → chunk-FM7LPUPA.js} +41 -41
- package/dist/cli/{chunk-AQWQ2BFX.mjs → chunk-GAVZ4EOD.mjs} +1 -1
- package/dist/cli/{chunk-GKYAYLRI.js → chunk-HEBO3XNZ.js} +27 -31
- package/dist/cli/{chunk-IYSTRCLX.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-HO3XK3R7.js → chunk-IMX7J4DU.js} +8 -8
- package/dist/cli/{chunk-EUPVF4SU.mjs → chunk-INEMTYMT.mjs} +8 -8
- package/dist/cli/{chunk-3FD5EQ62.js → chunk-IUOGII7D.js} +6 -7
- package/dist/cli/{chunk-U7QRMBIY.mjs → chunk-JJGWHITQ.mjs} +5 -5
- package/dist/cli/{chunk-SHLFOPD6.js → chunk-JLGP5XAJ.js} +5 -5
- package/dist/cli/{chunk-4TALT2M3.mjs → chunk-LFOERUQY.mjs} +69 -3
- package/dist/cli/{chunk-BBTKAASQ.js → chunk-LFQJW4S2.js} +42 -1
- package/dist/cli/{chunk-Z5TSLLOW.mjs → chunk-LH5PZKER.mjs} +63 -18
- package/dist/cli/{chunk-S46HWQKO.js → chunk-LRDHPOZW.js} +69 -69
- package/dist/cli/{chunk-6ZORHRKB.mjs → chunk-LRZGS6RZ.mjs} +2 -0
- package/dist/cli/{chunk-SL6MYJYM.js → chunk-MJTVX4QK.js} +35 -35
- package/dist/cli/{chunk-7IKQKKNX.js → chunk-MLABYI4M.js} +90 -24
- package/dist/cli/{chunk-ZIAXDBXX.mjs → chunk-NDNHYONK.mjs} +17 -21
- package/dist/cli/{chunk-YLTMXJFC.mjs → chunk-OTV2UUKW.mjs} +158 -16
- package/dist/cli/{chunk-G4O75EXF.js → chunk-Q6Z6N3A7.js} +18 -18
- package/dist/cli/{chunk-WE5HES3H.mjs → chunk-QG6JIWUL.mjs} +151 -43
- package/dist/cli/{chunk-QY3ZNU6Z.mjs → chunk-QI5S5HWB.mjs} +2 -2
- package/dist/cli/{chunk-CBV7AKWM.js → chunk-R6DZ6NQ2.js} +5 -5
- package/dist/cli/{chunk-57VZVF5D.mjs → chunk-RMNOZKRI.mjs} +3 -3
- package/dist/cli/{chunk-BAIST2BR.js → chunk-RTV4RF7N.js} +36 -36
- package/dist/cli/{chunk-JWUAX6OP.js → chunk-SBH4CKPN.js} +11 -11
- package/dist/cli/{chunk-FTJLJCE5.mjs → chunk-SG3LUONJ.mjs} +3 -3
- package/dist/cli/{chunk-2WFPHBR4.js → chunk-TFEXSHPM.js} +22 -18
- package/dist/cli/{chunk-QAORXEY3.mjs → chunk-TN4TY6TT.mjs} +6 -7
- package/dist/cli/{chunk-WEHCBH5R.mjs → chunk-UEVKMZLR.mjs} +54 -3
- package/dist/cli/{chunk-QILKGXYF.mjs → chunk-UVQJYV76.mjs} +2 -2
- package/dist/cli/{chunk-FSIVF2SI.mjs → chunk-VZGLIK5U.mjs} +1 -1
- package/dist/cli/{chunk-MF2GHZDO.js → chunk-WOCHZCUJ.js} +2 -2
- package/dist/cli/{chunk-VQALXEXO.js → chunk-XLIHTJVM.js} +348 -118
- package/dist/cli/{chunk-ADRC5I3R.js → chunk-Y6SP3JMI.js} +22 -22
- package/dist/cli/{chunk-77AAAGVB.js → chunk-YUA6HA6D.js} +2 -2
- package/dist/cli/{chunk-JL2OTMSG.mjs → chunk-Z3A2S3QM.mjs} +41 -0
- package/dist/cli/{chunk-6O5HOODW.mjs → chunk-Z6XPSHKM.mjs} +87 -41
- package/dist/cli/{chunk-QX7LFGJR.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-Q4KPAUJX.mjs → concurrent-runs-help-DNV2X5AZ.mjs} +9 -8
- package/dist/cli/{csv-F5VAGX4K.js → csv-SA6ELJY6.js} +16 -15
- package/dist/cli/{csv-2PTVDNO6.mjs → csv-ZXZGHWOM.mjs} +7 -6
- package/dist/cli/{db-IEDXAUF7.mjs → db-A54SP6AD.mjs} +16 -16
- package/dist/cli/{db-Z3OIUFMM.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-R3LP74QN.mjs → executions-HL2M2DFU.mjs} +10 -10
- package/dist/cli/{executions-H6H5655J.js → executions-TLFZRHBJ.js} +12 -12
- package/dist/cli/{feedback-VFOUR66B.js → feedback-5UEX5UZK.js} +17 -16
- package/dist/cli/{feedback-WL3MRVT5.mjs → feedback-QMBTNXVG.mjs} +9 -8
- package/dist/cli/git-4JWOOHBG.js +26 -0
- package/dist/cli/{git-YX2J4GCI.mjs → git-LKGXVIVC.mjs} +8 -7
- package/dist/cli/index.js +170 -158
- package/dist/cli/index.mjs +60 -48
- package/dist/cli/{integrations-E2JZYKHS.js → integrations-6RUTLMN7.js} +23 -27
- package/dist/cli/{integrations-5ZK5KLVP.mjs → integrations-FGGRVUJ7.mjs} +15 -19
- package/dist/cli/{legacy-noops-3VW4IJTH.js → legacy-noops-J3Z7QRWZ.js} +12 -11
- package/dist/cli/{legacy-noops-SMN3GSXY.mjs → legacy-noops-YIPRMVXZ.mjs} +9 -8
- package/dist/cli/{mcp-UQV2K4EW.js → mcp-6LWFP7RW.js} +121 -48
- package/dist/cli/{mcp-V6MGCYAG.mjs → mcp-CHDYFO7F.mjs} +100 -27
- package/dist/cli/{monitors-R3BBDCRC.js → monitors-STM6A7OU.js} +221 -186
- package/dist/cli/{monitors-GGKS5W6M.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-2MVO27VO.js → play-SM4CW2GS.js} +1116 -846
- package/dist/cli/{play-MDWPR4XG.mjs → play-SN5YWLS7.mjs} +375 -105
- package/dist/cli/{providers-AKDYFZJZ.mjs → providers-WZ4YBR5Y.mjs} +10 -10
- package/dist/cli/{providers-2AACRUZH.js → providers-WZARYMCF.js} +13 -13
- package/dist/cli/{quickstart-QDGRJFZY.mjs → quickstart-2575BNKA.mjs} +7 -6
- package/dist/cli/{quickstart-H6IV3PV3.js → quickstart-PS4YHQJ6.js} +9 -8
- package/dist/cli/{run-2634REDK.js → run-FLZ6OTM7.js} +51 -51
- package/dist/cli/{run-RTSQNGRD.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-6AOJ4XPP.mjs → search-HLPPKQEO.mjs} +11 -11
- package/dist/cli/search-JJWVHR3N.js +32 -0
- package/dist/cli/{search-output-6ADMTOU5.mjs → search-output-PDAXNOGP.mjs} +9 -8
- package/dist/cli/{search-output-S5ODBL5E.js → search-output-RXJLU36B.js} +12 -11
- package/dist/cli/{secrets-TFIFBFB3.mjs → secrets-CGELYQ3H.mjs} +11 -11
- package/dist/cli/{secrets-LHCIIHMT.js → secrets-QJNG7G2Y.js} +20 -20
- package/dist/cli/sessions-DHTBT2GN.js +23 -0
- package/dist/cli/{sessions-WHBVUHVW.mjs → sessions-ELMWVR4M.mjs} +9 -8
- package/dist/cli/{settings-CP4FVK2W.js → settings-44I44P5F.js} +89 -89
- package/dist/cli/{settings-EBONWL5C.mjs → settings-RR3LZXL7.mjs} +16 -16
- package/dist/cli/{setup-I5AZE3IU.mjs → setup-KGWRWH4B.mjs} +20 -19
- package/dist/cli/{setup-LFGHTNLQ.js → setup-KTEYOCJO.js} +60 -59
- package/dist/cli/skills-EPZPEXI2.js +37 -0
- package/dist/cli/{skills-W76AO5XE.mjs → skills-FPRID2I5.mjs} +10 -9
- package/dist/cli/tools-IGQQ5TML.js +57 -0
- package/dist/cli/{tools-7IJHGF6W.mjs → tools-PI4WMDLY.mjs} +23 -23
- package/dist/cli/update-4RNCVYGE.js +37 -0
- package/dist/cli/{update-GFOPZTHY.mjs → update-VJOJAZ7B.mjs} +14 -11
- package/dist/cli/{views-BPL2TQJ4.js → views-NTUOLNQU.js} +62 -64
- package/dist/cli/{views-D4NX4SBG.mjs → views-OVPSINZO.mjs} +47 -49
- package/dist/cli/{workflow-ZYNAUCKC.js → workflow-2UDYDM6F.js} +23 -23
- package/dist/cli/{workflow-YXP42FUI.mjs → workflow-7OEFNXZC.mjs} +13 -13
- package/dist/{client-CyXGrO4D.d.mts → client-B8f7RNF8.d.mts} +1 -1
- package/dist/{client-Bf3IpUKN.d.ts → client-C5TgXmJQ.d.ts} +1 -1
- package/dist/{client-core-BxsLnXlm.d.mts → client-core-SLLGBTht.d.mts} +268 -23
- package/dist/{client-core-BWd0lX0Z.d.ts → client-core-p0sOxnkl.d.ts} +268 -23
- package/dist/{compiler-manifest-BqwVrOri.d.ts → compiler-manifest-D_zZEh9Q.d.mts} +70 -5
- package/dist/{compiler-manifest-BqwVrOri.d.mts → 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 +161 -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-MMNVWATX.js +0 -43
- package/dist/cli/concurrent-runs-help-FQAIHKKC.js +0 -21
- package/dist/cli/describe-QDANCTS3.mjs +0 -50
- package/dist/cli/describe-VUTT5ZKU.js +0 -50
- package/dist/cli/git-ETB3GH3K.js +0 -25
- package/dist/cli/org-GRYVMNSW.js +0 -1282
- package/dist/cli/org-Z37NGJV4.mjs +0 -1282
- package/dist/cli/run-identity-G257GQED.js +0 -25
- package/dist/cli/search-VTW2YNBS.js +0 -32
- package/dist/cli/sessions-CJ4FJ2WB.js +0 -22
- package/dist/cli/skills-R7EBXREW.js +0 -36
- package/dist/cli/tools-V7U2BDXM.js +0 -57
- package/dist/cli/update-4COPZETK.js +0 -34
|
@@ -8,11 +8,13 @@
|
|
|
8
8
|
* as a wake hint, and one exact timer for the next due row. There is
|
|
9
9
|
* deliberately no worker fleet polling cadence.
|
|
10
10
|
*/
|
|
11
|
+
import { RUN_SCHEDULER_OUTBOX_EVENT_TYPE } from '../run-event-catalog';
|
|
11
12
|
import { isIsolatedRuntimeSchedulerSchema } from '../runtime-scheduler-topology';
|
|
12
13
|
import {
|
|
13
14
|
dispatchRunLedgerOutboxToLedgerBatchOnceWithClientScope,
|
|
14
15
|
postgresSchedulerNotifyChannel,
|
|
15
16
|
readPostgresSchedulerOutboxAdmissionHints,
|
|
17
|
+
readPostgresSchedulerOutboxDueRuns,
|
|
16
18
|
readPostgresSchedulerOutboxNextDueAt,
|
|
17
19
|
postgresSchedulerInlineCreatedProjectionLease,
|
|
18
20
|
type PostgresSchedulerOptions,
|
|
@@ -131,6 +133,8 @@ export type RunLedgerOutboxRecoveryDeps = {
|
|
|
131
133
|
parallelism?: number;
|
|
132
134
|
/** Fast polling is used only when the topology intentionally has no LISTEN session. */
|
|
133
135
|
notifyUnavailableSafetyWakeMs?: number;
|
|
136
|
+
/** One global claim, global clock read or bounded pass, by what asked for it. */
|
|
137
|
+
onGlobalDiscovery?: (trigger: string) => void;
|
|
134
138
|
now?: () => number;
|
|
135
139
|
setTimer?: (callback: () => void, delayMs: number) => RecoveryTimer;
|
|
136
140
|
clearTimer?: (timer: RecoveryTimer) => void;
|
|
@@ -204,21 +208,17 @@ function notificationRunId(payload: string): string | undefined {
|
|
|
204
208
|
}
|
|
205
209
|
}
|
|
206
210
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const clearTimer = deps.clearTimer ?? clearTimeout;
|
|
218
|
-
const logger = deps.logger ?? console;
|
|
211
|
+
function notificationIsAdmission(payload: string): boolean {
|
|
212
|
+
try {
|
|
213
|
+
const message = JSON.parse(payload) as { eventType?: unknown } | null;
|
|
214
|
+
return message?.eventType === RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runCreated;
|
|
215
|
+
} catch {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function recoverySlots(deps: RunLedgerOutboxRecoveryDeps) {
|
|
219
221
|
const requestedParallelism = Math.floor(deps.parallelism ?? 1);
|
|
220
|
-
const notifyUnavailableSafetyWakeMs =
|
|
221
|
-
deps.notifyUnavailableSafetyWakeMs ?? NOTIFY_UNAVAILABLE_SAFETY_WAKE_MS;
|
|
222
222
|
const parallelism = Number.isFinite(requestedParallelism)
|
|
223
223
|
? Math.max(
|
|
224
224
|
1,
|
|
@@ -243,6 +243,25 @@ export function startRunLedgerOutboxRecovery(
|
|
|
243
243
|
1,
|
|
244
244
|
parallelism - observabilityParallelism,
|
|
245
245
|
);
|
|
246
|
+
return { parallelism, observabilityParallelism, lifecycleParallelism };
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Start a bounded, work-conserving recovery controller from injected seams.
|
|
251
|
+
* Subscription happens before the first database scan, so a terminal commit
|
|
252
|
+
* cannot slip between startup scan and listener registration.
|
|
253
|
+
*/
|
|
254
|
+
export function startRunLedgerOutboxRecovery(
|
|
255
|
+
deps: RunLedgerOutboxRecoveryDeps,
|
|
256
|
+
): RunLedgerOutboxRecoveryController {
|
|
257
|
+
const now = deps.now ?? Date.now;
|
|
258
|
+
const setTimer = deps.setTimer ?? setTimeout;
|
|
259
|
+
const clearTimer = deps.clearTimer ?? clearTimeout;
|
|
260
|
+
const logger = deps.logger ?? console;
|
|
261
|
+
const notifyUnavailableSafetyWakeMs =
|
|
262
|
+
deps.notifyUnavailableSafetyWakeMs ?? NOTIFY_UNAVAILABLE_SAFETY_WAKE_MS;
|
|
263
|
+
const { parallelism, observabilityParallelism, lifecycleParallelism } =
|
|
264
|
+
recoverySlots(deps);
|
|
246
265
|
let observabilityRequested = false;
|
|
247
266
|
let closed = false;
|
|
248
267
|
let requested = false;
|
|
@@ -265,6 +284,8 @@ export function startRunLedgerOutboxRecovery(
|
|
|
265
284
|
let unsubscribeNotify: (() => void) | undefined;
|
|
266
285
|
let unsubscribeState: (() => void) | undefined;
|
|
267
286
|
let requestDrain: (reason: string, runId?: string) => void = () => undefined;
|
|
287
|
+
// What the next global claim should be attributed to.
|
|
288
|
+
let globalTrigger = 'unknown';
|
|
268
289
|
const lifecycleRunHints = new Set<string>();
|
|
269
290
|
const observabilityRunHints = new Set<string>();
|
|
270
291
|
const hasRequests = () =>
|
|
@@ -279,6 +300,7 @@ export function startRunLedgerOutboxRecovery(
|
|
|
279
300
|
// claim must still rediscover their clocks.
|
|
280
301
|
hints.clear();
|
|
281
302
|
dueClockKnownLane = null;
|
|
303
|
+
globalTrigger = 'overflow';
|
|
282
304
|
return false;
|
|
283
305
|
};
|
|
284
306
|
const takeRunHint = (hints: Set<string>) => {
|
|
@@ -381,6 +403,7 @@ export function startRunLedgerOutboxRecovery(
|
|
|
381
403
|
dueClockKnownLane = null;
|
|
382
404
|
requested = true;
|
|
383
405
|
observabilityRequested = !!deps.dispatchObservabilityOnce;
|
|
406
|
+
globalTrigger = reason;
|
|
384
407
|
lifecycleRunHints.clear();
|
|
385
408
|
observabilityRunHints.clear();
|
|
386
409
|
} else {
|
|
@@ -480,6 +503,7 @@ export function startRunLedgerOutboxRecovery(
|
|
|
480
503
|
lane: Exclude<ReturnType<typeof dueClockLane>, null>,
|
|
481
504
|
): Promise<void> => {
|
|
482
505
|
let dueAt: Date | null;
|
|
506
|
+
deps.onGlobalDiscovery?.('due_clock');
|
|
483
507
|
try {
|
|
484
508
|
dueAt = await deps.readNextDueAt(lane === 'both' ? undefined : lane);
|
|
485
509
|
} catch (error) {
|
|
@@ -632,8 +656,11 @@ export function startRunLedgerOutboxRecovery(
|
|
|
632
656
|
origin: LifecycleOrigin = runId === undefined
|
|
633
657
|
? 'global'
|
|
634
658
|
: 'producer_hint',
|
|
659
|
+
trigger?: string,
|
|
635
660
|
) => {
|
|
636
661
|
const id = Symbol();
|
|
662
|
+
if (runId === undefined)
|
|
663
|
+
deps.onGlobalDiscovery?.(trigger ?? globalTrigger);
|
|
637
664
|
if (
|
|
638
665
|
!observability &&
|
|
639
666
|
origin === 'global' &&
|
|
@@ -760,7 +787,7 @@ export function startRunLedgerOutboxRecovery(
|
|
|
760
787
|
pendingObservability.size < observabilityParallelism &&
|
|
761
788
|
pending.size < parallelism
|
|
762
789
|
)
|
|
763
|
-
launch(true);
|
|
790
|
+
launch(true, undefined, 'global', 'refill');
|
|
764
791
|
observabilityRefill = false;
|
|
765
792
|
}
|
|
766
793
|
if (refill) {
|
|
@@ -929,6 +956,457 @@ export function startRunLedgerOutboxRecovery(
|
|
|
929
956
|
};
|
|
930
957
|
}
|
|
931
958
|
|
|
959
|
+
/** Process switch for Bounded Discovery. Temporary; deleted after the soak. */
|
|
960
|
+
export const RUN_LEDGER_BOUNDED_DISCOVERY_ENV =
|
|
961
|
+
'DEEPLINE_RUN_LEDGER_BOUNDED_DISCOVERY';
|
|
962
|
+
export const BOUNDED_DISCOVERY_INTERVAL_MS = 30_000;
|
|
963
|
+
export const BOUNDED_DISCOVERY_LISTEN_DOWN_INTERVAL_MS = 5_000;
|
|
964
|
+
export const BOUNDED_DISCOVERY_PAGE_LIMIT = 1_000;
|
|
965
|
+
export const BOUNDED_DISCOVERY_MAX_RUN_HINTS = 10_000;
|
|
966
|
+
export const BOUNDED_DISCOVERY_MAX_RUN_TIMERS = 10_000;
|
|
967
|
+
export const BOUNDED_DISCOVERY_TIMER_FLOOR_MS = 1_000;
|
|
968
|
+
const BOUNDED_DISCOVERY_ORDINARY_TURN = 4;
|
|
969
|
+
|
|
970
|
+
/** Explicit opt-in applies to both Production and isolated Preview. */
|
|
971
|
+
export function runLedgerBoundedDiscoveryEnabled(
|
|
972
|
+
env: NodeJS.ProcessEnv,
|
|
973
|
+
): boolean {
|
|
974
|
+
return env[RUN_LEDGER_BOUNDED_DISCOVERY_ENV]?.trim() === 'true';
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
export type RunLedgerOutboxBoundedDiscoveryDeps =
|
|
978
|
+
RunLedgerOutboxRecoveryDeps & {
|
|
979
|
+
/** Hints and timers dropped at their bounds since the last report. */
|
|
980
|
+
onDiscoveryOverflow?: (dropped: number) => void;
|
|
981
|
+
readDueRuns: (input: {
|
|
982
|
+
afterRunId: string | null;
|
|
983
|
+
limit: number;
|
|
984
|
+
}) => Promise<{
|
|
985
|
+
rows: {
|
|
986
|
+
runId: string;
|
|
987
|
+
searchOnly: boolean;
|
|
988
|
+
dueAt: Date;
|
|
989
|
+
admission: boolean;
|
|
990
|
+
}[];
|
|
991
|
+
cursor: string | null;
|
|
992
|
+
}>;
|
|
993
|
+
};
|
|
994
|
+
|
|
995
|
+
type BoundedHintLane = 'admission' | 'lifecycle' | 'observability';
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* Bounded Discovery: a periodic page of due runs replaces every whole-outbox
|
|
999
|
+
* scan, and every claim names a run. Hints and timers grant nothing (the row
|
|
1000
|
+
* lease decides) and may all be lost, because the next passes rebuild them.
|
|
1001
|
+
*/
|
|
1002
|
+
export function startBoundedRunLedgerOutboxRecovery(
|
|
1003
|
+
deps: RunLedgerOutboxBoundedDiscoveryDeps,
|
|
1004
|
+
): RunLedgerOutboxRecoveryController {
|
|
1005
|
+
const listenDownIntervalMs =
|
|
1006
|
+
deps.notifyUnavailableSafetyWakeMs ??
|
|
1007
|
+
BOUNDED_DISCOVERY_LISTEN_DOWN_INTERVAL_MS;
|
|
1008
|
+
const now = deps.now ?? Date.now;
|
|
1009
|
+
const setTimer = deps.setTimer ?? setTimeout;
|
|
1010
|
+
const clearTimer = deps.clearTimer ?? clearTimeout;
|
|
1011
|
+
const logger = deps.logger ?? console;
|
|
1012
|
+
const { parallelism, observabilityParallelism, lifecycleParallelism } =
|
|
1013
|
+
recoverySlots(deps);
|
|
1014
|
+
const hints: Record<BoundedHintLane, Set<string>> = {
|
|
1015
|
+
admission: new Set(),
|
|
1016
|
+
lifecycle: new Set(),
|
|
1017
|
+
observability: new Set(),
|
|
1018
|
+
};
|
|
1019
|
+
// `${lane}:${runId}` to due time. One timer serves the earliest.
|
|
1020
|
+
const runDueMs = new Map<string, number>();
|
|
1021
|
+
const work = new Set<Promise<void>>();
|
|
1022
|
+
const inFlightStartedAt = new Map<number, number>();
|
|
1023
|
+
const inFlight = { lifecycle: 0, observability: 0 };
|
|
1024
|
+
const wave = {
|
|
1025
|
+
completed: 0,
|
|
1026
|
+
attempted: 0,
|
|
1027
|
+
projected: 0,
|
|
1028
|
+
retrying: 0,
|
|
1029
|
+
blocked: 0,
|
|
1030
|
+
};
|
|
1031
|
+
let closed = false;
|
|
1032
|
+
let cursor: string | null = null;
|
|
1033
|
+
let dropped = 0;
|
|
1034
|
+
let claimTurns = 0;
|
|
1035
|
+
let nextDispatchId = 0;
|
|
1036
|
+
let lastDispatchSettledAt: number | null = null;
|
|
1037
|
+
let claimFailures = 0;
|
|
1038
|
+
let discoveryFailures = 0;
|
|
1039
|
+
let cooldownUntilMs: number | null = null;
|
|
1040
|
+
let cooldownTimer: RecoveryTimer | null = null;
|
|
1041
|
+
let discoveryTimer: RecoveryTimer | null = null;
|
|
1042
|
+
let discoveryTimerAtMs: number | null = null;
|
|
1043
|
+
let runTimer: RecoveryTimer | null = null;
|
|
1044
|
+
let runTimerAtMs: number | null = null;
|
|
1045
|
+
let discovery: Promise<void> | null = null;
|
|
1046
|
+
let rerunReason: string | null = null;
|
|
1047
|
+
// The last pass found work and more pages remain in this cursor cycle.
|
|
1048
|
+
let continuationPending = false;
|
|
1049
|
+
let hubLease: PgNotifyHubLease | null = null;
|
|
1050
|
+
let unsubscribeNotify: (() => void) | undefined;
|
|
1051
|
+
let unsubscribeState: (() => void) | undefined;
|
|
1052
|
+
|
|
1053
|
+
const listenerIsAvailable = () => hubLease?.hub.state() === 'listening';
|
|
1054
|
+
|
|
1055
|
+
const addHint = (lane: BoundedHintLane, runId: string) => {
|
|
1056
|
+
if (closed) return;
|
|
1057
|
+
if (lane === 'lifecycle' && hints.admission.has(runId)) return;
|
|
1058
|
+
if (lane === 'admission') hints.lifecycle.delete(runId);
|
|
1059
|
+
const set = hints[lane];
|
|
1060
|
+
if (set.has(runId)) return;
|
|
1061
|
+
// The outbox row holds the truth, so the next passes restore a drop.
|
|
1062
|
+
if (set.size >= BOUNDED_DISCOVERY_MAX_RUN_HINTS) dropped += 1;
|
|
1063
|
+
else set.add(runId);
|
|
1064
|
+
};
|
|
1065
|
+
const takeHint = (lane: BoundedHintLane) => {
|
|
1066
|
+
const runId = hints[lane].values().next().value;
|
|
1067
|
+
if (runId !== undefined) hints[lane].delete(runId);
|
|
1068
|
+
return runId;
|
|
1069
|
+
};
|
|
1070
|
+
|
|
1071
|
+
const armRunTimer = (dueMs: number): void => {
|
|
1072
|
+
// The floor means a past-due leased head cannot spin this timer.
|
|
1073
|
+
const atMs = Math.max(dueMs, now() + BOUNDED_DISCOVERY_TIMER_FLOOR_MS);
|
|
1074
|
+
if (runTimerAtMs !== null && runTimerAtMs <= atMs) return;
|
|
1075
|
+
if (runTimer) clearTimer(runTimer);
|
|
1076
|
+
runTimerAtMs = atMs;
|
|
1077
|
+
runTimer = setTimer(fireRunTimer, Math.min(MAX_TIMEOUT_MS, atMs - now()));
|
|
1078
|
+
runTimer.unref?.();
|
|
1079
|
+
};
|
|
1080
|
+
const fireRunTimer = (): void => {
|
|
1081
|
+
runTimer = null;
|
|
1082
|
+
runTimerAtMs = null;
|
|
1083
|
+
let earliest = Infinity;
|
|
1084
|
+
for (const [key, dueMs] of runDueMs) {
|
|
1085
|
+
if (dueMs <= now()) {
|
|
1086
|
+
runDueMs.delete(key);
|
|
1087
|
+
const separator = key.indexOf(':');
|
|
1088
|
+
addHint(
|
|
1089
|
+
key.slice(0, separator) as BoundedHintLane,
|
|
1090
|
+
key.slice(separator + 1),
|
|
1091
|
+
);
|
|
1092
|
+
} else earliest = Math.min(earliest, dueMs);
|
|
1093
|
+
}
|
|
1094
|
+
if (Number.isFinite(earliest)) armRunTimer(earliest);
|
|
1095
|
+
pump();
|
|
1096
|
+
};
|
|
1097
|
+
const setRunDue = (lane: BoundedHintLane, runId: string, dueMs: number) => {
|
|
1098
|
+
if (closed) return;
|
|
1099
|
+
const key = `${lane}:${runId}`;
|
|
1100
|
+
const known = runDueMs.get(key);
|
|
1101
|
+
if (
|
|
1102
|
+
known === undefined &&
|
|
1103
|
+
runDueMs.size >= BOUNDED_DISCOVERY_MAX_RUN_TIMERS
|
|
1104
|
+
) {
|
|
1105
|
+
dropped += 1;
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
runDueMs.set(key, Math.min(known ?? Infinity, dueMs));
|
|
1109
|
+
armRunTimer(dueMs);
|
|
1110
|
+
};
|
|
1111
|
+
|
|
1112
|
+
const track = (promise: Promise<void>) => {
|
|
1113
|
+
const tracked: Promise<void> = promise.finally(() => work.delete(tracked));
|
|
1114
|
+
work.add(tracked);
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
/** Any claim that comes back empty learns only that run's own clock. */
|
|
1118
|
+
const readRunClock = async (
|
|
1119
|
+
lane: 'lifecycle' | 'observability',
|
|
1120
|
+
runId: string,
|
|
1121
|
+
): Promise<void> => {
|
|
1122
|
+
try {
|
|
1123
|
+
const dueAt = await deps.readNextDueAt(lane, runId);
|
|
1124
|
+
if (dueAt) setRunDue(lane, runId, dueAt.getTime());
|
|
1125
|
+
} catch (error) {
|
|
1126
|
+
// Discovery covers this run; hold no failure state for one clock.
|
|
1127
|
+
logger.warn('[run-ledger-outbox.recovery_retry]', {
|
|
1128
|
+
stage: 'run_due',
|
|
1129
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
};
|
|
1133
|
+
|
|
1134
|
+
const reportWave = () => {
|
|
1135
|
+
if (wave.attempted > 0) {
|
|
1136
|
+
logger.info('[run-ledger-outbox.recovery_wave]', {
|
|
1137
|
+
reason: 'bounded_discovery',
|
|
1138
|
+
parallelism,
|
|
1139
|
+
attempted: wave.attempted,
|
|
1140
|
+
projected: wave.projected,
|
|
1141
|
+
retrying: wave.retrying,
|
|
1142
|
+
blocked: wave.blocked,
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
wave.completed = wave.attempted = wave.projected = 0;
|
|
1146
|
+
wave.retrying = wave.blocked = 0;
|
|
1147
|
+
};
|
|
1148
|
+
|
|
1149
|
+
const enterCooldown = (error: unknown): void => {
|
|
1150
|
+
claimFailures += 1;
|
|
1151
|
+
const delayMs = listenerIsAvailable()
|
|
1152
|
+
? boundedFailureDelayMs(claimFailures)
|
|
1153
|
+
: listenDownIntervalMs;
|
|
1154
|
+
logger.warn('[run-ledger-outbox.recovery_retry]', {
|
|
1155
|
+
stage: 'dispatch',
|
|
1156
|
+
delayMs,
|
|
1157
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1158
|
+
});
|
|
1159
|
+
if (closed || cooldownUntilMs !== null) return;
|
|
1160
|
+
cooldownUntilMs = now() + delayMs;
|
|
1161
|
+
cooldownTimer = setTimer(() => {
|
|
1162
|
+
cooldownTimer = null;
|
|
1163
|
+
cooldownUntilMs = null;
|
|
1164
|
+
discover('recovery_error_retry');
|
|
1165
|
+
pump();
|
|
1166
|
+
}, delayMs);
|
|
1167
|
+
cooldownTimer.unref?.();
|
|
1168
|
+
};
|
|
1169
|
+
|
|
1170
|
+
const claim = async (lane: BoundedHintLane, runId: string): Promise<void> => {
|
|
1171
|
+
const observability = lane === 'observability';
|
|
1172
|
+
const slot = observability ? 'observability' : 'lifecycle';
|
|
1173
|
+
const id = nextDispatchId++;
|
|
1174
|
+
inFlight[slot] += 1;
|
|
1175
|
+
inFlightStartedAt.set(id, now());
|
|
1176
|
+
try {
|
|
1177
|
+
const result = await (observability
|
|
1178
|
+
? deps.dispatchObservabilityOnce!(runId)
|
|
1179
|
+
: deps.dispatchOnce('admission_first', runId));
|
|
1180
|
+
if (result.retrying > 0) {
|
|
1181
|
+
logger.warn('[run-ledger-outbox.recovery_retry]', {
|
|
1182
|
+
stage: 'projection',
|
|
1183
|
+
retrying: result.retrying,
|
|
1184
|
+
});
|
|
1185
|
+
} else claimFailures = 0;
|
|
1186
|
+
wave.completed += 1;
|
|
1187
|
+
wave.attempted += result.attempted;
|
|
1188
|
+
wave.projected += result.projected;
|
|
1189
|
+
wave.retrying += result.retrying;
|
|
1190
|
+
wave.blocked += result.failed;
|
|
1191
|
+
// Continue the run until a claim is empty: only then is its clock known,
|
|
1192
|
+
// including a retry this claim just committed.
|
|
1193
|
+
if (result.attempted > 0) addHint(slot, runId);
|
|
1194
|
+
else if (!closed) track(readRunClock(slot, runId));
|
|
1195
|
+
} catch (error) {
|
|
1196
|
+
addHint(lane, runId);
|
|
1197
|
+
enterCooldown(error);
|
|
1198
|
+
} finally {
|
|
1199
|
+
inFlight[slot] -= 1;
|
|
1200
|
+
inFlightStartedAt.delete(id);
|
|
1201
|
+
lastDispatchSettledAt = now();
|
|
1202
|
+
if (
|
|
1203
|
+
wave.completed >= parallelism ||
|
|
1204
|
+
(wave.completed > 0 && inFlightStartedAt.size === 0)
|
|
1205
|
+
)
|
|
1206
|
+
reportWave();
|
|
1207
|
+
pump();
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
|
|
1211
|
+
/** Admission first; every fourth claim serves ordinary work so it cannot starve. */
|
|
1212
|
+
const nextLifecycleHint = (): {
|
|
1213
|
+
lane: BoundedHintLane;
|
|
1214
|
+
runId: string;
|
|
1215
|
+
} | null => {
|
|
1216
|
+
claimTurns += 1;
|
|
1217
|
+
const order: BoundedHintLane[] =
|
|
1218
|
+
claimTurns % BOUNDED_DISCOVERY_ORDINARY_TURN === 0
|
|
1219
|
+
? ['lifecycle', 'admission']
|
|
1220
|
+
: ['admission', 'lifecycle'];
|
|
1221
|
+
for (const lane of order) {
|
|
1222
|
+
const runId = takeHint(lane);
|
|
1223
|
+
if (runId !== undefined) return { lane, runId };
|
|
1224
|
+
}
|
|
1225
|
+
return null;
|
|
1226
|
+
};
|
|
1227
|
+
|
|
1228
|
+
function pump(): void {
|
|
1229
|
+
if (closed || cooldownUntilMs !== null) return;
|
|
1230
|
+
while (
|
|
1231
|
+
inFlight.observability < observabilityParallelism &&
|
|
1232
|
+
hints.observability.size > 0
|
|
1233
|
+
) {
|
|
1234
|
+
track(claim('observability', takeHint('observability')!));
|
|
1235
|
+
}
|
|
1236
|
+
while (
|
|
1237
|
+
inFlight.lifecycle < lifecycleParallelism &&
|
|
1238
|
+
hints.admission.size + hints.lifecycle.size > 0
|
|
1239
|
+
) {
|
|
1240
|
+
const next = nextLifecycleHint()!;
|
|
1241
|
+
track(claim(next.lane, next.runId));
|
|
1242
|
+
}
|
|
1243
|
+
continueDiscovery();
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
/**
|
|
1247
|
+
* A backlog larger than one page must not wait on the interval while slots
|
|
1248
|
+
* idle. The cursor only advances, so this ends with the cycle at the latest.
|
|
1249
|
+
*/
|
|
1250
|
+
function continueDiscovery(): void {
|
|
1251
|
+
if (
|
|
1252
|
+
!continuationPending ||
|
|
1253
|
+
discovery ||
|
|
1254
|
+
Object.values(hints).some(
|
|
1255
|
+
(set) => set.size >= BOUNDED_DISCOVERY_MAX_RUN_HINTS / 2,
|
|
1256
|
+
)
|
|
1257
|
+
)
|
|
1258
|
+
return;
|
|
1259
|
+
continuationPending = false;
|
|
1260
|
+
discover('continuation');
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
const armDiscovery = (delayMs: number, reason: string): void => {
|
|
1264
|
+
if (closed) return;
|
|
1265
|
+
if (discoveryTimer) clearTimer(discoveryTimer);
|
|
1266
|
+
discoveryTimerAtMs = now() + delayMs;
|
|
1267
|
+
discoveryTimer = setTimer(() => {
|
|
1268
|
+
discoveryTimer = null;
|
|
1269
|
+
discoveryTimerAtMs = null;
|
|
1270
|
+
if (!listenerIsAvailable()) attachNotifyHub();
|
|
1271
|
+
discover(reason);
|
|
1272
|
+
}, delayMs);
|
|
1273
|
+
discoveryTimer.unref?.();
|
|
1274
|
+
};
|
|
1275
|
+
const discoveryIntervalMs = () =>
|
|
1276
|
+
listenerIsAvailable()
|
|
1277
|
+
? BOUNDED_DISCOVERY_INTERVAL_MS
|
|
1278
|
+
: listenDownIntervalMs;
|
|
1279
|
+
|
|
1280
|
+
const discoveryPass = async (): Promise<void> => {
|
|
1281
|
+
let page: Awaited<ReturnType<typeof deps.readDueRuns>>;
|
|
1282
|
+
try {
|
|
1283
|
+
page = await deps.readDueRuns({
|
|
1284
|
+
afterRunId: cursor,
|
|
1285
|
+
limit: BOUNDED_DISCOVERY_PAGE_LIMIT,
|
|
1286
|
+
});
|
|
1287
|
+
} catch (error) {
|
|
1288
|
+
// Hints already held keep draining; only discovery backs off.
|
|
1289
|
+
discoveryFailures += 1;
|
|
1290
|
+
rerunReason = null;
|
|
1291
|
+
continuationPending = false;
|
|
1292
|
+
const delayMs = Math.min(
|
|
1293
|
+
boundedFailureDelayMs(discoveryFailures),
|
|
1294
|
+
listenerIsAvailable() ? Infinity : discoveryIntervalMs(),
|
|
1295
|
+
);
|
|
1296
|
+
logger.warn('[run-ledger-outbox.recovery_retry]', {
|
|
1297
|
+
stage: 'discovery',
|
|
1298
|
+
delayMs,
|
|
1299
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1300
|
+
});
|
|
1301
|
+
armDiscovery(delayMs, 'recovery_error_retry');
|
|
1302
|
+
return;
|
|
1303
|
+
}
|
|
1304
|
+
if (closed) return;
|
|
1305
|
+
discoveryFailures = 0;
|
|
1306
|
+
cursor = page.cursor;
|
|
1307
|
+
continuationPending = page.cursor !== null && page.rows.length > 0;
|
|
1308
|
+
for (const row of page.rows) {
|
|
1309
|
+
const lane: BoundedHintLane = row.searchOnly
|
|
1310
|
+
? 'observability'
|
|
1311
|
+
: row.admission
|
|
1312
|
+
? 'admission'
|
|
1313
|
+
: 'lifecycle';
|
|
1314
|
+
if (row.dueAt.getTime() <= now()) addHint(lane, row.runId);
|
|
1315
|
+
else setRunDue(lane, row.runId, row.dueAt.getTime());
|
|
1316
|
+
}
|
|
1317
|
+
if (dropped > 0) {
|
|
1318
|
+
logger.warn('[run-ledger-outbox.bounded_discovery_overflow]', {
|
|
1319
|
+
dropped,
|
|
1320
|
+
});
|
|
1321
|
+
deps.onDiscoveryOverflow?.(dropped);
|
|
1322
|
+
dropped = 0;
|
|
1323
|
+
}
|
|
1324
|
+
armDiscovery(discoveryIntervalMs(), 'interval');
|
|
1325
|
+
pump();
|
|
1326
|
+
};
|
|
1327
|
+
|
|
1328
|
+
// Single-flight. A cooldown's expiry always discovers, so it owns the next pass.
|
|
1329
|
+
function discover(reason: string): void {
|
|
1330
|
+
if (closed || cooldownUntilMs !== null) return;
|
|
1331
|
+
if (discovery) {
|
|
1332
|
+
// Its snapshot may predate whatever asked; run once more after it.
|
|
1333
|
+
rerunReason = reason;
|
|
1334
|
+
return;
|
|
1335
|
+
}
|
|
1336
|
+
deps.onGlobalDiscovery?.(`bounded_${reason}`);
|
|
1337
|
+
discovery = discoveryPass().finally(() => {
|
|
1338
|
+
discovery = null;
|
|
1339
|
+
const again = rerunReason;
|
|
1340
|
+
rerunReason = null;
|
|
1341
|
+
if (again !== null) discover(again);
|
|
1342
|
+
else continueDiscovery();
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
function attachNotifyHub(): void {
|
|
1347
|
+
if (closed || hubLease) return;
|
|
1348
|
+
const lease = deps.acquireNotifyHub();
|
|
1349
|
+
if (!lease) return;
|
|
1350
|
+
hubLease = lease;
|
|
1351
|
+
unsubscribeNotify = lease.hub.subscribe((payload) => {
|
|
1352
|
+
const runId = notificationRunId(payload);
|
|
1353
|
+
if (runId === undefined) {
|
|
1354
|
+
discover('postgres_notify');
|
|
1355
|
+
return;
|
|
1356
|
+
}
|
|
1357
|
+
addHint(
|
|
1358
|
+
notificationIsAdmission(payload) ? 'admission' : 'lifecycle',
|
|
1359
|
+
runId,
|
|
1360
|
+
);
|
|
1361
|
+
if (deps.dispatchObservabilityOnce) addHint('observability', runId);
|
|
1362
|
+
pump();
|
|
1363
|
+
});
|
|
1364
|
+
unsubscribeState = lease.hub.subscribeState((state) => {
|
|
1365
|
+
if (state === 'listening') {
|
|
1366
|
+
discover('listener_connected');
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1369
|
+
const atMs = now() + listenDownIntervalMs;
|
|
1370
|
+
if (discoveryTimerAtMs !== null && discoveryTimerAtMs > atMs)
|
|
1371
|
+
armDiscovery(listenDownIntervalMs, 'interval');
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
// Subscribe first, so a commit cannot slip between the first page and LISTEN.
|
|
1376
|
+
attachNotifyHub();
|
|
1377
|
+
discover('startup');
|
|
1378
|
+
|
|
1379
|
+
return {
|
|
1380
|
+
wake: (reason = 'external_safety_wake') => discover(reason),
|
|
1381
|
+
notifyState: () => hubLease?.hub.state() ?? 'unavailable',
|
|
1382
|
+
drainHealth: () => {
|
|
1383
|
+
let oldest: number | null = null;
|
|
1384
|
+
for (const startedAt of inFlightStartedAt.values()) {
|
|
1385
|
+
if (oldest === null || startedAt < oldest) oldest = startedAt;
|
|
1386
|
+
}
|
|
1387
|
+
return {
|
|
1388
|
+
inFlightDispatches: inFlightStartedAt.size,
|
|
1389
|
+
oldestInFlightStartedAt: oldest,
|
|
1390
|
+
lastDispatchSettledAt,
|
|
1391
|
+
};
|
|
1392
|
+
},
|
|
1393
|
+
close: async () => {
|
|
1394
|
+
if (closed) return;
|
|
1395
|
+
closed = true;
|
|
1396
|
+
for (const timer of [discoveryTimer, runTimer, cooldownTimer]) {
|
|
1397
|
+
if (timer) clearTimer(timer);
|
|
1398
|
+
}
|
|
1399
|
+
for (const set of Object.values(hints)) set.clear();
|
|
1400
|
+
runDueMs.clear();
|
|
1401
|
+
unsubscribeNotify?.();
|
|
1402
|
+
unsubscribeState?.();
|
|
1403
|
+
await discovery;
|
|
1404
|
+
await Promise.all(work);
|
|
1405
|
+
hubLease?.release();
|
|
1406
|
+
},
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
|
|
932
1410
|
/**
|
|
933
1411
|
* Latency budget for the inline `run.created` attempt made by an admitting
|
|
934
1412
|
* process after its Runtime Postgres commit. The whole attempt (claim, token,
|
|
@@ -1188,6 +1666,10 @@ export function startRunLedgerOutboxRecoveryController(input: {
|
|
|
1188
1666
|
useDirectNotify?: boolean;
|
|
1189
1667
|
/** Observation hook for acknowledged rows (lag metrics). */
|
|
1190
1668
|
onDelivered?: (deliveries: readonly RunLedgerOutboxDeliveredRow[]) => void;
|
|
1669
|
+
/** Per-run claims from bounded pages. Never honored for isolated schemas. */
|
|
1670
|
+
boundedDiscovery?: boolean;
|
|
1671
|
+
onGlobalDiscovery?: RunLedgerOutboxRecoveryDeps['onGlobalDiscovery'];
|
|
1672
|
+
onDiscoveryOverflow?: RunLedgerOutboxBoundedDiscoveryDeps['onDiscoveryOverflow'];
|
|
1191
1673
|
}): RunLedgerOutboxRecoveryController {
|
|
1192
1674
|
const schedulerOptions = input.schedulerOptions ?? {};
|
|
1193
1675
|
const environment = input.environment ?? 'production';
|
|
@@ -1233,7 +1715,10 @@ export function startRunLedgerOutboxRecoveryController(input: {
|
|
|
1233
1715
|
},
|
|
1234
1716
|
schedulerOptions,
|
|
1235
1717
|
);
|
|
1236
|
-
|
|
1718
|
+
const deps: RunLedgerOutboxRecoveryDeps = {
|
|
1719
|
+
...(input.onGlobalDiscovery
|
|
1720
|
+
? { onGlobalDiscovery: input.onGlobalDiscovery }
|
|
1721
|
+
: {}),
|
|
1237
1722
|
acquireNotifyHub: () =>
|
|
1238
1723
|
input.useDirectNotify === false
|
|
1239
1724
|
? null
|
|
@@ -1270,6 +1755,22 @@ export function startRunLedgerOutboxRecoveryController(input: {
|
|
|
1270
1755
|
runId,
|
|
1271
1756
|
}),
|
|
1272
1757
|
),
|
|
1758
|
+
};
|
|
1759
|
+
if (!input.boundedDiscovery) return startRunLedgerOutboxRecovery(deps);
|
|
1760
|
+
return startBoundedRunLedgerOutboxRecovery({
|
|
1761
|
+
...deps,
|
|
1762
|
+
notifyUnavailableSafetyWakeMs: isIsolatedRuntimeSchedulerSchema(
|
|
1763
|
+
schedulerOptions.schema,
|
|
1764
|
+
)
|
|
1765
|
+
? ISOLATED_NOTIFY_UNAVAILABLE_SAFETY_WAKE_MS
|
|
1766
|
+
: BOUNDED_DISCOVERY_LISTEN_DOWN_INTERVAL_MS,
|
|
1767
|
+
...(input.onDiscoveryOverflow
|
|
1768
|
+
? { onDiscoveryOverflow: input.onDiscoveryOverflow }
|
|
1769
|
+
: {}),
|
|
1770
|
+
readDueRuns: (page) =>
|
|
1771
|
+
withRuntimeSchedulerClient(input.poolOptions, (client) =>
|
|
1772
|
+
readPostgresSchedulerOutboxDueRuns(client, page, schedulerOptions),
|
|
1773
|
+
),
|
|
1273
1774
|
});
|
|
1274
1775
|
}
|
|
1275
1776
|
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PlaySchedulerSubmitInput } from '../scheduler-backend';
|
|
2
2
|
|
|
3
3
|
const RUNTIME_EXECUTION_RECOVERY_DEPLOYMENT_HOST_RE =
|
|
4
|
-
/^deepline(?:-api-[a-z0-9]+|-(?!api-)[a-z0-9]
|
|
4
|
+
/^deepline(?:-api-[a-z0-9]+|-(?!api-)[a-z0-9]+|-api-r2-oidc-preview-[a-z0-9]{9})-aero-team-0f650658\.vercel\.app$/;
|
|
5
5
|
|
|
6
6
|
/** A recovery reader must remain on one immutable, Deepline-owned app build. */
|
|
7
7
|
export function isImmutableRuntimeExecutionRecoveryOrigin(
|
|
@@ -146,6 +146,15 @@ function receiptValueBindings(input: { orgId: string; receiptKey: string }): {
|
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
/** Every receipt value one workspace owns. */
|
|
150
|
+
export function runtimeReceiptValueOrgStoragePrefix(orgId: string): string {
|
|
151
|
+
const { orgBinding } = receiptValueBindings({
|
|
152
|
+
orgId: requiredNonempty(orgId, 'orgId'),
|
|
153
|
+
receiptKey: '',
|
|
154
|
+
});
|
|
155
|
+
return `runtime/receipt-values/v1/${orgBinding}/`;
|
|
156
|
+
}
|
|
157
|
+
|
|
149
158
|
export function runtimeReceiptValueStorageKey(input: {
|
|
150
159
|
orgId: string;
|
|
151
160
|
receiptKey: string;
|