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
package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/postgres-fence-adapter.ts
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
allocatePostgresSchedulerNextAttempt,
|
|
5
|
+
assignPostgresSchedulerRunAttempt,
|
|
6
|
+
deferPostgresSchedulerAttemptForCapacity,
|
|
7
|
+
deferPostgresSchedulerAttemptForRecovery,
|
|
8
|
+
handoffPostgresSchedulerAttemptContinuation,
|
|
9
|
+
markPostgresSchedulerAttemptRunning,
|
|
10
|
+
markPostgresSchedulerAttemptWaiting,
|
|
11
|
+
readPostgresSchedulerResult,
|
|
12
|
+
resumePostgresSchedulerDetachedRunnerAttempt,
|
|
13
|
+
type PostgresSchedulerOptions,
|
|
14
|
+
type PostgresSchedulerQueryClient,
|
|
15
|
+
} from '../../scheduler-backends/postgres';
|
|
16
|
+
import { PLAY_RUN_RECOVERY_DEFER_POLICY } from '../../play-run-recovery-policy';
|
|
17
|
+
import type {
|
|
18
|
+
PlayRunAttemptClaim,
|
|
19
|
+
PlayRunAttemptTerminalEnvelope,
|
|
20
|
+
} from '../../play-runs/attempts/contracts';
|
|
21
|
+
import type { PlayRunAttemptStore } from '../../play-runs/attempts/ports';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Runtime-Postgres Adapter for Play Run Attempt.
|
|
25
|
+
*
|
|
26
|
+
* The Adapter intentionally owns the scheduler's real transition vocabulary:
|
|
27
|
+
* fresh versus detached-fence claim, finite pre-code recovery, typed parking,
|
|
28
|
+
* ordinary wake, and detached continuation handoff. It does not execute
|
|
29
|
+
* sandboxes or shape runner-returned terminal output; those remain the
|
|
30
|
+
* Sandbox Runs and Terminal Modules behind their own seams. A bounded
|
|
31
|
+
* pre-code recovery exhaustion is the one scheduler-owned terminal envelope
|
|
32
|
+
* this Adapter constructs.
|
|
33
|
+
*/
|
|
34
|
+
export type PostgresPlayRunAttemptStore = PlayRunAttemptStore;
|
|
35
|
+
|
|
36
|
+
export function createPostgresPlayRunAttemptStore(input: {
|
|
37
|
+
client: PostgresSchedulerQueryClient;
|
|
38
|
+
schedulerOptions?: Pick<PostgresSchedulerOptions, 'schema'>;
|
|
39
|
+
/** Injectable only to make Adapter conformance vectors deterministic. */
|
|
40
|
+
createFenceId?: () => string;
|
|
41
|
+
nowMs?: () => number;
|
|
42
|
+
}): PostgresPlayRunAttemptStore {
|
|
43
|
+
const options = input.schedulerOptions;
|
|
44
|
+
const createFenceId = input.createFenceId ?? randomUUID;
|
|
45
|
+
const nowMs = input.nowMs ?? Date.now;
|
|
46
|
+
const freshClaim = async (run: { runId: string }) => {
|
|
47
|
+
// This intentionally retains the worker's allocate-then-assign law.
|
|
48
|
+
// Races may choose the same generation, but the assignment SQL admits
|
|
49
|
+
// only one of them; a loser observes null and must retire without work.
|
|
50
|
+
const number = await allocatePostgresSchedulerNextAttempt(
|
|
51
|
+
input.client,
|
|
52
|
+
run.runId,
|
|
53
|
+
options,
|
|
54
|
+
);
|
|
55
|
+
const fenceId = createFenceId();
|
|
56
|
+
const assigned = await assignPostgresSchedulerRunAttempt(
|
|
57
|
+
input.client,
|
|
58
|
+
{ runId: run.runId, attempt: number, taskToken: fenceId },
|
|
59
|
+
options,
|
|
60
|
+
);
|
|
61
|
+
if (assigned === null) return null;
|
|
62
|
+
return {
|
|
63
|
+
runId: run.runId,
|
|
64
|
+
number,
|
|
65
|
+
fenceId,
|
|
66
|
+
checkpoint: assigned.checkpoint ?? null,
|
|
67
|
+
origin: 'fresh' as const,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
async readTerminal({ runId }) {
|
|
72
|
+
const terminal = await readPostgresSchedulerResult(
|
|
73
|
+
input.client,
|
|
74
|
+
runId,
|
|
75
|
+
options,
|
|
76
|
+
);
|
|
77
|
+
if (terminal === null) return null;
|
|
78
|
+
return {
|
|
79
|
+
status: terminal.status,
|
|
80
|
+
...(Object.hasOwn(terminal, 'output')
|
|
81
|
+
? { output: terminal.output }
|
|
82
|
+
: {}),
|
|
83
|
+
...(Object.hasOwn(terminal, 'error') ? { error: terminal.error } : {}),
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
async resumeDetached(run) {
|
|
87
|
+
const resumed = await resumePostgresSchedulerDetachedRunnerAttempt(
|
|
88
|
+
input.client,
|
|
89
|
+
{ runId: run.runId },
|
|
90
|
+
options,
|
|
91
|
+
);
|
|
92
|
+
if (!resumed) return null;
|
|
93
|
+
const suspension = detachedRunnerSuspension(resumed.suspension);
|
|
94
|
+
return {
|
|
95
|
+
runId: run.runId,
|
|
96
|
+
number: resumed.attempt,
|
|
97
|
+
fenceId: resumed.leaseToken,
|
|
98
|
+
checkpoint: resumed.checkpoint ?? null,
|
|
99
|
+
origin: 'detached_runner_resume' as const,
|
|
100
|
+
suspension,
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
claim: freshClaim,
|
|
104
|
+
async deferBeforeCode({ claim, deferral }) {
|
|
105
|
+
if (deferral.kind === 'capacity') {
|
|
106
|
+
const deferred = await deferPostgresSchedulerAttemptForCapacity(
|
|
107
|
+
input.client,
|
|
108
|
+
{
|
|
109
|
+
runId: claim.runId,
|
|
110
|
+
attempt: claim.number,
|
|
111
|
+
leaseToken: claim.fenceId,
|
|
112
|
+
reason: deferral.reason,
|
|
113
|
+
},
|
|
114
|
+
options,
|
|
115
|
+
);
|
|
116
|
+
return deferred
|
|
117
|
+
? { kind: 'deferred' as const }
|
|
118
|
+
: { kind: 'fence_lost' as const };
|
|
119
|
+
}
|
|
120
|
+
const decision = deferral.decision;
|
|
121
|
+
if (decision.stage !== 'pre_code' || decision.action !== 'defer') {
|
|
122
|
+
throw new Error(
|
|
123
|
+
'Play Run Attempt recovery deferral requires a pre-code defer decision.',
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
const recovery = await deferPostgresSchedulerAttemptForRecovery(
|
|
127
|
+
input.client,
|
|
128
|
+
{
|
|
129
|
+
runId: claim.runId,
|
|
130
|
+
attempt: claim.number,
|
|
131
|
+
leaseToken: claim.fenceId,
|
|
132
|
+
reason: deferral.reason,
|
|
133
|
+
dependency: decision.dependency,
|
|
134
|
+
openCircuit:
|
|
135
|
+
decision.dependency === 'modal' &&
|
|
136
|
+
decision.reason !== 'modal_circuit_open_before_execution',
|
|
137
|
+
nowMs: nowMs(),
|
|
138
|
+
maxDefers: PLAY_RUN_RECOVERY_DEFER_POLICY.maxDefers,
|
|
139
|
+
horizonMs: PLAY_RUN_RECOVERY_DEFER_POLICY.horizonMs,
|
|
140
|
+
deferBaseMs: PLAY_RUN_RECOVERY_DEFER_POLICY.deferBaseSeconds * 1_000,
|
|
141
|
+
deferMaxMs: PLAY_RUN_RECOVERY_DEFER_POLICY.deferMaxSeconds * 1_000,
|
|
142
|
+
},
|
|
143
|
+
options,
|
|
144
|
+
);
|
|
145
|
+
if (recovery.deferred) return { kind: 'deferred' as const };
|
|
146
|
+
if (!recovery.exhausted) return { kind: 'fence_lost' as const };
|
|
147
|
+
return {
|
|
148
|
+
kind: 'exhausted' as const,
|
|
149
|
+
terminal: exhaustedRecoveryTerminal({
|
|
150
|
+
dependency: decision.dependency,
|
|
151
|
+
checkpoint: claim.checkpoint,
|
|
152
|
+
}),
|
|
153
|
+
};
|
|
154
|
+
},
|
|
155
|
+
async park({ claim, checkpoint, suspension }) {
|
|
156
|
+
const parked = await markPostgresSchedulerAttemptWaiting(
|
|
157
|
+
input.client,
|
|
158
|
+
{
|
|
159
|
+
runId: claim.runId,
|
|
160
|
+
attempt: claim.number,
|
|
161
|
+
leaseToken: claim.fenceId,
|
|
162
|
+
checkpoint,
|
|
163
|
+
suspension,
|
|
164
|
+
preserveHeartbeatAt: suspension.kind === 'detached_runner',
|
|
165
|
+
},
|
|
166
|
+
options,
|
|
167
|
+
);
|
|
168
|
+
return parked
|
|
169
|
+
? { kind: 'parked', lifecycle: parked }
|
|
170
|
+
: { kind: 'fence_lost' };
|
|
171
|
+
},
|
|
172
|
+
async resumeAfterPark({ claim, suspension }) {
|
|
173
|
+
const resumed = await markPostgresSchedulerAttemptRunning(
|
|
174
|
+
input.client,
|
|
175
|
+
{
|
|
176
|
+
runId: claim.runId,
|
|
177
|
+
attempt: claim.number,
|
|
178
|
+
leaseToken: claim.fenceId,
|
|
179
|
+
preserveHeartbeatAt: suspension.kind === 'detached_runner',
|
|
180
|
+
},
|
|
181
|
+
options,
|
|
182
|
+
);
|
|
183
|
+
return resumed
|
|
184
|
+
? { kind: 'resumed', lifecycle: resumed }
|
|
185
|
+
: { kind: 'fence_lost' };
|
|
186
|
+
},
|
|
187
|
+
async handoffDetachedContinuation({ claim, checkpoint }) {
|
|
188
|
+
if (claim.origin !== 'detached_runner_resume') {
|
|
189
|
+
throw new Error(
|
|
190
|
+
'Only a resumed detached-runner attempt may hand off a fresh continuation.',
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
const handedOff = await handoffPostgresSchedulerAttemptContinuation(
|
|
194
|
+
input.client,
|
|
195
|
+
{
|
|
196
|
+
runId: claim.runId,
|
|
197
|
+
attempt: claim.number,
|
|
198
|
+
leaseToken: claim.fenceId,
|
|
199
|
+
checkpoint,
|
|
200
|
+
},
|
|
201
|
+
options,
|
|
202
|
+
);
|
|
203
|
+
return handedOff
|
|
204
|
+
? { kind: 'handed_off', lifecycle: handedOff }
|
|
205
|
+
: { kind: 'fence_lost' };
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function detachedRunnerSuspension(
|
|
211
|
+
value: unknown,
|
|
212
|
+
): NonNullable<PlayRunAttemptClaim['suspension']> {
|
|
213
|
+
if (
|
|
214
|
+
!value ||
|
|
215
|
+
typeof value !== 'object' ||
|
|
216
|
+
Array.isArray(value) ||
|
|
217
|
+
(value as { kind?: unknown }).kind !== 'detached_runner'
|
|
218
|
+
) {
|
|
219
|
+
throw new Error(
|
|
220
|
+
'Detached Attempt resume was selected without a detached_runner suspension.',
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
const candidate = value as Record<string, unknown>;
|
|
224
|
+
if (
|
|
225
|
+
!Number.isSafeInteger(candidate.runnerAttempt) ||
|
|
226
|
+
typeof candidate.boundaryId !== 'string' ||
|
|
227
|
+
typeof candidate.sandboxId !== 'string' ||
|
|
228
|
+
typeof candidate.sessionId !== 'string' ||
|
|
229
|
+
typeof candidate.cmdId !== 'string' ||
|
|
230
|
+
typeof candidate.outputPath !== 'string' ||
|
|
231
|
+
typeof candidate.exitCodePath !== 'string' ||
|
|
232
|
+
!Number.isFinite(candidate.startedAtMs) ||
|
|
233
|
+
!Number.isFinite(candidate.heartbeatTimeoutMs) ||
|
|
234
|
+
!Number.isFinite(candidate.ceilingMs)
|
|
235
|
+
) {
|
|
236
|
+
throw new Error(
|
|
237
|
+
'Detached Attempt resume found an invalid persisted detached_runner suspension.',
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
return value as NonNullable<PlayRunAttemptClaim['suspension']>;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/** @deprecated Use `createPostgresPlayRunAttemptStore`; the old name retained
|
|
244
|
+
* for the migration while callers move from the claim-only Interface. */
|
|
245
|
+
export const createPostgresPlayRunAttemptFence =
|
|
246
|
+
createPostgresPlayRunAttemptStore;
|
|
247
|
+
|
|
248
|
+
function exhaustedRecoveryTerminal(input: {
|
|
249
|
+
dependency: 'modal' | 'runtime';
|
|
250
|
+
checkpoint: unknown;
|
|
251
|
+
}): PlayRunAttemptTerminalEnvelope {
|
|
252
|
+
// The checkpoint is intentionally not returned to customer output. It is
|
|
253
|
+
// already durable on the run row; the Terminal Module only needs a typed
|
|
254
|
+
// failure envelope to settle first-write-wins truth.
|
|
255
|
+
void input.checkpoint;
|
|
256
|
+
return {
|
|
257
|
+
status: 'failed',
|
|
258
|
+
error:
|
|
259
|
+
`PLATFORM_RECOVERY_EXHAUSTED: ${input.dependency} remained unavailable ` +
|
|
260
|
+
'before customer execution began through the bounded recovery horizon. ' +
|
|
261
|
+
'No customer code was started; inspect and redrive this run after the dependency is healthy.',
|
|
262
|
+
};
|
|
263
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { PlayRunAttemptTerminalEnvelope } from '../../play-runs/attempts/contracts';
|
|
2
|
+
|
|
3
|
+
/** The committed terminal fact used by worker-side read-model projection. */
|
|
4
|
+
export type PlayRunAttemptTerminalCommit =
|
|
5
|
+
| { status: 'completed'; output: unknown }
|
|
6
|
+
| { status: 'failed'; error: string };
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Post-commit effects are deliberately separate from terminal truth. Terminal
|
|
10
|
+
* has already won first-write-wins before this Interface is invoked; these
|
|
11
|
+
* effects improve observability and release ephemeral receipt leases, but
|
|
12
|
+
* cannot alter customer-visible terminal state.
|
|
13
|
+
*/
|
|
14
|
+
export type PlayRunAttemptWorkerTerminalProjectionPort = {
|
|
15
|
+
observeFenceLost(): Promise<void>;
|
|
16
|
+
projectCommitted(input: {
|
|
17
|
+
runnerResult: PlayRunAttemptTerminalEnvelope;
|
|
18
|
+
terminal: PlayRunAttemptTerminalCommit;
|
|
19
|
+
}): Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type PlayRunAttemptWorkerTerminalProjectionPorts = {
|
|
23
|
+
reconcileTerminalTruth(input: {
|
|
24
|
+
runnerResult: PlayRunAttemptTerminalEnvelope;
|
|
25
|
+
terminal: PlayRunAttemptTerminalCommit;
|
|
26
|
+
}): Promise<void>;
|
|
27
|
+
releaseFailedAttempt(input: {
|
|
28
|
+
runnerResult: PlayRunAttemptTerminalEnvelope;
|
|
29
|
+
terminal: Extract<PlayRunAttemptTerminalCommit, { status: 'failed' }>;
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
queueProgressFinalization(input: {
|
|
32
|
+
runnerResult: PlayRunAttemptTerminalEnvelope;
|
|
33
|
+
terminal: PlayRunAttemptTerminalCommit;
|
|
34
|
+
}): void;
|
|
35
|
+
requestTerminalProjection(input: {
|
|
36
|
+
terminal: PlayRunAttemptTerminalCommit;
|
|
37
|
+
}): void;
|
|
38
|
+
observeFenceLost(): Promise<void>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Builds the worker projection Module. The ordering is its Interface:
|
|
43
|
+
* reconcile durable truth, release failed-attempt leases, then enqueue
|
|
44
|
+
* best-effort progress/outbox projection. A stale terminal fence observes the
|
|
45
|
+
* winner only; it never emits a second projection sequence.
|
|
46
|
+
*/
|
|
47
|
+
export function createPlayRunAttemptWorkerTerminalProjection(
|
|
48
|
+
ports: PlayRunAttemptWorkerTerminalProjectionPorts,
|
|
49
|
+
): PlayRunAttemptWorkerTerminalProjectionPort {
|
|
50
|
+
return {
|
|
51
|
+
observeFenceLost: ports.observeFenceLost,
|
|
52
|
+
async projectCommitted(input) {
|
|
53
|
+
await ports.reconcileTerminalTruth(input);
|
|
54
|
+
if (input.terminal.status === 'failed') {
|
|
55
|
+
await ports.releaseFailedAttempt({
|
|
56
|
+
runnerResult: input.runnerResult,
|
|
57
|
+
terminal: input.terminal,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
ports.queueProgressFinalization(input);
|
|
61
|
+
ports.requestTerminalProjection({ terminal: input.terminal });
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run Ledger Projection is the delivery job for already-committed Runtime
|
|
3
|
+
* Postgres outbox facts. It never decides a Play Run's terminal state and it
|
|
4
|
+
* never re-executes a Play.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** A caller may ask the durable outbox to advance through one exact event. */
|
|
8
|
+
export type RunLedgerProjectionInput = {
|
|
9
|
+
/** Omit to advance the next claimable outbox fact. */
|
|
10
|
+
targetEventId?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Durable delivery counters. `targetDelivered` is meaningful only for a
|
|
15
|
+
* targeted call; callers must not infer it from `projected`.
|
|
16
|
+
*/
|
|
17
|
+
export type RunLedgerProjectionStats = {
|
|
18
|
+
attempted: number;
|
|
19
|
+
projected: number;
|
|
20
|
+
failed: number;
|
|
21
|
+
retrying: number;
|
|
22
|
+
failedEventIds: string[];
|
|
23
|
+
targetEventId?: string;
|
|
24
|
+
targetDelivered?: boolean;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type RunLedgerProjectionJob = {
|
|
28
|
+
deliver(input?: RunLedgerProjectionInput): Promise<RunLedgerProjectionStats>;
|
|
29
|
+
};
|
package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/gateway-adapter.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { WorkerRuntimeApiContext } from '../../app-runtime-api';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
dispatchRunLedgerOutboxToLedgerBatchOnceWithClientScope,
|
|
5
|
+
dispatchRunLedgerOutboxToLedgerThroughEventWithClientScope,
|
|
6
|
+
type PostgresSchedulerOptions,
|
|
7
|
+
type PostgresSchedulerOutboxDrainResult,
|
|
8
|
+
type PostgresSchedulerQueryClient,
|
|
9
|
+
} from '../../scheduler-backends/postgres';
|
|
10
|
+
|
|
11
|
+
import type { RunLedgerProjectionPorts } from '../../play-runs/projection/ports';
|
|
12
|
+
|
|
13
|
+
export type GatewayRunLedgerProjectionAdapterInput = {
|
|
14
|
+
runId: string;
|
|
15
|
+
runtimeApi: WorkerRuntimeApiContext;
|
|
16
|
+
withClient: <T>(
|
|
17
|
+
operation: (client: PostgresSchedulerQueryClient) => Promise<T>,
|
|
18
|
+
) => Promise<T>;
|
|
19
|
+
schedulerOptions?: Pick<PostgresSchedulerOptions, 'schema'>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Gateway Adapter for the durable Run Ledger outbox. It retains the worker's
|
|
24
|
+
* no-signing-key rule and turns both normal and targeted delivery into the
|
|
25
|
+
* one `RunLedgerProjection.deliver` port.
|
|
26
|
+
*/
|
|
27
|
+
export function createGatewayRunLedgerProjectionAdapter(
|
|
28
|
+
input: GatewayRunLedgerProjectionAdapterInput,
|
|
29
|
+
): RunLedgerProjectionPorts['outbox'] {
|
|
30
|
+
const options = input.schedulerOptions ?? {};
|
|
31
|
+
const dispatchInput = {
|
|
32
|
+
runId: input.runId,
|
|
33
|
+
runtimeApi: input.runtimeApi,
|
|
34
|
+
tokenAuthority: 'gateway' as const,
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
async deliver(request) {
|
|
38
|
+
if (request.targetEventId) {
|
|
39
|
+
return await dispatchRunLedgerOutboxToLedgerThroughEventWithClientScope(
|
|
40
|
+
input.withClient,
|
|
41
|
+
{ ...dispatchInput, targetEventId: request.targetEventId },
|
|
42
|
+
options,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
return await dispatchRunLedgerOutboxToLedgerBatchOnceWithClientScope(
|
|
46
|
+
input.withClient,
|
|
47
|
+
dispatchInput,
|
|
48
|
+
options,
|
|
49
|
+
);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** The targeted scheduler result has all public projection counters. */
|
|
55
|
+
export type GatewayRunLedgerProjectionResult =
|
|
56
|
+
PostgresSchedulerOutboxDrainResult;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { createRunLedgerProjectionJob } from '../../play-runs/projection/job';
|
|
2
|
+
export {
|
|
3
|
+
createGatewayRunLedgerProjectionAdapter,
|
|
4
|
+
type GatewayRunLedgerProjectionAdapterInput,
|
|
5
|
+
type GatewayRunLedgerProjectionResult,
|
|
6
|
+
} from '../../play-runs/projection/gateway-adapter';
|
|
7
|
+
export type {
|
|
8
|
+
RunLedgerProjectionInput,
|
|
9
|
+
RunLedgerProjectionJob,
|
|
10
|
+
RunLedgerProjectionStats,
|
|
11
|
+
} from '../../play-runs/projection/contracts';
|
|
12
|
+
export type {
|
|
13
|
+
RunLedgerOutboxDelivery,
|
|
14
|
+
RunLedgerProjectionPorts,
|
|
15
|
+
} from '../../play-runs/projection/ports';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
RunLedgerProjectionInput,
|
|
3
|
+
RunLedgerProjectionJob,
|
|
4
|
+
RunLedgerProjectionStats,
|
|
5
|
+
} from '../../play-runs/projection/contracts';
|
|
6
|
+
import type { RunLedgerProjectionPorts } from '../../play-runs/projection/ports';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Creates the Run Ledger Projection job.
|
|
10
|
+
*
|
|
11
|
+
* A target is a delivery observation, not a second queue. In particular, a
|
|
12
|
+
* target that remains pending must return the adapter's durable retry result
|
|
13
|
+
* rather than causing the caller to append or retry an event itself.
|
|
14
|
+
*/
|
|
15
|
+
export function createRunLedgerProjectionJob(
|
|
16
|
+
ports: RunLedgerProjectionPorts,
|
|
17
|
+
): RunLedgerProjectionJob {
|
|
18
|
+
return {
|
|
19
|
+
async deliver(
|
|
20
|
+
input: RunLedgerProjectionInput = {},
|
|
21
|
+
): Promise<RunLedgerProjectionStats> {
|
|
22
|
+
if (input.targetEventId !== undefined && !input.targetEventId.trim()) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
'Run Ledger Projection target event id must be non-empty when supplied.',
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const result = await ports.outbox.deliver(input);
|
|
29
|
+
validateStats(result, input);
|
|
30
|
+
return result;
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function validateStats(
|
|
36
|
+
result: RunLedgerProjectionStats,
|
|
37
|
+
input: RunLedgerProjectionInput,
|
|
38
|
+
): void {
|
|
39
|
+
for (const value of [
|
|
40
|
+
result.attempted,
|
|
41
|
+
result.projected,
|
|
42
|
+
result.failed,
|
|
43
|
+
result.retrying,
|
|
44
|
+
]) {
|
|
45
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
46
|
+
throw new Error(
|
|
47
|
+
'Run Ledger Projection adapter returned invalid delivery counters.',
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!Array.isArray(result.failedEventIds)) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
'Run Ledger Projection adapter returned invalid failed event ids.',
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
if (
|
|
57
|
+
input.targetEventId !== undefined &&
|
|
58
|
+
result.targetEventId !== undefined &&
|
|
59
|
+
result.targetEventId !== input.targetEventId
|
|
60
|
+
) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
'Run Ledger Projection adapter returned delivery stats for a different target event.',
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
RunLedgerProjectionInput,
|
|
3
|
+
RunLedgerProjectionStats,
|
|
4
|
+
} from '../../play-runs/projection/contracts';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The only infrastructure capability this job needs. The adapter owns the
|
|
8
|
+
* Postgres claim, ordered append, delivery idempotency, and durable retry
|
|
9
|
+
* clock; this job gives callers one stable Interface over that capability.
|
|
10
|
+
*/
|
|
11
|
+
export type RunLedgerOutboxDelivery = {
|
|
12
|
+
deliver(input: RunLedgerProjectionInput): Promise<RunLedgerProjectionStats>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type RunLedgerProjectionPorts = {
|
|
16
|
+
outbox: RunLedgerOutboxDelivery;
|
|
17
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sandbox Cleanup reconciles one already-claimed physical resource. It begins
|
|
3
|
+
* after a resource fact and cleanup obligation exist; it neither creates a
|
|
4
|
+
* sandbox nor decides a Play Run terminal state.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export type SandboxCleanupResource = {
|
|
8
|
+
provider: 'daytona' | 'modal';
|
|
9
|
+
sandboxId: string;
|
|
10
|
+
routingDomain: string | null;
|
|
11
|
+
runId: string;
|
|
12
|
+
attempt: number;
|
|
13
|
+
cleanupAttempt: number;
|
|
14
|
+
failureCount: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type SandboxCleanupDeleteOutcome =
|
|
18
|
+
| { kind: 'deleted'; routingDomain: string | null }
|
|
19
|
+
| { kind: 'already_absent'; routingDomain: string | null }
|
|
20
|
+
/** The provider outcome is ambiguous or failed; its resource remains live. */
|
|
21
|
+
| { kind: 'failed'; code: string; detail: string };
|
|
22
|
+
|
|
23
|
+
export type SandboxCleanupInput = {
|
|
24
|
+
resource: SandboxCleanupResource;
|
|
25
|
+
timeoutMs: number;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type SandboxCleanupOutcome =
|
|
29
|
+
| {
|
|
30
|
+
kind: 'completed';
|
|
31
|
+
providerOutcome: 'deleted' | 'already_absent';
|
|
32
|
+
/** The durable claim transition which settled this provider fact. */
|
|
33
|
+
completion: 'completed' | 'late_success_accepted' | 'already_deleted';
|
|
34
|
+
}
|
|
35
|
+
| { kind: 'completion_rejected'; completion: 'missing_obligation' }
|
|
36
|
+
| { kind: 'blocked'; reason: string }
|
|
37
|
+
| { kind: 'retry_scheduled'; retryAfterMs: number }
|
|
38
|
+
| { kind: 'retry_rejected' };
|
|
39
|
+
|
|
40
|
+
export type SandboxCleanupJob = {
|
|
41
|
+
reconcile(input: SandboxCleanupInput): Promise<SandboxCleanupOutcome>;
|
|
42
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { createSandboxCleanupJob } from '../../play-runs/sandbox-cleanup/job';
|
|
2
|
+
export {
|
|
3
|
+
createPostgresSandboxCleanupStore,
|
|
4
|
+
type SandboxCleanupPostgresAdapterInput,
|
|
5
|
+
} from '../../play-runs/sandbox-cleanup/postgres-adapter';
|
|
6
|
+
export type {
|
|
7
|
+
SandboxCleanupDeleteOutcome,
|
|
8
|
+
SandboxCleanupInput,
|
|
9
|
+
SandboxCleanupJob,
|
|
10
|
+
SandboxCleanupOutcome,
|
|
11
|
+
SandboxCleanupResource,
|
|
12
|
+
} from '../../play-runs/sandbox-cleanup/contracts';
|
|
13
|
+
export type {
|
|
14
|
+
SandboxCleanupPorts,
|
|
15
|
+
SandboxCleanupStore,
|
|
16
|
+
SandboxDeletion,
|
|
17
|
+
} from '../../play-runs/sandbox-cleanup/ports';
|