niceeval 0.13.1 → 0.13.2
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/INDEX.md +25 -2
- package/README.md +9 -10
- package/README.zh.md +9 -10
- package/dist/agents/ai-sdk.cjs.map +1 -1
- package/dist/agents/ai-sdk.d.cts +1 -1
- package/dist/agents/ai-sdk.d.mts +1 -1
- package/dist/agents/ai-sdk.d.ts +1 -1
- package/dist/agents/bub-install-spec.cjs +19 -5
- package/dist/agents/bub-install-spec.cjs.map +1 -1
- package/dist/agents/bub-install-spec.d.cts +9 -2
- package/dist/agents/bub-install-spec.d.mts +9 -2
- package/dist/agents/bub-install-spec.d.ts +9 -2
- package/dist/agents/bub-install-spec.js +14 -12
- package/dist/agents/bub.cjs +10 -6
- package/dist/agents/bub.cjs.map +1 -1
- package/dist/agents/bub.d.cts +2 -2
- package/dist/agents/bub.d.mts +2 -2
- package/dist/agents/bub.d.ts +2 -2
- package/dist/agents/claude-code.cjs.map +1 -1
- package/dist/agents/claude-code.d.cts +2 -2
- package/dist/agents/claude-code.d.mts +2 -2
- package/dist/agents/claude-code.d.ts +2 -2
- package/dist/agents/codex.cjs +4 -4
- package/dist/agents/codex.cjs.map +1 -1
- package/dist/agents/codex.d.cts +3 -3
- package/dist/agents/codex.d.mts +3 -3
- package/dist/agents/codex.d.ts +3 -3
- package/dist/agents/coding-cli-versions.cjs +10 -1
- package/dist/agents/coding-cli-versions.cjs.map +1 -1
- package/dist/agents/coding-cli-versions.d.cts +8 -3
- package/dist/agents/coding-cli-versions.d.mts +8 -3
- package/dist/agents/coding-cli-versions.d.ts +8 -3
- package/dist/agents/coding-cli-versions.js +18 -12
- package/dist/agents/deepseek-harness.cjs +151 -0
- package/dist/agents/deepseek-harness.cjs.map +1 -0
- package/dist/agents/deepseek-harness.d.cts +14 -0
- package/dist/agents/deepseek-harness.d.mts +14 -0
- package/dist/agents/deepseek-harness.d.ts +14 -0
- package/dist/agents/deepseek-harness.js +7 -0
- package/dist/agents/deepseek-harness.js.map +1 -0
- package/dist/agents/exact-npm-plugins.cjs +28 -0
- package/dist/agents/exact-npm-plugins.cjs.map +1 -0
- package/dist/agents/exact-npm-plugins.d.cts +10 -0
- package/dist/agents/exact-npm-plugins.d.mts +10 -0
- package/dist/agents/exact-npm-plugins.d.ts +10 -0
- package/dist/agents/exact-npm-plugins.js +8 -0
- package/dist/agents/exact-npm-plugins.js.map +1 -0
- package/dist/agents/index.cjs +5 -1
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.d.cts +4 -0
- package/dist/agents/index.d.mts +4 -0
- package/dist/agents/index.d.ts +4 -0
- package/dist/agents/index.js +54 -50
- package/dist/agents/index.mjs +54 -50
- package/dist/agents/omp.cjs +170 -0
- package/dist/agents/omp.cjs.map +1 -0
- package/dist/agents/omp.d.cts +14 -0
- package/dist/agents/omp.d.mts +14 -0
- package/dist/agents/omp.d.ts +14 -0
- package/dist/agents/omp.js +7 -0
- package/dist/agents/omp.js.map +1 -0
- package/dist/agents/openclaw.cjs +51 -2
- package/dist/agents/openclaw.cjs.map +1 -1
- package/dist/agents/openclaw.d.cts +2 -0
- package/dist/agents/openclaw.d.mts +2 -0
- package/dist/agents/openclaw.d.ts +2 -0
- package/dist/agents/types.cjs.map +1 -1
- package/dist/agents/types.d.cts +4 -4
- package/dist/agents/types.d.mts +4 -4
- package/dist/agents/types.d.ts +4 -4
- package/dist/agents/ui-message-stream.cjs +24 -7
- package/dist/agents/ui-message-stream.cjs.map +1 -1
- package/dist/analysis/api.cjs +28 -2
- package/dist/analysis/api.cjs.map +1 -1
- package/dist/analysis/api.d.cts +22 -1
- package/dist/analysis/api.d.mts +22 -1
- package/dist/analysis/api.d.ts +22 -1
- package/dist/analysis/api.js +8 -6
- package/dist/analysis/bindings.cjs +11 -18
- package/dist/analysis/bindings.cjs.map +1 -1
- package/dist/analysis/bindings.d.cts +177 -49
- package/dist/analysis/bindings.d.mts +177 -49
- package/dist/analysis/bindings.d.ts +177 -49
- package/dist/analysis/contracts.cjs +1 -0
- package/dist/analysis/contracts.cjs.map +1 -1
- package/dist/analysis/contracts.d.cts +43 -3
- package/dist/analysis/contracts.d.mts +43 -3
- package/dist/analysis/contracts.d.ts +43 -3
- package/dist/analysis/cost-projection.cjs +2 -1
- package/dist/analysis/cost-projection.cjs.map +1 -1
- package/dist/analysis/cost-projection.d.cts +1 -1
- package/dist/analysis/cost-projection.d.mts +1 -1
- package/dist/analysis/cost-projection.d.ts +1 -1
- package/dist/analysis/cost.cjs +13 -3
- package/dist/analysis/cost.cjs.map +1 -1
- package/dist/analysis/cost.d.cts +10 -3
- package/dist/analysis/cost.d.mts +10 -3
- package/dist/analysis/cost.d.ts +10 -3
- package/dist/analysis/experiment-groups.cjs +96 -0
- package/dist/analysis/experiment-groups.cjs.map +1 -0
- package/dist/analysis/experiment-groups.d.cts +9 -0
- package/dist/analysis/experiment-groups.d.mts +9 -0
- package/dist/analysis/experiment-groups.d.ts +9 -0
- package/dist/analysis/experiment-groups.js +10 -0
- package/dist/analysis/experiment-groups.js.map +1 -0
- package/dist/analysis/index.cjs +4 -1
- package/dist/analysis/index.cjs.map +1 -1
- package/dist/analysis/index.d.cts +4 -2
- package/dist/analysis/index.d.mts +4 -2
- package/dist/analysis/index.d.ts +4 -2
- package/dist/analysis/index.js +40 -36
- package/dist/analysis/index.mjs +40 -36
- package/dist/assertions/limits.cjs +4 -0
- package/dist/assertions/limits.cjs.map +1 -1
- package/dist/assertions/limits.d.cts +4 -0
- package/dist/assertions/limits.d.mts +4 -0
- package/dist/assertions/limits.d.ts +4 -0
- package/dist/assertions/match.cjs +63 -25
- package/dist/assertions/match.cjs.map +1 -1
- package/dist/assertions/match.d.cts +7 -0
- package/dist/assertions/match.d.mts +7 -0
- package/dist/assertions/match.d.ts +7 -0
- package/dist/assertions/record/attachment.cjs +32 -4
- package/dist/assertions/record/attachment.cjs.map +1 -1
- package/dist/assertions/record/diff.cjs +10 -4
- package/dist/assertions/record/diff.cjs.map +1 -1
- package/dist/assertions/record/producer.cjs +101 -4
- package/dist/assertions/record/producer.cjs.map +1 -1
- package/dist/assertions/record/producer.d.cts +4 -1
- package/dist/assertions/record/producer.d.mts +4 -1
- package/dist/assertions/record/producer.d.ts +4 -1
- package/dist/assertions/runtime.cjs +45 -5
- package/dist/assertions/runtime.cjs.map +1 -1
- package/dist/cli/record.cjs +113 -8
- package/dist/cli/record.cjs.map +1 -1
- package/dist/cli/record.d.cts +20 -1
- package/dist/cli/record.d.mts +20 -1
- package/dist/cli/record.d.ts +20 -1
- package/dist/cli/record.js +4 -2
- package/dist/cli.cjs +386 -31
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +10 -2
- package/dist/cli.d.mts +10 -2
- package/dist/cli.d.ts +10 -2
- package/dist/context/send-retry.cjs +4 -4
- package/dist/context/send-retry.cjs.map +1 -1
- package/dist/coordination/host/runtime.cjs +8 -30
- package/dist/coordination/host/runtime.cjs.map +1 -1
- package/dist/coordination/host/runtime.d.cts +3 -3
- package/dist/coordination/host/runtime.d.mts +3 -3
- package/dist/coordination/host/runtime.d.ts +3 -3
- package/dist/coordination/host/types.cjs.map +1 -1
- package/dist/coordination/host/types.d.cts +0 -5
- package/dist/coordination/host/types.d.mts +0 -5
- package/dist/coordination/host/types.d.ts +0 -5
- package/dist/coordination/platform/node.cjs +90 -9
- package/dist/coordination/platform/node.cjs.map +1 -1
- package/dist/define.cjs +25 -1
- package/dist/define.cjs.map +1 -1
- package/dist/experiment/host/index.cjs +1 -0
- package/dist/experiment/host/index.cjs.map +1 -1
- package/dist/i18n/en.cjs +26 -8
- package/dist/i18n/en.cjs.map +1 -1
- package/dist/i18n/en.d.cts +19 -6
- package/dist/i18n/en.d.mts +19 -6
- package/dist/i18n/en.d.ts +19 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/o11y/parsers/hermes.cjs +1 -1
- package/dist/o11y/parsers/hermes.cjs.map +1 -1
- package/dist/o11y/prices.json +1 -1
- package/dist/o11y/record/families.cjs +12 -3
- package/dist/o11y/record/families.cjs.map +1 -1
- package/dist/o11y/record/families.d.cts +8 -8
- package/dist/o11y/record/families.d.mts +8 -8
- package/dist/o11y/record/families.d.ts +8 -8
- package/dist/o11y/record/family-projectors.d.cts +66 -18
- package/dist/o11y/record/family-projectors.d.mts +66 -18
- package/dist/o11y/record/family-projectors.d.ts +66 -18
- package/dist/o11y/record/family-writers.d.cts +11 -3
- package/dist/o11y/record/family-writers.d.mts +11 -3
- package/dist/o11y/record/family-writers.d.ts +11 -3
- package/dist/o11y/record/runner-producer.cjs +14 -4
- package/dist/o11y/record/runner-producer.cjs.map +1 -1
- package/dist/record/codec/core.d.cts +2 -2
- package/dist/record/codec/core.d.mts +2 -2
- package/dist/record/codec/core.d.ts +2 -2
- package/dist/record/family/catalog.d.cts +44 -12
- package/dist/record/family/catalog.d.mts +44 -12
- package/dist/record/family/catalog.d.ts +44 -12
- package/dist/record/family/index.js +128 -124
- package/dist/record/family/observability-v1.cjs +35 -0
- package/dist/record/family/observability-v1.cjs.map +1 -0
- package/dist/record/family/observability-v1.d.cts +3 -0
- package/dist/record/family/observability-v1.d.mts +3 -0
- package/dist/record/family/observability-v1.d.ts +3 -0
- package/dist/record/family/observability-v1.js +6 -0
- package/dist/record/family/observability-v1.js.map +1 -0
- package/dist/record/family/observability.cjs +58 -9
- package/dist/record/family/observability.cjs.map +1 -1
- package/dist/record/family/observability.d.cts +1014 -15
- package/dist/record/family/observability.d.mts +1014 -15
- package/dist/record/family/observability.d.ts +1014 -15
- package/dist/record/family/observability.js +22 -18
- package/dist/record/host/runtime.cjs +600 -31
- package/dist/record/host/runtime.cjs.map +1 -1
- package/dist/record/host/types.cjs.map +1 -1
- package/dist/record/host/types.d.cts +33 -9
- package/dist/record/host/types.d.mts +33 -9
- package/dist/record/host/types.d.ts +33 -9
- package/dist/record/maintenance/runtime.cjs +1 -2
- package/dist/record/maintenance/runtime.cjs.map +1 -1
- package/dist/record/model/core.cjs.map +1 -1
- package/dist/record/model/core.d.cts +1 -1
- package/dist/record/model/core.d.mts +1 -1
- package/dist/record/model/core.d.ts +1 -1
- package/dist/record/model/definition.d.cts +6 -6
- package/dist/record/model/definition.d.mts +6 -6
- package/dist/record/model/definition.d.ts +6 -6
- package/dist/record/model/identifiers.cjs +1 -1
- package/dist/record/model/identifiers.cjs.map +1 -1
- package/dist/record/model/identifiers.d.cts +1 -1
- package/dist/record/model/identifiers.d.mts +1 -1
- package/dist/record/model/identifiers.d.ts +1 -1
- package/dist/record/platform/node.cjs +159 -23
- package/dist/record/platform/node.cjs.map +1 -1
- package/dist/record/platform/services.cjs.map +1 -1
- package/dist/record/platform/services.d.cts +15 -2
- package/dist/record/platform/services.d.mts +15 -2
- package/dist/record/platform/services.d.ts +15 -2
- package/dist/record/reader/errors.cjs +37 -1
- package/dist/record/reader/errors.cjs.map +1 -1
- package/dist/record/reader/errors.d.cts +49 -1
- package/dist/record/reader/errors.d.mts +49 -1
- package/dist/record/reader/errors.d.ts +49 -1
- package/dist/record/reader/errors.js +22 -12
- package/dist/record/reader/format.cjs +76 -17
- package/dist/record/reader/format.cjs.map +1 -1
- package/dist/record/reader/format.d.cts +11 -4
- package/dist/record/reader/format.d.mts +11 -4
- package/dist/record/reader/format.d.ts +11 -4
- package/dist/record/reader/format.js +2 -0
- package/dist/record/reader/index.js +32 -18
- package/dist/record/reader/runtime.cjs +64 -0
- package/dist/record/reader/runtime.cjs.map +1 -1
- package/dist/record/reader/runtime.d.cts +15 -0
- package/dist/record/reader/runtime.d.mts +15 -0
- package/dist/record/reader/runtime.d.ts +15 -0
- package/dist/record/reader/runtime.js +2 -0
- package/dist/report/assets/styles.css +53 -29
- package/dist/report/built-in/analysis-values.cjs +21 -13
- package/dist/report/built-in/analysis-values.cjs.map +1 -1
- package/dist/report/built-in/analysis-values.d.cts +11 -22
- package/dist/report/built-in/analysis-values.d.mts +11 -22
- package/dist/report/built-in/analysis-values.d.ts +11 -22
- package/dist/report/built-in/analysis-values.js +4 -6
- package/dist/report/built-in/index.cjs +1 -3
- package/dist/report/built-in/index.cjs.map +1 -1
- package/dist/report/built-in/index.d.cts +1 -1
- package/dist/report/built-in/index.d.mts +1 -1
- package/dist/report/built-in/index.d.ts +1 -1
- package/dist/report/built-in/index.js +4 -8
- package/dist/report/built-in/index.mjs +4 -8
- package/dist/report/built-in/machine.cjs +0 -2
- package/dist/report/built-in/machine.cjs.map +1 -1
- package/dist/report/built-in/machine.d.cts +0 -2
- package/dist/report/built-in/machine.d.mts +0 -2
- package/dist/report/built-in/machine.d.ts +0 -2
- package/dist/report/built-in/result-components.cjs +49 -51
- package/dist/report/built-in/result-components.cjs.map +1 -1
- package/dist/report/built-in/result-components.d.cts +16 -17
- package/dist/report/built-in/result-components.d.mts +16 -17
- package/dist/report/built-in/result-components.d.ts +16 -17
- package/dist/report/built-in/result-components.js +0 -4
- package/dist/report/built-in/run-membership-overview.cjs +126 -17
- package/dist/report/built-in/run-membership-overview.cjs.map +1 -1
- package/dist/report/built-in/run-membership-overview.d.cts +14 -0
- package/dist/report/built-in/run-membership-overview.d.mts +14 -0
- package/dist/report/built-in/run-membership-overview.d.ts +14 -0
- package/dist/report/built-in/run-membership-overview.js +4 -2
- package/dist/report/built-in/standard.cjs +80 -45
- package/dist/report/built-in/standard.cjs.map +1 -1
- package/dist/report/built-in/standard.d.cts +19 -41
- package/dist/report/built-in/standard.d.mts +19 -41
- package/dist/report/built-in/standard.d.ts +19 -41
- package/dist/report/built-in/standard.js +6 -6
- package/dist/report/components/attempt-detail/compute.cjs +78 -2
- package/dist/report/components/attempt-detail/compute.cjs.map +1 -1
- package/dist/report/components/attempt-detail/compute.d.cts +1 -1
- package/dist/report/components/attempt-detail/compute.d.mts +1 -1
- package/dist/report/components/attempt-detail/compute.d.ts +1 -1
- package/dist/report/components/attempt-detail/content.cjs +1 -1
- package/dist/report/components/attempt-detail/content.cjs.map +1 -1
- package/dist/report/components/entity-lists/compute.cjs +42 -5
- package/dist/report/components/entity-lists/compute.cjs.map +1 -1
- package/dist/report/components/entity-lists/compute.d.cts +10 -8
- package/dist/report/components/entity-lists/compute.d.mts +10 -8
- package/dist/report/components/entity-lists/compute.d.ts +10 -8
- package/dist/report/components/entity-lists/content.cjs +31 -6
- package/dist/report/components/entity-lists/content.cjs.map +1 -1
- package/dist/report/components/entity-lists/index.cjs +9 -4
- package/dist/report/components/entity-lists/index.cjs.map +1 -1
- package/dist/report/components/entity-lists/index.d.cts +4 -7
- package/dist/report/components/entity-lists/index.d.mts +4 -7
- package/dist/report/components/entity-lists/index.d.ts +4 -7
- package/dist/report/components/summaries/compute.cjs +8 -1
- package/dist/report/components/summaries/compute.cjs.map +1 -1
- package/dist/report/components/summaries/compute.d.cts +9 -1
- package/dist/report/components/summaries/compute.d.mts +9 -1
- package/dist/report/components/summaries/compute.d.ts +9 -1
- package/dist/report/components/summaries/index.cjs +48 -4
- package/dist/report/components/summaries/index.cjs.map +1 -1
- package/dist/report/components/summaries/index.d.cts +7 -4
- package/dist/report/components/summaries/index.d.mts +7 -4
- package/dist/report/components/summaries/index.d.ts +7 -4
- package/dist/report/definition/cell.cjs +3 -0
- package/dist/report/definition/cell.cjs.map +1 -1
- package/dist/report/definition/cell.d.cts +2 -0
- package/dist/report/definition/cell.d.mts +2 -0
- package/dist/report/definition/cell.d.ts +2 -0
- package/dist/report/definition/primitives/chart.cjs +8 -5
- package/dist/report/definition/primitives/chart.cjs.map +1 -1
- package/dist/report/definition/primitives/points-dataset.cjs +1 -0
- package/dist/report/definition/primitives/points-dataset.cjs.map +1 -1
- package/dist/report/definition/primitives.cjs +15 -2
- package/dist/report/definition/primitives.cjs.map +1 -1
- package/dist/report/definition/report.cjs +27 -3
- package/dist/report/definition/report.cjs.map +1 -1
- package/dist/report/definition/report.d.cts +8 -0
- package/dist/report/definition/report.d.mts +8 -0
- package/dist/report/definition/report.d.ts +8 -0
- package/dist/report/execution/machine.cjs +30 -14
- package/dist/report/execution/machine.cjs.map +1 -1
- package/dist/report/execution/machine.d.cts +20 -10
- package/dist/report/execution/machine.d.mts +20 -10
- package/dist/report/execution/machine.d.ts +20 -10
- package/dist/report/execution/machine.js +6 -6
- package/dist/report/host/execute.cjs +25 -16
- package/dist/report/host/execute.cjs.map +1 -1
- package/dist/report/host/execute.d.cts +4 -0
- package/dist/report/host/execute.d.mts +4 -0
- package/dist/report/host/execute.d.ts +4 -0
- package/dist/report/host/from-record.cjs +22 -5
- package/dist/report/host/from-record.cjs.map +1 -1
- package/dist/report/host/machine.cjs +53 -11
- package/dist/report/host/machine.cjs.map +1 -1
- package/dist/report/host/site-runtime.cjs +9 -8
- package/dist/report/host/site-runtime.cjs.map +1 -1
- package/dist/report/host/site-runtime.d.cts +1 -1
- package/dist/report/host/site-runtime.d.mts +1 -1
- package/dist/report/host/site-runtime.d.ts +1 -1
- package/dist/report/host/static.cjs +56 -9
- package/dist/report/host/static.cjs.map +1 -1
- package/dist/report/index.cjs.map +1 -1
- package/dist/report/index.d.cts +1 -1
- package/dist/report/index.d.mts +1 -1
- package/dist/report/index.d.ts +1 -1
- package/dist/report/model/dataset.cjs +7 -2
- package/dist/report/model/dataset.cjs.map +1 -1
- package/dist/report/model/locale.cjs +2 -0
- package/dist/report/model/locale.cjs.map +1 -1
- package/dist/report/model/locale.d.cts +1 -0
- package/dist/report/model/locale.d.mts +1 -0
- package/dist/report/model/locale.d.ts +1 -0
- package/dist/report/model/metrics.cjs +3 -1
- package/dist/report/model/metrics.cjs.map +1 -1
- package/dist/report/model/pricing.cjs +16 -11
- package/dist/report/model/pricing.cjs.map +1 -1
- package/dist/report/react/styles.css +53 -29
- package/dist/runner/adoption.cjs +1 -0
- package/dist/runner/adoption.cjs.map +1 -1
- package/dist/runner/attempt.cjs +44 -5
- package/dist/runner/attempt.cjs.map +1 -1
- package/dist/runner/attempt.d.cts +13 -1
- package/dist/runner/attempt.d.mts +13 -1
- package/dist/runner/attempt.d.ts +13 -1
- package/dist/runner/config-identity.cjs +10 -2
- package/dist/runner/config-identity.cjs.map +1 -1
- package/dist/runner/config-identity.d.cts +4 -2
- package/dist/runner/config-identity.d.mts +4 -2
- package/dist/runner/config-identity.d.ts +4 -2
- package/dist/runner/feedback/human.cjs +298 -59
- package/dist/runner/feedback/human.cjs.map +1 -1
- package/dist/runner/feedback/json.cjs +14 -6
- package/dist/runner/feedback/json.cjs.map +1 -1
- package/dist/runner/feedback/json.d.cts +3 -2
- package/dist/runner/feedback/json.d.mts +3 -2
- package/dist/runner/feedback/json.d.ts +3 -2
- package/dist/runner/feedback/reducer.cjs +2 -0
- package/dist/runner/feedback/reducer.cjs.map +1 -1
- package/dist/runner/judge-config.cjs +1 -1
- package/dist/runner/judge-config.cjs.map +1 -1
- package/dist/runner/ledger.cjs +124 -12
- package/dist/runner/ledger.cjs.map +1 -1
- package/dist/runner/project-current.cjs +13 -5
- package/dist/runner/project-current.cjs.map +1 -1
- package/dist/runner/run.cjs +564 -256
- package/dist/runner/run.cjs.map +1 -1
- package/dist/runner/sandbox-pool.cjs +161 -30
- package/dist/runner/sandbox-pool.cjs.map +1 -1
- package/dist/runner/sandbox-pool.d.cts +34 -2
- package/dist/runner/sandbox-pool.d.mts +34 -2
- package/dist/runner/sandbox-pool.d.ts +34 -2
- package/dist/runner/shared-state-lease.cjs +803 -0
- package/dist/runner/shared-state-lease.cjs.map +1 -0
- package/dist/runner/shared-state-lease.d.cts +121 -0
- package/dist/runner/shared-state-lease.d.mts +121 -0
- package/dist/runner/shared-state-lease.d.ts +121 -0
- package/dist/runner/shared-state-lease.js +24 -0
- package/dist/runner/shared-state-lease.js.map +1 -0
- package/dist/runner/teardown-registry.cjs +97 -34
- package/dist/runner/teardown-registry.cjs.map +1 -1
- package/dist/runner/teardown-registry.d.cts +27 -1
- package/dist/runner/teardown-registry.d.mts +27 -1
- package/dist/runner/teardown-registry.d.ts +27 -1
- package/dist/runner/teardown-registry.js +20 -16
- package/dist/runner/types.cjs.map +1 -1
- package/dist/runner/types.d.cts +31 -5
- package/dist/runner/types.d.mts +31 -5
- package/dist/runner/types.d.ts +31 -5
- package/dist/sample/analysis.cjs +249 -459
- package/dist/sample/analysis.cjs.map +1 -1
- package/dist/sample/capability.cjs +138 -7
- package/dist/sample/capability.cjs.map +1 -1
- package/dist/sample/capability.d.cts +3 -1
- package/dist/sample/capability.d.mts +3 -1
- package/dist/sample/capability.d.ts +3 -1
- package/dist/sample/capability.js +8 -6
- package/dist/sandbox/docker-agent-image.cjs +5 -1
- package/dist/sandbox/docker-agent-image.cjs.map +1 -1
- package/dist/sandbox/docker-agent-image.d.cts +2 -0
- package/dist/sandbox/docker-agent-image.d.mts +2 -0
- package/dist/sandbox/docker-agent-image.d.ts +2 -0
- package/dist/sandbox/docker-agent-image.js +14 -10
- package/dist/sandbox/docker-profile/schema.cjs +283 -534
- package/dist/sandbox/docker-profile/schema.cjs.map +1 -1
- package/dist/sandbox/docker-profile/schema.d.cts +10 -27
- package/dist/sandbox/docker-profile/schema.d.mts +10 -27
- package/dist/sandbox/docker-profile/schema.d.ts +10 -27
- package/dist/sandbox/e2b-agent-template.cjs +5 -2
- package/dist/sandbox/e2b-agent-template.cjs.map +1 -1
- package/dist/sandbox/index.cjs +4 -2
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.d.cts +1 -1
- package/dist/sandbox/index.d.mts +1 -1
- package/dist/sandbox/index.d.ts +1 -1
- package/dist/sandbox/index.js +120 -116
- package/dist/sandbox/index.mjs +120 -116
- package/dist/sandbox/keep-registry.cjs +28 -66
- package/dist/sandbox/keep-registry.cjs.map +1 -1
- package/dist/sandbox/types.cjs.map +1 -1
- package/dist/sandbox/types.d.cts +1 -1
- package/dist/sandbox/types.d.mts +1 -1
- package/dist/sandbox/types.d.ts +1 -1
- package/dist/shared/aggregate.cjs +16 -6
- package/dist/shared/aggregate.cjs.map +1 -1
- package/dist/shared/aggregate.d.cts +12 -4
- package/dist/shared/aggregate.d.mts +12 -4
- package/dist/shared/aggregate.d.ts +12 -4
- package/dist/shared/turn-label.cjs +20 -2
- package/dist/shared/turn-label.cjs.map +1 -1
- package/dist/shared/turn-label.d.cts +2 -0
- package/dist/shared/turn-label.d.mts +2 -0
- package/dist/shared/turn-label.d.ts +2 -0
- package/dist/shared/turn-label.js +4 -2
- package/dist/vendor/remark/remark-gfm.cjs +7 -7
- package/dist/vendor/remark/remark-gfm.cjs.map +1 -1
- package/dist/vendor/remark/remark-parse.cjs +12 -12
- package/dist/vendor/remark/remark-parse.cjs.map +1 -1
- package/dist/vendor/remark/remark.cjs +13 -13
- package/dist/vendor/remark/remark.cjs.map +1 -1
- package/dist/view/server.cjs +6 -0
- package/dist/view/server.cjs.map +1 -1
- package/docs-site/images/hitl-handshake-zh.svg +3 -3
- package/docs-site/zh/examples/ai-agent-application.mdx +1 -1
- package/docs-site/zh/examples/coding-agent-extensions.mdx +1 -1
- package/docs-site/zh/examples/integrations/ai-sdk-v7.mdx +4 -3
- package/docs-site/zh/examples/integrations/claude-sdk.mdx +3 -3
- package/docs-site/zh/examples/integrations/codex-sdk.mdx +5 -5
- package/docs-site/zh/examples/integrations/langgraph.mdx +4 -4
- package/docs-site/zh/examples/integrations/pi-sdk.mdx +5 -5
- package/docs-site/zh/explanation/adapter.mdx +5 -5
- package/docs-site/zh/explanation/assert.mdx +7 -7
- package/docs-site/zh/explanation/drive.mdx +4 -2
- package/docs-site/zh/explanation/evals.mdx +10 -8
- package/docs-site/zh/explanation/experiment.mdx +2 -2
- package/docs-site/zh/explanation/hitl.mdx +9 -9
- package/docs-site/zh/explanation/judge.mdx +5 -5
- package/docs-site/zh/explanation/overview.mdx +3 -3
- package/docs-site/zh/explanation/runner.mdx +1 -1
- package/docs-site/zh/index.mdx +3 -3
- package/docs-site/zh/reference/builtin-agents.mdx +13 -13
- package/docs-site/zh/reference/capabilities.mdx +1 -1
- package/docs-site/zh/reference/cli.mdx +18 -12
- package/docs-site/zh/reference/define-agent.mdx +130 -5
- package/docs-site/zh/reference/define-config.mdx +2 -2
- package/docs-site/zh/reference/define-eval.mdx +4 -4
- package/docs-site/zh/reference/events.mdx +11 -11
- package/docs-site/zh/reference/official-adapters.mdx +6 -6
- package/docs-site/zh/reference/results-data.mdx +6 -0
- package/docs-site/zh/troubleshooting/debugging.mdx +1 -1
- package/docs-site/zh/troubleshooting/recover-after-kill.mdx +37 -5
- package/docs-site/zh/tutorials/accept-results.mdx +72 -0
- package/docs-site/zh/tutorials/agent-onboarding.mdx +6 -6
- package/docs-site/zh/tutorials/authoring.mdx +9 -13
- package/docs-site/zh/tutorials/ci-integration.mdx +6 -6
- package/docs-site/zh/tutorials/compare-runs.mdx +61 -0
- package/docs-site/zh/tutorials/concurrency.mdx +13 -12
- package/docs-site/zh/tutorials/configuration.mdx +4 -6
- package/docs-site/zh/tutorials/connect-your-agent.mdx +1 -1
- package/docs-site/zh/tutorials/control-run-cost.mdx +58 -0
- package/docs-site/zh/tutorials/criteria-files.mdx +2 -2
- package/docs-site/zh/tutorials/custom-reports.mdx +2 -2
- package/docs-site/zh/tutorials/debug-lifecycle-plan.mdx +46 -0
- package/docs-site/zh/tutorials/docker-in-docker.mdx +52 -43
- package/docs-site/zh/tutorials/eval-groups.mdx +6 -6
- package/docs-site/zh/tutorials/evaluation-kinds.mdx +3 -3
- package/docs-site/zh/tutorials/experiments.mdx +2 -3
- package/docs-site/zh/tutorials/handle-execution-failures.mdx +18 -10
- package/docs-site/zh/tutorials/install-custom-sandbox-agent.mdx +16 -8
- package/docs-site/zh/tutorials/nixos-managed-dind.mdx +160 -0
- package/docs-site/zh/tutorials/plugins.mdx +14 -0
- package/docs-site/zh/tutorials/rerun-and-cache.mdx +4 -2
- package/docs-site/zh/tutorials/sandbox-agent.mdx +17 -11
- package/docs-site/zh/tutorials/sandbox-providers.mdx +17 -13
- package/docs-site/zh/tutorials/sandbox-reuse.mdx +12 -19
- package/docs-site/zh/tutorials/select-and-preview.mdx +65 -0
- package/docs-site/zh/tutorials/verify-judge.mdx +78 -0
- package/docs-site/zh/tutorials/viewing-results.mdx +38 -1
- package/docs-site/zh/tutorials/write-experiment.mdx +7 -5
- package/docs-site/zh/tutorials/write-send.mdx +9 -8
- package/package.json +9 -5
- package/dist/report/built-in/overview.cjs +0 -44
- package/dist/report/built-in/overview.cjs.map +0 -1
- package/dist/report/built-in/overview.d.cts +0 -6
- package/dist/report/built-in/overview.d.mts +0 -6
- package/dist/report/built-in/overview.d.ts +0 -6
- package/dist/report/built-in/overview.js +0 -9
- package/dist/report/built-in/overview.js.map +0 -1
- package/dist/runner/gate-lease.cjs +0 -283
- package/dist/runner/gate-lease.cjs.map +0 -1
- package/dist/runner/gate-lease.d.cts +0 -62
- package/dist/runner/gate-lease.d.mts +0 -62
- package/dist/runner/gate-lease.d.ts +0 -62
- package/dist/runner/gate-lease.js +0 -22
- package/dist/runner/gate-lease.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.js","sourceRoot":"","sources":["match.ts"],"names":[],"mappings":";;AAiNA,wCAEC;AAED,wCAKC;AAED,wEAEC;AAED,wEAEC;AAED,gEASC;AAED,0DAKC;AAgED,8DAiBC;AAED,wDA8BC;AAED,4DAEC;AAED,oDAIC;AAED,gDAUC;AAgHD,kBAUC;AAKD,gBA4BC;AACD,kBAqBC;AAgBD,4BAcC;AACD,4BAcC;AACD,0BAkBC;AAED,gCAYC;AAmBD,kCAYC;AAED,kCAYC;AASD,8BAQC;AAED,wBAOC;AAED,0BAOC;AAED,4CAcC;AAED,8BAEC;AAwCD,wBAOC;AAqBD,0BA8BC;AAKD,wCAUC;AAGD,8BAYC;AASD,4CAiBC;AACD,4CAgBC;AAiHD,8CAkBC;AAmBD,8BAYC;AAgJD,8BAsDC;AAED,wDAGC;AAED,0DAGC;AAqBD,kEA+EC;AAiED,oCAqBC;AAkDD,gCA4CC;AA5gDD,2DAAsD;AAEtD,wCAA2C;AA0C3C,8DAA8D;AAC9D,sDAAsD;AAC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,CAAC;IAC7B,IAAI,IAAI,KAAK,SAAS;QAClB,kBAAkB,CAAC,IAAI,EAAE,cAAc,IAAI,gBAAgB,EAAE,MAAM,CAAC,CAAC;IACzE,MAAM,IAAI,GAAG,cAAc,IAAI,GAAG,CAAC;IACnC,OAAO,kBAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACrD,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YACtB,OAAO,UAAU,CAAC,UAAU,CAAC,qBAAqB,EAAE,0BAA0B,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACzG,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC;YAChC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,IAA6B,CAAC,EAAE;SAC3F,CAAC,CAAC;QACH,OAAO,kBAAkB,CAErB,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC,CAEE,CAAC;AACR,CAAC","sourcesContent":["// Match 内核:纯候选比较、三态结果与领域 matcher。\n//\n// 这里不登记 Assertion,也不决定 Verdict / Score。调用方先冻结 subject,再把同一\n// candidate 交给本模块;因此组合 matcher 不会自行重读证据,也不会把 evaluator defect\n// 折成 mismatch 或 unavailable。\nimport type { StandardSchemaV1 as StandardSchema } from \"@standard-schema/spec\";\nimport type { CommandProjection, LogicalToolOccurrence, } from \"../o11y/types.ts\";\nimport { matchesJson } from \"../shared/json-match.ts\";\nimport type { JsonMatch, JsonValue } from \"../shared/types.ts\";\nimport { stripComments } from \"../util.ts\";\nexport type MatchDomain = \"value\" | \"tool\" | \"event\";\ntype MatchPathSegment = string | number;\n/** 可序列化的候选诊断;组合 matcher 用 children 保留声明顺序与嵌套位置。 */\nexport interface MatchDiagnostic {\n readonly code: string;\n readonly message: string;\n /** 相对当前 matcher 的路径;组合节点的 child index 也由 children 明确给出。 */\n readonly path: readonly MatchPathSegment[];\n readonly expected?: string;\n readonly received?: string;\n readonly reason?: string;\n readonly locator?: {\n readonly kind: \"json-pointer\";\n readonly pointer: string;\n } | {\n readonly kind: \"tool-occurrence\";\n readonly id: string;\n };\n readonly children?: readonly MatchDiagnosticChild[];\n}\nexport interface MatchDiagnosticChild {\n readonly index: number;\n readonly label?: string;\n readonly state: MatchEvaluationState;\n readonly diagnostic?: MatchDiagnostic;\n}\nexport type MatchEvaluationState = \"matched\" | \"mismatched\" | \"unavailable\";\n/** 一个单候选 matcher 的内部三态结果。 */\nexport type BooleanMatchEvaluation<R> = {\n readonly state: \"matched\";\n /** 永远是传入 candidate 本身,只是在类型层收窄。 */\n readonly value: R;\n readonly diagnostic?: MatchDiagnostic;\n} | {\n readonly state: \"mismatched\";\n readonly diagnostic: MatchDiagnostic;\n} | {\n readonly state: \"unavailable\";\n readonly reason: string;\n readonly diagnostic: MatchDiagnostic;\n};\n// 这些 symbol 不导出。外部作者无法构造看似可消费的 Match;输入 variance 与 refinement\n// variance 也保持分离,ScoreMatch 不会伪造一个没有含义的输出 refinement。\nconst matchInputBrand: unique symbol = Symbol(\"niceeval.match.input\");\nconst matchRefinementBrand: unique symbol = Symbol(\"niceeval.match.refinement\");\nconst matchEvaluatorBrand: unique symbol = Symbol(\"niceeval.match.evaluator\");\nconst positiveWitnessBrand: unique symbol = Symbol(\"niceeval.match.positive-witness\");\nconst thresholdedScoreMatchBrand: unique symbol = Symbol(\"niceeval.thresholdedScoreMatch\");\nconst assertionEventIdentityBrand: unique symbol = Symbol(\"niceeval.assertionEventIdentity\");\nconst assertionEventPositionBrand: unique symbol = Symbol(\"niceeval.assertionEventPosition\");\nconst toolOccurrenceIdentityBrand: unique symbol = Symbol(\"niceeval.toolOccurrenceIdentity\");\nconst matchBrands = new WeakSet<object>();\nconst thresholdedScoreMatches = new WeakMap<object, {\n readonly match: ScoreMatch<unknown>;\n readonly threshold: number;\n}>();\nexport interface Match<in T, D extends MatchDomain> {\n readonly domain: D;\n readonly name: string;\n readonly [matchInputBrand]: (candidate: T) => void;\n readonly [matchEvaluatorBrand]: (candidate: T) => Promise<unknown>;\n}\nexport interface BooleanMatch<in T, out R extends T, D extends MatchDomain = \"value\"> extends Match<T, D> {\n readonly kind: \"boolean\";\n readonly [matchRefinementBrand]: () => R;\n}\nexport interface ScoreMatch<in T> extends Match<T, \"value\"> {\n readonly kind: \"score\";\n atLeast(threshold: number): ThresholdedScoreMatch<T>;\n}\nexport interface ThresholdedScoreMatch<in T> {\n readonly kind: \"thresholded-score-match\";\n readonly [thresholdedScoreMatchBrand]: (candidate: T) => void;\n}\nexport type ValueMatch<T, R extends T = T> = BooleanMatch<T, R, \"value\"> | ScoreMatch<T>;\nexport type LogicalCommandOccurrence = LogicalToolOccurrence & {\n readonly command: Extract<CommandProjection, {\n readonly kind: \"command\";\n }>;\n};\nexport type ToolMatch<R extends LogicalToolOccurrence = LogicalToolOccurrence> = BooleanMatch<LogicalToolOccurrence, R, \"tool\">;\nexport type AssertionEventIdentity = string & {\n readonly [assertionEventIdentityBrand]: true;\n};\nexport type ToolOccurrenceIdentity = string & {\n readonly [toolOccurrenceIdentityBrand]: true;\n};\nexport interface AssertionEventPosition {\n readonly turnOrdinal: number;\n readonly eventOrdinal: number;\n readonly [assertionEventPositionBrand]: true;\n}\nexport interface AssertionToolReference {\n readonly id: ToolOccurrenceIdentity;\n readonly name: string;\n}\nexport type AssertionEvent = {\n readonly id: AssertionEventIdentity;\n readonly position: AssertionEventPosition;\n readonly type: \"message\";\n readonly role: \"assistant\" | \"user\";\n readonly text: string;\n} | {\n readonly id: AssertionEventIdentity;\n readonly position: AssertionEventPosition;\n readonly type: \"operation.started\";\n readonly tool: AssertionToolReference;\n} | {\n readonly id: AssertionEventIdentity;\n readonly position: AssertionEventPosition;\n readonly type: \"operation.finished\";\n readonly tool: AssertionToolReference;\n readonly status: \"completed\" | \"failed\" | \"rejected\";\n};\nexport type MatchableEvent = AssertionEvent;\nexport type EventMatch<R extends AssertionEvent = AssertionEvent> = BooleanMatch<AssertionEvent, R, \"event\">;\nconst assertionEventOccurrences = new WeakMap<object, LogicalToolOccurrence>();\nexport type RefinementOf<M> = M extends BooleanMatch<infer _T, infer R, infer _D> ? R : never;\nexport type RefinementIntersection<M extends readonly unknown[]> = M extends readonly [\n infer Head,\n ...infer Tail\n] ? RefinementOf<Head> & RefinementIntersection<Tail> : unknown;\ninterface InternalMatch {\n readonly domain: MatchDomain;\n readonly name: string;\n readonly kind: \"boolean\" | \"score\";\n readonly [matchEvaluatorBrand]: (candidate: unknown) => Promise<unknown>;\n readonly [positiveWitnessBrand]?: true;\n}\ninterface CreateBooleanMatchOptions {\n readonly positiveWitness?: true;\n}\nfunction isRecord(value: unknown): value is globalThis.Record<PropertyKey, unknown> {\n return value !== null && typeof value === \"object\";\n}\nfunction diagnostic(code: string, message: string, options: Omit<MatchDiagnostic, \"code\" | \"message\" | \"path\"> & {\n readonly path?: readonly MatchPathSegment[];\n} = {}): MatchDiagnostic {\n return Object.freeze({\n code,\n message,\n path: Object.freeze([...(options.path ?? [])]),\n ...(options.expected === undefined ? {} : { expected: options.expected }),\n ...(options.received === undefined ? {} : { received: options.received }),\n ...(options.reason === undefined ? {} : { reason: options.reason }),\n ...(options.locator === undefined ? {} : { locator: options.locator }),\n ...(options.children === undefined ? {} : { children: Object.freeze([...options.children]) }),\n });\n}\nfunction matched<R>(value: R, detail?: MatchDiagnostic): BooleanMatchEvaluation<R> {\n return Object.freeze({ state: \"matched\" as const, value, ...(detail === undefined ? {} : { diagnostic: detail }) });\n}\nfunction mismatched<R = never>(detail: MatchDiagnostic): BooleanMatchEvaluation<R> {\n return Object.freeze({ state: \"mismatched\" as const, diagnostic: detail });\n}\nfunction unavailable<R = never>(reason: string, detail: MatchDiagnostic): BooleanMatchEvaluation<R> {\n return Object.freeze({ state: \"unavailable\" as const, reason, diagnostic: detail });\n}\nfunction assertDiagnostic(value: unknown, label: string): asserts value is MatchDiagnostic {\n if (!isRecord(value) || typeof value.code !== \"string\" || typeof value.message !== \"string\" || !Array.isArray(value.path)) {\n throw new TypeError(`${label} returned an invalid diagnostic`);\n }\n}\nfunction assertBooleanEvaluation<R>(value: unknown, label: string): BooleanMatchEvaluation<R> {\n if (!isRecord(value) || typeof value.state !== \"string\") {\n throw new TypeError(`${label} returned an invalid boolean matcher result`);\n }\n if (value.state === \"matched\") {\n if (!(\"value\" in value))\n throw new TypeError(`${label} returned a matched result without the original candidate`);\n return value as BooleanMatchEvaluation<R>;\n }\n if (value.state === \"mismatched\") {\n assertDiagnostic(value.diagnostic, label);\n return value as BooleanMatchEvaluation<R>;\n }\n if (value.state === \"unavailable\") {\n if (typeof value.reason !== \"string\" || value.reason.length === 0) {\n throw new TypeError(`${label} returned unavailable without a reason`);\n }\n assertDiagnostic(value.diagnostic, label);\n return value as BooleanMatchEvaluation<R>;\n }\n throw new TypeError(`${label} returned an unknown matcher state`);\n}\nfunction internalMatchOf(value: unknown, label: string): InternalMatch {\n if (!isRecord(value) || !matchBrands.has(value)) {\n throw new TypeError(`${label} must be a Match created by niceeval/expect`);\n }\n const match = value as unknown as InternalMatch;\n if ((match.domain !== \"value\" && match.domain !== \"tool\" && match.domain !== \"event\") ||\n (match.kind !== \"boolean\" && match.kind !== \"score\") ||\n typeof match.name !== \"string\" ||\n typeof match[matchEvaluatorBrand] !== \"function\") {\n throw new TypeError(`${label} must be a Match created by niceeval/expect`);\n }\n return match;\n}\n/** @internal Runtime brand guard used by the context overload dispatcher. */\nexport function isManagedMatch(value: unknown): boolean {\n return isRecord(value) && matchBrands.has(value);\n}\n/** @internal Reject Match-shaped raw subjects instead of silently treating them as ordinary values. */\nexport function looksLikeMatch(value: unknown): boolean {\n if (!isRecord(value))\n return false;\n return (value.domain === \"value\" || value.domain === \"tool\" || value.domain === \"event\") &&\n (value.kind === \"boolean\" || value.kind === \"score\") && typeof value.name === \"string\";\n}\n/** @internal Runtime brand guard for ScoreMatch.atLeast(). */\nexport function isManagedThresholdedScoreMatch(value: unknown): value is ThresholdedScoreMatch<unknown> {\n return isRecord(value) && thresholdedScoreMatches.has(value);\n}\n/** @internal Reserve threshold-view-shaped raw inputs at the authoring boundary. */\nexport function looksLikeThresholdedScoreMatch(value: unknown): boolean {\n return isRecord(value) && value.kind === \"thresholded-score-match\";\n}\n/** @internal Resolve a threshold view without evaluating its underlying Match. */\nexport function thresholdedScoreMatchValue(value: unknown): {\n readonly match: ScoreMatch<unknown>;\n readonly threshold: number;\n} {\n const resolved = isRecord(value) ? thresholdedScoreMatches.get(value) : undefined;\n if (resolved === undefined) {\n throw new TypeError(\"value must be a threshold view created by ScoreMatch.atLeast()\");\n }\n return resolved;\n}\n/** @internal The value-side consumer accepts only a real, value-domain Match. */\nexport function assertManagedValueMatch(value: unknown, label = \"match\"): BooleanMatch<unknown, unknown, \"value\"> | ScoreMatch<unknown> {\n const match = internalMatchOf(value, label);\n if (match.domain !== \"value\")\n throw new TypeError(`${label} must be a value-domain Match`);\n return value as BooleanMatch<unknown, unknown, \"value\"> | ScoreMatch<unknown>;\n}\nfunction assertBooleanMatch(value: unknown, label: string, domain?: MatchDomain): InternalMatch {\n const match = internalMatchOf(value, label);\n if (match.kind !== \"boolean\")\n throw new TypeError(`${label} must be a BooleanMatch`);\n if (domain !== undefined && match.domain !== domain) {\n throw new TypeError(`${label} must have ${domain} domain, received ${match.domain}`);\n }\n return match;\n}\nfunction createBooleanMatch<T, R extends T, D extends MatchDomain>(domain: D, name: string, evaluate: (candidate: T) => BooleanMatchEvaluation<R> | Promise<BooleanMatchEvaluation<R>>, options: CreateBooleanMatchOptions = {}): BooleanMatch<T, R, D> {\n const result = {\n domain,\n name,\n kind: \"boolean\" as const,\n [matchInputBrand]: (_candidate: T) => undefined,\n [matchRefinementBrand]: () => undefined as unknown as R,\n [matchEvaluatorBrand]: async (candidate: T) => evaluate(candidate),\n ...(options.positiveWitness === true ? { [positiveWitnessBrand]: true as const } : {}),\n };\n const match = Object.freeze(result) as BooleanMatch<T, R, D>;\n matchBrands.add(match);\n return match;\n}\nfunction createScoreMatch<T>(name: string, evaluate: (candidate: T) => number | Promise<number>): ScoreMatch<T> {\n let match: ScoreMatch<T>;\n const result = {\n domain: \"value\" as const,\n name,\n kind: \"score\" as const,\n [matchInputBrand]: (_candidate: T) => undefined,\n [matchEvaluatorBrand]: async (candidate: T) => evaluate(candidate),\n atLeast(threshold: number) {\n assertUnitThreshold(threshold, \"ScoreMatch.atLeast() threshold\");\n const view: ThresholdedScoreMatch<T> = {\n kind: \"thresholded-score-match\",\n [thresholdedScoreMatchBrand]: (_candidate: T) => undefined,\n };\n thresholdedScoreMatches.set(view, { match: match as ScoreMatch<unknown>, threshold });\n return Object.freeze(view);\n },\n };\n match = Object.freeze(result) as ScoreMatch<T>;\n matchBrands.add(match);\n return match;\n}\nfunction assertUnitThreshold(value: unknown, label: string): asserts value is number {\n if (typeof value !== \"number\" || !Number.isFinite(value) || value < 0 || value > 1) {\n throw new TypeError(`${label} must be a finite number in [0, 1]`);\n }\n}\nfunction freezeEventPosition(turnOrdinal: number, eventOrdinal: number): AssertionEventPosition {\n return Object.freeze({ turnOrdinal, eventOrdinal }) as AssertionEventPosition;\n}\nfunction assertionEventId(session: string, turn: string, turnOrdinal: number, eventOrdinal: number): AssertionEventIdentity {\n return JSON.stringify([\n \"niceeval.assertion-event/1\",\n session,\n turn,\n turnOrdinal,\n eventOrdinal,\n ]) as AssertionEventIdentity;\n}\n/** @internal Project a raw message into the closed assertion-event surface. */\nexport function makeAssertionMessageEvent(input: {\n readonly session: string;\n readonly turn: string;\n readonly turnOrdinal: number;\n readonly eventOrdinal: number;\n readonly role: \"assistant\" | \"user\";\n readonly text: string;\n}): Extract<AssertionEvent, {\n readonly type: \"message\";\n}> {\n return Object.freeze({\n id: assertionEventId(input.session, input.turn, input.turnOrdinal, input.eventOrdinal),\n position: freezeEventPosition(input.turnOrdinal, input.eventOrdinal),\n type: \"message\" as const,\n role: input.role,\n text: input.text,\n });\n}\n/** @internal Project a correlated tool lifecycle row without exposing raw adapter fields. */\nexport function makeAssertionToolEvent(input: {\n readonly session: string;\n readonly turn: string;\n readonly turnOrdinal: number;\n readonly eventOrdinal: number;\n readonly type: \"operation.started\" | \"operation.finished\";\n readonly occurrence: LogicalToolOccurrence;\n readonly status?: \"completed\" | \"failed\" | \"rejected\";\n}): Extract<AssertionEvent, {\n readonly type: \"operation.started\" | \"operation.finished\";\n}> {\n const base = {\n id: assertionEventId(input.session, input.turn, input.turnOrdinal, input.eventOrdinal),\n position: freezeEventPosition(input.turnOrdinal, input.eventOrdinal),\n tool: Object.freeze({\n id: input.occurrence.id as ToolOccurrenceIdentity,\n name: input.occurrence.name.canonical ?? input.occurrence.name.original,\n }),\n };\n const event = input.type === \"operation.started\"\n ? Object.freeze({ ...base, type: \"operation.started\" as const })\n : Object.freeze({\n ...base,\n type: \"operation.finished\" as const,\n status: input.status ?? (() => {\n throw new TypeError(\"operation.finished assertion event requires status\");\n })(),\n });\n assertionEventOccurrences.set(event, input.occurrence);\n return event;\n}\n/** @internal Retrieve the correlated occurrence for eventMatch(tool). */\nexport function assertionEventOccurrence(event: AssertionEvent): LogicalToolOccurrence | undefined {\n return assertionEventOccurrences.get(event);\n}\n/** 供 Assertion runtime / scope owner 消费 BooleanMatch;普通作者面不会导出此 evaluator。 */\nexport async function evaluateBooleanMatch<T, R extends T, D extends MatchDomain>(match: BooleanMatch<T, R, D>, candidate: T): Promise<BooleanMatchEvaluation<R>> {\n const internal = assertBooleanMatch(match, \"match\");\n const result = await internal[matchEvaluatorBrand](candidate);\n return assertBooleanEvaluation<R>(result, `matcher ${internal.name}`);\n}\n/** 供 Assertion runtime 消费 ScoreMatch。范围非法是 evaluator defect,绝不 clamp。 */\nexport async function evaluateScoreMatch<T>(match: ScoreMatch<T>, candidate: T): Promise<number> {\n const internal = internalMatchOf(match, \"match\");\n if (internal.kind !== \"score\" || internal.domain !== \"value\") {\n throw new TypeError(\"match must be a value-domain ScoreMatch\");\n }\n const score = await internal[matchEvaluatorBrand](candidate);\n if (typeof score !== \"number\" || !Number.isFinite(score) || score < 0 || score > 1) {\n throw new TypeError(`matcher ${internal.name} returned a score outside finite [0, 1]`);\n }\n return score;\n}\nfunction hasPositiveWitnessCapability(match: BooleanMatch<unknown, unknown, \"value\">): boolean {\n return (internalMatchOf(match, \"input matcher\") as InternalMatch)[positiveWitnessBrand] === true;\n}\nfunction assertNonEmptyString(value: unknown, label: string): asserts value is string {\n if (typeof value !== \"string\" || value.length === 0)\n throw new TypeError(`${label} must be a non-empty string`);\n}\nfunction assertPlainOptions(value: unknown, label: string, allowed: readonly string[]): globalThis.Record<string, unknown> {\n if (value === undefined)\n return {};\n if (!isRecord(value) || Array.isArray(value))\n throw new TypeError(`${label} must be an options object`);\n for (const key of Object.keys(value)) {\n if (!allowed.includes(key))\n throw new TypeError(`${label} does not support option ${JSON.stringify(key)}`);\n }\n return value as globalThis.Record<string, unknown>;\n}\nfunction quoted(value: string): string {\n return JSON.stringify(value);\n}\nfunction resultChild(result: BooleanMatchEvaluation<unknown>, index: number, label?: string): MatchDiagnosticChild {\n return Object.freeze({\n index,\n ...(label === undefined ? {} : { label }),\n state: result.state,\n ...(result.diagnostic === undefined ? {} : { diagnostic: result.diagnostic }),\n });\n}\nfunction combineConjunction<T, R extends T>(candidate: T, name: string, fields: readonly {\n readonly label: string;\n readonly result: BooleanMatchEvaluation<unknown>;\n}[]): BooleanMatchEvaluation<R> {\n const children = fields.map((field, index) => resultChild(field.result, index, field.label));\n const mismatch = fields.find((field) => field.result.state === \"mismatched\");\n if (mismatch !== undefined) {\n return mismatched(diagnostic(\"all-of-mismatch\", `${name} had a definite mismatch`, {\n expected: \"all matcher fields matched\",\n children,\n }));\n }\n const missing = fields.find((field) => field.result.state === \"unavailable\");\n if (missing !== undefined) {\n const reason = (missing.result as Extract<BooleanMatchEvaluation<unknown>, {\n readonly state: \"unavailable\";\n }>).reason;\n return unavailable(reason, diagnostic(\"all-of-unavailable\", `${name} could not be decided from available evidence`, {\n expected: \"all matcher fields matched\",\n reason,\n children,\n }));\n }\n return matched(candidate as R, diagnostic(\"all-of-match\", `${name} matched all fields`, { children }));\n}\nasync function evaluateFields(fields: readonly {\n readonly label: string;\n readonly evaluate: () => Promise<BooleanMatchEvaluation<unknown>>;\n}[]): Promise<readonly {\n readonly label: string;\n readonly result: BooleanMatchEvaluation<unknown>;\n}[]> {\n const results: {\n label: string;\n result: BooleanMatchEvaluation<unknown>;\n }[] = [];\n let hasDefect = false;\n let firstDefect: unknown;\n // 不短路:组合的结构化诊断必须保留每个 child;defect 在所有可执行 child 完成后原样抛出。\n for (const field of fields) {\n try {\n results.push({ label: field.label, result: await field.evaluate() });\n }\n catch (error) {\n if (!hasDefect) {\n hasDefect = true;\n firstDefect = error;\n }\n }\n }\n if (hasDefect)\n throw firstDefect;\n return results;\n}\nfunction booleanCompositionName(operator: \"and\" | \"or\", matches: readonly {\n readonly name: string;\n}[]): string {\n return `${operator}(${matches.map((match) => match.name).join(\", \")})`;\n}\nfunction assertComposableMatches(first: unknown, rest: readonly unknown[], operator: \"and\" | \"or\"): {\n readonly domain: MatchDomain;\n readonly matches: readonly BooleanMatch<unknown, unknown, MatchDomain>[];\n} {\n if (rest.length === 0)\n throw new TypeError(`${operator}() requires at least two BooleanMatch values`);\n const firstInternal = assertBooleanMatch(first, `${operator}() first argument`);\n const matches: BooleanMatch<unknown, unknown, MatchDomain>[] = [\n first as BooleanMatch<unknown, unknown, MatchDomain>,\n ];\n for (const [index, match] of rest.entries()) {\n const internal = assertBooleanMatch(match, `${operator}() argument ${index + 2}`);\n if (internal.domain !== firstInternal.domain) {\n throw new TypeError(`${operator}() cannot combine ${firstInternal.domain}-domain and ${internal.domain}-domain matchers`);\n }\n matches.push(match as BooleanMatch<unknown, unknown, MatchDomain>);\n }\n return { domain: firstInternal.domain, matches };\n}\nexport function and<T, R extends T, D extends MatchDomain, const Rest extends readonly [\n BooleanMatch<NoInfer<T>, T, NoInfer<D>>,\n ...BooleanMatch<NoInfer<T>, T, NoInfer<D>>[]\n]>(first: BooleanMatch<T, R, D>, ...rest: Rest): BooleanMatch<T, T & R & RefinementIntersection<Rest>, D>;\nexport function and(first: BooleanMatch<unknown, unknown, MatchDomain>, ...rest: readonly BooleanMatch<unknown, unknown, MatchDomain>[]): BooleanMatch<unknown, unknown, MatchDomain> {\n const composition = assertComposableMatches(first, rest, \"and\");\n const name = booleanCompositionName(\"and\", composition.matches);\n return createBooleanMatch(composition.domain, name, async (candidate: unknown) => {\n const fields = await evaluateFields(composition.matches.map((match, index) => ({\n label: match.name || `matcher ${index}`,\n evaluate: () => evaluateBooleanMatch(match, candidate),\n })));\n return combineConjunction(candidate, name, fields);\n });\n}\nexport function or<T, R extends T, D extends MatchDomain, const Rest extends readonly [\n BooleanMatch<NoInfer<T>, T, NoInfer<D>>,\n ...BooleanMatch<NoInfer<T>, T, NoInfer<D>>[]\n]>(first: BooleanMatch<T, R, D>, ...rest: Rest): BooleanMatch<T, T & (R | RefinementOf<Rest[number]>), D>;\nexport function or(first: BooleanMatch<unknown, unknown, MatchDomain>, ...rest: readonly BooleanMatch<unknown, unknown, MatchDomain>[]): BooleanMatch<unknown, unknown, MatchDomain> {\n const composition = assertComposableMatches(first, rest, \"or\");\n const name = booleanCompositionName(\"or\", composition.matches);\n return createBooleanMatch(composition.domain, name, async (candidate: unknown) => {\n const fields = await evaluateFields(composition.matches.map((match, index) => ({\n label: match.name || `matcher ${index}`,\n evaluate: () => evaluateBooleanMatch(match, candidate),\n })));\n const children = fields.map((field, index) => resultChild(field.result, index, field.label));\n if (fields.some((field) => field.result.state === \"matched\")) {\n return matched(candidate, diagnostic(\"any-of-match\", `${name} matched at least one child`, { children }));\n }\n const missing = fields.find((field) => field.result.state === \"unavailable\");\n if (missing !== undefined) {\n const reason = (missing.result as Extract<BooleanMatchEvaluation<unknown>, {\n readonly state: \"unavailable\";\n }>).reason;\n return unavailable(reason, diagnostic(\"any-of-unavailable\", `${name} had no definite match and incomplete evidence`, {\n expected: \"at least one matcher matched\",\n reason,\n children,\n }));\n }\n return mismatched(diagnostic(\"any-of-mismatch\", `${name} had no matching child`, {\n expected: \"at least one matcher matched\",\n children,\n }));\n });\n}\nexport function not<T>(match: BooleanMatch<T, T, \"value\">): BooleanMatch<T, T, \"value\"> {\n assertBooleanMatch(match, \"not() argument\", \"value\");\n return createBooleanMatch(\"value\", `not(${match.name})`, async (candidate) => {\n const result = await evaluateBooleanMatch(match, candidate);\n if (result.state === \"matched\") {\n return mismatched(diagnostic(\"not-mismatch\", `not(${match.name}) failed because its child matched`, {\n expected: `not ${match.name}`,\n children: [resultChild(result, 0, match.name)],\n }));\n }\n if (result.state === \"mismatched\") {\n return matched(candidate, diagnostic(\"not-match\", `not(${match.name}) matched`, {\n children: [resultChild(result, 0, match.name)],\n }));\n }\n return unavailable(result.reason, diagnostic(\"not-unavailable\", `not(${match.name}) could not decide its child`, {\n expected: `not ${match.name}`,\n reason: result.reason,\n children: [resultChild(result, 0, match.name)],\n }));\n });\n}\nexport interface TextMatchOptions {\n readonly stripComments?: boolean;\n}\nfunction normalizeTextOptions(value: unknown, label: string): Readonly<TextMatchOptions> {\n const options = assertPlainOptions(value, label, [\"stripComments\"]);\n if (options.stripComments !== undefined && typeof options.stripComments !== \"boolean\") {\n throw new TypeError(`${label}.stripComments must be a boolean`);\n }\n return Object.freeze(options as TextMatchOptions);\n}\nfunction textCandidate(value: unknown, options: TextMatchOptions): string | undefined {\n if (typeof value !== \"string\")\n return undefined;\n return options.stripComments === true ? stripComments(value) : value;\n}\nexport function includes(text: string, options?: TextMatchOptions): BooleanMatch<string, string> {\n assertNonEmptyString(text, \"includes() text\");\n const normalizedOptions = normalizeTextOptions(options, \"includes() options\");\n const name = `includes(${quoted(text)})`;\n return createBooleanMatch(\"value\", name, (value) => {\n const candidate = textCandidate(value, normalizedOptions);\n if (candidate === undefined) {\n return mismatched(diagnostic(\"text-candidate-type\", `${name} only accepts string candidates`, { expected: \"string\" }));\n }\n if (candidate.includes(text)) {\n return matched(value, diagnostic(\"text-includes-match\", `${name} found the literal text`, { expected: quoted(text) }));\n }\n return mismatched(diagnostic(\"text-includes-mismatch\", `${name} did not find the literal text`, { expected: quoted(text) }));\n });\n}\nexport function excludes(text: string, options?: TextMatchOptions): BooleanMatch<string, string> {\n assertNonEmptyString(text, \"excludes() text\");\n const normalizedOptions = normalizeTextOptions(options, \"excludes() options\");\n const name = `excludes(${quoted(text)})`;\n return createBooleanMatch(\"value\", name, (value) => {\n const candidate = textCandidate(value, normalizedOptions);\n if (candidate === undefined) {\n return mismatched(diagnostic(\"text-candidate-type\", `${name} only accepts string candidates`, { expected: \"string\" }));\n }\n if (!candidate.includes(text)) {\n return matched(value, diagnostic(\"text-excludes-match\", `${name} did not find the literal text`, { expected: quoted(text) }));\n }\n return mismatched(diagnostic(\"text-excludes-mismatch\", `${name} found excluded literal text`, { expected: quoted(text) }));\n });\n}\nexport function pattern(expression: RegExp, options?: TextMatchOptions): BooleanMatch<string, string> {\n if (!(expression instanceof RegExp))\n throw new TypeError(\"pattern() expression must be a RegExp\");\n const normalizedOptions = normalizeTextOptions(options, \"pattern() options\");\n const name = `pattern(${expression.toString()})`;\n return createBooleanMatch(\"value\", name, (value) => {\n const candidate = textCandidate(value, normalizedOptions);\n if (candidate === undefined) {\n return mismatched(diagnostic(\"text-candidate-type\", `${name} only accepts string candidates`, { expected: \"string\" }));\n }\n // 新 clone 的 lastIndex 从零开始,既满足 g/y 每次独立求值,也完全不修改作者实例。\n const isolatedExpression = new RegExp(expression.source, expression.flags);\n isolatedExpression.lastIndex = 0;\n if (isolatedExpression.test(candidate)) {\n return matched(value, diagnostic(\"pattern-match\", `${name} matched`, { expected: expression.toString() }));\n }\n return mismatched(diagnostic(\"pattern-mismatch\", `${name} did not match`, { expected: expression.toString() }));\n });\n}\n/** 归一化 Levenshtein similarity;它是连续分数,不携带默认阈值或 verdict 策略。 */\nexport function similarity(expected: string): ScoreMatch<string> {\n if (typeof expected !== \"string\")\n throw new TypeError(\"similarity() expected must be a string\");\n const name = `similarity(${quoted(expected)})`;\n return createScoreMatch(name, (value) => {\n if (typeof value !== \"string\")\n throw new TypeError(`${name} only accepts string candidates`);\n const maxLength = Math.max(value.length, expected.length);\n if (maxLength === 0)\n return 1;\n return 1 - levenshtein(value, expected) / maxLength;\n });\n}\nfunction levenshtein(a: string, b: string): number {\n if (a.length === 0)\n return b.length;\n if (b.length === 0)\n return a.length;\n let previous = Array.from({ length: b.length + 1 }, (_unused, index) => index);\n let current = new Array<number>(b.length + 1);\n for (let row = 1; row <= a.length; row += 1) {\n current[0] = row;\n for (let column = 1; column <= b.length; column += 1) {\n const substitution = a.charCodeAt(row - 1) === b.charCodeAt(column - 1) ? 0 : 1;\n current[column] = Math.min(previous[column]! + 1, current[column - 1]! + 1, previous[column - 1]! + substitution);\n }\n [previous, current] = [current, previous];\n }\n return previous[b.length]!;\n}\n/** 至少含 min 个去重 http(s) URL 的纯文本 matcher。 */\nexport function includesUrl(min = 1): BooleanMatch<string, string> {\n const name = `includesUrl(min=${min})`;\n return createBooleanMatch(\"value\", name, (value) => {\n if (typeof value !== \"string\") {\n return mismatched(diagnostic(\"text-candidate-type\", `${name} only accepts string candidates`, { expected: \"string\" }));\n }\n const urls = new Set(value.match(/https?:\\/\\/[^\\s<>()\"'\\x60]+/g) ?? []);\n if (urls.size >= min) {\n return matched(value, diagnostic(\"url-count-match\", `${name} found enough distinct URLs`, { expected: `>= ${min}` }));\n }\n return mismatched(diagnostic(\"url-count-mismatch\", `${name} did not find enough distinct URLs`, { expected: `>= ${min}` }));\n });\n}\n/** 至少含 min 个 Markdown heading 的纯文本 matcher。 */\nexport function hasSections(min = 2): BooleanMatch<string, string> {\n const name = `hasSections(min=${min})`;\n return createBooleanMatch(\"value\", name, (value) => {\n if (typeof value !== \"string\") {\n return mismatched(diagnostic(\"text-candidate-type\", `${name} only accepts string candidates`, { expected: \"string\" }));\n }\n const count = (value.match(/^#{1,6}\\s+\\S/gm) ?? []).length;\n if (count >= min) {\n return matched(value, diagnostic(\"heading-count-match\", `${name} found enough headings`, { expected: `>= ${min}` }));\n }\n return mismatched(diagnostic(\"heading-count-mismatch\", `${name} did not find enough headings`, { expected: `>= ${min}` }));\n });\n}\nfunction optionalLabel(label: string | undefined, factory: string): string {\n if (label !== undefined && typeof label !== \"string\")\n throw new TypeError(`${factory}() label must be a string`);\n return label === undefined || label.length === 0 ? `${factory}()` : `${factory}(${label})`;\n}\n/** 非 null / undefined 的 value matcher;泛型调用可保留原 candidate 的非空收窄。 */\nexport function isDefined(label?: string): BooleanMatch<unknown, {}>;\nexport function isDefined<T>(label?: string): BooleanMatch<T, Exclude<T, null | undefined>>;\nexport function isDefined<T = unknown>(label?: string): BooleanMatch<T, Exclude<T, null | undefined>> {\n const name = optionalLabel(label, \"isDefined\");\n return createBooleanMatch(\"value\", name, (value) => {\n if (value !== null && value !== undefined) {\n return matched(value as Exclude<T, null | undefined>, diagnostic(\"defined-match\", `${name} matched`, { expected: \"defined\" }));\n }\n return mismatched(diagnostic(\"defined-mismatch\", `${name} did not match`, { expected: \"defined\" }));\n });\n}\n/** value === true 的 refinement matcher。 */\nexport function isTrue<T = unknown>(label?: string): BooleanMatch<T, T & true> {\n const name = optionalLabel(label, \"isTrue\");\n return createBooleanMatch(\"value\", name, (value) => {\n if (value === true)\n return matched(value as T & true, diagnostic(\"true-match\", `${name} matched`, { expected: \"true\" }));\n return mismatched(diagnostic(\"true-mismatch\", `${name} did not match`, { expected: \"true\" }));\n });\n}\n/** value === false 的 refinement matcher。 */\nexport function isFalse<T = unknown>(label?: string): BooleanMatch<T, T & false> {\n const name = optionalLabel(label, \"isFalse\");\n return createBooleanMatch(\"value\", name, (value) => {\n if (value === false)\n return matched(value as T & false, diagnostic(\"false-match\", `${name} matched`, { expected: \"false\" }));\n return mismatched(diagnostic(\"false-mismatch\", `${name} did not match`, { expected: \"false\" }));\n });\n}\n/** CommandResult-like candidate 的 exitCode === 0 matcher;不读取 stdout / stderr。 */\nexport function commandSucceeded<T = unknown>(): BooleanMatch<T, T & {\n readonly exitCode: 0;\n}> {\n const name = \"commandSucceeded()\";\n return createBooleanMatch(\"value\", name, (value) => {\n if (value !== null && typeof value === \"object\" && (value as {\n readonly exitCode?: unknown;\n }).exitCode === 0) {\n return matched(value as T & {\n readonly exitCode: 0;\n }, diagnostic(\"command-succeeded\", `${name} matched`, { expected: \"exit 0\" }));\n }\n return mismatched(diagnostic(\"command-failed\", `${name} did not match`, { expected: \"exit 0\" }));\n });\n}\n/** 小而稳定的深相等:基本值、NaN、Array、Date 与 enumerable object properties。 */\nexport function deepEqual(a: unknown, b: unknown): boolean {\n return deepEqualInner(a, b, new Map<object, object>());\n}\nfunction deepEqualInner(a: unknown, b: unknown, seen: Map<object, object>): boolean {\n if (a === b)\n return true;\n if (typeof a === \"number\" && typeof b === \"number\" && Number.isNaN(a) && Number.isNaN(b))\n return true;\n if (a === null || b === null || typeof a !== \"object\" || typeof b !== \"object\")\n return false;\n if (a instanceof Date || b instanceof Date)\n return a instanceof Date && b instanceof Date && a.getTime() === b.getTime();\n const seenB = seen.get(a);\n if (seenB !== undefined)\n return seenB === b;\n seen.set(a, b);\n const aIsArray = Array.isArray(a);\n const bIsArray = Array.isArray(b);\n if (aIsArray !== bIsArray)\n return false;\n if (aIsArray && bIsArray) {\n if (a.length !== b.length)\n return false;\n for (let index = 0; index < a.length; index += 1) {\n if (!deepEqualInner(a[index], b[index], seen))\n return false;\n }\n return true;\n }\n const aObject = a as globalThis.Record<string, unknown>;\n const bObject = b as globalThis.Record<string, unknown>;\n const aKeys = Object.keys(aObject);\n const bKeys = Object.keys(bObject);\n if (aKeys.length !== bKeys.length)\n return false;\n for (const key of aKeys) {\n if (!Object.prototype.hasOwnProperty.call(bObject, key) || !deepEqualInner(aObject[key], bObject[key], seen)) {\n return false;\n }\n }\n return true;\n}\nexport function equals<const T>(expected: T): BooleanMatch<unknown, T> {\n const name = \"equals(value)\";\n return createBooleanMatch<unknown, T, \"value\">(\"value\", name, (candidate) => {\n if (deepEqual(candidate, expected))\n return matched(expected, diagnostic(\"equals-match\", `${name} matched`));\n return mismatched(diagnostic(\"equals-mismatch\", `${name} did not match`));\n });\n}\nfunction isStandardSchema(value: unknown): value is StandardSchema {\n if (!isRecord(value))\n return false;\n const standard = value[\"~standard\"];\n return isRecord(standard) && typeof standard.validate === \"function\";\n}\nfunction standardIssuePath(value: unknown, label: string): readonly MatchPathSegment[] {\n if (value === undefined)\n return [];\n if (!Array.isArray(value))\n throw new TypeError(`${label} returned a schema issue with an invalid path`);\n return value.map((segment) => {\n const key = isRecord(segment) && \"key\" in segment ? segment.key : segment;\n if (typeof key === \"string\" || typeof key === \"number\")\n return key;\n if (typeof key === \"symbol\")\n return String(key);\n throw new TypeError(`${label} returned a schema issue with an invalid path segment`);\n });\n}\nexport function matches<S extends StandardSchema>(schema: S): BooleanMatch<unknown, StandardSchema.InferInput<S>, \"value\"> {\n if (!isStandardSchema(schema))\n throw new TypeError(\"matches() schema must implement Standard Schema v1\");\n const name = \"matches(schema)\";\n return createBooleanMatch(\"value\", name, async (candidate) => {\n const result = await schema[\"~standard\"].validate(candidate);\n if (!isRecord(result))\n throw new TypeError(`${name} schema returned an invalid result`);\n if (result.issues === undefined) {\n // Standard Schema output (including transforms) is intentionally ignored: Match refines the original candidate.\n return matched(candidate as StandardSchema.InferInput<S>, diagnostic(\"schema-match\", `${name} validated the original candidate`));\n }\n if (!Array.isArray(result.issues))\n throw new TypeError(`${name} schema returned invalid issues`);\n const children = result.issues.map((issue, index) => {\n if (!isRecord(issue) || typeof issue.message !== \"string\") {\n throw new TypeError(`${name} schema returned an invalid issue`);\n }\n const path = standardIssuePath(issue.path, name);\n return Object.freeze({\n index,\n state: \"mismatched\" as const,\n diagnostic: diagnostic(\"schema-issue\", issue.message, { path }),\n });\n });\n return mismatched(diagnostic(\"schema-mismatch\", `${name} rejected the candidate`, {\n expected: \"Standard Schema validation success\",\n children,\n }));\n });\n}\n/**\n * 旧 context 接线还会调用这一个内部 helper。它不再接受 Zod-style fallback;新的公共 matches()\n * 使用上面的严格 Standard Schema 入口,异常则由 evaluator 作为 defect 处理。\n */\nexport async function validateSchema(value: unknown, schema: unknown): Promise<boolean> {\n if (!isStandardSchema(schema))\n return false;\n try {\n const result = await schema[\"~standard\"].validate(value);\n return isRecord(result) && result.issues === undefined;\n }\n catch {\n return false;\n }\n}\nexport function satisfies<T, R extends T>(label: string, predicate: (value: T) => value is R): BooleanMatch<T, R>;\nexport function satisfies<T>(label: string, predicate: (value: T) => boolean | Promise<boolean>): BooleanMatch<T, T>;\nexport function satisfies<T, R extends T = T>(label: string, predicate: (value: T) => boolean | Promise<boolean>): BooleanMatch<T, R> | BooleanMatch<T, T> {\n assertNonEmptyString(label, \"satisfies() label\");\n if (typeof predicate !== \"function\")\n throw new TypeError(\"satisfies() predicate must be a function\");\n return createBooleanMatch<T, R, \"value\">(\"value\", `satisfies(${label})`, async (candidate) => {\n const value = await predicate(candidate);\n if (typeof value !== \"boolean\")\n throw new TypeError(`matcher satisfies(${label}) returned a non-boolean result`);\n if (value)\n return matched(candidate as R, diagnostic(\"value-match\", `satisfies(${label}) matched`));\n return mismatched(diagnostic(\"value-mismatch\", `satisfies(${label}) did not match`));\n });\n}\nexport function defineValueMatch<T, R extends T>(spec: {\n readonly name: string;\n readonly evaluate: (value: T) => value is R;\n}): BooleanMatch<T, R>;\nexport function defineValueMatch<T>(spec: {\n readonly name: string;\n readonly evaluate: (value: T) => boolean | Promise<boolean>;\n}): BooleanMatch<T, T>;\nexport function defineValueMatch<T, R extends T = T>(spec: {\n readonly name: string;\n readonly evaluate: (value: T) => boolean | Promise<boolean>;\n}): BooleanMatch<T, R> | BooleanMatch<T, T> {\n if (!isRecord(spec))\n throw new TypeError(\"defineValueMatch() spec must be an object\");\n assertNonEmptyString(spec.name, \"defineValueMatch() spec.name\");\n if (typeof spec.evaluate !== \"function\")\n throw new TypeError(\"defineValueMatch() spec.evaluate must be a function\");\n return createBooleanMatch<T, R, \"value\">(\"value\", spec.name, async (candidate) => {\n const value = await spec.evaluate(candidate);\n if (typeof value !== \"boolean\")\n throw new TypeError(`matcher ${spec.name} returned a non-boolean result`);\n if (value)\n return matched(candidate as R, diagnostic(\"value-match\", `${spec.name} matched`));\n return mismatched(diagnostic(\"value-mismatch\", `${spec.name} did not match`));\n });\n}\nexport function defineScoreMatch<T>(spec: {\n readonly name: string;\n readonly score: (value: T) => number | Promise<number>;\n}): ScoreMatch<T> {\n if (!isRecord(spec))\n throw new TypeError(\"defineScoreMatch() spec must be an object\");\n assertNonEmptyString(spec.name, \"defineScoreMatch() spec.name\");\n if (typeof spec.score !== \"function\")\n throw new TypeError(\"defineScoreMatch() spec.score must be a function\");\n return createScoreMatch(spec.name, async (candidate) => {\n const score = await spec.score(candidate);\n if (typeof score !== \"number\" || !Number.isFinite(score) || score < 0 || score > 1) {\n throw new TypeError(`matcher ${spec.name} returned a score outside finite [0, 1]`);\n }\n return score;\n });\n}\ninterface ReferencePathPattern {\n readonly original: string;\n readonly components: readonly string[];\n readonly matcher: RegExp;\n}\nfunction escapeRegExp(value: string): string {\n return value.replace(/[\\\\^$.*+?()[\\]{}|]/g, \"\\\\$&\");\n}\nfunction normalizeReferencePath(value: unknown, label: string): readonly string[] {\n assertNonEmptyString(value, label);\n const components = value.split(/[\\\\/]+/u).filter((component) => component.length > 0 && component !== \".\");\n if (components.length === 0)\n throw new TypeError(`${label} normalizes to an empty path`);\n return Object.freeze(components);\n}\nfunction pathPattern(components: readonly string[]): RegExp {\n // Whitespace / quoting can bound a path embedded in a tool input, while '-' and '.' stay in a component so\n // `agents` cannot match `agents-old` and `.niceeval` cannot match `.niceevaluation`.\n const componentChar = \"\\\\p{L}\\\\p{N}_.-\";\n const betweenComponents = \"[\\\\\\\\/]+(?:\\\\.[\\\\\\\\/]+)*\";\n const source = components.map(escapeRegExp).join(betweenComponents);\n return new RegExp(`(?<![${componentChar}])${source}(?![${componentChar}])`, \"u\");\n}\nfunction normalizeReferencePatterns(paths: readonly [\n string,\n ...string[]\n]): readonly ReferencePathPattern[] {\n if (!Array.isArray(paths) || paths.length === 0)\n throw new TypeError(\"referencesAnyPath() requires at least one path\");\n const seen = new Set<string>();\n const patterns = paths.map((path, index) => {\n const components = normalizeReferencePath(path, `referencesAnyPath() paths[${index}]`);\n const identity = components.join(\"\\u0000\");\n if (seen.has(identity))\n throw new TypeError(`referencesAnyPath() has duplicate normalized path ${quoted(path)}`);\n seen.add(identity);\n return Object.freeze({ original: path, components, matcher: pathPattern(components) });\n });\n return Object.freeze(patterns);\n}\ninterface PathWitness {\n readonly pointer: string;\n readonly pattern: ReferencePathPattern;\n}\nfunction jsonPointerSegment(value: string | number): string {\n return String(value).replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\n}\nfunction isPlainJsonObject(value: object): value is globalThis.Record<string, unknown> {\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\nfunction isArrayIndexKey(key: string, length: number): boolean {\n if (!/^(?:0|[1-9][0-9]*)$/u.test(key))\n return false;\n const index = Number(key);\n return Number.isSafeInteger(index) && index >= 0 && index < length;\n}\nfunction findReferencedPath(value: unknown, patterns: readonly ReferencePathPattern[], pointer = \"\", ancestors = new WeakSet<object>()): PathWitness | undefined {\n if (typeof value === \"string\") {\n const pattern = patterns.find((candidate) => {\n candidate.matcher.lastIndex = 0;\n return candidate.matcher.test(value);\n });\n return pattern === undefined ? undefined : { pointer, pattern };\n }\n if (value === null || typeof value === \"boolean\")\n return undefined;\n if (typeof value === \"number\") {\n if (!Number.isFinite(value))\n throw new TypeError(\"referencesAnyPath() received a non-JSON number\");\n return undefined;\n }\n if (typeof value !== \"object\")\n throw new TypeError(\"referencesAnyPath() received a non-JSON value\");\n if (ancestors.has(value))\n throw new TypeError(\"referencesAnyPath() received a cyclic JSON value\");\n ancestors.add(value);\n try {\n if (Array.isArray(value)) {\n for (const key of Object.keys(value)) {\n if (!isArrayIndexKey(key, value.length)) {\n throw new TypeError(\"referencesAnyPath() received a non-JSON array property\");\n }\n }\n for (let index = 0; index < value.length; index += 1) {\n const descriptor = Object.getOwnPropertyDescriptor(value, String(index));\n if (descriptor === undefined || !(\"value\" in descriptor)) {\n throw new TypeError(\"referencesAnyPath() received a sparse array or accessor\");\n }\n const witness = findReferencedPath(descriptor.value, patterns, `${pointer}/${index}`, ancestors);\n if (witness !== undefined)\n return witness;\n }\n return undefined;\n }\n if (!isPlainJsonObject(value))\n throw new TypeError(\"referencesAnyPath() received a non-plain JSON object\");\n for (const key of Object.keys(value)) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined || !(\"value\" in descriptor)) {\n throw new TypeError(\"referencesAnyPath() received an accessor property\");\n }\n const witness = findReferencedPath(descriptor.value, patterns, `${pointer}/${jsonPointerSegment(key)}`, ancestors);\n if (witness !== undefined)\n return witness;\n }\n return undefined;\n }\n finally {\n ancestors.delete(value);\n }\n}\nexport function referencesAnyPath(paths: readonly [\n string,\n ...string[]\n]): BooleanMatch<JsonValue, JsonValue, \"value\"> {\n const patterns = normalizeReferencePatterns(paths);\n const name = `referencesAnyPath(${patterns.length} paths)`;\n return createBooleanMatch(\"value\", name, (candidate) => {\n const witness = findReferencedPath(candidate, patterns);\n if (witness !== undefined) {\n return matched(candidate, diagnostic(\"path-reference-match\", `${name} found a referenced path`, {\n expected: witness.pattern.components.join(\"/\"),\n locator: { kind: \"json-pointer\", pointer: witness.pointer },\n }));\n }\n return mismatched(diagnostic(\"path-reference-mismatch\", `${name} found no referenced path`, {\n expected: patterns.map((pattern) => pattern.components.join(\"/\")).join(\" | \"),\n }));\n }, { positiveWitness: true });\n}\nexport type ToolStatus = Extract<LogicalToolOccurrence[\"lifecycle\"], {\n readonly state: \"available\";\n}>[\"status\"];\nexport interface CommandMatchOptions {\n readonly argsStart?: readonly string[];\n readonly excludes?: readonly string[];\n readonly status?: ToolStatus;\n}\nexport interface ToolMatchOptions {\n readonly input?: BooleanMatch<JsonValue, JsonValue, \"value\">;\n readonly output?: BooleanMatch<JsonValue, JsonValue, \"value\">;\n readonly status?: ToolStatus;\n}\n/**\n * Turns the recursive JsonMatch language into a managed value Match. Raw\n * JsonMatch stays at this explicit bridge; tool assertions consume only the\n * branded Match so every tool field follows the same evaluator path.\n */\nexport function jsonMatch(expected: JsonMatch): BooleanMatch<JsonValue, JsonValue, \"value\"> {\n const normalized = normalizeJsonMatch(expected, \"jsonMatch() expected\");\n const name = \"jsonMatch(...)\";\n return createBooleanMatch(\"value\", name, (candidate) => {\n if (matchesJson(candidate, normalized)) {\n return matched(candidate, diagnostic(\"json-match\", `${name} matched`));\n }\n return mismatched(diagnostic(\"json-mismatch\", `${name} did not match`, {\n expected: \"the supplied JsonMatch pattern\",\n received: \"the candidate JSON value\",\n }));\n });\n}\nfunction normalizeJsonMatch(value: unknown, label: string, active = new WeakSet<object>()): JsonMatch {\n if (value === null || typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") {\n if (typeof value === \"number\" && !Number.isFinite(value)) {\n throw new TypeError(`${label} must not contain a non-finite number`);\n }\n return value;\n }\n if (value instanceof RegExp)\n return new RegExp(value.source, value.flags);\n if (typeof value === \"function\")\n return value as (candidate: unknown) => boolean;\n if (typeof value !== \"object\")\n throw new TypeError(`${label} must be a JsonMatch value`);\n if (active.has(value))\n throw new TypeError(`${label} must not be cyclic`);\n active.add(value);\n try {\n if (Array.isArray(value)) {\n return Object.freeze(value.map((item, index) => normalizeJsonMatch(item, `${label}[${index}]`, active)));\n }\n if (!isPlainJsonObject(value))\n throw new TypeError(`${label} must use a plain object`);\n const entries: [\n string,\n JsonMatch\n ][] = [];\n for (const key of Object.keys(value)) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined || !(\"value\" in descriptor)) {\n throw new TypeError(`${label}.${key} must not be an accessor`);\n }\n entries.push([key, normalizeJsonMatch(descriptor.value, `${label}.${key}`, active)]);\n }\n return Object.freeze(Object.fromEntries(entries));\n }\n finally {\n active.delete(value);\n }\n}\nfunction normalizeStatus(value: unknown, label: string): ToolStatus | undefined {\n if (value === undefined)\n return undefined;\n if (value === \"pending\" || value === \"completed\" || value === \"failed\" || value === \"rejected\")\n return value;\n throw new TypeError(`${label} must be pending, completed, failed, or rejected`);\n}\nfunction normalizeTokens(value: unknown, label: string, unique: boolean): readonly string[] | undefined {\n if (value === undefined)\n return undefined;\n if (!Array.isArray(value))\n throw new TypeError(`${label} must be an array of command tokens`);\n const tokens = value.map((token, index) => {\n assertNonEmptyString(token, `${label}[${index}]`);\n return token;\n });\n if (unique && new Set(tokens).size !== tokens.length)\n throw new TypeError(`${label} must not contain duplicate tokens`);\n return Object.freeze(tokens);\n}\nfunction lifecycleResult(occurrence: LogicalToolOccurrence, expected: ToolStatus | undefined): BooleanMatchEvaluation<unknown> {\n const lifecycle = occurrence.lifecycle;\n if (!isRecord(lifecycle) || (lifecycle.state !== \"available\" && lifecycle.state !== \"opaque\")) {\n throw new TypeError(\"tool occurrence has an invalid lifecycle envelope\");\n }\n if (lifecycle.state === \"opaque\") {\n if (typeof lifecycle.reason !== \"string\" || lifecycle.reason.length === 0) {\n throw new TypeError(\"tool occurrence has an opaque lifecycle without a reason\");\n }\n return unavailable(lifecycle.reason, diagnostic(\"tool-lifecycle-unavailable\", \"tool lifecycle is not fully observed\", {\n expected,\n reason: lifecycle.reason,\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n if (expected === undefined) {\n return matched(occurrence, diagnostic(\"lifecycle-unrestricted\", \"lifecycle is unrestricted\", {\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n if (lifecycle.status !== expected) {\n return mismatched(diagnostic(\"tool-status-mismatch\", \"tool lifecycle status did not match\", {\n expected,\n received: typeof lifecycle.status === \"string\" ? lifecycle.status : undefined,\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n return matched(occurrence, diagnostic(\"tool-status-match\", \"tool lifecycle status matched\", {\n expected,\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n}\nfunction occurrenceNameResult(occurrence: LogicalToolOccurrence, expected: string): BooleanMatchEvaluation<unknown> {\n if (!isRecord(occurrence.name) || typeof occurrence.name.original !== \"string\") {\n throw new TypeError(\"tool occurrence has an invalid name envelope\");\n }\n // `unknown` means the adapter could not map this domain-specific tool onto\n // NiceEval's canonical vocabulary. It must not hide the original name that\n // the author can still check exactly.\n const observed = occurrence.name.canonical === undefined || occurrence.name.canonical === \"unknown\"\n ? occurrence.name.original\n : occurrence.name.canonical;\n if (observed !== expected) {\n return mismatched(diagnostic(\"tool-name-mismatch\", \"tool name did not match\", {\n expected: quoted(expected),\n received: quoted(observed),\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n return matched(occurrence, diagnostic(\"tool-name-match\", \"tool name matched exactly\", {\n expected: quoted(expected),\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n}\nasync function toolEvidenceResult(occurrence: LogicalToolOccurrence, field: \"input\" | \"output\", match: BooleanMatch<JsonValue, JsonValue, \"value\">): Promise<BooleanMatchEvaluation<unknown>> {\n const evidence = occurrence[field];\n if (!isRecord(evidence) || (evidence.state !== \"complete\" && evidence.state !== \"partial\" && evidence.state !== \"unavailable\")) {\n throw new TypeError(`tool occurrence has an invalid ${field} envelope`);\n }\n if (evidence.state === \"unavailable\") {\n if (typeof evidence.reason !== \"string\" || evidence.reason.length === 0) {\n throw new TypeError(`tool occurrence has unavailable ${field} without a reason`);\n }\n return unavailable(evidence.reason, diagnostic(`tool-${field}-unavailable`, `tool ${field} is unavailable`, {\n reason: evidence.reason,\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n const result = await evaluateBooleanMatch(match, evidence.value);\n if (evidence.state === \"complete\")\n return result;\n // partial input can only produce a positive result when the matcher itself carries the narrowed witness\n // capability. A visible reference hit survives hidden leaves; general predicates / schema checks do not.\n if (result.state === \"matched\" && hasPositiveWitnessCapability(match as BooleanMatch<unknown, unknown, \"value\">)) {\n return result;\n }\n return unavailable(`tool-${field}-coverage-partial`, diagnostic(`tool-${field}-coverage-partial`, `tool ${field} is partial without a decisive positive witness`, {\n reason: `tool-${field}-coverage-partial`,\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n ...(Array.isArray(evidence.opaquePointers) ? { received: evidence.opaquePointers.join(\",\") } : {}),\n }));\n}\nexport function toolMatch(name: string, options?: ToolMatchOptions): ToolMatch;\nexport function toolMatch(options: ToolMatchOptions): ToolMatch;\nexport function toolMatch(nameOrOptions: string | ToolMatchOptions, options?: ToolMatchOptions): ToolMatch {\n let expectedName: string | undefined;\n let input: BooleanMatch<JsonValue, JsonValue, \"value\"> | undefined;\n let output: BooleanMatch<JsonValue, JsonValue, \"value\"> | undefined;\n let status: ToolStatus | undefined;\n if (typeof nameOrOptions === \"string\") {\n assertNonEmptyString(nameOrOptions, \"toolMatch() name\");\n expectedName = nameOrOptions;\n const normalized = assertPlainOptions(options, \"toolMatch() options\", [\"input\", \"output\", \"status\"]);\n if (normalized.input !== undefined) {\n assertBooleanMatch(normalized.input, \"toolMatch() options.input\", \"value\");\n input = normalized.input as BooleanMatch<JsonValue, JsonValue, \"value\">;\n }\n if (normalized.output !== undefined) {\n assertBooleanMatch(normalized.output, \"toolMatch() options.output\", \"value\");\n output = normalized.output as BooleanMatch<JsonValue, JsonValue, \"value\">;\n }\n status = normalizeStatus(normalized.status, \"toolMatch() options.status\");\n }\n else {\n if (options !== undefined)\n throw new TypeError(\"toolMatch(options) does not accept a second argument\");\n const normalized = assertPlainOptions(nameOrOptions, \"toolMatch() options\", [\"input\", \"output\", \"status\"]);\n if (normalized.input === undefined && normalized.output === undefined && normalized.status === undefined) {\n throw new TypeError(\"toolMatch(options) requires input, output, or status\");\n }\n if (normalized.input !== undefined) {\n assertBooleanMatch(normalized.input, \"toolMatch() options.input\", \"value\");\n input = normalized.input as BooleanMatch<JsonValue, JsonValue, \"value\">;\n }\n if (normalized.output !== undefined) {\n assertBooleanMatch(normalized.output, \"toolMatch() options.output\", \"value\");\n output = normalized.output as BooleanMatch<JsonValue, JsonValue, \"value\">;\n }\n status = normalizeStatus(normalized.status, \"toolMatch() options.status\");\n }\n const name = expectedName === undefined\n ? `toolMatch(${[\n input === undefined ? undefined : `input=${input.name}`,\n output === undefined ? undefined : `output=${output.name}`,\n status === undefined ? undefined : `status=${status}`,\n ].filter((part): part is string => part !== undefined).join(\", \")})`\n : `toolMatch(${quoted(expectedName)})`;\n return createBooleanMatch(\"tool\", name, async (occurrence) => {\n const fields = await evaluateFields([\n ...(expectedName === undefined\n ? []\n : [{ label: \"name\", evaluate: async () => occurrenceNameResult(occurrence, expectedName!) }]),\n ...(input === undefined ? [] : [{ label: \"input\", evaluate: () => toolEvidenceResult(occurrence, \"input\", input!) }]),\n ...(output === undefined ? [] : [{ label: \"output\", evaluate: () => toolEvidenceResult(occurrence, \"output\", output!) }]),\n { label: \"status\", evaluate: async () => lifecycleResult(occurrence, status) },\n ]);\n return combineConjunction(occurrence, name, fields);\n });\n}\n/** @internal Assert-first accepts only branded tool-domain matches. */\nexport function assertManagedToolMatch(value: unknown, label = \"match\"): ToolMatch {\n assertBooleanMatch(value, label, \"tool\");\n return value as ToolMatch;\n}\n/** @internal Assert-first accepts only branded event-domain matches. */\nexport function assertManagedEventMatch(value: unknown, label = \"match\"): EventMatch {\n assertBooleanMatch(value, label, \"event\");\n return value as EventMatch;\n}\nexport type ToolMatchQuantifier = {\n readonly kind: \"at-least\";\n readonly count: number;\n} | {\n readonly kind: \"exact\";\n readonly count: number;\n} | {\n readonly kind: \"absent\";\n};\nexport interface ToolMatchCollectionOptions {\n readonly quantifier: ToolMatchQuantifier;\n /** Scope-level action coverage that can hide additional candidates. */\n readonly coverageReason?: string;\n}\n/**\n * The sole collection evaluator for scoped tool Assertions. It evaluates each\n * occurrence through ToolMatch, then folds exact / at-least / absent with the\n * same three-valued rule: a definite counterexample wins; incomplete evidence\n * cannot manufacture a positive count or an absence proof.\n */\nexport async function evaluateToolMatchCollection(match: ToolMatch, occurrences: readonly LogicalToolOccurrence[], options: ToolMatchCollectionOptions): Promise<BooleanMatchEvaluation<LogicalToolOccurrence | undefined>> {\n const candidates: CandidateResult<LogicalToolOccurrence>[] = [];\n for (const occurrence of occurrences) {\n candidates.push(Object.freeze({\n candidate: occurrence,\n result: await evaluateBooleanMatch(match, occurrence),\n }));\n }\n const children = candidates.map((candidate, index) => resultChild(candidate.result, index, `candidate ${candidate.candidate.id}`));\n const matches = candidates.filter((candidate) => candidate.result.state === \"matched\");\n const unavailableCandidate = candidates.find((candidate) => candidate.result.state === \"unavailable\");\n const unavailableReason = unavailableCandidate?.result.state === \"unavailable\"\n ? unavailableCandidate.result.reason\n : options.coverageReason;\n const incomplete = unavailableReason !== undefined;\n const received = `${matches.length} definite match${matches.length === 1 ? \"\" : \"es\"}`;\n const candidateLocator = (candidate: CandidateResult<LogicalToolOccurrence> | undefined) => candidate === undefined ? undefined : { kind: \"tool-occurrence\" as const, id: candidate.candidate.id };\n if (options.quantifier.kind === \"absent\") {\n const first = matches[0];\n if (first !== undefined) {\n return mismatched(diagnostic(\"tool-absence-mismatch\", `notCalledTool(${match.name}) observed a matching tool`, {\n expected: `no ${match.name}`,\n received,\n locator: candidateLocator(first),\n children,\n }));\n }\n if (incomplete) {\n return unavailable(unavailableReason, diagnostic(\"tool-absence-unavailable\", `notCalledTool(${match.name}) cannot prove absence`, {\n expected: `no ${match.name}`,\n received,\n reason: unavailableReason,\n children,\n }));\n }\n return matched(undefined, diagnostic(\"tool-absence-match\", `notCalledTool(${match.name}) observed no matching tool`, {\n expected: `no ${match.name}`,\n received,\n children,\n }));\n }\n const { kind, count } = options.quantifier;\n const expected = kind === \"exact\" ? `exactly ${count} × ${match.name}` : `at least ${count} × ${match.name}`;\n if (kind === \"exact\" && matches.length > count) {\n const overage = matches[count];\n return mismatched(diagnostic(\"tool-count-exceeded\", `calledTool(${match.name}) exceeded its exact count`, {\n expected,\n received,\n locator: candidateLocator(overage),\n children,\n }));\n }\n if (kind === \"at-least\" && matches.length >= count) {\n return matched(matches[0]?.candidate, diagnostic(\"tool-count-match\", `calledTool(${match.name}) satisfied its lower bound`, {\n expected,\n received,\n children,\n }));\n }\n if (kind === \"exact\" && matches.length === count && !incomplete) {\n return matched(matches[0]?.candidate, diagnostic(\"tool-count-match\", `calledTool(${match.name}) satisfied its exact count`, {\n expected,\n received,\n children,\n }));\n }\n if (incomplete) {\n return unavailable(unavailableReason, diagnostic(\"tool-count-unavailable\", `calledTool(${match.name}) cannot decide its count`, {\n expected,\n received,\n reason: unavailableReason,\n children,\n }));\n }\n return mismatched(diagnostic(\"tool-count-mismatch\", `calledTool(${match.name}) did not satisfy its count`, {\n expected,\n received,\n children,\n }));\n}\ninterface CandidateResult<T> {\n readonly candidate: T;\n readonly result: BooleanMatchEvaluation<unknown>;\n}\nfunction commandResult(occurrence: LogicalToolOccurrence, executable: string, argsStart: readonly string[] | undefined, excludes: readonly string[] | undefined): BooleanMatchEvaluation<unknown> {\n const projection = occurrence.command;\n if (projection === undefined) {\n return unavailable(\"logical-command-unavailable\", diagnostic(\"logical-command-unavailable\", \"tool occurrence has no durable command projection\", {\n reason: \"logical-command-unavailable\",\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n if (!isRecord(projection) || (projection.kind !== \"command\" && projection.kind !== \"not-command\")) {\n throw new TypeError(\"tool occurrence has an invalid command projection\");\n }\n if (projection.kind === \"not-command\") {\n return mismatched(diagnostic(\"not-command\", \"tool occurrence is not a command\", {\n expected: quoted(executable),\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n const logical = projection.logical;\n if (!isRecord(logical) || (logical.state !== \"available\" && logical.state !== \"opaque\")) {\n throw new TypeError(\"command projection has an invalid logical envelope\");\n }\n if (logical.normalizer !== \"logical-command/v1\") {\n throw new TypeError(\"command projection does not use logical-command/v1\");\n }\n if (logical.state === \"opaque\") {\n if (typeof logical.reason !== \"string\" || logical.reason.length === 0) {\n throw new TypeError(\"opaque logical command has no reason\");\n }\n return unavailable(`logical-command-opaque:${logical.reason}`, diagnostic(\"logical-command-opaque\", \"logical command is opaque\", {\n reason: logical.reason,\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n if (typeof logical.executable !== \"string\" || !Array.isArray(logical.args) || !logical.args.every((arg) => typeof arg === \"string\")) {\n throw new TypeError(\"available logical command has an invalid argv envelope\");\n }\n if (logical.executable !== executable) {\n return mismatched(diagnostic(\"logical-executable-mismatch\", \"logical executable did not match exactly\", {\n expected: quoted(executable),\n received: quoted(logical.executable),\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n if (argsStart !== undefined && !argsStart.every((token, index) => logical.args[index] === token)) {\n return mismatched(diagnostic(\"logical-args-prefix-mismatch\", \"logical argv did not start with the expected exact tokens\", {\n expected: argsStart.map(quoted).join(\" \"),\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n if (excludes !== undefined && excludes.some((token) => logical.args.includes(token))) {\n return mismatched(diagnostic(\"logical-args-excluded-token\", \"logical argv contained an excluded exact token\", {\n expected: `without ${excludes.map(quoted).join(\", \")}`,\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n return matched(occurrence, diagnostic(\"logical-command-match\", \"logical command matched exact executable and token rules\", {\n expected: quoted(executable),\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n}\nexport function commandMatch(executable: string, options?: CommandMatchOptions): ToolMatch<LogicalCommandOccurrence> {\n assertNonEmptyString(executable, \"commandMatch() executable\");\n const normalized = assertPlainOptions(options, \"commandMatch() options\", [\"argsStart\", \"excludes\", \"status\"]);\n const argsStart = normalizeTokens(normalized.argsStart, \"commandMatch() options.argsStart\", false);\n const excludes = normalizeTokens(normalized.excludes, \"commandMatch() options.excludes\", true);\n const status = normalizeStatus(normalized.status, \"commandMatch() options.status\");\n const details = [\n argsStart === undefined ? undefined : `argsStart=[${argsStart.map(quoted).join(\", \")}]`,\n excludes === undefined ? undefined : `excludes=[${excludes.map(quoted).join(\", \")}]`,\n status === undefined ? undefined : `status=${status}`,\n ]\n .filter((detail): detail is string => detail !== undefined)\n .join(\", \");\n const name = `commandMatch(${quoted(executable)}${details.length === 0 ? \"\" : `, ${details}`})`;\n return createBooleanMatch(\"tool\", name, async (occurrence) => {\n const fields = await evaluateFields([\n { label: \"command\", evaluate: async () => commandResult(occurrence, executable, argsStart, excludes) },\n { label: \"status\", evaluate: async () => lifecycleResult(occurrence, status) },\n ]);\n return combineConjunction<LogicalToolOccurrence, LogicalCommandOccurrence>(occurrence, name, fields);\n });\n}\nexport interface EventOptionsByType {\n readonly message: {\n readonly role?: \"assistant\" | \"user\";\n readonly text?: BooleanMatch<string, string, \"value\">;\n };\n readonly \"operation.started\": {\n readonly tool?: ToolMatch;\n };\n readonly \"operation.finished\": {\n readonly tool?: ToolMatch;\n };\n}\ntype MatchableEventType = keyof EventOptionsByType;\nfunction isMatchableEventType(value: unknown): value is MatchableEventType {\n return value === \"message\" || value === \"operation.started\" || value === \"operation.finished\";\n}\nfunction messageEventResult(event: Extract<MatchableEvent, {\n readonly type: \"message\";\n}>, role: \"assistant\" | \"user\" | undefined, text: BooleanMatch<string, string, \"value\"> | undefined): Promise<BooleanMatchEvaluation<unknown>> {\n return evaluateFields([\n ...(role === undefined\n ? []\n : [\n {\n label: \"role\",\n evaluate: async () => event.role === role\n ? matched(event, diagnostic(\"message-role-match\", \"message role matched\", { expected: role }))\n : mismatched(diagnostic(\"message-role-mismatch\", \"message role did not match\", {\n expected: role,\n received: event.role,\n })),\n },\n ]),\n ...(text === undefined\n ? []\n : [{ label: \"text\", evaluate: () => evaluateBooleanMatch(text, event.text) }]),\n ]).then((fields) => combineConjunction(event, \"eventMatch(message)\", fields));\n}\nasync function toolEventResult(event: MatchableEvent, match: ToolMatch | undefined): Promise<BooleanMatchEvaluation<unknown>> {\n if (match === undefined)\n return matched(event, diagnostic(\"event-type-match\", \"event type matched\"));\n const occurrence = assertionEventOccurrence(event);\n if (occurrence === undefined) {\n return unavailable(\"event-tool-occurrence-unavailable\", diagnostic(\"event-tool-occurrence-unavailable\", \"operation event has no associated logical tool occurrence\", {\n reason: \"event-tool-occurrence-unavailable\",\n }));\n }\n return evaluateBooleanMatch(match, occurrence);\n}\nexport function eventMatch<K extends keyof EventOptionsByType>(type: K, options?: EventOptionsByType[K]): EventMatch<Extract<AssertionEvent, {\n readonly type: K;\n}>> {\n if (!isMatchableEventType(type))\n throw new TypeError(\"eventMatch() type is not supported\");\n if (type === \"message\") {\n const normalized = assertPlainOptions(options, \"eventMatch(message) options\", [\"role\", \"text\"]);\n const role = normalized.role;\n if (role !== undefined && role !== \"assistant\" && role !== \"user\") {\n throw new TypeError(\"eventMatch(message) options.role must be assistant or user\");\n }\n const text = normalized.text;\n if (text !== undefined)\n assertBooleanMatch(text, \"eventMatch(message) options.text\", \"value\");\n const name = \"eventMatch(message)\";\n return createBooleanMatch(\"event\", name, async (event) => {\n if (event.type !== \"message\") {\n return mismatched(diagnostic(\"event-type-mismatch\", \"event type did not match\", { expected: \"message\" }));\n }\n return messageEventResult(event, role as \"assistant\" | \"user\" | undefined, text as BooleanMatch<string, string, \"value\"> | undefined) as Promise<BooleanMatchEvaluation<Extract<AssertionEvent, {\n readonly type: K;\n }>>>;\n }) as EventMatch<Extract<AssertionEvent, {\n readonly type: K;\n }>>;\n }\n const normalized = assertPlainOptions(options, `eventMatch(${type}) options`, [\"tool\"]);\n const tool = normalized.tool;\n if (tool !== undefined)\n assertBooleanMatch(tool, `eventMatch(${type}) options.tool`, \"tool\");\n const name = `eventMatch(${type})`;\n return createBooleanMatch(\"event\", name, async (event) => {\n if (event.type !== type) {\n return mismatched(diagnostic(\"event-type-mismatch\", \"event type did not match\", { expected: type }));\n }\n const fields = await evaluateFields([\n { label: \"tool\", evaluate: () => toolEventResult(event, tool as ToolMatch | undefined) },\n ]);\n return combineConjunction<AssertionEvent, Extract<AssertionEvent, {\n readonly type: K;\n }>>(event, name, fields);\n }) as EventMatch<Extract<AssertionEvent, {\n readonly type: K;\n }>>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"match.js","sourceRoot":"","sources":["match.ts"],"names":[],"mappings":";;AA0NA,wCAEC;AAED,wCAKC;AAED,wEAEC;AAED,wEAEC;AAED,gEASC;AAED,0DAKC;AAgED,8DAiBC;AAED,wDA8BC;AAED,4DAEC;AAED,oDAIC;AAED,gDAUC;AAgHD,kBAUC;AAKD,gBA4BC;AACD,kBAqBC;AAgBD,4BAcC;AACD,4BAcC;AACD,0BAkBC;AAED,gCAYC;AAmBD,kCAYC;AAED,kCAYC;AASD,8BAQC;AAED,wBAOC;AAED,0BAOC;AAED,4CAcC;AAED,8BAEC;AAwCD,wBAOC;AAqBD,0BA8BC;AAKD,wCAUC;AAGD,8BAYC;AASD,4CAiBC;AACD,4CAgBC;AAiHD,8CAkBC;AAmBD,8BAYC;AAgJD,8BAsDC;AAED,wDAGC;AAED,0DAGC;AAqBD,kEAmHC;AAkED,oCAqBC;AAkDD,gCA4CC;AA1jDD,2DAAsD;AAEtD,wCAA2C;AAC3C,2CAAqD;AAiDrD,8DAA8D;AAC9D,sDAAsD;AACtD,MAAM,eAAe,GAAkB,MAAM,CAAC,sBAAsB,CAAC,CAAC;AACtE,MAAM,oBAAoB,GAAkB,MAAM,CAAC,2BAA2B,CAAC,CAAC;AAChF,MAAM,mBAAmB,GAAkB,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAC9E,MAAM,oBAAoB,GAAkB,MAAM,CAAC,iCAAiC,CAAC,CAAC;AACtF,MAAM,0BAA0B,GAAkB,MAAM,CAAC,gCAAgC,CAAC,CAAC;AAC3F,MAAM,2BAA2B,GAAkB,MAAM,CAAC,iCAAiC,CAAC,CAAC;AAC7F,MAAM,2BAA2B,GAAkB,MAAM,CAAC,iCAAiC,CAAC,CAAC;AAC7F,MAAM,2BAA2B,GAAkB,MAAM,CAAC,iCAAiC,CAAC,CAAC;AAC7F,MAA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c,IAAI,GAAG,CAAC;IACnC,OAAO,kBAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACrD,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YACtB,OAAO,UAAU,CAAC,UAAU,CAAC,qBAAqB,EAAE,0BAA0B,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACzG,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC;YAChC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,IAA6B,CAAC,EAAE;SAC3F,CAAC,CAAC;QACH,OAAO,kBAAkB,CAErB,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC,CAEE,CAAC;AACR,CAAC","sourcesContent":["// Match 内核:纯候选比较、三态结果与领域 matcher。\n//\n// 这里不登记 Assertion,也不决定 Verdict / Score。调用方先冻结 subject,再把同一\n// candidate 交给本模块;因此组合 matcher 不会自行重读证据,也不会把 evaluator defect\n// 折成 mismatch 或 unavailable。\nimport type { StandardSchemaV1 as StandardSchema } from \"@standard-schema/spec\";\nimport type { CommandProjection, LogicalToolOccurrence, } from \"../o11y/types.ts\";\nimport { matchesJson } from \"../shared/json-match.ts\";\nimport type { JsonMatch, JsonValue } from \"../shared/types.ts\";\nimport { stripComments } from \"../util.ts\";\nimport { assertionRuntimeLimits } from \"./limits.ts\";\nexport type MatchDomain = \"value\" | \"tool\" | \"event\";\ntype MatchPathSegment = string | number;\n/** 可序列化的候选诊断;组合 matcher 用 children 保留声明顺序与嵌套位置。 */\nexport interface MatchDiagnostic {\n readonly code: string;\n readonly message: string;\n /** 相对当前 matcher 的路径;组合节点的 child index 也由 children 明确给出。 */\n readonly path: readonly MatchPathSegment[];\n readonly expected?: string;\n readonly received?: string;\n readonly reason?: string;\n readonly locator?: {\n readonly kind: \"json-pointer\";\n readonly pointer: string;\n } | {\n readonly kind: \"tool-occurrence\";\n readonly id: string;\n };\n readonly children?: readonly MatchDiagnosticChild[];\n /** Collection matchers retain only a bounded, representative candidate set. */\n readonly truncation?: {\n readonly code: \"diagnostic-truncated\";\n readonly reason: \"sampled\";\n readonly captured: number;\n readonly knownTotal: number;\n };\n}\nexport interface MatchDiagnosticChild {\n readonly index: number;\n readonly label?: string;\n readonly state: MatchEvaluationState;\n readonly diagnostic?: MatchDiagnostic;\n}\nexport type MatchEvaluationState = \"matched\" | \"mismatched\" | \"unavailable\";\n/** 一个单候选 matcher 的内部三态结果。 */\nexport type BooleanMatchEvaluation<R> = {\n readonly state: \"matched\";\n /** 永远是传入 candidate 本身,只是在类型层收窄。 */\n readonly value: R;\n readonly diagnostic?: MatchDiagnostic;\n} | {\n readonly state: \"mismatched\";\n readonly diagnostic: MatchDiagnostic;\n} | {\n readonly state: \"unavailable\";\n readonly reason: string;\n readonly diagnostic: MatchDiagnostic;\n};\n// 这些 symbol 不导出。外部作者无法构造看似可消费的 Match;输入 variance 与 refinement\n// variance 也保持分离,ScoreMatch 不会伪造一个没有含义的输出 refinement。\nconst matchInputBrand: unique symbol = Symbol(\"niceeval.match.input\");\nconst matchRefinementBrand: unique symbol = Symbol(\"niceeval.match.refinement\");\nconst matchEvaluatorBrand: unique symbol = Symbol(\"niceeval.match.evaluator\");\nconst positiveWitnessBrand: unique symbol = Symbol(\"niceeval.match.positive-witness\");\nconst thresholdedScoreMatchBrand: unique symbol = Symbol(\"niceeval.thresholdedScoreMatch\");\nconst assertionEventIdentityBrand: unique symbol = Symbol(\"niceeval.assertionEventIdentity\");\nconst assertionEventPositionBrand: unique symbol = Symbol(\"niceeval.assertionEventPosition\");\nconst toolOccurrenceIdentityBrand: unique symbol = Symbol(\"niceeval.toolOccurrenceIdentity\");\nconst matchBrands = new WeakSet<object>();\nconst thresholdedScoreMatches = new WeakMap<object, {\n readonly match: ScoreMatch<unknown>;\n readonly threshold: number;\n}>();\nexport interface Match<in T, D extends MatchDomain> {\n readonly domain: D;\n readonly name: string;\n readonly [matchInputBrand]: (candidate: T) => void;\n readonly [matchEvaluatorBrand]: (candidate: T) => Promise<unknown>;\n}\nexport interface BooleanMatch<in T, out R extends T, D extends MatchDomain = \"value\"> extends Match<T, D> {\n readonly kind: \"boolean\";\n readonly [matchRefinementBrand]: () => R;\n}\nexport interface ScoreMatch<in T> extends Match<T, \"value\"> {\n readonly kind: \"score\";\n atLeast(threshold: number): ThresholdedScoreMatch<T>;\n}\nexport interface ThresholdedScoreMatch<in T> {\n readonly kind: \"thresholded-score-match\";\n readonly [thresholdedScoreMatchBrand]: (candidate: T) => void;\n}\nexport type ValueMatch<T, R extends T = T> = BooleanMatch<T, R, \"value\"> | ScoreMatch<T>;\nexport type LogicalCommandOccurrence = LogicalToolOccurrence & {\n readonly command: Extract<CommandProjection, {\n readonly kind: \"command\";\n }>;\n};\nexport type ToolMatch<R extends LogicalToolOccurrence = LogicalToolOccurrence> = BooleanMatch<LogicalToolOccurrence, R, \"tool\">;\nexport type AssertionEventIdentity = string & {\n readonly [assertionEventIdentityBrand]: true;\n};\nexport type ToolOccurrenceIdentity = string & {\n readonly [toolOccurrenceIdentityBrand]: true;\n};\nexport interface AssertionEventPosition {\n readonly turnOrdinal: number;\n readonly eventOrdinal: number;\n readonly [assertionEventPositionBrand]: true;\n}\nexport interface AssertionToolReference {\n readonly id: ToolOccurrenceIdentity;\n readonly name: string;\n}\nexport type AssertionEvent = {\n readonly id: AssertionEventIdentity;\n readonly position: AssertionEventPosition;\n readonly type: \"message\";\n readonly role: \"assistant\" | \"user\";\n readonly text: string;\n} | {\n readonly id: AssertionEventIdentity;\n readonly position: AssertionEventPosition;\n readonly type: \"operation.started\";\n readonly tool: AssertionToolReference;\n} | {\n readonly id: AssertionEventIdentity;\n readonly position: AssertionEventPosition;\n readonly type: \"operation.finished\";\n readonly tool: AssertionToolReference;\n readonly status: \"completed\" | \"failed\" | \"rejected\";\n};\nexport type MatchableEvent = AssertionEvent;\nexport type EventMatch<R extends AssertionEvent = AssertionEvent> = BooleanMatch<AssertionEvent, R, \"event\">;\nconst assertionEventOccurrences = new WeakMap<object, LogicalToolOccurrence>();\nexport type RefinementOf<M> = M extends BooleanMatch<infer _T, infer R, infer _D> ? R : never;\nexport type RefinementIntersection<M extends readonly unknown[]> = M extends readonly [\n infer Head,\n ...infer Tail\n] ? RefinementOf<Head> & RefinementIntersection<Tail> : unknown;\ninterface InternalMatch {\n readonly domain: MatchDomain;\n readonly name: string;\n readonly kind: \"boolean\" | \"score\";\n readonly [matchEvaluatorBrand]: (candidate: unknown) => Promise<unknown>;\n readonly [positiveWitnessBrand]?: true;\n}\ninterface CreateBooleanMatchOptions {\n readonly positiveWitness?: true;\n}\nfunction isRecord(value: unknown): value is globalThis.Record<PropertyKey, unknown> {\n return value !== null && typeof value === \"object\";\n}\nfunction diagnostic(code: string, message: string, options: Omit<MatchDiagnostic, \"code\" | \"message\" | \"path\"> & {\n readonly path?: readonly MatchPathSegment[];\n} = {}): MatchDiagnostic {\n return Object.freeze({\n code,\n message,\n path: Object.freeze([...(options.path ?? [])]),\n ...(options.expected === undefined ? {} : { expected: options.expected }),\n ...(options.received === undefined ? {} : { received: options.received }),\n ...(options.reason === undefined ? {} : { reason: options.reason }),\n ...(options.locator === undefined ? {} : { locator: options.locator }),\n ...(options.children === undefined ? {} : { children: Object.freeze([...options.children]) }),\n ...(options.truncation === undefined ? {} : { truncation: Object.freeze({ ...options.truncation }) }),\n });\n}\nfunction matched<R>(value: R, detail?: MatchDiagnostic): BooleanMatchEvaluation<R> {\n return Object.freeze({ state: \"matched\" as const, value, ...(detail === undefined ? {} : { diagnostic: detail }) });\n}\nfunction mismatched<R = never>(detail: MatchDiagnostic): BooleanMatchEvaluation<R> {\n return Object.freeze({ state: \"mismatched\" as const, diagnostic: detail });\n}\nfunction unavailable<R = never>(reason: string, detail: MatchDiagnostic): BooleanMatchEvaluation<R> {\n return Object.freeze({ state: \"unavailable\" as const, reason, diagnostic: detail });\n}\nfunction assertDiagnostic(value: unknown, label: string): asserts value is MatchDiagnostic {\n if (!isRecord(value) || typeof value.code !== \"string\" || typeof value.message !== \"string\" || !Array.isArray(value.path)) {\n throw new TypeError(`${label} returned an invalid diagnostic`);\n }\n}\nfunction assertBooleanEvaluation<R>(value: unknown, label: string): BooleanMatchEvaluation<R> {\n if (!isRecord(value) || typeof value.state !== \"string\") {\n throw new TypeError(`${label} returned an invalid boolean matcher result`);\n }\n if (value.state === \"matched\") {\n if (!(\"value\" in value))\n throw new TypeError(`${label} returned a matched result without the original candidate`);\n return value as BooleanMatchEvaluation<R>;\n }\n if (value.state === \"mismatched\") {\n assertDiagnostic(value.diagnostic, label);\n return value as BooleanMatchEvaluation<R>;\n }\n if (value.state === \"unavailable\") {\n if (typeof value.reason !== \"string\" || value.reason.length === 0) {\n throw new TypeError(`${label} returned unavailable without a reason`);\n }\n assertDiagnostic(value.diagnostic, label);\n return value as BooleanMatchEvaluation<R>;\n }\n throw new TypeError(`${label} returned an unknown matcher state`);\n}\nfunction internalMatchOf(value: unknown, label: string): InternalMatch {\n if (!isRecord(value) || !matchBrands.has(value)) {\n throw new TypeError(`${label} must be a Match created by niceeval/expect`);\n }\n const match = value as unknown as InternalMatch;\n if ((match.domain !== \"value\" && match.domain !== \"tool\" && match.domain !== \"event\") ||\n (match.kind !== \"boolean\" && match.kind !== \"score\") ||\n typeof match.name !== \"string\" ||\n typeof match[matchEvaluatorBrand] !== \"function\") {\n throw new TypeError(`${label} must be a Match created by niceeval/expect`);\n }\n return match;\n}\n/** @internal Runtime brand guard used by the context overload dispatcher. */\nexport function isManagedMatch(value: unknown): boolean {\n return isRecord(value) && matchBrands.has(value);\n}\n/** @internal Reject Match-shaped raw subjects instead of silently treating them as ordinary values. */\nexport function looksLikeMatch(value: unknown): boolean {\n if (!isRecord(value))\n return false;\n return (value.domain === \"value\" || value.domain === \"tool\" || value.domain === \"event\") &&\n (value.kind === \"boolean\" || value.kind === \"score\") && typeof value.name === \"string\";\n}\n/** @internal Runtime brand guard for ScoreMatch.atLeast(). */\nexport function isManagedThresholdedScoreMatch(value: unknown): value is ThresholdedScoreMatch<unknown> {\n return isRecord(value) && thresholdedScoreMatches.has(value);\n}\n/** @internal Reserve threshold-view-shaped raw inputs at the authoring boundary. */\nexport function looksLikeThresholdedScoreMatch(value: unknown): boolean {\n return isRecord(value) && value.kind === \"thresholded-score-match\";\n}\n/** @internal Resolve a threshold view without evaluating its underlying Match. */\nexport function thresholdedScoreMatchValue(value: unknown): {\n readonly match: ScoreMatch<unknown>;\n readonly threshold: number;\n} {\n const resolved = isRecord(value) ? thresholdedScoreMatches.get(value) : undefined;\n if (resolved === undefined) {\n throw new TypeError(\"value must be a threshold view created by ScoreMatch.atLeast()\");\n }\n return resolved;\n}\n/** @internal The value-side consumer accepts only a real, value-domain Match. */\nexport function assertManagedValueMatch(value: unknown, label = \"match\"): BooleanMatch<unknown, unknown, \"value\"> | ScoreMatch<unknown> {\n const match = internalMatchOf(value, label);\n if (match.domain !== \"value\")\n throw new TypeError(`${label} must be a value-domain Match`);\n return value as BooleanMatch<unknown, unknown, \"value\"> | ScoreMatch<unknown>;\n}\nfunction assertBooleanMatch(value: unknown, label: string, domain?: MatchDomain): InternalMatch {\n const match = internalMatchOf(value, label);\n if (match.kind !== \"boolean\")\n throw new TypeError(`${label} must be a BooleanMatch`);\n if (domain !== undefined && match.domain !== domain) {\n throw new TypeError(`${label} must have ${domain} domain, received ${match.domain}`);\n }\n return match;\n}\nfunction createBooleanMatch<T, R extends T, D extends MatchDomain>(domain: D, name: string, evaluate: (candidate: T) => BooleanMatchEvaluation<R> | Promise<BooleanMatchEvaluation<R>>, options: CreateBooleanMatchOptions = {}): BooleanMatch<T, R, D> {\n const result = {\n domain,\n name,\n kind: \"boolean\" as const,\n [matchInputBrand]: (_candidate: T) => undefined,\n [matchRefinementBrand]: () => undefined as unknown as R,\n [matchEvaluatorBrand]: async (candidate: T) => evaluate(candidate),\n ...(options.positiveWitness === true ? { [positiveWitnessBrand]: true as const } : {}),\n };\n const match = Object.freeze(result) as BooleanMatch<T, R, D>;\n matchBrands.add(match);\n return match;\n}\nfunction createScoreMatch<T>(name: string, evaluate: (candidate: T) => number | Promise<number>): ScoreMatch<T> {\n let match: ScoreMatch<T>;\n const result = {\n domain: \"value\" as const,\n name,\n kind: \"score\" as const,\n [matchInputBrand]: (_candidate: T) => undefined,\n [matchEvaluatorBrand]: async (candidate: T) => evaluate(candidate),\n atLeast(threshold: number) {\n assertUnitThreshold(threshold, \"ScoreMatch.atLeast() threshold\");\n const view: ThresholdedScoreMatch<T> = {\n kind: \"thresholded-score-match\",\n [thresholdedScoreMatchBrand]: (_candidate: T) => undefined,\n };\n thresholdedScoreMatches.set(view, { match: match as ScoreMatch<unknown>, threshold });\n return Object.freeze(view);\n },\n };\n match = Object.freeze(result) as ScoreMatch<T>;\n matchBrands.add(match);\n return match;\n}\nfunction assertUnitThreshold(value: unknown, label: string): asserts value is number {\n if (typeof value !== \"number\" || !Number.isFinite(value) || value < 0 || value > 1) {\n throw new TypeError(`${label} must be a finite number in [0, 1]`);\n }\n}\nfunction freezeEventPosition(turnOrdinal: number, eventOrdinal: number): AssertionEventPosition {\n return Object.freeze({ turnOrdinal, eventOrdinal }) as AssertionEventPosition;\n}\nfunction assertionEventId(session: string, turn: string, turnOrdinal: number, eventOrdinal: number): AssertionEventIdentity {\n return JSON.stringify([\n \"niceeval.assertion-event/1\",\n session,\n turn,\n turnOrdinal,\n eventOrdinal,\n ]) as AssertionEventIdentity;\n}\n/** @internal Project a raw message into the closed assertion-event surface. */\nexport function makeAssertionMessageEvent(input: {\n readonly session: string;\n readonly turn: string;\n readonly turnOrdinal: number;\n readonly eventOrdinal: number;\n readonly role: \"assistant\" | \"user\";\n readonly text: string;\n}): Extract<AssertionEvent, {\n readonly type: \"message\";\n}> {\n return Object.freeze({\n id: assertionEventId(input.session, input.turn, input.turnOrdinal, input.eventOrdinal),\n position: freezeEventPosition(input.turnOrdinal, input.eventOrdinal),\n type: \"message\" as const,\n role: input.role,\n text: input.text,\n });\n}\n/** @internal Project a correlated tool lifecycle row without exposing raw adapter fields. */\nexport function makeAssertionToolEvent(input: {\n readonly session: string;\n readonly turn: string;\n readonly turnOrdinal: number;\n readonly eventOrdinal: number;\n readonly type: \"operation.started\" | \"operation.finished\";\n readonly occurrence: LogicalToolOccurrence;\n readonly status?: \"completed\" | \"failed\" | \"rejected\";\n}): Extract<AssertionEvent, {\n readonly type: \"operation.started\" | \"operation.finished\";\n}> {\n const base = {\n id: assertionEventId(input.session, input.turn, input.turnOrdinal, input.eventOrdinal),\n position: freezeEventPosition(input.turnOrdinal, input.eventOrdinal),\n tool: Object.freeze({\n id: input.occurrence.id as ToolOccurrenceIdentity,\n name: input.occurrence.name.canonical ?? input.occurrence.name.original,\n }),\n };\n const event = input.type === \"operation.started\"\n ? Object.freeze({ ...base, type: \"operation.started\" as const })\n : Object.freeze({\n ...base,\n type: \"operation.finished\" as const,\n status: input.status ?? (() => {\n throw new TypeError(\"operation.finished assertion event requires status\");\n })(),\n });\n assertionEventOccurrences.set(event, input.occurrence);\n return event;\n}\n/** @internal Retrieve the correlated occurrence for eventMatch(tool). */\nexport function assertionEventOccurrence(event: AssertionEvent): LogicalToolOccurrence | undefined {\n return assertionEventOccurrences.get(event);\n}\n/** 供 Assertion runtime / scope owner 消费 BooleanMatch;普通作者面不会导出此 evaluator。 */\nexport async function evaluateBooleanMatch<T, R extends T, D extends MatchDomain>(match: BooleanMatch<T, R, D>, candidate: T): Promise<BooleanMatchEvaluation<R>> {\n const internal = assertBooleanMatch(match, \"match\");\n const result = await internal[matchEvaluatorBrand](candidate);\n return assertBooleanEvaluation<R>(result, `matcher ${internal.name}`);\n}\n/** 供 Assertion runtime 消费 ScoreMatch。范围非法是 evaluator defect,绝不 clamp。 */\nexport async function evaluateScoreMatch<T>(match: ScoreMatch<T>, candidate: T): Promise<number> {\n const internal = internalMatchOf(match, \"match\");\n if (internal.kind !== \"score\" || internal.domain !== \"value\") {\n throw new TypeError(\"match must be a value-domain ScoreMatch\");\n }\n const score = await internal[matchEvaluatorBrand](candidate);\n if (typeof score !== \"number\" || !Number.isFinite(score) || score < 0 || score > 1) {\n throw new TypeError(`matcher ${internal.name} returned a score outside finite [0, 1]`);\n }\n return score;\n}\nfunction hasPositiveWitnessCapability(match: BooleanMatch<unknown, unknown, \"value\">): boolean {\n return (internalMatchOf(match, \"input matcher\") as InternalMatch)[positiveWitnessBrand] === true;\n}\nfunction assertNonEmptyString(value: unknown, label: string): asserts value is string {\n if (typeof value !== \"string\" || value.length === 0)\n throw new TypeError(`${label} must be a non-empty string`);\n}\nfunction assertPlainOptions(value: unknown, label: string, allowed: readonly string[]): globalThis.Record<string, unknown> {\n if (value === undefined)\n return {};\n if (!isRecord(value) || Array.isArray(value))\n throw new TypeError(`${label} must be an options object`);\n for (const key of Object.keys(value)) {\n if (!allowed.includes(key))\n throw new TypeError(`${label} does not support option ${JSON.stringify(key)}`);\n }\n return value as globalThis.Record<string, unknown>;\n}\nfunction quoted(value: string): string {\n return JSON.stringify(value);\n}\nfunction resultChild(result: BooleanMatchEvaluation<unknown>, index: number, label?: string): MatchDiagnosticChild {\n return Object.freeze({\n index,\n ...(label === undefined ? {} : { label }),\n state: result.state,\n ...(result.diagnostic === undefined ? {} : { diagnostic: result.diagnostic }),\n });\n}\nfunction combineConjunction<T, R extends T>(candidate: T, name: string, fields: readonly {\n readonly label: string;\n readonly result: BooleanMatchEvaluation<unknown>;\n}[]): BooleanMatchEvaluation<R> {\n const children = fields.map((field, index) => resultChild(field.result, index, field.label));\n const mismatch = fields.find((field) => field.result.state === \"mismatched\");\n if (mismatch !== undefined) {\n return mismatched(diagnostic(\"all-of-mismatch\", `${name} had a definite mismatch`, {\n expected: \"all matcher fields matched\",\n children,\n }));\n }\n const missing = fields.find((field) => field.result.state === \"unavailable\");\n if (missing !== undefined) {\n const reason = (missing.result as Extract<BooleanMatchEvaluation<unknown>, {\n readonly state: \"unavailable\";\n }>).reason;\n return unavailable(reason, diagnostic(\"all-of-unavailable\", `${name} could not be decided from available evidence`, {\n expected: \"all matcher fields matched\",\n reason,\n children,\n }));\n }\n return matched(candidate as R, diagnostic(\"all-of-match\", `${name} matched all fields`, { children }));\n}\nasync function evaluateFields(fields: readonly {\n readonly label: string;\n readonly evaluate: () => Promise<BooleanMatchEvaluation<unknown>>;\n}[]): Promise<readonly {\n readonly label: string;\n readonly result: BooleanMatchEvaluation<unknown>;\n}[]> {\n const results: {\n label: string;\n result: BooleanMatchEvaluation<unknown>;\n }[] = [];\n let hasDefect = false;\n let firstDefect: unknown;\n // 不短路:组合的结构化诊断必须保留每个 child;defect 在所有可执行 child 完成后原样抛出。\n for (const field of fields) {\n try {\n results.push({ label: field.label, result: await field.evaluate() });\n }\n catch (error) {\n if (!hasDefect) {\n hasDefect = true;\n firstDefect = error;\n }\n }\n }\n if (hasDefect)\n throw firstDefect;\n return results;\n}\nfunction booleanCompositionName(operator: \"and\" | \"or\", matches: readonly {\n readonly name: string;\n}[]): string {\n return `${operator}(${matches.map((match) => match.name).join(\", \")})`;\n}\nfunction assertComposableMatches(first: unknown, rest: readonly unknown[], operator: \"and\" | \"or\"): {\n readonly domain: MatchDomain;\n readonly matches: readonly BooleanMatch<unknown, unknown, MatchDomain>[];\n} {\n if (rest.length === 0)\n throw new TypeError(`${operator}() requires at least two BooleanMatch values`);\n const firstInternal = assertBooleanMatch(first, `${operator}() first argument`);\n const matches: BooleanMatch<unknown, unknown, MatchDomain>[] = [\n first as BooleanMatch<unknown, unknown, MatchDomain>,\n ];\n for (const [index, match] of rest.entries()) {\n const internal = assertBooleanMatch(match, `${operator}() argument ${index + 2}`);\n if (internal.domain !== firstInternal.domain) {\n throw new TypeError(`${operator}() cannot combine ${firstInternal.domain}-domain and ${internal.domain}-domain matchers`);\n }\n matches.push(match as BooleanMatch<unknown, unknown, MatchDomain>);\n }\n return { domain: firstInternal.domain, matches };\n}\nexport function and<T, R extends T, D extends MatchDomain, const Rest extends readonly [\n BooleanMatch<NoInfer<T>, T, NoInfer<D>>,\n ...BooleanMatch<NoInfer<T>, T, NoInfer<D>>[]\n]>(first: BooleanMatch<T, R, D>, ...rest: Rest): BooleanMatch<T, T & R & RefinementIntersection<Rest>, D>;\nexport function and(first: BooleanMatch<unknown, unknown, MatchDomain>, ...rest: readonly BooleanMatch<unknown, unknown, MatchDomain>[]): BooleanMatch<unknown, unknown, MatchDomain> {\n const composition = assertComposableMatches(first, rest, \"and\");\n const name = booleanCompositionName(\"and\", composition.matches);\n return createBooleanMatch(composition.domain, name, async (candidate: unknown) => {\n const fields = await evaluateFields(composition.matches.map((match, index) => ({\n label: match.name || `matcher ${index}`,\n evaluate: () => evaluateBooleanMatch(match, candidate),\n })));\n return combineConjunction(candidate, name, fields);\n });\n}\nexport function or<T, R extends T, D extends MatchDomain, const Rest extends readonly [\n BooleanMatch<NoInfer<T>, T, NoInfer<D>>,\n ...BooleanMatch<NoInfer<T>, T, NoInfer<D>>[]\n]>(first: BooleanMatch<T, R, D>, ...rest: Rest): BooleanMatch<T, T & (R | RefinementOf<Rest[number]>), D>;\nexport function or(first: BooleanMatch<unknown, unknown, MatchDomain>, ...rest: readonly BooleanMatch<unknown, unknown, MatchDomain>[]): BooleanMatch<unknown, unknown, MatchDomain> {\n const composition = assertComposableMatches(first, rest, \"or\");\n const name = booleanCompositionName(\"or\", composition.matches);\n return createBooleanMatch(composition.domain, name, async (candidate: unknown) => {\n const fields = await evaluateFields(composition.matches.map((match, index) => ({\n label: match.name || `matcher ${index}`,\n evaluate: () => evaluateBooleanMatch(match, candidate),\n })));\n const children = fields.map((field, index) => resultChild(field.result, index, field.label));\n if (fields.some((field) => field.result.state === \"matched\")) {\n return matched(candidate, diagnostic(\"any-of-match\", `${name} matched at least one child`, { children }));\n }\n const missing = fields.find((field) => field.result.state === \"unavailable\");\n if (missing !== undefined) {\n const reason = (missing.result as Extract<BooleanMatchEvaluation<unknown>, {\n readonly state: \"unavailable\";\n }>).reason;\n return unavailable(reason, diagnostic(\"any-of-unavailable\", `${name} had no definite match and incomplete evidence`, {\n expected: \"at least one matcher matched\",\n reason,\n children,\n }));\n }\n return mismatched(diagnostic(\"any-of-mismatch\", `${name} had no matching child`, {\n expected: \"at least one matcher matched\",\n children,\n }));\n });\n}\nexport function not<T>(match: BooleanMatch<T, T, \"value\">): BooleanMatch<T, T, \"value\"> {\n assertBooleanMatch(match, \"not() argument\", \"value\");\n return createBooleanMatch(\"value\", `not(${match.name})`, async (candidate) => {\n const result = await evaluateBooleanMatch(match, candidate);\n if (result.state === \"matched\") {\n return mismatched(diagnostic(\"not-mismatch\", `not(${match.name}) failed because its child matched`, {\n expected: `not ${match.name}`,\n children: [resultChild(result, 0, match.name)],\n }));\n }\n if (result.state === \"mismatched\") {\n return matched(candidate, diagnostic(\"not-match\", `not(${match.name}) matched`, {\n children: [resultChild(result, 0, match.name)],\n }));\n }\n return unavailable(result.reason, diagnostic(\"not-unavailable\", `not(${match.name}) could not decide its child`, {\n expected: `not ${match.name}`,\n reason: result.reason,\n children: [resultChild(result, 0, match.name)],\n }));\n });\n}\nexport interface TextMatchOptions {\n readonly stripComments?: boolean;\n}\nfunction normalizeTextOptions(value: unknown, label: string): Readonly<TextMatchOptions> {\n const options = assertPlainOptions(value, label, [\"stripComments\"]);\n if (options.stripComments !== undefined && typeof options.stripComments !== \"boolean\") {\n throw new TypeError(`${label}.stripComments must be a boolean`);\n }\n return Object.freeze(options as TextMatchOptions);\n}\nfunction textCandidate(value: unknown, options: TextMatchOptions): string | undefined {\n if (typeof value !== \"string\")\n return undefined;\n return options.stripComments === true ? stripComments(value) : value;\n}\nexport function includes(text: string, options?: TextMatchOptions): BooleanMatch<string, string> {\n assertNonEmptyString(text, \"includes() text\");\n const normalizedOptions = normalizeTextOptions(options, \"includes() options\");\n const name = `includes(${quoted(text)})`;\n return createBooleanMatch(\"value\", name, (value) => {\n const candidate = textCandidate(value, normalizedOptions);\n if (candidate === undefined) {\n return mismatched(diagnostic(\"text-candidate-type\", `${name} only accepts string candidates`, { expected: \"string\" }));\n }\n if (candidate.includes(text)) {\n return matched(value, diagnostic(\"text-includes-match\", `${name} found the literal text`, { expected: quoted(text) }));\n }\n return mismatched(diagnostic(\"text-includes-mismatch\", `${name} did not find the literal text`, { expected: quoted(text) }));\n });\n}\nexport function excludes(text: string, options?: TextMatchOptions): BooleanMatch<string, string> {\n assertNonEmptyString(text, \"excludes() text\");\n const normalizedOptions = normalizeTextOptions(options, \"excludes() options\");\n const name = `excludes(${quoted(text)})`;\n return createBooleanMatch(\"value\", name, (value) => {\n const candidate = textCandidate(value, normalizedOptions);\n if (candidate === undefined) {\n return mismatched(diagnostic(\"text-candidate-type\", `${name} only accepts string candidates`, { expected: \"string\" }));\n }\n if (!candidate.includes(text)) {\n return matched(value, diagnostic(\"text-excludes-match\", `${name} did not find the literal text`, { expected: quoted(text) }));\n }\n return mismatched(diagnostic(\"text-excludes-mismatch\", `${name} found excluded literal text`, { expected: quoted(text) }));\n });\n}\nexport function pattern(expression: RegExp, options?: TextMatchOptions): BooleanMatch<string, string> {\n if (!(expression instanceof RegExp))\n throw new TypeError(\"pattern() expression must be a RegExp\");\n const normalizedOptions = normalizeTextOptions(options, \"pattern() options\");\n const name = `pattern(${expression.toString()})`;\n return createBooleanMatch(\"value\", name, (value) => {\n const candidate = textCandidate(value, normalizedOptions);\n if (candidate === undefined) {\n return mismatched(diagnostic(\"text-candidate-type\", `${name} only accepts string candidates`, { expected: \"string\" }));\n }\n // 新 clone 的 lastIndex 从零开始,既满足 g/y 每次独立求值,也完全不修改作者实例。\n const isolatedExpression = new RegExp(expression.source, expression.flags);\n isolatedExpression.lastIndex = 0;\n if (isolatedExpression.test(candidate)) {\n return matched(value, diagnostic(\"pattern-match\", `${name} matched`, { expected: expression.toString() }));\n }\n return mismatched(diagnostic(\"pattern-mismatch\", `${name} did not match`, { expected: expression.toString() }));\n });\n}\n/** 归一化 Levenshtein similarity;它是连续分数,不携带默认阈值或 verdict 策略。 */\nexport function similarity(expected: string): ScoreMatch<string> {\n if (typeof expected !== \"string\")\n throw new TypeError(\"similarity() expected must be a string\");\n const name = `similarity(${quoted(expected)})`;\n return createScoreMatch(name, (value) => {\n if (typeof value !== \"string\")\n throw new TypeError(`${name} only accepts string candidates`);\n const maxLength = Math.max(value.length, expected.length);\n if (maxLength === 0)\n return 1;\n return 1 - levenshtein(value, expected) / maxLength;\n });\n}\nfunction levenshtein(a: string, b: string): number {\n if (a.length === 0)\n return b.length;\n if (b.length === 0)\n return a.length;\n let previous = Array.from({ length: b.length + 1 }, (_unused, index) => index);\n let current = new Array<number>(b.length + 1);\n for (let row = 1; row <= a.length; row += 1) {\n current[0] = row;\n for (let column = 1; column <= b.length; column += 1) {\n const substitution = a.charCodeAt(row - 1) === b.charCodeAt(column - 1) ? 0 : 1;\n current[column] = Math.min(previous[column]! + 1, current[column - 1]! + 1, previous[column - 1]! + substitution);\n }\n [previous, current] = [current, previous];\n }\n return previous[b.length]!;\n}\n/** 至少含 min 个去重 http(s) URL 的纯文本 matcher。 */\nexport function includesUrl(min = 1): BooleanMatch<string, string> {\n const name = `includesUrl(min=${min})`;\n return createBooleanMatch(\"value\", name, (value) => {\n if (typeof value !== \"string\") {\n return mismatched(diagnostic(\"text-candidate-type\", `${name} only accepts string candidates`, { expected: \"string\" }));\n }\n const urls = new Set(value.match(/https?:\\/\\/[^\\s<>()\"'\\x60]+/g) ?? []);\n if (urls.size >= min) {\n return matched(value, diagnostic(\"url-count-match\", `${name} found enough distinct URLs`, { expected: `>= ${min}` }));\n }\n return mismatched(diagnostic(\"url-count-mismatch\", `${name} did not find enough distinct URLs`, { expected: `>= ${min}` }));\n });\n}\n/** 至少含 min 个 Markdown heading 的纯文本 matcher。 */\nexport function hasSections(min = 2): BooleanMatch<string, string> {\n const name = `hasSections(min=${min})`;\n return createBooleanMatch(\"value\", name, (value) => {\n if (typeof value !== \"string\") {\n return mismatched(diagnostic(\"text-candidate-type\", `${name} only accepts string candidates`, { expected: \"string\" }));\n }\n const count = (value.match(/^#{1,6}\\s+\\S/gm) ?? []).length;\n if (count >= min) {\n return matched(value, diagnostic(\"heading-count-match\", `${name} found enough headings`, { expected: `>= ${min}` }));\n }\n return mismatched(diagnostic(\"heading-count-mismatch\", `${name} did not find enough headings`, { expected: `>= ${min}` }));\n });\n}\nfunction optionalLabel(label: string | undefined, factory: string): string {\n if (label !== undefined && typeof label !== \"string\")\n throw new TypeError(`${factory}() label must be a string`);\n return label === undefined || label.length === 0 ? `${factory}()` : `${factory}(${label})`;\n}\n/** 非 null / undefined 的 value matcher;泛型调用可保留原 candidate 的非空收窄。 */\nexport function isDefined(label?: string): BooleanMatch<unknown, {}>;\nexport function isDefined<T>(label?: string): BooleanMatch<T, Exclude<T, null | undefined>>;\nexport function isDefined<T = unknown>(label?: string): BooleanMatch<T, Exclude<T, null | undefined>> {\n const name = optionalLabel(label, \"isDefined\");\n return createBooleanMatch(\"value\", name, (value) => {\n if (value !== null && value !== undefined) {\n return matched(value as Exclude<T, null | undefined>, diagnostic(\"defined-match\", `${name} matched`, { expected: \"defined\" }));\n }\n return mismatched(diagnostic(\"defined-mismatch\", `${name} did not match`, { expected: \"defined\" }));\n });\n}\n/** value === true 的 refinement matcher。 */\nexport function isTrue<T = unknown>(label?: string): BooleanMatch<T, T & true> {\n const name = optionalLabel(label, \"isTrue\");\n return createBooleanMatch(\"value\", name, (value) => {\n if (value === true)\n return matched(value as T & true, diagnostic(\"true-match\", `${name} matched`, { expected: \"true\" }));\n return mismatched(diagnostic(\"true-mismatch\", `${name} did not match`, { expected: \"true\" }));\n });\n}\n/** value === false 的 refinement matcher。 */\nexport function isFalse<T = unknown>(label?: string): BooleanMatch<T, T & false> {\n const name = optionalLabel(label, \"isFalse\");\n return createBooleanMatch(\"value\", name, (value) => {\n if (value === false)\n return matched(value as T & false, diagnostic(\"false-match\", `${name} matched`, { expected: \"false\" }));\n return mismatched(diagnostic(\"false-mismatch\", `${name} did not match`, { expected: \"false\" }));\n });\n}\n/** CommandResult-like candidate 的 exitCode === 0 matcher;不读取 stdout / stderr。 */\nexport function commandSucceeded<T = unknown>(): BooleanMatch<T, T & {\n readonly exitCode: 0;\n}> {\n const name = \"commandSucceeded()\";\n return createBooleanMatch(\"value\", name, (value) => {\n if (value !== null && typeof value === \"object\" && (value as {\n readonly exitCode?: unknown;\n }).exitCode === 0) {\n return matched(value as T & {\n readonly exitCode: 0;\n }, diagnostic(\"command-succeeded\", `${name} matched`, { expected: \"exit 0\" }));\n }\n return mismatched(diagnostic(\"command-failed\", `${name} did not match`, { expected: \"exit 0\" }));\n });\n}\n/** 小而稳定的深相等:基本值、NaN、Array、Date 与 enumerable object properties。 */\nexport function deepEqual(a: unknown, b: unknown): boolean {\n return deepEqualInner(a, b, new Map<object, object>());\n}\nfunction deepEqualInner(a: unknown, b: unknown, seen: Map<object, object>): boolean {\n if (a === b)\n return true;\n if (typeof a === \"number\" && typeof b === \"number\" && Number.isNaN(a) && Number.isNaN(b))\n return true;\n if (a === null || b === null || typeof a !== \"object\" || typeof b !== \"object\")\n return false;\n if (a instanceof Date || b instanceof Date)\n return a instanceof Date && b instanceof Date && a.getTime() === b.getTime();\n const seenB = seen.get(a);\n if (seenB !== undefined)\n return seenB === b;\n seen.set(a, b);\n const aIsArray = Array.isArray(a);\n const bIsArray = Array.isArray(b);\n if (aIsArray !== bIsArray)\n return false;\n if (aIsArray && bIsArray) {\n if (a.length !== b.length)\n return false;\n for (let index = 0; index < a.length; index += 1) {\n if (!deepEqualInner(a[index], b[index], seen))\n return false;\n }\n return true;\n }\n const aObject = a as globalThis.Record<string, unknown>;\n const bObject = b as globalThis.Record<string, unknown>;\n const aKeys = Object.keys(aObject);\n const bKeys = Object.keys(bObject);\n if (aKeys.length !== bKeys.length)\n return false;\n for (const key of aKeys) {\n if (!Object.prototype.hasOwnProperty.call(bObject, key) || !deepEqualInner(aObject[key], bObject[key], seen)) {\n return false;\n }\n }\n return true;\n}\nexport function equals<const T>(expected: T): BooleanMatch<unknown, T> {\n const name = \"equals(value)\";\n return createBooleanMatch<unknown, T, \"value\">(\"value\", name, (candidate) => {\n if (deepEqual(candidate, expected))\n return matched(expected, diagnostic(\"equals-match\", `${name} matched`));\n return mismatched(diagnostic(\"equals-mismatch\", `${name} did not match`));\n });\n}\nfunction isStandardSchema(value: unknown): value is StandardSchema {\n if (!isRecord(value))\n return false;\n const standard = value[\"~standard\"];\n return isRecord(standard) && typeof standard.validate === \"function\";\n}\nfunction standardIssuePath(value: unknown, label: string): readonly MatchPathSegment[] {\n if (value === undefined)\n return [];\n if (!Array.isArray(value))\n throw new TypeError(`${label} returned a schema issue with an invalid path`);\n return value.map((segment) => {\n const key = isRecord(segment) && \"key\" in segment ? segment.key : segment;\n if (typeof key === \"string\" || typeof key === \"number\")\n return key;\n if (typeof key === \"symbol\")\n return String(key);\n throw new TypeError(`${label} returned a schema issue with an invalid path segment`);\n });\n}\nexport function matches<S extends StandardSchema>(schema: S): BooleanMatch<unknown, StandardSchema.InferInput<S>, \"value\"> {\n if (!isStandardSchema(schema))\n throw new TypeError(\"matches() schema must implement Standard Schema v1\");\n const name = \"matches(schema)\";\n return createBooleanMatch(\"value\", name, async (candidate) => {\n const result = await schema[\"~standard\"].validate(candidate);\n if (!isRecord(result))\n throw new TypeError(`${name} schema returned an invalid result`);\n if (result.issues === undefined) {\n // Standard Schema output (including transforms) is intentionally ignored: Match refines the original candidate.\n return matched(candidate as StandardSchema.InferInput<S>, diagnostic(\"schema-match\", `${name} validated the original candidate`));\n }\n if (!Array.isArray(result.issues))\n throw new TypeError(`${name} schema returned invalid issues`);\n const children = result.issues.map((issue, index) => {\n if (!isRecord(issue) || typeof issue.message !== \"string\") {\n throw new TypeError(`${name} schema returned an invalid issue`);\n }\n const path = standardIssuePath(issue.path, name);\n return Object.freeze({\n index,\n state: \"mismatched\" as const,\n diagnostic: diagnostic(\"schema-issue\", issue.message, { path }),\n });\n });\n return mismatched(diagnostic(\"schema-mismatch\", `${name} rejected the candidate`, {\n expected: \"Standard Schema validation success\",\n children,\n }));\n });\n}\n/**\n * 旧 context 接线还会调用这一个内部 helper。它不再接受 Zod-style fallback;新的公共 matches()\n * 使用上面的严格 Standard Schema 入口,异常则由 evaluator 作为 defect 处理。\n */\nexport async function validateSchema(value: unknown, schema: unknown): Promise<boolean> {\n if (!isStandardSchema(schema))\n return false;\n try {\n const result = await schema[\"~standard\"].validate(value);\n return isRecord(result) && result.issues === undefined;\n }\n catch {\n return false;\n }\n}\nexport function satisfies<T, R extends T>(label: string, predicate: (value: T) => value is R): BooleanMatch<T, R>;\nexport function satisfies<T>(label: string, predicate: (value: T) => boolean | Promise<boolean>): BooleanMatch<T, T>;\nexport function satisfies<T, R extends T = T>(label: string, predicate: (value: T) => boolean | Promise<boolean>): BooleanMatch<T, R> | BooleanMatch<T, T> {\n assertNonEmptyString(label, \"satisfies() label\");\n if (typeof predicate !== \"function\")\n throw new TypeError(\"satisfies() predicate must be a function\");\n return createBooleanMatch<T, R, \"value\">(\"value\", `satisfies(${label})`, async (candidate) => {\n const value = await predicate(candidate);\n if (typeof value !== \"boolean\")\n throw new TypeError(`matcher satisfies(${label}) returned a non-boolean result`);\n if (value)\n return matched(candidate as R, diagnostic(\"value-match\", `satisfies(${label}) matched`));\n return mismatched(diagnostic(\"value-mismatch\", `satisfies(${label}) did not match`));\n });\n}\nexport function defineValueMatch<T, R extends T>(spec: {\n readonly name: string;\n readonly evaluate: (value: T) => value is R;\n}): BooleanMatch<T, R>;\nexport function defineValueMatch<T>(spec: {\n readonly name: string;\n readonly evaluate: (value: T) => boolean | Promise<boolean>;\n}): BooleanMatch<T, T>;\nexport function defineValueMatch<T, R extends T = T>(spec: {\n readonly name: string;\n readonly evaluate: (value: T) => boolean | Promise<boolean>;\n}): BooleanMatch<T, R> | BooleanMatch<T, T> {\n if (!isRecord(spec))\n throw new TypeError(\"defineValueMatch() spec must be an object\");\n assertNonEmptyString(spec.name, \"defineValueMatch() spec.name\");\n if (typeof spec.evaluate !== \"function\")\n throw new TypeError(\"defineValueMatch() spec.evaluate must be a function\");\n return createBooleanMatch<T, R, \"value\">(\"value\", spec.name, async (candidate) => {\n const value = await spec.evaluate(candidate);\n if (typeof value !== \"boolean\")\n throw new TypeError(`matcher ${spec.name} returned a non-boolean result`);\n if (value)\n return matched(candidate as R, diagnostic(\"value-match\", `${spec.name} matched`));\n return mismatched(diagnostic(\"value-mismatch\", `${spec.name} did not match`));\n });\n}\nexport function defineScoreMatch<T>(spec: {\n readonly name: string;\n readonly score: (value: T) => number | Promise<number>;\n}): ScoreMatch<T> {\n if (!isRecord(spec))\n throw new TypeError(\"defineScoreMatch() spec must be an object\");\n assertNonEmptyString(spec.name, \"defineScoreMatch() spec.name\");\n if (typeof spec.score !== \"function\")\n throw new TypeError(\"defineScoreMatch() spec.score must be a function\");\n return createScoreMatch(spec.name, async (candidate) => {\n const score = await spec.score(candidate);\n if (typeof score !== \"number\" || !Number.isFinite(score) || score < 0 || score > 1) {\n throw new TypeError(`matcher ${spec.name} returned a score outside finite [0, 1]`);\n }\n return score;\n });\n}\ninterface ReferencePathPattern {\n readonly original: string;\n readonly components: readonly string[];\n readonly matcher: RegExp;\n}\nfunction escapeRegExp(value: string): string {\n return value.replace(/[\\\\^$.*+?()[\\]{}|]/g, \"\\\\$&\");\n}\nfunction normalizeReferencePath(value: unknown, label: string): readonly string[] {\n assertNonEmptyString(value, label);\n const components = value.split(/[\\\\/]+/u).filter((component) => component.length > 0 && component !== \".\");\n if (components.length === 0)\n throw new TypeError(`${label} normalizes to an empty path`);\n return Object.freeze(components);\n}\nfunction pathPattern(components: readonly string[]): RegExp {\n // Whitespace / quoting can bound a path embedded in a tool input, while '-' and '.' stay in a component so\n // `agents` cannot match `agents-old` and `.niceeval` cannot match `.niceevaluation`.\n const componentChar = \"\\\\p{L}\\\\p{N}_.-\";\n const betweenComponents = \"[\\\\\\\\/]+(?:\\\\.[\\\\\\\\/]+)*\";\n const source = components.map(escapeRegExp).join(betweenComponents);\n return new RegExp(`(?<![${componentChar}])${source}(?![${componentChar}])`, \"u\");\n}\nfunction normalizeReferencePatterns(paths: readonly [\n string,\n ...string[]\n]): readonly ReferencePathPattern[] {\n if (!Array.isArray(paths) || paths.length === 0)\n throw new TypeError(\"referencesAnyPath() requires at least one path\");\n const seen = new Set<string>();\n const patterns = paths.map((path, index) => {\n const components = normalizeReferencePath(path, `referencesAnyPath() paths[${index}]`);\n const identity = components.join(\"\\u0000\");\n if (seen.has(identity))\n throw new TypeError(`referencesAnyPath() has duplicate normalized path ${quoted(path)}`);\n seen.add(identity);\n return Object.freeze({ original: path, components, matcher: pathPattern(components) });\n });\n return Object.freeze(patterns);\n}\ninterface PathWitness {\n readonly pointer: string;\n readonly pattern: ReferencePathPattern;\n}\nfunction jsonPointerSegment(value: string | number): string {\n return String(value).replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\n}\nfunction isPlainJsonObject(value: object): value is globalThis.Record<string, unknown> {\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\nfunction isArrayIndexKey(key: string, length: number): boolean {\n if (!/^(?:0|[1-9][0-9]*)$/u.test(key))\n return false;\n const index = Number(key);\n return Number.isSafeInteger(index) && index >= 0 && index < length;\n}\nfunction findReferencedPath(value: unknown, patterns: readonly ReferencePathPattern[], pointer = \"\", ancestors = new WeakSet<object>()): PathWitness | undefined {\n if (typeof value === \"string\") {\n const pattern = patterns.find((candidate) => {\n candidate.matcher.lastIndex = 0;\n return candidate.matcher.test(value);\n });\n return pattern === undefined ? undefined : { pointer, pattern };\n }\n if (value === null || typeof value === \"boolean\")\n return undefined;\n if (typeof value === \"number\") {\n if (!Number.isFinite(value))\n throw new TypeError(\"referencesAnyPath() received a non-JSON number\");\n return undefined;\n }\n if (typeof value !== \"object\")\n throw new TypeError(\"referencesAnyPath() received a non-JSON value\");\n if (ancestors.has(value))\n throw new TypeError(\"referencesAnyPath() received a cyclic JSON value\");\n ancestors.add(value);\n try {\n if (Array.isArray(value)) {\n for (const key of Object.keys(value)) {\n if (!isArrayIndexKey(key, value.length)) {\n throw new TypeError(\"referencesAnyPath() received a non-JSON array property\");\n }\n }\n for (let index = 0; index < value.length; index += 1) {\n const descriptor = Object.getOwnPropertyDescriptor(value, String(index));\n if (descriptor === undefined || !(\"value\" in descriptor)) {\n throw new TypeError(\"referencesAnyPath() received a sparse array or accessor\");\n }\n const witness = findReferencedPath(descriptor.value, patterns, `${pointer}/${index}`, ancestors);\n if (witness !== undefined)\n return witness;\n }\n return undefined;\n }\n if (!isPlainJsonObject(value))\n throw new TypeError(\"referencesAnyPath() received a non-plain JSON object\");\n for (const key of Object.keys(value)) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined || !(\"value\" in descriptor)) {\n throw new TypeError(\"referencesAnyPath() received an accessor property\");\n }\n const witness = findReferencedPath(descriptor.value, patterns, `${pointer}/${jsonPointerSegment(key)}`, ancestors);\n if (witness !== undefined)\n return witness;\n }\n return undefined;\n }\n finally {\n ancestors.delete(value);\n }\n}\nexport function referencesAnyPath(paths: readonly [\n string,\n ...string[]\n]): BooleanMatch<JsonValue, JsonValue, \"value\"> {\n const patterns = normalizeReferencePatterns(paths);\n const name = `referencesAnyPath(${patterns.length} paths)`;\n return createBooleanMatch(\"value\", name, (candidate) => {\n const witness = findReferencedPath(candidate, patterns);\n if (witness !== undefined) {\n return matched(candidate, diagnostic(\"path-reference-match\", `${name} found a referenced path`, {\n expected: witness.pattern.components.join(\"/\"),\n locator: { kind: \"json-pointer\", pointer: witness.pointer },\n }));\n }\n return mismatched(diagnostic(\"path-reference-mismatch\", `${name} found no referenced path`, {\n expected: patterns.map((pattern) => pattern.components.join(\"/\")).join(\" | \"),\n }));\n }, { positiveWitness: true });\n}\nexport type ToolStatus = Extract<LogicalToolOccurrence[\"lifecycle\"], {\n readonly state: \"available\";\n}>[\"status\"];\nexport interface CommandMatchOptions {\n readonly argsStart?: readonly string[];\n readonly excludes?: readonly string[];\n readonly status?: ToolStatus;\n}\nexport interface ToolMatchOptions {\n readonly input?: BooleanMatch<JsonValue, JsonValue, \"value\">;\n readonly output?: BooleanMatch<JsonValue, JsonValue, \"value\">;\n readonly status?: ToolStatus;\n}\n/**\n * Turns the recursive JsonMatch language into a managed value Match. Raw\n * JsonMatch stays at this explicit bridge; tool assertions consume only the\n * branded Match so every tool field follows the same evaluator path.\n */\nexport function jsonMatch(expected: JsonMatch): BooleanMatch<JsonValue, JsonValue, \"value\"> {\n const normalized = normalizeJsonMatch(expected, \"jsonMatch() expected\");\n const name = \"jsonMatch(...)\";\n return createBooleanMatch(\"value\", name, (candidate) => {\n if (matchesJson(candidate, normalized)) {\n return matched(candidate, diagnostic(\"json-match\", `${name} matched`));\n }\n return mismatched(diagnostic(\"json-mismatch\", `${name} did not match`, {\n expected: \"the supplied JsonMatch pattern\",\n received: \"the candidate JSON value\",\n }));\n });\n}\nfunction normalizeJsonMatch(value: unknown, label: string, active = new WeakSet<object>()): JsonMatch {\n if (value === null || typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") {\n if (typeof value === \"number\" && !Number.isFinite(value)) {\n throw new TypeError(`${label} must not contain a non-finite number`);\n }\n return value;\n }\n if (value instanceof RegExp)\n return new RegExp(value.source, value.flags);\n if (typeof value === \"function\")\n return value as (candidate: unknown) => boolean;\n if (typeof value !== \"object\")\n throw new TypeError(`${label} must be a JsonMatch value`);\n if (active.has(value))\n throw new TypeError(`${label} must not be cyclic`);\n active.add(value);\n try {\n if (Array.isArray(value)) {\n return Object.freeze(value.map((item, index) => normalizeJsonMatch(item, `${label}[${index}]`, active)));\n }\n if (!isPlainJsonObject(value))\n throw new TypeError(`${label} must use a plain object`);\n const entries: [\n string,\n JsonMatch\n ][] = [];\n for (const key of Object.keys(value)) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined || !(\"value\" in descriptor)) {\n throw new TypeError(`${label}.${key} must not be an accessor`);\n }\n entries.push([key, normalizeJsonMatch(descriptor.value, `${label}.${key}`, active)]);\n }\n return Object.freeze(Object.fromEntries(entries));\n }\n finally {\n active.delete(value);\n }\n}\nfunction normalizeStatus(value: unknown, label: string): ToolStatus | undefined {\n if (value === undefined)\n return undefined;\n if (value === \"pending\" || value === \"completed\" || value === \"failed\" || value === \"rejected\")\n return value;\n throw new TypeError(`${label} must be pending, completed, failed, or rejected`);\n}\nfunction normalizeTokens(value: unknown, label: string, unique: boolean): readonly string[] | undefined {\n if (value === undefined)\n return undefined;\n if (!Array.isArray(value))\n throw new TypeError(`${label} must be an array of command tokens`);\n const tokens = value.map((token, index) => {\n assertNonEmptyString(token, `${label}[${index}]`);\n return token;\n });\n if (unique && new Set(tokens).size !== tokens.length)\n throw new TypeError(`${label} must not contain duplicate tokens`);\n return Object.freeze(tokens);\n}\nfunction lifecycleResult(occurrence: LogicalToolOccurrence, expected: ToolStatus | undefined): BooleanMatchEvaluation<unknown> {\n const lifecycle = occurrence.lifecycle;\n if (!isRecord(lifecycle) || (lifecycle.state !== \"available\" && lifecycle.state !== \"opaque\")) {\n throw new TypeError(\"tool occurrence has an invalid lifecycle envelope\");\n }\n if (lifecycle.state === \"opaque\") {\n if (typeof lifecycle.reason !== \"string\" || lifecycle.reason.length === 0) {\n throw new TypeError(\"tool occurrence has an opaque lifecycle without a reason\");\n }\n return unavailable(lifecycle.reason, diagnostic(\"tool-lifecycle-unavailable\", \"tool lifecycle is not fully observed\", {\n expected,\n reason: lifecycle.reason,\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n if (expected === undefined) {\n return matched(occurrence, diagnostic(\"lifecycle-unrestricted\", \"lifecycle is unrestricted\", {\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n if (lifecycle.status !== expected) {\n return mismatched(diagnostic(\"tool-status-mismatch\", \"tool lifecycle status did not match\", {\n expected,\n received: typeof lifecycle.status === \"string\" ? lifecycle.status : undefined,\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n return matched(occurrence, diagnostic(\"tool-status-match\", \"tool lifecycle status matched\", {\n expected,\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n}\nfunction occurrenceNameResult(occurrence: LogicalToolOccurrence, expected: string): BooleanMatchEvaluation<unknown> {\n if (!isRecord(occurrence.name) || typeof occurrence.name.original !== \"string\") {\n throw new TypeError(\"tool occurrence has an invalid name envelope\");\n }\n // `unknown` means the adapter could not map this domain-specific tool onto\n // NiceEval's canonical vocabulary. It must not hide the original name that\n // the author can still check exactly.\n const observed = occurrence.name.canonical === undefined || occurrence.name.canonical === \"unknown\"\n ? occurrence.name.original\n : occurrence.name.canonical;\n if (observed !== expected) {\n return mismatched(diagnostic(\"tool-name-mismatch\", \"tool name did not match\", {\n expected: quoted(expected),\n received: quoted(observed),\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n return matched(occurrence, diagnostic(\"tool-name-match\", \"tool name matched exactly\", {\n expected: quoted(expected),\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n}\nasync function toolEvidenceResult(occurrence: LogicalToolOccurrence, field: \"input\" | \"output\", match: BooleanMatch<JsonValue, JsonValue, \"value\">): Promise<BooleanMatchEvaluation<unknown>> {\n const evidence = occurrence[field];\n if (!isRecord(evidence) || (evidence.state !== \"complete\" && evidence.state !== \"partial\" && evidence.state !== \"unavailable\")) {\n throw new TypeError(`tool occurrence has an invalid ${field} envelope`);\n }\n if (evidence.state === \"unavailable\") {\n if (typeof evidence.reason !== \"string\" || evidence.reason.length === 0) {\n throw new TypeError(`tool occurrence has unavailable ${field} without a reason`);\n }\n return unavailable(evidence.reason, diagnostic(`tool-${field}-unavailable`, `tool ${field} is unavailable`, {\n reason: evidence.reason,\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n const result = await evaluateBooleanMatch(match, evidence.value);\n if (evidence.state === \"complete\")\n return result;\n // partial input can only produce a positive result when the matcher itself carries the narrowed witness\n // capability. A visible reference hit survives hidden leaves; general predicates / schema checks do not.\n if (result.state === \"matched\" && hasPositiveWitnessCapability(match as BooleanMatch<unknown, unknown, \"value\">)) {\n return result;\n }\n return unavailable(`tool-${field}-coverage-partial`, diagnostic(`tool-${field}-coverage-partial`, `tool ${field} is partial without a decisive positive witness`, {\n reason: `tool-${field}-coverage-partial`,\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n ...(Array.isArray(evidence.opaquePointers) ? { received: evidence.opaquePointers.join(\",\") } : {}),\n }));\n}\nexport function toolMatch(name: string, options?: ToolMatchOptions): ToolMatch;\nexport function toolMatch(options: ToolMatchOptions): ToolMatch;\nexport function toolMatch(nameOrOptions: string | ToolMatchOptions, options?: ToolMatchOptions): ToolMatch {\n let expectedName: string | undefined;\n let input: BooleanMatch<JsonValue, JsonValue, \"value\"> | undefined;\n let output: BooleanMatch<JsonValue, JsonValue, \"value\"> | undefined;\n let status: ToolStatus | undefined;\n if (typeof nameOrOptions === \"string\") {\n assertNonEmptyString(nameOrOptions, \"toolMatch() name\");\n expectedName = nameOrOptions;\n const normalized = assertPlainOptions(options, \"toolMatch() options\", [\"input\", \"output\", \"status\"]);\n if (normalized.input !== undefined) {\n assertBooleanMatch(normalized.input, \"toolMatch() options.input\", \"value\");\n input = normalized.input as BooleanMatch<JsonValue, JsonValue, \"value\">;\n }\n if (normalized.output !== undefined) {\n assertBooleanMatch(normalized.output, \"toolMatch() options.output\", \"value\");\n output = normalized.output as BooleanMatch<JsonValue, JsonValue, \"value\">;\n }\n status = normalizeStatus(normalized.status, \"toolMatch() options.status\");\n }\n else {\n if (options !== undefined)\n throw new TypeError(\"toolMatch(options) does not accept a second argument\");\n const normalized = assertPlainOptions(nameOrOptions, \"toolMatch() options\", [\"input\", \"output\", \"status\"]);\n if (normalized.input === undefined && normalized.output === undefined && normalized.status === undefined) {\n throw new TypeError(\"toolMatch(options) requires input, output, or status\");\n }\n if (normalized.input !== undefined) {\n assertBooleanMatch(normalized.input, \"toolMatch() options.input\", \"value\");\n input = normalized.input as BooleanMatch<JsonValue, JsonValue, \"value\">;\n }\n if (normalized.output !== undefined) {\n assertBooleanMatch(normalized.output, \"toolMatch() options.output\", \"value\");\n output = normalized.output as BooleanMatch<JsonValue, JsonValue, \"value\">;\n }\n status = normalizeStatus(normalized.status, \"toolMatch() options.status\");\n }\n const name = expectedName === undefined\n ? `toolMatch(${[\n input === undefined ? undefined : `input=${input.name}`,\n output === undefined ? undefined : `output=${output.name}`,\n status === undefined ? undefined : `status=${status}`,\n ].filter((part): part is string => part !== undefined).join(\", \")})`\n : `toolMatch(${quoted(expectedName)})`;\n return createBooleanMatch(\"tool\", name, async (occurrence) => {\n const fields = await evaluateFields([\n ...(expectedName === undefined\n ? []\n : [{ label: \"name\", evaluate: async () => occurrenceNameResult(occurrence, expectedName!) }]),\n ...(input === undefined ? [] : [{ label: \"input\", evaluate: () => toolEvidenceResult(occurrence, \"input\", input!) }]),\n ...(output === undefined ? [] : [{ label: \"output\", evaluate: () => toolEvidenceResult(occurrence, \"output\", output!) }]),\n { label: \"status\", evaluate: async () => lifecycleResult(occurrence, status) },\n ]);\n return combineConjunction(occurrence, name, fields);\n });\n}\n/** @internal Assert-first accepts only branded tool-domain matches. */\nexport function assertManagedToolMatch(value: unknown, label = \"match\"): ToolMatch {\n assertBooleanMatch(value, label, \"tool\");\n return value as ToolMatch;\n}\n/** @internal Assert-first accepts only branded event-domain matches. */\nexport function assertManagedEventMatch(value: unknown, label = \"match\"): EventMatch {\n assertBooleanMatch(value, label, \"event\");\n return value as EventMatch;\n}\nexport type ToolMatchQuantifier = {\n readonly kind: \"at-least\";\n readonly count: number;\n} | {\n readonly kind: \"exact\";\n readonly count: number;\n} | {\n readonly kind: \"absent\";\n};\nexport interface ToolMatchCollectionOptions {\n readonly quantifier: ToolMatchQuantifier;\n /** Scope-level action coverage that can hide additional candidates. */\n readonly coverageReason?: string;\n}\n/**\n * The sole collection evaluator for scoped tool Assertions. It evaluates each\n * occurrence through ToolMatch, then folds exact / at-least / absent with the\n * same three-valued rule: a definite counterexample wins; incomplete evidence\n * cannot manufacture a positive count or an absence proof.\n */\nexport async function evaluateToolMatchCollection(match: ToolMatch, occurrences: readonly LogicalToolOccurrence[], options: ToolMatchCollectionOptions): Promise<BooleanMatchEvaluation<LogicalToolOccurrence | undefined>> {\n const sampledCandidates: CandidateResult<LogicalToolOccurrence>[] = [];\n let matchCount = 0;\n let firstMatch: CandidateResult<LogicalToolOccurrence> | undefined;\n let firstUnavailable: CandidateResult<LogicalToolOccurrence> | undefined;\n let exactOverage: CandidateResult<LogicalToolOccurrence> | undefined;\n for (const [index, occurrence] of occurrences.entries()) {\n const candidate = Object.freeze({\n index,\n candidate: occurrence,\n result: await evaluateBooleanMatch(match, occurrence),\n });\n if (sampledCandidates.length < assertionRuntimeLimits.collectionDiagnosticCandidates) {\n sampledCandidates.push(candidate);\n }\n if (candidate.result.state === \"matched\") {\n matchCount += 1;\n firstMatch ??= candidate;\n if (options.quantifier.kind === \"exact\" && matchCount === options.quantifier.count + 1) {\n exactOverage = candidate;\n }\n }\n else if (candidate.result.state === \"unavailable\") {\n firstUnavailable ??= candidate;\n }\n }\n const unavailableReason = firstUnavailable?.result.state === \"unavailable\"\n ? firstUnavailable.result.reason\n : options.coverageReason;\n const incomplete = unavailableReason !== undefined;\n const received = `${matchCount} definite match${matchCount === 1 ? \"\" : \"es\"}`;\n const candidateLocator = (candidate: CandidateResult<LogicalToolOccurrence> | undefined) => candidate === undefined ? undefined : { kind: \"tool-occurrence\" as const, id: candidate.candidate.id };\n const diagnosticSample = (...decisive: readonly (CandidateResult<LogicalToolOccurrence> | undefined)[]): Pick<MatchDiagnostic, \"children\" | \"truncation\"> => {\n const byIndex = new Map<number, CandidateResult<LogicalToolOccurrence>>();\n for (const candidate of [...sampledCandidates, ...decisive]) {\n if (candidate !== undefined)\n byIndex.set(candidate.index, candidate);\n }\n const captured = [...byIndex.values()].sort((left, right) => left.index - right.index);\n return Object.freeze({\n children: Object.freeze(captured.map((candidate) => resultChild(candidate.result, candidate.index, `candidate ${candidate.candidate.id}`))),\n ...(captured.length === occurrences.length\n ? {}\n : {\n truncation: Object.freeze({\n code: \"diagnostic-truncated\" as const,\n reason: \"sampled\" as const,\n captured: captured.length,\n knownTotal: occurrences.length,\n }),\n }),\n });\n };\n if (options.quantifier.kind === \"absent\") {\n const first = firstMatch;\n if (first !== undefined) {\n return mismatched(diagnostic(\"tool-absence-mismatch\", `notCalledTool(${match.name}) observed a matching tool`, {\n expected: `no ${match.name}`,\n received,\n locator: candidateLocator(first),\n ...diagnosticSample(first),\n }));\n }\n if (incomplete) {\n return unavailable(unavailableReason, diagnostic(\"tool-absence-unavailable\", `notCalledTool(${match.name}) cannot prove absence`, {\n expected: `no ${match.name}`,\n received,\n reason: unavailableReason,\n ...diagnosticSample(firstUnavailable),\n }));\n }\n return matched(undefined, diagnostic(\"tool-absence-match\", `notCalledTool(${match.name}) observed no matching tool`, {\n expected: `no ${match.name}`,\n received,\n ...diagnosticSample(),\n }));\n }\n const { kind, count } = options.quantifier;\n const expected = kind === \"exact\" ? `exactly ${count} × ${match.name}` : `at least ${count} × ${match.name}`;\n if (kind === \"exact\" && matchCount > count) {\n const overage = exactOverage;\n return mismatched(diagnostic(\"tool-count-exceeded\", `calledTool(${match.name}) exceeded its exact count`, {\n expected,\n received,\n locator: candidateLocator(overage),\n ...diagnosticSample(overage),\n }));\n }\n if (kind === \"at-least\" && matchCount >= count) {\n return matched(firstMatch?.candidate, diagnostic(\"tool-count-match\", `calledTool(${match.name}) satisfied its lower bound`, {\n expected,\n received,\n ...diagnosticSample(firstMatch),\n }));\n }\n if (kind === \"exact\" && matchCount === count && !incomplete) {\n return matched(firstMatch?.candidate, diagnostic(\"tool-count-match\", `calledTool(${match.name}) satisfied its exact count`, {\n expected,\n received,\n ...diagnosticSample(firstMatch),\n }));\n }\n if (incomplete) {\n return unavailable(unavailableReason, diagnostic(\"tool-count-unavailable\", `calledTool(${match.name}) cannot decide its count`, {\n expected,\n received,\n reason: unavailableReason,\n ...diagnosticSample(firstUnavailable),\n }));\n }\n return mismatched(diagnostic(\"tool-count-mismatch\", `calledTool(${match.name}) did not satisfy its count`, {\n expected,\n received,\n ...diagnosticSample(),\n }));\n}\ninterface CandidateResult<T> {\n readonly index: number;\n readonly candidate: T;\n readonly result: BooleanMatchEvaluation<unknown>;\n}\nfunction commandResult(occurrence: LogicalToolOccurrence, executable: string, argsStart: readonly string[] | undefined, excludes: readonly string[] | undefined): BooleanMatchEvaluation<unknown> {\n const projection = occurrence.command;\n if (projection === undefined) {\n return unavailable(\"logical-command-unavailable\", diagnostic(\"logical-command-unavailable\", \"tool occurrence has no durable command projection\", {\n reason: \"logical-command-unavailable\",\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n if (!isRecord(projection) || (projection.kind !== \"command\" && projection.kind !== \"not-command\")) {\n throw new TypeError(\"tool occurrence has an invalid command projection\");\n }\n if (projection.kind === \"not-command\") {\n return mismatched(diagnostic(\"not-command\", \"tool occurrence is not a command\", {\n expected: quoted(executable),\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n const logical = projection.logical;\n if (!isRecord(logical) || (logical.state !== \"available\" && logical.state !== \"opaque\")) {\n throw new TypeError(\"command projection has an invalid logical envelope\");\n }\n if (logical.normalizer !== \"logical-command/v1\") {\n throw new TypeError(\"command projection does not use logical-command/v1\");\n }\n if (logical.state === \"opaque\") {\n if (typeof logical.reason !== \"string\" || logical.reason.length === 0) {\n throw new TypeError(\"opaque logical command has no reason\");\n }\n return unavailable(`logical-command-opaque:${logical.reason}`, diagnostic(\"logical-command-opaque\", \"logical command is opaque\", {\n reason: logical.reason,\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n if (typeof logical.executable !== \"string\" || !Array.isArray(logical.args) || !logical.args.every((arg) => typeof arg === \"string\")) {\n throw new TypeError(\"available logical command has an invalid argv envelope\");\n }\n if (logical.executable !== executable) {\n return mismatched(diagnostic(\"logical-executable-mismatch\", \"logical executable did not match exactly\", {\n expected: quoted(executable),\n received: quoted(logical.executable),\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n if (argsStart !== undefined && !argsStart.every((token, index) => logical.args[index] === token)) {\n return mismatched(diagnostic(\"logical-args-prefix-mismatch\", \"logical argv did not start with the expected exact tokens\", {\n expected: argsStart.map(quoted).join(\" \"),\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n if (excludes !== undefined && excludes.some((token) => logical.args.includes(token))) {\n return mismatched(diagnostic(\"logical-args-excluded-token\", \"logical argv contained an excluded exact token\", {\n expected: `without ${excludes.map(quoted).join(\", \")}`,\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n }\n return matched(occurrence, diagnostic(\"logical-command-match\", \"logical command matched exact executable and token rules\", {\n expected: quoted(executable),\n locator: { kind: \"tool-occurrence\", id: occurrence.id },\n }));\n}\nexport function commandMatch(executable: string, options?: CommandMatchOptions): ToolMatch<LogicalCommandOccurrence> {\n assertNonEmptyString(executable, \"commandMatch() executable\");\n const normalized = assertPlainOptions(options, \"commandMatch() options\", [\"argsStart\", \"excludes\", \"status\"]);\n const argsStart = normalizeTokens(normalized.argsStart, \"commandMatch() options.argsStart\", false);\n const excludes = normalizeTokens(normalized.excludes, \"commandMatch() options.excludes\", true);\n const status = normalizeStatus(normalized.status, \"commandMatch() options.status\");\n const details = [\n argsStart === undefined ? undefined : `argsStart=[${argsStart.map(quoted).join(\", \")}]`,\n excludes === undefined ? undefined : `excludes=[${excludes.map(quoted).join(\", \")}]`,\n status === undefined ? undefined : `status=${status}`,\n ]\n .filter((detail): detail is string => detail !== undefined)\n .join(\", \");\n const name = `commandMatch(${quoted(executable)}${details.length === 0 ? \"\" : `, ${details}`})`;\n return createBooleanMatch(\"tool\", name, async (occurrence) => {\n const fields = await evaluateFields([\n { label: \"command\", evaluate: async () => commandResult(occurrence, executable, argsStart, excludes) },\n { label: \"status\", evaluate: async () => lifecycleResult(occurrence, status) },\n ]);\n return combineConjunction<LogicalToolOccurrence, LogicalCommandOccurrence>(occurrence, name, fields);\n });\n}\nexport interface EventOptionsByType {\n readonly message: {\n readonly role?: \"assistant\" | \"user\";\n readonly text?: BooleanMatch<string, string, \"value\">;\n };\n readonly \"operation.started\": {\n readonly tool?: ToolMatch;\n };\n readonly \"operation.finished\": {\n readonly tool?: ToolMatch;\n };\n}\ntype MatchableEventType = keyof EventOptionsByType;\nfunction isMatchableEventType(value: unknown): value is MatchableEventType {\n return value === \"message\" || value === \"operation.started\" || value === \"operation.finished\";\n}\nfunction messageEventResult(event: Extract<MatchableEvent, {\n readonly type: \"message\";\n}>, role: \"assistant\" | \"user\" | undefined, text: BooleanMatch<string, string, \"value\"> | undefined): Promise<BooleanMatchEvaluation<unknown>> {\n return evaluateFields([\n ...(role === undefined\n ? []\n : [\n {\n label: \"role\",\n evaluate: async () => event.role === role\n ? matched(event, diagnostic(\"message-role-match\", \"message role matched\", { expected: role }))\n : mismatched(diagnostic(\"message-role-mismatch\", \"message role did not match\", {\n expected: role,\n received: event.role,\n })),\n },\n ]),\n ...(text === undefined\n ? []\n : [{ label: \"text\", evaluate: () => evaluateBooleanMatch(text, event.text) }]),\n ]).then((fields) => combineConjunction(event, \"eventMatch(message)\", fields));\n}\nasync function toolEventResult(event: MatchableEvent, match: ToolMatch | undefined): Promise<BooleanMatchEvaluation<unknown>> {\n if (match === undefined)\n return matched(event, diagnostic(\"event-type-match\", \"event type matched\"));\n const occurrence = assertionEventOccurrence(event);\n if (occurrence === undefined) {\n return unavailable(\"event-tool-occurrence-unavailable\", diagnostic(\"event-tool-occurrence-unavailable\", \"operation event has no associated logical tool occurrence\", {\n reason: \"event-tool-occurrence-unavailable\",\n }));\n }\n return evaluateBooleanMatch(match, occurrence);\n}\nexport function eventMatch<K extends keyof EventOptionsByType>(type: K, options?: EventOptionsByType[K]): EventMatch<Extract<AssertionEvent, {\n readonly type: K;\n}>> {\n if (!isMatchableEventType(type))\n throw new TypeError(\"eventMatch() type is not supported\");\n if (type === \"message\") {\n const normalized = assertPlainOptions(options, \"eventMatch(message) options\", [\"role\", \"text\"]);\n const role = normalized.role;\n if (role !== undefined && role !== \"assistant\" && role !== \"user\") {\n throw new TypeError(\"eventMatch(message) options.role must be assistant or user\");\n }\n const text = normalized.text;\n if (text !== undefined)\n assertBooleanMatch(text, \"eventMatch(message) options.text\", \"value\");\n const name = \"eventMatch(message)\";\n return createBooleanMatch(\"event\", name, async (event) => {\n if (event.type !== \"message\") {\n return mismatched(diagnostic(\"event-type-mismatch\", \"event type did not match\", { expected: \"message\" }));\n }\n return messageEventResult(event, role as \"assistant\" | \"user\" | undefined, text as BooleanMatch<string, string, \"value\"> | undefined) as Promise<BooleanMatchEvaluation<Extract<AssertionEvent, {\n readonly type: K;\n }>>>;\n }) as EventMatch<Extract<AssertionEvent, {\n readonly type: K;\n }>>;\n }\n const normalized = assertPlainOptions(options, `eventMatch(${type}) options`, [\"tool\"]);\n const tool = normalized.tool;\n if (tool !== undefined)\n assertBooleanMatch(tool, `eventMatch(${type}) options.tool`, \"tool\");\n const name = `eventMatch(${type})`;\n return createBooleanMatch(\"event\", name, async (event) => {\n if (event.type !== type) {\n return mismatched(diagnostic(\"event-type-mismatch\", \"event type did not match\", { expected: type }));\n }\n const fields = await evaluateFields([\n { label: \"tool\", evaluate: () => toolEventResult(event, tool as ToolMatch | undefined) },\n ]);\n return combineConjunction<AssertionEvent, Extract<AssertionEvent, {\n readonly type: K;\n }>>(event, name, fields);\n }) as EventMatch<Extract<AssertionEvent, {\n readonly type: K;\n }>>;\n}\n"]}
|