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
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTTP headers attached to every server-to-coordinator request.
|
|
3
|
-
*
|
|
4
|
-
* The coordinator is a Cloudflare Worker (`deepline-play-coordinator-*`) that
|
|
5
|
-
* we publish through Cloudflare's Versions + Deployments primitives. Whenever
|
|
6
|
-
* a deployment is split across two versions (e.g. 10% canary), Cloudflare
|
|
7
|
-
* uses the `Cloudflare-Workers-Version-Key` header to pick a stable version
|
|
8
|
-
* per request. Sending the runId as the key keeps every request for one play
|
|
9
|
-
* run pinned to whichever version started the run, so a partial rollout
|
|
10
|
-
* cannot strand a Workflow's `/submit` and `/result` calls on different
|
|
11
|
-
* code versions.
|
|
12
|
-
*
|
|
13
|
-
* The header is harmless when there is only one active version (the default).
|
|
14
3
|
*/
|
|
15
|
-
|
|
16
|
-
export const COORDINATOR_VERSION_OVERRIDES_HEADER =
|
|
17
|
-
'Cloudflare-Workers-Version-Overrides';
|
|
4
|
+
|
|
18
5
|
/**
|
|
19
6
|
* Shared secret the coordinator uses to authenticate dispatcher (Vercel app)
|
|
20
7
|
* traffic. The coordinator also sanity-checks `x-deepline-run-scope` matches
|
|
@@ -88,8 +75,6 @@ export function coordinatorRequestHeaders(input: {
|
|
|
88
75
|
runId: string;
|
|
89
76
|
contentType?: string | null;
|
|
90
77
|
internalToken?: string | null;
|
|
91
|
-
runtimeDeployVersion?: string | null;
|
|
92
|
-
coordinatorWorkerName?: string | null;
|
|
93
78
|
/**
|
|
94
79
|
* When set, the coordinator validates this matches the runId in the URL.
|
|
95
80
|
* Pass the runId on `/cancel` / `/signal` calls so a leaked dispatcher
|
|
@@ -102,22 +87,6 @@ export function coordinatorRequestHeaders(input: {
|
|
|
102
87
|
headers['content-type'] = input.contentType;
|
|
103
88
|
}
|
|
104
89
|
const trimmed = input.runId.trim();
|
|
105
|
-
if (trimmed) {
|
|
106
|
-
headers[COORDINATOR_VERSION_KEY_HEADER] = trimmed;
|
|
107
|
-
}
|
|
108
|
-
const runtimeDeployVersion = input.runtimeDeployVersion?.trim();
|
|
109
|
-
const coordinatorWorkerName = input.coordinatorWorkerName?.trim();
|
|
110
|
-
if (
|
|
111
|
-
runtimeDeployVersion &&
|
|
112
|
-
coordinatorWorkerName &&
|
|
113
|
-
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(
|
|
114
|
-
runtimeDeployVersion,
|
|
115
|
-
) &&
|
|
116
|
-
/^[A-Za-z0-9_-]+$/.test(coordinatorWorkerName)
|
|
117
|
-
) {
|
|
118
|
-
headers[COORDINATOR_VERSION_OVERRIDES_HEADER] =
|
|
119
|
-
`${coordinatorWorkerName}="${runtimeDeployVersion}"`;
|
|
120
|
-
}
|
|
121
90
|
const internalToken =
|
|
122
91
|
input.internalToken?.trim() || resolveInternalCoordinatorToken();
|
|
123
92
|
if (internalToken) {
|
|
@@ -10,8 +10,10 @@ import type { PlayRunContractSnapshot } from '../plays/contracts';
|
|
|
10
10
|
import type { PlayStructuredDefinition } from '../plays/definition';
|
|
11
11
|
import type { PlayStaticPipeline } from '../plays/static-pipeline';
|
|
12
12
|
import type {
|
|
13
|
+
AsyncPlayRunRef,
|
|
13
14
|
DurableCallStaleAfterSeconds,
|
|
14
15
|
PlayAuthoringCallOptions,
|
|
16
|
+
PlayAuthoringAsyncCallOptions,
|
|
15
17
|
PlayAuthoringCsvOptions,
|
|
16
18
|
PlayAuthoringFetchOptions,
|
|
17
19
|
PlayAuthoringRuntimeStepOptions,
|
|
@@ -331,6 +333,19 @@ export type PlayCallOptions = Omit<
|
|
|
331
333
|
timeoutMs?: number;
|
|
332
334
|
};
|
|
333
335
|
|
|
336
|
+
export type PlayAsyncCallOptions = PlayAuthoringAsyncCallOptions;
|
|
337
|
+
|
|
338
|
+
export type AsyncPlayLaunchRequest = Readonly<{
|
|
339
|
+
key: string;
|
|
340
|
+
invocationKey: string;
|
|
341
|
+
playRef: string;
|
|
342
|
+
input: Record<string, unknown>;
|
|
343
|
+
description: string;
|
|
344
|
+
schedulerSchema: string | null;
|
|
345
|
+
/** Governor ancestry at the authored call site, before entering the child. */
|
|
346
|
+
ancestryPlayIds: readonly string[];
|
|
347
|
+
}>;
|
|
348
|
+
|
|
334
349
|
export type RuntimeStepOptions = PlayAuthoringRuntimeStepOptions;
|
|
335
350
|
|
|
336
351
|
export type FetchOptions = PlayAuthoringFetchOptions;
|
|
@@ -345,6 +360,16 @@ export interface ResolvedPlayExecution {
|
|
|
345
360
|
definition?: PlayStructuredDefinition | null;
|
|
346
361
|
staticPipeline?: PlayStaticPipeline | null;
|
|
347
362
|
contractSnapshot?: PlayRunContractSnapshot | null;
|
|
363
|
+
launchMetadata?: {
|
|
364
|
+
revisionId?: string | null;
|
|
365
|
+
artifactStorageKey: string;
|
|
366
|
+
artifactHash: string;
|
|
367
|
+
graphHash: string;
|
|
368
|
+
definitionScope: 'org' | 'system';
|
|
369
|
+
authoringContract?:
|
|
370
|
+
| import('../plays/authoring-contract').AdmittedPlayAuthoringContract
|
|
371
|
+
| null;
|
|
372
|
+
} | null;
|
|
348
373
|
}
|
|
349
374
|
|
|
350
375
|
export interface BatchRequest {
|
|
@@ -374,6 +399,15 @@ export interface MapExecutionFrame {
|
|
|
374
399
|
totalRows: number;
|
|
375
400
|
completedRowKeys: string[];
|
|
376
401
|
pendingRowKeys: string[];
|
|
402
|
+
/**
|
|
403
|
+
* The admitted inputs that still need to run after a durable suspension.
|
|
404
|
+
* This prevents a replay from losing work when its authored source query is
|
|
405
|
+
* stateful and no longer returns rows that were selected before the pause.
|
|
406
|
+
*/
|
|
407
|
+
suspendedInputRows?: Array<{
|
|
408
|
+
inputIndex: number;
|
|
409
|
+
data: Record<string, unknown>;
|
|
410
|
+
}>;
|
|
377
411
|
completedRowsCount?: number;
|
|
378
412
|
pendingRowsCount?: number;
|
|
379
413
|
failedRowsCount?: number;
|
|
@@ -548,6 +582,9 @@ export type IntegrationEventWaitRuntimeContext = {
|
|
|
548
582
|
workflowId?: string;
|
|
549
583
|
orgId?: string;
|
|
550
584
|
executorToken?: string;
|
|
585
|
+
slackHitlDefaultTimeoutMs?: number;
|
|
586
|
+
/** Behavior selected by the admitted Play artifact, never worker version. */
|
|
587
|
+
slackHitlTimeoutOutcome?: 'park' | 'error';
|
|
551
588
|
};
|
|
552
589
|
|
|
553
590
|
export type IntegrationEventWaitBoundary = {
|
|
@@ -560,6 +597,21 @@ export type IntegrationEventWaitBoundary = {
|
|
|
560
597
|
channel: string;
|
|
561
598
|
ts: string;
|
|
562
599
|
};
|
|
600
|
+
/**
|
|
601
|
+
* Optional control-plane timeout behavior. Missing preserves the legacy
|
|
602
|
+
* "return the timed_out result" replay behavior for older app deployments.
|
|
603
|
+
*/
|
|
604
|
+
timeoutPolicy?: {
|
|
605
|
+
suspendAfterTimeoutMs?: number;
|
|
606
|
+
finalizeOnTimeout?: boolean;
|
|
607
|
+
/**
|
|
608
|
+
* A terminal policy is persisted with the boundary so durable replay never
|
|
609
|
+
* changes a published Play's timeout behavior.
|
|
610
|
+
*/
|
|
611
|
+
timeoutOutcome?: 'return_null' | 'error';
|
|
612
|
+
/** Customer-authored message used only for the terminal error outcome. */
|
|
613
|
+
timeoutError?: string;
|
|
614
|
+
};
|
|
563
615
|
};
|
|
564
616
|
|
|
565
617
|
export type IntegrationEventWaitHandler = {
|
|
@@ -584,6 +636,11 @@ export type IntegrationEventWaitHandler = {
|
|
|
584
636
|
context: IntegrationEventWaitRuntimeContext;
|
|
585
637
|
boundary: IntegrationEventWaitBoundary;
|
|
586
638
|
}) => Promise<void>;
|
|
639
|
+
/**
|
|
640
|
+
* When set, timeout finalization is side-effect-only: the Play stays parked
|
|
641
|
+
* instead of consuming a `timed_out` result.
|
|
642
|
+
*/
|
|
643
|
+
suspendAfterTimeoutMs?: number;
|
|
587
644
|
};
|
|
588
645
|
|
|
589
646
|
export interface ContextOptions {
|
|
@@ -598,6 +655,8 @@ export interface ContextOptions {
|
|
|
598
655
|
executionScope?: RunExecutionScope;
|
|
599
656
|
/** Authoring semantics pinned by the immutable artifact. */
|
|
600
657
|
authoringContractEdition?: PlayAuthoringContractEdition;
|
|
658
|
+
/** Direct/local callers may opt into the new terminal Slack HITL outcome. */
|
|
659
|
+
slackHitlTimeoutOutcome?: 'park' | 'error';
|
|
601
660
|
/** Error shape pinned by the immutable play artifact; missing preserves legacy schema 0. */
|
|
602
661
|
toolErrorSchemaVersion?: ToolExecutionErrorSchemaVersion;
|
|
603
662
|
/** Execute-result contract pinned by the immutable Play artifact. */
|
|
@@ -769,6 +828,8 @@ export interface ContextOptions {
|
|
|
769
828
|
}) => Promise<void>;
|
|
770
829
|
playId?: string;
|
|
771
830
|
runId?: string;
|
|
831
|
+
/** Shared governance/billing root. Differs from runId for async children. */
|
|
832
|
+
rootRunId?: string;
|
|
772
833
|
/** Physical executor run that owns leases for an inline child context. */
|
|
773
834
|
runtimeReceiptOwnerRunId?: string;
|
|
774
835
|
/** Logical invocation scope for receipts created inside an inline child. */
|
|
@@ -800,6 +861,10 @@ export interface ContextOptions {
|
|
|
800
861
|
*/
|
|
801
862
|
runtimeSheetBackedMapDatasets?: boolean;
|
|
802
863
|
resolvePlay?: (playRef: string) => Promise<ResolvedPlayExecution | null>;
|
|
864
|
+
/** Admit an independently scheduled scalar/HITL Play Run. */
|
|
865
|
+
launchPlayAsync?: (
|
|
866
|
+
request: AsyncPlayLaunchRequest,
|
|
867
|
+
) => Promise<AsyncPlayRunRef>;
|
|
803
868
|
getToolQueueHints?: (toolId: string) => Promise<readonly PlayQueueHint[]>;
|
|
804
869
|
getToolProvider?: (toolId: string) => Promise<string | null>;
|
|
805
870
|
getToolOperation?: (toolId: string) => Promise<string | null>;
|
|
@@ -811,7 +876,17 @@ export interface ContextOptions {
|
|
|
811
876
|
requiresExecutionFence?: boolean;
|
|
812
877
|
} | null>;
|
|
813
878
|
getToolActionCacheVersion?: (toolId: string) => Promise<string> | string;
|
|
879
|
+
/**
|
|
880
|
+
* Source-declared older action identities that remain safe to read. They
|
|
881
|
+
* are read-only fallbacks: new receipts and provider calls always use the
|
|
882
|
+
* primary `getToolActionCacheVersion` value.
|
|
883
|
+
*/
|
|
884
|
+
getToolActionCacheReadVersions?: (
|
|
885
|
+
toolId: string,
|
|
886
|
+
) => Promise<string[]> | string[];
|
|
814
887
|
getToolAuthScopeDigest?: (toolId: string) => Promise<string> | string;
|
|
888
|
+
/** Original run for an explicit customer rerun, never an automatic retry. */
|
|
889
|
+
replayedFromRunId?: string | null;
|
|
815
890
|
getToolRateScope?: (
|
|
816
891
|
toolId: string,
|
|
817
892
|
provider: string,
|
|
@@ -842,6 +917,17 @@ export interface ContextOptions {
|
|
|
842
917
|
| Promise<import('./async-operation').AsyncOperationContractWire | null>
|
|
843
918
|
| import('./async-operation').AsyncOperationContractWire
|
|
844
919
|
| null;
|
|
920
|
+
/**
|
|
921
|
+
* Bounded-check policy projected onto a caller-managed async lifecycle
|
|
922
|
+
* companion. The runtime owns cadence; provider adapters only translate
|
|
923
|
+
* this budget into their native result/status request.
|
|
924
|
+
*/
|
|
925
|
+
getToolAsyncOperationPoll?: (
|
|
926
|
+
toolId: string,
|
|
927
|
+
) =>
|
|
928
|
+
| Promise<import('./async-operation').AsyncOperationPollExecution | null>
|
|
929
|
+
| import('./async-operation').AsyncOperationPollExecution
|
|
930
|
+
| null;
|
|
845
931
|
getIntegrationEventWaitHandler?: (
|
|
846
932
|
toolId: string,
|
|
847
933
|
) =>
|
|
@@ -982,6 +1068,11 @@ export interface PlayCheckpoint {
|
|
|
982
1068
|
channel: string;
|
|
983
1069
|
ts: string;
|
|
984
1070
|
};
|
|
1071
|
+
/**
|
|
1072
|
+
* Control-plane timeout behavior captured when the wait was armed.
|
|
1073
|
+
* Missing fields preserve legacy checkpoint replay behavior.
|
|
1074
|
+
*/
|
|
1075
|
+
timeoutPolicy?: IntegrationEventWaitBoundary['timeoutPolicy'];
|
|
985
1076
|
output?: unknown;
|
|
986
1077
|
completedAt?: number;
|
|
987
1078
|
}
|
|
@@ -1147,6 +1238,12 @@ export type PlayStep =
|
|
|
1147
1238
|
nestedSteps: PlayStep[];
|
|
1148
1239
|
description?: string;
|
|
1149
1240
|
}
|
|
1241
|
+
| {
|
|
1242
|
+
type: 'play_launch';
|
|
1243
|
+
playId: string;
|
|
1244
|
+
runId: string;
|
|
1245
|
+
description?: string;
|
|
1246
|
+
}
|
|
1150
1247
|
| {
|
|
1151
1248
|
type: 'run_javascript';
|
|
1152
1249
|
alias: string;
|
|
@@ -1187,6 +1284,12 @@ export type PlayDatasetSubstep =
|
|
|
1187
1284
|
nestedSteps: PlayStep[];
|
|
1188
1285
|
description?: string;
|
|
1189
1286
|
}
|
|
1287
|
+
| {
|
|
1288
|
+
type: 'play_launch';
|
|
1289
|
+
playId: string;
|
|
1290
|
+
runId: string;
|
|
1291
|
+
description?: string;
|
|
1292
|
+
}
|
|
1190
1293
|
| {
|
|
1191
1294
|
type: 'run_javascript';
|
|
1192
1295
|
alias: string;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deployed,
|
|
3
|
+
readDeployedObject,
|
|
4
|
+
type DeployedDiagnostic,
|
|
5
|
+
} from '@deepline/deployed-contracts';
|
|
6
|
+
import type { PlayRunnerExecutionConfig } from './protocol';
|
|
7
|
+
|
|
8
|
+
export type DaytonaPayloadEnvelope = {
|
|
9
|
+
/** Diagnostic only. A missing/different marker cannot block materialization. */
|
|
10
|
+
schemaVersion?: number;
|
|
11
|
+
runnerCode: string;
|
|
12
|
+
artifactBundledCode: string;
|
|
13
|
+
artifactSourceMap: string;
|
|
14
|
+
config: PlayRunnerExecutionConfig;
|
|
15
|
+
crashPusherCode: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const DAYTONA_PAYLOAD_CONTRACT = deployed.object({
|
|
19
|
+
id: 'daytona-payload',
|
|
20
|
+
unknown: 'preserve',
|
|
21
|
+
fields: {
|
|
22
|
+
runnerCode: deployed.string(),
|
|
23
|
+
artifactBundledCode: deployed.string(),
|
|
24
|
+
artifactSourceMap: deployed.string(),
|
|
25
|
+
config: deployed.record(),
|
|
26
|
+
crashPusherCode: deployed.string(),
|
|
27
|
+
schemaVersion: deployed.optional(deployed.diagnostic.number(), {
|
|
28
|
+
whenAbsent: 'diagnostic unavailable',
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const DAYTONA_PAYLOAD_FILE_FIELDS = [
|
|
34
|
+
'runnerCode',
|
|
35
|
+
'artifactBundledCode',
|
|
36
|
+
'artifactSourceMap',
|
|
37
|
+
'crashPusherCode',
|
|
38
|
+
] as const;
|
|
39
|
+
|
|
40
|
+
export function readDaytonaPayloadEnvelope(input: unknown): {
|
|
41
|
+
value: DaytonaPayloadEnvelope;
|
|
42
|
+
diagnostics: DeployedDiagnostic[];
|
|
43
|
+
} {
|
|
44
|
+
const { value, diagnostics } = readDeployedObject(
|
|
45
|
+
DAYTONA_PAYLOAD_CONTRACT,
|
|
46
|
+
input,
|
|
47
|
+
);
|
|
48
|
+
return {
|
|
49
|
+
value: {
|
|
50
|
+
runnerCode: value.runnerCode as string,
|
|
51
|
+
artifactBundledCode: value.artifactBundledCode as string,
|
|
52
|
+
artifactSourceMap: value.artifactSourceMap as string,
|
|
53
|
+
config: value.config as PlayRunnerExecutionConfig,
|
|
54
|
+
crashPusherCode: value.crashPusherCode as string,
|
|
55
|
+
},
|
|
56
|
+
diagnostics,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The sandbox has only Node built-ins. Generate its tiny entry from the same
|
|
62
|
+
* contract-owned field list instead of maintaining a second hand-written list
|
|
63
|
+
* in transport code. This is shipped source, not Function#toString output.
|
|
64
|
+
*/
|
|
65
|
+
export function buildDaytonaPayloadMaterializerSource(): string {
|
|
66
|
+
const fields = JSON.stringify(DAYTONA_PAYLOAD_FILE_FIELDS);
|
|
67
|
+
return `const fs=require('node:fs');const zlib=require('node:zlib');const p=JSON.parse(zlib.gunzipSync(fs.readFileSync(process.argv[1])));if(!p||typeof p!=='object'||Array.isArray(p))throw new Error('Daytona payload: expected object');for(const key of ${fields})if(typeof p[key]!=='string')throw new Error('Daytona payload is missing required field '+key);if(!p.config||typeof p.config!=='object'||Array.isArray(p.config))throw new Error('Daytona payload is missing required field config');if(typeof p.schemaVersion==='number'&&p.schemaVersion!==1)console.warn('[daytona] payload schema marker differs; attempting structural materialization');fs.writeFileSync(process.argv[2],p.runnerCode);fs.writeFileSync(process.argv[3],JSON.stringify(p.config));fs.writeFileSync(process.argv[4],p.artifactBundledCode);fs.writeFileSync(process.argv[5],p.artifactSourceMap);fs.writeFileSync(process.argv[6],p.crashPusherCode);`;
|
|
68
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { withRuntimeSchedulerClient } from './/scheduler-backends/postgres-pool';
|
|
2
|
+
import { isIsolatedRuntimeSchedulerSchema } from './/runtime-scheduler-topology';
|
|
3
|
+
|
|
4
|
+
/** A single controller owns this fleet-wide sweep. Workers clean resources for
|
|
5
|
+
* their own attempts; they do not each enumerate the shared Daytona account. */
|
|
6
|
+
export const DAYTONA_JANITOR_INTERVAL_MS = 5 * 60 * 1_000;
|
|
7
|
+
|
|
8
|
+
export type DaytonaSandboxJanitorOptions = {
|
|
9
|
+
url: string;
|
|
10
|
+
schema: string;
|
|
11
|
+
maxClients?: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Start the production-only Daytona orphan sweep.
|
|
16
|
+
*
|
|
17
|
+
* Sandboxes have a source-scoped label shared by production, previews, and
|
|
18
|
+
* worktrees. An isolated schema cannot authoritatively distinguish its own
|
|
19
|
+
* sandboxes from the others, so it must never sweep. The fixed runtime
|
|
20
|
+
* controller is the one production owner; moving this here makes the Daytona
|
|
21
|
+
* list/read traffic constant with fleet size.
|
|
22
|
+
*/
|
|
23
|
+
export function startDaytonaSandboxJanitor(
|
|
24
|
+
options: DaytonaSandboxJanitorOptions,
|
|
25
|
+
): { stop: () => void } {
|
|
26
|
+
if (!process.env.DAYTONA_API_KEY?.trim()) {
|
|
27
|
+
console.info('[daytona-janitor.controller] disabled (no DAYTONA_API_KEY)');
|
|
28
|
+
return { stop: () => undefined };
|
|
29
|
+
}
|
|
30
|
+
if (isIsolatedRuntimeSchedulerSchema(options.schema)) {
|
|
31
|
+
console.info('[daytona-janitor.controller] disabled (isolated schema)', {
|
|
32
|
+
schema: options.schema,
|
|
33
|
+
});
|
|
34
|
+
return { stop: () => undefined };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let running = false;
|
|
38
|
+
const runPass = async (): Promise<void> => {
|
|
39
|
+
if (running) {
|
|
40
|
+
console.info('[daytona-janitor.controller] skip (previous pass running)');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
running = true;
|
|
44
|
+
try {
|
|
45
|
+
const [
|
|
46
|
+
{ Daytona },
|
|
47
|
+
{ loadDaytonaRequiredConfig },
|
|
48
|
+
{
|
|
49
|
+
createPostgresDaytonaJanitorOwnershipPort,
|
|
50
|
+
reapOrphanDaytonaSandboxes,
|
|
51
|
+
},
|
|
52
|
+
] = await Promise.all([
|
|
53
|
+
import('@daytonaio/sdk'),
|
|
54
|
+
import('.//daytona-runtime-config'),
|
|
55
|
+
import('./daytona-sandbox-reaper'),
|
|
56
|
+
]);
|
|
57
|
+
const { clientOptions } = loadDaytonaRequiredConfig();
|
|
58
|
+
const daytona = new Daytona(clientOptions);
|
|
59
|
+
await withRuntimeSchedulerClient(
|
|
60
|
+
{
|
|
61
|
+
url: options.url,
|
|
62
|
+
applicationName: 'deepline-daytona-janitor',
|
|
63
|
+
maxClients: options.maxClients ?? 2,
|
|
64
|
+
},
|
|
65
|
+
(client) =>
|
|
66
|
+
reapOrphanDaytonaSandboxes({
|
|
67
|
+
daytona: {
|
|
68
|
+
list: (query) => daytona.list(query),
|
|
69
|
+
},
|
|
70
|
+
ownership: createPostgresDaytonaJanitorOwnershipPort({
|
|
71
|
+
client,
|
|
72
|
+
schema: options.schema,
|
|
73
|
+
}),
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
// This is a best-effort resource backstop. A failed sweep must never
|
|
78
|
+
// terminate the controller that scales and recovers customer work.
|
|
79
|
+
console.warn('[daytona-janitor.controller] pass failed', {
|
|
80
|
+
error: error instanceof Error ? error.message : String(error),
|
|
81
|
+
});
|
|
82
|
+
} finally {
|
|
83
|
+
running = false;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const interval = setInterval(() => {
|
|
88
|
+
void runPass();
|
|
89
|
+
}, DAYTONA_JANITOR_INTERVAL_MS);
|
|
90
|
+
interval.unref();
|
|
91
|
+
|
|
92
|
+
// Run once immediately. The singleton controller has no fleet-start
|
|
93
|
+
// stampede to smooth, and an early pass shortens recovery after deploy.
|
|
94
|
+
void runPass();
|
|
95
|
+
console.info('[daytona-janitor.controller] scheduled', {
|
|
96
|
+
intervalMs: DAYTONA_JANITOR_INTERVAL_MS,
|
|
97
|
+
schema: options.schema,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
stop: () => clearInterval(interval),
|
|
102
|
+
};
|
|
103
|
+
}
|