deepline 0.3.88 → 0.3.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/contracts/install-commands.json +29 -0
- package/dist/bundling-sources/sdk/src/client.ts +652 -39
- package/dist/bundling-sources/sdk/src/config.ts +77 -0
- package/dist/bundling-sources/sdk/src/http.ts +76 -30
- package/dist/bundling-sources/sdk/src/index.ts +10 -0
- package/dist/bundling-sources/sdk/src/monitor-fleet-contract.ts +1 -1
- package/dist/bundling-sources/sdk/src/pagination.ts +25 -0
- package/dist/bundling-sources/sdk/src/play.ts +15 -1
- package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +3 -3
- package/dist/bundling-sources/sdk/src/release.ts +16 -9
- package/dist/bundling-sources/sdk/src/types.ts +106 -4
- package/dist/bundling-sources/shared_libs/integration-contracts/AGENTS.md +9 -0
- package/dist/bundling-sources/shared_libs/integration-contracts/README.md +3 -0
- package/dist/bundling-sources/shared_libs/integration-contracts/index.ts +2 -0
- package/dist/bundling-sources/shared_libs/monitors/analytics-install-guides.ts +77 -0
- package/dist/bundling-sources/shared_libs/monitors/analytics-public.ts +10 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/charges.ts +125 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/policy-builders.ts +686 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/pricing.ts +54 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/public-pricing.ts +72 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/session.ts +45 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/state.ts +454 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/tamradar.ts +260 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/types.ts +215 -0
- package/dist/bundling-sources/shared_libs/monitors/callback-security.ts +333 -0
- package/dist/bundling-sources/shared_libs/monitors/cursor-page.ts +42 -0
- package/dist/bundling-sources/shared_libs/monitors/deactivation-reasons.ts +16 -0
- package/dist/bundling-sources/shared_libs/monitors/framework-managed-payload-fields.ts +71 -0
- package/dist/bundling-sources/shared_libs/monitors/generated/provider-monitor-callback-admission-targets.ts +16 -0
- package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +270 -0
- package/dist/bundling-sources/shared_libs/monitors/inbound-publish-key.ts +39 -0
- package/dist/bundling-sources/shared_libs/monitors/inbound-queue.ts +82 -0
- package/dist/bundling-sources/shared_libs/monitors/inventory-reconciliation.ts +59 -0
- package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +471 -0
- package/dist/bundling-sources/shared_libs/monitors/org-monitor-limits.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/package.json +36 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +1125 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +305 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts +964 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-consumer-health.ts +56 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts +131 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +535 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-legacy-aliases.ts +16 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-priority-execution.ts +56 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +28 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-runtime-read-eligibility.ts +38 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-state.ts +122 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-status.ts +10 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +112 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-webhook-monitor-runtime.ts +300 -0
- package/dist/bundling-sources/shared_libs/monitors/quickstart-prompts.ts +22 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +245 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-message.ts +38 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue-ack-probe.ts +94 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue-delivery.ts +60 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue.ts +60 -0
- package/dist/bundling-sources/shared_libs/monitors/snitcher-install-validation.ts +93 -0
- package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +332 -0
- package/dist/bundling-sources/shared_libs/monitors/snitcher-radar.ts +221 -0
- package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +105 -0
- package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +73 -0
- package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +81 -0
- package/dist/bundling-sources/shared_libs/monitors/tsconfig.json +10 -0
- package/dist/bundling-sources/shared_libs/observability/build-context.ts +13 -0
- package/dist/bundling-sources/shared_libs/observability/log-metadata.ts +160 -0
- package/dist/bundling-sources/shared_libs/observability/request-context.ts +68 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +654 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +35 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-work.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/neon-constants.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +272 -0
- package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +6 -11
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +135 -12
- package/dist/bundling-sources/shared_libs/play-runtime/async-operation.ts +66 -1
- package/dist/bundling-sources/shared_libs/play-runtime/async-play-invocation.ts +77 -0
- package/dist/bundling-sources/shared_libs/play-runtime/bounceban-batching.ts +137 -0
- package/dist/bundling-sources/shared_libs/play-runtime/checkpoint-boundaries.ts +70 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +1159 -166
- package/dist/bundling-sources/shared_libs/play-runtime/coordinator-headers.ts +1 -32
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +103 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-payload-contract.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-janitor.ts +103 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-reaper.ts +725 -0
- package/dist/bundling-sources/shared_libs/play-runtime/default-batch-strategies.ts +20 -1
- package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +29 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +29 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-gateway-invocation-fence.ts +442 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-protocol.ts +7 -1
- package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/contracts.ts +66 -0
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/job.ts +145 -0
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/ports.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/postgres-store.ts +170 -0
- package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +1322 -0
- package/dist/bundling-sources/shared_libs/play-runtime/internal-step-ids.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/lane-retirement-gate.ts +189 -0
- package/dist/bundling-sources/shared_libs/play-runtime/launch-source-policy.ts +112 -0
- package/dist/bundling-sources/shared_libs/play-runtime/map-execution-frame.ts +8 -0
- package/dist/bundling-sources/shared_libs/play-runtime/perf-trace.ts +127 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-artifact-runtime-contract.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts +24 -1
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/contracts.ts +56 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/index.ts +13 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/job.ts +41 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/ports.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/postgres-adapter.ts +54 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/contracts.ts +114 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/engine-suspension.ts +108 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/index.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/job.ts +97 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/ports.ts +104 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/postgres-fence-adapter.ts +263 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/worker-terminal-projection.ts +64 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/contracts.ts +29 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/gateway-adapter.ts +56 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/index.ts +15 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/job.ts +65 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/ports.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/contracts.ts +42 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/index.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +142 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/ports.ts +42 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/postgres-adapter.ts +102 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/contracts.ts +60 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/index.ts +16 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/job.ts +78 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/ports.ts +54 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/postgres-adapter.ts +71 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-semantics.ts +28 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/receipt-status.ts +5 -8
- package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +23 -2
- package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +168 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +90 -13
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +6 -12
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-start-admission.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/bundle.ts +0 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +14 -43
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +67 -213
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +201 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-capacity-policy.ts +20 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-contract.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-env.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +67 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-release-environment.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sandbox-contract.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +38 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-telemetry.ts +108 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +37 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-deadline-reconciliation.ts +88 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-play-deploy-task.ts +124 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-play-run-task.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +193 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-queue-lifecycle.ts +269 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-queue-suffix.ts +73 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +6642 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +897 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-metrics.ts +120 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-required-env.ts +76 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +476 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-heavy-request-admission.ts +47 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-progress-registry.ts +147 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/index.ts +27 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/lazy.ts +50 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +98 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-budget-state.ts +260 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +1416 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +1255 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +942 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +14636 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +888 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +355 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-terminal-transition.ts +46 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runner-push.ts +60 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +33 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-gateway-health.ts +64 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +835 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-ledger-reconciliation.ts +1218 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-operation.ts +207 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-scheduler-schema.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/scheduler-capacity.ts +123 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/scheduler-launch-read-observability.ts +78 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/submit-admission.ts +169 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/terminal-contract.ts +20 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/worker-queue-metrics.ts +34 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/worker-resource-metrics.ts +249 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sheet-attempt-sql.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/step-progress.ts +296 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/native-batch.ts +3 -3
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts +20 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +60 -15
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execution-outcome.ts +20 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/vercel-protection.ts +14 -1
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +165 -0
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +15 -23
- package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +169 -0
- package/dist/bundling-sources/shared_libs/play-runtime/zerobounce-batching.ts +122 -0
- package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +8 -3
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +454 -17
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +19 -4
- package/dist/bundling-sources/shared_libs/plays/contracts.ts +8 -14
- package/dist/bundling-sources/shared_libs/plays/core.ts +11 -6
- package/dist/bundling-sources/shared_libs/plays/deployment-status.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/docflow-binding-owner.ts +16 -11
- package/dist/bundling-sources/shared_libs/plays/docflow.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/email-status.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/play-grep-search.ts +39 -0
- package/dist/bundling-sources/shared_libs/plays/resolve-static-pipeline.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/share/copy.ts +271 -0
- package/dist/bundling-sources/shared_libs/plays/share/metrics.ts +140 -0
- package/dist/bundling-sources/shared_libs/plays/share/public-read-model.ts +86 -0
- package/dist/bundling-sources/shared_libs/plays/share/seo-quality.ts +181 -0
- package/dist/bundling-sources/shared_libs/plays/share/static-pipeline-summary.ts +658 -0
- package/dist/bundling-sources/shared_libs/plays/share/types.ts +197 -0
- package/dist/bundling-sources/shared_libs/plays/slack-hitl-timeout-error.ts +37 -0
- package/dist/bundling-sources/shared_libs/plays/slug.ts +115 -0
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +50 -15
- package/dist/bundling-sources/shared_libs/plays/tool-category-descriptions.ts +2 -2
- package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +1 -1
- package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +877 -0
- package/dist/bundling-sources/shared_libs/product-notifications/configuration-draft.ts +456 -0
- package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +566 -0
- package/dist/bundling-sources/shared_libs/product-notifications/content.ts +28 -0
- package/dist/bundling-sources/shared_libs/product-notifications/default-policy.ts +60 -0
- package/dist/bundling-sources/shared_libs/product-notifications/email.ts +246 -0
- package/dist/bundling-sources/shared_libs/product-notifications/evaluation.ts +280 -0
- package/dist/bundling-sources/shared_libs/product-notifications/events.ts +433 -0
- package/dist/bundling-sources/shared_libs/product-notifications/legacy-slack.ts +80 -0
- package/dist/bundling-sources/shared_libs/product-notifications/overflow.ts +18 -0
- package/dist/bundling-sources/shared_libs/product-notifications/rolling-limit.ts +24 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +624 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-payload.ts +140 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-transport.ts +75 -0
- package/dist/bundling-sources/shared_libs/product-notifications/workspace.ts +38 -0
- package/dist/bundling-sources/shared_libs/runtime-env.ts +12 -0
- package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +42 -0
- package/dist/bundling-sources/shared_libs/security/header-safe-env.ts +35 -0
- package/dist/bundling-sources/shared_libs/security/internal-actor.ts +50 -0
- package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +267 -0
- package/dist/bundling-sources/shared_libs/security/slack-sanitize.ts +133 -0
- package/dist/cli/getting-started.d.mts +52 -0
- package/dist/cli/getting-started.d.ts +52 -0
- package/dist/cli/getting-started.js +65 -0
- package/dist/cli/getting-started.mjs +36 -0
- package/dist/cli/index.d.mts +9 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.js +1611 -453
- package/dist/cli/index.mjs +1596 -447
- package/dist/{compiler-manifest-Dbov16F7.d.mts → compiler-manifest-BaJfE-5H.d.mts} +136 -10
- package/dist/{compiler-manifest-Dbov16F7.d.ts → compiler-manifest-BaJfE-5H.d.ts} +136 -10
- package/dist/index.d.mts +910 -155
- package/dist/index.d.ts +910 -155
- package/dist/index.js +550 -64
- package/dist/index.mjs +550 -64
- package/dist/install-integrity.json +193 -4
- package/dist/monitor-fleet-contract.d.mts +138 -0
- package/dist/monitor-fleet-contract.d.ts +138 -0
- package/dist/monitor-fleet-contract.js +404 -0
- package/dist/monitor-fleet-contract.mjs +367 -0
- package/dist/plays/bundle-play-file.d.mts +8 -3
- package/dist/plays/bundle-play-file.d.ts +8 -3
- package/dist/plays/bundle-play-file.mjs +100 -20
- package/dist/release.d.mts +255 -0
- package/dist/release.d.ts +255 -0
- package/dist/release.js +215 -0
- package/dist/release.mjs +188 -0
- package/package.json +23 -4
- /package/dist/bundling-sources/shared_libs/{integrations/bettercontact-execution-policy.ts → integration-contracts/bettercontact/execution-policy.ts} +0 -0
- /package/dist/bundling-sources/shared_libs/{integrations/theirstack-execution-policy.ts → integration-contracts/theirstack/execution-policy.ts} +0 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one durable lifecycle for a physical managed sandbox.
|
|
3
|
+
*
|
|
4
|
+
* Keep these values aligned with `runtime_sandbox_operation_state` in the
|
|
5
|
+
* scheduler schema. This is deliberately an enum, rather than an open
|
|
6
|
+
* string union: adding a lifecycle state must update every transition below.
|
|
7
|
+
*/
|
|
8
|
+
export enum RuntimeSandboxOperationState {
|
|
9
|
+
Reserved = 'reserved',
|
|
10
|
+
Live = 'live',
|
|
11
|
+
Deleting = 'deleting',
|
|
12
|
+
Deleted = 'deleted',
|
|
13
|
+
Abandoned = 'abandoned',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export enum RuntimeSandboxProvider {
|
|
17
|
+
Daytona = 'daytona',
|
|
18
|
+
Modal = 'modal',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type RuntimeSandboxOperationReserved = {
|
|
22
|
+
state: RuntimeSandboxOperationState.Reserved;
|
|
23
|
+
operationKey: string;
|
|
24
|
+
provider: RuntimeSandboxProvider;
|
|
25
|
+
runId: string;
|
|
26
|
+
attempt: number;
|
|
27
|
+
orgId: string;
|
|
28
|
+
sandboxId: null;
|
|
29
|
+
routingDomain: null;
|
|
30
|
+
deletedAtMs: null;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type RuntimeSandboxOperationLive = {
|
|
34
|
+
state: RuntimeSandboxOperationState.Live;
|
|
35
|
+
operationKey: string;
|
|
36
|
+
provider: RuntimeSandboxProvider;
|
|
37
|
+
runId: string;
|
|
38
|
+
attempt: number;
|
|
39
|
+
orgId: string;
|
|
40
|
+
sandboxId: string;
|
|
41
|
+
routingDomain: string | null;
|
|
42
|
+
deletedAtMs: null;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type RuntimeSandboxOperationDeleting = {
|
|
46
|
+
state: RuntimeSandboxOperationState.Deleting;
|
|
47
|
+
operationKey: string;
|
|
48
|
+
provider: RuntimeSandboxProvider;
|
|
49
|
+
runId: string;
|
|
50
|
+
attempt: number;
|
|
51
|
+
orgId: string;
|
|
52
|
+
sandboxId: string;
|
|
53
|
+
routingDomain: string | null;
|
|
54
|
+
deletedAtMs: null;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type RuntimeSandboxOperationDeleted = {
|
|
58
|
+
state: RuntimeSandboxOperationState.Deleted;
|
|
59
|
+
operationKey: string;
|
|
60
|
+
provider: RuntimeSandboxProvider;
|
|
61
|
+
runId: string;
|
|
62
|
+
attempt: number;
|
|
63
|
+
orgId: string;
|
|
64
|
+
sandboxId: string;
|
|
65
|
+
routingDomain: string | null;
|
|
66
|
+
deletedAtMs: number;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** Confirmed no-resource outcome. It cannot be promoted to a live sandbox. */
|
|
70
|
+
export type RuntimeSandboxOperationAbandoned = {
|
|
71
|
+
state: RuntimeSandboxOperationState.Abandoned;
|
|
72
|
+
operationKey: string;
|
|
73
|
+
provider: RuntimeSandboxProvider;
|
|
74
|
+
runId: string;
|
|
75
|
+
attempt: number;
|
|
76
|
+
orgId: string;
|
|
77
|
+
sandboxId: null;
|
|
78
|
+
routingDomain: null;
|
|
79
|
+
deletedAtMs: null;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export type RuntimeSandboxOperation =
|
|
83
|
+
| RuntimeSandboxOperationReserved
|
|
84
|
+
| RuntimeSandboxOperationLive
|
|
85
|
+
| RuntimeSandboxOperationDeleting
|
|
86
|
+
| RuntimeSandboxOperationDeleted
|
|
87
|
+
| RuntimeSandboxOperationAbandoned;
|
|
88
|
+
|
|
89
|
+
/** Every legal transition is explicit and closed over the enum. */
|
|
90
|
+
export const RUNTIME_SANDBOX_OPERATION_TRANSITIONS: Readonly<
|
|
91
|
+
Record<RuntimeSandboxOperationState, readonly RuntimeSandboxOperationState[]>
|
|
92
|
+
> = {
|
|
93
|
+
[RuntimeSandboxOperationState.Reserved]: [
|
|
94
|
+
RuntimeSandboxOperationState.Live,
|
|
95
|
+
RuntimeSandboxOperationState.Deleting,
|
|
96
|
+
RuntimeSandboxOperationState.Abandoned,
|
|
97
|
+
],
|
|
98
|
+
[RuntimeSandboxOperationState.Live]: [RuntimeSandboxOperationState.Deleting],
|
|
99
|
+
[RuntimeSandboxOperationState.Deleting]: [
|
|
100
|
+
RuntimeSandboxOperationState.Deleted,
|
|
101
|
+
],
|
|
102
|
+
[RuntimeSandboxOperationState.Deleted]: [],
|
|
103
|
+
[RuntimeSandboxOperationState.Abandoned]: [],
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export function canTransitionRuntimeSandboxOperation(
|
|
107
|
+
from: RuntimeSandboxOperationState,
|
|
108
|
+
to: RuntimeSandboxOperationState,
|
|
109
|
+
): boolean {
|
|
110
|
+
return RUNTIME_SANDBOX_OPERATION_TRANSITIONS[from].includes(to);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
type RuntimeSandboxOperationDatabaseRow = {
|
|
114
|
+
operation_key: unknown;
|
|
115
|
+
provider: unknown;
|
|
116
|
+
run_id: unknown;
|
|
117
|
+
attempt: unknown;
|
|
118
|
+
org_id: unknown;
|
|
119
|
+
sandbox_id: unknown;
|
|
120
|
+
routing_domain: unknown;
|
|
121
|
+
state: unknown;
|
|
122
|
+
delete_confirmed_at_ms: unknown;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
function requiredText(value: unknown, name: string): string {
|
|
126
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
127
|
+
throw new Error(`Invalid sandbox operation ${name}.`);
|
|
128
|
+
}
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** The sole boundary that converts database text into the closed TS FSM. */
|
|
133
|
+
export function decodeRuntimeSandboxOperation(
|
|
134
|
+
row: RuntimeSandboxOperationDatabaseRow,
|
|
135
|
+
): RuntimeSandboxOperation {
|
|
136
|
+
const provider = requiredText(row.provider, 'provider');
|
|
137
|
+
if (
|
|
138
|
+
provider !== RuntimeSandboxProvider.Daytona &&
|
|
139
|
+
provider !== RuntimeSandboxProvider.Modal
|
|
140
|
+
) {
|
|
141
|
+
throw new Error(`Unknown sandbox operation provider: ${provider}.`);
|
|
142
|
+
}
|
|
143
|
+
const state = requiredText(row.state, 'state');
|
|
144
|
+
const base = {
|
|
145
|
+
operationKey: requiredText(row.operation_key, 'operationKey'),
|
|
146
|
+
provider,
|
|
147
|
+
runId: requiredText(row.run_id, 'runId'),
|
|
148
|
+
attempt: Number(row.attempt),
|
|
149
|
+
orgId: requiredText(row.org_id, 'orgId'),
|
|
150
|
+
} as const;
|
|
151
|
+
if (!Number.isSafeInteger(base.attempt) || base.attempt < 1) {
|
|
152
|
+
throw new Error('Invalid sandbox operation attempt.');
|
|
153
|
+
}
|
|
154
|
+
const sandboxId =
|
|
155
|
+
row.sandbox_id === null ? null : requiredText(row.sandbox_id, 'sandboxId');
|
|
156
|
+
const routingDomain =
|
|
157
|
+
row.routing_domain === null
|
|
158
|
+
? null
|
|
159
|
+
: requiredText(row.routing_domain, 'routingDomain');
|
|
160
|
+
const deletedAtMs =
|
|
161
|
+
row.delete_confirmed_at_ms === null
|
|
162
|
+
? null
|
|
163
|
+
: Number(row.delete_confirmed_at_ms);
|
|
164
|
+
switch (state) {
|
|
165
|
+
case RuntimeSandboxOperationState.Reserved:
|
|
166
|
+
case RuntimeSandboxOperationState.Abandoned:
|
|
167
|
+
if (
|
|
168
|
+
sandboxId !== null ||
|
|
169
|
+
routingDomain !== null ||
|
|
170
|
+
deletedAtMs !== null
|
|
171
|
+
) {
|
|
172
|
+
throw new Error(`Invalid ${state} sandbox operation shape.`);
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
...base,
|
|
176
|
+
state,
|
|
177
|
+
sandboxId: null,
|
|
178
|
+
routingDomain: null,
|
|
179
|
+
deletedAtMs: null,
|
|
180
|
+
};
|
|
181
|
+
case RuntimeSandboxOperationState.Live:
|
|
182
|
+
case RuntimeSandboxOperationState.Deleting:
|
|
183
|
+
if (sandboxId === null || deletedAtMs !== null) {
|
|
184
|
+
throw new Error(`Invalid ${state} sandbox operation shape.`);
|
|
185
|
+
}
|
|
186
|
+
return { ...base, state, sandboxId, routingDomain, deletedAtMs: null };
|
|
187
|
+
case RuntimeSandboxOperationState.Deleted:
|
|
188
|
+
if (
|
|
189
|
+
sandboxId === null ||
|
|
190
|
+
deletedAtMs === null ||
|
|
191
|
+
!Number.isFinite(deletedAtMs)
|
|
192
|
+
) {
|
|
193
|
+
throw new Error('Invalid deleted sandbox operation shape.');
|
|
194
|
+
}
|
|
195
|
+
return { ...base, state, sandboxId, routingDomain, deletedAtMs };
|
|
196
|
+
default:
|
|
197
|
+
throw new Error(`Unknown sandbox operation state: ${state}.`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export function runtimeSandboxProviderForResourceKind(
|
|
202
|
+
kind: 'daytona_sandbox' | 'modal_sandbox',
|
|
203
|
+
): RuntimeSandboxProvider {
|
|
204
|
+
return kind === 'daytona_sandbox'
|
|
205
|
+
? RuntimeSandboxProvider.Daytona
|
|
206
|
+
: RuntimeSandboxProvider.Modal;
|
|
207
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const LOCAL_RUNTIME_SCHEDULER_SCHEMA_ENV =
|
|
2
|
+
'DEEPLINE_LOCAL_RUNTIME_SCHEDULER_SCHEMA';
|
|
3
|
+
export const RUNTIME_SCHEDULER_SCHEMA_ENV = 'DEEPLINE_RUNTIME_SCHEDULER_SCHEMA';
|
|
4
|
+
|
|
5
|
+
export function resolveRuntimeSchedulerSchemaEnv(): string | null {
|
|
6
|
+
const localSchema = process.env[LOCAL_RUNTIME_SCHEDULER_SCHEMA_ENV]?.trim();
|
|
7
|
+
if (localSchema) return localSchema;
|
|
8
|
+
const schema = process.env[RUNTIME_SCHEDULER_SCHEMA_ENV]?.trim();
|
|
9
|
+
return schema || null;
|
|
10
|
+
}
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/scheduler-capacity.ts
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export class RuntimeSchedulerSaturatedError extends Error {
|
|
2
|
+
readonly queueDepth: number;
|
|
3
|
+
|
|
4
|
+
constructor(queueDepth: number) {
|
|
5
|
+
super(
|
|
6
|
+
`Runtime scheduler DB pool is saturated (${queueDepth} pending acquires). ` +
|
|
7
|
+
'Backpressure: shed or retry with backoff instead of queueing more work.',
|
|
8
|
+
);
|
|
9
|
+
this.name = 'RuntimeSchedulerSaturatedError';
|
|
10
|
+
this.queueDepth = queueDepth;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Scheduler admission is temporarily full, not broken. */
|
|
15
|
+
export class RuntimeSchedulerCapacityError extends Error {
|
|
16
|
+
readonly retryAfterMs: number;
|
|
17
|
+
|
|
18
|
+
constructor(message: string, retryAfterMs: number) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.name = 'RuntimeSchedulerCapacityError';
|
|
21
|
+
this.retryAfterMs = retryAfterMs;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class RuntimeSchedulerPgBouncerCapacityError extends RuntimeSchedulerCapacityError {
|
|
26
|
+
constructor(cause: string) {
|
|
27
|
+
super(
|
|
28
|
+
`Runtime scheduler PgBouncer is at connection capacity: ${cause}`,
|
|
29
|
+
5_000,
|
|
30
|
+
);
|
|
31
|
+
this.name = 'RuntimeSchedulerPgBouncerCapacityError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The app deliberately keeps bulk launch transactions off the last control
|
|
37
|
+
* plane connection. This is a bounded, process-local admission limit, not a
|
|
38
|
+
* durable scheduler queue: a caller has not been admitted until its existing
|
|
39
|
+
* atomic launch transaction commits.
|
|
40
|
+
*/
|
|
41
|
+
export class RuntimeSchedulerSubmissionAdmissionError extends RuntimeSchedulerCapacityError {
|
|
42
|
+
readonly reason: 'full' | 'timed_out';
|
|
43
|
+
|
|
44
|
+
constructor(reason: 'full' | 'timed_out', queueDepth: number) {
|
|
45
|
+
super(
|
|
46
|
+
`Runtime scheduler submission admission ${reason} (${queueDepth} queued launches).`,
|
|
47
|
+
1_000,
|
|
48
|
+
);
|
|
49
|
+
this.name = 'RuntimeSchedulerSubmissionAdmissionError';
|
|
50
|
+
this.reason = reason;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function isRuntimeSchedulerCapacityError(
|
|
55
|
+
error: unknown,
|
|
56
|
+
): error is RuntimeSchedulerCapacityError | RuntimeSchedulerSaturatedError {
|
|
57
|
+
if (
|
|
58
|
+
error instanceof RuntimeSchedulerCapacityError ||
|
|
59
|
+
error instanceof RuntimeSchedulerSaturatedError
|
|
60
|
+
) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
if (!error || typeof error !== 'object') return false;
|
|
64
|
+
const candidate = error as { name?: unknown; message?: unknown };
|
|
65
|
+
if (typeof candidate.name !== 'string') return false;
|
|
66
|
+
if (typeof candidate.message !== 'string') return false;
|
|
67
|
+
return (
|
|
68
|
+
(candidate.name === 'RuntimeSchedulerPgBouncerCapacityError' &&
|
|
69
|
+
candidate.message.includes(
|
|
70
|
+
'Runtime scheduler PgBouncer is at connection capacity:',
|
|
71
|
+
)) ||
|
|
72
|
+
(candidate.name === 'RuntimeSchedulerCapacityError' &&
|
|
73
|
+
candidate.message.startsWith('Runtime scheduler ')) ||
|
|
74
|
+
(candidate.name === 'RuntimeSchedulerSubmissionAdmissionError' &&
|
|
75
|
+
candidate.message.startsWith(
|
|
76
|
+
'Runtime scheduler submission admission ',
|
|
77
|
+
)) ||
|
|
78
|
+
(candidate.name === 'RuntimeSchedulerSaturatedError' &&
|
|
79
|
+
candidate.message.startsWith('Runtime scheduler DB pool is saturated ('))
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Restore the typed capacity signal after a text-only protocol boundary. */
|
|
84
|
+
export function parseRuntimeSchedulerCapacityError(
|
|
85
|
+
message: string,
|
|
86
|
+
): RuntimeSchedulerCapacityError | RuntimeSchedulerSaturatedError | null {
|
|
87
|
+
const pgBouncerPrefix =
|
|
88
|
+
'Runtime scheduler PgBouncer is at connection capacity: ';
|
|
89
|
+
const pgBouncerIndex = message.indexOf(pgBouncerPrefix);
|
|
90
|
+
if (pgBouncerIndex >= 0) {
|
|
91
|
+
return new RuntimeSchedulerPgBouncerCapacityError(
|
|
92
|
+
message
|
|
93
|
+
.slice(pgBouncerIndex + pgBouncerPrefix.length)
|
|
94
|
+
.split(/\r?\n/, 1)[0]!,
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const saturated = message.match(
|
|
99
|
+
/Runtime scheduler DB pool is saturated \((\d+) pending acquires\)\./,
|
|
100
|
+
);
|
|
101
|
+
if (saturated)
|
|
102
|
+
return new RuntimeSchedulerSaturatedError(Number(saturated[1]));
|
|
103
|
+
|
|
104
|
+
const admission = message.match(
|
|
105
|
+
/Runtime scheduler submission admission (full|timed_out) \((\d+) queued launches\)\./,
|
|
106
|
+
);
|
|
107
|
+
return admission
|
|
108
|
+
? new RuntimeSchedulerSubmissionAdmissionError(
|
|
109
|
+
admission[1] as 'full' | 'timed_out',
|
|
110
|
+
Number(admission[2]),
|
|
111
|
+
)
|
|
112
|
+
: null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function runtimeSchedulerCapacityRetryAfterMs(
|
|
116
|
+
error: RuntimeSchedulerCapacityError | RuntimeSchedulerSaturatedError,
|
|
117
|
+
): number {
|
|
118
|
+
const retryAfterMs = (error as { retryAfterMs?: unknown }).retryAfterMs;
|
|
119
|
+
if (typeof retryAfterMs === 'number' && Number.isFinite(retryAfterMs)) {
|
|
120
|
+
return Math.max(0, retryAfterMs);
|
|
121
|
+
}
|
|
122
|
+
return error.name === 'RuntimeSchedulerSaturatedError' ? 1_000 : 5_000;
|
|
123
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-process telemetry for immutable launch lookups. Keep labels bounded: the
|
|
3
|
+
* callers are an explicit union and releases are immutable deploy lanes. Never
|
|
4
|
+
* put run ids, play names, users, or organizations in these metrics.
|
|
5
|
+
*/
|
|
6
|
+
export type SchedulerLaunchReadCaller =
|
|
7
|
+
| 'play_run_control'
|
|
8
|
+
| 'scheduler_submit_recovery'
|
|
9
|
+
| 'runtime_worker_execute'
|
|
10
|
+
| 'runtime_worker_terminal_recovery'
|
|
11
|
+
| 'direct_terminal_billing'
|
|
12
|
+
| 'runtime_worker_outbox_projection'
|
|
13
|
+
| 'receipt_gateway_auth'
|
|
14
|
+
| 'receipt_gateway_lazy'
|
|
15
|
+
| 'test';
|
|
16
|
+
|
|
17
|
+
export type SchedulerLaunchReadOutcome = 'found' | 'missing' | 'error';
|
|
18
|
+
|
|
19
|
+
type Counter = {
|
|
20
|
+
caller: SchedulerLaunchReadCaller;
|
|
21
|
+
releaseId: string;
|
|
22
|
+
found: number;
|
|
23
|
+
missing: number;
|
|
24
|
+
errors: number;
|
|
25
|
+
total: number;
|
|
26
|
+
durationMsTotal: number;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const counters = new Map<string, Counter>();
|
|
30
|
+
|
|
31
|
+
function counterFor(input: {
|
|
32
|
+
caller: SchedulerLaunchReadCaller;
|
|
33
|
+
releaseId: string | null;
|
|
34
|
+
}): Counter {
|
|
35
|
+
const releaseId = input.releaseId?.trim() || 'unassigned';
|
|
36
|
+
const key = `${input.caller}:${releaseId}`;
|
|
37
|
+
const existing = counters.get(key);
|
|
38
|
+
if (existing) return existing;
|
|
39
|
+
const counter: Counter = {
|
|
40
|
+
caller: input.caller,
|
|
41
|
+
releaseId,
|
|
42
|
+
found: 0,
|
|
43
|
+
missing: 0,
|
|
44
|
+
errors: 0,
|
|
45
|
+
total: 0,
|
|
46
|
+
durationMsTotal: 0,
|
|
47
|
+
};
|
|
48
|
+
counters.set(key, counter);
|
|
49
|
+
return counter;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function recordSchedulerLaunchRead(input: {
|
|
53
|
+
caller: SchedulerLaunchReadCaller;
|
|
54
|
+
releaseId: string | null;
|
|
55
|
+
durationMs: number;
|
|
56
|
+
outcome: SchedulerLaunchReadOutcome;
|
|
57
|
+
}): void {
|
|
58
|
+
const counter = counterFor(input);
|
|
59
|
+
counter.total += 1;
|
|
60
|
+
counter.durationMsTotal += Math.max(0, input.durationMs);
|
|
61
|
+
if (input.outcome === 'found') counter.found += 1;
|
|
62
|
+
if (input.outcome === 'missing') counter.missing += 1;
|
|
63
|
+
if (input.outcome === 'error') counter.errors += 1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function schedulerLaunchReadMetricsSnapshot(): Counter[] {
|
|
67
|
+
return [...counters.values()]
|
|
68
|
+
.map((counter) => ({ ...counter }))
|
|
69
|
+
.sort(
|
|
70
|
+
(left, right) =>
|
|
71
|
+
left.caller.localeCompare(right.caller) ||
|
|
72
|
+
left.releaseId.localeCompare(right.releaseId),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function resetSchedulerLaunchReadMetricsForTest(): void {
|
|
77
|
+
counters.clear();
|
|
78
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process-local admission before the atomic Postgres launch transaction.
|
|
3
|
+
*
|
|
4
|
+
* A Vercel app process uses a deliberately tiny two-client scheduler pool.
|
|
5
|
+
* Bulk submissions used to consume both clients while executor-token lease
|
|
6
|
+
* reads needed one, so a burst turned a retryable token lookup into a failed
|
|
7
|
+
* engine leg. One bulk submit at a time keeps a control-plane client free.
|
|
8
|
+
*
|
|
9
|
+
* This is intentionally not durable state and does not acknowledge a launch.
|
|
10
|
+
* The existing submit transaction remains the only admission boundary. If the
|
|
11
|
+
* process dies, its ordinary launch-record recovery path remains authoritative.
|
|
12
|
+
*
|
|
13
|
+
* Do not wire an HTTP abort signal into this queue. At this point the caller
|
|
14
|
+
* has already persisted its launch record; silently dropping it on disconnect
|
|
15
|
+
* would make a durable start look abandoned. Explicit run cancellation and
|
|
16
|
+
* durable recovery own that decision instead.
|
|
17
|
+
*/
|
|
18
|
+
import { RuntimeSchedulerSubmissionAdmissionError } from './scheduler-capacity';
|
|
19
|
+
|
|
20
|
+
export const RUNTIME_SCHEDULER_SUBMIT_ADMISSION = {
|
|
21
|
+
maxActive: 1,
|
|
22
|
+
maxQueued: 128,
|
|
23
|
+
maxWaitMs: 60_000,
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
type Waiter = {
|
|
27
|
+
enqueuedAt: number;
|
|
28
|
+
resolve: (permit: RuntimeSchedulerSubmitAdmissionPermit) => void;
|
|
29
|
+
reject: (error: Error) => void;
|
|
30
|
+
timeout: ReturnType<typeof setTimeout>;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type AdmissionEntry = {
|
|
34
|
+
active: number;
|
|
35
|
+
waiters: Waiter[];
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
type AdmissionRegistry = Map<string, AdmissionEntry>;
|
|
39
|
+
|
|
40
|
+
const REGISTRY_SYMBOL = Symbol.for(
|
|
41
|
+
'deepline.runtimeSchedulerSubmitAdmission.registry',
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
function registry(): AdmissionRegistry {
|
|
45
|
+
const target = globalThis as typeof globalThis & Record<symbol, unknown>;
|
|
46
|
+
const existing = target[REGISTRY_SYMBOL];
|
|
47
|
+
if (existing instanceof Map) return existing as AdmissionRegistry;
|
|
48
|
+
const created: AdmissionRegistry = new Map<string, AdmissionEntry>();
|
|
49
|
+
target[REGISTRY_SYMBOL] = created;
|
|
50
|
+
return created;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type RuntimeSchedulerSubmitAdmissionParams = {
|
|
54
|
+
/** Kept in-memory only. Do not log this value because it contains DB auth. */
|
|
55
|
+
schedulerUrl: string;
|
|
56
|
+
schedulerSchema: string | null | undefined;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export type RuntimeSchedulerSubmitAdmissionPermit = {
|
|
60
|
+
queueDepth: number;
|
|
61
|
+
waitMs: number;
|
|
62
|
+
release: () => void;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
function keyFor(params: RuntimeSchedulerSubmitAdmissionParams): string {
|
|
66
|
+
return `${params.schedulerUrl}\u0000${params.schedulerSchema ?? ''}`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function removeWaiter(entry: AdmissionEntry, waiter: Waiter): boolean {
|
|
70
|
+
const index = entry.waiters.indexOf(waiter);
|
|
71
|
+
if (index < 0) return false;
|
|
72
|
+
entry.waiters.splice(index, 1);
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function pruneEntry(key: string, entry: AdmissionEntry): void {
|
|
77
|
+
if (entry.active === 0 && entry.waiters.length === 0) {
|
|
78
|
+
registry().delete(key);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function permitFor(
|
|
83
|
+
key: string,
|
|
84
|
+
entry: AdmissionEntry,
|
|
85
|
+
queueDepth: number,
|
|
86
|
+
enqueuedAt: number,
|
|
87
|
+
): RuntimeSchedulerSubmitAdmissionPermit {
|
|
88
|
+
let released = false;
|
|
89
|
+
return {
|
|
90
|
+
queueDepth,
|
|
91
|
+
waitMs: Date.now() - enqueuedAt,
|
|
92
|
+
release: () => {
|
|
93
|
+
if (released) return;
|
|
94
|
+
released = true;
|
|
95
|
+
const next = entry.waiters.shift();
|
|
96
|
+
if (next) {
|
|
97
|
+
clearTimeout(next.timeout);
|
|
98
|
+
next.resolve(
|
|
99
|
+
permitFor(key, entry, entry.waiters.length, next.enqueuedAt),
|
|
100
|
+
);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
entry.active -= 1;
|
|
104
|
+
pruneEntry(key, entry);
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Wait for the next local bulk-submit slot. This never makes a launch durable
|
|
111
|
+
* or returns success to an API caller; it merely controls when the caller may
|
|
112
|
+
* start the existing atomic scheduler transaction.
|
|
113
|
+
*/
|
|
114
|
+
export async function acquireRuntimeSchedulerSubmitAdmission(
|
|
115
|
+
params: RuntimeSchedulerSubmitAdmissionParams,
|
|
116
|
+
): Promise<RuntimeSchedulerSubmitAdmissionPermit> {
|
|
117
|
+
const key = keyFor(params);
|
|
118
|
+
const entries = registry();
|
|
119
|
+
const entry = entries.get(key) ?? { active: 0, waiters: [] };
|
|
120
|
+
entries.set(key, entry);
|
|
121
|
+
const enqueuedAt = Date.now();
|
|
122
|
+
|
|
123
|
+
if (entry.active < RUNTIME_SCHEDULER_SUBMIT_ADMISSION.maxActive) {
|
|
124
|
+
entry.active += 1;
|
|
125
|
+
return permitFor(key, entry, 0, enqueuedAt);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (entry.waiters.length >= RUNTIME_SCHEDULER_SUBMIT_ADMISSION.maxQueued) {
|
|
129
|
+
pruneEntry(key, entry);
|
|
130
|
+
throw new RuntimeSchedulerSubmissionAdmissionError(
|
|
131
|
+
'full',
|
|
132
|
+
entry.waiters.length,
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return new Promise<RuntimeSchedulerSubmitAdmissionPermit>(
|
|
137
|
+
(resolve, reject) => {
|
|
138
|
+
const waiter: Waiter = {
|
|
139
|
+
enqueuedAt,
|
|
140
|
+
resolve,
|
|
141
|
+
reject,
|
|
142
|
+
timeout: setTimeout(() => {
|
|
143
|
+
if (!removeWaiter(entry, waiter)) return;
|
|
144
|
+
reject(
|
|
145
|
+
new RuntimeSchedulerSubmissionAdmissionError(
|
|
146
|
+
'timed_out',
|
|
147
|
+
entry.waiters.length,
|
|
148
|
+
),
|
|
149
|
+
);
|
|
150
|
+
pruneEntry(key, entry);
|
|
151
|
+
}, RUNTIME_SCHEDULER_SUBMIT_ADMISSION.maxWaitMs),
|
|
152
|
+
};
|
|
153
|
+
entry.waiters.push(waiter);
|
|
154
|
+
},
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Run submit-time control-plane work while holding the bounded permit. */
|
|
159
|
+
export async function withRuntimeSchedulerSubmitAdmission<T>(
|
|
160
|
+
params: RuntimeSchedulerSubmitAdmissionParams,
|
|
161
|
+
operation: (permit: RuntimeSchedulerSubmitAdmissionPermit) => Promise<T>,
|
|
162
|
+
): Promise<T> {
|
|
163
|
+
const permit = await acquireRuntimeSchedulerSubmitAdmission(params);
|
|
164
|
+
try {
|
|
165
|
+
return await operation(permit);
|
|
166
|
+
} finally {
|
|
167
|
+
permit.release();
|
|
168
|
+
}
|
|
169
|
+
}
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/terminal-contract.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The terminal transition contract a worker release declares. Declaring it
|
|
3
|
+
* proves the owning runtime release has the durable compute-billing controller
|
|
4
|
+
* required before a capped completion may bypass the parked Absurd invocation.
|
|
5
|
+
*
|
|
6
|
+
* There is exactly one. A worker that declares nothing — or anything this build
|
|
7
|
+
* does not recognize — takes the compatibility wake path, which is what every
|
|
8
|
+
* pre-declaration lane has always done.
|
|
9
|
+
*/
|
|
10
|
+
export const DIRECT_COMPLETED_TERMINAL_CONTRACT =
|
|
11
|
+
'direct-completed-v2' as const;
|
|
12
|
+
|
|
13
|
+
export type DirectCompletedTerminalContract =
|
|
14
|
+
typeof DIRECT_COMPLETED_TERMINAL_CONTRACT;
|
|
15
|
+
|
|
16
|
+
export function directCompletedTerminalContract(
|
|
17
|
+
value: unknown,
|
|
18
|
+
): DirectCompletedTerminalContract | null {
|
|
19
|
+
return value === DIRECT_COMPLETED_TERMINAL_CONTRACT ? value : null;
|
|
20
|
+
}
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/worker-queue-metrics.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global scheduler queue state cannot be collected independently by every
|
|
3
|
+
* worker. The production metrics collector scrapes every worker, so a
|
|
4
|
+
* per-scrape aggregate would multiply PlanetScale load by the fleet size.
|
|
5
|
+
*/
|
|
6
|
+
export type WorkerQueueMetrics = {
|
|
7
|
+
queued: string;
|
|
8
|
+
running: string;
|
|
9
|
+
oldest_queued_s: string;
|
|
10
|
+
oldest_running_s: string;
|
|
11
|
+
stale_leases: string;
|
|
12
|
+
completed_runner_handoffs: string;
|
|
13
|
+
running_without_lease: string;
|
|
14
|
+
stale_heartbeats: string;
|
|
15
|
+
play_run_dead_letters: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Preserve the established metric series while explicitly reporting that this
|
|
20
|
+
* individual worker does not own a fresh global queue-state projection.
|
|
21
|
+
*/
|
|
22
|
+
export function unavailableWorkerQueueMetrics(): WorkerQueueMetrics {
|
|
23
|
+
return {
|
|
24
|
+
queued: 'NaN',
|
|
25
|
+
running: 'NaN',
|
|
26
|
+
oldest_queued_s: 'NaN',
|
|
27
|
+
oldest_running_s: 'NaN',
|
|
28
|
+
stale_leases: 'NaN',
|
|
29
|
+
completed_runner_handoffs: 'NaN',
|
|
30
|
+
running_without_lease: 'NaN',
|
|
31
|
+
stale_heartbeats: 'NaN',
|
|
32
|
+
play_run_dead_letters: 'NaN',
|
|
33
|
+
};
|
|
34
|
+
}
|