deepline 0.3.88 → 0.3.90
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/contracts/install-commands.json +29 -0
- package/dist/bundling-sources/sdk/src/client.ts +652 -39
- package/dist/bundling-sources/sdk/src/config.ts +77 -0
- package/dist/bundling-sources/sdk/src/http.ts +76 -30
- package/dist/bundling-sources/sdk/src/index.ts +10 -0
- package/dist/bundling-sources/sdk/src/monitor-fleet-contract.ts +1 -1
- package/dist/bundling-sources/sdk/src/pagination.ts +25 -0
- package/dist/bundling-sources/sdk/src/play.ts +15 -1
- package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +3 -3
- package/dist/bundling-sources/sdk/src/release.ts +16 -9
- package/dist/bundling-sources/sdk/src/types.ts +106 -4
- package/dist/bundling-sources/shared_libs/integration-contracts/AGENTS.md +9 -0
- package/dist/bundling-sources/shared_libs/integration-contracts/README.md +3 -0
- package/dist/bundling-sources/shared_libs/integration-contracts/index.ts +2 -0
- package/dist/bundling-sources/shared_libs/monitors/analytics-install-guides.ts +77 -0
- package/dist/bundling-sources/shared_libs/monitors/analytics-public.ts +10 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/charges.ts +125 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/policy-builders.ts +686 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/pricing.ts +54 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/public-pricing.ts +72 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/session.ts +45 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/state.ts +454 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/tamradar.ts +260 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/types.ts +215 -0
- package/dist/bundling-sources/shared_libs/monitors/callback-security.ts +333 -0
- package/dist/bundling-sources/shared_libs/monitors/cursor-page.ts +42 -0
- package/dist/bundling-sources/shared_libs/monitors/deactivation-reasons.ts +16 -0
- package/dist/bundling-sources/shared_libs/monitors/framework-managed-payload-fields.ts +71 -0
- package/dist/bundling-sources/shared_libs/monitors/generated/provider-monitor-callback-admission-targets.ts +16 -0
- package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +270 -0
- package/dist/bundling-sources/shared_libs/monitors/inbound-publish-key.ts +39 -0
- package/dist/bundling-sources/shared_libs/monitors/inbound-queue.ts +82 -0
- package/dist/bundling-sources/shared_libs/monitors/inventory-reconciliation.ts +59 -0
- package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +471 -0
- package/dist/bundling-sources/shared_libs/monitors/org-monitor-limits.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/package.json +36 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +1125 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +305 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts +964 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-consumer-health.ts +56 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts +131 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +535 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-legacy-aliases.ts +16 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-priority-execution.ts +56 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +28 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-runtime-read-eligibility.ts +38 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-state.ts +122 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-status.ts +10 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +112 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-webhook-monitor-runtime.ts +300 -0
- package/dist/bundling-sources/shared_libs/monitors/quickstart-prompts.ts +22 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +245 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-message.ts +38 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue-ack-probe.ts +94 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue-delivery.ts +60 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue.ts +60 -0
- package/dist/bundling-sources/shared_libs/monitors/snitcher-install-validation.ts +93 -0
- package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +332 -0
- package/dist/bundling-sources/shared_libs/monitors/snitcher-radar.ts +221 -0
- package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +105 -0
- package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +73 -0
- package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +81 -0
- package/dist/bundling-sources/shared_libs/monitors/tsconfig.json +10 -0
- package/dist/bundling-sources/shared_libs/observability/build-context.ts +13 -0
- package/dist/bundling-sources/shared_libs/observability/log-metadata.ts +160 -0
- package/dist/bundling-sources/shared_libs/observability/request-context.ts +68 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +654 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +35 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-work.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/neon-constants.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +272 -0
- package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +6 -11
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +135 -12
- package/dist/bundling-sources/shared_libs/play-runtime/async-operation.ts +66 -1
- package/dist/bundling-sources/shared_libs/play-runtime/async-play-invocation.ts +77 -0
- package/dist/bundling-sources/shared_libs/play-runtime/bounceban-batching.ts +137 -0
- package/dist/bundling-sources/shared_libs/play-runtime/checkpoint-boundaries.ts +70 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +1159 -166
- package/dist/bundling-sources/shared_libs/play-runtime/coordinator-headers.ts +1 -32
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +103 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-payload-contract.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-janitor.ts +103 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-reaper.ts +725 -0
- package/dist/bundling-sources/shared_libs/play-runtime/default-batch-strategies.ts +20 -1
- package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +29 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +29 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-gateway-invocation-fence.ts +442 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-protocol.ts +7 -1
- package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/contracts.ts +66 -0
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/job.ts +145 -0
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/ports.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/postgres-store.ts +170 -0
- package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +1322 -0
- package/dist/bundling-sources/shared_libs/play-runtime/internal-step-ids.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/lane-retirement-gate.ts +189 -0
- package/dist/bundling-sources/shared_libs/play-runtime/launch-source-policy.ts +112 -0
- package/dist/bundling-sources/shared_libs/play-runtime/map-execution-frame.ts +8 -0
- package/dist/bundling-sources/shared_libs/play-runtime/perf-trace.ts +127 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-artifact-runtime-contract.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts +24 -1
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/contracts.ts +56 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/index.ts +13 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/job.ts +41 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/ports.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/postgres-adapter.ts +54 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/contracts.ts +114 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/engine-suspension.ts +108 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/index.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/job.ts +97 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/ports.ts +104 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/postgres-fence-adapter.ts +263 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/worker-terminal-projection.ts +64 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/contracts.ts +29 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/gateway-adapter.ts +56 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/index.ts +15 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/job.ts +65 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/ports.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/contracts.ts +42 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/index.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +142 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/ports.ts +42 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/postgres-adapter.ts +102 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/contracts.ts +60 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/index.ts +16 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/job.ts +78 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/ports.ts +54 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/postgres-adapter.ts +71 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-semantics.ts +28 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/receipt-status.ts +5 -8
- package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +23 -2
- package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +168 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +90 -13
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +6 -12
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-start-admission.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/bundle.ts +0 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +14 -43
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +67 -213
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +201 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-capacity-policy.ts +20 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-contract.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-env.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +67 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-release-environment.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sandbox-contract.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +38 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-telemetry.ts +108 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +37 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-deadline-reconciliation.ts +88 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-play-deploy-task.ts +124 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-play-run-task.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +193 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-queue-lifecycle.ts +269 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-queue-suffix.ts +73 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +6642 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +897 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-metrics.ts +120 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-required-env.ts +76 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +476 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-heavy-request-admission.ts +47 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-progress-registry.ts +147 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/index.ts +27 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/lazy.ts +50 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +98 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-budget-state.ts +260 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +1416 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +1255 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +942 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +14636 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +888 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +355 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-terminal-transition.ts +46 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runner-push.ts +60 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +33 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-gateway-health.ts +64 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +835 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-ledger-reconciliation.ts +1218 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-operation.ts +207 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-scheduler-schema.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/scheduler-capacity.ts +123 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/scheduler-launch-read-observability.ts +78 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/submit-admission.ts +169 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/terminal-contract.ts +20 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/worker-queue-metrics.ts +34 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/worker-resource-metrics.ts +249 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sheet-attempt-sql.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/step-progress.ts +296 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/native-batch.ts +3 -3
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts +20 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +60 -15
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execution-outcome.ts +20 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/vercel-protection.ts +14 -1
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +165 -0
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +15 -23
- package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +169 -0
- package/dist/bundling-sources/shared_libs/play-runtime/zerobounce-batching.ts +122 -0
- package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +8 -3
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +454 -17
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +19 -4
- package/dist/bundling-sources/shared_libs/plays/contracts.ts +8 -14
- package/dist/bundling-sources/shared_libs/plays/core.ts +11 -6
- package/dist/bundling-sources/shared_libs/plays/deployment-status.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/docflow-binding-owner.ts +16 -11
- package/dist/bundling-sources/shared_libs/plays/docflow.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/email-status.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/play-grep-search.ts +39 -0
- package/dist/bundling-sources/shared_libs/plays/resolve-static-pipeline.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/share/copy.ts +271 -0
- package/dist/bundling-sources/shared_libs/plays/share/metrics.ts +140 -0
- package/dist/bundling-sources/shared_libs/plays/share/public-read-model.ts +86 -0
- package/dist/bundling-sources/shared_libs/plays/share/seo-quality.ts +181 -0
- package/dist/bundling-sources/shared_libs/plays/share/static-pipeline-summary.ts +658 -0
- package/dist/bundling-sources/shared_libs/plays/share/types.ts +197 -0
- package/dist/bundling-sources/shared_libs/plays/slack-hitl-timeout-error.ts +37 -0
- package/dist/bundling-sources/shared_libs/plays/slug.ts +115 -0
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +50 -15
- package/dist/bundling-sources/shared_libs/plays/tool-category-descriptions.ts +2 -2
- package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +1 -1
- package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +877 -0
- package/dist/bundling-sources/shared_libs/product-notifications/configuration-draft.ts +456 -0
- package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +566 -0
- package/dist/bundling-sources/shared_libs/product-notifications/content.ts +28 -0
- package/dist/bundling-sources/shared_libs/product-notifications/default-policy.ts +60 -0
- package/dist/bundling-sources/shared_libs/product-notifications/email.ts +246 -0
- package/dist/bundling-sources/shared_libs/product-notifications/evaluation.ts +280 -0
- package/dist/bundling-sources/shared_libs/product-notifications/events.ts +433 -0
- package/dist/bundling-sources/shared_libs/product-notifications/legacy-slack.ts +80 -0
- package/dist/bundling-sources/shared_libs/product-notifications/overflow.ts +18 -0
- package/dist/bundling-sources/shared_libs/product-notifications/rolling-limit.ts +24 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +624 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-payload.ts +140 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-transport.ts +75 -0
- package/dist/bundling-sources/shared_libs/product-notifications/workspace.ts +38 -0
- package/dist/bundling-sources/shared_libs/runtime-env.ts +12 -0
- package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +42 -0
- package/dist/bundling-sources/shared_libs/security/header-safe-env.ts +35 -0
- package/dist/bundling-sources/shared_libs/security/internal-actor.ts +50 -0
- package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +267 -0
- package/dist/bundling-sources/shared_libs/security/slack-sanitize.ts +133 -0
- package/dist/cli/getting-started.d.mts +52 -0
- package/dist/cli/getting-started.d.ts +52 -0
- package/dist/cli/getting-started.js +65 -0
- package/dist/cli/getting-started.mjs +36 -0
- package/dist/cli/index.d.mts +9 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.js +1611 -453
- package/dist/cli/index.mjs +1596 -447
- package/dist/{compiler-manifest-Dbov16F7.d.mts → compiler-manifest-BaJfE-5H.d.mts} +136 -10
- package/dist/{compiler-manifest-Dbov16F7.d.ts → compiler-manifest-BaJfE-5H.d.ts} +136 -10
- package/dist/index.d.mts +910 -155
- package/dist/index.d.ts +910 -155
- package/dist/index.js +550 -64
- package/dist/index.mjs +550 -64
- package/dist/install-integrity.json +193 -4
- package/dist/monitor-fleet-contract.d.mts +138 -0
- package/dist/monitor-fleet-contract.d.ts +138 -0
- package/dist/monitor-fleet-contract.js +404 -0
- package/dist/monitor-fleet-contract.mjs +367 -0
- package/dist/plays/bundle-play-file.d.mts +8 -3
- package/dist/plays/bundle-play-file.d.ts +8 -3
- package/dist/plays/bundle-play-file.mjs +100 -20
- package/dist/release.d.mts +255 -0
- package/dist/release.d.ts +255 -0
- package/dist/release.js +215 -0
- package/dist/release.mjs +188 -0
- package/package.json +23 -4
- /package/dist/bundling-sources/shared_libs/{integrations/bettercontact-execution-policy.ts → integration-contracts/bettercontact/execution-policy.ts} +0 -0
- /package/dist/bundling-sources/shared_libs/{integrations/theirstack-execution-policy.ts → integration-contracts/theirstack/execution-policy.ts} +0 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { NextResponse } from 'next/server';
|
|
2
|
+
|
|
3
|
+
import { MAX_PRIORITY_MONITORS_PER_ORG } from '@deepline/monitors/provider-monitor-priority-execution';
|
|
4
|
+
|
|
5
|
+
export const MONITOR_ERROR_FALLBACK_NEXT_ACTION =
|
|
6
|
+
"Do not retry blindly. Read the deepline-monitors skill's 'Recover from errors by code' section, inspect the returned message and relevant state, then diagnose this failure.";
|
|
7
|
+
|
|
8
|
+
type MonitorErrorPayload = Record<string, unknown>;
|
|
9
|
+
|
|
10
|
+
function asRecord(value: unknown): Record<string, unknown> | null {
|
|
11
|
+
return value && typeof value === 'object' && !Array.isArray(value)
|
|
12
|
+
? (value as Record<string, unknown>)
|
|
13
|
+
: null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function errorCode(payload: MonitorErrorPayload): string {
|
|
17
|
+
const nested = asRecord(payload.error);
|
|
18
|
+
const value = nested?.code ?? payload.code;
|
|
19
|
+
return typeof value === 'string' ? value : '';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function nestedError(
|
|
23
|
+
payload: MonitorErrorPayload,
|
|
24
|
+
): Record<string, unknown> | null {
|
|
25
|
+
return asRecord(payload.error);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function upstreamRetryAfterSeconds(
|
|
29
|
+
error: Record<string, unknown>,
|
|
30
|
+
): number | null {
|
|
31
|
+
const declared = error.retryAfterSeconds;
|
|
32
|
+
if (
|
|
33
|
+
typeof declared === 'number' &&
|
|
34
|
+
Number.isFinite(declared) &&
|
|
35
|
+
declared >= 0
|
|
36
|
+
) {
|
|
37
|
+
return Math.ceil(declared);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const headers = asRecord(error.headers);
|
|
41
|
+
const retryAfter = headers?.['retry-after'];
|
|
42
|
+
if (typeof retryAfter !== 'string' || !retryAfter.trim()) return null;
|
|
43
|
+
const numeric = Number(retryAfter);
|
|
44
|
+
if (Number.isFinite(numeric) && numeric >= 0) return Math.ceil(numeric);
|
|
45
|
+
|
|
46
|
+
const retryAt = Date.parse(retryAfter);
|
|
47
|
+
if (!Number.isFinite(retryAt)) return null;
|
|
48
|
+
return Math.max(0, Math.ceil((retryAt - Date.now()) / 1_000));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Classify only the monitor-lifecycle upstream failures that are safe to
|
|
53
|
+
* explain generically. This deliberately duck-types the integration error:
|
|
54
|
+
* monitor route tests and provider adapters can cross module boundaries, but
|
|
55
|
+
* the stable discriminant is part of the shared integration error contract.
|
|
56
|
+
*
|
|
57
|
+
* Do not relay the upstream message or body. They can contain provider account
|
|
58
|
+
* identifiers, request details, or provider-only diagnostics. The status and
|
|
59
|
+
* normalized Retry-After are enough for a customer to make a safe next move.
|
|
60
|
+
*/
|
|
61
|
+
export function monitorUpstreamFailureResponse(
|
|
62
|
+
error: unknown,
|
|
63
|
+
): NextResponse | null {
|
|
64
|
+
const upstream = asRecord(error);
|
|
65
|
+
if (
|
|
66
|
+
upstream?.isIntegrationUpstreamHttpError !== true ||
|
|
67
|
+
typeof upstream.status !== 'number'
|
|
68
|
+
) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const retryAfterSeconds = upstreamRetryAfterSeconds(upstream);
|
|
73
|
+
const retryHeaders =
|
|
74
|
+
retryAfterSeconds === null
|
|
75
|
+
? undefined
|
|
76
|
+
: { 'retry-after': String(retryAfterSeconds) };
|
|
77
|
+
|
|
78
|
+
if (upstream.status === 429) {
|
|
79
|
+
return monitorErrorResponse(
|
|
80
|
+
{
|
|
81
|
+
error: {
|
|
82
|
+
code: 'monitor_upstream_rate_limited',
|
|
83
|
+
message:
|
|
84
|
+
'The monitor provider is rate limiting lifecycle requests. Deepline could not confirm completion of this lifecycle change.',
|
|
85
|
+
upstream_status: upstream.status,
|
|
86
|
+
...(retryAfterSeconds === null
|
|
87
|
+
? {}
|
|
88
|
+
: { retry_after_seconds: retryAfterSeconds }),
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{ status: 429, headers: retryHeaders },
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (upstream.status >= 500 && upstream.status <= 599) {
|
|
96
|
+
return monitorErrorResponse(
|
|
97
|
+
{
|
|
98
|
+
error: {
|
|
99
|
+
code: 'monitor_upstream_unavailable',
|
|
100
|
+
message:
|
|
101
|
+
'The monitor provider is temporarily unavailable. Deepline could not confirm completion of this lifecycle change.',
|
|
102
|
+
upstream_status: upstream.status,
|
|
103
|
+
...(retryAfterSeconds === null
|
|
104
|
+
? {}
|
|
105
|
+
: { retry_after_seconds: retryAfterSeconds }),
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{ status: 503, headers: retryHeaders },
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Server-owned recovery guidance for every agent-facing monitor error.
|
|
117
|
+
* Known codes get an exact next step. Unknown failures deliberately point at
|
|
118
|
+
* the monitor skill and prohibit blind retries instead of inventing a fix.
|
|
119
|
+
*/
|
|
120
|
+
export function monitorErrorNextAction(payload: MonitorErrorPayload): string {
|
|
121
|
+
const code = errorCode(payload);
|
|
122
|
+
const retryAfterMs = payload.retry_after_ms;
|
|
123
|
+
const retryAfterSeconds =
|
|
124
|
+
nestedError(payload)?.retry_after_seconds ?? payload.retry_after_seconds;
|
|
125
|
+
|
|
126
|
+
if (code === 'monitor_access_required') {
|
|
127
|
+
return 'Stop monitor work and contact the Deepline team to request access; then rerun `deepline monitors status --json`.';
|
|
128
|
+
}
|
|
129
|
+
if (code === 'monitor_tool_not_found' || code === 'unknown_monitor_tool') {
|
|
130
|
+
return 'Run `deepline monitors available --json`, choose a returned tool id, then retry with that exact id.';
|
|
131
|
+
}
|
|
132
|
+
if (code === 'deployed_monitor_not_found' || code === 'monitor_not_found') {
|
|
133
|
+
return 'Run `deepline monitors list --status all --json`, choose a returned public monitor key, then retry with that key.';
|
|
134
|
+
}
|
|
135
|
+
if (code === 'ingestion_plane_not_ready') {
|
|
136
|
+
return typeof retryAfterMs === 'number'
|
|
137
|
+
? `Wait ${retryAfterMs} ms, then retry the same read or check once.`
|
|
138
|
+
: 'Wait for Customer DB provisioning, then retry the same read or check once.';
|
|
139
|
+
}
|
|
140
|
+
if (code === 'monitor_control_plane_unavailable') {
|
|
141
|
+
return 'Wait briefly, then rerun the same monitor read. No monitor state was changed.';
|
|
142
|
+
}
|
|
143
|
+
if (code === 'provider_monitor_identity_backfill_in_progress') {
|
|
144
|
+
return typeof retryAfterSeconds === 'number'
|
|
145
|
+
? `Wait ${retryAfterSeconds} seconds, then retry the same monitor lifecycle request once. No upstream monitor was created.`
|
|
146
|
+
: 'Wait briefly, then retry the same monitor lifecycle request once. No upstream monitor was created.';
|
|
147
|
+
}
|
|
148
|
+
if (code === 'provider_monitor_capacity_backfill_in_progress') {
|
|
149
|
+
return typeof retryAfterSeconds === 'number'
|
|
150
|
+
? `Wait ${retryAfterSeconds} seconds, then retry the same monitor create once. No upstream monitor was created.`
|
|
151
|
+
: 'Wait briefly, then retry the same monitor create once. No upstream monitor was created.';
|
|
152
|
+
}
|
|
153
|
+
if (code === 'ORG_MONITOR_LIMIT_EXCEEDED') {
|
|
154
|
+
return 'Run `deepline monitors list --status all --json`; stop watching an account you no longer need, or contact Deepline for a higher account limit.';
|
|
155
|
+
}
|
|
156
|
+
if (code === 'MONITOR_ENTITY_LIMIT_EXCEEDED') {
|
|
157
|
+
return 'This account already carries the maximum number of monitors. Delete one of its monitors, or watch the signal on a different account.';
|
|
158
|
+
}
|
|
159
|
+
if (code === 'MONITOR_CAPACITY_CLEANUP_REQUIRED') {
|
|
160
|
+
return 'Inspect the monitor and complete upstream cleanup before recreating this public key. Do not retry create blindly.';
|
|
161
|
+
}
|
|
162
|
+
if (code === 'MONITOR_MANAGED_BY_FLEET') {
|
|
163
|
+
return 'Change the owning Monitor Fleet or deactivate it before mutating this member directly.';
|
|
164
|
+
}
|
|
165
|
+
if (code === 'provider_monitor_operation_in_progress') {
|
|
166
|
+
return 'Rerun the same deploy or update that started this change. Do not send a different change until it finishes.';
|
|
167
|
+
}
|
|
168
|
+
if (code === 'provider_monitor_delete_in_progress') {
|
|
169
|
+
return 'Rerun the same delete now. Do not deploy, update, or reactivate this monitor until that delete finishes.';
|
|
170
|
+
}
|
|
171
|
+
if (
|
|
172
|
+
code === 'invalid_limit' ||
|
|
173
|
+
code === 'invalid_monitor_status' ||
|
|
174
|
+
code === 'unknown_monitor_tool_filter' ||
|
|
175
|
+
code === 'unknown_deployed_monitor_filter'
|
|
176
|
+
) {
|
|
177
|
+
return 'Correct the request using the returned expected, received, or suggestion fields, then retry once.';
|
|
178
|
+
}
|
|
179
|
+
if (code === 'monitor_deploy_validation_failed') {
|
|
180
|
+
return 'Fix every returned issue using its path and suggestion. Rerun `deepline monitors check` for definitions or the relevant dry-run for delete/reactivate; do not mutate until validation passes.';
|
|
181
|
+
}
|
|
182
|
+
if (code === 'monitor_tool_unavailable') {
|
|
183
|
+
return 'Run `deepline monitors available --json`; choose a tool returned for this workspace, or stop and request access to the unavailable capability.';
|
|
184
|
+
}
|
|
185
|
+
if (code === 'monitor_entitlement_limit_exceeded') {
|
|
186
|
+
return 'Run `deepline monitors list --status all --json`; reuse or disable an existing monitor, or ask the user to change entitlement before retrying.';
|
|
187
|
+
}
|
|
188
|
+
if (code === 'priority_monitor_limit_exceeded') {
|
|
189
|
+
return `This workspace already has ${MAX_PRIORITY_MONITORS_PER_ORG} priority radars. Delete or update an existing priority radar only after confirming it is no longer needed, then retry the urgent preview.`;
|
|
190
|
+
}
|
|
191
|
+
if (code === 'monitor_already_exists') {
|
|
192
|
+
const existing = asRecord(nestedError(payload)?.existing_monitor)?.key;
|
|
193
|
+
return typeof existing === 'string'
|
|
194
|
+
? `Run \`deepline monitors get ${existing} --json\` to inspect the monitor that owns this identity. Reuse it or contact Deepline support before replacing it; do not delete and redeploy blindly.`
|
|
195
|
+
: 'Inspect the returned existing_monitor.key with `deepline monitors get <key> --json`. Reuse that monitor or contact Deepline support before replacing it; do not delete and redeploy blindly.';
|
|
196
|
+
}
|
|
197
|
+
if (code === 'upstream_monitor_conflict_unresolved') {
|
|
198
|
+
const existing = asRecord(nestedError(payload)?.existing_monitor)?.key;
|
|
199
|
+
return typeof existing === 'string'
|
|
200
|
+
? `Run \`deepline monitors get ${existing} --json\` to inspect the matching managed monitor, then report this upstream 409 to Deepline support. Do not retry blindly.`
|
|
201
|
+
: 'Report this upstream 409 to Deepline support with the returned tool and identity. Do not retry blindly.';
|
|
202
|
+
}
|
|
203
|
+
if (code === 'monitor_upstream_rate_limited') {
|
|
204
|
+
return typeof retryAfterSeconds === 'number'
|
|
205
|
+
? `Wait ${retryAfterSeconds} seconds, then run \`deepline monitors get <key> --json\` to inspect the stored state. Do not retry or create another monitor unless that state confirms the prior lifecycle action was not applied; if it is missing or unclear, contact Deepline support with the returned upstream_status.`
|
|
206
|
+
: 'Wait briefly, then run `deepline monitors get <key> --json` to inspect the stored state. Do not retry or create another monitor unless that state confirms the prior lifecycle action was not applied; if it is missing or unclear, contact Deepline support with the returned upstream_status.';
|
|
207
|
+
}
|
|
208
|
+
if (code === 'monitor_upstream_unavailable') {
|
|
209
|
+
return typeof retryAfterSeconds === 'number'
|
|
210
|
+
? `Wait ${retryAfterSeconds} seconds, then run \`deepline monitors get <key> --json\` to inspect the stored state. Do not retry or create another monitor unless that state confirms the prior lifecycle action was not applied; if it is missing or unclear, contact Deepline support with the returned upstream_status.`
|
|
211
|
+
: 'Wait briefly, then run `deepline monitors get <key> --json` to inspect the stored state. Do not retry or create another monitor unless that state confirms the prior lifecycle action was not applied; if it is missing or unclear, contact Deepline support with the returned upstream_status.';
|
|
212
|
+
}
|
|
213
|
+
if (
|
|
214
|
+
code === 'monitor_entitlement_required' ||
|
|
215
|
+
code === 'monitor_billing_policy_blocked'
|
|
216
|
+
) {
|
|
217
|
+
return 'Stop and report the required monitor entitlement or unresolved pricing policy; do not retry until the Deepline team resolves it.';
|
|
218
|
+
}
|
|
219
|
+
if (code === 'monitor_billing_denied') {
|
|
220
|
+
return 'Report the returned required credits, balance, and shortfall, then stop; retry only after the user adds credits or changes the plan.';
|
|
221
|
+
}
|
|
222
|
+
if (code === 'BILLING_UNAVAILABLE') {
|
|
223
|
+
return 'Wait briefly and retry the same read or check once; do not repeat a mutation until its monitor state is verified.';
|
|
224
|
+
}
|
|
225
|
+
if (
|
|
226
|
+
code === 'monitor_billing_settlement_failed' ||
|
|
227
|
+
code.includes('cleanup_required') ||
|
|
228
|
+
code.includes('cleanup_failed')
|
|
229
|
+
) {
|
|
230
|
+
return 'Run `deepline monitors get <key> --json`, report the disabled or repair-required state, and do not repeat the mutation blindly.';
|
|
231
|
+
}
|
|
232
|
+
if (code === 'no_active_org') {
|
|
233
|
+
return 'Select an active organization, verify it with `deepline auth status --json`, then retry.';
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return MONITOR_ERROR_FALLBACK_NEXT_ACTION;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export function monitorErrorResponse(
|
|
240
|
+
payload: MonitorErrorPayload,
|
|
241
|
+
init: { status: number; headers?: HeadersInit },
|
|
242
|
+
): NextResponse {
|
|
243
|
+
return NextResponse.json(
|
|
244
|
+
{
|
|
245
|
+
...payload,
|
|
246
|
+
next_action:
|
|
247
|
+
typeof payload.next_action === 'string'
|
|
248
|
+
? payload.next_action
|
|
249
|
+
: monitorErrorNextAction(payload),
|
|
250
|
+
},
|
|
251
|
+
init,
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** Add monitor-specific recovery guidance to auth errors created upstream. */
|
|
256
|
+
export async function withMonitorErrorNextAction(
|
|
257
|
+
response: NextResponse,
|
|
258
|
+
): Promise<NextResponse> {
|
|
259
|
+
if (response.status < 400) return response;
|
|
260
|
+
const payload = (await response
|
|
261
|
+
.clone()
|
|
262
|
+
.json()
|
|
263
|
+
.catch(() => null)) as unknown;
|
|
264
|
+
const record = asRecord(payload);
|
|
265
|
+
if (!record) return response;
|
|
266
|
+
|
|
267
|
+
const headers = new Headers(response.headers);
|
|
268
|
+
headers.delete('content-length');
|
|
269
|
+
return monitorErrorResponse(record, { status: response.status, headers });
|
|
270
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import {
|
|
3
|
+
parseProviderCallbackPayload,
|
|
4
|
+
providerCallbackWireEventId,
|
|
5
|
+
} from '@deepline/monitors/provider-callback-verification';
|
|
6
|
+
|
|
7
|
+
// The Neon-free publish idempotency key the thin receiver forwards to the queue
|
|
8
|
+
// producer's send(..., { idempotencyKey }). Pure function of what is on the wire:
|
|
9
|
+
// (provider, orgId, token) scope + the stable provider event id derived from
|
|
10
|
+
// headers+payload. A provider re-POST of the SAME event yields the SAME key
|
|
11
|
+
// (deduped at publish); two DISTINCT events yield DIFFERENT keys; a token/org
|
|
12
|
+
// swap can never collide. When the provider gives no id, providerCallbackWireEventId
|
|
13
|
+
// falls back to a deterministic sha256 of the payload, so the key stays stable
|
|
14
|
+
// and content-addressed (never random).
|
|
15
|
+
//
|
|
16
|
+
// Lives in its own module (not /monitors/inbound-queue) so the thin receiver
|
|
17
|
+
// can import the REAL helper even when tests fake the queue producer seam.
|
|
18
|
+
export function signalRadarInboundPublishIdempotencyKey(input: {
|
|
19
|
+
provider: string;
|
|
20
|
+
orgId: string;
|
|
21
|
+
token: string;
|
|
22
|
+
headers: Headers;
|
|
23
|
+
rawBody: string;
|
|
24
|
+
}): string {
|
|
25
|
+
const payload = parseProviderCallbackPayload({
|
|
26
|
+
contentType: input.headers.get('content-type'),
|
|
27
|
+
rawBody: input.rawBody,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const eventId = providerCallbackWireEventId({
|
|
31
|
+
provider: input.provider,
|
|
32
|
+
headers: input.headers,
|
|
33
|
+
payload,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return `sr_inbound_${createHash('sha256')
|
|
37
|
+
.update(JSON.stringify([input.provider, input.orgId, input.token, eventId]))
|
|
38
|
+
.digest('hex')}`;
|
|
39
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { signalRadarInboundPublishIdempotencyKey } from '@deepline/monitors/inbound-publish-key';
|
|
2
|
+
import {
|
|
3
|
+
classifyInboundFailure,
|
|
4
|
+
recordSignalRadarDeadLetter as recordSignalRadarDeadLetterCore,
|
|
5
|
+
type InboundFailureClass,
|
|
6
|
+
type InboundPgClient,
|
|
7
|
+
} from '@deepline/monitors/signal-radars/inbound-dead-letter';
|
|
8
|
+
import {
|
|
9
|
+
send as sendSignalRadarInbound,
|
|
10
|
+
SIGNAL_RADAR_INBOUND_TOPIC as SIGNAL_RADAR_INBOUND_TOPIC_VALUE,
|
|
11
|
+
type SignalRadarInboundSendOptions,
|
|
12
|
+
} from '@deepline/monitors/signal-radars/inbound-queue';
|
|
13
|
+
import type { SignalRadarInboundMessage } from '@deepline/monitors/signal-radars/inbound-message';
|
|
14
|
+
|
|
15
|
+
// Public inbound-queue surface used by the thin provider-callback receiver.
|
|
16
|
+
// Re-exports the topic + producer and adds the Neon-free publish key helper and
|
|
17
|
+
// the retry classifier the receiver/worker share.
|
|
18
|
+
export const SIGNAL_RADAR_INBOUND_TOPIC = SIGNAL_RADAR_INBOUND_TOPIC_VALUE;
|
|
19
|
+
|
|
20
|
+
function headersToObject(headers: Headers): Record<string, string> {
|
|
21
|
+
const result: Record<string, string> = {};
|
|
22
|
+
headers.forEach((value, key) => {
|
|
23
|
+
result[key.toLowerCase()] = value;
|
|
24
|
+
});
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Re-export the Neon-free publish key helper so the pure-helper test resolves it
|
|
29
|
+
// here. The receiver imports it directly from /monitors/inbound-publish-key
|
|
30
|
+
// so it gets the real helper even when this module's producer seam is faked.
|
|
31
|
+
export { signalRadarInboundPublishIdempotencyKey };
|
|
32
|
+
|
|
33
|
+
// Producer wrapper the receiver calls: `send(message, { idempotencyKey })`.
|
|
34
|
+
export async function sendSignalRadarInboundMessage(
|
|
35
|
+
message: SignalRadarInboundMessage,
|
|
36
|
+
options?: SignalRadarInboundSendOptions,
|
|
37
|
+
) {
|
|
38
|
+
return sendSignalRadarInbound(message, options);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Transient (retry) vs permanent (dead-letter) classifier, shared with the
|
|
42
|
+
// worker's retry callback. See classifyInboundFailure for the semantics.
|
|
43
|
+
export function classifySignalRadarInboundError(
|
|
44
|
+
error: unknown,
|
|
45
|
+
): InboundFailureClass {
|
|
46
|
+
return classifyInboundFailure(error);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Positional-client dead-letter writer used by the worker's retry path. Adapts
|
|
50
|
+
// the ergonomic call shape to the shared idempotent writer.
|
|
51
|
+
export async function recordSignalRadarDeadLetter(
|
|
52
|
+
client: InboundPgClient,
|
|
53
|
+
input: {
|
|
54
|
+
provider: string;
|
|
55
|
+
orgId?: string | null;
|
|
56
|
+
radarKey?: string | null;
|
|
57
|
+
eventIdempotencyKey?: string | null;
|
|
58
|
+
payload: Record<string, unknown>;
|
|
59
|
+
headers?: Record<string, string>;
|
|
60
|
+
attempts: number;
|
|
61
|
+
lastError?: string | null;
|
|
62
|
+
},
|
|
63
|
+
): Promise<void> {
|
|
64
|
+
await recordSignalRadarDeadLetterCore({
|
|
65
|
+
client,
|
|
66
|
+
message: {
|
|
67
|
+
provider: input.provider,
|
|
68
|
+
orgId: input.orgId ?? '',
|
|
69
|
+
token: '',
|
|
70
|
+
radarKey: input.radarKey ?? null,
|
|
71
|
+
eventIdempotencyKey: input.eventIdempotencyKey ?? null,
|
|
72
|
+
headers: input.headers ?? {},
|
|
73
|
+
receivedAt: new Date().toISOString(),
|
|
74
|
+
rawBody: JSON.stringify(input.payload ?? {}),
|
|
75
|
+
},
|
|
76
|
+
error: new Error(input.lastError ?? 'monitor inbound poison message'),
|
|
77
|
+
attempts: input.attempts,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type { SignalRadarInboundMessage } from '@deepline/monitors/signal-radars/inbound-message';
|
|
82
|
+
export { headersToObject };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Shared inventory rules. Job progress and missing evidence are not monitor states. */
|
|
2
|
+
export type InventoryRadar = {
|
|
3
|
+
id: string;
|
|
4
|
+
status: 'active' | 'inactive' | 'unknown';
|
|
5
|
+
};
|
|
6
|
+
export type InventoryDecision = {
|
|
7
|
+
verdict: 'converged' | 'desynced' | 'unknown';
|
|
8
|
+
reason: string;
|
|
9
|
+
radarId?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/** Call only after BOTH inventories completed. Absence is otherwise unknown. */
|
|
13
|
+
export function compareMonitorInventory(input: {
|
|
14
|
+
desired: 'active' | 'inactive';
|
|
15
|
+
resourceId: string | null;
|
|
16
|
+
exact: InventoryRadar[];
|
|
17
|
+
marker: InventoryRadar[];
|
|
18
|
+
candidateOwnerCount: number;
|
|
19
|
+
}): InventoryDecision {
|
|
20
|
+
const { desired, resourceId, exact, marker, candidateOwnerCount } = input;
|
|
21
|
+
if (exact.length > 1 || candidateOwnerCount > (resourceId ? 1 : 0)) {
|
|
22
|
+
return { verdict: 'unknown', reason: 'ambiguous_tamradar_binding' };
|
|
23
|
+
}
|
|
24
|
+
if (!resourceId) {
|
|
25
|
+
if (marker.length > 1)
|
|
26
|
+
return { verdict: 'unknown', reason: 'ambiguous_tamradar_binding' };
|
|
27
|
+
if (marker.length === 1)
|
|
28
|
+
return {
|
|
29
|
+
verdict: 'desynced',
|
|
30
|
+
reason: 'adoptable_tamradar_radar',
|
|
31
|
+
radarId: marker[0]!.id,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const radar = exact[0];
|
|
35
|
+
if (!radar) {
|
|
36
|
+
if (!resourceId) {
|
|
37
|
+
// A complete account list proves that no stamped counterpart exists; it
|
|
38
|
+
// cannot prove which resource an unbound historical row used to own.
|
|
39
|
+
// Creation or adoption is a separate, explicit operator operation.
|
|
40
|
+
return { verdict: 'unknown', reason: 'missing_tamradar_binding' };
|
|
41
|
+
}
|
|
42
|
+
return desired === 'inactive'
|
|
43
|
+
? { verdict: 'converged', reason: 'in_sync' }
|
|
44
|
+
: { verdict: 'desynced', reason: 'missing_tamradar_radar' };
|
|
45
|
+
}
|
|
46
|
+
if (radar.status === 'unknown')
|
|
47
|
+
return {
|
|
48
|
+
verdict: 'unknown',
|
|
49
|
+
reason: 'unknown_tamradar_state',
|
|
50
|
+
radarId: radar.id,
|
|
51
|
+
};
|
|
52
|
+
return radar.status === desired
|
|
53
|
+
? { verdict: 'converged', reason: 'in_sync', radarId: radar.id }
|
|
54
|
+
: {
|
|
55
|
+
verdict: 'desynced',
|
|
56
|
+
reason: 'tamradar_state_differs',
|
|
57
|
+
radarId: radar.id,
|
|
58
|
+
};
|
|
59
|
+
}
|