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
|
@@ -68,6 +68,7 @@ import {
|
|
|
68
68
|
stringifyPostgresJson,
|
|
69
69
|
} from './postgres-json';
|
|
70
70
|
import { RECEIPT_STATUS_CODE, receiptStatusFromCode } from './receipt-status';
|
|
71
|
+
import { WORK_RECEIPT_EXECUTION_LOCK_TABLE } from './work-receipt-storage-contract';
|
|
71
72
|
import {
|
|
72
73
|
workReceiptClaimableStatusCodes,
|
|
73
74
|
workReceiptActiveOwnerPredicateSql,
|
|
@@ -298,7 +299,6 @@ const dbSessionCache = new Map<string, DbSessionCacheEntry>();
|
|
|
298
299
|
const dbSessionInFlight = new Map<string, Promise<CreateDbSessionResponse>>();
|
|
299
300
|
const postgresPools = new Map<string, CachedRuntimePostgresPool>();
|
|
300
301
|
const runtimePostgresAdmissions = new Map<string, RuntimePostgresAdmission>();
|
|
301
|
-
const runtimeWorkReceiptEnsureCache = new Map<string, Promise<void>>();
|
|
302
302
|
const runtimeSheetEnsureCache = new Map<
|
|
303
303
|
string,
|
|
304
304
|
{ expiresAt: number; promise: Promise<void> }
|
|
@@ -313,25 +313,13 @@ const APPEND_KEY_SUFFIX_LENGTH = 12;
|
|
|
313
313
|
// 60-min alignment fixed. A shorter TTL only causes periodic re-mints (cheap;
|
|
314
314
|
// the tenant runtime role is long-lived), not run failures.
|
|
315
315
|
const RUNTIME_DB_SESSION_TTL_SECONDS = 10 * 60;
|
|
316
|
-
const RUNTIME_WORK_RECEIPT_LEASE_COLUMNS = [
|
|
317
|
-
'lease_id',
|
|
318
|
-
'lease_owner_run_id',
|
|
319
|
-
'lease_owner_attempt',
|
|
320
|
-
'lease_expires_at',
|
|
321
|
-
] as const;
|
|
322
|
-
const RUNTIME_WORK_RECEIPT_FAILURE_KIND_COLUMN = 'failure_kind';
|
|
323
|
-
const RUNTIME_WORK_RECEIPT_ERROR_PAYLOAD_COLUMN = 'error_payload';
|
|
324
|
-
const RUNTIME_WORK_RECEIPT_SELF_HEAL_COLUMNS = [
|
|
325
|
-
...RUNTIME_WORK_RECEIPT_LEASE_COLUMNS,
|
|
326
|
-
RUNTIME_WORK_RECEIPT_FAILURE_KIND_COLUMN,
|
|
327
|
-
RUNTIME_WORK_RECEIPT_ERROR_PAYLOAD_COLUMN,
|
|
328
|
-
] as const;
|
|
329
316
|
const RUNTIME_SHEET_ATTEMPT_COLUMNS = [
|
|
330
317
|
'_attempt_id',
|
|
331
318
|
'_attempt_owner_run_id',
|
|
332
319
|
'_attempt_seq',
|
|
333
320
|
'_attempt_expires_at',
|
|
334
321
|
] as const;
|
|
322
|
+
const RUNTIME_SHEET_TIMESTAMP_COLUMNS = ['_created_at', '_updated_at'] as const;
|
|
335
323
|
const RUNTIME_SHEET_ENSURE_CACHE_TTL_MS = 10 * 60_000;
|
|
336
324
|
const RUNTIME_SHEET_READY_AFTER_ENSURE_RETRY_DELAYS_MS = [
|
|
337
325
|
100, 250, 500, 1_000, 2_000,
|
|
@@ -1020,9 +1008,28 @@ async function isRuntimeSheetSchemaReady(
|
|
|
1020
1008
|
[...RUNTIME_SHEET_ATTEMPT_COLUMNS],
|
|
1021
1009
|
],
|
|
1022
1010
|
);
|
|
1011
|
+
const timestampColumns = await client.query<Record<string, unknown>>(
|
|
1012
|
+
`
|
|
1013
|
+
SELECT count(*)::int AS ready_count
|
|
1014
|
+
FROM information_schema.columns
|
|
1015
|
+
WHERE table_schema = $1
|
|
1016
|
+
AND table_name = $2
|
|
1017
|
+
AND column_name = ANY($3::text[])
|
|
1018
|
+
AND data_type = 'timestamp with time zone'
|
|
1019
|
+
AND is_nullable = 'NO'
|
|
1020
|
+
AND column_default IS NOT NULL
|
|
1021
|
+
`,
|
|
1022
|
+
[
|
|
1023
|
+
session.postgres.schema,
|
|
1024
|
+
session.postgres.sheetTable,
|
|
1025
|
+
[...RUNTIME_SHEET_TIMESTAMP_COLUMNS],
|
|
1026
|
+
],
|
|
1027
|
+
);
|
|
1023
1028
|
return (
|
|
1024
1029
|
Number(attemptColumns.rows[0]?.present_count ?? 0) ===
|
|
1025
|
-
|
|
1030
|
+
RUNTIME_SHEET_ATTEMPT_COLUMNS.length &&
|
|
1031
|
+
Number(timestampColumns.rows[0]?.ready_count ?? 0) ===
|
|
1032
|
+
RUNTIME_SHEET_TIMESTAMP_COLUMNS.length
|
|
1026
1033
|
);
|
|
1027
1034
|
};
|
|
1028
1035
|
try {
|
|
@@ -1053,9 +1060,14 @@ async function readRuntimeSheetSchemaDiagnostic(
|
|
|
1053
1060
|
const query = async (
|
|
1054
1061
|
client: RuntimeQueryClient,
|
|
1055
1062
|
): Promise<Record<string, unknown>> => {
|
|
1056
|
-
const visibleColumns = await client.query<{
|
|
1063
|
+
const visibleColumns = await client.query<{
|
|
1064
|
+
column_name: string;
|
|
1065
|
+
data_type: string;
|
|
1066
|
+
is_nullable: string;
|
|
1067
|
+
column_default: string | null;
|
|
1068
|
+
}>(
|
|
1057
1069
|
`
|
|
1058
|
-
SELECT column_name
|
|
1070
|
+
SELECT column_name, data_type, is_nullable, column_default
|
|
1059
1071
|
FROM information_schema.columns
|
|
1060
1072
|
WHERE table_schema = $1
|
|
1061
1073
|
AND table_name = $2
|
|
@@ -1079,6 +1091,15 @@ async function readRuntimeSheetSchemaDiagnostic(
|
|
|
1079
1091
|
],
|
|
1080
1092
|
);
|
|
1081
1093
|
const visible = new Set(visibleColumns.rows.map((row) => row.column_name));
|
|
1094
|
+
const timestampColumns = new Map(
|
|
1095
|
+
visibleColumns.rows
|
|
1096
|
+
.filter((row) =>
|
|
1097
|
+
RUNTIME_SHEET_TIMESTAMP_COLUMNS.includes(
|
|
1098
|
+
row.column_name as (typeof RUNTIME_SHEET_TIMESTAMP_COLUMNS)[number],
|
|
1099
|
+
),
|
|
1100
|
+
)
|
|
1101
|
+
.map((row) => [row.column_name, row]),
|
|
1102
|
+
);
|
|
1082
1103
|
return {
|
|
1083
1104
|
schema: session.postgres.schema,
|
|
1084
1105
|
table: session.postgres.sheetTable,
|
|
@@ -1091,6 +1112,15 @@ async function readRuntimeSheetSchemaDiagnostic(
|
|
|
1091
1112
|
missingAttemptColumns: RUNTIME_SHEET_ATTEMPT_COLUMNS.filter(
|
|
1092
1113
|
(column) => !visible.has(column),
|
|
1093
1114
|
),
|
|
1115
|
+
timestampColumnStates: RUNTIME_SHEET_TIMESTAMP_COLUMNS.map((column) => {
|
|
1116
|
+
const state = timestampColumns.get(column);
|
|
1117
|
+
return {
|
|
1118
|
+
column,
|
|
1119
|
+
dataType: state?.data_type ?? null,
|
|
1120
|
+
isNullable: state?.is_nullable ?? null,
|
|
1121
|
+
hasDefault: state?.column_default != null,
|
|
1122
|
+
};
|
|
1123
|
+
}),
|
|
1094
1124
|
};
|
|
1095
1125
|
};
|
|
1096
1126
|
try {
|
|
@@ -2483,11 +2513,7 @@ function workReceiptTable(session: RuntimePostgresSession): string {
|
|
|
2483
2513
|
}
|
|
2484
2514
|
|
|
2485
2515
|
function receiptExecutionLockTable(session: RuntimePostgresSession): string {
|
|
2486
|
-
return fqRuntimeTable(session,
|
|
2487
|
-
}
|
|
2488
|
-
|
|
2489
|
-
function postgresUrlCacheKey(value: string): string {
|
|
2490
|
-
return createHash('sha256').update(value).digest('hex').slice(0, 24);
|
|
2516
|
+
return fqRuntimeTable(session, WORK_RECEIPT_EXECUTION_LOCK_TABLE);
|
|
2491
2517
|
}
|
|
2492
2518
|
|
|
2493
2519
|
function workReceiptKeyHex(key: string): string {
|
|
@@ -2548,134 +2574,6 @@ function mapRuntimeWorkReceiptRow(raw: Record<string, unknown>): WorkReceipt {
|
|
|
2548
2574
|
};
|
|
2549
2575
|
}
|
|
2550
2576
|
|
|
2551
|
-
function isMissingRuntimeWorkReceiptSelfHealColumnError(
|
|
2552
|
-
error: unknown,
|
|
2553
|
-
): boolean {
|
|
2554
|
-
if (!error || typeof error !== 'object') {
|
|
2555
|
-
return false;
|
|
2556
|
-
}
|
|
2557
|
-
const code = 'code' in error ? String(error.code) : '';
|
|
2558
|
-
const message = 'message' in error ? String(error.message) : '';
|
|
2559
|
-
if (code !== '42703' && !/column .* does not exist/i.test(message)) {
|
|
2560
|
-
return false;
|
|
2561
|
-
}
|
|
2562
|
-
return RUNTIME_WORK_RECEIPT_SELF_HEAL_COLUMNS.some((column) =>
|
|
2563
|
-
message.includes(column),
|
|
2564
|
-
);
|
|
2565
|
-
}
|
|
2566
|
-
|
|
2567
|
-
function runtimeWorkReceiptEnsureCacheKey(
|
|
2568
|
-
session: RuntimePostgresSession,
|
|
2569
|
-
): string {
|
|
2570
|
-
return `${postgresUrlCacheKey(session.postgresUrl)}::${session.postgres.schema}::${session.postgres.receiptTable ?? RUNTIME_WORK_RECEIPT_POSTGRES_TABLE}`;
|
|
2571
|
-
}
|
|
2572
|
-
|
|
2573
|
-
async function missingRuntimeWorkReceiptSelfHealColumns(
|
|
2574
|
-
session: RuntimePostgresSession,
|
|
2575
|
-
client: RuntimeQueryClient,
|
|
2576
|
-
): Promise<string[]> {
|
|
2577
|
-
const result = await client.query(
|
|
2578
|
-
`
|
|
2579
|
-
SELECT column_name
|
|
2580
|
-
FROM information_schema.columns
|
|
2581
|
-
WHERE table_schema = $1
|
|
2582
|
-
AND table_name = $2
|
|
2583
|
-
AND column_name = ANY($3::text[])
|
|
2584
|
-
`,
|
|
2585
|
-
[
|
|
2586
|
-
session.postgres.schema,
|
|
2587
|
-
session.postgres.receiptTable ?? RUNTIME_WORK_RECEIPT_POSTGRES_TABLE,
|
|
2588
|
-
[...RUNTIME_WORK_RECEIPT_SELF_HEAL_COLUMNS],
|
|
2589
|
-
],
|
|
2590
|
-
);
|
|
2591
|
-
const present = new Set(
|
|
2592
|
-
result.rows.map((row) => String(row.column_name ?? '')),
|
|
2593
|
-
);
|
|
2594
|
-
return RUNTIME_WORK_RECEIPT_SELF_HEAL_COLUMNS.filter(
|
|
2595
|
-
(column) => !present.has(column),
|
|
2596
|
-
);
|
|
2597
|
-
}
|
|
2598
|
-
|
|
2599
|
-
// COMPAT / SELF-HEAL — owner: runtime. Removal milestone: runtime-ledger
|
|
2600
|
-
// cutover. The customer-Neon
|
|
2601
|
-
// work-receipt table (lease columns + failure_kind) is the dying surface. The
|
|
2602
|
-
// F2 rolling migration (scripts/migrate-play-runtime-storage.ts) backfills these
|
|
2603
|
-
// columns; this lazy CREATE/ALTER self-heal is a compat-window safety net and is
|
|
2604
|
-
// deleted together with the Neon receipt path at M1.
|
|
2605
|
-
async function ensureRuntimeWorkReceiptTable(
|
|
2606
|
-
session: RuntimePostgresSession,
|
|
2607
|
-
client: RuntimeQueryClient,
|
|
2608
|
-
): Promise<void> {
|
|
2609
|
-
const cacheKey = runtimeWorkReceiptEnsureCacheKey(session);
|
|
2610
|
-
const cached = runtimeWorkReceiptEnsureCache.get(cacheKey);
|
|
2611
|
-
if (cached) {
|
|
2612
|
-
await cached;
|
|
2613
|
-
return;
|
|
2614
|
-
}
|
|
2615
|
-
const promise = client
|
|
2616
|
-
.query(
|
|
2617
|
-
`
|
|
2618
|
-
CREATE TABLE IF NOT EXISTS ${workReceiptTable(session)} (
|
|
2619
|
-
k bytea PRIMARY KEY,
|
|
2620
|
-
status smallint NOT NULL DEFAULT 0,
|
|
2621
|
-
output jsonb,
|
|
2622
|
-
error text,
|
|
2623
|
-
error_payload jsonb,
|
|
2624
|
-
failure_kind smallint NOT NULL DEFAULT 0,
|
|
2625
|
-
run_id text,
|
|
2626
|
-
lease_id text,
|
|
2627
|
-
lease_owner_run_id text,
|
|
2628
|
-
lease_owner_attempt integer,
|
|
2629
|
-
lease_expires_at timestamptz,
|
|
2630
|
-
updated_at timestamptz NOT NULL DEFAULT now()
|
|
2631
|
-
)
|
|
2632
|
-
`,
|
|
2633
|
-
)
|
|
2634
|
-
.then(async () => {
|
|
2635
|
-
await client.query(`
|
|
2636
|
-
CREATE TABLE IF NOT EXISTS ${receiptExecutionLockTable(session)} (
|
|
2637
|
-
k bytea PRIMARY KEY,
|
|
2638
|
-
owner_execution_id text NOT NULL,
|
|
2639
|
-
expires_at timestamptz NOT NULL,
|
|
2640
|
-
updated_at timestamptz NOT NULL DEFAULT now()
|
|
2641
|
-
)
|
|
2642
|
-
`);
|
|
2643
|
-
const missingColumns = await missingRuntimeWorkReceiptSelfHealColumns(
|
|
2644
|
-
session,
|
|
2645
|
-
client,
|
|
2646
|
-
);
|
|
2647
|
-
if (missingColumns.length === 0) return;
|
|
2648
|
-
await client.query(`
|
|
2649
|
-
ALTER TABLE ${workReceiptTable(session)}
|
|
2650
|
-
${missingColumns
|
|
2651
|
-
.map((column) => {
|
|
2652
|
-
const type =
|
|
2653
|
-
column === 'lease_expires_at'
|
|
2654
|
-
? 'timestamptz'
|
|
2655
|
-
: column === 'lease_owner_attempt'
|
|
2656
|
-
? 'integer'
|
|
2657
|
-
: column === RUNTIME_WORK_RECEIPT_FAILURE_KIND_COLUMN
|
|
2658
|
-
? 'smallint NOT NULL DEFAULT 0'
|
|
2659
|
-
: column === RUNTIME_WORK_RECEIPT_ERROR_PAYLOAD_COLUMN
|
|
2660
|
-
? 'jsonb'
|
|
2661
|
-
: 'text';
|
|
2662
|
-
return `ADD COLUMN IF NOT EXISTS ${column} ${type}`;
|
|
2663
|
-
})
|
|
2664
|
-
.join(',\n ')}
|
|
2665
|
-
`);
|
|
2666
|
-
})
|
|
2667
|
-
.then(() => undefined);
|
|
2668
|
-
runtimeWorkReceiptEnsureCache.set(cacheKey, promise);
|
|
2669
|
-
try {
|
|
2670
|
-
await promise;
|
|
2671
|
-
} catch (error) {
|
|
2672
|
-
if (runtimeWorkReceiptEnsureCache.get(cacheKey) === promise) {
|
|
2673
|
-
runtimeWorkReceiptEnsureCache.delete(cacheKey);
|
|
2674
|
-
}
|
|
2675
|
-
throw error;
|
|
2676
|
-
}
|
|
2677
|
-
}
|
|
2678
|
-
|
|
2679
2577
|
export async function acquireRuntimeReceiptExecutionLock(
|
|
2680
2578
|
context: RuntimeApiContext,
|
|
2681
2579
|
input: {
|
|
@@ -2752,13 +2650,10 @@ async function withRuntimeWorkReceiptClient<T>(
|
|
|
2752
2650
|
session: RuntimePostgresSession,
|
|
2753
2651
|
operation: (client: RuntimeQueryClient) => Promise<T>,
|
|
2754
2652
|
): Promise<T> {
|
|
2755
|
-
// Receipt tables are
|
|
2756
|
-
//
|
|
2757
|
-
//
|
|
2758
|
-
//
|
|
2759
|
-
// can let provider work continue after durable receipt persistence is gone.
|
|
2760
|
-
// Only the schema-migration branch below may repair ownership before its
|
|
2761
|
-
// retry. A genuinely missing schema or second failure also rethrows loudly.
|
|
2653
|
+
// Receipt tables are customer-Postgres bootstrap state. The operation path
|
|
2654
|
+
// never performs DDL or schema repair: a missing table/column is the real
|
|
2655
|
+
// operation failure and must remain visible to the caller. We retry only
|
|
2656
|
+
// transient connection/transport failures, never a semantic SQL error.
|
|
2762
2657
|
const withClient = async <R>(
|
|
2763
2658
|
run: (client: RuntimeQueryClient) => Promise<R>,
|
|
2764
2659
|
): Promise<R> =>
|
|
@@ -2768,8 +2663,6 @@ async function withRuntimeWorkReceiptClient<T>(
|
|
|
2768
2663
|
cachePool: !context.disablePostgresPoolCache,
|
|
2769
2664
|
signal: context.abortSignal,
|
|
2770
2665
|
});
|
|
2771
|
-
let selfHealAttempted = false;
|
|
2772
|
-
|
|
2773
2666
|
for (
|
|
2774
2667
|
let attempt = 1;
|
|
2775
2668
|
attempt <= RUNTIME_WORK_RECEIPT_QUERY_MAX_ATTEMPTS;
|
|
@@ -2778,34 +2671,6 @@ async function withRuntimeWorkReceiptClient<T>(
|
|
|
2778
2671
|
try {
|
|
2779
2672
|
return await withClient(operation);
|
|
2780
2673
|
} catch (error) {
|
|
2781
|
-
const missingStorage =
|
|
2782
|
-
isMissingRelationError(error) ||
|
|
2783
|
-
isMissingRuntimeWorkReceiptSelfHealColumnError(error);
|
|
2784
|
-
if (missingStorage && !selfHealAttempted) {
|
|
2785
|
-
selfHealAttempted = true;
|
|
2786
|
-
runtimeWorkReceiptEnsureCache.delete(
|
|
2787
|
-
runtimeWorkReceiptEnsureCacheKey(session),
|
|
2788
|
-
);
|
|
2789
|
-
try {
|
|
2790
|
-
await withClient((client) =>
|
|
2791
|
-
ensureRuntimeWorkReceiptTable(session, client),
|
|
2792
|
-
);
|
|
2793
|
-
} catch (ensureError) {
|
|
2794
|
-
if (!isPostgresPermissionDeniedError(ensureError)) {
|
|
2795
|
-
throw ensureError;
|
|
2796
|
-
}
|
|
2797
|
-
runtimeWorkReceiptEnsureCache.delete(
|
|
2798
|
-
runtimeWorkReceiptEnsureCacheKey(session),
|
|
2799
|
-
);
|
|
2800
|
-
await repairRuntimeStorageGrants(context, {
|
|
2801
|
-
playName: context.playName?.trim() || session.playName,
|
|
2802
|
-
});
|
|
2803
|
-
await withClient((client) =>
|
|
2804
|
-
ensureRuntimeWorkReceiptTable(session, client),
|
|
2805
|
-
);
|
|
2806
|
-
}
|
|
2807
|
-
continue;
|
|
2808
|
-
}
|
|
2809
2674
|
if (
|
|
2810
2675
|
attempt >= RUNTIME_WORK_RECEIPT_QUERY_MAX_ATTEMPTS ||
|
|
2811
2676
|
!isTransientRuntimePostgresOperationError(error)
|
|
@@ -7047,11 +6912,6 @@ async function completeRuntimeMapRowChunks(
|
|
|
7047
6912
|
OR coalesce(target._attempt_owner_run_id, target._run_id) IS DISTINCT FROM $10::text
|
|
7048
6913
|
)
|
|
7049
6914
|
)`;
|
|
7050
|
-
const sameOwnerTerminalEpochSql = sameOwnerTerminalAttemptEpochSql(
|
|
7051
|
-
'target',
|
|
7052
|
-
'$10::text',
|
|
7053
|
-
'$12',
|
|
7054
|
-
);
|
|
7055
6915
|
const { rows } = await client.query<{
|
|
7056
6916
|
updated: number;
|
|
7057
6917
|
matched_keys: string[];
|
|
@@ -7106,6 +6966,15 @@ async function completeRuntimeMapRowChunks(
|
|
|
7106
6966
|
target._status <> 'enriched'
|
|
7107
6967
|
OR (${targetChangedPatchedCellSql})
|
|
7108
6968
|
)
|
|
6969
|
+
-- First terminal wins: suppress conflict for same owner+epoch already-terminal row.
|
|
6970
|
+
-- Durable replay (omitted_terminal_replay) from same attempt epoch is idempotent.
|
|
6971
|
+
AND NOT (
|
|
6972
|
+
$10::text IS NOT NULL
|
|
6973
|
+
AND $12::integer IS NOT NULL
|
|
6974
|
+
AND target._status = 'enriched'
|
|
6975
|
+
AND coalesce(target._attempt_owner_run_id, target._run_id) = $10::text
|
|
6976
|
+
AND COALESCE(target._attempt_seq, 0) = $12::integer
|
|
6977
|
+
)
|
|
7109
6978
|
),
|
|
7110
6979
|
applied_rows AS (
|
|
7111
6980
|
UPDATE ${sheetTable(session)} AS target
|
|
@@ -7127,13 +6996,21 @@ async function completeRuntimeMapRowChunks(
|
|
|
7127
6996
|
AND ($13::bigint IS NULL OR target._write_version = $13::bigint)
|
|
7128
6997
|
AND ($13::bigint IS NOT NULL OR target._status <> 'enriched')
|
|
7129
6998
|
AND NOT (${newerTerminalRuntimeSheetRowSql('target', '$11::timestamptz', '$12::integer', '$9::text', '$10::text')})
|
|
7130
|
-
AND NOT (${sameOwnerTerminalEpochSql})
|
|
7131
6999
|
AND (
|
|
7132
7000
|
($9::text IS NULL AND target._run_id = $5::text)
|
|
7133
7001
|
OR ($9::text IS NOT NULL AND ${writableNonTerminalAttemptSql})
|
|
7134
7002
|
OR ($9::text IS NOT NULL AND ${activeRuntimeSheetAttemptFenceSql('target', '$9::text', '$10::text', '$11::timestamptz', '$12::integer')})
|
|
7135
7003
|
OR ($9::text IS NOT NULL AND ${writableEnrichedAttemptSql})
|
|
7136
7004
|
)
|
|
7005
|
+
-- First terminal wins: skip UPDATE for already-terminal same-owner+epoch row.
|
|
7006
|
+
-- Even though we excluded from conflicts, we still no-op here for idempotency.
|
|
7007
|
+
AND NOT (
|
|
7008
|
+
$10::text IS NOT NULL
|
|
7009
|
+
AND $12::integer IS NOT NULL
|
|
7010
|
+
AND target._status = 'enriched'
|
|
7011
|
+
AND coalesce(target._attempt_owner_run_id, target._run_id) = $10::text
|
|
7012
|
+
AND COALESCE(target._attempt_seq, 0) = $12::integer
|
|
7013
|
+
)
|
|
7137
7014
|
AND (
|
|
7138
7015
|
target._status <> 'enriched'
|
|
7139
7016
|
OR target._run_id IS DISTINCT FROM $5::text
|
|
@@ -7339,11 +7216,6 @@ async function completeRuntimeMapRowChunksWithInputIndexRepair(
|
|
|
7339
7216
|
'$11::timestamptz',
|
|
7340
7217
|
'$12',
|
|
7341
7218
|
);
|
|
7342
|
-
const sameOwnerTerminalEpochSql = sameOwnerTerminalAttemptEpochSql(
|
|
7343
|
-
'target',
|
|
7344
|
-
'$10::text',
|
|
7345
|
-
'$12',
|
|
7346
|
-
);
|
|
7347
7219
|
const { rows } = await client.query<{
|
|
7348
7220
|
_key?: string;
|
|
7349
7221
|
fenced_keys?: string[];
|
|
@@ -7403,6 +7275,15 @@ async function completeRuntimeMapRowChunksWithInputIndexRepair(
|
|
|
7403
7275
|
target._status <> 'enriched'
|
|
7404
7276
|
OR (${targetChangedPatchedCellSql})
|
|
7405
7277
|
)
|
|
7278
|
+
-- First terminal wins: suppress conflict for same owner+epoch already-terminal row.
|
|
7279
|
+
-- Durable replay (omitted_terminal_replay) from same attempt epoch is idempotent.
|
|
7280
|
+
AND NOT (
|
|
7281
|
+
$10::text IS NOT NULL
|
|
7282
|
+
AND $12::integer IS NOT NULL
|
|
7283
|
+
AND target._status = 'enriched'
|
|
7284
|
+
AND coalesce(target._attempt_owner_run_id, target._run_id) = $10::text
|
|
7285
|
+
AND COALESCE(target._attempt_seq, 0) = $12::integer
|
|
7286
|
+
)
|
|
7406
7287
|
),
|
|
7407
7288
|
applied_rows AS (
|
|
7408
7289
|
UPDATE ${sheetTable(session)} AS target
|
|
@@ -7425,7 +7306,6 @@ async function completeRuntimeMapRowChunksWithInputIndexRepair(
|
|
|
7425
7306
|
AND ($13::bigint IS NULL OR target._write_version = $13::bigint)
|
|
7426
7307
|
AND ($13::bigint IS NOT NULL OR target._status <> 'enriched')
|
|
7427
7308
|
AND NOT (${newerTerminalRuntimeSheetRowSql('target', '$11::timestamptz', '$12::integer', '$9::text', '$10::text')})
|
|
7428
|
-
AND NOT (${sameOwnerTerminalEpochSql})
|
|
7429
7309
|
AND (
|
|
7430
7310
|
($9::text IS NULL AND target._run_id = $5::text)
|
|
7431
7311
|
OR ($9::text IS NOT NULL AND ${activeRuntimeSheetAttemptFenceSql('target', '$9::text', '$10::text', '$11::timestamptz', '$12::integer')})
|
|
@@ -7862,6 +7742,16 @@ async function failRuntimeMapRowChunks(
|
|
|
7862
7742
|
OR target._error IS DISTINCT FROM updates.error
|
|
7863
7743
|
OR (${targetChangedPatchedCellSql})
|
|
7864
7744
|
)
|
|
7745
|
+
-- Same-owner terminal replay is not a conflict. Normal replay
|
|
7746
|
+
-- preserves the first value below; explicit force-failure may update it.
|
|
7747
|
+
-- Different owners and attempt epochs still conflict.
|
|
7748
|
+
AND NOT (
|
|
7749
|
+
$12::text IS NOT NULL
|
|
7750
|
+
AND $14::integer IS NOT NULL
|
|
7751
|
+
AND target._status IN ('failed', 'enriched')
|
|
7752
|
+
AND coalesce(target._attempt_owner_run_id, target._run_id) = $12::text
|
|
7753
|
+
AND COALESCE(target._attempt_seq, 0) = $14::integer
|
|
7754
|
+
)
|
|
7865
7755
|
),
|
|
7866
7756
|
applied_rows AS (
|
|
7867
7757
|
UPDATE ${sheetTable(session)} AS target
|
|
@@ -7888,13 +7778,15 @@ async function failRuntimeMapRowChunks(
|
|
|
7888
7778
|
($11::text IS NULL AND target._run_id = $6::text)
|
|
7889
7779
|
OR ($11::text IS NOT NULL AND ${activeRuntimeSheetAttemptFenceSql('target', '$11::text', '$12::text', '$13::timestamptz', '$14::integer')})
|
|
7890
7780
|
)
|
|
7781
|
+
-- First terminal wins for failed rows too, BUT only when NOT force-failing.
|
|
7782
|
+
-- Normal replay: no-op when already-failed OR already-enriched from same owner+epoch.
|
|
7891
7783
|
AND NOT (
|
|
7892
|
-
$
|
|
7893
|
-
AND
|
|
7894
|
-
AND
|
|
7895
|
-
AND target._status
|
|
7896
|
-
AND target.
|
|
7897
|
-
AND
|
|
7784
|
+
$15::boolean = FALSE
|
|
7785
|
+
AND $12::text IS NOT NULL
|
|
7786
|
+
AND $14::integer IS NOT NULL
|
|
7787
|
+
AND target._status IN ('failed', 'enriched')
|
|
7788
|
+
AND coalesce(target._attempt_owner_run_id, target._run_id) = $12::text
|
|
7789
|
+
AND COALESCE(target._attempt_seq, 0) = $14::integer
|
|
7898
7790
|
)
|
|
7899
7791
|
RETURNING target._key, prev._status AS prev_status
|
|
7900
7792
|
),
|
|
@@ -8006,9 +7898,12 @@ async function failRuntimeMapRowChunks(
|
|
|
8006
7898
|
input.writeVersion,
|
|
8007
7899
|
],
|
|
8008
7900
|
);
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
7901
|
+
const appliedCount = Number(rows[0]?.updated ?? 0);
|
|
7902
|
+
const chunkFencedKeys = rows[0]?.fenced_keys ?? [];
|
|
7903
|
+
const chunkConflictKeys = rows[0]?.conflict_keys ?? [];
|
|
7904
|
+
updated += appliedCount;
|
|
7905
|
+
fencedKeys.push(...chunkFencedKeys);
|
|
7906
|
+
conflictKeys.push(...chunkConflictKeys);
|
|
8012
7907
|
}
|
|
8013
7908
|
return { updated, fencedKeys, conflictKeys };
|
|
8014
7909
|
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { mintWorkflowExecutorToken } from './/workflow-executor-auth';
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_RUNTIME_EXECUTION_CAPABILITIES,
|
|
4
|
+
normalizeRuntimeExecutionCapabilities,
|
|
5
|
+
type RuntimeAuthorityDescriptor,
|
|
6
|
+
type RuntimeExecutionCapability,
|
|
7
|
+
} from './/execution-capabilities';
|
|
8
|
+
import type { FixtureBehavior } from './/fixture-behavior';
|
|
9
|
+
import type { PlaySchedulerSubmitInput } from './/scheduler-backend';
|
|
10
|
+
import type { DirectCompletedTerminalContract } from './/scheduler-backends/terminal-contract';
|
|
11
|
+
|
|
12
|
+
export type RuntimeAuthority = {
|
|
13
|
+
executorToken: string;
|
|
14
|
+
descriptor: RuntimeAuthorityDescriptor;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Derive a child Run's durable authority from its admitted parent. The child
|
|
19
|
+
* owns its authored secret names and play identity; organization, actor,
|
|
20
|
+
* billing, scheduler placement, and capability policy remain parent-owned
|
|
21
|
+
* durable facts. This deliberately does not intersect secret names: a child
|
|
22
|
+
* Play resolves its own scoped declaration, where an equal name can identify
|
|
23
|
+
* a different Play-specific secret.
|
|
24
|
+
*/
|
|
25
|
+
export function deriveAsyncChildRuntimeAuthority(input: {
|
|
26
|
+
parent: RuntimeAuthorityDescriptor;
|
|
27
|
+
workflowId: string;
|
|
28
|
+
runId: string;
|
|
29
|
+
playName: string;
|
|
30
|
+
billingRunId: string;
|
|
31
|
+
allowedSecrets: readonly string[];
|
|
32
|
+
}): RuntimeAuthorityDescriptor {
|
|
33
|
+
return {
|
|
34
|
+
orgId: input.parent.orgId,
|
|
35
|
+
workflowId: input.workflowId,
|
|
36
|
+
runId: input.runId,
|
|
37
|
+
// The scheduler-owned parent launch resolves the billing owner to the
|
|
38
|
+
// root before child admission. Keep the descriptor's token claim aligned
|
|
39
|
+
// with that durable run-state fact even for a legacy intermediate parent
|
|
40
|
+
// that predates `billingRunId` on its authority descriptor.
|
|
41
|
+
billingRunId: input.billingRunId,
|
|
42
|
+
playName: input.playName,
|
|
43
|
+
allowedSecrets: [...new Set(input.allowedSecrets)],
|
|
44
|
+
maxCreditsPerRun: input.parent.maxCreditsPerRun ?? null,
|
|
45
|
+
integrationMode: input.parent.integrationMode ?? null,
|
|
46
|
+
fixtureBehavior: input.parent.fixtureBehavior ?? null,
|
|
47
|
+
synthetic: input.parent.synthetic === true,
|
|
48
|
+
actorUserId: input.parent.actorUserId ?? null,
|
|
49
|
+
actorEmail: input.parent.actorEmail ?? null,
|
|
50
|
+
schedulerSchema: input.parent.schedulerSchema ?? null,
|
|
51
|
+
docflowEnabled: input.parent.docflowEnabled === true,
|
|
52
|
+
asyncChildAdmissionAttemptRequired:
|
|
53
|
+
input.parent.asyncChildAdmissionAttemptRequired === true,
|
|
54
|
+
capabilities: normalizeRuntimeExecutionCapabilities(
|
|
55
|
+
input.parent.capabilities,
|
|
56
|
+
),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export async function mintPlayRunRuntimeAuthorityDescriptor(input: {
|
|
61
|
+
descriptor: RuntimeAuthorityDescriptor;
|
|
62
|
+
runtimeOrigin?: string | null;
|
|
63
|
+
}): Promise<RuntimeAuthority> {
|
|
64
|
+
return {
|
|
65
|
+
descriptor: input.descriptor,
|
|
66
|
+
executorToken: await mintWorkflowExecutorToken({
|
|
67
|
+
...runtimeAuthorityMintInput(input.descriptor),
|
|
68
|
+
runtimeOrigin: input.runtimeOrigin,
|
|
69
|
+
}),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export async function mintPlayRunRuntimeAuthority(input: {
|
|
74
|
+
orgId: string;
|
|
75
|
+
workflowId: string;
|
|
76
|
+
runId: string;
|
|
77
|
+
billingRunId?: string | null;
|
|
78
|
+
playName: string;
|
|
79
|
+
allowedSecrets?: readonly string[] | null;
|
|
80
|
+
maxCreditsPerRun?: number | null;
|
|
81
|
+
integrationMode?: 'live' | 'eval_stub' | 'fixture' | null;
|
|
82
|
+
fixtureBehavior?: FixtureBehavior | null;
|
|
83
|
+
synthetic?: boolean | null;
|
|
84
|
+
actorUserId?: string | null;
|
|
85
|
+
actorEmail?: string | null;
|
|
86
|
+
schedulerSchema?: string | null;
|
|
87
|
+
/** Docflow rollout answer for the launching actor, resolved by the caller. */
|
|
88
|
+
docflowEnabled?: boolean | null;
|
|
89
|
+
runtimeOrigin?: string | null;
|
|
90
|
+
}): Promise<RuntimeAuthority> {
|
|
91
|
+
const descriptor: RuntimeAuthorityDescriptor = {
|
|
92
|
+
orgId: input.orgId,
|
|
93
|
+
workflowId: input.workflowId,
|
|
94
|
+
runId: input.runId,
|
|
95
|
+
billingRunId: input.billingRunId ?? null,
|
|
96
|
+
playName: input.playName,
|
|
97
|
+
allowedSecrets: [...new Set(input.allowedSecrets ?? [])],
|
|
98
|
+
maxCreditsPerRun: input.maxCreditsPerRun ?? null,
|
|
99
|
+
integrationMode: input.integrationMode ?? null,
|
|
100
|
+
fixtureBehavior: input.fixtureBehavior ?? null,
|
|
101
|
+
synthetic: input.synthetic === true,
|
|
102
|
+
actorUserId: input.actorUserId ?? null,
|
|
103
|
+
actorEmail: input.actorEmail ?? null,
|
|
104
|
+
schedulerSchema: input.schedulerSchema ?? null,
|
|
105
|
+
docflowEnabled: input.docflowEnabled === true,
|
|
106
|
+
capabilities: normalizeRuntimeExecutionCapabilities(
|
|
107
|
+
DEFAULT_RUNTIME_EXECUTION_CAPABILITIES,
|
|
108
|
+
),
|
|
109
|
+
};
|
|
110
|
+
return await mintPlayRunRuntimeAuthorityDescriptor({
|
|
111
|
+
descriptor,
|
|
112
|
+
runtimeOrigin: input.runtimeOrigin,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function runtimeAuthorityMintInput(
|
|
117
|
+
descriptor: RuntimeAuthorityDescriptor,
|
|
118
|
+
input: {
|
|
119
|
+
runAttempt?: number | null;
|
|
120
|
+
runLeaseToken?: string | null;
|
|
121
|
+
terminalContract?: DirectCompletedTerminalContract | null;
|
|
122
|
+
capabilities?: readonly RuntimeExecutionCapability[];
|
|
123
|
+
runtimeOrigin?: string | null;
|
|
124
|
+
} = {},
|
|
125
|
+
) {
|
|
126
|
+
return {
|
|
127
|
+
orgId: descriptor.orgId,
|
|
128
|
+
workflowId: descriptor.workflowId,
|
|
129
|
+
runId: descriptor.runId,
|
|
130
|
+
billingRunId: descriptor.billingRunId,
|
|
131
|
+
playName: descriptor.playName,
|
|
132
|
+
allowedSecrets: descriptor.allowedSecrets,
|
|
133
|
+
maxCreditsPerRun: descriptor.maxCreditsPerRun,
|
|
134
|
+
integrationMode: descriptor.integrationMode,
|
|
135
|
+
fixtureBehavior: descriptor.fixtureBehavior,
|
|
136
|
+
synthetic: descriptor.synthetic,
|
|
137
|
+
actorUserId: descriptor.actorUserId,
|
|
138
|
+
actorEmail: descriptor.actorEmail,
|
|
139
|
+
schedulerSchema: descriptor.schedulerSchema,
|
|
140
|
+
runAttempt: input.runAttempt,
|
|
141
|
+
runLeaseToken: input.runLeaseToken,
|
|
142
|
+
terminalContract: input.terminalContract,
|
|
143
|
+
capabilities: input.capabilities ?? descriptor.capabilities,
|
|
144
|
+
runtimeOrigin: input.runtimeOrigin,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export async function mintPlayRunAttemptRuntimeToken(input: {
|
|
149
|
+
descriptor: RuntimeAuthorityDescriptor;
|
|
150
|
+
runAttempt?: number | null;
|
|
151
|
+
runLeaseToken?: string | null;
|
|
152
|
+
terminalContract?: DirectCompletedTerminalContract | null;
|
|
153
|
+
capabilities?: readonly RuntimeExecutionCapability[];
|
|
154
|
+
runtimeOrigin?: string | null;
|
|
155
|
+
}): Promise<string> {
|
|
156
|
+
return await mintWorkflowExecutorToken(
|
|
157
|
+
runtimeAuthorityMintInput(input.descriptor, input),
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Reconstruct the smallest authority needed to settle compute billing for a
|
|
163
|
+
* terminal launch row written before runtimeAuthority became durable state.
|
|
164
|
+
*
|
|
165
|
+
* This is deliberately not a general legacy-token fallback. The caller may
|
|
166
|
+
* mint only billing.write, and every fact comes from the leased launch row
|
|
167
|
+
* selected by the scheduler rather than the worker's request body.
|
|
168
|
+
*/
|
|
169
|
+
export function requireComputeBillingDispatchRuntimeAuthority(
|
|
170
|
+
launch: Pick<
|
|
171
|
+
PlaySchedulerSubmitInput,
|
|
172
|
+
'orgId' | 'runId' | 'playName' | 'userId' | 'userEmail'
|
|
173
|
+
>,
|
|
174
|
+
): RuntimeAuthorityDescriptor {
|
|
175
|
+
const orgId = launch.orgId?.trim();
|
|
176
|
+
const runId = launch.runId?.trim();
|
|
177
|
+
const playName = launch.playName?.trim();
|
|
178
|
+
if (!orgId || !runId || !playName) {
|
|
179
|
+
throw new Error(
|
|
180
|
+
'Legacy compute-billing launch is missing orgId, runId, or playName.',
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
orgId,
|
|
186
|
+
// Scheduler envelopes use the workflow id as the durable run id.
|
|
187
|
+
workflowId: runId,
|
|
188
|
+
runId,
|
|
189
|
+
billingRunId: runId,
|
|
190
|
+
playName,
|
|
191
|
+
allowedSecrets: [],
|
|
192
|
+
maxCreditsPerRun: null,
|
|
193
|
+
integrationMode: null,
|
|
194
|
+
fixtureBehavior: null,
|
|
195
|
+
synthetic: false,
|
|
196
|
+
actorUserId: launch.userId?.trim() || null,
|
|
197
|
+
actorEmail: launch.userEmail?.trim() || null,
|
|
198
|
+
docflowEnabled: false,
|
|
199
|
+
capabilities: ['billing.write'],
|
|
200
|
+
};
|
|
201
|
+
}
|
|
@@ -59,3 +59,9 @@ export function isTestOnlyRuntime(): boolean {
|
|
|
59
59
|
if (process.env.VERCEL_ENV === 'production') return false;
|
|
60
60
|
return process.env.VERCEL_ENV === 'preview' || getRuntimeEnv() !== 'prod';
|
|
61
61
|
}
|
|
62
|
+
|
|
63
|
+
export function shouldEnableMarketingIntegrations(): boolean {
|
|
64
|
+
return getRuntimeEnv() === 'prod';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { isBuildContext } from '../observability/build-context';
|