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
|
@@ -0,0 +1,726 @@
|
|
|
1
|
+
import { PROVIDER_BULK_LISTING_CLOCK_SKEW_MS } from './provider-bulk-wait';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Releasing a Fleet member's create fence on recorded provider evidence
|
|
5
|
+
* (#10280, `deepline-admin monitors fleets release-fence`).
|
|
6
|
+
*
|
|
7
|
+
* A create fence (`opId`) is written before a provider create that cannot be
|
|
8
|
+
* repeated safely, and only provider evidence ends it: the radar the create
|
|
9
|
+
* made, the provider saying the create failed, or the fence's own record that
|
|
10
|
+
* the request never left (KAR-260). A create whose answer was lost and whose
|
|
11
|
+
* radar never appears therefore waits forever, by design: a complete account
|
|
12
|
+
* listing that does not name it proves nothing, because provider inventory
|
|
13
|
+
* can lag an accepted create. That wait is the operator recovery signal, and
|
|
14
|
+
* this is the recovery action for it.
|
|
15
|
+
*
|
|
16
|
+
* The operator may release a fence only on evidence, never on absence alone:
|
|
17
|
+
*
|
|
18
|
+
* - `bulk_failed`: the fence names an accepted bulk, and the provider's bulk
|
|
19
|
+
* status, read now, reports this member's create failed.
|
|
20
|
+
* - `listing_absent`: the operator records a proof that the provider never
|
|
21
|
+
* accepted the create (for Medely's `smb-new-hires-1`, the request log
|
|
22
|
+
* showing the page timed out between the fence and the POST), AND a
|
|
23
|
+
* complete read of every radar created since the fence, every status, names
|
|
24
|
+
* none for this member. A radar there carrying this member's key is
|
|
25
|
+
* acceptance (KAR-39), whoever's stamp it carries, and refuses the release.
|
|
26
|
+
*
|
|
27
|
+
* - `provider_reconciled`: a member on a per-resource transport
|
|
28
|
+
* (`runtime.fleetPerResource`, Exa), whose provider offers no bulk status
|
|
29
|
+
* and no listing Deepline may read. The operator records what they found
|
|
30
|
+
* in the provider account by the member's `deepline_org_id` /
|
|
31
|
+
* `deepline_monitor_key` metadata: the monitor existed and they deleted it
|
|
32
|
+
* (`deleted`, with its id), or none exists (`absent`), with a proof. Only
|
|
33
|
+
* a fence whose answer was lost qualifies; one that recorded the create's
|
|
34
|
+
* answer is settled by the convergence (`deepline-admin monitors
|
|
35
|
+
* release-held-create`, #11153).
|
|
36
|
+
*
|
|
37
|
+
* The decision is one pure function so the dry run and the apply make it the
|
|
38
|
+
* same way (KAR-71): each asks it, performs the provider read it names, and
|
|
39
|
+
* asks again, until it releases, refuses or answers `already`. The listing
|
|
40
|
+
* read is a walk saved between requests (`fence-walk.ts`); one that has not
|
|
41
|
+
* finished refuses `listing_incomplete` until a later request finishes it.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/** The longest proof text recorded on the fence. */
|
|
45
|
+
export const FLEET_FENCE_RELEASE_PROOF_MAX_LENGTH = 400;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The convergence states a claim takes a member from, so the only ones where
|
|
49
|
+
* recorded evidence is ever read. A fence survives only a wait
|
|
50
|
+
* (`rate_limited`) or a pass holding it (`submitting`).
|
|
51
|
+
*/
|
|
52
|
+
export const FLEET_FENCE_RELEASE_CLAIMABLE_STATES: readonly string[] = [
|
|
53
|
+
'pending',
|
|
54
|
+
'rate_limited',
|
|
55
|
+
'submitting',
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The convergence states a member carrying a create fence can be in (#11210):
|
|
60
|
+
* the fence-keeping wait (`settleBatch` keeps `opId` only on `rate_limited`
|
|
61
|
+
* with `keepOperation`) and the pass holding it (`submitting`, where the
|
|
62
|
+
* fence is written). Every other settle clears the fence, and every path to
|
|
63
|
+
* `pending` (a plan commit, a repair mark) refuses or clears a fenced row, so
|
|
64
|
+
* these are the only buckets an op release looks for its members in.
|
|
65
|
+
*/
|
|
66
|
+
export const FLEET_FENCE_HOLDING_STATES = [
|
|
67
|
+
'rate_limited',
|
|
68
|
+
'submitting',
|
|
69
|
+
] as const;
|
|
70
|
+
|
|
71
|
+
/** Evidence a fence is released on, as recorded on it. */
|
|
72
|
+
export type FleetFenceNonAcceptance =
|
|
73
|
+
| { kind: 'bulk_failed'; bulkId: string; failure: string }
|
|
74
|
+
| {
|
|
75
|
+
kind: 'listing_absent';
|
|
76
|
+
bulkId?: string;
|
|
77
|
+
createdSince: string;
|
|
78
|
+
pages: number;
|
|
79
|
+
scanned: number;
|
|
80
|
+
proof: string;
|
|
81
|
+
}
|
|
82
|
+
| {
|
|
83
|
+
kind: 'provider_reconciled';
|
|
84
|
+
outcome: FleetFenceReconciliationOutcome;
|
|
85
|
+
/** The provider resource the operator deleted, for `deleted`. */
|
|
86
|
+
providerResourceId?: string;
|
|
87
|
+
proof: string;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* What an operator found in a per-resource provider's account for a held
|
|
92
|
+
* create: they deleted the monitor it made, or none exists.
|
|
93
|
+
*/
|
|
94
|
+
export type FleetFenceReconciliationOutcome = 'deleted' | 'absent';
|
|
95
|
+
|
|
96
|
+
/** The member row fields the decision reads. */
|
|
97
|
+
export type FleetFenceReleaseMember = {
|
|
98
|
+
monitorKey: string;
|
|
99
|
+
fleetId?: string | null;
|
|
100
|
+
convergence?: string | null;
|
|
101
|
+
leaseExpiresAt?: number | null;
|
|
102
|
+
opId?: string | null;
|
|
103
|
+
providerOpRef?: string | null;
|
|
104
|
+
/** The row's creation time: a lower bound on when any fence was written. */
|
|
105
|
+
creationTime?: number | null;
|
|
106
|
+
opSubmission?: {
|
|
107
|
+
opId: string;
|
|
108
|
+
state: 'fenced' | 'posting';
|
|
109
|
+
fencedAt?: number;
|
|
110
|
+
removedResourceId?: string;
|
|
111
|
+
nonAcceptance?: { kind: string; bulkId?: string };
|
|
112
|
+
} | null;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/** What the provider's bulk status said about this member's create. */
|
|
116
|
+
export type FleetFenceBulkObservation =
|
|
117
|
+
| { read: 'error'; message: string }
|
|
118
|
+
| {
|
|
119
|
+
read: 'ok';
|
|
120
|
+
/** The bulk as a whole. */
|
|
121
|
+
status: 'processing' | 'completed';
|
|
122
|
+
/** The item naming this member, if the status names it. */
|
|
123
|
+
item:
|
|
124
|
+
| { outcome: 'created'; providerResourceId: string }
|
|
125
|
+
| { outcome: 'failed'; failure: string }
|
|
126
|
+
| { outcome: 'processing' }
|
|
127
|
+
| { outcome: 'unknown' }
|
|
128
|
+
| null;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/** A radar the listing holds under this member's key. */
|
|
132
|
+
export type FleetFenceListedRadar = {
|
|
133
|
+
radarId: string;
|
|
134
|
+
orgId: string | null;
|
|
135
|
+
status: string;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/** What a listing walk from the fence found for this member. */
|
|
139
|
+
export type FleetFenceListingObservation =
|
|
140
|
+
| { read: 'error'; message: string }
|
|
141
|
+
| {
|
|
142
|
+
read: 'ok';
|
|
143
|
+
createdSince: string;
|
|
144
|
+
complete: boolean;
|
|
145
|
+
pages: number;
|
|
146
|
+
scanned: number;
|
|
147
|
+
matches: FleetFenceListedRadar[];
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export type FleetFenceReleaseRefusal =
|
|
151
|
+
| 'member_not_found'
|
|
152
|
+
| 'not_fleet_member'
|
|
153
|
+
| 'fence_changed'
|
|
154
|
+
| 'no_create_fence'
|
|
155
|
+
| 'member_not_claimable'
|
|
156
|
+
| 'member_leased'
|
|
157
|
+
| 'proof_too_long'
|
|
158
|
+
| 'create_accepted'
|
|
159
|
+
| 'radar_unattributable'
|
|
160
|
+
| 'bulk_processing'
|
|
161
|
+
| 'bulk_unreadable'
|
|
162
|
+
| 'proof_required'
|
|
163
|
+
| 'listing_unreadable'
|
|
164
|
+
| 'listing_incomplete'
|
|
165
|
+
| 'reconciliation_required'
|
|
166
|
+
| 'resource_id_required'
|
|
167
|
+
| 'reconciliation_not_applicable';
|
|
168
|
+
|
|
169
|
+
export type FleetFenceRead =
|
|
170
|
+
| { kind: 'bulk_status'; bulkId: string }
|
|
171
|
+
| { kind: 'listing'; createdSince: string };
|
|
172
|
+
|
|
173
|
+
export type FleetFenceReleaseDecision =
|
|
174
|
+
| { kind: 'read'; read: FleetFenceRead }
|
|
175
|
+
| { kind: 'refuse'; code: FleetFenceReleaseRefusal; message: string }
|
|
176
|
+
| {
|
|
177
|
+
kind: 'already';
|
|
178
|
+
reason: 'evidence_recorded' | 'unsent_fence';
|
|
179
|
+
message: string;
|
|
180
|
+
}
|
|
181
|
+
| { kind: 'release'; evidence: FleetFenceNonAcceptance };
|
|
182
|
+
|
|
183
|
+
function refuse(
|
|
184
|
+
code: FleetFenceReleaseRefusal,
|
|
185
|
+
message: string,
|
|
186
|
+
): FleetFenceReleaseDecision {
|
|
187
|
+
return { kind: 'refuse', code, message };
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** The proof as recorded: trimmed, null when empty. */
|
|
191
|
+
export function normalizeFleetFenceReleaseProof(
|
|
192
|
+
proof: string | null | undefined,
|
|
193
|
+
): string | null {
|
|
194
|
+
const text = typeof proof === 'string' ? proof.trim() : '';
|
|
195
|
+
return text === '' ? null : text;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Where the listing read for a fence starts: the fence's own record, else
|
|
200
|
+
* the member row's creation (which no fence can predate), less the clock skew
|
|
201
|
+
* between Deepline and the provider.
|
|
202
|
+
*/
|
|
203
|
+
export function fleetFenceListingCreatedSince(
|
|
204
|
+
member: Pick<
|
|
205
|
+
FleetFenceReleaseMember,
|
|
206
|
+
'creationTime' | 'opSubmission' | 'opId'
|
|
207
|
+
>,
|
|
208
|
+
): string {
|
|
209
|
+
const submission =
|
|
210
|
+
member.opSubmission && member.opSubmission.opId === member.opId
|
|
211
|
+
? member.opSubmission
|
|
212
|
+
: null;
|
|
213
|
+
const fencedAt = submission?.fencedAt ?? member.creationTime ?? 0;
|
|
214
|
+
return new Date(
|
|
215
|
+
Math.max(0, fencedAt - PROVIDER_BULK_LISTING_CLOCK_SKEW_MS),
|
|
216
|
+
).toISOString();
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Whether a recorded release still applies to the fence a claim holds: the
|
|
221
|
+
* same operation, and the same bulk (or none) it was recorded against. A
|
|
222
|
+
* fence that has since recorded an acceptance is not released by evidence
|
|
223
|
+
* read before it.
|
|
224
|
+
*/
|
|
225
|
+
export function fleetFenceReleasedOnEvidence(
|
|
226
|
+
member: Pick<
|
|
227
|
+
FleetFenceReleaseMember,
|
|
228
|
+
'opId' | 'providerOpRef' | 'opSubmission'
|
|
229
|
+
>,
|
|
230
|
+
): boolean {
|
|
231
|
+
const submission = member.opSubmission;
|
|
232
|
+
if (!member.opId || !submission || submission.opId !== member.opId) {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
const evidence = submission.nonAcceptance;
|
|
236
|
+
// A radar this create made, which a removal confirmed deleted, proves it
|
|
237
|
+
// was accepted, whatever was recorded before.
|
|
238
|
+
if (!evidence || submission.removedResourceId) return false;
|
|
239
|
+
return (evidence.bulkId ?? null) === (member.providerOpRef ?? null);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export function decideFleetFenceRelease(input: {
|
|
243
|
+
orgId: string;
|
|
244
|
+
fleetId: string;
|
|
245
|
+
member: FleetFenceReleaseMember | null;
|
|
246
|
+
now: number;
|
|
247
|
+
proof: string | null;
|
|
248
|
+
/** The fence the operator reviewed in the dry run, for an apply. */
|
|
249
|
+
expectedOpId?: string;
|
|
250
|
+
bulk?: FleetFenceBulkObservation;
|
|
251
|
+
listing?: FleetFenceListingObservation;
|
|
252
|
+
/**
|
|
253
|
+
* The member's tool creates one provider resource per request
|
|
254
|
+
* (`runtime.fleetPerResource`): no bulk status or listing exists, so only
|
|
255
|
+
* an operator's provider reconciliation releases its fence.
|
|
256
|
+
*/
|
|
257
|
+
perResource?: boolean;
|
|
258
|
+
/** The operator's reconciliation of a held per-resource create. */
|
|
259
|
+
reconciliation?: {
|
|
260
|
+
outcome: FleetFenceReconciliationOutcome;
|
|
261
|
+
providerResourceId?: string;
|
|
262
|
+
};
|
|
263
|
+
}): FleetFenceReleaseDecision {
|
|
264
|
+
const { member } = input;
|
|
265
|
+
if (!member) {
|
|
266
|
+
return refuse(
|
|
267
|
+
'member_not_found',
|
|
268
|
+
'No monitor with this key exists in this workspace.',
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
if (member.fleetId !== input.fleetId) {
|
|
272
|
+
return refuse(
|
|
273
|
+
'not_fleet_member',
|
|
274
|
+
`Monitor ${member.monitorKey} is not a member of Fleet ${input.fleetId}.`,
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
if (!member.opId) {
|
|
278
|
+
return refuse(
|
|
279
|
+
'no_create_fence',
|
|
280
|
+
`Monitor ${member.monitorKey} has no open create fence, so there is nothing to release.`,
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
if (input.expectedOpId !== undefined && member.opId !== input.expectedOpId) {
|
|
284
|
+
return refuse(
|
|
285
|
+
'fence_changed',
|
|
286
|
+
`Monitor ${member.monitorKey} now carries fence ${member.opId}, not ${input.expectedOpId}: the proof was about another create attempt. Dry-run it again.`,
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
if (fleetFenceReleasedOnEvidence(member)) {
|
|
290
|
+
return {
|
|
291
|
+
kind: 'already',
|
|
292
|
+
reason: 'evidence_recorded',
|
|
293
|
+
message:
|
|
294
|
+
'Non-acceptance evidence is already recorded on this fence; the next claim releases it.',
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
const submission =
|
|
298
|
+
member.opSubmission?.opId === member.opId ? member.opSubmission : null;
|
|
299
|
+
if (submission?.removedResourceId) {
|
|
300
|
+
return refuse(
|
|
301
|
+
'create_accepted',
|
|
302
|
+
`This create made radar ${submission.removedResourceId}, which a removal already confirmed deleted; the convergence finishes on it.`,
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
if (!member.providerOpRef && submission?.state === 'fenced') {
|
|
306
|
+
return {
|
|
307
|
+
kind: 'already',
|
|
308
|
+
reason: 'unsent_fence',
|
|
309
|
+
message:
|
|
310
|
+
"The fence's own record says its create never reached the provider, so the next claim releases it without evidence (KAR-260).",
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
if (
|
|
314
|
+
!FLEET_FENCE_RELEASE_CLAIMABLE_STATES.includes(member.convergence ?? '')
|
|
315
|
+
) {
|
|
316
|
+
return refuse(
|
|
317
|
+
'member_not_claimable',
|
|
318
|
+
`Monitor ${member.monitorKey} is ${member.convergence ?? 'not converging'}, so no claim would read the evidence; nothing is recorded.`,
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
if (
|
|
322
|
+
member.convergence === 'submitting' &&
|
|
323
|
+
(member.leaseExpiresAt ?? 0) > input.now
|
|
324
|
+
) {
|
|
325
|
+
return refuse(
|
|
326
|
+
'member_leased',
|
|
327
|
+
`A convergence pass holds monitor ${member.monitorKey} until ${new Date(member.leaseExpiresAt!).toISOString()}; run this again after that.`,
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
if (
|
|
331
|
+
input.proof !== null &&
|
|
332
|
+
input.proof.length > FLEET_FENCE_RELEASE_PROOF_MAX_LENGTH
|
|
333
|
+
) {
|
|
334
|
+
return refuse(
|
|
335
|
+
'proof_too_long',
|
|
336
|
+
`--proof is ${input.proof.length} characters; record at most ${FLEET_FENCE_RELEASE_PROOF_MAX_LENGTH} and link the rest.`,
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if (input.perResource) return decidePerResourceRelease(input, member);
|
|
341
|
+
if (input.reconciliation) {
|
|
342
|
+
return refuse(
|
|
343
|
+
'reconciliation_not_applicable',
|
|
344
|
+
`Monitor ${member.monitorKey} is created through a provider bulk, whose own status and listing decide its release; --outcome applies only to a per-resource provider.`,
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
const bulkId = member.providerOpRef ?? null;
|
|
349
|
+
if (bulkId !== null) {
|
|
350
|
+
if (!input.bulk)
|
|
351
|
+
return { kind: 'read', read: { kind: 'bulk_status', bulkId } };
|
|
352
|
+
if (input.bulk.read === 'error') {
|
|
353
|
+
return refuse(
|
|
354
|
+
'bulk_unreadable',
|
|
355
|
+
`The provider's status for bulk ${bulkId} could not be read (${input.bulk.message}); nothing is released on an unread answer.`,
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
const item = input.bulk.item;
|
|
359
|
+
if (item?.outcome === 'failed') {
|
|
360
|
+
return {
|
|
361
|
+
kind: 'release',
|
|
362
|
+
evidence: { kind: 'bulk_failed', bulkId, failure: item.failure },
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
if (item?.outcome === 'created') {
|
|
366
|
+
return refuse(
|
|
367
|
+
'create_accepted',
|
|
368
|
+
`The provider's bulk ${bulkId} reports this create made radar ${item.providerResourceId}; the convergence publishes or removes it.`,
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
if (item?.outcome === 'processing' || input.bulk.status === 'processing') {
|
|
372
|
+
return refuse(
|
|
373
|
+
'bulk_processing',
|
|
374
|
+
`The provider is still processing bulk ${bulkId}; the member waits on it.`,
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
// A completed bulk that does not name this member as created or failed
|
|
378
|
+
// has not answered for it; only the listing and a proof can.
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if (input.proof === null) {
|
|
382
|
+
return refuse(
|
|
383
|
+
'proof_required',
|
|
384
|
+
bulkId === null
|
|
385
|
+
? 'This create was sent and its answer was lost. A listing that does not show it proves nothing, so pass --proof with the recorded evidence that the provider never accepted it (a request log, a provider confirmation).'
|
|
386
|
+
: `Bulk ${bulkId} did not report this create failed. Pass --proof with the recorded evidence that the provider never accepted it.`,
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
if (!input.listing) {
|
|
390
|
+
return {
|
|
391
|
+
kind: 'read',
|
|
392
|
+
read: {
|
|
393
|
+
kind: 'listing',
|
|
394
|
+
createdSince: fleetFenceListingCreatedSince(member),
|
|
395
|
+
},
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
if (input.listing.read === 'error') {
|
|
399
|
+
return refuse(
|
|
400
|
+
'listing_unreadable',
|
|
401
|
+
`The provider listing could not be read (${input.listing.message}); nothing is released on an unread answer.`,
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
const own = input.listing.matches.find(
|
|
405
|
+
(radar) => radar.orgId === input.orgId,
|
|
406
|
+
);
|
|
407
|
+
if (own) {
|
|
408
|
+
return refuse(
|
|
409
|
+
'create_accepted',
|
|
410
|
+
`The provider holds radar ${own.radarId} (${own.status}) under this member's key and this workspace's stamp, so the create was accepted (KAR-39); the convergence adopts or removes it.`,
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
const other = input.listing.matches[0];
|
|
414
|
+
if (other) {
|
|
415
|
+
return refuse(
|
|
416
|
+
'radar_unattributable',
|
|
417
|
+
`The provider holds radar ${other.radarId} (${other.status}) under this member's key with ${other.orgId === null ? 'no workspace stamp' : 'another workspace stamp'}; an operator must decide whose it is before anything is released. A saved listing walk keeps this radar: once it is reconciled, run the release again with --restart-walk (restartWalk) to read the whole window afresh.`,
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
if (!input.listing.complete) {
|
|
421
|
+
return refuse(
|
|
422
|
+
'listing_incomplete',
|
|
423
|
+
`The listing walk of radars created since ${input.listing.createdSince} is saved at ${input.listing.pages} pages and not finished, so it cannot rule this create out yet. Run the release again: it resumes the walk.`,
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
return {
|
|
427
|
+
kind: 'release',
|
|
428
|
+
evidence: {
|
|
429
|
+
kind: 'listing_absent',
|
|
430
|
+
...(bulkId === null ? {} : { bulkId }),
|
|
431
|
+
createdSince: input.listing.createdSince,
|
|
432
|
+
pages: input.listing.pages,
|
|
433
|
+
scanned: input.listing.scanned,
|
|
434
|
+
proof: input.proof,
|
|
435
|
+
},
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* A per-resource member's release: no provider read exists, so the operator's
|
|
441
|
+
* reconciliation and proof are the evidence. Only a create whose answer was
|
|
442
|
+
* lost qualifies.
|
|
443
|
+
*/
|
|
444
|
+
function decidePerResourceRelease(
|
|
445
|
+
input: Parameters<typeof decideFleetFenceRelease>[0],
|
|
446
|
+
member: FleetFenceReleaseMember,
|
|
447
|
+
): FleetFenceReleaseDecision {
|
|
448
|
+
if (member.providerOpRef) {
|
|
449
|
+
return refuse(
|
|
450
|
+
'create_accepted',
|
|
451
|
+
`This create's answer was recorded: it made ${member.providerOpRef}, which the convergence publishes or removes.`,
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
if (!input.reconciliation) {
|
|
455
|
+
return refuse(
|
|
456
|
+
'reconciliation_required',
|
|
457
|
+
`This create's answer was lost and its provider has no listing Deepline may read. Find the provider monitor stamped deepline_monitor_key=${member.monitorKey}, deepline_org_id=${input.orgId}, then run deepline-admin monitors release-held-create with --outcome deleted --provider-resource-id <id> after deleting it, or --outcome absent if none exists.`,
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
const providerResourceId = input.reconciliation.providerResourceId?.trim();
|
|
461
|
+
if (input.reconciliation.outcome === 'deleted' && !providerResourceId) {
|
|
462
|
+
return refuse(
|
|
463
|
+
'resource_id_required',
|
|
464
|
+
'--outcome deleted needs --provider-resource-id: the id of the provider monitor that was deleted.',
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
if (input.proof === null) {
|
|
468
|
+
return refuse(
|
|
469
|
+
'proof_required',
|
|
470
|
+
'Pass --proof with what was checked (the provider account and how it was searched, and the delete when there was one).',
|
|
471
|
+
);
|
|
472
|
+
}
|
|
473
|
+
return {
|
|
474
|
+
kind: 'release',
|
|
475
|
+
evidence: {
|
|
476
|
+
kind: 'provider_reconciled',
|
|
477
|
+
outcome: input.reconciliation.outcome,
|
|
478
|
+
...(input.reconciliation.outcome === 'deleted'
|
|
479
|
+
? { providerResourceId: providerResourceId! }
|
|
480
|
+
: {}),
|
|
481
|
+
proof: input.proof,
|
|
482
|
+
},
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// ---------------------------------------------------------------------------
|
|
487
|
+
// Releasing every member of one fence op (#11210)
|
|
488
|
+
// ---------------------------------------------------------------------------
|
|
489
|
+
|
|
490
|
+
/*
|
|
491
|
+
* One ambiguous bulk POST fences every member it carried (at most 100) under
|
|
492
|
+
* one op id. `deepline-admin monitors fleets release-fence-op` decides all of
|
|
493
|
+
* them in one call, from one provider read of each kind: each member is
|
|
494
|
+
* decided by `decideFleetFenceRelease` itself, bound to the op id as its
|
|
495
|
+
* `expectedOpId`, so the evidence rules are exactly the per-member verb's. The
|
|
496
|
+
* op decision only gathers the reads its members ask for into one bulk status
|
|
497
|
+
* read per bulk and one listing walk from the earliest fence, and hands each
|
|
498
|
+
* member its own slice of the answers. A member a read finds accepted, or
|
|
499
|
+
* whose fence moved, is refused alone; the rest are released.
|
|
500
|
+
*/
|
|
501
|
+
|
|
502
|
+
/** One bulk item's outcome, as the release decision reads it. */
|
|
503
|
+
export type FleetFenceBulkItem = Exclude<
|
|
504
|
+
Extract<FleetFenceBulkObservation, { read: 'ok' }>['item'],
|
|
505
|
+
null
|
|
506
|
+
>;
|
|
507
|
+
|
|
508
|
+
/** The provider's bulk status for every member it names, by monitor key. */
|
|
509
|
+
export type FleetFenceBulkStatusObservation =
|
|
510
|
+
| { read: 'error'; message: string }
|
|
511
|
+
| {
|
|
512
|
+
read: 'ok';
|
|
513
|
+
status: 'processing' | 'completed';
|
|
514
|
+
items: ReadonlyMap<string, FleetFenceBulkItem>;
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
/** One member's view of a bulk status read for its whole op. */
|
|
518
|
+
export function fleetFenceBulkObservationFor(
|
|
519
|
+
status: FleetFenceBulkStatusObservation,
|
|
520
|
+
monitorKey: string,
|
|
521
|
+
): FleetFenceBulkObservation {
|
|
522
|
+
if (status.read === 'error') return status;
|
|
523
|
+
return {
|
|
524
|
+
read: 'ok',
|
|
525
|
+
status: status.status,
|
|
526
|
+
item: status.items.get(monitorKey) ?? null,
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/** A listing walk for a whole op: each match names the member key it carries. */
|
|
531
|
+
export type FleetFenceOpListingObservation =
|
|
532
|
+
| { read: 'error'; message: string }
|
|
533
|
+
| {
|
|
534
|
+
read: 'ok';
|
|
535
|
+
createdSince: string;
|
|
536
|
+
complete: boolean;
|
|
537
|
+
pages: number;
|
|
538
|
+
scanned: number;
|
|
539
|
+
/** Every key the walk matched pages against. */
|
|
540
|
+
monitorKeys: readonly string[];
|
|
541
|
+
matches: Array<
|
|
542
|
+
FleetFenceListedRadar & {
|
|
543
|
+
monitorKey: string;
|
|
544
|
+
/** Absent or null: no listed creation time, kept as inside. */
|
|
545
|
+
createdAt?: string | null;
|
|
546
|
+
}
|
|
547
|
+
>;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* One member's view of the op's listing walk. The walk starts at the earliest
|
|
552
|
+
* fence among the members that asked for it, so it covers each of theirs; one
|
|
553
|
+
* that started after this member's fence, or that did not look for this
|
|
554
|
+
* member's key (a member a pass held when the walk was asked for), is not
|
|
555
|
+
* evidence for it.
|
|
556
|
+
*/
|
|
557
|
+
export function fleetFenceListingObservationFor(
|
|
558
|
+
listing: FleetFenceOpListingObservation,
|
|
559
|
+
member: Pick<
|
|
560
|
+
FleetFenceReleaseMember,
|
|
561
|
+
'monitorKey' | 'creationTime' | 'opSubmission' | 'opId'
|
|
562
|
+
>,
|
|
563
|
+
): FleetFenceListingObservation {
|
|
564
|
+
if (listing.read === 'error') return listing;
|
|
565
|
+
if (!listing.monitorKeys.includes(member.monitorKey)) {
|
|
566
|
+
return {
|
|
567
|
+
read: 'error',
|
|
568
|
+
message: `the listing walk did not look for ${member.monitorKey}`,
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
const walkedFrom = Date.parse(listing.createdSince);
|
|
572
|
+
const fencedFrom = Date.parse(fleetFenceListingCreatedSince(member));
|
|
573
|
+
if (!(walkedFrom <= fencedFrom)) {
|
|
574
|
+
return {
|
|
575
|
+
read: 'error',
|
|
576
|
+
message: `the listing walked from ${listing.createdSince}, after this fence's ${fleetFenceListingCreatedSince(member)}`,
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
return {
|
|
580
|
+
read: 'ok',
|
|
581
|
+
createdSince: listing.createdSince,
|
|
582
|
+
complete: listing.complete,
|
|
583
|
+
pages: listing.pages,
|
|
584
|
+
scanned: listing.scanned,
|
|
585
|
+
// The walk started at the op's earliest fence; a radar created before this
|
|
586
|
+
// member's own window is not evidence about this member's create (a legacy
|
|
587
|
+
// fence's window starts at its own row's creation). A radar with no
|
|
588
|
+
// listed creation time is kept, which can only refuse a release.
|
|
589
|
+
matches: listing.matches
|
|
590
|
+
.filter(
|
|
591
|
+
(radar) =>
|
|
592
|
+
radar.monitorKey === member.monitorKey &&
|
|
593
|
+
(radar.createdAt == null ||
|
|
594
|
+
!(Date.parse(radar.createdAt) < fencedFrom)),
|
|
595
|
+
)
|
|
596
|
+
.map(({ radarId, orgId, status }) => ({ radarId, orgId, status })),
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/** The next provider read an op release makes, for every member that needs it. */
|
|
601
|
+
export type FleetFenceOpRead =
|
|
602
|
+
| { kind: 'bulk_status'; bulkId: string; monitorKeys: string[] }
|
|
603
|
+
| { kind: 'listing'; createdSince: string; monitorKeys: string[] };
|
|
604
|
+
|
|
605
|
+
/** An op member's decision as far as the reads made so far take it. */
|
|
606
|
+
export type FleetFenceOpMemberDecision = {
|
|
607
|
+
monitorKey: string;
|
|
608
|
+
decision: FleetFenceReleaseDecision;
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
export type FleetFenceOpReleaseRefusal = 'op_not_found';
|
|
612
|
+
|
|
613
|
+
export type FleetFenceOpReleaseDecision =
|
|
614
|
+
| { kind: 'refuse'; code: FleetFenceOpReleaseRefusal; message: string }
|
|
615
|
+
/** Some members wait on `read`; `members` holds every member's decision. */
|
|
616
|
+
| {
|
|
617
|
+
kind: 'read';
|
|
618
|
+
read: FleetFenceOpRead;
|
|
619
|
+
members: FleetFenceOpMemberDecision[];
|
|
620
|
+
}
|
|
621
|
+
/** Every member decided: released, refused or already recorded. */
|
|
622
|
+
| { kind: 'decided'; members: FleetFenceOpMemberDecision[] };
|
|
623
|
+
|
|
624
|
+
/** A member of an op, with whether its tool creates one resource per request. */
|
|
625
|
+
export type FleetFenceOpMember = FleetFenceReleaseMember & {
|
|
626
|
+
perResource?: boolean;
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
export function decideFleetFenceOpRelease(input: {
|
|
630
|
+
orgId: string;
|
|
631
|
+
fleetId: string;
|
|
632
|
+
/** The fence op every member was found under. */
|
|
633
|
+
opId: string;
|
|
634
|
+
/** Every member found carrying the op's fence, read now. */
|
|
635
|
+
members: readonly FleetFenceOpMember[];
|
|
636
|
+
now: number;
|
|
637
|
+
proof: string | null;
|
|
638
|
+
/** Each bulk status read so far, by bulk id. */
|
|
639
|
+
bulks?: ReadonlyMap<string, FleetFenceBulkStatusObservation>;
|
|
640
|
+
/** The op's listing walk, once made. */
|
|
641
|
+
listing?: FleetFenceOpListingObservation;
|
|
642
|
+
}): FleetFenceOpReleaseDecision {
|
|
643
|
+
if (input.members.length === 0) {
|
|
644
|
+
return {
|
|
645
|
+
kind: 'refuse',
|
|
646
|
+
code: 'op_not_found',
|
|
647
|
+
message: `No member of Fleet ${input.fleetId} carries fence ${input.opId} in a state a claim takes it from (rate_limited or submitting), so there is nothing to release.`,
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
const members: FleetFenceOpMemberDecision[] = input.members.map(
|
|
651
|
+
({ perResource, ...member }) => {
|
|
652
|
+
const bulkId = member.providerOpRef ?? null;
|
|
653
|
+
const status = bulkId === null ? undefined : input.bulks?.get(bulkId);
|
|
654
|
+
const bulk = status
|
|
655
|
+
? fleetFenceBulkObservationFor(status, member.monitorKey)
|
|
656
|
+
: undefined;
|
|
657
|
+
return {
|
|
658
|
+
monitorKey: member.monitorKey,
|
|
659
|
+
decision: decideFleetFenceRelease({
|
|
660
|
+
orgId: input.orgId,
|
|
661
|
+
fleetId: input.fleetId,
|
|
662
|
+
member,
|
|
663
|
+
now: input.now,
|
|
664
|
+
proof: input.proof,
|
|
665
|
+
// Found under the op, so bound to it: a member whose fence moved
|
|
666
|
+
// since is about another create attempt.
|
|
667
|
+
expectedOpId: input.opId,
|
|
668
|
+
...(bulk ? { bulk } : {}),
|
|
669
|
+
...(input.listing
|
|
670
|
+
? {
|
|
671
|
+
listing: fleetFenceListingObservationFor(input.listing, member),
|
|
672
|
+
}
|
|
673
|
+
: {}),
|
|
674
|
+
...(perResource ? { perResource } : {}),
|
|
675
|
+
}),
|
|
676
|
+
};
|
|
677
|
+
},
|
|
678
|
+
);
|
|
679
|
+
const reads = members.flatMap((entry) =>
|
|
680
|
+
entry.decision.kind === 'read'
|
|
681
|
+
? [{ monitorKey: entry.monitorKey, read: entry.decision.read }]
|
|
682
|
+
: [],
|
|
683
|
+
);
|
|
684
|
+
// Every bulk status first: a member its bulk reports failed needs no
|
|
685
|
+
// listing, so the walk covers only the members the bulks left undecided.
|
|
686
|
+
const bulkReads = reads.flatMap(({ monitorKey, read }) =>
|
|
687
|
+
read.kind === 'bulk_status' ? [{ monitorKey, bulkId: read.bulkId }] : [],
|
|
688
|
+
);
|
|
689
|
+
if (bulkReads.length > 0) {
|
|
690
|
+
const bulkId = bulkReads[0]!.bulkId;
|
|
691
|
+
return {
|
|
692
|
+
kind: 'read',
|
|
693
|
+
read: {
|
|
694
|
+
kind: 'bulk_status',
|
|
695
|
+
bulkId,
|
|
696
|
+
monitorKeys: bulkReads
|
|
697
|
+
.filter((read) => read.bulkId === bulkId)
|
|
698
|
+
.map((read) => read.monitorKey),
|
|
699
|
+
},
|
|
700
|
+
members,
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
const listingReads = reads.flatMap(({ monitorKey, read }) =>
|
|
704
|
+
read.kind === 'listing'
|
|
705
|
+
? [{ monitorKey, createdSince: read.createdSince }]
|
|
706
|
+
: [],
|
|
707
|
+
);
|
|
708
|
+
if (listingReads.length > 0) {
|
|
709
|
+
// From the earliest fence, so the one walk covers every member's window.
|
|
710
|
+
const createdSince = listingReads
|
|
711
|
+
.map((read) => read.createdSince)
|
|
712
|
+
.reduce((earliest, candidate) =>
|
|
713
|
+
Date.parse(candidate) < Date.parse(earliest) ? candidate : earliest,
|
|
714
|
+
);
|
|
715
|
+
return {
|
|
716
|
+
kind: 'read',
|
|
717
|
+
read: {
|
|
718
|
+
kind: 'listing',
|
|
719
|
+
createdSince,
|
|
720
|
+
monitorKeys: listingReads.map((read) => read.monitorKey),
|
|
721
|
+
},
|
|
722
|
+
members,
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
return { kind: 'decided', members };
|
|
726
|
+
}
|