@treeseed/sdk 0.11.0 → 0.12.5
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 +629 -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 +66 -0
- package/dist/platform/desired-state.js +1052 -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
package/dist/d1-store.js
CHANGED
|
@@ -113,13 +113,13 @@ class MemoryAgentDatabase {
|
|
|
113
113
|
contentLeases = /* @__PURE__ */ new Map();
|
|
114
114
|
cursors = /* @__PURE__ */ new Map();
|
|
115
115
|
workDays = /* @__PURE__ */ new Map();
|
|
116
|
-
tasks = /* @__PURE__ */ new Map();
|
|
117
|
-
taskEvents = /* @__PURE__ */ new Map();
|
|
118
|
-
taskOutputs = /* @__PURE__ */ new Map();
|
|
119
116
|
graphRuns = /* @__PURE__ */ new Map();
|
|
120
117
|
reports = /* @__PURE__ */ new Map();
|
|
121
118
|
workPolicies = /* @__PURE__ */ new Map();
|
|
122
119
|
workdayRequests = /* @__PURE__ */ new Map();
|
|
120
|
+
tasks = /* @__PURE__ */ new Map();
|
|
121
|
+
taskEvents = /* @__PURE__ */ new Map();
|
|
122
|
+
taskOutputs = /* @__PURE__ */ new Map();
|
|
123
123
|
workdayManagerLeases = /* @__PURE__ */ new Map();
|
|
124
124
|
workerRunners = /* @__PURE__ */ new Map();
|
|
125
125
|
repositoryClaims = /* @__PURE__ */ new Map();
|
|
@@ -188,10 +188,10 @@ class MemoryAgentDatabase {
|
|
|
188
188
|
return [...this.tasks.values()];
|
|
189
189
|
}
|
|
190
190
|
if (model === "task_event") {
|
|
191
|
-
return [...this.taskEvents.values()]
|
|
191
|
+
return [...this.taskEvents.values()];
|
|
192
192
|
}
|
|
193
193
|
if (model === "task_output") {
|
|
194
|
-
return [...this.taskOutputs.values()]
|
|
194
|
+
return [...this.taskOutputs.values()];
|
|
195
195
|
}
|
|
196
196
|
if (model === "graph_run") {
|
|
197
197
|
return [...this.graphRuns.values()];
|
|
@@ -233,8 +233,11 @@ class MemoryAgentDatabase {
|
|
|
233
233
|
if (request.model === "task") {
|
|
234
234
|
return this.tasks.get(key) ?? null;
|
|
235
235
|
}
|
|
236
|
+
if (request.model === "task_event") {
|
|
237
|
+
return this.taskEvents.get(key) ?? null;
|
|
238
|
+
}
|
|
236
239
|
if (request.model === "task_output") {
|
|
237
|
-
return
|
|
240
|
+
return this.taskOutputs.get(key) ?? null;
|
|
238
241
|
}
|
|
239
242
|
if (request.model === "graph_run") {
|
|
240
243
|
return this.graphRuns.get(key) ?? null;
|
|
@@ -396,23 +399,6 @@ class MemoryAgentDatabase {
|
|
|
396
399
|
summary: data.summary ?? null,
|
|
397
400
|
actor: request.actor
|
|
398
401
|
});
|
|
399
|
-
case "task":
|
|
400
|
-
return this.createTask({
|
|
401
|
-
id: typeof data.id === "string" ? data.id : void 0,
|
|
402
|
-
workDayId: String(data.workDayId ?? data.work_day_id ?? ""),
|
|
403
|
-
agentId: String(data.agentId ?? data.agent_id ?? ""),
|
|
404
|
-
type: String(data.type ?? ""),
|
|
405
|
-
state: typeof data.state === "string" ? data.state : "pending",
|
|
406
|
-
priority: Number(data.priority ?? 0),
|
|
407
|
-
idempotencyKey: String(data.idempotencyKey ?? data.idempotency_key ?? ""),
|
|
408
|
-
payload: data.payload ?? data,
|
|
409
|
-
payloadHash: typeof (data.payloadHash ?? data.payload_hash) === "string" ? String(data.payloadHash ?? data.payload_hash) : null,
|
|
410
|
-
maxAttempts: Number(data.maxAttempts ?? data.max_attempts ?? 3),
|
|
411
|
-
availableAt: typeof (data.availableAt ?? data.available_at) === "string" ? String(data.availableAt ?? data.available_at) : void 0,
|
|
412
|
-
graphVersion: typeof (data.graphVersion ?? data.graph_version) === "string" ? String(data.graphVersion ?? data.graph_version) : null,
|
|
413
|
-
parentTaskId: typeof (data.parentTaskId ?? data.parent_task_id) === "string" ? String(data.parentTaskId ?? data.parent_task_id) : null,
|
|
414
|
-
actor: request.actor
|
|
415
|
-
});
|
|
416
402
|
case "graph_run": {
|
|
417
403
|
const record = {
|
|
418
404
|
id: String(data.id ?? crypto.randomUUID()),
|
|
@@ -518,36 +504,6 @@ class MemoryAgentDatabase {
|
|
|
518
504
|
summary: data.summary ?? null,
|
|
519
505
|
actor: request.actor
|
|
520
506
|
});
|
|
521
|
-
case "task": {
|
|
522
|
-
const taskId = String(request.id ?? request.key ?? data.id ?? "");
|
|
523
|
-
if (data.state === "completed") {
|
|
524
|
-
return this.completeTask({
|
|
525
|
-
id: taskId,
|
|
526
|
-
output: data.output ?? null,
|
|
527
|
-
outputRef: typeof data.outputRef === "string" ? data.outputRef : null,
|
|
528
|
-
summary: data.summary ?? null,
|
|
529
|
-
actor: request.actor
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
if (data.state === "failed") {
|
|
533
|
-
return this.failTask({
|
|
534
|
-
id: taskId,
|
|
535
|
-
errorCode: typeof data.errorCode === "string" ? data.errorCode : null,
|
|
536
|
-
errorMessage: String(data.errorMessage ?? "Task failed"),
|
|
537
|
-
retryable: Boolean(data.retryable),
|
|
538
|
-
nextVisibleAt: typeof data.nextVisibleAt === "string" ? data.nextVisibleAt : null,
|
|
539
|
-
actor: request.actor
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
return this.recordTaskProgress({
|
|
543
|
-
id: taskId,
|
|
544
|
-
workerId: typeof data.workerId === "string" ? data.workerId : null,
|
|
545
|
-
state: typeof data.state === "string" ? data.state : void 0,
|
|
546
|
-
appendEvent: data.appendEvent,
|
|
547
|
-
patch: data.patch ?? void 0,
|
|
548
|
-
actor: request.actor
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
507
|
default:
|
|
552
508
|
throw new Error(`Unsupported D1 update model "${request.model}".`);
|
|
553
509
|
}
|
|
@@ -678,143 +634,6 @@ class MemoryAgentDatabase {
|
|
|
678
634
|
this.workDays.set(next.id, next);
|
|
679
635
|
return next;
|
|
680
636
|
}
|
|
681
|
-
async createTask(request) {
|
|
682
|
-
const timestamp = nowIso();
|
|
683
|
-
const record = {
|
|
684
|
-
id: request.id ?? crypto.randomUUID(),
|
|
685
|
-
workDayId: request.workDayId,
|
|
686
|
-
agentId: request.agentId,
|
|
687
|
-
type: request.type,
|
|
688
|
-
state: request.state ?? "pending",
|
|
689
|
-
priority: Number(request.priority ?? 0),
|
|
690
|
-
idempotencyKey: request.idempotencyKey,
|
|
691
|
-
payloadJson: JSON.stringify(request.payload),
|
|
692
|
-
payloadHash: request.payloadHash ?? null,
|
|
693
|
-
attemptCount: 0,
|
|
694
|
-
maxAttempts: Number(request.maxAttempts ?? 3),
|
|
695
|
-
claimedBy: null,
|
|
696
|
-
leaseExpiresAt: null,
|
|
697
|
-
availableAt: request.availableAt ?? timestamp,
|
|
698
|
-
lastErrorCode: null,
|
|
699
|
-
lastErrorMessage: null,
|
|
700
|
-
graphVersion: request.graphVersion ?? null,
|
|
701
|
-
parentTaskId: request.parentTaskId ?? null,
|
|
702
|
-
createdAt: timestamp,
|
|
703
|
-
startedAt: null,
|
|
704
|
-
completedAt: null,
|
|
705
|
-
updatedAt: timestamp
|
|
706
|
-
};
|
|
707
|
-
this.tasks.set(record.id, record);
|
|
708
|
-
return record;
|
|
709
|
-
}
|
|
710
|
-
async claimTask(request) {
|
|
711
|
-
const existing = this.tasks.get(request.id);
|
|
712
|
-
if (!existing) return null;
|
|
713
|
-
const next = {
|
|
714
|
-
...existing,
|
|
715
|
-
state: "claimed",
|
|
716
|
-
claimedBy: request.workerId,
|
|
717
|
-
leaseExpiresAt: new Date(Date.now() + request.leaseSeconds * 1e3).toISOString(),
|
|
718
|
-
attemptCount: existing.attemptCount + 1,
|
|
719
|
-
startedAt: existing.startedAt ?? nowIso(),
|
|
720
|
-
updatedAt: nowIso()
|
|
721
|
-
};
|
|
722
|
-
this.tasks.set(next.id, next);
|
|
723
|
-
return next;
|
|
724
|
-
}
|
|
725
|
-
async recordTaskProgress(request) {
|
|
726
|
-
const existing = this.tasks.get(request.id);
|
|
727
|
-
if (!existing) return null;
|
|
728
|
-
const nextPayload = {
|
|
729
|
-
...JSON.parse(existing.payloadJson),
|
|
730
|
-
...request.patch ?? {}
|
|
731
|
-
};
|
|
732
|
-
const next = {
|
|
733
|
-
...existing,
|
|
734
|
-
state: request.state ?? existing.state,
|
|
735
|
-
claimedBy: request.workerId ?? existing.claimedBy,
|
|
736
|
-
payloadJson: JSON.stringify(nextPayload),
|
|
737
|
-
updatedAt: nowIso()
|
|
738
|
-
};
|
|
739
|
-
this.tasks.set(next.id, next);
|
|
740
|
-
if (request.appendEvent?.kind) {
|
|
741
|
-
await this.appendTaskEvent({
|
|
742
|
-
taskId: request.id,
|
|
743
|
-
kind: request.appendEvent.kind,
|
|
744
|
-
data: request.appendEvent.data,
|
|
745
|
-
actor: request.actor
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
return next;
|
|
749
|
-
}
|
|
750
|
-
async completeTask(request) {
|
|
751
|
-
const existing = this.tasks.get(request.id);
|
|
752
|
-
if (!existing) return null;
|
|
753
|
-
const next = {
|
|
754
|
-
...existing,
|
|
755
|
-
state: "completed",
|
|
756
|
-
completedAt: nowIso(),
|
|
757
|
-
leaseExpiresAt: null,
|
|
758
|
-
updatedAt: nowIso()
|
|
759
|
-
};
|
|
760
|
-
this.tasks.set(next.id, next);
|
|
761
|
-
if (request.output) {
|
|
762
|
-
const outputs = this.taskOutputs.get(request.id) ?? [];
|
|
763
|
-
outputs.push({
|
|
764
|
-
id: crypto.randomUUID(),
|
|
765
|
-
taskId: request.id,
|
|
766
|
-
outputJson: JSON.stringify(request.output),
|
|
767
|
-
outputRef: request.outputRef ?? null,
|
|
768
|
-
createdAt: nowIso()
|
|
769
|
-
});
|
|
770
|
-
this.taskOutputs.set(request.id, outputs);
|
|
771
|
-
}
|
|
772
|
-
if (request.summary) {
|
|
773
|
-
await this.appendTaskEvent({
|
|
774
|
-
taskId: request.id,
|
|
775
|
-
kind: "completed",
|
|
776
|
-
data: request.summary,
|
|
777
|
-
actor: request.actor
|
|
778
|
-
});
|
|
779
|
-
}
|
|
780
|
-
return next;
|
|
781
|
-
}
|
|
782
|
-
async failTask(request) {
|
|
783
|
-
const existing = this.tasks.get(request.id);
|
|
784
|
-
if (!existing) return null;
|
|
785
|
-
const next = {
|
|
786
|
-
...existing,
|
|
787
|
-
state: request.retryable ? "pending" : "failed",
|
|
788
|
-
availableAt: request.nextVisibleAt ?? existing.availableAt,
|
|
789
|
-
lastErrorCode: request.errorCode ?? null,
|
|
790
|
-
lastErrorMessage: request.errorMessage,
|
|
791
|
-
leaseExpiresAt: null,
|
|
792
|
-
updatedAt: nowIso()
|
|
793
|
-
};
|
|
794
|
-
this.tasks.set(next.id, next);
|
|
795
|
-
return next;
|
|
796
|
-
}
|
|
797
|
-
async appendTaskEvent(request) {
|
|
798
|
-
const events = this.taskEvents.get(request.taskId) ?? [];
|
|
799
|
-
const next = {
|
|
800
|
-
id: crypto.randomUUID(),
|
|
801
|
-
taskId: request.taskId,
|
|
802
|
-
seq: events.length + 1,
|
|
803
|
-
kind: request.kind,
|
|
804
|
-
dataJson: JSON.stringify({ ...request.data ?? {}, actor: request.actor }),
|
|
805
|
-
createdAt: nowIso()
|
|
806
|
-
};
|
|
807
|
-
events.push(next);
|
|
808
|
-
this.taskEvents.set(request.taskId, events);
|
|
809
|
-
return next;
|
|
810
|
-
}
|
|
811
|
-
async searchTasks(request) {
|
|
812
|
-
return [...this.tasks.values()].filter((task) => !request.workDayId || task.workDayId === request.workDayId).filter((task) => !request.agentId || task.agentId === request.agentId).filter((task) => {
|
|
813
|
-
if (!request.state) return true;
|
|
814
|
-
const states = Array.isArray(request.state) ? request.state : [request.state];
|
|
815
|
-
return states.includes(task.state);
|
|
816
|
-
}).sort((left, right) => right.priority - left.priority || left.availableAt.localeCompare(right.availableAt)).slice(0, request.limit ?? 50);
|
|
817
|
-
}
|
|
818
637
|
async createReport(request) {
|
|
819
638
|
const record = {
|
|
820
639
|
id: request.id ?? crypto.randomUUID(),
|
|
@@ -828,16 +647,6 @@ class MemoryAgentDatabase {
|
|
|
828
647
|
this.reports.set(record.id, record);
|
|
829
648
|
return record;
|
|
830
649
|
}
|
|
831
|
-
async getManagerContext(taskId) {
|
|
832
|
-
const task = this.tasks.get(taskId) ?? null;
|
|
833
|
-
const workDay = task ? this.workDays.get(task.workDayId) ?? null : null;
|
|
834
|
-
return {
|
|
835
|
-
task,
|
|
836
|
-
workDay,
|
|
837
|
-
agent: null,
|
|
838
|
-
graph: workDay?.graphVersion ? { graphVersion: workDay.graphVersion } : null
|
|
839
|
-
};
|
|
840
|
-
}
|
|
841
650
|
async getWorkPolicy(projectId, environment = "local") {
|
|
842
651
|
return this.workPolicies.get(`${projectId}:${environment}`) ?? null;
|
|
843
652
|
}
|
|
@@ -886,6 +695,97 @@ class MemoryAgentDatabase {
|
|
|
886
695
|
async listWorkdayRequests(projectId, environment, state) {
|
|
887
696
|
return [...this.workdayRequests.values()].filter((entry) => entry.projectId === projectId && entry.environment === environment).filter((entry) => !state || entry.state === state).sort((left, right) => left.createdAt.localeCompare(right.createdAt));
|
|
888
697
|
}
|
|
698
|
+
async createTask(request) {
|
|
699
|
+
const timestamp = nowIso();
|
|
700
|
+
const existing = [...this.tasks.values()].find((entry) => entry.idempotencyKey === request.idempotencyKey);
|
|
701
|
+
if (existing) return existing;
|
|
702
|
+
const record = {
|
|
703
|
+
id: request.id ?? crypto.randomUUID(),
|
|
704
|
+
workDayId: request.workDayId,
|
|
705
|
+
agentId: request.agentId,
|
|
706
|
+
type: request.type,
|
|
707
|
+
idempotencyKey: request.idempotencyKey,
|
|
708
|
+
payloadJson: JSON.stringify(request.payload ?? {}),
|
|
709
|
+
state: "pending",
|
|
710
|
+
claimedBy: null,
|
|
711
|
+
claimedAt: null,
|
|
712
|
+
leaseExpiresAt: null,
|
|
713
|
+
attempts: 0,
|
|
714
|
+
createdAt: timestamp,
|
|
715
|
+
updatedAt: timestamp
|
|
716
|
+
};
|
|
717
|
+
this.tasks.set(record.id, record);
|
|
718
|
+
return record;
|
|
719
|
+
}
|
|
720
|
+
async claimTask(request) {
|
|
721
|
+
const existing = this.tasks.get(request.id);
|
|
722
|
+
if (!existing) return null;
|
|
723
|
+
const timestamp = nowIso();
|
|
724
|
+
const next = {
|
|
725
|
+
...existing,
|
|
726
|
+
state: "claimed",
|
|
727
|
+
claimedBy: request.workerId,
|
|
728
|
+
claimedAt: timestamp,
|
|
729
|
+
leaseExpiresAt: new Date(Date.now() + (request.leaseSeconds ?? 300) * 1e3).toISOString(),
|
|
730
|
+
attempts: existing.attempts + 1,
|
|
731
|
+
updatedAt: timestamp
|
|
732
|
+
};
|
|
733
|
+
this.tasks.set(next.id, next);
|
|
734
|
+
return next;
|
|
735
|
+
}
|
|
736
|
+
async recordTaskProgress(request) {
|
|
737
|
+
const existing = this.tasks.get(request.id);
|
|
738
|
+
if (!existing) return null;
|
|
739
|
+
const timestamp = nowIso();
|
|
740
|
+
const next = {
|
|
741
|
+
...existing,
|
|
742
|
+
state: request.state ?? existing.state,
|
|
743
|
+
updatedAt: timestamp
|
|
744
|
+
};
|
|
745
|
+
this.tasks.set(next.id, next);
|
|
746
|
+
if (request.appendEvent) {
|
|
747
|
+
const event = {
|
|
748
|
+
id: crypto.randomUUID(),
|
|
749
|
+
taskId: next.id,
|
|
750
|
+
kind: request.appendEvent.kind,
|
|
751
|
+
dataJson: JSON.stringify(request.appendEvent.data ?? {}),
|
|
752
|
+
actor: request.actor ?? null,
|
|
753
|
+
createdAt: timestamp
|
|
754
|
+
};
|
|
755
|
+
this.taskEvents.set(event.id, event);
|
|
756
|
+
}
|
|
757
|
+
return next;
|
|
758
|
+
}
|
|
759
|
+
async completeTask(request) {
|
|
760
|
+
const existing = this.tasks.get(request.id);
|
|
761
|
+
if (!existing) return null;
|
|
762
|
+
const timestamp = nowIso();
|
|
763
|
+
const next = {
|
|
764
|
+
...existing,
|
|
765
|
+
state: "completed",
|
|
766
|
+
updatedAt: timestamp
|
|
767
|
+
};
|
|
768
|
+
this.tasks.set(next.id, next);
|
|
769
|
+
const output = {
|
|
770
|
+
id: crypto.randomUUID(),
|
|
771
|
+
taskId: next.id,
|
|
772
|
+
outputJson: JSON.stringify(request.output ?? {}),
|
|
773
|
+
outputRef: request.outputRef ?? null,
|
|
774
|
+
summaryJson: request.summary ? JSON.stringify(request.summary) : null,
|
|
775
|
+
actor: request.actor ?? null,
|
|
776
|
+
createdAt: timestamp,
|
|
777
|
+
updatedAt: timestamp
|
|
778
|
+
};
|
|
779
|
+
this.taskOutputs.set(output.id, output);
|
|
780
|
+
return next;
|
|
781
|
+
}
|
|
782
|
+
async getManagerContext(taskId) {
|
|
783
|
+
const task = this.tasks.get(taskId) ?? null;
|
|
784
|
+
const workDay = task ? this.workDays.get(task.workDayId) ?? null : null;
|
|
785
|
+
const events = [...this.taskEvents.values()].filter((entry) => entry.taskId === taskId);
|
|
786
|
+
const outputs = [...this.taskOutputs.values()].filter((entry) => entry.taskId === taskId);
|
|
787
|
+
return { task, workDay, events, outputs };
|
|
788
|
+
}
|
|
889
789
|
async claimWorkdayManagerLease(request) {
|
|
890
790
|
const timestamp = request.now ?? nowIso();
|
|
891
791
|
const nowMs = Date.parse(timestamp);
|
|
@@ -1183,15 +1083,6 @@ class CloudflareD1AgentDatabase {
|
|
|
1183
1083
|
if (request.model === "work_day") {
|
|
1184
1084
|
return this.operational.getWorkDay(String(request.id ?? request.key ?? request.slug ?? ""));
|
|
1185
1085
|
}
|
|
1186
|
-
if (request.model === "task") {
|
|
1187
|
-
return this.operational.getTask(String(request.id ?? request.key ?? request.slug ?? ""));
|
|
1188
|
-
}
|
|
1189
|
-
if (request.model === "task_event") {
|
|
1190
|
-
return this.operational.getTaskEvent(String(request.id ?? request.key ?? request.slug ?? ""));
|
|
1191
|
-
}
|
|
1192
|
-
if (request.model === "task_output") {
|
|
1193
|
-
return this.operational.getTaskOutput(String(request.id ?? request.key ?? request.slug ?? ""));
|
|
1194
|
-
}
|
|
1195
1086
|
if (request.model === "report") {
|
|
1196
1087
|
return this.operational.getReport(String(request.id ?? request.key ?? request.slug ?? ""));
|
|
1197
1088
|
}
|
|
@@ -1222,29 +1113,6 @@ class CloudflareD1AgentDatabase {
|
|
|
1222
1113
|
if (request.model === "work_day") {
|
|
1223
1114
|
return this.operational.searchWorkDays(request.limit);
|
|
1224
1115
|
}
|
|
1225
|
-
if (request.model === "task") {
|
|
1226
|
-
return this.operational.searchTasks({
|
|
1227
|
-
workDayId: normalizedRequest.filters?.find((entry) => entry.field === "work_day_id")?.value,
|
|
1228
|
-
agentId: normalizedRequest.filters?.find((entry) => entry.field === "agent_id")?.value,
|
|
1229
|
-
state: normalizedRequest.filters?.find((entry) => entry.field === "state")?.value,
|
|
1230
|
-
limit: request.limit
|
|
1231
|
-
});
|
|
1232
|
-
}
|
|
1233
|
-
if (request.model === "task_event") {
|
|
1234
|
-
return this.operational.searchTaskEvents({
|
|
1235
|
-
id: normalizedRequest.filters?.find((entry) => entry.field === "id")?.value,
|
|
1236
|
-
taskId: normalizedRequest.filters?.find((entry) => entry.field === "task_id")?.value,
|
|
1237
|
-
kind: normalizedRequest.filters?.find((entry) => entry.field === "kind")?.value,
|
|
1238
|
-
limit: request.limit
|
|
1239
|
-
});
|
|
1240
|
-
}
|
|
1241
|
-
if (request.model === "task_output") {
|
|
1242
|
-
return this.operational.searchTaskOutputs({
|
|
1243
|
-
id: normalizedRequest.filters?.find((entry) => entry.field === "id")?.value,
|
|
1244
|
-
taskId: normalizedRequest.filters?.find((entry) => entry.field === "task_id")?.value,
|
|
1245
|
-
limit: request.limit
|
|
1246
|
-
});
|
|
1247
|
-
}
|
|
1248
1116
|
if (request.model === "report") {
|
|
1249
1117
|
return [];
|
|
1250
1118
|
}
|
|
@@ -1284,13 +1152,6 @@ class CloudflareD1AgentDatabase {
|
|
|
1284
1152
|
leaseToken: items[0]?.token ?? null
|
|
1285
1153
|
};
|
|
1286
1154
|
}
|
|
1287
|
-
if (request.model === "task") {
|
|
1288
|
-
const items = await this.operational.searchTasks({
|
|
1289
|
-
state: "pending",
|
|
1290
|
-
limit: 1
|
|
1291
|
-
});
|
|
1292
|
-
return { item: items[0] ?? null, leaseToken: null };
|
|
1293
|
-
}
|
|
1294
1155
|
return {
|
|
1295
1156
|
item: (await this.search({
|
|
1296
1157
|
model: request.model,
|
|
@@ -1346,24 +1207,6 @@ class CloudflareD1AgentDatabase {
|
|
|
1346
1207
|
actor: request.actor
|
|
1347
1208
|
});
|
|
1348
1209
|
}
|
|
1349
|
-
if (request.model === "task") {
|
|
1350
|
-
return await this.createTask({
|
|
1351
|
-
id: typeof normalizedRequest.data.id === "string" ? normalizedRequest.data.id : void 0,
|
|
1352
|
-
workDayId: String(normalizedRequest.data.workDayId ?? normalizedRequest.data.work_day_id ?? ""),
|
|
1353
|
-
agentId: String(normalizedRequest.data.agentId ?? normalizedRequest.data.agent_id ?? ""),
|
|
1354
|
-
type: String(normalizedRequest.data.type ?? ""),
|
|
1355
|
-
state: typeof normalizedRequest.data.state === "string" ? normalizedRequest.data.state : "pending",
|
|
1356
|
-
priority: Number(normalizedRequest.data.priority ?? 0),
|
|
1357
|
-
idempotencyKey: String(normalizedRequest.data.idempotencyKey ?? normalizedRequest.data.idempotency_key ?? ""),
|
|
1358
|
-
payload: normalizedRequest.data.payload ?? normalizedRequest.data,
|
|
1359
|
-
payloadHash: typeof (normalizedRequest.data.payloadHash ?? normalizedRequest.data.payload_hash) === "string" ? String(normalizedRequest.data.payloadHash ?? normalizedRequest.data.payload_hash) : null,
|
|
1360
|
-
maxAttempts: Number(normalizedRequest.data.maxAttempts ?? normalizedRequest.data.max_attempts ?? 3),
|
|
1361
|
-
availableAt: typeof (normalizedRequest.data.availableAt ?? normalizedRequest.data.available_at) === "string" ? String(normalizedRequest.data.availableAt ?? normalizedRequest.data.available_at) : void 0,
|
|
1362
|
-
graphVersion: typeof (normalizedRequest.data.graphVersion ?? normalizedRequest.data.graph_version) === "string" ? String(normalizedRequest.data.graphVersion ?? normalizedRequest.data.graph_version) : null,
|
|
1363
|
-
parentTaskId: typeof (normalizedRequest.data.parentTaskId ?? normalizedRequest.data.parent_task_id) === "string" ? String(normalizedRequest.data.parentTaskId ?? normalizedRequest.data.parent_task_id) : null,
|
|
1364
|
-
actor: request.actor
|
|
1365
|
-
});
|
|
1366
|
-
}
|
|
1367
1210
|
if (request.model === "graph_run") {
|
|
1368
1211
|
return await this.operational.createGraphRun({
|
|
1369
1212
|
id: String(normalizedRequest.data.id ?? crypto.randomUUID()),
|
|
@@ -1420,36 +1263,6 @@ class CloudflareD1AgentDatabase {
|
|
|
1420
1263
|
actor: request.actor
|
|
1421
1264
|
});
|
|
1422
1265
|
}
|
|
1423
|
-
if (request.model === "task") {
|
|
1424
|
-
const taskId = String(request.id ?? request.key ?? normalizedRequest.data.id ?? "");
|
|
1425
|
-
if (normalizedRequest.data.state === "completed") {
|
|
1426
|
-
return this.completeTask({
|
|
1427
|
-
id: taskId,
|
|
1428
|
-
output: normalizedRequest.data.output,
|
|
1429
|
-
outputRef: typeof normalizedRequest.data.outputRef === "string" ? normalizedRequest.data.outputRef : null,
|
|
1430
|
-
summary: normalizedRequest.data.summary,
|
|
1431
|
-
actor: request.actor
|
|
1432
|
-
});
|
|
1433
|
-
}
|
|
1434
|
-
if (normalizedRequest.data.state === "failed") {
|
|
1435
|
-
return this.failTask({
|
|
1436
|
-
id: taskId,
|
|
1437
|
-
errorCode: typeof normalizedRequest.data.errorCode === "string" ? normalizedRequest.data.errorCode : null,
|
|
1438
|
-
errorMessage: String(normalizedRequest.data.errorMessage ?? "Task failed"),
|
|
1439
|
-
retryable: Boolean(normalizedRequest.data.retryable),
|
|
1440
|
-
nextVisibleAt: typeof normalizedRequest.data.nextVisibleAt === "string" ? normalizedRequest.data.nextVisibleAt : null,
|
|
1441
|
-
actor: request.actor
|
|
1442
|
-
});
|
|
1443
|
-
}
|
|
1444
|
-
return this.recordTaskProgress({
|
|
1445
|
-
id: taskId,
|
|
1446
|
-
workerId: typeof normalizedRequest.data.workerId === "string" ? normalizedRequest.data.workerId : null,
|
|
1447
|
-
state: typeof normalizedRequest.data.state === "string" ? normalizedRequest.data.state : void 0,
|
|
1448
|
-
appendEvent: normalizedRequest.data.appendEvent,
|
|
1449
|
-
patch: normalizedRequest.data.patch,
|
|
1450
|
-
actor: request.actor
|
|
1451
|
-
});
|
|
1452
|
-
}
|
|
1453
1266
|
throw new Error(`Unsupported D1 update model "${request.model}".`);
|
|
1454
1267
|
}
|
|
1455
1268
|
claimMessage(request) {
|
|
@@ -1485,40 +1298,9 @@ class CloudflareD1AgentDatabase {
|
|
|
1485
1298
|
closeWorkDay(request) {
|
|
1486
1299
|
return this.operational.closeWorkDay(request);
|
|
1487
1300
|
}
|
|
1488
|
-
createTask(request) {
|
|
1489
|
-
return this.operational.createTask(request);
|
|
1490
|
-
}
|
|
1491
|
-
claimTask(request) {
|
|
1492
|
-
return this.operational.claimTask(request);
|
|
1493
|
-
}
|
|
1494
|
-
recordTaskProgress(request) {
|
|
1495
|
-
return this.operational.recordTaskProgress(request);
|
|
1496
|
-
}
|
|
1497
|
-
completeTask(request) {
|
|
1498
|
-
return this.operational.completeTask(request);
|
|
1499
|
-
}
|
|
1500
|
-
failTask(request) {
|
|
1501
|
-
return this.operational.failTask(request);
|
|
1502
|
-
}
|
|
1503
|
-
appendTaskEvent(request) {
|
|
1504
|
-
return this.operational.appendTaskEvent(request);
|
|
1505
|
-
}
|
|
1506
|
-
searchTasks(request) {
|
|
1507
|
-
return this.operational.searchTasks(request);
|
|
1508
|
-
}
|
|
1509
1301
|
createReport(request) {
|
|
1510
1302
|
return this.operational.createReport(request);
|
|
1511
1303
|
}
|
|
1512
|
-
async getManagerContext(taskId) {
|
|
1513
|
-
const task = await this.operational.getTask(taskId);
|
|
1514
|
-
const workDay = task ? await this.operational.getWorkDay(task.workDayId) : null;
|
|
1515
|
-
return {
|
|
1516
|
-
task,
|
|
1517
|
-
workDay,
|
|
1518
|
-
agent: null,
|
|
1519
|
-
graph: workDay?.graphVersion ? { graphVersion: workDay.graphVersion } : null
|
|
1520
|
-
};
|
|
1521
|
-
}
|
|
1522
1304
|
getWorkPolicy(projectId, environment = "local") {
|
|
1523
1305
|
return this.operational.getWorkPolicy(projectId, environment);
|
|
1524
1306
|
}
|
|
@@ -1531,6 +1313,21 @@ class CloudflareD1AgentDatabase {
|
|
|
1531
1313
|
listWorkdayRequests(projectId, environment, state) {
|
|
1532
1314
|
return this.operational.listWorkdayRequests(projectId, environment, state);
|
|
1533
1315
|
}
|
|
1316
|
+
createTask(_request) {
|
|
1317
|
+
throw new Error("Project runner task lifecycle is not implemented by the SQLite SDK store.");
|
|
1318
|
+
}
|
|
1319
|
+
claimTask(_request) {
|
|
1320
|
+
throw new Error("Project runner task lifecycle is not implemented by the SQLite SDK store.");
|
|
1321
|
+
}
|
|
1322
|
+
recordTaskProgress(_request) {
|
|
1323
|
+
throw new Error("Project runner task lifecycle is not implemented by the SQLite SDK store.");
|
|
1324
|
+
}
|
|
1325
|
+
completeTask(_request) {
|
|
1326
|
+
throw new Error("Project runner task lifecycle is not implemented by the SQLite SDK store.");
|
|
1327
|
+
}
|
|
1328
|
+
getManagerContext(_taskId) {
|
|
1329
|
+
throw new Error("Project runner task lifecycle is not implemented by the SQLite SDK store.");
|
|
1330
|
+
}
|
|
1534
1331
|
claimWorkdayManagerLease(request) {
|
|
1535
1332
|
return this.operational.claimWorkdayManagerLease(request);
|
|
1536
1333
|
}
|