@treeseed/sdk 0.13.0-rc.13 → 0.13.0-rc.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -9
- package/dist/accounts/account-contracts.d.ts +6 -0
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.d.ts +5485 -0
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.js +242 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +304 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.js +44 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.d.ts +2 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.js +13 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.d.ts +23 -60
- package/dist/agent-capacity/contracts/capacity/assignments/context-pack-compiler.d.ts +25 -0
- package/dist/agent-capacity/contracts/capacity/assignments/context-pack-compiler.js +67 -0
- package/dist/agent-capacity/contracts/capacity/communication/communication-records.d.ts +1 -1
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.d.ts +126 -3
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.js +35 -1
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.d.ts +80 -0
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.js +121 -0
- package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.d.ts +103 -0
- package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.js +51 -0
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.d.ts +490 -0
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.js +170 -0
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +210 -91
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.js +19 -0
- package/dist/agent-capacity/contracts/configuration/configuration.d.ts +1 -1
- package/dist/agent-capacity/contracts/configuration/configuration.js +1 -3
- package/dist/agent-capacity/contracts/operations/agent-team-clone.d.ts +218 -0
- package/dist/agent-capacity/contracts/operations/agent-team-clone.js +57 -0
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.d.ts +119 -24
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.js +16 -0
- package/dist/agent-capacity/contracts/runtime/runtime-observability.d.ts +2 -154
- package/dist/agent-capacity/contracts/support/agent-atlas.d.ts +0 -13
- package/dist/agent-capacity/contracts/support/execution-graph.d.ts +1291 -0
- package/dist/agent-capacity/contracts/support/execution-graph.js +122 -0
- package/dist/agent-capacity/contracts/support/financial-records.d.ts +3 -6
- package/dist/agent-capacity/contracts/support/planning-records.d.ts +1 -87
- package/dist/agent-capacity/contracts/support/time-capacity.d.ts +0 -14
- package/dist/agent-capacity/contracts/support/time-capacity.js +1 -8
- package/dist/agent-capacity/grant.d.ts +34 -0
- package/dist/agent-capacity/grant.js +4 -0
- package/dist/agent-capacity/validation/activity-profile.d.ts +1 -1
- package/dist/agent-capacity/validation/activity-profile.js +3 -259
- package/dist/agent-capacity/validation/agent-definition-schema.d.ts +2538 -9020
- package/dist/agent-capacity/validation/agent-definition-schema.js +59 -181
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +25 -25
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.js +0 -1
- package/dist/agent-capacity/validation/assignment-records.d.ts +1 -6
- package/dist/agent-capacity/validation/assignment-records.js +49 -35
- package/dist/agent-capacity/validation/configuration.d.ts +1 -1
- package/dist/agent-capacity/validation/configuration.js +2 -7
- package/dist/agent-capacity/validation/execution/execution-graph.d.ts +1 -0
- package/dist/agent-capacity/validation/execution/execution-graph.js +16 -0
- package/dist/agent-capacity/validation/grant.d.ts +11 -0
- package/dist/agent-capacity/validation/grant.js +31 -0
- package/dist/agent-capacity/validation/index.d.ts +2 -1
- package/dist/agent-capacity/validation/index.js +2 -1
- package/dist/agent-capacity/workday.d.ts +13 -4
- package/dist/agent-capacity/workday.js +10 -26
- package/dist/capacity/agents/agent-capacity.d.ts +11 -4
- package/dist/capacity/agents/agent-capacity.js +9 -3
- package/dist/capacity-provider/capability-ontology.d.ts +1495 -0
- package/dist/capacity-provider/capability-ontology.js +221 -0
- package/dist/capacity-provider/client.d.ts +78 -3
- package/dist/capacity-provider/client.js +22 -10
- package/dist/capacity-provider/contracts/capacity-facts.d.ts +13 -0
- package/dist/capacity-provider/contracts/environment-profiles.d.ts +255 -0
- package/dist/capacity-provider/contracts/environment-profiles.js +71 -0
- package/dist/capacity-provider/contracts/governance.d.ts +110 -51
- package/dist/capacity-provider/contracts/index.d.ts +3 -0
- package/dist/capacity-provider/contracts/index.js +3 -0
- package/dist/capacity-provider/core-capability-catalog.d.ts +47 -0
- package/dist/capacity-provider/core-capability-catalog.js +49 -0
- package/dist/capacity-provider/environment-catalog.d.ts +877 -0
- package/dist/capacity-provider/environment-catalog.js +116 -0
- package/dist/capacity-provider/index.d.ts +5 -0
- package/dist/capacity-provider/index.js +5 -0
- package/dist/capacity-provider/install-configuration.d.ts +39 -0
- package/dist/capacity-provider/install-configuration.js +18 -0
- package/dist/capacity-provider/sandbox-contracts.d.ts +602 -0
- package/dist/capacity-provider/sandbox-contracts.js +90 -0
- package/dist/capacity-provider/sandbox.d.ts +2 -0
- package/dist/capacity-provider/sandbox.js +2 -0
- package/dist/capacity-provider/source-workspace.d.ts +740 -0
- package/dist/capacity-provider/source-workspace.js +130 -0
- package/dist/capacity-provider/validation.d.ts +11 -3
- package/dist/capacity-provider/validation.js +136 -70
- package/dist/configuration/secrets-capability.d.ts +5 -1
- package/dist/configuration/secrets-capability.js +5 -1
- package/dist/content/contracts.d.ts +1 -1
- package/dist/content/validation/agent-operational-content-schemas.d.ts +430 -777
- package/dist/content/validation/agent-operational-content-schemas.js +31 -57
- package/dist/content/validation/auxiliary-content-schemas.d.ts +144 -144
- package/dist/content/validation/content-model-schemas.d.ts +16063 -19764
- package/dist/content/validation/content-model-schemas.js +350 -98
- package/dist/content/validation/portable-content-data.d.ts +751 -1782
- package/dist/content/validation/portable-content-data.js +10 -4
- package/dist/content/validation/schema-constraints.d.ts +80 -0
- package/dist/content/validation/schema-constraints.js +173 -0
- package/dist/deployment/ai/storage.d.ts +158 -0
- package/dist/deployment/ai/storage.js +32 -0
- package/dist/deployment/ai-hosting.d.ts +297 -0
- package/dist/deployment/ai-hosting.js +63 -0
- package/dist/deployment/ai-instance.d.ts +65 -0
- package/dist/deployment/ai-instance.js +30 -0
- package/dist/deployment/ai-mode.d.ts +454 -0
- package/dist/deployment/ai-mode.js +67 -0
- package/dist/deployment/canonical.d.ts +2 -0
- package/dist/deployment/canonical.js +17 -0
- package/dist/deployment/catalog.d.ts +16 -0
- package/dist/deployment/catalog.js +48 -0
- package/dist/deployment/hosted-topology-template.d.ts +449 -0
- package/dist/deployment/hosted-topology-template.js +56 -0
- package/dist/deployment/hosted-topology.d.ts +2698 -0
- package/dist/deployment/hosted-topology.js +468 -0
- package/dist/deployment/index.d.ts +13 -0
- package/dist/deployment/index.js +13 -0
- package/dist/deployment/postgres/contracts.d.ts +418 -0
- package/dist/deployment/postgres/contracts.js +83 -0
- package/dist/deployment/postgres/requirements.d.ts +15 -0
- package/dist/deployment/postgres/requirements.js +32 -0
- package/dist/deployment/postgres/transfer.d.ts +97 -0
- package/dist/deployment/postgres/transfer.js +29 -0
- package/dist/deployment/schemas.d.ts +8625 -0
- package/dist/deployment/schemas.js +455 -0
- package/dist/deployment/topology.d.ts +9 -0
- package/dist/deployment/topology.js +35 -0
- package/dist/development/index.d.ts +1 -0
- package/dist/development/index.js +1 -0
- package/dist/development/schemas.d.ts +3594 -0
- package/dist/development/schemas.js +204 -0
- package/dist/development/session-migration.d.ts +3 -0
- package/dist/development/session-migration.js +25 -0
- package/dist/entrypoints/clients/control-plane-client.d.ts +9 -1
- package/dist/entrypoints/clients/control-plane-client.js +17 -5
- package/dist/graph/context-query-contracts.d.ts +16 -1
- package/dist/graph/context-query-contracts.js +6 -1
- package/dist/guarantees/evidence-trust.d.ts +32 -0
- package/dist/guarantees/evidence-trust.js +47 -0
- package/dist/guarantees/index.d.ts +154 -0
- package/dist/guarantees/index.js +44 -0
- package/dist/identity/browser-session.d.ts +233 -0
- package/dist/identity/browser-session.js +51 -0
- package/dist/identity/contracts.d.ts +191 -0
- package/dist/identity/contracts.js +77 -0
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.js +3 -0
- package/dist/identity/runtime.d.ts +186 -0
- package/dist/identity/runtime.js +49 -0
- package/dist/knowledge/contracts.d.ts +9 -2
- package/dist/knowledge/contracts.js +2 -2
- package/dist/model-registry/agent-operational-models.d.ts +1 -1
- package/dist/model-registry/agent-operational-models.js +1 -4
- package/dist/model-registry/build-builtin-model-registry.js +44 -72
- package/dist/model-registry/discussion-models.js +0 -1
- package/dist/operator-contracts/canonical-command-tree.js +415 -44
- package/dist/operator-contracts/catalog/admin-account-team-operations.d.ts +36 -0
- package/dist/operator-contracts/catalog/admin-account-team-operations.js +52 -0
- package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.d.ts +75 -0
- package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.js +42 -0
- package/dist/operator-contracts/catalog/capability-ontology-operations.d.ts +163 -0
- package/dist/operator-contracts/catalog/capability-ontology-operations.js +24 -0
- package/dist/operator-contracts/catalog/commands/command-tree-builders.d.ts +62 -0
- package/dist/operator-contracts/catalog/commands/command-tree-builders.js +191 -0
- package/dist/operator-contracts/catalog/communication-operations.d.ts +457 -0
- package/dist/operator-contracts/catalog/communication-operations.js +92 -0
- package/dist/operator-contracts/catalog/control-plane-catalog.d.ts +6 -0
- package/dist/operator-contracts/catalog/control-plane-catalog.js +18 -0
- package/dist/operator-contracts/catalog/execution/execution-operations.d.ts +36 -0
- package/dist/operator-contracts/catalog/execution/execution-operations.js +39 -0
- package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +399 -0
- package/dist/operator-contracts/catalog/hosted-topology-operations.js +79 -0
- package/dist/operator-contracts/catalog/inbox-operations.d.ts +265 -0
- package/dist/operator-contracts/catalog/inbox-operations.js +36 -0
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.d.ts +53 -0
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.js +24 -0
- package/dist/operator-contracts/catalog/infrastructure/command-tree-paths.d.ts +3 -0
- package/dist/operator-contracts/catalog/infrastructure/command-tree-paths.js +15 -0
- package/dist/operator-contracts/catalog/knowledge-share-operations.d.ts +127 -0
- package/dist/operator-contracts/catalog/knowledge-share-operations.js +25 -0
- package/dist/operator-contracts/catalog/provider-environment-commands.d.ts +4 -0
- package/dist/operator-contracts/catalog/provider-environment-commands.js +69 -0
- package/dist/operator-contracts/catalog/provider-environment-operations.d.ts +41 -0
- package/dist/operator-contracts/catalog/provider-environment-operations.js +61 -0
- package/dist/operator-contracts/catalog/services/identity-commands.d.ts +2 -0
- package/dist/operator-contracts/catalog/services/identity-commands.js +13 -0
- package/dist/operator-contracts/catalog/services/secret-commands.d.ts +2 -0
- package/dist/operator-contracts/catalog/services/secret-commands.js +31 -0
- package/dist/operator-contracts/catalog/services/secret-operations.d.ts +70 -0
- package/dist/operator-contracts/catalog/services/secret-operations.js +52 -0
- package/dist/operator-contracts/catalog/treeai-operations.d.ts +13 -0
- package/dist/operator-contracts/catalog/treeai-operations.js +61 -0
- package/dist/operator-contracts/catalog/workdays/profile-commands.d.ts +4 -0
- package/dist/operator-contracts/catalog/workdays/profile-commands.js +20 -0
- package/dist/operator-contracts/catalog/workdays/profile-operations.d.ts +41 -0
- package/dist/operator-contracts/catalog/workdays/profile-operations.js +50 -0
- package/dist/operator-contracts/catalog/workdays/selection-commands.d.ts +3 -0
- package/dist/operator-contracts/catalog/workdays/selection-commands.js +28 -0
- package/dist/operator-contracts/command-tree.d.ts +29 -0
- package/dist/operator-contracts/command-tree.js +50 -0
- package/dist/operator-contracts/communication/addressing.d.ts +8 -0
- package/dist/operator-contracts/communication/addressing.js +57 -0
- package/dist/operator-contracts/communication/contracts.d.ts +1966 -0
- package/dist/operator-contracts/communication/contracts.js +195 -0
- package/dist/operator-contracts/control-plane-operation.d.ts +15 -1
- package/dist/operator-contracts/control-plane-operation.js +14 -6
- package/dist/operator-contracts/control-plane-operations.d.ts +2496 -328
- package/dist/operator-contracts/control-plane-operations.js +282 -129
- package/dist/operator-contracts/inbox/contracts.d.ts +1111 -0
- package/dist/operator-contracts/inbox/contracts.js +138 -0
- package/dist/operator-contracts/index.d.ts +6 -1
- package/dist/operator-contracts/index.js +6 -1
- package/dist/operator-contracts/knowledge/contracts.d.ts +130 -0
- package/dist/operator-contracts/knowledge/contracts.js +39 -0
- package/dist/operator-contracts/mcp.d.ts +5 -0
- package/dist/operator-contracts/mcp.js +62 -0
- package/dist/operator-contracts/oauth.d.ts +45 -0
- package/dist/operator-contracts/oauth.js +7 -0
- package/dist/operator-contracts/operation-builder.d.ts +18 -0
- package/dist/operator-contracts/operation-builder.js +78 -0
- package/dist/operator-contracts/seed/seed-bundle.d.ts +138 -0
- package/dist/operator-contracts/seed/seed-bundle.js +68 -0
- package/dist/operator-contracts/workday-lifecycle.d.ts +383 -28
- package/dist/operator-contracts/workday-lifecycle.js +124 -17
- package/dist/platform/agent-schema-verification.d.ts +3 -0
- package/dist/platform/agent-schema-verification.js +377 -0
- package/dist/platform/contracts.d.ts +429 -0
- package/dist/platform/contracts.js +93 -0
- package/dist/platform/index.d.ts +6 -0
- package/dist/platform/index.js +6 -0
- package/dist/platform/inventory.d.ts +11 -0
- package/dist/platform/inventory.js +53 -0
- package/dist/platform/project-create.d.ts +49 -0
- package/dist/platform/project-create.js +75 -0
- package/dist/platform/schemas.d.ts +1094 -0
- package/dist/platform/schemas.js +99 -0
- package/dist/platform/verification.d.ts +9 -0
- package/dist/platform/verification.js +114 -0
- package/dist/platform/workset.d.ts +21 -0
- package/dist/platform/workset.js +106 -0
- package/dist/sdk-types/support/planning-policy.d.ts +1 -1
- package/dist/sdk-types/support/sdk-model-names.d.ts +1 -1
- package/dist/sdk-types/support/sdk-model-names.js +0 -3
- package/dist/sdk-types/support/sdk-search-request.d.ts +2 -2
- package/dist/secrets-capability/github-actions-encryption.d.ts +2 -0
- package/dist/secrets-capability/github-actions-encryption.js +11 -0
- package/dist/secrets-capability/provider-operation-contracts.d.ts +15 -1
- package/dist/secrets-capability/secret-contracts.d.ts +33 -0
- package/dist/secrets-capability/secret-contracts.js +49 -0
- package/dist/secrets-capability/service-provider-contracts.d.ts +5 -3
- package/dist/secrets-capability/service-provider-contracts.js +66 -50
- package/dist/secrets-capability/shared-access.d.ts +51 -0
- package/dist/secrets-capability/shared-access.js +36 -0
- package/dist/secrets-capability/shared-resources.d.ts +376 -0
- package/dist/secrets-capability/shared-resources.js +91 -0
- package/dist/secrets-capability/vault-contracts.d.ts +132 -0
- package/dist/secrets-capability/vault-contracts.js +56 -0
- package/dist/security/encrypted-envelope.d.ts +177 -0
- package/dist/security/encrypted-envelope.js +34 -0
- package/dist/security/envelope-codec.d.ts +38 -0
- package/dist/security/envelope-codec.js +96 -0
- package/dist/security/index.d.ts +2 -0
- package/dist/security/index.js +2 -0
- package/dist/site-contracts/catalog.d.ts +16 -0
- package/dist/site-contracts/catalog.js +19 -0
- package/dist/site-contracts/cloudflare.d.ts +48 -0
- package/dist/site-contracts/platform.d.ts +94 -0
- package/dist/site-contracts/plugin.d.ts +63 -0
- package/dist/site-contracts/plugin.js +26 -0
- package/dist/treeai/catalog.d.ts +1 -0
- package/dist/treeai/catalog.js +1 -0
- package/dist/treeai/client.d.ts +793 -0
- package/dist/treeai/client.js +44 -0
- package/dist/treeai/contract.d.ts +41 -0
- package/dist/treeai/contract.js +51 -0
- package/dist/treeai/generated/upstream.d.ts +770 -0
- package/dist/treeai/generated/upstream.js +4 -0
- package/dist/treeai/index.d.ts +4 -0
- package/dist/treeai/index.js +4 -0
- package/dist/treedx/client.d.ts +605 -0
- package/dist/treedx/client.js +39 -0
- package/dist/treedx/contract.d.ts +32 -0
- package/dist/treedx/contract.js +63 -0
- package/dist/treedx/index.d.ts +3 -0
- package/dist/treedx/index.js +3 -0
- package/dist/treedx/types.d.ts +294 -7
- package/dist/treedx/types.js +44 -7
- package/dist/types/agents/agent-activity-profile.d.ts +43 -98
- package/dist/types/agents/agent-activity-profile.js +23 -0
- package/dist/types/agents/agent-trigger-kinds.d.ts +3 -5
- package/dist/types/agents/agent-trigger-kinds.js +1 -13
- package/dist/types/agents/execution-run-ref.d.ts +1 -8
- package/guarantees/agent/golden/component-boundaries.guarantee.yaml +12 -0
- package/guarantees/agent/golden/product-custody.guarantee.yaml +12 -0
- package/guarantees/agent/golden/product.guarantee.yaml +12 -0
- package/guarantees/agent/golden/scenes/component-boundaries.scene.yaml +864 -0
- package/guarantees/agent/golden/scenes/product-custody.scene.yaml +53 -0
- package/guarantees/agent/golden/scenes/product.scene.yaml +8 -0
- package/guarantees/verifiers/golden.verifiers.yaml +1474 -0
- package/package.json +72 -13
- package/tests/acceptance/golden-product.test.ts +205 -0
- package/tests/acceptance/golden-product.ts +404 -0
- package/tests/acceptance/product/base-red.ts +73 -0
- package/tests/acceptance/product/documentation-examples.ts +68 -0
- package/tests/acceptance/product/intent-runtime.ts +145 -0
- package/tests/acceptance/product/release-output.ts +160 -0
- package/tests/acceptance/product/research-artifact.ts +87 -0
- package/tests/acceptance/product/research-revision.ts +82 -0
- package/tests/acceptance/product/research-source.ts +91 -0
- package/tests/acceptance/product/test-chain.ts +192 -0
- package/treeseed.package.yaml +147 -0
- package/dist/agent-capacity/allocation.d.ts +0 -186
- package/dist/agent-capacity/allocation.js +0 -226
- package/dist/agent-capacity/artifact-mutation-receipt.d.ts +0 -49
- package/dist/agent-capacity/artifact-mutation-receipt.js +0 -36
- package/dist/agent-capacity/artifacts.d.ts +0 -107
- package/dist/agent-capacity/artifacts.js +0 -39
- package/dist/agent-capacity/authority/agent-authority-presets.d.ts +0 -13
- package/dist/agent-capacity/authority/agent-authority-presets.js +0 -106
- package/dist/agent-capacity/contracts/operations/workflow-promotion.d.ts +0 -24
- package/dist/agent-capacity/contracts/support/decision-work.d.ts +0 -251
- package/dist/agent-capacity/policy/capacity/allocations/allocation-hierarchy.d.ts +0 -29
- package/dist/agent-capacity/policy/capacity/allocations/allocation-hierarchy.js +0 -110
- package/dist/agent-capacity/validation/allocation.d.ts +0 -12
- package/dist/agent-capacity/validation/allocation.js +0 -115
- package/dist/agent-capacity/validation/workflow-promotion.d.ts +0 -2
- package/dist/agent-capacity/validation/workflow-promotion.js +0 -34
- package/dist/operator-contracts/workday-profile.d.ts +0 -72
- package/dist/operator-contracts/workday-profile.js +0 -106
- package/dist/secrets-capability/service-vault-contracts.d.ts +0 -61
- package/dist/secrets-capability/service-vault-contracts.js +0 -39
- package/dist/treedx/accounts/auth.d.ts +0 -17
- package/dist/treedx/accounts/auth.js +0 -48
- package/dist/treedx/client/accounts/contracts/auth-mode.d.ts +0 -3
- package/dist/treedx/client/accounts/contracts/auth-mode.js +0 -6
- package/dist/treedx/client/build/creation/build-context.d.ts +0 -3
- package/dist/treedx/client/build/creation/build-context.js +0 -7
- package/dist/treedx/client/build/creation/build-snapshot.d.ts +0 -3
- package/dist/treedx/client/build/creation/build-snapshot.js +0 -8
- package/dist/treedx/client/capacity/allocations/contracts/put-capability-grant.d.ts +0 -3
- package/dist/treedx/client/capacity/allocations/contracts/put-capability-grant.js +0 -7
- package/dist/treedx/client/capacity/allocations/queries/list-capability-grants.d.ts +0 -6
- package/dist/treedx/client/capacity/allocations/queries/list-capability-grants.js +0 -10
- package/dist/treedx/client/methods.d.ts +0 -102
- package/dist/treedx/client/methods.js +0 -209
- package/dist/treedx/client/persistence/contracts/restore-storage.d.ts +0 -3
- package/dist/treedx/client/persistence/contracts/restore-storage.js +0 -6
- package/dist/treedx/client/persistence/lifecycle/verify-storage-restore.d.ts +0 -3
- package/dist/treedx/client/persistence/lifecycle/verify-storage-restore.js +0 -6
- package/dist/treedx/client/repositories/creation/register-repository.d.ts +0 -3
- package/dist/treedx/client/repositories/creation/register-repository.js +0 -7
- package/dist/treedx/client/repositories/queries/get-repository.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/get-repository.js +0 -7
- package/dist/treedx/client/repositories/queries/list-repository-paths.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/list-repository-paths.js +0 -7
- package/dist/treedx/client/repositories/queries/list-repository-refs.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/list-repository-refs.js +0 -12
- package/dist/treedx/client/repositories/queries/query-repository.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/query-repository.js +0 -7
- package/dist/treedx/client/repositories/queries/read-repository-file.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/read-repository-file.js +0 -6
- package/dist/treedx/client/repositories/queries/read-repository-files.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/read-repository-files.js +0 -7
- package/dist/treedx/client/repositories/queries/search-repository-files.d.ts +0 -3
- package/dist/treedx/client/repositories/queries/search-repository-files.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/artifacts/contracts/download-artifact.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/artifacts/contracts/download-artifact.js +0 -9
- package/dist/treedx/client/support/contracts/treedx/authorization/contracts/whoami.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/authorization/contracts/whoami.js +0 -6
- package/dist/treedx/client/support/contracts/treedx/graph/contracts/parse-context-dsl.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/graph/contracts/parse-context-dsl.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/health/contracts/deep-health.d.ts +0 -5
- package/dist/treedx/client/support/contracts/treedx/health/contracts/deep-health.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/health/contracts/health.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/health/contracts/health.js +0 -6
- package/dist/treedx/client/support/contracts/treedx/health/contracts/metrics.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/health/contracts/metrics.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/health/contracts/prometheus-metrics.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/health/contracts/prometheus-metrics.js +0 -19
- package/dist/treedx/client/support/contracts/treedx/health/contracts/ready.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/health/contracts/ready.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/health/contracts/status.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/health/contracts/status.js +0 -6
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/commit.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/commit.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/diff.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/diff.js +0 -6
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/fetch-remote.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/fetch-remote.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/push.d.ts +0 -6
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/push.js +0 -23
- package/dist/treedx/client/support/contracts/treedx/search/contracts/compact-search-index.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/search/contracts/compact-search-index.js +0 -8
- package/dist/treedx/client/support/contracts/treedx/search/contracts/search.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/search/contracts/search.js +0 -7
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/backup-storage.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/backup-storage.js +0 -8
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/compact-storage.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/compact-storage.js +0 -8
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/assert-binary-ok.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/assert-binary-ok.js +0 -15
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/fetch-with-timeout.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/fetch-with-timeout.js +0 -38
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/headers.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/headers.js +0 -15
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/parse-json-response.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/parse-json-response.js +0 -15
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/query.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/query.js +0 -14
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/repo-id.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/repo-id.js +0 -14
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/request.d.ts +0 -6
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/request.js +0 -41
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/throw-api-error.d.ts +0 -2
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/throw-api-error.js +0 -14
- package/dist/treedx/client/support/contracts/treedx/workspaces/contracts/exec.d.ts +0 -3
- package/dist/treedx/client/support/contracts/treedx/workspaces/contracts/exec.js +0 -7
- package/dist/treedx/client/support/creation/apply-changeset.d.ts +0 -3
- package/dist/treedx/client/support/creation/apply-changeset.js +0 -10
- package/dist/treedx/client/support/creation/apply-storage-migration.d.ts +0 -3
- package/dist/treedx/client/support/creation/apply-storage-migration.js +0 -7
- package/dist/treedx/client/support/creation/create-migration.d.ts +0 -6
- package/dist/treedx/client/support/creation/create-migration.js +0 -7
- package/dist/treedx/client/support/creation/export-artifact.d.ts +0 -3
- package/dist/treedx/client/support/creation/export-artifact.js +0 -8
- package/dist/treedx/client/support/creation/plan-storage-migration.d.ts +0 -3
- package/dist/treedx/client/support/creation/plan-storage-migration.js +0 -7
- package/dist/treedx/client/support/creation/request-binary.d.ts +0 -6
- package/dist/treedx/client/support/creation/request-binary.js +0 -42
- package/dist/treedx/client/support/creation/write-file.d.ts +0 -3
- package/dist/treedx/client/support/creation/write-file.js +0 -10
- package/dist/treedx/client/support/creation/write-files.d.ts +0 -3
- package/dist/treedx/client/support/creation/write-files.js +0 -12
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/get-artifact.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/get-artifact.js +0 -7
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/list-artifacts.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/list-artifacts.js +0 -7
- package/dist/treedx/client/support/queries/treedx/authorization/queries/effective-scope.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/authorization/queries/effective-scope.js +0 -9
- package/dist/treedx/client/support/queries/treedx/authorization/queries/list-capabilities.d.ts +0 -4
- package/dist/treedx/client/support/queries/treedx/authorization/queries/list-capabilities.js +0 -6
- package/dist/treedx/client/support/queries/treedx/federation/queries/get-placement.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/federation/queries/get-placement.js +0 -7
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-node.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-node.js +0 -7
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-related.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-related.js +0 -7
- package/dist/treedx/client/support/queries/treedx/graph/queries/list-nodes.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/graph/queries/list-nodes.js +0 -7
- package/dist/treedx/client/support/queries/treedx/repositories/queries/list-tree.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/repositories/queries/list-tree.js +0 -10
- package/dist/treedx/client/support/queries/treedx/repositories/queries/read-file.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/repositories/queries/read-file.js +0 -9
- package/dist/treedx/client/support/queries/treedx/search/queries/get-search-index-status.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/search/queries/get-search-index-status.js +0 -7
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-migration.d.ts +0 -6
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-migration.js +0 -7
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-snapshot.d.ts +0 -6
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-snapshot.js +0 -7
- package/dist/treedx/client/support/queries/treedx/storage/queries/list-storage-migrations.d.ts +0 -6
- package/dist/treedx/client/support/queries/treedx/storage/queries/list-storage-migrations.js +0 -6
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-audit-events.d.ts +0 -15
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-audit-events.js +0 -6
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-repositories.d.ts +0 -3
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-repositories.js +0 -7
- package/dist/treedx/client/support/retirement/cleanup-artifacts.d.ts +0 -3
- package/dist/treedx/client/support/retirement/cleanup-artifacts.js +0 -7
- package/dist/treedx/client/support/retirement/delete-artifact.d.ts +0 -3
- package/dist/treedx/client/support/retirement/delete-artifact.js +0 -7
- package/dist/treedx/client/support/retirement/delete-file.d.ts +0 -3
- package/dist/treedx/client/support/retirement/delete-file.js +0 -10
- package/dist/treedx/client/support/retirement/rollback-storage-migration.d.ts +0 -3
- package/dist/treedx/client/support/retirement/rollback-storage-migration.js +0 -7
- package/dist/treedx/client/support/updates/patch-file.d.ts +0 -3
- package/dist/treedx/client/support/updates/patch-file.js +0 -10
- package/dist/treedx/client/support/updates/refresh-search-index.d.ts +0 -3
- package/dist/treedx/client/support/updates/refresh-search-index.js +0 -8
- package/dist/treedx/client/treedx/blobs/contracts/download-blob.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/contracts/download-blob.js +0 -6
- package/dist/treedx/client/treedx/blobs/creation/create-blob-upload.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/create-blob-upload.js +0 -8
- package/dist/treedx/client/treedx/blobs/creation/request-blob-download.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/request-blob-download.js +0 -27
- package/dist/treedx/client/treedx/blobs/creation/request-blob-upload.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/request-blob-upload.js +0 -41
- package/dist/treedx/client/treedx/blobs/creation/upload-blob-part.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/upload-blob-part.js +0 -27
- package/dist/treedx/client/treedx/blobs/creation/upload-blob.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/upload-blob.js +0 -6
- package/dist/treedx/client/treedx/blobs/creation/write-blob.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/creation/write-blob.js +0 -8
- package/dist/treedx/client/treedx/blobs/lifecycle/complete-blob-upload.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/lifecycle/complete-blob-upload.js +0 -8
- package/dist/treedx/client/treedx/blobs/queries/read-blob.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/queries/read-blob.js +0 -10
- package/dist/treedx/client/treedx/blobs/retirement/abort-blob-upload.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/retirement/abort-blob-upload.js +0 -7
- package/dist/treedx/client/treedx/blobs/retirement/delete-blob.d.ts +0 -3
- package/dist/treedx/client/treedx/blobs/retirement/delete-blob.js +0 -8
- package/dist/treedx/client/treedx/federation/contracts/federated-query.d.ts +0 -3
- package/dist/treedx/client/treedx/federation/contracts/federated-query.js +0 -7
- package/dist/treedx/client/treedx/federation/creation/plan-federated-query.d.ts +0 -3
- package/dist/treedx/client/treedx/federation/creation/plan-federated-query.js +0 -6
- package/dist/treedx/client/treedx/federation/queries/check-mirror-health.d.ts +0 -3
- package/dist/treedx/client/treedx/federation/queries/check-mirror-health.js +0 -7
- package/dist/treedx/client/treedx/federation/updates/promote-mirror.d.ts +0 -3
- package/dist/treedx/client/treedx/federation/updates/promote-mirror.js +0 -7
- package/dist/treedx/client/treedx/federation/updates/sync-mirror.d.ts +0 -3
- package/dist/treedx/client/treedx/federation/updates/sync-mirror.js +0 -7
- package/dist/treedx/client/treedx/graph/contracts/federated-context.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/contracts/federated-context.js +0 -7
- package/dist/treedx/client/treedx/graph/contracts/federated-graph.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/contracts/federated-graph.js +0 -7
- package/dist/treedx/client/treedx/graph/contracts/graph-search.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/contracts/graph-search.js +0 -8
- package/dist/treedx/client/treedx/graph/queries/get-graph-node.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/get-graph-node.js +0 -10
- package/dist/treedx/client/treedx/graph/queries/get-graph-refresh-job.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/get-graph-refresh-job.js +0 -7
- package/dist/treedx/client/treedx/graph/queries/get-subgraph.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/get-subgraph.js +0 -7
- package/dist/treedx/client/treedx/graph/queries/query-graph.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/query-graph.js +0 -7
- package/dist/treedx/client/treedx/graph/queries/search-graph-entities.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/search-graph-entities.js +0 -6
- package/dist/treedx/client/treedx/graph/queries/search-graph-files.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/search-graph-files.js +0 -6
- package/dist/treedx/client/treedx/graph/queries/search-graph-sections.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/queries/search-graph-sections.js +0 -6
- package/dist/treedx/client/treedx/graph/updates/refresh-graph.d.ts +0 -3
- package/dist/treedx/client/treedx/graph/updates/refresh-graph.js +0 -7
- package/dist/treedx/client/treedx/search/contracts/federated-search.d.ts +0 -3
- package/dist/treedx/client/treedx/search/contracts/federated-search.js +0 -7
- package/dist/treedx/client/treedx/workspaces/creation/create-workspace.d.ts +0 -3
- package/dist/treedx/client/treedx/workspaces/creation/create-workspace.js +0 -7
- package/dist/treedx/client/treedx/workspaces/retirement/abandon-workspace.d.ts +0 -3
- package/dist/treedx/client/treedx/workspaces/retirement/abandon-workspace.js +0 -12
- package/dist/treedx/client/treedx/workspaces/retirement/close-workspace.d.ts +0 -2
- package/dist/treedx/client/treedx/workspaces/retirement/close-workspace.js +0 -6
- package/dist/treedx/generated/openapi-types.d.ts +0 -3662
- package/dist/treedx/generated/openapi-types.js +0 -0
- package/dist/treedx/support/client.d.ts +0 -251
- package/dist/treedx/support/client.js +0 -252
- package/dist/treedx/support/errors.d.ts +0 -13
- package/dist/treedx/support/errors.js +0 -17
- package/dist/treedx/types/tree-dx-actor.d.ts +0 -209
- package/dist/treedx/types/tree-dx-actor.js +0 -8
- package/dist/treedx/types/tree-dx-artifact-list-response.d.ts +0 -13
- package/dist/treedx/types/tree-dx-artifact-list-response.js +0 -0
- package/dist/treedx/types/tree-dx-changeset.d.ts +0 -51
- package/dist/treedx/types/tree-dx-changeset.js +0 -6
- package/dist/treedx/types/tree-dx-context-request.d.ts +0 -245
- package/dist/treedx/types/tree-dx-context-request.js +0 -0
- package/dist/treedx/types/tree-dx-exec-result.d.ts +0 -249
- package/dist/treedx/types/tree-dx-exec-result.js +0 -0
- package/dist/treedx/types/tree-dx-list-tree-request.d.ts +0 -222
- package/dist/treedx/types/tree-dx-list-tree-request.js +0 -0
- package/dist/treedx/types/tree-dx-push-request.d.ts +0 -229
- package/dist/treedx/types/tree-dx-push-request.js +0 -0
- /package/dist/{agent-capacity/contracts/operations/workflow-promotion.js → site-contracts/cloudflare.js} +0 -0
- /package/dist/{agent-capacity/contracts/support/decision-work.js → site-contracts/platform.js} +0 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import {Session} from 'node:inspector/promises';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import {createHash} from 'node:crypto';
|
|
4
|
+
import {once} from 'node:events';
|
|
5
|
+
import {readFileSync,realpathSync,lstatSync} from 'node:fs';
|
|
6
|
+
import {createServer} from 'node:http';
|
|
7
|
+
import {isAbsolute,resolve} from 'node:path';
|
|
8
|
+
import {pathToFileURL} from 'node:url';
|
|
9
|
+
|
|
10
|
+
const label='ACCEPTANCE_SDK_INTENT_PRODUCT';
|
|
11
|
+
type Request={method:string|undefined;path:string|undefined;body:string};
|
|
12
|
+
/** Read native V8 entry counts for the owning compiled public normalizer only. */
|
|
13
|
+
export function sdkNormalizerCoverageCount(root:string,observation:unknown):number{
|
|
14
|
+
const label='ACCEPTANCE_SDK_NORMALIZATION_PATH';assert.ok(isAbsolute(root)&&resolve(root)===root,label);
|
|
15
|
+
assert.ok(observation&&typeof observation==='object'&&!Array.isArray(observation),label);
|
|
16
|
+
const scripts=Reflect.get(observation,'result');assert.ok(Array.isArray(scripts),label);
|
|
17
|
+
const expected=pathToFileURL(resolve(root,'dist/operator-contracts/workday-lifecycle.js')).href,matched:Array<Record<string,unknown>>=[];
|
|
18
|
+
for(const script of scripts){assert.ok(script&&typeof script==='object'&&!Array.isArray(script)&&typeof script.url==='string',label);if(script.url!==expected)continue;
|
|
19
|
+
assert.ok(Array.isArray(script.functions),label);for(const fn of script.functions){assert.ok(fn&&typeof fn==='object'&&!Array.isArray(fn),label);if(fn.functionName==='normalizeWorkdayIntent')matched.push(fn);}
|
|
20
|
+
}
|
|
21
|
+
assert.ok(matched.length<=1,label+': Duplicate owning function observation');if(!matched.length)return 0;
|
|
22
|
+
const ranges=matched[0]!.ranges;assert.ok(Array.isArray(ranges)&&ranges.length>0,label+': Original measured function range required');
|
|
23
|
+
for(const range of ranges){assert.ok(range&&typeof range==='object'&&!Array.isArray(range),label);for(const key of ['startOffset','endOffset','count'])assert.ok(Number.isSafeInteger(range[key])&&range[key]>=0,label+': Unmeasured native function range');assert.ok(range.endOffset>range.startOffset,label);}
|
|
24
|
+
return ranges[0]!.count as number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** One local inspector session observes immutable candidate bytes. It never
|
|
28
|
+
* changes source, installs a loader, opens a port or connects to another process. */
|
|
29
|
+
export class SdkIntentNormalizerObservation{
|
|
30
|
+
private static active=false;
|
|
31
|
+
private readonly session=new Session();private owned=false;private connected=false;private started=false;
|
|
32
|
+
private asset='';private digest='';private canonicalRoot='';
|
|
33
|
+
constructor(private readonly root:string){}
|
|
34
|
+
get closed(){return !this.owned;}
|
|
35
|
+
async start(){
|
|
36
|
+
const label='ACCEPTANCE_SDK_NORMALIZATION_PATH';assert.ok(!this.owned&&!SdkIntentNormalizerObservation.active,label+': Concurrent observation denied');
|
|
37
|
+
assert.ok(isAbsolute(this.root)&&realpathSync(this.root)===resolve(this.root),label);this.canonicalRoot=realpathSync(this.root);
|
|
38
|
+
this.asset=resolve(this.root,'dist/operator-contracts/workday-lifecycle.js');assert.equal(realpathSync(this.asset),this.asset,label);assert.ok(lstatSync(this.asset).isFile(),label);
|
|
39
|
+
this.digest=createHash('sha256').update(readFileSync(this.asset)).digest('hex');SdkIntentNormalizerObservation.active=true;this.owned=true;
|
|
40
|
+
try{this.session.connect();this.connected=true;await this.session.post('Profiler.enable');await this.session.post('Profiler.startPreciseCoverage',{callCount:true,detailed:true});this.started=true;}
|
|
41
|
+
catch(error){try{await this.close();}catch(cleanup){throw new AggregateError([error,cleanup],label+': Observation and cleanup failed');}throw error;}
|
|
42
|
+
}
|
|
43
|
+
async read(){
|
|
44
|
+
const label='ACCEPTANCE_SDK_NORMALIZATION_PATH';assert.ok(this.owned&&this.started,label+': Original observation required');
|
|
45
|
+
assert.equal(createHash('sha256').update(readFileSync(this.asset)).digest('hex'),this.digest,label+': Compiled normalizer changed');
|
|
46
|
+
return sdkNormalizerCoverageCount(this.canonicalRoot,await this.session.post('Profiler.takePreciseCoverage'));
|
|
47
|
+
}
|
|
48
|
+
async close(){
|
|
49
|
+
if(!this.owned)return;const failures:unknown[]=[];
|
|
50
|
+
if(this.started)try{await this.session.post('Profiler.stopPreciseCoverage');}catch(error){failures.push(error);}
|
|
51
|
+
if(this.connected){try{await this.session.post('Profiler.disable');}catch(error){failures.push(error);}try{this.session.disconnect();}catch(error){failures.push(error);}}
|
|
52
|
+
this.started=false;this.connected=false;this.owned=false;SdkIntentNormalizerObservation.active=false;
|
|
53
|
+
if(failures.length)throw new AggregateError(failures,'ACCEPTANCE_SDK_NORMALIZATION_PATH: Native observation cleanup failed');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Inspect the original built public exports inside existing native replay
|
|
58
|
+
* custody. Controlled replies are transport inputs, never API admission or
|
|
59
|
+
* managed Tester/Engineer receipts. No source implementation is substituted. */
|
|
60
|
+
export async function verifySdkIntentRuntime(root:string){
|
|
61
|
+
const requests:Request[]=[],failures:Array<{expectation:string;observed:string}>=[];
|
|
62
|
+
const targets:Array<{specifier:string;path:string;sha256:string}>=[];
|
|
63
|
+
const normalizationPathFailures:Array<{expectation:string;count:number}>=[],directNormalizationFailures:Array<{expectation:string;observed:string}>=[];
|
|
64
|
+
let checks=0,currentExpectation='';
|
|
65
|
+
try{
|
|
66
|
+
assert.ok(typeof root==='string'&&isAbsolute(root)&&realpathSync(root)===resolve(root),label+': exact native package root required');
|
|
67
|
+
const manifest=JSON.parse(readFileSync(resolve(root,'package.json'),'utf8')) as {name?:unknown;exports?:Record<string,{default?:unknown}>};
|
|
68
|
+
assert.equal(manifest.name,'@treeseed/sdk',label+': original SDK identity required');
|
|
69
|
+
const load=async(specifier:string)=>{
|
|
70
|
+
const target=manifest.exports?.[specifier]?.default;
|
|
71
|
+
assert.ok(typeof target==='string'&&target.startsWith('./dist/')&&!target.split('/').includes('..'),label+': public built export required');
|
|
72
|
+
const path=resolve(root,target);assert.equal(realpathSync(path),path,label+': workspace/source links are forbidden');assert.equal(lstatSync(path).isFile(),true,label);
|
|
73
|
+
targets.push({specifier,path:target,sha256:createHash('sha256').update(readFileSync(path)).digest('hex')});
|
|
74
|
+
return import(pathToFileURL(path).href);
|
|
75
|
+
};
|
|
76
|
+
const sdk=await load('./control-plane-client') as typeof import('@treeseed/sdk/control-plane-client');
|
|
77
|
+
const contracts=await load('./operator-contracts') as typeof import('@treeseed/sdk/operator-contracts');
|
|
78
|
+
assert.equal(typeof sdk.ControlPlaneClient,'function',label);assert.ok(contracts.CONTROL_PLANE_OPERATIONS?.workdays,label);
|
|
79
|
+
const server=createServer(async(request,response)=>{
|
|
80
|
+
const chunks:Buffer[]=[];for await(const chunk of request)chunks.push(Buffer.isBuffer(chunk)?chunk:Buffer.from(chunk));
|
|
81
|
+
requests.push({method:request.method,path:request.url,body:Buffer.concat(chunks).toString('utf8')});
|
|
82
|
+
response.writeHead(200,{'content-type':'application/json'});response.end(JSON.stringify({data:{marker:'sdk-intent-inspection'}}));
|
|
83
|
+
});
|
|
84
|
+
let cleanupConfirmed=false;const normalization=new SdkIntentNormalizerObservation(root);
|
|
85
|
+
try{
|
|
86
|
+
server.listen(0,'127.0.0.1');await once(server,'listening');const address=server.address();assert.ok(address&&typeof address!=='string',label);
|
|
87
|
+
await normalization.start();
|
|
88
|
+
const client=new sdk.ControlPlaneClient({profile:{serverId:'local',label:'Local',baseUrl:'http://127.0.0.1:'+address.port}});
|
|
89
|
+
const base={schemaVersion:'treeseed.workday-intent/v1',teamId:'team',profileId:'default',projects:['sdk'],startsAt:'2030-01-01T00:00:00Z',durationSeconds:600,
|
|
90
|
+
proposalIds:['proposal-original'],groupIds:['ui-snapshot-admin-chart'],agentSelection:{activityTypes:['planning']},allocation:{planningPercent:20,allocationWeight:2}};
|
|
91
|
+
const ordered=['A','Z','a','a-1','a.1','a/1','a:1'];
|
|
92
|
+
const capture=async(expectation:string,action:()=>Promise<void>)=>{checks++;currentExpectation=expectation;try{await action();}catch(error){failures.push({expectation,observed:String(error)});}};
|
|
93
|
+
const observe=async(nested:boolean,intent:Record<string,unknown>,expected:Record<string,unknown>|null)=>{
|
|
94
|
+
const body=nested?{intent,cadenceSeconds:3600}:intent;
|
|
95
|
+
const originalIntent=structuredClone(Object.getOwnPropertyDescriptors(intent)),originalBody=structuredClone(Object.getOwnPropertyDescriptors(body));
|
|
96
|
+
const before=requests.length,binding=nested?contracts.CONTROL_PLANE_OPERATIONS.workdays.createSchedule:contracts.CONTROL_PLANE_OPERATIONS.workdays.preflight;
|
|
97
|
+
try{let value:unknown,denied=false;try{value=Reflect.apply(contracts.normalizeWorkdayIntent,contracts,[intent]);}catch{denied=true;}
|
|
98
|
+
if(expected===null)assert.equal(denied,true,label+': Direct public normalization accepted invalid own intent');else{assert.equal(denied,false,label);assert.deepEqual(value,expected,label+': Direct public normalization differs from exact intent');}
|
|
99
|
+
}catch(error){directNormalizationFailures.push({expectation:currentExpectation,observed:String(error)});}
|
|
100
|
+
await normalization.read(); // Exclude the independent direct-call control from invoke's own measured path.
|
|
101
|
+
|
|
102
|
+
try{
|
|
103
|
+
if(expected===null){let denied=false;try{await client.invoke(binding,{path:{teamId:'team'},query:{},body},{signal:AbortSignal.timeout(10_000)});}catch{denied=true;}
|
|
104
|
+
assert.equal(denied,true,label+': invalid own intent accepted');assert.equal(requests.length,before,label+': invalid intent reached transport');
|
|
105
|
+
}else{
|
|
106
|
+
const result=await client.invoke(binding,{path:{teamId:'team'},query:{},body},{signal:AbortSignal.timeout(10_000)});
|
|
107
|
+
assert.deepEqual(result,{data:{marker:'sdk-intent-inspection'}},label);assert.equal(requests.length,before+1,label);
|
|
108
|
+
assert.deepEqual(requests.at(-1),{method:'POST',path:'/v1/teams/team/'+(nested?'workday-schedules':'workday-runs/preflight'),body:JSON.stringify(nested?{intent:expected,cadenceSeconds:3600}:expected)},label+': exact canonical bytes and independent controls required');
|
|
109
|
+
const sent=JSON.parse(requests.at(-1)!.body) as Record<string,unknown>,transmitted=nested?sent.intent as Record<string,unknown>:sent;
|
|
110
|
+
for(const key of ['intentDigest','preflightDigest'])assert.equal(Object.hasOwn(transmitted,key),false,label+': SDK must not invent API digests');
|
|
111
|
+
}
|
|
112
|
+
}finally{const count=await normalization.read();if(count!==1)normalizationPathFailures.push({expectation:currentExpectation,count});assert.deepEqual(Object.getOwnPropertyDescriptors(intent),originalIntent,label+': caller intent changed');assert.deepEqual(Object.getOwnPropertyDescriptors(body),originalBody,label+': caller body changed');}
|
|
113
|
+
};
|
|
114
|
+
const tree=contracts.TREESEED_COMMAND_TREE_V1,originalTree=structuredClone(tree);
|
|
115
|
+
const leaves=new Map<string,Extract<(typeof tree.commands)[number],{nodeType:'leaf'}>>();
|
|
116
|
+
const visit=(nodes:typeof tree.commands,parent:string[]=[])=>{for(const node of nodes){const path=[...parent,node.segment];if(node.nodeType==='branch')visit(node.children,path);else leaves.set(path.join(' '),node);}};
|
|
117
|
+
visit(tree.commands);
|
|
118
|
+
for(const [path,operationId,field]of [['workdays plan','workdays.plan','decisionIds'],['workdays schedules start','workdays.schedules.create','intent.decisionIds']])await capture('descriptor/'+operationId,async()=>{
|
|
119
|
+
const leaf=leaves.get(path!);assert.ok(leaf&&leaf.execution.kind==='operation',label+': original generated operation required');assert.equal(leaf.execution.operationId,operationId,label);
|
|
120
|
+
const options=leaf.options?.filter(option=>option.name==='--decision');assert.equal(options?.length,1,label);assert.equal(options![0]!.type,'string[]',label);
|
|
121
|
+
assert.deepEqual(leaf.execution.input?.filter(input=>input.name==='decision'||input.field===field),[{target:'body',field,source:'option',name:'decision',required:false,transform:'csv'}],label);
|
|
122
|
+
for(const prohibited of ['executionPlanId','capacityPlanId','executionInputId','demandSetId'])assert.ok(!leaf.execution.input?.some(input=>input.field===prohibited||input.field==='intent.'+prohibited||input.name===prohibited),label);
|
|
123
|
+
assert.deepEqual(tree,originalTree,label+': original generated contracts changed');
|
|
124
|
+
});
|
|
125
|
+
for(const nested of [false,true]){
|
|
126
|
+
const shape=nested?'nested':'direct';
|
|
127
|
+
for(const planningOnly of [false,true]){
|
|
128
|
+
const input={...base,planningOnly};await capture('omitted/'+shape+'/'+planningOnly,()=>observe(nested,input,input));
|
|
129
|
+
for(const [index,decisionIds]of [ordered.map(id=>' '+id+' '),[...ordered].reverse(),[ordered[3]!,ordered[6]!,ordered[0]!,ordered[5]!,ordered[2]!,ordered[4]!,ordered[1]!]].entries())
|
|
130
|
+
await capture('canonical/'+shape+'/'+planningOnly+'/'+index,()=>observe(nested,{...input,decisionIds},{...input,decisionIds:ordered}));
|
|
131
|
+
}
|
|
132
|
+
await capture('maximum-200/'+shape,()=>observe(nested,{...base,decisionIds:['x'.repeat(200)]},{...base,decisionIds:['x'.repeat(200)]}));
|
|
133
|
+
const malformed:unknown[]=[[],[''],[' \t\n '],['one',' one '],['same','same'],[null],[1],'one',null,Array.from({length:65},(_,index)=>'decision-'+index),['x'.repeat(201)],['é'],['e\u0301'],['\uE000'],['\u{10000}'],['decision?']];
|
|
134
|
+
for(const [index,decisionIds]of malformed.entries())await capture('invalid-decision/'+shape+'/'+index,()=>observe(nested,{...base,decisionIds},null));
|
|
135
|
+
for(const field of ['executionPlanId','capacityPlanId','executionInputId','demandSetId'])for(const [index,value]of [undefined,null,'','derived-identity'].entries())for(const enumerable of [true,false]){
|
|
136
|
+
const intent={...base};Object.defineProperty(intent,field,{value,enumerable,configurable:true,writable:true});
|
|
137
|
+
await capture('retired/'+shape+'/'+field+'/'+index+'/'+(enumerable?'enumerable':'hidden'),()=>observe(nested,intent,null));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}finally{try{server.closeAllConnections();if(server.listening)await new Promise<void>((done,reject)=>server.close(error=>error?reject(error):done()));}finally{await normalization.close();cleanupConfirmed=!server.listening&&normalization.closed;}}
|
|
141
|
+
const observation={checks,failures,normalizationPathFailures,directNormalizationFailures,targets,requests,cleanupConfirmed};console.log(JSON.stringify({sdkIntentRuntimeObservation:observation}));
|
|
142
|
+
assert.equal(cleanupConfirmed,true,label+': disposable transport residue');if(failures.length||normalizationPathFailures.length||directNormalizationFailures.length)throw new Error(label+': independent public intent behavior failed',{cause:observation});
|
|
143
|
+
return observation;
|
|
144
|
+
}catch(error){if(error instanceof Error&&error.message.startsWith(label))throw error;throw new Error(label+': exact public runtime inspection failed',{cause:error});}
|
|
145
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
|
|
4
|
+
type Row = Record<string, any>;
|
|
5
|
+
const code = 'ACCEPTANCE_SDK_RELEASE_OUTPUT';
|
|
6
|
+
export const sdkReleaseCommands = ['npm run release:verify', 'npm pack'] as const;
|
|
7
|
+
export const sdkNativeTestCommand = 'npm run test:contracts -- --reporter=default --reporter=json';
|
|
8
|
+
export function isSdkArchiveCommand(command: unknown): command is string {
|
|
9
|
+
return typeof command === 'string' && /^npm run standards:acceptance -- --archive (?:\.\/)?[a-zA-Z0-9][a-zA-Z0-9._-]*\.tgz$/u.test(command);
|
|
10
|
+
}
|
|
11
|
+
function object(value: unknown): Row {
|
|
12
|
+
assert.ok(value && typeof value === 'object' && !Array.isArray(value), `${code}: Original object required`);
|
|
13
|
+
return value as Row;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** One original producer boundary for release and approved-test command observations. */
|
|
17
|
+
function originalSdkOutput(participant: Row, events: unknown, commit: string, command: string, status: 'passed' | 'failed') {
|
|
18
|
+
const attempt = object(participant.assignmentAttempt), records = object(participant.assignmentResult).verification;
|
|
19
|
+
for (const key of ['id', 'teamId', 'projectId', 'workdayId']) assert.ok(typeof attempt[key] === 'string' && attempt[key].trim(), `${code}: Exact original assignment scope required`);
|
|
20
|
+
assert.ok(Array.isArray(events) && events.every(event => event && typeof event === 'object' && !Array.isArray(event)), `${code}: Complete original execution events required`);
|
|
21
|
+
assert.ok(Array.isArray(records) && records.every(value => value && typeof value === 'object' && !Array.isArray(value)), `${code}: Canonical measured inventory required`);
|
|
22
|
+
const original = events.filter(event => event.assignmentId === attempt.id && event.eventType === 'provider.execution.completed');
|
|
23
|
+
assert.equal(original.length, 1, `${code}: One original execution event per independent participant required`);
|
|
24
|
+
const event = object(original[0]), payload = object(event.protectedPayload);
|
|
25
|
+
assert.ok(event.runId === attempt.workdayId && event.teamId === attempt.teamId && event.status === 'completed'
|
|
26
|
+
&& payload.sourceCommit === commit && Array.isArray(payload.verificationObservations) && Array.isArray(payload.verificationRecords),
|
|
27
|
+
`${code}: Original candidate and protected runner outputs required`);
|
|
28
|
+
assert.ok([...payload.verificationRecords, ...payload.verificationObservations].every(record => record && typeof record === 'object' && !Array.isArray(record)), `${code}: Malformed original command observation`);
|
|
29
|
+
const receipts = records.filter(record => record.command === command); assert.equal(receipts.length, 1, `${code}: Required command must be independently measured once`);
|
|
30
|
+
const receipt = receipts[0]!;
|
|
31
|
+
assert.ok(receipt.status === status && receipt.exitCode === (status === 'passed' ? 0 : 1)
|
|
32
|
+
&& Number.isSafeInteger(receipt.durationSeconds) && receipt.durationSeconds >= 0, `${code}: Actual measured command required`);
|
|
33
|
+
assert.deepEqual(payload.verificationRecords.filter((record: Row) => record.command === command), [receipt], `${code}: Canonical receipt differs from original runner record`);
|
|
34
|
+
const observed = payload.verificationObservations.filter((record: Row) => record.command === command);
|
|
35
|
+
assert.equal(observed.length, 1, `${code}: Missing or duplicated original output`);
|
|
36
|
+
const { stdout, stderr, ...measured } = object(observed[0]);
|
|
37
|
+
assert.ok(typeof stdout === 'string' && typeof stderr === 'string', `${code}: Original output bytes required`);
|
|
38
|
+
assert.deepEqual(measured, receipt, `${code}: Output belongs to another measured command`);
|
|
39
|
+
assert.equal(receipt.outputDigest, `sha256:${createHash('sha256').update(JSON.stringify({ stderr, stdout })).digest('hex')}`, `${code}: Original output digest mismatch`);
|
|
40
|
+
return { stdout, stderr };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Read only original protected runner observations through the authorized API. */
|
|
44
|
+
export function verifySdkReleaseOutputs(actor: Row, reviewer: Row, events: unknown, commit: string): void {
|
|
45
|
+
const digests: string[] = [];
|
|
46
|
+
for (const participant of [actor, reviewer]) {
|
|
47
|
+
const records = object(participant.assignmentResult).verification;
|
|
48
|
+
assert.ok(Array.isArray(records), `${code}: Complete release command inventory required`);
|
|
49
|
+
const archives = records.filter(record => isSdkArchiveCommand(record.command));
|
|
50
|
+
assert.equal(archives.length, 1, `${code}: One current-directory archive inspection required`);
|
|
51
|
+
const outputs = new Map<string, string>();
|
|
52
|
+
for (const command of [...sdkReleaseCommands, String(archives[0]!.command)])
|
|
53
|
+
outputs.set(command, originalSdkOutput(participant, events, commit, command, 'passed').stdout);
|
|
54
|
+
digests.push(sdkPackedArchiveDigest(outputs.get('npm pack')!, outputs.get(String(archives[0]!.command))!, String(archives[0]!.command)));
|
|
55
|
+
}
|
|
56
|
+
assert.equal(digests[0], digests[1], `${code}: Independent participants inspected different archive bytes`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** The owning Vitest reporter supplies assertion identities/status/timing; no exit-zero inference. */
|
|
60
|
+
export function nativeTestReport(stdout: string, passed: boolean): Map<string, { path: string; status: string }> {
|
|
61
|
+
const label = 'ACCEPTANCE_SDK_APPROVED_TESTS';
|
|
62
|
+
const clean = stdout.replace(/\u001b\[[0-9;]*m/gu, '');
|
|
63
|
+
const json = clean.split(/\r?\n/u).filter(line => line.startsWith('{"numTotalTestSuites":'));
|
|
64
|
+
assert.equal(json.length, 1, `${label}: One complete native assertion report required`);
|
|
65
|
+
const report = object(JSON.parse(json[0]!)); assert.equal(report.success, passed, label);
|
|
66
|
+
const roots = [...clean.matchAll(/^\s*RUN\s+v\S+\s+(\/[^\r\n]+)$/gmu)]; assert.equal(roots.length, 1, `${label}: Original native execution root required`);
|
|
67
|
+
const root = roots[0]![1]!.trim();
|
|
68
|
+
for (const key of ['numTotalTestSuites', 'numPassedTestSuites', 'numFailedTestSuites', 'numPendingTestSuites', 'numTotalTests', 'numPassedTests', 'numFailedTests', 'numPendingTests', 'numTodoTests'])
|
|
69
|
+
assert.ok(Number.isSafeInteger(report[key]) && report[key] >= 0, `${label}: Complete native counts required`);
|
|
70
|
+
assert.ok(report.numTotalTests > 0 && report.numTotalTestSuites > 0 && Number.isFinite(report.startTime), label);
|
|
71
|
+
for (const key of ['numPendingTestSuites', 'numPendingTests', 'numTodoTests']) assert.equal(report[key], 0, `${label}: Partial skipped or todo reports denied`);
|
|
72
|
+
assert.equal(report.numPassedTestSuites + report.numFailedTestSuites, report.numTotalTestSuites, label);
|
|
73
|
+
assert.equal(report.numPassedTests + report.numFailedTests, report.numTotalTests, label);
|
|
74
|
+
assert.ok(passed ? report.numFailedTests === 0 : report.numFailedTests > 0, label);
|
|
75
|
+
assert.ok(Array.isArray(report.testResults) && report.testResults.length > 0 && report.testResults.length <= report.numTotalTestSuites, label);
|
|
76
|
+
const files = new Set<string>(), assertions = new Map<string, { path: string; status: string }>(); let successes = 0, failures = 0;
|
|
77
|
+
for (const value of report.testResults) {
|
|
78
|
+
const file = object(value); assert.ok(typeof file.name === 'string' && file.name.startsWith(`${root}/`), label);
|
|
79
|
+
const path = file.name.slice(root.length + 1);
|
|
80
|
+
assert.ok(/^tests\/.+\.(?:test|spec)\.tsx?$/u.test(path) && !path.split('/').some((part: string) => !part || part === '.' || part === '..') && !files.has(path), `${label}: Unique original test files required`);
|
|
81
|
+
files.add(path); assert.ok(Number.isFinite(file.startTime) && Number.isFinite(file.endTime) && file.startTime >= report.startTime && file.endTime >= file.startTime, label);
|
|
82
|
+
assert.ok(Array.isArray(file.assertionResults) && file.assertionResults.length > 0, `${label}: Empty native file denied`);
|
|
83
|
+
let failed = false;
|
|
84
|
+
for (const entry of file.assertionResults) {
|
|
85
|
+
const test = object(entry), id = `${path}\0${test.fullName}`;
|
|
86
|
+
assert.ok(typeof test.fullName === 'string' && test.fullName.trim() && !assertions.has(id)
|
|
87
|
+
&& ['passed', 'failed'].includes(test.status) && Number.isFinite(test.duration) && test.duration >= 0
|
|
88
|
+
&& Array.isArray(test.failureMessages) && test.failureMessages.every((message: unknown) => typeof message === 'string'), label);
|
|
89
|
+
if (test.status === 'failed') { failed = true; failures++; assert.ok(test.failureMessages.some((message: string) => /\bAssertionError\b/u.test(message)), `${label}: Setup or subprocess errors are not test-first RED`); }
|
|
90
|
+
else { successes++; assert.equal(test.failureMessages.length, 0, label); }
|
|
91
|
+
assertions.set(id, { path, status: test.status });
|
|
92
|
+
}
|
|
93
|
+
assert.equal(file.status, failed ? 'failed' : 'passed', label);
|
|
94
|
+
}
|
|
95
|
+
assert.equal(successes, report.numPassedTests, label); assert.equal(failures, report.numFailedTests, label);
|
|
96
|
+
assert.equal(assertions.size, report.numTotalTests, label);
|
|
97
|
+
return assertions;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Exact committed blobs plus original full RED/GREEN observations prove consumption; semantic BASE intent remains separate. */
|
|
101
|
+
export function verifySdkApprovedTestOutputs(tester: Row, engineer: Row, events: unknown, testerCommit: string, engineerCommit: string, committed: readonly { path: string }[], replayed?: { redAssertions: ReadonlyMap<string,{path:string;status:string}>; greenAssertions: ReadonlyMap<string,{path:string;status:string}> }): void {
|
|
102
|
+
const label = 'ACCEPTANCE_SDK_APPROVED_TESTS';
|
|
103
|
+
assert.ok(/^[a-f0-9]{40}$/u.test(testerCommit) && /^[a-f0-9]{40}$/u.test(engineerCommit) && testerCommit !== engineerCommit, label);
|
|
104
|
+
assert.ok(tester.assignmentAttempt.id !== engineer.assignmentAttempt.id, label);
|
|
105
|
+
for (const key of ['teamId', 'projectId', 'workdayId']) assert.equal(tester.assignmentAttempt[key], engineer.assignmentAttempt[key], label);
|
|
106
|
+
assert.ok(Array.isArray(events), label);
|
|
107
|
+
for (const participant of [tester, engineer]) for (const event of events.filter(value => value?.assignmentId === participant.assignmentAttempt.id))
|
|
108
|
+
assert.equal(event.projectId, participant.assignmentAttempt.projectId, label);
|
|
109
|
+
assert.ok(Array.isArray(committed) && committed.length > 0 && new Set(committed.map(file => file.path)).size === committed.length, label);
|
|
110
|
+
const paths = new Set(committed.filter(file => /\.(?:test|spec)\.tsx?$/u.test(file.path)).map(file => file.path)); assert.ok(paths.size > 0, label);
|
|
111
|
+
const red = nativeTestReport(originalSdkOutput(tester, events, testerCommit, sdkNativeTestCommand, 'failed').stdout, false);
|
|
112
|
+
const green = nativeTestReport(originalSdkOutput(engineer, events, engineerCommit, sdkNativeTestCommand, 'passed').stdout, true);
|
|
113
|
+
assert.deepEqual([...green.keys()].sort(), [...red.keys()].sort(), `${label}: Engineer must execute the same complete assertion inventory`);
|
|
114
|
+
for (const path of paths) assert.ok([...red.values()].some(test => test.path === path), `${label}: Approved committed test omitted from native discovery`);
|
|
115
|
+
for (const test of red.values()) if (test.status === 'failed') assert.ok(paths.has(test.path), `${label}: Unrelated BASE failures remain unaccepted`);
|
|
116
|
+
if(arguments.length>=7){
|
|
117
|
+
assert.ok(replayed&&replayed.redAssertions instanceof Map&&replayed.greenAssertions instanceof Map,label+': independent native replay required');
|
|
118
|
+
for(const[original,replayedAssertions]of [[red,replayed.redAssertions],[green,replayed.greenAssertions]]as const){
|
|
119
|
+
assert.equal(replayedAssertions.size,original.size,label+': independent replay assertion inventory differs');
|
|
120
|
+
for(const[id,observed]of original)assert.deepEqual(replayedAssertions.get(id),observed,label+': original protected assertion differs from independent replay');
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
}
|
|
125
|
+
export function sdkGoldenExecutionEvents(read: (args: string[]) => Row, workday: string, team: string): Row[] {
|
|
126
|
+
const events: Row[] = [], cursors = new Set<string>(), ids = new Set<string>();
|
|
127
|
+
let cursor: string | undefined;
|
|
128
|
+
for (let page = 0; page < 40; page += 1) {
|
|
129
|
+
const result = read(['workdays', 'events', 'list', workday, '--diagnostics', 'full', '--limit', '50', ...(cursor ? ['--cursor', cursor] : [])]);
|
|
130
|
+
assert.ok(result && Array.isArray(result.items) && typeof result.page?.hasMore === 'boolean', `${code}: Complete diagnostic page required`);
|
|
131
|
+
for (const event of result.items) {
|
|
132
|
+
assert.ok(event && typeof event.id === 'string' && event.id && !ids.has(event.id)
|
|
133
|
+
&& event.runId === workday && event.teamId === team, `${code}: Duplicate or foreign diagnostic event`);
|
|
134
|
+
ids.add(event.id); events.push(event);
|
|
135
|
+
}
|
|
136
|
+
if (!result.page.hasMore) return events;
|
|
137
|
+
const next: unknown = result.page.nextCursor;
|
|
138
|
+
assert.ok(typeof next === 'string' && next && !cursors.has(next),
|
|
139
|
+
`${code}: Missing or repeated diagnostic cursor`);
|
|
140
|
+
cursor = next; cursors.add(next);
|
|
141
|
+
}
|
|
142
|
+
assert.fail(`${code}: Incomplete diagnostic inventory`);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** Parse outputs of the existing native pack and standards archive boundary. */
|
|
146
|
+
export function sdkPackedArchiveDigest(packed: string, inspectionOutput: string, command: string): string {
|
|
147
|
+
assert.ok(isSdkArchiveCommand(command), `${code}: Exact public standards archive command required`);
|
|
148
|
+
const lines = packed.trimEnd().split(/\r?\n/u), filenames = lines.filter(line => /^[a-zA-Z0-9][a-zA-Z0-9._-]*\.tgz$/u.test(line));
|
|
149
|
+
assert.ok(filenames.length === 1 && lines.at(-1) === filenames[0], `${code}: npm pack must produce one final current-directory archive`);
|
|
150
|
+
const filename = filenames[0]!;
|
|
151
|
+
assert.equal(command.replace('npm run standards:acceptance -- --archive ', '').replace(/^\.\//u, ''), filename,
|
|
152
|
+
`${code}: Inspection did not consume the actual npm pack output`);
|
|
153
|
+
let inspection: Row | undefined;
|
|
154
|
+
try { inspection = JSON.parse(inspectionOutput.trimEnd().split(/\r?\n/u).at(-1)!); } catch { /* Fail below with original evidence intact. */ }
|
|
155
|
+
assert.ok(inspection && inspection.ok === true && typeof inspection.archiveDigest === 'string'
|
|
156
|
+
&& /^sha256:[a-f0-9]{64}$/u.test(inspection.archiveDigest) && Number.isSafeInteger(inspection.declarations)
|
|
157
|
+
&& inspection.declarations > 0 && Number.isSafeInteger(inspection.exportTargets) && inspection.exportTargets > 0,
|
|
158
|
+
`${code}: Actual public standards archive inspection required`);
|
|
159
|
+
return inspection.archiveDigest;
|
|
160
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import{parseSdkResearchCitation,resolveSdkResearchCitation,declaredSdkResearchIntentFields}from'./research-source.ts';
|
|
2
|
+
import assert from'node:assert/strict';
|
|
3
|
+
import{createHash}from'node:crypto';
|
|
4
|
+
import{posix}from'node:path';
|
|
5
|
+
import{parseDocument,visit}from'yaml';
|
|
6
|
+
import{validatePortableContentData}from'@treeseed/sdk/content-validation';
|
|
7
|
+
|
|
8
|
+
type Row=Record<string,unknown>;
|
|
9
|
+
const code='ACCEPTANCE_SDK_RESEARCH_ARTIFACT';
|
|
10
|
+
function row(value:unknown):Row{assert.ok(value&&typeof value==='object'&&!Array.isArray(value),code+': Original public object required');return value as Row;}
|
|
11
|
+
|
|
12
|
+
/** Consume original independently read bytes, retaining the native content model and source authority. */
|
|
13
|
+
export function sdkResearchArtifact(reference:Row,returned:unknown){
|
|
14
|
+
sdkResearchArtifactReference(reference);
|
|
15
|
+
const observed=row(returned);
|
|
16
|
+
assert.ok(observed.ok===true&&observed.repoId===reference.repository&&observed.resolvedRef===reference.commit
|
|
17
|
+
&&Array.isArray(observed.files)&&observed.files.length===1,code+': One complete independent native artifact read required');
|
|
18
|
+
const file=row(observed.files[0]);assert.ok(file.path===reference.path&&typeof file.content==='string'&&Buffer.byteLength(file.content)<=1_048_576,code+': Original exact path and raw bytes required');
|
|
19
|
+
const content=file.content,sha256=createHash('sha256').update(content).digest('hex');
|
|
20
|
+
if(reference.digest!==undefined)assert.equal(reference.digest,'sha256:'+sha256,code+': Original recorded digest differs from bytes');
|
|
21
|
+
const match=content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/u);assert.ok(match,code+': Original native frontmatter required');
|
|
22
|
+
const document=parseDocument(match[1]!);assert.ok(document.errors.length===0&&document.warnings.length===0,code+': Ambiguous native YAML denied');
|
|
23
|
+
visit(document,(_key,node)=>{if(node&&typeof node==='object'&&'anchor'in node)assert.ok(!node.anchor,code+': Native aliases or anchored content denied');});
|
|
24
|
+
const frontmatter=row(document.toJS({maxAliasCount:0})),body=match[2]!.trim();assert.deepEqual(frontmatter,file.frontmatter,code+': Parsed native view contradicts raw bytes');
|
|
25
|
+
if(file.body!==undefined)assert.equal(file.body,body,code+': Native body differs from original bytes');
|
|
26
|
+
if(frontmatter.body!==undefined)assert.equal(frontmatter.body,body,code+': Frontmatter body differs from original bytes');
|
|
27
|
+
const model=frontmatter.schemaVersion==='treeseed.note/v1'?'note':frontmatter.schemaVersion==='treeseed.knowledge-page/v2'?'knowledge':frontmatter.schemaVersion==='treeseed.decision/v1'?'decision':undefined;
|
|
28
|
+
assert.ok(model&&frontmatter.projectId===reference.projectId,code+': Original project-owned canonical artifact required');
|
|
29
|
+
assert.ok(validatePortableContentData(model,model==='decision'?frontmatter:{...frontmatter,body}).ok,code+': Complete original canonical artifact required');
|
|
30
|
+
return{model,frontmatter,body,content,sha256};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Required SDK research facts are read from the frozen owning Git objects; independent governed reviews still own the free-text assessment. */
|
|
34
|
+
export function verifySdkResearchCitations(artifact:Pick<ReturnType<typeof sdkResearchArtifact>,'body'|'frontmatter'>,
|
|
35
|
+
sdkRoot:string,base:string,stage:'preliminary'|'corrected',otherSources:Readonly<Record<string,{root:string;base:string}>>={}){
|
|
36
|
+
const label='ACCEPTANCE_SDK_RESEARCH_SOURCES';assert.ok(artifact&&typeof artifact.body==='string'&&artifact.body.trim()&&artifact.frontmatter&&typeof artifact.frontmatter==='object',label);
|
|
37
|
+
assert.ok(stage==='preliminary'||stage==='corrected',label+': Exact original contribution stage required');
|
|
38
|
+
const values:unknown[]=[...artifact.body.matchAll(/https?:\/\/[^\s<>()\]"'`]+/gu)].map(match=>match[0].replace(/[.,;:!?]+$/u,''));
|
|
39
|
+
for(const name of ['relatedRefs','subjectRefs'])if(artifact.frontmatter[name]!==undefined)assert.ok(Array.isArray(artifact.frontmatter[name]),label+': Canonical original source references required');
|
|
40
|
+
const collect=(value:unknown):void=>{
|
|
41
|
+
if(typeof value==='string'){for(const match of value.matchAll(/https?:\/\/[^\s<>()\]"'`]+/gu))values.push(match[0].replace(/[.,;:!?]+$/u,''));return;}
|
|
42
|
+
if(Array.isArray(value)){for(const item of value)collect(item);return;}
|
|
43
|
+
if(!value||typeof value!=='object')return;const ref=value as Row;
|
|
44
|
+
if(ref.store==='git'||ref.store==='url'){values.push(ref);return;}
|
|
45
|
+
if(ref.store==='treedx'||ref.store==='postgresql')return;
|
|
46
|
+
for(const[key,item]of Object.entries(ref))if(key!=='body')collect(item);
|
|
47
|
+
};collect(artifact.frontmatter);
|
|
48
|
+
|
|
49
|
+
const sources={...otherSources,'treeseed-ai/sdk':{root:sdkRoot,base}},cited=new Map<string,{value:unknown;reference:ReturnType<typeof parseSdkResearchCitation>;observed:ReturnType<typeof resolveSdkResearchCitation>}>();
|
|
50
|
+
for(const value of values){
|
|
51
|
+
let repository:unknown;if(typeof value==='string'){let url:URL;try{url=new URL(value);}catch(cause){throw new Error(label+': Malformed original source citation',{cause});}const parts=url.pathname.split('/');repository=parts[1]+'/'+parts[2];}else{const ref=row(value);if(ref.store==='url'&&typeof ref.url==='string'){const parts=new URL(ref.url).pathname.split('/');repository=parts[1]+'/'+parts[2];}else repository=ref.repository;}
|
|
52
|
+
assert.ok(typeof repository==='string'&&Object.hasOwn(sources,repository),label+': Citation owner must have frozen source custody');
|
|
53
|
+
const owner=sources[repository as keyof typeof sources]!;const reference=parseSdkResearchCitation(value,owner.base,repository);
|
|
54
|
+
assert.ok(reference.anchor||reference.startLine!==undefined,label+': Exact original source location required');
|
|
55
|
+
const observed=resolveSdkResearchCitation(owner.root,owner.base,value,undefined,repository),key=JSON.stringify(reference);
|
|
56
|
+
cited.set(key,{value,reference,observed});
|
|
57
|
+
}
|
|
58
|
+
const entries=[...cited.values()],required=[
|
|
59
|
+
['src/operator-contracts/workday-lifecycle.ts','WorkdayIntent'],['src/entrypoints/clients/control-plane-client.ts','ControlPlaneClient.invoke'],
|
|
60
|
+
['src/operator-contracts/control-plane-operations.ts','workdays.plan'],['src/operator-contracts/control-plane-operations.ts','workdays.schedules.create'],
|
|
61
|
+
['src/operator-contracts/canonical-command-tree.ts','workdays.plan'],['src/operator-contracts/canonical-command-tree.ts','workdays.schedules.create'],
|
|
62
|
+
['src/operator-contracts/workday-lifecycle.ts','WorkdayPreflightReceipt'],['src/operator-contracts/catalog/workdays/selection-commands.ts','WORKDAY_PLAN_OPTIONS'],
|
|
63
|
+
]as const;
|
|
64
|
+
const proves=(entry:typeof entries[number],path:string,symbol:string)=>{
|
|
65
|
+
if(entry.reference.repository!=='treeseed-ai/sdk'||entry.reference.path!==path)return;
|
|
66
|
+
try{return resolveSdkResearchCitation(sdkRoot,base,entry.value,symbol);}catch{return;}
|
|
67
|
+
};
|
|
68
|
+
for(const[path,symbol]of required.slice(0,stage==='preliminary'?2:required.length))assert.ok(entries.some(entry=>proves(entry,path,symbol)),label+': Missing exact source finding '+symbol+' at '+path);
|
|
69
|
+
if(stage==='preliminary'){
|
|
70
|
+
assert.ok(entries.every(entry=>required.slice(0,2).some(([path,symbol])=>proves(entry,path,symbol))),label+': First contribution may cite only WorkdayIntent and ControlPlaneClient.invoke');
|
|
71
|
+
const paragraphs=artifact.body.split(/\n\s*\n/u);
|
|
72
|
+
for(const subject of [/operation\s+bindings?/iu,/generated\s+descriptors?/iu,/per[- ]field\s+provenance/iu])assert.ok(paragraphs.some(paragraph=>subject.test(paragraph)&&/\bpending\b/iu.test(paragraph)),label+': Omitted findings must be explicitly pending');
|
|
73
|
+
}else{
|
|
74
|
+
const intent=entries.map(entry=>proves(entry,required[0][0],required[0][1])).find(value=>value!==undefined);assert.ok(intent,label);
|
|
75
|
+
declaredSdkResearchIntentFields(intent.source);
|
|
76
|
+
for(const name of ['executionPlanId','capacityPlanId','executionInputId','demandSetId'])assert.ok(new RegExp('\\b'+name+'\\b','u').test(artifact.body),label+': Each actual caller-field provenance finding is required');
|
|
77
|
+
}
|
|
78
|
+
return entries.map(({reference,observed})=>({reference,blob:observed.blob,sourceSha256:observed.sourceSha256,line:observed.line}));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Validate source authority before a supported read is invoked. */
|
|
82
|
+
export function sdkResearchArtifactReference(reference:Row):void{
|
|
83
|
+
assert.ok(reference.kind==='treedx'&&typeof reference.projectId==='string'&&reference.projectId
|
|
84
|
+
&&typeof reference.repository==='string'&&reference.repository&&typeof reference.commit==='string'&&/^[a-f0-9]{40}$/u.test(reference.commit)
|
|
85
|
+
&&typeof reference.path==='string'&&reference.path&&!reference.path.startsWith('/')&&!/[\\\u0000-\u001f\u007f]/u.test(reference.path)
|
|
86
|
+
&&posix.normalize(reference.path)===reference.path&&!reference.path.split('/').some(part=>part==='..'||part==='.'||!part),code+': Exact original returned artifact reference required');
|
|
87
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import{isDeepStrictEqual}from'node:util';
|
|
2
|
+
import assert from'node:assert/strict';
|
|
3
|
+
import{assignmentAttemptSchema,assignmentResultSchema}from'@treeseed/sdk/agent-capacity';
|
|
4
|
+
import{sdkResearchArtifact,sdkResearchArtifactReference,verifySdkResearchCitations}from'./research-artifact.ts';
|
|
5
|
+
|
|
6
|
+
type Row=Record<string,unknown>;
|
|
7
|
+
const code='ACCEPTANCE_SDK_RESEARCH_REVISION';
|
|
8
|
+
const row=(value:unknown):Row=>{assert.ok(value&&typeof value==='object'&&!Array.isArray(value),code+': Original public object required');return value as Row;};
|
|
9
|
+
const clock=(value:unknown)=>{assert.ok(typeof value==='string'&&Number.isFinite(Date.parse(value)),code+': Original native clock required');return Date.parse(value);};
|
|
10
|
+
|
|
11
|
+
/** Read and compare actual products and classed reviews; this does not dispatch a model, prescribe its findings, or synthesize an approval. */
|
|
12
|
+
export async function verifySdkResearchRevision(items:readonly Row[],scopeInput:unknown,sdkRoot:string,base:string,
|
|
13
|
+
read:(reference:Row)=>unknown|Promise<unknown>,otherSources:Readonly<Record<string,{root:string;base:string}>>={}){
|
|
14
|
+
const scope=assignmentAttemptSchema.parse(scopeInput);assert.ok(Array.isArray(items),code);
|
|
15
|
+
const selected=items.filter(item=>row(item.assignmentAttempt).workItemId==='research-context'&&item.projectId===scope.projectId
|
|
16
|
+
&&['acting','reviewing'].includes(String(row(row(item.assignmentAttempt).effectiveProfile).activity))).map(item=>{
|
|
17
|
+
const attempt=assignmentAttemptSchema.parse(item.assignmentAttempt),result=assignmentResultSchema.parse(item.assignmentResult);
|
|
18
|
+
assert.deepEqual(attempt,item.assignmentAttempt,code+': Issued authority must not be normalized');assert.deepEqual(result,item.assignmentResult,code+': Original result must not be normalized');
|
|
19
|
+
assert.ok(item.id===attempt.id&&result.assignmentId===attempt.id&&item.status==='completed'&&attempt.status==='completed'&&result.status==='completed',code+': Original completed owning attempts required');
|
|
20
|
+
for(const field of ['teamId','projectId','workdayId']as const)assert.equal(attempt[field],scope[field],code+': Foreign revision scope');
|
|
21
|
+
assert.deepEqual(attempt.sourceRef,scope.sourceRef,code+': Frozen proposal authority changed');
|
|
22
|
+
assert.ok(clock(attempt.createdAt)<=clock(result.completedAt)&&clock(result.completedAt)<=clock(attempt.deadline),code+': Result escaped original deadline');
|
|
23
|
+
assert.equal(clock(item.completedAt),clock(result.completedAt),code+': Public owning result clock differs');
|
|
24
|
+
return{item,attempt,result};
|
|
25
|
+
});
|
|
26
|
+
assert.equal(new Set(selected.map(value=>value.attempt.id)).size,selected.length,code+': Duplicate attempt');assert.equal(new Set(selected.map(value=>value.result.id)).size,selected.length,code+': Duplicate result');
|
|
27
|
+
const actors=selected.filter(value=>value.attempt.effectiveProfile.activity==='acting').sort((a,b)=>clock(a.attempt.createdAt)-clock(b.attempt.createdAt)),reviews=selected.filter(value=>value.attempt.effectiveProfile.activity==='reviewing');
|
|
28
|
+
assert.equal(actors.length,2,code+': One preliminary contribution and one later correction required');assert.equal(reviews.length,2,code+': Actual request-changes and later approval required');
|
|
29
|
+
const first=actors[0]!,corrected=actors[1]!;assert.equal(first.attempt.nodeId,corrected.attempt.nodeId,code+': Another work item cannot replace the original contribution');assert.equal(corrected.attempt.nodeRevision,first.attempt.nodeRevision+1,code+': Correction requires the original advanced node revision');
|
|
30
|
+
const requested=reviews.filter(value=>value.result&&value.attempt.predecessorResultIds.includes(first.result.id)),approved=reviews.filter(value=>value.attempt.predecessorResultIds.includes(corrected.result.id));
|
|
31
|
+
assert.equal(requested.length,1,code+': One original paired request-changes required');assert.equal(approved.length,1,code+': One later paired approval required');
|
|
32
|
+
const request=requested[0]!,approval=approved[0]!;assert.notEqual(request.attempt.id,approval.attempt.id,code+': Separate review attempts required');assert.equal(request.attempt.nodeId,approval.attempt.nodeId,code+': Same original paired Reviewer node required');
|
|
33
|
+
assert.ok(corrected.attempt.predecessorResultIds.includes(request.result.id),code+': Correction must consume the actual request-changes result');
|
|
34
|
+
assert.ok(clock(first.result.completedAt)<clock(request.attempt.createdAt)&&clock(request.result.completedAt)<clock(corrected.attempt.createdAt)&&clock(corrected.result.completedAt)<clock(approval.attempt.createdAt),code+': Original independent review and correction chronology required');
|
|
35
|
+
const retained=new Map<string,{reference:Row;returned:unknown;artifact:ReturnType<typeof sdkResearchArtifact>}>();
|
|
36
|
+
const content=async(reference:Row,owner:typeof scope)=>{
|
|
37
|
+
sdkResearchArtifactReference(reference);const targets=owner.grant.contentWrite.filter(target=>target.repository===reference.repository&&target.path===reference.path);assert.equal(targets.length,1,code+': Returned output requires its exact original publication target before reading');
|
|
38
|
+
assert.equal(reference.projectId,scope.projectId,code+': Foreign output owner');const key=JSON.stringify(reference);let found=retained.get(key);
|
|
39
|
+
if(!found){const returned=await read(reference),artifact=sdkResearchArtifact(reference,returned);assert.ok(targets[0]!.id===artifact.frontmatter.id&&targets[0]!.model===artifact.model,code+': Original publication model and identity required');found={reference,returned,artifact};retained.set(key,found);}return found;
|
|
40
|
+
};
|
|
41
|
+
const actorProduct=async(actor:typeof first)=>{
|
|
42
|
+
assert.ok(actor.attempt.contextRefs.some(ref=>ref.store==='git'&&ref.repository==='treeseed-ai/sdk'&&ref.commit===base),code+': Original frozen SDK source must be consumed');
|
|
43
|
+
const references=actor.result.references.filter(ref=>ref.kind==='treedx');assert.equal(references.length,1,code+': One original primary research artifact required');
|
|
44
|
+
const found=await content(references[0]!,actor.attempt);assert.ok(found.artifact.model==='note'||found.artifact.model==='knowledge',code+': Researcher must return original Note or Knowledge');
|
|
45
|
+
if(found.artifact.model==='note')assert.ok(clock(actor.attempt.createdAt)<=clock(found.artifact.frontmatter.createdAt)&&clock(found.artifact.frontmatter.createdAt)<=clock(actor.result.completedAt),code+': Artifact predates or escapes its owning contribution');
|
|
46
|
+
return found;
|
|
47
|
+
};
|
|
48
|
+
const preliminary=await actorProduct(first),correction=await actorProduct(corrected);
|
|
49
|
+
assert.notEqual(preliminary.artifact.sha256,correction.artifact.sha256,code+': Reusing the original bytes is not a correction');
|
|
50
|
+
assert.notEqual(preliminary.artifact.body,correction.artifact.body,code+': A metadata-only rewrite is not substantive research');
|
|
51
|
+
const candidate=(subject:unknown,artifact:typeof preliminary)=>{const ref=row(subject);return ref.store==='treedx'&&ref.model===artifact.artifact.model&&ref.id===artifact.artifact.frontmatter.id
|
|
52
|
+
&&ref.repository===artifact.reference.repository&&ref.commit===artifact.reference.commit&&ref.path===artifact.reference.path
|
|
53
|
+
&&(ref.digest===undefined||ref.digest==='sha256:'+artifact.artifact.sha256);};
|
|
54
|
+
const reviewProduct=async(review:typeof request,actor:typeof first,artifact:typeof preliminary,disposition:'request-changes'|'approved')=>{
|
|
55
|
+
assert.notEqual(review.attempt.agentClass,actor.attempt.agentClass,code+': Actor cannot review itself');assert.notDeepEqual(review.attempt.effectiveProfile.profileRef,actor.attempt.effectiveProfile.profileRef,code+': Independent assigned reviewing profile required');
|
|
56
|
+
assert.equal(row(row(review.item.lifecycleOutput).activityCompletion).reviewDisposition,disposition,code+': Exact original review disposition required');
|
|
57
|
+
assert.ok(review.attempt.grant.sourceWrite.length===0&&!review.attempt.grant.tools.includes('source.write'),code+': Reviewer cannot mutate source');
|
|
58
|
+
assert.ok(review.attempt.contextRefs.some(ref=>candidate(ref,artifact))&&review.attempt.grant.contentRead.some(ref=>candidate(ref,artifact)),code+': Reviewer must read the exact original candidate');
|
|
59
|
+
assert.ok(!review.attempt.grant.contentWrite.some(ref=>ref.repository===artifact.reference.repository&&ref.path===artifact.reference.path),code+': Reviewer candidate writes denied');
|
|
60
|
+
const workspace=review.attempt.workspace;if(workspace.mode==='treedx'&&workspace.repository===artifact.reference.repository)assert.ok(!workspace.writablePaths.some(path=>path==='.'||path===artifact.reference.path||String(artifact.reference.path).startsWith(path.replace(/\/$/u,'')+'/')),code+': Reviewer candidate workspace must remain read-only');
|
|
61
|
+
const observed=await Promise.all(review.result.references.filter(ref=>ref.kind==='treedx').map(ref=>content(ref,review.attempt))),decisions=observed.filter(value=>value.artifact.model==='decision'&&value.artifact.frontmatter.decisionClass==='work-review');
|
|
62
|
+
assert.equal(decisions.length,1,code+': One genuine classed work-review Decision required');const decision=decisions[0]!,value=decision.artifact.frontmatter;
|
|
63
|
+
assert.equal(value.disposition,disposition,code+': Lifecycle flag cannot replace classed authority');assert.ok(candidate(value.subjectRef,artifact),code+': Classed review must bind exact actual artifact bytes');
|
|
64
|
+
assert.ok(Array.isArray(value.authorityRefs)&&value.authorityRefs.some(ref=>isDeepStrictEqual(ref,scope.sourceRef)),code+': Exact original proposal authority required');
|
|
65
|
+
assert.ok(Array.isArray(value.decidedByRefs)&&value.decidedByRefs.some(ref=>isDeepStrictEqual(ref,review.attempt.effectiveProfile.profileRef)),code+': Original assigned reviewing profile must decide');
|
|
66
|
+
assert.ok(clock(review.attempt.createdAt)<=clock(value.decidedAt)&&clock(value.decidedAt)<=clock(review.result.completedAt),code+': Original independent decision clock required');
|
|
67
|
+
return{decision,observed};
|
|
68
|
+
};
|
|
69
|
+
const changes=await reviewProduct(request,first,preliminary,'request-changes'),acceptance=await reviewProduct(approval,corrected,correction,'approved'),findingRefs=changes.decision.artifact.frontmatter.findingRefs;
|
|
70
|
+
assert.ok(Array.isArray(findingRefs)&&findingRefs.length>0,code+': Actual actionable original findings required');const findingDigests:string[]=[];
|
|
71
|
+
for(const value of findingRefs){const ref=row(value),found=changes.observed.filter(item=>item.artifact.model==='note'&&item.artifact.frontmatter.classification==='feedback'&&item.artifact.frontmatter.id===ref.id&&item.reference.repository===ref.repository&&item.reference.path===ref.path&&item.reference.commit===(ref.commit??changes.decision.reference.commit));
|
|
72
|
+
assert.equal(found.length,1,code+': Every original finding must have one actual returned native Note');const finding=found[0]!;assert.equal(ref.digest,'sha256:'+finding.artifact.sha256,code+': Findings bytes differ from original Decision');
|
|
73
|
+
assert.deepEqual(finding.artifact.frontmatter.subjectRefs,[changes.decision.artifact.frontmatter.subjectRef],code+': Feedback must address the same original artifact');
|
|
74
|
+
assert.ok(corrected.attempt.contextRefs.some(context=>context.store==='treedx'&&context.repository===finding.reference.repository&&context.commit===finding.reference.commit&&context.path===finding.reference.path)
|
|
75
|
+
&&corrected.attempt.grant.contentRead.some(context=>context.store==='treedx'&&context.repository===finding.reference.repository&&context.commit===finding.reference.commit&&context.path===finding.reference.path),code+': Correction must consume actual original feedback with exact read authority');
|
|
76
|
+
findingDigests.push(finding.artifact.sha256);
|
|
77
|
+
}
|
|
78
|
+
const preliminarySources=verifySdkResearchCitations(preliminary.artifact,sdkRoot,base,'preliminary',otherSources),correctedSources=verifySdkResearchCitations(correction.artifact,sdkRoot,base,'corrected',otherSources);
|
|
79
|
+
for(const found of retained.values())assert.deepEqual(await read(found.reference),found.returned,code+': Original artifacts and failed review observations changed during read-back');
|
|
80
|
+
assert.ok(acceptance.decision.artifact.frontmatter.rationale,code+': Actual later independent approval rationale required');
|
|
81
|
+
return{firstActorId:first.attempt.id,requestChangesId:request.attempt.id,correctionActorId:corrected.attempt.id,approvalId:approval.attempt.id,preliminarySha256:preliminary.artifact.sha256,correctedSha256:correction.artifact.sha256,findingDigests,preliminarySources,correctedSources};
|
|
82
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import {execFileSync} from 'node:child_process';
|
|
3
|
+
import {createHash} from 'node:crypto';
|
|
4
|
+
import {realpathSync} from 'node:fs';
|
|
5
|
+
import {isAbsolute,resolve,posix} from 'node:path';
|
|
6
|
+
import ts from 'typescript';
|
|
7
|
+
import {exactEntityReferenceSchema} from '@treeseed/sdk/agent-capacity';
|
|
8
|
+
|
|
9
|
+
const code='ACCEPTANCE_SDK_RESEARCH_CITATION';
|
|
10
|
+
type SourceLocation={repository:string;commit:string;path:string;anchor?:string;startLine?:number;endLine?:number;digest?:string;url?:string};
|
|
11
|
+
function anchor(value:string):{first:number;last:number}|undefined{
|
|
12
|
+
const match=value.match(/^L([1-9][0-9]*)(?:-L([1-9][0-9]*))?$/u);if(!match)return;
|
|
13
|
+
const first=Number(match[1]),last=Number(match[2]??match[1]);assert.ok(Number.isSafeInteger(first)&&Number.isSafeInteger(last)&&first<=last,code+': Exact source line range required');return{first,last};
|
|
14
|
+
}
|
|
15
|
+
/** Existing exact Git refs and ordinary source URLs retain one frozen source authority. */
|
|
16
|
+
export function parseSdkResearchCitation(value:unknown,base:string,repository='treeseed-ai/sdk'):SourceLocation{
|
|
17
|
+
assert.match(base,/^[a-f0-9]{40}$/u,code+': Exact frozen base required');assert.match(repository,/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u,code);
|
|
18
|
+
let reference:SourceLocation;
|
|
19
|
+
if(typeof value==='string'){
|
|
20
|
+
let url:URL;try{url=new URL(value);}catch(cause){throw new Error(code+': Source URL required',{cause});}
|
|
21
|
+
assert.ok(value===url.href&&url.protocol==='https:'&&url.hostname==='github.com'&&!url.port&&!url.username&&!url.password&&!url.search,code+': Exact public source URL required');
|
|
22
|
+
const parts=url.pathname.split('/');assert.ok(parts[0]===''&&parts[1]+'/'+parts[2]===repository&&parts[3]==='blob'&&parts.length>5,code+': Foreign source repository or location');
|
|
23
|
+
let path:string;try{path=decodeURIComponent(parts.slice(5).join('/'));}catch(cause){throw new Error(code+': Invalid encoded source path',{cause});}
|
|
24
|
+
reference={repository,commit:parts[4]!,path,...(url.hash?{anchor:url.hash.slice(1)}:{})};if(reference.anchor)assert.ok(anchor(reference.anchor),code+': Source URL anchor must resolve to exact lines');
|
|
25
|
+
}else{
|
|
26
|
+
const checked=exactEntityReferenceSchema.safeParse(value);assert.ok(checked.success,code+': Canonical exact Git reference required');assert.deepEqual(checked.data,value,code+': Source reference cannot be normalized');
|
|
27
|
+
const data=checked.data;assert.ok(data.store==='git'||data.store==='url',code+': Canonical source owner required');
|
|
28
|
+
const presentation=data.url===undefined?undefined:parseSdkResearchCitation(data.url,base,repository);
|
|
29
|
+
if(data.store==='git')assert.ok(data.repository&&data.commit&&data.path,code+': Complete exact source location required');
|
|
30
|
+
reference={repository:data.repository??presentation!.repository,commit:data.commit??presentation!.commit,path:data.path??presentation!.path,
|
|
31
|
+
...(data.anchor!==undefined?{anchor:data.anchor}:presentation?.anchor!==undefined?{anchor:presentation.anchor}:{}),
|
|
32
|
+
...(data.startLine!==undefined?{startLine:data.startLine,...(data.endLine!==undefined?{endLine:data.endLine}:{})}:{}),
|
|
33
|
+
...(data.digest!==undefined?{digest:data.digest}:{}),...(data.url!==undefined?{url:data.url}:{})};
|
|
34
|
+
if(presentation){for(const key of ['repository','commit','path']as const)assert.equal(reference[key],presentation[key],code+': Contradictory presentation source');
|
|
35
|
+
const range=reference.startLine!==undefined?{first:reference.startLine,last:reference.endLine??reference.startLine}:reference.anchor?anchor(reference.anchor):undefined,shown=presentation.anchor?anchor(presentation.anchor):undefined;
|
|
36
|
+
if(range&&shown)assert.ok(range.first<=shown.last&&shown.first<=range.last,code+': Contradictory presentation source lines');}
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
assert.equal(reference.repository,repository,code+': Foreign source repository');assert.equal(reference.commit,base,code+': Citation differs from frozen source');
|
|
40
|
+
assert.ok(reference.path.startsWith('src/')&&reference.path.endsWith('.ts')&&!reference.path.includes('\\')&&!/[\u0000-\u001f\u007f]/u.test(reference.path)&&posix.normalize(reference.path)===reference.path&&!reference.path.split('/').includes('..'),code+': Canonical owning source path required');
|
|
41
|
+
if(reference.anchor!==undefined){assert.ok(reference.anchor&&reference.anchor.trim()===reference.anchor,code);if(reference.anchor.startsWith('L')&&/^L[0-9]/u.test(reference.anchor))assert.ok(anchor(reference.anchor),code);else assert.match(reference.anchor,/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/u,code+': Exact source symbol required');}
|
|
42
|
+
if(reference.startLine!==undefined){const last=reference.endLine??reference.startLine;assert.ok(Number.isSafeInteger(reference.startLine)&&Number.isSafeInteger(last)&&reference.startLine<=last,code+': Exact canonical source lines required');const located=reference.anchor?anchor(reference.anchor):undefined;if(located)assert.ok(located.first===reference.startLine&&located.last===last,code+': Contradictory source line authorities');}
|
|
43
|
+
return reference;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Read native immutable Git objects; no checked-out source or network fallback. */
|
|
47
|
+
export function resolveSdkResearchCitation(root:string,base:string,citation:unknown,symbol?:string,repository='treeseed-ai/sdk'){
|
|
48
|
+
const reference=parseSdkResearchCitation(citation,base,repository);if(symbol!==undefined)assert.match(symbol,/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/u,code);
|
|
49
|
+
try{
|
|
50
|
+
assert.ok(isAbsolute(root)&&realpathSync(root)===resolve(root),code+': Exact owning repository required');
|
|
51
|
+
const env={...process.env};for(const key of Object.keys(env))if(key.startsWith('GIT_'))delete env[key];env.GIT_OPTIONAL_LOCKS='0';env.GIT_NO_REPLACE_OBJECTS='1';
|
|
52
|
+
const git=(args:string[])=>execFileSync('git',['--no-replace-objects','-C',root,...args],{env,timeout:30_000,maxBuffer:8*1024*1024});
|
|
53
|
+
assert.equal(git(['cat-file','-t',base]).toString('utf8').trim(),'commit',code);const bytes=git(['cat-file','blob',base+':'+reference.path]),source=bytes.toString('utf8');assert.ok(Buffer.from(source,'utf8').equals(bytes),code+': Exact UTF-8 source required');
|
|
54
|
+
const sourceSha256=createHash('sha256').update(bytes).digest('hex');if(reference.digest!==undefined)assert.equal(reference.digest,'sha256:'+sourceSha256,code+': Source digest differs from original Git bytes');
|
|
55
|
+
const suppliedAnchor=reference.anchor?anchor(reference.anchor):undefined,range=reference.startLine!==undefined?{first:reference.startLine,last:reference.endLine??reference.startLine}:suppliedAnchor;
|
|
56
|
+
if(reference.anchor&&!suppliedAnchor){if(symbol===undefined)symbol=reference.anchor;else assert.equal(reference.anchor,symbol,code+': Foreign source symbol');}
|
|
57
|
+
const parsed=ts.createSourceFile(reference.path,source,ts.ScriptTarget.Latest,true,ts.ScriptKind.TS),diagnostics:unknown=Reflect.get(parsed,'parseDiagnostics');assert.ok(Array.isArray(diagnostics)&&diagnostics.length===0,code+': Source must parse without repair');
|
|
58
|
+
const matches:ts.Node[]=[];const inspect=(node:ts.Node)=>{let name:string|undefined;
|
|
59
|
+
if(ts.isInterfaceDeclaration(node)||ts.isTypeAliasDeclaration(node)||ts.isFunctionDeclaration(node)||ts.isClassDeclaration(node)||ts.isVariableDeclaration(node))name=node.name&&ts.isIdentifier(node.name)?node.name.text:undefined;
|
|
60
|
+
if(ts.isMethodDeclaration(node)&&ts.isClassDeclaration(node.parent)&&node.parent.name&&ts.isIdentifier(node.name))name=node.parent.name.text+'.'+node.name.text;
|
|
61
|
+
if(ts.isCallExpression(node)&&ts.isIdentifier(node.expression)&&['resource','operation'].includes(node.expression.text)&&node.arguments[0]&&ts.isStringLiteral(node.arguments[0])&&node.arguments[0].text===symbol)name=symbol;
|
|
62
|
+
if(symbol!==undefined&&name===symbol)matches.push(node);ts.forEachChild(node,inspect);
|
|
63
|
+
};inspect(parsed);if(symbol!==undefined)assert.ok(matches.length>0,code+': Cited source symbol missing');
|
|
64
|
+
const lines=source.split('\n').length;if(range)assert.ok(range.last<=lines,code+': Cited lines are absent');
|
|
65
|
+
const located=matches.filter(node=>!range||parsed.getLineAndCharacterOfPosition(node.getStart(parsed)).line+1<=range.last&&parsed.getLineAndCharacterOfPosition(node.end).line+1>=range.first);if(symbol!==undefined)assert.ok(located.length>0,code+': Citation does not locate its claimed symbol');
|
|
66
|
+
if(reference.url){const shown=parseSdkResearchCitation(reference.url,base,repository),display=shown.anchor?anchor(shown.anchor):undefined;
|
|
67
|
+
if(display){assert.ok(display.last<=lines,code+': Presented source lines are absent');if(symbol!==undefined)assert.ok(located.some(node=>parsed.getLineAndCharacterOfPosition(node.getStart(parsed)).line+1<=display.last&&parsed.getLineAndCharacterOfPosition(node.end).line+1>=display.first),code+': Presentation does not locate its claimed source symbol');}}
|
|
68
|
+
assert.ok(symbol!==undefined||range,code+': Exact source lines or a source symbol required');
|
|
69
|
+
const line=symbol!==undefined?parsed.getLineAndCharacterOfPosition(located[0]!.getStart(parsed)).line+1:range!.first;
|
|
70
|
+
return{source,blob:git(['rev-parse',base+':'+reference.path]).toString('utf8').trim(),sourceSha256,symbol,line};
|
|
71
|
+
}catch(cause){if(cause instanceof Error&&cause.message.startsWith(code))throw cause;throw new Error(code+': Native frozen source resolution failed',{cause});}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Absence is established from a complete native declaration, never a prose assertion or a receipt with a different owner. */
|
|
75
|
+
export function declaredSdkResearchIntentFields(source:string):string[]{
|
|
76
|
+
const label='ACCEPTANCE_SDK_RESEARCH_INTENT';assert.ok(typeof source==='string'&&source.length>0,label);
|
|
77
|
+
const parsed=ts.createSourceFile('workday-lifecycle.ts',source,ts.ScriptTarget.Latest,true,ts.ScriptKind.TS),diagnostics:unknown=Reflect.get(parsed,'parseDiagnostics');
|
|
78
|
+
assert.ok(Array.isArray(diagnostics)&&diagnostics.length===0,label+': Complete original source required');
|
|
79
|
+
const declarations:ts.InterfaceDeclaration[]=[];
|
|
80
|
+
const inspect=(node:ts.Node)=>{if(ts.isInterfaceDeclaration(node)&&node.name.text==='WorkdayIntent')declarations.push(node);ts.forEachChild(node,inspect);};inspect(parsed);
|
|
81
|
+
assert.equal(declarations.length,1,label+': One unambiguous original interface required');const declaration=declarations[0]!;
|
|
82
|
+
assert.ok(!declaration.heritageClauses?.length,label+': Inherited caller fields require their own complete proof');
|
|
83
|
+
const fields=declaration.members.map(member=>{
|
|
84
|
+
assert.ok(ts.isPropertySignature(member)&&member.name&&(ts.isIdentifier(member.name)||ts.isStringLiteral(member.name)),label+': Every original member must be statically declared');
|
|
85
|
+
return member.name.text;
|
|
86
|
+
});
|
|
87
|
+
assert.equal(new Set(fields).size,fields.length,label+': Duplicate or merged declarations denied');
|
|
88
|
+
for(const name of ['schemaVersion','teamId','profileId','projects','executionMode','startsAt','planningOnly','proposalIds','decisionIds','agentSelection','allocation'])assert.ok(fields.includes(name),label+': Missing original independent intent control '+name);
|
|
89
|
+
for(const name of ['executionPlanId','capacityPlanId','executionInputId','demandSetId'])assert.ok(!fields.includes(name),label+': Prohibited field is declared as SDK caller input: '+name);
|
|
90
|
+
return fields;
|
|
91
|
+
}
|