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
|
@@ -24,6 +24,11 @@ export const TOOL_EXECUTE_BARE_RATE_LIMIT_MAX_ATTEMPTS = 2;
|
|
|
24
24
|
// tool deadline remains the hard bound; this prevents a normal one-minute
|
|
25
25
|
// queue wait from being compressed into eight five-second retries.
|
|
26
26
|
export const TOOL_EXECUTE_CONCURRENCY_BACKPRESSURE_MAX_ATTEMPTS = 65;
|
|
27
|
+
// Scheduler admission happens before the integration route can dispatch a
|
|
28
|
+
// provider request. A typed refusal is therefore safe to park and replay even
|
|
29
|
+
// for an operation that has not opted into ordinary transient-5xx retries.
|
|
30
|
+
// Keep its window aligned with other local control-plane queue signals.
|
|
31
|
+
export const TOOL_EXECUTE_RUNTIME_SCHEDULER_CAPACITY_MAX_ATTEMPTS = 65;
|
|
27
32
|
export const TOOL_EXECUTE_TRANSPORT_MAX_ATTEMPTS = 3;
|
|
28
33
|
export const TOOL_EXECUTE_TRANSPORT_RETRY_DELAY_MS = 1_000;
|
|
29
34
|
export const TOOL_EXECUTE_RETRY_DELAY_FALLBACK_MS = 1_000;
|
|
@@ -61,6 +66,7 @@ export type ToolExecuteHttpRetryDecision = {
|
|
|
61
66
|
reason:
|
|
62
67
|
| 'rate_limit'
|
|
63
68
|
| 'concurrency_backpressure'
|
|
69
|
+
| 'runtime_scheduler_capacity'
|
|
64
70
|
| 'idempotency_in_progress'
|
|
65
71
|
| 'gateway_invocation_in_progress'
|
|
66
72
|
| 'customer_db_storage_unavailable'
|
|
@@ -78,6 +84,8 @@ export type ToolExecuteHttpFailureOutcome = ToolExecuteHttpRetryDecision & {
|
|
|
78
84
|
retryDelayMs: number;
|
|
79
85
|
backpressureDelayMs: number | null;
|
|
80
86
|
chargeRetryBudget: boolean;
|
|
87
|
+
/** The response proves the provider request was never dispatched. */
|
|
88
|
+
knownNotDispatched: boolean;
|
|
81
89
|
};
|
|
82
90
|
|
|
83
91
|
export type ToolExecuteHttpFailureAttemptTracker = {
|
|
@@ -155,6 +163,18 @@ function isConcurrencyBackpressureResponse(input: {
|
|
|
155
163
|
);
|
|
156
164
|
}
|
|
157
165
|
|
|
166
|
+
function isRuntimeSchedulerCapacityResponse(input: {
|
|
167
|
+
status: number;
|
|
168
|
+
bodyText: string;
|
|
169
|
+
}): boolean {
|
|
170
|
+
// This is a scheduler pre-admission outcome. Do not extend this exemption to
|
|
171
|
+
// generic 503s: they can arrive after a non-idempotent provider call.
|
|
172
|
+
return (
|
|
173
|
+
input.status === 503 &&
|
|
174
|
+
parseJsonObject(input.bodyText)?.code === 'scheduler_capacity'
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
158
178
|
function idempotencyInProgressRetryDelayMs(attempt: number): number {
|
|
159
179
|
return (
|
|
160
180
|
TOOL_EXECUTE_IDEMPOTENCY_IN_PROGRESS_RETRY_DELAYS_MS[
|
|
@@ -189,6 +209,7 @@ function decideToolExecuteHttpRetry(input: {
|
|
|
189
209
|
gatewayInvocationInProgress?: boolean;
|
|
190
210
|
customerDbStorageUnavailable?: boolean;
|
|
191
211
|
concurrencyBackpressure?: boolean;
|
|
212
|
+
runtimeSchedulerCapacity?: boolean;
|
|
192
213
|
hardBillingFailure?: boolean;
|
|
193
214
|
hasRetryAfterHeader?: boolean;
|
|
194
215
|
transientHttpRetrySafe?: boolean;
|
|
@@ -222,6 +243,13 @@ function decideToolExecuteHttpRetry(input: {
|
|
|
222
243
|
reason: 'rate_limit',
|
|
223
244
|
};
|
|
224
245
|
}
|
|
246
|
+
if (input.runtimeSchedulerCapacity) {
|
|
247
|
+
return {
|
|
248
|
+
retryable: true,
|
|
249
|
+
attemptCap: TOOL_EXECUTE_RUNTIME_SCHEDULER_CAPACITY_MAX_ATTEMPTS,
|
|
250
|
+
reason: 'runtime_scheduler_capacity',
|
|
251
|
+
};
|
|
252
|
+
}
|
|
225
253
|
if (input.gatewayInvocationInProgress) {
|
|
226
254
|
return {
|
|
227
255
|
retryable: true,
|
|
@@ -274,6 +302,7 @@ export function createToolExecuteHttpFailureAttemptTracker(): ToolExecuteHttpFai
|
|
|
274
302
|
> = {
|
|
275
303
|
rate_limit: 0,
|
|
276
304
|
concurrency_backpressure: 0,
|
|
305
|
+
runtime_scheduler_capacity: 0,
|
|
277
306
|
idempotency_in_progress: 0,
|
|
278
307
|
gateway_invocation_in_progress: 0,
|
|
279
308
|
customer_db_storage_unavailable: 0,
|
|
@@ -304,6 +333,10 @@ export function createToolExecuteHttpFailureAttemptTracker(): ToolExecuteHttpFai
|
|
|
304
333
|
status: input.status,
|
|
305
334
|
bodyText: input.bodyText ?? '',
|
|
306
335
|
}),
|
|
336
|
+
runtimeSchedulerCapacity: isRuntimeSchedulerCapacityResponse({
|
|
337
|
+
status: input.status,
|
|
338
|
+
bodyText: input.bodyText ?? '',
|
|
339
|
+
}),
|
|
307
340
|
hasRetryAfterHeader: true,
|
|
308
341
|
transientHttpRetrySafe: input.transientHttpRetrySafe === true,
|
|
309
342
|
});
|
|
@@ -350,12 +383,14 @@ export function classifyToolExecuteHttpFailure(input: {
|
|
|
350
383
|
const customerDbStorageUnavailable =
|
|
351
384
|
isCustomerDbStorageUnavailableResponse(input);
|
|
352
385
|
const concurrencyBackpressure = isConcurrencyBackpressureResponse(input);
|
|
386
|
+
const runtimeSchedulerCapacity = isRuntimeSchedulerCapacityResponse(input);
|
|
353
387
|
const initialRetryDecision = decideToolExecuteHttpRetry({
|
|
354
388
|
status: input.status,
|
|
355
389
|
idempotencyInProgress,
|
|
356
390
|
gatewayInvocationInProgress,
|
|
357
391
|
customerDbStorageUnavailable,
|
|
358
392
|
concurrencyBackpressure,
|
|
393
|
+
runtimeSchedulerCapacity,
|
|
359
394
|
hasRetryAfterHeader,
|
|
360
395
|
transientHttpRetrySafe,
|
|
361
396
|
});
|
|
@@ -372,7 +407,9 @@ export function classifyToolExecuteHttpFailure(input: {
|
|
|
372
407
|
schemaVersion: input.schemaVersion,
|
|
373
408
|
retryable: initialRetryDecision.retryable,
|
|
374
409
|
retryAfterMs:
|
|
375
|
-
input.status === 429 && hasRetryAfterHeader
|
|
410
|
+
(input.status === 429 && hasRetryAfterHeader) || runtimeSchedulerCapacity
|
|
411
|
+
? retryAfterMs
|
|
412
|
+
: null,
|
|
376
413
|
});
|
|
377
414
|
if (
|
|
378
415
|
typeof input.providerLatencyMs === 'number' &&
|
|
@@ -388,6 +425,7 @@ export function classifyToolExecuteHttpFailure(input: {
|
|
|
388
425
|
gatewayInvocationInProgress,
|
|
389
426
|
customerDbStorageUnavailable,
|
|
390
427
|
concurrencyBackpressure,
|
|
428
|
+
runtimeSchedulerCapacity,
|
|
391
429
|
hardBillingFailure,
|
|
392
430
|
hasRetryAfterHeader,
|
|
393
431
|
transientHttpRetrySafe,
|
|
@@ -414,23 +452,28 @@ export function classifyToolExecuteHttpFailure(input: {
|
|
|
414
452
|
TOOL_EXECUTE_RETRY_DELAY_FALLBACK_MS * input.attempt,
|
|
415
453
|
),
|
|
416
454
|
)
|
|
417
|
-
:
|
|
455
|
+
: retryDecision.reason === 'runtime_scheduler_capacity'
|
|
418
456
|
? Math.min(
|
|
419
|
-
|
|
420
|
-
Math.max(
|
|
421
|
-
retryAfterMs,
|
|
422
|
-
TOOL_EXECUTE_RETRY_DELAY_FALLBACK_MS * input.attempt,
|
|
423
|
-
),
|
|
457
|
+
TOOL_EXECUTE_RETRY_DELAY_MAX_MS,
|
|
458
|
+
Math.max(retryAfterMs, TOOL_EXECUTE_RETRY_DELAY_FALLBACK_MS),
|
|
424
459
|
)
|
|
425
|
-
:
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
460
|
+
: input.status === 429
|
|
461
|
+
? Math.min(
|
|
462
|
+
TOOL_EXECUTE_RATE_LIMIT_RETRY_DELAY_MAX_MS,
|
|
463
|
+
Math.max(
|
|
464
|
+
retryAfterMs,
|
|
465
|
+
TOOL_EXECUTE_RETRY_DELAY_FALLBACK_MS * input.attempt,
|
|
466
|
+
),
|
|
467
|
+
)
|
|
468
|
+
: retryDecision.reason === 'idempotency_in_progress' &&
|
|
429
469
|
!hasRetryAfterHeader
|
|
430
470
|
? idempotencyInProgressRetryDelayMs(input.attempt)
|
|
431
|
-
:
|
|
432
|
-
|
|
433
|
-
|
|
471
|
+
: retryDecision.reason === 'gateway_invocation_in_progress' &&
|
|
472
|
+
!hasRetryAfterHeader
|
|
473
|
+
? idempotencyInProgressRetryDelayMs(input.attempt)
|
|
474
|
+
: retryAfterMs > 0
|
|
475
|
+
? Math.min(TOOL_EXECUTE_RETRY_DELAY_MAX_MS, retryAfterMs)
|
|
476
|
+
: TOOL_EXECUTE_RETRY_DELAY_FALLBACK_MS;
|
|
434
477
|
return {
|
|
435
478
|
...retryDecision,
|
|
436
479
|
error,
|
|
@@ -458,6 +501,8 @@ export function classifyToolExecuteHttpFailure(input: {
|
|
|
458
501
|
chargeRetryBudget:
|
|
459
502
|
shouldRetry &&
|
|
460
503
|
retryDecision.reason !== 'gateway_invocation_in_progress' &&
|
|
461
|
-
retryDecision.reason !== 'concurrency_backpressure'
|
|
504
|
+
retryDecision.reason !== 'concurrency_backpressure' &&
|
|
505
|
+
retryDecision.reason !== 'runtime_scheduler_capacity',
|
|
506
|
+
knownNotDispatched: runtimeSchedulerCapacity,
|
|
462
507
|
};
|
|
463
508
|
}
|
|
@@ -19,6 +19,11 @@ export type ToolExecutionOutcome =
|
|
|
19
19
|
| (BaseToolExecutionOutcome & {
|
|
20
20
|
kind: 'checkpoint';
|
|
21
21
|
})
|
|
22
|
+
| (BaseToolExecutionOutcome & {
|
|
23
|
+
/** Exact completed receipt recorded by the user-requested source run. */
|
|
24
|
+
kind: 'source_run';
|
|
25
|
+
receiptKey: string;
|
|
26
|
+
})
|
|
22
27
|
| (BaseToolExecutionOutcome & {
|
|
23
28
|
kind: 'cache';
|
|
24
29
|
receiptKey: string;
|
|
@@ -75,6 +80,21 @@ export function toolExecutionMetadataForOutcome(
|
|
|
75
80
|
source: 'checkpoint',
|
|
76
81
|
...optionalCacheKey(outcome.cacheKey),
|
|
77
82
|
};
|
|
83
|
+
case 'source_run': {
|
|
84
|
+
const receiptKey = trimmed(outcome.receiptKey);
|
|
85
|
+
if (!receiptKey) {
|
|
86
|
+
throw new Error('Source-run tool recovery requires a receipt key.');
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
idempotent: true,
|
|
90
|
+
cached: true,
|
|
91
|
+
source: 'source_run',
|
|
92
|
+
...optionalCacheKey(outcome.cacheKey),
|
|
93
|
+
receiptRole: 'follower',
|
|
94
|
+
receiptKey,
|
|
95
|
+
...followerAttachment({ receiptKey }),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
78
98
|
case 'cache': {
|
|
79
99
|
const receiptKey = trimmed(outcome.receiptKey);
|
|
80
100
|
if (!receiptKey) {
|
|
@@ -8,6 +8,18 @@ export function transientServiceUnavailableDetail(
|
|
|
8
8
|
if (error instanceof TypeError && /^fetch failed$/i.test(detail.trim())) {
|
|
9
9
|
return detail;
|
|
10
10
|
}
|
|
11
|
+
// A Convex deployment can also be briefly unreachable at its Cloudflare
|
|
12
|
+
// edge. Unlike the normal JSON envelope, the HTTP client passes that 502
|
|
13
|
+
// page through as its error message. Keep this narrow to Convex's own
|
|
14
|
+
// branded page: an arbitrary application response that happens to mention
|
|
15
|
+
// a gateway must never make a caller retryable.
|
|
16
|
+
if (
|
|
17
|
+
/convex\.cloud\s*\|\s*502\s*:\s*Bad gateway[\s\S]*Error code\s*502/i.test(
|
|
18
|
+
detail,
|
|
19
|
+
)
|
|
20
|
+
) {
|
|
21
|
+
return detail;
|
|
22
|
+
}
|
|
11
23
|
// Convex uses explicit ServiceUnavailable and ExpiredInQueue responses, as
|
|
12
24
|
// well as this generic InternalServerError envelope for short control-plane
|
|
13
25
|
// outages. The latter text is intentionally exact: application exceptions
|
|
@@ -114,7 +114,9 @@ export async function resolveVercelProtectionBypassCookie(input: {
|
|
|
114
114
|
// supplies a reusable cookie or evicts itself for a later retry.
|
|
115
115
|
const response = await (input.fetchImpl ?? fetch)(url.toString(), {
|
|
116
116
|
headers: { 'x-vercel-protection-bypass': token },
|
|
117
|
-
signal: AbortSignal.timeout(
|
|
117
|
+
signal: AbortSignal.timeout(
|
|
118
|
+
VERCEL_PROTECTION_COOKIE_PREFLIGHT_TIMEOUT_MS,
|
|
119
|
+
),
|
|
118
120
|
});
|
|
119
121
|
return response ? cookieHeaderFromSetCookie(response.headers) : null;
|
|
120
122
|
})();
|
|
@@ -154,3 +156,14 @@ export async function vercelProtectionBypassHeaders(input: {
|
|
|
154
156
|
...(cookie ? { cookie } : {}),
|
|
155
157
|
};
|
|
156
158
|
}
|
|
159
|
+
|
|
160
|
+
export function resolveVercelProtectionBypassTokenForRequest(
|
|
161
|
+
req: Pick<Request, 'headers'>,
|
|
162
|
+
): string | null {
|
|
163
|
+
const token =
|
|
164
|
+
req.headers.get('x-vercel-protection-bypass')?.trim() ||
|
|
165
|
+
process.env.VERCEL_PROTECTION_BYPASS_TOKEN?.trim() ||
|
|
166
|
+
process.env.VERCEL_AUTOMATION_BYPASS_SECRET?.trim() ||
|
|
167
|
+
'';
|
|
168
|
+
return token || null;
|
|
169
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import {
|
|
3
|
+
PLAY_SECRET_UNAVAILABLE,
|
|
4
|
+
playSecretUnavailableErrorFrom,
|
|
5
|
+
} from '../plays/secrets/errors';
|
|
6
|
+
|
|
7
|
+
const RETRY_BASE_MS = 1_000;
|
|
8
|
+
const RETRY_CAP_MS = 15 * 60 * 1_000;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Admission has not called a customer provider or started user code. Unknown
|
|
12
|
+
* failures therefore stay retryable: an internal 5xx must not discard a
|
|
13
|
+
* source delivery. Only a proven local configuration error is blocked.
|
|
14
|
+
*/
|
|
15
|
+
export function classifyWebhookReceiptAdmissionFailure(error: unknown): {
|
|
16
|
+
retryable: boolean;
|
|
17
|
+
code: 'INTERNAL_ADMISSION_FAILURE' | typeof PLAY_SECRET_UNAVAILABLE;
|
|
18
|
+
} {
|
|
19
|
+
const unavailableSecret = playSecretUnavailableErrorFrom(error);
|
|
20
|
+
if (unavailableSecret) {
|
|
21
|
+
return { retryable: false, code: PLAY_SECRET_UNAVAILABLE };
|
|
22
|
+
}
|
|
23
|
+
return { retryable: true, code: 'INTERNAL_ADMISSION_FAILURE' };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Stable jitter spreads a burst without making a receipt's retry timing
|
|
28
|
+
* unknowable to operators. The cap makes a prolonged platform incident cheap
|
|
29
|
+
* while the receipt remains durable and visible for recovery.
|
|
30
|
+
*/
|
|
31
|
+
export function webhookReceiptRetryDelayMs(input: {
|
|
32
|
+
eventId: string;
|
|
33
|
+
attempt: number;
|
|
34
|
+
}): number {
|
|
35
|
+
const exponent = Math.min(Math.max(input.attempt - 1, 0), 10);
|
|
36
|
+
const ceiling = Math.min(RETRY_CAP_MS, RETRY_BASE_MS * 2 ** exponent);
|
|
37
|
+
const hash = createHash('sha256')
|
|
38
|
+
.update(input.eventId)
|
|
39
|
+
.update(':')
|
|
40
|
+
.update(String(input.attempt))
|
|
41
|
+
.digest();
|
|
42
|
+
// Keep a nonzero delay and give concurrent deliveries independent stable
|
|
43
|
+
// placement across the exponential window. The first retry spans 1–2s;
|
|
44
|
+
// otherwise a burst of first-attempt failures would synchronise again.
|
|
45
|
+
const fraction = hash.readUInt32BE(0) / 0xffff_ffff;
|
|
46
|
+
return Math.min(
|
|
47
|
+
RETRY_CAP_MS,
|
|
48
|
+
Math.max(RETRY_BASE_MS, Math.round(ceiling * (1 + fraction))),
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { deployed } from '@deepline/deployed-contracts';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Durable work-receipt storage is shared by app and worker deployments.
|
|
5
|
+
*
|
|
6
|
+
* The key namespace and integer codes are immutable: changing either would
|
|
7
|
+
* reinterpret an already-written receipt or make it invisible. Table columns
|
|
8
|
+
* are intentionally additive, because an older writer ignores an extra column
|
|
9
|
+
* and this module gives a newer reader one canonical self-heal path.
|
|
10
|
+
*/
|
|
11
|
+
export const WORK_RECEIPT_KEY_FORMAT = {
|
|
12
|
+
prefix: 'ctxv2',
|
|
13
|
+
separator: ':',
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
export const WORK_RECEIPT_STATUS_CODE = {
|
|
17
|
+
queued: 0,
|
|
18
|
+
pending: 0,
|
|
19
|
+
running: 1,
|
|
20
|
+
completed: 2,
|
|
21
|
+
failed: 3,
|
|
22
|
+
skipped: 4,
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
export type WorkReceiptStatus = keyof typeof WORK_RECEIPT_STATUS_CODE;
|
|
26
|
+
|
|
27
|
+
export const WORK_RECEIPT_FAILURE_KIND_CODE = {
|
|
28
|
+
terminal: 0,
|
|
29
|
+
repairable: 1,
|
|
30
|
+
} as const;
|
|
31
|
+
|
|
32
|
+
export type WorkReceiptFailureKind =
|
|
33
|
+
keyof typeof WORK_RECEIPT_FAILURE_KIND_CODE;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Every customer-Neon receipt writer derives its DDL from this list. The
|
|
37
|
+
* deploy-skew gate permits only additive changes once this contract is live.
|
|
38
|
+
*/
|
|
39
|
+
export const WORK_RECEIPT_TABLE_COLUMNS = [
|
|
40
|
+
['status', 'smallint NOT NULL DEFAULT 0'],
|
|
41
|
+
['output', 'jsonb'],
|
|
42
|
+
['error', 'text'],
|
|
43
|
+
['error_payload', 'jsonb'],
|
|
44
|
+
['failure_kind', 'smallint NOT NULL DEFAULT 0'],
|
|
45
|
+
['run_id', 'text'],
|
|
46
|
+
['lease_id', 'text'],
|
|
47
|
+
['lease_owner_run_id', 'text'],
|
|
48
|
+
['lease_owner_attempt', 'integer'],
|
|
49
|
+
['lease_expires_at', 'timestamptz'],
|
|
50
|
+
['updated_at', 'timestamptz NOT NULL DEFAULT now()'],
|
|
51
|
+
] as const;
|
|
52
|
+
|
|
53
|
+
/** The non-idempotent-work lock shares the receipt deployment boundary. */
|
|
54
|
+
export const WORK_RECEIPT_EXECUTION_LOCK_TABLE =
|
|
55
|
+
'_deepline_receipt_execution_locks';
|
|
56
|
+
|
|
57
|
+
export const WORK_RECEIPT_EXECUTION_LOCK_STORAGE_CONTRACT = deployed.table({
|
|
58
|
+
id: 'work-receipt-execution-lock-storage',
|
|
59
|
+
key: 'k bytea primary key',
|
|
60
|
+
columns: {
|
|
61
|
+
owner_execution_id: { type: 'text NOT NULL' },
|
|
62
|
+
expires_at: { type: 'timestamptz NOT NULL' },
|
|
63
|
+
updated_at: {
|
|
64
|
+
type: 'timestamptz NOT NULL DEFAULT now()',
|
|
65
|
+
default: 'timestamptz NOT NULL DEFAULT now()',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* CI snapshots this declarative shape. A writer can add a nullable/defaulted
|
|
72
|
+
* column, but cannot silently reinterpret a receipt key or replace/delete a
|
|
73
|
+
* column an older reader may still need.
|
|
74
|
+
*/
|
|
75
|
+
export const WORK_RECEIPT_STORAGE_CONTRACT = deployed.table({
|
|
76
|
+
id: 'work-receipt-storage',
|
|
77
|
+
key: 'k bytea primary key',
|
|
78
|
+
columns: Object.fromEntries(
|
|
79
|
+
WORK_RECEIPT_TABLE_COLUMNS.map(([name, definition]) => [
|
|
80
|
+
name,
|
|
81
|
+
{
|
|
82
|
+
type: definition,
|
|
83
|
+
optional: !/NOT NULL/.test(definition) || undefined,
|
|
84
|
+
default: /DEFAULT/.test(definition) ? definition : undefined,
|
|
85
|
+
},
|
|
86
|
+
]),
|
|
87
|
+
),
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export type WorkReceiptTableColumn =
|
|
91
|
+
(typeof WORK_RECEIPT_TABLE_COLUMNS)[number][0];
|
|
92
|
+
|
|
93
|
+
export const WORK_RECEIPT_TABLE_COLUMN_NAMES = WORK_RECEIPT_TABLE_COLUMNS.map(
|
|
94
|
+
([column]) => column,
|
|
95
|
+
) as readonly WorkReceiptTableColumn[];
|
|
96
|
+
|
|
97
|
+
export const WORK_RECEIPT_LEASE_COLUMNS = [
|
|
98
|
+
'lease_id',
|
|
99
|
+
'lease_owner_run_id',
|
|
100
|
+
'lease_owner_attempt',
|
|
101
|
+
'lease_expires_at',
|
|
102
|
+
] as const satisfies readonly WorkReceiptTableColumn[];
|
|
103
|
+
|
|
104
|
+
/** Columns a newer runtime can safely add to a legacy receipt table. */
|
|
105
|
+
export const WORK_RECEIPT_SELF_HEAL_COLUMNS = [
|
|
106
|
+
...WORK_RECEIPT_LEASE_COLUMNS,
|
|
107
|
+
'failure_kind',
|
|
108
|
+
'error_payload',
|
|
109
|
+
] as const satisfies readonly WorkReceiptTableColumn[];
|
|
110
|
+
|
|
111
|
+
const WORK_RECEIPT_TABLE_COLUMN_DEFINITION = new Map<
|
|
112
|
+
WorkReceiptTableColumn,
|
|
113
|
+
string
|
|
114
|
+
>(WORK_RECEIPT_TABLE_COLUMNS);
|
|
115
|
+
|
|
116
|
+
export function workReceiptTableColumnDefinition(
|
|
117
|
+
column: WorkReceiptTableColumn,
|
|
118
|
+
): string {
|
|
119
|
+
const definition = WORK_RECEIPT_TABLE_COLUMN_DEFINITION.get(column);
|
|
120
|
+
if (!definition) {
|
|
121
|
+
throw new Error(`Unknown runtime work receipt column: ${column}`);
|
|
122
|
+
}
|
|
123
|
+
return definition;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function workReceiptTableDefinitionSql(): string {
|
|
127
|
+
return [
|
|
128
|
+
'k bytea PRIMARY KEY',
|
|
129
|
+
...WORK_RECEIPT_TABLE_COLUMNS.map(
|
|
130
|
+
([column, definition]) => `${column} ${definition}`,
|
|
131
|
+
),
|
|
132
|
+
].join(',\n ');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function workReceiptExecutionLockTableDefinitionSql(): string {
|
|
136
|
+
return [
|
|
137
|
+
'k bytea PRIMARY KEY',
|
|
138
|
+
'owner_execution_id text NOT NULL',
|
|
139
|
+
'expires_at timestamptz NOT NULL',
|
|
140
|
+
'updated_at timestamptz NOT NULL DEFAULT now()',
|
|
141
|
+
].join(',\n ');
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function workReceiptAdditiveColumnsSql(
|
|
145
|
+
columns: readonly WorkReceiptTableColumn[],
|
|
146
|
+
): string {
|
|
147
|
+
return columns
|
|
148
|
+
.map(
|
|
149
|
+
(column) =>
|
|
150
|
+
`ADD COLUMN IF NOT EXISTS ${column} ${workReceiptTableColumnDefinition(column)}`,
|
|
151
|
+
)
|
|
152
|
+
.join(',\n ');
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function workReceiptStatusCaseSql(column = 'status'): string {
|
|
156
|
+
return [
|
|
157
|
+
`case ${column}`,
|
|
158
|
+
`when ${WORK_RECEIPT_STATUS_CODE.queued} then 'pending'`,
|
|
159
|
+
`when ${WORK_RECEIPT_STATUS_CODE.running} then 'running'`,
|
|
160
|
+
`when ${WORK_RECEIPT_STATUS_CODE.completed} then 'completed'`,
|
|
161
|
+
`when ${WORK_RECEIPT_STATUS_CODE.failed} then 'failed'`,
|
|
162
|
+
`when ${WORK_RECEIPT_STATUS_CODE.skipped} then 'skipped'`,
|
|
163
|
+
`else ${column}::text end`,
|
|
164
|
+
].join(' ');
|
|
165
|
+
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { isReusableWorkReceiptState } from './work-receipt-state-machine';
|
|
2
2
|
import type { ToolExecutionFailureV1 } from '../plays/tool-execution-error';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
import {
|
|
4
|
+
WORK_RECEIPT_FAILURE_KIND_CODE,
|
|
5
|
+
WORK_RECEIPT_KEY_FORMAT,
|
|
6
|
+
type WorkReceiptFailureKind,
|
|
7
|
+
type WorkReceiptStatus,
|
|
8
|
+
} from './work-receipt-storage-contract';
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
WORK_RECEIPT_FAILURE_KIND_CODE,
|
|
12
|
+
type WorkReceiptFailureKind,
|
|
13
|
+
type WorkReceiptStatus,
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
export function workReceiptFailureKindFromCode(
|
|
@@ -39,14 +41,6 @@ export function workReceiptFailureKindCodeForWrite(
|
|
|
39
41
|
return WORK_RECEIPT_FAILURE_KIND_CODE.repairable;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
|
-
export type WorkReceiptStatus =
|
|
43
|
-
| 'queued'
|
|
44
|
-
| 'pending'
|
|
45
|
-
| 'running'
|
|
46
|
-
| 'completed'
|
|
47
|
-
| 'failed'
|
|
48
|
-
| 'skipped';
|
|
49
|
-
|
|
50
44
|
export type WorkReceipt = {
|
|
51
45
|
key: string;
|
|
52
46
|
status: WorkReceiptStatus;
|
|
@@ -191,8 +185,6 @@ export type WorkReceiptStore = {
|
|
|
191
185
|
): Promise<Array<WorkReceipt | null>>;
|
|
192
186
|
};
|
|
193
187
|
|
|
194
|
-
const SCOPED_WORK_RECEIPT_KEY_VERSION = 'ctxv2';
|
|
195
|
-
|
|
196
188
|
function encodeWorkReceiptKeyComponent(value: string): string {
|
|
197
189
|
return encodeURIComponent(value);
|
|
198
190
|
}
|
|
@@ -212,11 +204,11 @@ export function buildScopedWorkReceiptKey(input: {
|
|
|
212
204
|
const orgId = normalizeWorkReceiptScopeComponent(input.orgId, 'org');
|
|
213
205
|
const playName = normalizeWorkReceiptScopeComponent(input.playName, 'play');
|
|
214
206
|
return [
|
|
215
|
-
|
|
207
|
+
WORK_RECEIPT_KEY_FORMAT.prefix,
|
|
216
208
|
encodeWorkReceiptKeyComponent(orgId),
|
|
217
209
|
encodeWorkReceiptKeyComponent(playName),
|
|
218
210
|
encodeWorkReceiptKeyComponent(input.key),
|
|
219
|
-
].join(
|
|
211
|
+
].join(WORK_RECEIPT_KEY_FORMAT.separator);
|
|
220
212
|
}
|
|
221
213
|
|
|
222
214
|
export function scopedWorkReceiptKeyPrefix(input: {
|
|
@@ -224,11 +216,11 @@ export function scopedWorkReceiptKeyPrefix(input: {
|
|
|
224
216
|
playName: string;
|
|
225
217
|
}): string {
|
|
226
218
|
return [
|
|
227
|
-
|
|
219
|
+
WORK_RECEIPT_KEY_FORMAT.prefix,
|
|
228
220
|
encodeWorkReceiptKeyComponent(input.orgId.trim()),
|
|
229
221
|
encodeWorkReceiptKeyComponent(input.playName.trim()),
|
|
230
222
|
'',
|
|
231
|
-
].join(
|
|
223
|
+
].join(WORK_RECEIPT_KEY_FORMAT.separator);
|
|
232
224
|
}
|
|
233
225
|
|
|
234
226
|
export function isReusableWorkReceipt(receipt: WorkReceipt): boolean {
|