@treeseed/sdk 0.13.0-rc.13 → 0.13.0-rc.131
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 +282 -129
- 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 +864 -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 +1474 -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,22 +1,127 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { workdayActivitySelectionSchema } from "../agent-capacity/workday.js";
|
|
2
|
+
import { workdayAllocationOverridesSchema } from "../agent-capacity/contracts/capacity/workdays/workday-allocation.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { leaseSchema } from "../agent-capacity/contracts/capacity/assignments/agent-execution.js";
|
|
5
|
+
import { alternativeProperties, conditionalFields, exclusiveProperties, exclusiveUnion, preserveInputOrder, uniqueArray } from "../content/validation/schema-constraints.js";
|
|
6
|
+
import { normalizeWorkdayAgentSelection } from "../agent-capacity/workday.js";
|
|
7
|
+
const identifier = leaseSchema.shape.id, timestamp = leaseSchema.shape.acquiredAt;
|
|
8
|
+
const selectedIdentities = uniqueArray(z.array(identifier).min(1).max(64));
|
|
9
|
+
const intentAgentSelectionSchema = alternativeProperties(workdayActivitySelectionSchema.extend({
|
|
10
|
+
activityTypes: workdayActivitySelectionSchema.shape.activityTypes.unwrap().min(1).optional()
|
|
11
|
+
}), ["activityTypes"]);
|
|
12
|
+
const workdayIntentFields = z.object({
|
|
13
|
+
schemaVersion: z.literal("treeseed.workday-intent/v1"),
|
|
14
|
+
teamId: identifier,
|
|
15
|
+
profileId: identifier,
|
|
16
|
+
projects: exclusiveUnion(z.union([z.literal("all"), uniqueArray(z.array(identifier).min(1))])),
|
|
17
|
+
executionMode: z.enum(["simulation", "production"]).default("simulation").optional(),
|
|
18
|
+
startsAt: timestamp,
|
|
19
|
+
endsAt: timestamp.optional(),
|
|
20
|
+
durationSeconds: z.number().int().positive().optional(),
|
|
21
|
+
planningOnly: z.boolean().optional(),
|
|
22
|
+
objectiveFilters: z.array(identifier).optional(),
|
|
23
|
+
proposalIds: selectedIdentities.optional(),
|
|
24
|
+
decisionIds: selectedIdentities.optional(),
|
|
25
|
+
groupIds: selectedIdentities.optional(),
|
|
26
|
+
continueFromWorkdayId: z.string().min(1).max(128).regex(/\S/u).optional(),
|
|
27
|
+
allocation: workdayAllocationOverridesSchema.optional(),
|
|
28
|
+
agentSelection: intentAgentSelectionSchema.optional(),
|
|
29
|
+
operatorConstraints: z.object({ providerIds: uniqueArray(z.array(identifier)).optional(), maxConcurrency: z.number().int().positive().optional() }).strict().optional()
|
|
30
|
+
}).strict();
|
|
31
|
+
const workdayScopeRules = [
|
|
32
|
+
{
|
|
33
|
+
field: "projects",
|
|
34
|
+
alternatives: [["groupIds"], ["proposalIds"], ["decisionIds"]],
|
|
35
|
+
path: ["groupIds"],
|
|
36
|
+
message: "Select shared groups or exact proposals or decisions whose groups supply participants."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
field: "continueFromWorkdayId",
|
|
40
|
+
alternatives: [["decisionIds"]],
|
|
41
|
+
forbidden: { fields: ["proposalIds"], conditions: [{ field: "planningOnly", equals: true }] },
|
|
42
|
+
path: ["continueFromWorkdayId"],
|
|
43
|
+
message: "Continuation requires exact decisions, not new proposal planning."
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
const workdayIntentSchema = exclusiveProperties(conditionalFields(workdayIntentFields, workdayScopeRules), ["endsAt", "durationSeconds"]);
|
|
47
|
+
const requestIntentFields = z.preprocess(
|
|
48
|
+
portableIntentInput,
|
|
49
|
+
exclusiveProperties(conditionalFields(workdayIntentFields.partial({ schemaVersion: true, teamId: true }), workdayScopeRules), ["endsAt", "durationSeconds"])
|
|
50
|
+
).superRefine((intent, context) => {
|
|
51
|
+
if (!validIntentRange(intent)) context.addIssue({ code: z.ZodIssueCode.custom, path: ["endsAt"], message: "endsAt must be after startsAt." });
|
|
52
|
+
});
|
|
53
|
+
const workdayIntentRequestSchema = preserveInputOrder(requestIntentFields, (intent) => normalizeWorkdayIntent(intent, "request"));
|
|
54
|
+
function validIntentRange(intent) {
|
|
55
|
+
return intent.endsAt === void 0 || Date.parse(intent.endsAt) > Date.parse(intent.startsAt);
|
|
56
|
+
}
|
|
57
|
+
function portableIntentInput(value) {
|
|
58
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return value;
|
|
59
|
+
const intent = Object.fromEntries(Object.getOwnPropertyNames(value).map((key) => [key, Reflect.get(value, key)]));
|
|
60
|
+
return { ...intent, ...Array.isArray(intent.decisionIds) ? { decisionIds: intent.decisionIds.map((value2) => typeof value2 === "string" ? value2.trim() : value2) } : {} };
|
|
61
|
+
}
|
|
2
62
|
function validateWorkdayIntent(intent) {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
63
|
+
const result = workdayIntentSchema.safeParse(portableIntentInput(intent));
|
|
64
|
+
const codes = {
|
|
65
|
+
schemaVersion: "schema_version_invalid",
|
|
66
|
+
teamId: "team_required",
|
|
67
|
+
profileId: "profile_required",
|
|
68
|
+
projects: "project_selection_invalid",
|
|
69
|
+
operatorConstraints: "operator_constraints_invalid",
|
|
70
|
+
executionMode: "execution_mode_invalid",
|
|
71
|
+
startsAt: "start_invalid",
|
|
72
|
+
endsAt: "end_invalid",
|
|
73
|
+
durationSeconds: "duration_invalid",
|
|
74
|
+
planningOnly: "planning_only_invalid",
|
|
75
|
+
objectiveFilters: "objective_selection_invalid",
|
|
76
|
+
proposalIds: "proposal_selection_invalid",
|
|
77
|
+
decisionIds: "decision_selection_invalid",
|
|
78
|
+
groupIds: "group_selection_invalid",
|
|
79
|
+
continueFromWorkdayId: "continuation_invalid",
|
|
80
|
+
agentSelection: "agent_selection_invalid",
|
|
81
|
+
allocation: "allocation_invalid"
|
|
82
|
+
};
|
|
83
|
+
const diagnostics = result.success ? [] : result.error.issues.flatMap((issue) => {
|
|
84
|
+
if (issue.code === z.ZodIssueCode.unrecognized_keys && !issue.path.length)
|
|
85
|
+
return issue.keys.map((key) => ({ code: "field_forbidden", path: key, message: "Derived execution state is not portable workday intent." }));
|
|
86
|
+
const root = String(issue.path[0] ?? "");
|
|
87
|
+
return [{
|
|
88
|
+
code: root === "endsAt" && intent.durationSeconds !== void 0 && intent.endsAt !== void 0 ? "time_range_ambiguous" : codes[root] ?? "intent_invalid",
|
|
89
|
+
path: root === "allocation" || root === "agentSelection" ? issue.path.join(".") : root,
|
|
90
|
+
message: issue.message
|
|
91
|
+
}];
|
|
92
|
+
});
|
|
93
|
+
if (!validIntentRange(intent))
|
|
94
|
+
diagnostics.push({ code: "end_invalid", path: "endsAt", message: "endsAt must be after startsAt." });
|
|
12
95
|
return diagnostics;
|
|
13
96
|
}
|
|
97
|
+
function normalizeWorkdayIntent(input, shape) {
|
|
98
|
+
if (shape === "request") {
|
|
99
|
+
const normalized2 = requestIntentFields.parse(input);
|
|
100
|
+
return { ...normalized2, ...normalized2.decisionIds ? { decisionIds: [...normalized2.decisionIds].sort() } : {} };
|
|
101
|
+
}
|
|
102
|
+
const intent = input;
|
|
103
|
+
const diagnostics = validateWorkdayIntent(intent);
|
|
104
|
+
if (diagnostics.length) throw new Error(`Invalid workday intent: ${diagnostics.map((value) => `${value.path}: ${value.message}`).join("; ")}`);
|
|
105
|
+
const normalized = workdayIntentSchema.parse(portableIntentInput(intent));
|
|
106
|
+
return { ...intent, ...normalized, ...normalized.decisionIds ? { decisionIds: [...normalized.decisionIds].sort() } : {} };
|
|
107
|
+
}
|
|
108
|
+
function validateWorkdayIntentSelection(value) {
|
|
109
|
+
const input = value && typeof value === "object" && !Array.isArray(value) ? Object.fromEntries(
|
|
110
|
+
Object.entries(value).map(([key, entries]) => [key, Array.isArray(entries) ? entries.map((entry) => typeof entry === "string" ? entry.trim() : entry) : entries])
|
|
111
|
+
) : value;
|
|
112
|
+
const result = intentAgentSelectionSchema.safeParse(input);
|
|
113
|
+
return result.success ? [] : result.error.issues.map((issue) => ({
|
|
114
|
+
code: "agent_selection_invalid",
|
|
115
|
+
path: ["agentSelection", ...issue.path].join("."),
|
|
116
|
+
message: issue.message
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
14
119
|
function validateSelectedDemand(demand) {
|
|
15
120
|
const diagnostics = [];
|
|
16
121
|
if (demand.requestedSeconds <= 0 || !Number.isInteger(demand.requestedSeconds)) diagnostics.push({ code: "requested_seconds_invalid", path: "requestedSeconds", message: "Demand duration must be a positive integer." });
|
|
17
|
-
if (demand.mode === "acting" && !demand.actingAuthority) diagnostics.push({ code: "acting_authority_required", path: "actingAuthority", message: "Acting demand requires
|
|
18
|
-
if (demand.mode === "acting" && demand.actingAuthority &&
|
|
19
|
-
if (demand.mode === "acting" && demand.actingAuthority && [demand.actingAuthority.
|
|
122
|
+
if (demand.mode === "acting" && !demand.actingAuthority) diagnostics.push({ code: "acting_authority_required", path: "actingAuthority", message: "Acting demand requires an exact accepted decision and living execution-node revision." });
|
|
123
|
+
if (demand.mode === "acting" && demand.actingAuthority && [demand.actingAuthority.decisionId, demand.actingAuthority.executionNodeId, demand.actingAuthority.sourceDigest].some((value) => typeof value !== "string" || !value.trim())) diagnostics.push({ code: "acting_authority_identity_missing", path: "actingAuthority", message: "Acting authority must bind non-empty decision, execution-node, and source identities." });
|
|
124
|
+
if (demand.mode === "acting" && demand.actingAuthority && [demand.actingAuthority.decisionRevision, demand.actingAuthority.executionNodeRevision, demand.actingAuthority.graphRevision].some((value) => !Number.isInteger(value) || value <= 0)) diagnostics.push({ code: "acting_authority_revision_invalid", path: "actingAuthority", message: "Acting authority must bind positive decision, node, and graph revisions." });
|
|
20
125
|
return diagnostics;
|
|
21
126
|
}
|
|
22
127
|
function validateWorkdayPreflight(receipt, now = /* @__PURE__ */ new Date()) {
|
|
@@ -31,8 +136,6 @@ function validateWorkdayPreflight(receipt, now = /* @__PURE__ */ new Date()) {
|
|
|
31
136
|
else if (expiry <= now.getTime()) diagnostics.push({ code: "preflight_expired", path: "expiresAt", message: "Workday preflight has expired and must be regenerated." });
|
|
32
137
|
if (!Number.isFinite(Date.parse(receipt.startsAt)) || !Number.isFinite(Date.parse(receipt.endsAt)) || Date.parse(receipt.endsAt) <= Date.parse(receipt.startsAt)) diagnostics.push({ code: "preflight_time_range_invalid", path: "endsAt", message: "Preflight must bind a valid time range." });
|
|
33
138
|
if (!Number.isInteger(receipt.maxConcurrency) || receipt.maxConcurrency <= 0) diagnostics.push({ code: "preflight_concurrency_invalid", path: "maxConcurrency", message: "Preflight concurrency must be a positive integer." });
|
|
34
|
-
if (!Number.isFinite(receipt.reserveSeconds) || receipt.reserveSeconds < 0) diagnostics.push({ code: "preflight_reserve_invalid", path: "reserveSeconds", message: "Preflight reserve seconds must be finite and non-negative." });
|
|
35
|
-
for (const [index, evidence] of receipt.borrowing.entries()) diagnostics.push(...validateWorkdayBorrowingEvidence(evidence).map((diagnostic) => ({ ...diagnostic, path: `borrowing.${index}.${diagnostic.path}` })));
|
|
36
139
|
if (new Set(receipt.selectedDemands.map((demand) => demand.id)).size !== receipt.selectedDemands.length) diagnostics.push({ code: "preflight_demand_duplicate", path: "selectedDemands", message: "Preflight demand identities must be unique." });
|
|
37
140
|
return diagnostics;
|
|
38
141
|
}
|
|
@@ -50,16 +153,20 @@ function validateWorkdaySettlement(settlement) {
|
|
|
50
153
|
for (const [field, value] of Object.entries(accounting).filter(([field2]) => field2 !== "classSlug")) {
|
|
51
154
|
if (!Number.isFinite(value) || value < 0) diagnostics.push({ code: "settlement_accounting_invalid", path: `classAccounting.${index}.${field}`, message: "Settlement seconds must be finite and non-negative." });
|
|
52
155
|
}
|
|
53
|
-
if (accounting.lentSeconds > accounting.allocatedSeconds + accounting.borrowedSeconds) diagnostics.push({ code: "settlement_lending_invalid", path: `classAccounting.${index}.lentSeconds`, message: "A class cannot lend more capacity than it held." });
|
|
54
156
|
}
|
|
55
157
|
if (!settlement.preflightDigest.trim() || !settlement.settlementDigest.trim()) diagnostics.push({ code: "settlement_digest_required", path: "settlementDigest", message: "Settlement must bind its preflight and final accounting digests." });
|
|
56
158
|
if (!Number.isFinite(Date.parse(settlement.startedAt)) || !Number.isFinite(Date.parse(settlement.completedAt)) || Date.parse(settlement.completedAt) < Date.parse(settlement.startedAt)) diagnostics.push({ code: "settlement_time_range_invalid", path: "completedAt", message: "Settlement must bind a valid completion time at or after workday start." });
|
|
57
159
|
return diagnostics;
|
|
58
160
|
}
|
|
59
161
|
export {
|
|
162
|
+
normalizeWorkdayAgentSelection,
|
|
163
|
+
normalizeWorkdayIntent,
|
|
60
164
|
validateSelectedDemand,
|
|
61
165
|
validateWorkdayIntent,
|
|
166
|
+
validateWorkdayIntentSelection,
|
|
62
167
|
validateWorkdayPreflight,
|
|
63
168
|
validateWorkdayPreflightFreshness,
|
|
64
|
-
validateWorkdaySettlement
|
|
169
|
+
validateWorkdaySettlement,
|
|
170
|
+
workdayIntentRequestSchema,
|
|
171
|
+
workdayIntentSchema
|
|
65
172
|
};
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { describeContentFrontmatterSchema } from "../content/validation/content-model-schemas.js";
|
|
2
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { exportSchemaConstraints } from "../content/validation/schema-constraints.js";
|
|
5
|
+
import {
|
|
6
|
+
assignmentAttemptSchema,
|
|
7
|
+
assignmentContextSchema,
|
|
8
|
+
assignmentResultSchema,
|
|
9
|
+
usageSettlementSchema,
|
|
10
|
+
leaseSchema,
|
|
11
|
+
reservationSchema,
|
|
12
|
+
exactEntityReferenceSchema,
|
|
13
|
+
exactGrantSchema,
|
|
14
|
+
assignmentWorkspaceSchema,
|
|
15
|
+
estimateSchema
|
|
16
|
+
} from "../agent-capacity/contracts/capacity/assignments/agent-execution.js";
|
|
17
|
+
import {
|
|
18
|
+
assignmentReferenceSchema,
|
|
19
|
+
effectiveActivityProfileSchema,
|
|
20
|
+
authorizedContextItemSchema,
|
|
21
|
+
verificationRecordSchema,
|
|
22
|
+
usageSchema,
|
|
23
|
+
diagnosticSchema,
|
|
24
|
+
assignmentTimingAwarenessReceiptSchema
|
|
25
|
+
} from "../agent-capacity/contracts/capacity/assignments/agent-execution.js";
|
|
26
|
+
import {
|
|
27
|
+
executionNodeSchema,
|
|
28
|
+
executionEdgeSchema,
|
|
29
|
+
graphRevisionSchema,
|
|
30
|
+
graphChangeSetSchema,
|
|
31
|
+
conditionDefinitionSchema
|
|
32
|
+
} from "../agent-capacity/validation/execution/execution-graph.js";
|
|
33
|
+
import { appliedWorkdaySchema, workdayPolicySchema, workdayProfileSchema, weightMapSchema, projectWeightSchema, agentClassWeightSchema } from "../agent-capacity/contracts/capacity/workdays/workday-allocation.js";
|
|
34
|
+
import { activityProfileSchema, activityProfilesSchema } from "../agent-capacity/validation/agent-definition-schema.js";
|
|
35
|
+
import { providerOfferSchema, providerStateSchema, availabilityWindowSchema, nativeLimitSchema } from "../agent-capacity/contracts/capacity/providers/supply-policy.js";
|
|
36
|
+
import { treeDxWorkspaceSchema, treeDxWorkspaceReviewSchema, treeDxPublicationReceiptSchema } from "../treedx/types.js";
|
|
37
|
+
import { teamRecordSchema, projectRecordSchema, repositoryBindingSchema, treeDxBindingSchema } from "./schemas.js";
|
|
38
|
+
import { agentRegistrationSchema } from "../agent-capacity/contracts/projects/agents/project-agent-class.js";
|
|
39
|
+
import { workdayIntentSchema } from "../operator-contracts/workday-lifecycle.js";
|
|
40
|
+
import { workdayScheduleSchema } from "../agent-capacity/contracts/capacity/workdays/workday-records.js";
|
|
41
|
+
const models = {
|
|
42
|
+
Book: "book",
|
|
43
|
+
Knowledge: "knowledge",
|
|
44
|
+
Objective: "objective",
|
|
45
|
+
Discussion: "discussion",
|
|
46
|
+
DiscussionMessage: "discussion_message",
|
|
47
|
+
AgentProfile: "agent",
|
|
48
|
+
Proposal: "proposal",
|
|
49
|
+
Question: "question",
|
|
50
|
+
Note: "note",
|
|
51
|
+
Decision: "decision"
|
|
52
|
+
};
|
|
53
|
+
const runtimeSchemas = {
|
|
54
|
+
WeightMap: weightMapSchema,
|
|
55
|
+
ProjectWeight: projectWeightSchema,
|
|
56
|
+
AgentClassWeight: agentClassWeightSchema,
|
|
57
|
+
WorkdayIntent: workdayIntentSchema,
|
|
58
|
+
RepositoryBinding: repositoryBindingSchema,
|
|
59
|
+
TreeDxBinding: treeDxBindingSchema,
|
|
60
|
+
AvailabilityWindow: availabilityWindowSchema,
|
|
61
|
+
NativeLimit: nativeLimitSchema,
|
|
62
|
+
AssignmentContext: assignmentContextSchema,
|
|
63
|
+
ExactEntityReference: exactEntityReferenceSchema,
|
|
64
|
+
ExactGrant: exactGrantSchema,
|
|
65
|
+
AssignmentWorkspace: assignmentWorkspaceSchema,
|
|
66
|
+
Estimate: estimateSchema,
|
|
67
|
+
AssignmentReference: assignmentReferenceSchema,
|
|
68
|
+
GitReference: assignmentReferenceSchema.options[0],
|
|
69
|
+
TreeDxReference: assignmentReferenceSchema.options[1],
|
|
70
|
+
UrlReference: assignmentReferenceSchema.options[2],
|
|
71
|
+
ReadOnlyWorkspace: assignmentWorkspaceSchema.options[0],
|
|
72
|
+
TreeDxAssignmentWorkspace: assignmentWorkspaceSchema.options[1],
|
|
73
|
+
GitAssignmentWorkspace: assignmentWorkspaceSchema.options[2],
|
|
74
|
+
EffectiveActivityProfile: effectiveActivityProfileSchema,
|
|
75
|
+
AuthorizedContextItem: authorizedContextItemSchema,
|
|
76
|
+
VerificationRecord: verificationRecordSchema,
|
|
77
|
+
Usage: usageSchema,
|
|
78
|
+
Diagnostic: diagnosticSchema,
|
|
79
|
+
AssignmentTimingAwarenessReceipt: assignmentTimingAwarenessReceiptSchema,
|
|
80
|
+
GraphChangeSet: graphChangeSetSchema,
|
|
81
|
+
ConditionDefinition: conditionDefinitionSchema,
|
|
82
|
+
WorkdayPolicyFields: workdayPolicySchema,
|
|
83
|
+
ActivityProfile: activityProfileSchema,
|
|
84
|
+
ActivityProfiles: activityProfilesSchema,
|
|
85
|
+
PlanningRound: appliedWorkdaySchema.innerType().shape.planningRounds.element,
|
|
86
|
+
AssignmentLimits: assignmentAttemptSchema.innerType().shape.limits,
|
|
87
|
+
ProviderOfferSelection: assignmentAttemptSchema.innerType().shape.provider
|
|
88
|
+
};
|
|
89
|
+
const schemas = {
|
|
90
|
+
Team: teamRecordSchema,
|
|
91
|
+
Project: projectRecordSchema,
|
|
92
|
+
AgentRegistration: agentRegistrationSchema,
|
|
93
|
+
WorkdaySchedule: workdayScheduleSchema,
|
|
94
|
+
...Object.fromEntries(Object.entries(models).map(([name, model]) => [name, describeContentFrontmatterSchema(model)])),
|
|
95
|
+
ProviderOffer: providerOfferSchema,
|
|
96
|
+
ProviderState: providerStateSchema,
|
|
97
|
+
TreeDxWorkspace: treeDxWorkspaceSchema,
|
|
98
|
+
TreeDxWorkspaceReview: treeDxWorkspaceReviewSchema,
|
|
99
|
+
TreeDxPublicationReceipt: treeDxPublicationReceiptSchema,
|
|
100
|
+
AssignmentAttempt: assignmentAttemptSchema,
|
|
101
|
+
AssignmentResult: assignmentResultSchema,
|
|
102
|
+
UsageSettlement: usageSettlementSchema,
|
|
103
|
+
Lease: leaseSchema,
|
|
104
|
+
Reservation: reservationSchema,
|
|
105
|
+
ExecutionNode: executionNodeSchema,
|
|
106
|
+
ExecutionEdge: executionEdgeSchema,
|
|
107
|
+
Workday: appliedWorkdaySchema,
|
|
108
|
+
GraphRevision: graphRevisionSchema,
|
|
109
|
+
WorkdayPolicy: workdayProfileSchema,
|
|
110
|
+
...runtimeSchemas
|
|
111
|
+
};
|
|
112
|
+
const runtimeOnly = new Set(Object.keys(runtimeSchemas));
|
|
113
|
+
function record(value) {
|
|
114
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
115
|
+
}
|
|
116
|
+
function dereference(schema, root, references) {
|
|
117
|
+
while (typeof schema.$ref === "string" && schema.$ref.startsWith("#/")) {
|
|
118
|
+
const reference = schema.$ref;
|
|
119
|
+
if (references.has(reference)) return schema;
|
|
120
|
+
references.add(reference);
|
|
121
|
+
const parts = reference.slice(2).split("/");
|
|
122
|
+
if (parts.some((part) => /~(?![01])/u.test(part))) return schema;
|
|
123
|
+
let selected = root;
|
|
124
|
+
for (const part of parts) {
|
|
125
|
+
const key = part.replace(/~1/gu, "/").replace(/~0/gu, "~");
|
|
126
|
+
if (!selected || typeof selected !== "object" || !Object.hasOwn(selected, key)) return schema;
|
|
127
|
+
selected = Object.getOwnPropertyDescriptor(selected, key)?.value;
|
|
128
|
+
}
|
|
129
|
+
if (selected === false) return false;
|
|
130
|
+
if (selected !== true && (!selected || typeof selected !== "object" || Array.isArray(selected))) return schema;
|
|
131
|
+
schema = { ...record(selected), ...Object.fromEntries(Object.entries(schema).filter(([key]) => key !== "$ref")) };
|
|
132
|
+
}
|
|
133
|
+
return schema;
|
|
134
|
+
}
|
|
135
|
+
function disjointTaggedBranches(value) {
|
|
136
|
+
if (!Array.isArray(value) || !value.length) return false;
|
|
137
|
+
const branches = value.map(record), first = branches[0];
|
|
138
|
+
if (branches.some((branch) => branch.type !== "object" || !Array.isArray(branch.required))) return false;
|
|
139
|
+
return first.required.some((field) => {
|
|
140
|
+
if (typeof field !== "string") return false;
|
|
141
|
+
const tags = [];
|
|
142
|
+
for (const branch of branches) {
|
|
143
|
+
if (!branch.required.includes(field)) return false;
|
|
144
|
+
const tag = record(record(branch.properties)[field]);
|
|
145
|
+
if (!Object.hasOwn(tag, "const")) return false;
|
|
146
|
+
const literal = tag.const;
|
|
147
|
+
if (literal !== null && typeof literal !== "string" && typeof literal !== "boolean" && !(typeof literal === "number" && Number.isFinite(literal))) return false;
|
|
148
|
+
tags.push(JSON.stringify(literal));
|
|
149
|
+
}
|
|
150
|
+
return new Set(tags).size === branches.length;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function finiteValuesImplyType(schema) {
|
|
154
|
+
const values = Object.hasOwn(schema, "const") ? [schema.const] : Array.isArray(schema.enum) ? schema.enum : [];
|
|
155
|
+
const types = Array.isArray(schema.type) ? schema.type : [schema.type];
|
|
156
|
+
return values.length > 0 && values.every((value) => types.some((type) => type === "null" ? value === null : type === "array" ? Array.isArray(value) : type === "object" ? value !== null && typeof value === "object" && !Array.isArray(value) : type === "integer" ? typeof value === "number" && Number.isInteger(value) : type === "number" ? typeof value === "number" && Number.isFinite(value) : typeof value === type));
|
|
157
|
+
}
|
|
158
|
+
function finiteValues(value) {
|
|
159
|
+
const schema = record(value), keys = Object.keys(schema);
|
|
160
|
+
if (keys.length !== 1) return void 0;
|
|
161
|
+
const values = keys[0] === "const" ? [schema.const] : keys[0] === "enum" && Array.isArray(schema.enum) ? schema.enum : schema.type === "null" ? [null] : void 0;
|
|
162
|
+
if (!values?.length || values.some((item) => item !== null && typeof item !== "string" && typeof item !== "boolean" && !(typeof item === "number" && Number.isFinite(item)))) return void 0;
|
|
163
|
+
return values;
|
|
164
|
+
}
|
|
165
|
+
function finiteSchema(values) {
|
|
166
|
+
const unique = [...new Map(values.map((value) => [JSON.stringify(value), value])).entries()].sort(([left], [right]) => left.localeCompare(right)).map(([, value]) => value);
|
|
167
|
+
return unique.length === 1 ? { const: unique[0] } : { enum: unique };
|
|
168
|
+
}
|
|
169
|
+
function structuralSchema(value, root, ancestors = /* @__PURE__ */ new Set(), inheritedObject = false, cache = /* @__PURE__ */ new WeakMap()) {
|
|
170
|
+
if (!value || typeof value !== "object") return structuralSchemaValue(value, root, ancestors, inheritedObject, cache);
|
|
171
|
+
const key = JSON.stringify([[...ancestors].sort(), inheritedObject]), entries = cache.get(value) ?? /* @__PURE__ */ new Map();
|
|
172
|
+
if (entries.has(key)) return entries.get(key);
|
|
173
|
+
const result = structuralSchemaValue(value, root, ancestors, inheritedObject, cache);
|
|
174
|
+
entries.set(key, result);
|
|
175
|
+
cache.set(value, entries);
|
|
176
|
+
return result;
|
|
177
|
+
}
|
|
178
|
+
function structuralSchemaValue(value, root, ancestors, inheritedObject, cache) {
|
|
179
|
+
if (typeof value === "boolean") return value ? {} : false;
|
|
180
|
+
const references = new Set(ancestors), schema = dereference(record(value), root, references);
|
|
181
|
+
if (schema === false) return false;
|
|
182
|
+
const normalized = {};
|
|
183
|
+
for (const key of [
|
|
184
|
+
"$ref",
|
|
185
|
+
"type",
|
|
186
|
+
"const",
|
|
187
|
+
"enum",
|
|
188
|
+
"minLength",
|
|
189
|
+
"maxLength",
|
|
190
|
+
"pattern",
|
|
191
|
+
"format",
|
|
192
|
+
"minimum",
|
|
193
|
+
"maximum",
|
|
194
|
+
"exclusiveMinimum",
|
|
195
|
+
"exclusiveMaximum",
|
|
196
|
+
"multipleOf",
|
|
197
|
+
"minItems",
|
|
198
|
+
"maxItems",
|
|
199
|
+
"minProperties",
|
|
200
|
+
"maxProperties",
|
|
201
|
+
"uniqueItems",
|
|
202
|
+
"minContains",
|
|
203
|
+
"maxContains"
|
|
204
|
+
]) {
|
|
205
|
+
if (schema[key] !== void 0) normalized[key] = schema[key];
|
|
206
|
+
}
|
|
207
|
+
const objectAuthority = inheritedObject || schema.type === "object";
|
|
208
|
+
if (inheritedObject && normalized.type === "object") delete normalized.type;
|
|
209
|
+
if (normalized.type === "integer" && schema.exclusiveMinimum === 0 && normalized.minimum === void 0) {
|
|
210
|
+
normalized.minimum = 1;
|
|
211
|
+
delete normalized.exclusiveMinimum;
|
|
212
|
+
}
|
|
213
|
+
if (!Object.hasOwn(normalized, "const") && Array.isArray(normalized.enum) && normalized.enum.length === 1) {
|
|
214
|
+
normalized.const = normalized.enum[0];
|
|
215
|
+
delete normalized.enum;
|
|
216
|
+
}
|
|
217
|
+
if (finiteValuesImplyType(normalized)) delete normalized.type;
|
|
218
|
+
for (const key of ["items", "contains", "not", "if", "then", "else", "propertyNames", "unevaluatedItems", "unevaluatedProperties"]) {
|
|
219
|
+
if (schema[key] !== void 0) normalized[key] = structuralSchema(
|
|
220
|
+
schema[key],
|
|
221
|
+
root,
|
|
222
|
+
references,
|
|
223
|
+
objectAuthority && ["not", "if", "then", "else"].includes(key),
|
|
224
|
+
cache
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
for (const key of ["allOf", "anyOf", "oneOf", "prefixItems"]) {
|
|
228
|
+
if (schema[key] !== void 0) normalized[key] = Array.isArray(schema[key]) ? schema[key].map((child) => structuralSchema(child, root, references, objectAuthority && key !== "prefixItems", cache)) : schema[key];
|
|
229
|
+
}
|
|
230
|
+
if (normalized.anyOf === void 0 && disjointTaggedBranches(normalized.oneOf)) {
|
|
231
|
+
normalized.anyOf = normalized.oneOf;
|
|
232
|
+
delete normalized.oneOf;
|
|
233
|
+
}
|
|
234
|
+
if (disjointTaggedBranches(normalized.anyOf)) normalized.anyOf = [...normalized.anyOf].sort((left, right) => JSON.stringify(left).localeCompare(JSON.stringify(right)));
|
|
235
|
+
for (const key of ["properties", "patternProperties", "dependentSchemas"]) {
|
|
236
|
+
if (schema[key] !== void 0) normalized[key] = Object.fromEntries(
|
|
237
|
+
Object.entries(record(schema[key])).sort(([left], [right]) => left.localeCompare(right)).map(([name, child]) => [name, structuralSchema(child, root, references, false, cache)])
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
if (schema.dependentRequired !== void 0) normalized.dependentRequired = Object.fromEntries(
|
|
241
|
+
Object.entries(record(schema.dependentRequired)).sort(([left], [right]) => left.localeCompare(right)).map(([key, child]) => [key, Array.isArray(child) ? [...child].sort() : child])
|
|
242
|
+
);
|
|
243
|
+
if (Array.isArray(schema.required)) normalized.required = [...schema.required].sort();
|
|
244
|
+
if (schema.additionalProperties === false) normalized.additionalProperties = false;
|
|
245
|
+
else if (schema.additionalProperties && Object.keys(record(schema.additionalProperties)).length) {
|
|
246
|
+
normalized.additionalProperties = structuralSchema(schema.additionalProperties, root, references, false, cache);
|
|
247
|
+
}
|
|
248
|
+
const finite = finiteValues(normalized);
|
|
249
|
+
if (finite) return finiteSchema(finite);
|
|
250
|
+
if (Object.keys(normalized).length === 1) {
|
|
251
|
+
const key = normalized.anyOf !== void 0 ? "anyOf" : "oneOf", union = normalized[key];
|
|
252
|
+
if (Array.isArray(union) && union.length) {
|
|
253
|
+
const branches = union.map(finiteValues);
|
|
254
|
+
if (branches.every((branch) => branch !== void 0)) {
|
|
255
|
+
const values = branches.flat();
|
|
256
|
+
if (key === "anyOf" || new Set(values.map((value2) => JSON.stringify(value2))).size === values.length) {
|
|
257
|
+
return finiteSchema(values);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return normalized;
|
|
263
|
+
}
|
|
264
|
+
function structuralDifferences(expected, actual, path = "") {
|
|
265
|
+
if (JSON.stringify(expected) === JSON.stringify(actual)) return [];
|
|
266
|
+
if (!expected || !actual || typeof expected !== "object" || typeof actual !== "object" || Array.isArray(expected) !== Array.isArray(actual)) return [
|
|
267
|
+
`${path || "<root>"}: declaration ${JSON.stringify(expected)}, executable ${JSON.stringify(actual)}`
|
|
268
|
+
];
|
|
269
|
+
const left = expected, right = actual;
|
|
270
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)])].sort().flatMap((key) => structuralDifferences(left[key], right[key], path ? `${path}.${key}` : key));
|
|
271
|
+
}
|
|
272
|
+
const executableStructures = new Map(Object.entries(schemas).map(([name, schema]) => {
|
|
273
|
+
const generated = record(zodToJsonSchema(schema, { name, $refStrategy: "none", postProcess: exportSchemaConstraints }));
|
|
274
|
+
let base = schema;
|
|
275
|
+
while (base instanceof z.ZodEffects) base = base.innerType();
|
|
276
|
+
const shape = base instanceof z.ZodObject ? base.shape : {};
|
|
277
|
+
const keys = Object.keys(shape).sort(), required = keys.filter((key) => !shape[key].isOptional());
|
|
278
|
+
return [name, {
|
|
279
|
+
object: base instanceof z.ZodObject,
|
|
280
|
+
shape,
|
|
281
|
+
keys,
|
|
282
|
+
required,
|
|
283
|
+
structure: JSON.stringify(structuralSchema(record(record(generated.definitions)[name]), generated))
|
|
284
|
+
}];
|
|
285
|
+
}));
|
|
286
|
+
function verifyAgentContentSchema(document, path = "docs/agent.schema.yml") {
|
|
287
|
+
const definitions = document?.$defs ?? {};
|
|
288
|
+
const diagnostics = [];
|
|
289
|
+
const structures = /* @__PURE__ */ new WeakMap();
|
|
290
|
+
for (const [name, value] of Object.entries(definitions)) if (!Object.keys(record(value)).length)
|
|
291
|
+
diagnostics.push({ code: "agent_schema_missing", path, message: `${name} definition is missing or unconstrained.` });
|
|
292
|
+
const union = record(document).oneOf;
|
|
293
|
+
if (!Array.isArray(union) || !union.length) diagnostics.push({
|
|
294
|
+
code: "agent_schema_root_missing",
|
|
295
|
+
path,
|
|
296
|
+
message: "The stored-record root must declare a nonempty oneOf union; a content-model subset is not complete authority."
|
|
297
|
+
});
|
|
298
|
+
else {
|
|
299
|
+
const seen = /* @__PURE__ */ new Set();
|
|
300
|
+
for (const entry of union) {
|
|
301
|
+
const reference = record(entry).$ref;
|
|
302
|
+
const match = typeof reference === "string" ? /^#\/\$defs\/([^/]+)$/u.exec(reference) : null;
|
|
303
|
+
const name = match?.[1];
|
|
304
|
+
if (!name || Object.keys(record(entry)).length !== 1) diagnostics.push({
|
|
305
|
+
code: "agent_schema_root_invalid",
|
|
306
|
+
path,
|
|
307
|
+
message: `Stored-record root reference ${String(reference)} must identify one exact local definition.`
|
|
308
|
+
});
|
|
309
|
+
else {
|
|
310
|
+
if (seen.has(name)) diagnostics.push({ code: "agent_schema_root_duplicate", path, message: `Stored-record root repeats ${name}.` });
|
|
311
|
+
seen.add(name);
|
|
312
|
+
if (!Object.hasOwn(definitions, name) || !Object.keys(record(definitions[name])).length) diagnostics.push({
|
|
313
|
+
code: "agent_schema_missing",
|
|
314
|
+
path,
|
|
315
|
+
message: `${name} root authority is missing or unconstrained.`
|
|
316
|
+
});
|
|
317
|
+
else if (runtimeOnly.has(name)) diagnostics.push({
|
|
318
|
+
code: "agent_schema_root_invalid",
|
|
319
|
+
path,
|
|
320
|
+
message: `${name} is a runtime/shared contract, not a stored-record root member.`
|
|
321
|
+
});
|
|
322
|
+
else if (!Object.hasOwn(schemas, name)) diagnostics.push({
|
|
323
|
+
code: "agent_schema_unverified",
|
|
324
|
+
path,
|
|
325
|
+
message: `${name} stored-record authority has no executable schema equivalence implementation.`
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
for (const name of Object.keys(schemas)) if (!runtimeOnly.has(name) && !seen.has(name)) {
|
|
330
|
+
diagnostics.push({
|
|
331
|
+
code: "agent_schema_root_missing",
|
|
332
|
+
path,
|
|
333
|
+
message: `${name} executable stored-record authority is absent from the root union.`
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
for (const [definition, executable] of executableStructures) {
|
|
338
|
+
const declared = definitions[definition];
|
|
339
|
+
const { shape, keys: actualKeys, required } = executable;
|
|
340
|
+
if (!declared || typeof declared !== "object" || executable.object && !declared.properties) {
|
|
341
|
+
diagnostics.push({ code: "agent_schema_missing", path, message: `${definition} must declare properties and required fields.` });
|
|
342
|
+
continue;
|
|
343
|
+
}
|
|
344
|
+
const declaredKeys = Object.keys(declared.properties ?? {}).sort();
|
|
345
|
+
const missing = actualKeys.filter((key) => !declaredKeys.includes(key));
|
|
346
|
+
const extra = declaredKeys.filter((key) => !actualKeys.includes(key));
|
|
347
|
+
if (missing.length || extra.length) diagnostics.push({
|
|
348
|
+
code: "agent_schema_fields_mismatch",
|
|
349
|
+
path,
|
|
350
|
+
message: `${definition} differs from SDK executable fields; missing: ${missing.join(", ") || "none"}; extra: ${extra.join(", ") || "none"}.`
|
|
351
|
+
});
|
|
352
|
+
const declaredRequired = [...declared.required ?? []].sort();
|
|
353
|
+
if (JSON.stringify(required) !== JSON.stringify(declaredRequired)) diagnostics.push({
|
|
354
|
+
code: "agent_schema_required_mismatch",
|
|
355
|
+
path,
|
|
356
|
+
message: `${definition} required fields differ; SDK: ${required.join(", ") || "none"}; declaration: ${declaredRequired.join(", ") || "none"}.`
|
|
357
|
+
});
|
|
358
|
+
for (const [field, specification] of Object.entries(declared.properties ?? {})) {
|
|
359
|
+
if (specification && Object.hasOwn(specification, "const") && shape[field] && !shape[field].safeParse(specification.const).success) diagnostics.push({
|
|
360
|
+
code: "agent_schema_constant_mismatch",
|
|
361
|
+
path,
|
|
362
|
+
message: `${definition}.${field} constant is rejected by the SDK validator.`
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
const expectedStructure = JSON.stringify(structuralSchema(declared, document, /* @__PURE__ */ new Set(), false, structures));
|
|
366
|
+
const actualStructure = executable.structure;
|
|
367
|
+
if (expectedStructure !== actualStructure) diagnostics.push({
|
|
368
|
+
code: "agent_schema_structure_mismatch",
|
|
369
|
+
path,
|
|
370
|
+
message: `${definition} nested declarative constraints differ from the SDK validator at ${structuralDifferences(JSON.parse(expectedStructure), JSON.parse(actualStructure)).join("; ")}.`
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
return diagnostics;
|
|
374
|
+
}
|
|
375
|
+
export {
|
|
376
|
+
verifyAgentContentSchema
|
|
377
|
+
};
|