@treeseed/sdk 0.11.0 → 0.12.4
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/README.md +9 -4
- package/dist/agent-capacity.d.ts +916 -0
- package/dist/agent-capacity.js +1600 -0
- package/dist/agent-tools.d.ts +37 -0
- package/dist/agent-tools.js +301 -0
- package/dist/api/app.d.ts +1 -1
- package/dist/api/auth/d1-database.d.ts +2 -2
- package/dist/api/auth/d1-provider.d.ts +4 -4
- package/dist/api/auth/d1-store.d.ts +2 -2
- package/dist/api/auth/memory-provider.d.ts +1 -1
- package/dist/api/auth/tokens.d.ts +1 -1
- package/dist/api/config.d.ts +3 -1
- package/dist/api/config.js +34 -10
- package/dist/api/http.d.ts +2 -2
- package/dist/api/index.d.ts +10 -10
- package/dist/api/index.js +4 -2
- package/dist/api/operations-routes.d.ts +3 -3
- package/dist/api/operations.d.ts +1 -1
- package/dist/api/providers.d.ts +1 -1
- package/dist/api/providers.js +21 -4
- package/dist/api/railway.d.ts +3 -2
- package/dist/api/sdk-dispatch.d.ts +4 -4
- package/dist/api/sdk-routes.d.ts +2 -2
- package/dist/api/templates.d.ts +2 -2
- package/dist/api/types.d.ts +3 -2
- package/dist/capacity-provider.d.ts +117 -60
- package/dist/capacity-provider.js +215 -43
- package/dist/capacity.d.ts +2 -2
- package/dist/cli-tools.d.ts +1 -1
- package/dist/content-operations.d.ts +97 -0
- package/dist/content-operations.js +250 -0
- package/dist/content-store.d.ts +4 -4
- package/dist/control-plane-client.d.ts +13 -18
- package/dist/control-plane-client.js +8 -86
- package/dist/control-plane.d.ts +2 -2
- package/dist/copilot.d.ts +3 -0
- package/dist/copilot.js +16 -1
- package/dist/d1-http.d.ts +1 -1
- package/dist/d1-store.d.ts +32 -57
- package/dist/d1-store.js +115 -318
- package/dist/db/d1.d.ts +1 -232
- package/dist/db/index.d.ts +3 -3
- package/dist/db/market-schema.d.ts +49037 -11843
- package/dist/db/market-schema.js +1788 -50
- package/dist/db/node-sqlite.d.ts +1 -232
- package/dist/db/schema.d.ts +0 -462
- package/dist/db/schema.js +2 -22
- package/dist/dispatch.d.ts +1 -1
- package/dist/dispatch.js +0 -11
- package/dist/fixture-support.js +52 -4
- package/dist/governance.d.ts +133 -0
- package/dist/governance.js +285 -0
- package/dist/graph/build.d.ts +2 -2
- package/dist/graph/context-query-contracts.d.ts +1 -1
- package/dist/graph/dsl.d.ts +1 -1
- package/dist/graph/query.d.ts +4 -4
- package/dist/graph/ranking.d.ts +1 -1
- package/dist/graph/schema.d.ts +1 -1
- package/dist/graph.d.ts +11 -11
- package/dist/guarantees/index.d.ts +425 -0
- package/dist/guarantees/index.js +1146 -0
- package/dist/hosting/apps.d.ts +1 -1
- package/dist/hosting/builtins.d.ts +1 -1
- package/dist/hosting/builtins.js +9 -198
- package/dist/hosting/contracts.d.ts +3 -2
- package/dist/hosting/graph.d.ts +24 -21
- package/dist/hosting/graph.js +280 -294
- package/dist/hosting/index.d.ts +4 -4
- package/dist/index.d.ts +88 -74
- package/dist/index.js +81 -10
- package/dist/local-dev/managed-dev.d.ts +85 -0
- package/dist/local-dev/managed-dev.js +368 -0
- package/dist/managed-dependencies.d.ts +9 -0
- package/dist/managed-dependencies.js +10 -8
- package/dist/market-client.d.ts +265 -7
- package/dist/market-client.js +381 -9
- package/dist/model-registry.d.ts +1 -1
- package/dist/model-registry.js +19 -19
- package/dist/operations/agent-tools.d.ts +2 -11
- package/dist/operations/agent-tools.js +2 -14
- package/dist/operations/providers/default.d.ts +1 -1
- package/dist/operations/providers/default.js +20 -37
- package/dist/operations/repository-operations.d.ts +26 -2
- package/dist/operations/repository-operations.js +159 -1
- package/dist/operations/runtime.d.ts +3 -3
- package/dist/operations/services/bootstrap-runner.d.ts +1 -1
- package/dist/operations/services/build-warning-policy.d.ts +34 -0
- package/dist/operations/services/build-warning-policy.js +81 -82
- package/dist/operations/services/commit-message-provider.js +4 -4
- package/dist/operations/services/config-runtime.d.ts +73 -19
- package/dist/operations/services/config-runtime.js +276 -100
- package/dist/operations/services/deploy.d.ts +41 -622
- package/dist/operations/services/deploy.js +181 -213
- package/dist/operations/services/deployment-readiness.d.ts +1 -1
- package/dist/operations/services/deployment-readiness.js +38 -7
- package/dist/operations/services/git-remote-policy.js +12 -4
- package/dist/operations/services/git-runner.d.ts +66 -0
- package/dist/operations/services/git-runner.js +479 -0
- package/dist/operations/services/git-workflow.d.ts +43 -5
- package/dist/operations/services/git-workflow.js +242 -20
- package/dist/operations/services/github-actions-verification.d.ts +3 -1
- package/dist/operations/services/github-actions-verification.js +11 -3
- package/dist/operations/services/github-api.js +21 -5
- package/dist/operations/services/github-automation.d.ts +3 -3
- package/dist/operations/services/github-automation.js +15 -18
- package/dist/operations/services/github-credentials.js +2 -1
- package/dist/operations/services/hosted-service-checks.d.ts +19 -1
- package/dist/operations/services/hosted-service-checks.js +162 -11
- package/dist/operations/services/hosting-audit.d.ts +2 -2
- package/dist/operations/services/hosting-audit.js +7 -7
- package/dist/operations/services/hub-launch.d.ts +1 -1
- package/dist/operations/services/hub-provider-launch.d.ts +5 -5
- package/dist/operations/services/hub-provider-launch.js +19 -14
- package/dist/operations/services/live-hosted-service-checks.d.ts +2 -1
- package/dist/operations/services/live-hosted-service-checks.js +193 -80
- package/dist/operations/services/local-dev.js +0 -1
- package/dist/operations/services/managed-host-security.d.ts +1 -1
- package/dist/operations/services/managed-repositories.d.ts +37 -0
- package/dist/operations/services/managed-repositories.js +177 -0
- package/dist/operations/services/operations-runner-smoke.d.ts +3 -2
- package/dist/operations/services/operations-runner-smoke.js +22 -4
- package/dist/operations/services/package-adapters.d.ts +77 -2
- package/dist/operations/services/package-adapters.js +627 -56
- package/dist/operations/services/package-reference-policy.d.ts +12 -88
- package/dist/operations/services/package-reference-policy.js +81 -213
- package/dist/operations/services/project-host-operations.d.ts +4 -4
- package/dist/operations/services/project-platform.d.ts +19 -193
- package/dist/operations/services/project-platform.js +31 -103
- package/dist/operations/services/project-web-monitor.d.ts +2 -2
- package/dist/operations/services/project-web-monitor.js +97 -2
- package/dist/operations/services/railway-api.d.ts +36 -7
- package/dist/operations/services/railway-api.js +331 -100
- package/dist/operations/services/railway-deploy.d.ts +7 -95
- package/dist/operations/services/railway-deploy.js +334 -742
- package/dist/operations/services/release-history.js +3 -4
- package/dist/operations/services/release-proof-ledger.d.ts +13 -0
- package/dist/operations/services/release-proof-ledger.js +81 -0
- package/dist/operations/services/release-proof-planner.d.ts +48 -0
- package/dist/operations/services/release-proof-planner.js +195 -0
- package/dist/operations/services/release-proof-runner.d.ts +16 -0
- package/dist/operations/services/release-proof-runner.js +169 -0
- package/dist/operations/services/release-proof.d.ts +81 -0
- package/dist/operations/services/release-proof.js +79 -0
- package/dist/operations/services/repository-save-orchestrator.d.ts +6 -7
- package/dist/operations/services/repository-save-orchestrator.js +353 -174
- package/dist/operations/services/runtime-paths.d.ts +1 -3
- package/dist/operations/services/runtime-paths.js +0 -4
- package/dist/operations/services/runtime-tools.d.ts +1 -192
- package/dist/operations/services/runtime-tools.js +4 -444
- package/dist/operations/services/save-deploy-preflight.js +9 -1
- package/dist/operations/services/template-host-bindings.d.ts +2 -2
- package/dist/operations/services/template-host-bindings.js +3 -2
- package/dist/operations/services/template-registry.d.ts +6 -6
- package/dist/operations/services/template-registry.js +33 -14
- package/dist/operations/services/template-secret-sync.d.ts +3 -3
- package/dist/operations/services/workflow-timing.d.ts +25 -0
- package/dist/operations/services/workflow-timing.js +79 -0
- package/dist/operations/services/workspace-dependency-mode.js +41 -4
- package/dist/operations/services/workspace-preflight.js +8 -8
- package/dist/operations/services/workspace-save-script.d.ts +4 -4
- package/dist/operations/services/workspace-save.d.ts +1 -0
- package/dist/operations/services/workspace-save.js +41 -18
- package/dist/operations/services/workspace-tools.js +40 -6
- package/dist/operations-registry.d.ts +1 -1
- package/dist/operations-registry.js +5 -6
- package/dist/operations-types.d.ts +1 -1
- package/dist/operations.d.ts +17 -11
- package/dist/operations.js +57 -3
- package/dist/platform/book-export.js +2 -0
- package/dist/platform/books-data.d.ts +1 -1
- package/dist/platform/config.d.ts +27 -0
- package/dist/platform/config.js +100 -0
- package/dist/platform/content-runtime-source.d.ts +54 -0
- package/dist/platform/content-runtime-source.js +169 -0
- package/dist/platform/contracts.d.ts +6 -1
- package/dist/platform/deploy-config.d.ts +1 -1
- package/dist/platform/deploy-config.js +7 -1
- package/dist/platform/deploy-runtime.d.ts +1 -1
- package/dist/platform/desired-state.d.ts +63 -0
- package/dist/platform/desired-state.js +1021 -0
- package/dist/platform/env.yaml +414 -19
- package/dist/platform/environment.d.ts +2 -2
- package/dist/platform/environment.js +54 -22
- package/dist/platform/local-content-materialization.d.ts +9 -0
- package/dist/platform/local-content-materialization.js +212 -0
- package/dist/platform/plugin.d.ts +5 -5
- package/dist/platform/plugins/runtime.d.ts +3 -3
- package/dist/platform/plugins/runtime.js +62 -1
- package/dist/platform/plugins.d.ts +6 -6
- package/dist/platform/published-content-pipeline.d.ts +3 -3
- package/dist/platform/published-content-pipeline.js +5 -1
- package/dist/platform/published-content.d.ts +4 -3
- package/dist/platform/site-config-schema.d.ts +1 -0
- package/dist/platform/site-config-schema.js +4 -1
- package/dist/platform/tenant/runtime-config.d.ts +152 -2
- package/dist/platform/tenant-config.d.ts +1 -1
- package/dist/platform/utils/site-config-schema.d.ts +154 -0
- package/dist/platform/utils/site-config-schema.js +400 -461
- package/dist/platform-operation-store.d.ts +1 -1
- package/dist/plugin-default.d.ts +1 -1
- package/dist/plugin-default.js +27 -12
- package/dist/project-import.d.ts +91 -0
- package/dist/project-import.js +257 -0
- package/dist/project-workflow.d.ts +1 -1
- package/dist/reconcile/bootstrap-systems.d.ts +2 -2
- package/dist/reconcile/bootstrap-systems.js +3 -3
- package/dist/reconcile/builtin-adapters.d.ts +7 -1
- package/dist/reconcile/builtin-adapters.js +2924 -346
- package/dist/reconcile/contracts.d.ts +15 -2
- package/dist/reconcile/desired-state.d.ts +2 -193
- package/dist/reconcile/desired-state.js +24 -33
- package/dist/reconcile/engine.d.ts +60 -397
- package/dist/reconcile/engine.js +182 -18
- package/dist/reconcile/index.d.ts +10 -10
- package/dist/reconcile/live-acceptance.d.ts +22 -1
- package/dist/reconcile/live-acceptance.js +456 -44
- package/dist/reconcile/providers/docker-private.d.ts +54 -0
- package/dist/reconcile/providers/docker-private.js +101 -0
- package/dist/reconcile/providers/github-private.d.ts +65 -0
- package/dist/reconcile/providers/github-private.js +119 -0
- package/dist/reconcile/providers/local-private.d.ts +28 -0
- package/dist/reconcile/providers/local-private.js +75 -0
- package/dist/reconcile/providers/railway-iac.d.ts +66 -0
- package/dist/reconcile/providers/railway-iac.js +275 -0
- package/dist/reconcile/providers/release-private.d.ts +92 -0
- package/dist/reconcile/providers/release-private.js +152 -0
- package/dist/reconcile/registry.d.ts +2 -2
- package/dist/reconcile/registry.js +16 -1
- package/dist/reconcile/state.d.ts +1 -1
- package/dist/reconcile/state.js +3 -40
- package/dist/reconcile/units.d.ts +1 -1
- package/dist/reconcile/units.js +7 -1
- package/dist/remote.d.ts +6 -6
- package/dist/scenes/artifacts.d.ts +16 -0
- package/dist/scenes/artifacts.js +61 -0
- package/dist/scenes/auth.d.ts +2 -0
- package/dist/scenes/auth.js +28 -0
- package/dist/scenes/base-url.d.ts +12 -0
- package/dist/scenes/base-url.js +123 -0
- package/dist/scenes/builtin-plugins.d.ts +2 -0
- package/dist/scenes/builtin-plugins.js +447 -0
- package/dist/scenes/checkpoints.d.ts +14 -0
- package/dist/scenes/checkpoints.js +33 -0
- package/dist/scenes/device-matrix.d.ts +2 -0
- package/dist/scenes/device-matrix.js +97 -0
- package/dist/scenes/devices.d.ts +11 -0
- package/dist/scenes/devices.js +22 -0
- package/dist/scenes/diagnostics.d.ts +5 -0
- package/dist/scenes/diagnostics.js +22 -0
- package/dist/scenes/diagram-providers.d.ts +2 -0
- package/dist/scenes/diagram-providers.js +181 -0
- package/dist/scenes/diagram-validation.d.ts +22 -0
- package/dist/scenes/diagram-validation.js +74 -0
- package/dist/scenes/environment.d.ts +2 -0
- package/dist/scenes/environment.js +65 -0
- package/dist/scenes/evidence-bundle.d.ts +5 -0
- package/dist/scenes/evidence-bundle.js +42 -0
- package/dist/scenes/evidence-report.d.ts +10 -0
- package/dist/scenes/evidence-report.js +73 -0
- package/dist/scenes/evidence.d.ts +16 -0
- package/dist/scenes/evidence.js +277 -0
- package/dist/scenes/index.d.ts +48 -0
- package/dist/scenes/index.js +312 -0
- package/dist/scenes/inspect.d.ts +9 -0
- package/dist/scenes/inspect.js +64 -0
- package/dist/scenes/loader.d.ts +3 -0
- package/dist/scenes/loader.js +38 -0
- package/dist/scenes/logs.d.ts +2 -0
- package/dist/scenes/logs.js +47 -0
- package/dist/scenes/operations.d.ts +3 -0
- package/dist/scenes/operations.js +128 -0
- package/dist/scenes/phase0.d.ts +9 -0
- package/dist/scenes/phase0.js +637 -0
- package/dist/scenes/planner.d.ts +12 -0
- package/dist/scenes/planner.js +166 -0
- package/dist/scenes/playwright-adapter.d.ts +2 -0
- package/dist/scenes/playwright-adapter.js +63 -0
- package/dist/scenes/plugins.d.ts +5 -0
- package/dist/scenes/plugins.js +115 -0
- package/dist/scenes/progress.d.ts +17 -0
- package/dist/scenes/progress.js +24 -0
- package/dist/scenes/publish-destinations.d.ts +12 -0
- package/dist/scenes/publish-destinations.js +99 -0
- package/dist/scenes/publish-plan-report.d.ts +10 -0
- package/dist/scenes/publish-plan-report.js +70 -0
- package/dist/scenes/publish-plan.d.ts +15 -0
- package/dist/scenes/publish-plan.js +248 -0
- package/dist/scenes/publish-redaction.d.ts +16 -0
- package/dist/scenes/publish-redaction.js +148 -0
- package/dist/scenes/publish-release-record.d.ts +13 -0
- package/dist/scenes/publish-release-record.js +34 -0
- package/dist/scenes/publish-report.d.ts +10 -0
- package/dist/scenes/publish-report.js +67 -0
- package/dist/scenes/publish.d.ts +16 -0
- package/dist/scenes/publish.js +298 -0
- package/dist/scenes/registry.d.ts +12 -0
- package/dist/scenes/registry.js +65 -0
- package/dist/scenes/remotion-adapter.d.ts +3 -0
- package/dist/scenes/remotion-adapter.js +94 -0
- package/dist/scenes/remotion-composition-registry.d.ts +2 -0
- package/dist/scenes/remotion-composition-registry.js +12 -0
- package/dist/scenes/remotion-compositions.d.ts +15 -0
- package/dist/scenes/remotion-compositions.js +464 -0
- package/dist/scenes/remotion-diagrams.d.ts +9 -0
- package/dist/scenes/remotion-diagrams.js +188 -0
- package/dist/scenes/remotion-input.d.ts +13 -0
- package/dist/scenes/remotion-input.js +291 -0
- package/dist/scenes/remotion-visuals.d.ts +29 -0
- package/dist/scenes/remotion-visuals.js +198 -0
- package/dist/scenes/render-media-assets.d.ts +9 -0
- package/dist/scenes/render-media-assets.js +117 -0
- package/dist/scenes/render-report.d.ts +10 -0
- package/dist/scenes/render-report.js +27 -0
- package/dist/scenes/render.d.ts +2 -0
- package/dist/scenes/render.js +218 -0
- package/dist/scenes/reporter.d.ts +3 -0
- package/dist/scenes/reporter.js +101 -0
- package/dist/scenes/resume.d.ts +2 -0
- package/dist/scenes/resume.js +79 -0
- package/dist/scenes/runner.d.ts +2 -0
- package/dist/scenes/runner.js +674 -0
- package/dist/scenes/schema.d.ts +6 -0
- package/dist/scenes/schema.js +994 -0
- package/dist/scenes/seed.d.ts +2 -0
- package/dist/scenes/seed.js +83 -0
- package/dist/scenes/segments.d.ts +15 -0
- package/dist/scenes/segments.js +79 -0
- package/dist/scenes/selectors.d.ts +3 -0
- package/dist/scenes/selectors.js +21 -0
- package/dist/scenes/timeline.d.ts +11 -0
- package/dist/scenes/timeline.js +26 -0
- package/dist/scenes/timeouts.d.ts +6 -0
- package/dist/scenes/timeouts.js +17 -0
- package/dist/scenes/training-captions.d.ts +14 -0
- package/dist/scenes/training-captions.js +98 -0
- package/dist/scenes/training-report.d.ts +10 -0
- package/dist/scenes/training-report.js +78 -0
- package/dist/scenes/training-transcript.d.ts +24 -0
- package/dist/scenes/training-transcript.js +204 -0
- package/dist/scenes/training.d.ts +10 -0
- package/dist/scenes/training.js +134 -0
- package/dist/scenes/types.d.ts +1872 -0
- package/dist/scenes/types.js +8 -0
- package/dist/scenes/visual-audit-contact-sheets.d.ts +6 -0
- package/dist/scenes/visual-audit-contact-sheets.js +119 -0
- package/dist/scenes/visual-audit-fixtures.d.ts +25 -0
- package/dist/scenes/visual-audit-fixtures.js +210 -0
- package/dist/scenes/visual-audit-report.d.ts +11 -0
- package/dist/scenes/visual-audit-report.js +85 -0
- package/dist/scenes/visual-audit-review.d.ts +23 -0
- package/dist/scenes/visual-audit-review.js +829 -0
- package/dist/scenes/visual-audit-routes.d.ts +13 -0
- package/dist/scenes/visual-audit-routes.js +308 -0
- package/dist/scenes/visual-audit.d.ts +3 -0
- package/dist/scenes/visual-audit.js +596 -0
- package/dist/scripts/build-dist.js +154 -40
- package/dist/scripts/check-build-warnings.js +42 -53
- package/dist/scripts/cleanup-markdown.js +1 -1
- package/dist/scripts/cli-test-fixtures.js +24 -28
- package/dist/scripts/migrate-journey-csv-to-guarantees.js +140 -0
- package/dist/scripts/package-tools.js +12 -1
- package/dist/scripts/prepare.js +3 -7
- package/dist/scripts/release-verify.js +2 -5
- package/dist/scripts/run-fixture-astro-command.js +1 -1
- package/dist/scripts/template-catalog.test.js +68 -82
- package/dist/scripts/tenant-dev.js +0 -10
- package/dist/scripts/test-cloudflare-local.js +1 -1
- package/dist/scripts/test-scaffold.js +0 -1
- package/dist/scripts/test-smoke.js +3 -3
- package/dist/scripts/treeseed-build-dist.js +4 -7
- package/dist/scripts/treeseed-release-verify.js +1 -1
- package/dist/scripts/verify-driver.js +30 -21
- package/dist/scripts/workflow-commands.test.js +18 -27
- package/dist/scripts/workspace-command-e2e.js +1 -1
- package/dist/scripts/workspace-lint.js +6 -0
- package/dist/scripts/workspace-release-test.js +90 -1
- package/dist/scripts/workspace-test.js +6 -0
- package/dist/sdk-dispatch.d.ts +1 -1
- package/dist/sdk-dispatch.js +0 -16
- package/dist/sdk-fields.d.ts +1 -1
- package/dist/sdk-filters.d.ts +1 -1
- package/dist/sdk-types.d.ts +1184 -113
- package/dist/sdk-types.js +393 -0
- package/dist/sdk.d.ts +74 -79
- package/dist/sdk.js +27 -36
- package/dist/secrets-capability.d.ts +421 -0
- package/dist/secrets-capability.js +530 -0
- package/dist/seeds/normalize.js +1 -0
- package/dist/seeds/planner.js +38 -0
- package/dist/seeds/schema.js +293 -4
- package/dist/seeds/types.d.ts +60 -0
- package/dist/seeds/types.js +9 -1
- package/dist/service-credentials.d.ts +54 -0
- package/dist/service-credentials.js +112 -0
- package/dist/stores/cursor-store.d.ts +2 -2
- package/dist/stores/envelopes.d.ts +1 -1
- package/dist/stores/helpers.d.ts +1 -1
- package/dist/stores/lease-store.d.ts +2 -2
- package/dist/stores/message-store.d.ts +2 -2
- package/dist/stores/operational-store.d.ts +3 -26
- package/dist/stores/operational-store.js +0 -225
- package/dist/stores/project-workflow-store.d.ts +2 -2
- package/dist/stores/run-store.d.ts +2 -3
- package/dist/stores/run-store.js +0 -98
- package/dist/stores/subscription-store.d.ts +2 -3
- package/dist/stores/subscription-store.js +0 -100
- package/dist/template-catalog.d.ts +1 -1
- package/dist/template-launch-requirements.d.ts +2 -2
- package/dist/template-launch-ui.d.ts +2 -2
- package/dist/treedx/adapters.d.ts +6 -6
- package/dist/treedx/client.d.ts +1 -1
- package/dist/treedx/errors.d.ts +1 -1
- package/dist/treedx/federated-client.d.ts +3 -3
- package/dist/treedx/graph-adapter.d.ts +2 -2
- package/dist/treedx/index.d.ts +14 -14
- package/dist/treedx/market-integration.d.ts +1 -1
- package/dist/treedx/ports.d.ts +30 -30
- package/dist/treedx/query-adapter.d.ts +3 -3
- package/dist/treedx/registry-client.d.ts +2 -2
- package/dist/treedx/repository-adapter.d.ts +4 -4
- package/dist/treedx/repository-adapter.js +14 -3
- package/dist/treedx/sdk-integration.d.ts +3 -3
- package/dist/treedx/types.d.ts +2 -2
- package/dist/treedx/workspace-adapter.d.ts +2 -2
- package/dist/treedx-backends.d.ts +13 -11
- package/dist/treedx-backends.js +52 -50
- package/dist/treedx-client.d.ts +3 -0
- package/dist/treedx-client.js +10 -1
- package/dist/treeseed/services/compose.yml +2 -3
- package/dist/treeseed/template-catalog/catalog.fixture.json +4 -4
- package/dist/types/agents.d.ts +256 -0
- package/dist/types/agents.js +42 -1
- package/dist/verification.d.ts +1 -0
- package/dist/verification.js +143 -14
- package/dist/workflow/operations.d.ts +510 -559
- package/dist/workflow/operations.js +1891 -1342
- package/dist/workflow/policy.js +19 -7
- package/dist/workflow/runs.d.ts +9 -3
- package/dist/workflow/runs.js +66 -26
- package/dist/workflow/session.d.ts +4 -1
- package/dist/workflow/session.js +50 -10
- package/dist/workflow/worktrees.d.ts +6 -2
- package/dist/workflow/worktrees.js +98 -15
- package/dist/workflow-state.d.ts +5 -5
- package/dist/workflow-state.js +27 -17
- package/dist/workflow-support.d.ts +26 -25
- package/dist/workflow-support.js +27 -31
- package/dist/workflow.d.ts +46 -16
- package/dist/workflow.js +19 -7
- package/drizzle/d1/0000_treeseed_d1.sql +0 -18
- package/drizzle/market/0000_market_control_plane.sql +1793 -1499
- package/drizzle/market/0005_agent_capacity_coordination.sql +145 -0
- package/drizzle/market/0006_provider_assignment_lifecycle.sql +9 -0
- package/drizzle/market/0007_agent_architecture_gap_closure.sql +157 -0
- package/drizzle/market/0008_agent_capacity_operational_closure.sql +27 -0
- package/drizzle/market/0009_agent_capacity_runtime_hardening.sql +29 -0
- package/drizzle/market/0010_secrets_capability_persistence.sql +130 -0
- package/drizzle/market/0011_github_app_adapter.sql +47 -0
- package/drizzle/market/0012_workday_test_runs.sql +44 -0
- package/drizzle/market/0013_runtime_task_lifecycle.sql +39 -0
- package/drizzle/market/0014_governance_pipeline.sql +189 -0
- package/package.json +75 -18
- package/scripts/{verify-driver.mjs → verify-driver.ts} +19 -4
- package/templates/github/deploy-web.workflow.yml +12 -8
- package/dist/operations/services/mailpit-runtime.d.ts +0 -20
- package/dist/operations/services/mailpit-runtime.js +0 -67
- package/dist/operations/services/release-candidate.d.ts +0 -60
- package/dist/operations/services/release-candidate.js +0 -953
- package/dist/scripts/ensure-mailpit.js +0 -48
- package/dist/scripts/logs-mailpit.js +0 -2
- package/dist/scripts/run-ts.js +0 -45
- package/dist/scripts/stop-mailpit.js +0 -5
- package/dist/scripts/treeseed-run-ts.js +0 -45
|
@@ -7,7 +7,6 @@ import { resolveTreeseedWebCachePolicy } from "../../platform/deploy-config.js";
|
|
|
7
7
|
import {
|
|
8
8
|
deleteRailwayCustomDomain,
|
|
9
9
|
deleteRailwayEnvironment,
|
|
10
|
-
deleteRailwayProject,
|
|
11
10
|
deleteRailwayVolume,
|
|
12
11
|
getRailwayServiceInstance,
|
|
13
12
|
listRailwayCustomDomains,
|
|
@@ -23,7 +22,7 @@ import { loadCliDeployConfig, resolveWranglerBin } from "./runtime-tools.js";
|
|
|
23
22
|
import { sdkD1MigrationsRoot } from "./runtime-paths.js";
|
|
24
23
|
const DEFAULT_COMPATIBILITY_DATE = "2026-04-05";
|
|
25
24
|
const DEFAULT_COMPATIBILITY_FLAGS = ["nodejs_compat"];
|
|
26
|
-
const DEFAULT_TREESEED_MARKET_BASE_URL = "https://api.treeseed.
|
|
25
|
+
const DEFAULT_TREESEED_MARKET_BASE_URL = "https://api.treeseed.dev";
|
|
27
26
|
const GENERATED_ROOT = ".treeseed/generated";
|
|
28
27
|
const STATE_ROOT = ".treeseed/state";
|
|
29
28
|
const WORKTREE_METADATA_RELATIVE_PATH = ".treeseed/worktree.json";
|
|
@@ -146,6 +145,24 @@ function deriveApiDomainFromWebDomain(domain) {
|
|
|
146
145
|
}
|
|
147
146
|
return domain.startsWith("api.") ? domain : `api.${domain}`;
|
|
148
147
|
}
|
|
148
|
+
function configuredApiConnectionDomain(deployConfig, scope) {
|
|
149
|
+
const apiConnection = deployConfig.connections?.api?.environments?.[scope];
|
|
150
|
+
const domain = apiConnection?.domain?.trim();
|
|
151
|
+
if (domain) {
|
|
152
|
+
return domain;
|
|
153
|
+
}
|
|
154
|
+
const connectionBaseUrl = primaryHost(apiConnection?.baseUrl);
|
|
155
|
+
if (connectionBaseUrl) {
|
|
156
|
+
return connectionBaseUrl;
|
|
157
|
+
}
|
|
158
|
+
const serviceDomain = deployConfig.services?.api?.environments?.[scope]?.domain?.trim();
|
|
159
|
+
if (serviceDomain) {
|
|
160
|
+
return serviceDomain;
|
|
161
|
+
}
|
|
162
|
+
return primaryHost(
|
|
163
|
+
deployConfig.services?.api?.environments?.[scope]?.baseUrl ?? deployConfig.services?.api?.publicBaseUrl
|
|
164
|
+
);
|
|
165
|
+
}
|
|
149
166
|
function resolveConfiguredSurfaceDomain(deployConfig, target, surface) {
|
|
150
167
|
if (target.kind !== "persistent") {
|
|
151
168
|
return null;
|
|
@@ -155,6 +172,12 @@ function resolveConfiguredSurfaceDomain(deployConfig, target, surface) {
|
|
|
155
172
|
if (configured) {
|
|
156
173
|
return configured;
|
|
157
174
|
}
|
|
175
|
+
if (surface === "api") {
|
|
176
|
+
const apiConnectionDomain = configuredApiConnectionDomain(deployConfig, scope);
|
|
177
|
+
if (apiConnectionDomain) {
|
|
178
|
+
return apiConnectionDomain;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
158
181
|
if (scope === "staging") {
|
|
159
182
|
return deriveTreeseedStagingSurfaceDomain(
|
|
160
183
|
deployConfig,
|
|
@@ -171,6 +194,14 @@ function resolveConfiguredSurfaceDomain(deployConfig, target, surface) {
|
|
|
171
194
|
return deriveApiDomainFromWebDomain(resolveConfiguredSurfaceDomain(deployConfig, target, "web"));
|
|
172
195
|
}
|
|
173
196
|
function resolveConfiguredSurfaceBaseUrl(deployConfig, target, surface) {
|
|
197
|
+
if (surface === "api") {
|
|
198
|
+
const scope = scopeFromTarget(target);
|
|
199
|
+
const apiConnection = deployConfig.connections?.api?.environments?.[scope];
|
|
200
|
+
const connectionBaseUrl = apiConnection?.baseUrl ?? (apiConnection?.domain ? `https://${apiConnection.domain}` : null);
|
|
201
|
+
if (connectionBaseUrl) {
|
|
202
|
+
return connectionBaseUrl;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
174
205
|
const configuredDomain = resolveConfiguredSurfaceDomain(deployConfig, target, surface);
|
|
175
206
|
if (configuredDomain) {
|
|
176
207
|
return `https://${configuredDomain}`;
|
|
@@ -301,6 +332,7 @@ function resolveContentServingMode(deployConfig, options = {}) {
|
|
|
301
332
|
return deployConfig.providers?.content?.serving ?? "local_collections";
|
|
302
333
|
}
|
|
303
334
|
function buildPublicVars(deployConfig, options = {}) {
|
|
335
|
+
const target = options.target ? normalizeTarget(options.target) : createPersistentDeployTarget("prod");
|
|
304
336
|
const identity = resolveTreeseedResourceIdentity(deployConfig, createPersistentDeployTarget("prod"));
|
|
305
337
|
const contentRuntimeProvider = deployConfig.providers?.content?.runtime ?? "team_scoped_r2_overlay";
|
|
306
338
|
const contentPublishProvider = deployConfig.providers?.content?.publish ?? contentRuntimeProvider;
|
|
@@ -312,20 +344,23 @@ function buildPublicVars(deployConfig, options = {}) {
|
|
|
312
344
|
const managedRuntime = deployConfig.runtime?.mode === "treeseed_managed";
|
|
313
345
|
const workerRailway = deployConfig.services?.worker?.railway ?? {};
|
|
314
346
|
const webCachePolicy = resolveTreeseedWebCachePolicy(deployConfig);
|
|
347
|
+
const projectDomain = target.kind === "persistent" ? resolveConfiguredSurfaceDomain(deployConfig, target, "web") : primaryHost(deployConfig.surfaces?.web?.publicBaseUrl ?? deployConfig.siteUrl);
|
|
315
348
|
return {
|
|
316
349
|
TREESEED_HOSTING_KIND: deployConfig.hosting?.kind ?? "self_hosted_project",
|
|
317
350
|
TREESEED_HOSTING_REGISTRATION: deployConfig.hosting?.registration ?? "none",
|
|
318
351
|
TREESEED_HUB_MODE: deployConfig.hub?.mode ?? "treeseed_hosted",
|
|
319
352
|
TREESEED_RUNTIME_MODE: deployConfig.runtime?.mode ?? "none",
|
|
320
353
|
TREESEED_RUNTIME_REGISTRATION: deployConfig.runtime?.registration ?? "none",
|
|
321
|
-
TREESEED_CENTRAL_MARKET_API_BASE_URL:
|
|
322
|
-
|
|
323
|
-
|
|
354
|
+
TREESEED_CENTRAL_MARKET_API_BASE_URL: resolveConfiguredCentralMarketBaseUrl(deployConfig, target),
|
|
355
|
+
TREESEED_MARKET_API_BASE_URL: resolveConfiguredMarketBaseUrl(deployConfig, target),
|
|
356
|
+
TREESEED_API_BASE_URL: resolveConfiguredMarketBaseUrl(deployConfig, target),
|
|
357
|
+
TREESEED_CATALOG_MARKET_API_BASE_URLS: resolveConfiguredMarketBaseUrl(deployConfig, target) ?? envOrNull("TREESEED_CATALOG_MARKET_API_BASE_URLS"),
|
|
324
358
|
TREESEED_HOSTING_TEAM_ID: contentDefaultTeamId,
|
|
359
|
+
TREESEED_PROJECT_DOMAINS: projectDomain ?? "",
|
|
325
360
|
TREESEED_PROJECT_ID: identity.projectId,
|
|
326
|
-
TREESEED_AGENT_EXECUTION_PROVIDER: deployConfig.providers?.agents?.execution ?? "
|
|
327
|
-
TREESEED_AGENT_REPOSITORY_PROVIDER: deployConfig.providers?.agents?.repository ?? "
|
|
328
|
-
TREESEED_AGENT_VERIFICATION_PROVIDER: deployConfig.providers?.agents?.verification ?? "
|
|
361
|
+
TREESEED_AGENT_EXECUTION_PROVIDER: deployConfig.providers?.agents?.execution ?? "codex",
|
|
362
|
+
TREESEED_AGENT_REPOSITORY_PROVIDER: deployConfig.providers?.agents?.repository ?? "git",
|
|
363
|
+
TREESEED_AGENT_VERIFICATION_PROVIDER: deployConfig.providers?.agents?.verification ?? "local",
|
|
329
364
|
TREESEED_CONTENT_RUNTIME_PROVIDER: contentRuntimeProvider,
|
|
330
365
|
TREESEED_CONTENT_PUBLISH_PROVIDER: contentPublishProvider,
|
|
331
366
|
TREESEED_CONTENT_SERVING_MODE: contentServingMode,
|
|
@@ -380,7 +415,7 @@ function envValue(env, key) {
|
|
|
380
415
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
381
416
|
}
|
|
382
417
|
const LOCAL_RUNTIME_AUTH_ENV_KEYS = [
|
|
383
|
-
"
|
|
418
|
+
"TREESEED_BETTER_AUTH_URL",
|
|
384
419
|
"TREESEED_SITE_URL",
|
|
385
420
|
"TREESEED_AUTH_MODE",
|
|
386
421
|
"TREESEED_AUTH_INTERNAL_SIGNUP",
|
|
@@ -478,15 +513,7 @@ function defaultStateFromConfig(deployConfig, target) {
|
|
|
478
513
|
previewDatabaseId: `dryrun-${suffix}-site-data-preview`
|
|
479
514
|
}
|
|
480
515
|
},
|
|
481
|
-
queues: {
|
|
482
|
-
agentWork: {
|
|
483
|
-
name: environmentScopedIdentityName(identity, deployConfig.cloudflare.queueName ?? "agent-work", target),
|
|
484
|
-
dlqName: environmentScopedIdentityName(identity, deployConfig.cloudflare.dlqName ?? "agent-work-dlq", target),
|
|
485
|
-
binding: deployConfig.cloudflare.queueBinding ?? "AGENT_WORK_QUEUE",
|
|
486
|
-
queueId: null,
|
|
487
|
-
dlqId: null
|
|
488
|
-
}
|
|
489
|
-
},
|
|
516
|
+
queues: {},
|
|
490
517
|
pages: {
|
|
491
518
|
projectName: resolveConfiguredPagesProjectName(deployConfig),
|
|
492
519
|
productionBranch: deployConfig.cloudflare.pages?.productionBranch ?? "main",
|
|
@@ -655,19 +682,7 @@ function loadDeployState(tenantRoot, deployConfig, options = {}) {
|
|
|
655
682
|
binding: defaults.d1Databases.SITE_DATA_DB.binding
|
|
656
683
|
}
|
|
657
684
|
},
|
|
658
|
-
queues: {
|
|
659
|
-
...defaults.queues ?? {},
|
|
660
|
-
...persisted.queues ?? {},
|
|
661
|
-
agentWork: {
|
|
662
|
-
...defaults.queues?.agentWork ?? {},
|
|
663
|
-
...persisted.queues?.agentWork ?? {},
|
|
664
|
-
name: defaults.queues?.agentWork?.name ?? persisted.queues?.agentWork?.name ?? "agent-work",
|
|
665
|
-
dlqName: defaults.queues?.agentWork?.dlqName ?? persisted.queues?.agentWork?.dlqName ?? "agent-work-dlq",
|
|
666
|
-
binding: defaults.queues?.agentWork?.binding ?? persisted.queues?.agentWork?.binding ?? "AGENT_WORK_QUEUE",
|
|
667
|
-
queueId: persisted.queues?.agentWork?.queueId ?? defaults.queues?.agentWork?.queueId ?? null,
|
|
668
|
-
dlqId: persisted.queues?.agentWork?.dlqId ?? defaults.queues?.agentWork?.dlqId ?? null
|
|
669
|
-
}
|
|
670
|
-
},
|
|
685
|
+
queues: {},
|
|
671
686
|
generatedSecrets: {
|
|
672
687
|
...defaults.generatedSecrets ?? {},
|
|
673
688
|
...persisted.generatedSecrets ?? {}
|
|
@@ -925,7 +940,7 @@ function isWranglerAlreadyExistsError(error, matchers) {
|
|
|
925
940
|
return matchers.some((matcher) => matcher.test(message));
|
|
926
941
|
}
|
|
927
942
|
function listKvNamespaces(tenantRoot, env) {
|
|
928
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
943
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
929
944
|
if (!accountId) {
|
|
930
945
|
return [];
|
|
931
946
|
}
|
|
@@ -936,7 +951,7 @@ function listKvNamespaces(tenantRoot, env) {
|
|
|
936
951
|
return Array.isArray(payload?.result) ? payload.result : [];
|
|
937
952
|
}
|
|
938
953
|
function listD1Databases(tenantRoot, env) {
|
|
939
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
954
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
940
955
|
if (!accountId) {
|
|
941
956
|
return [];
|
|
942
957
|
}
|
|
@@ -947,7 +962,7 @@ function listD1Databases(tenantRoot, env) {
|
|
|
947
962
|
return Array.isArray(payload?.result) ? payload.result : [];
|
|
948
963
|
}
|
|
949
964
|
function listQueues(tenantRoot, env) {
|
|
950
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
965
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
951
966
|
if (!accountId) {
|
|
952
967
|
return [];
|
|
953
968
|
}
|
|
@@ -958,7 +973,7 @@ function listQueues(tenantRoot, env) {
|
|
|
958
973
|
return Array.isArray(payload?.result) ? payload.result : [];
|
|
959
974
|
}
|
|
960
975
|
function listR2Buckets(tenantRoot, env) {
|
|
961
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
976
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
962
977
|
if (!accountId) {
|
|
963
978
|
return [];
|
|
964
979
|
}
|
|
@@ -969,7 +984,7 @@ function listR2Buckets(tenantRoot, env) {
|
|
|
969
984
|
return Array.isArray(payload?.result?.buckets) ? payload.result.buckets : [];
|
|
970
985
|
}
|
|
971
986
|
function listPagesProjects(tenantRoot, env) {
|
|
972
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
987
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
973
988
|
if (!accountId) {
|
|
974
989
|
return [];
|
|
975
990
|
}
|
|
@@ -980,7 +995,7 @@ function listPagesProjects(tenantRoot, env) {
|
|
|
980
995
|
return Array.isArray(payload?.result) ? payload.result : [];
|
|
981
996
|
}
|
|
982
997
|
function listTurnstileWidgets(tenantRoot, env) {
|
|
983
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
998
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
984
999
|
if (!accountId) {
|
|
985
1000
|
return [];
|
|
986
1001
|
}
|
|
@@ -991,7 +1006,7 @@ function listTurnstileWidgets(tenantRoot, env) {
|
|
|
991
1006
|
return Array.isArray(payload?.result) ? payload.result : [];
|
|
992
1007
|
}
|
|
993
1008
|
function listWorkers(tenantRoot, env) {
|
|
994
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
1009
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
995
1010
|
if (!accountId) {
|
|
996
1011
|
return [];
|
|
997
1012
|
}
|
|
@@ -1033,7 +1048,7 @@ function listDnsRecords(zoneId, env) {
|
|
|
1033
1048
|
return records;
|
|
1034
1049
|
}
|
|
1035
1050
|
function getTurnstileWidget(env, sitekey) {
|
|
1036
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
1051
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
1037
1052
|
if (!accountId || !sitekey) {
|
|
1038
1053
|
return null;
|
|
1039
1054
|
}
|
|
@@ -1044,7 +1059,7 @@ function getTurnstileWidget(env, sitekey) {
|
|
|
1044
1059
|
return payload?.result ?? null;
|
|
1045
1060
|
}
|
|
1046
1061
|
function createTurnstileWidget(env, input) {
|
|
1047
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
1062
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
1048
1063
|
if (!accountId) {
|
|
1049
1064
|
throw new Error("Configure CLOUDFLARE_ACCOUNT_ID before creating Turnstile widgets.");
|
|
1050
1065
|
}
|
|
@@ -1064,7 +1079,7 @@ function createTurnstileWidget(env, input) {
|
|
|
1064
1079
|
}
|
|
1065
1080
|
}
|
|
1066
1081
|
function updateTurnstileWidget(env, sitekey, input) {
|
|
1067
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
1082
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
1068
1083
|
if (!accountId || !sitekey) {
|
|
1069
1084
|
throw new Error("Configure CLOUDFLARE_ACCOUNT_ID and sitekey before updating Turnstile widgets.");
|
|
1070
1085
|
}
|
|
@@ -1167,13 +1182,10 @@ function buildProvisioningSummary(deployConfig, state, target) {
|
|
|
1167
1182
|
formGuardKv: state.kvNamespaces.FORM_GUARD_KV,
|
|
1168
1183
|
sessionKv: state.kvNamespaces.SESSION ?? null,
|
|
1169
1184
|
siteDataDb: state.d1Databases.SITE_DATA_DB,
|
|
1170
|
-
queue: state.queues?.agentWork ?? null,
|
|
1171
1185
|
content: state.content ?? null,
|
|
1172
1186
|
resources: {
|
|
1173
1187
|
pagesProject: state.pages?.projectName ?? null,
|
|
1174
1188
|
contentBucket: state.content?.bucketName ?? null,
|
|
1175
|
-
queue: state.queues?.agentWork?.name ?? null,
|
|
1176
|
-
dlq: state.queues?.agentWork?.dlqName ?? null,
|
|
1177
1189
|
database: state.d1Databases?.SITE_DATA_DB?.databaseName ?? null,
|
|
1178
1190
|
turnstileWidget: state.turnstileWidgets?.formGuard?.name ?? null,
|
|
1179
1191
|
formGuardKv: state.kvNamespaces?.FORM_GUARD_KV?.name ?? null,
|
|
@@ -1241,7 +1253,7 @@ function shouldManageCloudflareWebCacheRules(deployConfig, target) {
|
|
|
1241
1253
|
return Boolean(webTarget?.host && !webTarget.host.endsWith(".workers.dev") && !webTarget.host.endsWith(".pages.dev"));
|
|
1242
1254
|
}
|
|
1243
1255
|
function cloudflareApiRequest(path, { method = "GET", body, env, allowFailure = false } = {}) {
|
|
1244
|
-
const token = env?.CLOUDFLARE_API_TOKEN ?? process.env.
|
|
1256
|
+
const token = env?.TREESEED_CLOUDFLARE_API_TOKEN ?? env?.CLOUDFLARE_API_TOKEN ?? process.env.TREESEED_CLOUDFLARE_API_TOKEN ?? "";
|
|
1245
1257
|
if (!token) {
|
|
1246
1258
|
if (allowFailure) {
|
|
1247
1259
|
return null;
|
|
@@ -1405,6 +1417,13 @@ function listCloudflareZoneRulesets(zoneId, env) {
|
|
|
1405
1417
|
const result = cloudflareApiRequest(`/zones/${zoneId}/rulesets`, { env, allowFailure: true });
|
|
1406
1418
|
return Array.isArray(result?.result) ? result.result : [];
|
|
1407
1419
|
}
|
|
1420
|
+
function joinCloudflareAndExpression(clauses) {
|
|
1421
|
+
const parts = clauses.map((clause) => typeof clause === "string" ? clause.trim() : "").filter((clause) => clause.length > 0).map((clause) => clause.startsWith("(") && clause.endsWith(")") ? clause : `(${clause})`);
|
|
1422
|
+
if (parts.length === 0) {
|
|
1423
|
+
throw new Error("Cannot build a Cloudflare expression without predicates.");
|
|
1424
|
+
}
|
|
1425
|
+
return `(${parts.join(" and ")})`;
|
|
1426
|
+
}
|
|
1408
1427
|
function buildTreeseedManagedCloudflareCacheRules(deployConfig, cacheTarget, kind) {
|
|
1409
1428
|
if (!cacheTarget?.host) {
|
|
1410
1429
|
return [];
|
|
@@ -1412,12 +1431,16 @@ function buildTreeseedManagedCloudflareCacheRules(deployConfig, cacheTarget, kin
|
|
|
1412
1431
|
const policy = resolveTreeseedWebCachePolicy(deployConfig);
|
|
1413
1432
|
const cachePolicy = kind === "web" ? policy.contentPages : policy.r2PublishedObjects;
|
|
1414
1433
|
const hostExpression = `(http.host eq "${cacheTarget.host}")`;
|
|
1415
|
-
const pathExpression = cacheTarget.pathPrefix ? `(starts_with(http.request.uri.path, "${cacheTarget.pathPrefix}/") or (http.request.uri.path eq "${cacheTarget.pathPrefix}"))` :
|
|
1434
|
+
const pathExpression = cacheTarget.pathPrefix ? `(starts_with(http.request.uri.path, "${cacheTarget.pathPrefix}/") or (http.request.uri.path eq "${cacheTarget.pathPrefix}"))` : null;
|
|
1416
1435
|
if (kind === "content") {
|
|
1417
1436
|
return [
|
|
1418
1437
|
{
|
|
1419
1438
|
description: "treeseed-managed: cache public r2 objects",
|
|
1420
|
-
expression:
|
|
1439
|
+
expression: joinCloudflareAndExpression([
|
|
1440
|
+
hostExpression,
|
|
1441
|
+
pathExpression,
|
|
1442
|
+
'(http.request.method in {"GET" "HEAD"})'
|
|
1443
|
+
]),
|
|
1421
1444
|
action: "set_cache_settings",
|
|
1422
1445
|
action_parameters: {
|
|
1423
1446
|
cache: true,
|
|
@@ -1435,21 +1458,31 @@ function buildTreeseedManagedCloudflareCacheRules(deployConfig, cacheTarget, kin
|
|
|
1435
1458
|
];
|
|
1436
1459
|
}
|
|
1437
1460
|
const sourcePaths = policy.sourcePages.paths.map((path) => path === "/" ? "/" : path.replace(/\/+$/u, ""));
|
|
1438
|
-
const sourcePathExpression = sourcePaths.length > 0 ? `(${sourcePaths.map((path) => `(http.request.uri.path eq "${path}")`).join(" or ")})` :
|
|
1439
|
-
const notSourcePathExpression = sourcePaths.length > 0 ? `not ${sourcePathExpression}` :
|
|
1440
|
-
|
|
1461
|
+
const sourcePathExpression = sourcePaths.length > 0 ? `(${sourcePaths.map((path) => `(http.request.uri.path eq "${path}")`).join(" or ")})` : null;
|
|
1462
|
+
const notSourcePathExpression = sourcePaths.length > 0 ? `not ${sourcePathExpression}` : null;
|
|
1463
|
+
const rules = [
|
|
1441
1464
|
{
|
|
1442
1465
|
description: "treeseed-managed: bypass preview and dynamic routes",
|
|
1443
|
-
expression:
|
|
1466
|
+
expression: joinCloudflareAndExpression([
|
|
1467
|
+
hostExpression,
|
|
1468
|
+
'((starts_with(http.request.uri.path, "/api/")) or (http.request.uri.path eq "/api") or (starts_with(http.request.uri.path, "/auth")) or (starts_with(http.request.uri.path, "/admin")) or (starts_with(http.request.uri.path, "/app")) or (starts_with(http.request.uri.path, "/internal")) or (http.request.uri.query contains "preview=") or (http.cookie contains "treeseed-content-preview="))'
|
|
1469
|
+
]),
|
|
1444
1470
|
action: "set_cache_settings",
|
|
1445
1471
|
action_parameters: {
|
|
1446
1472
|
cache: false
|
|
1447
1473
|
},
|
|
1448
1474
|
enabled: true
|
|
1449
|
-
}
|
|
1450
|
-
|
|
1475
|
+
}
|
|
1476
|
+
];
|
|
1477
|
+
if (sourcePathExpression) {
|
|
1478
|
+
rules.push({
|
|
1451
1479
|
description: "treeseed-managed: cache source html routes",
|
|
1452
|
-
expression:
|
|
1480
|
+
expression: joinCloudflareAndExpression([
|
|
1481
|
+
hostExpression,
|
|
1482
|
+
pathExpression,
|
|
1483
|
+
sourcePathExpression,
|
|
1484
|
+
'(http.request.method in {"GET" "HEAD"})'
|
|
1485
|
+
]),
|
|
1453
1486
|
action: "set_cache_settings",
|
|
1454
1487
|
action_parameters: {
|
|
1455
1488
|
cache: true,
|
|
@@ -1463,10 +1496,26 @@ function buildTreeseedManagedCloudflareCacheRules(deployConfig, cacheTarget, kin
|
|
|
1463
1496
|
}
|
|
1464
1497
|
},
|
|
1465
1498
|
enabled: true
|
|
1466
|
-
}
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
rules.push(
|
|
1467
1502
|
{
|
|
1468
1503
|
description: "treeseed-managed: cache content html routes",
|
|
1469
|
-
expression:
|
|
1504
|
+
expression: joinCloudflareAndExpression([
|
|
1505
|
+
hostExpression,
|
|
1506
|
+
pathExpression,
|
|
1507
|
+
notSourcePathExpression,
|
|
1508
|
+
'(http.request.method in {"GET" "HEAD"})',
|
|
1509
|
+
'(http.request.uri.path.extension eq "")',
|
|
1510
|
+
'not (starts_with(http.request.uri.path, "/api/"))',
|
|
1511
|
+
'not (http.request.uri.path eq "/api")',
|
|
1512
|
+
'not (starts_with(http.request.uri.path, "/auth"))',
|
|
1513
|
+
'not (starts_with(http.request.uri.path, "/admin"))',
|
|
1514
|
+
'not (starts_with(http.request.uri.path, "/app"))',
|
|
1515
|
+
'not (starts_with(http.request.uri.path, "/internal"))',
|
|
1516
|
+
'not (http.request.uri.query contains "preview=")',
|
|
1517
|
+
'not (http.cookie contains "treeseed-content-preview=")'
|
|
1518
|
+
]),
|
|
1470
1519
|
action: "set_cache_settings",
|
|
1471
1520
|
action_parameters: {
|
|
1472
1521
|
cache: true,
|
|
@@ -1481,7 +1530,8 @@ function buildTreeseedManagedCloudflareCacheRules(deployConfig, cacheTarget, kin
|
|
|
1481
1530
|
},
|
|
1482
1531
|
enabled: true
|
|
1483
1532
|
}
|
|
1484
|
-
|
|
1533
|
+
);
|
|
1534
|
+
return rules;
|
|
1485
1535
|
}
|
|
1486
1536
|
function reconcileCloudflareCacheRulesForTarget(role, deployConfig, state, cacheTarget, env, { dryRun = false } = {}) {
|
|
1487
1537
|
const roleKey = role === "web" ? "Web" : "Content";
|
|
@@ -1535,7 +1585,7 @@ function reconcileCloudflareWebCacheRules(tenantRoot, deployConfig, state, targe
|
|
|
1535
1585
|
return { managed: false, skipped: true, reason: "unsupported_target_or_host" };
|
|
1536
1586
|
}
|
|
1537
1587
|
const env = {
|
|
1538
|
-
CLOUDFLARE_API_TOKEN: providedEnv?.CLOUDFLARE_API_TOKEN ?? process.env.
|
|
1588
|
+
CLOUDFLARE_API_TOKEN: providedEnv?.CLOUDFLARE_API_TOKEN ?? process.env.TREESEED_CLOUDFLARE_API_TOKEN ?? ""
|
|
1539
1589
|
};
|
|
1540
1590
|
if (!env.CLOUDFLARE_API_TOKEN) {
|
|
1541
1591
|
state.webCache.webHost = resolvePublicWebCacheTarget(deployConfig)?.host ?? null;
|
|
@@ -1608,7 +1658,7 @@ function queueId(entry) {
|
|
|
1608
1658
|
}
|
|
1609
1659
|
function hasProvisionedCloudflareResources(state) {
|
|
1610
1660
|
return Boolean(
|
|
1611
|
-
state?.pages?.projectName && state?.pages?.url && state?.d1Databases?.SITE_DATA_DB?.databaseId && state?.kvNamespaces?.FORM_GUARD_KV?.id && state?.
|
|
1661
|
+
state?.pages?.projectName && state?.pages?.url && state?.d1Databases?.SITE_DATA_DB?.databaseId && state?.kvNamespaces?.FORM_GUARD_KV?.id && state?.content?.bucketName
|
|
1612
1662
|
);
|
|
1613
1663
|
}
|
|
1614
1664
|
function absoluteUrlForPath(baseUrl, path) {
|
|
@@ -1638,14 +1688,14 @@ function purgeSourcePageCaches(tenantRoot, options = {}) {
|
|
|
1638
1688
|
const deployConfig = loadTenantDeployConfig(tenantRoot);
|
|
1639
1689
|
const state = loadDeployState(tenantRoot, deployConfig, { target });
|
|
1640
1690
|
const urls = resolveSourcePagePurgeUrls(deployConfig);
|
|
1641
|
-
if ((options.dryRun ?? false) || urls.length === 0 || !process.env.
|
|
1691
|
+
if ((options.dryRun ?? false) || urls.length === 0 || !process.env.TREESEED_CLOUDFLARE_API_TOKEN) {
|
|
1642
1692
|
recordCachePurgeResult(state.webCache.deployPurge, urls.map((url) => ({ count: url ? 1 : 0 })));
|
|
1643
1693
|
writeDeployState(tenantRoot, state, { target });
|
|
1644
1694
|
return { skipped: options.dryRun ?? false, urls, results: [] };
|
|
1645
1695
|
}
|
|
1646
1696
|
try {
|
|
1647
1697
|
const results = purgeCloudflareCacheByUrls(urls, deployConfig, {
|
|
1648
|
-
env: { CLOUDFLARE_API_TOKEN: process.env.
|
|
1698
|
+
env: { CLOUDFLARE_API_TOKEN: process.env.TREESEED_CLOUDFLARE_API_TOKEN }
|
|
1649
1699
|
});
|
|
1650
1700
|
recordCachePurgeResult(state.webCache.deployPurge, results);
|
|
1651
1701
|
writeDeployState(tenantRoot, state, { target });
|
|
@@ -1660,14 +1710,14 @@ function purgePublishedContentCaches(tenantRoot, urls, options = {}) {
|
|
|
1660
1710
|
const target = normalizeTarget(options.scope ?? options.target ?? "prod");
|
|
1661
1711
|
const deployConfig = loadTenantDeployConfig(tenantRoot);
|
|
1662
1712
|
const state = loadDeployState(tenantRoot, deployConfig, { target });
|
|
1663
|
-
if ((options.dryRun ?? false) || !urls?.length || !process.env.
|
|
1713
|
+
if ((options.dryRun ?? false) || !urls?.length || !process.env.TREESEED_CLOUDFLARE_API_TOKEN) {
|
|
1664
1714
|
recordCachePurgeResult(state.webCache.contentPurge, (urls ?? []).map((url) => ({ count: url ? 1 : 0 })));
|
|
1665
1715
|
writeDeployState(tenantRoot, state, { target });
|
|
1666
1716
|
return { skipped: options.dryRun ?? false, urls: urls ?? [], results: [] };
|
|
1667
1717
|
}
|
|
1668
1718
|
try {
|
|
1669
1719
|
const results = purgeCloudflareCacheByUrls(urls, deployConfig, {
|
|
1670
|
-
env: { CLOUDFLARE_API_TOKEN: process.env.
|
|
1720
|
+
env: { CLOUDFLARE_API_TOKEN: process.env.TREESEED_CLOUDFLARE_API_TOKEN }
|
|
1671
1721
|
});
|
|
1672
1722
|
recordCachePurgeResult(state.webCache.contentPurge, results);
|
|
1673
1723
|
writeDeployState(tenantRoot, state, { target });
|
|
@@ -1687,8 +1737,41 @@ function isPlaceholderAccountId(value) {
|
|
|
1687
1737
|
function resolveConfiguredCloudflareAccountId(deployConfig) {
|
|
1688
1738
|
return envOrNull("CLOUDFLARE_ACCOUNT_ID") ?? deployConfig.cloudflare.accountId;
|
|
1689
1739
|
}
|
|
1690
|
-
function
|
|
1691
|
-
|
|
1740
|
+
function normalizeConfiguredBaseUrl(value) {
|
|
1741
|
+
const raw = typeof value === "string" ? value.trim() : "";
|
|
1742
|
+
if (!raw) {
|
|
1743
|
+
return null;
|
|
1744
|
+
}
|
|
1745
|
+
return raw.replace(/\/+$/u, "");
|
|
1746
|
+
}
|
|
1747
|
+
function domainBaseUrl(domain) {
|
|
1748
|
+
const raw = typeof domain === "string" ? domain.trim() : "";
|
|
1749
|
+
if (!raw) {
|
|
1750
|
+
return null;
|
|
1751
|
+
}
|
|
1752
|
+
if (/^https?:\/\//iu.test(raw)) {
|
|
1753
|
+
return normalizeConfiguredBaseUrl(raw);
|
|
1754
|
+
}
|
|
1755
|
+
return `https://${raw.replace(/^\/+|\/+$/gu, "")}`;
|
|
1756
|
+
}
|
|
1757
|
+
function targetEnvironmentKey(target) {
|
|
1758
|
+
if (target?.kind === "persistent") {
|
|
1759
|
+
return target.scope;
|
|
1760
|
+
}
|
|
1761
|
+
return "staging";
|
|
1762
|
+
}
|
|
1763
|
+
function resolveConfiguredApiConnectionBaseUrl(deployConfig, target) {
|
|
1764
|
+
const scope = targetEnvironmentKey(target);
|
|
1765
|
+
if (scope === "local") {
|
|
1766
|
+
return normalizeConfiguredBaseUrl(deployConfig.connections?.api?.localBaseUrl) ?? normalizeConfiguredBaseUrl(deployConfig.connections?.api?.environments?.local?.baseUrl) ?? domainBaseUrl(deployConfig.connections?.api?.environments?.local?.domain);
|
|
1767
|
+
}
|
|
1768
|
+
return normalizeConfiguredBaseUrl(deployConfig.connections?.api?.environments?.[scope]?.baseUrl) ?? domainBaseUrl(deployConfig.connections?.api?.environments?.[scope]?.domain);
|
|
1769
|
+
}
|
|
1770
|
+
function resolveConfiguredMarketBaseUrl(deployConfig, target) {
|
|
1771
|
+
return resolveConfiguredApiConnectionBaseUrl(deployConfig, target) ?? envOrNull("TREESEED_API_BASE_URL") ?? deployConfig.runtime?.marketBaseUrl ?? deployConfig.hosting?.marketBaseUrl ?? envOrNull("TREESEED_CENTRAL_MARKET_API_BASE_URL") ?? DEFAULT_TREESEED_MARKET_BASE_URL;
|
|
1772
|
+
}
|
|
1773
|
+
function resolveConfiguredCentralMarketBaseUrl(deployConfig, target) {
|
|
1774
|
+
return resolveConfiguredApiConnectionBaseUrl(deployConfig, target) ?? envOrNull("TREESEED_CENTRAL_MARKET_API_BASE_URL") ?? DEFAULT_TREESEED_MARKET_BASE_URL;
|
|
1692
1775
|
}
|
|
1693
1776
|
function resolveConfiguredPagesProjectName(deployConfig) {
|
|
1694
1777
|
return sharedDeploymentName(resolveTreeseedResourceIdentity(deployConfig, createPersistentDeployTarget("prod")));
|
|
@@ -1865,7 +1948,7 @@ function deleteKvNamespace(tenantRoot, namespaceId, { env, dryRun, preview = fal
|
|
|
1865
1948
|
if (dryRun) {
|
|
1866
1949
|
return { status: "planned", id: namespaceId, preview };
|
|
1867
1950
|
}
|
|
1868
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
1951
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
1869
1952
|
const path = accountId ? `/accounts/${encodeURIComponent(accountId)}/storage/kv/namespaces/${encodeURIComponent(namespaceId)}` : null;
|
|
1870
1953
|
const deleted = deleteCloudflareApiResource(path, { env, dryRun: false, name: namespaceId, type: "kv-namespace" });
|
|
1871
1954
|
return { status: deleted.status, id: namespaceId, preview };
|
|
@@ -1877,7 +1960,7 @@ function deleteTurnstileWidget(sitekey, { env, dryRun, name = null }) {
|
|
|
1877
1960
|
if (dryRun) {
|
|
1878
1961
|
return { status: "planned", sitekey, name };
|
|
1879
1962
|
}
|
|
1880
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
1963
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
1881
1964
|
const path = accountId ? `/accounts/${encodeURIComponent(accountId)}/challenges/widgets/${encodeURIComponent(sitekey)}` : null;
|
|
1882
1965
|
let deleted;
|
|
1883
1966
|
try {
|
|
@@ -1895,7 +1978,7 @@ function deleteD1Database(tenantRoot, databaseName, { env, dryRun }) {
|
|
|
1895
1978
|
if (dryRun) {
|
|
1896
1979
|
return { status: "planned", name: databaseName };
|
|
1897
1980
|
}
|
|
1898
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
1981
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
1899
1982
|
const database = accountId ? listD1Databases(tenantRoot, env).find((entry) => entry?.name === databaseName) : null;
|
|
1900
1983
|
const databaseId = database?.uuid ?? database?.id ?? null;
|
|
1901
1984
|
const path = accountId && databaseId ? `/accounts/${encodeURIComponent(accountId)}/d1/database/${encodeURIComponent(databaseId)}` : null;
|
|
@@ -1909,7 +1992,7 @@ function deleteWorker(tenantRoot, workerName, { env, dryRun, force = false }) {
|
|
|
1909
1992
|
if (dryRun) {
|
|
1910
1993
|
return { status: "planned", name: workerName };
|
|
1911
1994
|
}
|
|
1912
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
1995
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
1913
1996
|
const path = accountId ? `/accounts/${encodeURIComponent(accountId)}/workers/services/${encodeURIComponent(workerName)}` : null;
|
|
1914
1997
|
const deleted = deleteCloudflareApiResource(path, { env, dryRun: false, name: workerName, type: "worker" });
|
|
1915
1998
|
return { status: deleted.status, name: workerName };
|
|
@@ -1948,7 +2031,7 @@ function deleteQueueByName(tenantRoot, queue, { env, dryRun }) {
|
|
|
1948
2031
|
if (dryRun) {
|
|
1949
2032
|
return resourceOperation("cloudflare", "queue", name, "planned", { id });
|
|
1950
2033
|
}
|
|
1951
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
2034
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
1952
2035
|
if (!id && accountId) {
|
|
1953
2036
|
const live = listQueues(tenantRoot, env).find((entry) => queueName(entry) === name);
|
|
1954
2037
|
id = queueId(live);
|
|
@@ -1965,25 +2048,6 @@ function deleteQueueByName(tenantRoot, queue, { env, dryRun }) {
|
|
|
1965
2048
|
}
|
|
1966
2049
|
throw new Error(`Failed to delete queue ${name}: CLOUDFLARE_ACCOUNT_ID is not configured.`);
|
|
1967
2050
|
}
|
|
1968
|
-
function isLegacyTreeseedQueueName(name, scope) {
|
|
1969
|
-
if (!name || !scope) {
|
|
1970
|
-
return false;
|
|
1971
|
-
}
|
|
1972
|
-
const environmentNames = scope === "prod" ? ["prod", "production"] : [scope];
|
|
1973
|
-
return environmentNames.some(
|
|
1974
|
-
(environmentName) => name === `agent-work-${environmentName}` || name === `agent-work-dlq-${environmentName}`
|
|
1975
|
-
);
|
|
1976
|
-
}
|
|
1977
|
-
function legacyQueueDestroyOperations(tenantRoot, queues, target, knownNames, { env, dryRun }) {
|
|
1978
|
-
const scope = target.kind === "persistent" ? target.scope : target.branchName;
|
|
1979
|
-
return queues.filter((queue) => {
|
|
1980
|
-
const name = queueName(queue);
|
|
1981
|
-
return name && !knownNames.has(name) && isLegacyTreeseedQueueName(name, scope);
|
|
1982
|
-
}).map((queue) => {
|
|
1983
|
-
const deleted = deleteQueueByName(tenantRoot, queue, { env, dryRun });
|
|
1984
|
-
return { ...deleted, legacy: true };
|
|
1985
|
-
});
|
|
1986
|
-
}
|
|
1987
2051
|
function deleteR2Bucket(tenantRoot, bucketName, { env, dryRun, deleteData }) {
|
|
1988
2052
|
if (!bucketName) {
|
|
1989
2053
|
return resourceOperation("cloudflare", "r2-bucket", bucketName, "missing");
|
|
@@ -1995,7 +2059,7 @@ function deleteR2Bucket(tenantRoot, bucketName, { env, dryRun, deleteData }) {
|
|
|
1995
2059
|
return resourceOperation("cloudflare", "r2-bucket", bucketName, "planned");
|
|
1996
2060
|
}
|
|
1997
2061
|
const drained = drainR2Bucket(bucketName, { env });
|
|
1998
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
2062
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
1999
2063
|
const path = accountId ? `/accounts/${encodeURIComponent(accountId)}/r2/buckets/${encodeURIComponent(bucketName)}` : null;
|
|
2000
2064
|
const deleted = deleteCloudflareApiResource(path, { env, dryRun: false, name: bucketName, type: "r2-bucket" });
|
|
2001
2065
|
return resourceOperation("cloudflare", "r2-bucket", bucketName, deleted.status, drained);
|
|
@@ -2004,7 +2068,7 @@ function r2ObjectKey(entry) {
|
|
|
2004
2068
|
return typeof entry?.key === "string" ? entry.key : typeof entry?.name === "string" ? entry.name : "";
|
|
2005
2069
|
}
|
|
2006
2070
|
function listR2Objects(bucketName, { env }) {
|
|
2007
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
2071
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
2008
2072
|
if (!accountId || !bucketName) {
|
|
2009
2073
|
return [];
|
|
2010
2074
|
}
|
|
@@ -2032,7 +2096,7 @@ function listR2Objects(bucketName, { env }) {
|
|
|
2032
2096
|
return objects;
|
|
2033
2097
|
}
|
|
2034
2098
|
function drainR2Bucket(bucketName, { env }) {
|
|
2035
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
2099
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
2036
2100
|
if (!accountId || !bucketName) {
|
|
2037
2101
|
return { objectsDeleted: 0, objectsMissing: 0, objectsDeferred: 0 };
|
|
2038
2102
|
}
|
|
@@ -2064,8 +2128,8 @@ function drainR2Bucket(bucketName, { env }) {
|
|
|
2064
2128
|
return { objectsDeleted, objectsMissing, objectsDeferred };
|
|
2065
2129
|
}
|
|
2066
2130
|
function deleteR2ObjectsBatch(bucketName, keys, { env }) {
|
|
2067
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
2068
|
-
const token = env?.CLOUDFLARE_API_TOKEN ?? process.env.
|
|
2131
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
2132
|
+
const token = env?.CLOUDFLARE_API_TOKEN ?? process.env.TREESEED_CLOUDFLARE_API_TOKEN ?? "";
|
|
2069
2133
|
const uniqueKeys = [...new Set((keys ?? []).filter(Boolean))];
|
|
2070
2134
|
if (!accountId || !bucketName || uniqueKeys.length === 0) {
|
|
2071
2135
|
return { objectsDeleted: 0, objectsMissing: 0, objectsDeferred: 0 };
|
|
@@ -2187,7 +2251,7 @@ function pagesDomainName(domain) {
|
|
|
2187
2251
|
return typeof domain?.name === "string" ? domain.name : typeof domain?.domain === "string" ? domain.domain : typeof domain?.hostname === "string" ? domain.hostname : "";
|
|
2188
2252
|
}
|
|
2189
2253
|
function listPagesCustomDomains(projectName, { env }) {
|
|
2190
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
2254
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
2191
2255
|
if (!projectName || !accountId) {
|
|
2192
2256
|
return [];
|
|
2193
2257
|
}
|
|
@@ -2238,7 +2302,7 @@ function deletePagesCustomDomains(tenantRoot, projectName, knownNames, { env, dr
|
|
|
2238
2302
|
if (dryRun) {
|
|
2239
2303
|
return desiredNames.length > 0 ? desiredNames.map((name) => resourceOperation("cloudflare", "pages-custom-domain", name, "planned", { projectName, knownOnly })) : [resourceOperation("cloudflare", "pages-custom-domain", projectName, knownOnly ? "skipped" : "planned", { reason: knownOnly ? "no_target_scoped_domain" : "project_delete_prerequisite" })];
|
|
2240
2304
|
}
|
|
2241
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
2305
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
2242
2306
|
if (!accountId) {
|
|
2243
2307
|
return desiredNames.length > 0 ? desiredNames.map((name) => resourceOperation("cloudflare", "pages-custom-domain", name, "blocked", { projectName, reason: "missing_cloudflare_account_id" })) : [resourceOperation("cloudflare", "pages-custom-domain", projectName, "blocked", { reason: "missing_cloudflare_account_id" })];
|
|
2244
2308
|
}
|
|
@@ -2263,7 +2327,7 @@ function pagesDeploymentEnvironments(environment = "all") {
|
|
|
2263
2327
|
return environment === "preview" ? ["preview"] : environment === "production" ? ["production"] : ["preview", "production"];
|
|
2264
2328
|
}
|
|
2265
2329
|
function listPagesDeploymentsWithApi(projectName, { env, environment = "all" }) {
|
|
2266
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
2330
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
2267
2331
|
if (!projectName || !accountId) {
|
|
2268
2332
|
return [];
|
|
2269
2333
|
}
|
|
@@ -2317,7 +2381,7 @@ function deletePagesDeployments(tenantRoot, projectName, { env, dryRun, environm
|
|
|
2317
2381
|
if (dryRun) {
|
|
2318
2382
|
return resourceOperation("cloudflare", "pages-deployments", projectName, "planned", { reason: "project_delete_prerequisite", environment });
|
|
2319
2383
|
}
|
|
2320
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
2384
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
2321
2385
|
if (!accountId) {
|
|
2322
2386
|
return resourceOperation("cloudflare", "pages-deployments", projectName, "blocked", { reason: "missing_cloudflare_account_id" });
|
|
2323
2387
|
}
|
|
@@ -2371,7 +2435,7 @@ function deletePagesDeployments(tenantRoot, projectName, { env, dryRun, environm
|
|
|
2371
2435
|
});
|
|
2372
2436
|
}
|
|
2373
2437
|
function deletePagesProject(projectName, { env, dryRun }) {
|
|
2374
|
-
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
2438
|
+
const accountId = env?.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "";
|
|
2375
2439
|
if (!projectName || !accountId) {
|
|
2376
2440
|
return resourceOperation("cloudflare", "pages-project", projectName, "missing");
|
|
2377
2441
|
}
|
|
@@ -2563,17 +2627,19 @@ async function destroyRailwayResources(tenantRoot, deployConfig, target, { dryRu
|
|
|
2563
2627
|
}
|
|
2564
2628
|
}
|
|
2565
2629
|
}
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
const
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2630
|
+
if (deleteData) {
|
|
2631
|
+
const volumes = await listRailwayVolumes({ projectId: project.id, env });
|
|
2632
|
+
for (const volume of volumes) {
|
|
2633
|
+
const matchingInstance = volume.instances.find((instance) => instance.environmentId === environment?.id);
|
|
2634
|
+
if (!matchingInstance) {
|
|
2635
|
+
continue;
|
|
2636
|
+
}
|
|
2637
|
+
if (dryRun) {
|
|
2638
|
+
operations.push(resourceOperation("railway", "volume", volume.name, "planned", { id: volume.id, projectId: project.id }));
|
|
2639
|
+
} else {
|
|
2640
|
+
const result = await deleteRailwayVolume({ volumeId: volume.id, env });
|
|
2641
|
+
operations.push(resourceOperation("railway", "volume", volume.name, result.status, { id: volume.id, projectId: project.id }));
|
|
2642
|
+
}
|
|
2577
2643
|
}
|
|
2578
2644
|
}
|
|
2579
2645
|
const shouldDeleteProject = shouldDeleteRailwayProjectAfterEnvironmentDestroy(project, scope, deleteData, environment?.id ?? null);
|
|
@@ -2584,11 +2650,7 @@ async function destroyRailwayResources(tenantRoot, deployConfig, target, { dryRu
|
|
|
2584
2650
|
reason: scope === "prod" ? "prod_delete_data_cleanup" : "no_managed_persistent_environments"
|
|
2585
2651
|
}));
|
|
2586
2652
|
} else {
|
|
2587
|
-
|
|
2588
|
-
operations.push(resourceOperation("railway", "project", project.name, result.status, {
|
|
2589
|
-
id: project.id,
|
|
2590
|
-
reason: scope === "prod" ? "prod_delete_data_cleanup" : "no_managed_persistent_environments"
|
|
2591
|
-
}));
|
|
2653
|
+
throw new Error("Railway project deletion is reconciler-owned. Use trsd reconcile destroy or live acceptance cleanup for project-scoped deletion.");
|
|
2592
2654
|
}
|
|
2593
2655
|
} else if (environment) {
|
|
2594
2656
|
if (dryRun) {
|
|
@@ -2770,8 +2832,6 @@ function treeSeedSweepTokens(deployConfig, state) {
|
|
|
2770
2832
|
state.pages?.projectName,
|
|
2771
2833
|
state.workerName,
|
|
2772
2834
|
state.content?.bucketName,
|
|
2773
|
-
state.queues?.agentWork?.name,
|
|
2774
|
-
state.queues?.agentWork?.dlqName,
|
|
2775
2835
|
state.kvNamespaces?.FORM_GUARD_KV?.name,
|
|
2776
2836
|
state.kvNamespaces?.SESSION?.name,
|
|
2777
2837
|
state.d1Databases?.SITE_DATA_DB?.databaseName,
|
|
@@ -2978,12 +3038,7 @@ async function sweepTreeSeedRailwayResources(deployConfig, state, { env, dryRun
|
|
|
2978
3038
|
sweep: true
|
|
2979
3039
|
}));
|
|
2980
3040
|
} else {
|
|
2981
|
-
|
|
2982
|
-
operations.push(resourceOperation("railway", "project", project.name, deleted.status, {
|
|
2983
|
-
id: project.id,
|
|
2984
|
-
workspaceId: workspace.id,
|
|
2985
|
-
sweep: true
|
|
2986
|
-
}));
|
|
3041
|
+
throw new Error("Railway project sweep deletion is reconciler-owned. Use trsd reconcile test-live --mode cleanup for isolated cleanup.");
|
|
2987
3042
|
}
|
|
2988
3043
|
}
|
|
2989
3044
|
return operations.length > 0 ? operations : [resourceOperation("railway", "treeseed-sweep", "railway", "missing", { reason: "no_matching_projects" })];
|
|
@@ -3027,8 +3082,6 @@ async function destroyTreeseedEnvironmentResources(tenantRoot, options = {}) {
|
|
|
3027
3082
|
state.turnstileWidgets.formGuard = resolveExistingTurnstileWidget(turnstileWidgets, state.turnstileWidgets?.formGuard);
|
|
3028
3083
|
const pagesProject = pagesProjects.find((entry) => entry?.name === state.pages?.projectName);
|
|
3029
3084
|
const bucket = buckets.find((entry) => entry?.name === state.content?.bucketName);
|
|
3030
|
-
const queue = queues.find((entry) => queueName(entry) === state.queues?.agentWork?.name);
|
|
3031
|
-
const dlq = queues.find((entry) => queueName(entry) === state.queues?.agentWork?.dlqName);
|
|
3032
3085
|
const workerResult = deleteWorker(tenantRoot, state.workerName, { env, dryRun, force });
|
|
3033
3086
|
const turnstileWidget = deleteTurnstileWidget(state.turnstileWidgets?.formGuard?.sitekey, {
|
|
3034
3087
|
env,
|
|
@@ -3055,13 +3108,6 @@ async function destroyTreeseedEnvironmentResources(tenantRoot, options = {}) {
|
|
|
3055
3108
|
return resourceOperation("cloudflare", "kv-namespace", namespace.title, result.status, { ...result, legacy: true });
|
|
3056
3109
|
});
|
|
3057
3110
|
const database = deleteD1DatabaseForDestroy(tenantRoot, state.d1Databases.SITE_DATA_DB.databaseName, { env, dryRun, deleteData });
|
|
3058
|
-
const deletedQueue = deleteQueueByName(tenantRoot, queue ?? { name: state.queues?.agentWork?.name }, { env, dryRun });
|
|
3059
|
-
const deletedDlq = state.queues?.agentWork?.dlqName ? deleteQueueByName(tenantRoot, dlq ?? { name: state.queues.agentWork.dlqName }, { env, dryRun }) : null;
|
|
3060
|
-
const knownQueueNames = new Set([
|
|
3061
|
-
state.queues?.agentWork?.name,
|
|
3062
|
-
state.queues?.agentWork?.dlqName
|
|
3063
|
-
].filter(Boolean));
|
|
3064
|
-
const legacyQueues = legacyQueueDestroyOperations(tenantRoot, queues, target, knownQueueNames, { env, dryRun });
|
|
3065
3111
|
const r2Bucket = bucket || dryRun ? deleteR2Bucket(tenantRoot, state.content?.bucketName, { env, dryRun, deleteData }) : resourceOperation("cloudflare", "r2-bucket", state.content?.bucketName, "missing");
|
|
3066
3112
|
const pageDnsNames = [
|
|
3067
3113
|
state.pages?.customDomain,
|
|
@@ -3099,9 +3145,6 @@ async function destroyTreeseedEnvironmentResources(tenantRoot, options = {}) {
|
|
|
3099
3145
|
...sessionPreview ? [resourceOperation("cloudflare", "kv-namespace-preview", state.kvNamespaces.SESSION.name, sessionPreview.status, sessionPreview)] : [],
|
|
3100
3146
|
...legacyKvNamespaces,
|
|
3101
3147
|
database,
|
|
3102
|
-
deletedQueue,
|
|
3103
|
-
...deletedDlq ? [deletedDlq] : [],
|
|
3104
|
-
...legacyQueues,
|
|
3105
3148
|
r2Bucket,
|
|
3106
3149
|
...pageCustomDomains,
|
|
3107
3150
|
pageDeployments,
|
|
@@ -3157,8 +3200,6 @@ function destroyCloudflareResources(tenantRoot, options = {}) {
|
|
|
3157
3200
|
state.d1Databases.SITE_DATA_DB
|
|
3158
3201
|
);
|
|
3159
3202
|
state.turnstileWidgets.formGuard = resolveExistingTurnstileWidget(turnstileWidgets, state.turnstileWidgets?.formGuard);
|
|
3160
|
-
const queue = queues.find((entry) => queueName(entry) === state.queues?.agentWork?.name);
|
|
3161
|
-
const dlq = queues.find((entry) => queueName(entry) === state.queues?.agentWork?.dlqName);
|
|
3162
3203
|
const bucket = buckets.find((entry) => entry?.name === state.content?.bucketName);
|
|
3163
3204
|
const pagesProject = pagesProjects.find((entry) => entry?.name === state.pages?.projectName);
|
|
3164
3205
|
const worker = deleteWorker(tenantRoot, state.workerName, { env, dryRun, force });
|
|
@@ -3169,13 +3210,6 @@ function destroyCloudflareResources(tenantRoot, options = {}) {
|
|
|
3169
3210
|
});
|
|
3170
3211
|
const formGuard = deleteKvNamespace(tenantRoot, state.kvNamespaces.FORM_GUARD_KV.id, { env, dryRun });
|
|
3171
3212
|
const database = deleteD1DatabaseForDestroy(tenantRoot, state.d1Databases.SITE_DATA_DB.databaseName, { env, dryRun, deleteData });
|
|
3172
|
-
const deletedQueue = deleteQueueByName(tenantRoot, queue ?? { name: state.queues?.agentWork?.name }, { env, dryRun });
|
|
3173
|
-
const deletedDlq = state.queues?.agentWork?.dlqName ? deleteQueueByName(tenantRoot, dlq ?? { name: state.queues.agentWork.dlqName }, { env, dryRun }) : null;
|
|
3174
|
-
const knownQueueNames = new Set([
|
|
3175
|
-
state.queues?.agentWork?.name,
|
|
3176
|
-
state.queues?.agentWork?.dlqName
|
|
3177
|
-
].filter(Boolean));
|
|
3178
|
-
const legacyQueues = legacyQueueDestroyOperations(tenantRoot, queues, target, knownQueueNames, { env, dryRun });
|
|
3179
3213
|
const r2Bucket = bucket || dryRun ? deleteR2Bucket(tenantRoot, state.content?.bucketName, { env, dryRun, deleteData }) : resourceOperation("cloudflare", "r2-bucket", state.content?.bucketName, "missing");
|
|
3180
3214
|
const pages = pagesProject || dryRun ? deletePagesProject(state.pages?.projectName, { env, dryRun }) : resourceOperation("cloudflare", "pages-project", state.pages?.projectName, "missing");
|
|
3181
3215
|
const operations = {
|
|
@@ -3183,9 +3217,6 @@ function destroyCloudflareResources(tenantRoot, options = {}) {
|
|
|
3183
3217
|
turnstileWidget,
|
|
3184
3218
|
formGuard,
|
|
3185
3219
|
database,
|
|
3186
|
-
queue: deletedQueue,
|
|
3187
|
-
dlq: deletedDlq,
|
|
3188
|
-
legacyQueues,
|
|
3189
3220
|
r2Bucket,
|
|
3190
3221
|
pages
|
|
3191
3222
|
};
|
|
@@ -3282,61 +3313,6 @@ function provisionCloudflareResources(tenantRoot, options = {}) {
|
|
|
3282
3313
|
current.databaseId = created.uuid;
|
|
3283
3314
|
current.previewDatabaseId = created.previewDatabaseUuid ?? created.uuid;
|
|
3284
3315
|
};
|
|
3285
|
-
const ensureQueue = () => {
|
|
3286
|
-
const current = state.queues?.agentWork;
|
|
3287
|
-
if (!current?.name) {
|
|
3288
|
-
return;
|
|
3289
|
-
}
|
|
3290
|
-
let refreshedQueues = queues;
|
|
3291
|
-
const exists = refreshedQueues.find((entry) => queueName(entry) === current.name);
|
|
3292
|
-
if (exists) {
|
|
3293
|
-
current.queueId = queueId(exists);
|
|
3294
|
-
const currentDlq = current.dlqName ? refreshedQueues.find((entry) => queueName(entry) === current.dlqName) : null;
|
|
3295
|
-
current.dlqId = queueId(currentDlq);
|
|
3296
|
-
return;
|
|
3297
|
-
}
|
|
3298
|
-
if (dryRun) {
|
|
3299
|
-
current.queueId = `dryrun-${current.name}`;
|
|
3300
|
-
current.dlqId = current.dlqName ? `dryrun-${current.dlqName}` : null;
|
|
3301
|
-
return;
|
|
3302
|
-
}
|
|
3303
|
-
try {
|
|
3304
|
-
runWrangler(["queues", "create", current.name], {
|
|
3305
|
-
cwd: tenantRoot,
|
|
3306
|
-
capture: true,
|
|
3307
|
-
env
|
|
3308
|
-
});
|
|
3309
|
-
} catch (error) {
|
|
3310
|
-
if (!isWranglerAlreadyExistsError(error, [/Queue name .* is already taken/i, /\[code:\s*11009\]/i])) {
|
|
3311
|
-
throw error;
|
|
3312
|
-
}
|
|
3313
|
-
}
|
|
3314
|
-
refreshedQueues = listQueues(tenantRoot, env);
|
|
3315
|
-
if (current.dlqName && !refreshedQueues.find((entry) => queueName(entry) === current.dlqName)) {
|
|
3316
|
-
try {
|
|
3317
|
-
runWrangler(["queues", "create", current.dlqName], {
|
|
3318
|
-
cwd: tenantRoot,
|
|
3319
|
-
capture: true,
|
|
3320
|
-
env
|
|
3321
|
-
});
|
|
3322
|
-
} catch (error) {
|
|
3323
|
-
if (!isWranglerAlreadyExistsError(error, [/Queue name .* is already taken/i, /\[code:\s*11009\]/i])) {
|
|
3324
|
-
throw error;
|
|
3325
|
-
}
|
|
3326
|
-
}
|
|
3327
|
-
}
|
|
3328
|
-
refreshedQueues = listQueues(tenantRoot, env);
|
|
3329
|
-
const created = refreshedQueues.find((entry) => queueName(entry) === current.name);
|
|
3330
|
-
if (!created) {
|
|
3331
|
-
throw new Error(`Unable to resolve Cloudflare queue ${current.name} after reconciliation.`);
|
|
3332
|
-
}
|
|
3333
|
-
current.queueId = queueId(created);
|
|
3334
|
-
const createdDlq = current.dlqName ? refreshedQueues.find((entry) => queueName(entry) === current.dlqName) : null;
|
|
3335
|
-
if (current.dlqName && !createdDlq) {
|
|
3336
|
-
throw new Error(`Unable to resolve Cloudflare dead-letter queue ${current.dlqName} after reconciliation.`);
|
|
3337
|
-
}
|
|
3338
|
-
current.dlqId = queueId(createdDlq);
|
|
3339
|
-
};
|
|
3340
3316
|
const ensureR2Bucket = () => {
|
|
3341
3317
|
const bucketName = state.content?.bucketName;
|
|
3342
3318
|
if (!bucketName) {
|
|
@@ -3374,7 +3350,7 @@ function provisionCloudflareResources(tenantRoot, options = {}) {
|
|
|
3374
3350
|
const exists = pagesProjects.find((entry) => entry?.name === current.projectName);
|
|
3375
3351
|
if (exists) {
|
|
3376
3352
|
current.url = exists.subdomain ? `https://${exists.subdomain}` : current.url ?? `https://${current.projectName}.pages.dev`;
|
|
3377
|
-
ensurePagesProjectCompatibility(env.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
3353
|
+
ensurePagesProjectCompatibility(env.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "", current.projectName, env, exists, { state, target });
|
|
3378
3354
|
return;
|
|
3379
3355
|
}
|
|
3380
3356
|
if (dryRun) {
|
|
@@ -3393,12 +3369,11 @@ function provisionCloudflareResources(tenantRoot, options = {}) {
|
|
|
3393
3369
|
capture: true,
|
|
3394
3370
|
env
|
|
3395
3371
|
});
|
|
3396
|
-
ensurePagesProjectCompatibility(env.CLOUDFLARE_ACCOUNT_ID ?? process.env.
|
|
3372
|
+
ensurePagesProjectCompatibility(env.CLOUDFLARE_ACCOUNT_ID ?? process.env.TREESEED_CLOUDFLARE_ACCOUNT_ID ?? "", current.projectName, env, null, { state, target });
|
|
3397
3373
|
current.url = `https://${current.projectName}.pages.dev`;
|
|
3398
3374
|
};
|
|
3399
3375
|
ensureKv("FORM_GUARD_KV");
|
|
3400
3376
|
ensureD1();
|
|
3401
|
-
ensureQueue();
|
|
3402
3377
|
ensureR2Bucket();
|
|
3403
3378
|
ensurePagesProject();
|
|
3404
3379
|
reconcileCloudflareWebCacheRules(tenantRoot, deployConfig, state, target, { dryRun });
|
|
@@ -3488,8 +3463,6 @@ function verifyProvisionedCloudflareResources(tenantRoot, options = {}) {
|
|
|
3488
3463
|
pages: Boolean(state.pages?.projectName && (livePages || pagesProject?.name === state.pages.projectName)),
|
|
3489
3464
|
formGuardKv: Boolean(state.kvNamespaces?.FORM_GUARD_KV?.name && kvNamespaces.find((entry) => entry?.title === state.kvNamespaces.FORM_GUARD_KV.name)),
|
|
3490
3465
|
d1: Boolean(state.d1Databases?.SITE_DATA_DB?.databaseName && d1Databases.find((entry) => entry?.name === state.d1Databases.SITE_DATA_DB.databaseName)),
|
|
3491
|
-
queue: Boolean(state.queues?.agentWork?.name && queues.find((entry) => queueName(entry) === state.queues.agentWork.name)),
|
|
3492
|
-
dlq: !state.queues?.agentWork?.dlqName || Boolean(queues.find((entry) => queueName(entry) === state.queues.agentWork.dlqName)),
|
|
3493
3466
|
r2: Boolean(state.content?.bucketName && buckets.find((entry) => entry?.name === state.content.bucketName)),
|
|
3494
3467
|
pagesFormGuardKvBinding: !pagesBindings.kv_namespaces?.FORM_GUARD_KV || pageBindingConfigured("kv_namespaces", "FORM_GUARD_KV", pagesBindings.kv_namespaces.FORM_GUARD_KV),
|
|
3495
3468
|
pagesD1Binding: !pagesBindings.d1_databases?.SITE_DATA_DB || pageBindingConfigured("d1_databases", "SITE_DATA_DB", pagesBindings.d1_databases.SITE_DATA_DB),
|
|
@@ -3505,12 +3478,6 @@ function verifyProvisionedCloudflareResources(tenantRoot, options = {}) {
|
|
|
3505
3478
|
state.readiness.blockers = [];
|
|
3506
3479
|
state.readiness.warnings = [];
|
|
3507
3480
|
state.readiness.lastValidationSummary = checks;
|
|
3508
|
-
const liveQueue = queues.find((entry) => queueName(entry) === state.queues?.agentWork?.name);
|
|
3509
|
-
if (state.queues?.agentWork) {
|
|
3510
|
-
state.queues.agentWork.queueId = queueId(liveQueue) ?? state.queues.agentWork.queueId ?? null;
|
|
3511
|
-
const liveDlq = queues.find((entry) => queueName(entry) === state.queues.agentWork.dlqName);
|
|
3512
|
-
state.queues.agentWork.dlqId = queueId(liveDlq) ?? state.queues.agentWork.dlqId ?? null;
|
|
3513
|
-
}
|
|
3514
3481
|
if (state.pages) {
|
|
3515
3482
|
const configuredWebUrl = resolveConfiguredSurfaceBaseUrl(deployConfig, target, "web");
|
|
3516
3483
|
if (configuredWebUrl) {
|
|
@@ -3749,6 +3716,7 @@ export {
|
|
|
3749
3716
|
buildProvisioningSummary,
|
|
3750
3717
|
buildPublicVars,
|
|
3751
3718
|
buildSecretMap,
|
|
3719
|
+
buildTreeseedManagedCloudflareCacheRules,
|
|
3752
3720
|
buildWranglerConfigContents,
|
|
3753
3721
|
cleanupDestroyedState,
|
|
3754
3722
|
cloudflareApiRequest,
|