deepline 0.3.89 → 0.3.91
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 +221 -43
- package/dist/bundling-sources/sdk/src/index.ts +4 -0
- package/dist/bundling-sources/sdk/src/monitor-fleet-contract.ts +2 -556
- package/dist/bundling-sources/sdk/src/monitor-fleets.ts +2 -2
- package/dist/bundling-sources/sdk/src/pagination.ts +25 -0
- package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +1 -1
- package/dist/bundling-sources/sdk/src/release.ts +11 -9
- package/dist/bundling-sources/sdk/src/types.ts +29 -1
- package/dist/bundling-sources/shared_libs/integration-contracts/monitor-fleet-contract.ts +549 -0
- package/dist/bundling-sources/shared_libs/monitors/analytics-public.ts +10 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/errors.ts +96 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +8 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +320 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/verdict.ts +106 -0
- package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +8 -1
- package/dist/bundling-sources/shared_libs/monitors/inbound-queue.ts +4 -4
- package/dist/bundling-sources/shared_libs/monitors/inventory-reconciliation.ts +59 -0
- package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +7 -9
- package/dist/bundling-sources/shared_libs/monitors/monitor-fleet-limits.ts +2 -12
- package/dist/bundling-sources/shared_libs/monitors/package.json +113 -4
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +56 -9
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-consumer-health.ts +2 -2
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +2 -2
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +1 -1
- 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 +1 -1
- package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +2 -2
- package/dist/bundling-sources/shared_libs/monitors/snitcher-radar.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +1 -1
- 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 +690 -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/app-runtime-api.ts +46 -1
- 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 +0 -1
- package/dist/bundling-sources/shared_libs/play-runtime/bounceban-batching.ts +137 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +779 -140
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +46 -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/db-session-lease-store.ts +578 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/roll-execution-relay.ts +521 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/roll-receipt-gateway.ts +1378 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/runtime-topology.ts +1024 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-gateway-route-probe.ts +193 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machine-lifecycle.ts +104 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +1844 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/process-tree.ts +40 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-gateway-drain.ts +262 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-surface.ts +98 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-topology.ts +303 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-tuple-publication-guardian.ts +70 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-tuple-recovery.ts +519 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts +280 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-production-gate.ts +159 -0
- 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 +23 -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 +3 -3
- 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/memory-store.ts +114 -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 +1 -1
- 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/protocol.ts +2 -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 +3 -5
- package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +168 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +44 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/child-play-resolver.ts +26 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +3662 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/progress-sidecar.ts +47 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-deadline.ts +84 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-gateway-transport.ts +91 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +424 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +321 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-sheet-persistence-retry.ts +110 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +625 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +72 -9
- 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.ts +19 -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 -44
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +103 -208
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +201 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-env.ts +6 -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 +14 -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 +7 -0
- 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/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/webhook-receipt-retry.ts +50 -0
- 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 +2 -0
- package/dist/bundling-sources/shared_libs/plays/bundling/repository-adapter.ts +24 -0
- package/dist/bundling-sources/shared_libs/plays/child-run-projection.ts +174 -0
- package/dist/bundling-sources/shared_libs/plays/contracts.ts +2 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/api-client.ts +267 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/control-plane-types.ts +73 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/manifest.ts +162 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/project-serializer.ts +87 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/source-file-path.ts +26 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/target-paths.ts +36 -0
- package/dist/bundling-sources/shared_libs/plays/deployment-status.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/docflow.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/launch/input-contract.ts +400 -0
- package/dist/bundling-sources/shared_libs/plays/launch/prepare.ts +96 -0
- package/dist/bundling-sources/shared_libs/plays/local-file-discovery.ts +385 -0
- package/dist/bundling-sources/shared_libs/plays/play-grep-search.ts +112 -0
- package/dist/bundling-sources/shared_libs/plays/play-reference.ts +117 -0
- package/dist/bundling-sources/shared_libs/plays/run-input-summary.ts +260 -0
- package/dist/bundling-sources/shared_libs/plays/run-summary-types.ts +49 -0
- package/dist/bundling-sources/shared_libs/plays/secrets/errors.ts +19 -0
- 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/sheet-filter.ts +347 -0
- package/dist/bundling-sources/shared_libs/plays/slack-hitl-timeout-error.ts +37 -0
- package/dist/bundling-sources/shared_libs/plays/standard-webhooks.ts +117 -0
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +6 -1
- package/dist/bundling-sources/shared_libs/plays/status-result.ts +388 -0
- package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/transform-factor-structure.ts +377 -0
- package/dist/bundling-sources/shared_libs/plays/webhook-payload.ts +113 -0
- package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +7 -1
- package/dist/bundling-sources/shared_libs/product-notifications/default-policy.ts +3 -2
- 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/runtime-env.ts +6 -0
- package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +42 -0
- package/dist/bundling-sources/shared_libs/security/header-safe-env.ts +10 -3
- 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 +895 -407
- package/dist/cli/index.mjs +893 -414
- package/dist/{compiler-manifest-DsLbQaew.d.mts → compiler-manifest-x14KL83E.d.mts} +4 -2
- package/dist/{compiler-manifest-DsLbQaew.d.ts → compiler-manifest-x14KL83E.d.ts} +4 -2
- package/dist/index.d.mts +124 -154
- package/dist/index.d.ts +124 -154
- package/dist/index.js +132 -28
- package/dist/index.mjs +132 -28
- package/dist/install-integrity.json +182 -2
- package/dist/monitor-fleet-contract.d.mts +131 -0
- package/dist/monitor-fleet-contract.d.ts +131 -0
- package/dist/monitor-fleet-contract.js +406 -0
- package/dist/monitor-fleet-contract.mjs +367 -0
- package/dist/plays/bundle-play-file.d.mts +2 -2
- package/dist/plays/bundle-play-file.d.ts +2 -2
- package/dist/release.d.mts +255 -0
- package/dist/release.d.ts +255 -0
- package/dist/release.js +210 -0
- package/dist/release.mjs +183 -0
- package/package.json +21 -4
|
@@ -4,21 +4,130 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
|
-
"./
|
|
8
|
-
"
|
|
9
|
-
"
|
|
7
|
+
"./fleets/limits": "./fleets/limits.ts",
|
|
8
|
+
"./analytics-install-guides": "./analytics-install-guides.ts",
|
|
9
|
+
"./analytics-install-guides.js": "./analytics-install-guides.ts",
|
|
10
|
+
"./analytics-public": "./analytics-public.ts",
|
|
11
|
+
"./analytics-public.js": "./analytics-public.ts",
|
|
12
|
+
"./billing/charges": "./billing/charges.ts",
|
|
13
|
+
"./billing/charges.js": "./billing/charges.ts",
|
|
14
|
+
"./billing/policy-builders": "./billing/policy-builders.ts",
|
|
15
|
+
"./billing/policy-builders.js": "./billing/policy-builders.ts",
|
|
16
|
+
"./billing/pricing": "./billing/pricing.ts",
|
|
17
|
+
"./billing/pricing.js": "./billing/pricing.ts",
|
|
18
|
+
"./billing/public-pricing": "./billing/public-pricing.ts",
|
|
19
|
+
"./billing/public-pricing.js": "./billing/public-pricing.ts",
|
|
20
|
+
"./billing/session": "./billing/session.ts",
|
|
21
|
+
"./billing/session.js": "./billing/session.ts",
|
|
22
|
+
"./billing/state": "./billing/state.ts",
|
|
23
|
+
"./billing/state.js": "./billing/state.ts",
|
|
24
|
+
"./billing/tamradar": "./billing/tamradar.ts",
|
|
25
|
+
"./billing/tamradar.js": "./billing/tamradar.ts",
|
|
26
|
+
"./billing/types": "./billing/types.ts",
|
|
27
|
+
"./billing/types.js": "./billing/types.ts",
|
|
28
|
+
"./callback-security": "./callback-security.ts",
|
|
29
|
+
"./callback-security.js": "./callback-security.ts",
|
|
30
|
+
"./cursor-page": "./cursor-page.ts",
|
|
31
|
+
"./cursor-page.js": "./cursor-page.ts",
|
|
32
|
+
"./deactivation-reasons": "./deactivation-reasons.ts",
|
|
33
|
+
"./deactivation-reasons.js": "./deactivation-reasons.ts",
|
|
34
|
+
"./fleets/errors": "./fleets/errors.ts",
|
|
35
|
+
"./fleets/errors.js": "./fleets/errors.ts",
|
|
36
|
+
"./fleets/plan": "./fleets/plan.ts",
|
|
37
|
+
"./fleets/plan.js": "./fleets/plan.ts",
|
|
38
|
+
"./fleets/verdict": "./fleets/verdict.ts",
|
|
39
|
+
"./fleets/verdict.js": "./fleets/verdict.ts",
|
|
40
|
+
"./framework-managed-payload-fields": "./framework-managed-payload-fields.ts",
|
|
41
|
+
"./framework-managed-payload-fields.js": "./framework-managed-payload-fields.ts",
|
|
42
|
+
"./generated/provider-monitor-callback-admission-targets": "./generated/provider-monitor-callback-admission-targets.ts",
|
|
43
|
+
"./generated/provider-monitor-callback-admission-targets.js": "./generated/provider-monitor-callback-admission-targets.ts",
|
|
44
|
+
"./http-error-response": "./http-error-response.ts",
|
|
45
|
+
"./http-error-response.js": "./http-error-response.ts",
|
|
46
|
+
"./inbound-publish-key": "./inbound-publish-key.ts",
|
|
47
|
+
"./inbound-publish-key.js": "./inbound-publish-key.ts",
|
|
48
|
+
"./inbound-queue": "./inbound-queue.ts",
|
|
49
|
+
"./inbound-queue.js": "./inbound-queue.ts",
|
|
50
|
+
"./inventory-reconciliation": "./inventory-reconciliation.ts",
|
|
51
|
+
"./inventory-reconciliation.js": "./inventory-reconciliation.ts",
|
|
52
|
+
"./lifecycle-notifications": "./lifecycle-notifications.ts",
|
|
53
|
+
"./lifecycle-notifications.js": "./lifecycle-notifications.ts",
|
|
54
|
+
"./monitor-fleet-limits": "./monitor-fleet-limits.ts",
|
|
55
|
+
"./monitor-fleet-limits.js": "./monitor-fleet-limits.ts",
|
|
56
|
+
"./org-monitor-limits": "./org-monitor-limits.ts",
|
|
57
|
+
"./org-monitor-limits.js": "./org-monitor-limits.ts",
|
|
58
|
+
"./provider-callback-verification": "./provider-callback-verification.ts",
|
|
59
|
+
"./provider-callback-verification.js": "./provider-callback-verification.ts",
|
|
60
|
+
"./provider-monitor-batch-operation": "./provider-monitor-batch-operation.ts",
|
|
61
|
+
"./provider-monitor-batch-operation.js": "./provider-monitor-batch-operation.ts",
|
|
62
|
+
"./provider-monitor-capability": "./provider-monitor-capability.ts",
|
|
63
|
+
"./provider-monitor-capability.js": "./provider-monitor-capability.ts",
|
|
64
|
+
"./provider-monitor-consumer-health": "./provider-monitor-consumer-health.ts",
|
|
65
|
+
"./provider-monitor-consumer-health.js": "./provider-monitor-consumer-health.ts",
|
|
66
|
+
"./provider-monitor-errors": "./provider-monitor-errors.ts",
|
|
67
|
+
"./provider-monitor-errors.js": "./provider-monitor-errors.ts",
|
|
68
|
+
"./provider-monitor-identity-claims": "./provider-monitor-identity-claims.ts",
|
|
69
|
+
"./provider-monitor-identity-claims.js": "./provider-monitor-identity-claims.ts",
|
|
70
|
+
"./provider-monitor-legacy-aliases": "./provider-monitor-legacy-aliases.ts",
|
|
71
|
+
"./provider-monitor-legacy-aliases.js": "./provider-monitor-legacy-aliases.ts",
|
|
72
|
+
"./provider-monitor-priority-execution": "./provider-monitor-priority-execution.ts",
|
|
73
|
+
"./provider-monitor-priority-execution.js": "./provider-monitor-priority-execution.ts",
|
|
74
|
+
"./provider-monitor-public-aliases": "./provider-monitor-public-aliases.ts",
|
|
75
|
+
"./provider-monitor-public-aliases.js": "./provider-monitor-public-aliases.ts",
|
|
76
|
+
"./provider-monitor-runtime-read-eligibility": "./provider-monitor-runtime-read-eligibility.ts",
|
|
77
|
+
"./provider-monitor-runtime-read-eligibility.js": "./provider-monitor-runtime-read-eligibility.ts",
|
|
78
|
+
"./provider-monitor-state": "./provider-monitor-state.ts",
|
|
79
|
+
"./provider-monitor-state.js": "./provider-monitor-state.ts",
|
|
80
|
+
"./provider-monitor-status": "./provider-monitor-status.ts",
|
|
81
|
+
"./provider-monitor-status.js": "./provider-monitor-status.ts",
|
|
82
|
+
"./provider-monitor-upstream-identity": "./provider-monitor-upstream-identity.ts",
|
|
83
|
+
"./provider-monitor-upstream-identity.js": "./provider-monitor-upstream-identity.ts",
|
|
84
|
+
"./provider-webhook-monitor-runtime": "./provider-webhook-monitor-runtime.ts",
|
|
85
|
+
"./provider-webhook-monitor-runtime.js": "./provider-webhook-monitor-runtime.ts",
|
|
86
|
+
"./quickstart-prompts": "./quickstart-prompts.ts",
|
|
87
|
+
"./quickstart-prompts.js": "./quickstart-prompts.ts",
|
|
88
|
+
"./signal-radars/inbound-dead-letter": "./signal-radars/inbound-dead-letter.ts",
|
|
89
|
+
"./signal-radars/inbound-dead-letter.js": "./signal-radars/inbound-dead-letter.ts",
|
|
90
|
+
"./signal-radars/inbound-message": "./signal-radars/inbound-message.ts",
|
|
91
|
+
"./signal-radars/inbound-message.js": "./signal-radars/inbound-message.ts",
|
|
92
|
+
"./signal-radars/inbound-queue": "./signal-radars/inbound-queue.ts",
|
|
93
|
+
"./signal-radars/inbound-queue-ack-probe": "./signal-radars/inbound-queue-ack-probe.ts",
|
|
94
|
+
"./signal-radars/inbound-queue-ack-probe.js": "./signal-radars/inbound-queue-ack-probe.ts",
|
|
95
|
+
"./signal-radars/inbound-queue-delivery": "./signal-radars/inbound-queue-delivery.ts",
|
|
96
|
+
"./signal-radars/inbound-queue-delivery.js": "./signal-radars/inbound-queue-delivery.ts",
|
|
97
|
+
"./signal-radars/inbound-queue.js": "./signal-radars/inbound-queue.ts",
|
|
98
|
+
"./snitcher-install-validation": "./snitcher-install-validation.ts",
|
|
99
|
+
"./snitcher-install-validation.js": "./snitcher-install-validation.ts",
|
|
100
|
+
"./snitcher-ip2company": "./snitcher-ip2company.ts",
|
|
101
|
+
"./snitcher-ip2company.js": "./snitcher-ip2company.ts",
|
|
102
|
+
"./snitcher-radar": "./snitcher-radar.ts",
|
|
103
|
+
"./snitcher-radar.js": "./snitcher-radar.ts",
|
|
104
|
+
"./starter-templates": "./starter-templates.ts",
|
|
105
|
+
"./starter-templates.js": "./starter-templates.ts",
|
|
106
|
+
"./tracking-provider-guidance": "./tracking-provider-guidance.ts",
|
|
107
|
+
"./tracking-provider-guidance.js": "./tracking-provider-guidance.ts",
|
|
108
|
+
"./tracking-provider-integrations": "./tracking-provider-integrations.ts",
|
|
109
|
+
"./tracking-provider-integrations.js": "./tracking-provider-integrations.ts",
|
|
110
|
+
"./validation": "./validation.ts",
|
|
111
|
+
"./validation.js": "./validation.ts"
|
|
10
112
|
},
|
|
11
113
|
"scripts": {
|
|
12
114
|
"build": "tsc -p tsconfig.json --noEmit",
|
|
13
115
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
14
116
|
},
|
|
15
117
|
"dependencies": {
|
|
118
|
+
"@deepline/auth": "workspace:*",
|
|
16
119
|
"@deepline/billing": "workspace:*",
|
|
120
|
+
"@deepline/convex-client": "workspace:*",
|
|
17
121
|
"@deepline/ingestion-v2": "workspace:*",
|
|
122
|
+
"@deepline/play-runtime": "workspace:*",
|
|
18
123
|
"@deepline/plays": "workspace:*",
|
|
124
|
+
"@deepline/product-notifications": "workspace:*",
|
|
125
|
+
"@vercel/oidc": "^3.0.5",
|
|
126
|
+
"@vercel/queue": "^0.4.0",
|
|
19
127
|
"next": "16.3.0-canary.60",
|
|
20
128
|
"pg": "^8.19.0",
|
|
21
|
-
"react": "19.2.5"
|
|
129
|
+
"react": "19.2.5",
|
|
130
|
+
"@deepline/integration-contracts": "workspace:*"
|
|
22
131
|
},
|
|
23
132
|
"devDependencies": {
|
|
24
133
|
"@types/node": "^20.0.0",
|
|
@@ -17,6 +17,10 @@ export const PROVIDER_MONITOR_BATCH_OPERATION_KINDS = [
|
|
|
17
17
|
'reactivate',
|
|
18
18
|
'audit',
|
|
19
19
|
'repair',
|
|
20
|
+
// Fleet plans already write canonical desired state. This internal
|
|
21
|
+
// operation is the durable, observable hand-off to the fenced Fleet
|
|
22
|
+
// executor; it is not a second lifecycle verb or a raw provider create.
|
|
23
|
+
'converge',
|
|
20
24
|
] as const;
|
|
21
25
|
|
|
22
26
|
export type ProviderMonitorBatchOperationKind =
|
|
@@ -56,7 +60,13 @@ export type ProviderMonitorBatchOperationRequest = {
|
|
|
56
60
|
kind: ProviderMonitorBatchOperationKind;
|
|
57
61
|
scope: ProviderMonitorBatchScope;
|
|
58
62
|
dryRun: boolean;
|
|
59
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* The application deployment that accepted this operation. A provider
|
|
65
|
+
* callback is part of the create side effect, so a continuation must retain
|
|
66
|
+
* this origin instead of recomputing it from a later deployment.
|
|
67
|
+
*/
|
|
68
|
+
callbackBaseUrl?: string;
|
|
69
|
+
/** Required for direct/target deactivation; Fleet teardown may be customer-owned. */
|
|
60
70
|
deactivationReason?: string;
|
|
61
71
|
};
|
|
62
72
|
|
|
@@ -79,6 +89,29 @@ function canonicalJson(value: unknown): string {
|
|
|
79
89
|
return JSON.stringify(value);
|
|
80
90
|
}
|
|
81
91
|
|
|
92
|
+
function normalizeCallbackBaseUrl(
|
|
93
|
+
value: string | undefined,
|
|
94
|
+
): string | undefined {
|
|
95
|
+
if (value === undefined) return undefined;
|
|
96
|
+
let parsed: URL;
|
|
97
|
+
try {
|
|
98
|
+
parsed = new URL(value);
|
|
99
|
+
} catch {
|
|
100
|
+
throw new Error('callbackBaseUrl must be an absolute HTTP(S) origin.');
|
|
101
|
+
}
|
|
102
|
+
if (
|
|
103
|
+
(parsed.protocol !== 'http:' && parsed.protocol !== 'https:') ||
|
|
104
|
+
parsed.username ||
|
|
105
|
+
parsed.password ||
|
|
106
|
+
parsed.search ||
|
|
107
|
+
parsed.hash ||
|
|
108
|
+
(parsed.pathname !== '' && parsed.pathname !== '/')
|
|
109
|
+
) {
|
|
110
|
+
throw new Error('callbackBaseUrl must be an absolute HTTP(S) origin.');
|
|
111
|
+
}
|
|
112
|
+
return parsed.origin;
|
|
113
|
+
}
|
|
114
|
+
|
|
82
115
|
/**
|
|
83
116
|
* A job id is deterministic on purpose. Convex's existing `by_run` point
|
|
84
117
|
* lookup is then the idempotency index: the same org/key can only own one run,
|
|
@@ -126,6 +159,10 @@ export function validateProviderMonitorBatchOperationRequest(
|
|
|
126
159
|
if (!isProviderMonitorBatchOperationKind(request.kind)) {
|
|
127
160
|
throw new Error(`Unknown monitor batch operation '${request.kind}'.`);
|
|
128
161
|
}
|
|
162
|
+
const callbackBaseUrl = normalizeCallbackBaseUrl(request.callbackBaseUrl);
|
|
163
|
+
if (callbackBaseUrl !== undefined && request.kind !== 'deploy') {
|
|
164
|
+
throw new Error('callbackBaseUrl is only valid for a batch deploy.');
|
|
165
|
+
}
|
|
129
166
|
if (!request.scope || typeof request.scope !== 'object') {
|
|
130
167
|
throw new Error('A monitor batch operation requires exactly one scope.');
|
|
131
168
|
}
|
|
@@ -151,6 +188,9 @@ export function validateProviderMonitorBatchOperationRequest(
|
|
|
151
188
|
'Batch deploy requires a durable manifest of complete definitions.',
|
|
152
189
|
);
|
|
153
190
|
}
|
|
191
|
+
if (request.kind === 'converge') {
|
|
192
|
+
throw new Error('Batch converge requires exactly one Fleet scope.');
|
|
193
|
+
}
|
|
154
194
|
if (request.kind === 'deactivate' && !request.deactivationReason) {
|
|
155
195
|
throw new Error(
|
|
156
196
|
'Batch deactivate requires a declared deactivation reason.',
|
|
@@ -159,7 +199,11 @@ export function validateProviderMonitorBatchOperationRequest(
|
|
|
159
199
|
if (request.kind === 'deactivate') {
|
|
160
200
|
requireMonitorDeactivationReason(request.deactivationReason!);
|
|
161
201
|
}
|
|
162
|
-
return {
|
|
202
|
+
return {
|
|
203
|
+
...request,
|
|
204
|
+
scope: { kind: 'keys', monitorKeys: keys },
|
|
205
|
+
...(callbackBaseUrl === undefined ? {} : { callbackBaseUrl }),
|
|
206
|
+
};
|
|
163
207
|
}
|
|
164
208
|
if (scope.kind === 'target') {
|
|
165
209
|
if (request.kind === 'deploy') {
|
|
@@ -167,6 +211,9 @@ export function validateProviderMonitorBatchOperationRequest(
|
|
|
167
211
|
'Batch deploy requires a durable manifest of complete definitions.',
|
|
168
212
|
);
|
|
169
213
|
}
|
|
214
|
+
if (request.kind === 'converge') {
|
|
215
|
+
throw new Error('Batch converge requires exactly one Fleet scope.');
|
|
216
|
+
}
|
|
170
217
|
if (!isProviderMonitorBatchTarget(scope.target)) {
|
|
171
218
|
throw new Error(`Unknown monitor batch target '${scope.target}'.`);
|
|
172
219
|
}
|
|
@@ -178,7 +225,10 @@ export function validateProviderMonitorBatchOperationRequest(
|
|
|
178
225
|
if (request.kind === 'deactivate') {
|
|
179
226
|
requireMonitorDeactivationReason(request.deactivationReason!);
|
|
180
227
|
}
|
|
181
|
-
return
|
|
228
|
+
return {
|
|
229
|
+
...request,
|
|
230
|
+
...(callbackBaseUrl === undefined ? {} : { callbackBaseUrl }),
|
|
231
|
+
};
|
|
182
232
|
}
|
|
183
233
|
if (scope.kind === 'fleet') {
|
|
184
234
|
if (request.kind === 'deploy') {
|
|
@@ -188,17 +238,13 @@ export function validateProviderMonitorBatchOperationRequest(
|
|
|
188
238
|
}
|
|
189
239
|
if (!scope.fleetId.trim())
|
|
190
240
|
throw new Error('A Fleet scope requires fleetId.');
|
|
191
|
-
if (request.kind === 'deactivate' &&
|
|
192
|
-
throw new Error(
|
|
193
|
-
'Batch deactivate requires a declared deactivation reason.',
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
if (request.kind === 'deactivate') {
|
|
241
|
+
if (request.kind === 'deactivate' && request.deactivationReason) {
|
|
197
242
|
requireMonitorDeactivationReason(request.deactivationReason!);
|
|
198
243
|
}
|
|
199
244
|
return {
|
|
200
245
|
...request,
|
|
201
246
|
scope: { kind: 'fleet', fleetId: scope.fleetId.trim() },
|
|
247
|
+
...(callbackBaseUrl === undefined ? {} : { callbackBaseUrl }),
|
|
202
248
|
};
|
|
203
249
|
}
|
|
204
250
|
if (scope.kind === 'manifest') {
|
|
@@ -230,6 +276,7 @@ export function validateProviderMonitorBatchOperationRequest(
|
|
|
230
276
|
? {}
|
|
231
277
|
: { sha256: scope.sha256.trim().toLowerCase() }),
|
|
232
278
|
},
|
|
279
|
+
...(callbackBaseUrl === undefined ? {} : { callbackBaseUrl }),
|
|
233
280
|
};
|
|
234
281
|
}
|
|
235
282
|
throw new Error(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { internal } from '@convex/
|
|
2
|
-
import { getRequiredInternalConvexClient } from '
|
|
1
|
+
import { internal } from '@deepline/convex-client/function-references';
|
|
2
|
+
import { getRequiredInternalConvexClient } from '@deepline/convex-client/internal-client';
|
|
3
3
|
|
|
4
4
|
type MonitorStreamResource = {
|
|
5
5
|
key: string;
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
ProviderMonitorOrgLimitExceededError,
|
|
9
9
|
} from '@deepline/monitors/provider-monitor-errors';
|
|
10
10
|
import { MAX_PRIORITY_MONITORS_PER_ORG } from '@deepline/monitors/provider-monitor-priority-execution';
|
|
11
|
-
import { internal } from '@convex/
|
|
12
|
-
import { getRequiredInternalConvexClient } from '
|
|
11
|
+
import { internal } from '@deepline/convex-client/function-references';
|
|
12
|
+
import { getRequiredInternalConvexClient } from '@deepline/convex-client/internal-client';
|
|
13
13
|
import {
|
|
14
14
|
providerMonitorUpstreamIdentitySignature,
|
|
15
15
|
type ProviderMonitorUpstreamIdentitySignature,
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ANALYTICS_INTEGRATION_SLUG,
|
|
3
3
|
ANALYTICS_PUBLIC_PROVIDER,
|
|
4
4
|
ANALYTICS_PUBLIC_TOOL,
|
|
5
|
-
} from '
|
|
5
|
+
} from '@deepline/monitors/analytics-public';
|
|
6
6
|
|
|
7
7
|
export const ANALYTICS_MONITOR_KEY = ANALYTICS_INTEGRATION_SLUG;
|
|
8
8
|
export const ANALYTICS_INTERNAL_MONITOR_KEY = 'snitcher-website-sessions';
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { isRepairableTenantDataPlaneError } from '@deepline/ingestion-v2/tenant-data-plane-errors';
|
|
3
|
+
import type { SignalRadarInboundMessage } from '@deepline/monitors/signal-radars/inbound-message';
|
|
4
|
+
|
|
5
|
+
// Minimal pg client seam shared with the ingestion stack: a `query(sql, args)`
|
|
6
|
+
// that returns `{ rows }`. Deliberately structural so PGlite (tests) and the
|
|
7
|
+
// Neon pooled client (prod) both satisfy it without adapters.
|
|
8
|
+
export type InboundPgClient = {
|
|
9
|
+
query: (
|
|
10
|
+
sql: string,
|
|
11
|
+
args?: unknown[],
|
|
12
|
+
) => Promise<{ rows?: unknown[]; rowCount?: number }>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type InboundFailureClass = 'transient' | 'permanent';
|
|
16
|
+
|
|
17
|
+
function errorMessage(error: unknown): string {
|
|
18
|
+
if (error instanceof Error && error.message.trim()) return error.message;
|
|
19
|
+
if (typeof error === 'string' && error.trim()) return error;
|
|
20
|
+
return String(error ?? 'unknown error');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// A TRANSIENT failure is an infra outage the event can survive: keep retrying
|
|
24
|
+
// via backoff so a long Neon/Convex flap drains on recovery instead of being
|
|
25
|
+
// dead-lettered (which would drop a real customer signal). A PERMANENT failure
|
|
26
|
+
// is a poison message — an unrecognized/invalid payload shape that will never
|
|
27
|
+
// succeed no matter how many times we redeliver — so it must give up + record.
|
|
28
|
+
//
|
|
29
|
+
// The transient side reuses the SAME classification the rest of the ingestion
|
|
30
|
+
// stack already treats as repairable (permission-denied / role drift / conn
|
|
31
|
+
// resets), so the worker never disagrees with the route on "transient".
|
|
32
|
+
export function classifyInboundFailure(error: unknown): InboundFailureClass {
|
|
33
|
+
if (isRepairableTenantDataPlaneError(error)) return 'transient';
|
|
34
|
+
|
|
35
|
+
const code =
|
|
36
|
+
error && typeof error === 'object'
|
|
37
|
+
? String((error as { code?: unknown }).code ?? '')
|
|
38
|
+
: '';
|
|
39
|
+
const transientCodes = new Set([
|
|
40
|
+
'tenant_data_plane_repair_required',
|
|
41
|
+
'provider_monitor_convex_sync_pending',
|
|
42
|
+
// The worker emits this after capture-first receipt persistence cannot be
|
|
43
|
+
// completed. The event has not entered durable storage, so it must remain
|
|
44
|
+
// retryable even after the ordinary poison-message delivery budget.
|
|
45
|
+
'provider_callback_raw_capture_unavailable',
|
|
46
|
+
// A concurrent worker still owns the durable receipt. Acknowledging this
|
|
47
|
+
// redelivery as poison could dead-letter a live callback and clear the
|
|
48
|
+
// owner's receipt before its lease completes.
|
|
49
|
+
'provider_callback_raw_receipt_in_progress',
|
|
50
|
+
'ECONNRESET',
|
|
51
|
+
'ECONNREFUSED',
|
|
52
|
+
'ETIMEDOUT',
|
|
53
|
+
'EPIPE',
|
|
54
|
+
'ENOTFOUND',
|
|
55
|
+
'EAI_AGAIN',
|
|
56
|
+
'snitcher_ip2company_retryable',
|
|
57
|
+
'57P01', // admin shutdown
|
|
58
|
+
'57P02', // crash shutdown
|
|
59
|
+
'57P03', // cannot connect now
|
|
60
|
+
'08000', // connection exception
|
|
61
|
+
'08003', // connection does not exist
|
|
62
|
+
'08006', // connection failure
|
|
63
|
+
'53300', // too many connections
|
|
64
|
+
]);
|
|
65
|
+
if (code && transientCodes.has(code)) return 'transient';
|
|
66
|
+
|
|
67
|
+
const message = errorMessage(error);
|
|
68
|
+
const transientPatterns = [
|
|
69
|
+
/connection (?:terminated|refused|reset|closed|failure)/i,
|
|
70
|
+
/could not connect to server/i,
|
|
71
|
+
/connection to server .* failed/i,
|
|
72
|
+
/the database system is (?:starting up|shutting down|in recovery)/i,
|
|
73
|
+
/timeout(?: exceeded)?(?: when trying)? to connect/i,
|
|
74
|
+
/connect(?:ion)? timeout/i,
|
|
75
|
+
/terminating connection due to/i,
|
|
76
|
+
/too many connections/i,
|
|
77
|
+
/ECONNRESET|ECONNREFUSED|ETIMEDOUT/i,
|
|
78
|
+
/convex.*(?:unavailable|timeout|network)/i,
|
|
79
|
+
/fetch failed/i,
|
|
80
|
+
/socket hang up/i,
|
|
81
|
+
];
|
|
82
|
+
if (transientPatterns.some((pattern) => pattern.test(message))) {
|
|
83
|
+
return 'transient';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Default to permanent: an unclassified failure is treated as poison so it is
|
|
87
|
+
// recorded for human review rather than retried forever. Transient outages are
|
|
88
|
+
// the ones we can positively identify (above); everything else is give-up-able.
|
|
89
|
+
return 'permanent';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
type DeadLetterMessageInput = Pick<
|
|
93
|
+
SignalRadarInboundMessage,
|
|
94
|
+
'provider' | 'orgId' | 'token' | 'headers' | 'receivedAt'
|
|
95
|
+
> & {
|
|
96
|
+
admission?: SignalRadarInboundMessage['admission'];
|
|
97
|
+
radarKey?: string | null;
|
|
98
|
+
eventIdempotencyKey?: string | null;
|
|
99
|
+
rawBody?: string;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
async function markCapturedRawWriteFailed(
|
|
103
|
+
client: InboundPgClient,
|
|
104
|
+
eventIdempotencyKey: string,
|
|
105
|
+
lastError: string,
|
|
106
|
+
) {
|
|
107
|
+
// The capture-first raw row (dl_meta.monitor_inbound_raw) may already exist for
|
|
108
|
+
// this event. Flip it to write_failed so on-call sees "captured, dead-lettered,
|
|
109
|
+
// replayable" in one place. Best-effort: a missing table/row must not block the
|
|
110
|
+
// dead-letter record itself.
|
|
111
|
+
try {
|
|
112
|
+
await client.query(
|
|
113
|
+
`UPDATE dl_meta.monitor_inbound_raw
|
|
114
|
+
SET status = 'write_failed', error = $2, updated_at = now()
|
|
115
|
+
WHERE event_idempotency_key = $1`,
|
|
116
|
+
[eventIdempotencyKey, lastError.slice(0, 4000)],
|
|
117
|
+
);
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.warn('[signal-radar.dead_letter.raw_mark_failed]', {
|
|
120
|
+
event_idempotency_key: eventIdempotencyKey,
|
|
121
|
+
error: error instanceof Error ? error.message : String(error),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Idempotent dead-letter writer. Keyed on the provider event idempotency key via
|
|
127
|
+
// the partial-unique index, so the SAME poison event redelivered N times yields
|
|
128
|
+
// exactly ONE dead letter (attempts/last_error bumped), while two distinct
|
|
129
|
+
// null-keyed poison events stay distinct (the partial index only enforces
|
|
130
|
+
// uniqueness WHERE event_idempotency_key IS NOT NULL). Also marks the captured
|
|
131
|
+
// raw row write_failed when one exists for the key.
|
|
132
|
+
export async function recordSignalRadarDeadLetter(input: {
|
|
133
|
+
client: InboundPgClient;
|
|
134
|
+
message: DeadLetterMessageInput;
|
|
135
|
+
error: unknown;
|
|
136
|
+
attempts: number;
|
|
137
|
+
}): Promise<void> {
|
|
138
|
+
const { client, message } = input;
|
|
139
|
+
const lastError = errorMessage(input.error);
|
|
140
|
+
const eventIdempotencyKey = message.eventIdempotencyKey ?? null;
|
|
141
|
+
const payload = {
|
|
142
|
+
provider: message.provider,
|
|
143
|
+
orgId: message.orgId,
|
|
144
|
+
token: message.token,
|
|
145
|
+
radarKey: message.radarKey ?? null,
|
|
146
|
+
eventIdempotencyKey,
|
|
147
|
+
rawBody: message.rawBody ?? null,
|
|
148
|
+
headers: message.headers ?? {},
|
|
149
|
+
receivedAt: message.receivedAt,
|
|
150
|
+
admission: message.admission ?? null,
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
if (eventIdempotencyKey) {
|
|
154
|
+
await client.query(
|
|
155
|
+
`INSERT INTO dl_meta.signal_radar_inbound_dead_letter
|
|
156
|
+
(dead_letter_id, provider, radar_key, org_id, event_idempotency_key,
|
|
157
|
+
payload, headers, attempts, last_error, status)
|
|
158
|
+
VALUES ($1, $2, $3, $4, $5, $6::jsonb, $7::jsonb, $8, $9, 'open')
|
|
159
|
+
ON CONFLICT (event_idempotency_key)
|
|
160
|
+
WHERE event_idempotency_key IS NOT NULL
|
|
161
|
+
DO UPDATE SET
|
|
162
|
+
attempts = EXCLUDED.attempts,
|
|
163
|
+
last_error = EXCLUDED.last_error,
|
|
164
|
+
payload = EXCLUDED.payload,
|
|
165
|
+
headers = EXCLUDED.headers,
|
|
166
|
+
updated_at = now()`,
|
|
167
|
+
[
|
|
168
|
+
randomUUID(),
|
|
169
|
+
message.provider,
|
|
170
|
+
message.radarKey ?? null,
|
|
171
|
+
message.orgId ?? null,
|
|
172
|
+
eventIdempotencyKey,
|
|
173
|
+
JSON.stringify(payload),
|
|
174
|
+
JSON.stringify(message.headers ?? {}),
|
|
175
|
+
input.attempts,
|
|
176
|
+
lastError.slice(0, 8000),
|
|
177
|
+
],
|
|
178
|
+
);
|
|
179
|
+
await markCapturedRawWriteFailed(client, eventIdempotencyKey, lastError);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// No idempotency key -> the partial index does not apply, so each null-keyed
|
|
184
|
+
// poison event is its own dead letter (never merged).
|
|
185
|
+
await client.query(
|
|
186
|
+
`INSERT INTO dl_meta.signal_radar_inbound_dead_letter
|
|
187
|
+
(dead_letter_id, provider, radar_key, org_id, event_idempotency_key,
|
|
188
|
+
payload, headers, attempts, last_error, status)
|
|
189
|
+
VALUES ($1, $2, $3, $4, NULL, $5::jsonb, $6::jsonb, $7, $8, 'open')`,
|
|
190
|
+
[
|
|
191
|
+
randomUUID(),
|
|
192
|
+
message.provider,
|
|
193
|
+
message.radarKey ?? null,
|
|
194
|
+
message.orgId ?? null,
|
|
195
|
+
JSON.stringify(payload),
|
|
196
|
+
JSON.stringify(message.headers ?? {}),
|
|
197
|
+
input.attempts,
|
|
198
|
+
lastError.slice(0, 8000),
|
|
199
|
+
],
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// The load-bearing retry-callback decision (plan §4a). Runs on every handler
|
|
204
|
+
// throw:
|
|
205
|
+
// - transient -> back off + redeliver, NEVER acknowledge, regardless of how
|
|
206
|
+
// far past maxDeliveries we are. A long Neon outage must drain on recovery.
|
|
207
|
+
// - permanent, still within maxDeliveries -> back off (give it its allotted
|
|
208
|
+
// retries; a "permanent" verdict can be a transient mislabel early on).
|
|
209
|
+
// - permanent, past maxDeliveries -> record the dead letter + acknowledge
|
|
210
|
+
// (stop retrying; it is now durably captured for human review + replay).
|
|
211
|
+
export type InboundRetryDecision =
|
|
212
|
+
| { afterSeconds: number }
|
|
213
|
+
| { acknowledge: true };
|
|
214
|
+
|
|
215
|
+
export function inboundBackoffSeconds(deliveryCount: number): number {
|
|
216
|
+
// Mirror the plan's bounded exponential backoff: 2^n * 5, capped at 300s.
|
|
217
|
+
const exponent = Math.max(1, deliveryCount);
|
|
218
|
+
return Math.min(300, 2 ** exponent * 5);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export async function resolveInboundRetryDecision(input: {
|
|
222
|
+
client: InboundPgClient;
|
|
223
|
+
message: DeadLetterMessageInput;
|
|
224
|
+
error: unknown;
|
|
225
|
+
deliveryCount: number;
|
|
226
|
+
maxDeliveries: number;
|
|
227
|
+
}): Promise<InboundRetryDecision> {
|
|
228
|
+
const failureClass = classifyInboundFailure(input.error);
|
|
229
|
+
|
|
230
|
+
if (failureClass === 'transient') {
|
|
231
|
+
return { afterSeconds: inboundBackoffSeconds(input.deliveryCount) };
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (input.deliveryCount <= input.maxDeliveries) {
|
|
235
|
+
return { afterSeconds: inboundBackoffSeconds(input.deliveryCount) };
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
await recordSignalRadarDeadLetter({
|
|
239
|
+
client: input.client,
|
|
240
|
+
message: input.message,
|
|
241
|
+
error: input.error,
|
|
242
|
+
attempts: input.deliveryCount,
|
|
243
|
+
});
|
|
244
|
+
return { acknowledge: true };
|
|
245
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// The durable message the thin Monitor inbound receiver enqueues onto the
|
|
2
|
+
// Vercel Queues front-queue. It carries ONLY what the worker needs that is not
|
|
3
|
+
// derivable without the provider's HTTP request — nothing Neon-derived. The
|
|
4
|
+
// worker re-runs the full ingestion machinery from this envelope alone (resolve
|
|
5
|
+
// the radar binding from Neon, capture-first raw, typed write, inline dispatch),
|
|
6
|
+
// so the receiver never has to touch Neon before returning 200.
|
|
7
|
+
|
|
8
|
+
export type SignalRadarInboundMessage = {
|
|
9
|
+
provider: string;
|
|
10
|
+
orgId: string;
|
|
11
|
+
token: string;
|
|
12
|
+
rawBody: string;
|
|
13
|
+
headers: Record<string, string>;
|
|
14
|
+
receivedAt: string;
|
|
15
|
+
admission: {
|
|
16
|
+
id: string;
|
|
17
|
+
bindingVersion: number;
|
|
18
|
+
/** A batch callback is resolved by its provider resource ID in Tier 2. */
|
|
19
|
+
routingMode?: 'single_monitor' | 'batch_by_upstream_resource';
|
|
20
|
+
verificationMode:
|
|
21
|
+
| 'hmac_signature'
|
|
22
|
+
| 'shared_secret_body'
|
|
23
|
+
| 'secret_header'
|
|
24
|
+
| 'callback_token_only';
|
|
25
|
+
};
|
|
26
|
+
// The Neon-free provider-event publish idempotency key, computed by the
|
|
27
|
+
// receiver from what is on the wire. Carried so the worker and dead-letter
|
|
28
|
+
// writer can key on the same grain the publish deduped on.
|
|
29
|
+
eventIdempotencyKey?: string | null;
|
|
30
|
+
// A preview monitor callback is received by Vercel but its run executes on
|
|
31
|
+
// an isolated scheduler lane. Preserve that request-scoped context across
|
|
32
|
+
// the durable queue boundary.
|
|
33
|
+
postgresSchedulerSchema?: string | null;
|
|
34
|
+
runtimeApiBaseUrl?: string | null;
|
|
35
|
+
// Optional radar hint the worker resolves durably from Neon; present only on
|
|
36
|
+
// dead-letter/replay envelopes where it was already known.
|
|
37
|
+
radarKey?: string | null;
|
|
38
|
+
};
|