niceeval 0.13.1 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INDEX.md +25 -2
- package/README.md +9 -10
- package/README.zh.md +9 -10
- package/dist/agents/ai-sdk.cjs.map +1 -1
- package/dist/agents/ai-sdk.d.cts +1 -1
- package/dist/agents/ai-sdk.d.mts +1 -1
- package/dist/agents/ai-sdk.d.ts +1 -1
- package/dist/agents/bub-install-spec.cjs +19 -5
- package/dist/agents/bub-install-spec.cjs.map +1 -1
- package/dist/agents/bub-install-spec.d.cts +9 -2
- package/dist/agents/bub-install-spec.d.mts +9 -2
- package/dist/agents/bub-install-spec.d.ts +9 -2
- package/dist/agents/bub-install-spec.js +14 -12
- package/dist/agents/bub.cjs +10 -6
- package/dist/agents/bub.cjs.map +1 -1
- package/dist/agents/bub.d.cts +2 -2
- package/dist/agents/bub.d.mts +2 -2
- package/dist/agents/bub.d.ts +2 -2
- package/dist/agents/claude-code.cjs.map +1 -1
- package/dist/agents/claude-code.d.cts +2 -2
- package/dist/agents/claude-code.d.mts +2 -2
- package/dist/agents/claude-code.d.ts +2 -2
- package/dist/agents/codex.cjs +4 -4
- package/dist/agents/codex.cjs.map +1 -1
- package/dist/agents/codex.d.cts +3 -3
- package/dist/agents/codex.d.mts +3 -3
- package/dist/agents/codex.d.ts +3 -3
- package/dist/agents/coding-cli-versions.cjs +10 -1
- package/dist/agents/coding-cli-versions.cjs.map +1 -1
- package/dist/agents/coding-cli-versions.d.cts +8 -3
- package/dist/agents/coding-cli-versions.d.mts +8 -3
- package/dist/agents/coding-cli-versions.d.ts +8 -3
- package/dist/agents/coding-cli-versions.js +18 -12
- package/dist/agents/deepseek-harness.cjs +151 -0
- package/dist/agents/deepseek-harness.cjs.map +1 -0
- package/dist/agents/deepseek-harness.d.cts +14 -0
- package/dist/agents/deepseek-harness.d.mts +14 -0
- package/dist/agents/deepseek-harness.d.ts +14 -0
- package/dist/agents/deepseek-harness.js +7 -0
- package/dist/agents/deepseek-harness.js.map +1 -0
- package/dist/agents/exact-npm-plugins.cjs +28 -0
- package/dist/agents/exact-npm-plugins.cjs.map +1 -0
- package/dist/agents/exact-npm-plugins.d.cts +10 -0
- package/dist/agents/exact-npm-plugins.d.mts +10 -0
- package/dist/agents/exact-npm-plugins.d.ts +10 -0
- package/dist/agents/exact-npm-plugins.js +8 -0
- package/dist/agents/exact-npm-plugins.js.map +1 -0
- package/dist/agents/index.cjs +5 -1
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.d.cts +4 -0
- package/dist/agents/index.d.mts +4 -0
- package/dist/agents/index.d.ts +4 -0
- package/dist/agents/index.js +54 -50
- package/dist/agents/index.mjs +54 -50
- package/dist/agents/omp.cjs +170 -0
- package/dist/agents/omp.cjs.map +1 -0
- package/dist/agents/omp.d.cts +14 -0
- package/dist/agents/omp.d.mts +14 -0
- package/dist/agents/omp.d.ts +14 -0
- package/dist/agents/omp.js +7 -0
- package/dist/agents/omp.js.map +1 -0
- package/dist/agents/openclaw.cjs +51 -2
- package/dist/agents/openclaw.cjs.map +1 -1
- package/dist/agents/openclaw.d.cts +2 -0
- package/dist/agents/openclaw.d.mts +2 -0
- package/dist/agents/openclaw.d.ts +2 -0
- package/dist/agents/types.cjs.map +1 -1
- package/dist/agents/types.d.cts +4 -4
- package/dist/agents/types.d.mts +4 -4
- package/dist/agents/types.d.ts +4 -4
- package/dist/agents/ui-message-stream.cjs +24 -7
- package/dist/agents/ui-message-stream.cjs.map +1 -1
- package/dist/analysis/api.cjs +28 -2
- package/dist/analysis/api.cjs.map +1 -1
- package/dist/analysis/api.d.cts +22 -1
- package/dist/analysis/api.d.mts +22 -1
- package/dist/analysis/api.d.ts +22 -1
- package/dist/analysis/api.js +8 -6
- package/dist/analysis/bindings.cjs +11 -18
- package/dist/analysis/bindings.cjs.map +1 -1
- package/dist/analysis/bindings.d.cts +177 -49
- package/dist/analysis/bindings.d.mts +177 -49
- package/dist/analysis/bindings.d.ts +177 -49
- package/dist/analysis/contracts.cjs +1 -0
- package/dist/analysis/contracts.cjs.map +1 -1
- package/dist/analysis/contracts.d.cts +43 -3
- package/dist/analysis/contracts.d.mts +43 -3
- package/dist/analysis/contracts.d.ts +43 -3
- package/dist/analysis/cost-projection.cjs +2 -1
- package/dist/analysis/cost-projection.cjs.map +1 -1
- package/dist/analysis/cost-projection.d.cts +1 -1
- package/dist/analysis/cost-projection.d.mts +1 -1
- package/dist/analysis/cost-projection.d.ts +1 -1
- package/dist/analysis/cost.cjs +13 -3
- package/dist/analysis/cost.cjs.map +1 -1
- package/dist/analysis/cost.d.cts +10 -3
- package/dist/analysis/cost.d.mts +10 -3
- package/dist/analysis/cost.d.ts +10 -3
- package/dist/analysis/experiment-groups.cjs +96 -0
- package/dist/analysis/experiment-groups.cjs.map +1 -0
- package/dist/analysis/experiment-groups.d.cts +9 -0
- package/dist/analysis/experiment-groups.d.mts +9 -0
- package/dist/analysis/experiment-groups.d.ts +9 -0
- package/dist/analysis/experiment-groups.js +10 -0
- package/dist/analysis/experiment-groups.js.map +1 -0
- package/dist/analysis/index.cjs +4 -1
- package/dist/analysis/index.cjs.map +1 -1
- package/dist/analysis/index.d.cts +4 -2
- package/dist/analysis/index.d.mts +4 -2
- package/dist/analysis/index.d.ts +4 -2
- package/dist/analysis/index.js +40 -36
- package/dist/analysis/index.mjs +40 -36
- package/dist/assertions/limits.cjs +4 -0
- package/dist/assertions/limits.cjs.map +1 -1
- package/dist/assertions/limits.d.cts +4 -0
- package/dist/assertions/limits.d.mts +4 -0
- package/dist/assertions/limits.d.ts +4 -0
- package/dist/assertions/match.cjs +63 -25
- package/dist/assertions/match.cjs.map +1 -1
- package/dist/assertions/match.d.cts +7 -0
- package/dist/assertions/match.d.mts +7 -0
- package/dist/assertions/match.d.ts +7 -0
- package/dist/assertions/record/attachment.cjs +32 -4
- package/dist/assertions/record/attachment.cjs.map +1 -1
- package/dist/assertions/record/diff.cjs +10 -4
- package/dist/assertions/record/diff.cjs.map +1 -1
- package/dist/assertions/record/producer.cjs +101 -4
- package/dist/assertions/record/producer.cjs.map +1 -1
- package/dist/assertions/record/producer.d.cts +4 -1
- package/dist/assertions/record/producer.d.mts +4 -1
- package/dist/assertions/record/producer.d.ts +4 -1
- package/dist/assertions/runtime.cjs +45 -5
- package/dist/assertions/runtime.cjs.map +1 -1
- package/dist/cli/record.cjs +113 -8
- package/dist/cli/record.cjs.map +1 -1
- package/dist/cli/record.d.cts +20 -1
- package/dist/cli/record.d.mts +20 -1
- package/dist/cli/record.d.ts +20 -1
- package/dist/cli/record.js +4 -2
- package/dist/cli.cjs +386 -31
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +10 -2
- package/dist/cli.d.mts +10 -2
- package/dist/cli.d.ts +10 -2
- package/dist/context/send-retry.cjs +4 -4
- package/dist/context/send-retry.cjs.map +1 -1
- package/dist/coordination/host/runtime.cjs +8 -30
- package/dist/coordination/host/runtime.cjs.map +1 -1
- package/dist/coordination/host/runtime.d.cts +3 -3
- package/dist/coordination/host/runtime.d.mts +3 -3
- package/dist/coordination/host/runtime.d.ts +3 -3
- package/dist/coordination/host/types.cjs.map +1 -1
- package/dist/coordination/host/types.d.cts +0 -5
- package/dist/coordination/host/types.d.mts +0 -5
- package/dist/coordination/host/types.d.ts +0 -5
- package/dist/coordination/platform/node.cjs +90 -9
- package/dist/coordination/platform/node.cjs.map +1 -1
- package/dist/define.cjs +25 -1
- package/dist/define.cjs.map +1 -1
- package/dist/experiment/host/index.cjs +1 -0
- package/dist/experiment/host/index.cjs.map +1 -1
- package/dist/i18n/en.cjs +26 -8
- package/dist/i18n/en.cjs.map +1 -1
- package/dist/i18n/en.d.cts +19 -6
- package/dist/i18n/en.d.mts +19 -6
- package/dist/i18n/en.d.ts +19 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/o11y/parsers/hermes.cjs +1 -1
- package/dist/o11y/parsers/hermes.cjs.map +1 -1
- package/dist/o11y/prices.json +1 -1
- package/dist/o11y/record/families.cjs +12 -3
- package/dist/o11y/record/families.cjs.map +1 -1
- package/dist/o11y/record/families.d.cts +8 -8
- package/dist/o11y/record/families.d.mts +8 -8
- package/dist/o11y/record/families.d.ts +8 -8
- package/dist/o11y/record/family-projectors.d.cts +66 -18
- package/dist/o11y/record/family-projectors.d.mts +66 -18
- package/dist/o11y/record/family-projectors.d.ts +66 -18
- package/dist/o11y/record/family-writers.d.cts +11 -3
- package/dist/o11y/record/family-writers.d.mts +11 -3
- package/dist/o11y/record/family-writers.d.ts +11 -3
- package/dist/o11y/record/runner-producer.cjs +14 -4
- package/dist/o11y/record/runner-producer.cjs.map +1 -1
- package/dist/record/codec/core.d.cts +2 -2
- package/dist/record/codec/core.d.mts +2 -2
- package/dist/record/codec/core.d.ts +2 -2
- package/dist/record/family/catalog.d.cts +44 -12
- package/dist/record/family/catalog.d.mts +44 -12
- package/dist/record/family/catalog.d.ts +44 -12
- package/dist/record/family/index.js +128 -124
- package/dist/record/family/observability-v1.cjs +35 -0
- package/dist/record/family/observability-v1.cjs.map +1 -0
- package/dist/record/family/observability-v1.d.cts +3 -0
- package/dist/record/family/observability-v1.d.mts +3 -0
- package/dist/record/family/observability-v1.d.ts +3 -0
- package/dist/record/family/observability-v1.js +6 -0
- package/dist/record/family/observability-v1.js.map +1 -0
- package/dist/record/family/observability.cjs +58 -9
- package/dist/record/family/observability.cjs.map +1 -1
- package/dist/record/family/observability.d.cts +1014 -15
- package/dist/record/family/observability.d.mts +1014 -15
- package/dist/record/family/observability.d.ts +1014 -15
- package/dist/record/family/observability.js +22 -18
- package/dist/record/host/runtime.cjs +600 -31
- package/dist/record/host/runtime.cjs.map +1 -1
- package/dist/record/host/types.cjs.map +1 -1
- package/dist/record/host/types.d.cts +33 -9
- package/dist/record/host/types.d.mts +33 -9
- package/dist/record/host/types.d.ts +33 -9
- package/dist/record/maintenance/runtime.cjs +1 -2
- package/dist/record/maintenance/runtime.cjs.map +1 -1
- package/dist/record/model/core.cjs.map +1 -1
- package/dist/record/model/core.d.cts +1 -1
- package/dist/record/model/core.d.mts +1 -1
- package/dist/record/model/core.d.ts +1 -1
- package/dist/record/model/definition.d.cts +6 -6
- package/dist/record/model/definition.d.mts +6 -6
- package/dist/record/model/definition.d.ts +6 -6
- package/dist/record/model/identifiers.cjs +1 -1
- package/dist/record/model/identifiers.cjs.map +1 -1
- package/dist/record/model/identifiers.d.cts +1 -1
- package/dist/record/model/identifiers.d.mts +1 -1
- package/dist/record/model/identifiers.d.ts +1 -1
- package/dist/record/platform/node.cjs +159 -23
- package/dist/record/platform/node.cjs.map +1 -1
- package/dist/record/platform/services.cjs.map +1 -1
- package/dist/record/platform/services.d.cts +15 -2
- package/dist/record/platform/services.d.mts +15 -2
- package/dist/record/platform/services.d.ts +15 -2
- package/dist/record/reader/errors.cjs +37 -1
- package/dist/record/reader/errors.cjs.map +1 -1
- package/dist/record/reader/errors.d.cts +49 -1
- package/dist/record/reader/errors.d.mts +49 -1
- package/dist/record/reader/errors.d.ts +49 -1
- package/dist/record/reader/errors.js +22 -12
- package/dist/record/reader/format.cjs +76 -17
- package/dist/record/reader/format.cjs.map +1 -1
- package/dist/record/reader/format.d.cts +11 -4
- package/dist/record/reader/format.d.mts +11 -4
- package/dist/record/reader/format.d.ts +11 -4
- package/dist/record/reader/format.js +2 -0
- package/dist/record/reader/index.js +32 -18
- package/dist/record/reader/runtime.cjs +64 -0
- package/dist/record/reader/runtime.cjs.map +1 -1
- package/dist/record/reader/runtime.d.cts +15 -0
- package/dist/record/reader/runtime.d.mts +15 -0
- package/dist/record/reader/runtime.d.ts +15 -0
- package/dist/record/reader/runtime.js +2 -0
- package/dist/report/assets/styles.css +53 -29
- package/dist/report/built-in/analysis-values.cjs +21 -13
- package/dist/report/built-in/analysis-values.cjs.map +1 -1
- package/dist/report/built-in/analysis-values.d.cts +11 -22
- package/dist/report/built-in/analysis-values.d.mts +11 -22
- package/dist/report/built-in/analysis-values.d.ts +11 -22
- package/dist/report/built-in/analysis-values.js +4 -6
- package/dist/report/built-in/index.cjs +1 -3
- package/dist/report/built-in/index.cjs.map +1 -1
- package/dist/report/built-in/index.d.cts +1 -1
- package/dist/report/built-in/index.d.mts +1 -1
- package/dist/report/built-in/index.d.ts +1 -1
- package/dist/report/built-in/index.js +4 -8
- package/dist/report/built-in/index.mjs +4 -8
- package/dist/report/built-in/machine.cjs +0 -2
- package/dist/report/built-in/machine.cjs.map +1 -1
- package/dist/report/built-in/machine.d.cts +0 -2
- package/dist/report/built-in/machine.d.mts +0 -2
- package/dist/report/built-in/machine.d.ts +0 -2
- package/dist/report/built-in/result-components.cjs +49 -51
- package/dist/report/built-in/result-components.cjs.map +1 -1
- package/dist/report/built-in/result-components.d.cts +16 -17
- package/dist/report/built-in/result-components.d.mts +16 -17
- package/dist/report/built-in/result-components.d.ts +16 -17
- package/dist/report/built-in/result-components.js +0 -4
- package/dist/report/built-in/run-membership-overview.cjs +126 -17
- package/dist/report/built-in/run-membership-overview.cjs.map +1 -1
- package/dist/report/built-in/run-membership-overview.d.cts +14 -0
- package/dist/report/built-in/run-membership-overview.d.mts +14 -0
- package/dist/report/built-in/run-membership-overview.d.ts +14 -0
- package/dist/report/built-in/run-membership-overview.js +4 -2
- package/dist/report/built-in/standard.cjs +80 -45
- package/dist/report/built-in/standard.cjs.map +1 -1
- package/dist/report/built-in/standard.d.cts +19 -41
- package/dist/report/built-in/standard.d.mts +19 -41
- package/dist/report/built-in/standard.d.ts +19 -41
- package/dist/report/built-in/standard.js +6 -6
- package/dist/report/components/attempt-detail/compute.cjs +78 -2
- package/dist/report/components/attempt-detail/compute.cjs.map +1 -1
- package/dist/report/components/attempt-detail/compute.d.cts +1 -1
- package/dist/report/components/attempt-detail/compute.d.mts +1 -1
- package/dist/report/components/attempt-detail/compute.d.ts +1 -1
- package/dist/report/components/attempt-detail/content.cjs +1 -1
- package/dist/report/components/attempt-detail/content.cjs.map +1 -1
- package/dist/report/components/entity-lists/compute.cjs +42 -5
- package/dist/report/components/entity-lists/compute.cjs.map +1 -1
- package/dist/report/components/entity-lists/compute.d.cts +10 -8
- package/dist/report/components/entity-lists/compute.d.mts +10 -8
- package/dist/report/components/entity-lists/compute.d.ts +10 -8
- package/dist/report/components/entity-lists/content.cjs +31 -6
- package/dist/report/components/entity-lists/content.cjs.map +1 -1
- package/dist/report/components/entity-lists/index.cjs +9 -4
- package/dist/report/components/entity-lists/index.cjs.map +1 -1
- package/dist/report/components/entity-lists/index.d.cts +4 -7
- package/dist/report/components/entity-lists/index.d.mts +4 -7
- package/dist/report/components/entity-lists/index.d.ts +4 -7
- package/dist/report/components/summaries/compute.cjs +8 -1
- package/dist/report/components/summaries/compute.cjs.map +1 -1
- package/dist/report/components/summaries/compute.d.cts +9 -1
- package/dist/report/components/summaries/compute.d.mts +9 -1
- package/dist/report/components/summaries/compute.d.ts +9 -1
- package/dist/report/components/summaries/index.cjs +48 -4
- package/dist/report/components/summaries/index.cjs.map +1 -1
- package/dist/report/components/summaries/index.d.cts +7 -4
- package/dist/report/components/summaries/index.d.mts +7 -4
- package/dist/report/components/summaries/index.d.ts +7 -4
- package/dist/report/definition/cell.cjs +3 -0
- package/dist/report/definition/cell.cjs.map +1 -1
- package/dist/report/definition/cell.d.cts +2 -0
- package/dist/report/definition/cell.d.mts +2 -0
- package/dist/report/definition/cell.d.ts +2 -0
- package/dist/report/definition/primitives/chart.cjs +8 -5
- package/dist/report/definition/primitives/chart.cjs.map +1 -1
- package/dist/report/definition/primitives/points-dataset.cjs +1 -0
- package/dist/report/definition/primitives/points-dataset.cjs.map +1 -1
- package/dist/report/definition/primitives.cjs +15 -2
- package/dist/report/definition/primitives.cjs.map +1 -1
- package/dist/report/definition/report.cjs +27 -3
- package/dist/report/definition/report.cjs.map +1 -1
- package/dist/report/definition/report.d.cts +8 -0
- package/dist/report/definition/report.d.mts +8 -0
- package/dist/report/definition/report.d.ts +8 -0
- package/dist/report/execution/machine.cjs +30 -14
- package/dist/report/execution/machine.cjs.map +1 -1
- package/dist/report/execution/machine.d.cts +20 -10
- package/dist/report/execution/machine.d.mts +20 -10
- package/dist/report/execution/machine.d.ts +20 -10
- package/dist/report/execution/machine.js +6 -6
- package/dist/report/host/execute.cjs +25 -16
- package/dist/report/host/execute.cjs.map +1 -1
- package/dist/report/host/execute.d.cts +4 -0
- package/dist/report/host/execute.d.mts +4 -0
- package/dist/report/host/execute.d.ts +4 -0
- package/dist/report/host/from-record.cjs +22 -5
- package/dist/report/host/from-record.cjs.map +1 -1
- package/dist/report/host/machine.cjs +53 -11
- package/dist/report/host/machine.cjs.map +1 -1
- package/dist/report/host/site-runtime.cjs +9 -8
- package/dist/report/host/site-runtime.cjs.map +1 -1
- package/dist/report/host/site-runtime.d.cts +1 -1
- package/dist/report/host/site-runtime.d.mts +1 -1
- package/dist/report/host/site-runtime.d.ts +1 -1
- package/dist/report/host/static.cjs +56 -9
- package/dist/report/host/static.cjs.map +1 -1
- package/dist/report/index.cjs.map +1 -1
- package/dist/report/index.d.cts +1 -1
- package/dist/report/index.d.mts +1 -1
- package/dist/report/index.d.ts +1 -1
- package/dist/report/model/dataset.cjs +7 -2
- package/dist/report/model/dataset.cjs.map +1 -1
- package/dist/report/model/locale.cjs +2 -0
- package/dist/report/model/locale.cjs.map +1 -1
- package/dist/report/model/locale.d.cts +1 -0
- package/dist/report/model/locale.d.mts +1 -0
- package/dist/report/model/locale.d.ts +1 -0
- package/dist/report/model/metrics.cjs +3 -1
- package/dist/report/model/metrics.cjs.map +1 -1
- package/dist/report/model/pricing.cjs +16 -11
- package/dist/report/model/pricing.cjs.map +1 -1
- package/dist/report/react/styles.css +53 -29
- package/dist/runner/adoption.cjs +1 -0
- package/dist/runner/adoption.cjs.map +1 -1
- package/dist/runner/attempt.cjs +44 -5
- package/dist/runner/attempt.cjs.map +1 -1
- package/dist/runner/attempt.d.cts +13 -1
- package/dist/runner/attempt.d.mts +13 -1
- package/dist/runner/attempt.d.ts +13 -1
- package/dist/runner/config-identity.cjs +10 -2
- package/dist/runner/config-identity.cjs.map +1 -1
- package/dist/runner/config-identity.d.cts +4 -2
- package/dist/runner/config-identity.d.mts +4 -2
- package/dist/runner/config-identity.d.ts +4 -2
- package/dist/runner/feedback/human.cjs +298 -59
- package/dist/runner/feedback/human.cjs.map +1 -1
- package/dist/runner/feedback/json.cjs +14 -6
- package/dist/runner/feedback/json.cjs.map +1 -1
- package/dist/runner/feedback/json.d.cts +3 -2
- package/dist/runner/feedback/json.d.mts +3 -2
- package/dist/runner/feedback/json.d.ts +3 -2
- package/dist/runner/feedback/reducer.cjs +2 -0
- package/dist/runner/feedback/reducer.cjs.map +1 -1
- package/dist/runner/judge-config.cjs +1 -1
- package/dist/runner/judge-config.cjs.map +1 -1
- package/dist/runner/ledger.cjs +124 -12
- package/dist/runner/ledger.cjs.map +1 -1
- package/dist/runner/project-current.cjs +13 -5
- package/dist/runner/project-current.cjs.map +1 -1
- package/dist/runner/run.cjs +564 -256
- package/dist/runner/run.cjs.map +1 -1
- package/dist/runner/sandbox-pool.cjs +161 -30
- package/dist/runner/sandbox-pool.cjs.map +1 -1
- package/dist/runner/sandbox-pool.d.cts +34 -2
- package/dist/runner/sandbox-pool.d.mts +34 -2
- package/dist/runner/sandbox-pool.d.ts +34 -2
- package/dist/runner/shared-state-lease.cjs +803 -0
- package/dist/runner/shared-state-lease.cjs.map +1 -0
- package/dist/runner/shared-state-lease.d.cts +121 -0
- package/dist/runner/shared-state-lease.d.mts +121 -0
- package/dist/runner/shared-state-lease.d.ts +121 -0
- package/dist/runner/shared-state-lease.js +24 -0
- package/dist/runner/shared-state-lease.js.map +1 -0
- package/dist/runner/teardown-registry.cjs +97 -34
- package/dist/runner/teardown-registry.cjs.map +1 -1
- package/dist/runner/teardown-registry.d.cts +27 -1
- package/dist/runner/teardown-registry.d.mts +27 -1
- package/dist/runner/teardown-registry.d.ts +27 -1
- package/dist/runner/teardown-registry.js +20 -16
- package/dist/runner/types.cjs.map +1 -1
- package/dist/runner/types.d.cts +31 -5
- package/dist/runner/types.d.mts +31 -5
- package/dist/runner/types.d.ts +31 -5
- package/dist/sample/analysis.cjs +249 -459
- package/dist/sample/analysis.cjs.map +1 -1
- package/dist/sample/capability.cjs +138 -7
- package/dist/sample/capability.cjs.map +1 -1
- package/dist/sample/capability.d.cts +3 -1
- package/dist/sample/capability.d.mts +3 -1
- package/dist/sample/capability.d.ts +3 -1
- package/dist/sample/capability.js +8 -6
- package/dist/sandbox/docker-agent-image.cjs +5 -1
- package/dist/sandbox/docker-agent-image.cjs.map +1 -1
- package/dist/sandbox/docker-agent-image.d.cts +2 -0
- package/dist/sandbox/docker-agent-image.d.mts +2 -0
- package/dist/sandbox/docker-agent-image.d.ts +2 -0
- package/dist/sandbox/docker-agent-image.js +14 -10
- package/dist/sandbox/docker-profile/schema.cjs +283 -534
- package/dist/sandbox/docker-profile/schema.cjs.map +1 -1
- package/dist/sandbox/docker-profile/schema.d.cts +10 -27
- package/dist/sandbox/docker-profile/schema.d.mts +10 -27
- package/dist/sandbox/docker-profile/schema.d.ts +10 -27
- package/dist/sandbox/e2b-agent-template.cjs +5 -2
- package/dist/sandbox/e2b-agent-template.cjs.map +1 -1
- package/dist/sandbox/index.cjs +4 -2
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.d.cts +1 -1
- package/dist/sandbox/index.d.mts +1 -1
- package/dist/sandbox/index.d.ts +1 -1
- package/dist/sandbox/index.js +120 -116
- package/dist/sandbox/index.mjs +120 -116
- package/dist/sandbox/keep-registry.cjs +28 -66
- package/dist/sandbox/keep-registry.cjs.map +1 -1
- package/dist/sandbox/types.cjs.map +1 -1
- package/dist/sandbox/types.d.cts +1 -1
- package/dist/sandbox/types.d.mts +1 -1
- package/dist/sandbox/types.d.ts +1 -1
- package/dist/shared/aggregate.cjs +16 -6
- package/dist/shared/aggregate.cjs.map +1 -1
- package/dist/shared/aggregate.d.cts +12 -4
- package/dist/shared/aggregate.d.mts +12 -4
- package/dist/shared/aggregate.d.ts +12 -4
- package/dist/shared/turn-label.cjs +20 -2
- package/dist/shared/turn-label.cjs.map +1 -1
- package/dist/shared/turn-label.d.cts +2 -0
- package/dist/shared/turn-label.d.mts +2 -0
- package/dist/shared/turn-label.d.ts +2 -0
- package/dist/shared/turn-label.js +4 -2
- package/dist/vendor/remark/remark-gfm.cjs +7 -7
- package/dist/vendor/remark/remark-gfm.cjs.map +1 -1
- package/dist/vendor/remark/remark-parse.cjs +12 -12
- package/dist/vendor/remark/remark-parse.cjs.map +1 -1
- package/dist/vendor/remark/remark.cjs +13 -13
- package/dist/vendor/remark/remark.cjs.map +1 -1
- package/dist/view/server.cjs +6 -0
- package/dist/view/server.cjs.map +1 -1
- package/docs-site/images/hitl-handshake-zh.svg +3 -3
- package/docs-site/zh/examples/ai-agent-application.mdx +1 -1
- package/docs-site/zh/examples/coding-agent-extensions.mdx +1 -1
- package/docs-site/zh/examples/integrations/ai-sdk-v7.mdx +4 -3
- package/docs-site/zh/examples/integrations/claude-sdk.mdx +3 -3
- package/docs-site/zh/examples/integrations/codex-sdk.mdx +5 -5
- package/docs-site/zh/examples/integrations/langgraph.mdx +4 -4
- package/docs-site/zh/examples/integrations/pi-sdk.mdx +5 -5
- package/docs-site/zh/explanation/adapter.mdx +5 -5
- package/docs-site/zh/explanation/assert.mdx +7 -7
- package/docs-site/zh/explanation/drive.mdx +4 -2
- package/docs-site/zh/explanation/evals.mdx +10 -8
- package/docs-site/zh/explanation/experiment.mdx +2 -2
- package/docs-site/zh/explanation/hitl.mdx +9 -9
- package/docs-site/zh/explanation/judge.mdx +5 -5
- package/docs-site/zh/explanation/overview.mdx +3 -3
- package/docs-site/zh/explanation/runner.mdx +1 -1
- package/docs-site/zh/index.mdx +3 -3
- package/docs-site/zh/reference/builtin-agents.mdx +13 -13
- package/docs-site/zh/reference/capabilities.mdx +1 -1
- package/docs-site/zh/reference/cli.mdx +18 -12
- package/docs-site/zh/reference/define-agent.mdx +130 -5
- package/docs-site/zh/reference/define-config.mdx +2 -2
- package/docs-site/zh/reference/define-eval.mdx +4 -4
- package/docs-site/zh/reference/events.mdx +11 -11
- package/docs-site/zh/reference/official-adapters.mdx +6 -6
- package/docs-site/zh/reference/results-data.mdx +6 -0
- package/docs-site/zh/troubleshooting/debugging.mdx +1 -1
- package/docs-site/zh/troubleshooting/recover-after-kill.mdx +37 -5
- package/docs-site/zh/tutorials/accept-results.mdx +72 -0
- package/docs-site/zh/tutorials/agent-onboarding.mdx +6 -6
- package/docs-site/zh/tutorials/authoring.mdx +9 -13
- package/docs-site/zh/tutorials/ci-integration.mdx +6 -6
- package/docs-site/zh/tutorials/compare-runs.mdx +61 -0
- package/docs-site/zh/tutorials/concurrency.mdx +13 -12
- package/docs-site/zh/tutorials/configuration.mdx +4 -6
- package/docs-site/zh/tutorials/connect-your-agent.mdx +1 -1
- package/docs-site/zh/tutorials/control-run-cost.mdx +58 -0
- package/docs-site/zh/tutorials/criteria-files.mdx +2 -2
- package/docs-site/zh/tutorials/custom-reports.mdx +2 -2
- package/docs-site/zh/tutorials/debug-lifecycle-plan.mdx +46 -0
- package/docs-site/zh/tutorials/docker-in-docker.mdx +52 -43
- package/docs-site/zh/tutorials/eval-groups.mdx +6 -6
- package/docs-site/zh/tutorials/evaluation-kinds.mdx +3 -3
- package/docs-site/zh/tutorials/experiments.mdx +2 -3
- package/docs-site/zh/tutorials/handle-execution-failures.mdx +18 -10
- package/docs-site/zh/tutorials/install-custom-sandbox-agent.mdx +16 -8
- package/docs-site/zh/tutorials/nixos-managed-dind.mdx +160 -0
- package/docs-site/zh/tutorials/plugins.mdx +14 -0
- package/docs-site/zh/tutorials/rerun-and-cache.mdx +4 -2
- package/docs-site/zh/tutorials/sandbox-agent.mdx +17 -11
- package/docs-site/zh/tutorials/sandbox-providers.mdx +17 -13
- package/docs-site/zh/tutorials/sandbox-reuse.mdx +12 -19
- package/docs-site/zh/tutorials/select-and-preview.mdx +65 -0
- package/docs-site/zh/tutorials/verify-judge.mdx +78 -0
- package/docs-site/zh/tutorials/viewing-results.mdx +38 -1
- package/docs-site/zh/tutorials/write-experiment.mdx +7 -5
- package/docs-site/zh/tutorials/write-send.mdx +9 -8
- package/package.json +9 -5
- package/dist/report/built-in/overview.cjs +0 -44
- package/dist/report/built-in/overview.cjs.map +0 -1
- package/dist/report/built-in/overview.d.cts +0 -6
- package/dist/report/built-in/overview.d.mts +0 -6
- package/dist/report/built-in/overview.d.ts +0 -6
- package/dist/report/built-in/overview.js +0 -9
- package/dist/report/built-in/overview.js.map +0 -1
- package/dist/runner/gate-lease.cjs +0 -283
- package/dist/runner/gate-lease.cjs.map +0 -1
- package/dist/runner/gate-lease.d.cts +0 -62
- package/dist/runner/gate-lease.d.mts +0 -62
- package/dist/runner/gate-lease.d.ts +0 -62
- package/dist/runner/gate-lease.js +0 -22
- package/dist/runner/gate-lease.js.map +0 -1
|
@@ -3,6 +3,80 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createAssertionsDocumentBuilder = createAssertionsDocumentBuilder;
|
|
4
4
|
const effect_1 = require("effect");
|
|
5
5
|
const codec_ts_1 = require("./codec.cjs");
|
|
6
|
+
const UTF8 = new TextEncoder();
|
|
7
|
+
function encodedBytes(value) {
|
|
8
|
+
return UTF8.encode(JSON.stringify(value)).byteLength;
|
|
9
|
+
}
|
|
10
|
+
const DIAGNOSTIC_ROOT_KEYS = Object.freeze([
|
|
11
|
+
"code",
|
|
12
|
+
"message",
|
|
13
|
+
"path",
|
|
14
|
+
"expected",
|
|
15
|
+
"received",
|
|
16
|
+
"reason",
|
|
17
|
+
"locator",
|
|
18
|
+
]);
|
|
19
|
+
function compactDiagnostic(diagnostic, mode) {
|
|
20
|
+
if (mode === "minimal") {
|
|
21
|
+
return Object.freeze({
|
|
22
|
+
code: "diagnostic-truncated",
|
|
23
|
+
message: "matcher diagnostic details were omitted to fit the Assertions document limit",
|
|
24
|
+
path: Object.freeze([]),
|
|
25
|
+
truncation: Object.freeze({
|
|
26
|
+
code: "diagnostic-truncated",
|
|
27
|
+
reason: "document-limit",
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const root = {};
|
|
32
|
+
for (const key of DIAGNOSTIC_ROOT_KEYS) {
|
|
33
|
+
const value = diagnostic[key];
|
|
34
|
+
if (value !== undefined)
|
|
35
|
+
root[key] = value;
|
|
36
|
+
}
|
|
37
|
+
root.truncation = Object.freeze({
|
|
38
|
+
code: "diagnostic-truncated",
|
|
39
|
+
reason: "document-limit",
|
|
40
|
+
});
|
|
41
|
+
return Object.freeze(root);
|
|
42
|
+
}
|
|
43
|
+
function replaceDiagnostic(result, mode) {
|
|
44
|
+
if (result.diagnostic === undefined)
|
|
45
|
+
return result;
|
|
46
|
+
const diagnostic = compactDiagnostic(result.diagnostic, mode);
|
|
47
|
+
switch (result.state) {
|
|
48
|
+
case "matched": return Object.freeze({ ...result, diagnostic });
|
|
49
|
+
case "mismatched": return Object.freeze({ ...result, diagnostic });
|
|
50
|
+
case "unavailable": return Object.freeze({ ...result, diagnostic });
|
|
51
|
+
case "errored": return Object.freeze({ ...result, diagnostic });
|
|
52
|
+
case "not-applicable": return Object.freeze({ ...result, diagnostic });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function compactEntries(entries, mode) {
|
|
56
|
+
return Object.freeze(entries.map((entry) => Object.freeze({
|
|
57
|
+
...entry,
|
|
58
|
+
result: replaceDiagnostic(entry.result, mode),
|
|
59
|
+
})));
|
|
60
|
+
}
|
|
61
|
+
function invalidDocument(message) {
|
|
62
|
+
return Object.freeze({ code: "assertions-document-invalid", message });
|
|
63
|
+
}
|
|
64
|
+
function firstSchemaIssue(error) {
|
|
65
|
+
try {
|
|
66
|
+
const issue = effect_1.ParseResult.ArrayFormatter.formatErrorSync(error)[0];
|
|
67
|
+
if (issue === undefined)
|
|
68
|
+
return undefined;
|
|
69
|
+
const path = issue.path.length === 0 ? "document" : issue.path.map(String).join(".");
|
|
70
|
+
const expected = issue.message.split(", actual ", 1)[0] ?? issue.message;
|
|
71
|
+
const message = expected.length <= 512
|
|
72
|
+
? expected
|
|
73
|
+
: `${expected.slice(0, 511)}…`;
|
|
74
|
+
return `${path}: ${message}`;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
6
80
|
/**
|
|
7
81
|
* Assertion producers own normalization and ID allocation. This builder owns
|
|
8
82
|
* neither Record paths nor blob streams: the later Attachment adapter supplies
|
|
@@ -35,19 +109,42 @@ function createAssertionsDocumentBuilder(input) {
|
|
|
35
109
|
entries.push(Object.freeze({ entryId: entryId.right, ...entry }));
|
|
36
110
|
return effect_1.Either.right(entryId.right);
|
|
37
111
|
},
|
|
38
|
-
seal() {
|
|
112
|
+
seal(sealInput = {}) {
|
|
39
113
|
if (sealed !== undefined) {
|
|
40
114
|
return effect_1.Either.right(sealed);
|
|
41
115
|
}
|
|
42
|
-
const
|
|
116
|
+
const maximumBytes = sealInput.maximumBytes ?? codec_ts_1.MAX_ASSERTION_DOCUMENT_BYTES;
|
|
117
|
+
if (!Number.isSafeInteger(maximumBytes) || maximumBytes <= 0 || maximumBytes > codec_ts_1.MAX_ASSERTION_DOCUMENT_BYTES) {
|
|
118
|
+
return effect_1.Either.left(invalidDocument(`Assertions framing has no positive entry budget within the ${codec_ts_1.MAX_ASSERTION_DOCUMENT_BYTES}-byte limit. ` +
|
|
119
|
+
"Reduce assertion source sites or assertion count and retry."));
|
|
120
|
+
}
|
|
121
|
+
let document = Object.freeze({
|
|
43
122
|
entries: Object.freeze([...entries]),
|
|
44
123
|
});
|
|
45
124
|
if (!(0, codec_ts_1.isAssertionsRawDataGraph)(document)) {
|
|
46
|
-
return effect_1.Either.left(
|
|
125
|
+
return effect_1.Either.left(invalidDocument("Assertions could not be saved because an entry contains a cyclic or non-JSON value. " +
|
|
126
|
+
"Upgrade NiceEval and retry; if this persists, report assertions-document-invalid."));
|
|
127
|
+
}
|
|
128
|
+
let documentBytes = encodedBytes(document);
|
|
129
|
+
if (documentBytes > maximumBytes) {
|
|
130
|
+
document = Object.freeze({ entries: compactEntries(document.entries, "root") });
|
|
131
|
+
documentBytes = encodedBytes(document);
|
|
132
|
+
}
|
|
133
|
+
if (documentBytes > maximumBytes) {
|
|
134
|
+
document = Object.freeze({ entries: compactEntries(document.entries, "minimal") });
|
|
135
|
+
documentBytes = encodedBytes(document);
|
|
136
|
+
}
|
|
137
|
+
if (documentBytes > maximumBytes) {
|
|
138
|
+
return effect_1.Either.left(invalidDocument(`Assertions could not be saved after diagnostic compaction because entry framing is ` +
|
|
139
|
+
`${documentBytes} bytes; ${maximumBytes} bytes remain after source sites within the ` +
|
|
140
|
+
`${codec_ts_1.MAX_ASSERTION_DOCUMENT_BYTES}-byte limit. Large subject and evidence snapshots are already ` +
|
|
141
|
+
"stored as blobs; reduce assertion count or matcher/display identity and retry."));
|
|
47
142
|
}
|
|
48
143
|
const encoded = effect_1.Schema.encodeUnknownEither(input.documentSchema, codec_ts_1.AssertionsExactParseOptions)(document);
|
|
49
144
|
if (effect_1.Either.isLeft(encoded)) {
|
|
50
|
-
|
|
145
|
+
const issue = firstSchemaIssue(encoded.left);
|
|
146
|
+
return effect_1.Either.left(invalidDocument(`Assertions could not be saved${issue === undefined ? "" : ` because ${issue}`}. ` +
|
|
147
|
+
"Upgrade NiceEval and retry; if this persists, report assertions-document-invalid."));
|
|
51
148
|
}
|
|
52
149
|
sealed = document;
|
|
53
150
|
return effect_1.Either.right(document);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"producer.js","sourceRoot":"","sources":["producer.ts"],"names":[],"mappings":";;AA0CA,0EAiDC;AA3FD,mCAAwC;AACxC,yCAA4G;AAoC5G;;;;GAIG;AACH,SAAgB,+BAA+B,CAAmB,KAGjE;IACG,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,MAAM,OAAO,GAA8B,EAA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CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;aACvC,CAAC,CAAC;YACH,IAAI,CAAC,IAAA,mCAAwB,EAAC,QAAQ,CAAC,EAAE,CAAC;gBACtC,OAAO,eAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,6BAA6B,EAAE,CAAC,CAAC;YAChE,CAAC;YACD,MAAM,OAAO,GAAG,eAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,cAAc,EAAE,sCAA2B,CAAC,CAAC,QAAQ,CAAC,CAAC;YACxG,IAAI,eAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;gBACzB,OAAO,eAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,6BAA6B,EAAE,CAAC,CAAC;YAChE,CAAC;YACD,MAAM,GAAG,QAAQ,CAAC;YAClB,OAAO,eAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;KACJ,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { Either, Schema } from \"effect\";\nimport { AssertionEntryIdSchema, AssertionsExactParseOptions, isAssertionsRawDataGraph, } from \"./codec.ts\";\nimport type { AssertionDisplay, AssertionEntryId, AssertionEntry, AssertionLimitation, AssertionMaterial, AssertionCoverage, AssertionsDocument, SealedAssertionResult, WritableCriterionEnvelope, } from \"./model.ts\";\nexport interface AssertionEntryInput<BlobRef> {\n readonly display: AssertionDisplay;\n readonly criterion: WritableCriterionEnvelope;\n readonly subject: AssertionMaterial<BlobRef>;\n readonly evidence: readonly AssertionMaterial<BlobRef>[];\n readonly coverage: AssertionCoverage;\n readonly limitations: readonly AssertionLimitation[];\n readonly result: SealedAssertionResult;\n}\nexport interface AssertionsEntryIdSource {\n /** Must return a fresh `ae_[a-z0-9]{20}` candidate for this Attachment. */\n readonly next: () => string;\n}\nexport type AssertionsProducerError = {\n readonly code: \"assertion-entry-id-invalid\";\n readonly entryId: string;\n} | {\n readonly code: \"assertion-entry-id-duplicate\";\n readonly entryId: string;\n} | {\n readonly code: \"assertions-document-sealed\";\n} | {\n readonly code: \"assertions-document-invalid\";\n};\nexport interface AssertionsDocumentBuilder<BlobRef> {\n /** Appends exactly one completed Assertion in declaration/display order. */\n readonly append: (entry: AssertionEntryInput<BlobRef>) => Either.Either<AssertionEntryId, AssertionsProducerError>;\n /**\n * Checks the writer-only exact document schema once and prevents subsequent\n * appends. Repeated calls return the same sealed document without running\n * an evaluator or minting another entry ID.\n */\n readonly seal: () => Either.Either<AssertionsDocument<BlobRef>, AssertionsProducerError>;\n}\n/**\n * Assertion producers own normalization and ID allocation. This builder owns\n * neither Record paths nor blob streams: the later Attachment adapter supplies\n * Record's local builder, so an entry cannot borrow another Attachment's ref.\n */\nexport function createAssertionsDocumentBuilder<BlobRef, Encoded>(input: {\n readonly documentSchema: Schema.Schema<AssertionsDocument<BlobRef>, Encoded>;\n readonly entryIds: AssertionsEntryIdSource;\n}): AssertionsDocumentBuilder<BlobRef> {\n const entryIds = new Set<string>();\n const entries: AssertionEntry<BlobRef>[] = [];\n let sealed: AssertionsDocument<BlobRef> | undefined;\n const builder: AssertionsDocumentBuilder<BlobRef> = {\n append(entry: AssertionEntryInput<BlobRef>): Either.Either<AssertionEntryId, AssertionsProducerError> {\n if (sealed !== undefined) {\n return Either.left({ code: \"assertions-document-sealed\" });\n }\n const entryIdText = input.entryIds.next();\n const entryId = Schema.decodeUnknownEither(AssertionEntryIdSchema, AssertionsExactParseOptions)(entryIdText);\n if (Either.isLeft(entryId)) {\n return Either.left({\n code: \"assertion-entry-id-invalid\",\n entryId: entryIdText,\n });\n }\n if (entryIds.has(entryId.right)) {\n return Either.left({\n code: \"assertion-entry-id-duplicate\",\n entryId: entryIdText,\n });\n }\n entryIds.add(entryId.right);\n entries.push(Object.freeze({ entryId: entryId.right, ...entry }));\n return Either.right(entryId.right);\n },\n seal(): Either.Either<AssertionsDocument<BlobRef>, AssertionsProducerError> {\n if (sealed !== undefined) {\n return Either.right(sealed);\n }\n const document: AssertionsDocument<BlobRef> = Object.freeze({\n entries: Object.freeze([...entries]),\n });\n if (!isAssertionsRawDataGraph(document)) {\n return Either.left({ code: \"assertions-document-invalid\" });\n }\n const encoded = Schema.encodeUnknownEither(input.documentSchema, AssertionsExactParseOptions)(document);\n if (Either.isLeft(encoded)) {\n return Either.left({ code: \"assertions-document-invalid\" });\n }\n sealed = document;\n return Either.right(document);\n },\n };\n return Object.freeze(builder);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"producer.js","sourceRoot":"","sources":["producer.ts"],"names":[],"mappings":";;AAuHA,0EA0EC;AAjMD,mCAAqD;AACrD,yCAA0I;AA2B1I,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;AAC/B,SAAS,YAAY,CAAC,KAAc;IAChC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC;AACzD,CAAC;AACD,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;IACvC,MAAM;IACN,SAAS;IACT,MAAM;IACN,UAAU;IACV,UAAU;IACV,QAAQ;IACR,SAAS;CACH,CAAC,CAAC;AACZ,SAAS,iBAAiB,CAAC,UAA6B,EAAE,IAAwB;IAC9E,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACrB,OAAO,MAAM,CAAC,MAAM,CAAC;YACjB,IAAI,EAAE,sBAAsB;YAC5B,OAAO,EAAE,8EAA8E;YACvF,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACvB,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC;gBACtB,IAAI,EAAE,sBAAsB;gBAC5B,MAAM,EAAE,gBAAgB;aAC3B,CAAC;SACL,CAAC,CAAC;IACP,CAAC;IACD,MAAM,IAAI,GAAgD,EAAE,CAAC;IAC7D,KAAK,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC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G,aAAa,WAAW,YAAY,8CAA8C;oBACrF,GAAG,uCAA4B,gEAAgE;oBAC/F,gFAAgF,CAAC,CAAC,CAAC;YAC3F,CAAC;YACD,MAAM,OAAO,GAAG,eAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,cAAc,EAAE,sCAA2B,CAAC,CAAC,QAAQ,CAAC,CAAC;YACxG,IAAI,eAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;gBACzB,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBAC7C,OAAO,eAAM,CAAC,IAAI,CAAC,eAAe,CAAC,gCAAgC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,EAAE,IAAI;oBACjH,mFAAmF,CAAC,CAAC,CAAC;YAC9F,CAAC;YACD,MAAM,GAAG,QAAQ,CAAC;YAClB,OAAO,eAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;KACJ,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { Either, ParseResult, Schema } from \"effect\";\nimport { AssertionEntryIdSchema, AssertionsExactParseOptions, MAX_ASSERTION_DOCUMENT_BYTES, isAssertionsRawDataGraph, } from \"./codec.ts\";\nimport type { BoundedJsonObject, BoundedJsonValue, AssertionDisplay, AssertionEntryId, AssertionEntry, AssertionLimitation, AssertionMaterial, AssertionCoverage, AssertionsDocument, SealedAssertionResult, WritableCriterionEnvelope, } from \"./model.ts\";\nexport interface AssertionEntryInput<BlobRef> {\n readonly display: AssertionDisplay;\n readonly criterion: WritableCriterionEnvelope;\n readonly subject: AssertionMaterial<BlobRef>;\n readonly evidence: readonly AssertionMaterial<BlobRef>[];\n readonly coverage: AssertionCoverage;\n readonly limitations: readonly AssertionLimitation[];\n readonly result: SealedAssertionResult;\n}\nexport interface AssertionsEntryIdSource {\n /** Must return a fresh `ae_[a-z0-9]{20}` candidate for this Attachment. */\n readonly next: () => string;\n}\nexport type AssertionsProducerError = {\n readonly code: \"assertion-entry-id-invalid\";\n readonly entryId: string;\n} | {\n readonly code: \"assertion-entry-id-duplicate\";\n readonly entryId: string;\n} | {\n readonly code: \"assertions-document-sealed\";\n} | {\n readonly code: \"assertions-document-invalid\";\n readonly message: string;\n};\nconst UTF8 = new TextEncoder();\nfunction encodedBytes(value: unknown): number {\n return UTF8.encode(JSON.stringify(value)).byteLength;\n}\nconst DIAGNOSTIC_ROOT_KEYS = Object.freeze([\n \"code\",\n \"message\",\n \"path\",\n \"expected\",\n \"received\",\n \"reason\",\n \"locator\",\n] as const);\nfunction compactDiagnostic(diagnostic: BoundedJsonObject, mode: \"root\" | \"minimal\"): BoundedJsonObject {\n if (mode === \"minimal\") {\n return Object.freeze({\n code: \"diagnostic-truncated\",\n message: \"matcher diagnostic details were omitted to fit the Assertions document limit\",\n path: Object.freeze([]),\n truncation: Object.freeze({\n code: \"diagnostic-truncated\",\n reason: \"document-limit\",\n }),\n });\n }\n const root: globalThis.Record<string, BoundedJsonValue> = {};\n for (const key of DIAGNOSTIC_ROOT_KEYS) {\n const value = diagnostic[key];\n if (value !== undefined)\n root[key] = value;\n }\n root.truncation = Object.freeze({\n code: \"diagnostic-truncated\",\n reason: \"document-limit\",\n });\n return Object.freeze(root);\n}\nfunction replaceDiagnostic(result: SealedAssertionResult, mode: \"root\" | \"minimal\"): SealedAssertionResult {\n if (result.diagnostic === undefined)\n return result;\n const diagnostic = compactDiagnostic(result.diagnostic, mode);\n switch (result.state) {\n case \"matched\": return Object.freeze({ ...result, diagnostic });\n case \"mismatched\": return Object.freeze({ ...result, diagnostic });\n case \"unavailable\": return Object.freeze({ ...result, diagnostic });\n case \"errored\": return Object.freeze({ ...result, diagnostic });\n case \"not-applicable\": return Object.freeze({ ...result, diagnostic });\n }\n}\nfunction compactEntries<BlobRef>(entries: readonly AssertionEntry<BlobRef>[], mode: \"root\" | \"minimal\"): readonly AssertionEntry<BlobRef>[] {\n return Object.freeze(entries.map((entry) => Object.freeze({\n ...entry,\n result: replaceDiagnostic(entry.result, mode),\n })));\n}\nfunction invalidDocument(message: string): AssertionsProducerError {\n return Object.freeze({ code: \"assertions-document-invalid\" as const, message });\n}\nfunction firstSchemaIssue(error: ParseResult.ParseError): string | undefined {\n try {\n const issue = ParseResult.ArrayFormatter.formatErrorSync(error)[0];\n if (issue === undefined)\n return undefined;\n const path = issue.path.length === 0 ? \"document\" : issue.path.map(String).join(\".\");\n const expected = issue.message.split(\", actual \", 1)[0] ?? issue.message;\n const message = expected.length <= 512\n ? expected\n : `${expected.slice(0, 511)}…`;\n return `${path}: ${message}`;\n }\n catch {\n return undefined;\n }\n}\nexport interface AssertionsDocumentBuilder<BlobRef> {\n /** Appends exactly one completed Assertion in declaration/display order. */\n readonly append: (entry: AssertionEntryInput<BlobRef>) => Either.Either<AssertionEntryId, AssertionsProducerError>;\n /**\n * Checks the writer-only exact document schema once and prevents subsequent\n * appends. Repeated calls return the same sealed document without running\n * an evaluator or minting another entry ID.\n */\n readonly seal: (input?: {\n readonly maximumBytes?: number;\n }) => Either.Either<AssertionsDocument<BlobRef>, AssertionsProducerError>;\n}\n/**\n * Assertion producers own normalization and ID allocation. This builder owns\n * neither Record paths nor blob streams: the later Attachment adapter supplies\n * Record's local builder, so an entry cannot borrow another Attachment's ref.\n */\nexport function createAssertionsDocumentBuilder<BlobRef, Encoded>(input: {\n readonly documentSchema: Schema.Schema<AssertionsDocument<BlobRef>, Encoded>;\n readonly entryIds: AssertionsEntryIdSource;\n}): AssertionsDocumentBuilder<BlobRef> {\n const entryIds = new Set<string>();\n const entries: AssertionEntry<BlobRef>[] = [];\n let sealed: AssertionsDocument<BlobRef> | undefined;\n const builder: AssertionsDocumentBuilder<BlobRef> = {\n append(entry: AssertionEntryInput<BlobRef>): Either.Either<AssertionEntryId, AssertionsProducerError> {\n if (sealed !== undefined) {\n return Either.left({ code: \"assertions-document-sealed\" });\n }\n const entryIdText = input.entryIds.next();\n const entryId = Schema.decodeUnknownEither(AssertionEntryIdSchema, AssertionsExactParseOptions)(entryIdText);\n if (Either.isLeft(entryId)) {\n return Either.left({\n code: \"assertion-entry-id-invalid\",\n entryId: entryIdText,\n });\n }\n if (entryIds.has(entryId.right)) {\n return Either.left({\n code: \"assertion-entry-id-duplicate\",\n entryId: entryIdText,\n });\n }\n entryIds.add(entryId.right);\n entries.push(Object.freeze({ entryId: entryId.right, ...entry }));\n return Either.right(entryId.right);\n },\n seal(sealInput: {\n readonly maximumBytes?: number;\n } = {}): Either.Either<AssertionsDocument<BlobRef>, AssertionsProducerError> {\n if (sealed !== undefined) {\n return Either.right(sealed);\n }\n const maximumBytes = sealInput.maximumBytes ?? MAX_ASSERTION_DOCUMENT_BYTES;\n if (!Number.isSafeInteger(maximumBytes) || maximumBytes <= 0 || maximumBytes > MAX_ASSERTION_DOCUMENT_BYTES) {\n return Either.left(invalidDocument(`Assertions framing has no positive entry budget within the ${MAX_ASSERTION_DOCUMENT_BYTES}-byte limit. ` +\n \"Reduce assertion source sites or assertion count and retry.\"));\n }\n let document: AssertionsDocument<BlobRef> = Object.freeze({\n entries: Object.freeze([...entries]),\n });\n if (!isAssertionsRawDataGraph(document)) {\n return Either.left(invalidDocument(\"Assertions could not be saved because an entry contains a cyclic or non-JSON value. \" +\n \"Upgrade NiceEval and retry; if this persists, report assertions-document-invalid.\"));\n }\n let documentBytes = encodedBytes(document);\n if (documentBytes > maximumBytes) {\n document = Object.freeze({ entries: compactEntries(document.entries, \"root\") });\n documentBytes = encodedBytes(document);\n }\n if (documentBytes > maximumBytes) {\n document = Object.freeze({ entries: compactEntries(document.entries, \"minimal\") });\n documentBytes = encodedBytes(document);\n }\n if (documentBytes > maximumBytes) {\n return Either.left(invalidDocument(`Assertions could not be saved after diagnostic compaction because entry framing is ` +\n `${documentBytes} bytes; ${maximumBytes} bytes remain after source sites within the ` +\n `${MAX_ASSERTION_DOCUMENT_BYTES}-byte limit. Large subject and evidence snapshots are already ` +\n \"stored as blobs; reduce assertion count or matcher/display identity and retry.\"));\n }\n const encoded = Schema.encodeUnknownEither(input.documentSchema, AssertionsExactParseOptions)(document);\n if (Either.isLeft(encoded)) {\n const issue = firstSchemaIssue(encoded.left);\n return Either.left(invalidDocument(`Assertions could not be saved${issue === undefined ? \"\" : ` because ${issue}`}. ` +\n \"Upgrade NiceEval and retry; if this persists, report assertions-document-invalid.\"));\n }\n sealed = document;\n return Either.right(document);\n },\n };\n return Object.freeze(builder);\n}\n"]}
|
|
@@ -23,6 +23,7 @@ export type AssertionsProducerError = {
|
|
|
23
23
|
readonly code: "assertions-document-sealed";
|
|
24
24
|
} | {
|
|
25
25
|
readonly code: "assertions-document-invalid";
|
|
26
|
+
readonly message: string;
|
|
26
27
|
};
|
|
27
28
|
export interface AssertionsDocumentBuilder<BlobRef> {
|
|
28
29
|
/** Appends exactly one completed Assertion in declaration/display order. */
|
|
@@ -32,7 +33,9 @@ export interface AssertionsDocumentBuilder<BlobRef> {
|
|
|
32
33
|
* appends. Repeated calls return the same sealed document without running
|
|
33
34
|
* an evaluator or minting another entry ID.
|
|
34
35
|
*/
|
|
35
|
-
readonly seal: (
|
|
36
|
+
readonly seal: (input?: {
|
|
37
|
+
readonly maximumBytes?: number;
|
|
38
|
+
}) => Either.Either<AssertionsDocument<BlobRef>, AssertionsProducerError>;
|
|
36
39
|
}
|
|
37
40
|
/**
|
|
38
41
|
* Assertion producers own normalization and ID allocation. This builder owns
|
|
@@ -23,6 +23,7 @@ export type AssertionsProducerError = {
|
|
|
23
23
|
readonly code: "assertions-document-sealed";
|
|
24
24
|
} | {
|
|
25
25
|
readonly code: "assertions-document-invalid";
|
|
26
|
+
readonly message: string;
|
|
26
27
|
};
|
|
27
28
|
export interface AssertionsDocumentBuilder<BlobRef> {
|
|
28
29
|
/** Appends exactly one completed Assertion in declaration/display order. */
|
|
@@ -32,7 +33,9 @@ export interface AssertionsDocumentBuilder<BlobRef> {
|
|
|
32
33
|
* appends. Repeated calls return the same sealed document without running
|
|
33
34
|
* an evaluator or minting another entry ID.
|
|
34
35
|
*/
|
|
35
|
-
readonly seal: (
|
|
36
|
+
readonly seal: (input?: {
|
|
37
|
+
readonly maximumBytes?: number;
|
|
38
|
+
}) => Either.Either<AssertionsDocument<BlobRef>, AssertionsProducerError>;
|
|
36
39
|
}
|
|
37
40
|
/**
|
|
38
41
|
* Assertion producers own normalization and ID allocation. This builder owns
|
|
@@ -23,6 +23,7 @@ export type AssertionsProducerError = {
|
|
|
23
23
|
readonly code: "assertions-document-sealed";
|
|
24
24
|
} | {
|
|
25
25
|
readonly code: "assertions-document-invalid";
|
|
26
|
+
readonly message: string;
|
|
26
27
|
};
|
|
27
28
|
export interface AssertionsDocumentBuilder<BlobRef> {
|
|
28
29
|
/** Appends exactly one completed Assertion in declaration/display order. */
|
|
@@ -32,7 +33,9 @@ export interface AssertionsDocumentBuilder<BlobRef> {
|
|
|
32
33
|
* appends. Repeated calls return the same sealed document without running
|
|
33
34
|
* an evaluator or minting another entry ID.
|
|
34
35
|
*/
|
|
35
|
-
readonly seal: (
|
|
36
|
+
readonly seal: (input?: {
|
|
37
|
+
readonly maximumBytes?: number;
|
|
38
|
+
}) => Either.Either<AssertionsDocument<BlobRef>, AssertionsProducerError>;
|
|
36
39
|
}
|
|
37
40
|
/**
|
|
38
41
|
* Assertion producers own normalization and ID allocation. This builder owns
|
|
@@ -224,13 +224,21 @@ function captureAssertionSnapshot(value) {
|
|
|
224
224
|
* bounded JSON copy that keeps their tree (field children and locators) for
|
|
225
225
|
* show/view without granting those readers evaluator authority.
|
|
226
226
|
*/
|
|
227
|
-
function captureMatchDiagnostic(value, depth = 0, seen = new WeakSet()) {
|
|
227
|
+
function captureMatchDiagnostic(value, depth = 0, seen = new WeakSet(), budget = { remainingNodes: limits_ts_1.assertionRuntimeLimits.diagnosticNodes }) {
|
|
228
228
|
if (value === undefined)
|
|
229
229
|
return undefined;
|
|
230
|
-
if (
|
|
230
|
+
if (budget.remainingNodes <= 0) {
|
|
231
231
|
return Object.freeze({
|
|
232
232
|
code: "diagnostic-truncated",
|
|
233
|
-
message:
|
|
233
|
+
message: "matcher diagnostic exceeded the persisted node limit",
|
|
234
|
+
path: Object.freeze([]),
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
budget.remainingNodes -= 1;
|
|
238
|
+
if (depth >= limits_ts_1.assertionRuntimeLimits.diagnosticDepth || seen.has(value)) {
|
|
239
|
+
return Object.freeze({
|
|
240
|
+
code: "diagnostic-truncated",
|
|
241
|
+
message: depth >= limits_ts_1.assertionRuntimeLimits.diagnosticDepth
|
|
234
242
|
? "matcher diagnostic exceeded the persisted depth limit"
|
|
235
243
|
: "matcher diagnostic contained a cycle",
|
|
236
244
|
path: Object.freeze([]),
|
|
@@ -258,23 +266,55 @@ function captureMatchDiagnostic(value, depth = 0, seen = new WeakSet()) {
|
|
|
258
266
|
? Object.freeze({ kind: "json-pointer", pointer: text(value.locator.pointer) })
|
|
259
267
|
: Object.freeze({ kind: "tool-occurrence", id: text(value.locator.id) });
|
|
260
268
|
}
|
|
269
|
+
if (value.truncation !== undefined) {
|
|
270
|
+
output.truncation = Object.freeze({ ...value.truncation });
|
|
271
|
+
}
|
|
261
272
|
if (value.children !== undefined) {
|
|
262
273
|
const children = [];
|
|
263
274
|
for (const child of value.children.slice(0, limits_ts_1.assertionRuntimeLimits.jsonArrayItems)) {
|
|
275
|
+
if (budget.remainingNodes <= 0)
|
|
276
|
+
break;
|
|
264
277
|
const entry = {
|
|
265
278
|
index: child.index,
|
|
266
279
|
state: child.state,
|
|
267
280
|
};
|
|
268
281
|
if (child.label !== undefined)
|
|
269
282
|
entry.label = text(child.label);
|
|
270
|
-
const diagnostic = captureMatchDiagnostic(child.diagnostic, depth + 1, seen);
|
|
283
|
+
const diagnostic = captureMatchDiagnostic(child.diagnostic, depth + 1, seen, budget);
|
|
271
284
|
if (diagnostic !== undefined)
|
|
272
285
|
entry.diagnostic = diagnostic;
|
|
273
286
|
children.push(Object.freeze(entry));
|
|
274
287
|
}
|
|
275
288
|
output.children = Object.freeze(children);
|
|
289
|
+
if (children.length < value.children.length && output.truncation === undefined) {
|
|
290
|
+
output.truncation = Object.freeze({
|
|
291
|
+
code: "diagnostic-truncated",
|
|
292
|
+
reason: "sampled",
|
|
293
|
+
captured: children.length,
|
|
294
|
+
knownTotal: value.children.length,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
276
297
|
}
|
|
277
|
-
|
|
298
|
+
const captured = Object.freeze(output);
|
|
299
|
+
const serialized = JSON.stringify(captured);
|
|
300
|
+
const originalBytes = UTF8.encode(serialized).byteLength;
|
|
301
|
+
if (originalBytes <= limits_ts_1.assertionRuntimeLimits.diagnosticBytes)
|
|
302
|
+
return captured;
|
|
303
|
+
return Object.freeze({
|
|
304
|
+
code: output.code,
|
|
305
|
+
message: output.message,
|
|
306
|
+
path: output.path,
|
|
307
|
+
...(output.expected === undefined ? {} : { expected: output.expected }),
|
|
308
|
+
...(output.received === undefined ? {} : { received: output.received }),
|
|
309
|
+
...(output.reason === undefined ? {} : { reason: output.reason }),
|
|
310
|
+
...(output.locator === undefined ? {} : { locator: output.locator }),
|
|
311
|
+
truncation: Object.freeze({
|
|
312
|
+
code: "diagnostic-truncated",
|
|
313
|
+
reason: "byte-limit",
|
|
314
|
+
limitBytes: limits_ts_1.assertionRuntimeLimits.diagnosticBytes,
|
|
315
|
+
originalBytes,
|
|
316
|
+
}),
|
|
317
|
+
});
|
|
278
318
|
}
|
|
279
319
|
finally {
|
|
280
320
|
seen.delete(value);
|