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/admission/postgres-adapter.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
submitPostgresAbsurdPlayRun,
|
|
3
|
+
type PostgresSchedulerQueryClient,
|
|
4
|
+
} from '../../scheduler-backends/postgres';
|
|
5
|
+
import {
|
|
6
|
+
PlayRunLaunchConflictError,
|
|
7
|
+
type PlayRunAdmissionInput,
|
|
8
|
+
type PlayRunAdmissionReceipt,
|
|
9
|
+
} from '../../play-runs/admission/contracts';
|
|
10
|
+
import type { PlayRunAdmissionPorts } from '../../play-runs/admission/ports';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* PostgreSQL/Absurd implementation of the admission seam. The delegated
|
|
14
|
+
* statement persists `runs` and invokes `absurd.spawn_task` in one data-
|
|
15
|
+
* modifying CTE; no caller can observe a persisted runnable Play Run without
|
|
16
|
+
* its corresponding queue task.
|
|
17
|
+
*/
|
|
18
|
+
export function createPostgresPlayRunAdmissionPorts(input: {
|
|
19
|
+
client: PostgresSchedulerQueryClient;
|
|
20
|
+
schema?: string;
|
|
21
|
+
}): PlayRunAdmissionPorts {
|
|
22
|
+
const options = input.schema ? { schema: input.schema } : undefined;
|
|
23
|
+
return {
|
|
24
|
+
atomicQueueSubmitter: {
|
|
25
|
+
async submit(
|
|
26
|
+
admission: PlayRunAdmissionInput,
|
|
27
|
+
): Promise<PlayRunAdmissionReceipt> {
|
|
28
|
+
try {
|
|
29
|
+
return await submitPostgresAbsurdPlayRun(
|
|
30
|
+
input.client,
|
|
31
|
+
admission.launch,
|
|
32
|
+
options,
|
|
33
|
+
admission.queueName,
|
|
34
|
+
admission.recoverExistingTask === true,
|
|
35
|
+
);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
if (isLaunchConflict(error)) {
|
|
38
|
+
throw new PlayRunLaunchConflictError(admission.launch.runId, {
|
|
39
|
+
cause: error,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function isLaunchConflict(error: unknown): boolean {
|
|
50
|
+
return (
|
|
51
|
+
error instanceof Error &&
|
|
52
|
+
/already exists with a different launch/i.test(error.message)
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Play Run Attempt is the controller for one fenced execution leg.
|
|
3
|
+
*
|
|
4
|
+
* It deliberately does not know how a sandbox is created, how a runner is
|
|
5
|
+
* started, or how a terminal transaction is committed. Its only policy is
|
|
6
|
+
* the retry boundary: work known not to have crossed into user/provider code
|
|
7
|
+
* may be deferred; once that boundary may have been crossed, this job never
|
|
8
|
+
* asks Sandbox Runs to execute again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** The already-persisted run details required by this leg. */
|
|
12
|
+
export type PlayRunAttemptLaunch = {
|
|
13
|
+
runId: string;
|
|
14
|
+
/** Opaque to the attempt job; consumed by its execution implementation. */
|
|
15
|
+
launch: unknown;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
import type { PlayExecutionSuspension } from '../../suspension';
|
|
19
|
+
import type { PlayRunRecoveryDecision } from '../../play-run-recovery-policy';
|
|
20
|
+
|
|
21
|
+
/** A scheduler fence granted to exactly one execution leg. */
|
|
22
|
+
export type PlayRunAttemptClaim = {
|
|
23
|
+
runId: string;
|
|
24
|
+
number: number;
|
|
25
|
+
/** Opaque authority used by scheduler/resource/terminal Adapters. */
|
|
26
|
+
fenceId: string;
|
|
27
|
+
checkpoint: unknown;
|
|
28
|
+
/**
|
|
29
|
+
* A detached runner keeps its original attempt-scoped executor token. A
|
|
30
|
+
* heartbeat wake must therefore reuse this claim rather than minting a
|
|
31
|
+
* successor that would fence its still-live runner out of heartbeats and
|
|
32
|
+
* terminal delivery.
|
|
33
|
+
*/
|
|
34
|
+
origin: 'fresh' | 'detached_runner_resume';
|
|
35
|
+
/** Present only for an origin that resumed a detached runner. */
|
|
36
|
+
suspension?: Extract<PlayExecutionSuspension, { kind: 'detached_runner' }>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** A durable waiting/resumed lifecycle fact ready for read-model projection. */
|
|
40
|
+
export type PlayRunAttemptLifecycle = {
|
|
41
|
+
runId: string;
|
|
42
|
+
eventId: string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** Durable truth read before a new attempt may be claimed. */
|
|
46
|
+
export type PlayRunAttemptTerminal = {
|
|
47
|
+
status: 'completed' | 'failed' | 'cancelled';
|
|
48
|
+
output?: unknown;
|
|
49
|
+
error?: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type PlayRunAttemptInput = {
|
|
53
|
+
run: PlayRunAttemptLaunch;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Sandbox Runs reports whether user/provider code was crossed. The payload
|
|
58
|
+
* is opaque here because only the terminal job owns interpretation and
|
|
59
|
+
* persistence of a runner result.
|
|
60
|
+
*/
|
|
61
|
+
/**
|
|
62
|
+
* Evidence that no customer or provider code has begun. It is intentionally
|
|
63
|
+
* distinct from an ordinary thrown error: only these outcomes may put a run
|
|
64
|
+
* back into durable admission.
|
|
65
|
+
*/
|
|
66
|
+
export type PlayRunAttemptPreCodeDeferral =
|
|
67
|
+
| { kind: 'capacity'; reason: string }
|
|
68
|
+
| {
|
|
69
|
+
kind: 'recovery';
|
|
70
|
+
reason: string;
|
|
71
|
+
decision: PlayRunRecoveryDecision;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The runner-to-terminal transport envelope. Attempt never interprets this
|
|
76
|
+
* result; Terminal owns first-write-wins persistence and result shaping.
|
|
77
|
+
*/
|
|
78
|
+
export type PlayRunAttemptTerminalEnvelope =
|
|
79
|
+
| { status: 'completed'; output: unknown }
|
|
80
|
+
| { status: 'failed'; error: string };
|
|
81
|
+
|
|
82
|
+
export type PlayRunAttemptSandboxOutcome =
|
|
83
|
+
| { kind: 'pre_code_deferred'; deferral: PlayRunAttemptPreCodeDeferral }
|
|
84
|
+
| {
|
|
85
|
+
kind: 'suspended';
|
|
86
|
+
checkpoint: unknown;
|
|
87
|
+
suspension: PlayExecutionSuspension;
|
|
88
|
+
}
|
|
89
|
+
| { kind: 'terminal'; result: PlayRunAttemptTerminalEnvelope }
|
|
90
|
+
| { kind: 'post_code_unknown'; reason: string };
|
|
91
|
+
|
|
92
|
+
export type PlayRunAttemptTerminalHandoff =
|
|
93
|
+
| { kind: 'committed' }
|
|
94
|
+
| { kind: 'already_terminal' }
|
|
95
|
+
| { kind: 'fence_lost' };
|
|
96
|
+
|
|
97
|
+
/** Outcomes visible to the worker Adapter after one execution leg. */
|
|
98
|
+
export type PlayRunAttemptOutcome =
|
|
99
|
+
| { kind: 'already_terminal'; terminal: PlayRunAttemptTerminal }
|
|
100
|
+
| { kind: 'claim_rejected' }
|
|
101
|
+
| { kind: 'pre_code_deferred'; deferral: PlayRunAttemptPreCodeDeferral }
|
|
102
|
+
| {
|
|
103
|
+
kind: 'parked';
|
|
104
|
+
checkpoint: unknown;
|
|
105
|
+
suspension: PlayExecutionSuspension;
|
|
106
|
+
}
|
|
107
|
+
| { kind: 'post_code_unknown'; reason: string }
|
|
108
|
+
| { kind: 'terminal_committed' }
|
|
109
|
+
| { kind: 'terminal_already_committed' }
|
|
110
|
+
| { kind: 'terminal_fence_lost' };
|
|
111
|
+
|
|
112
|
+
export type PlayRunAttemptJob = {
|
|
113
|
+
execute(input: PlayRunAttemptInput): Promise<PlayRunAttemptOutcome>;
|
|
114
|
+
};
|
package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/engine-suspension.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PlayRunAttemptClaim,
|
|
3
|
+
PlayRunAttemptLaunch,
|
|
4
|
+
PlayRunAttemptLifecycle,
|
|
5
|
+
} from '../../play-runs/attempts/contracts';
|
|
6
|
+
import type { PlayRunAttemptStore } from '../../play-runs/attempts/ports';
|
|
7
|
+
import type { PlayExecutionSuspension } from '../../suspension';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The durable task engine is an Adapter, not Attempt policy. It maps a
|
|
11
|
+
* persisted Play suspension to a sleep/event/heartbeat primitive and reports
|
|
12
|
+
* whether the primitive parked this handler or resolved on this invocation.
|
|
13
|
+
*
|
|
14
|
+
* An Absurd Adapter retains the actual control signal until its ingress has
|
|
15
|
+
* handled the semantic `parked` outcome, then rethrows it. This separates the
|
|
16
|
+
* engine's transport exception from the Attempt Module's transition law.
|
|
17
|
+
*/
|
|
18
|
+
export type PlayRunAttemptEngineSuspensionPort = {
|
|
19
|
+
resolve(input: {
|
|
20
|
+
run: PlayRunAttemptLaunch;
|
|
21
|
+
attempt: PlayRunAttemptClaim;
|
|
22
|
+
checkpoint: unknown;
|
|
23
|
+
suspension: PlayExecutionSuspension;
|
|
24
|
+
}): Promise<{ kind: 'parked' } | { kind: 'resolved'; checkpoint: unknown }>;
|
|
25
|
+
/** Re-emit the engine-specific park signal captured by `resolve`. */
|
|
26
|
+
rethrowParked(): never;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type PlayRunAttemptSuspensionOutcome =
|
|
30
|
+
| { kind: 'fence_lost'; stage: 'park' | 'resume' | 'handoff' }
|
|
31
|
+
| { kind: 'parked' }
|
|
32
|
+
| { kind: 'resumed'; checkpoint: unknown }
|
|
33
|
+
| { kind: 'continuation_handed_off'; checkpoint: unknown };
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Owns the durable transition law around an engine suspension:
|
|
37
|
+
*
|
|
38
|
+
* running -> waiting -> engine park|wake -> running|fresh continuation
|
|
39
|
+
*
|
|
40
|
+
* A detached runner which itself reaches a normal Play suspension cannot
|
|
41
|
+
* reuse its terminal slot; it is handed off to a fresh attempt. All other
|
|
42
|
+
* wakes retain their exact fence.
|
|
43
|
+
*/
|
|
44
|
+
export function createPlayRunAttemptSuspensionJob(ports: {
|
|
45
|
+
store: PlayRunAttemptStore;
|
|
46
|
+
engine: PlayRunAttemptEngineSuspensionPort;
|
|
47
|
+
lifecycle?: {
|
|
48
|
+
waiting(lifecycle: PlayRunAttemptLifecycle): Promise<void>;
|
|
49
|
+
resumed(lifecycle: PlayRunAttemptLifecycle): Promise<void>;
|
|
50
|
+
};
|
|
51
|
+
}) {
|
|
52
|
+
return {
|
|
53
|
+
async resolve(input: {
|
|
54
|
+
run: PlayRunAttemptLaunch;
|
|
55
|
+
attempt: PlayRunAttemptClaim;
|
|
56
|
+
checkpoint: unknown;
|
|
57
|
+
suspension: PlayExecutionSuspension;
|
|
58
|
+
/** The current runner result was read from a previously detached runner. */
|
|
59
|
+
fromDetachedRunner: boolean;
|
|
60
|
+
}): Promise<PlayRunAttemptSuspensionOutcome> {
|
|
61
|
+
const parked = await ports.store.park({
|
|
62
|
+
claim: input.attempt,
|
|
63
|
+
checkpoint: input.checkpoint,
|
|
64
|
+
suspension: input.suspension,
|
|
65
|
+
});
|
|
66
|
+
if (parked.kind === 'fence_lost') {
|
|
67
|
+
return { kind: 'fence_lost', stage: 'park' };
|
|
68
|
+
}
|
|
69
|
+
await ports.lifecycle?.waiting(parked.lifecycle);
|
|
70
|
+
|
|
71
|
+
const engineOutcome = await ports.engine.resolve({
|
|
72
|
+
run: input.run,
|
|
73
|
+
attempt: input.attempt,
|
|
74
|
+
checkpoint: input.checkpoint,
|
|
75
|
+
suspension: input.suspension,
|
|
76
|
+
});
|
|
77
|
+
if (engineOutcome.kind === 'parked') return engineOutcome;
|
|
78
|
+
|
|
79
|
+
if (
|
|
80
|
+
input.fromDetachedRunner &&
|
|
81
|
+
input.suspension.kind !== 'detached_runner'
|
|
82
|
+
) {
|
|
83
|
+
const handedOff = await ports.store.handoffDetachedContinuation({
|
|
84
|
+
claim: input.attempt,
|
|
85
|
+
checkpoint: engineOutcome.checkpoint,
|
|
86
|
+
});
|
|
87
|
+
if (handedOff.kind === 'fence_lost') {
|
|
88
|
+
return { kind: 'fence_lost', stage: 'handoff' };
|
|
89
|
+
}
|
|
90
|
+
await ports.lifecycle?.resumed(handedOff.lifecycle);
|
|
91
|
+
return {
|
|
92
|
+
kind: 'continuation_handed_off',
|
|
93
|
+
checkpoint: engineOutcome.checkpoint,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const resumed = await ports.store.resumeAfterPark({
|
|
98
|
+
claim: input.attempt,
|
|
99
|
+
suspension: input.suspension,
|
|
100
|
+
});
|
|
101
|
+
if (resumed.kind === 'fence_lost') {
|
|
102
|
+
return { kind: 'fence_lost', stage: 'resume' };
|
|
103
|
+
}
|
|
104
|
+
await ports.lifecycle?.resumed(resumed.lifecycle);
|
|
105
|
+
return { kind: 'resumed', checkpoint: engineOutcome.checkpoint };
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export { createPlayRunAttemptJob } from '../../play-runs/attempts/job';
|
|
2
|
+
export {
|
|
3
|
+
createPlayRunAttemptSuspensionJob,
|
|
4
|
+
type PlayRunAttemptEngineSuspensionPort,
|
|
5
|
+
type PlayRunAttemptSuspensionOutcome,
|
|
6
|
+
} from '../../play-runs/attempts/engine-suspension';
|
|
7
|
+
export {
|
|
8
|
+
createPlayRunAttemptWorkerTerminalProjection,
|
|
9
|
+
type PlayRunAttemptTerminalCommit,
|
|
10
|
+
type PlayRunAttemptWorkerTerminalProjectionPort,
|
|
11
|
+
type PlayRunAttemptWorkerTerminalProjectionPorts,
|
|
12
|
+
} from '../../play-runs/attempts/worker-terminal-projection';
|
|
13
|
+
export {
|
|
14
|
+
createPostgresPlayRunAttemptFence,
|
|
15
|
+
createPostgresPlayRunAttemptStore,
|
|
16
|
+
type PostgresPlayRunAttemptStore,
|
|
17
|
+
} from '../../play-runs/attempts/postgres-fence-adapter';
|
|
18
|
+
export type {
|
|
19
|
+
PlayRunAttemptClaim,
|
|
20
|
+
PlayRunAttemptInput,
|
|
21
|
+
PlayRunAttemptJob,
|
|
22
|
+
PlayRunAttemptLaunch,
|
|
23
|
+
PlayRunAttemptLifecycle,
|
|
24
|
+
PlayRunAttemptOutcome,
|
|
25
|
+
PlayRunAttemptPreCodeDeferral,
|
|
26
|
+
PlayRunAttemptSandboxOutcome,
|
|
27
|
+
PlayRunAttemptTerminal,
|
|
28
|
+
PlayRunAttemptTerminalEnvelope,
|
|
29
|
+
PlayRunAttemptTerminalHandoff,
|
|
30
|
+
} from '../../play-runs/attempts/contracts';
|
|
31
|
+
export type {
|
|
32
|
+
PlayRunAttemptPorts,
|
|
33
|
+
PlayRunAttemptStore,
|
|
34
|
+
PlayRunTerminalPort,
|
|
35
|
+
SandboxRunsPort,
|
|
36
|
+
} from '../../play-runs/attempts/ports';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PlayRunAttemptInput,
|
|
3
|
+
PlayRunAttemptJob,
|
|
4
|
+
PlayRunAttemptOutcome,
|
|
5
|
+
} from '../../play-runs/attempts/contracts';
|
|
6
|
+
import type { PlayRunAttemptPorts } from '../../play-runs/attempts/ports';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Builds the Play Run Attempt job.
|
|
10
|
+
*
|
|
11
|
+
* The ordering is the contract:
|
|
12
|
+
*
|
|
13
|
+
* terminal read -> fenced claim -> Sandbox Runs -> Terminal | park | defer
|
|
14
|
+
*
|
|
15
|
+
* A post-code-unknown outcome is intentionally returned to the caller rather
|
|
16
|
+
* than converted to a retry. A later recovery leg must resolve durable
|
|
17
|
+
* runner/resource facts; replaying here risks duplicate provider work.
|
|
18
|
+
*/
|
|
19
|
+
export function createPlayRunAttemptJob(
|
|
20
|
+
ports: PlayRunAttemptPorts,
|
|
21
|
+
): PlayRunAttemptJob {
|
|
22
|
+
return {
|
|
23
|
+
async execute(input: PlayRunAttemptInput): Promise<PlayRunAttemptOutcome> {
|
|
24
|
+
validate(input);
|
|
25
|
+
const terminal = await ports.store.readTerminal({
|
|
26
|
+
runId: input.run.runId,
|
|
27
|
+
});
|
|
28
|
+
if (terminal) return { kind: 'already_terminal', terminal };
|
|
29
|
+
|
|
30
|
+
// A detached runner owns an attempt-scoped executor token. Its heartbeat
|
|
31
|
+
// wake must see that exact claim before ordinary allocation is allowed.
|
|
32
|
+
const claim =
|
|
33
|
+
(await ports.store.resumeDetached(input.run)) ??
|
|
34
|
+
(await ports.store.claim(input.run));
|
|
35
|
+
if (claim === null) return { kind: 'claim_rejected' };
|
|
36
|
+
|
|
37
|
+
const sandbox = await ports.sandboxRuns.execute({
|
|
38
|
+
run: input.run,
|
|
39
|
+
attempt: claim,
|
|
40
|
+
});
|
|
41
|
+
switch (sandbox.kind) {
|
|
42
|
+
case 'pre_code_deferred':
|
|
43
|
+
const deferred = await ports.store.deferBeforeCode({
|
|
44
|
+
claim,
|
|
45
|
+
deferral: sandbox.deferral,
|
|
46
|
+
});
|
|
47
|
+
if (deferred.kind === 'deferred') return sandbox;
|
|
48
|
+
if (deferred.kind === 'fence_lost') return { kind: 'claim_rejected' };
|
|
49
|
+
const terminalResult = await ports.terminal.accept({
|
|
50
|
+
attempt: claim,
|
|
51
|
+
result: deferred.terminal,
|
|
52
|
+
});
|
|
53
|
+
return terminalResult.kind === 'committed'
|
|
54
|
+
? { kind: 'terminal_committed' }
|
|
55
|
+
: terminalResult.kind === 'already_terminal'
|
|
56
|
+
? { kind: 'terminal_already_committed' }
|
|
57
|
+
: { kind: 'terminal_fence_lost' };
|
|
58
|
+
case 'suspended': {
|
|
59
|
+
const parked = await ports.store.park({
|
|
60
|
+
claim,
|
|
61
|
+
checkpoint: sandbox.checkpoint,
|
|
62
|
+
suspension: sandbox.suspension,
|
|
63
|
+
});
|
|
64
|
+
return parked.kind === 'parked'
|
|
65
|
+
? {
|
|
66
|
+
kind: 'parked',
|
|
67
|
+
checkpoint: sandbox.checkpoint,
|
|
68
|
+
suspension: sandbox.suspension,
|
|
69
|
+
}
|
|
70
|
+
: { kind: 'claim_rejected' };
|
|
71
|
+
}
|
|
72
|
+
case 'post_code_unknown':
|
|
73
|
+
return sandbox;
|
|
74
|
+
case 'terminal': {
|
|
75
|
+
const terminalResult = await ports.terminal.accept({
|
|
76
|
+
attempt: claim,
|
|
77
|
+
result: sandbox.result,
|
|
78
|
+
});
|
|
79
|
+
switch (terminalResult.kind) {
|
|
80
|
+
case 'committed':
|
|
81
|
+
return { kind: 'terminal_committed' };
|
|
82
|
+
case 'already_terminal':
|
|
83
|
+
return { kind: 'terminal_already_committed' };
|
|
84
|
+
case 'fence_lost':
|
|
85
|
+
return { kind: 'terminal_fence_lost' };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function validate(input: PlayRunAttemptInput): void {
|
|
94
|
+
if (!input.run.runId.trim()) {
|
|
95
|
+
throw new Error('Play Run Attempt requires a non-empty run id.');
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PlayRunAttemptClaim,
|
|
3
|
+
PlayRunAttemptLaunch,
|
|
4
|
+
PlayRunAttemptLifecycle,
|
|
5
|
+
PlayRunAttemptPreCodeDeferral,
|
|
6
|
+
PlayRunAttemptSandboxOutcome,
|
|
7
|
+
PlayRunAttemptTerminalEnvelope,
|
|
8
|
+
PlayRunAttemptTerminal,
|
|
9
|
+
PlayRunAttemptTerminalHandoff,
|
|
10
|
+
} from '../../play-runs/attempts/contracts';
|
|
11
|
+
import type { PlayExecutionSuspension } from '../../suspension';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Scheduler state belongs on this seam. It intentionally combines allocate
|
|
15
|
+
* and assign: an attempt number without its write fence is not usable work.
|
|
16
|
+
*/
|
|
17
|
+
export type PlayRunAttemptStore = {
|
|
18
|
+
readTerminal(input: {
|
|
19
|
+
runId: string;
|
|
20
|
+
}): Promise<PlayRunAttemptTerminal | null>;
|
|
21
|
+
claim(input: PlayRunAttemptLaunch): Promise<PlayRunAttemptClaim | null>;
|
|
22
|
+
/**
|
|
23
|
+
* Reuses the fence held by a parked detached runner. This read is separate
|
|
24
|
+
* from `claim` because every other parked suspension must receive a fresh
|
|
25
|
+
* generation after its engine wake.
|
|
26
|
+
*/
|
|
27
|
+
resumeDetached(
|
|
28
|
+
input: PlayRunAttemptLaunch,
|
|
29
|
+
): Promise<PlayRunAttemptClaim | null>;
|
|
30
|
+
/** Only proven pre-code work may be returned to scheduler admission. */
|
|
31
|
+
deferBeforeCode(input: {
|
|
32
|
+
claim: PlayRunAttemptClaim;
|
|
33
|
+
deferral: PlayRunAttemptPreCodeDeferral;
|
|
34
|
+
}): Promise<
|
|
35
|
+
| { kind: 'deferred' }
|
|
36
|
+
| { kind: 'exhausted'; terminal: PlayRunAttemptTerminalEnvelope }
|
|
37
|
+
| { kind: 'fence_lost' }
|
|
38
|
+
>;
|
|
39
|
+
/**
|
|
40
|
+
* Stores a safe continuation without inventing a new attempt generation.
|
|
41
|
+
* The store, rather than callers, derives detached-runner heartbeat rules
|
|
42
|
+
* from the typed suspension.
|
|
43
|
+
*/
|
|
44
|
+
park(input: {
|
|
45
|
+
claim: PlayRunAttemptClaim;
|
|
46
|
+
checkpoint: unknown;
|
|
47
|
+
suspension: PlayExecutionSuspension;
|
|
48
|
+
}): Promise<
|
|
49
|
+
| { kind: 'parked'; lifecycle: PlayRunAttemptLifecycle }
|
|
50
|
+
| { kind: 'fence_lost' }
|
|
51
|
+
>;
|
|
52
|
+
/** Transition a non-detached parked attempt back to running. */
|
|
53
|
+
resumeAfterPark(input: {
|
|
54
|
+
claim: PlayRunAttemptClaim;
|
|
55
|
+
suspension: PlayExecutionSuspension;
|
|
56
|
+
}): Promise<
|
|
57
|
+
| { kind: 'resumed'; lifecycle: PlayRunAttemptLifecycle }
|
|
58
|
+
| { kind: 'fence_lost' }
|
|
59
|
+
>;
|
|
60
|
+
/**
|
|
61
|
+
* A detached runner that produces another suspension cannot reuse its
|
|
62
|
+
* terminal slot. Retire it and return its checkpoint to durable admission.
|
|
63
|
+
*/
|
|
64
|
+
handoffDetachedContinuation(input: {
|
|
65
|
+
claim: PlayRunAttemptClaim;
|
|
66
|
+
checkpoint: unknown;
|
|
67
|
+
}): Promise<
|
|
68
|
+
| { kind: 'handed_off'; lifecycle: PlayRunAttemptLifecycle }
|
|
69
|
+
| { kind: 'fence_lost' }
|
|
70
|
+
>;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The physical execution-resource Module; it never settles the Play Run.
|
|
75
|
+
*
|
|
76
|
+
* This is the proposed live-worker routing seam. An Absurd Adapter will own
|
|
77
|
+
* one complete runner leg: config/materialization, resource facts, runner
|
|
78
|
+
* start or detached-terminal observation, and engine-context suspension
|
|
79
|
+
* resolution. It reports only these semantic outcomes here. In particular it
|
|
80
|
+
* must report `pre_code_deferred` only with proof that no runner/customer code
|
|
81
|
+
* could have started, and must report `post_code_unknown` rather than replay
|
|
82
|
+
* an ambiguous runner command. The Attempt Module then owns the only durable
|
|
83
|
+
* transition allowed for each outcome.
|
|
84
|
+
*/
|
|
85
|
+
export type SandboxRunsPort = {
|
|
86
|
+
execute(input: {
|
|
87
|
+
run: PlayRunAttemptLaunch;
|
|
88
|
+
attempt: PlayRunAttemptClaim;
|
|
89
|
+
}): Promise<PlayRunAttemptSandboxOutcome>;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/** The durable terminal Module; it owns first-write-wins terminal truth. */
|
|
93
|
+
export type PlayRunTerminalPort = {
|
|
94
|
+
accept(input: {
|
|
95
|
+
attempt: PlayRunAttemptClaim;
|
|
96
|
+
result: PlayRunAttemptTerminalEnvelope;
|
|
97
|
+
}): Promise<PlayRunAttemptTerminalHandoff>;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export type PlayRunAttemptPorts = {
|
|
101
|
+
store: PlayRunAttemptStore;
|
|
102
|
+
sandboxRuns: SandboxRunsPort;
|
|
103
|
+
terminal: PlayRunTerminalPort;
|
|
104
|
+
};
|