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
package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { createHmac, timingSafeEqual } from 'node:crypto';
|
|
2
|
+
|
|
3
|
+
const ROLLBACK_EVENT_TYPES = new Set([
|
|
4
|
+
'deployment.rollback',
|
|
5
|
+
'deployment-rollback',
|
|
6
|
+
]);
|
|
7
|
+
const TRACKED_EVENT_TYPES = new Set([
|
|
8
|
+
'deployment.succeeded',
|
|
9
|
+
'deployment.promoted',
|
|
10
|
+
...ROLLBACK_EVENT_TYPES,
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
export type AlignmentStatus =
|
|
14
|
+
| 'ignored'
|
|
15
|
+
| 'tracked'
|
|
16
|
+
| 'rollback_tracked'
|
|
17
|
+
| 'rollback_needs_manual_mapping';
|
|
18
|
+
|
|
19
|
+
export interface VercelWebhookEvent {
|
|
20
|
+
type?: string;
|
|
21
|
+
id?: string;
|
|
22
|
+
createdAt?: number;
|
|
23
|
+
payload?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface VercelDeploymentSummary {
|
|
27
|
+
id: string;
|
|
28
|
+
url?: string;
|
|
29
|
+
meta?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface VercelRollbackNotice {
|
|
33
|
+
status: AlignmentStatus;
|
|
34
|
+
eventType: string;
|
|
35
|
+
deliveryId: string | null;
|
|
36
|
+
vercelProject: string | null;
|
|
37
|
+
fromDeploymentId: string | null;
|
|
38
|
+
toDeploymentId: string | null;
|
|
39
|
+
toDeploymentUrl: string | null;
|
|
40
|
+
gitSha: string | null;
|
|
41
|
+
workerBuildId: string | null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface VercelDeploymentEventSummary {
|
|
45
|
+
status: 'ignored' | 'tracked';
|
|
46
|
+
eventType: string;
|
|
47
|
+
deliveryId: string | null;
|
|
48
|
+
vercelProject: string | null;
|
|
49
|
+
deploymentId: string | null;
|
|
50
|
+
deploymentUrl: string | null;
|
|
51
|
+
target: string | null;
|
|
52
|
+
gitSha: string | null;
|
|
53
|
+
workerBuildId: string | null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function readRecord(value: unknown): Record<string, unknown> | null {
|
|
57
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
|
|
58
|
+
return value as Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function readString(value: unknown): string | null {
|
|
62
|
+
return typeof value === 'string' && value.trim() ? value.trim() : null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function readNestedString(
|
|
66
|
+
record: Record<string, unknown> | null,
|
|
67
|
+
path: string[],
|
|
68
|
+
): string | null {
|
|
69
|
+
let current: unknown = record;
|
|
70
|
+
for (const key of path) {
|
|
71
|
+
const next = readRecord(current);
|
|
72
|
+
if (!next) return null;
|
|
73
|
+
current = next[key];
|
|
74
|
+
}
|
|
75
|
+
return readString(current);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function normalizeGitSha(value: string | null): string | null {
|
|
79
|
+
if (!value) return null;
|
|
80
|
+
const trimmed = value.trim();
|
|
81
|
+
return /^[a-f0-9]{7,40}$/i.test(trimmed) ? trimmed : null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function verifyVercelSignature(input: {
|
|
85
|
+
rawBody: string;
|
|
86
|
+
signature: string | null;
|
|
87
|
+
secret: string;
|
|
88
|
+
}): boolean {
|
|
89
|
+
const signature = input.signature?.trim();
|
|
90
|
+
if (!signature) return false;
|
|
91
|
+
const expected = createHmac('sha1', input.secret)
|
|
92
|
+
.update(input.rawBody)
|
|
93
|
+
.digest('hex');
|
|
94
|
+
const expectedBuffer = Buffer.from(expected, 'hex');
|
|
95
|
+
const actualBuffer = Buffer.from(signature, 'hex');
|
|
96
|
+
if (expectedBuffer.byteLength !== actualBuffer.byteLength) return false;
|
|
97
|
+
return timingSafeEqual(expectedBuffer, actualBuffer);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function extractVercelDeploymentEvent(event: VercelWebhookEvent): {
|
|
101
|
+
eventType: string;
|
|
102
|
+
deliveryId: string | null;
|
|
103
|
+
deploymentId: string | null;
|
|
104
|
+
fromDeploymentId: string | null;
|
|
105
|
+
toDeploymentId: string | null;
|
|
106
|
+
vercelProject: string | null;
|
|
107
|
+
deploymentUrl: string | null;
|
|
108
|
+
target: string | null;
|
|
109
|
+
} {
|
|
110
|
+
const payload = readRecord(event.payload);
|
|
111
|
+
const eventType = readString(event.type) ?? 'unknown';
|
|
112
|
+
const deployment = readRecord(payload?.deployment);
|
|
113
|
+
const previousDeployment = readRecord(payload?.previousDeployment);
|
|
114
|
+
const targetDeployment = readRecord(payload?.targetDeployment);
|
|
115
|
+
const rollback = readRecord(payload?.rollback);
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
eventType,
|
|
119
|
+
deliveryId: readString(event.id),
|
|
120
|
+
deploymentId:
|
|
121
|
+
readNestedString(deployment, ['id']) ?? readString(payload?.deploymentId),
|
|
122
|
+
fromDeploymentId:
|
|
123
|
+
readString(payload?.fromDeploymentId) ??
|
|
124
|
+
readNestedString(rollback, ['fromDeploymentId']) ??
|
|
125
|
+
readNestedString(previousDeployment, ['id']) ??
|
|
126
|
+
readNestedString(deployment, ['id']),
|
|
127
|
+
toDeploymentId:
|
|
128
|
+
readString(payload?.toDeploymentId) ??
|
|
129
|
+
readString(payload?.targetDeploymentId) ??
|
|
130
|
+
readNestedString(rollback, ['toDeploymentId']) ??
|
|
131
|
+
readNestedString(targetDeployment, ['id']),
|
|
132
|
+
vercelProject:
|
|
133
|
+
readNestedString(payload, ['project', 'name']) ??
|
|
134
|
+
readString(payload?.projectName) ??
|
|
135
|
+
readString(payload?.projectId) ??
|
|
136
|
+
readNestedString(deployment, ['name']),
|
|
137
|
+
deploymentUrl:
|
|
138
|
+
readNestedString(deployment, ['url']) ??
|
|
139
|
+
readNestedString(payload, ['links', 'deployment']),
|
|
140
|
+
target: readString(payload?.target),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export const extractVercelRollbackIds = extractVercelDeploymentEvent;
|
|
145
|
+
|
|
146
|
+
export function extractGitShaFromVercelDeployment(
|
|
147
|
+
deployment: VercelDeploymentSummary | null,
|
|
148
|
+
): string | null {
|
|
149
|
+
const meta = deployment?.meta ?? {};
|
|
150
|
+
return normalizeGitSha(
|
|
151
|
+
readString(meta.githubCommitSha) ??
|
|
152
|
+
readString(meta.githubCommitSHA) ??
|
|
153
|
+
readString(meta.gitCommitSha) ??
|
|
154
|
+
readString(meta.commitSha) ??
|
|
155
|
+
readString(meta.VERCEL_GIT_COMMIT_SHA),
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function extractDeploymentSummaryFromVercelEvent(
|
|
160
|
+
event: VercelWebhookEvent,
|
|
161
|
+
): VercelDeploymentSummary | null {
|
|
162
|
+
const payload = readRecord(event.payload);
|
|
163
|
+
const ids = extractVercelDeploymentEvent(event);
|
|
164
|
+
const deployment =
|
|
165
|
+
readRecord(payload?.targetDeployment) ?? readRecord(payload?.deployment);
|
|
166
|
+
if (!deployment) return null;
|
|
167
|
+
|
|
168
|
+
const id =
|
|
169
|
+
readString(deployment.id) ?? ids.toDeploymentId ?? ids.deploymentId;
|
|
170
|
+
if (!id) return null;
|
|
171
|
+
|
|
172
|
+
return {
|
|
173
|
+
id,
|
|
174
|
+
url: readString(deployment.url) ?? ids.deploymentUrl ?? undefined,
|
|
175
|
+
meta: readRecord(deployment.meta) ?? undefined,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export function buildVercelRollbackNotice(input: {
|
|
180
|
+
event: VercelWebhookEvent;
|
|
181
|
+
targetDeployment: VercelDeploymentSummary | null;
|
|
182
|
+
}): VercelRollbackNotice {
|
|
183
|
+
const ids = extractVercelDeploymentEvent(input.event);
|
|
184
|
+
if (!ROLLBACK_EVENT_TYPES.has(ids.eventType)) {
|
|
185
|
+
return {
|
|
186
|
+
status: 'ignored',
|
|
187
|
+
eventType: ids.eventType,
|
|
188
|
+
deliveryId: ids.deliveryId,
|
|
189
|
+
vercelProject: ids.vercelProject,
|
|
190
|
+
fromDeploymentId: ids.fromDeploymentId,
|
|
191
|
+
toDeploymentId: ids.toDeploymentId,
|
|
192
|
+
toDeploymentUrl: input.targetDeployment?.url ?? null,
|
|
193
|
+
gitSha: null,
|
|
194
|
+
workerBuildId: null,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const gitSha = extractGitShaFromVercelDeployment(input.targetDeployment);
|
|
199
|
+
if (!gitSha) {
|
|
200
|
+
return {
|
|
201
|
+
status: 'rollback_needs_manual_mapping',
|
|
202
|
+
eventType: ids.eventType,
|
|
203
|
+
deliveryId: ids.deliveryId,
|
|
204
|
+
vercelProject: ids.vercelProject,
|
|
205
|
+
fromDeploymentId: ids.fromDeploymentId,
|
|
206
|
+
toDeploymentId: ids.toDeploymentId,
|
|
207
|
+
toDeploymentUrl: input.targetDeployment?.url ?? null,
|
|
208
|
+
gitSha: null,
|
|
209
|
+
workerBuildId: null,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const workerBuildId = `git-${gitSha}`;
|
|
214
|
+
|
|
215
|
+
return {
|
|
216
|
+
status: 'rollback_tracked',
|
|
217
|
+
eventType: ids.eventType,
|
|
218
|
+
deliveryId: ids.deliveryId,
|
|
219
|
+
vercelProject: ids.vercelProject,
|
|
220
|
+
fromDeploymentId: ids.fromDeploymentId,
|
|
221
|
+
toDeploymentId: ids.toDeploymentId,
|
|
222
|
+
toDeploymentUrl: input.targetDeployment?.url ?? null,
|
|
223
|
+
gitSha,
|
|
224
|
+
workerBuildId,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export function buildVercelDeploymentEventSummary(input: {
|
|
229
|
+
event: VercelWebhookEvent;
|
|
230
|
+
deployment: VercelDeploymentSummary | null;
|
|
231
|
+
}): VercelDeploymentEventSummary {
|
|
232
|
+
const ids = extractVercelDeploymentEvent(input.event);
|
|
233
|
+
const gitSha = extractGitShaFromVercelDeployment(input.deployment);
|
|
234
|
+
return {
|
|
235
|
+
status: TRACKED_EVENT_TYPES.has(ids.eventType) ? 'tracked' : 'ignored',
|
|
236
|
+
eventType: ids.eventType,
|
|
237
|
+
deliveryId: ids.deliveryId,
|
|
238
|
+
vercelProject: ids.vercelProject,
|
|
239
|
+
deploymentId: ids.deploymentId,
|
|
240
|
+
deploymentUrl: input.deployment?.url ?? ids.deploymentUrl,
|
|
241
|
+
target: ids.target,
|
|
242
|
+
gitSha,
|
|
243
|
+
workerBuildId: gitSha ? `git-${gitSha}` : null,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export function buildVercelRollbackSlackText(
|
|
248
|
+
plan: VercelRollbackNotice,
|
|
249
|
+
): string {
|
|
250
|
+
const lines = [
|
|
251
|
+
plan.status === 'rollback_tracked'
|
|
252
|
+
? ':warning: Vercel rollback detected; runtime rollback is manual.'
|
|
253
|
+
: ':warning: Vercel rollback detected; runtime build mapping needs manual lookup.',
|
|
254
|
+
plan.vercelProject ? `Project: ${plan.vercelProject}` : null,
|
|
255
|
+
plan.fromDeploymentId ? `From: ${plan.fromDeploymentId}` : null,
|
|
256
|
+
plan.toDeploymentId ? `To: ${plan.toDeploymentId}` : null,
|
|
257
|
+
plan.workerBuildId ? `Worker build: ${plan.workerBuildId}` : null,
|
|
258
|
+
];
|
|
259
|
+
return lines.filter(Boolean).join('\n');
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export function buildVercelDeploymentSlackText(
|
|
263
|
+
summary: VercelDeploymentEventSummary,
|
|
264
|
+
): string {
|
|
265
|
+
const title =
|
|
266
|
+
summary.eventType === 'deployment.succeeded'
|
|
267
|
+
? ':white_check_mark: Vercel deployment succeeded.'
|
|
268
|
+
: ':large_green_circle: Vercel deployment promoted.';
|
|
269
|
+
const lines = [
|
|
270
|
+
title,
|
|
271
|
+
summary.vercelProject ? `Project: ${summary.vercelProject}` : null,
|
|
272
|
+
summary.deploymentId ? `Deployment: ${summary.deploymentId}` : null,
|
|
273
|
+
summary.deploymentUrl ? `URL: ${summary.deploymentUrl}` : null,
|
|
274
|
+
summary.target ? `Target: ${summary.target}` : null,
|
|
275
|
+
summary.workerBuildId
|
|
276
|
+
? `Aligned worker build: ${summary.workerBuildId}`
|
|
277
|
+
: null,
|
|
278
|
+
];
|
|
279
|
+
return lines.filter(Boolean).join('\n');
|
|
280
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
export type VercelDeployment = {
|
|
2
|
+
id?: string;
|
|
3
|
+
/** Vercel's deployment-list endpoint names this same identifier `uid`. */
|
|
4
|
+
uid?: string;
|
|
5
|
+
url?: string;
|
|
6
|
+
gitSource?: { sha?: string };
|
|
7
|
+
meta?: { githubCommitSha?: string };
|
|
8
|
+
readyState?: string;
|
|
9
|
+
target?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type VercelGateDecision =
|
|
13
|
+
| { kind: 'ready' }
|
|
14
|
+
| { kind: 'superseded'; activeSha: string }
|
|
15
|
+
| { kind: 'assert-mismatch'; activeSha?: string }
|
|
16
|
+
| { kind: 'wait' };
|
|
17
|
+
|
|
18
|
+
export type VercelStagedProductionDecision =
|
|
19
|
+
| { kind: 'ready'; deployment: VercelDeployment }
|
|
20
|
+
| { kind: 'auto-assigned' }
|
|
21
|
+
| { kind: 'vercel-failed'; description?: string; targetUrl?: string }
|
|
22
|
+
| { kind: 'wait' };
|
|
23
|
+
|
|
24
|
+
export type VercelStagedProductionPolicyDecision =
|
|
25
|
+
| { kind: 'ready' }
|
|
26
|
+
| { kind: 'auto-assign-enabled' };
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The release controller only owns the Vercel alias while Vercel is configured
|
|
30
|
+
* to leave Production builds staged. Treat an absent or legacy project setting
|
|
31
|
+
* as unsafe rather than hoping the candidate gate catches an alias move later.
|
|
32
|
+
*/
|
|
33
|
+
export function decideVercelStagedProductionPolicy(input: {
|
|
34
|
+
autoAssignCustomDomains?: boolean;
|
|
35
|
+
}): VercelStagedProductionPolicyDecision {
|
|
36
|
+
return input.autoAssignCustomDomains === false
|
|
37
|
+
? { kind: 'ready' }
|
|
38
|
+
: { kind: 'auto-assign-enabled' };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function deploymentSha(deployment: VercelDeployment): string | undefined {
|
|
42
|
+
return deployment.meta?.githubCommitSha ?? deployment.gitSource?.sha;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function deploymentId(deployment: VercelDeployment): string | undefined {
|
|
46
|
+
return deployment.id ?? deployment.uid;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Git creates the production build; the release controller only promotes the
|
|
51
|
+
* already-staged deployment after its runtime proof has passed. Keep that one
|
|
52
|
+
* provider mutation shared by normal release and panic recovery.
|
|
53
|
+
*/
|
|
54
|
+
export async function promoteVercelProductionDeployment(input: {
|
|
55
|
+
deploymentId: string;
|
|
56
|
+
fetchImpl?: typeof fetch;
|
|
57
|
+
projectId: string;
|
|
58
|
+
teamId: string;
|
|
59
|
+
token: string;
|
|
60
|
+
}): Promise<Response> {
|
|
61
|
+
return await (input.fetchImpl ?? fetch)(
|
|
62
|
+
`https://api.vercel.com/v10/projects/${encodeURIComponent(input.projectId)}/promote/${encodeURIComponent(input.deploymentId)}?teamId=${encodeURIComponent(input.teamId)}`,
|
|
63
|
+
{
|
|
64
|
+
method: 'POST',
|
|
65
|
+
headers: {
|
|
66
|
+
authorization: `Bearer ${input.token}`,
|
|
67
|
+
'content-type': 'application/json',
|
|
68
|
+
},
|
|
69
|
+
body: '{}',
|
|
70
|
+
},
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A staged production deployment is the exact production build we will
|
|
76
|
+
* promote later, but it must not yet own the public production alias. This is
|
|
77
|
+
* deliberately separate from decideVercelProductionGate: accepting an active
|
|
78
|
+
* alias here would make the release controller silently lose traffic control.
|
|
79
|
+
*/
|
|
80
|
+
export function decideVercelStagedProductionGate(input: {
|
|
81
|
+
expectedSha: string;
|
|
82
|
+
activeDeployment: VercelDeployment;
|
|
83
|
+
deployments: VercelDeployment[];
|
|
84
|
+
vercelStatus?: {
|
|
85
|
+
state?: string;
|
|
86
|
+
description?: string;
|
|
87
|
+
target_url?: string;
|
|
88
|
+
};
|
|
89
|
+
}): VercelStagedProductionDecision {
|
|
90
|
+
if (
|
|
91
|
+
input.vercelStatus?.state === 'failure' ||
|
|
92
|
+
input.vercelStatus?.state === 'error'
|
|
93
|
+
) {
|
|
94
|
+
return {
|
|
95
|
+
kind: 'vercel-failed',
|
|
96
|
+
description: input.vercelStatus.description,
|
|
97
|
+
targetUrl: input.vercelStatus.target_url,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const activeServesExpectedSha =
|
|
101
|
+
deploymentSha(input.activeDeployment) === input.expectedSha;
|
|
102
|
+
if (activeServesExpectedSha) {
|
|
103
|
+
return { kind: 'auto-assigned' };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const candidates = input.deployments.filter(
|
|
107
|
+
(deployment) =>
|
|
108
|
+
deploymentSha(deployment) === input.expectedSha &&
|
|
109
|
+
deployment.target === 'production' &&
|
|
110
|
+
deploymentId(deployment) !== deploymentId(input.activeDeployment),
|
|
111
|
+
);
|
|
112
|
+
const staged = candidates.find(
|
|
113
|
+
(deployment) =>
|
|
114
|
+
deployment.readyState === 'READY' &&
|
|
115
|
+
Boolean(deploymentId(deployment)) &&
|
|
116
|
+
Boolean(deployment.url),
|
|
117
|
+
);
|
|
118
|
+
if (staged) return { kind: 'ready', deployment: staged };
|
|
119
|
+
|
|
120
|
+
if (candidates.some((deployment) => deployment.readyState === 'ERROR')) {
|
|
121
|
+
return {
|
|
122
|
+
kind: 'vercel-failed',
|
|
123
|
+
description: input.vercelStatus?.description,
|
|
124
|
+
targetUrl: input.vercelStatus?.target_url,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
return { kind: 'wait' };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Decide whether a shared-plane mutation may proceed from the deployment that
|
|
132
|
+
* is actually behind the production alias. Kept pure so the race cases are
|
|
133
|
+
* tested without making Vercel or GitHub API calls.
|
|
134
|
+
*/
|
|
135
|
+
export function decideVercelProductionGate(input: {
|
|
136
|
+
expectedSha: string;
|
|
137
|
+
activeDeployment: VercelDeployment;
|
|
138
|
+
activeRevisionIsNewer: boolean;
|
|
139
|
+
mode: 'wait' | 'assert';
|
|
140
|
+
}): VercelGateDecision {
|
|
141
|
+
const activeSha =
|
|
142
|
+
input.activeDeployment.meta?.githubCommitSha ??
|
|
143
|
+
input.activeDeployment.gitSource?.sha;
|
|
144
|
+
|
|
145
|
+
if (
|
|
146
|
+
activeSha === input.expectedSha &&
|
|
147
|
+
input.activeDeployment.readyState === 'READY' &&
|
|
148
|
+
input.activeDeployment.target === 'production'
|
|
149
|
+
) {
|
|
150
|
+
return { kind: 'ready' };
|
|
151
|
+
}
|
|
152
|
+
if (input.activeRevisionIsNewer && activeSha) {
|
|
153
|
+
return { kind: 'superseded', activeSha };
|
|
154
|
+
}
|
|
155
|
+
if (input.mode === 'assert') {
|
|
156
|
+
return { kind: 'assert-mismatch', activeSha };
|
|
157
|
+
}
|
|
158
|
+
return { kind: 'wait' };
|
|
159
|
+
}
|
|
@@ -34,6 +34,35 @@ export function durableCacheStaleBucket(input: {
|
|
|
34
34
|
|
|
35
35
|
export const durableCallStaleBucket = durableCacheStaleBucket;
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* An exact completed tool receipt owned by a source run. The opaque key keeps
|
|
39
|
+
* request data out of storage keys while still giving a replay one stable,
|
|
40
|
+
* deterministic lookup per logical tool call.
|
|
41
|
+
*/
|
|
42
|
+
export function buildSourceRunToolReceiptManifestKey(input: {
|
|
43
|
+
orgId?: string | null;
|
|
44
|
+
sourceRunId: string;
|
|
45
|
+
logicalCallId: string;
|
|
46
|
+
}): string {
|
|
47
|
+
const orgId = input.orgId?.trim() || 'org';
|
|
48
|
+
const sourceRunId = input.sourceRunId.trim();
|
|
49
|
+
const logicalCallId = input.logicalCallId.trim();
|
|
50
|
+
if (!sourceRunId || !logicalCallId) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
'Source-run tool receipt manifest key requires sourceRunId and logicalCallId.',
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
const digest = sha256Hex(
|
|
56
|
+
stableStringify({
|
|
57
|
+
kind: 'source-run-tool-receipt-manifest-v1',
|
|
58
|
+
orgId,
|
|
59
|
+
sourceRunId,
|
|
60
|
+
logicalCallId,
|
|
61
|
+
}),
|
|
62
|
+
);
|
|
63
|
+
return `ctx:${orgId}:source-run-tool-receipt:${digest}`;
|
|
64
|
+
}
|
|
65
|
+
|
|
37
66
|
export function buildDurableToolCallCacheKey(input: {
|
|
38
67
|
orgId?: string | null;
|
|
39
68
|
toolId: string;
|
|
@@ -63,6 +63,12 @@ export type RuntimeAuthorityDescriptor = {
|
|
|
63
63
|
* the pre-feature behavior, which is the whole point of the switch.
|
|
64
64
|
*/
|
|
65
65
|
docflowEnabled?: boolean | null;
|
|
66
|
+
/**
|
|
67
|
+
* Expand-before-enable fence for async-child attempt proof. Missing is the
|
|
68
|
+
* historic compatibility behavior; writers may enable it only after every
|
|
69
|
+
* worker can refresh an attempt token carrying a lease claim.
|
|
70
|
+
*/
|
|
71
|
+
asyncChildAdmissionAttemptRequired?: boolean | null;
|
|
66
72
|
capabilities: RuntimeExecutionCapability[];
|
|
67
73
|
};
|
|
68
74
|
|
|
@@ -89,6 +95,21 @@ export function normalizeRuntimeExecutionCapabilities(
|
|
|
89
95
|
return [...new Set(values.filter(isRuntimeExecutionCapability))].sort();
|
|
90
96
|
}
|
|
91
97
|
|
|
98
|
+
/**
|
|
99
|
+
* A backend may impose a smaller execution surface, but it can never turn a
|
|
100
|
+
* durable run authority into a broader one. Keep this policy primitive beside
|
|
101
|
+
* the descriptor rather than letting token issuers reconstruct it ad hoc.
|
|
102
|
+
*/
|
|
103
|
+
export function intersectRuntimeExecutionCapabilities(
|
|
104
|
+
persisted: readonly unknown[] | null | undefined,
|
|
105
|
+
backendAllowed: readonly RuntimeExecutionCapability[],
|
|
106
|
+
): RuntimeExecutionCapability[] {
|
|
107
|
+
const allowed = new Set(backendAllowed);
|
|
108
|
+
return normalizeRuntimeExecutionCapabilities(persisted).filter((capability) =>
|
|
109
|
+
allowed.has(capability),
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
92
113
|
export function hasRuntimeExecutionCapability(
|
|
93
114
|
values: readonly string[] | null | undefined,
|
|
94
115
|
capability: RuntimeExecutionCapability,
|
|
@@ -152,6 +173,8 @@ export function requireRuntimeAuthorityDescriptor(
|
|
|
152
173
|
// read back through, so anything that is not an explicit yes — missing,
|
|
153
174
|
// null, a string that survived a JSON round trip — denies.
|
|
154
175
|
docflowEnabled: descriptor.docflowEnabled === true,
|
|
176
|
+
asyncChildAdmissionAttemptRequired:
|
|
177
|
+
descriptor.asyncChildAdmissionAttemptRequired === true,
|
|
155
178
|
capabilities,
|
|
156
179
|
};
|
|
157
180
|
}
|