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
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts
CHANGED
|
@@ -3,9 +3,18 @@ import dns from 'node:dns';
|
|
|
3
3
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
4
|
import {
|
|
5
5
|
readCarriedExperimentSwitchOverrides,
|
|
6
|
+
resolveExperimentSwitch,
|
|
6
7
|
type ExperimentSwitchOverrides,
|
|
7
8
|
} from '../experiment-switches';
|
|
8
9
|
import { parseEarlySandboxClaimOwner } from './early-sandbox-claim-affinity';
|
|
10
|
+
import {
|
|
11
|
+
EARLY_SANDBOX_LISTENER_HINT,
|
|
12
|
+
parseEarlySandboxListenerGeneration,
|
|
13
|
+
parseEarlySandboxListenerQueue,
|
|
14
|
+
parseEarlySandboxListenerStatus,
|
|
15
|
+
selectEarlySandboxListener,
|
|
16
|
+
type EarlySandboxListenerStatus,
|
|
17
|
+
} from './early-sandbox-listener-hint';
|
|
9
18
|
|
|
10
19
|
export const RUNTIME_WORKER_WAKE_PATH = '/internal/runtime-worker/wake';
|
|
11
20
|
|
|
@@ -72,6 +81,22 @@ export function runtimeWorkerWakeTargetFromEnv(
|
|
|
72
81
|
return url && token ? { url, token } : null;
|
|
73
82
|
}
|
|
74
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Deployment-owned target for the early-sandbox hint relay only. Its own
|
|
86
|
+
* setting (`DEEPLINE_RUNTIME_WORKER_EARLY_SANDBOX_URL`) lets a deployment
|
|
87
|
+
* relay hints without also turning on terminal and generic worker wakes,
|
|
88
|
+
* which read `DEEPLINE_RUNTIME_WORKER_WAKE_URL`. Absent: the wake target, so
|
|
89
|
+
* a Preview lane that sets only the wake URL relays hints as before.
|
|
90
|
+
*/
|
|
91
|
+
export function runtimeWorkerEarlySandboxTargetFromEnv(
|
|
92
|
+
env: Record<string, string | undefined> = process.env,
|
|
93
|
+
): RuntimeWorkerWakeTarget | null {
|
|
94
|
+
const url = env.DEEPLINE_RUNTIME_WORKER_EARLY_SANDBOX_URL?.trim();
|
|
95
|
+
const token = env.DEEPLINE_INTERNAL_TOKEN?.trim();
|
|
96
|
+
if (url) return token ? { url, token } : null;
|
|
97
|
+
return runtimeWorkerWakeTargetFromEnv(env);
|
|
98
|
+
}
|
|
99
|
+
|
|
75
100
|
/** A bounded hint, never a retry, admission, or correctness dependency. */
|
|
76
101
|
export async function requestRuntimeWorkerWake(
|
|
77
102
|
target: RuntimeWorkerWakeTarget,
|
|
@@ -202,6 +227,13 @@ export type RuntimeWorkerEarlySandboxHint = {
|
|
|
202
227
|
* gateway drops it, and its hint takes the absent path.
|
|
203
228
|
*/
|
|
204
229
|
sandboxPlacementPolicyId?: string;
|
|
230
|
+
/**
|
|
231
|
+
* LH: the run's release queue (`absurdQueueNameForLaunch`). The gateway
|
|
232
|
+
* picks that queue's listener; the worker refuses any other queue.
|
|
233
|
+
*/
|
|
234
|
+
queue?: string;
|
|
235
|
+
/** LH: set by the gateway only, the chosen listener's generation. */
|
|
236
|
+
listenerGeneration?: string;
|
|
205
237
|
};
|
|
206
238
|
|
|
207
239
|
/** Longest placement policy id a hint may carry (catalog ids are ~25). */
|
|
@@ -236,11 +268,31 @@ export function parseEarlySandboxHint(
|
|
|
236
268
|
return null;
|
|
237
269
|
sandboxPlacementPolicyId = trimmed;
|
|
238
270
|
}
|
|
271
|
+
// LH fields: present but malformed is a malformed hint, as above.
|
|
272
|
+
let queue: string | undefined;
|
|
273
|
+
if (value.queue !== undefined && value.queue !== null) {
|
|
274
|
+
const parsed = parseEarlySandboxListenerQueue(value.queue);
|
|
275
|
+
if (!parsed) return null;
|
|
276
|
+
queue = parsed;
|
|
277
|
+
}
|
|
278
|
+
let listenerGeneration: string | undefined;
|
|
279
|
+
if (
|
|
280
|
+
value.listenerGeneration !== undefined &&
|
|
281
|
+
value.listenerGeneration !== null
|
|
282
|
+
) {
|
|
283
|
+
const parsed = parseEarlySandboxListenerGeneration(
|
|
284
|
+
value.listenerGeneration,
|
|
285
|
+
);
|
|
286
|
+
if (!parsed) return null;
|
|
287
|
+
listenerGeneration = parsed;
|
|
288
|
+
}
|
|
239
289
|
return {
|
|
240
290
|
workflowId,
|
|
241
291
|
orgId,
|
|
242
292
|
...(experimentSwitchOverrides ? { experimentSwitchOverrides } : {}),
|
|
243
293
|
...(sandboxPlacementPolicyId ? { sandboxPlacementPolicyId } : {}),
|
|
294
|
+
...(queue ? { queue } : {}),
|
|
295
|
+
...(listenerGeneration ? { listenerGeneration } : {}),
|
|
244
296
|
};
|
|
245
297
|
} catch {
|
|
246
298
|
return null;
|
|
@@ -319,9 +371,11 @@ export async function requestRuntimeWorkerEarlySandboxWithOwner(
|
|
|
319
371
|
url: string,
|
|
320
372
|
token: string,
|
|
321
373
|
hint: RuntimeWorkerEarlySandboxHint,
|
|
374
|
+
/** Defaults to the hint's 1 s bound; the LH relay passes what remains. */
|
|
375
|
+
timeoutMs: number = EARLY_SANDBOX_HINT_REQUEST_TIMEOUT_MS,
|
|
322
376
|
): Promise<{ status: number | null; owner: string | null }> {
|
|
323
377
|
const controller = new AbortController();
|
|
324
|
-
const timeout = setTimeout(() => controller.abort(),
|
|
378
|
+
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
325
379
|
try {
|
|
326
380
|
const target = new URL(url);
|
|
327
381
|
if (target.protocol === 'http:' && target.hostname.endsWith('.internal')) {
|
|
@@ -366,12 +420,309 @@ export async function requestRuntimeWorkerEarlySandboxWithOwner(
|
|
|
366
420
|
}
|
|
367
421
|
}
|
|
368
422
|
|
|
423
|
+
/** LH: a worker's in-memory listener status (no database read). */
|
|
424
|
+
export const RUNTIME_WORKER_EARLY_SANDBOX_LISTENER_PATH =
|
|
425
|
+
'/internal/runtime-worker/early-sandbox-listener';
|
|
426
|
+
|
|
427
|
+
/** Most worker addresses the gateway asks for listener status. */
|
|
428
|
+
export const EARLY_SANDBOX_LISTENER_MAX_TARGETS = 32;
|
|
429
|
+
/** Every hint request's bound (app -> gateway, gateway -> worker). */
|
|
430
|
+
export const EARLY_SANDBOX_HINT_REQUEST_TIMEOUT_MS = 1_000;
|
|
431
|
+
/**
|
|
432
|
+
* The gateway's whole LH budget (status reads plus the relay to the chosen
|
|
433
|
+
* worker), inside the app's own hint request bound so the app never gives up
|
|
434
|
+
* on a gateway that is still working.
|
|
435
|
+
*/
|
|
436
|
+
export const EARLY_SANDBOX_LISTENER_HINT_BUDGET_MS = 900;
|
|
437
|
+
/**
|
|
438
|
+
* One deadline for the lookup and every status read; a slow worker counts as
|
|
439
|
+
* no status. 300 ms refused every Production hint on the target org
|
|
440
|
+
* (2026-11-23 12:00Z: `outcomes: {timeout: 2}` while the elected listener
|
|
441
|
+
* claimed the run). 700 ms leaves the relay at least 200 ms of the LH budget.
|
|
442
|
+
* A miss still only means the launch creates its own sandbox.
|
|
443
|
+
*/
|
|
444
|
+
export const EARLY_SANDBOX_LISTENER_STATUS_TIMEOUT_MS = 700;
|
|
445
|
+
/** The least the relay is given after the status reads. */
|
|
446
|
+
export const EARLY_SANDBOX_LISTENER_RELAY_MIN_MS = 100;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* The worker's listener status source: its desk while ready, or none (the
|
|
450
|
+
* read answers 503). The Preview listener-status fixture
|
|
451
|
+
* (`resolvePreviewWorkerListenerStatusFault`) also yields none.
|
|
452
|
+
*/
|
|
453
|
+
export function workerEarlySandboxListenerStatusSource(input: {
|
|
454
|
+
ready: boolean;
|
|
455
|
+
desk: { status: () => EarlySandboxListenerStatus | null } | null;
|
|
456
|
+
fault: string | null;
|
|
457
|
+
}): (() => EarlySandboxListenerStatus | null) | null {
|
|
458
|
+
const { desk } = input;
|
|
459
|
+
return input.ready && desk && !input.fault ? () => desk.status() : null;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/** Worker side of the listener status read (node:http). */
|
|
463
|
+
export function handleRuntimeWorkerEarlySandboxListener(
|
|
464
|
+
req: IncomingMessage,
|
|
465
|
+
res: ServerResponse,
|
|
466
|
+
input: {
|
|
467
|
+
expectedToken: string | undefined;
|
|
468
|
+
status: (() => EarlySandboxListenerStatus | null) | null;
|
|
469
|
+
},
|
|
470
|
+
): boolean {
|
|
471
|
+
if (
|
|
472
|
+
new URL(req.url ?? '/', 'http://worker.local').pathname !==
|
|
473
|
+
RUNTIME_WORKER_EARLY_SANDBOX_LISTENER_PATH
|
|
474
|
+
)
|
|
475
|
+
return false;
|
|
476
|
+
const respond = (status: number, body: string) => {
|
|
477
|
+
res.writeHead(status, {
|
|
478
|
+
'content-type': 'application/json',
|
|
479
|
+
'cache-control': 'no-store',
|
|
480
|
+
});
|
|
481
|
+
res.end(body);
|
|
482
|
+
};
|
|
483
|
+
if (req.method !== 'POST') {
|
|
484
|
+
respond(405, '{"error":"Use POST."}');
|
|
485
|
+
return true;
|
|
486
|
+
}
|
|
487
|
+
if (
|
|
488
|
+
!internalBearerTokenMatches(req.headers.authorization, input.expectedToken)
|
|
489
|
+
) {
|
|
490
|
+
respond(401, '{"error":"Unauthorized."}');
|
|
491
|
+
return true;
|
|
492
|
+
}
|
|
493
|
+
const status = input.status?.() ?? null;
|
|
494
|
+
if (!status) {
|
|
495
|
+
respond(503, '{"error":"No listener status."}');
|
|
496
|
+
return true;
|
|
497
|
+
}
|
|
498
|
+
respond(200, JSON.stringify(status));
|
|
499
|
+
return true;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/** Every private address behind a `.internal` worker URL; the URL otherwise. */
|
|
503
|
+
async function resolveWorkerTargets(
|
|
504
|
+
url: URL,
|
|
505
|
+
lookupAll: (hostname: string) => Promise<string[]>,
|
|
506
|
+
signal: AbortSignal,
|
|
507
|
+
): Promise<URL[]> {
|
|
508
|
+
if (!(url.protocol === 'http:' && url.hostname.endsWith('.internal')))
|
|
509
|
+
return [url];
|
|
510
|
+
const addresses = await new Promise<string[]>((resolve, reject) => {
|
|
511
|
+
signal.addEventListener(
|
|
512
|
+
'abort',
|
|
513
|
+
() => reject(new Error('listener lookup timed out')),
|
|
514
|
+
{ once: true },
|
|
515
|
+
);
|
|
516
|
+
lookupAll(url.hostname).then(resolve, reject);
|
|
517
|
+
});
|
|
518
|
+
return addresses
|
|
519
|
+
.slice(0, EARLY_SANDBOX_LISTENER_MAX_TARGETS)
|
|
520
|
+
.map((address) => {
|
|
521
|
+
const target = new URL(url);
|
|
522
|
+
target.hostname = `[${address}]`;
|
|
523
|
+
return target;
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
const defaultLookupAll = (hostname: string) =>
|
|
528
|
+
new Promise<string[]>((resolve, reject) => {
|
|
529
|
+
dns.lookup(hostname, { family: 6, all: true }, (error, resolved) =>
|
|
530
|
+
error ? reject(error) : resolve(resolved.map((entry) => entry.address)),
|
|
531
|
+
);
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* LH: the one worker address listening for `queue`, with its generation, or
|
|
536
|
+
* why none was chosen. Reads only each worker's in-memory status.
|
|
537
|
+
*/
|
|
538
|
+
export async function findEarlySandboxListener(input: {
|
|
539
|
+
url: string;
|
|
540
|
+
token: string;
|
|
541
|
+
queue: string;
|
|
542
|
+
lookupAll?: (hostname: string) => Promise<string[]>;
|
|
543
|
+
timeoutMs?: number;
|
|
544
|
+
/**
|
|
545
|
+
* The deadline owner: arms `abort` after `ms` and returns its cancel.
|
|
546
|
+
* Defaults to a timer; tests inject one they fire explicitly.
|
|
547
|
+
*/
|
|
548
|
+
scheduleDeadline?: (abort: () => void, ms: number) => () => void;
|
|
549
|
+
/** The caller's cancellation (e.g. the hint request ending). */
|
|
550
|
+
signal?: AbortSignal;
|
|
551
|
+
/** Close each connection after its read (the path warmer: no pooled socket). */
|
|
552
|
+
closeConnections?: boolean;
|
|
553
|
+
}): Promise<
|
|
554
|
+
| {
|
|
555
|
+
target: URL;
|
|
556
|
+
generation: string;
|
|
557
|
+
asked: number;
|
|
558
|
+
outcomes: EarlySandboxListenerStatusOutcomes;
|
|
559
|
+
}
|
|
560
|
+
| {
|
|
561
|
+
refused: string;
|
|
562
|
+
asked: number;
|
|
563
|
+
outcomes: EarlySandboxListenerStatusOutcomes;
|
|
564
|
+
}
|
|
565
|
+
> {
|
|
566
|
+
const controller = new AbortController();
|
|
567
|
+
const scheduleDeadline =
|
|
568
|
+
input.scheduleDeadline ??
|
|
569
|
+
((abort: () => void, ms: number) => {
|
|
570
|
+
const timer = setTimeout(abort, ms);
|
|
571
|
+
return () => clearTimeout(timer);
|
|
572
|
+
});
|
|
573
|
+
const cancelDeadline = scheduleDeadline(
|
|
574
|
+
() => controller.abort(),
|
|
575
|
+
input.timeoutMs ?? EARLY_SANDBOX_LISTENER_STATUS_TIMEOUT_MS,
|
|
576
|
+
);
|
|
577
|
+
const onParentAbort = () => controller.abort();
|
|
578
|
+
if (input.signal?.aborted) controller.abort();
|
|
579
|
+
else input.signal?.addEventListener('abort', onParentAbort, { once: true });
|
|
580
|
+
const outcomes: EarlySandboxListenerStatusOutcomes = {
|
|
581
|
+
counts: {},
|
|
582
|
+
otherQueues: [],
|
|
583
|
+
lookupMs: null,
|
|
584
|
+
slowestReadMs: null,
|
|
585
|
+
};
|
|
586
|
+
const startedAt = performance.now();
|
|
587
|
+
const elapsed = (from: number) => Math.round(performance.now() - from);
|
|
588
|
+
const note = (outcome: string) => {
|
|
589
|
+
outcomes.counts[outcome] = (outcomes.counts[outcome] ?? 0) + 1;
|
|
590
|
+
};
|
|
591
|
+
try {
|
|
592
|
+
const base = new URL(input.url);
|
|
593
|
+
base.pathname = RUNTIME_WORKER_EARLY_SANDBOX_LISTENER_PATH;
|
|
594
|
+
let targets: URL[];
|
|
595
|
+
try {
|
|
596
|
+
targets = await resolveWorkerTargets(
|
|
597
|
+
base,
|
|
598
|
+
input.lookupAll ?? defaultLookupAll,
|
|
599
|
+
controller.signal,
|
|
600
|
+
);
|
|
601
|
+
} catch {
|
|
602
|
+
outcomes.lookupMs = elapsed(startedAt);
|
|
603
|
+
note('lookup_failed');
|
|
604
|
+
return { refused: 'lookup_failed', asked: 0, outcomes };
|
|
605
|
+
}
|
|
606
|
+
outcomes.lookupMs = elapsed(startedAt);
|
|
607
|
+
const readsStartedAt = performance.now();
|
|
608
|
+
const ended = () => {
|
|
609
|
+
const ms = elapsed(readsStartedAt);
|
|
610
|
+
outcomes.slowestReadMs = Math.max(outcomes.slowestReadMs ?? 0, ms);
|
|
611
|
+
};
|
|
612
|
+
const statuses = await Promise.all(
|
|
613
|
+
targets.map(async (target) => {
|
|
614
|
+
try {
|
|
615
|
+
const response = await fetch(target, {
|
|
616
|
+
method: 'POST',
|
|
617
|
+
headers: {
|
|
618
|
+
authorization: `Bearer ${input.token}`,
|
|
619
|
+
...(input.closeConnections ? { connection: 'close' } : {}),
|
|
620
|
+
},
|
|
621
|
+
redirect: 'error',
|
|
622
|
+
signal: controller.signal,
|
|
623
|
+
});
|
|
624
|
+
if (response.status !== 200) {
|
|
625
|
+
await response.body?.cancel();
|
|
626
|
+
// The status code only; the body and headers are never read.
|
|
627
|
+
note(
|
|
628
|
+
Number.isInteger(response.status) &&
|
|
629
|
+
response.status >= 100 &&
|
|
630
|
+
response.status <= 599
|
|
631
|
+
? `http_${response.status}`
|
|
632
|
+
: 'http_invalid',
|
|
633
|
+
);
|
|
634
|
+
return null;
|
|
635
|
+
}
|
|
636
|
+
let status: EarlySandboxListenerStatus | null = null;
|
|
637
|
+
try {
|
|
638
|
+
status = parseEarlySandboxListenerStatus(
|
|
639
|
+
JSON.parse((await response.text()).slice(0, 1024)),
|
|
640
|
+
);
|
|
641
|
+
} catch {
|
|
642
|
+
status = null;
|
|
643
|
+
}
|
|
644
|
+
if (!status) note('malformed');
|
|
645
|
+
else if (status.queue !== input.queue) {
|
|
646
|
+
note('other_queue');
|
|
647
|
+
if (
|
|
648
|
+
outcomes.otherQueues.length < 2 &&
|
|
649
|
+
!outcomes.otherQueues.includes(status.queue)
|
|
650
|
+
)
|
|
651
|
+
outcomes.otherQueues.push(status.queue);
|
|
652
|
+
} else if (status.generation === null) note('not_listening');
|
|
653
|
+
else if (status.draining) note('listening_draining');
|
|
654
|
+
else if (status.unreservedSlots < 1) note('listening_no_slot');
|
|
655
|
+
else note('listening');
|
|
656
|
+
return status;
|
|
657
|
+
} catch (error) {
|
|
658
|
+
note(
|
|
659
|
+
controller.signal.aborted
|
|
660
|
+
? 'timeout'
|
|
661
|
+
: `error_${errorCode(error) ?? 'unknown'}`,
|
|
662
|
+
);
|
|
663
|
+
return null;
|
|
664
|
+
} finally {
|
|
665
|
+
ended();
|
|
666
|
+
}
|
|
667
|
+
}),
|
|
668
|
+
);
|
|
669
|
+
const selection = selectEarlySandboxListener({
|
|
670
|
+
queue: input.queue,
|
|
671
|
+
statuses,
|
|
672
|
+
});
|
|
673
|
+
if ('refused' in selection)
|
|
674
|
+
return { refused: selection.refused, asked: targets.length, outcomes };
|
|
675
|
+
const target = new URL(targets[selection.target]!);
|
|
676
|
+
target.pathname = RUNTIME_WORKER_EARLY_SANDBOX_PATH;
|
|
677
|
+
return {
|
|
678
|
+
target,
|
|
679
|
+
generation: selection.generation,
|
|
680
|
+
asked: targets.length,
|
|
681
|
+
outcomes,
|
|
682
|
+
};
|
|
683
|
+
} finally {
|
|
684
|
+
cancelDeadline();
|
|
685
|
+
input.signal?.removeEventListener('abort', onParentAbort);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* LH: what each worker's status read returned, for the gateway decision line:
|
|
691
|
+
* `listening`, `listening_draining`, `listening_no_slot`, `not_listening`,
|
|
692
|
+
* `other_queue` (with up to 2 sample queue names), `malformed`,
|
|
693
|
+
* `http_<status>`, `timeout`, `error_<code>` or `lookup_failed`.
|
|
694
|
+
*/
|
|
695
|
+
export type EarlySandboxListenerStatusOutcomes = {
|
|
696
|
+
counts: Record<string, number>;
|
|
697
|
+
otherQueues: string[];
|
|
698
|
+
/** Milliseconds spent resolving worker addresses (null: not reached). */
|
|
699
|
+
lookupMs: number | null;
|
|
700
|
+
/** The slowest status read that ended, ok or not (null: none ended). */
|
|
701
|
+
slowestReadMs: number | null;
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* A bounded, allowlisted error class (e.g. `ECONNREFUSED`, `UND_ERR_SOCKET`),
|
|
706
|
+
* never a message, URL or provider body: anything else is `unknown`.
|
|
707
|
+
*/
|
|
708
|
+
const ERROR_CODE_PATTERN = /^[A-Z][A-Z0-9_]{1,31}$/;
|
|
709
|
+
function errorCode(error: unknown): string | null {
|
|
710
|
+
const direct = (error as { code?: unknown } | null)?.code;
|
|
711
|
+
const cause = (error as { cause?: { code?: unknown } } | null)?.cause?.code;
|
|
712
|
+
for (const code of [direct, cause]) {
|
|
713
|
+
if (typeof code === 'string' && ERROR_CODE_PATTERN.test(code)) return code;
|
|
714
|
+
}
|
|
715
|
+
return null;
|
|
716
|
+
}
|
|
717
|
+
|
|
369
718
|
/** Gateway relay of the early-sandbox hint to its fixed private worker. */
|
|
370
719
|
export async function handleRuntimeGatewayEarlySandbox(
|
|
371
720
|
req: Request,
|
|
372
721
|
input: {
|
|
373
722
|
expectedToken: string | undefined;
|
|
374
723
|
target: RuntimeWorkerWakeTarget | null;
|
|
724
|
+
/** Test seam; `findEarlySandboxListener` otherwise. */
|
|
725
|
+
findListener?: typeof findEarlySandboxListener;
|
|
375
726
|
},
|
|
376
727
|
): Promise<Response | null> {
|
|
377
728
|
if (new URL(req.url).pathname !== RUNTIME_WORKER_EARLY_SANDBOX_PATH)
|
|
@@ -395,9 +746,98 @@ export async function handleRuntimeGatewayEarlySandbox(
|
|
|
395
746
|
}
|
|
396
747
|
const hint = parseEarlySandboxHint(await req.text());
|
|
397
748
|
if (!hint) return respond(400, '{"error":"Invalid hint."}');
|
|
398
|
-
if (!input.target)
|
|
749
|
+
if (!input.target) {
|
|
750
|
+
// Loud: a gateway released without the hint target refuses every hint.
|
|
751
|
+
console.warn('[runtime.worker_early_sandbox]', {
|
|
752
|
+
event: 'no_target',
|
|
753
|
+
workflowId: hint.workflowId,
|
|
754
|
+
});
|
|
755
|
+
return respond(503, '{"error":"No worker target."}');
|
|
756
|
+
}
|
|
757
|
+
// The generation is the gateway's to choose; a caller's is never relayed.
|
|
758
|
+
delete hint.listenerGeneration;
|
|
399
759
|
const workerUrl = new URL(input.target.url);
|
|
400
760
|
workerUrl.pathname = RUNTIME_WORKER_EARLY_SANDBOX_PATH;
|
|
761
|
+
if (
|
|
762
|
+
resolveExperimentSwitch(
|
|
763
|
+
'LH',
|
|
764
|
+
hint.experimentSwitchOverrides,
|
|
765
|
+
EARLY_SANDBOX_LISTENER_HINT,
|
|
766
|
+
)
|
|
767
|
+
) {
|
|
768
|
+
// LH: only the one listener for the run's queue gets the hint. No queue,
|
|
769
|
+
// no listener, or more than one: no hint, and the launch creates its own.
|
|
770
|
+
// One decision line per LH hint, joinable by workflow id.
|
|
771
|
+
const decided = (fields: Record<string, unknown>) =>
|
|
772
|
+
console.info('[runtime.listener_hint]', {
|
|
773
|
+
workflowId: hint.workflowId,
|
|
774
|
+
...fields,
|
|
775
|
+
});
|
|
776
|
+
if (!hint.queue) {
|
|
777
|
+
decided({ event: 'refused', reason: 'no_queue', asked: 0 });
|
|
778
|
+
return respond(503, '{"ok":false,"refused":"no_queue"}');
|
|
779
|
+
}
|
|
780
|
+
const lhStartedAt = performance.now();
|
|
781
|
+
const found = await (input.findListener ?? findEarlySandboxListener)({
|
|
782
|
+
url: workerUrl.toString(),
|
|
783
|
+
token: input.target.token,
|
|
784
|
+
queue: hint.queue,
|
|
785
|
+
});
|
|
786
|
+
if ('refused' in found) {
|
|
787
|
+
decided({
|
|
788
|
+
event: 'refused',
|
|
789
|
+
reason: found.refused,
|
|
790
|
+
asked: found.asked,
|
|
791
|
+
outcomes: found.outcomes.counts,
|
|
792
|
+
lookupMs: found.outcomes.lookupMs,
|
|
793
|
+
slowestReadMs: found.outcomes.slowestReadMs,
|
|
794
|
+
...(found.outcomes.otherQueues.length
|
|
795
|
+
? { otherQueues: found.outcomes.otherQueues, queue: hint.queue }
|
|
796
|
+
: {}),
|
|
797
|
+
});
|
|
798
|
+
return respond(
|
|
799
|
+
503,
|
|
800
|
+
JSON.stringify({ ok: false, refused: found.refused }),
|
|
801
|
+
);
|
|
802
|
+
}
|
|
803
|
+
const relayBudgetMs = Math.max(
|
|
804
|
+
EARLY_SANDBOX_LISTENER_RELAY_MIN_MS,
|
|
805
|
+
Math.round(
|
|
806
|
+
EARLY_SANDBOX_LISTENER_HINT_BUDGET_MS -
|
|
807
|
+
(performance.now() - lhStartedAt),
|
|
808
|
+
),
|
|
809
|
+
);
|
|
810
|
+
const { status } = await requestRuntimeWorkerEarlySandboxWithOwner(
|
|
811
|
+
found.target.toString(),
|
|
812
|
+
input.target.token,
|
|
813
|
+
{ ...hint, listenerGeneration: found.generation },
|
|
814
|
+
relayBudgetMs,
|
|
815
|
+
);
|
|
816
|
+
// A refusing worker (handover since the status read, slot taken) means
|
|
817
|
+
// no early sandbox; the launch creates its own.
|
|
818
|
+
decided(
|
|
819
|
+
status === 202
|
|
820
|
+
? {
|
|
821
|
+
event: 'accepted',
|
|
822
|
+
generation: found.generation,
|
|
823
|
+
asked: found.asked,
|
|
824
|
+
lookupMs: found.outcomes.lookupMs,
|
|
825
|
+
slowestReadMs: found.outcomes.slowestReadMs,
|
|
826
|
+
}
|
|
827
|
+
: {
|
|
828
|
+
event: 'refused',
|
|
829
|
+
reason: 'listener_refused',
|
|
830
|
+
workerStatus: status,
|
|
831
|
+
asked: found.asked,
|
|
832
|
+
},
|
|
833
|
+
);
|
|
834
|
+
return respond(
|
|
835
|
+
status ?? 503,
|
|
836
|
+
status === 202
|
|
837
|
+
? '{"ok":true}'
|
|
838
|
+
: JSON.stringify({ ok: false, refused: 'listener_refused' }),
|
|
839
|
+
);
|
|
840
|
+
}
|
|
401
841
|
const { status, owner } = await requestRuntimeWorkerEarlySandboxWithOwner(
|
|
402
842
|
workerUrl.toString(),
|
|
403
843
|
input.target.token,
|
|
@@ -412,3 +852,160 @@ export async function handleRuntimeGatewayEarlySandbox(
|
|
|
412
852
|
: '{"ok":false}',
|
|
413
853
|
);
|
|
414
854
|
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Keeps the gateway's private paths to every worker warm for LH. Measured in
|
|
858
|
+
* Production (2026-11-24 05:3xZ, from both receipt gateways): the first TCP
|
|
859
|
+
* connection from a gateway to a worker's :8787 takes ~2 s (2007-2055 ms on
|
|
860
|
+
* every cold pair), then any new connection to that worker takes 1-17 ms for
|
|
861
|
+
* minutes. The delay is the path, not the worker: a closed port on a cold
|
|
862
|
+
* host takes the same ~2 s to refuse, and the kernel counts two SYN
|
|
863
|
+
* retransmits (the first two SYNs are dropped; Linux resends at 1 s and 2 s).
|
|
864
|
+
* Hints are rare, so the hint-time status read always met a cold path and
|
|
865
|
+
* timed out (`outcomes: {timeout: 6}`). A periodic status read keeps every
|
|
866
|
+
* started worker's path warm and reaches a newly started worker within one
|
|
867
|
+
* interval; the hint still reads fresh status itself, so nothing is selected
|
|
868
|
+
* from this pass.
|
|
869
|
+
*/
|
|
870
|
+
export const EARLY_SANDBOX_LISTENER_WARM_INTERVAL_MS = 5_000;
|
|
871
|
+
/** Long enough for a cold connection (~2 s) to open, so the path warms. */
|
|
872
|
+
export const EARLY_SANDBOX_LISTENER_WARM_TIMEOUT_MS = 4_000;
|
|
873
|
+
/** No release queue is named this; every status reads as another queue. */
|
|
874
|
+
const WARM_PASS_QUEUE = 'listener-path-warm';
|
|
875
|
+
|
|
876
|
+
export type EarlySandboxListenerPathWarmer = {
|
|
877
|
+
/** One pass now (single-flight); resolves when it ends. */
|
|
878
|
+
warmNow: () => Promise<void>;
|
|
879
|
+
/** Clears the timer and aborts a pass in flight. */
|
|
880
|
+
stop: () => void;
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
/**
|
|
884
|
+
* Only for a deployment that names the early-sandbox URL explicitly (today the
|
|
885
|
+
* Production receipt gateways); null otherwise, so no other deployment gains
|
|
886
|
+
* background reads.
|
|
887
|
+
*/
|
|
888
|
+
export function startEarlySandboxListenerPathWarmer(input: {
|
|
889
|
+
env?: Record<string, string | undefined>;
|
|
890
|
+
find?: typeof findEarlySandboxListener;
|
|
891
|
+
lookupAll?: (hostname: string) => Promise<string[]>;
|
|
892
|
+
setIntervalFn?: (tick: () => void, ms: number) => { unref?: () => void };
|
|
893
|
+
clearIntervalFn?: (handle: { unref?: () => void }) => void;
|
|
894
|
+
log?: (line: Record<string, unknown>) => void;
|
|
895
|
+
}): EarlySandboxListenerPathWarmer | null {
|
|
896
|
+
const env = input.env ?? process.env;
|
|
897
|
+
if (!env.DEEPLINE_RUNTIME_WORKER_EARLY_SANDBOX_URL?.trim()) return null;
|
|
898
|
+
const target = runtimeWorkerEarlySandboxTargetFromEnv(env);
|
|
899
|
+
if (!target) return null;
|
|
900
|
+
const find = input.find ?? findEarlySandboxListener;
|
|
901
|
+
const lookupAll = input.lookupAll ?? defaultLookupAll;
|
|
902
|
+
const log =
|
|
903
|
+
input.log ??
|
|
904
|
+
((line: Record<string, unknown>) =>
|
|
905
|
+
console.info({ ...line, message: '[runtime.listener_path_warm]' }));
|
|
906
|
+
let running: Promise<void> | null = null;
|
|
907
|
+
let stopped = false;
|
|
908
|
+
// `dns.lookup` cannot be cancelled: an abandoned lookup still holds a
|
|
909
|
+
// threadpool slot, so no pass starts until the last one has settled.
|
|
910
|
+
let lookupUnsettled = false;
|
|
911
|
+
const trackedLookup = (hostname: string) => {
|
|
912
|
+
lookupUnsettled = true;
|
|
913
|
+
const lookup = lookupAll(hostname);
|
|
914
|
+
void lookup.then(
|
|
915
|
+
() => {
|
|
916
|
+
lookupUnsettled = false;
|
|
917
|
+
},
|
|
918
|
+
() => {
|
|
919
|
+
lookupUnsettled = false;
|
|
920
|
+
},
|
|
921
|
+
);
|
|
922
|
+
return lookup;
|
|
923
|
+
};
|
|
924
|
+
// A line only when the pass outcome changes, so a lasting failure is one
|
|
925
|
+
// line (plus how many identical passes it stood for), not one per pass.
|
|
926
|
+
let lastLogged: string | null = null;
|
|
927
|
+
let suppressed = 0;
|
|
928
|
+
const controller = new AbortController();
|
|
929
|
+
const warmNow = () => {
|
|
930
|
+
if (stopped) return Promise.resolve();
|
|
931
|
+
if (running) return running;
|
|
932
|
+
if (lookupUnsettled) {
|
|
933
|
+
suppressed += 1;
|
|
934
|
+
return Promise.resolve();
|
|
935
|
+
}
|
|
936
|
+
running = (async () => {
|
|
937
|
+
let line: Record<string, unknown>;
|
|
938
|
+
try {
|
|
939
|
+
const found = await find({
|
|
940
|
+
url: target.url,
|
|
941
|
+
token: target.token,
|
|
942
|
+
queue: WARM_PASS_QUEUE,
|
|
943
|
+
timeoutMs: EARLY_SANDBOX_LISTENER_WARM_TIMEOUT_MS,
|
|
944
|
+
signal: controller.signal,
|
|
945
|
+
lookupAll: trackedLookup,
|
|
946
|
+
closeConnections: true,
|
|
947
|
+
});
|
|
948
|
+
const slowest = found.outcomes.slowestReadMs;
|
|
949
|
+
const unhealthy = Object.keys(found.outcomes.counts).filter(
|
|
950
|
+
(outcome) => outcome !== 'other_queue',
|
|
951
|
+
);
|
|
952
|
+
const cold = (slowest ?? 0) > EARLY_SANDBOX_LISTENER_STATUS_TIMEOUT_MS;
|
|
953
|
+
line = {
|
|
954
|
+
event: 'warm',
|
|
955
|
+
asked: found.asked,
|
|
956
|
+
counts: found.outcomes.counts,
|
|
957
|
+
lookupMs: found.outcomes.lookupMs,
|
|
958
|
+
slowestReadMs: slowest,
|
|
959
|
+
};
|
|
960
|
+
// A cold path is worth a line every time (a new worker or a lost
|
|
961
|
+
// route); an all-healthy pass resets the change detector silently.
|
|
962
|
+
if (!cold && unhealthy.length === 0) {
|
|
963
|
+
lastLogged = null;
|
|
964
|
+
suppressed = 0;
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
if (!cold) {
|
|
968
|
+
// Canonical: `counts` keys follow whichever read finished first, so
|
|
969
|
+
// the same outcome must not read as a change (Production 2026-11-25:
|
|
970
|
+
// {other_queue, http_503} vs {http_503, other_queue} logged most
|
|
971
|
+
// passes).
|
|
972
|
+
const key = JSON.stringify(
|
|
973
|
+
Object.entries(found.outcomes.counts).sort(([a], [b]) =>
|
|
974
|
+
a < b ? -1 : a > b ? 1 : 0,
|
|
975
|
+
),
|
|
976
|
+
);
|
|
977
|
+
if (key === lastLogged) {
|
|
978
|
+
suppressed += 1;
|
|
979
|
+
return;
|
|
980
|
+
}
|
|
981
|
+
lastLogged = key;
|
|
982
|
+
}
|
|
983
|
+
} catch {
|
|
984
|
+
line = { event: 'warm', failed: true };
|
|
985
|
+
} finally {
|
|
986
|
+
running = null;
|
|
987
|
+
}
|
|
988
|
+
// An aborted pass at shutdown is not a route failure.
|
|
989
|
+
if (stopped) return;
|
|
990
|
+
log(suppressed > 0 ? { ...line, suppressed } : line);
|
|
991
|
+
suppressed = 0;
|
|
992
|
+
})();
|
|
993
|
+
return running;
|
|
994
|
+
};
|
|
995
|
+
const handle = (input.setIntervalFn ?? setInterval)(() => {
|
|
996
|
+
void warmNow();
|
|
997
|
+
}, EARLY_SANDBOX_LISTENER_WARM_INTERVAL_MS);
|
|
998
|
+
handle.unref?.();
|
|
999
|
+
void warmNow();
|
|
1000
|
+
return {
|
|
1001
|
+
warmNow,
|
|
1002
|
+
stop: () => {
|
|
1003
|
+
stopped = true;
|
|
1004
|
+
(
|
|
1005
|
+
input.clearIntervalFn ??
|
|
1006
|
+
((h) => clearInterval(h as ReturnType<typeof setInterval>))
|
|
1007
|
+
)(handle);
|
|
1008
|
+
controller.abort();
|
|
1009
|
+
},
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
RUNNER_ACCOUNT_ACCESS_UNAVAILABLE_RETRY_BUDGET_MS,
|
|
3
|
+
RUNNER_GATEWAY_CONNECTION_RETRY_BUDGET_MS,
|
|
4
|
+
} from './runtime-constants';
|
|
2
5
|
|
|
3
6
|
export const SECRET_RESOLUTION_MAX_ATTEMPTS = 3;
|
|
4
7
|
export const SECRET_RESOLUTION_MAX_RETRY_AFTER_MS = 2_000;
|
|
@@ -109,3 +112,25 @@ export function secretResolutionOutageRetryDelayMs(input: {
|
|
|
109
112
|
? delayMs
|
|
110
113
|
: null;
|
|
111
114
|
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The wait before resending a lookup the app's account-access cutoff refused
|
|
118
|
+
* as unavailable (`isAccountAccessUnavailableResponse`) once its ordinary
|
|
119
|
+
* attempts are spent: 1 s growing by 1 s per attempt up to 8 s, or null when
|
|
120
|
+
* the account-access budget is used up. The cutoff ran before any route, so
|
|
121
|
+
* nothing was resolved.
|
|
122
|
+
*/
|
|
123
|
+
export function secretResolutionAccountAccessRetryDelayMs(input: {
|
|
124
|
+
respondedAttempts: number;
|
|
125
|
+
elapsedMs: number;
|
|
126
|
+
}): number | null {
|
|
127
|
+
const delayMs = Math.min(
|
|
128
|
+
8_000,
|
|
129
|
+
1_000 *
|
|
130
|
+
Math.max(1, input.respondedAttempts - SECRET_RESOLUTION_MAX_ATTEMPTS + 1),
|
|
131
|
+
);
|
|
132
|
+
return input.elapsedMs + delayMs <=
|
|
133
|
+
RUNNER_ACCOUNT_ACCESS_UNAVAILABLE_RETRY_BUDGET_MS
|
|
134
|
+
? delayMs
|
|
135
|
+
: null;
|
|
136
|
+
}
|