@treeseed/sdk 0.13.0-rc.13 → 0.13.0-rc.130
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 +69 -9
- package/dist/accounts/account-contracts.d.ts +6 -0
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.d.ts +5485 -0
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.js +242 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +304 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.js +44 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.d.ts +2 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.js +13 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.d.ts +23 -60
- package/dist/agent-capacity/contracts/capacity/assignments/context-pack-compiler.d.ts +25 -0
- package/dist/agent-capacity/contracts/capacity/assignments/context-pack-compiler.js +67 -0
- package/dist/agent-capacity/contracts/capacity/communication/communication-records.d.ts +1 -1
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.d.ts +126 -3
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.js +35 -1
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.d.ts +80 -0
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.js +121 -0
- package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.d.ts +103 -0
- package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.js +51 -0
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.d.ts +490 -0
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.js +170 -0
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +210 -91
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.js +19 -0
- package/dist/agent-capacity/contracts/configuration/configuration.d.ts +1 -1
- package/dist/agent-capacity/contracts/configuration/configuration.js +1 -3
- package/dist/agent-capacity/contracts/operations/agent-team-clone.d.ts +218 -0
- package/dist/agent-capacity/contracts/operations/agent-team-clone.js +57 -0
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.d.ts +119 -24
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.js +16 -0
- package/dist/agent-capacity/contracts/runtime/runtime-observability.d.ts +2 -154
- package/dist/agent-capacity/contracts/support/agent-atlas.d.ts +0 -13
- package/dist/agent-capacity/contracts/support/execution-graph.d.ts +1291 -0
- package/dist/agent-capacity/contracts/support/execution-graph.js +122 -0
- package/dist/agent-capacity/contracts/support/financial-records.d.ts +3 -6
- package/dist/agent-capacity/contracts/support/planning-records.d.ts +1 -87
- package/dist/agent-capacity/contracts/support/time-capacity.d.ts +0 -14
- package/dist/agent-capacity/contracts/support/time-capacity.js +1 -8
- package/dist/agent-capacity/grant.d.ts +34 -0
- package/dist/agent-capacity/grant.js +4 -0
- package/dist/agent-capacity/validation/activity-profile.d.ts +1 -1
- package/dist/agent-capacity/validation/activity-profile.js +3 -259
- package/dist/agent-capacity/validation/agent-definition-schema.d.ts +2538 -9020
- package/dist/agent-capacity/validation/agent-definition-schema.js +59 -181
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +25 -25
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.js +0 -1
- package/dist/agent-capacity/validation/assignment-records.d.ts +1 -6
- package/dist/agent-capacity/validation/assignment-records.js +49 -35
- package/dist/agent-capacity/validation/configuration.d.ts +1 -1
- package/dist/agent-capacity/validation/configuration.js +2 -7
- package/dist/agent-capacity/validation/execution/execution-graph.d.ts +1 -0
- package/dist/agent-capacity/validation/execution/execution-graph.js +16 -0
- package/dist/agent-capacity/validation/grant.d.ts +11 -0
- package/dist/agent-capacity/validation/grant.js +31 -0
- package/dist/agent-capacity/validation/index.d.ts +2 -1
- package/dist/agent-capacity/validation/index.js +2 -1
- package/dist/agent-capacity/workday.d.ts +13 -4
- package/dist/agent-capacity/workday.js +10 -26
- package/dist/capacity/agents/agent-capacity.d.ts +11 -4
- package/dist/capacity/agents/agent-capacity.js +9 -3
- package/dist/capacity-provider/capability-ontology.d.ts +1495 -0
- package/dist/capacity-provider/capability-ontology.js +221 -0
- package/dist/capacity-provider/client.d.ts +78 -3
- package/dist/capacity-provider/client.js +22 -10
- package/dist/capacity-provider/contracts/capacity-facts.d.ts +13 -0
- package/dist/capacity-provider/contracts/environment-profiles.d.ts +255 -0
- package/dist/capacity-provider/contracts/environment-profiles.js +71 -0
- package/dist/capacity-provider/contracts/governance.d.ts +110 -51
- package/dist/capacity-provider/contracts/index.d.ts +3 -0
- package/dist/capacity-provider/contracts/index.js +3 -0
- package/dist/capacity-provider/core-capability-catalog.d.ts +47 -0
- package/dist/capacity-provider/core-capability-catalog.js +49 -0
- package/dist/capacity-provider/environment-catalog.d.ts +877 -0
- package/dist/capacity-provider/environment-catalog.js +116 -0
- package/dist/capacity-provider/index.d.ts +5 -0
- package/dist/capacity-provider/index.js +5 -0
- package/dist/capacity-provider/install-configuration.d.ts +39 -0
- package/dist/capacity-provider/install-configuration.js +18 -0
- package/dist/capacity-provider/sandbox-contracts.d.ts +602 -0
- package/dist/capacity-provider/sandbox-contracts.js +90 -0
- package/dist/capacity-provider/sandbox.d.ts +2 -0
- package/dist/capacity-provider/sandbox.js +2 -0
- package/dist/capacity-provider/source-workspace.d.ts +740 -0
- package/dist/capacity-provider/source-workspace.js +130 -0
- package/dist/capacity-provider/validation.d.ts +11 -3
- package/dist/capacity-provider/validation.js +136 -70
- package/dist/configuration/secrets-capability.d.ts +5 -1
- package/dist/configuration/secrets-capability.js +5 -1
- package/dist/content/contracts.d.ts +1 -1
- package/dist/content/validation/agent-operational-content-schemas.d.ts +430 -777
- package/dist/content/validation/agent-operational-content-schemas.js +31 -57
- package/dist/content/validation/auxiliary-content-schemas.d.ts +144 -144
- package/dist/content/validation/content-model-schemas.d.ts +16063 -19764
- package/dist/content/validation/content-model-schemas.js +350 -98
- package/dist/content/validation/portable-content-data.d.ts +751 -1782
- package/dist/content/validation/portable-content-data.js +10 -4
- package/dist/content/validation/schema-constraints.d.ts +80 -0
- package/dist/content/validation/schema-constraints.js +173 -0
- package/dist/deployment/ai/storage.d.ts +158 -0
- package/dist/deployment/ai/storage.js +32 -0
- package/dist/deployment/ai-hosting.d.ts +297 -0
- package/dist/deployment/ai-hosting.js +63 -0
- package/dist/deployment/ai-instance.d.ts +65 -0
- package/dist/deployment/ai-instance.js +30 -0
- package/dist/deployment/ai-mode.d.ts +454 -0
- package/dist/deployment/ai-mode.js +67 -0
- package/dist/deployment/canonical.d.ts +2 -0
- package/dist/deployment/canonical.js +17 -0
- package/dist/deployment/catalog.d.ts +16 -0
- package/dist/deployment/catalog.js +48 -0
- package/dist/deployment/hosted-topology-template.d.ts +449 -0
- package/dist/deployment/hosted-topology-template.js +56 -0
- package/dist/deployment/hosted-topology.d.ts +2698 -0
- package/dist/deployment/hosted-topology.js +468 -0
- package/dist/deployment/index.d.ts +13 -0
- package/dist/deployment/index.js +13 -0
- package/dist/deployment/postgres/contracts.d.ts +418 -0
- package/dist/deployment/postgres/contracts.js +83 -0
- package/dist/deployment/postgres/requirements.d.ts +15 -0
- package/dist/deployment/postgres/requirements.js +32 -0
- package/dist/deployment/postgres/transfer.d.ts +97 -0
- package/dist/deployment/postgres/transfer.js +29 -0
- package/dist/deployment/schemas.d.ts +8625 -0
- package/dist/deployment/schemas.js +455 -0
- package/dist/deployment/topology.d.ts +9 -0
- package/dist/deployment/topology.js +35 -0
- package/dist/development/index.d.ts +1 -0
- package/dist/development/index.js +1 -0
- package/dist/development/schemas.d.ts +3594 -0
- package/dist/development/schemas.js +204 -0
- package/dist/development/session-migration.d.ts +3 -0
- package/dist/development/session-migration.js +25 -0
- package/dist/entrypoints/clients/control-plane-client.d.ts +9 -1
- package/dist/entrypoints/clients/control-plane-client.js +17 -5
- package/dist/graph/context-query-contracts.d.ts +16 -1
- package/dist/graph/context-query-contracts.js +6 -1
- package/dist/guarantees/evidence-trust.d.ts +32 -0
- package/dist/guarantees/evidence-trust.js +47 -0
- package/dist/guarantees/index.d.ts +154 -0
- package/dist/guarantees/index.js +44 -0
- package/dist/identity/browser-session.d.ts +233 -0
- package/dist/identity/browser-session.js +51 -0
- package/dist/identity/contracts.d.ts +191 -0
- package/dist/identity/contracts.js +77 -0
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.js +3 -0
- package/dist/identity/runtime.d.ts +186 -0
- package/dist/identity/runtime.js +49 -0
- package/dist/knowledge/contracts.d.ts +9 -2
- package/dist/knowledge/contracts.js +2 -2
- package/dist/model-registry/agent-operational-models.d.ts +1 -1
- package/dist/model-registry/agent-operational-models.js +1 -4
- package/dist/model-registry/build-builtin-model-registry.js +44 -72
- package/dist/model-registry/discussion-models.js +0 -1
- package/dist/operator-contracts/canonical-command-tree.js +415 -44
- package/dist/operator-contracts/catalog/admin-account-team-operations.d.ts +36 -0
- package/dist/operator-contracts/catalog/admin-account-team-operations.js +52 -0
- package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.d.ts +75 -0
- package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.js +42 -0
- package/dist/operator-contracts/catalog/capability-ontology-operations.d.ts +163 -0
- package/dist/operator-contracts/catalog/capability-ontology-operations.js +24 -0
- package/dist/operator-contracts/catalog/commands/command-tree-builders.d.ts +62 -0
- package/dist/operator-contracts/catalog/commands/command-tree-builders.js +191 -0
- package/dist/operator-contracts/catalog/communication-operations.d.ts +457 -0
- package/dist/operator-contracts/catalog/communication-operations.js +92 -0
- package/dist/operator-contracts/catalog/control-plane-catalog.d.ts +6 -0
- package/dist/operator-contracts/catalog/control-plane-catalog.js +18 -0
- package/dist/operator-contracts/catalog/execution/execution-operations.d.ts +36 -0
- package/dist/operator-contracts/catalog/execution/execution-operations.js +39 -0
- package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +399 -0
- package/dist/operator-contracts/catalog/hosted-topology-operations.js +79 -0
- package/dist/operator-contracts/catalog/inbox-operations.d.ts +265 -0
- package/dist/operator-contracts/catalog/inbox-operations.js +36 -0
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.d.ts +53 -0
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.js +24 -0
- package/dist/operator-contracts/catalog/infrastructure/command-tree-paths.d.ts +3 -0
- package/dist/operator-contracts/catalog/infrastructure/command-tree-paths.js +15 -0
- package/dist/operator-contracts/catalog/knowledge-share-operations.d.ts +127 -0
- package/dist/operator-contracts/catalog/knowledge-share-operations.js +25 -0
- package/dist/operator-contracts/catalog/provider-environment-commands.d.ts +4 -0
- package/dist/operator-contracts/catalog/provider-environment-commands.js +69 -0
- package/dist/operator-contracts/catalog/provider-environment-operations.d.ts +41 -0
- package/dist/operator-contracts/catalog/provider-environment-operations.js +61 -0
- package/dist/operator-contracts/catalog/services/identity-commands.d.ts +2 -0
- package/dist/operator-contracts/catalog/services/identity-commands.js +13 -0
- package/dist/operator-contracts/catalog/services/secret-commands.d.ts +2 -0
- package/dist/operator-contracts/catalog/services/secret-commands.js +31 -0
- package/dist/operator-contracts/catalog/services/secret-operations.d.ts +70 -0
- package/dist/operator-contracts/catalog/services/secret-operations.js +52 -0
- package/dist/operator-contracts/catalog/treeai-operations.d.ts +13 -0
- package/dist/operator-contracts/catalog/treeai-operations.js +61 -0
- package/dist/operator-contracts/catalog/workdays/profile-commands.d.ts +4 -0
- package/dist/operator-contracts/catalog/workdays/profile-commands.js +20 -0
- package/dist/operator-contracts/catalog/workdays/profile-operations.d.ts +41 -0
- package/dist/operator-contracts/catalog/workdays/profile-operations.js +50 -0
- package/dist/operator-contracts/catalog/workdays/selection-commands.d.ts +3 -0
- package/dist/operator-contracts/catalog/workdays/selection-commands.js +28 -0
- package/dist/operator-contracts/command-tree.d.ts +29 -0
- package/dist/operator-contracts/command-tree.js +50 -0
- package/dist/operator-contracts/communication/addressing.d.ts +8 -0
- package/dist/operator-contracts/communication/addressing.js +57 -0
- package/dist/operator-contracts/communication/contracts.d.ts +1966 -0
- package/dist/operator-contracts/communication/contracts.js +195 -0
- package/dist/operator-contracts/control-plane-operation.d.ts +15 -1
- package/dist/operator-contracts/control-plane-operation.js +14 -6
- package/dist/operator-contracts/control-plane-operations.d.ts +2496 -328
- package/dist/operator-contracts/control-plane-operations.js +280 -127
- package/dist/operator-contracts/inbox/contracts.d.ts +1111 -0
- package/dist/operator-contracts/inbox/contracts.js +138 -0
- package/dist/operator-contracts/index.d.ts +6 -1
- package/dist/operator-contracts/index.js +6 -1
- package/dist/operator-contracts/knowledge/contracts.d.ts +130 -0
- package/dist/operator-contracts/knowledge/contracts.js +39 -0
- package/dist/operator-contracts/mcp.d.ts +5 -0
- package/dist/operator-contracts/mcp.js +62 -0
- package/dist/operator-contracts/oauth.d.ts +45 -0
- package/dist/operator-contracts/oauth.js +7 -0
- package/dist/operator-contracts/operation-builder.d.ts +18 -0
- package/dist/operator-contracts/operation-builder.js +78 -0
- package/dist/operator-contracts/seed/seed-bundle.d.ts +138 -0
- package/dist/operator-contracts/seed/seed-bundle.js +68 -0
- package/dist/operator-contracts/workday-lifecycle.d.ts +383 -28
- package/dist/operator-contracts/workday-lifecycle.js +124 -17
- package/dist/platform/agent-schema-verification.d.ts +3 -0
- package/dist/platform/agent-schema-verification.js +377 -0
- package/dist/platform/contracts.d.ts +429 -0
- package/dist/platform/contracts.js +93 -0
- package/dist/platform/index.d.ts +6 -0
- package/dist/platform/index.js +6 -0
- package/dist/platform/inventory.d.ts +11 -0
- package/dist/platform/inventory.js +53 -0
- package/dist/platform/project-create.d.ts +49 -0
- package/dist/platform/project-create.js +75 -0
- package/dist/platform/schemas.d.ts +1094 -0
- package/dist/platform/schemas.js +99 -0
- package/dist/platform/verification.d.ts +9 -0
- package/dist/platform/verification.js +114 -0
- package/dist/platform/workset.d.ts +21 -0
- package/dist/platform/workset.js +106 -0
- package/dist/sdk-types/support/planning-policy.d.ts +1 -1
- package/dist/sdk-types/support/sdk-model-names.d.ts +1 -1
- package/dist/sdk-types/support/sdk-model-names.js +0 -3
- package/dist/sdk-types/support/sdk-search-request.d.ts +2 -2
- package/dist/secrets-capability/github-actions-encryption.d.ts +2 -0
- package/dist/secrets-capability/github-actions-encryption.js +11 -0
- package/dist/secrets-capability/provider-operation-contracts.d.ts +15 -1
- package/dist/secrets-capability/secret-contracts.d.ts +33 -0
- package/dist/secrets-capability/secret-contracts.js +49 -0
- package/dist/secrets-capability/service-provider-contracts.d.ts +5 -3
- package/dist/secrets-capability/service-provider-contracts.js +66 -50
- package/dist/secrets-capability/shared-access.d.ts +51 -0
- package/dist/secrets-capability/shared-access.js +36 -0
- package/dist/secrets-capability/shared-resources.d.ts +376 -0
- package/dist/secrets-capability/shared-resources.js +91 -0
- package/dist/secrets-capability/vault-contracts.d.ts +132 -0
- package/dist/secrets-capability/vault-contracts.js +56 -0
- package/dist/security/encrypted-envelope.d.ts +177 -0
- package/dist/security/encrypted-envelope.js +34 -0
- package/dist/security/envelope-codec.d.ts +38 -0
- package/dist/security/envelope-codec.js +96 -0
- package/dist/security/index.d.ts +2 -0
- package/dist/security/index.js +2 -0
- package/dist/site-contracts/catalog.d.ts +16 -0
- package/dist/site-contracts/catalog.js +19 -0
- package/dist/site-contracts/cloudflare.d.ts +48 -0
- package/dist/site-contracts/platform.d.ts +94 -0
- package/dist/site-contracts/plugin.d.ts +63 -0
- package/dist/site-contracts/plugin.js +26 -0
- package/dist/treeai/catalog.d.ts +1 -0
- package/dist/treeai/catalog.js +1 -0
- package/dist/treeai/client.d.ts +793 -0
- package/dist/treeai/client.js +44 -0
- package/dist/treeai/contract.d.ts +41 -0
- package/dist/treeai/contract.js +51 -0
- package/dist/treeai/generated/upstream.d.ts +770 -0
- package/dist/treeai/generated/upstream.js +4 -0
- package/dist/treeai/index.d.ts +4 -0
- package/dist/treeai/index.js +4 -0
- package/dist/treedx/client.d.ts +605 -0
- package/dist/treedx/client.js +39 -0
- package/dist/treedx/contract.d.ts +32 -0
- package/dist/treedx/contract.js +63 -0
- package/dist/treedx/index.d.ts +3 -0
- package/dist/treedx/index.js +3 -0
- package/dist/treedx/types.d.ts +294 -7
- package/dist/treedx/types.js +44 -7
- package/dist/types/agents/agent-activity-profile.d.ts +43 -98
- package/dist/types/agents/agent-activity-profile.js +23 -0
- package/dist/types/agents/agent-trigger-kinds.d.ts +3 -5
- package/dist/types/agents/agent-trigger-kinds.js +1 -13
- package/dist/types/agents/execution-run-ref.d.ts +1 -8
- package/guarantees/agent/golden/component-boundaries.guarantee.yaml +12 -0
- package/guarantees/agent/golden/product-custody.guarantee.yaml +12 -0
- package/guarantees/agent/golden/product.guarantee.yaml +12 -0
- package/guarantees/agent/golden/scenes/component-boundaries.scene.yaml +858 -0
- package/guarantees/agent/golden/scenes/product-custody.scene.yaml +53 -0
- package/guarantees/agent/golden/scenes/product.scene.yaml +8 -0
- package/guarantees/verifiers/golden.verifiers.yaml +1464 -0
- package/package.json +72 -13
- package/tests/acceptance/golden-product.test.ts +205 -0
- package/tests/acceptance/golden-product.ts +404 -0
- package/tests/acceptance/product/base-red.ts +73 -0
- package/tests/acceptance/product/documentation-examples.ts +68 -0
- package/tests/acceptance/product/intent-runtime.ts +145 -0
- package/tests/acceptance/product/release-output.ts +160 -0
- package/tests/acceptance/product/research-artifact.ts +87 -0
- package/tests/acceptance/product/research-revision.ts +82 -0
- package/tests/acceptance/product/research-source.ts +91 -0
- package/tests/acceptance/product/test-chain.ts +192 -0
- package/treeseed.package.yaml +147 -0
- package/dist/agent-capacity/allocation.d.ts +0 -186
- package/dist/agent-capacity/allocation.js +0 -226
- package/dist/agent-capacity/artifact-mutation-receipt.d.ts +0 -49
- package/dist/agent-capacity/artifact-mutation-receipt.js +0 -36
- package/dist/agent-capacity/artifacts.d.ts +0 -107
- package/dist/agent-capacity/artifacts.js +0 -39
- package/dist/agent-capacity/authority/agent-authority-presets.d.ts +0 -13
- package/dist/agent-capacity/authority/agent-authority-presets.js +0 -106
- package/dist/agent-capacity/contracts/operations/workflow-promotion.d.ts +0 -24
- package/dist/agent-capacity/contracts/support/decision-work.d.ts +0 -251
- package/dist/agent-capacity/policy/capacity/allocations/allocation-hierarchy.d.ts +0 -29
- package/dist/agent-capacity/policy/capacity/allocations/allocation-hierarchy.js +0 -110
- package/dist/agent-capacity/validation/allocation.d.ts +0 -12
- package/dist/agent-capacity/validation/allocation.js +0 -115
- package/dist/agent-capacity/validation/workflow-promotion.d.ts +0 -2
- package/dist/agent-capacity/validation/workflow-promotion.js +0 -34
- package/dist/operator-contracts/workday-profile.d.ts +0 -72
- package/dist/operator-contracts/workday-profile.js +0 -106
- package/dist/secrets-capability/service-vault-contracts.d.ts +0 -61
- package/dist/secrets-capability/service-vault-contracts.js +0 -39
- package/dist/treedx/accounts/auth.d.ts +0 -17
- package/dist/treedx/accounts/auth.js +0 -48
- package/dist/treedx/client/accounts/contracts/auth-mode.d.ts +0 -3
- package/dist/treedx/client/accounts/contracts/auth-mode.js +0 -6
- package/dist/treedx/client/build/creation/build-context.d.ts +0 -3
- package/dist/treedx/client/build/creation/build-context.js +0 -7
- package/dist/treedx/client/build/creation/build-snapshot.d.ts +0 -3
- package/dist/treedx/client/build/creation/build-snapshot.js +0 -8
- package/dist/treedx/client/capacity/allocations/contracts/put-capability-grant.d.ts +0 -3
- package/dist/treedx/client/capacity/allocations/contracts/put-capability-grant.js +0 -7
- package/dist/treedx/client/capacity/allocations/queries/list-capability-grants.d.ts +0 -6
- package/dist/treedx/client/capacity/allocations/queries/list-capability-grants.js +0 -10
- package/dist/treedx/client/methods.d.ts +0 -102
- package/dist/treedx/client/methods.js +0 -209
- package/dist/treedx/client/persistence/contracts/restore-storage.d.ts +0 -3
- package/dist/treedx/client/persistence/contracts/restore-storage.js +0 -6
- package/dist/treedx/client/persistence/lifecycle/verify-storage-restore.d.ts +0 -3
- package/dist/treedx/client/persistence/lifecycle/verify-storage-restore.js +0 -6
- package/dist/treedx/client/repositories/creation/register-repository.d.ts +0 -3
- package/dist/treedx/client/repositories/creation/register-repository.js +0 -7
- package/dist/treedx/client/repositories/queries/get-repository.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/get-repository.js +0 -7
- package/dist/treedx/client/repositories/queries/list-repository-paths.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/list-repository-paths.js +0 -7
- package/dist/treedx/client/repositories/queries/list-repository-refs.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/list-repository-refs.js +0 -12
- package/dist/treedx/client/repositories/queries/query-repository.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/query-repository.js +0 -7
- package/dist/treedx/client/repositories/queries/read-repository-file.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/read-repository-file.js +0 -6
- package/dist/treedx/client/repositories/queries/read-repository-files.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/read-repository-files.js +0 -7
- package/dist/treedx/client/repositories/queries/search-repository-files.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/search-repository-files.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/artifacts/contracts/download-artifact.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/artifacts/contracts/download-artifact.js +0 -9
- package/dist/treedx/client/support/contracts/treedx/authorization/contracts/whoami.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/authorization/contracts/whoami.js +0 -6
- package/dist/treedx/client/support/contracts/treedx/graph/contracts/parse-context-dsl.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/graph/contracts/parse-context-dsl.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/health/contracts/deep-health.d.ts +0 -5
- package/dist/treedx/client/support/contracts/treedx/health/contracts/deep-health.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/health/contracts/health.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/health/contracts/health.js +0 -6
- package/dist/treedx/client/support/contracts/treedx/health/contracts/metrics.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/health/contracts/metrics.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/health/contracts/prometheus-metrics.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/health/contracts/prometheus-metrics.js +0 -19
- package/dist/treedx/client/support/contracts/treedx/health/contracts/ready.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/health/contracts/ready.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/health/contracts/status.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/health/contracts/status.js +0 -6
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/commit.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/commit.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/diff.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/diff.js +0 -6
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/fetch-remote.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/fetch-remote.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/push.d.ts +0 -6
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/push.js +0 -23
- package/dist/treedx/client/support/contracts/treedx/search/contracts/compact-search-index.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/search/contracts/compact-search-index.js +0 -8
- package/dist/treedx/client/support/contracts/treedx/search/contracts/search.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/search/contracts/search.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/backup-storage.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/backup-storage.js +0 -8
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/compact-storage.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/compact-storage.js +0 -8
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/assert-binary-ok.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/assert-binary-ok.js +0 -15
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/fetch-with-timeout.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/fetch-with-timeout.js +0 -38
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/headers.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/headers.js +0 -15
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/parse-json-response.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/parse-json-response.js +0 -15
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/query.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/query.js +0 -14
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/repo-id.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/repo-id.js +0 -14
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/request.d.ts +0 -6
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/request.js +0 -41
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/throw-api-error.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/throw-api-error.js +0 -14
- package/dist/treedx/client/support/contracts/treedx/workspaces/contracts/exec.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/workspaces/contracts/exec.js +0 -7
- package/dist/treedx/client/support/creation/apply-changeset.d.ts +0 -3
- package/dist/treedx/client/support/creation/apply-changeset.js +0 -10
- package/dist/treedx/client/support/creation/apply-storage-migration.d.ts +0 -3
- package/dist/treedx/client/support/creation/apply-storage-migration.js +0 -7
- package/dist/treedx/client/support/creation/create-migration.d.ts +0 -6
- package/dist/treedx/client/support/creation/create-migration.js +0 -7
- package/dist/treedx/client/support/creation/export-artifact.d.ts +0 -3
- package/dist/treedx/client/support/creation/export-artifact.js +0 -8
- package/dist/treedx/client/support/creation/plan-storage-migration.d.ts +0 -3
- package/dist/treedx/client/support/creation/plan-storage-migration.js +0 -7
- package/dist/treedx/client/support/creation/request-binary.d.ts +0 -6
- package/dist/treedx/client/support/creation/request-binary.js +0 -42
- package/dist/treedx/client/support/creation/write-file.d.ts +0 -3
- package/dist/treedx/client/support/creation/write-file.js +0 -10
- package/dist/treedx/client/support/creation/write-files.d.ts +0 -3
- package/dist/treedx/client/support/creation/write-files.js +0 -12
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/get-artifact.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/get-artifact.js +0 -7
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/list-artifacts.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/list-artifacts.js +0 -7
- package/dist/treedx/client/support/queries/treedx/authorization/queries/effective-scope.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/authorization/queries/effective-scope.js +0 -9
- package/dist/treedx/client/support/queries/treedx/authorization/queries/list-capabilities.d.ts +0 -4
- package/dist/treedx/client/support/queries/treedx/authorization/queries/list-capabilities.js +0 -6
- package/dist/treedx/client/support/queries/treedx/federation/queries/get-placement.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/federation/queries/get-placement.js +0 -7
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-node.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-node.js +0 -7
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-related.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-related.js +0 -7
- package/dist/treedx/client/support/queries/treedx/graph/queries/list-nodes.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/graph/queries/list-nodes.js +0 -7
- package/dist/treedx/client/support/queries/treedx/repositories/queries/list-tree.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/repositories/queries/list-tree.js +0 -10
- package/dist/treedx/client/support/queries/treedx/repositories/queries/read-file.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/repositories/queries/read-file.js +0 -9
- package/dist/treedx/client/support/queries/treedx/search/queries/get-search-index-status.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/search/queries/get-search-index-status.js +0 -7
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-migration.d.ts +0 -6
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-migration.js +0 -7
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-snapshot.d.ts +0 -6
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-snapshot.js +0 -7
- package/dist/treedx/client/support/queries/treedx/storage/queries/list-storage-migrations.d.ts +0 -6
- package/dist/treedx/client/support/queries/treedx/storage/queries/list-storage-migrations.js +0 -6
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-audit-events.d.ts +0 -15
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-audit-events.js +0 -6
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-repositories.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-repositories.js +0 -7
- package/dist/treedx/client/support/retirement/cleanup-artifacts.d.ts +0 -3
- package/dist/treedx/client/support/retirement/cleanup-artifacts.js +0 -7
- package/dist/treedx/client/support/retirement/delete-artifact.d.ts +0 -3
- package/dist/treedx/client/support/retirement/delete-artifact.js +0 -7
- package/dist/treedx/client/support/retirement/delete-file.d.ts +0 -3
- package/dist/treedx/client/support/retirement/delete-file.js +0 -10
- package/dist/treedx/client/support/retirement/rollback-storage-migration.d.ts +0 -3
- package/dist/treedx/client/support/retirement/rollback-storage-migration.js +0 -7
- package/dist/treedx/client/support/updates/patch-file.d.ts +0 -3
- package/dist/treedx/client/support/updates/patch-file.js +0 -10
- package/dist/treedx/client/support/updates/refresh-search-index.d.ts +0 -3
- package/dist/treedx/client/support/updates/refresh-search-index.js +0 -8
- package/dist/treedx/client/treedx/blobs/contracts/download-blob.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/contracts/download-blob.js +0 -6
- package/dist/treedx/client/treedx/blobs/creation/create-blob-upload.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/create-blob-upload.js +0 -8
- package/dist/treedx/client/treedx/blobs/creation/request-blob-download.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/request-blob-download.js +0 -27
- package/dist/treedx/client/treedx/blobs/creation/request-blob-upload.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/request-blob-upload.js +0 -41
- package/dist/treedx/client/treedx/blobs/creation/upload-blob-part.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/upload-blob-part.js +0 -27
- package/dist/treedx/client/treedx/blobs/creation/upload-blob.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/upload-blob.js +0 -6
- package/dist/treedx/client/treedx/blobs/creation/write-blob.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/write-blob.js +0 -8
- package/dist/treedx/client/treedx/blobs/lifecycle/complete-blob-upload.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/lifecycle/complete-blob-upload.js +0 -8
- package/dist/treedx/client/treedx/blobs/queries/read-blob.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/queries/read-blob.js +0 -10
- package/dist/treedx/client/treedx/blobs/retirement/abort-blob-upload.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/retirement/abort-blob-upload.js +0 -7
- package/dist/treedx/client/treedx/blobs/retirement/delete-blob.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/retirement/delete-blob.js +0 -8
- package/dist/treedx/client/treedx/federation/contracts/federated-query.d.ts +0 -3
- package/dist/treedx/client/treedx/federation/contracts/federated-query.js +0 -7
- package/dist/treedx/client/treedx/federation/creation/plan-federated-query.d.ts +0 -3
- package/dist/treedx/client/treedx/federation/creation/plan-federated-query.js +0 -6
- package/dist/treedx/client/treedx/federation/queries/check-mirror-health.d.ts +0 -3
- package/dist/treedx/client/treedx/federation/queries/check-mirror-health.js +0 -7
- package/dist/treedx/client/treedx/federation/updates/promote-mirror.d.ts +0 -3
- package/dist/treedx/client/treedx/federation/updates/promote-mirror.js +0 -7
- package/dist/treedx/client/treedx/federation/updates/sync-mirror.d.ts +0 -3
- package/dist/treedx/client/treedx/federation/updates/sync-mirror.js +0 -7
- package/dist/treedx/client/treedx/graph/contracts/federated-context.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/contracts/federated-context.js +0 -7
- package/dist/treedx/client/treedx/graph/contracts/federated-graph.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/contracts/federated-graph.js +0 -7
- package/dist/treedx/client/treedx/graph/contracts/graph-search.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/contracts/graph-search.js +0 -8
- package/dist/treedx/client/treedx/graph/queries/get-graph-node.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/get-graph-node.js +0 -10
- package/dist/treedx/client/treedx/graph/queries/get-graph-refresh-job.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/get-graph-refresh-job.js +0 -7
- package/dist/treedx/client/treedx/graph/queries/get-subgraph.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/get-subgraph.js +0 -7
- package/dist/treedx/client/treedx/graph/queries/query-graph.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/query-graph.js +0 -7
- package/dist/treedx/client/treedx/graph/queries/search-graph-entities.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/search-graph-entities.js +0 -6
- package/dist/treedx/client/treedx/graph/queries/search-graph-files.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/search-graph-files.js +0 -6
- package/dist/treedx/client/treedx/graph/queries/search-graph-sections.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/search-graph-sections.js +0 -6
- package/dist/treedx/client/treedx/graph/updates/refresh-graph.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/updates/refresh-graph.js +0 -7
- package/dist/treedx/client/treedx/search/contracts/federated-search.d.ts +0 -3
- package/dist/treedx/client/treedx/search/contracts/federated-search.js +0 -7
- package/dist/treedx/client/treedx/workspaces/creation/create-workspace.d.ts +0 -3
- package/dist/treedx/client/treedx/workspaces/creation/create-workspace.js +0 -7
- package/dist/treedx/client/treedx/workspaces/retirement/abandon-workspace.d.ts +0 -3
- package/dist/treedx/client/treedx/workspaces/retirement/abandon-workspace.js +0 -12
- package/dist/treedx/client/treedx/workspaces/retirement/close-workspace.d.ts +0 -2
- package/dist/treedx/client/treedx/workspaces/retirement/close-workspace.js +0 -6
- package/dist/treedx/generated/openapi-types.d.ts +0 -3662
- package/dist/treedx/generated/openapi-types.js +0 -0
- package/dist/treedx/support/client.d.ts +0 -251
- package/dist/treedx/support/client.js +0 -252
- package/dist/treedx/support/errors.d.ts +0 -13
- package/dist/treedx/support/errors.js +0 -17
- package/dist/treedx/types/tree-dx-actor.d.ts +0 -209
- package/dist/treedx/types/tree-dx-actor.js +0 -8
- package/dist/treedx/types/tree-dx-artifact-list-response.d.ts +0 -13
- package/dist/treedx/types/tree-dx-artifact-list-response.js +0 -0
- package/dist/treedx/types/tree-dx-changeset.d.ts +0 -51
- package/dist/treedx/types/tree-dx-changeset.js +0 -6
- package/dist/treedx/types/tree-dx-context-request.d.ts +0 -245
- package/dist/treedx/types/tree-dx-context-request.js +0 -0
- package/dist/treedx/types/tree-dx-exec-result.d.ts +0 -249
- package/dist/treedx/types/tree-dx-exec-result.js +0 -0
- package/dist/treedx/types/tree-dx-list-tree-request.d.ts +0 -222
- package/dist/treedx/types/tree-dx-list-tree-request.js +0 -0
- package/dist/treedx/types/tree-dx-push-request.d.ts +0 -229
- package/dist/treedx/types/tree-dx-push-request.js +0 -0
- /package/dist/{agent-capacity/contracts/operations/workflow-promotion.js → site-contracts/cloudflare.js} +0 -0
- /package/dist/{agent-capacity/contracts/support/decision-work.js → site-contracts/platform.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { conditionalFields, requiredProperties, uniqueArray as unique } from "./schema-constraints.js";
|
|
3
|
+
import { agentClassSchema as agentClass, agentDefinitionSchema, permissionSetSchema } from "../../agent-capacity/validation/agent-definition-schema.js";
|
|
4
4
|
import {
|
|
5
5
|
BOOK_SCHEMA_VERSION,
|
|
6
6
|
KNOWLEDGE_PAGE_SCHEMA_VERSION,
|
|
@@ -9,14 +9,36 @@ import {
|
|
|
9
9
|
} from "../../knowledge/contracts.js";
|
|
10
10
|
import { auxiliaryContentSchemas } from "./auxiliary-content-schemas.js";
|
|
11
11
|
import { agentOperationalContentSchemas } from "./agent-operational-content-schemas.js";
|
|
12
|
+
import { exactEntityReferenceSchema, estimateSchema } from "../../agent-capacity/contracts/capacity/assignments/agent-execution.js";
|
|
12
13
|
import { agentTestContentSchema, templateProductContentSchema, workdayContentSchema } from "./auxiliary-content-schemas.js";
|
|
13
14
|
export * from "./agent-operational-content-schemas.js";
|
|
14
15
|
const nonEmpty = z.string().trim().min(1);
|
|
15
16
|
const strings = z.array(z.string());
|
|
17
|
+
const identifier = z.string().min(1).max(200).regex(/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/u);
|
|
18
|
+
const slug = z.string().min(1).max(100).regex(/^[a-z0-9]+(?:[._/-][a-z0-9]+)*$/u);
|
|
19
|
+
const identifiers = z.array(identifier);
|
|
16
20
|
const date = z.coerce.date();
|
|
17
21
|
const lifecycleStatus = z.enum(["live", "in progress", "exploratory", "planned", "speculative"]);
|
|
18
|
-
const
|
|
19
|
-
const
|
|
22
|
+
const exactRefs = z.array(exactEntityReferenceSchema);
|
|
23
|
+
const exactWorkItemReferenceSchema = z.intersection(exactEntityReferenceSchema, requiredProperties(
|
|
24
|
+
z.object({
|
|
25
|
+
store: z.literal("treedx"),
|
|
26
|
+
model: z.literal("proposal"),
|
|
27
|
+
anchor: z.string().regex(new RegExp("^work-item/[a-z0-9]+(?:-[a-z0-9]+)*$", "u"))
|
|
28
|
+
}).passthrough(),
|
|
29
|
+
["store", "model", "id", "revision", "digest", "repository", "commit", "path", "anchor"],
|
|
30
|
+
"A dependency endpoint must identify an exact proposal work item."
|
|
31
|
+
));
|
|
32
|
+
const exactDependencyLinkSchema = z.object({
|
|
33
|
+
relation: z.literal("depends_on"),
|
|
34
|
+
from: exactWorkItemReferenceSchema,
|
|
35
|
+
to: exactWorkItemReferenceSchema
|
|
36
|
+
}).strict().superRefine((link, context) => {
|
|
37
|
+
if (JSON.stringify(link.from) === JSON.stringify(link.to)) context.addIssue({
|
|
38
|
+
code: z.ZodIssueCode.custom,
|
|
39
|
+
message: "A work item cannot depend on itself."
|
|
40
|
+
});
|
|
41
|
+
});
|
|
20
42
|
const linked = {
|
|
21
43
|
group_ids: strings.optional(),
|
|
22
44
|
related_objectives: strings.optional(),
|
|
@@ -48,6 +70,124 @@ const proposalPlanSchema = z.object({
|
|
|
48
70
|
verification: strings,
|
|
49
71
|
openQuestions: strings.optional()
|
|
50
72
|
});
|
|
73
|
+
const proposalLinks = {
|
|
74
|
+
related_notes: strings.optional(),
|
|
75
|
+
evidence_refs: strings.optional(),
|
|
76
|
+
decision_dependencies: z.array(z.object({ projectId: nonEmpty, decisionId: nonEmpty }).strict()).optional(),
|
|
77
|
+
...linked
|
|
78
|
+
};
|
|
79
|
+
function validateWorkItemWorkspace(value, context) {
|
|
80
|
+
if (value.workspace !== "read-only") {
|
|
81
|
+
const mutable = (value.contextRefs ?? []).filter((reference) => reference.store === value.workspace && reference.model === "repository");
|
|
82
|
+
if (mutable.length !== 1) context.addIssue({ code: z.ZodIssueCode.custom, path: ["contextRefs"], message: `${value.workspace} work requires exactly one exact ${value.workspace} workspace reference.` });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function validateWorkItemDependencies(value, context) {
|
|
86
|
+
const ids = new Set(value.workItems.map((item) => item.id));
|
|
87
|
+
if (ids.size !== value.workItems.length) context.addIssue({ code: z.ZodIssueCode.custom, message: "Work-item IDs must be unique." });
|
|
88
|
+
for (const [index, item] of value.workItems.entries()) for (const dependency of item.dependsOn) {
|
|
89
|
+
if (!ids.has(dependency)) context.addIssue({ code: z.ZodIssueCode.custom, path: ["workItems", index, "dependsOn"], message: `Dependency ${dependency} does not exist in this proposal.` });
|
|
90
|
+
if (dependency === item.id) context.addIssue({ code: z.ZodIssueCode.custom, path: ["workItems", index, "dependsOn"], message: "Work items cannot depend on themselves." });
|
|
91
|
+
}
|
|
92
|
+
const byId = new Map(value.workItems.map((item) => [item.id, item]));
|
|
93
|
+
const visiting = /* @__PURE__ */ new Set(), visited = /* @__PURE__ */ new Set();
|
|
94
|
+
const cyclic = (id) => {
|
|
95
|
+
if (visiting.has(id)) return true;
|
|
96
|
+
if (visited.has(id)) return false;
|
|
97
|
+
visiting.add(id);
|
|
98
|
+
if ((byId.get(id)?.dependsOn ?? []).some(cyclic)) return true;
|
|
99
|
+
visiting.delete(id);
|
|
100
|
+
visited.add(id);
|
|
101
|
+
return false;
|
|
102
|
+
};
|
|
103
|
+
if ([...ids].some(cyclic)) context.addIssue({ code: z.ZodIssueCode.custom, path: ["workItems"], message: "Work-item dependencies must be acyclic." });
|
|
104
|
+
}
|
|
105
|
+
const executionPlanWorkItemSchema = conditionalFields(z.object({
|
|
106
|
+
id: slug,
|
|
107
|
+
priority: z.number().int().safe().optional(),
|
|
108
|
+
activity: z.literal("acting"),
|
|
109
|
+
agentClass,
|
|
110
|
+
workspace: z.enum(["read-only", "treedx", "git"]),
|
|
111
|
+
review: z.enum(["required", "none"]),
|
|
112
|
+
objective: nonEmpty,
|
|
113
|
+
estimate: estimateSchema.optional(),
|
|
114
|
+
reviewEstimate: estimateSchema.optional(),
|
|
115
|
+
maximumReviewCycles: z.number().int().positive().optional(),
|
|
116
|
+
dependsOn: unique(z.array(slug)),
|
|
117
|
+
requestedPermissions: permissionSetSchema,
|
|
118
|
+
requiredCapabilities: unique(z.array(identifier)).optional(),
|
|
119
|
+
contextRefs: unique(exactRefs).optional(),
|
|
120
|
+
acceptanceCriteria: z.array(nonEmpty).min(1)
|
|
121
|
+
}).strict(), [
|
|
122
|
+
{ field: "review", equals: "required", alternatives: [["maximumReviewCycles"]], message: "Required review needs a maximum cycle count." },
|
|
123
|
+
{ field: "review", equals: "none", forbidden: { fields: ["reviewEstimate", "maximumReviewCycles"] }, message: "Unreviewed work cannot define review estimates or cycles." }
|
|
124
|
+
]).superRefine(validateWorkItemWorkspace);
|
|
125
|
+
const executionPlanSchema = z.object({ workItems: z.array(executionPlanWorkItemSchema).min(1) }).strict().superRefine(validateWorkItemDependencies);
|
|
126
|
+
const proposalSchema = conditionalFields(z.object({
|
|
127
|
+
schemaVersion: z.literal("treeseed.proposal/v1"),
|
|
128
|
+
id: identifier,
|
|
129
|
+
projectId: identifier,
|
|
130
|
+
title: nonEmpty,
|
|
131
|
+
groupIds: unique(identifiers).optional(),
|
|
132
|
+
request: nonEmpty,
|
|
133
|
+
summary: nonEmpty.optional(),
|
|
134
|
+
status: z.enum(["draft", "discussing", "ready", "decided", "withdrawn"]),
|
|
135
|
+
objectiveRefs: unique(exactRefs).optional(),
|
|
136
|
+
evidenceRefs: unique(exactRefs).optional(),
|
|
137
|
+
discussionRef: exactEntityReferenceSchema.optional(),
|
|
138
|
+
executionPlan: executionPlanSchema.optional()
|
|
139
|
+
}).strict(), [{
|
|
140
|
+
field: "status",
|
|
141
|
+
in: ["ready", "decided"],
|
|
142
|
+
alternatives: [["summary", "executionPlan"]],
|
|
143
|
+
items: {
|
|
144
|
+
field: "executionPlan",
|
|
145
|
+
key: "workItems",
|
|
146
|
+
required: ["estimate"],
|
|
147
|
+
conditional: { field: "review", equals: "required", required: ["reviewEstimate"] }
|
|
148
|
+
},
|
|
149
|
+
message: "Ready proposals require a summary, an execution plan, and each required independent estimate."
|
|
150
|
+
}]);
|
|
151
|
+
const estimateAssignmentRefSchema = exactEntityReferenceSchema.innerType().pick({ store: true, model: true, id: true, revision: true }).extend({
|
|
152
|
+
store: z.literal("postgresql"),
|
|
153
|
+
model: z.literal("assignment-attempt"),
|
|
154
|
+
revision: z.number().int().positive()
|
|
155
|
+
}).strict();
|
|
156
|
+
const contributionEstimateSchema = estimateSchema.innerType().extend({ rationale: nonEmpty }).refine(
|
|
157
|
+
(value) => estimateSchema.safeParse(value).success,
|
|
158
|
+
{ message: "Contribution estimates must satisfy the shared bounded estimate contract." }
|
|
159
|
+
);
|
|
160
|
+
const contributionWorkItemSchema = conditionalFields(executionPlanWorkItemSchema.innerType().innerType().omit({ agentClass: true }).extend({
|
|
161
|
+
estimateRef: estimateAssignmentRefSchema,
|
|
162
|
+
estimate: contributionEstimateSchema,
|
|
163
|
+
reviewEstimate: contributionEstimateSchema.optional()
|
|
164
|
+
}), [
|
|
165
|
+
{
|
|
166
|
+
field: "review",
|
|
167
|
+
equals: "required",
|
|
168
|
+
alternatives: [["maximumReviewCycles", "reviewEstimate"]],
|
|
169
|
+
message: "Reviewed contributions require bounded cycles and their author\u2019s own review estimate."
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
field: "review",
|
|
173
|
+
equals: "none",
|
|
174
|
+
forbidden: { fields: ["reviewEstimate", "maximumReviewCycles"] },
|
|
175
|
+
message: "Unreviewed work cannot define review estimates or cycles."
|
|
176
|
+
}
|
|
177
|
+
]).superRefine(validateWorkItemWorkspace);
|
|
178
|
+
const contributionExecutionPlanSchema = executionPlanSchema.innerType().extend({
|
|
179
|
+
workItems: z.array(contributionWorkItemSchema).min(1)
|
|
180
|
+
}).superRefine(validateWorkItemDependencies);
|
|
181
|
+
const contributionProposalSchema = conditionalFields(proposalSchema.innerType().extend({
|
|
182
|
+
schemaVersion: z.literal("treeseed.proposal/v2"),
|
|
183
|
+
groupIds: unique(z.array(identifier).min(1)),
|
|
184
|
+
executionPlan: contributionExecutionPlanSchema.optional()
|
|
185
|
+
}), [{
|
|
186
|
+
field: "status",
|
|
187
|
+
in: ["ready", "decided"],
|
|
188
|
+
alternatives: [["summary", "executionPlan"]],
|
|
189
|
+
message: "Ready proposals require the contribution plan from every subscribed participant."
|
|
190
|
+
}]);
|
|
51
191
|
const schemas = {
|
|
52
192
|
page: z.object({
|
|
53
193
|
title: nonEmpty,
|
|
@@ -60,81 +200,140 @@ const schemas = {
|
|
|
60
200
|
summary: nonEmpty.optional(),
|
|
61
201
|
updated_at: date.optional()
|
|
62
202
|
}),
|
|
63
|
-
note: z.object({
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
203
|
+
note: conditionalFields(z.object({
|
|
204
|
+
schemaVersion: z.literal("treeseed.note/v1"),
|
|
205
|
+
id: identifier,
|
|
206
|
+
projectId: identifier,
|
|
207
|
+
classification: z.enum(["general", "feedback", "research", "workday-report"]),
|
|
208
|
+
subjectRefs: unique(exactRefs.min(1)),
|
|
209
|
+
body: nonEmpty,
|
|
210
|
+
createdAt: z.string().datetime({ offset: true }),
|
|
211
|
+
links: z.array(exactDependencyLinkSchema).optional()
|
|
212
|
+
}).strict(), [{
|
|
213
|
+
field: "classification",
|
|
214
|
+
equals: "workday-report",
|
|
215
|
+
contains: { field: "subjectRefs", properties: { store: "postgresql", model: "workday" } },
|
|
216
|
+
path: ["subjectRefs"],
|
|
217
|
+
message: "Workday reports must reference their exact workday."
|
|
218
|
+
}]),
|
|
219
|
+
question: conditionalFields(z.object({
|
|
220
|
+
schemaVersion: z.literal("treeseed.question/v1"),
|
|
221
|
+
id: identifier,
|
|
222
|
+
projectId: identifier,
|
|
223
|
+
subjectRef: exactEntityReferenceSchema,
|
|
224
|
+
question: nonEmpty,
|
|
225
|
+
status: z.enum(["open", "answered", "withdrawn"]),
|
|
226
|
+
addressedTo: unique(z.array(agentClass)).optional(),
|
|
227
|
+
answer: nonEmpty.optional(),
|
|
228
|
+
answerRefs: unique(exactRefs).optional(),
|
|
229
|
+
askedAt: z.string().datetime({ offset: true }),
|
|
230
|
+
answeredAt: z.string().datetime({ offset: true }).optional()
|
|
231
|
+
}).strict(), [{
|
|
232
|
+
field: "status",
|
|
233
|
+
equals: "answered",
|
|
234
|
+
alternatives: [["answer"], ["answerRefs"]],
|
|
235
|
+
message: "Answered questions require an answer or exact answer reference."
|
|
236
|
+
}]),
|
|
80
237
|
objective: z.object({
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
238
|
+
schemaVersion: z.literal("treeseed.objective/v1"),
|
|
239
|
+
id: identifier,
|
|
240
|
+
projectId: identifier,
|
|
241
|
+
title: nonEmpty,
|
|
242
|
+
outcome: nonEmpty,
|
|
243
|
+
status: z.enum(["active", "achieved", "abandoned"]),
|
|
244
|
+
evidenceRefs: unique(exactRefs).optional()
|
|
245
|
+
}).strict(),
|
|
246
|
+
proposal: z.union([contributionProposalSchema, proposalSchema]),
|
|
247
|
+
decision: conditionalFields(z.object({
|
|
248
|
+
schemaVersion: z.literal("treeseed.decision/v1"),
|
|
249
|
+
id: identifier,
|
|
250
|
+
projectId: identifier,
|
|
251
|
+
decisionClass: z.enum(["proposal", "work-review", "publication"]),
|
|
252
|
+
decisionMethod: z.enum(["authority", "approval", "vote"]),
|
|
253
|
+
subjectRef: exactEntityReferenceSchema,
|
|
254
|
+
disposition: z.enum(["approved", "rejected", "request-changes", "deferred", "superseded"]),
|
|
255
|
+
rationale: nonEmpty,
|
|
256
|
+
findingRefs: unique(exactRefs).optional(),
|
|
257
|
+
authorityRefs: unique(exactRefs.min(1)),
|
|
258
|
+
decidedByRefs: unique(exactRefs.min(1)),
|
|
259
|
+
positions: z.array(z.object({ actorRef: exactEntityReferenceSchema, position: z.enum(["approve", "reject", "abstain"]), rationale: z.string().optional(), recordedAt: z.string().datetime({ offset: true }) }).strict()).min(1).optional(),
|
|
260
|
+
decidedAt: z.string().datetime({ offset: true })
|
|
261
|
+
}).strict(), [
|
|
262
|
+
{ field: "decisionMethod", in: ["approval", "vote"], alternatives: [["positions"]], path: ["positions"], message: "Approval and vote decisions require signed positions." },
|
|
263
|
+
{
|
|
264
|
+
field: "decisionClass",
|
|
265
|
+
equals: "work-review",
|
|
266
|
+
allowed: { field: "disposition", values: ["approved", "request-changes"] },
|
|
267
|
+
path: ["disposition"],
|
|
268
|
+
message: "Work review must approve or request changes."
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
field: "decisionClass",
|
|
272
|
+
equals: "proposal",
|
|
273
|
+
allowed: { field: "disposition", values: ["approved", "rejected", "deferred", "superseded"] },
|
|
274
|
+
path: ["disposition"],
|
|
275
|
+
message: "Only work review may request changes."
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
field: "decisionClass",
|
|
279
|
+
equals: "publication",
|
|
280
|
+
allowed: { field: "disposition", values: ["approved", "rejected", "deferred", "superseded"] },
|
|
281
|
+
path: ["disposition"],
|
|
282
|
+
message: "Only work review may request changes."
|
|
283
|
+
}
|
|
284
|
+
]),
|
|
111
285
|
book: z.object({
|
|
112
286
|
schemaVersion: z.literal(BOOK_SCHEMA_VERSION),
|
|
113
|
-
id:
|
|
287
|
+
id: identifier,
|
|
288
|
+
projectId: identifier,
|
|
289
|
+
revision: z.number().int().positive(),
|
|
114
290
|
order: z.number().int().nonnegative(),
|
|
115
|
-
slug
|
|
291
|
+
slug,
|
|
116
292
|
title: nonEmpty,
|
|
117
293
|
description: nonEmpty.optional(),
|
|
118
294
|
summary: nonEmpty,
|
|
119
295
|
status: z.enum(KNOWLEDGE_STATUSES),
|
|
120
296
|
visibility: z.enum(KNOWLEDGE_VISIBILITIES),
|
|
121
|
-
groupIds:
|
|
122
|
-
audience:
|
|
123
|
-
relatedBookIds:
|
|
124
|
-
|
|
297
|
+
groupIds: identifiers.optional(),
|
|
298
|
+
audience: z.array(nonEmpty).optional(),
|
|
299
|
+
relatedBookIds: identifiers.optional(),
|
|
300
|
+
packPolicy: z.enum(["allowed", "restricted", "disabled"]).optional(),
|
|
301
|
+
editorialCoreNoteId: identifier.optional(),
|
|
302
|
+
cover: z.object({ image: nonEmpty.optional(), alt: nonEmpty.optional() }).strict().optional()
|
|
303
|
+
}).strict(),
|
|
125
304
|
knowledge: z.object({
|
|
126
305
|
schemaVersion: z.literal(KNOWLEDGE_PAGE_SCHEMA_VERSION),
|
|
127
|
-
id:
|
|
128
|
-
|
|
129
|
-
|
|
306
|
+
id: identifier,
|
|
307
|
+
projectId: identifier,
|
|
308
|
+
bookRef: exactEntityReferenceSchema.refine((ref) => ref.store === "treedx" && ref.model === "book" && Boolean(ref.revision && ref.digest && ref.path), "Knowledge requires an exact Book path, revision, and digest."),
|
|
309
|
+
slug,
|
|
310
|
+
body: nonEmpty,
|
|
130
311
|
title: nonEmpty,
|
|
131
312
|
description: nonEmpty.optional(),
|
|
132
|
-
summary: nonEmpty,
|
|
313
|
+
summary: nonEmpty.optional(),
|
|
133
314
|
status: z.enum(KNOWLEDGE_STATUSES),
|
|
134
315
|
visibility: z.enum(KNOWLEDGE_VISIBILITIES),
|
|
135
316
|
order: z.number().int().nonnegative().optional(),
|
|
136
|
-
groupIds:
|
|
137
|
-
|
|
317
|
+
groupIds: identifiers.optional(),
|
|
318
|
+
parentId: identifier.optional(),
|
|
319
|
+
contributors: identifiers.optional(),
|
|
320
|
+
relatedBookIds: identifiers.optional(),
|
|
321
|
+
relatedKnowledgeIds: identifiers.optional(),
|
|
322
|
+
relatedNoteIds: identifiers.optional(),
|
|
323
|
+
relatedQuestionIds: identifiers.optional(),
|
|
324
|
+
relatedObjectiveIds: identifiers.optional(),
|
|
325
|
+
relatedProposalIds: identifiers.optional(),
|
|
326
|
+
relatedDecisionIds: identifiers.optional(),
|
|
327
|
+
guaranteeIds: identifiers.optional(),
|
|
328
|
+
audiences: z.object({ primary: z.array(nonEmpty).optional(), secondary: z.array(nonEmpty).optional(), excluded: z.array(nonEmpty).optional() }).strict().optional(),
|
|
329
|
+
relatedRefs: unique(exactRefs).optional(),
|
|
330
|
+
capabilityIds: identifiers.optional(),
|
|
331
|
+
routePatterns: z.array(nonEmpty).optional(),
|
|
332
|
+
resourceTypes: identifiers.optional(),
|
|
333
|
+
actionIds: identifiers.optional(),
|
|
334
|
+
keywords: z.array(nonEmpty).optional(),
|
|
335
|
+
documentationUrls: z.array(nonEmpty).optional()
|
|
336
|
+
}).strict(),
|
|
138
337
|
person: z.object({
|
|
139
338
|
name: nonEmpty,
|
|
140
339
|
description: nonEmpty.optional(),
|
|
@@ -148,36 +347,47 @@ const schemas = {
|
|
|
148
347
|
}),
|
|
149
348
|
agent: agentDefinitionSchema,
|
|
150
349
|
discussion: z.object({
|
|
350
|
+
schemaVersion: z.literal("treeseed.discussion/v1"),
|
|
351
|
+
id: identifier,
|
|
352
|
+
projectId: identifier,
|
|
353
|
+
subjectRef: exactEntityReferenceSchema,
|
|
354
|
+
status: z.enum(["open", "resolved", "closed"]),
|
|
355
|
+
participantClasses: unique(z.array(agentClass)),
|
|
151
356
|
title: nonEmpty,
|
|
357
|
+
teamId: identifier,
|
|
358
|
+
createdAt: z.string().datetime({ offset: true }),
|
|
152
359
|
topic: nonEmpty.optional(),
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
legacy_status: z.enum(["open", "resolved"]).optional(),
|
|
161
|
-
created_at: date.optional(),
|
|
162
|
-
updated_at: date.optional()
|
|
163
|
-
}),
|
|
360
|
+
visibility: z.enum(KNOWLEDGE_VISIBILITIES).optional(),
|
|
361
|
+
participantIds: identifiers.optional(),
|
|
362
|
+
agentIds: identifiers.optional(),
|
|
363
|
+
groupIds: identifiers.optional(),
|
|
364
|
+
parentWorkdayId: identifier.optional(),
|
|
365
|
+
updatedAt: z.string().datetime({ offset: true }).optional()
|
|
366
|
+
}).strict(),
|
|
164
367
|
discussion_message: z.object({
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
368
|
+
schemaVersion: z.literal("treeseed.discussion-message/v1"),
|
|
369
|
+
id: identifier,
|
|
370
|
+
discussionRef: exactEntityReferenceSchema,
|
|
371
|
+
authorRef: exactEntityReferenceSchema,
|
|
372
|
+
body: nonEmpty,
|
|
373
|
+
createdAt: z.string().datetime({ offset: true }),
|
|
374
|
+
replyToRef: exactEntityReferenceSchema.optional(),
|
|
375
|
+
title: nonEmpty.optional(),
|
|
376
|
+
discussionId: identifier.optional(),
|
|
377
|
+
authorId: identifier.optional(),
|
|
378
|
+
authorType: z.enum(["user", "agent", "system"]).optional(),
|
|
169
379
|
intent: z.enum(["discuss", "propose"]).optional(),
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}),
|
|
380
|
+
mentionedAgents: identifiers.optional(),
|
|
381
|
+
recipientIds: identifiers.optional(),
|
|
382
|
+
fileRefs: z.array(z.record(z.unknown())).optional(),
|
|
383
|
+
contextRefs: z.array(z.record(z.unknown())).optional(),
|
|
384
|
+
inboxIntent: z.enum(["comment", "answer", "reply"]).optional(),
|
|
385
|
+
sourceMessageRefs: unique(exactRefs).optional(),
|
|
386
|
+
authorAgentId: identifier.optional(),
|
|
387
|
+
handoffId: identifier.optional(),
|
|
388
|
+
parentWorkdayId: identifier.optional(),
|
|
389
|
+
resultingOperationId: identifier.optional()
|
|
390
|
+
}).strict(),
|
|
181
391
|
discussion_event: z.object({
|
|
182
392
|
title: nonEmpty,
|
|
183
393
|
discussion_id: nonEmpty.optional(),
|
|
@@ -227,21 +437,35 @@ function validateContentFrontmatter(model, value) {
|
|
|
227
437
|
}))
|
|
228
438
|
};
|
|
229
439
|
}
|
|
230
|
-
function describeContentFrontmatterSchema(model) {
|
|
231
|
-
return schemas[model];
|
|
440
|
+
function describeContentFrontmatterSchema(model, schemaVersion) {
|
|
441
|
+
if (model !== "proposal") return schemas[model];
|
|
442
|
+
if (schemaVersion === "treeseed.proposal/v1") return proposalSchema;
|
|
443
|
+
if (schemaVersion !== void 0 && schemaVersion !== "treeseed.proposal/v2") throw new Error("proposal_schema_version_unsupported");
|
|
444
|
+
return contributionProposalSchema;
|
|
232
445
|
}
|
|
233
446
|
function fieldContract(schema) {
|
|
234
447
|
let current = schema;
|
|
235
448
|
let required = true;
|
|
236
|
-
|
|
237
|
-
required = false;
|
|
238
|
-
current = current.unwrap();
|
|
449
|
+
while (current instanceof z.ZodOptional || current instanceof z.ZodNullable || current instanceof z.ZodDefault || current instanceof z.ZodEffects) {
|
|
450
|
+
if (current instanceof z.ZodOptional || current instanceof z.ZodDefault) required = false;
|
|
451
|
+
current = current instanceof z.ZodEffects ? current.innerType() : current instanceof z.ZodDefault ? current.removeDefault() : current.unwrap();
|
|
239
452
|
}
|
|
240
|
-
if (current instanceof z.ZodNullable) current = current.unwrap();
|
|
241
453
|
const contract = { required };
|
|
242
454
|
if (current instanceof z.ZodEnum) return { ...contract, type: "string", values: current.options };
|
|
243
455
|
if (current instanceof z.ZodLiteral) return { ...contract, type: typeof current.value, value: current.value };
|
|
244
|
-
if (current instanceof z.ZodString)
|
|
456
|
+
if (current instanceof z.ZodString) {
|
|
457
|
+
const checks = current._def.checks;
|
|
458
|
+
const minimum = checks.find((check) => check.kind === "min")?.value;
|
|
459
|
+
const maximum = checks.find((check) => check.kind === "max")?.value;
|
|
460
|
+
const pattern = checks.find((check) => check.kind === "regex")?.regex?.source;
|
|
461
|
+
return {
|
|
462
|
+
...contract,
|
|
463
|
+
type: "string",
|
|
464
|
+
...minimum !== void 0 ? { minLength: minimum } : {},
|
|
465
|
+
...maximum !== void 0 ? { maxLength: maximum } : {},
|
|
466
|
+
...pattern ? { pattern } : {}
|
|
467
|
+
};
|
|
468
|
+
}
|
|
245
469
|
if (current instanceof z.ZodNumber) return { ...contract, type: "number" };
|
|
246
470
|
if (current instanceof z.ZodBoolean) return { ...contract, type: "boolean" };
|
|
247
471
|
if (current instanceof z.ZodDate) return { ...contract, type: "date" };
|
|
@@ -253,17 +477,45 @@ function fieldContract(schema) {
|
|
|
253
477
|
};
|
|
254
478
|
return { ...contract, type: current._def.typeName ?? "unknown" };
|
|
255
479
|
}
|
|
256
|
-
function describeContentFrontmatterContract(model) {
|
|
257
|
-
const
|
|
480
|
+
function describeContentFrontmatterContract(model, schemaVersion) {
|
|
481
|
+
const selected = describeContentFrontmatterSchema(model, schemaVersion);
|
|
482
|
+
const schema = selected instanceof z.ZodEffects ? selected.innerType() : selected;
|
|
483
|
+
if (!(schema instanceof z.ZodObject)) throw new Error(`Content model ${model} is not an object schema.`);
|
|
258
484
|
return {
|
|
259
485
|
model,
|
|
260
486
|
fields: Object.fromEntries(Object.entries(schema.shape).map(([name, value]) => [name, fieldContract(value)]))
|
|
261
487
|
};
|
|
262
488
|
}
|
|
489
|
+
function contractJsonSchema(contract) {
|
|
490
|
+
const type = contract.type;
|
|
491
|
+
if (type === "object") {
|
|
492
|
+
const fields = contract.fields;
|
|
493
|
+
return {
|
|
494
|
+
type: "object",
|
|
495
|
+
additionalProperties: false,
|
|
496
|
+
properties: Object.fromEntries(Object.entries(fields).map(([name, field]) => {
|
|
497
|
+
const schema = contractJsonSchema(field);
|
|
498
|
+
return [name, field.required === true ? schema : { anyOf: [schema, { type: "null" }] }];
|
|
499
|
+
})),
|
|
500
|
+
required: Object.keys(fields)
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
if (type === "array") return { type: "array", items: contractJsonSchema(contract.items) };
|
|
504
|
+
if (contract.value !== void 0) return { type, const: contract.value };
|
|
505
|
+
if (Array.isArray(contract.values)) return { type, enum: contract.values };
|
|
506
|
+
if (type === "date") return { type: "string", format: "date-time" };
|
|
507
|
+
return Object.fromEntries(Object.entries(contract).filter(([name]) => !["required", "fields", "items"].includes(name)));
|
|
508
|
+
}
|
|
509
|
+
function describeContentFrontmatterJsonSchema(model, schemaVersion) {
|
|
510
|
+
const contract = describeContentFrontmatterContract(model, schemaVersion);
|
|
511
|
+
return contractJsonSchema({ required: true, type: "object", fields: contract.fields });
|
|
512
|
+
}
|
|
263
513
|
export {
|
|
264
514
|
agentTestContentSchema,
|
|
265
515
|
describeContentFrontmatterContract,
|
|
516
|
+
describeContentFrontmatterJsonSchema,
|
|
266
517
|
describeContentFrontmatterSchema,
|
|
518
|
+
exactDependencyLinkSchema,
|
|
267
519
|
isPortableContentModel,
|
|
268
520
|
templateProductContentSchema,
|
|
269
521
|
validateContentFrontmatter,
|