@treeseed/sdk 0.13.0-rc.13 → 0.13.0-rc.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -9
- package/dist/accounts/account-contracts.d.ts +6 -0
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.d.ts +5485 -0
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.js +242 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +304 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.js +44 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.d.ts +2 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.js +13 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.d.ts +23 -60
- package/dist/agent-capacity/contracts/capacity/assignments/context-pack-compiler.d.ts +25 -0
- package/dist/agent-capacity/contracts/capacity/assignments/context-pack-compiler.js +67 -0
- package/dist/agent-capacity/contracts/capacity/communication/communication-records.d.ts +1 -1
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.d.ts +126 -3
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.js +35 -1
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.d.ts +80 -0
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.js +121 -0
- package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.d.ts +103 -0
- package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.js +51 -0
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.d.ts +490 -0
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.js +170 -0
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +210 -91
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.js +19 -0
- package/dist/agent-capacity/contracts/configuration/configuration.d.ts +1 -1
- package/dist/agent-capacity/contracts/configuration/configuration.js +1 -3
- package/dist/agent-capacity/contracts/operations/agent-team-clone.d.ts +218 -0
- package/dist/agent-capacity/contracts/operations/agent-team-clone.js +57 -0
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.d.ts +119 -24
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.js +16 -0
- package/dist/agent-capacity/contracts/runtime/runtime-observability.d.ts +2 -154
- package/dist/agent-capacity/contracts/support/agent-atlas.d.ts +0 -13
- package/dist/agent-capacity/contracts/support/execution-graph.d.ts +1291 -0
- package/dist/agent-capacity/contracts/support/execution-graph.js +122 -0
- package/dist/agent-capacity/contracts/support/financial-records.d.ts +3 -6
- package/dist/agent-capacity/contracts/support/planning-records.d.ts +1 -87
- package/dist/agent-capacity/contracts/support/time-capacity.d.ts +0 -14
- package/dist/agent-capacity/contracts/support/time-capacity.js +1 -8
- package/dist/agent-capacity/grant.d.ts +34 -0
- package/dist/agent-capacity/grant.js +4 -0
- package/dist/agent-capacity/validation/activity-profile.d.ts +1 -1
- package/dist/agent-capacity/validation/activity-profile.js +3 -259
- package/dist/agent-capacity/validation/agent-definition-schema.d.ts +2538 -9020
- package/dist/agent-capacity/validation/agent-definition-schema.js +59 -181
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +25 -25
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.js +0 -1
- package/dist/agent-capacity/validation/assignment-records.d.ts +1 -6
- package/dist/agent-capacity/validation/assignment-records.js +49 -35
- package/dist/agent-capacity/validation/configuration.d.ts +1 -1
- package/dist/agent-capacity/validation/configuration.js +2 -7
- package/dist/agent-capacity/validation/execution/execution-graph.d.ts +1 -0
- package/dist/agent-capacity/validation/execution/execution-graph.js +16 -0
- package/dist/agent-capacity/validation/grant.d.ts +11 -0
- package/dist/agent-capacity/validation/grant.js +31 -0
- package/dist/agent-capacity/validation/index.d.ts +2 -1
- package/dist/agent-capacity/validation/index.js +2 -1
- package/dist/agent-capacity/workday.d.ts +13 -4
- package/dist/agent-capacity/workday.js +10 -26
- package/dist/capacity/agents/agent-capacity.d.ts +11 -4
- package/dist/capacity/agents/agent-capacity.js +9 -3
- package/dist/capacity-provider/capability-ontology.d.ts +1495 -0
- package/dist/capacity-provider/capability-ontology.js +221 -0
- package/dist/capacity-provider/client.d.ts +78 -3
- package/dist/capacity-provider/client.js +22 -10
- package/dist/capacity-provider/contracts/capacity-facts.d.ts +13 -0
- package/dist/capacity-provider/contracts/environment-profiles.d.ts +255 -0
- package/dist/capacity-provider/contracts/environment-profiles.js +71 -0
- package/dist/capacity-provider/contracts/governance.d.ts +110 -51
- package/dist/capacity-provider/contracts/index.d.ts +3 -0
- package/dist/capacity-provider/contracts/index.js +3 -0
- package/dist/capacity-provider/core-capability-catalog.d.ts +47 -0
- package/dist/capacity-provider/core-capability-catalog.js +49 -0
- package/dist/capacity-provider/environment-catalog.d.ts +877 -0
- package/dist/capacity-provider/environment-catalog.js +116 -0
- package/dist/capacity-provider/index.d.ts +5 -0
- package/dist/capacity-provider/index.js +5 -0
- package/dist/capacity-provider/install-configuration.d.ts +39 -0
- package/dist/capacity-provider/install-configuration.js +18 -0
- package/dist/capacity-provider/sandbox-contracts.d.ts +602 -0
- package/dist/capacity-provider/sandbox-contracts.js +90 -0
- package/dist/capacity-provider/sandbox.d.ts +2 -0
- package/dist/capacity-provider/sandbox.js +2 -0
- package/dist/capacity-provider/source-workspace.d.ts +740 -0
- package/dist/capacity-provider/source-workspace.js +130 -0
- package/dist/capacity-provider/validation.d.ts +11 -3
- package/dist/capacity-provider/validation.js +136 -70
- package/dist/configuration/secrets-capability.d.ts +5 -1
- package/dist/configuration/secrets-capability.js +5 -1
- package/dist/content/contracts.d.ts +1 -1
- package/dist/content/validation/agent-operational-content-schemas.d.ts +430 -777
- package/dist/content/validation/agent-operational-content-schemas.js +31 -57
- package/dist/content/validation/auxiliary-content-schemas.d.ts +144 -144
- package/dist/content/validation/content-model-schemas.d.ts +16063 -19764
- package/dist/content/validation/content-model-schemas.js +350 -98
- package/dist/content/validation/portable-content-data.d.ts +751 -1782
- package/dist/content/validation/portable-content-data.js +10 -4
- package/dist/content/validation/schema-constraints.d.ts +80 -0
- package/dist/content/validation/schema-constraints.js +173 -0
- package/dist/deployment/ai/storage.d.ts +158 -0
- package/dist/deployment/ai/storage.js +32 -0
- package/dist/deployment/ai-hosting.d.ts +297 -0
- package/dist/deployment/ai-hosting.js +63 -0
- package/dist/deployment/ai-instance.d.ts +65 -0
- package/dist/deployment/ai-instance.js +30 -0
- package/dist/deployment/ai-mode.d.ts +454 -0
- package/dist/deployment/ai-mode.js +67 -0
- package/dist/deployment/canonical.d.ts +2 -0
- package/dist/deployment/canonical.js +17 -0
- package/dist/deployment/catalog.d.ts +16 -0
- package/dist/deployment/catalog.js +48 -0
- package/dist/deployment/hosted-topology-template.d.ts +449 -0
- package/dist/deployment/hosted-topology-template.js +56 -0
- package/dist/deployment/hosted-topology.d.ts +2698 -0
- package/dist/deployment/hosted-topology.js +468 -0
- package/dist/deployment/index.d.ts +13 -0
- package/dist/deployment/index.js +13 -0
- package/dist/deployment/postgres/contracts.d.ts +418 -0
- package/dist/deployment/postgres/contracts.js +83 -0
- package/dist/deployment/postgres/requirements.d.ts +15 -0
- package/dist/deployment/postgres/requirements.js +32 -0
- package/dist/deployment/postgres/transfer.d.ts +97 -0
- package/dist/deployment/postgres/transfer.js +29 -0
- package/dist/deployment/schemas.d.ts +8625 -0
- package/dist/deployment/schemas.js +455 -0
- package/dist/deployment/topology.d.ts +9 -0
- package/dist/deployment/topology.js +35 -0
- package/dist/development/index.d.ts +1 -0
- package/dist/development/index.js +1 -0
- package/dist/development/schemas.d.ts +3594 -0
- package/dist/development/schemas.js +204 -0
- package/dist/development/session-migration.d.ts +3 -0
- package/dist/development/session-migration.js +25 -0
- package/dist/entrypoints/clients/control-plane-client.d.ts +9 -1
- package/dist/entrypoints/clients/control-plane-client.js +17 -5
- package/dist/graph/context-query-contracts.d.ts +16 -1
- package/dist/graph/context-query-contracts.js +6 -1
- package/dist/guarantees/evidence-trust.d.ts +32 -0
- package/dist/guarantees/evidence-trust.js +47 -0
- package/dist/guarantees/index.d.ts +154 -0
- package/dist/guarantees/index.js +44 -0
- package/dist/identity/browser-session.d.ts +233 -0
- package/dist/identity/browser-session.js +51 -0
- package/dist/identity/contracts.d.ts +191 -0
- package/dist/identity/contracts.js +77 -0
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.js +3 -0
- package/dist/identity/runtime.d.ts +186 -0
- package/dist/identity/runtime.js +49 -0
- package/dist/knowledge/contracts.d.ts +9 -2
- package/dist/knowledge/contracts.js +2 -2
- package/dist/model-registry/agent-operational-models.d.ts +1 -1
- package/dist/model-registry/agent-operational-models.js +1 -4
- package/dist/model-registry/build-builtin-model-registry.js +44 -72
- package/dist/model-registry/discussion-models.js +0 -1
- package/dist/operator-contracts/canonical-command-tree.js +415 -44
- package/dist/operator-contracts/catalog/admin-account-team-operations.d.ts +36 -0
- package/dist/operator-contracts/catalog/admin-account-team-operations.js +52 -0
- package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.d.ts +75 -0
- package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.js +42 -0
- package/dist/operator-contracts/catalog/capability-ontology-operations.d.ts +163 -0
- package/dist/operator-contracts/catalog/capability-ontology-operations.js +24 -0
- package/dist/operator-contracts/catalog/commands/command-tree-builders.d.ts +62 -0
- package/dist/operator-contracts/catalog/commands/command-tree-builders.js +191 -0
- package/dist/operator-contracts/catalog/communication-operations.d.ts +457 -0
- package/dist/operator-contracts/catalog/communication-operations.js +92 -0
- package/dist/operator-contracts/catalog/control-plane-catalog.d.ts +6 -0
- package/dist/operator-contracts/catalog/control-plane-catalog.js +18 -0
- package/dist/operator-contracts/catalog/execution/execution-operations.d.ts +36 -0
- package/dist/operator-contracts/catalog/execution/execution-operations.js +39 -0
- package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +399 -0
- package/dist/operator-contracts/catalog/hosted-topology-operations.js +79 -0
- package/dist/operator-contracts/catalog/inbox-operations.d.ts +265 -0
- package/dist/operator-contracts/catalog/inbox-operations.js +36 -0
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.d.ts +53 -0
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.js +24 -0
- package/dist/operator-contracts/catalog/infrastructure/command-tree-paths.d.ts +3 -0
- package/dist/operator-contracts/catalog/infrastructure/command-tree-paths.js +15 -0
- package/dist/operator-contracts/catalog/knowledge-share-operations.d.ts +127 -0
- package/dist/operator-contracts/catalog/knowledge-share-operations.js +25 -0
- package/dist/operator-contracts/catalog/provider-environment-commands.d.ts +4 -0
- package/dist/operator-contracts/catalog/provider-environment-commands.js +69 -0
- package/dist/operator-contracts/catalog/provider-environment-operations.d.ts +41 -0
- package/dist/operator-contracts/catalog/provider-environment-operations.js +61 -0
- package/dist/operator-contracts/catalog/services/identity-commands.d.ts +2 -0
- package/dist/operator-contracts/catalog/services/identity-commands.js +13 -0
- package/dist/operator-contracts/catalog/services/secret-commands.d.ts +2 -0
- package/dist/operator-contracts/catalog/services/secret-commands.js +31 -0
- package/dist/operator-contracts/catalog/services/secret-operations.d.ts +70 -0
- package/dist/operator-contracts/catalog/services/secret-operations.js +52 -0
- package/dist/operator-contracts/catalog/treeai-operations.d.ts +13 -0
- package/dist/operator-contracts/catalog/treeai-operations.js +61 -0
- package/dist/operator-contracts/catalog/workdays/profile-commands.d.ts +4 -0
- package/dist/operator-contracts/catalog/workdays/profile-commands.js +20 -0
- package/dist/operator-contracts/catalog/workdays/profile-operations.d.ts +41 -0
- package/dist/operator-contracts/catalog/workdays/profile-operations.js +50 -0
- package/dist/operator-contracts/catalog/workdays/selection-commands.d.ts +3 -0
- package/dist/operator-contracts/catalog/workdays/selection-commands.js +28 -0
- package/dist/operator-contracts/command-tree.d.ts +29 -0
- package/dist/operator-contracts/command-tree.js +50 -0
- package/dist/operator-contracts/communication/addressing.d.ts +8 -0
- package/dist/operator-contracts/communication/addressing.js +57 -0
- package/dist/operator-contracts/communication/contracts.d.ts +1966 -0
- package/dist/operator-contracts/communication/contracts.js +195 -0
- package/dist/operator-contracts/control-plane-operation.d.ts +15 -1
- package/dist/operator-contracts/control-plane-operation.js +14 -6
- package/dist/operator-contracts/control-plane-operations.d.ts +2496 -328
- package/dist/operator-contracts/control-plane-operations.js +280 -127
- package/dist/operator-contracts/inbox/contracts.d.ts +1111 -0
- package/dist/operator-contracts/inbox/contracts.js +138 -0
- package/dist/operator-contracts/index.d.ts +6 -1
- package/dist/operator-contracts/index.js +6 -1
- package/dist/operator-contracts/knowledge/contracts.d.ts +130 -0
- package/dist/operator-contracts/knowledge/contracts.js +39 -0
- package/dist/operator-contracts/mcp.d.ts +5 -0
- package/dist/operator-contracts/mcp.js +62 -0
- package/dist/operator-contracts/oauth.d.ts +45 -0
- package/dist/operator-contracts/oauth.js +7 -0
- package/dist/operator-contracts/operation-builder.d.ts +18 -0
- package/dist/operator-contracts/operation-builder.js +78 -0
- package/dist/operator-contracts/seed/seed-bundle.d.ts +138 -0
- package/dist/operator-contracts/seed/seed-bundle.js +68 -0
- package/dist/operator-contracts/workday-lifecycle.d.ts +383 -28
- package/dist/operator-contracts/workday-lifecycle.js +124 -17
- package/dist/platform/agent-schema-verification.d.ts +3 -0
- package/dist/platform/agent-schema-verification.js +377 -0
- package/dist/platform/contracts.d.ts +429 -0
- package/dist/platform/contracts.js +93 -0
- package/dist/platform/index.d.ts +6 -0
- package/dist/platform/index.js +6 -0
- package/dist/platform/inventory.d.ts +11 -0
- package/dist/platform/inventory.js +53 -0
- package/dist/platform/project-create.d.ts +49 -0
- package/dist/platform/project-create.js +75 -0
- package/dist/platform/schemas.d.ts +1094 -0
- package/dist/platform/schemas.js +99 -0
- package/dist/platform/verification.d.ts +9 -0
- package/dist/platform/verification.js +114 -0
- package/dist/platform/workset.d.ts +21 -0
- package/dist/platform/workset.js +106 -0
- package/dist/sdk-types/support/planning-policy.d.ts +1 -1
- package/dist/sdk-types/support/sdk-model-names.d.ts +1 -1
- package/dist/sdk-types/support/sdk-model-names.js +0 -3
- package/dist/sdk-types/support/sdk-search-request.d.ts +2 -2
- package/dist/secrets-capability/github-actions-encryption.d.ts +2 -0
- package/dist/secrets-capability/github-actions-encryption.js +11 -0
- package/dist/secrets-capability/provider-operation-contracts.d.ts +15 -1
- package/dist/secrets-capability/secret-contracts.d.ts +33 -0
- package/dist/secrets-capability/secret-contracts.js +49 -0
- package/dist/secrets-capability/service-provider-contracts.d.ts +5 -3
- package/dist/secrets-capability/service-provider-contracts.js +66 -50
- package/dist/secrets-capability/shared-access.d.ts +51 -0
- package/dist/secrets-capability/shared-access.js +36 -0
- package/dist/secrets-capability/shared-resources.d.ts +376 -0
- package/dist/secrets-capability/shared-resources.js +91 -0
- package/dist/secrets-capability/vault-contracts.d.ts +132 -0
- package/dist/secrets-capability/vault-contracts.js +56 -0
- package/dist/security/encrypted-envelope.d.ts +177 -0
- package/dist/security/encrypted-envelope.js +34 -0
- package/dist/security/envelope-codec.d.ts +38 -0
- package/dist/security/envelope-codec.js +96 -0
- package/dist/security/index.d.ts +2 -0
- package/dist/security/index.js +2 -0
- package/dist/site-contracts/catalog.d.ts +16 -0
- package/dist/site-contracts/catalog.js +19 -0
- package/dist/site-contracts/cloudflare.d.ts +48 -0
- package/dist/site-contracts/platform.d.ts +94 -0
- package/dist/site-contracts/plugin.d.ts +63 -0
- package/dist/site-contracts/plugin.js +26 -0
- package/dist/treeai/catalog.d.ts +1 -0
- package/dist/treeai/catalog.js +1 -0
- package/dist/treeai/client.d.ts +793 -0
- package/dist/treeai/client.js +44 -0
- package/dist/treeai/contract.d.ts +41 -0
- package/dist/treeai/contract.js +51 -0
- package/dist/treeai/generated/upstream.d.ts +770 -0
- package/dist/treeai/generated/upstream.js +4 -0
- package/dist/treeai/index.d.ts +4 -0
- package/dist/treeai/index.js +4 -0
- package/dist/treedx/client.d.ts +605 -0
- package/dist/treedx/client.js +39 -0
- package/dist/treedx/contract.d.ts +32 -0
- package/dist/treedx/contract.js +63 -0
- package/dist/treedx/index.d.ts +3 -0
- package/dist/treedx/index.js +3 -0
- package/dist/treedx/types.d.ts +294 -7
- package/dist/treedx/types.js +44 -7
- package/dist/types/agents/agent-activity-profile.d.ts +43 -98
- package/dist/types/agents/agent-activity-profile.js +23 -0
- package/dist/types/agents/agent-trigger-kinds.d.ts +3 -5
- package/dist/types/agents/agent-trigger-kinds.js +1 -13
- package/dist/types/agents/execution-run-ref.d.ts +1 -8
- package/guarantees/agent/golden/component-boundaries.guarantee.yaml +12 -0
- package/guarantees/agent/golden/product-custody.guarantee.yaml +12 -0
- package/guarantees/agent/golden/product.guarantee.yaml +12 -0
- package/guarantees/agent/golden/scenes/component-boundaries.scene.yaml +858 -0
- package/guarantees/agent/golden/scenes/product-custody.scene.yaml +53 -0
- package/guarantees/agent/golden/scenes/product.scene.yaml +8 -0
- package/guarantees/verifiers/golden.verifiers.yaml +1464 -0
- package/package.json +72 -13
- package/tests/acceptance/golden-product.test.ts +205 -0
- package/tests/acceptance/golden-product.ts +404 -0
- package/tests/acceptance/product/base-red.ts +73 -0
- package/tests/acceptance/product/documentation-examples.ts +68 -0
- package/tests/acceptance/product/intent-runtime.ts +145 -0
- package/tests/acceptance/product/release-output.ts +160 -0
- package/tests/acceptance/product/research-artifact.ts +87 -0
- package/tests/acceptance/product/research-revision.ts +82 -0
- package/tests/acceptance/product/research-source.ts +91 -0
- package/tests/acceptance/product/test-chain.ts +192 -0
- package/treeseed.package.yaml +147 -0
- package/dist/agent-capacity/allocation.d.ts +0 -186
- package/dist/agent-capacity/allocation.js +0 -226
- package/dist/agent-capacity/artifact-mutation-receipt.d.ts +0 -49
- package/dist/agent-capacity/artifact-mutation-receipt.js +0 -36
- package/dist/agent-capacity/artifacts.d.ts +0 -107
- package/dist/agent-capacity/artifacts.js +0 -39
- package/dist/agent-capacity/authority/agent-authority-presets.d.ts +0 -13
- package/dist/agent-capacity/authority/agent-authority-presets.js +0 -106
- package/dist/agent-capacity/contracts/operations/workflow-promotion.d.ts +0 -24
- package/dist/agent-capacity/contracts/support/decision-work.d.ts +0 -251
- package/dist/agent-capacity/policy/capacity/allocations/allocation-hierarchy.d.ts +0 -29
- package/dist/agent-capacity/policy/capacity/allocations/allocation-hierarchy.js +0 -110
- package/dist/agent-capacity/validation/allocation.d.ts +0 -12
- package/dist/agent-capacity/validation/allocation.js +0 -115
- package/dist/agent-capacity/validation/workflow-promotion.d.ts +0 -2
- package/dist/agent-capacity/validation/workflow-promotion.js +0 -34
- package/dist/operator-contracts/workday-profile.d.ts +0 -72
- package/dist/operator-contracts/workday-profile.js +0 -106
- package/dist/secrets-capability/service-vault-contracts.d.ts +0 -61
- package/dist/secrets-capability/service-vault-contracts.js +0 -39
- package/dist/treedx/accounts/auth.d.ts +0 -17
- package/dist/treedx/accounts/auth.js +0 -48
- package/dist/treedx/client/accounts/contracts/auth-mode.d.ts +0 -3
- package/dist/treedx/client/accounts/contracts/auth-mode.js +0 -6
- package/dist/treedx/client/build/creation/build-context.d.ts +0 -3
- package/dist/treedx/client/build/creation/build-context.js +0 -7
- package/dist/treedx/client/build/creation/build-snapshot.d.ts +0 -3
- package/dist/treedx/client/build/creation/build-snapshot.js +0 -8
- package/dist/treedx/client/capacity/allocations/contracts/put-capability-grant.d.ts +0 -3
- package/dist/treedx/client/capacity/allocations/contracts/put-capability-grant.js +0 -7
- package/dist/treedx/client/capacity/allocations/queries/list-capability-grants.d.ts +0 -6
- package/dist/treedx/client/capacity/allocations/queries/list-capability-grants.js +0 -10
- package/dist/treedx/client/methods.d.ts +0 -102
- package/dist/treedx/client/methods.js +0 -209
- package/dist/treedx/client/persistence/contracts/restore-storage.d.ts +0 -3
- package/dist/treedx/client/persistence/contracts/restore-storage.js +0 -6
- package/dist/treedx/client/persistence/lifecycle/verify-storage-restore.d.ts +0 -3
- package/dist/treedx/client/persistence/lifecycle/verify-storage-restore.js +0 -6
- package/dist/treedx/client/repositories/creation/register-repository.d.ts +0 -3
- package/dist/treedx/client/repositories/creation/register-repository.js +0 -7
- package/dist/treedx/client/repositories/queries/get-repository.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/get-repository.js +0 -7
- package/dist/treedx/client/repositories/queries/list-repository-paths.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/list-repository-paths.js +0 -7
- package/dist/treedx/client/repositories/queries/list-repository-refs.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/list-repository-refs.js +0 -12
- package/dist/treedx/client/repositories/queries/query-repository.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/query-repository.js +0 -7
- package/dist/treedx/client/repositories/queries/read-repository-file.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/read-repository-file.js +0 -6
- package/dist/treedx/client/repositories/queries/read-repository-files.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/read-repository-files.js +0 -7
- package/dist/treedx/client/repositories/queries/search-repository-files.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/search-repository-files.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/artifacts/contracts/download-artifact.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/artifacts/contracts/download-artifact.js +0 -9
- package/dist/treedx/client/support/contracts/treedx/authorization/contracts/whoami.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/authorization/contracts/whoami.js +0 -6
- package/dist/treedx/client/support/contracts/treedx/graph/contracts/parse-context-dsl.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/graph/contracts/parse-context-dsl.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/health/contracts/deep-health.d.ts +0 -5
- package/dist/treedx/client/support/contracts/treedx/health/contracts/deep-health.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/health/contracts/health.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/health/contracts/health.js +0 -6
- package/dist/treedx/client/support/contracts/treedx/health/contracts/metrics.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/health/contracts/metrics.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/health/contracts/prometheus-metrics.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/health/contracts/prometheus-metrics.js +0 -19
- package/dist/treedx/client/support/contracts/treedx/health/contracts/ready.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/health/contracts/ready.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/health/contracts/status.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/health/contracts/status.js +0 -6
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/commit.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/commit.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/diff.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/diff.js +0 -6
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/fetch-remote.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/fetch-remote.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/push.d.ts +0 -6
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/push.js +0 -23
- package/dist/treedx/client/support/contracts/treedx/search/contracts/compact-search-index.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/search/contracts/compact-search-index.js +0 -8
- package/dist/treedx/client/support/contracts/treedx/search/contracts/search.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/search/contracts/search.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/backup-storage.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/backup-storage.js +0 -8
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/compact-storage.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/compact-storage.js +0 -8
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/assert-binary-ok.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/assert-binary-ok.js +0 -15
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/fetch-with-timeout.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/fetch-with-timeout.js +0 -38
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/headers.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/headers.js +0 -15
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/parse-json-response.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/parse-json-response.js +0 -15
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/query.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/query.js +0 -14
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/repo-id.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/repo-id.js +0 -14
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/request.d.ts +0 -6
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/request.js +0 -41
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/throw-api-error.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/throw-api-error.js +0 -14
- package/dist/treedx/client/support/contracts/treedx/workspaces/contracts/exec.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/workspaces/contracts/exec.js +0 -7
- package/dist/treedx/client/support/creation/apply-changeset.d.ts +0 -3
- package/dist/treedx/client/support/creation/apply-changeset.js +0 -10
- package/dist/treedx/client/support/creation/apply-storage-migration.d.ts +0 -3
- package/dist/treedx/client/support/creation/apply-storage-migration.js +0 -7
- package/dist/treedx/client/support/creation/create-migration.d.ts +0 -6
- package/dist/treedx/client/support/creation/create-migration.js +0 -7
- package/dist/treedx/client/support/creation/export-artifact.d.ts +0 -3
- package/dist/treedx/client/support/creation/export-artifact.js +0 -8
- package/dist/treedx/client/support/creation/plan-storage-migration.d.ts +0 -3
- package/dist/treedx/client/support/creation/plan-storage-migration.js +0 -7
- package/dist/treedx/client/support/creation/request-binary.d.ts +0 -6
- package/dist/treedx/client/support/creation/request-binary.js +0 -42
- package/dist/treedx/client/support/creation/write-file.d.ts +0 -3
- package/dist/treedx/client/support/creation/write-file.js +0 -10
- package/dist/treedx/client/support/creation/write-files.d.ts +0 -3
- package/dist/treedx/client/support/creation/write-files.js +0 -12
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/get-artifact.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/get-artifact.js +0 -7
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/list-artifacts.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/list-artifacts.js +0 -7
- package/dist/treedx/client/support/queries/treedx/authorization/queries/effective-scope.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/authorization/queries/effective-scope.js +0 -9
- package/dist/treedx/client/support/queries/treedx/authorization/queries/list-capabilities.d.ts +0 -4
- package/dist/treedx/client/support/queries/treedx/authorization/queries/list-capabilities.js +0 -6
- package/dist/treedx/client/support/queries/treedx/federation/queries/get-placement.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/federation/queries/get-placement.js +0 -7
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-node.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-node.js +0 -7
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-related.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-related.js +0 -7
- package/dist/treedx/client/support/queries/treedx/graph/queries/list-nodes.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/graph/queries/list-nodes.js +0 -7
- package/dist/treedx/client/support/queries/treedx/repositories/queries/list-tree.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/repositories/queries/list-tree.js +0 -10
- package/dist/treedx/client/support/queries/treedx/repositories/queries/read-file.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/repositories/queries/read-file.js +0 -9
- package/dist/treedx/client/support/queries/treedx/search/queries/get-search-index-status.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/search/queries/get-search-index-status.js +0 -7
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-migration.d.ts +0 -6
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-migration.js +0 -7
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-snapshot.d.ts +0 -6
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-snapshot.js +0 -7
- package/dist/treedx/client/support/queries/treedx/storage/queries/list-storage-migrations.d.ts +0 -6
- package/dist/treedx/client/support/queries/treedx/storage/queries/list-storage-migrations.js +0 -6
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-audit-events.d.ts +0 -15
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-audit-events.js +0 -6
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-repositories.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-repositories.js +0 -7
- package/dist/treedx/client/support/retirement/cleanup-artifacts.d.ts +0 -3
- package/dist/treedx/client/support/retirement/cleanup-artifacts.js +0 -7
- package/dist/treedx/client/support/retirement/delete-artifact.d.ts +0 -3
- package/dist/treedx/client/support/retirement/delete-artifact.js +0 -7
- package/dist/treedx/client/support/retirement/delete-file.d.ts +0 -3
- package/dist/treedx/client/support/retirement/delete-file.js +0 -10
- package/dist/treedx/client/support/retirement/rollback-storage-migration.d.ts +0 -3
- package/dist/treedx/client/support/retirement/rollback-storage-migration.js +0 -7
- package/dist/treedx/client/support/updates/patch-file.d.ts +0 -3
- package/dist/treedx/client/support/updates/patch-file.js +0 -10
- package/dist/treedx/client/support/updates/refresh-search-index.d.ts +0 -3
- package/dist/treedx/client/support/updates/refresh-search-index.js +0 -8
- package/dist/treedx/client/treedx/blobs/contracts/download-blob.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/contracts/download-blob.js +0 -6
- package/dist/treedx/client/treedx/blobs/creation/create-blob-upload.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/create-blob-upload.js +0 -8
- package/dist/treedx/client/treedx/blobs/creation/request-blob-download.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/request-blob-download.js +0 -27
- package/dist/treedx/client/treedx/blobs/creation/request-blob-upload.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/request-blob-upload.js +0 -41
- package/dist/treedx/client/treedx/blobs/creation/upload-blob-part.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/upload-blob-part.js +0 -27
- package/dist/treedx/client/treedx/blobs/creation/upload-blob.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/upload-blob.js +0 -6
- package/dist/treedx/client/treedx/blobs/creation/write-blob.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/write-blob.js +0 -8
- package/dist/treedx/client/treedx/blobs/lifecycle/complete-blob-upload.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/lifecycle/complete-blob-upload.js +0 -8
- package/dist/treedx/client/treedx/blobs/queries/read-blob.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/queries/read-blob.js +0 -10
- package/dist/treedx/client/treedx/blobs/retirement/abort-blob-upload.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/retirement/abort-blob-upload.js +0 -7
- package/dist/treedx/client/treedx/blobs/retirement/delete-blob.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/retirement/delete-blob.js +0 -8
- package/dist/treedx/client/treedx/federation/contracts/federated-query.d.ts +0 -3
- package/dist/treedx/client/treedx/federation/contracts/federated-query.js +0 -7
- package/dist/treedx/client/treedx/federation/creation/plan-federated-query.d.ts +0 -3
- package/dist/treedx/client/treedx/federation/creation/plan-federated-query.js +0 -6
- package/dist/treedx/client/treedx/federation/queries/check-mirror-health.d.ts +0 -3
- package/dist/treedx/client/treedx/federation/queries/check-mirror-health.js +0 -7
- package/dist/treedx/client/treedx/federation/updates/promote-mirror.d.ts +0 -3
- package/dist/treedx/client/treedx/federation/updates/promote-mirror.js +0 -7
- package/dist/treedx/client/treedx/federation/updates/sync-mirror.d.ts +0 -3
- package/dist/treedx/client/treedx/federation/updates/sync-mirror.js +0 -7
- package/dist/treedx/client/treedx/graph/contracts/federated-context.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/contracts/federated-context.js +0 -7
- package/dist/treedx/client/treedx/graph/contracts/federated-graph.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/contracts/federated-graph.js +0 -7
- package/dist/treedx/client/treedx/graph/contracts/graph-search.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/contracts/graph-search.js +0 -8
- package/dist/treedx/client/treedx/graph/queries/get-graph-node.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/get-graph-node.js +0 -10
- package/dist/treedx/client/treedx/graph/queries/get-graph-refresh-job.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/get-graph-refresh-job.js +0 -7
- package/dist/treedx/client/treedx/graph/queries/get-subgraph.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/get-subgraph.js +0 -7
- package/dist/treedx/client/treedx/graph/queries/query-graph.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/query-graph.js +0 -7
- package/dist/treedx/client/treedx/graph/queries/search-graph-entities.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/search-graph-entities.js +0 -6
- package/dist/treedx/client/treedx/graph/queries/search-graph-files.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/search-graph-files.js +0 -6
- package/dist/treedx/client/treedx/graph/queries/search-graph-sections.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/search-graph-sections.js +0 -6
- package/dist/treedx/client/treedx/graph/updates/refresh-graph.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/updates/refresh-graph.js +0 -7
- package/dist/treedx/client/treedx/search/contracts/federated-search.d.ts +0 -3
- package/dist/treedx/client/treedx/search/contracts/federated-search.js +0 -7
- package/dist/treedx/client/treedx/workspaces/creation/create-workspace.d.ts +0 -3
- package/dist/treedx/client/treedx/workspaces/creation/create-workspace.js +0 -7
- package/dist/treedx/client/treedx/workspaces/retirement/abandon-workspace.d.ts +0 -3
- package/dist/treedx/client/treedx/workspaces/retirement/abandon-workspace.js +0 -12
- package/dist/treedx/client/treedx/workspaces/retirement/close-workspace.d.ts +0 -2
- package/dist/treedx/client/treedx/workspaces/retirement/close-workspace.js +0 -6
- package/dist/treedx/generated/openapi-types.d.ts +0 -3662
- package/dist/treedx/generated/openapi-types.js +0 -0
- package/dist/treedx/support/client.d.ts +0 -251
- package/dist/treedx/support/client.js +0 -252
- package/dist/treedx/support/errors.d.ts +0 -13
- package/dist/treedx/support/errors.js +0 -17
- package/dist/treedx/types/tree-dx-actor.d.ts +0 -209
- package/dist/treedx/types/tree-dx-actor.js +0 -8
- package/dist/treedx/types/tree-dx-artifact-list-response.d.ts +0 -13
- package/dist/treedx/types/tree-dx-artifact-list-response.js +0 -0
- package/dist/treedx/types/tree-dx-changeset.d.ts +0 -51
- package/dist/treedx/types/tree-dx-changeset.js +0 -6
- package/dist/treedx/types/tree-dx-context-request.d.ts +0 -245
- package/dist/treedx/types/tree-dx-context-request.js +0 -0
- package/dist/treedx/types/tree-dx-exec-result.d.ts +0 -249
- package/dist/treedx/types/tree-dx-exec-result.js +0 -0
- package/dist/treedx/types/tree-dx-list-tree-request.d.ts +0 -222
- package/dist/treedx/types/tree-dx-list-tree-request.js +0 -0
- package/dist/treedx/types/tree-dx-push-request.d.ts +0 -229
- package/dist/treedx/types/tree-dx-push-request.js +0 -0
- /package/dist/{agent-capacity/contracts/operations/workflow-promotion.js → site-contracts/cloudflare.js} +0 -0
- /package/dist/{agent-capacity/contracts/support/decision-work.js → site-contracts/platform.js} +0 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export type AgentExecutionMode = 'planning' | 'acting';
|
|
2
|
-
|
|
2
|
+
import type { AgentWorkExecutionMode } from '../../support/authority/execution-mode.js';
|
|
3
3
|
export type ProviderAssignmentStatus = 'pending' | 'leased' | 'running' | 'completed' | 'failed' | 'returned' | 'expired' | 'cancelled';
|
|
4
4
|
export type ProviderAssignmentLeaseState = 'unleased' | 'leased' | 'released' | 'expired';
|
|
5
|
-
export type
|
|
6
|
-
export type ProviderAssignmentSynthesisSource = 'approved_decision' | 'planning_input_request' | 'capacity_plan' | 'workday_demand' | 'verification_failure' | 'fallback_queue';
|
|
5
|
+
export type ProviderAssignmentSynthesisSource = 'living_execution_graph';
|
|
7
6
|
export declare const AGENT_ASSIGNMENT_WORKSPACE_ACCESS_MODES: readonly ["context_only", "workspace_write", "brokered_workspace", "full_workspace_no_credentials", "trusted_direct"];
|
|
8
7
|
export type AgentAssignmentWorkspaceAccessMode = (typeof AGENT_ASSIGNMENT_WORKSPACE_ACCESS_MODES)[number];
|
|
9
8
|
export type AgentAssignmentCapabilityHandleKind = 'repository_access' | 'treedx_workspace' | 'workflow_operation' | 'secret_use';
|
|
@@ -14,7 +13,6 @@ export interface WorkdayCapacityEnvelope {
|
|
|
14
13
|
workDayId?: string | null;
|
|
15
14
|
environment?: string | null;
|
|
16
15
|
executionMode?: AgentWorkExecutionMode;
|
|
17
|
-
allocationSetId?: string | null;
|
|
18
16
|
availableSeconds?: number | null;
|
|
19
17
|
requestedSeconds?: number | null;
|
|
20
18
|
reservedSeconds?: number | null;
|
|
@@ -35,23 +33,6 @@ export interface AgentCapacityEnvelope extends WorkdayCapacityEnvelope {
|
|
|
35
33
|
reservedNativeAmount?: number | null;
|
|
36
34
|
limits?: Record<string, unknown>;
|
|
37
35
|
}
|
|
38
|
-
export interface DecisionExecutionInput {
|
|
39
|
-
teamId: string;
|
|
40
|
-
projectId: string;
|
|
41
|
-
projectAgentClassId: string;
|
|
42
|
-
mode: AgentExecutionMode;
|
|
43
|
-
executionMode?: AgentWorkExecutionMode;
|
|
44
|
-
activityType?: import('../../../../types/agents.js').AgentActivityType;
|
|
45
|
-
workGraphNodeId?: string | null;
|
|
46
|
-
estimateId?: string | null;
|
|
47
|
-
taskId?: string | null;
|
|
48
|
-
workDayId?: string | null;
|
|
49
|
-
agentId?: string | null;
|
|
50
|
-
handlerId?: string | null;
|
|
51
|
-
capacity: AgentCapacityEnvelope;
|
|
52
|
-
input: Record<string, unknown>;
|
|
53
|
-
metadata?: Record<string, unknown>;
|
|
54
|
-
}
|
|
55
36
|
export interface TreeDxProxyHandle {
|
|
56
37
|
id: string;
|
|
57
38
|
teamId: string;
|
|
@@ -59,6 +40,7 @@ export interface TreeDxProxyHandle {
|
|
|
59
40
|
assignmentId?: string | null;
|
|
60
41
|
executionMode?: AgentWorkExecutionMode;
|
|
61
42
|
repositoryId?: string | null;
|
|
43
|
+
repositoryProjectId?: string | null;
|
|
62
44
|
workspaceId?: string | null;
|
|
63
45
|
baseCommitSha?: string | null;
|
|
64
46
|
baseRef?: string | null;
|
|
@@ -75,6 +57,15 @@ export interface TreeDxProxyHandle {
|
|
|
75
57
|
allowedPaths?: string[];
|
|
76
58
|
allowedReadPaths?: string[];
|
|
77
59
|
allowedWritePaths?: string[];
|
|
60
|
+
readRepositories?: Array<{
|
|
61
|
+
projectId: string;
|
|
62
|
+
projectSlug: string;
|
|
63
|
+
repositoryId: string;
|
|
64
|
+
baseRef: string;
|
|
65
|
+
allowedPaths: string[];
|
|
66
|
+
allowedModels: string[];
|
|
67
|
+
source: 'team-library' | 'same-team' | 'shared-team';
|
|
68
|
+
}>;
|
|
78
69
|
metadata?: Record<string, unknown>;
|
|
79
70
|
}
|
|
80
71
|
export interface ProviderAssignmentCapabilityHandleBase {
|
|
@@ -153,10 +144,10 @@ export interface ProviderAssignment {
|
|
|
153
144
|
parentWorkdayId?: string | null;
|
|
154
145
|
parentAssignmentId?: string | null;
|
|
155
146
|
handoffRootId?: string | null;
|
|
147
|
+
operationHandoffId?: string | null;
|
|
156
148
|
handoffParentId?: string | null;
|
|
157
149
|
handoffDepth?: number;
|
|
158
150
|
sourceMessageRefs?: string[];
|
|
159
|
-
allocationSetId: string | null;
|
|
160
151
|
projectAgentClassId: string;
|
|
161
152
|
reservationId: string | null;
|
|
162
153
|
workDayId: string | null;
|
|
@@ -172,7 +163,6 @@ export interface ProviderAssignment {
|
|
|
172
163
|
agentId: string | null;
|
|
173
164
|
handlerId: string | null;
|
|
174
165
|
capacityEnvelope: AgentCapacityEnvelope;
|
|
175
|
-
decisionInput: DecisionExecutionInput | Record<string, unknown>;
|
|
176
166
|
workspaceContext: Record<string, unknown>;
|
|
177
167
|
allowedOutputs: Record<string, unknown>;
|
|
178
168
|
explanation: Record<string, unknown>;
|
|
@@ -189,6 +179,11 @@ export interface ProviderAssignment {
|
|
|
189
179
|
synthesisKey: string | null;
|
|
190
180
|
decisionId: string | null;
|
|
191
181
|
proposalId: string | null;
|
|
182
|
+
graphRevision?: number | null;
|
|
183
|
+
executionNodeId?: string | null;
|
|
184
|
+
executionNodeRevision?: number | null;
|
|
185
|
+
assignmentAttempt?: import('./agent-execution.js').AssignmentAttempt | null;
|
|
186
|
+
assignmentResult?: import('./agent-execution.js').AssignmentResult | null;
|
|
192
187
|
fallbackOutputId: string | null;
|
|
193
188
|
treedxProxyHandle: TreeDxProxyHandle | Record<string, unknown> | null;
|
|
194
189
|
capabilityHandles: ProviderAssignmentCapabilityHandles | Record<string, unknown> | null;
|
|
@@ -197,6 +192,11 @@ export interface ProviderAssignment {
|
|
|
197
192
|
updatedAt: string;
|
|
198
193
|
}
|
|
199
194
|
export interface ProviderAssignmentLifecycleRequest {
|
|
195
|
+
activeSeconds?: number | null;
|
|
196
|
+
elapsedSeconds?: number | null;
|
|
197
|
+
actualUsd?: number | null;
|
|
198
|
+
providerUnits?: number | null;
|
|
199
|
+
usage?: Record<string, unknown> | null;
|
|
200
200
|
runnerId?: string | null;
|
|
201
201
|
leaseToken?: string | null;
|
|
202
202
|
leaseSeconds?: number | null;
|
|
@@ -207,7 +207,6 @@ export interface ProviderAssignmentLifecycleRequest {
|
|
|
207
207
|
output?: Record<string, unknown> | null;
|
|
208
208
|
summary?: Record<string, unknown> | null;
|
|
209
209
|
fallbackOutput?: Record<string, unknown> | null;
|
|
210
|
-
modeRunId?: string | null;
|
|
211
210
|
metadata?: Record<string, unknown>;
|
|
212
211
|
completion?: import('../../support/time-capacity.js').AssignmentCompletionEvidence | null;
|
|
213
212
|
performance?: import('../../support/time-capacity.js').AssignmentPerformanceSummary | null;
|
|
@@ -231,39 +230,3 @@ export interface ProviderAssignmentLifecycleResult {
|
|
|
231
230
|
diagnostics?: Record<string, unknown> | null;
|
|
232
231
|
leaseDiagnostics?: Record<string, unknown> | null;
|
|
233
232
|
}
|
|
234
|
-
export interface AgentModeRunUsageSettlement {
|
|
235
|
-
capacityUsageActualId: string | null;
|
|
236
|
-
capacityLedgerEntryId: string | null;
|
|
237
|
-
activeSeconds: number | null;
|
|
238
|
-
elapsedSeconds: number | null;
|
|
239
|
-
actualUsd: number | null;
|
|
240
|
-
nativeUsage: Record<string, unknown> | null;
|
|
241
|
-
metadata: Record<string, unknown>;
|
|
242
|
-
}
|
|
243
|
-
export interface AgentModeRun {
|
|
244
|
-
id: string;
|
|
245
|
-
teamId: string;
|
|
246
|
-
projectId: string;
|
|
247
|
-
providerAssignmentId: string;
|
|
248
|
-
capacityProviderId: string;
|
|
249
|
-
executionProviderId: string | null;
|
|
250
|
-
projectAgentClassId: string;
|
|
251
|
-
agentId: string | null;
|
|
252
|
-
handlerId: string | null;
|
|
253
|
-
mode: AgentExecutionMode;
|
|
254
|
-
executionMode?: AgentWorkExecutionMode;
|
|
255
|
-
status: AgentModeRunStatus;
|
|
256
|
-
selectedInput: Record<string, unknown>;
|
|
257
|
-
capacityEnvelope: AgentCapacityEnvelope;
|
|
258
|
-
outputs: Record<string, unknown>;
|
|
259
|
-
traceRefs: Record<string, unknown>;
|
|
260
|
-
usageActual: AgentModeRunUsageSettlement | Record<string, unknown>;
|
|
261
|
-
validation: Record<string, unknown>;
|
|
262
|
-
fallbackReason: string | null;
|
|
263
|
-
startedAt: string | null;
|
|
264
|
-
completedAt: string | null;
|
|
265
|
-
failedAt: string | null;
|
|
266
|
-
metadata: Record<string, unknown>;
|
|
267
|
-
createdAt: string;
|
|
268
|
-
updatedAt: string;
|
|
269
|
-
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ProviderContextCapacity } from '../../../../capacity-provider/capability-ontology.js';
|
|
2
|
+
import type { AssignmentContextPack, AssignmentContextSource } from './assignment-context-pack.js';
|
|
3
|
+
export interface ContextPackCandidate {
|
|
4
|
+
source: Omit<AssignmentContextSource, 'disposition' | 'measurement' | 'reason'>;
|
|
5
|
+
measurement: {
|
|
6
|
+
unit: 'tokens' | 'bytes' | 'items';
|
|
7
|
+
amount: number;
|
|
8
|
+
provenance: string;
|
|
9
|
+
};
|
|
10
|
+
priority: number;
|
|
11
|
+
mandatory?: boolean;
|
|
12
|
+
minimumBudget?: number;
|
|
13
|
+
maximumBudget?: number;
|
|
14
|
+
summaryMeasurement?: {
|
|
15
|
+
unit: 'tokens' | 'bytes' | 'items';
|
|
16
|
+
amount: number;
|
|
17
|
+
provenance: string;
|
|
18
|
+
};
|
|
19
|
+
omissionReason?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function compileAssignmentContextPack(input: {
|
|
22
|
+
assignmentId: string;
|
|
23
|
+
capacity: ProviderContextCapacity;
|
|
24
|
+
candidates: ContextPackCandidate[];
|
|
25
|
+
}): AssignmentContextPack;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
const canonical = (value) => value === null || typeof value !== "object" ? JSON.stringify(value) : Array.isArray(value) ? `[${value.map(canonical).join(",")}]` : `{${Object.entries(value).sort(([a], [b]) => a.localeCompare(b)).map(([key, item]) => `${JSON.stringify(key)}:${canonical(item)}`).join(",")}}`;
|
|
3
|
+
function compileAssignmentContextPack(input) {
|
|
4
|
+
const capacityUnit = input.capacity.mode === "bounded" ? input.capacity.measurement : null;
|
|
5
|
+
const budgetUnit = input.capacity.mode === "bounded" ? input.capacity.measurement : "bytes";
|
|
6
|
+
const ordered = [...input.candidates].sort((left, right) => Number(Boolean(right.mandatory)) - Number(Boolean(left.mandatory)) || Number(right.source.required) - Number(left.source.required) || right.priority - left.priority || left.source.id.localeCompare(right.source.id));
|
|
7
|
+
const mandatoryAmount = ordered.filter((candidate) => candidate.mandatory && !candidate.omissionReason).reduce((sum, candidate) => {
|
|
8
|
+
if (candidate.measurement.unit !== budgetUnit) throw new Error(`Context source ${candidate.source.id} uses ${candidate.measurement.unit}, but the offer budgets ${budgetUnit}.`);
|
|
9
|
+
return sum + candidate.measurement.amount;
|
|
10
|
+
}, 0);
|
|
11
|
+
const requiredFloor = ordered.filter((candidate) => candidate.source.required && !candidate.omissionReason).reduce((sum, candidate) => {
|
|
12
|
+
if (candidate.measurement.unit !== budgetUnit) throw new Error(`Context source ${candidate.source.id} uses ${candidate.measurement.unit}, but the offer budgets ${budgetUnit}.`);
|
|
13
|
+
if (candidate.mandatory) return sum + candidate.measurement.amount;
|
|
14
|
+
const summarized = candidate.summaryMeasurement?.unit === budgetUnit && candidate.summaryMeasurement.amount >= (candidate.minimumBudget ?? 0) ? candidate.summaryMeasurement.amount : candidate.measurement.amount;
|
|
15
|
+
return sum + summarized;
|
|
16
|
+
}, 0);
|
|
17
|
+
const maximumInput = input.capacity.mode === "bounded" ? input.capacity.maximum - input.capacity.reservedOutput : input.capacity.transportPayloadBytes;
|
|
18
|
+
if (input.capacity.mode === "bounded" && mandatoryAmount > maximumInput) throw new Error("Mandatory context exceeds the selected provider offer maximum input capacity.");
|
|
19
|
+
if (input.capacity.mode === "bounded" && requiredFloor > maximumInput) throw new Error("Required context exceeds the selected provider offer maximum input capacity.");
|
|
20
|
+
const limit = input.capacity.mode === "bounded" ? Math.min(maximumInput, Math.max(input.capacity.defaultInitial, mandatoryAmount, requiredFloor)) : input.capacity.transportPayloadBytes;
|
|
21
|
+
const sources = [];
|
|
22
|
+
let consumed = 0;
|
|
23
|
+
for (const candidate of ordered) {
|
|
24
|
+
if (candidate.omissionReason) {
|
|
25
|
+
sources.push({ ...candidate.source, disposition: "omitted", measurement: { ...candidate.measurement, amount: 0 }, reason: candidate.omissionReason });
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const compatible = candidate.measurement.unit === budgetUnit;
|
|
29
|
+
if (!compatible) throw new Error(`Context source ${candidate.source.id} uses ${candidate.measurement.unit}, but the offer budgets ${budgetUnit}.`);
|
|
30
|
+
if (candidate.maximumBudget !== void 0 && candidate.minimumBudget !== void 0 && candidate.minimumBudget > candidate.maximumBudget) throw new Error(`Context source ${candidate.source.id} has an invalid minimum/maximum budget.`);
|
|
31
|
+
if (candidate.minimumBudget !== void 0 && candidate.measurement.amount < candidate.minimumBudget && candidate.source.required) throw new Error(`Required context source ${candidate.source.id} cannot satisfy its minimum budget.`);
|
|
32
|
+
if (candidate.mandatory && consumed + candidate.measurement.amount > limit) throw new Error(`Mandatory context exceeds the selected provider offer default: ${candidate.source.id}.`);
|
|
33
|
+
if (consumed + candidate.measurement.amount <= limit && (candidate.maximumBudget === void 0 || candidate.measurement.amount <= candidate.maximumBudget)) {
|
|
34
|
+
sources.push({ ...candidate.source, disposition: "included", measurement: candidate.measurement, reason: null });
|
|
35
|
+
consumed += candidate.measurement.amount;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (!candidate.mandatory && candidate.summaryMeasurement && consumed + candidate.summaryMeasurement.amount <= limit && (candidate.maximumBudget === void 0 || candidate.summaryMeasurement.amount <= candidate.maximumBudget) && (candidate.minimumBudget === void 0 || candidate.summaryMeasurement.amount >= candidate.minimumBudget)) {
|
|
39
|
+
sources.push({ ...candidate.source, disposition: "summarized", measurement: candidate.summaryMeasurement, reason: "provider_context_default" });
|
|
40
|
+
consumed += candidate.summaryMeasurement.amount;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (candidate.source.required) throw new Error(`Mandatory context exceeds the selected provider offer default: ${candidate.source.id}.`);
|
|
44
|
+
sources.push({ ...candidate.source, disposition: "omitted", measurement: { ...candidate.measurement, amount: 0 }, reason: "provider_context_default" });
|
|
45
|
+
}
|
|
46
|
+
const totals = { tokens: 0, bytes: 0, items: 0 };
|
|
47
|
+
for (const source of sources) totals[source.measurement.unit] += source.measurement.amount;
|
|
48
|
+
const material = {
|
|
49
|
+
schemaVersion: "treeseed.assignment-context-pack/v1",
|
|
50
|
+
assignmentId: input.assignmentId,
|
|
51
|
+
capacity: {
|
|
52
|
+
mode: input.capacity.mode,
|
|
53
|
+
measurement: capacityUnit,
|
|
54
|
+
defaultInitial: input.capacity.mode === "bounded" ? input.capacity.defaultInitial : null,
|
|
55
|
+
maximum: input.capacity.mode === "bounded" ? input.capacity.maximum : null,
|
|
56
|
+
reservedOutput: input.capacity.mode === "bounded" ? input.capacity.reservedOutput : null,
|
|
57
|
+
transportPayloadBytes: input.capacity.transportPayloadBytes,
|
|
58
|
+
measurementProvenance: input.capacity.measurementProvenance
|
|
59
|
+
},
|
|
60
|
+
totals,
|
|
61
|
+
sources
|
|
62
|
+
};
|
|
63
|
+
return { ...material, digest: `sha256:${createHash("sha256").update(canonical(material)).digest("hex")}` };
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
compileAssignmentContextPack
|
|
67
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ProviderLanePurpose = 'communication' | '
|
|
1
|
+
export type ProviderLanePurpose = 'communication' | 'platform' | 'workday';
|
|
2
2
|
export type CapacityExecutionKind = 'workday' | 'conversation' | 'simulation' | 'recovery';
|
|
3
3
|
export type CapacityTriggerKind = 'scheduled' | 'manual' | 'discussion' | 'agent-handoff';
|
|
4
4
|
export type CommunicationPriorityClass = 'human-interactive' | 'workday-blocking-agent' | 'agent-asynchronous' | 'operational';
|
|
@@ -1,3 +1,129 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const availabilityWindowSchema: z.ZodObject<{
|
|
3
|
+
startsAt: z.ZodString;
|
|
4
|
+
endsAt: z.ZodString;
|
|
5
|
+
}, "strict", z.ZodTypeAny, {
|
|
6
|
+
startsAt: string;
|
|
7
|
+
endsAt: string;
|
|
8
|
+
}, {
|
|
9
|
+
startsAt: string;
|
|
10
|
+
endsAt: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const nativeLimitSchema: z.ZodObject<{
|
|
13
|
+
name: z.ZodString;
|
|
14
|
+
unit: z.ZodString;
|
|
15
|
+
maximum: z.ZodNumber;
|
|
16
|
+
}, "strict", z.ZodTypeAny, {
|
|
17
|
+
maximum: number;
|
|
18
|
+
name: string;
|
|
19
|
+
unit: string;
|
|
20
|
+
}, {
|
|
21
|
+
maximum: number;
|
|
22
|
+
name: string;
|
|
23
|
+
unit: string;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const providerOfferSchema: z.ZodObject<{
|
|
26
|
+
schemaVersion: z.ZodLiteral<"treeseed.provider-offer/v1">;
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
providerId: z.ZodString;
|
|
29
|
+
revision: z.ZodNumber;
|
|
30
|
+
runtimeBuild: z.ZodString;
|
|
31
|
+
capabilities: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
32
|
+
toolGroups: z.ZodEffects<z.ZodArray<z.ZodEnum<["discussion", "source.read", "source.write", "verification", "release"]>, "many">, ("discussion" | "source.read" | "source.write" | "verification" | "release")[], ("discussion" | "source.read" | "source.write" | "verification" | "release")[]>;
|
|
33
|
+
maximumConcurrency: z.ZodNumber;
|
|
34
|
+
availability: z.ZodArray<z.ZodObject<{
|
|
35
|
+
startsAt: z.ZodString;
|
|
36
|
+
endsAt: z.ZodString;
|
|
37
|
+
}, "strict", z.ZodTypeAny, {
|
|
38
|
+
startsAt: string;
|
|
39
|
+
endsAt: string;
|
|
40
|
+
}, {
|
|
41
|
+
startsAt: string;
|
|
42
|
+
endsAt: string;
|
|
43
|
+
}>, "many">;
|
|
44
|
+
nativeLimits: z.ZodArray<z.ZodObject<{
|
|
45
|
+
name: z.ZodString;
|
|
46
|
+
unit: z.ZodString;
|
|
47
|
+
maximum: z.ZodNumber;
|
|
48
|
+
}, "strict", z.ZodTypeAny, {
|
|
49
|
+
maximum: number;
|
|
50
|
+
name: string;
|
|
51
|
+
unit: string;
|
|
52
|
+
}, {
|
|
53
|
+
maximum: number;
|
|
54
|
+
name: string;
|
|
55
|
+
unit: string;
|
|
56
|
+
}>, "many">;
|
|
57
|
+
validFrom: z.ZodString;
|
|
58
|
+
validUntil: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, "strict", z.ZodTypeAny, {
|
|
60
|
+
id: string;
|
|
61
|
+
schemaVersion: "treeseed.provider-offer/v1";
|
|
62
|
+
revision: number;
|
|
63
|
+
capabilities: string[];
|
|
64
|
+
providerId: string;
|
|
65
|
+
runtimeBuild: string;
|
|
66
|
+
maximumConcurrency: number;
|
|
67
|
+
toolGroups: ("discussion" | "source.read" | "source.write" | "verification" | "release")[];
|
|
68
|
+
availability: {
|
|
69
|
+
startsAt: string;
|
|
70
|
+
endsAt: string;
|
|
71
|
+
}[];
|
|
72
|
+
nativeLimits: {
|
|
73
|
+
maximum: number;
|
|
74
|
+
name: string;
|
|
75
|
+
unit: string;
|
|
76
|
+
}[];
|
|
77
|
+
validFrom: string;
|
|
78
|
+
validUntil?: string | undefined;
|
|
79
|
+
}, {
|
|
80
|
+
id: string;
|
|
81
|
+
schemaVersion: "treeseed.provider-offer/v1";
|
|
82
|
+
revision: number;
|
|
83
|
+
capabilities: string[];
|
|
84
|
+
providerId: string;
|
|
85
|
+
runtimeBuild: string;
|
|
86
|
+
maximumConcurrency: number;
|
|
87
|
+
toolGroups: ("discussion" | "source.read" | "source.write" | "verification" | "release")[];
|
|
88
|
+
availability: {
|
|
89
|
+
startsAt: string;
|
|
90
|
+
endsAt: string;
|
|
91
|
+
}[];
|
|
92
|
+
nativeLimits: {
|
|
93
|
+
maximum: number;
|
|
94
|
+
name: string;
|
|
95
|
+
unit: string;
|
|
96
|
+
}[];
|
|
97
|
+
validFrom: string;
|
|
98
|
+
validUntil?: string | undefined;
|
|
99
|
+
}>;
|
|
100
|
+
export declare const providerStateSchema: z.ZodObject<{
|
|
101
|
+
schemaVersion: z.ZodLiteral<"treeseed.provider-state/v1">;
|
|
102
|
+
providerId: z.ZodString;
|
|
103
|
+
offerId: z.ZodString;
|
|
104
|
+
healthy: z.ZodBoolean;
|
|
105
|
+
activeAssignmentIds: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
106
|
+
observedNativeUsage: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
107
|
+
observedAt: z.ZodString;
|
|
108
|
+
}, "strict", z.ZodTypeAny, {
|
|
109
|
+
schemaVersion: "treeseed.provider-state/v1";
|
|
110
|
+
providerId: string;
|
|
111
|
+
observedAt: string;
|
|
112
|
+
offerId: string;
|
|
113
|
+
healthy: boolean;
|
|
114
|
+
activeAssignmentIds: string[];
|
|
115
|
+
observedNativeUsage: Record<string, number>;
|
|
116
|
+
}, {
|
|
117
|
+
schemaVersion: "treeseed.provider-state/v1";
|
|
118
|
+
providerId: string;
|
|
119
|
+
observedAt: string;
|
|
120
|
+
offerId: string;
|
|
121
|
+
healthy: boolean;
|
|
122
|
+
activeAssignmentIds: string[];
|
|
123
|
+
observedNativeUsage: Record<string, number>;
|
|
124
|
+
}>;
|
|
125
|
+
export type ProviderOffer = z.infer<typeof providerOfferSchema>;
|
|
126
|
+
export type ProviderState = z.infer<typeof providerStateSchema>;
|
|
1
127
|
export declare const CAPACITY_SUPPLY_POLICY_CONTRACT: "treeseed.capacity-supply-policy/v1";
|
|
2
128
|
export interface CapacitySupplyPolicy {
|
|
3
129
|
contract: typeof CAPACITY_SUPPLY_POLICY_CONTRACT;
|
|
@@ -7,9 +133,7 @@ export interface CapacitySupplyPolicy {
|
|
|
7
133
|
allowPlanningFailover: boolean;
|
|
8
134
|
allowActingFailover: boolean;
|
|
9
135
|
preferredCapacityProviderIds?: string[];
|
|
10
|
-
preferredExecutionProviderIds?: string[];
|
|
11
136
|
disallowedCapacityProviderIds?: string[];
|
|
12
|
-
disallowedExecutionProviderIds?: string[];
|
|
13
137
|
}
|
|
14
138
|
export interface CapacitySupplyCandidate {
|
|
15
139
|
capacityProviderId: string;
|
|
@@ -24,7 +148,6 @@ export interface CapacitySupplyCandidate {
|
|
|
24
148
|
availableConcurrency: number;
|
|
25
149
|
preferred?: boolean;
|
|
26
150
|
estimatedCost?: number | null;
|
|
27
|
-
minimumAssignmentDuration?: import('../../../../capacity-provider/contracts/governance.js').MinimumAssignmentDuration;
|
|
28
151
|
}
|
|
29
152
|
export interface CapacitySupplySelection {
|
|
30
153
|
selected: CapacitySupplyCandidate | null;
|
|
@@ -1,4 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { uniqueArray } from "../../../../content/validation/schema-constraints.js";
|
|
3
|
+
import { AGENT_TOOL_GROUPS } from "../../../../types/agents.js";
|
|
4
|
+
import { assignmentAttemptSchema, leaseSchema } from "../assignments/agent-execution.js";
|
|
5
|
+
const identifier = leaseSchema.shape.id, timestamp = leaseSchema.shape.acquiredAt;
|
|
6
|
+
const availabilityWindowSchema = z.object({ startsAt: timestamp, endsAt: timestamp }).strict();
|
|
7
|
+
const nativeLimitSchema = z.object({ name: identifier, unit: identifier, maximum: z.number().finite().positive() }).strict();
|
|
8
|
+
const providerOfferSchema = z.object({
|
|
9
|
+
schemaVersion: z.literal("treeseed.provider-offer/v1"),
|
|
10
|
+
id: identifier,
|
|
11
|
+
providerId: identifier,
|
|
12
|
+
revision: z.number().int().positive(),
|
|
13
|
+
runtimeBuild: assignmentAttemptSchema.innerType().shape.provider.shape.runtimeBuild,
|
|
14
|
+
capabilities: uniqueArray(z.array(identifier)),
|
|
15
|
+
toolGroups: uniqueArray(z.array(z.enum(AGENT_TOOL_GROUPS))),
|
|
16
|
+
maximumConcurrency: z.number().int().positive(),
|
|
17
|
+
availability: z.array(availabilityWindowSchema).min(1),
|
|
18
|
+
nativeLimits: z.array(nativeLimitSchema),
|
|
19
|
+
validFrom: timestamp,
|
|
20
|
+
validUntil: timestamp.optional()
|
|
21
|
+
}).strict();
|
|
22
|
+
const providerStateSchema = z.object({
|
|
23
|
+
schemaVersion: z.literal("treeseed.provider-state/v1"),
|
|
24
|
+
providerId: identifier,
|
|
25
|
+
offerId: identifier,
|
|
26
|
+
healthy: z.boolean(),
|
|
27
|
+
activeAssignmentIds: uniqueArray(z.array(identifier)),
|
|
28
|
+
observedNativeUsage: z.record(z.number().finite().nonnegative()),
|
|
29
|
+
observedAt: timestamp
|
|
30
|
+
}).strict();
|
|
1
31
|
const CAPACITY_SUPPLY_POLICY_CONTRACT = "treeseed.capacity-supply-policy/v1";
|
|
2
32
|
export {
|
|
3
|
-
CAPACITY_SUPPLY_POLICY_CONTRACT
|
|
33
|
+
CAPACITY_SUPPLY_POLICY_CONTRACT,
|
|
34
|
+
availabilityWindowSchema,
|
|
35
|
+
nativeLimitSchema,
|
|
36
|
+
providerOfferSchema,
|
|
37
|
+
providerStateSchema
|
|
4
38
|
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/** Pure allocation arithmetic. Admission must reserve the returned amount atomically. */
|
|
2
|
+
import { type AppliedWorkday } from './workday-allocation.js';
|
|
3
|
+
export interface AllocationShare {
|
|
4
|
+
id: string;
|
|
5
|
+
weight: number;
|
|
6
|
+
committedSeconds: number;
|
|
7
|
+
maximumAdditionalSeconds: number;
|
|
8
|
+
}
|
|
9
|
+
/** Redistributable shares; existing reservations/consumption retain their entitlement. */
|
|
10
|
+
export declare function distributeAllocationSeconds(remainingSeconds: number, shares: AllocationShare[]): Record<string, number>;
|
|
11
|
+
/** Resolve each live workday's phase opportunity from the same shared hard supply.
|
|
12
|
+
* maximumAdditionalSeconds is graph-ready demand, bounded by supply windows/concurrency.
|
|
13
|
+
* Existing commitments are never resized; execution mode does not alter entitlement.
|
|
14
|
+
*/
|
|
15
|
+
export declare function allocateWorkdayCapacity(input: {
|
|
16
|
+
remainingSeconds: number;
|
|
17
|
+
now: string;
|
|
18
|
+
workdays: Array<{
|
|
19
|
+
plan: AppliedWorkday;
|
|
20
|
+
committedSeconds: number;
|
|
21
|
+
planningCommittedSeconds: number;
|
|
22
|
+
maximumAdditionalSeconds: number;
|
|
23
|
+
actingReady: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
}): {
|
|
26
|
+
[k: string]: {
|
|
27
|
+
shareSeconds: number;
|
|
28
|
+
phase: "planning" | "acting" | "ended";
|
|
29
|
+
phaseRemainingSeconds: number;
|
|
30
|
+
weight: number;
|
|
31
|
+
committedSeconds: number;
|
|
32
|
+
planningCommittedSeconds: number;
|
|
33
|
+
remainingSupplySeconds: number;
|
|
34
|
+
totalEligibleWeight: number;
|
|
35
|
+
availableSeconds: number;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export interface AllocationMeasurement {
|
|
39
|
+
id: string;
|
|
40
|
+
completedAt: string;
|
|
41
|
+
expectedSeconds: number;
|
|
42
|
+
allocatedSeconds: number;
|
|
43
|
+
activeSeconds: number;
|
|
44
|
+
outcome: 'completed' | 'expired' | 'cancelled' | 'credential-failure' | 'infrastructure-failure' | 'invalid-result';
|
|
45
|
+
}
|
|
46
|
+
/** Caller scopes history to exact provider/model, capability, class, and activity. */
|
|
47
|
+
export declare function calibrateAssignmentSeconds(estimate: {
|
|
48
|
+
expectedSeconds: number;
|
|
49
|
+
maximumSeconds: number;
|
|
50
|
+
}, measurements: AllocationMeasurement[]): {
|
|
51
|
+
seconds: number;
|
|
52
|
+
multiplier: number;
|
|
53
|
+
measurementIds: string[];
|
|
54
|
+
};
|
|
55
|
+
export interface AssignmentAllocationConstraint {
|
|
56
|
+
id: string;
|
|
57
|
+
remainingSeconds: number;
|
|
58
|
+
}
|
|
59
|
+
export declare function calculateAssignmentAllocation(input: {
|
|
60
|
+
estimate: {
|
|
61
|
+
expectedSeconds: number;
|
|
62
|
+
maximumSeconds: number;
|
|
63
|
+
};
|
|
64
|
+
measurements: AllocationMeasurement[];
|
|
65
|
+
constraints: AssignmentAllocationConstraint[];
|
|
66
|
+
providerMaximumSeconds?: number;
|
|
67
|
+
profileMaximumSeconds?: number;
|
|
68
|
+
planningTurnMaximumSeconds?: number;
|
|
69
|
+
}): {
|
|
70
|
+
admitted: boolean;
|
|
71
|
+
allocatedSeconds: number;
|
|
72
|
+
desiredSeconds: number;
|
|
73
|
+
calibration: {
|
|
74
|
+
seconds: number;
|
|
75
|
+
multiplier: number;
|
|
76
|
+
measurementIds: string[];
|
|
77
|
+
};
|
|
78
|
+
limitingConstraint: string;
|
|
79
|
+
constraints: AssignmentAllocationConstraint[];
|
|
80
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { workdayPhase } from "./workday-allocation.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
function nonnegative(value) {
|
|
4
|
+
if (!Number.isFinite(value) || value < 0) throw new Error("allocation_amount_invalid");
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
function distributeAllocationSeconds(remainingSeconds, shares) {
|
|
8
|
+
nonnegative(remainingSeconds);
|
|
9
|
+
if (new Set(shares.map((share) => share.id)).size !== shares.length) throw new Error("allocation_share_duplicate");
|
|
10
|
+
const ordered = [...shares].sort((a, b) => a.id.localeCompare(b.id));
|
|
11
|
+
for (const share of ordered) {
|
|
12
|
+
if (!Number.isFinite(share.weight) || share.weight <= 0) throw new Error("allocation_weight_invalid");
|
|
13
|
+
nonnegative(share.committedSeconds);
|
|
14
|
+
nonnegative(share.maximumAdditionalSeconds);
|
|
15
|
+
}
|
|
16
|
+
const result = Object.fromEntries(ordered.map((share) => [share.id, 0]));
|
|
17
|
+
const capacity = Math.min(remainingSeconds, ordered.reduce((sum, share) => sum + share.maximumAdditionalSeconds, 0));
|
|
18
|
+
if (!capacity) return result;
|
|
19
|
+
let low = 0;
|
|
20
|
+
let high = Math.max(...ordered.map((share) => (share.committedSeconds + capacity) / share.weight));
|
|
21
|
+
for (let iteration = 0; iteration < 80; iteration += 1) {
|
|
22
|
+
const level = (low + high) / 2;
|
|
23
|
+
const amount = ordered.reduce((sum, share) => sum + Math.min(
|
|
24
|
+
share.maximumAdditionalSeconds,
|
|
25
|
+
Math.max(0, level * share.weight - share.committedSeconds)
|
|
26
|
+
), 0);
|
|
27
|
+
if (amount > capacity) high = level;
|
|
28
|
+
else low = level;
|
|
29
|
+
}
|
|
30
|
+
for (const share of ordered) result[share.id] = Math.floor(Math.min(
|
|
31
|
+
share.maximumAdditionalSeconds,
|
|
32
|
+
Math.max(0, low * share.weight - share.committedSeconds)
|
|
33
|
+
) + 1e-9);
|
|
34
|
+
let residual = Math.floor(capacity) - Object.values(result).reduce((sum, amount) => sum + amount, 0);
|
|
35
|
+
for (const share of [...ordered].sort((a, b) => (a.committedSeconds + result[a.id]) / a.weight - (b.committedSeconds + result[b.id]) / b.weight || a.id.localeCompare(b.id))) {
|
|
36
|
+
if (residual > 0 && result[share.id] + 1 <= share.maximumAdditionalSeconds) {
|
|
37
|
+
result[share.id] += 1;
|
|
38
|
+
residual -= 1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
function allocateWorkdayCapacity(input) {
|
|
44
|
+
if (!Number.isFinite(Date.parse(input.now))) throw new Error("allocation_time_invalid");
|
|
45
|
+
const shares = input.workdays.map(({ plan, committedSeconds, planningCommittedSeconds, maximumAdditionalSeconds, actingReady }) => {
|
|
46
|
+
nonnegative(planningCommittedSeconds);
|
|
47
|
+
if (planningCommittedSeconds > committedSeconds) throw new Error("allocation_planning_commitment_invalid");
|
|
48
|
+
const eligible = Date.parse(input.now) >= Date.parse(plan.startsAt) && (plan.state === "closing" || plan.state === "active" && workdayPhase(plan, input.now, actingReady) !== "ended");
|
|
49
|
+
return {
|
|
50
|
+
id: plan.id,
|
|
51
|
+
weight: plan.policySnapshot.allocationWeight,
|
|
52
|
+
committedSeconds,
|
|
53
|
+
maximumAdditionalSeconds: eligible ? maximumAdditionalSeconds : 0
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
const opportunities = distributeAllocationSeconds(input.remainingSeconds, shares);
|
|
57
|
+
return Object.fromEntries(input.workdays.map(({ plan, committedSeconds, planningCommittedSeconds, actingReady }) => {
|
|
58
|
+
const shareSeconds = opportunities[plan.id];
|
|
59
|
+
const phase = plan.state === "closing" ? "acting" : workdayPhase(plan, input.now, actingReady);
|
|
60
|
+
const phaseRemainingSeconds = shareSeconds;
|
|
61
|
+
return [plan.id, {
|
|
62
|
+
shareSeconds,
|
|
63
|
+
phase,
|
|
64
|
+
phaseRemainingSeconds,
|
|
65
|
+
weight: plan.policySnapshot.allocationWeight,
|
|
66
|
+
committedSeconds,
|
|
67
|
+
planningCommittedSeconds,
|
|
68
|
+
remainingSupplySeconds: input.remainingSeconds,
|
|
69
|
+
totalEligibleWeight: shares.filter((share) => share.maximumAdditionalSeconds > 0).reduce((sum, share) => sum + share.weight, 0),
|
|
70
|
+
availableSeconds: Math.min(shareSeconds, phaseRemainingSeconds)
|
|
71
|
+
}];
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
function calibrateAssignmentSeconds(estimate, measurements) {
|
|
75
|
+
if (!Number.isFinite(estimate.expectedSeconds) || estimate.expectedSeconds <= 0 || !Number.isFinite(estimate.maximumSeconds) || estimate.maximumSeconds < estimate.expectedSeconds) throw new Error("allocation_estimate_invalid");
|
|
76
|
+
const eligibleHistory = measurements.filter((entry) => entry.outcome === "completed" || entry.outcome === "expired");
|
|
77
|
+
const ids = /* @__PURE__ */ new Set();
|
|
78
|
+
for (const entry of eligibleHistory) {
|
|
79
|
+
if (typeof entry.id !== "string" || !entry.id || entry.id !== entry.id.trim() || ids.has(entry.id) || !z.string().datetime({ offset: true }).safeParse(entry.completedAt).success || !Number.isFinite(entry.expectedSeconds) || entry.expectedSeconds <= 0 || !Number.isFinite(entry.allocatedSeconds) || entry.allocatedSeconds <= 0) throw new Error("allocation_measurement_invalid");
|
|
80
|
+
ids.add(entry.id);
|
|
81
|
+
nonnegative(entry.activeSeconds);
|
|
82
|
+
}
|
|
83
|
+
const eligible = eligibleHistory.sort((a, b) => Date.parse(a.completedAt) - Date.parse(b.completedAt) || a.id.localeCompare(b.id)).slice(-20);
|
|
84
|
+
let multiplier = estimate.maximumSeconds / estimate.expectedSeconds;
|
|
85
|
+
for (const entry of eligible) {
|
|
86
|
+
const ratio = entry.activeSeconds / entry.expectedSeconds;
|
|
87
|
+
const similarity = Math.min(estimate.expectedSeconds, entry.expectedSeconds) / Math.max(estimate.expectedSeconds, entry.expectedSeconds);
|
|
88
|
+
multiplier = entry.outcome === "expired" ? Math.max(multiplier * 1.25, entry.allocatedSeconds / entry.expectedSeconds * 1.25, ratio * 1.25) : Math.max(multiplier * (1 - 0.1 * similarity), ratio * 1.25);
|
|
89
|
+
}
|
|
90
|
+
return { seconds: Math.ceil(estimate.expectedSeconds * multiplier), multiplier, measurementIds: eligible.map((entry) => entry.id) };
|
|
91
|
+
}
|
|
92
|
+
function calculateAssignmentAllocation(input) {
|
|
93
|
+
const calibration = calibrateAssignmentSeconds(input.estimate, input.measurements);
|
|
94
|
+
const constraints = [...input.constraints];
|
|
95
|
+
for (const [id, value] of [
|
|
96
|
+
["provider-maximum", input.providerMaximumSeconds],
|
|
97
|
+
["profile-maximum", input.profileMaximumSeconds],
|
|
98
|
+
["planning-turn", input.planningTurnMaximumSeconds]
|
|
99
|
+
]) if (value !== void 0) constraints.push({ id, remainingSeconds: nonnegative(value) });
|
|
100
|
+
if (!constraints.length) throw new Error("allocation_constraints_required");
|
|
101
|
+
for (const entry of constraints) nonnegative(entry.remainingSeconds);
|
|
102
|
+
constraints.sort((a, b) => a.remainingSeconds - b.remainingSeconds || a.id.localeCompare(b.id));
|
|
103
|
+
const availableSeconds = Math.floor(constraints[0].remainingSeconds);
|
|
104
|
+
const desiredSeconds = calibration.seconds;
|
|
105
|
+
const admitted = availableSeconds >= 1;
|
|
106
|
+
const allocatedSeconds = admitted ? Math.min(desiredSeconds, availableSeconds) : 0;
|
|
107
|
+
return {
|
|
108
|
+
admitted,
|
|
109
|
+
allocatedSeconds,
|
|
110
|
+
desiredSeconds,
|
|
111
|
+
calibration,
|
|
112
|
+
limitingConstraint: availableSeconds < desiredSeconds ? constraints[0].id : "task-duration",
|
|
113
|
+
constraints
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
allocateWorkdayCapacity,
|
|
118
|
+
calculateAssignmentAllocation,
|
|
119
|
+
calibrateAssignmentSeconds,
|
|
120
|
+
distributeAllocationSeconds
|
|
121
|
+
};
|