niceeval 0.13.2 → 0.13.3
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/dist/agents/bub.cjs +4 -4
- package/dist/agents/bub.cjs.map +1 -1
- package/dist/agents/bub.d.cts +2 -2
- package/dist/agents/bub.d.mts +2 -2
- package/dist/agents/bub.d.ts +2 -2
- package/dist/agents/claude-code-native.cjs +213 -0
- package/dist/agents/claude-code-native.cjs.map +1 -0
- package/dist/agents/claude-code-native.d.cts +5 -0
- package/dist/agents/claude-code-native.d.mts +5 -0
- package/dist/agents/claude-code-native.d.ts +5 -0
- package/dist/agents/claude-code-native.js +6 -0
- package/dist/agents/claude-code-native.js.map +1 -0
- package/dist/agents/claude-code.cjs +26 -80
- package/dist/agents/claude-code.cjs.map +1 -1
- package/dist/agents/codex-app-server.cjs +314 -0
- package/dist/agents/codex-app-server.cjs.map +1 -0
- package/dist/agents/codex-app-server.d.cts +9 -0
- package/dist/agents/codex-app-server.d.mts +9 -0
- package/dist/agents/codex-app-server.d.ts +9 -0
- package/dist/agents/codex-app-server.js +6 -0
- package/dist/agents/codex-app-server.js.map +1 -0
- package/dist/agents/codex.cjs +19 -68
- package/dist/agents/codex.cjs.map +1 -1
- package/dist/agents/codex.d.cts +3 -3
- package/dist/agents/codex.d.mts +3 -3
- package/dist/agents/codex.d.ts +3 -3
- package/dist/agents/index.cjs +3 -1
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.d.cts +1 -0
- package/dist/agents/index.d.mts +1 -0
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/index.js +84 -82
- package/dist/agents/index.mjs +84 -82
- package/dist/agents/managed-jsonl.cjs +207 -0
- package/dist/agents/managed-jsonl.cjs.map +1 -0
- package/dist/agents/managed-jsonl.d.cts +39 -0
- package/dist/agents/managed-jsonl.d.mts +39 -0
- package/dist/agents/managed-jsonl.d.ts +39 -0
- package/dist/agents/managed-jsonl.js +6 -0
- package/dist/agents/managed-jsonl.js.map +1 -0
- package/dist/agents/managed-process.cjs +31 -0
- package/dist/agents/managed-process.cjs.map +1 -0
- package/dist/agents/managed-process.d.cts +3 -0
- package/dist/agents/managed-process.d.mts +3 -0
- package/dist/agents/managed-process.d.ts +3 -0
- package/dist/agents/managed-process.js +6 -0
- package/dist/agents/managed-process.js.map +1 -0
- package/dist/agents/omp.cjs +18 -1
- package/dist/agents/omp.cjs.map +1 -1
- package/dist/agents/sdk-streams.cjs +11 -4
- package/dist/agents/sdk-streams.cjs.map +1 -1
- package/dist/agents/types.cjs.map +1 -1
- package/dist/agents/types.d.cts +8 -0
- package/dist/agents/types.d.mts +8 -0
- package/dist/agents/types.d.ts +8 -0
- package/dist/analysis/bindings.cjs +74 -19
- package/dist/analysis/bindings.cjs.map +1 -1
- package/dist/analysis/bindings.d.cts +534 -156
- package/dist/analysis/bindings.d.mts +534 -156
- package/dist/analysis/bindings.d.ts +534 -156
- package/dist/analysis/domain-view.cjs.map +1 -1
- package/dist/analysis/domain-view.d.cts +137 -8
- package/dist/analysis/domain-view.d.mts +137 -8
- package/dist/analysis/domain-view.d.ts +137 -8
- package/dist/analysis/index.cjs.map +1 -1
- package/dist/analysis/index.d.cts +1 -1
- package/dist/analysis/index.d.mts +1 -1
- package/dist/analysis/index.d.ts +1 -1
- package/dist/assertions/api.cjs.map +1 -1
- package/dist/assertions/api.d.cts +62 -0
- package/dist/assertions/api.d.mts +62 -0
- package/dist/assertions/api.d.ts +62 -0
- package/dist/assertions/judge.cjs +56 -5
- package/dist/assertions/judge.cjs.map +1 -1
- package/dist/assertions/match.cjs +66 -42
- package/dist/assertions/match.cjs.map +1 -1
- package/dist/assertions/match.d.cts +13 -0
- package/dist/assertions/match.d.mts +13 -0
- package/dist/assertions/match.d.ts +13 -0
- package/dist/assertions/record/attachment.cjs +104 -33
- package/dist/assertions/record/attachment.cjs.map +1 -1
- package/dist/assertions/record/attachment.d.cts +294 -57
- package/dist/assertions/record/attachment.d.mts +294 -57
- package/dist/assertions/record/attachment.d.ts +294 -57
- package/dist/assertions/record/codec.cjs +91 -17
- package/dist/assertions/record/codec.cjs.map +1 -1
- package/dist/assertions/record/codec.d.cts +280 -52
- package/dist/assertions/record/codec.d.mts +280 -52
- package/dist/assertions/record/codec.d.ts +280 -52
- package/dist/assertions/record/index.js +2 -0
- package/dist/assertions/record/model.cjs +16 -0
- package/dist/assertions/record/model.cjs.map +1 -1
- package/dist/assertions/record/model.d.cts +120 -13
- package/dist/assertions/record/model.d.mts +120 -13
- package/dist/assertions/record/model.d.ts +120 -13
- package/dist/assertions/record/model.js +2 -0
- package/dist/assertions/record/producer.cjs +70 -50
- package/dist/assertions/record/producer.cjs.map +1 -1
- package/dist/assertions/record/producer.d.cts +8 -7
- package/dist/assertions/record/producer.d.mts +8 -7
- package/dist/assertions/record/producer.d.ts +8 -7
- package/dist/assertions/runtime.cjs +49 -7
- package/dist/assertions/runtime.cjs.map +1 -1
- package/dist/cli/application.cjs +40 -0
- package/dist/cli/application.cjs.map +1 -0
- package/dist/cli/application.d.cts +129 -0
- package/dist/cli/application.d.mts +129 -0
- package/dist/cli/application.d.ts +129 -0
- package/dist/cli/application.js +24 -0
- package/dist/cli/application.js.map +1 -0
- package/dist/cli/bootstrap.cjs +10 -4
- package/dist/cli/bootstrap.cjs.map +1 -1
- package/dist/cli/node-application.cjs +123 -0
- package/dist/cli/node-application.cjs.map +1 -0
- package/dist/cli/node-application.d.cts +14 -0
- package/dist/cli/node-application.d.mts +14 -0
- package/dist/cli/node-application.d.ts +14 -0
- package/dist/cli/node-application.js +26 -0
- package/dist/cli/node-application.js.map +1 -0
- package/dist/cli/program.cjs +2807 -0
- package/dist/cli/program.cjs.map +1 -0
- package/dist/cli/program.d.cts +352 -0
- package/dist/cli/program.d.mts +352 -0
- package/dist/cli/program.d.ts +352 -0
- package/dist/cli/program.js +36 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/project-configuration.cjs +134 -0
- package/dist/cli/project-configuration.cjs.map +1 -0
- package/dist/cli/project-configuration.d.cts +64 -0
- package/dist/cli/project-configuration.d.mts +64 -0
- package/dist/cli/project-configuration.d.ts +64 -0
- package/dist/cli/project-configuration.js +22 -0
- package/dist/cli/project-configuration.js.map +1 -0
- package/dist/cli/record.cjs +20 -4
- package/dist/cli/record.cjs.map +1 -1
- package/dist/cli/record.d.cts +3 -3
- package/dist/cli/record.d.mts +3 -3
- package/dist/cli/record.d.ts +3 -3
- package/dist/cli.cjs +19 -3130
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +2 -148
- package/dist/cli.d.mts +2 -148
- package/dist/cli.d.ts +2 -148
- package/dist/cli.js +22 -30
- package/dist/context/assert-first.cjs +21 -15
- package/dist/context/assert-first.cjs.map +1 -1
- package/dist/context/assert-first.d.cts +1 -0
- package/dist/context/assert-first.d.mts +1 -0
- package/dist/context/assert-first.d.ts +1 -0
- package/dist/context/attempt-resources.cjs +13 -0
- package/dist/context/attempt-resources.cjs.map +1 -0
- package/dist/context/attempt-resources.d.cts +3 -0
- package/dist/context/attempt-resources.d.mts +3 -0
- package/dist/context/attempt-resources.d.ts +3 -0
- package/dist/context/attempt-resources.js +8 -0
- package/dist/context/attempt-resources.js.map +1 -0
- package/dist/context/session.cjs +4 -3
- package/dist/context/session.cjs.map +1 -1
- package/dist/context/session.d.cts +1 -0
- package/dist/context/session.d.mts +1 -0
- package/dist/context/session.d.ts +1 -0
- package/dist/eval/record/verdict.cjs +3 -2
- package/dist/eval/record/verdict.cjs.map +1 -1
- package/dist/experiment/host/index.cjs +1 -6
- package/dist/experiment/host/index.cjs.map +1 -1
- package/dist/experiment/host/index.d.cts +1 -0
- package/dist/experiment/host/index.d.mts +1 -0
- package/dist/experiment/host/index.d.ts +1 -0
- package/dist/load-config.cjs +13 -4
- package/dist/load-config.cjs.map +1 -1
- package/dist/load-config.d.cts +4 -3
- package/dist/load-config.d.mts +4 -3
- package/dist/load-config.d.ts +4 -3
- package/dist/load-config.js +4 -2
- package/dist/o11y/parsers/codex.cjs +29 -7
- package/dist/o11y/parsers/codex.cjs.map +1 -1
- package/dist/record/codec/core.d.cts +0 -2
- package/dist/record/codec/core.d.mts +0 -2
- package/dist/record/codec/core.d.ts +0 -2
- package/dist/record/codec/identifiers.cjs +2 -3
- package/dist/record/codec/identifiers.cjs.map +1 -1
- package/dist/record/codec/identifiers.d.cts +1 -2
- package/dist/record/codec/identifiers.d.mts +1 -2
- package/dist/record/codec/identifiers.d.ts +1 -2
- package/dist/record/codec/identifiers.js +10 -12
- package/dist/record/codec/index.js +42 -44
- package/dist/record/definition/attachment.cjs +1 -0
- package/dist/record/definition/attachment.cjs.map +1 -1
- package/dist/record/definition/attachment.d.cts +14 -0
- package/dist/record/definition/attachment.d.mts +14 -0
- package/dist/record/definition/attachment.d.ts +14 -0
- package/dist/record/family/assertions-v1.cjs +104 -0
- package/dist/record/family/assertions-v1.cjs.map +1 -0
- package/dist/record/family/assertions-v1.d.cts +2 -0
- package/dist/record/family/assertions-v1.d.mts +2 -0
- package/dist/record/family/assertions-v1.d.ts +2 -0
- package/dist/record/family/assertions-v1.js +6 -0
- package/dist/record/family/assertions-v1.js.map +1 -0
- package/dist/record/family/assertions.cjs +16 -5
- package/dist/record/family/assertions.cjs.map +1 -1
- package/dist/record/family/assertions.d.cts +510 -56
- package/dist/record/family/assertions.d.mts +510 -56
- package/dist/record/family/assertions.d.ts +510 -56
- package/dist/record/family/assertions.js +14 -10
- package/dist/record/family/catalog.cjs +17 -1
- package/dist/record/family/catalog.cjs.map +1 -1
- package/dist/record/family/catalog.d.cts +1292 -104
- package/dist/record/family/catalog.d.mts +1292 -104
- package/dist/record/family/catalog.d.ts +1292 -104
- package/dist/record/family/catalog.js +22 -20
- package/dist/record/family/index.js +144 -138
- package/dist/record/family/observability-v1.cjs +5 -0
- package/dist/record/family/observability-v1.cjs.map +1 -1
- package/dist/record/family/observability.cjs +1 -1
- package/dist/record/family/observability.cjs.map +1 -1
- package/dist/record/host/runtime.cjs +323 -173
- package/dist/record/host/runtime.cjs.map +1 -1
- package/dist/record/host/types.cjs.map +1 -1
- package/dist/record/host/types.d.cts +9 -7
- package/dist/record/host/types.d.mts +9 -7
- package/dist/record/host/types.d.ts +9 -7
- package/dist/record/model/core.cjs.map +1 -1
- package/dist/record/model/core.d.cts +1 -2
- package/dist/record/model/core.d.mts +1 -2
- package/dist/record/model/core.d.ts +1 -2
- package/dist/record/model/definition.cjs +1 -2
- package/dist/record/model/definition.cjs.map +1 -1
- package/dist/record/model/definition.d.cts +1 -7
- package/dist/record/model/definition.d.mts +1 -7
- package/dist/record/model/definition.d.ts +1 -7
- package/dist/record/model/identifiers.cjs +2 -3
- package/dist/record/model/identifiers.cjs.map +1 -1
- package/dist/record/model/identifiers.d.cts +1 -3
- package/dist/record/model/identifiers.d.mts +1 -3
- package/dist/record/model/identifiers.d.ts +1 -3
- package/dist/record/model/identifiers.js +36 -38
- package/dist/record/model/index.js +60 -62
- package/dist/record/platform/node.cjs +17 -7
- package/dist/record/platform/node.cjs.map +1 -1
- package/dist/record/platform/services.cjs.map +1 -1
- package/dist/record/platform/services.d.cts +8 -3
- package/dist/record/platform/services.d.mts +8 -3
- package/dist/record/platform/services.d.ts +8 -3
- package/dist/record/reader/format.cjs +16 -65
- package/dist/record/reader/format.cjs.map +1 -1
- package/dist/record/reader/format.d.cts +5 -9
- package/dist/record/reader/format.d.mts +5 -9
- package/dist/record/reader/format.d.ts +5 -9
- package/dist/record/reader/index.js +10 -8
- package/dist/record/reader/runtime.cjs +63 -32
- package/dist/record/reader/runtime.cjs.map +1 -1
- package/dist/record/reader/runtime.d.cts +40 -4
- package/dist/record/reader/runtime.d.mts +40 -4
- package/dist/record/reader/runtime.d.ts +40 -4
- package/dist/record/reader/runtime.js +6 -4
- package/dist/report/assets/enhance.js +5 -5
- package/dist/report/assets/styles.css +190 -24
- package/dist/report/built-in/result-components.cjs +8 -5
- package/dist/report/built-in/result-components.cjs.map +1 -1
- package/dist/report/built-in/standard.cjs +3 -0
- package/dist/report/built-in/standard.cjs.map +1 -1
- package/dist/report/built-in/standard.d.cts +2 -0
- package/dist/report/built-in/standard.d.mts +2 -0
- package/dist/report/built-in/standard.d.ts +2 -0
- package/dist/report/client-dist/app.js +53 -0
- package/dist/report/components/attempt-detail/compute.cjs +108 -231
- package/dist/report/components/attempt-detail/compute.cjs.map +1 -1
- package/dist/report/components/attempt-detail/compute.d.cts +11 -45
- package/dist/report/components/attempt-detail/compute.d.mts +11 -45
- package/dist/report/components/attempt-detail/compute.d.ts +11 -45
- package/dist/report/components/attempt-detail/compute.js +2 -4
- package/dist/report/components/attempt-detail/content.cjs +4 -4
- package/dist/report/components/attempt-detail/content.cjs.map +1 -1
- package/dist/report/components/attempt-detail/validate.cjs +47 -4
- package/dist/report/components/attempt-detail/validate.cjs.map +1 -1
- package/dist/report/components/entity-lists/compute.cjs +9 -15
- package/dist/report/components/entity-lists/compute.cjs.map +1 -1
- package/dist/report/components/entity-lists/content.cjs +53 -40
- package/dist/report/components/entity-lists/content.cjs.map +1 -1
- package/dist/report/components/entity-lists/index.cjs +1 -3
- package/dist/report/components/entity-lists/index.cjs.map +1 -1
- package/dist/report/components/experiment-detail/compute.cjs +4 -6
- package/dist/report/components/experiment-detail/compute.cjs.map +1 -1
- package/dist/report/components/summaries/index.cjs +5 -1
- package/dist/report/components/summaries/index.cjs.map +1 -1
- package/dist/report/definition/cell.cjs +14 -7
- package/dist/report/definition/cell.cjs.map +1 -1
- package/dist/report/definition/cell.d.cts +4 -0
- package/dist/report/definition/cell.d.mts +4 -0
- package/dist/report/definition/cell.d.ts +4 -0
- package/dist/report/definition/primitives/assertion-evidence.cjs +96 -0
- package/dist/report/definition/primitives/assertion-evidence.cjs.map +1 -0
- package/dist/report/definition/primitives/assertion-evidence.d.cts +11 -0
- package/dist/report/definition/primitives/assertion-evidence.d.mts +11 -0
- package/dist/report/definition/primitives/assertion-evidence.d.ts +11 -0
- package/dist/report/definition/primitives/assertion-evidence.js +6 -0
- package/dist/report/definition/primitives/assertion-evidence.js.map +1 -0
- package/dist/report/definition/primitives/conversation.cjs +7 -0
- package/dist/report/definition/primitives/conversation.cjs.map +1 -1
- package/dist/report/definition/primitives/conversation.d.cts +2 -0
- package/dist/report/definition/primitives/conversation.d.mts +2 -0
- package/dist/report/definition/primitives/conversation.d.ts +2 -0
- package/dist/report/definition/primitives/turn-trace.cjs +53 -3
- package/dist/report/definition/primitives/turn-trace.cjs.map +1 -1
- package/dist/report/definition/primitives.cjs +14 -1
- package/dist/report/definition/primitives.cjs.map +1 -1
- package/dist/report/definition/report.cjs +16 -8
- package/dist/report/definition/report.cjs.map +1 -1
- package/dist/report/definition/report.d.cts +6 -0
- package/dist/report/definition/report.d.mts +6 -0
- package/dist/report/definition/report.d.ts +6 -0
- package/dist/report/definition/table-text.cjs +12 -3
- package/dist/report/definition/table-text.cjs.map +1 -1
- package/dist/report/definition/table-text.d.cts +6 -1
- package/dist/report/definition/table-text.d.mts +6 -1
- package/dist/report/definition/table-text.d.ts +6 -1
- package/dist/report/execution/model.cjs +6 -14
- package/dist/report/execution/model.cjs.map +1 -1
- package/dist/report/execution/model.d.cts +5 -10
- package/dist/report/execution/model.d.mts +5 -10
- package/dist/report/execution/model.d.ts +5 -10
- package/dist/report/execution/model.js +6 -6
- package/dist/report/execution/paths.cjs +0 -11
- package/dist/report/execution/paths.cjs.map +1 -1
- package/dist/report/execution/paths.d.cts +0 -1
- package/dist/report/execution/paths.d.mts +0 -1
- package/dist/report/execution/paths.d.ts +0 -1
- package/dist/report/execution/paths.js +6 -8
- package/dist/report/host/execute.cjs +13 -22
- package/dist/report/host/execute.cjs.map +1 -1
- package/dist/report/host/execute.d.cts +1 -4
- package/dist/report/host/execute.d.mts +1 -4
- package/dist/report/host/execute.d.ts +1 -4
- package/dist/report/host/from-record.cjs +3 -0
- package/dist/report/host/from-record.cjs.map +1 -1
- package/dist/report/host/from-record.d.cts +4 -1
- package/dist/report/host/from-record.d.mts +4 -1
- package/dist/report/host/from-record.d.ts +4 -1
- package/dist/report/host/site-assets.cjs +1 -2
- package/dist/report/host/site-assets.cjs.map +1 -1
- package/dist/report/host/site-assets.d.cts +0 -1
- package/dist/report/host/site-assets.d.mts +0 -1
- package/dist/report/host/site-assets.d.ts +0 -1
- package/dist/report/host/site-assets.js +2 -4
- package/dist/report/host/static.cjs +71 -346
- package/dist/report/host/static.cjs.map +1 -1
- package/dist/report/host/static.d.cts +1 -3
- package/dist/report/host/static.d.mts +1 -3
- package/dist/report/host/static.d.ts +1 -3
- package/dist/report/host/static.js +2 -2
- package/dist/report/host/view-session.cjs.map +1 -1
- package/dist/report/host/view-session.d.cts +1 -1
- package/dist/report/host/view-session.d.mts +1 -1
- package/dist/report/host/view-session.d.ts +1 -1
- package/dist/report/model/locale.cjs +1 -1
- package/dist/report/model/locale.cjs.map +1 -1
- package/dist/report/model/locale.d.cts +1 -1
- package/dist/report/model/locale.d.mts +1 -1
- package/dist/report/model/locale.d.ts +1 -1
- package/dist/report/model/pricing.cjs +2 -2
- package/dist/report/model/pricing.cjs.map +1 -1
- package/dist/report/react/enhance.js +5 -5
- package/dist/report/react/styles.css +190 -24
- package/dist/runner/adoption.cjs +4 -7
- package/dist/runner/adoption.cjs.map +1 -1
- package/dist/runner/attempt-resources.cjs +60 -0
- package/dist/runner/attempt-resources.cjs.map +1 -0
- package/dist/runner/attempt-resources.d.cts +13 -0
- package/dist/runner/attempt-resources.d.mts +13 -0
- package/dist/runner/attempt-resources.d.ts +13 -0
- package/dist/runner/attempt-resources.js +6 -0
- package/dist/runner/attempt-resources.js.map +1 -0
- package/dist/runner/attempt.cjs +37 -3
- package/dist/runner/attempt.cjs.map +1 -1
- package/dist/runner/feedback/failure.cjs +77 -2
- package/dist/runner/feedback/failure.cjs.map +1 -1
- package/dist/runner/feedback/failure.d.cts +2 -1
- package/dist/runner/feedback/failure.d.mts +2 -1
- package/dist/runner/feedback/failure.d.ts +2 -1
- package/dist/runner/project-current.cjs +2 -13
- package/dist/runner/project-current.cjs.map +1 -1
- package/dist/runner/project-current.d.cts +4 -2
- package/dist/runner/project-current.d.mts +4 -2
- package/dist/runner/project-current.d.ts +4 -2
- package/dist/runner/reporters/braintrust.cjs +7 -7
- package/dist/runner/reporters/braintrust.cjs.map +1 -1
- package/dist/runner/reuse-readback.cjs +3 -4
- package/dist/runner/reuse-readback.cjs.map +1 -1
- package/dist/runner/run.cjs +5 -2
- package/dist/runner/run.cjs.map +1 -1
- package/dist/sandbox/backend.cjs +32 -2
- package/dist/sandbox/backend.cjs.map +1 -1
- package/dist/sandbox/backend.d.cts +12 -1
- package/dist/sandbox/backend.d.mts +12 -1
- package/dist/sandbox/backend.d.ts +12 -1
- package/dist/sandbox/backend.js +28 -22
- package/dist/sandbox/docker.cjs +140 -0
- package/dist/sandbox/docker.cjs.map +1 -1
- package/dist/sandbox/docker.d.cts +3 -1
- package/dist/sandbox/docker.d.mts +3 -1
- package/dist/sandbox/docker.d.ts +3 -1
- package/dist/sandbox/e2b.cjs +42 -0
- package/dist/sandbox/e2b.cjs.map +1 -1
- package/dist/sandbox/e2b.d.cts +2 -0
- package/dist/sandbox/e2b.d.mts +2 -0
- package/dist/sandbox/e2b.d.ts +2 -0
- package/dist/sandbox/local.cjs +64 -0
- package/dist/sandbox/local.cjs.map +1 -1
- package/dist/sandbox/local.d.cts +3 -1
- package/dist/sandbox/local.d.mts +3 -1
- package/dist/sandbox/local.d.ts +3 -1
- package/dist/sandbox/managed-process.cjs +49 -0
- package/dist/sandbox/managed-process.cjs.map +1 -0
- package/dist/sandbox/managed-process.d.cts +11 -0
- package/dist/sandbox/managed-process.d.mts +11 -0
- package/dist/sandbox/managed-process.d.ts +11 -0
- package/dist/sandbox/managed-process.js +6 -0
- package/dist/sandbox/managed-process.js.map +1 -0
- package/dist/sandbox/types.cjs.map +1 -1
- package/dist/sandbox/types.d.cts +24 -0
- package/dist/sandbox/types.d.mts +24 -0
- package/dist/sandbox/types.d.ts +24 -0
- package/dist/sandbox/vercel.cjs +1 -0
- package/dist/sandbox/vercel.cjs.map +1 -1
- package/dist/sandbox/vercel.d.cts +1 -0
- package/dist/sandbox/vercel.d.mts +1 -0
- package/dist/sandbox/vercel.d.ts +1 -0
- package/dist/view/server.cjs +2 -37
- package/dist/view/server.cjs.map +1 -1
- package/dist/view/server.d.cts +0 -3
- package/dist/view/server.d.mts +0 -3
- package/dist/view/server.d.ts +0 -3
- package/docs-site/zh/reference/builtin-agents.mdx +7 -7
- package/docs-site/zh/reference/official-adapters.mdx +4 -4
- package/docs-site/zh/reference/report-components.mdx +2 -2
- package/docs-site/zh/tutorials/configuration.mdx +2 -2
- package/docs-site/zh/tutorials/deploy-report-site.mdx +24 -2
- package/docs-site/zh/tutorials/publish-report.mdx +4 -4
- package/docs-site/zh/tutorials/sandbox-agent.mdx +5 -5
- package/docs-site/zh/tutorials/theming.mdx +2 -2
- package/package.json +4 -6
- package/dist/record/migration/index.cjs +0 -5
- package/dist/record/migration/index.cjs.map +0 -1
- package/dist/record/migration/index.d.cts +0 -11
- package/dist/record/migration/index.d.mts +0 -11
- package/dist/record/migration/index.d.ts +0 -11
- package/dist/record/migration/index.js +0 -6
- package/dist/record/migration/index.js.map +0 -1
- package/dist/report/host/site-runtime.cjs +0 -92
- package/dist/report/host/site-runtime.cjs.map +0 -1
- package/dist/report/host/site-runtime.d.cts +0 -9
- package/dist/report/host/site-runtime.d.mts +0 -9
- package/dist/report/host/site-runtime.d.ts +0 -9
- package/dist/report/host/site-runtime.js +0 -10
- package/dist/report/host/site-runtime.js.map +0 -1
- package/dist/view/client-dist/app.css +0 -2
- package/dist/view/client-dist/app.js +0 -49
- package/dist/view/data.cjs +0 -3
- package/dist/view/data.cjs.map +0 -1
- package/dist/view/data.d.cts +0 -9
- package/dist/view/data.d.mts +0 -9
- package/dist/view/data.d.ts +0 -9
- package/dist/view/data.js +0 -4
- package/dist/view/data.js.map +0 -1
- package/dist/view/index.cjs +0 -24
- package/dist/view/index.cjs.map +0 -1
- package/dist/view/index.d.cts +0 -9
- package/dist/view/index.d.mts +0 -9
- package/dist/view/index.d.ts +0 -9
- package/dist/view/index.js +0 -28
- package/dist/view/index.js.map +0 -1
- package/dist/view/report-view-cache.cjs +0 -200
- package/dist/view/report-view-cache.cjs.map +0 -1
- package/dist/view/report-view-cache.d.cts +0 -67
- package/dist/view/report-view-cache.d.mts +0 -67
- package/dist/view/report-view-cache.d.ts +0 -67
- package/dist/view/report-view-cache.js +0 -8
- package/dist/view/report-view-cache.js.map +0 -1
- package/dist/view/shared/types.cjs +0 -3
- package/dist/view/shared/types.cjs.map +0 -1
- package/dist/view/shared/types.d.cts +0 -51
- package/dist/view/shared/types.d.mts +0 -51
- package/dist/view/shared/types.d.ts +0 -51
- package/dist/view/shared/types.js +0 -4
- package/dist/view/shared/types.js.map +0 -1
- package/dist/view/site.cjs +0 -32
- package/dist/view/site.cjs.map +0 -1
- package/dist/view/site.d.cts +0 -24
- package/dist/view/site.d.mts +0 -24
- package/dist/view/site.d.ts +0 -24
- package/dist/view/site.js +0 -8
- package/dist/view/site.js.map +0 -1
- package/dist/view/styles.css +0 -170
- package/dist/view/template.html +0 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"judge.js","sourceRoot":"","sources":["judge.ts"],"names":[],"mappings":";;;;;AAyMA,kDAKC;AAwDD,4CAaC;AAgBD,sDAIC;AA4ED,4DAEC;AArXD,2EAA2E;AAC3E,6DAA6D;AAC7D,yCAA0D;AAC1D,mCAA+C;AAC/C,oDAA4B;AAC5B,6CAA2C;AAG3C,wCAAoC;AACpC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,yBAAyB,GAAG,IAAI,CAAC;AACvC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAC/B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAqB7B,SAAS,YAAY,CAAC,KAAc;IAChC,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MA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AS,EAAE,QAAQ,EAAE,OAAO,CAAC;SACpF,CAAC,CAAC,CAAC;IACR,CAAC,CAAC,CAAC;IACH,OAAO,qBAAqB,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC;AACD,kFAAkF;AAClF,SAAgB,wBAAwB,CAAC,KAA2B;IAChE,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC","sourcesContent":["// Native LLM-as-Judge evaluator. The Assert-first path keeps provider I/O,\n// timeout, retry, and interruption inside the owning Effect.\nimport { ClosedQA, Factuality, Summary } from \"autoevals\";\nimport { Clock, Effect, Random } from \"effect\";\nimport OpenAI from \"openai\";\nimport { summaryText } from \"./display.ts\";\nimport type { MeasurementAssertionEvaluation } from \"./api.ts\";\nimport type { JudgeMaterial, ResolvedJudgeConfig } from \"./types.ts\";\nimport { getEnv } from \"../util.ts\";\nconst JUDGE_MAX_ATTEMPTS = 3;\nconst JUDGE_RETRY_BASE_DELAY_MS = 1000;\nconst PROBE_TIMEOUT_MS = 20000;\nconst PROBE_MAX_ATTEMPTS = 2;\nexport type JudgeRecipe = \"closedQA\" | \"factuality\" | \"summarizes\";\ntype AutoevalResult = {\n score?: number | null;\n metadata?: Record<string, unknown>;\n};\ntype JudgeMeasurementResult = {\n readonly state: \"measured\";\n readonly value: number;\n readonly evidence?: string;\n readonly explanation?: string;\n} | {\n readonly state: \"unavailable\";\n readonly reason: \"source-unavailable\";\n readonly detail: string;\n readonly evidence?: string;\n} | {\n readonly state: \"errored\";\n readonly code: string;\n readonly message: string;\n};\nfunction errorSummary(error: unknown): string {\n const message = error instanceof Error ? error.message : String(error);\n return message.replace(/\\s+/g, \" \").slice(0, 300);\n}\nfunction objectField(value: unknown, key: string): unknown {\n if (typeof value !== \"object\" || value === null)\n return undefined;\n try {\n return Reflect.get(value, key);\n }\n catch {\n return undefined;\n }\n}\nfunction judgeStatus(error: unknown): number | undefined {\n let current: unknown = error;\n for (let depth = 0; current !== undefined && depth < 5; depth++) {\n const status = objectField(current, \"status\");\n if (typeof status === \"number\" && Number.isInteger(status))\n return status;\n const nested = objectField(current, \"error\");\n const nestedStatus = objectField(nested, \"status\");\n if (typeof nestedStatus === \"number\" && Number.isInteger(nestedStatus))\n return nestedStatus;\n current = objectField(current, \"cause\");\n }\n return undefined;\n}\nfunction judgeCode(error: unknown): string | undefined {\n let current: unknown = error;\n for (let depth = 0; current !== undefined && depth < 5; depth++) {\n const code = objectField(current, \"code\");\n if (typeof code === \"string\" && code !== \"\")\n return code;\n const nestedCode = objectField(objectField(current, \"error\"), \"code\");\n if (typeof nestedCode === \"string\" && nestedCode !== \"\")\n return nestedCode;\n current = objectField(current, \"cause\");\n }\n return undefined;\n}\nfunction headerValue(headers: unknown, name: string): string | undefined {\n if (headers instanceof Headers)\n return headers.get(name) ?? undefined;\n if (typeof headers !== \"object\" || headers === null)\n return undefined;\n const lower = name.toLowerCase();\n for (const [key, value] of Object.entries(headers)) {\n if (key.toLowerCase() === lower && typeof value === \"string\")\n return value;\n }\n return undefined;\n}\nfunction retryAfterMs(headers: unknown, nowMs: number): number | undefined {\n const raw = headerValue(headers, \"retry-after\")?.trim();\n if (!raw)\n return undefined;\n const seconds = Number(raw);\n if (Number.isFinite(seconds) && seconds >= 0)\n return Math.round(seconds * 1000);\n const timestamp = Date.parse(raw);\n return Number.isFinite(timestamp) ? Math.max(0, timestamp - nowMs) : undefined;\n}\nfunction isTransientJudgeStatus(status: number | undefined): boolean {\n return status === 408 || status === 429 || (status !== undefined && status >= 500 && status <= 599);\n}\nfunction isConnectionFailure(error: unknown): boolean {\n let current: unknown = error;\n for (let depth = 0; current !== undefined && depth < 5; depth++) {\n const name = objectField(current, \"name\");\n const code = objectField(current, \"code\");\n if (name === \"APIUserAbortError\")\n return false;\n if (name === \"APIConnectionError\" || name === \"APIConnectionTimeoutError\")\n return true;\n if (typeof code === \"string\" && /^(?:ECONN|ENOTFOUND|EAI_AGAIN|ENETUNREACH|EHOSTUNREACH|ETIMEDOUT|ERR_TLS)/i.test(code))\n return true;\n if (/fetch failed|socket hang up|connection (?:reset|closed|refused)|network error|other side closed|timed? out|timeout|\\b(?:ECONNRESET|ECONNREFUSED|ENOTFOUND|EAI_AGAIN|ETIMEDOUT)\\b/i.test(errorSummary(current))) {\n return true;\n }\n current = objectField(current, \"cause\");\n }\n return false;\n}\nfunction isTransportFailure(error: unknown): boolean {\n return judgeStatus(error) !== undefined || isConnectionFailure(error);\n}\nfunction isTransientJudgeFailure(error: unknown): boolean {\n const status = judgeStatus(error);\n return isTransientJudgeStatus(status) || (status === undefined && isConnectionFailure(error));\n}\ninterface JudgeProviderFailure {\n readonly _tag: \"JudgeProviderFailure\";\n readonly error: unknown;\n}\ninterface JudgeProbeTimeout {\n readonly _tag: \"JudgeProbeTimeout\";\n}\ntype JudgeProbeFailure = JudgeProviderFailure | JudgeProbeTimeout;\n/**\n * An author-facing AbortSignal is external to this fiber. It must interrupt\n * the owning Effect instead of being reclassified as a Judge result.\n */\nfunction interruptWhenAborted(signal: AbortSignal): Effect.Effect<never> {\n return Effect.async<never>((resume) => {\n let completed = false;\n const interrupted = () => {\n if (completed)\n return;\n completed = true;\n resume(Effect.interrupt);\n };\n signal.addEventListener(\"abort\", interrupted, { once: true });\n // Register first, then inspect state so an abort cannot fall between the\n // initial check and listener installation.\n if (signal.aborted)\n interrupted();\n return Effect.sync(() => {\n completed = true;\n signal.removeEventListener(\"abort\", interrupted);\n });\n });\n}\nfunction interruptibleByCaller<A, E, R>(effect: Effect.Effect<A, E, R>, signal: AbortSignal | undefined): Effect.Effect<A, E, R> {\n if (signal === undefined)\n return effect;\n return Effect.suspend(() => signal.aborted\n ? Effect.interrupt\n : Effect.raceFirst(effect, interruptWhenAborted(signal)));\n}\nfunction formatSeconds(ms: number): string {\n const seconds = ms / 1000;\n return `${Number.isInteger(seconds) ? seconds : seconds.toFixed(1)}s`;\n}\nfunction judgeFailureEvidence(error: unknown, model: string, attempts: number, retried: boolean): string {\n const parts = [`model=${model}`];\n const status = judgeStatus(error);\n const code = judgeCode(error);\n if (status !== undefined)\n parts.push(`HTTP ${status}`);\n if (code !== undefined)\n parts.push(`code=${code}`);\n parts.push(errorSummary(error));\n parts.push(retried ? `retry=yes · attempts=${attempts}` : \"retry=no\");\n if (attempts >= JUDGE_MAX_ATTEMPTS)\n parts.push(\"retries exhausted\");\n return parts.join(\" · \");\n}\nfunction judgeClient(apiKey: string, baseURL: string, signal?: AbortSignal): OpenAI {\n return new OpenAI({\n apiKey,\n baseURL,\n maxRetries: 0,\n fetch: signal\n ? (input, init) => fetch(input, {\n ...init,\n signal: init?.signal ? AbortSignal.any([signal, init.signal]) : signal,\n })\n : undefined,\n });\n}\ntype AutoevalOpenAIClient = NonNullable<Parameters<typeof ClosedQA>[0][\"client\"]>;\nfunction bridgeAutoevalClient(client: OpenAI): {\n readonly client: AutoevalOpenAIClient;\n} {\n // @ts-expect-error autoevals and this package resolve equivalent OpenAI SDKs through distinct peer contexts.\n return { client };\n}\nexport function freezeJudgeMaterial(material: JudgeMaterial): JudgeMaterial {\n if (typeof material !== \"object\" || material === null || typeof material.input !== \"string\" || typeof material.output !== \"string\") {\n throw new TypeError(\"t.judge requires material { input: string, output: string }\");\n }\n return Object.freeze({ input: material.input, output: material.output });\n}\nfunction evidenceFor(material: JudgeMaterial): string {\n return JSON.stringify({ input: summaryText(material.input), output: summaryText(material.output) });\n}\nfunction missingConfiguration(resolved: ResolvedJudgeConfig): JudgeMeasurementResult | undefined {\n if (!resolved.model)\n return unavailable(\"judge-model-unresolved\");\n if (!getEnv(resolved.apiKeyEnv))\n return unavailable(`judge-key-unresolved (${resolved.apiKeyEnv} unset)`);\n return undefined;\n}\nconst retryProbe = Symbol(\"retry-judge-probe\");\nfunction probeAttempt(judge: ResolvedJudgeConfig, apiKey: string, endpoint: string, attempt: number, callerSignal: AbortSignal | undefined): Effect.Effect<string | undefined | typeof retryProbe, JudgeProbeFailure> {\n const probe = Effect.gen(function* () {\n const response = yield* Effect.tryPromise({\n try: async (effectSignal) => {\n // This is the probe's sole Promise adapter boundary. The Effect fiber\n // owns provider cancellation; caller aborts interrupt that fiber first.\n const response = await fetch(`${endpoint}/chat/completions`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", Authorization: `Bearer ${apiKey}` },\n body: JSON.stringify({ model: judge.model, messages: [{ role: \"user\", content: \"Reply with the single word: ok\" }] }),\n signal: effectSignal,\n });\n return {\n response,\n body: response.ok ? \"\" : await response.text().catch(() => \"\"),\n };\n },\n catch: (error): JudgeProviderFailure => ({ _tag: \"JudgeProviderFailure\", error }),\n });\n if (response.response.ok)\n return undefined;\n if (isTransientJudgeStatus(response.response.status) && attempt < PROBE_MAX_ATTEMPTS) {\n const delay = retryAfterMs(response.response.headers, yield* Clock.currentTimeMillis);\n if (delay !== undefined)\n yield* Effect.sleep(delay);\n return retryProbe;\n }\n return `Judge precheck failed for ${endpoint} (${judge.model}): HTTP ${response.response.status} ${response.body.slice(0, 300)}`;\n }).pipe(Effect.timeoutFail({\n duration: PROBE_TIMEOUT_MS,\n onTimeout: (): JudgeProbeTimeout => ({ _tag: \"JudgeProbeTimeout\" }),\n }));\n return interruptibleByCaller(probe, callerSignal);\n}\nfunction probeFailureMessage(failure: JudgeProbeFailure, judge: ResolvedJudgeConfig, endpoint: string): string {\n if (failure._tag === \"JudgeProbeTimeout\") {\n return `Judge precheck timed out for ${endpoint} (${judge.model}) after ${PROBE_TIMEOUT_MS / 1000}s`;\n }\n return `Judge precheck failed for ${endpoint} (${judge.model}): ${errorSummary(failure.error)}`;\n}\n/**\n * A precheck only tests a configured, credentialed endpoint. Missing model or\n * key remains a normal zero-network unavailable Assertion when an author consumes it.\n */\nexport function probeJudgeEffect(judge: ResolvedJudgeConfig, signal?: AbortSignal): Effect.Effect<string | undefined> {\n return Effect.suspend(() => {\n const apiKey = getEnv(judge.apiKeyEnv);\n if (!judge.model || !apiKey)\n return Effect.succeed(undefined);\n const endpoint = judge.baseUrl.replace(/\\/$/, \"\");\n const probe = (attempt: number): Effect.Effect<string | undefined> => probeAttempt(judge, apiKey, endpoint, attempt, signal).pipe(Effect.flatMap((result) => result === retryProbe\n ? probe(attempt + 1)\n : Effect.succeed(result)), Effect.catchAll((failure) => attempt === PROBE_MAX_ATTEMPTS\n ? Effect.succeed(probeFailureMessage(failure, judge, endpoint))\n : probe(attempt + 1)));\n return probe(1);\n });\n}\nfunction unavailableForCall(model: string, timeoutMs: number, attempts: number, retried: boolean): JudgeMeasurementResult {\n return unavailable(\"judge-call-failed\", `model=${model} · timed out after ${formatSeconds(timeoutMs)} · retry=${retried ? \"yes\" : \"no\"} · attempts=${attempts}`);\n}\nfunction unavailable(detail: string, evidence?: string): JudgeMeasurementResult {\n return {\n state: \"unavailable\",\n reason: \"source-unavailable\",\n detail,\n ...(evidence === undefined ? {} : { evidence }),\n };\n}\nfunction evaluatorError(code: string, message: string): JudgeMeasurementResult {\n return { state: \"errored\", code, message };\n}\n/** Throws synchronously at the author callsite when the Eval did not opt in. */\nexport function assertJudgeCapability(judge: ResolvedJudgeConfig | undefined): asserts judge is ResolvedJudgeConfig {\n if (judge === undefined) {\n throw new Error(\"Judge Assertion requires defineEval({ judge: true }) or defineScoreEval({ judge: true })\");\n }\n}\nexport interface JudgeRecipeExecution {\n readonly judge: ResolvedJudgeConfig;\n readonly recipe: JudgeRecipe;\n readonly reference: string;\n readonly material: JudgeMaterial;\n readonly signal?: AbortSignal;\n readonly random?: () => number;\n}\nfunction evaluateAutoeval(input: JudgeRecipeExecution, material: JudgeMaterial, apiKey: string, model: string): Effect.Effect<AutoevalResult, JudgeProviderFailure> {\n const provider = Effect.tryPromise({\n try: (effectSignal) => {\n const client = bridgeAutoevalClient(judgeClient(apiKey, input.judge.baseUrl, effectSignal));\n return Promise.resolve(input.recipe === \"closedQA\"\n ? ClosedQA({ input: material.input, output: material.output, criteria: input.reference, model, ...client })\n : input.recipe === \"factuality\"\n ? Factuality({ input: material.input, output: material.output, expected: input.reference, model, ...client })\n : Summary({ input: material.input, output: material.output, expected: input.reference, model, ...client }));\n },\n catch: (error): JudgeProviderFailure => ({ _tag: \"JudgeProviderFailure\", error }),\n });\n return provider;\n}\nfunction judgeSleep(delayMs: number): Effect.Effect<void> {\n return Effect.sleep(delayMs);\n}\n/**\n * The real Judge invocation. Provider I/O is adapted once, then retry,\n * timeout, interruption, and delay remain inside the owning Effect.\n */\nfunction evaluateJudgeRecipe(input: JudgeRecipeExecution): Effect.Effect<JudgeMeasurementResult> {\n const evaluation = Effect.suspend(() => {\n const { judge: resolved } = input;\n const frozenMaterial = freezeJudgeMaterial(input.material);\n const missing = missingConfiguration(resolved);\n if (missing !== undefined)\n return Effect.succeed(missing);\n const model = resolved.model!;\n const apiKey = getEnv(resolved.apiKeyEnv)!;\n let attempts = 0;\n let retried = false;\n const evaluate = (attempt: number): Effect.Effect<JudgeMeasurementResult> => Effect.sync(() => {\n attempts = attempt + 1;\n }).pipe(Effect.zipRight(evaluateAutoeval(input, frozenMaterial, apiKey, model).pipe(Effect.flatMap((result): Effect.Effect<JudgeMeasurementResult> => {\n if (typeof result.score !== \"number\" || !Number.isFinite(result.score) || result.score < 0 || result.score > 1) {\n return Effect.succeed(evaluatorError(\"judge-invalid-response\", \"Judge returned no finite score in [0, 1]\"));\n }\n const rationale = result.metadata?.rationale;\n return Effect.succeed({\n state: \"measured\" as const,\n value: result.score,\n evidence: evidenceFor(frozenMaterial),\n ...(typeof rationale === \"string\" && rationale.trim() !== \"\" ? { explanation: summaryText(rationale) } : {}),\n });\n }), Effect.catchAll((failure: JudgeProviderFailure): Effect.Effect<JudgeMeasurementResult> => Effect.gen(function* () {\n const error = failure.error;\n if (!isTransportFailure(error))\n return evaluatorError(\"judge-evaluator-error\", errorSummary(error));\n if (!isTransientJudgeFailure(error) || attempt + 1 >= JUDGE_MAX_ATTEMPTS) {\n return unavailable(\"judge-call-failed\", judgeFailureEvidence(error, model, attempts, retried));\n }\n const retryAfter = retryAfterMs(objectField(error, \"headers\"), yield* Clock.currentTimeMillis);\n const delay = retryAfter ?? (input.random ? input.random() : yield* Random.next) * JUDGE_RETRY_BASE_DELAY_MS * 2 ** attempt;\n retried = true;\n yield* judgeSleep(delay);\n return yield* evaluate(attempt + 1);\n })))));\n return evaluate(0).pipe(Effect.timeoutTo({\n duration: resolved.timeoutMs,\n onSuccess: (evaluation) => evaluation,\n onTimeout: () => unavailableForCall(model, resolved.timeoutMs, attempts, retried),\n }));\n });\n return interruptibleByCaller(evaluation, input.signal);\n}\n/** Assert-first bridge: one provider Promise adaptation in the Attempt Effect. */\nexport function evaluateJudgeMeasurement(input: JudgeRecipeExecution): Effect.Effect<MeasurementAssertionEvaluation, never, never> {\n return evaluateJudgeRecipe(input);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"judge.js","sourceRoot":"","sources":["judge.ts"],"names":[],"mappings":";;;;;AA2MA,kDAKC;AAqDD,4CAaC;AAgBD,sDAIC;AA0FD,4DA0CC;AA1aD,2EAA2E;AAC3E,6DAA6D;AAC7D,yCAA0D;AAC1D,mCAA+C;AAC/C,oDAA4B;AAC5B,6CAA2C;AAG3C,wCAAoC;AACpC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,yBAAyB,GAAG,IAAI,CAAC;AACvC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAC/B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAuB7B,SAAS,YAAY,CAAC,KAAc;IAChC,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACtD,CAAC;AACD,SAAS,WAAW,CAAC,KAAc,EAAE,GAAW;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK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AE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;wBAC1E,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;wBACzE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;wBACvE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;qBAC7E,CAAC;iBACL,CAAC,CAAC;YACP,KAAK,SAAS;gBACV,OAAO,MAAM,CAAC,MAAM,CAAC;oBACjB,KAAK,EAAE,SAAkB;oBACzB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;iBACxE,CAAC,CAAC;QACX,CAAC;IACL,CAAC,CAAC,CAAC,CAAC;AACR,CAAC","sourcesContent":["// Native LLM-as-Judge evaluator. The Assert-first path keeps provider I/O,\n// timeout, retry, and interruption inside the owning Effect.\nimport { ClosedQA, Factuality, Summary } from \"autoevals\";\nimport { Clock, Effect, Random } from \"effect\";\nimport OpenAI from \"openai\";\nimport { summaryText } from \"./display.ts\";\nimport type { MeasurementAssertionEvaluation } from \"./api.ts\";\nimport type { JudgeMaterial, ResolvedJudgeConfig } from \"./types.ts\";\nimport { getEnv } from \"../util.ts\";\nconst JUDGE_MAX_ATTEMPTS = 3;\nconst JUDGE_RETRY_BASE_DELAY_MS = 1000;\nconst PROBE_TIMEOUT_MS = 20000;\nconst PROBE_MAX_ATTEMPTS = 2;\nexport type JudgeRecipe = \"closedQA\" | \"factuality\" | \"summarizes\";\ntype AutoevalResult = {\n score?: number | null;\n metadata?: Record<string, unknown>;\n};\ntype JudgeMeasurementResult = {\n readonly state: \"measured\";\n readonly value: number;\n readonly evidence?: string;\n readonly explanation?: string;\n readonly detail?: string;\n readonly citations?: readonly string[];\n} | {\n readonly state: \"unavailable\";\n readonly reason: \"source-unavailable\";\n readonly detail: string;\n readonly evidence?: string;\n} | {\n readonly state: \"errored\";\n readonly code: string;\n readonly message: string;\n};\nfunction errorSummary(error: unknown): string {\n const message = error instanceof Error ? error.message : String(error);\n return message.replace(/\\s+/g, \" \").slice(0, 300);\n}\nfunction objectField(value: unknown, key: string): unknown {\n if (typeof value !== \"object\" || value === null)\n return undefined;\n try {\n return Reflect.get(value, key);\n }\n catch {\n return undefined;\n }\n}\nfunction judgeStatus(error: unknown): number | undefined {\n let current: unknown = error;\n for (let depth = 0; current !== undefined && depth < 5; depth++) {\n const status = objectField(current, \"status\");\n if (typeof status === \"number\" && Number.isInteger(status))\n return status;\n const nested = objectField(current, \"error\");\n const nestedStatus = objectField(nested, \"status\");\n if (typeof nestedStatus === \"number\" && Number.isInteger(nestedStatus))\n return nestedStatus;\n current = objectField(current, \"cause\");\n }\n return undefined;\n}\nfunction judgeCode(error: unknown): string | undefined {\n let current: unknown = error;\n for (let depth = 0; current !== undefined && depth < 5; depth++) {\n const code = objectField(current, \"code\");\n if (typeof code === \"string\" && code !== \"\")\n return code;\n const nestedCode = objectField(objectField(current, \"error\"), \"code\");\n if (typeof nestedCode === \"string\" && nestedCode !== \"\")\n return nestedCode;\n current = objectField(current, \"cause\");\n }\n return undefined;\n}\nfunction headerValue(headers: unknown, name: string): string | undefined {\n if (headers instanceof Headers)\n return headers.get(name) ?? undefined;\n if (typeof headers !== \"object\" || headers === null)\n return undefined;\n const lower = name.toLowerCase();\n for (const [key, value] of Object.entries(headers)) {\n if (key.toLowerCase() === lower && typeof value === \"string\")\n return value;\n }\n return undefined;\n}\nfunction retryAfterMs(headers: unknown, nowMs: number): number | undefined {\n const raw = headerValue(headers, \"retry-after\")?.trim();\n if (!raw)\n return undefined;\n const seconds = Number(raw);\n if (Number.isFinite(seconds) && seconds >= 0)\n return Math.round(seconds * 1000);\n const timestamp = Date.parse(raw);\n return Number.isFinite(timestamp) ? Math.max(0, timestamp - nowMs) : undefined;\n}\nfunction isTransientJudgeStatus(status: number | undefined): boolean {\n return status === 408 || status === 429 || (status !== undefined && status >= 500 && status <= 599);\n}\nfunction isConnectionFailure(error: unknown): boolean {\n let current: unknown = error;\n for (let depth = 0; current !== undefined && depth < 5; depth++) {\n const name = objectField(current, \"name\");\n const code = objectField(current, \"code\");\n if (name === \"APIUserAbortError\")\n return false;\n if (name === \"APIConnectionError\" || name === \"APIConnectionTimeoutError\")\n return true;\n if (typeof code === \"string\" && /^(?:ECONN|ENOTFOUND|EAI_AGAIN|ENETUNREACH|EHOSTUNREACH|ETIMEDOUT|ERR_TLS)/i.test(code))\n return true;\n if (/fetch failed|socket hang up|connection (?:reset|closed|refused)|network error|other side closed|timed? out|timeout|\\b(?:ECONNRESET|ECONNREFUSED|ENOTFOUND|EAI_AGAIN|ETIMEDOUT)\\b/i.test(errorSummary(current))) {\n return true;\n }\n current = objectField(current, \"cause\");\n }\n return false;\n}\nfunction isTransportFailure(error: unknown): boolean {\n return judgeStatus(error) !== undefined || isConnectionFailure(error);\n}\nfunction isTransientJudgeFailure(error: unknown): boolean {\n const status = judgeStatus(error);\n return isTransientJudgeStatus(status) || (status === undefined && isConnectionFailure(error));\n}\ninterface JudgeProviderFailure {\n readonly _tag: \"JudgeProviderFailure\";\n readonly error: unknown;\n}\ninterface JudgeProbeTimeout {\n readonly _tag: \"JudgeProbeTimeout\";\n}\ntype JudgeProbeFailure = JudgeProviderFailure | JudgeProbeTimeout;\n/**\n * An author-facing AbortSignal is external to this fiber. It must interrupt\n * the owning Effect instead of being reclassified as a Judge result.\n */\nfunction interruptWhenAborted(signal: AbortSignal): Effect.Effect<never> {\n return Effect.async<never>((resume) => {\n let completed = false;\n const interrupted = () => {\n if (completed)\n return;\n completed = true;\n resume(Effect.interrupt);\n };\n signal.addEventListener(\"abort\", interrupted, { once: true });\n // Register first, then inspect state so an abort cannot fall between the\n // initial check and listener installation.\n if (signal.aborted)\n interrupted();\n return Effect.sync(() => {\n completed = true;\n signal.removeEventListener(\"abort\", interrupted);\n });\n });\n}\nfunction interruptibleByCaller<A, E, R>(effect: Effect.Effect<A, E, R>, signal: AbortSignal | undefined): Effect.Effect<A, E, R> {\n if (signal === undefined)\n return effect;\n return Effect.suspend(() => signal.aborted\n ? Effect.interrupt\n : Effect.raceFirst(effect, interruptWhenAborted(signal)));\n}\nfunction formatSeconds(ms: number): string {\n const seconds = ms / 1000;\n return `${Number.isInteger(seconds) ? seconds : seconds.toFixed(1)}s`;\n}\nfunction judgeFailureEvidence(error: unknown, model: string, attempts: number, retried: boolean): string {\n const parts = [`model=${model}`];\n const status = judgeStatus(error);\n const code = judgeCode(error);\n if (status !== undefined)\n parts.push(`HTTP ${status}`);\n if (code !== undefined)\n parts.push(`code=${code}`);\n parts.push(errorSummary(error));\n parts.push(retried ? `retry=yes · attempts=${attempts}` : \"retry=no\");\n if (attempts >= JUDGE_MAX_ATTEMPTS)\n parts.push(\"retries exhausted\");\n return parts.join(\" · \");\n}\nfunction judgeClient(apiKey: string, baseURL: string, signal?: AbortSignal): OpenAI {\n return new OpenAI({\n apiKey,\n baseURL,\n maxRetries: 0,\n fetch: signal\n ? (input, init) => fetch(input, {\n ...init,\n signal: init?.signal ? AbortSignal.any([signal, init.signal]) : signal,\n })\n : undefined,\n });\n}\ntype AutoevalOpenAIClient = NonNullable<Parameters<typeof ClosedQA>[0][\"client\"]>;\nfunction bridgeAutoevalClient(client: OpenAI): {\n readonly client: AutoevalOpenAIClient;\n} {\n // @ts-expect-error autoevals and this package resolve equivalent OpenAI SDKs through distinct peer contexts.\n return { client };\n}\nexport function freezeJudgeMaterial(material: JudgeMaterial): JudgeMaterial {\n if (typeof material !== \"object\" || material === null || typeof material.input !== \"string\" || typeof material.output !== \"string\") {\n throw new TypeError(\"t.judge requires material { input: string, output: string }\");\n }\n return Object.freeze({ input: material.input, output: material.output });\n}\nfunction missingConfiguration(resolved: ResolvedJudgeConfig): JudgeMeasurementResult | undefined {\n if (!resolved.model)\n return unavailable(\"judge-model-unresolved\");\n if (!getEnv(resolved.apiKeyEnv))\n return unavailable(`judge-key-unresolved (${resolved.apiKeyEnv} unset)`);\n return undefined;\n}\nconst retryProbe = Symbol(\"retry-judge-probe\");\nfunction probeAttempt(judge: ResolvedJudgeConfig, apiKey: string, endpoint: string, attempt: number, callerSignal: AbortSignal | undefined): Effect.Effect<string | undefined | typeof retryProbe, JudgeProbeFailure> {\n const probe = Effect.gen(function* () {\n const response = yield* Effect.tryPromise({\n try: async (effectSignal) => {\n // This is the probe's sole Promise adapter boundary. The Effect fiber\n // owns provider cancellation; caller aborts interrupt that fiber first.\n const response = await fetch(`${endpoint}/chat/completions`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", Authorization: `Bearer ${apiKey}` },\n body: JSON.stringify({ model: judge.model, messages: [{ role: \"user\", content: \"Reply with the single word: ok\" }] }),\n signal: effectSignal,\n });\n return {\n response,\n body: response.ok ? \"\" : await response.text().catch(() => \"\"),\n };\n },\n catch: (error): JudgeProviderFailure => ({ _tag: \"JudgeProviderFailure\", error }),\n });\n if (response.response.ok)\n return undefined;\n if (isTransientJudgeStatus(response.response.status) && attempt < PROBE_MAX_ATTEMPTS) {\n const delay = retryAfterMs(response.response.headers, yield* Clock.currentTimeMillis);\n if (delay !== undefined)\n yield* Effect.sleep(delay);\n return retryProbe;\n }\n return `Judge precheck failed for ${endpoint} (${judge.model}): HTTP ${response.response.status} ${response.body.slice(0, 300)}`;\n }).pipe(Effect.timeoutFail({\n duration: PROBE_TIMEOUT_MS,\n onTimeout: (): JudgeProbeTimeout => ({ _tag: \"JudgeProbeTimeout\" }),\n }));\n return interruptibleByCaller(probe, callerSignal);\n}\nfunction probeFailureMessage(failure: JudgeProbeFailure, judge: ResolvedJudgeConfig, endpoint: string): string {\n if (failure._tag === \"JudgeProbeTimeout\") {\n return `Judge precheck timed out for ${endpoint} (${judge.model}) after ${PROBE_TIMEOUT_MS / 1000}s`;\n }\n return `Judge precheck failed for ${endpoint} (${judge.model}): ${errorSummary(failure.error)}`;\n}\n/**\n * A precheck only tests a configured, credentialed endpoint. Missing model or\n * key remains a normal zero-network unavailable Assertion when an author consumes it.\n */\nexport function probeJudgeEffect(judge: ResolvedJudgeConfig, signal?: AbortSignal): Effect.Effect<string | undefined> {\n return Effect.suspend(() => {\n const apiKey = getEnv(judge.apiKeyEnv);\n if (!judge.model || !apiKey)\n return Effect.succeed(undefined);\n const endpoint = judge.baseUrl.replace(/\\/$/, \"\");\n const probe = (attempt: number): Effect.Effect<string | undefined> => probeAttempt(judge, apiKey, endpoint, attempt, signal).pipe(Effect.flatMap((result) => result === retryProbe\n ? probe(attempt + 1)\n : Effect.succeed(result)), Effect.catchAll((failure) => attempt === PROBE_MAX_ATTEMPTS\n ? Effect.succeed(probeFailureMessage(failure, judge, endpoint))\n : probe(attempt + 1)));\n return probe(1);\n });\n}\nfunction unavailableForCall(model: string, timeoutMs: number, attempts: number, retried: boolean): JudgeMeasurementResult {\n return unavailable(\"judge-call-failed\", `model=${model} · timed out after ${formatSeconds(timeoutMs)} · retry=${retried ? \"yes\" : \"no\"} · attempts=${attempts}`);\n}\nfunction unavailable(detail: string, evidence?: string): JudgeMeasurementResult {\n return {\n state: \"unavailable\",\n reason: \"source-unavailable\",\n detail,\n ...(evidence === undefined ? {} : { evidence }),\n };\n}\nfunction evaluatorError(code: string, message: string): JudgeMeasurementResult {\n return { state: \"errored\", code, message };\n}\n/** Throws synchronously at the author callsite when the Eval did not opt in. */\nexport function assertJudgeCapability(judge: ResolvedJudgeConfig | undefined): asserts judge is ResolvedJudgeConfig {\n if (judge === undefined) {\n throw new Error(\"Judge Assertion requires defineEval({ judge: true }) or defineScoreEval({ judge: true })\");\n }\n}\nexport interface JudgeRecipeExecution {\n readonly judge: ResolvedJudgeConfig;\n readonly recipe: JudgeRecipe;\n readonly reference: string;\n readonly material: JudgeMaterial;\n readonly signal?: AbortSignal;\n readonly random?: () => number;\n}\nfunction evaluateAutoeval(input: JudgeRecipeExecution, material: JudgeMaterial, apiKey: string, model: string): Effect.Effect<AutoevalResult, JudgeProviderFailure> {\n const provider = Effect.tryPromise({\n try: (effectSignal) => {\n const client = bridgeAutoevalClient(judgeClient(apiKey, input.judge.baseUrl, effectSignal));\n return Promise.resolve(input.recipe === \"closedQA\"\n ? ClosedQA({ input: material.input, output: material.output, criteria: input.reference, model, ...client })\n : input.recipe === \"factuality\"\n ? Factuality({ input: material.input, output: material.output, expected: input.reference, model, ...client })\n : Summary({ input: material.input, output: material.output, expected: input.reference, model, ...client }));\n },\n catch: (error): JudgeProviderFailure => ({ _tag: \"JudgeProviderFailure\", error }),\n });\n return provider;\n}\nfunction judgeSleep(delayMs: number): Effect.Effect<void> {\n return Effect.sleep(delayMs);\n}\n/**\n * The real Judge invocation. Provider I/O is adapted once, then retry,\n * timeout, interruption, and delay remain inside the owning Effect.\n */\nfunction evaluateJudgeRecipe(input: JudgeRecipeExecution): Effect.Effect<JudgeMeasurementResult> {\n const evaluation = Effect.suspend(() => {\n const { judge: resolved } = input;\n const frozenMaterial = freezeJudgeMaterial(input.material);\n const missing = missingConfiguration(resolved);\n if (missing !== undefined)\n return Effect.succeed(missing);\n const model = resolved.model!;\n const apiKey = getEnv(resolved.apiKeyEnv)!;\n let attempts = 0;\n let retried = false;\n const evaluate = (attempt: number): Effect.Effect<JudgeMeasurementResult> => Effect.sync(() => {\n attempts = attempt + 1;\n }).pipe(Effect.zipRight(evaluateAutoeval(input, frozenMaterial, apiKey, model).pipe(Effect.flatMap((result): Effect.Effect<JudgeMeasurementResult> => {\n if (typeof result.score !== \"number\" || !Number.isFinite(result.score) || result.score < 0 || result.score > 1) {\n return Effect.succeed(evaluatorError(\"judge-invalid-response\", \"Judge returned no finite score in [0, 1]\"));\n }\n const rationale = result.metadata?.rationale;\n const returnedEvidence = result.metadata?.evidence;\n const returnedDetail = result.metadata?.detail;\n const returnedCitations = result.metadata?.citations;\n return Effect.succeed({\n state: \"measured\" as const,\n value: result.score,\n ...(typeof returnedEvidence === \"string\" && returnedEvidence.trim() !== \"\"\n ? { evidence: summaryText(returnedEvidence) }\n : {}),\n ...(typeof rationale === \"string\" && rationale.trim() !== \"\" ? { explanation: summaryText(rationale) } : {}),\n ...(typeof returnedDetail === \"string\" && returnedDetail.trim() !== \"\" ? { detail: summaryText(returnedDetail) } : {}),\n ...(Array.isArray(returnedCitations)\n ? {\n citations: Object.freeze(returnedCitations\n .slice(0, 16)\n .filter((citation): citation is string => typeof citation === \"string\" && citation.trim() !== \"\")\n .map(summaryText)),\n }\n : {}),\n });\n }), Effect.catchAll((failure: JudgeProviderFailure): Effect.Effect<JudgeMeasurementResult> => Effect.gen(function* () {\n const error = failure.error;\n if (!isTransportFailure(error))\n return evaluatorError(\"judge-evaluator-error\", errorSummary(error));\n if (!isTransientJudgeFailure(error) || attempt + 1 >= JUDGE_MAX_ATTEMPTS) {\n return unavailable(\"judge-call-failed\", judgeFailureEvidence(error, model, attempts, retried));\n }\n const retryAfter = retryAfterMs(objectField(error, \"headers\"), yield* Clock.currentTimeMillis);\n const delay = retryAfter ?? (input.random ? input.random() : yield* Random.next) * JUDGE_RETRY_BASE_DELAY_MS * 2 ** attempt;\n retried = true;\n yield* judgeSleep(delay);\n return yield* evaluate(attempt + 1);\n })))));\n return evaluate(0).pipe(Effect.timeoutTo({\n duration: resolved.timeoutMs,\n onSuccess: (evaluation) => evaluation,\n onTimeout: () => unavailableForCall(model, resolved.timeoutMs, attempts, retried),\n }));\n });\n return interruptibleByCaller(evaluation, input.signal);\n}\n/** Assert-first bridge: one provider Promise adaptation in the Attempt Effect. */\nexport function evaluateJudgeMeasurement(input: JudgeRecipeExecution): Effect.Effect<MeasurementAssertionEvaluation, never, never> {\n return evaluateJudgeRecipe(input).pipe(Effect.map((result): MeasurementAssertionEvaluation => {\n switch (result.state) {\n case \"measured\":\n return Object.freeze({\n state: \"measured\" as const,\n value: result.value,\n detail: Object.freeze({\n evidence: result.evidence === undefined\n ? Object.freeze({ state: \"unavailable\", reason: \"not-recorded\" })\n : Object.freeze({ state: \"available\", value: result.evidence }),\n rationale: result.explanation === undefined\n ? Object.freeze({ state: \"unavailable\", reason: \"not-recorded\" })\n : Object.freeze({ state: \"available\", value: result.explanation }),\n detail: result.detail === undefined\n ? Object.freeze({ state: \"unavailable\", reason: \"not-recorded\" })\n : Object.freeze({ state: \"available\", value: result.detail }),\n citations: result.citations === undefined\n ? Object.freeze({ state: \"unavailable\", reason: \"not-recorded\" })\n : Object.freeze({ state: \"available\", value: result.citations }),\n }),\n });\n case \"unavailable\":\n return Object.freeze({\n state: \"unavailable\" as const,\n reason: result.reason,\n detail: Object.freeze({\n failureDetail: result.detail,\n failureEvidence: result.evidence ?? Object.freeze({ state: \"unavailable\", reason: \"not-recorded\" }),\n rationale: Object.freeze({ state: \"unavailable\", reason: \"not-recorded\" }),\n evidence: Object.freeze({ state: \"unavailable\", reason: \"not-recorded\" }),\n detail: Object.freeze({ state: \"unavailable\", reason: \"not-recorded\" }),\n citations: Object.freeze({ state: \"unavailable\", reason: \"not-recorded\" }),\n }),\n });\n case \"errored\":\n return Object.freeze({\n state: \"errored\" as const,\n detail: Object.freeze({ code: result.code, message: result.message }),\n });\n }\n }));\n}\n"]}
|
|
@@ -1085,6 +1085,9 @@ function assertManagedEventMatch(value, label = "match") {
|
|
|
1085
1085
|
async function evaluateToolMatchCollection(match, occurrences, options) {
|
|
1086
1086
|
const sampledCandidates = [];
|
|
1087
1087
|
let matchCount = 0;
|
|
1088
|
+
let mismatchCount = 0;
|
|
1089
|
+
let unavailableCount = 0;
|
|
1090
|
+
let examined = 0;
|
|
1088
1091
|
let firstMatch;
|
|
1089
1092
|
let firstUnavailable;
|
|
1090
1093
|
let exactOverage;
|
|
@@ -1094,6 +1097,7 @@ async function evaluateToolMatchCollection(match, occurrences, options) {
|
|
|
1094
1097
|
candidate: occurrence,
|
|
1095
1098
|
result: await evaluateBooleanMatch(match, occurrence),
|
|
1096
1099
|
});
|
|
1100
|
+
examined += 1;
|
|
1097
1101
|
if (sampledCandidates.length < limits_ts_1.assertionRuntimeLimits.collectionDiagnosticCandidates) {
|
|
1098
1102
|
sampledCandidates.push(candidate);
|
|
1099
1103
|
}
|
|
@@ -1102,16 +1106,36 @@ async function evaluateToolMatchCollection(match, occurrences, options) {
|
|
|
1102
1106
|
firstMatch ??= candidate;
|
|
1103
1107
|
if (options.quantifier.kind === "exact" && matchCount === options.quantifier.count + 1) {
|
|
1104
1108
|
exactOverage = candidate;
|
|
1109
|
+
break;
|
|
1105
1110
|
}
|
|
1111
|
+
if (options.quantifier.kind === "absent")
|
|
1112
|
+
break;
|
|
1113
|
+
if (options.quantifier.kind === "at-least" && matchCount === options.quantifier.count)
|
|
1114
|
+
break;
|
|
1106
1115
|
}
|
|
1107
1116
|
else if (candidate.result.state === "unavailable") {
|
|
1117
|
+
unavailableCount += 1;
|
|
1108
1118
|
firstUnavailable ??= candidate;
|
|
1109
1119
|
}
|
|
1120
|
+
else {
|
|
1121
|
+
mismatchCount += 1;
|
|
1122
|
+
}
|
|
1110
1123
|
}
|
|
1111
1124
|
const unavailableReason = firstUnavailable?.result.state === "unavailable"
|
|
1112
1125
|
? firstUnavailable.result.reason
|
|
1113
1126
|
: options.coverageReason;
|
|
1114
1127
|
const incomplete = unavailableReason !== undefined;
|
|
1128
|
+
const exhaustive = options.coverageReason === undefined && examined === occurrences.length;
|
|
1129
|
+
const receipt = (decisive) => Object.freeze({
|
|
1130
|
+
examined,
|
|
1131
|
+
matched: matchCount,
|
|
1132
|
+
mismatched: mismatchCount,
|
|
1133
|
+
unavailable: unavailableCount,
|
|
1134
|
+
knownTotal: occurrences.length,
|
|
1135
|
+
complete: options.coverageReason === undefined,
|
|
1136
|
+
exhaustive,
|
|
1137
|
+
decisive,
|
|
1138
|
+
});
|
|
1115
1139
|
const received = `${matchCount} definite match${matchCount === 1 ? "" : "es"}`;
|
|
1116
1140
|
const candidateLocator = (candidate) => candidate === undefined ? undefined : { kind: "tool-occurrence", id: candidate.candidate.id };
|
|
1117
1141
|
const diagnosticSample = (...decisive) => {
|
|
@@ -1138,65 +1162,65 @@ async function evaluateToolMatchCollection(match, occurrences, options) {
|
|
|
1138
1162
|
if (options.quantifier.kind === "absent") {
|
|
1139
1163
|
const first = firstMatch;
|
|
1140
1164
|
if (first !== undefined) {
|
|
1141
|
-
return mismatched(diagnostic("tool-absence-mismatch", `notCalledTool(${match.name}) observed a matching tool`, {
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1165
|
+
return Object.freeze({ ...mismatched(diagnostic("tool-absence-mismatch", `notCalledTool(${match.name}) observed a matching tool`, {
|
|
1166
|
+
expected: `no ${match.name}`,
|
|
1167
|
+
received,
|
|
1168
|
+
locator: candidateLocator(first),
|
|
1169
|
+
...diagnosticSample(first),
|
|
1170
|
+
})), receipt: receipt(true) });
|
|
1147
1171
|
}
|
|
1148
1172
|
if (incomplete) {
|
|
1149
|
-
return unavailable(unavailableReason, diagnostic("tool-absence-unavailable", `notCalledTool(${match.name}) cannot prove absence`, {
|
|
1173
|
+
return Object.freeze({ ...unavailable(unavailableReason, diagnostic("tool-absence-unavailable", `notCalledTool(${match.name}) cannot prove absence`, {
|
|
1174
|
+
expected: `no ${match.name}`,
|
|
1175
|
+
received,
|
|
1176
|
+
reason: unavailableReason,
|
|
1177
|
+
...diagnosticSample(firstUnavailable),
|
|
1178
|
+
})), receipt: receipt(false) });
|
|
1179
|
+
}
|
|
1180
|
+
return Object.freeze({ ...matched(undefined, diagnostic("tool-absence-match", `notCalledTool(${match.name}) observed no matching tool`, {
|
|
1150
1181
|
expected: `no ${match.name}`,
|
|
1151
1182
|
received,
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
}));
|
|
1155
|
-
}
|
|
1156
|
-
return matched(undefined, diagnostic("tool-absence-match", `notCalledTool(${match.name}) observed no matching tool`, {
|
|
1157
|
-
expected: `no ${match.name}`,
|
|
1158
|
-
received,
|
|
1159
|
-
...diagnosticSample(),
|
|
1160
|
-
}));
|
|
1183
|
+
...diagnosticSample(),
|
|
1184
|
+
})), receipt: receipt(true) });
|
|
1161
1185
|
}
|
|
1162
1186
|
const { kind, count } = options.quantifier;
|
|
1163
1187
|
const expected = kind === "exact" ? `exactly ${count} × ${match.name}` : `at least ${count} × ${match.name}`;
|
|
1164
1188
|
if (kind === "exact" && matchCount > count) {
|
|
1165
1189
|
const overage = exactOverage;
|
|
1166
|
-
return mismatched(diagnostic("tool-count-exceeded", `calledTool(${match.name}) exceeded its exact count`, {
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1190
|
+
return Object.freeze({ ...mismatched(diagnostic("tool-count-exceeded", `calledTool(${match.name}) exceeded its exact count`, {
|
|
1191
|
+
expected,
|
|
1192
|
+
received,
|
|
1193
|
+
locator: candidateLocator(overage),
|
|
1194
|
+
...diagnosticSample(overage),
|
|
1195
|
+
})), receipt: receipt(true) });
|
|
1172
1196
|
}
|
|
1173
1197
|
if (kind === "at-least" && matchCount >= count) {
|
|
1174
|
-
return matched(firstMatch?.candidate, diagnostic("tool-count-match", `calledTool(${match.name}) satisfied its lower bound`, {
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1198
|
+
return Object.freeze({ ...matched(firstMatch?.candidate, diagnostic("tool-count-match", `calledTool(${match.name}) satisfied its lower bound`, {
|
|
1199
|
+
expected,
|
|
1200
|
+
received,
|
|
1201
|
+
...diagnosticSample(firstMatch),
|
|
1202
|
+
})), receipt: receipt(true) });
|
|
1179
1203
|
}
|
|
1180
1204
|
if (kind === "exact" && matchCount === count && !incomplete) {
|
|
1181
|
-
return matched(firstMatch?.candidate, diagnostic("tool-count-match", `calledTool(${match.name}) satisfied its exact count`, {
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1205
|
+
return Object.freeze({ ...matched(firstMatch?.candidate, diagnostic("tool-count-match", `calledTool(${match.name}) satisfied its exact count`, {
|
|
1206
|
+
expected,
|
|
1207
|
+
received,
|
|
1208
|
+
...diagnosticSample(firstMatch),
|
|
1209
|
+
})), receipt: receipt(true) });
|
|
1186
1210
|
}
|
|
1187
1211
|
if (incomplete) {
|
|
1188
|
-
return unavailable(unavailableReason, diagnostic("tool-count-unavailable", `calledTool(${match.name}) cannot decide its count`, {
|
|
1212
|
+
return Object.freeze({ ...unavailable(unavailableReason, diagnostic("tool-count-unavailable", `calledTool(${match.name}) cannot decide its count`, {
|
|
1213
|
+
expected,
|
|
1214
|
+
received,
|
|
1215
|
+
reason: unavailableReason,
|
|
1216
|
+
...diagnosticSample(firstUnavailable),
|
|
1217
|
+
})), receipt: receipt(false) });
|
|
1218
|
+
}
|
|
1219
|
+
return Object.freeze({ ...mismatched(diagnostic("tool-count-mismatch", `calledTool(${match.name}) did not satisfy its count`, {
|
|
1189
1220
|
expected,
|
|
1190
1221
|
received,
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
}));
|
|
1194
|
-
}
|
|
1195
|
-
return mismatched(diagnostic("tool-count-mismatch", `calledTool(${match.name}) did not satisfy its count`, {
|
|
1196
|
-
expected,
|
|
1197
|
-
received,
|
|
1198
|
-
...diagnosticSample(),
|
|
1199
|
-
}));
|
|
1222
|
+
...diagnosticSample(),
|
|
1223
|
+
})), receipt: receipt(true) });
|
|
1200
1224
|
}
|
|
1201
1225
|
function commandResult(occurrence, executable, argsStart, excludes) {
|
|
1202
1226
|
const projection = occurrence.command;
|