@treeseed/sdk 0.13.0-rc.11 → 0.13.0-rc.111
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 +23 -9
- package/dist/.treeseed-build-complete.json +1 -0
- package/dist/accounts/account-contracts.d.ts +6 -0
- package/dist/agent-capacity/artifact-mutation-receipt.d.ts +1 -1
- package/dist/agent-capacity/artifacts.d.ts +17 -1
- package/dist/agent-capacity/authority/agent-authority-presets.js +2 -1
- 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-records.d.ts +10 -1
- 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 +0 -2
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +1 -1
- package/dist/agent-capacity/contracts/configuration/configuration.js +1 -1
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.d.ts +0 -1
- package/dist/agent-capacity/contracts/runtime/runtime-observability.d.ts +3 -3
- package/dist/agent-capacity/contracts/support/decision-work.d.ts +2 -3
- package/dist/agent-capacity/validation/activity-profile.js +25 -12
- package/dist/agent-capacity/validation/agent-definition-schema.d.ts +1092 -1170
- package/dist/agent-capacity/validation/agent-definition-schema.js +11 -29
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +20 -20
- package/dist/agent-capacity/validation/configuration.d.ts +1 -1
- package/dist/agent-capacity/validation/configuration.js +1 -2
- package/dist/capacity/agents/agent-capacity.d.ts +2 -0
- package/dist/capacity/agents/agent-capacity.js +2 -0
- 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 +24 -0
- package/dist/capacity-provider/client.js +11 -1
- 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 +103 -35
- package/dist/capacity-provider/contracts/index.d.ts +1 -0
- package/dist/capacity-provider/contracts/index.js +1 -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 +548 -0
- package/dist/capacity-provider/sandbox-contracts.js +86 -0
- package/dist/capacity-provider/sandbox.d.ts +1 -0
- package/dist/capacity-provider/sandbox.js +1 -0
- package/dist/capacity-provider/validation.d.ts +2 -2
- package/dist/capacity-provider/validation.js +91 -55
- package/dist/configuration/secrets-capability.d.ts +5 -1
- package/dist/configuration/secrets-capability.js +5 -1
- package/dist/content/validation/agent-operational-content-schemas.d.ts +490 -168
- package/dist/content/validation/agent-operational-content-schemas.js +18 -3
- package/dist/content/validation/auxiliary-content-schemas.d.ts +160 -160
- package/dist/content/validation/content-model-schemas.d.ts +2943 -2747
- package/dist/content/validation/portable-content-data.d.ts +296 -292
- 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 +14 -0
- package/dist/deployment/postgres/requirements.js +30 -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 +3578 -0
- package/dist/development/schemas.js +199 -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 +5 -0
- package/dist/guarantees/evidence-trust.d.ts +32 -0
- package/dist/guarantees/evidence-trust.js +47 -0
- package/dist/guarantees/index.d.ts +130 -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 +72 -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/model-registry/agent-operational-models.js +1 -1
- package/dist/operator-contracts/canonical-command-tree.js +465 -16
- 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/capability-ontology-operations.d.ts +163 -0
- package/dist/operator-contracts/catalog/capability-ontology-operations.js +24 -0
- package/dist/operator-contracts/catalog/communication-operations.d.ts +437 -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/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 +261 -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 +23 -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 +62 -0
- package/dist/operator-contracts/catalog/services/secret-operations.js +51 -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/command-tree.d.ts +28 -0
- package/dist/operator-contracts/command-tree.js +49 -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 +1818 -0
- package/dist/operator-contracts/communication/contracts.js +188 -0
- package/dist/operator-contracts/control-plane-operation.d.ts +9 -0
- package/dist/operator-contracts/control-plane-operation.js +12 -2
- package/dist/operator-contracts/control-plane-operations.d.ts +2255 -195
- package/dist/operator-contracts/control-plane-operations.js +247 -85
- package/dist/operator-contracts/inbox/contracts.d.ts +1099 -0
- package/dist/operator-contracts/inbox/contracts.js +134 -0
- package/dist/operator-contracts/index.d.ts +6 -0
- package/dist/operator-contracts/index.js +6 -0
- 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 +61 -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/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 +986 -0
- package/dist/platform/schemas.js +73 -0
- package/dist/platform/verification.d.ts +9 -0
- package/dist/platform/verification.js +104 -0
- package/dist/platform/workset.d.ts +21 -0
- package/dist/platform/workset.js +106 -0
- 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 +2 -0
- package/dist/treedx/types.d.ts +8 -7
- package/dist/treedx/types.js +0 -7
- package/dist/types/agents/agent-activity-profile.d.ts +18 -36
- package/dist/types/agents/agent-trigger-kinds.d.ts +3 -5
- package/dist/types/agents/agent-trigger-kinds.js +1 -13
- package/package.json +64 -11
- 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/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-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/{treedx/generated/openapi-types.js → site-contracts/cloudflare.js} +0 -0
- /package/dist/{treedx/types/tree-dx-artifact-list-response.js → site-contracts/platform.js} +0 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const digest = z.string().regex(/^sha256:[a-f0-9]{64}$/u);
|
|
4
|
+
const semver = z.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u);
|
|
5
|
+
const identifier = z.string().regex(/^[a-z][a-z0-9.-]{1,191}$/u);
|
|
6
|
+
const capabilityId = z.string().regex(/^(?:treeseed\.[a-z][a-z0-9.-]*|provider\.[a-f0-9]{16,64}\.[a-z][a-z0-9.-]*)$/u);
|
|
7
|
+
const jsonSchema = z.record(z.unknown());
|
|
8
|
+
const capabilityReferenceSchema = z.object({ id: capabilityId, version: semver, digest }).strict();
|
|
9
|
+
const artifactContractSchema = z.object({ id: identifier, version: semver, digest, mediaTypes: z.array(z.string().min(1)).default([]) }).strict();
|
|
10
|
+
const configurationFieldSchema = z.object({
|
|
11
|
+
key: identifier,
|
|
12
|
+
description: z.string().min(1),
|
|
13
|
+
schema: jsonSchema,
|
|
14
|
+
requirementSupport: z.array(z.enum(["required", "preferred"])).min(1),
|
|
15
|
+
securityCritical: z.boolean().default(false)
|
|
16
|
+
}).strict();
|
|
17
|
+
const capabilityDefinitionSchema = z.object({
|
|
18
|
+
schemaVersion: z.literal("treeseed.capability-definition/v1"),
|
|
19
|
+
id: capabilityId,
|
|
20
|
+
version: semver,
|
|
21
|
+
digest,
|
|
22
|
+
family: z.enum(["coordination", "research", "data", "engineering", "publishing", "external-work"]),
|
|
23
|
+
title: z.string().min(1),
|
|
24
|
+
description: z.string().min(1),
|
|
25
|
+
status: z.enum(["active", "deprecated", "revoked"]),
|
|
26
|
+
features: z.array(identifier),
|
|
27
|
+
inputs: z.array(artifactContractSchema),
|
|
28
|
+
outputs: z.array(artifactContractSchema),
|
|
29
|
+
configuration: z.array(configurationFieldSchema),
|
|
30
|
+
permissionClasses: z.array(identifier),
|
|
31
|
+
contextModes: z.array(identifier),
|
|
32
|
+
interactionModes: z.array(identifier),
|
|
33
|
+
implies: z.array(capabilityReferenceSchema),
|
|
34
|
+
conflicts: z.array(capabilityReferenceSchema),
|
|
35
|
+
qualificationTier: z.enum(["signed-attestation", "automated-suite", "reviewed-certification"]),
|
|
36
|
+
createdAt: z.string().datetime()
|
|
37
|
+
}).strict();
|
|
38
|
+
const capabilityOntologySchema = z.object({
|
|
39
|
+
schemaVersion: z.literal("treeseed.capability-ontology/v1"),
|
|
40
|
+
generation: z.number().int().positive(),
|
|
41
|
+
digest,
|
|
42
|
+
definitions: z.array(capabilityDefinitionSchema),
|
|
43
|
+
createdAt: z.string().datetime(),
|
|
44
|
+
signature: z.object({ keyId: identifier, algorithm: z.enum(["Ed25519", "release-catalog"]), value: z.string().min(1) }).strict()
|
|
45
|
+
}).strict().superRefine((catalog, context) => {
|
|
46
|
+
const keys = catalog.definitions.map((entry) => `${entry.id}@${entry.version}`);
|
|
47
|
+
if (new Set(keys).size !== keys.length) context.addIssue({ code: z.ZodIssueCode.custom, path: ["definitions"], message: "Capability definitions must be unique by id and version." });
|
|
48
|
+
});
|
|
49
|
+
const configuredValueSchema = z.object({ value: z.unknown(), requirement: z.enum(["required", "preferred"]) }).strict();
|
|
50
|
+
const capabilityDemandSchema = z.object({
|
|
51
|
+
schemaVersion: z.literal("treeseed.capability-demand/v1"),
|
|
52
|
+
ontologyGeneration: z.number().int().positive(),
|
|
53
|
+
requirements: z.array(z.object({
|
|
54
|
+
capabilityId,
|
|
55
|
+
versionRange: z.string().min(1),
|
|
56
|
+
requirement: z.enum(["required", "preferred"]),
|
|
57
|
+
alternativeGroup: identifier.nullable().default(null),
|
|
58
|
+
requiredFeatures: z.array(identifier).default([]),
|
|
59
|
+
configuration: z.record(configuredValueSchema).default({})
|
|
60
|
+
}).strict()).min(1),
|
|
61
|
+
resolved: z.array(capabilityReferenceSchema),
|
|
62
|
+
permissionClasses: z.array(identifier),
|
|
63
|
+
contextModes: z.array(identifier),
|
|
64
|
+
inputContracts: z.array(artifactContractSchema),
|
|
65
|
+
outputContracts: z.array(artifactContractSchema),
|
|
66
|
+
demandDigest: digest
|
|
67
|
+
}).strict();
|
|
68
|
+
const capabilityConformanceSchema = z.object({
|
|
69
|
+
schemaVersion: z.literal("treeseed.capability-conformance/v1"),
|
|
70
|
+
providerId: z.string().min(1),
|
|
71
|
+
capability: capabilityReferenceSchema,
|
|
72
|
+
tier: z.enum(["signed-attestation", "automated-suite", "reviewed-certification"]),
|
|
73
|
+
status: z.enum(["passed", "failed", "revoked"]),
|
|
74
|
+
evidenceDigest: digest,
|
|
75
|
+
suite: z.object({ id: identifier, version: semver }).strict().nullable(),
|
|
76
|
+
issuedAt: z.string().datetime(),
|
|
77
|
+
expiresAt: z.string().datetime().nullable(),
|
|
78
|
+
signature: z.object({ keyId: identifier, algorithm: z.literal("Ed25519"), value: z.string().min(1) }).strict()
|
|
79
|
+
}).strict();
|
|
80
|
+
const providerContextCapacitySchema = z.discriminatedUnion("mode", [
|
|
81
|
+
z.object({
|
|
82
|
+
mode: z.literal("bounded"),
|
|
83
|
+
measurement: z.enum(["tokens", "bytes", "items"]),
|
|
84
|
+
defaultInitial: z.number().int().positive(),
|
|
85
|
+
maximum: z.number().int().positive(),
|
|
86
|
+
reservedOutput: z.number().int().nonnegative().default(0),
|
|
87
|
+
transportPayloadBytes: z.number().int().positive(),
|
|
88
|
+
measurementProvenance: z.object({ provider: identifier, implementation: z.string().min(1), version: z.string().min(1).nullable() }).strict()
|
|
89
|
+
}).strict(),
|
|
90
|
+
z.object({
|
|
91
|
+
mode: z.literal("unbounded"),
|
|
92
|
+
measurement: z.enum(["tokens", "bytes", "items"]).nullable().default(null),
|
|
93
|
+
transportPayloadBytes: z.number().int().positive(),
|
|
94
|
+
measurementProvenance: z.object({ provider: identifier, implementation: z.string().min(1), version: z.string().min(1).nullable() }).strict()
|
|
95
|
+
}).strict()
|
|
96
|
+
]).superRefine((value, context) => {
|
|
97
|
+
if (value.mode === "bounded" && value.defaultInitial > value.maximum) context.addIssue({ code: z.ZodIssueCode.custom, path: ["defaultInitial"], message: "Default initial context cannot exceed the maximum." });
|
|
98
|
+
if (value.mode === "bounded" && value.measurement === "tokens" && value.reservedOutput >= value.maximum) context.addIssue({ code: z.ZodIssueCode.custom, path: ["reservedOutput"], message: "Reserved output must leave room for input context." });
|
|
99
|
+
});
|
|
100
|
+
const capabilityOfferSchema = z.object({
|
|
101
|
+
schemaVersion: z.literal("treeseed.capability-offer/v2"),
|
|
102
|
+
offerId: identifier,
|
|
103
|
+
capabilities: z.array(capabilityReferenceSchema).min(1),
|
|
104
|
+
features: z.array(identifier),
|
|
105
|
+
configurationSupport: z.record(z.object({ required: z.boolean(), preferred: z.boolean() }).strict()),
|
|
106
|
+
permissionClasses: z.array(identifier),
|
|
107
|
+
contextModes: z.array(identifier),
|
|
108
|
+
inputContracts: z.array(artifactContractSchema),
|
|
109
|
+
outputContracts: z.array(artifactContractSchema),
|
|
110
|
+
interactionModes: z.array(identifier),
|
|
111
|
+
conformance: z.array(capabilityConformanceSchema).min(1),
|
|
112
|
+
contextCapacity: providerContextCapacitySchema,
|
|
113
|
+
limits: z.record(z.unknown()),
|
|
114
|
+
commercial: z.object({ currency: z.string().min(3).max(3).nullable(), estimatedCost: z.number().nonnegative().nullable() }).strict(),
|
|
115
|
+
region: z.string().min(1).nullable(),
|
|
116
|
+
trust: z.array(identifier),
|
|
117
|
+
offerDigest: digest
|
|
118
|
+
}).strict();
|
|
119
|
+
const capabilityNegotiationReceiptSchema = z.object({
|
|
120
|
+
schemaVersion: z.literal("treeseed.capability-negotiation/v1"),
|
|
121
|
+
demandDigest: digest,
|
|
122
|
+
offerDigest: digest,
|
|
123
|
+
eligible: z.boolean(),
|
|
124
|
+
resolvedCapabilities: z.array(capabilityReferenceSchema),
|
|
125
|
+
omittedPreferred: z.array(z.string()),
|
|
126
|
+
reasons: z.array(z.string()),
|
|
127
|
+
receiptDigest: digest
|
|
128
|
+
}).strict();
|
|
129
|
+
function canonical(value) {
|
|
130
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
131
|
+
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
132
|
+
return `{${Object.entries(value).filter(([, item]) => item !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([key, item]) => `${JSON.stringify(key)}:${canonical(item)}`).join(",")}}`;
|
|
133
|
+
}
|
|
134
|
+
function capabilityContractDigest(value) {
|
|
135
|
+
return `sha256:${createHash("sha256").update(canonical(value)).digest("hex")}`;
|
|
136
|
+
}
|
|
137
|
+
function capabilityDefinitionDigest(value) {
|
|
138
|
+
return capabilityContractDigest(value);
|
|
139
|
+
}
|
|
140
|
+
function capabilityOfferDigest(value) {
|
|
141
|
+
return capabilityContractDigest(value);
|
|
142
|
+
}
|
|
143
|
+
function capabilityDemandDigest(value) {
|
|
144
|
+
return capabilityContractDigest(value);
|
|
145
|
+
}
|
|
146
|
+
function semverSatisfies(version, range) {
|
|
147
|
+
const parse = (input) => /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-|$)/u.exec(input)?.slice(1, 4).map(Number) ?? null;
|
|
148
|
+
const actual = parse(version);
|
|
149
|
+
if (!actual) return false;
|
|
150
|
+
const compare = (left, right) => left[0] - right[0] || left[1] - right[1] || left[2] - right[2];
|
|
151
|
+
if (range.includes("||")) return range.split("||").some((part) => semverSatisfies(version, part.trim()));
|
|
152
|
+
if (/\s/u.test(range.trim())) return range.trim().split(/\s+/u).every((part) => semverSatisfies(version, part));
|
|
153
|
+
for (const operator of [">=", "<=", ">", "<"]) if (range.startsWith(operator)) {
|
|
154
|
+
const expected = parse(range.slice(operator.length));
|
|
155
|
+
if (!expected) return false;
|
|
156
|
+
const result = compare(actual, expected);
|
|
157
|
+
return operator === ">=" ? result >= 0 : operator === "<=" ? result <= 0 : operator === ">" ? result > 0 : result < 0;
|
|
158
|
+
}
|
|
159
|
+
if (range.startsWith("^")) {
|
|
160
|
+
const expected = parse(range.slice(1));
|
|
161
|
+
if (!expected || compare(actual, expected) < 0) return false;
|
|
162
|
+
return expected[0] > 0 ? actual[0] === expected[0] : expected[1] > 0 ? actual[0] === 0 && actual[1] === expected[1] : compare(actual, [0, 0, expected[2] + 1]) < 0;
|
|
163
|
+
}
|
|
164
|
+
if (range.startsWith("~")) {
|
|
165
|
+
const expected = parse(range.slice(1));
|
|
166
|
+
return Boolean(expected && actual[0] === expected[0] && actual[1] === expected[1] && compare(actual, expected) >= 0);
|
|
167
|
+
}
|
|
168
|
+
if (/^\d+\.x$/u.test(range)) return actual[0] === Number(range.split(".")[0]);
|
|
169
|
+
const exact = parse(range);
|
|
170
|
+
return Boolean(exact && compare(actual, exact) === 0);
|
|
171
|
+
}
|
|
172
|
+
function negotiateCapabilityOffer(demand, offer) {
|
|
173
|
+
const reasons = [], omittedPreferred = [], resolvedCapabilities = [];
|
|
174
|
+
const alternatives = /* @__PURE__ */ new Map();
|
|
175
|
+
for (const requirement of demand.requirements) {
|
|
176
|
+
const candidates = offer.capabilities.filter((capability) => capability.id === requirement.capabilityId && semverSatisfies(capability.version, requirement.versionRange));
|
|
177
|
+
const compatible = candidates.find((capability) => demand.resolved.some((resolved) => resolved.id === capability.id && resolved.version === capability.version && resolved.digest === capability.digest));
|
|
178
|
+
const featureCompatible = compatible && requirement.requiredFeatures.every((feature) => offer.features.includes(feature));
|
|
179
|
+
const configMissing = Object.entries(requirement.configuration).filter(([key, configured]) => configured.requirement === "required" && offer.configurationSupport[key]?.required !== true).map(([key]) => key);
|
|
180
|
+
const satisfied = Boolean(featureCompatible && configMissing.length === 0);
|
|
181
|
+
if (requirement.alternativeGroup) {
|
|
182
|
+
const group = alternatives.get(requirement.alternativeGroup) ?? { satisfied: false, required: false };
|
|
183
|
+
alternatives.set(requirement.alternativeGroup, { satisfied: group.satisfied || satisfied, required: group.required || requirement.requirement === "required" });
|
|
184
|
+
} else if (!satisfied && requirement.requirement === "required") reasons.push(`missing_required_capability:${requirement.capabilityId}`);
|
|
185
|
+
else if (!satisfied) omittedPreferred.push(`capability:${requirement.capabilityId}`);
|
|
186
|
+
if (satisfied && compatible) resolvedCapabilities.push(compatible);
|
|
187
|
+
for (const [key, configured] of Object.entries(requirement.configuration)) if (configured.requirement === "preferred" && offer.configurationSupport[key]?.preferred !== true) omittedPreferred.push(`configuration:${requirement.capabilityId}:${key}`);
|
|
188
|
+
}
|
|
189
|
+
for (const [group, state] of alternatives) if (!state.satisfied && state.required) reasons.push(`missing_required_alternative:${group}`);
|
|
190
|
+
else if (!state.satisfied) omittedPreferred.push(`alternative:${group}`);
|
|
191
|
+
for (const permission of demand.permissionClasses) if (!offer.permissionClasses.includes(permission)) reasons.push(`missing_permission_support:${permission}`);
|
|
192
|
+
for (const mode of demand.contextModes) if (!offer.contextModes.includes(mode)) reasons.push(`missing_context_mode:${mode}`);
|
|
193
|
+
for (const contract of demand.inputContracts) if (!offer.inputContracts.some((candidate) => candidate.id === contract.id && candidate.version === contract.version && candidate.digest === contract.digest)) reasons.push(`missing_input_contract:${contract.id}`);
|
|
194
|
+
for (const contract of demand.outputContracts) if (!offer.outputContracts.some((candidate) => candidate.id === contract.id && candidate.version === contract.version && candidate.digest === contract.digest)) reasons.push(`missing_output_contract:${contract.id}`);
|
|
195
|
+
const material = {
|
|
196
|
+
schemaVersion: "treeseed.capability-negotiation/v1",
|
|
197
|
+
demandDigest: demand.demandDigest,
|
|
198
|
+
offerDigest: offer.offerDigest,
|
|
199
|
+
eligible: reasons.length === 0,
|
|
200
|
+
resolvedCapabilities,
|
|
201
|
+
omittedPreferred: [...new Set(omittedPreferred)].sort(),
|
|
202
|
+
reasons: [...new Set(reasons)].sort()
|
|
203
|
+
};
|
|
204
|
+
return capabilityNegotiationReceiptSchema.parse({ ...material, receiptDigest: capabilityContractDigest(material) });
|
|
205
|
+
}
|
|
206
|
+
export {
|
|
207
|
+
capabilityConformanceSchema,
|
|
208
|
+
capabilityContractDigest,
|
|
209
|
+
capabilityDefinitionDigest,
|
|
210
|
+
capabilityDefinitionSchema,
|
|
211
|
+
capabilityDemandDigest,
|
|
212
|
+
capabilityDemandSchema,
|
|
213
|
+
capabilityNegotiationReceiptSchema,
|
|
214
|
+
capabilityOfferDigest,
|
|
215
|
+
capabilityOfferSchema,
|
|
216
|
+
capabilityOntologySchema,
|
|
217
|
+
capabilityReferenceSchema,
|
|
218
|
+
negotiateCapabilityOffer,
|
|
219
|
+
providerContextCapacitySchema,
|
|
220
|
+
semverSatisfies
|
|
221
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ProviderAssignmentLifecycleRequest, ProviderAssignmentLifecycleResult, ProviderNextAssignmentRequest } from '../capacity/agents/agent-capacity.js';
|
|
2
2
|
import type { ProviderRuntimeEventInput } from '../agent-capacity/contracts/capacity/workdays/workday-records.js';
|
|
3
3
|
import type { CapacityProviderIdentity, CapacityProviderIdentityRotationRequest, CapacityProviderSignedProof, ProviderAccessTokenIssue, ProviderAvailabilitySession, ProviderCredentialIssuanceAuthorization, ProviderRegistrationRequest, ProviderRegistrationSubmission, ProviderTeamCredentialIssue } from './contracts/index.js';
|
|
4
|
+
import type { ProviderDiscussionResponseRequest } from '../operator-contracts/communication/contracts.js';
|
|
4
5
|
export interface ProviderProtocolClientOptions {
|
|
5
6
|
controlPlaneUrl: string;
|
|
6
7
|
accessToken?: string;
|
|
@@ -43,6 +44,29 @@ export declare class ProviderProtocolClient {
|
|
|
43
44
|
startAssignmentExecution(assignmentId: string, request: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
44
45
|
startAssignmentCloseout(assignmentId: string, request: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
45
46
|
preflightAssignmentCompletion(assignmentId: string, request: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
47
|
+
respondToAssignmentDiscussion(assignmentId: string, request: ProviderDiscussionResponseRequest, idempotencyKey: string): Promise<{
|
|
48
|
+
status: "responded" | "abstained";
|
|
49
|
+
schemaVersion: "treeseed.provider-discussion-response-receipt/v1";
|
|
50
|
+
assignmentId: string;
|
|
51
|
+
invocationId: string;
|
|
52
|
+
messageRef: string;
|
|
53
|
+
settledAt: string;
|
|
54
|
+
}>;
|
|
55
|
+
acknowledgeCommunicationNotification(assignmentId: string, request: {
|
|
56
|
+
providerId: string;
|
|
57
|
+
runnerId: string;
|
|
58
|
+
observedAt: string;
|
|
59
|
+
}): Promise<Record<string, unknown>>;
|
|
60
|
+
createCommunicationTraceEvent(assignmentId: string, request: {
|
|
61
|
+
leaseToken: string;
|
|
62
|
+
runnerId: string;
|
|
63
|
+
sequence: number;
|
|
64
|
+
type: string;
|
|
65
|
+
occurredAt: string;
|
|
66
|
+
summary: string;
|
|
67
|
+
payload: Record<string, unknown>;
|
|
68
|
+
protectedPayload?: Record<string, unknown>;
|
|
69
|
+
}): Promise<Record<string, unknown>>;
|
|
46
70
|
returnAssignment(assignmentId: string, request?: ProviderAssignmentLifecycleRequest): Promise<ProviderAssignmentLifecycleResult>;
|
|
47
71
|
completeAssignment(assignmentId: string, request?: ProviderAssignmentLifecycleRequest): Promise<ProviderAssignmentLifecycleResult>;
|
|
48
72
|
failAssignment(assignmentId: string, request?: ProviderAssignmentLifecycleRequest): Promise<ProviderAssignmentLifecycleResult>;
|
|
@@ -48,11 +48,12 @@ class ProviderProtocolClient {
|
|
|
48
48
|
fetchImpl: this.fetchImpl,
|
|
49
49
|
userAgent: this.userAgent
|
|
50
50
|
});
|
|
51
|
+
const idempotencyKey = options.idempotencyKey ?? (operation.descriptor.idempotency.required ? globalThis.crypto.randomUUID() : void 0);
|
|
51
52
|
const response = await client.invoke(operation, {
|
|
52
53
|
path: input.path ?? {},
|
|
53
54
|
query: input.query ?? {},
|
|
54
55
|
body: input.body
|
|
55
|
-
}, { authorization, headers: options.headers, idempotencyKey
|
|
56
|
+
}, { authorization, headers: options.headers, idempotencyKey, signal: controller.signal });
|
|
56
57
|
return response.data;
|
|
57
58
|
} catch (error) {
|
|
58
59
|
if (error instanceof CapacityProviderApiError) throw error;
|
|
@@ -125,6 +126,15 @@ class ProviderProtocolClient {
|
|
|
125
126
|
preflightAssignmentCompletion(assignmentId, request) {
|
|
126
127
|
return this.invoke(CONTROL_PLANE_OPERATIONS.providers.completionPreflight, { path: { assignmentId }, body: request });
|
|
127
128
|
}
|
|
129
|
+
respondToAssignmentDiscussion(assignmentId, request, idempotencyKey) {
|
|
130
|
+
return this.invoke(CONTROL_PLANE_OPERATIONS.providers.discussionResponse, { path: { assignmentId }, body: request }, { idempotencyKey });
|
|
131
|
+
}
|
|
132
|
+
acknowledgeCommunicationNotification(assignmentId, request) {
|
|
133
|
+
return this.invoke(CONTROL_PLANE_OPERATIONS.providers.notificationAcknowledge, { path: { assignmentId }, body: request });
|
|
134
|
+
}
|
|
135
|
+
createCommunicationTraceEvent(assignmentId, request) {
|
|
136
|
+
return this.invoke(CONTROL_PLANE_OPERATIONS.providers.traceEvent, { path: { assignmentId }, body: request });
|
|
137
|
+
}
|
|
128
138
|
returnAssignment(assignmentId, request = {}) {
|
|
129
139
|
return this.invoke(CONTROL_PLANE_OPERATIONS.providers.returnAssignment, { path: { assignmentId }, body: request });
|
|
130
140
|
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const providerRegistrationCodeStatusSchema: z.ZodObject<{
|
|
3
|
+
schemaVersion: z.ZodLiteral<"treeseed.provider-registration-code-status/v1">;
|
|
4
|
+
teamId: z.ZodString;
|
|
5
|
+
generation: z.ZodNumber;
|
|
6
|
+
codePrefix: z.ZodString;
|
|
7
|
+
rotatedAt: z.ZodString;
|
|
8
|
+
}, "strict", z.ZodTypeAny, {
|
|
9
|
+
schemaVersion: "treeseed.provider-registration-code-status/v1";
|
|
10
|
+
teamId: string;
|
|
11
|
+
rotatedAt: string;
|
|
12
|
+
generation: number;
|
|
13
|
+
codePrefix: string;
|
|
14
|
+
}, {
|
|
15
|
+
schemaVersion: "treeseed.provider-registration-code-status/v1";
|
|
16
|
+
teamId: string;
|
|
17
|
+
rotatedAt: string;
|
|
18
|
+
generation: number;
|
|
19
|
+
codePrefix: string;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const providerRegistrationCodeReceiptSchema: z.ZodObject<{
|
|
22
|
+
schemaVersion: z.ZodLiteral<"treeseed.provider-registration-code-receipt/v1">;
|
|
23
|
+
teamId: z.ZodString;
|
|
24
|
+
generation: z.ZodNumber;
|
|
25
|
+
codePrefix: z.ZodString;
|
|
26
|
+
registrationCode: z.ZodString;
|
|
27
|
+
rotatedAt: z.ZodString;
|
|
28
|
+
}, "strict", z.ZodTypeAny, {
|
|
29
|
+
schemaVersion: "treeseed.provider-registration-code-receipt/v1";
|
|
30
|
+
teamId: string;
|
|
31
|
+
rotatedAt: string;
|
|
32
|
+
generation: number;
|
|
33
|
+
codePrefix: string;
|
|
34
|
+
registrationCode: string;
|
|
35
|
+
}, {
|
|
36
|
+
schemaVersion: "treeseed.provider-registration-code-receipt/v1";
|
|
37
|
+
teamId: string;
|
|
38
|
+
rotatedAt: string;
|
|
39
|
+
generation: number;
|
|
40
|
+
codePrefix: string;
|
|
41
|
+
registrationCode: string;
|
|
42
|
+
}>;
|
|
43
|
+
export declare const providerEnvironmentVariableDescriptorSchema: z.ZodObject<{
|
|
44
|
+
name: z.ZodString;
|
|
45
|
+
available: z.ZodBoolean;
|
|
46
|
+
rotatedAt: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, "strict", z.ZodTypeAny, {
|
|
48
|
+
name: string;
|
|
49
|
+
available: boolean;
|
|
50
|
+
rotatedAt?: string | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
name: string;
|
|
53
|
+
available: boolean;
|
|
54
|
+
rotatedAt?: string | undefined;
|
|
55
|
+
}>;
|
|
56
|
+
export declare const providerEnvironmentProfileDescriptorSchema: z.ZodEffects<z.ZodObject<{
|
|
57
|
+
schemaVersion: z.ZodLiteral<"treeseed.provider-environment-profile/v1">;
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
generation: z.ZodNumber;
|
|
60
|
+
variables: z.ZodArray<z.ZodObject<{
|
|
61
|
+
name: z.ZodString;
|
|
62
|
+
available: z.ZodBoolean;
|
|
63
|
+
rotatedAt: z.ZodOptional<z.ZodString>;
|
|
64
|
+
}, "strict", z.ZodTypeAny, {
|
|
65
|
+
name: string;
|
|
66
|
+
available: boolean;
|
|
67
|
+
rotatedAt?: string | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
name: string;
|
|
70
|
+
available: boolean;
|
|
71
|
+
rotatedAt?: string | undefined;
|
|
72
|
+
}>, "many">;
|
|
73
|
+
updatedAt: z.ZodString;
|
|
74
|
+
}, "strict", z.ZodTypeAny, {
|
|
75
|
+
id: string;
|
|
76
|
+
schemaVersion: "treeseed.provider-environment-profile/v1";
|
|
77
|
+
variables: {
|
|
78
|
+
name: string;
|
|
79
|
+
available: boolean;
|
|
80
|
+
rotatedAt?: string | undefined;
|
|
81
|
+
}[];
|
|
82
|
+
generation: number;
|
|
83
|
+
updatedAt: string;
|
|
84
|
+
}, {
|
|
85
|
+
id: string;
|
|
86
|
+
schemaVersion: "treeseed.provider-environment-profile/v1";
|
|
87
|
+
variables: {
|
|
88
|
+
name: string;
|
|
89
|
+
available: boolean;
|
|
90
|
+
rotatedAt?: string | undefined;
|
|
91
|
+
}[];
|
|
92
|
+
generation: number;
|
|
93
|
+
updatedAt: string;
|
|
94
|
+
}>, {
|
|
95
|
+
id: string;
|
|
96
|
+
schemaVersion: "treeseed.provider-environment-profile/v1";
|
|
97
|
+
variables: {
|
|
98
|
+
name: string;
|
|
99
|
+
available: boolean;
|
|
100
|
+
rotatedAt?: string | undefined;
|
|
101
|
+
}[];
|
|
102
|
+
generation: number;
|
|
103
|
+
updatedAt: string;
|
|
104
|
+
}, {
|
|
105
|
+
id: string;
|
|
106
|
+
schemaVersion: "treeseed.provider-environment-profile/v1";
|
|
107
|
+
variables: {
|
|
108
|
+
name: string;
|
|
109
|
+
available: boolean;
|
|
110
|
+
rotatedAt?: string | undefined;
|
|
111
|
+
}[];
|
|
112
|
+
generation: number;
|
|
113
|
+
updatedAt: string;
|
|
114
|
+
}>;
|
|
115
|
+
export declare const assignmentEnvironmentGrantSchema: z.ZodEffects<z.ZodObject<{
|
|
116
|
+
schemaVersion: z.ZodLiteral<"treeseed.assignment-environment-grant/v1">;
|
|
117
|
+
grantId: z.ZodString;
|
|
118
|
+
assignmentId: z.ZodString;
|
|
119
|
+
providerId: z.ZodString;
|
|
120
|
+
teamId: z.ZodString;
|
|
121
|
+
projectId: z.ZodString;
|
|
122
|
+
profileId: z.ZodString;
|
|
123
|
+
variables: z.ZodArray<z.ZodString, "many">;
|
|
124
|
+
network: z.ZodObject<{
|
|
125
|
+
allowed: z.ZodBoolean;
|
|
126
|
+
destinations: z.ZodArray<z.ZodString, "many">;
|
|
127
|
+
}, "strict", z.ZodTypeAny, {
|
|
128
|
+
allowed: boolean;
|
|
129
|
+
destinations: string[];
|
|
130
|
+
}, {
|
|
131
|
+
allowed: boolean;
|
|
132
|
+
destinations: string[];
|
|
133
|
+
}>;
|
|
134
|
+
policy: z.ZodObject<{
|
|
135
|
+
handlerDeclarationDigest: z.ZodString;
|
|
136
|
+
providerOfferDigest: z.ZodString;
|
|
137
|
+
providerPermissionDigest: z.ZodString;
|
|
138
|
+
teamApprovalDigest: z.ZodString;
|
|
139
|
+
assignmentGrantDigest: z.ZodString;
|
|
140
|
+
sandboxPolicyDigest: z.ZodString;
|
|
141
|
+
}, "strict", z.ZodTypeAny, {
|
|
142
|
+
handlerDeclarationDigest: string;
|
|
143
|
+
providerOfferDigest: string;
|
|
144
|
+
providerPermissionDigest: string;
|
|
145
|
+
teamApprovalDigest: string;
|
|
146
|
+
assignmentGrantDigest: string;
|
|
147
|
+
sandboxPolicyDigest: string;
|
|
148
|
+
}, {
|
|
149
|
+
handlerDeclarationDigest: string;
|
|
150
|
+
providerOfferDigest: string;
|
|
151
|
+
providerPermissionDigest: string;
|
|
152
|
+
teamApprovalDigest: string;
|
|
153
|
+
assignmentGrantDigest: string;
|
|
154
|
+
sandboxPolicyDigest: string;
|
|
155
|
+
}>;
|
|
156
|
+
issuedAt: z.ZodString;
|
|
157
|
+
expiresAt: z.ZodString;
|
|
158
|
+
}, "strict", z.ZodTypeAny, {
|
|
159
|
+
expiresAt: string;
|
|
160
|
+
schemaVersion: "treeseed.assignment-environment-grant/v1";
|
|
161
|
+
projectId: string;
|
|
162
|
+
teamId: string;
|
|
163
|
+
providerId: string;
|
|
164
|
+
issuedAt: string;
|
|
165
|
+
variables: string[];
|
|
166
|
+
assignmentId: string;
|
|
167
|
+
profileId: string;
|
|
168
|
+
network: {
|
|
169
|
+
allowed: boolean;
|
|
170
|
+
destinations: string[];
|
|
171
|
+
};
|
|
172
|
+
policy: {
|
|
173
|
+
handlerDeclarationDigest: string;
|
|
174
|
+
providerOfferDigest: string;
|
|
175
|
+
providerPermissionDigest: string;
|
|
176
|
+
teamApprovalDigest: string;
|
|
177
|
+
assignmentGrantDigest: string;
|
|
178
|
+
sandboxPolicyDigest: string;
|
|
179
|
+
};
|
|
180
|
+
grantId: string;
|
|
181
|
+
}, {
|
|
182
|
+
expiresAt: string;
|
|
183
|
+
schemaVersion: "treeseed.assignment-environment-grant/v1";
|
|
184
|
+
projectId: string;
|
|
185
|
+
teamId: string;
|
|
186
|
+
providerId: string;
|
|
187
|
+
issuedAt: string;
|
|
188
|
+
variables: string[];
|
|
189
|
+
assignmentId: string;
|
|
190
|
+
profileId: string;
|
|
191
|
+
network: {
|
|
192
|
+
allowed: boolean;
|
|
193
|
+
destinations: string[];
|
|
194
|
+
};
|
|
195
|
+
policy: {
|
|
196
|
+
handlerDeclarationDigest: string;
|
|
197
|
+
providerOfferDigest: string;
|
|
198
|
+
providerPermissionDigest: string;
|
|
199
|
+
teamApprovalDigest: string;
|
|
200
|
+
assignmentGrantDigest: string;
|
|
201
|
+
sandboxPolicyDigest: string;
|
|
202
|
+
};
|
|
203
|
+
grantId: string;
|
|
204
|
+
}>, {
|
|
205
|
+
expiresAt: string;
|
|
206
|
+
schemaVersion: "treeseed.assignment-environment-grant/v1";
|
|
207
|
+
projectId: string;
|
|
208
|
+
teamId: string;
|
|
209
|
+
providerId: string;
|
|
210
|
+
issuedAt: string;
|
|
211
|
+
variables: string[];
|
|
212
|
+
assignmentId: string;
|
|
213
|
+
profileId: string;
|
|
214
|
+
network: {
|
|
215
|
+
allowed: boolean;
|
|
216
|
+
destinations: string[];
|
|
217
|
+
};
|
|
218
|
+
policy: {
|
|
219
|
+
handlerDeclarationDigest: string;
|
|
220
|
+
providerOfferDigest: string;
|
|
221
|
+
providerPermissionDigest: string;
|
|
222
|
+
teamApprovalDigest: string;
|
|
223
|
+
assignmentGrantDigest: string;
|
|
224
|
+
sandboxPolicyDigest: string;
|
|
225
|
+
};
|
|
226
|
+
grantId: string;
|
|
227
|
+
}, {
|
|
228
|
+
expiresAt: string;
|
|
229
|
+
schemaVersion: "treeseed.assignment-environment-grant/v1";
|
|
230
|
+
projectId: string;
|
|
231
|
+
teamId: string;
|
|
232
|
+
providerId: string;
|
|
233
|
+
issuedAt: string;
|
|
234
|
+
variables: string[];
|
|
235
|
+
assignmentId: string;
|
|
236
|
+
profileId: string;
|
|
237
|
+
network: {
|
|
238
|
+
allowed: boolean;
|
|
239
|
+
destinations: string[];
|
|
240
|
+
};
|
|
241
|
+
policy: {
|
|
242
|
+
handlerDeclarationDigest: string;
|
|
243
|
+
providerOfferDigest: string;
|
|
244
|
+
providerPermissionDigest: string;
|
|
245
|
+
teamApprovalDigest: string;
|
|
246
|
+
assignmentGrantDigest: string;
|
|
247
|
+
sandboxPolicyDigest: string;
|
|
248
|
+
};
|
|
249
|
+
grantId: string;
|
|
250
|
+
}>;
|
|
251
|
+
export type ProviderRegistrationCodeStatus = z.infer<typeof providerRegistrationCodeStatusSchema>;
|
|
252
|
+
export type ProviderRegistrationCodeReceipt = z.infer<typeof providerRegistrationCodeReceiptSchema>;
|
|
253
|
+
export type ProviderEnvironmentVariableDescriptor = z.infer<typeof providerEnvironmentVariableDescriptorSchema>;
|
|
254
|
+
export type ProviderEnvironmentProfileDescriptor = z.infer<typeof providerEnvironmentProfileDescriptorSchema>;
|
|
255
|
+
export type AssignmentEnvironmentGrant = z.infer<typeof assignmentEnvironmentGrantSchema>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const identifier = z.string().regex(/^[a-z][a-z0-9._-]{0,127}$/u);
|
|
3
|
+
const digest = z.string().regex(/^sha256:[a-f0-9]{64}$/u);
|
|
4
|
+
const variableName = z.string().regex(/^[A-Z_][A-Z0-9_]*$/u);
|
|
5
|
+
const maximumGrantLifetimeMs = 24 * 60 * 60 * 1e3;
|
|
6
|
+
const providerRegistrationCodeStatusSchema = z.object({
|
|
7
|
+
schemaVersion: z.literal("treeseed.provider-registration-code-status/v1"),
|
|
8
|
+
teamId: z.string().min(1),
|
|
9
|
+
generation: z.number().int().positive(),
|
|
10
|
+
codePrefix: z.string().min(1),
|
|
11
|
+
rotatedAt: z.string().datetime()
|
|
12
|
+
}).strict();
|
|
13
|
+
const providerRegistrationCodeReceiptSchema = z.object({
|
|
14
|
+
schemaVersion: z.literal("treeseed.provider-registration-code-receipt/v1"),
|
|
15
|
+
teamId: z.string().min(1),
|
|
16
|
+
generation: z.number().int().positive(),
|
|
17
|
+
codePrefix: z.string().min(1),
|
|
18
|
+
registrationCode: z.string().min(16),
|
|
19
|
+
rotatedAt: z.string().datetime()
|
|
20
|
+
}).strict();
|
|
21
|
+
const providerEnvironmentVariableDescriptorSchema = z.object({
|
|
22
|
+
name: variableName,
|
|
23
|
+
available: z.boolean(),
|
|
24
|
+
rotatedAt: z.string().datetime().optional()
|
|
25
|
+
}).strict();
|
|
26
|
+
const providerEnvironmentProfileDescriptorSchema = z.object({
|
|
27
|
+
schemaVersion: z.literal("treeseed.provider-environment-profile/v1"),
|
|
28
|
+
id: identifier,
|
|
29
|
+
generation: z.number().int().positive(),
|
|
30
|
+
variables: z.array(providerEnvironmentVariableDescriptorSchema),
|
|
31
|
+
updatedAt: z.string().datetime()
|
|
32
|
+
}).strict().superRefine((profile, context) => {
|
|
33
|
+
const names = /* @__PURE__ */ new Set();
|
|
34
|
+
for (const [index, variable] of profile.variables.entries()) {
|
|
35
|
+
if (names.has(variable.name)) context.addIssue({ code: z.ZodIssueCode.custom, path: ["variables", index, "name"], message: "Environment variable names must be unique within a profile." });
|
|
36
|
+
names.add(variable.name);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const assignmentEnvironmentGrantSchema = z.object({
|
|
40
|
+
schemaVersion: z.literal("treeseed.assignment-environment-grant/v1"),
|
|
41
|
+
grantId: identifier,
|
|
42
|
+
assignmentId: z.string().min(1),
|
|
43
|
+
providerId: z.string().min(1),
|
|
44
|
+
teamId: z.string().min(1),
|
|
45
|
+
projectId: z.string().min(1),
|
|
46
|
+
profileId: identifier,
|
|
47
|
+
variables: z.array(variableName).min(1),
|
|
48
|
+
network: z.object({ allowed: z.boolean(), destinations: z.array(z.string().min(1)) }).strict(),
|
|
49
|
+
policy: z.object({
|
|
50
|
+
handlerDeclarationDigest: digest,
|
|
51
|
+
providerOfferDigest: digest,
|
|
52
|
+
providerPermissionDigest: digest,
|
|
53
|
+
teamApprovalDigest: digest,
|
|
54
|
+
assignmentGrantDigest: digest,
|
|
55
|
+
sandboxPolicyDigest: digest
|
|
56
|
+
}).strict(),
|
|
57
|
+
issuedAt: z.string().datetime(),
|
|
58
|
+
expiresAt: z.string().datetime()
|
|
59
|
+
}).strict().superRefine((grant, context) => {
|
|
60
|
+
if (new Set(grant.variables).size !== grant.variables.length) context.addIssue({ code: z.ZodIssueCode.custom, path: ["variables"], message: "Granted environment variables must be unique." });
|
|
61
|
+
if (Date.parse(grant.expiresAt) <= Date.parse(grant.issuedAt)) context.addIssue({ code: z.ZodIssueCode.custom, path: ["expiresAt"], message: "Environment grants must expire after issuance." });
|
|
62
|
+
if (Date.parse(grant.expiresAt) - Date.parse(grant.issuedAt) > maximumGrantLifetimeMs) context.addIssue({ code: z.ZodIssueCode.custom, path: ["expiresAt"], message: "Environment grants cannot exceed 24 hours." });
|
|
63
|
+
if (!grant.network.allowed && grant.network.destinations.length) context.addIssue({ code: z.ZodIssueCode.custom, path: ["network", "destinations"], message: "Denied network authority cannot declare destinations." });
|
|
64
|
+
});
|
|
65
|
+
export {
|
|
66
|
+
assignmentEnvironmentGrantSchema,
|
|
67
|
+
providerEnvironmentProfileDescriptorSchema,
|
|
68
|
+
providerEnvironmentVariableDescriptorSchema,
|
|
69
|
+
providerRegistrationCodeReceiptSchema,
|
|
70
|
+
providerRegistrationCodeStatusSchema
|
|
71
|
+
};
|