niceeval 0.15.1-canary.76 → 0.16.1
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 +45 -40
- package/dist/adapter-execution-trace.cjs.map +1 -1
- package/dist/adapter-execution-trace.d.cts +26 -0
- package/dist/adapter-execution-trace.d.mts +26 -0
- package/dist/adapter-execution-trace.d.ts +26 -0
- package/dist/adapter-usage.cjs.map +1 -1
- package/dist/adapter-usage.d.cts +9 -0
- package/dist/adapter-usage.d.mts +9 -0
- package/dist/adapter-usage.d.ts +9 -0
- package/dist/adapter.cjs +19 -4
- package/dist/adapter.cjs.map +1 -1
- package/dist/adapter.d.cts +37 -12
- package/dist/adapter.d.mts +37 -12
- package/dist/adapter.d.ts +37 -12
- package/dist/agents/ai-sdk.cjs +3 -0
- package/dist/agents/ai-sdk.cjs.map +1 -1
- package/dist/agents/bub.cjs +3 -0
- package/dist/agents/bub.cjs.map +1 -1
- package/dist/agents/claude-code-native.cjs +28 -2
- package/dist/agents/claude-code-native.cjs.map +1 -1
- package/dist/agents/claude-code.cjs +3 -0
- package/dist/agents/claude-code.cjs.map +1 -1
- package/dist/agents/codex.cjs +3 -0
- package/dist/agents/codex.cjs.map +1 -1
- package/dist/agents/coding-cli-versions.cjs +9 -10
- package/dist/agents/coding-cli-versions.cjs.map +1 -1
- package/dist/agents/coding-cli-versions.d.cts +1 -1
- package/dist/agents/coding-cli-versions.d.mts +1 -1
- package/dist/agents/coding-cli-versions.d.ts +1 -1
- package/dist/agents/deepseek-harness.cjs +3 -0
- package/dist/agents/deepseek-harness.cjs.map +1 -1
- package/dist/agents/hermes.cjs +3 -0
- package/dist/agents/hermes.cjs.map +1 -1
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.d.cts +3 -2
- package/dist/agents/index.d.mts +3 -2
- package/dist/agents/index.d.ts +3 -2
- package/dist/agents/omp.cjs +3 -0
- package/dist/agents/omp.cjs.map +1 -1
- package/dist/agents/openai-compat.cjs +6 -0
- package/dist/agents/openai-compat.cjs.map +1 -1
- package/dist/agents/openclaw.cjs +3 -0
- package/dist/agents/openclaw.cjs.map +1 -1
- package/dist/agents/opencode.cjs +3 -0
- package/dist/agents/opencode.cjs.map +1 -1
- package/dist/agents/sdk-streams.cjs +9 -0
- package/dist/agents/sdk-streams.cjs.map +1 -1
- package/dist/agents/ui-message-stream.cjs +3 -0
- package/dist/agents/ui-message-stream.cjs.map +1 -1
- package/dist/assertions/api.cjs.map +1 -1
- package/dist/assertions/api.d.cts +27 -5
- package/dist/assertions/api.d.mts +27 -5
- package/dist/assertions/api.d.ts +27 -5
- package/dist/assertions/collection.cjs +6 -0
- package/dist/assertions/collection.cjs.map +1 -1
- package/dist/assertions/collection.d.cts +4 -2
- package/dist/assertions/collection.d.mts +4 -2
- package/dist/assertions/collection.d.ts +4 -2
- package/dist/assertions/collection.js +12 -8
- package/dist/assertions/context-match.cjs +70 -0
- package/dist/assertions/context-match.cjs.map +1 -0
- package/dist/assertions/context-match.d.cts +107 -0
- package/dist/assertions/context-match.d.mts +107 -0
- package/dist/assertions/context-match.d.ts +107 -0
- package/dist/assertions/context-match.js +12 -0
- package/dist/assertions/context-match.js.map +1 -0
- package/dist/assertions/full-content.cjs +109 -0
- package/dist/assertions/full-content.cjs.map +1 -0
- package/dist/assertions/full-content.d.cts +6 -0
- package/dist/assertions/full-content.d.mts +6 -0
- package/dist/assertions/full-content.d.ts +6 -0
- package/dist/assertions/full-content.js +12 -0
- package/dist/assertions/full-content.js.map +1 -0
- package/dist/assertions/judge-presets.cjs +2 -34
- package/dist/assertions/judge-presets.cjs.map +1 -1
- package/dist/assertions/judge-presets.d.cts +6 -9
- package/dist/assertions/judge-presets.d.mts +6 -9
- package/dist/assertions/judge-presets.d.ts +6 -9
- package/dist/assertions/judge-presets.js +8 -8
- package/dist/assertions/judge.cjs +107 -29
- package/dist/assertions/judge.cjs.map +1 -1
- package/dist/assertions/judge.d.cts +2 -0
- package/dist/assertions/judge.d.mts +2 -0
- package/dist/assertions/judge.d.ts +2 -0
- package/dist/assertions/match.cjs +244 -5
- package/dist/assertions/match.cjs.map +1 -1
- package/dist/assertions/match.d.cts +43 -3
- package/dist/assertions/match.d.mts +43 -3
- package/dist/assertions/match.d.ts +43 -3
- package/dist/assertions/match.js +88 -78
- package/dist/assertions/material.cjs +520 -0
- package/dist/assertions/material.cjs.map +1 -0
- package/dist/assertions/material.d.cts +56 -0
- package/dist/assertions/material.d.mts +56 -0
- package/dist/assertions/material.d.ts +56 -0
- package/dist/assertions/material.js +20 -0
- package/dist/assertions/material.js.map +1 -0
- package/dist/assertions/record/attachment.cjs +5 -2
- package/dist/assertions/record/attachment.cjs.map +1 -1
- package/dist/assertions/record/codec.cjs +2 -1
- package/dist/assertions/record/codec.cjs.map +1 -1
- package/dist/assertions/record/model.cjs.map +1 -1
- package/dist/assertions/record/model.d.cts +6 -1
- package/dist/assertions/record/model.d.mts +6 -1
- package/dist/assertions/record/model.d.ts +6 -1
- package/dist/assertions/runtime.cjs +207 -14
- package/dist/assertions/runtime.cjs.map +1 -1
- package/dist/assertions/runtime.d.cts +9 -0
- package/dist/assertions/runtime.d.mts +9 -0
- package/dist/assertions/runtime.d.ts +9 -0
- package/dist/assertions/runtime.js +14 -8
- package/dist/assertions/score-match-audit.cjs +18 -8
- package/dist/assertions/score-match-audit.cjs.map +1 -1
- package/dist/assertions/score-match-gateway.cjs +83 -25
- package/dist/assertions/score-match-gateway.cjs.map +1 -1
- package/dist/assertions/score-match-gateway.d.cts +2 -0
- package/dist/assertions/score-match-gateway.d.mts +2 -0
- package/dist/assertions/score-match-gateway.d.ts +2 -0
- package/dist/assertions/value-composition.test-d.cjs +77 -0
- package/dist/assertions/value-composition.test-d.cjs.map +1 -0
- package/dist/assertions/value-composition.test-d.d.cts +1 -0
- package/dist/assertions/value-composition.test-d.d.mts +1 -0
- package/dist/assertions/value-composition.test-d.d.ts +1 -0
- package/dist/assertions/value-composition.test-d.js +4 -0
- package/dist/assertions/value-composition.test-d.js.map +1 -0
- package/dist/context/assert-first.cjs +207 -213
- package/dist/context/assert-first.cjs.map +1 -1
- package/dist/context/assert-first.d.cts +49 -23
- package/dist/context/assert-first.d.mts +49 -23
- package/dist/context/assert-first.d.ts +49 -23
- package/dist/context/session.cjs +111 -9
- package/dist/context/session.cjs.map +1 -1
- package/dist/context/session.d.cts +18 -0
- package/dist/context/session.d.mts +18 -0
- package/dist/context/session.d.ts +18 -0
- package/dist/define.cjs +17 -1
- package/dist/define.cjs.map +1 -1
- package/dist/eval/cli/contribution.cjs +2 -0
- package/dist/eval/cli/contribution.cjs.map +1 -1
- package/dist/eval/host/index.cjs +2 -0
- package/dist/eval/host/index.cjs.map +1 -1
- package/dist/eval/record/evaluation.cjs +3 -0
- package/dist/eval/record/evaluation.cjs.map +1 -1
- package/dist/eval/record/membership-provenance.d.cts +15 -15
- package/dist/eval/record/membership-provenance.d.mts +15 -15
- package/dist/eval/record/membership-provenance.d.ts +15 -15
- package/dist/eval/record/score.cjs +7 -0
- package/dist/eval/record/score.cjs.map +1 -1
- package/dist/eval/record/sealed-assertion.cjs +3 -0
- package/dist/eval/record/sealed-assertion.cjs.map +1 -1
- package/dist/eval/record/verdict.cjs +7 -0
- package/dist/eval/record/verdict.cjs.map +1 -1
- package/dist/expect/index.cjs +8 -2
- package/dist/expect/index.cjs.map +1 -1
- package/dist/expect/index.d.cts +9 -4
- package/dist/expect/index.d.mts +9 -4
- package/dist/expect/index.d.ts +9 -4
- package/dist/expect/index.js +72 -62
- package/dist/expect/index.mjs +72 -62
- package/dist/experiment/host/cli/contribution.cjs +37 -23
- package/dist/experiment/host/cli/contribution.cjs.map +1 -1
- package/dist/experiment/host/cli/contribution.d.cts +9 -1
- package/dist/experiment/host/cli/contribution.d.mts +9 -1
- package/dist/experiment/host/cli/contribution.d.ts +9 -1
- package/dist/experiment/host/current.cjs +74 -0
- package/dist/experiment/host/current.cjs.map +1 -0
- package/dist/experiment/host/current.d.cts +33 -0
- package/dist/experiment/host/current.d.mts +33 -0
- package/dist/experiment/host/current.d.ts +33 -0
- package/dist/experiment/host/current.js +10 -0
- package/dist/experiment/host/current.js.map +1 -0
- package/dist/experiment/host/index.cjs +17 -174
- package/dist/experiment/host/index.cjs.map +1 -1
- package/dist/experiment/host/index.d.cts +8 -54
- package/dist/experiment/host/index.d.mts +8 -54
- package/dist/experiment/host/index.d.ts +8 -54
- package/dist/experiment/host/operations.cjs +33 -10
- package/dist/experiment/host/operations.cjs.map +1 -1
- package/dist/experiment/host/operations.d.cts +29 -1
- package/dist/experiment/host/operations.d.mts +29 -1
- package/dist/experiment/host/operations.d.ts +29 -1
- package/dist/experiment/host/operations.js +6 -4
- package/dist/experiment/host/requirements.cjs +3 -0
- package/dist/experiment/host/requirements.cjs.map +1 -0
- package/dist/experiment/host/requirements.d.cts +3 -0
- package/dist/experiment/host/requirements.d.mts +3 -0
- package/dist/experiment/host/requirements.d.ts +3 -0
- package/dist/experiment/host/requirements.js +4 -0
- package/dist/experiment/host/requirements.js.map +1 -0
- package/dist/experiment/host/runtime.cjs +179 -0
- package/dist/experiment/host/runtime.cjs.map +1 -0
- package/dist/experiment/host/runtime.d.cts +79 -0
- package/dist/experiment/host/runtime.d.mts +79 -0
- package/dist/experiment/host/runtime.d.ts +79 -0
- package/dist/experiment/host/runtime.js +6 -0
- package/dist/experiment/host/runtime.js.map +1 -0
- package/dist/experiment/host/types.cjs.map +1 -1
- package/dist/experiment/host/types.d.cts +17 -16
- package/dist/experiment/host/types.d.mts +17 -16
- package/dist/experiment/host/types.d.ts +17 -16
- package/dist/fresh-import.cjs +2 -1
- package/dist/fresh-import.cjs.map +1 -1
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -6
- package/dist/index.d.mts +12 -6
- package/dist/index.d.ts +12 -6
- package/dist/index.js +32 -30
- package/dist/index.mjs +32 -30
- package/dist/inspection/artifacts.cjs +83 -54
- package/dist/inspection/artifacts.cjs.map +1 -1
- package/dist/inspection/artifacts.d.cts +8 -0
- package/dist/inspection/artifacts.d.mts +8 -0
- package/dist/inspection/artifacts.d.ts +8 -0
- package/dist/inspection/artifacts.js +2 -0
- package/dist/inspection/assertions.cjs +4 -1
- package/dist/inspection/assertions.cjs.map +1 -1
- package/dist/inspection/cli/contribution.cjs +27 -4
- package/dist/inspection/cli/contribution.cjs.map +1 -1
- package/dist/inspection/cli/contribution.d.cts +2 -1
- package/dist/inspection/cli/contribution.d.mts +2 -1
- package/dist/inspection/cli/contribution.d.ts +2 -1
- package/dist/inspection/execution-traces.cjs +114 -8
- package/dist/inspection/execution-traces.cjs.map +1 -1
- package/dist/inspection/execution-traces.d.cts +38 -0
- package/dist/inspection/execution-traces.d.mts +38 -0
- package/dist/inspection/execution-traces.d.ts +38 -0
- package/dist/inspection/facts.cjs +12 -0
- package/dist/inspection/facts.cjs.map +1 -1
- package/dist/inspection/limits.cjs +5 -1
- package/dist/inspection/limits.cjs.map +1 -1
- package/dist/inspection/limits.d.cts +4 -0
- package/dist/inspection/limits.d.mts +4 -0
- package/dist/inspection/limits.d.ts +4 -0
- package/dist/inspection/limits.js +6 -2
- package/dist/inspection/overview.cjs +74 -33
- package/dist/inspection/overview.cjs.map +1 -1
- package/dist/inspection/overview.d.cts +19 -1
- package/dist/inspection/overview.d.mts +19 -1
- package/dist/inspection/overview.d.ts +19 -1
- package/dist/inspection/overview.js +4 -2
- package/dist/inspection/project-input.cjs +9 -0
- package/dist/inspection/project-input.cjs.map +1 -0
- package/dist/inspection/project-input.d.cts +20 -0
- package/dist/inspection/project-input.d.mts +20 -0
- package/dist/inspection/project-input.d.ts +20 -0
- package/dist/inspection/project-input.js +8 -0
- package/dist/inspection/project-input.js.map +1 -0
- package/dist/inspection/project-result.cjs +60 -0
- package/dist/inspection/project-result.cjs.map +1 -0
- package/dist/inspection/project-result.d.cts +1264 -0
- package/dist/inspection/project-result.d.mts +1264 -0
- package/dist/inspection/project-result.d.ts +1264 -0
- package/dist/inspection/project-result.js +10 -0
- package/dist/inspection/project-result.js.map +1 -0
- package/dist/inspection/project-source.cjs +109 -0
- package/dist/inspection/project-source.cjs.map +1 -0
- package/dist/inspection/project-source.d.cts +10 -0
- package/dist/inspection/project-source.d.mts +10 -0
- package/dist/inspection/project-source.d.ts +10 -0
- package/dist/inspection/project-source.js +6 -0
- package/dist/inspection/project-source.js.map +1 -0
- package/dist/inspection/project.cjs +100 -0
- package/dist/inspection/project.cjs.map +1 -0
- package/dist/inspection/project.d.cts +3 -0
- package/dist/inspection/project.d.mts +3 -0
- package/dist/inspection/project.d.ts +3 -0
- package/dist/inspection/project.js +6 -0
- package/dist/inspection/project.js.map +1 -0
- package/dist/inspection/protocol.cjs +19 -9
- package/dist/inspection/protocol.cjs.map +1 -1
- package/dist/inspection/protocol.d.cts +5506 -38189
- package/dist/inspection/protocol.d.mts +5506 -38189
- package/dist/inspection/protocol.d.ts +5506 -38189
- package/dist/inspection/public.mjs +896 -84
- package/dist/inspection/query.cjs +2 -0
- package/dist/inspection/query.cjs.map +1 -1
- package/dist/inspection/results.cjs +234 -29
- package/dist/inspection/results.cjs.map +1 -1
- package/dist/inspection/results.d.cts +870 -13
- package/dist/inspection/results.d.mts +870 -13
- package/dist/inspection/results.d.ts +870 -13
- package/dist/inspection/results.js +36 -34
- package/dist/inspection/select.cjs +126 -14
- package/dist/inspection/select.cjs.map +1 -1
- package/dist/inspection/select.d.cts +1 -1
- package/dist/inspection/select.d.mts +1 -1
- package/dist/inspection/select.d.ts +1 -1
- package/dist/inspection/source.cjs +4 -0
- package/dist/inspection/source.cjs.map +1 -1
- package/dist/inspection/sources.cjs +5 -0
- package/dist/inspection/sources.cjs.map +1 -1
- package/dist/inspection/trace.cjs +82 -84
- package/dist/inspection/trace.cjs.map +1 -1
- package/dist/inspection/trace.d.cts +7 -2
- package/dist/inspection/trace.d.mts +7 -2
- package/dist/inspection/trace.d.ts +7 -2
- package/dist/model-slots.cjs +35 -0
- package/dist/model-slots.cjs.map +1 -0
- package/dist/model-slots.d.cts +19 -0
- package/dist/model-slots.d.mts +19 -0
- package/dist/model-slots.d.ts +19 -0
- package/dist/model-slots.js +8 -0
- package/dist/model-slots.js.map +1 -0
- package/dist/o11y/adapter-call-price.cjs +4 -0
- package/dist/o11y/adapter-call-price.cjs.map +1 -1
- package/dist/o11y/adapter-call-price.d.cts +24 -0
- package/dist/o11y/adapter-call-price.d.mts +24 -0
- package/dist/o11y/adapter-call-price.d.ts +24 -0
- package/dist/o11y/adapter-call-price.js +6 -2
- package/dist/o11y/adapter-usage-projection.cjs +158 -0
- package/dist/o11y/adapter-usage-projection.cjs.map +1 -0
- package/dist/o11y/adapter-usage-projection.d.cts +141 -0
- package/dist/o11y/adapter-usage-projection.d.mts +141 -0
- package/dist/o11y/adapter-usage-projection.d.ts +141 -0
- package/dist/o11y/adapter-usage-projection.js +20 -0
- package/dist/o11y/adapter-usage-projection.js.map +1 -0
- package/dist/o11y/eval-usage.cjs +149 -0
- package/dist/o11y/eval-usage.cjs.map +1 -0
- package/dist/o11y/eval-usage.d.cts +46 -0
- package/dist/o11y/eval-usage.d.mts +46 -0
- package/dist/o11y/eval-usage.d.ts +46 -0
- package/dist/o11y/eval-usage.js +8 -0
- package/dist/o11y/eval-usage.js.map +1 -0
- package/dist/o11y/judge-call-price.cjs +62 -0
- package/dist/o11y/judge-call-price.cjs.map +1 -0
- package/dist/o11y/judge-call-price.d.cts +3 -0
- package/dist/o11y/judge-call-price.d.mts +3 -0
- package/dist/o11y/judge-call-price.d.ts +3 -0
- package/dist/o11y/judge-call-price.js +6 -0
- package/dist/o11y/judge-call-price.js.map +1 -0
- package/dist/o11y/judge-usage-projection.cjs +134 -0
- package/dist/o11y/judge-usage-projection.cjs.map +1 -0
- package/dist/o11y/judge-usage-projection.d.cts +18 -0
- package/dist/o11y/judge-usage-projection.d.mts +18 -0
- package/dist/o11y/judge-usage-projection.d.ts +18 -0
- package/dist/o11y/judge-usage-projection.js +20 -0
- package/dist/o11y/judge-usage-projection.js.map +1 -0
- package/dist/o11y/judge-usage-receipt.cjs +135 -0
- package/dist/o11y/judge-usage-receipt.cjs.map +1 -0
- package/dist/o11y/judge-usage-receipt.d.cts +5 -0
- package/dist/o11y/judge-usage-receipt.d.mts +5 -0
- package/dist/o11y/judge-usage-receipt.d.ts +5 -0
- package/dist/o11y/judge-usage-receipt.js +6 -0
- package/dist/o11y/judge-usage-receipt.js.map +1 -0
- package/dist/o11y/judge-usage.cjs +171 -0
- package/dist/o11y/judge-usage.cjs.map +1 -0
- package/dist/o11y/judge-usage.d.cts +35 -0
- package/dist/o11y/judge-usage.d.mts +35 -0
- package/dist/o11y/judge-usage.d.ts +35 -0
- package/dist/o11y/judge-usage.js +6 -0
- package/dist/o11y/judge-usage.js.map +1 -0
- package/dist/plugin/contracts.cjs +2 -0
- package/dist/plugin/contracts.cjs.map +1 -1
- package/dist/plugin/link.cjs +7 -0
- package/dist/plugin/link.cjs.map +1 -1
- package/dist/record/attachment/protocol.cjs +8 -6
- package/dist/record/attachment/protocol.cjs.map +1 -1
- package/dist/record/attachment/protocol.d.cts +10 -0
- package/dist/record/attachment/protocol.d.mts +10 -0
- package/dist/record/attachment/protocol.d.ts +10 -0
- package/dist/record/attachment/protocol.js +38 -36
- package/dist/record/codec/seal-manifest.d.cts +3 -3
- package/dist/record/codec/seal-manifest.d.mts +3 -3
- package/dist/record/codec/seal-manifest.d.ts +3 -3
- package/dist/record/family/adapter-usage/definition.d.cts +1 -0
- package/dist/record/family/adapter-usage/definition.d.mts +1 -0
- package/dist/record/family/adapter-usage/definition.d.ts +1 -0
- package/dist/record/family/adapter-usage/persistence.cjs +1 -1
- package/dist/record/family/adapter-usage/persistence.cjs.map +1 -1
- package/dist/record/family/adapter-usage/persistence.d.cts +2 -1
- package/dist/record/family/adapter-usage/persistence.d.mts +2 -1
- package/dist/record/family/adapter-usage/persistence.d.ts +2 -1
- package/dist/record/family/adapter-usage/schema.cjs +21 -2
- package/dist/record/family/adapter-usage/schema.cjs.map +1 -1
- package/dist/record/family/adapter-usage/schema.d.cts +85 -0
- package/dist/record/family/adapter-usage/schema.d.mts +85 -0
- package/dist/record/family/adapter-usage/schema.d.ts +85 -0
- package/dist/record/family/adapter-usage/schema.js +18 -12
- package/dist/record/family/catalog.cjs +31 -27
- package/dist/record/family/catalog.cjs.map +1 -1
- package/dist/record/family/catalog.d.cts +94 -3
- package/dist/record/family/catalog.d.mts +94 -3
- package/dist/record/family/catalog.d.ts +94 -3
- package/dist/record/family/current.cjs +45 -42
- package/dist/record/family/current.cjs.map +1 -1
- package/dist/record/family/current.d.cts +240 -1
- package/dist/record/family/current.d.mts +240 -1
- package/dist/record/family/current.d.ts +240 -1
- package/dist/record/family/execution-traces/definition.d.cts +26 -0
- package/dist/record/family/execution-traces/definition.d.mts +26 -0
- package/dist/record/family/execution-traces/definition.d.ts +26 -0
- package/dist/record/family/execution-traces/definition.js +20 -14
- package/dist/record/family/execution-traces/schema.cjs +57 -1
- package/dist/record/family/execution-traces/schema.cjs.map +1 -1
- package/dist/record/family/execution-traces/schema.d.cts +114 -0
- package/dist/record/family/execution-traces/schema.d.mts +114 -0
- package/dist/record/family/execution-traces/schema.d.ts +114 -0
- package/dist/record/family/execution-traces/schema.js +18 -12
- package/dist/record/family/judge-usage/definition.cjs +12 -0
- package/dist/record/family/judge-usage/definition.cjs.map +1 -0
- package/dist/record/family/judge-usage/definition.d.cts +91 -0
- package/dist/record/family/judge-usage/definition.d.mts +91 -0
- package/dist/record/family/judge-usage/definition.d.ts +91 -0
- package/dist/record/family/judge-usage/definition.js +6 -0
- package/dist/record/family/judge-usage/definition.js.map +1 -0
- package/dist/record/family/judge-usage/persistence.cjs +10 -0
- package/dist/record/family/judge-usage/persistence.cjs.map +1 -0
- package/dist/record/family/judge-usage/persistence.d.cts +91 -0
- package/dist/record/family/judge-usage/persistence.d.mts +91 -0
- package/dist/record/family/judge-usage/persistence.d.ts +91 -0
- package/dist/record/family/judge-usage/persistence.js +6 -0
- package/dist/record/family/judge-usage/persistence.js.map +1 -0
- package/dist/record/family/judge-usage/schema.cjs +307 -0
- package/dist/record/family/judge-usage/schema.cjs.map +1 -0
- package/dist/record/family/judge-usage/schema.d.cts +351 -0
- package/dist/record/family/judge-usage/schema.d.mts +351 -0
- package/dist/record/family/judge-usage/schema.d.ts +351 -0
- package/dist/record/family/judge-usage/schema.js +18 -0
- package/dist/record/family/judge-usage/schema.js.map +1 -0
- package/dist/record/host/sqlite-host.cjs +55 -9
- package/dist/record/host/sqlite-host.cjs.map +1 -1
- package/dist/record/host/types.cjs.map +1 -1
- package/dist/record/host/types.d.cts +7 -0
- package/dist/record/host/types.d.mts +7 -0
- package/dist/record/host/types.d.ts +7 -0
- package/dist/record/model/run-context.cjs +7 -1
- package/dist/record/model/run-context.cjs.map +1 -1
- package/dist/record/model/run-context.d.cts +4 -0
- package/dist/record/model/run-context.d.mts +4 -0
- package/dist/record/model/run-context.d.ts +4 -0
- package/dist/record/model/seal-manifest.d.cts +1 -1
- package/dist/record/model/seal-manifest.d.mts +1 -1
- package/dist/record/model/seal-manifest.d.ts +1 -1
- package/dist/record/sqlite/client.cjs +18 -5
- package/dist/record/sqlite/client.cjs.map +1 -1
- package/dist/record/sqlite/client.d.cts +1 -1
- package/dist/record/sqlite/client.d.mts +1 -1
- package/dist/record/sqlite/client.d.ts +1 -1
- package/dist/record/sqlite/project-state-database.cjs +29 -8
- package/dist/record/sqlite/project-state-database.cjs.map +1 -1
- package/dist/run/host/runtime.cjs +4 -0
- package/dist/run/host/runtime.cjs.map +1 -1
- package/dist/run/storage/sqlite.cjs +20 -0
- package/dist/run/storage/sqlite.cjs.map +1 -1
- package/dist/runner/adapter-execution-trace.cjs +125 -2
- package/dist/runner/adapter-execution-trace.cjs.map +1 -1
- package/dist/runner/adapter-execution-trace.d.cts +1 -1
- package/dist/runner/adapter-execution-trace.d.mts +1 -1
- package/dist/runner/adapter-execution-trace.d.ts +1 -1
- package/dist/runner/adapter-usage.cjs +55 -7
- package/dist/runner/adapter-usage.cjs.map +1 -1
- package/dist/runner/adapter-usage.d.cts +9 -2
- package/dist/runner/adapter-usage.d.mts +9 -2
- package/dist/runner/adapter-usage.d.ts +9 -2
- package/dist/runner/adoption.cjs +9 -0
- package/dist/runner/adoption.cjs.map +1 -1
- package/dist/runner/attempt-cancellation.cjs +12 -0
- package/dist/runner/attempt-cancellation.cjs.map +1 -0
- package/dist/runner/attempt-cancellation.d.cts +6 -0
- package/dist/runner/attempt-cancellation.d.mts +6 -0
- package/dist/runner/attempt-cancellation.d.ts +6 -0
- package/dist/runner/attempt-cancellation.js +6 -0
- package/dist/runner/attempt-cancellation.js.map +1 -0
- package/dist/runner/attempt-resources.cjs +10 -4
- package/dist/runner/attempt-resources.cjs.map +1 -1
- package/dist/runner/attempt-resources.d.cts +2 -1
- package/dist/runner/attempt-resources.d.mts +2 -1
- package/dist/runner/attempt-resources.d.ts +2 -1
- package/dist/runner/attempt.cjs +1177 -1139
- package/dist/runner/attempt.cjs.map +1 -1
- package/dist/runner/config-identity.cjs +20 -1
- package/dist/runner/config-identity.cjs.map +1 -1
- package/dist/runner/config-identity.d.cts +5 -0
- package/dist/runner/config-identity.d.mts +5 -0
- package/dist/runner/config-identity.d.ts +5 -0
- package/dist/runner/discover.cjs +14 -0
- package/dist/runner/discover.cjs.map +1 -1
- package/dist/runner/discover.d.cts +3 -0
- package/dist/runner/discover.d.mts +3 -0
- package/dist/runner/discover.d.ts +3 -0
- package/dist/runner/feedback/human.cjs +9 -4
- package/dist/runner/feedback/human.cjs.map +1 -1
- package/dist/runner/fingerprint.cjs +1 -0
- package/dist/runner/fingerprint.cjs.map +1 -1
- package/dist/runner/judge-usage.cjs +18 -0
- package/dist/runner/judge-usage.cjs.map +1 -0
- package/dist/runner/judge-usage.d.cts +5 -0
- package/dist/runner/judge-usage.d.mts +5 -0
- package/dist/runner/judge-usage.d.ts +5 -0
- package/dist/runner/judge-usage.js +8 -0
- package/dist/runner/judge-usage.js.map +1 -0
- package/dist/runner/project-target.cjs.map +1 -1
- package/dist/runner/project-target.d.cts +2 -0
- package/dist/runner/project-target.d.mts +2 -0
- package/dist/runner/project-target.d.ts +2 -0
- package/dist/runner/record/planning.cjs +1 -0
- package/dist/runner/record/planning.cjs.map +1 -1
- package/dist/runner/record.cjs +4 -0
- package/dist/runner/record.cjs.map +1 -1
- package/dist/runner/reporters/braintrust.cjs +2 -0
- package/dist/runner/reporters/braintrust.cjs.map +1 -1
- package/dist/runner/reuse-diagnostics.cjs +9 -10
- package/dist/runner/reuse-diagnostics.cjs.map +1 -1
- package/dist/runner/reuse-diagnostics.d.cts +5 -6
- package/dist/runner/reuse-diagnostics.d.mts +5 -6
- package/dist/runner/reuse-diagnostics.d.ts +5 -6
- package/dist/runner/reuse-diagnostics.js +4 -4
- package/dist/runner/reuse-plan.cjs +100 -48
- package/dist/runner/reuse-plan.cjs.map +1 -1
- package/dist/runner/reuse-plan.d.cts +60 -3
- package/dist/runner/reuse-plan.d.mts +60 -3
- package/dist/runner/reuse-plan.d.ts +60 -3
- package/dist/runner/reuse-plan.js +14 -10
- package/dist/runner/run.cjs +8 -6
- package/dist/runner/run.cjs.map +1 -1
- package/dist/runner/session.cjs +1 -1
- package/dist/runner/session.cjs.map +1 -1
- package/dist/runner/session.d.cts +1 -1
- package/dist/runner/session.d.mts +1 -1
- package/dist/runner/session.d.ts +1 -1
- package/dist/runner/source-producer.cjs +3 -1
- package/dist/runner/source-producer.cjs.map +1 -1
- package/dist/runner/types.cjs.map +1 -1
- package/dist/runner/types.d.cts +26 -5
- package/dist/runner/types.d.mts +26 -5
- package/dist/runner/types.d.ts +26 -5
- package/dist/sandbox/action.cjs +3 -0
- package/dist/sandbox/action.cjs.map +1 -1
- package/dist/sandbox/commands.cjs +3 -0
- package/dist/sandbox/commands.cjs.map +1 -1
- package/dist/sandbox/compose.cjs +6 -0
- package/dist/sandbox/compose.cjs.map +1 -1
- package/dist/sandbox/docker-profile/registry.cjs +7 -0
- package/dist/sandbox/docker-profile/registry.cjs.map +1 -1
- package/dist/sandbox/docker-profile/runtime.cjs +3 -0
- package/dist/sandbox/docker-profile/runtime.cjs.map +1 -1
- package/dist/sandbox/docker-profile/schema.cjs +7 -0
- package/dist/sandbox/docker-profile/schema.cjs.map +1 -1
- package/dist/sandbox/incus.cjs +7 -0
- package/dist/sandbox/incus.cjs.map +1 -1
- package/dist/sandbox/layer.cjs +12 -0
- package/dist/sandbox/layer.cjs.map +1 -1
- package/dist/shared/adapter-cleanup.cjs +18 -0
- package/dist/shared/adapter-cleanup.cjs.map +1 -0
- package/dist/shared/adapter-cleanup.d.cts +4 -0
- package/dist/shared/adapter-cleanup.d.mts +4 -0
- package/dist/shared/adapter-cleanup.d.ts +4 -0
- package/dist/shared/adapter-cleanup.js +10 -0
- package/dist/shared/adapter-cleanup.js.map +1 -0
- package/dist/shared/attempt-lifecycle.cjs +3 -0
- package/dist/shared/attempt-lifecycle.cjs.map +1 -0
- package/dist/shared/attempt-lifecycle.d.cts +13 -0
- package/dist/shared/attempt-lifecycle.d.mts +13 -0
- package/dist/shared/attempt-lifecycle.d.ts +13 -0
- package/dist/shared/attempt-lifecycle.js +4 -0
- package/dist/shared/attempt-lifecycle.js.map +1 -0
- package/dist/show/contribution.cjs +52 -14
- package/dist/show/contribution.cjs.map +1 -1
- package/dist/show/contribution.d.cts +23 -1
- package/dist/show/contribution.d.mts +23 -1
- package/dist/show/contribution.d.ts +23 -1
- package/dist/show/model.cjs +8 -1
- package/dist/show/model.cjs.map +1 -1
- package/dist/show/model.d.cts +10 -1
- package/dist/show/model.d.mts +10 -1
- package/dist/show/model.d.ts +10 -1
- package/dist/show/render.cjs +287 -49
- package/dist/show/render.cjs.map +1 -1
- package/dist/show/render.d.cts +3 -0
- package/dist/show/render.d.mts +3 -0
- package/dist/show/render.d.ts +3 -0
- package/dist/sources/projector.cjs +3 -0
- package/dist/sources/projector.cjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/view/app-dist/.vite/manifest.json +2 -2
- package/dist/view/app-dist/assets/index-CmVoXbwG.js +63 -0
- package/dist/view/app-dist/assets/{quality-cost-scatter-CFB3wnkN.js → quality-cost-scatter-BuLISaH4.js} +1 -1
- package/dist/view/app-dist/index.html +1 -1
- package/dist/view/cli/contribution.cjs +54 -21
- package/dist/view/cli/contribution.cjs.map +1 -1
- package/dist/view/cli/contribution.d.cts +2 -1
- package/dist/view/cli/contribution.d.mts +2 -1
- package/dist/view/cli/contribution.d.ts +2 -1
- package/dist/view/function-runtime.mjs +13231 -11647
- package/dist/view/http-protocol.cjs +3 -0
- package/dist/view/http-protocol.cjs.map +1 -1
- package/dist/view/http-protocol.d.cts +8 -0
- package/dist/view/http-protocol.d.mts +8 -0
- package/dist/view/http-protocol.d.ts +8 -0
- package/dist/view/inspection-host.cjs +17 -1
- package/dist/view/inspection-host.cjs.map +1 -1
- package/dist/view/render.cjs +1 -0
- package/dist/view/render.cjs.map +1 -1
- package/dist/view/render.d.cts +2 -1
- package/dist/view/render.d.mts +2 -1
- package/dist/view/render.d.ts +2 -1
- package/dist/view/revision.cjs.map +1 -1
- package/dist/view/revision.d.cts +12 -0
- package/dist/view/revision.d.mts +12 -0
- package/dist/view/revision.d.ts +12 -0
- package/dist/view/server.cjs +10 -9
- package/dist/view/server.cjs.map +1 -1
- package/docs-site/zh/examples/ai-agent-application.mdx +1 -1
- package/docs-site/zh/explanation/adapter.mdx +2 -2
- package/docs-site/zh/explanation/assert.mdx +60 -24
- package/docs-site/zh/explanation/drive.mdx +1 -1
- package/docs-site/zh/explanation/evals.mdx +31 -29
- package/docs-site/zh/explanation/experiment.mdx +15 -15
- package/docs-site/zh/explanation/judge.mdx +23 -15
- package/docs-site/zh/explanation/overview.mdx +44 -21
- package/docs-site/zh/explanation/record.mdx +28 -13
- package/docs-site/zh/explanation/results-flow.mdx +37 -0
- package/docs-site/zh/explanation/runner.mdx +27 -6
- package/docs-site/zh/index.mdx +22 -115
- package/docs-site/zh/introduction.mdx +89 -61
- package/docs-site/zh/reference/cli.mdx +50 -26
- package/docs-site/zh/reference/define-agent.mdx +37 -5
- package/docs-site/zh/reference/define-eval.mdx +130 -29
- package/docs-site/zh/reference/define-experiment.mdx +251 -0
- package/docs-site/zh/reference/events.mdx +34 -30
- package/docs-site/zh/reference/expect.mdx +77 -2
- package/docs-site/zh/reference/official-adapters.mdx +2 -2
- package/docs-site/zh/troubleshooting/debug-sandbox.mdx +43 -24
- package/docs-site/zh/troubleshooting/debugging.mdx +65 -42
- package/docs-site/zh/troubleshooting/recover-after-kill.mdx +35 -28
- package/docs-site/zh/tutorials/accept-results.mdx +34 -24
- package/docs-site/zh/tutorials/agent-feedback-loop.mdx +74 -43
- package/docs-site/zh/tutorials/agent-onboarding.mdx +27 -20
- package/docs-site/zh/tutorials/authoring.mdx +138 -121
- package/docs-site/zh/tutorials/ci-integration.mdx +46 -22
- package/docs-site/zh/tutorials/compare-runs.mdx +40 -13
- package/docs-site/zh/tutorials/concurrency.mdx +66 -62
- package/docs-site/zh/tutorials/configuration.mdx +17 -17
- package/docs-site/zh/tutorials/connect-otel.mdx +48 -37
- package/docs-site/zh/tutorials/connect-your-agent.mdx +80 -173
- package/docs-site/zh/tutorials/control-run-cost.mdx +63 -12
- package/docs-site/zh/tutorials/criteria-files.mdx +28 -21
- package/docs-site/zh/tutorials/custom-application.mdx +75 -55
- package/docs-site/zh/tutorials/dataset-fanout.mdx +32 -22
- package/docs-site/zh/tutorials/debug-lifecycle-plan.mdx +38 -31
- package/docs-site/zh/tutorials/docker-in-docker.mdx +83 -89
- package/docs-site/zh/tutorials/eval-groups.mdx +70 -89
- package/docs-site/zh/tutorials/evaluation-kinds.mdx +12 -5
- package/docs-site/zh/tutorials/experiment-services.mdx +243 -0
- package/docs-site/zh/tutorials/fixtures.mdx +42 -26
- package/docs-site/zh/tutorials/handle-execution-failures.mdx +41 -19
- package/docs-site/zh/tutorials/install-custom-sandbox-agent.mdx +21 -16
- package/docs-site/zh/tutorials/niceeval-taste-application.mdx +394 -0
- package/docs-site/zh/tutorials/niceeval-taste.mdx +190 -0
- package/docs-site/zh/tutorials/nixos-managed-dind.mdx +51 -39
- package/docs-site/zh/tutorials/plugins.mdx +55 -31
- package/docs-site/zh/tutorials/prebuilt-sandbox.mdx +204 -0
- package/docs-site/zh/tutorials/quickstart.mdx +91 -47
- package/docs-site/zh/tutorials/reporters.mdx +45 -30
- package/docs-site/zh/tutorials/rerun-and-cache.mdx +39 -40
- package/docs-site/zh/tutorials/sandbox-agent.mdx +65 -40
- package/docs-site/zh/tutorials/sandbox-providers.mdx +104 -282
- package/docs-site/zh/tutorials/sandbox-reuse.mdx +65 -97
- package/docs-site/zh/tutorials/select-and-preview.mdx +25 -20
- package/docs-site/zh/tutorials/verify-judge.mdx +49 -26
- package/docs-site/zh/tutorials/viewing-results.mdx +130 -80
- package/docs-site/zh/tutorials/write-experiment.mdx +116 -298
- package/docs-site/zh/tutorials/write-send.mdx +53 -52
- package/node_modules/undici/docs/docs/api/Agent.md +8 -8
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
- package/node_modules/undici/docs/docs/api/Errors.md +25 -0
- package/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
- package/node_modules/undici/docs/docs/api/Pool.md +5 -6
- package/node_modules/undici/lib/api/readable.js +1 -2
- package/node_modules/undici/lib/core/request.js +23 -2
- package/node_modules/undici/lib/core/util.js +0 -39
- package/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
- package/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
- package/node_modules/undici/lib/dispatcher/client.js +1 -1
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +3 -2
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
- package/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
- package/node_modules/undici/lib/dispatcher/pool.js +90 -7
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
- package/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
- package/node_modules/undici/lib/handler/redirect-handler.js +5 -0
- package/node_modules/undici/lib/handler/retry-handler.js +72 -13
- package/node_modules/undici/lib/interceptor/cache.js +4 -1
- package/node_modules/undici/lib/interceptor/decompress.js +236 -69
- package/node_modules/undici/lib/web/cache/cache.js +17 -8
- package/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
- package/node_modules/undici/lib/web/cookies/index.js +19 -7
- package/node_modules/undici/lib/web/cookies/util.js +3 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
- package/node_modules/undici/lib/web/fetch/body.js +22 -15
- package/node_modules/undici/lib/web/fetch/data-url.js +6 -6
- package/node_modules/undici/lib/web/fetch/formdata.js +30 -36
- package/node_modules/undici/lib/web/fetch/headers.js +34 -31
- package/node_modules/undici/lib/web/fetch/index.js +38 -14
- package/node_modules/undici/lib/web/fetch/request.js +74 -79
- package/node_modules/undici/lib/web/fetch/response.js +43 -44
- package/node_modules/undici/lib/web/fetch/util.js +7 -7
- package/node_modules/undici/lib/web/infra/index.js +16 -1
- package/node_modules/undici/lib/web/webidl/index.js +2 -14
- package/node_modules/undici/lib/web/websocket/events.js +43 -26
- package/node_modules/undici/lib/web/websocket/receiver.js +5 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
- package/node_modules/undici/lib/web/websocket/websocket.js +44 -41
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/diagnostics-channel.d.ts +2 -1
- package/node_modules/undici/types/interceptors.d.ts +1 -1
- package/node_modules/undici/types/webidl.d.ts +13 -7
- package/package.json +4 -4
- package/dist/view/app-dist/assets/index-DFzw1L97.js +0 -63
- package/docs-site/zh/tutorials/experiments.mdx +0 -101
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.js","sourceRoot":"","sources":["collection.ts"],"names":[],"mappings":";;AAgGA,wDA6BC;AACD,8DAIC;AAWD,sEAKC;AACD,4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C9B,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,cAAc,CAAC,MAAM,IAAA,0CAAoB,EAAC;gBACvD,cAAc,EAAE,qBAAqB;gBACrC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,OAAO;aACV,CAAC,EAAE,OAAO,CAAC;YACZ,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;SAC1B,CAAC;KACL,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { Effect } from \"effect\";\nimport type { AssertionCoverage, AssertionCriterion, AssertionLimitation, BooleanAssertionEvaluation, BooleanAssertionRegistration, MatcherSourceSnapshot, } from \"./api.ts\";\nimport { evaluateMatcherCollection, evaluateMatcherOrder, interruptedMatcherArtifact, type MatcherQuery, type MatcherSourceRow, } from \"./matcher-artifact.ts\";\nimport type { LogicalToolOccurrence } from \"../o11y/types.ts\";\nimport { collectionMatchSpecOf, assertionEventOccurrence, evaluateBooleanMatch, isManagedEventMatch, isManagedCollectionMatch, isManagedToolMatch, isNumericComparisonMatch, looksLikeCollectionMatch, type BooleanMatchEvaluation, type CollectionMatch, type EventMatch, type EventOccurrenceView, type ManagedEventOccurrences, type ManagedToolCalls, type NumericMaterial, type ToolMatch, type ToolMatchQuantifier, type ToolOccurrenceView, } from \"./match.ts\";\nimport { numericBooleanRegistration } from \"./numeric.ts\";\nimport { captureAssertionSnapshot } from \"./runtime.ts\";\ntype ProjectedMatcherCandidate<Candidate> = {\n readonly state: \"available\";\n readonly value: Candidate;\n} | {\n readonly state: \"unavailable\";\n readonly reason: string;\n};\nexport interface ManagedToolCallsSidecar {\n readonly scope: \"turn\" | \"session\" | \"attempt\";\n readonly cardinality: NumericMaterial;\n readonly sourceSnapshot: MatcherSourceSnapshot;\n readonly rows: readonly MatcherSourceRow<ProjectedMatcherCandidate<LogicalToolOccurrence>>[];\n readonly coverage: AssertionCoverage;\n readonly limitations: readonly AssertionLimitation[];\n readonly actionsCoverage: unknown;\n readonly orphanFinishCount: number;\n readonly snapshot: unknown;\n}\nconst managedToolCallsSidecars = new WeakMap<object, ManagedToolCallsSidecar>();\nexport interface ManagedEventOccurrencesSidecar {\n readonly scope: \"turn\" | \"session\" | \"attempt\";\n readonly sourceSnapshot: MatcherSourceSnapshot;\n readonly rows: readonly MatcherSourceRow<{\n readonly state: \"available\";\n readonly value: EventOccurrenceView;\n }>[];\n readonly coverage: unknown;\n readonly snapshot: unknown;\n readonly unassociatedOperation: boolean;\n}\nconst managedEventOccurrencesSidecars = new WeakMap<object, ManagedEventOccurrencesSidecar>();\nfunction occurrenceView(row: MatcherSourceRow<ProjectedMatcherCandidate<LogicalToolOccurrence>>): ToolOccurrenceView {\n if (row.candidate.state !== \"available\") {\n return Object.freeze({ name: \"unknown\" });\n }\n const occurrence = row.candidate.value;\n const name = occurrence.name.canonical === undefined || occurrence.name.canonical === \"unknown\"\n ? occurrence.name.original\n : occurrence.name.canonical;\n return Object.freeze({\n name,\n ...(occurrence.input.state === \"unavailable\" ? {} : { input: occurrence.input.value }),\n ...(occurrence.output.state === \"unavailable\" ? {} : { output: occurrence.output.value }),\n ...(occurrence.lifecycle.state === \"available\" ? { status: occurrence.lifecycle.status } : {}),\n });\n}\nfunction foldedSourceSnapshot(snapshot: MatcherSourceSnapshot, incompleteReason: string | undefined): MatcherSourceSnapshot {\n if (snapshot.collectionAtCut === \"unavailable\")\n return snapshot;\n if (snapshot.collectionAtCut === \"partial\" || incompleteReason !== undefined) {\n return snapshot.collectionAtCut === \"partial\"\n ? snapshot\n : Object.freeze({ ...snapshot, collectionAtCut: \"partial\" as const });\n }\n return snapshot;\n}\nfunction cardinalityMaterial(input: {\n readonly collectionAtCut: MatcherSourceSnapshot[\"collectionAtCut\"];\n readonly knownLength: number;\n}): NumericMaterial {\n if (input.collectionAtCut === \"unavailable\") {\n return Object.freeze({ state: \"unavailable\" as const, reason: \"source-unavailable\" });\n }\n if (input.collectionAtCut === \"complete\") {\n return Object.freeze({ state: \"exact\" as const, value: input.knownLength });\n }\n return Object.freeze({ state: \"lower-bound\" as const, value: input.knownLength });\n}\nfunction cardinalityCoverage(material: NumericMaterial): {\n readonly coverage: AssertionCoverage;\n readonly limitations: readonly AssertionLimitation[];\n} {\n if (material.state === \"unavailable\") {\n return Object.freeze({\n coverage: Object.freeze({ state: \"unavailable\" as const, reason: \"source-unavailable\" as const }),\n limitations: Object.freeze([]),\n });\n }\n if (material.state === \"lower-bound\") {\n return Object.freeze({\n coverage: Object.freeze({ state: \"partial\" as const, reason: \"provider-limited\" as const }),\n limitations: Object.freeze([{ kind: \"provider-limited\" as const }]),\n });\n }\n return Object.freeze({\n coverage: Object.freeze({ state: \"complete\" as const }),\n limitations: Object.freeze([]),\n });\n}\nexport function freezeManagedToolCalls(input: {\n readonly scope: \"turn\" | \"session\" | \"attempt\";\n readonly sourceSnapshot: MatcherSourceSnapshot;\n readonly rows: readonly MatcherSourceRow<ProjectedMatcherCandidate<LogicalToolOccurrence>>[];\n readonly incompleteReason?: string;\n readonly actionsCoverage: unknown;\n readonly orphanFinishCount: number;\n readonly snapshot: unknown;\n}): ManagedToolCalls {\n const views = Object.freeze(input.rows.map(occurrenceView));\n const collection = Object.freeze(views) as ManagedToolCalls;\n const sourceSnapshot = foldedSourceSnapshot(input.sourceSnapshot, input.incompleteReason);\n const cardinality = cardinalityMaterial({\n collectionAtCut: sourceSnapshot.collectionAtCut,\n knownLength: input.rows.length,\n });\n const coverage = cardinalityCoverage(cardinality);\n managedToolCallsSidecars.set(collection, Object.freeze({\n scope: input.scope,\n cardinality,\n sourceSnapshot,\n rows: input.rows,\n coverage: coverage.coverage,\n limitations: coverage.limitations,\n actionsCoverage: input.actionsCoverage,\n orphanFinishCount: input.orphanFinishCount,\n snapshot: input.snapshot,\n }));\n return collection;\n}\nexport function managedToolCallsSidecarOf(value: unknown): ManagedToolCallsSidecar | undefined {\n return typeof value === \"object\" && value !== null\n ? managedToolCallsSidecars.get(value)\n : undefined;\n}\nfunction eventOccurrenceView(event: EventOccurrenceView): EventOccurrenceView {\n if (event.type === \"message\") {\n return Object.freeze({ type: event.type, role: event.role, text: event.text });\n }\n return Object.freeze({\n type: event.type,\n tool: Object.freeze({ name: event.tool.name }),\n ...(event.type === \"operation.finished\" ? { status: event.status } : {}),\n }) as EventOccurrenceView;\n}\nexport function freezeManagedEventOccurrences(input: ManagedEventOccurrencesSidecar): ManagedEventOccurrences {\n const views = Object.freeze(input.rows.map((row) => eventOccurrenceView(row.candidate.value)));\n const collection = Object.freeze(views) as ManagedEventOccurrences;\n managedEventOccurrencesSidecars.set(collection, Object.freeze({ ...input }));\n return collection;\n}\nexport function managedEventOccurrencesSidecarOf(value: unknown): ManagedEventOccurrencesSidecar | undefined {\n return typeof value === \"object\" && value !== null\n ? managedEventOccurrencesSidecars.get(value)\n : undefined;\n}\nfunction unavailableMatcherCandidate(reason: string): BooleanMatchEvaluation<never> {\n return Object.freeze({\n state: \"unavailable\" as const,\n reason,\n diagnostic: Object.freeze({\n code: \"source-candidate-unavailable\",\n message: \"the matcher candidate could not be resolved from the immutable source ledger\",\n path: Object.freeze([]),\n reason,\n }),\n });\n}\nfunction toolMatchEvaluation(occurrence: LogicalToolOccurrence, result: BooleanMatchEvaluation<unknown>): BooleanMatchEvaluation<unknown> {\n if (occurrence.lifecycle.state === \"opaque\" && result.state === \"matched\") {\n return Object.freeze({\n state: \"unavailable\" as const,\n reason: `tool-lifecycle-unavailable:${occurrence.lifecycle.reason}`,\n diagnostic: Object.freeze({\n code: \"tool-lifecycle-unavailable\",\n message: \"the matching tool lifecycle is incomplete\",\n path: Object.freeze([]),\n reason: occurrence.lifecycle.reason,\n }),\n });\n }\n return result;\n}\nfunction toolMatcherQuery(match: ToolMatch, summary: import(\"./api.ts\").AssertionSnapshotValue = Object.freeze({\n matcher: match.name,\n})): MatcherQuery<ProjectedMatcherCandidate<LogicalToolOccurrence>> {\n return Object.freeze({\n summary,\n evaluate: async (candidate: ProjectedMatcherCandidate<LogicalToolOccurrence>) => candidate.state === \"unavailable\"\n ? unavailableMatcherCandidate(candidate.reason)\n : toolMatchEvaluation(candidate.value, await evaluateBooleanMatch(match, candidate.value)),\n });\n}\nfunction eventMatcherQuery(match: EventMatch, summary: import(\"./api.ts\").AssertionSnapshotValue = Object.freeze({ matcher: match.name })): MatcherQuery<ProjectedMatcherCandidate<EventOccurrenceView>> {\n return Object.freeze({\n summary,\n evaluate: async (candidate: ProjectedMatcherCandidate<EventOccurrenceView>) => {\n if (candidate.state === \"unavailable\")\n return unavailableMatcherCandidate(candidate.reason);\n const result = await evaluateBooleanMatch(match, candidate.value);\n const occurrence = assertionEventOccurrence(candidate.value);\n return occurrence === undefined ? result : toolMatchEvaluation(occurrence, result);\n },\n });\n}\nfunction occurrenceAssertion(quantifier: ToolMatchQuantifier): \"present\" | \"absent\" | \"count\" {\n if (quantifier.kind === \"absent\")\n return \"absent\";\n if (quantifier.kind === \"exact\")\n return \"count\";\n return quantifier.kind === \"at-least\" && quantifier.count === 1 ? \"present\" : \"count\";\n}\nfunction occurrenceCriterion(scope: \"turn\" | \"session\" | \"attempt\", matcher: string | undefined, quantifier: ToolMatchQuantifier): AssertionCriterion {\n return Object.freeze({\n kind: \"occurrence\" as const,\n scope,\n occurrence: \"tool\" as const,\n assertion: occurrenceAssertion(quantifier),\n ...(matcher === undefined ? {} : { matcher }),\n quantifier: Object.freeze(quantifier.kind === \"absent\"\n ? { kind: \"absent\" as const }\n : { kind: quantifier.kind, count: quantifier.count }),\n });\n}\nfunction orderCriterion(scope: \"turn\" | \"session\", matches: readonly ToolMatch[]): AssertionCriterion {\n return Object.freeze({\n kind: \"occurrence\" as const,\n scope,\n occurrence: \"tool\" as const,\n assertion: \"order\" as const,\n matcher: matches.map((match) => match.name).join(\", \"),\n });\n}\nfunction matchedSubject<Subject>(evaluation: BooleanAssertionEvaluation<void>, subject: Subject): BooleanAssertionEvaluation<Subject> {\n if (evaluation.state === \"matched\") {\n return Object.freeze({ ...evaluation, value: subject });\n }\n return evaluation as BooleanAssertionEvaluation<Subject>;\n}\nexport function collectionMatchRegistration<Subject>(subject: Subject, match: unknown): BooleanAssertionRegistration<Subject> {\n const sidecar = managedToolCallsSidecarOf(subject);\n const eventSidecar = managedEventOccurrencesSidecarOf(subject);\n if (isNumericComparisonMatch(match)) {\n if (eventSidecar !== undefined) {\n throw new TypeError(\"numeric Match cannot be used with managed eventOccurrences\");\n }\n if (sidecar !== undefined) {\n const captured = captureAssertionSnapshot(Object.freeze({\n ...sidecar.cardinality,\n cut: sidecar.snapshot,\n coverage: sidecar.coverage,\n collection: \"tool-calls\",\n scope: sidecar.scope,\n }));\n return numericBooleanRegistration({\n match,\n criterionSubject: Object.freeze({\n kind: \"collection-cardinality\" as const,\n collection: \"tool-calls\" as const,\n scope: sidecar.scope,\n }),\n material: sidecar.cardinality,\n captured: Object.freeze({\n ...captured,\n coverage: sidecar.coverage,\n limitations: sidecar.limitations,\n }),\n matchedValue: () => subject,\n });\n }\n if (!Array.isArray(subject)) {\n throw new TypeError(\"a numeric collection Match requires an array subject\");\n }\n const material = Object.freeze({ state: \"exact\" as const, value: subject.length });\n const captured = captureAssertionSnapshot(Object.freeze({\n ...material,\n cut: Object.freeze({ kind: \"author-array\" as const }),\n coverage: Object.freeze({ state: \"complete\" as const }),\n derivation: Object.freeze({ kind: \"explicit-value\" as const }),\n }));\n return numericBooleanRegistration({\n match,\n criterionSubject: Object.freeze({ kind: \"explicit-value\" as const }),\n material,\n captured,\n matchedValue: () => subject,\n });\n }\n const spec = isManagedToolMatch(match) || isManagedEventMatch(match)\n ? Object.freeze({\n kind: \"occurrence\" as const,\n domain: isManagedEventMatch(match) ? \"event\" as const : \"tool\" as const,\n item: match,\n quantifier: Object.freeze({ kind: \"at-least\" as const, count: 1 }),\n })\n : (() => {\n if (!isManagedCollectionMatch(match)) {\n if (looksLikeCollectionMatch(match)) {\n throw new TypeError(\"t.check() match must be a collection Match created by niceeval/expect\");\n }\n throw new TypeError(\"t.check() match must be a ToolMatch or collection Match created by niceeval/expect\");\n }\n return collectionMatchSpecOf(match);\n })();\n const domainSidecar = spec.domain === \"event\" ? eventSidecar : sidecar;\n if (domainSidecar === undefined) {\n throw new TypeError(spec.kind === \"in-order\"\n ? `inOrder() requires managed ${spec.domain === \"event\" ? \"eventOccurrences\" : \"toolCalls\"}`\n : `${spec.domain === \"event\" ? \"EventMatch\" : \"ToolMatch\"} occurrence checks require managed ${spec.domain === \"event\" ? \"eventOccurrences\" : \"toolCalls\"}`);\n }\n if (spec.domain === \"event\") {\n const managed = eventSidecar!;\n if (spec.kind === \"occurrence\") {\n const item = spec.item as EventMatch;\n const query = eventMatcherQuery(item, Object.freeze({ matcher: item.name, quantifier: spec.quantifier }));\n const captured = captureAssertionSnapshot({\n scope: managed.scope,\n occurrence: \"event\",\n matcher: item.name,\n quantifier: spec.quantifier,\n candidateCount: managed.rows.length,\n unassociatedOperation: managed.unassociatedOperation,\n coverage: managed.coverage,\n snapshot: managed.snapshot,\n });\n return Object.freeze({\n criterion: Object.freeze({\n ...occurrenceCriterion(managed.scope, item.name, spec.quantifier),\n occurrence: \"event\" as const,\n }),\n subject: captured.material,\n coverage: captured.coverage,\n limitations: captured.limitations,\n interruptedMatcherArtifact: interruptedMatcherArtifact({\n sourceSnapshot: managed.sourceSnapshot,\n sourceRows: managed.rows.length,\n queries: Object.freeze([query.summary]),\n kind: \"collection-filter\",\n }),\n evaluate: () => Effect.tryPromise({\n try: async () => matchedSubject(await evaluateMatcherCollection({\n sourceSnapshot: managed.sourceSnapshot,\n rows: managed.rows,\n query,\n quantifier: spec.quantifier,\n }), subject),\n catch: (error) => error,\n }),\n });\n }\n if (managed.scope === \"attempt\" || managed.sourceSnapshot.scope === \"attempt\") {\n throw new TypeError(\"inOrder() is unavailable at Attempt scope\");\n }\n const orderedSourceSnapshot = managed.sourceSnapshot as Exclude<MatcherSourceSnapshot, {\n readonly scope: \"attempt\";\n }>;\n const matches = spec.matches as readonly EventMatch[];\n const queries = Object.freeze(matches.map(eventMatcherQuery));\n const captured = captureAssertionSnapshot({\n scope: managed.scope,\n occurrence: \"event\",\n assertion: \"event-order\",\n matches: matches.map((item) => item.name),\n candidateCount: managed.rows.length,\n coverage: managed.coverage,\n snapshot: managed.snapshot,\n });\n return Object.freeze({\n criterion: Object.freeze({\n kind: \"occurrence\" as const,\n scope: managed.scope,\n occurrence: \"event\" as const,\n assertion: \"order\" as const,\n matcher: matches.map((item) => item.name).join(\", \"),\n }),\n subject: captured.material,\n coverage: captured.coverage,\n limitations: captured.limitations,\n interruptedMatcherArtifact: interruptedMatcherArtifact({\n sourceSnapshot: orderedSourceSnapshot,\n sourceRows: managed.rows.length,\n queries: Object.freeze(queries.map((query) => query.summary)),\n kind: \"ordered-sequence\",\n }),\n evaluate: () => Effect.tryPromise({\n try: async () => matchedSubject(await evaluateMatcherOrder({\n sourceSnapshot: orderedSourceSnapshot,\n rows: managed.rows,\n queries,\n }), subject),\n catch: (error) => error,\n }),\n });\n }\n if (sidecar === undefined)\n throw new TypeError(\"ToolMatch occurrence checks require a managed toolCalls collection\");\n if (spec.kind === \"occurrence\") {\n const item = spec.item as ToolMatch;\n const query = toolMatcherQuery(item, Object.freeze({\n matcher: item.name,\n quantifier: spec.quantifier,\n }));\n const captured = captureAssertionSnapshot({\n scope: sidecar.scope,\n occurrence: \"tool\",\n matcher: item.name,\n quantifier: spec.quantifier,\n candidateCount: sidecar.rows.length,\n orphanFinishCount: sidecar.orphanFinishCount,\n coverage: sidecar.actionsCoverage,\n snapshot: sidecar.snapshot,\n });\n return Object.freeze({\n criterion: occurrenceCriterion(sidecar.scope, item.name, spec.quantifier),\n subject: captured.material,\n coverage: captured.coverage,\n limitations: captured.limitations,\n interruptedMatcherArtifact: interruptedMatcherArtifact({\n sourceSnapshot: sidecar.sourceSnapshot,\n sourceRows: sidecar.rows.length,\n queries: Object.freeze([query.summary]),\n kind: \"collection-filter\",\n }),\n evaluate: () => Effect.tryPromise({\n try: async () => matchedSubject(await evaluateMatcherCollection({\n sourceSnapshot: sidecar.sourceSnapshot,\n rows: sidecar.rows,\n query,\n quantifier: spec.quantifier,\n }), subject),\n catch: (error) => error,\n }),\n });\n }\n if (sidecar.sourceSnapshot.scope === \"attempt\" || sidecar.scope === \"attempt\") {\n throw new TypeError(\"inOrder() is unavailable at Attempt scope\");\n }\n const orderedSourceSnapshot = sidecar.sourceSnapshot;\n const toolMatches = spec.matches as readonly ToolMatch[];\n const queries = Object.freeze(toolMatches.map(toolMatcherQuery));\n const captured = captureAssertionSnapshot({\n scope: sidecar.scope,\n assertion: \"tool-order\",\n matches: toolMatches.map((item) => item.name),\n candidateCount: sidecar.rows.length,\n coverage: sidecar.coverage,\n snapshot: sidecar.snapshot,\n });\n return Object.freeze({\n criterion: orderCriterion(sidecar.scope, toolMatches),\n subject: captured.material,\n coverage: captured.coverage,\n limitations: captured.limitations,\n interruptedMatcherArtifact: interruptedMatcherArtifact({\n sourceSnapshot: orderedSourceSnapshot,\n sourceRows: sidecar.rows.length,\n queries: Object.freeze(queries.map((query) => query.summary)),\n kind: \"ordered-sequence\",\n }),\n evaluate: () => Effect.tryPromise({\n try: async () => matchedSubject(await evaluateMatcherOrder({\n sourceSnapshot: orderedSourceSnapshot,\n rows: sidecar.rows,\n queries,\n }), subject),\n catch: (error) => error,\n }),\n });\n}\nexport type { CollectionMatch };\n"]}
|
|
1
|
+
{"version":3,"file":"collection.js","sourceRoot":"","sources":["collection.ts"],"names":[],"mappings":";;AAoGA,wDA6BC;AACD,8DAIC;AAWD,sEAKC;AACD,4EAIC;AA4BD,4CASC;AACD,8CAWC;AAmCD,kEAqOC;AApdD,8CAA8C;AAC9C,2EAA2E;AAC3E,uEAAuE;AACvE,+DAA+D;AAC/D,mCAAgC;AAEhC,+DAA+J;AAE/J,yCAAuc;AACvc,6CAA0D;AAC1D,6CAAwD;AAmBxD,MAAM,wBAAwB,GAAG,IAAI,OAAO,EAAmC,CAAC;AAYhF,MAAM,+BAA+B,GAAG,IAAI,OAAO,EAA0C,CAAC;AAC9F,SAAS,cAAc,C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AAE,CAAC,KAAK;SAC1B,CAAC;KACL,CAAC,CAAC;AACP,CAAC","sourcesContent":["// @concord-file ne-eval-assertions-collection\n// @concord-implements docs/feature/assertions/library/scoped-assertions.md\n// @concord-implements docs/feature/assertions/architecture/evidence.md\n// @concord-implements docs/feature/eval/use-case/calledtool.md\nimport { Effect } from \"effect\";\nimport type { AssertionCoverage, AssertionCriterion, AssertionLimitation, BooleanAssertionEvaluation, BooleanAssertionRegistration, MatcherSourceSnapshot, } from \"./api.ts\";\nimport { evaluateMatcherCollection, evaluateMatcherOrder, interruptedMatcherArtifact, type MatcherQuery, type MatcherSourceRow, } from \"./matcher-artifact.ts\";\nimport type { LogicalToolOccurrence } from \"../o11y/types.ts\";\nimport { collectionMatchSpecOf, assertionEventOccurrence, evaluateBooleanMatch, isManagedEventMatch, isManagedCollectionMatch, isManagedToolMatch, isNumericComparisonMatch, looksLikeCollectionMatch, type BooleanMatchEvaluation, type CollectionMatch, type EventMatch, type EventOccurrenceView, type ManagedEventOccurrences, type ManagedToolCalls, type NumericMaterial, type ToolMatch, type ToolMatchQuantifier, type ToolOccurrenceView, } from \"./match.ts\";\nimport { numericBooleanRegistration } from \"./numeric.ts\";\nimport { captureAssertionSnapshot } from \"./runtime.ts\";\ntype ProjectedMatcherCandidate<Candidate> = {\n readonly state: \"available\";\n readonly value: Candidate;\n} | {\n readonly state: \"unavailable\";\n readonly reason: string;\n};\nexport interface ManagedToolCallsSidecar {\n readonly scope: \"turn\" | \"session\" | \"attempt\";\n readonly cardinality: NumericMaterial;\n readonly sourceSnapshot: MatcherSourceSnapshot;\n readonly rows: readonly MatcherSourceRow<ProjectedMatcherCandidate<LogicalToolOccurrence>>[];\n readonly coverage: AssertionCoverage;\n readonly limitations: readonly AssertionLimitation[];\n readonly actionsCoverage: unknown;\n readonly orphanFinishCount: number;\n readonly snapshot: unknown;\n}\nconst managedToolCallsSidecars = new WeakMap<object, ManagedToolCallsSidecar>();\nexport interface ManagedEventOccurrencesSidecar {\n readonly scope: \"turn\" | \"session\" | \"attempt\";\n readonly sourceSnapshot: MatcherSourceSnapshot;\n readonly rows: readonly MatcherSourceRow<{\n readonly state: \"available\";\n readonly value: EventOccurrenceView;\n }>[];\n readonly coverage: unknown;\n readonly snapshot: unknown;\n readonly unassociatedOperation: boolean;\n}\nconst managedEventOccurrencesSidecars = new WeakMap<object, ManagedEventOccurrencesSidecar>();\nfunction occurrenceView(row: MatcherSourceRow<ProjectedMatcherCandidate<LogicalToolOccurrence>>): ToolOccurrenceView {\n if (row.candidate.state !== \"available\") {\n return Object.freeze({ name: \"unknown\" });\n }\n const occurrence = row.candidate.value;\n const name = occurrence.name.canonical === undefined || occurrence.name.canonical === \"unknown\"\n ? occurrence.name.original\n : occurrence.name.canonical;\n return Object.freeze({\n name,\n ...(occurrence.input.state === \"unavailable\" ? {} : { input: occurrence.input.value }),\n ...(occurrence.output.state === \"unavailable\" ? {} : { output: occurrence.output.value }),\n ...(occurrence.lifecycle.state === \"available\" ? { status: occurrence.lifecycle.status } : {}),\n });\n}\nfunction foldedSourceSnapshot(snapshot: MatcherSourceSnapshot, incompleteReason: string | undefined): MatcherSourceSnapshot {\n if (snapshot.collectionAtCut === \"unavailable\")\n return snapshot;\n if (snapshot.collectionAtCut === \"partial\" || incompleteReason !== undefined) {\n return snapshot.collectionAtCut === \"partial\"\n ? snapshot\n : Object.freeze({ ...snapshot, collectionAtCut: \"partial\" as const });\n }\n return snapshot;\n}\nfunction cardinalityMaterial(input: {\n readonly collectionAtCut: MatcherSourceSnapshot[\"collectionAtCut\"];\n readonly knownLength: number;\n}): NumericMaterial {\n if (input.collectionAtCut === \"unavailable\") {\n return Object.freeze({ state: \"unavailable\" as const, reason: \"source-unavailable\" });\n }\n if (input.collectionAtCut === \"complete\") {\n return Object.freeze({ state: \"exact\" as const, value: input.knownLength });\n }\n return Object.freeze({ state: \"lower-bound\" as const, value: input.knownLength });\n}\nfunction cardinalityCoverage(material: NumericMaterial): {\n readonly coverage: AssertionCoverage;\n readonly limitations: readonly AssertionLimitation[];\n} {\n if (material.state === \"unavailable\") {\n return Object.freeze({\n coverage: Object.freeze({ state: \"unavailable\" as const, reason: \"source-unavailable\" as const }),\n limitations: Object.freeze([]),\n });\n }\n if (material.state === \"lower-bound\") {\n return Object.freeze({\n coverage: Object.freeze({ state: \"partial\" as const, reason: \"provider-limited\" as const }),\n limitations: Object.freeze([{ kind: \"provider-limited\" as const }]),\n });\n }\n return Object.freeze({\n coverage: Object.freeze({ state: \"complete\" as const }),\n limitations: Object.freeze([]),\n });\n}\nexport function freezeManagedToolCalls(input: {\n readonly scope: \"turn\" | \"session\" | \"attempt\";\n readonly sourceSnapshot: MatcherSourceSnapshot;\n readonly rows: readonly MatcherSourceRow<ProjectedMatcherCandidate<LogicalToolOccurrence>>[];\n readonly incompleteReason?: string;\n readonly actionsCoverage: unknown;\n readonly orphanFinishCount: number;\n readonly snapshot: unknown;\n}): ManagedToolCalls {\n const views = Object.freeze(input.rows.map(occurrenceView));\n const collection = Object.freeze(views) as ManagedToolCalls;\n const sourceSnapshot = foldedSourceSnapshot(input.sourceSnapshot, input.incompleteReason);\n const cardinality = cardinalityMaterial({\n collectionAtCut: sourceSnapshot.collectionAtCut,\n knownLength: input.rows.length,\n });\n const coverage = cardinalityCoverage(cardinality);\n managedToolCallsSidecars.set(collection, Object.freeze({\n scope: input.scope,\n cardinality,\n sourceSnapshot,\n rows: input.rows,\n coverage: coverage.coverage,\n limitations: coverage.limitations,\n actionsCoverage: input.actionsCoverage,\n orphanFinishCount: input.orphanFinishCount,\n snapshot: input.snapshot,\n }));\n return collection;\n}\nexport function managedToolCallsSidecarOf(value: unknown): ManagedToolCallsSidecar | undefined {\n return typeof value === \"object\" && value !== null\n ? managedToolCallsSidecars.get(value)\n : undefined;\n}\nfunction eventOccurrenceView(event: EventOccurrenceView): EventOccurrenceView {\n if (event.type === \"message\") {\n return Object.freeze({ type: event.type, role: event.role, text: event.text });\n }\n return Object.freeze({\n type: event.type,\n tool: Object.freeze({ name: event.tool.name }),\n ...(event.type === \"operation.finished\" ? { status: event.status } : {}),\n }) as EventOccurrenceView;\n}\nexport function freezeManagedEventOccurrences(input: ManagedEventOccurrencesSidecar): ManagedEventOccurrences {\n const views = Object.freeze(input.rows.map((row) => eventOccurrenceView(row.candidate.value)));\n const collection = Object.freeze(views) as ManagedEventOccurrences;\n managedEventOccurrencesSidecars.set(collection, Object.freeze({ ...input }));\n return collection;\n}\nexport function managedEventOccurrencesSidecarOf(value: unknown): ManagedEventOccurrencesSidecar | undefined {\n return typeof value === \"object\" && value !== null\n ? managedEventOccurrencesSidecars.get(value)\n : undefined;\n}\nfunction unavailableMatcherCandidate(reason: string): BooleanMatchEvaluation<never> {\n return Object.freeze({\n state: \"unavailable\" as const,\n reason,\n diagnostic: Object.freeze({\n code: \"source-candidate-unavailable\",\n message: \"the matcher candidate could not be resolved from the immutable source ledger\",\n path: Object.freeze([]),\n reason,\n }),\n });\n}\nfunction toolMatchEvaluation(occurrence: LogicalToolOccurrence, result: BooleanMatchEvaluation<unknown>): BooleanMatchEvaluation<unknown> {\n if (occurrence.lifecycle.state === \"opaque\" && result.state === \"matched\") {\n return Object.freeze({\n state: \"unavailable\" as const,\n reason: `tool-lifecycle-unavailable:${occurrence.lifecycle.reason}`,\n diagnostic: Object.freeze({\n code: \"tool-lifecycle-unavailable\",\n message: \"the matching tool lifecycle is incomplete\",\n path: Object.freeze([]),\n reason: occurrence.lifecycle.reason,\n }),\n });\n }\n return result;\n}\nexport function toolMatcherQuery(match: ToolMatch, summary: import(\"./api.ts\").AssertionSnapshotValue = Object.freeze({\n matcher: match.name,\n})): MatcherQuery<ProjectedMatcherCandidate<LogicalToolOccurrence>> {\n return Object.freeze({\n summary,\n evaluate: async (candidate: ProjectedMatcherCandidate<LogicalToolOccurrence>) => candidate.state === \"unavailable\"\n ? unavailableMatcherCandidate(candidate.reason)\n : toolMatchEvaluation(candidate.value, await evaluateBooleanMatch(match, candidate.value)),\n });\n}\nexport function eventMatcherQuery(match: EventMatch, summary: import(\"./api.ts\").AssertionSnapshotValue = Object.freeze({ matcher: match.name })): MatcherQuery<ProjectedMatcherCandidate<EventOccurrenceView>> {\n return Object.freeze({\n summary,\n evaluate: async (candidate: ProjectedMatcherCandidate<EventOccurrenceView>) => {\n if (candidate.state === \"unavailable\")\n return unavailableMatcherCandidate(candidate.reason);\n const result = await evaluateBooleanMatch(match, candidate.value);\n const occurrence = assertionEventOccurrence(candidate.value);\n return occurrence === undefined ? result : toolMatchEvaluation(occurrence, result);\n },\n });\n}\nfunction occurrenceAssertion(quantifier: ToolMatchQuantifier): \"present\" | \"absent\" | \"count\" {\n if (quantifier.kind === \"absent\")\n return \"absent\";\n if (quantifier.kind === \"exact\")\n return \"count\";\n return quantifier.kind === \"at-least\" && quantifier.count === 1 ? \"present\" : \"count\";\n}\nfunction occurrenceCriterion(scope: \"turn\" | \"session\" | \"attempt\", matcher: string | undefined, quantifier: ToolMatchQuantifier): AssertionCriterion {\n return Object.freeze({\n kind: \"occurrence\" as const,\n scope,\n occurrence: \"tool\" as const,\n assertion: occurrenceAssertion(quantifier),\n ...(matcher === undefined ? {} : { matcher }),\n quantifier: Object.freeze(quantifier.kind === \"absent\"\n ? { kind: \"absent\" as const }\n : { kind: quantifier.kind, count: quantifier.count }),\n });\n}\nfunction orderCriterion(scope: \"turn\" | \"session\", matches: readonly ToolMatch[]): AssertionCriterion {\n return Object.freeze({\n kind: \"occurrence\" as const,\n scope,\n occurrence: \"tool\" as const,\n assertion: \"order\" as const,\n matcher: matches.map((match) => match.name).join(\", \"),\n });\n}\nfunction matchedSubject<Subject>(evaluation: BooleanAssertionEvaluation<void>, subject: Subject): BooleanAssertionEvaluation<Subject> {\n if (evaluation.state === \"matched\") {\n return Object.freeze({ ...evaluation, value: subject });\n }\n return evaluation as BooleanAssertionEvaluation<Subject>;\n}\nexport function collectionMatchRegistration<Subject>(subject: Subject, match: unknown): BooleanAssertionRegistration<Subject> {\n const sidecar = managedToolCallsSidecarOf(subject);\n const eventSidecar = managedEventOccurrencesSidecarOf(subject);\n if (isNumericComparisonMatch(match)) {\n if (eventSidecar !== undefined) {\n throw new TypeError(\"numeric Match cannot be used with managed eventOccurrences\");\n }\n if (sidecar !== undefined) {\n const captured = captureAssertionSnapshot(Object.freeze({\n ...sidecar.cardinality,\n cut: sidecar.snapshot,\n coverage: sidecar.coverage,\n collection: \"tool-calls\",\n scope: sidecar.scope,\n }));\n return numericBooleanRegistration({\n match,\n criterionSubject: Object.freeze({\n kind: \"collection-cardinality\" as const,\n collection: \"tool-calls\" as const,\n scope: sidecar.scope,\n }),\n material: sidecar.cardinality,\n captured: Object.freeze({\n ...captured,\n coverage: sidecar.coverage,\n limitations: sidecar.limitations,\n }),\n matchedValue: () => subject,\n });\n }\n if (!Array.isArray(subject)) {\n throw new TypeError(\"a numeric collection Match requires an array subject\");\n }\n const material = Object.freeze({ state: \"exact\" as const, value: subject.length });\n const captured = captureAssertionSnapshot(Object.freeze({\n ...material,\n cut: Object.freeze({ kind: \"author-array\" as const }),\n coverage: Object.freeze({ state: \"complete\" as const }),\n derivation: Object.freeze({ kind: \"explicit-value\" as const }),\n }));\n return numericBooleanRegistration({\n match,\n criterionSubject: Object.freeze({ kind: \"explicit-value\" as const }),\n material,\n captured,\n matchedValue: () => subject,\n });\n }\n const spec = isManagedToolMatch(match) || isManagedEventMatch(match)\n ? Object.freeze({\n kind: \"occurrence\" as const,\n domain: isManagedEventMatch(match) ? \"event\" as const : \"tool\" as const,\n item: match,\n quantifier: Object.freeze({ kind: \"at-least\" as const, count: 1 }),\n })\n : (() => {\n if (!isManagedCollectionMatch(match)) {\n if (looksLikeCollectionMatch(match)) {\n throw new TypeError(\"t.check() match must be a collection Match created by niceeval/expect\");\n }\n throw new TypeError(\"t.check() match must be a ToolMatch or collection Match created by niceeval/expect\");\n }\n return collectionMatchSpecOf(match);\n })();\n const domainSidecar = spec.domain === \"event\" ? eventSidecar : sidecar;\n if (domainSidecar === undefined) {\n throw new TypeError(spec.kind === \"in-order\"\n ? `inOrder() requires managed ${spec.domain === \"event\" ? \"eventOccurrences\" : \"toolCalls\"}`\n : `${spec.domain === \"event\" ? \"EventMatch\" : \"ToolMatch\"} occurrence checks require managed ${spec.domain === \"event\" ? \"eventOccurrences\" : \"toolCalls\"}`);\n }\n if (spec.domain === \"event\") {\n const managed = eventSidecar!;\n if (spec.kind === \"occurrence\") {\n const item = spec.item as EventMatch;\n const query = eventMatcherQuery(item, Object.freeze({ matcher: item.name, quantifier: spec.quantifier }));\n const captured = captureAssertionSnapshot({\n scope: managed.scope,\n occurrence: \"event\",\n matcher: item.name,\n quantifier: spec.quantifier,\n candidateCount: managed.rows.length,\n unassociatedOperation: managed.unassociatedOperation,\n coverage: managed.coverage,\n snapshot: managed.snapshot,\n });\n return Object.freeze({\n criterion: Object.freeze({\n ...occurrenceCriterion(managed.scope, item.name, spec.quantifier),\n occurrence: \"event\" as const,\n }),\n subject: captured.material,\n coverage: captured.coverage,\n limitations: captured.limitations,\n interruptedMatcherArtifact: interruptedMatcherArtifact({\n sourceSnapshot: managed.sourceSnapshot,\n sourceRows: managed.rows.length,\n queries: Object.freeze([query.summary]),\n kind: \"collection-filter\",\n }),\n evaluate: () => Effect.tryPromise({\n try: async () => matchedSubject(await evaluateMatcherCollection({\n sourceSnapshot: managed.sourceSnapshot,\n rows: managed.rows,\n query,\n quantifier: spec.quantifier,\n }), subject),\n catch: (error) => error,\n }),\n });\n }\n if (managed.scope === \"attempt\" || managed.sourceSnapshot.scope === \"attempt\") {\n throw new TypeError(\"inOrder() is unavailable at Attempt scope\");\n }\n const orderedSourceSnapshot = managed.sourceSnapshot as Exclude<MatcherSourceSnapshot, {\n readonly scope: \"attempt\";\n }>;\n const matches = spec.matches as readonly EventMatch[];\n const queries = Object.freeze(matches.map(eventMatcherQuery));\n const captured = captureAssertionSnapshot({\n scope: managed.scope,\n occurrence: \"event\",\n assertion: \"event-order\",\n matches: matches.map((item) => item.name),\n candidateCount: managed.rows.length,\n coverage: managed.coverage,\n snapshot: managed.snapshot,\n });\n return Object.freeze({\n criterion: Object.freeze({\n kind: \"occurrence\" as const,\n scope: managed.scope,\n occurrence: \"event\" as const,\n assertion: \"order\" as const,\n matcher: matches.map((item) => item.name).join(\", \"),\n }),\n subject: captured.material,\n coverage: captured.coverage,\n limitations: captured.limitations,\n interruptedMatcherArtifact: interruptedMatcherArtifact({\n sourceSnapshot: orderedSourceSnapshot,\n sourceRows: managed.rows.length,\n queries: Object.freeze(queries.map((query) => query.summary)),\n kind: \"ordered-sequence\",\n }),\n evaluate: () => Effect.tryPromise({\n try: async () => matchedSubject(await evaluateMatcherOrder({\n sourceSnapshot: orderedSourceSnapshot,\n rows: managed.rows,\n queries,\n }), subject),\n catch: (error) => error,\n }),\n });\n }\n if (sidecar === undefined)\n throw new TypeError(\"ToolMatch occurrence checks require a managed toolCalls collection\");\n if (spec.kind === \"occurrence\") {\n const item = spec.item as ToolMatch;\n const query = toolMatcherQuery(item, Object.freeze({\n matcher: item.name,\n quantifier: spec.quantifier,\n }));\n const captured = captureAssertionSnapshot({\n scope: sidecar.scope,\n occurrence: \"tool\",\n matcher: item.name,\n quantifier: spec.quantifier,\n candidateCount: sidecar.rows.length,\n orphanFinishCount: sidecar.orphanFinishCount,\n coverage: sidecar.actionsCoverage,\n snapshot: sidecar.snapshot,\n });\n return Object.freeze({\n criterion: occurrenceCriterion(sidecar.scope, item.name, spec.quantifier),\n subject: captured.material,\n coverage: captured.coverage,\n limitations: captured.limitations,\n interruptedMatcherArtifact: interruptedMatcherArtifact({\n sourceSnapshot: sidecar.sourceSnapshot,\n sourceRows: sidecar.rows.length,\n queries: Object.freeze([query.summary]),\n kind: \"collection-filter\",\n }),\n evaluate: () => Effect.tryPromise({\n try: async () => matchedSubject(await evaluateMatcherCollection({\n sourceSnapshot: sidecar.sourceSnapshot,\n rows: sidecar.rows,\n query,\n quantifier: spec.quantifier,\n }), subject),\n catch: (error) => error,\n }),\n });\n }\n if (sidecar.sourceSnapshot.scope === \"attempt\" || sidecar.scope === \"attempt\") {\n throw new TypeError(\"inOrder() is unavailable at Attempt scope\");\n }\n const orderedSourceSnapshot = sidecar.sourceSnapshot;\n const toolMatches = spec.matches as readonly ToolMatch[];\n const queries = Object.freeze(toolMatches.map(toolMatcherQuery));\n const captured = captureAssertionSnapshot({\n scope: sidecar.scope,\n assertion: \"tool-order\",\n matches: toolMatches.map((item) => item.name),\n candidateCount: sidecar.rows.length,\n coverage: sidecar.coverage,\n snapshot: sidecar.snapshot,\n });\n return Object.freeze({\n criterion: orderCriterion(sidecar.scope, toolMatches),\n subject: captured.material,\n coverage: captured.coverage,\n limitations: captured.limitations,\n interruptedMatcherArtifact: interruptedMatcherArtifact({\n sourceSnapshot: orderedSourceSnapshot,\n sourceRows: sidecar.rows.length,\n queries: Object.freeze(queries.map((query) => query.summary)),\n kind: \"ordered-sequence\",\n }),\n evaluate: () => Effect.tryPromise({\n try: async () => matchedSubject(await evaluateMatcherOrder({\n sourceSnapshot: orderedSourceSnapshot,\n rows: sidecar.rows,\n queries,\n }), subject),\n catch: (error) => error,\n }),\n });\n}\nexport type { CollectionMatch };\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AssertionCoverage, AssertionLimitation, BooleanAssertionRegistration, MatcherSourceSnapshot } from "./api.cjs";
|
|
2
|
-
import { type MatcherSourceRow } from "./matcher-artifact.cjs";
|
|
2
|
+
import { type MatcherQuery, type MatcherSourceRow } from "./matcher-artifact.cjs";
|
|
3
3
|
import type { LogicalToolOccurrence } from "../o11y/types.cjs";
|
|
4
|
-
import { type CollectionMatch, type EventOccurrenceView, type ManagedEventOccurrences, type ManagedToolCalls, type NumericMaterial } from "./match.cjs";
|
|
4
|
+
import { type CollectionMatch, type EventMatch, type EventOccurrenceView, type ManagedEventOccurrences, type ManagedToolCalls, type NumericMaterial, type ToolMatch } from "./match.cjs";
|
|
5
5
|
type ProjectedMatcherCandidate<Candidate> = {
|
|
6
6
|
readonly state: "available";
|
|
7
7
|
readonly value: Candidate;
|
|
@@ -43,5 +43,7 @@ export declare function freezeManagedToolCalls(input: {
|
|
|
43
43
|
export declare function managedToolCallsSidecarOf(value: unknown): ManagedToolCallsSidecar | undefined;
|
|
44
44
|
export declare function freezeManagedEventOccurrences(input: ManagedEventOccurrencesSidecar): ManagedEventOccurrences;
|
|
45
45
|
export declare function managedEventOccurrencesSidecarOf(value: unknown): ManagedEventOccurrencesSidecar | undefined;
|
|
46
|
+
export declare function toolMatcherQuery(match: ToolMatch, summary?: import("./api.cjs").AssertionSnapshotValue): MatcherQuery<ProjectedMatcherCandidate<LogicalToolOccurrence>>;
|
|
47
|
+
export declare function eventMatcherQuery(match: EventMatch, summary?: import("./api.cjs").AssertionSnapshotValue): MatcherQuery<ProjectedMatcherCandidate<EventOccurrenceView>>;
|
|
46
48
|
export declare function collectionMatchRegistration<Subject>(subject: Subject, match: unknown): BooleanAssertionRegistration<Subject>;
|
|
47
49
|
export type { CollectionMatch };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AssertionCoverage, AssertionLimitation, BooleanAssertionRegistration, MatcherSourceSnapshot } from "./api.mjs";
|
|
2
|
-
import { type MatcherSourceRow } from "./matcher-artifact.mjs";
|
|
2
|
+
import { type MatcherQuery, type MatcherSourceRow } from "./matcher-artifact.mjs";
|
|
3
3
|
import type { LogicalToolOccurrence } from "../o11y/types.mjs";
|
|
4
|
-
import { type CollectionMatch, type EventOccurrenceView, type ManagedEventOccurrences, type ManagedToolCalls, type NumericMaterial } from "./match.mjs";
|
|
4
|
+
import { type CollectionMatch, type EventMatch, type EventOccurrenceView, type ManagedEventOccurrences, type ManagedToolCalls, type NumericMaterial, type ToolMatch } from "./match.mjs";
|
|
5
5
|
type ProjectedMatcherCandidate<Candidate> = {
|
|
6
6
|
readonly state: "available";
|
|
7
7
|
readonly value: Candidate;
|
|
@@ -43,5 +43,7 @@ export declare function freezeManagedToolCalls(input: {
|
|
|
43
43
|
export declare function managedToolCallsSidecarOf(value: unknown): ManagedToolCallsSidecar | undefined;
|
|
44
44
|
export declare function freezeManagedEventOccurrences(input: ManagedEventOccurrencesSidecar): ManagedEventOccurrences;
|
|
45
45
|
export declare function managedEventOccurrencesSidecarOf(value: unknown): ManagedEventOccurrencesSidecar | undefined;
|
|
46
|
+
export declare function toolMatcherQuery(match: ToolMatch, summary?: import("./api.mjs").AssertionSnapshotValue): MatcherQuery<ProjectedMatcherCandidate<LogicalToolOccurrence>>;
|
|
47
|
+
export declare function eventMatcherQuery(match: EventMatch, summary?: import("./api.mjs").AssertionSnapshotValue): MatcherQuery<ProjectedMatcherCandidate<EventOccurrenceView>>;
|
|
46
48
|
export declare function collectionMatchRegistration<Subject>(subject: Subject, match: unknown): BooleanAssertionRegistration<Subject>;
|
|
47
49
|
export type { CollectionMatch };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AssertionCoverage, AssertionLimitation, BooleanAssertionRegistration, MatcherSourceSnapshot } from "./api.js";
|
|
2
|
-
import { type MatcherSourceRow } from "./matcher-artifact.js";
|
|
2
|
+
import { type MatcherQuery, type MatcherSourceRow } from "./matcher-artifact.js";
|
|
3
3
|
import type { LogicalToolOccurrence } from "../o11y/types.js";
|
|
4
|
-
import { type CollectionMatch, type EventOccurrenceView, type ManagedEventOccurrences, type ManagedToolCalls, type NumericMaterial } from "./match.js";
|
|
4
|
+
import { type CollectionMatch, type EventMatch, type EventOccurrenceView, type ManagedEventOccurrences, type ManagedToolCalls, type NumericMaterial, type ToolMatch } from "./match.js";
|
|
5
5
|
type ProjectedMatcherCandidate<Candidate> = {
|
|
6
6
|
readonly state: "available";
|
|
7
7
|
readonly value: Candidate;
|
|
@@ -43,5 +43,7 @@ export declare function freezeManagedToolCalls(input: {
|
|
|
43
43
|
export declare function managedToolCallsSidecarOf(value: unknown): ManagedToolCallsSidecar | undefined;
|
|
44
44
|
export declare function freezeManagedEventOccurrences(input: ManagedEventOccurrencesSidecar): ManagedEventOccurrences;
|
|
45
45
|
export declare function managedEventOccurrencesSidecarOf(value: unknown): ManagedEventOccurrencesSidecar | undefined;
|
|
46
|
+
export declare function toolMatcherQuery(match: ToolMatch, summary?: import("./api.js").AssertionSnapshotValue): MatcherQuery<ProjectedMatcherCandidate<LogicalToolOccurrence>>;
|
|
47
|
+
export declare function eventMatcherQuery(match: EventMatch, summary?: import("./api.js").AssertionSnapshotValue): MatcherQuery<ProjectedMatcherCandidate<EventOccurrenceView>>;
|
|
46
48
|
export declare function collectionMatchRegistration<Subject>(subject: Subject, match: unknown): BooleanAssertionRegistration<Subject>;
|
|
47
49
|
export type { CollectionMatch };
|
|
@@ -3,12 +3,16 @@ const __niceevalRequire = __niceevalCreateRequire(import.meta.url);
|
|
|
3
3
|
const __niceevalCanonical = __niceevalRequire("./collection.cjs");
|
|
4
4
|
const __niceevalExport0 = __niceevalCanonical["collectionMatchRegistration"];
|
|
5
5
|
export { __niceevalExport0 as collectionMatchRegistration };
|
|
6
|
-
const __niceevalExport1 = __niceevalCanonical["
|
|
7
|
-
export { __niceevalExport1 as
|
|
8
|
-
const __niceevalExport2 = __niceevalCanonical["
|
|
9
|
-
export { __niceevalExport2 as
|
|
10
|
-
const __niceevalExport3 = __niceevalCanonical["
|
|
11
|
-
export { __niceevalExport3 as
|
|
12
|
-
const __niceevalExport4 = __niceevalCanonical["
|
|
13
|
-
export { __niceevalExport4 as
|
|
6
|
+
const __niceevalExport1 = __niceevalCanonical["eventMatcherQuery"];
|
|
7
|
+
export { __niceevalExport1 as eventMatcherQuery };
|
|
8
|
+
const __niceevalExport2 = __niceevalCanonical["freezeManagedEventOccurrences"];
|
|
9
|
+
export { __niceevalExport2 as freezeManagedEventOccurrences };
|
|
10
|
+
const __niceevalExport3 = __niceevalCanonical["freezeManagedToolCalls"];
|
|
11
|
+
export { __niceevalExport3 as freezeManagedToolCalls };
|
|
12
|
+
const __niceevalExport4 = __niceevalCanonical["managedEventOccurrencesSidecarOf"];
|
|
13
|
+
export { __niceevalExport4 as managedEventOccurrencesSidecarOf };
|
|
14
|
+
const __niceevalExport5 = __niceevalCanonical["managedToolCallsSidecarOf"];
|
|
15
|
+
export { __niceevalExport5 as managedToolCallsSidecarOf };
|
|
16
|
+
const __niceevalExport6 = __niceevalCanonical["toolMatcherQuery"];
|
|
17
|
+
export { __niceevalExport6 as toolMatcherQuery };
|
|
14
18
|
//# sourceMappingURL=collection.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineMaterialMatch = defineMaterialMatch;
|
|
4
|
+
exports.defineContextMatch = defineContextMatch;
|
|
5
|
+
exports.isContextualMatch = isContextualMatch;
|
|
6
|
+
exports.contextMatchDefinitionOf = contextMatchDefinitionOf;
|
|
7
|
+
const effect_1 = require("effect");
|
|
8
|
+
const match_ts_1 = require("./match.cjs");
|
|
9
|
+
const contextBrand = Symbol("niceeval.match.context");
|
|
10
|
+
const valueBrand = Symbol("niceeval.match.fact");
|
|
11
|
+
const definitions = new WeakMap();
|
|
12
|
+
const defaults = { maxItems: 256, maxBytes: 48 * 1024, maxNodes: 16384, maxDepth: 32 };
|
|
13
|
+
const maximum = { maxItems: 16384, maxBytes: 4 * 1024 * 1024, maxNodes: 1048576, maxDepth: 64 };
|
|
14
|
+
function captureBudget(value, single) {
|
|
15
|
+
const result = { ...defaults, ...(single ? { maxItems: 1 } : {}) };
|
|
16
|
+
if (value === undefined)
|
|
17
|
+
return Object.freeze(result);
|
|
18
|
+
if (!effect_1.Predicate.isObject(value) || Array.isArray(value))
|
|
19
|
+
throw new TypeError("Context Match capture budget must be an object");
|
|
20
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
21
|
+
if (typeof key !== "string" || !Object.hasOwn(defaults, key) || single && key === "maxItems")
|
|
22
|
+
throw new TypeError("Unknown Context Match capture budget " + String(key));
|
|
23
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
24
|
+
if (descriptor === undefined || !("value" in descriptor))
|
|
25
|
+
throw new TypeError("Capture budget fields must be data properties");
|
|
26
|
+
const count = descriptor.value;
|
|
27
|
+
const field = key;
|
|
28
|
+
if (typeof count !== "number" || !Number.isSafeInteger(count) || count <= 0 || count > maximum[field])
|
|
29
|
+
throw new TypeError("Capture " + field + " must be a positive integer at most " + maximum[field]);
|
|
30
|
+
result[field] = count;
|
|
31
|
+
}
|
|
32
|
+
return Object.freeze(result);
|
|
33
|
+
}
|
|
34
|
+
function declare(value, collection) {
|
|
35
|
+
if (!effect_1.Predicate.isObject(value) || Array.isArray(value))
|
|
36
|
+
throw new TypeError("Context Match definition must be an object");
|
|
37
|
+
const spec = value;
|
|
38
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
39
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
40
|
+
if (typeof key !== "string" || !["name", "read", "match", "capture"].includes(key) || descriptor === undefined || !("value" in descriptor))
|
|
41
|
+
throw new TypeError("Context Match accepts name, read, match and optional capture data properties");
|
|
42
|
+
}
|
|
43
|
+
if (typeof spec.name !== "string" || spec.name.trim() === "" || new TextEncoder().encode(spec.name).length > 128 || /[\u0000-\u001f\u007f]/u.test(spec.name))
|
|
44
|
+
throw new TypeError("Context Match name must be nonempty and at most 128 UTF-8 bytes");
|
|
45
|
+
if (typeof spec.read !== "function")
|
|
46
|
+
throw new TypeError("Context Match requires a synchronous reader");
|
|
47
|
+
let kind = "material";
|
|
48
|
+
if (!(collection && ((0, match_ts_1.isManagedToolMatch)(spec.match) || (0, match_ts_1.isManagedEventMatch)(spec.match)))) {
|
|
49
|
+
const match = (0, match_ts_1.assertManagedValueMatch)(spec.match, "Context Match definition");
|
|
50
|
+
if (collection && match.kind !== "boolean")
|
|
51
|
+
throw new TypeError("Material collections require a BooleanMatch");
|
|
52
|
+
if (!collection)
|
|
53
|
+
kind = match.kind === "score" ? "context-score" : "context-boolean";
|
|
54
|
+
}
|
|
55
|
+
const match = Object.freeze({ kind });
|
|
56
|
+
definitions.set(match, Object.freeze({ name: spec.name, read: spec.read, match: spec.match, kind, capture: captureBudget(spec.capture, !collection) }));
|
|
57
|
+
return match;
|
|
58
|
+
}
|
|
59
|
+
function defineMaterialMatch(definition) { return declare(definition, true); }
|
|
60
|
+
function defineContextMatch(definition) { return declare(definition, false); }
|
|
61
|
+
/** @internal Brands are verified without probing application names. */
|
|
62
|
+
function isContextualMatch(value) { return effect_1.Predicate.isObject(value) && definitions.has(value); }
|
|
63
|
+
/** @internal Private reader access is limited to the authoring receiver. */
|
|
64
|
+
function contextMatchDefinitionOf(match) {
|
|
65
|
+
const definition = definitions.get(match);
|
|
66
|
+
if (definition === undefined)
|
|
67
|
+
throw new TypeError("Expected a defined contextual Match");
|
|
68
|
+
return definition;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=context-match.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-match.js","sourceRoot":"","sources":["context-match.ts"],"names":[],"mappings":";;AA4IA,kDAA+G;AAa/G,gDAA+G;AAE/G,8CAA2I;AAE3I,4DACoF;AA9JpF,mCAAmC;AACnC,yCAA2Q;AAuC3Q,MAAM,YAAY,GAAkB,MAAM,CAAC,wBAAwB,CAAC,CAAC;AACrE,MAAM,UAAU,GAAkB,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAiChE,MAAM,WAAW,GAAG,IAAI,OAAO,EAAkC,CAAC;AAClE,MAAM,QAAQ,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AACvF,MAAM,OAAO,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AAChG,SAAS,aAAa,CAAC,KAAc,EAAE,MAAe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K,CAAC,CAAC,CAAC,CAAC;AAC3I,4EAA4E;AAC5E,SAAgB,wBAAwB,CAAC,KAAa;IAA4B,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAAC,IAAI,UAAU,KAAK,SAAS;QACrJ,MAAM,IAAI,SAAS,CAAC,qCAAqC,CAAC,CAAC;IAAC,OAAO,UAAU,CAAC;AAAC,CAAC","sourcesContent":["import { Predicate } from \"effect\";\nimport { assertManagedValueMatch, isManagedToolMatch, isManagedEventMatch, type BooleanMatch, type ScoreMatch, type ManagedToolCalls, type ManagedEventOccurrences, type ToolMatch, type EventMatch, type ToolOccurrenceView, type EventOccurrenceView } from \"./match.ts\";\n// A named container keeps recursive array elements deferred until they are read.\ninterface ReadonlyMaterialArray<T> extends ReadonlyArray<ReadonlyMaterial<T>> {\n}\nexport type ReadonlyMaterial<T> = T extends ManagedToolCalls | ManagedEventOccurrences ? T : T extends (...args: infer A) => infer R ? (...args: A) => ReadonlyMaterial<R> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<K, ReadonlyMaterial<V>> : T extends ReadonlySet<infer V> ? ReadonlySet<ReadonlyMaterial<V>> : T extends readonly unknown[] ? ReadonlyArray<T[number]> extends Readonly<T> ? ReadonlyMaterialArray<T[number]> : {\n readonly [K in keyof T]: ReadonlyMaterial<T[K]>;\n} : T extends object ? {\n readonly [K in keyof T]: ReadonlyMaterial<T[K]>;\n} : T;\nexport type MatchContext<C> = ReadonlyMaterial<C>;\nexport interface MaterialItem<T> {\n readonly id: string;\n readonly value: T;\n}\nexport type MaterialCollection<T> = {\n readonly state: \"complete\";\n readonly items: readonly MaterialItem<T>[];\n} | {\n readonly state: \"partial\";\n readonly items: readonly MaterialItem<T>[];\n readonly reason: string;\n} | {\n readonly state: \"unavailable\";\n readonly reason: string;\n};\nexport interface MaterialCaptureBudget {\n readonly maxItems?: number;\n readonly maxBytes?: number;\n readonly maxNodes?: number;\n readonly maxDepth?: number;\n}\nexport type FactCaptureBudget = Omit<MaterialCaptureBudget, \"maxItems\">;\nexport type MatchFact<T> = {\n readonly state: \"available\";\n readonly value: T;\n} | {\n readonly state: \"unavailable\";\n readonly reason: string;\n};\nconst contextBrand: unique symbol = Symbol(\"niceeval.match.context\");\nconst valueBrand: unique symbol = Symbol(\"niceeval.match.fact\");\nexport interface MaterialMatch<in C, out T> {\n readonly kind: \"material\";\n readonly [contextBrand]: (ctx: C) => void;\n readonly [valueBrand]: T;\n}\nexport interface ContextBooleanMatch<in C, out T> {\n readonly kind: \"context-boolean\";\n readonly [contextBrand]: (ctx: C) => void;\n readonly [valueBrand]: T;\n}\nexport interface ContextScoreMatch<in C, out T> {\n readonly kind: \"context-score\";\n readonly [contextBrand]: (ctx: C) => void;\n readonly [valueBrand]: T;\n}\n/** @internal Erased descriptor; only the owning receiver supplies a context. */\nexport type ContextualMatch = MaterialMatch<never, unknown> | ContextBooleanMatch<never, unknown> | ContextScoreMatch<never, unknown>;\n/** @internal Resolved, finite capture bounds. */\nexport interface ResolvedMaterialCaptureBudget {\n readonly maxItems: number;\n readonly maxBytes: number;\n readonly maxNodes: number;\n readonly maxDepth: number;\n}\n/** @internal Reader declarations never capture an Attempt. */\nexport interface ContextMatchDefinition {\n readonly name: string;\n readonly kind: ContextualMatch[\"kind\"];\n readonly read: (context: unknown) => unknown;\n readonly match: unknown;\n readonly capture: ResolvedMaterialCaptureBudget;\n}\nconst definitions = new WeakMap<object, ContextMatchDefinition>();\nconst defaults = { maxItems: 256, maxBytes: 48 * 1024, maxNodes: 16384, maxDepth: 32 };\nconst maximum = { maxItems: 16384, maxBytes: 4 * 1024 * 1024, maxNodes: 1048576, maxDepth: 64 };\nfunction captureBudget(value: unknown, single: boolean): ResolvedMaterialCaptureBudget {\n const result = { ...defaults, ...(single ? { maxItems: 1 } : {}) };\n if (value === undefined)\n return Object.freeze(result);\n if (!Predicate.isObject(value) || Array.isArray(value))\n throw new TypeError(\"Context Match capture budget must be an object\");\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key !== \"string\" || !Object.hasOwn(defaults, key) || single && key === \"maxItems\")\n throw new TypeError(\"Unknown Context Match capture budget \" + String(key));\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined || !(\"value\" in descriptor))\n throw new TypeError(\"Capture budget fields must be data properties\");\n const count: unknown = descriptor.value;\n const field = key as keyof typeof defaults;\n if (typeof count !== \"number\" || !Number.isSafeInteger(count) || count <= 0 || count > maximum[field])\n throw new TypeError(\"Capture \" + field + \" must be a positive integer at most \" + maximum[field]);\n result[field] = count;\n }\n return Object.freeze(result);\n}\nfunction declare(value: unknown, collection: boolean): ContextualMatch {\n if (!Predicate.isObject(value) || Array.isArray(value))\n throw new TypeError(\"Context Match definition must be an object\");\n const spec = value as Record<string, unknown>;\n for (const key of Reflect.ownKeys(value)) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== \"string\" || ![\"name\", \"read\", \"match\", \"capture\"].includes(key) || descriptor === undefined || !(\"value\" in descriptor))\n throw new TypeError(\"Context Match accepts name, read, match and optional capture data properties\");\n }\n if (typeof spec.name !== \"string\" || spec.name.trim() === \"\" || new TextEncoder().encode(spec.name).length > 128 || /[\\u0000-\\u001f\\u007f]/u.test(spec.name))\n throw new TypeError(\"Context Match name must be nonempty and at most 128 UTF-8 bytes\");\n if (typeof spec.read !== \"function\")\n throw new TypeError(\"Context Match requires a synchronous reader\");\n let kind: ContextualMatch[\"kind\"] = \"material\";\n if (!(collection && (isManagedToolMatch(spec.match) || isManagedEventMatch(spec.match)))) {\n const match = assertManagedValueMatch(spec.match, \"Context Match definition\");\n if (collection && match.kind !== \"boolean\")\n throw new TypeError(\"Material collections require a BooleanMatch\");\n if (!collection)\n kind = match.kind === \"score\" ? \"context-score\" : \"context-boolean\";\n }\n const match = Object.freeze({ kind }) as ContextualMatch;\n definitions.set(match, Object.freeze({ name: spec.name, read: spec.read as ContextMatchDefinition[\"read\"], match: spec.match, kind, capture: captureBudget(spec.capture, !collection) }));\n return match;\n}\nexport function defineMaterialMatch<C, T>(definition: {\n readonly name: string;\n readonly read: (ctx: MatchContext<C>) => MaterialCollection<ReadonlyMaterial<T>>;\n readonly match: BooleanMatch<ReadonlyMaterial<T>, ReadonlyMaterial<T>>;\n readonly capture?: MaterialCaptureBudget;\n}): MaterialMatch<C, ReadonlyMaterial<T>>;\nexport function defineMaterialMatch<C>(definition: {\n readonly name: string;\n readonly read: (ctx: MatchContext<C>) => ManagedToolCalls;\n readonly match: ToolMatch;\n readonly capture?: MaterialCaptureBudget;\n}): MaterialMatch<C, ToolOccurrenceView>;\nexport function defineMaterialMatch<C>(definition: {\n readonly name: string;\n readonly read: (ctx: MatchContext<C>) => ManagedEventOccurrences;\n readonly match: EventMatch;\n readonly capture?: MaterialCaptureBudget;\n}): MaterialMatch<C, EventOccurrenceView>;\nexport function defineMaterialMatch(definition: unknown): ContextualMatch { return declare(definition, true); }\nexport function defineContextMatch<C, T>(definition: {\n readonly name: string;\n readonly read: (ctx: MatchContext<C>) => MatchFact<ReadonlyMaterial<T>>;\n readonly match: BooleanMatch<ReadonlyMaterial<T>, ReadonlyMaterial<T>>;\n readonly capture?: FactCaptureBudget;\n}): ContextBooleanMatch<C, ReadonlyMaterial<T>>;\nexport function defineContextMatch<C, T>(definition: {\n readonly name: string;\n readonly read: (ctx: MatchContext<C>) => MatchFact<ReadonlyMaterial<T>>;\n readonly match: ScoreMatch<ReadonlyMaterial<T>>;\n readonly capture?: FactCaptureBudget;\n}): ContextScoreMatch<C, ReadonlyMaterial<T>>;\nexport function defineContextMatch(definition: unknown): ContextualMatch { return declare(definition, false); }\n/** @internal Brands are verified without probing application names. */\nexport function isContextualMatch(value: unknown): value is ContextualMatch { return Predicate.isObject(value) && definitions.has(value); }\n/** @internal Private reader access is limited to the authoring receiver. */\nexport function contextMatchDefinitionOf(match: object): ContextMatchDefinition { const definition = definitions.get(match); if (definition === undefined)\n throw new TypeError(\"Expected a defined contextual Match\"); return definition; }\n"]}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { type BooleanMatch, type ScoreMatch, type ManagedToolCalls, type ManagedEventOccurrences, type ToolMatch, type EventMatch, type ToolOccurrenceView, type EventOccurrenceView } from "./match.cjs";
|
|
2
|
+
interface ReadonlyMaterialArray<T> extends ReadonlyArray<ReadonlyMaterial<T>> {
|
|
3
|
+
}
|
|
4
|
+
export type ReadonlyMaterial<T> = T extends ManagedToolCalls | ManagedEventOccurrences ? T : T extends (...args: infer A) => infer R ? (...args: A) => ReadonlyMaterial<R> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<K, ReadonlyMaterial<V>> : T extends ReadonlySet<infer V> ? ReadonlySet<ReadonlyMaterial<V>> : T extends readonly unknown[] ? ReadonlyArray<T[number]> extends Readonly<T> ? ReadonlyMaterialArray<T[number]> : {
|
|
5
|
+
readonly [K in keyof T]: ReadonlyMaterial<T[K]>;
|
|
6
|
+
} : T extends object ? {
|
|
7
|
+
readonly [K in keyof T]: ReadonlyMaterial<T[K]>;
|
|
8
|
+
} : T;
|
|
9
|
+
export type MatchContext<C> = ReadonlyMaterial<C>;
|
|
10
|
+
export interface MaterialItem<T> {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly value: T;
|
|
13
|
+
}
|
|
14
|
+
export type MaterialCollection<T> = {
|
|
15
|
+
readonly state: "complete";
|
|
16
|
+
readonly items: readonly MaterialItem<T>[];
|
|
17
|
+
} | {
|
|
18
|
+
readonly state: "partial";
|
|
19
|
+
readonly items: readonly MaterialItem<T>[];
|
|
20
|
+
readonly reason: string;
|
|
21
|
+
} | {
|
|
22
|
+
readonly state: "unavailable";
|
|
23
|
+
readonly reason: string;
|
|
24
|
+
};
|
|
25
|
+
export interface MaterialCaptureBudget {
|
|
26
|
+
readonly maxItems?: number;
|
|
27
|
+
readonly maxBytes?: number;
|
|
28
|
+
readonly maxNodes?: number;
|
|
29
|
+
readonly maxDepth?: number;
|
|
30
|
+
}
|
|
31
|
+
export type FactCaptureBudget = Omit<MaterialCaptureBudget, "maxItems">;
|
|
32
|
+
export type MatchFact<T> = {
|
|
33
|
+
readonly state: "available";
|
|
34
|
+
readonly value: T;
|
|
35
|
+
} | {
|
|
36
|
+
readonly state: "unavailable";
|
|
37
|
+
readonly reason: string;
|
|
38
|
+
};
|
|
39
|
+
declare const contextBrand: unique symbol;
|
|
40
|
+
declare const valueBrand: unique symbol;
|
|
41
|
+
export interface MaterialMatch<in C, out T> {
|
|
42
|
+
readonly kind: "material";
|
|
43
|
+
readonly [contextBrand]: (ctx: C) => void;
|
|
44
|
+
readonly [valueBrand]: T;
|
|
45
|
+
}
|
|
46
|
+
export interface ContextBooleanMatch<in C, out T> {
|
|
47
|
+
readonly kind: "context-boolean";
|
|
48
|
+
readonly [contextBrand]: (ctx: C) => void;
|
|
49
|
+
readonly [valueBrand]: T;
|
|
50
|
+
}
|
|
51
|
+
export interface ContextScoreMatch<in C, out T> {
|
|
52
|
+
readonly kind: "context-score";
|
|
53
|
+
readonly [contextBrand]: (ctx: C) => void;
|
|
54
|
+
readonly [valueBrand]: T;
|
|
55
|
+
}
|
|
56
|
+
/** @internal Erased descriptor; only the owning receiver supplies a context. */
|
|
57
|
+
export type ContextualMatch = MaterialMatch<never, unknown> | ContextBooleanMatch<never, unknown> | ContextScoreMatch<never, unknown>;
|
|
58
|
+
/** @internal Resolved, finite capture bounds. */
|
|
59
|
+
export interface ResolvedMaterialCaptureBudget {
|
|
60
|
+
readonly maxItems: number;
|
|
61
|
+
readonly maxBytes: number;
|
|
62
|
+
readonly maxNodes: number;
|
|
63
|
+
readonly maxDepth: number;
|
|
64
|
+
}
|
|
65
|
+
/** @internal Reader declarations never capture an Attempt. */
|
|
66
|
+
export interface ContextMatchDefinition {
|
|
67
|
+
readonly name: string;
|
|
68
|
+
readonly kind: ContextualMatch["kind"];
|
|
69
|
+
readonly read: (context: unknown) => unknown;
|
|
70
|
+
readonly match: unknown;
|
|
71
|
+
readonly capture: ResolvedMaterialCaptureBudget;
|
|
72
|
+
}
|
|
73
|
+
export declare function defineMaterialMatch<C, T>(definition: {
|
|
74
|
+
readonly name: string;
|
|
75
|
+
readonly read: (ctx: MatchContext<C>) => MaterialCollection<ReadonlyMaterial<T>>;
|
|
76
|
+
readonly match: BooleanMatch<ReadonlyMaterial<T>, ReadonlyMaterial<T>>;
|
|
77
|
+
readonly capture?: MaterialCaptureBudget;
|
|
78
|
+
}): MaterialMatch<C, ReadonlyMaterial<T>>;
|
|
79
|
+
export declare function defineMaterialMatch<C>(definition: {
|
|
80
|
+
readonly name: string;
|
|
81
|
+
readonly read: (ctx: MatchContext<C>) => ManagedToolCalls;
|
|
82
|
+
readonly match: ToolMatch;
|
|
83
|
+
readonly capture?: MaterialCaptureBudget;
|
|
84
|
+
}): MaterialMatch<C, ToolOccurrenceView>;
|
|
85
|
+
export declare function defineMaterialMatch<C>(definition: {
|
|
86
|
+
readonly name: string;
|
|
87
|
+
readonly read: (ctx: MatchContext<C>) => ManagedEventOccurrences;
|
|
88
|
+
readonly match: EventMatch;
|
|
89
|
+
readonly capture?: MaterialCaptureBudget;
|
|
90
|
+
}): MaterialMatch<C, EventOccurrenceView>;
|
|
91
|
+
export declare function defineContextMatch<C, T>(definition: {
|
|
92
|
+
readonly name: string;
|
|
93
|
+
readonly read: (ctx: MatchContext<C>) => MatchFact<ReadonlyMaterial<T>>;
|
|
94
|
+
readonly match: BooleanMatch<ReadonlyMaterial<T>, ReadonlyMaterial<T>>;
|
|
95
|
+
readonly capture?: FactCaptureBudget;
|
|
96
|
+
}): ContextBooleanMatch<C, ReadonlyMaterial<T>>;
|
|
97
|
+
export declare function defineContextMatch<C, T>(definition: {
|
|
98
|
+
readonly name: string;
|
|
99
|
+
readonly read: (ctx: MatchContext<C>) => MatchFact<ReadonlyMaterial<T>>;
|
|
100
|
+
readonly match: ScoreMatch<ReadonlyMaterial<T>>;
|
|
101
|
+
readonly capture?: FactCaptureBudget;
|
|
102
|
+
}): ContextScoreMatch<C, ReadonlyMaterial<T>>;
|
|
103
|
+
/** @internal Brands are verified without probing application names. */
|
|
104
|
+
export declare function isContextualMatch(value: unknown): value is ContextualMatch;
|
|
105
|
+
/** @internal Private reader access is limited to the authoring receiver. */
|
|
106
|
+
export declare function contextMatchDefinitionOf(match: object): ContextMatchDefinition;
|
|
107
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { type BooleanMatch, type ScoreMatch, type ManagedToolCalls, type ManagedEventOccurrences, type ToolMatch, type EventMatch, type ToolOccurrenceView, type EventOccurrenceView } from "./match.mjs";
|
|
2
|
+
interface ReadonlyMaterialArray<T> extends ReadonlyArray<ReadonlyMaterial<T>> {
|
|
3
|
+
}
|
|
4
|
+
export type ReadonlyMaterial<T> = T extends ManagedToolCalls | ManagedEventOccurrences ? T : T extends (...args: infer A) => infer R ? (...args: A) => ReadonlyMaterial<R> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<K, ReadonlyMaterial<V>> : T extends ReadonlySet<infer V> ? ReadonlySet<ReadonlyMaterial<V>> : T extends readonly unknown[] ? ReadonlyArray<T[number]> extends Readonly<T> ? ReadonlyMaterialArray<T[number]> : {
|
|
5
|
+
readonly [K in keyof T]: ReadonlyMaterial<T[K]>;
|
|
6
|
+
} : T extends object ? {
|
|
7
|
+
readonly [K in keyof T]: ReadonlyMaterial<T[K]>;
|
|
8
|
+
} : T;
|
|
9
|
+
export type MatchContext<C> = ReadonlyMaterial<C>;
|
|
10
|
+
export interface MaterialItem<T> {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly value: T;
|
|
13
|
+
}
|
|
14
|
+
export type MaterialCollection<T> = {
|
|
15
|
+
readonly state: "complete";
|
|
16
|
+
readonly items: readonly MaterialItem<T>[];
|
|
17
|
+
} | {
|
|
18
|
+
readonly state: "partial";
|
|
19
|
+
readonly items: readonly MaterialItem<T>[];
|
|
20
|
+
readonly reason: string;
|
|
21
|
+
} | {
|
|
22
|
+
readonly state: "unavailable";
|
|
23
|
+
readonly reason: string;
|
|
24
|
+
};
|
|
25
|
+
export interface MaterialCaptureBudget {
|
|
26
|
+
readonly maxItems?: number;
|
|
27
|
+
readonly maxBytes?: number;
|
|
28
|
+
readonly maxNodes?: number;
|
|
29
|
+
readonly maxDepth?: number;
|
|
30
|
+
}
|
|
31
|
+
export type FactCaptureBudget = Omit<MaterialCaptureBudget, "maxItems">;
|
|
32
|
+
export type MatchFact<T> = {
|
|
33
|
+
readonly state: "available";
|
|
34
|
+
readonly value: T;
|
|
35
|
+
} | {
|
|
36
|
+
readonly state: "unavailable";
|
|
37
|
+
readonly reason: string;
|
|
38
|
+
};
|
|
39
|
+
declare const contextBrand: unique symbol;
|
|
40
|
+
declare const valueBrand: unique symbol;
|
|
41
|
+
export interface MaterialMatch<in C, out T> {
|
|
42
|
+
readonly kind: "material";
|
|
43
|
+
readonly [contextBrand]: (ctx: C) => void;
|
|
44
|
+
readonly [valueBrand]: T;
|
|
45
|
+
}
|
|
46
|
+
export interface ContextBooleanMatch<in C, out T> {
|
|
47
|
+
readonly kind: "context-boolean";
|
|
48
|
+
readonly [contextBrand]: (ctx: C) => void;
|
|
49
|
+
readonly [valueBrand]: T;
|
|
50
|
+
}
|
|
51
|
+
export interface ContextScoreMatch<in C, out T> {
|
|
52
|
+
readonly kind: "context-score";
|
|
53
|
+
readonly [contextBrand]: (ctx: C) => void;
|
|
54
|
+
readonly [valueBrand]: T;
|
|
55
|
+
}
|
|
56
|
+
/** @internal Erased descriptor; only the owning receiver supplies a context. */
|
|
57
|
+
export type ContextualMatch = MaterialMatch<never, unknown> | ContextBooleanMatch<never, unknown> | ContextScoreMatch<never, unknown>;
|
|
58
|
+
/** @internal Resolved, finite capture bounds. */
|
|
59
|
+
export interface ResolvedMaterialCaptureBudget {
|
|
60
|
+
readonly maxItems: number;
|
|
61
|
+
readonly maxBytes: number;
|
|
62
|
+
readonly maxNodes: number;
|
|
63
|
+
readonly maxDepth: number;
|
|
64
|
+
}
|
|
65
|
+
/** @internal Reader declarations never capture an Attempt. */
|
|
66
|
+
export interface ContextMatchDefinition {
|
|
67
|
+
readonly name: string;
|
|
68
|
+
readonly kind: ContextualMatch["kind"];
|
|
69
|
+
readonly read: (context: unknown) => unknown;
|
|
70
|
+
readonly match: unknown;
|
|
71
|
+
readonly capture: ResolvedMaterialCaptureBudget;
|
|
72
|
+
}
|
|
73
|
+
export declare function defineMaterialMatch<C, T>(definition: {
|
|
74
|
+
readonly name: string;
|
|
75
|
+
readonly read: (ctx: MatchContext<C>) => MaterialCollection<ReadonlyMaterial<T>>;
|
|
76
|
+
readonly match: BooleanMatch<ReadonlyMaterial<T>, ReadonlyMaterial<T>>;
|
|
77
|
+
readonly capture?: MaterialCaptureBudget;
|
|
78
|
+
}): MaterialMatch<C, ReadonlyMaterial<T>>;
|
|
79
|
+
export declare function defineMaterialMatch<C>(definition: {
|
|
80
|
+
readonly name: string;
|
|
81
|
+
readonly read: (ctx: MatchContext<C>) => ManagedToolCalls;
|
|
82
|
+
readonly match: ToolMatch;
|
|
83
|
+
readonly capture?: MaterialCaptureBudget;
|
|
84
|
+
}): MaterialMatch<C, ToolOccurrenceView>;
|
|
85
|
+
export declare function defineMaterialMatch<C>(definition: {
|
|
86
|
+
readonly name: string;
|
|
87
|
+
readonly read: (ctx: MatchContext<C>) => ManagedEventOccurrences;
|
|
88
|
+
readonly match: EventMatch;
|
|
89
|
+
readonly capture?: MaterialCaptureBudget;
|
|
90
|
+
}): MaterialMatch<C, EventOccurrenceView>;
|
|
91
|
+
export declare function defineContextMatch<C, T>(definition: {
|
|
92
|
+
readonly name: string;
|
|
93
|
+
readonly read: (ctx: MatchContext<C>) => MatchFact<ReadonlyMaterial<T>>;
|
|
94
|
+
readonly match: BooleanMatch<ReadonlyMaterial<T>, ReadonlyMaterial<T>>;
|
|
95
|
+
readonly capture?: FactCaptureBudget;
|
|
96
|
+
}): ContextBooleanMatch<C, ReadonlyMaterial<T>>;
|
|
97
|
+
export declare function defineContextMatch<C, T>(definition: {
|
|
98
|
+
readonly name: string;
|
|
99
|
+
readonly read: (ctx: MatchContext<C>) => MatchFact<ReadonlyMaterial<T>>;
|
|
100
|
+
readonly match: ScoreMatch<ReadonlyMaterial<T>>;
|
|
101
|
+
readonly capture?: FactCaptureBudget;
|
|
102
|
+
}): ContextScoreMatch<C, ReadonlyMaterial<T>>;
|
|
103
|
+
/** @internal Brands are verified without probing application names. */
|
|
104
|
+
export declare function isContextualMatch(value: unknown): value is ContextualMatch;
|
|
105
|
+
/** @internal Private reader access is limited to the authoring receiver. */
|
|
106
|
+
export declare function contextMatchDefinitionOf(match: object): ContextMatchDefinition;
|
|
107
|
+
export {};
|