niceeval 0.15.1-canary.76 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INDEX.md +45 -40
- package/dist/adapter-execution-trace.cjs.map +1 -1
- package/dist/adapter-execution-trace.d.cts +26 -0
- package/dist/adapter-execution-trace.d.mts +26 -0
- package/dist/adapter-execution-trace.d.ts +26 -0
- package/dist/adapter-usage.cjs.map +1 -1
- package/dist/adapter-usage.d.cts +9 -0
- package/dist/adapter-usage.d.mts +9 -0
- package/dist/adapter-usage.d.ts +9 -0
- package/dist/adapter.cjs +19 -4
- package/dist/adapter.cjs.map +1 -1
- package/dist/adapter.d.cts +37 -12
- package/dist/adapter.d.mts +37 -12
- package/dist/adapter.d.ts +37 -12
- package/dist/agents/ai-sdk.cjs +3 -0
- package/dist/agents/ai-sdk.cjs.map +1 -1
- package/dist/agents/bub.cjs +3 -0
- package/dist/agents/bub.cjs.map +1 -1
- package/dist/agents/claude-code-native.cjs +28 -2
- package/dist/agents/claude-code-native.cjs.map +1 -1
- package/dist/agents/claude-code.cjs +3 -0
- package/dist/agents/claude-code.cjs.map +1 -1
- package/dist/agents/codex.cjs +3 -0
- package/dist/agents/codex.cjs.map +1 -1
- package/dist/agents/coding-cli-versions.cjs +9 -10
- package/dist/agents/coding-cli-versions.cjs.map +1 -1
- package/dist/agents/coding-cli-versions.d.cts +1 -1
- package/dist/agents/coding-cli-versions.d.mts +1 -1
- package/dist/agents/coding-cli-versions.d.ts +1 -1
- package/dist/agents/deepseek-harness.cjs +3 -0
- package/dist/agents/deepseek-harness.cjs.map +1 -1
- package/dist/agents/hermes.cjs +3 -0
- package/dist/agents/hermes.cjs.map +1 -1
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.d.cts +3 -2
- package/dist/agents/index.d.mts +3 -2
- package/dist/agents/index.d.ts +3 -2
- package/dist/agents/omp.cjs +3 -0
- package/dist/agents/omp.cjs.map +1 -1
- package/dist/agents/openai-compat.cjs +6 -0
- package/dist/agents/openai-compat.cjs.map +1 -1
- package/dist/agents/openclaw.cjs +3 -0
- package/dist/agents/openclaw.cjs.map +1 -1
- package/dist/agents/opencode.cjs +3 -0
- package/dist/agents/opencode.cjs.map +1 -1
- package/dist/agents/sdk-streams.cjs +9 -0
- package/dist/agents/sdk-streams.cjs.map +1 -1
- package/dist/agents/ui-message-stream.cjs +3 -0
- package/dist/agents/ui-message-stream.cjs.map +1 -1
- package/dist/assertions/api.cjs.map +1 -1
- package/dist/assertions/api.d.cts +27 -5
- package/dist/assertions/api.d.mts +27 -5
- package/dist/assertions/api.d.ts +27 -5
- package/dist/assertions/collection.cjs +6 -0
- package/dist/assertions/collection.cjs.map +1 -1
- package/dist/assertions/collection.d.cts +4 -2
- package/dist/assertions/collection.d.mts +4 -2
- package/dist/assertions/collection.d.ts +4 -2
- package/dist/assertions/collection.js +12 -8
- package/dist/assertions/context-match.cjs +70 -0
- package/dist/assertions/context-match.cjs.map +1 -0
- package/dist/assertions/context-match.d.cts +107 -0
- package/dist/assertions/context-match.d.mts +107 -0
- package/dist/assertions/context-match.d.ts +107 -0
- package/dist/assertions/context-match.js +12 -0
- package/dist/assertions/context-match.js.map +1 -0
- package/dist/assertions/full-content.cjs +109 -0
- package/dist/assertions/full-content.cjs.map +1 -0
- package/dist/assertions/full-content.d.cts +6 -0
- package/dist/assertions/full-content.d.mts +6 -0
- package/dist/assertions/full-content.d.ts +6 -0
- package/dist/assertions/full-content.js +12 -0
- package/dist/assertions/full-content.js.map +1 -0
- package/dist/assertions/judge-presets.cjs +2 -34
- package/dist/assertions/judge-presets.cjs.map +1 -1
- package/dist/assertions/judge-presets.d.cts +6 -9
- package/dist/assertions/judge-presets.d.mts +6 -9
- package/dist/assertions/judge-presets.d.ts +6 -9
- package/dist/assertions/judge-presets.js +8 -8
- package/dist/assertions/judge.cjs +107 -29
- package/dist/assertions/judge.cjs.map +1 -1
- package/dist/assertions/judge.d.cts +2 -0
- package/dist/assertions/judge.d.mts +2 -0
- package/dist/assertions/judge.d.ts +2 -0
- package/dist/assertions/match.cjs +244 -5
- package/dist/assertions/match.cjs.map +1 -1
- package/dist/assertions/match.d.cts +43 -3
- package/dist/assertions/match.d.mts +43 -3
- package/dist/assertions/match.d.ts +43 -3
- package/dist/assertions/match.js +88 -78
- package/dist/assertions/material.cjs +520 -0
- package/dist/assertions/material.cjs.map +1 -0
- package/dist/assertions/material.d.cts +56 -0
- package/dist/assertions/material.d.mts +56 -0
- package/dist/assertions/material.d.ts +56 -0
- package/dist/assertions/material.js +20 -0
- package/dist/assertions/material.js.map +1 -0
- package/dist/assertions/record/attachment.cjs +5 -2
- package/dist/assertions/record/attachment.cjs.map +1 -1
- package/dist/assertions/record/codec.cjs +2 -1
- package/dist/assertions/record/codec.cjs.map +1 -1
- package/dist/assertions/record/model.cjs.map +1 -1
- package/dist/assertions/record/model.d.cts +6 -1
- package/dist/assertions/record/model.d.mts +6 -1
- package/dist/assertions/record/model.d.ts +6 -1
- package/dist/assertions/runtime.cjs +207 -14
- package/dist/assertions/runtime.cjs.map +1 -1
- package/dist/assertions/runtime.d.cts +9 -0
- package/dist/assertions/runtime.d.mts +9 -0
- package/dist/assertions/runtime.d.ts +9 -0
- package/dist/assertions/runtime.js +14 -8
- package/dist/assertions/score-match-audit.cjs +18 -8
- package/dist/assertions/score-match-audit.cjs.map +1 -1
- package/dist/assertions/score-match-gateway.cjs +83 -25
- package/dist/assertions/score-match-gateway.cjs.map +1 -1
- package/dist/assertions/score-match-gateway.d.cts +2 -0
- package/dist/assertions/score-match-gateway.d.mts +2 -0
- package/dist/assertions/score-match-gateway.d.ts +2 -0
- package/dist/assertions/value-composition.test-d.cjs +77 -0
- package/dist/assertions/value-composition.test-d.cjs.map +1 -0
- package/dist/assertions/value-composition.test-d.d.cts +1 -0
- package/dist/assertions/value-composition.test-d.d.mts +1 -0
- package/dist/assertions/value-composition.test-d.d.ts +1 -0
- package/dist/assertions/value-composition.test-d.js +4 -0
- package/dist/assertions/value-composition.test-d.js.map +1 -0
- package/dist/context/assert-first.cjs +207 -213
- package/dist/context/assert-first.cjs.map +1 -1
- package/dist/context/assert-first.d.cts +49 -23
- package/dist/context/assert-first.d.mts +49 -23
- package/dist/context/assert-first.d.ts +49 -23
- package/dist/context/session.cjs +111 -9
- package/dist/context/session.cjs.map +1 -1
- package/dist/context/session.d.cts +18 -0
- package/dist/context/session.d.mts +18 -0
- package/dist/context/session.d.ts +18 -0
- package/dist/define.cjs +17 -1
- package/dist/define.cjs.map +1 -1
- package/dist/eval/cli/contribution.cjs +2 -0
- package/dist/eval/cli/contribution.cjs.map +1 -1
- package/dist/eval/host/index.cjs +2 -0
- package/dist/eval/host/index.cjs.map +1 -1
- package/dist/eval/record/evaluation.cjs +3 -0
- package/dist/eval/record/evaluation.cjs.map +1 -1
- package/dist/eval/record/membership-provenance.d.cts +15 -15
- package/dist/eval/record/membership-provenance.d.mts +15 -15
- package/dist/eval/record/membership-provenance.d.ts +15 -15
- package/dist/eval/record/score.cjs +7 -0
- package/dist/eval/record/score.cjs.map +1 -1
- package/dist/eval/record/sealed-assertion.cjs +3 -0
- package/dist/eval/record/sealed-assertion.cjs.map +1 -1
- package/dist/eval/record/verdict.cjs +7 -0
- package/dist/eval/record/verdict.cjs.map +1 -1
- package/dist/expect/index.cjs +8 -2
- package/dist/expect/index.cjs.map +1 -1
- package/dist/expect/index.d.cts +9 -4
- package/dist/expect/index.d.mts +9 -4
- package/dist/expect/index.d.ts +9 -4
- package/dist/expect/index.js +72 -62
- package/dist/expect/index.mjs +72 -62
- package/dist/experiment/host/cli/contribution.cjs +37 -23
- package/dist/experiment/host/cli/contribution.cjs.map +1 -1
- package/dist/experiment/host/cli/contribution.d.cts +9 -1
- package/dist/experiment/host/cli/contribution.d.mts +9 -1
- package/dist/experiment/host/cli/contribution.d.ts +9 -1
- package/dist/experiment/host/current.cjs +74 -0
- package/dist/experiment/host/current.cjs.map +1 -0
- package/dist/experiment/host/current.d.cts +33 -0
- package/dist/experiment/host/current.d.mts +33 -0
- package/dist/experiment/host/current.d.ts +33 -0
- package/dist/experiment/host/current.js +10 -0
- package/dist/experiment/host/current.js.map +1 -0
- package/dist/experiment/host/index.cjs +17 -174
- package/dist/experiment/host/index.cjs.map +1 -1
- package/dist/experiment/host/index.d.cts +8 -54
- package/dist/experiment/host/index.d.mts +8 -54
- package/dist/experiment/host/index.d.ts +8 -54
- package/dist/experiment/host/operations.cjs +33 -10
- package/dist/experiment/host/operations.cjs.map +1 -1
- package/dist/experiment/host/operations.d.cts +29 -1
- package/dist/experiment/host/operations.d.mts +29 -1
- package/dist/experiment/host/operations.d.ts +29 -1
- package/dist/experiment/host/operations.js +6 -4
- package/dist/experiment/host/requirements.cjs +3 -0
- package/dist/experiment/host/requirements.cjs.map +1 -0
- package/dist/experiment/host/requirements.d.cts +3 -0
- package/dist/experiment/host/requirements.d.mts +3 -0
- package/dist/experiment/host/requirements.d.ts +3 -0
- package/dist/experiment/host/requirements.js +4 -0
- package/dist/experiment/host/requirements.js.map +1 -0
- package/dist/experiment/host/runtime.cjs +179 -0
- package/dist/experiment/host/runtime.cjs.map +1 -0
- package/dist/experiment/host/runtime.d.cts +79 -0
- package/dist/experiment/host/runtime.d.mts +79 -0
- package/dist/experiment/host/runtime.d.ts +79 -0
- package/dist/experiment/host/runtime.js +6 -0
- package/dist/experiment/host/runtime.js.map +1 -0
- package/dist/experiment/host/types.cjs.map +1 -1
- package/dist/experiment/host/types.d.cts +17 -16
- package/dist/experiment/host/types.d.mts +17 -16
- package/dist/experiment/host/types.d.ts +17 -16
- package/dist/fresh-import.cjs +2 -1
- package/dist/fresh-import.cjs.map +1 -1
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -6
- package/dist/index.d.mts +12 -6
- package/dist/index.d.ts +12 -6
- package/dist/index.js +32 -30
- package/dist/index.mjs +32 -30
- package/dist/inspection/artifacts.cjs +83 -54
- package/dist/inspection/artifacts.cjs.map +1 -1
- package/dist/inspection/artifacts.d.cts +8 -0
- package/dist/inspection/artifacts.d.mts +8 -0
- package/dist/inspection/artifacts.d.ts +8 -0
- package/dist/inspection/artifacts.js +2 -0
- package/dist/inspection/assertions.cjs +4 -1
- package/dist/inspection/assertions.cjs.map +1 -1
- package/dist/inspection/cli/contribution.cjs +27 -4
- package/dist/inspection/cli/contribution.cjs.map +1 -1
- package/dist/inspection/cli/contribution.d.cts +2 -1
- package/dist/inspection/cli/contribution.d.mts +2 -1
- package/dist/inspection/cli/contribution.d.ts +2 -1
- package/dist/inspection/execution-traces.cjs +114 -8
- package/dist/inspection/execution-traces.cjs.map +1 -1
- package/dist/inspection/execution-traces.d.cts +38 -0
- package/dist/inspection/execution-traces.d.mts +38 -0
- package/dist/inspection/execution-traces.d.ts +38 -0
- package/dist/inspection/facts.cjs +12 -0
- package/dist/inspection/facts.cjs.map +1 -1
- package/dist/inspection/limits.cjs +5 -1
- package/dist/inspection/limits.cjs.map +1 -1
- package/dist/inspection/limits.d.cts +4 -0
- package/dist/inspection/limits.d.mts +4 -0
- package/dist/inspection/limits.d.ts +4 -0
- package/dist/inspection/limits.js +6 -2
- package/dist/inspection/overview.cjs +74 -33
- package/dist/inspection/overview.cjs.map +1 -1
- package/dist/inspection/overview.d.cts +19 -1
- package/dist/inspection/overview.d.mts +19 -1
- package/dist/inspection/overview.d.ts +19 -1
- package/dist/inspection/overview.js +4 -2
- package/dist/inspection/project-input.cjs +9 -0
- package/dist/inspection/project-input.cjs.map +1 -0
- package/dist/inspection/project-input.d.cts +20 -0
- package/dist/inspection/project-input.d.mts +20 -0
- package/dist/inspection/project-input.d.ts +20 -0
- package/dist/inspection/project-input.js +8 -0
- package/dist/inspection/project-input.js.map +1 -0
- package/dist/inspection/project-result.cjs +60 -0
- package/dist/inspection/project-result.cjs.map +1 -0
- package/dist/inspection/project-result.d.cts +1264 -0
- package/dist/inspection/project-result.d.mts +1264 -0
- package/dist/inspection/project-result.d.ts +1264 -0
- package/dist/inspection/project-result.js +10 -0
- package/dist/inspection/project-result.js.map +1 -0
- package/dist/inspection/project-source.cjs +109 -0
- package/dist/inspection/project-source.cjs.map +1 -0
- package/dist/inspection/project-source.d.cts +10 -0
- package/dist/inspection/project-source.d.mts +10 -0
- package/dist/inspection/project-source.d.ts +10 -0
- package/dist/inspection/project-source.js +6 -0
- package/dist/inspection/project-source.js.map +1 -0
- package/dist/inspection/project.cjs +100 -0
- package/dist/inspection/project.cjs.map +1 -0
- package/dist/inspection/project.d.cts +3 -0
- package/dist/inspection/project.d.mts +3 -0
- package/dist/inspection/project.d.ts +3 -0
- package/dist/inspection/project.js +6 -0
- package/dist/inspection/project.js.map +1 -0
- package/dist/inspection/protocol.cjs +19 -9
- package/dist/inspection/protocol.cjs.map +1 -1
- package/dist/inspection/protocol.d.cts +5506 -38189
- package/dist/inspection/protocol.d.mts +5506 -38189
- package/dist/inspection/protocol.d.ts +5506 -38189
- package/dist/inspection/public.mjs +896 -84
- package/dist/inspection/query.cjs +2 -0
- package/dist/inspection/query.cjs.map +1 -1
- package/dist/inspection/results.cjs +234 -29
- package/dist/inspection/results.cjs.map +1 -1
- package/dist/inspection/results.d.cts +870 -13
- package/dist/inspection/results.d.mts +870 -13
- package/dist/inspection/results.d.ts +870 -13
- package/dist/inspection/results.js +36 -34
- package/dist/inspection/select.cjs +126 -14
- package/dist/inspection/select.cjs.map +1 -1
- package/dist/inspection/select.d.cts +1 -1
- package/dist/inspection/select.d.mts +1 -1
- package/dist/inspection/select.d.ts +1 -1
- package/dist/inspection/source.cjs +4 -0
- package/dist/inspection/source.cjs.map +1 -1
- package/dist/inspection/sources.cjs +5 -0
- package/dist/inspection/sources.cjs.map +1 -1
- package/dist/inspection/trace.cjs +82 -84
- package/dist/inspection/trace.cjs.map +1 -1
- package/dist/inspection/trace.d.cts +7 -2
- package/dist/inspection/trace.d.mts +7 -2
- package/dist/inspection/trace.d.ts +7 -2
- package/dist/model-slots.cjs +35 -0
- package/dist/model-slots.cjs.map +1 -0
- package/dist/model-slots.d.cts +19 -0
- package/dist/model-slots.d.mts +19 -0
- package/dist/model-slots.d.ts +19 -0
- package/dist/model-slots.js +8 -0
- package/dist/model-slots.js.map +1 -0
- package/dist/o11y/adapter-call-price.cjs +4 -0
- package/dist/o11y/adapter-call-price.cjs.map +1 -1
- package/dist/o11y/adapter-call-price.d.cts +24 -0
- package/dist/o11y/adapter-call-price.d.mts +24 -0
- package/dist/o11y/adapter-call-price.d.ts +24 -0
- package/dist/o11y/adapter-call-price.js +6 -2
- package/dist/o11y/adapter-usage-projection.cjs +158 -0
- package/dist/o11y/adapter-usage-projection.cjs.map +1 -0
- package/dist/o11y/adapter-usage-projection.d.cts +141 -0
- package/dist/o11y/adapter-usage-projection.d.mts +141 -0
- package/dist/o11y/adapter-usage-projection.d.ts +141 -0
- package/dist/o11y/adapter-usage-projection.js +20 -0
- package/dist/o11y/adapter-usage-projection.js.map +1 -0
- package/dist/o11y/eval-usage.cjs +149 -0
- package/dist/o11y/eval-usage.cjs.map +1 -0
- package/dist/o11y/eval-usage.d.cts +46 -0
- package/dist/o11y/eval-usage.d.mts +46 -0
- package/dist/o11y/eval-usage.d.ts +46 -0
- package/dist/o11y/eval-usage.js +8 -0
- package/dist/o11y/eval-usage.js.map +1 -0
- package/dist/o11y/judge-call-price.cjs +62 -0
- package/dist/o11y/judge-call-price.cjs.map +1 -0
- package/dist/o11y/judge-call-price.d.cts +3 -0
- package/dist/o11y/judge-call-price.d.mts +3 -0
- package/dist/o11y/judge-call-price.d.ts +3 -0
- package/dist/o11y/judge-call-price.js +6 -0
- package/dist/o11y/judge-call-price.js.map +1 -0
- package/dist/o11y/judge-usage-projection.cjs +134 -0
- package/dist/o11y/judge-usage-projection.cjs.map +1 -0
- package/dist/o11y/judge-usage-projection.d.cts +18 -0
- package/dist/o11y/judge-usage-projection.d.mts +18 -0
- package/dist/o11y/judge-usage-projection.d.ts +18 -0
- package/dist/o11y/judge-usage-projection.js +20 -0
- package/dist/o11y/judge-usage-projection.js.map +1 -0
- package/dist/o11y/judge-usage-receipt.cjs +135 -0
- package/dist/o11y/judge-usage-receipt.cjs.map +1 -0
- package/dist/o11y/judge-usage-receipt.d.cts +5 -0
- package/dist/o11y/judge-usage-receipt.d.mts +5 -0
- package/dist/o11y/judge-usage-receipt.d.ts +5 -0
- package/dist/o11y/judge-usage-receipt.js +6 -0
- package/dist/o11y/judge-usage-receipt.js.map +1 -0
- package/dist/o11y/judge-usage.cjs +171 -0
- package/dist/o11y/judge-usage.cjs.map +1 -0
- package/dist/o11y/judge-usage.d.cts +35 -0
- package/dist/o11y/judge-usage.d.mts +35 -0
- package/dist/o11y/judge-usage.d.ts +35 -0
- package/dist/o11y/judge-usage.js +6 -0
- package/dist/o11y/judge-usage.js.map +1 -0
- package/dist/plugin/contracts.cjs +2 -0
- package/dist/plugin/contracts.cjs.map +1 -1
- package/dist/plugin/link.cjs +7 -0
- package/dist/plugin/link.cjs.map +1 -1
- package/dist/record/attachment/protocol.cjs +8 -6
- package/dist/record/attachment/protocol.cjs.map +1 -1
- package/dist/record/attachment/protocol.d.cts +10 -0
- package/dist/record/attachment/protocol.d.mts +10 -0
- package/dist/record/attachment/protocol.d.ts +10 -0
- package/dist/record/attachment/protocol.js +38 -36
- package/dist/record/codec/seal-manifest.d.cts +3 -3
- package/dist/record/codec/seal-manifest.d.mts +3 -3
- package/dist/record/codec/seal-manifest.d.ts +3 -3
- package/dist/record/family/adapter-usage/definition.d.cts +1 -0
- package/dist/record/family/adapter-usage/definition.d.mts +1 -0
- package/dist/record/family/adapter-usage/definition.d.ts +1 -0
- package/dist/record/family/adapter-usage/persistence.cjs +1 -1
- package/dist/record/family/adapter-usage/persistence.cjs.map +1 -1
- package/dist/record/family/adapter-usage/persistence.d.cts +2 -1
- package/dist/record/family/adapter-usage/persistence.d.mts +2 -1
- package/dist/record/family/adapter-usage/persistence.d.ts +2 -1
- package/dist/record/family/adapter-usage/schema.cjs +21 -2
- package/dist/record/family/adapter-usage/schema.cjs.map +1 -1
- package/dist/record/family/adapter-usage/schema.d.cts +85 -0
- package/dist/record/family/adapter-usage/schema.d.mts +85 -0
- package/dist/record/family/adapter-usage/schema.d.ts +85 -0
- package/dist/record/family/adapter-usage/schema.js +18 -12
- package/dist/record/family/catalog.cjs +31 -27
- package/dist/record/family/catalog.cjs.map +1 -1
- package/dist/record/family/catalog.d.cts +94 -3
- package/dist/record/family/catalog.d.mts +94 -3
- package/dist/record/family/catalog.d.ts +94 -3
- package/dist/record/family/current.cjs +45 -42
- package/dist/record/family/current.cjs.map +1 -1
- package/dist/record/family/current.d.cts +240 -1
- package/dist/record/family/current.d.mts +240 -1
- package/dist/record/family/current.d.ts +240 -1
- package/dist/record/family/execution-traces/definition.d.cts +26 -0
- package/dist/record/family/execution-traces/definition.d.mts +26 -0
- package/dist/record/family/execution-traces/definition.d.ts +26 -0
- package/dist/record/family/execution-traces/definition.js +20 -14
- package/dist/record/family/execution-traces/schema.cjs +57 -1
- package/dist/record/family/execution-traces/schema.cjs.map +1 -1
- package/dist/record/family/execution-traces/schema.d.cts +114 -0
- package/dist/record/family/execution-traces/schema.d.mts +114 -0
- package/dist/record/family/execution-traces/schema.d.ts +114 -0
- package/dist/record/family/execution-traces/schema.js +18 -12
- package/dist/record/family/judge-usage/definition.cjs +12 -0
- package/dist/record/family/judge-usage/definition.cjs.map +1 -0
- package/dist/record/family/judge-usage/definition.d.cts +91 -0
- package/dist/record/family/judge-usage/definition.d.mts +91 -0
- package/dist/record/family/judge-usage/definition.d.ts +91 -0
- package/dist/record/family/judge-usage/definition.js +6 -0
- package/dist/record/family/judge-usage/definition.js.map +1 -0
- package/dist/record/family/judge-usage/persistence.cjs +10 -0
- package/dist/record/family/judge-usage/persistence.cjs.map +1 -0
- package/dist/record/family/judge-usage/persistence.d.cts +91 -0
- package/dist/record/family/judge-usage/persistence.d.mts +91 -0
- package/dist/record/family/judge-usage/persistence.d.ts +91 -0
- package/dist/record/family/judge-usage/persistence.js +6 -0
- package/dist/record/family/judge-usage/persistence.js.map +1 -0
- package/dist/record/family/judge-usage/schema.cjs +307 -0
- package/dist/record/family/judge-usage/schema.cjs.map +1 -0
- package/dist/record/family/judge-usage/schema.d.cts +351 -0
- package/dist/record/family/judge-usage/schema.d.mts +351 -0
- package/dist/record/family/judge-usage/schema.d.ts +351 -0
- package/dist/record/family/judge-usage/schema.js +18 -0
- package/dist/record/family/judge-usage/schema.js.map +1 -0
- package/dist/record/host/sqlite-host.cjs +55 -9
- package/dist/record/host/sqlite-host.cjs.map +1 -1
- package/dist/record/host/types.cjs.map +1 -1
- package/dist/record/host/types.d.cts +7 -0
- package/dist/record/host/types.d.mts +7 -0
- package/dist/record/host/types.d.ts +7 -0
- package/dist/record/model/run-context.cjs +7 -1
- package/dist/record/model/run-context.cjs.map +1 -1
- package/dist/record/model/run-context.d.cts +4 -0
- package/dist/record/model/run-context.d.mts +4 -0
- package/dist/record/model/run-context.d.ts +4 -0
- package/dist/record/model/seal-manifest.d.cts +1 -1
- package/dist/record/model/seal-manifest.d.mts +1 -1
- package/dist/record/model/seal-manifest.d.ts +1 -1
- package/dist/record/sqlite/client.cjs +18 -5
- package/dist/record/sqlite/client.cjs.map +1 -1
- package/dist/record/sqlite/client.d.cts +1 -1
- package/dist/record/sqlite/client.d.mts +1 -1
- package/dist/record/sqlite/client.d.ts +1 -1
- package/dist/record/sqlite/project-state-database.cjs +29 -8
- package/dist/record/sqlite/project-state-database.cjs.map +1 -1
- package/dist/run/host/runtime.cjs +4 -0
- package/dist/run/host/runtime.cjs.map +1 -1
- package/dist/run/storage/sqlite.cjs +20 -0
- package/dist/run/storage/sqlite.cjs.map +1 -1
- package/dist/runner/adapter-execution-trace.cjs +125 -2
- package/dist/runner/adapter-execution-trace.cjs.map +1 -1
- package/dist/runner/adapter-execution-trace.d.cts +1 -1
- package/dist/runner/adapter-execution-trace.d.mts +1 -1
- package/dist/runner/adapter-execution-trace.d.ts +1 -1
- package/dist/runner/adapter-usage.cjs +55 -7
- package/dist/runner/adapter-usage.cjs.map +1 -1
- package/dist/runner/adapter-usage.d.cts +9 -2
- package/dist/runner/adapter-usage.d.mts +9 -2
- package/dist/runner/adapter-usage.d.ts +9 -2
- package/dist/runner/adoption.cjs +9 -0
- package/dist/runner/adoption.cjs.map +1 -1
- package/dist/runner/attempt-cancellation.cjs +12 -0
- package/dist/runner/attempt-cancellation.cjs.map +1 -0
- package/dist/runner/attempt-cancellation.d.cts +6 -0
- package/dist/runner/attempt-cancellation.d.mts +6 -0
- package/dist/runner/attempt-cancellation.d.ts +6 -0
- package/dist/runner/attempt-cancellation.js +6 -0
- package/dist/runner/attempt-cancellation.js.map +1 -0
- package/dist/runner/attempt-resources.cjs +10 -4
- package/dist/runner/attempt-resources.cjs.map +1 -1
- package/dist/runner/attempt-resources.d.cts +2 -1
- package/dist/runner/attempt-resources.d.mts +2 -1
- package/dist/runner/attempt-resources.d.ts +2 -1
- package/dist/runner/attempt.cjs +1177 -1139
- package/dist/runner/attempt.cjs.map +1 -1
- package/dist/runner/config-identity.cjs +20 -1
- package/dist/runner/config-identity.cjs.map +1 -1
- package/dist/runner/config-identity.d.cts +5 -0
- package/dist/runner/config-identity.d.mts +5 -0
- package/dist/runner/config-identity.d.ts +5 -0
- package/dist/runner/discover.cjs +14 -0
- package/dist/runner/discover.cjs.map +1 -1
- package/dist/runner/discover.d.cts +3 -0
- package/dist/runner/discover.d.mts +3 -0
- package/dist/runner/discover.d.ts +3 -0
- package/dist/runner/feedback/human.cjs +9 -4
- package/dist/runner/feedback/human.cjs.map +1 -1
- package/dist/runner/fingerprint.cjs +1 -0
- package/dist/runner/fingerprint.cjs.map +1 -1
- package/dist/runner/judge-usage.cjs +18 -0
- package/dist/runner/judge-usage.cjs.map +1 -0
- package/dist/runner/judge-usage.d.cts +5 -0
- package/dist/runner/judge-usage.d.mts +5 -0
- package/dist/runner/judge-usage.d.ts +5 -0
- package/dist/runner/judge-usage.js +8 -0
- package/dist/runner/judge-usage.js.map +1 -0
- package/dist/runner/project-target.cjs.map +1 -1
- package/dist/runner/project-target.d.cts +2 -0
- package/dist/runner/project-target.d.mts +2 -0
- package/dist/runner/project-target.d.ts +2 -0
- package/dist/runner/record/planning.cjs +1 -0
- package/dist/runner/record/planning.cjs.map +1 -1
- package/dist/runner/record.cjs +4 -0
- package/dist/runner/record.cjs.map +1 -1
- package/dist/runner/reporters/braintrust.cjs +2 -0
- package/dist/runner/reporters/braintrust.cjs.map +1 -1
- package/dist/runner/reuse-diagnostics.cjs +9 -10
- package/dist/runner/reuse-diagnostics.cjs.map +1 -1
- package/dist/runner/reuse-diagnostics.d.cts +5 -6
- package/dist/runner/reuse-diagnostics.d.mts +5 -6
- package/dist/runner/reuse-diagnostics.d.ts +5 -6
- package/dist/runner/reuse-diagnostics.js +4 -4
- package/dist/runner/reuse-plan.cjs +100 -48
- package/dist/runner/reuse-plan.cjs.map +1 -1
- package/dist/runner/reuse-plan.d.cts +60 -3
- package/dist/runner/reuse-plan.d.mts +60 -3
- package/dist/runner/reuse-plan.d.ts +60 -3
- package/dist/runner/reuse-plan.js +14 -10
- package/dist/runner/run.cjs +8 -6
- package/dist/runner/run.cjs.map +1 -1
- package/dist/runner/session.cjs +1 -1
- package/dist/runner/session.cjs.map +1 -1
- package/dist/runner/session.d.cts +1 -1
- package/dist/runner/session.d.mts +1 -1
- package/dist/runner/session.d.ts +1 -1
- package/dist/runner/source-producer.cjs +3 -1
- package/dist/runner/source-producer.cjs.map +1 -1
- package/dist/runner/types.cjs.map +1 -1
- package/dist/runner/types.d.cts +26 -5
- package/dist/runner/types.d.mts +26 -5
- package/dist/runner/types.d.ts +26 -5
- package/dist/sandbox/action.cjs +3 -0
- package/dist/sandbox/action.cjs.map +1 -1
- package/dist/sandbox/commands.cjs +3 -0
- package/dist/sandbox/commands.cjs.map +1 -1
- package/dist/sandbox/compose.cjs +6 -0
- package/dist/sandbox/compose.cjs.map +1 -1
- package/dist/sandbox/docker-profile/registry.cjs +7 -0
- package/dist/sandbox/docker-profile/registry.cjs.map +1 -1
- package/dist/sandbox/docker-profile/runtime.cjs +3 -0
- package/dist/sandbox/docker-profile/runtime.cjs.map +1 -1
- package/dist/sandbox/docker-profile/schema.cjs +7 -0
- package/dist/sandbox/docker-profile/schema.cjs.map +1 -1
- package/dist/sandbox/incus.cjs +7 -0
- package/dist/sandbox/incus.cjs.map +1 -1
- package/dist/sandbox/layer.cjs +12 -0
- package/dist/sandbox/layer.cjs.map +1 -1
- package/dist/shared/adapter-cleanup.cjs +18 -0
- package/dist/shared/adapter-cleanup.cjs.map +1 -0
- package/dist/shared/adapter-cleanup.d.cts +4 -0
- package/dist/shared/adapter-cleanup.d.mts +4 -0
- package/dist/shared/adapter-cleanup.d.ts +4 -0
- package/dist/shared/adapter-cleanup.js +10 -0
- package/dist/shared/adapter-cleanup.js.map +1 -0
- package/dist/shared/attempt-lifecycle.cjs +3 -0
- package/dist/shared/attempt-lifecycle.cjs.map +1 -0
- package/dist/shared/attempt-lifecycle.d.cts +13 -0
- package/dist/shared/attempt-lifecycle.d.mts +13 -0
- package/dist/shared/attempt-lifecycle.d.ts +13 -0
- package/dist/shared/attempt-lifecycle.js +4 -0
- package/dist/shared/attempt-lifecycle.js.map +1 -0
- package/dist/show/contribution.cjs +52 -14
- package/dist/show/contribution.cjs.map +1 -1
- package/dist/show/contribution.d.cts +23 -1
- package/dist/show/contribution.d.mts +23 -1
- package/dist/show/contribution.d.ts +23 -1
- package/dist/show/model.cjs +8 -1
- package/dist/show/model.cjs.map +1 -1
- package/dist/show/model.d.cts +10 -1
- package/dist/show/model.d.mts +10 -1
- package/dist/show/model.d.ts +10 -1
- package/dist/show/render.cjs +287 -49
- package/dist/show/render.cjs.map +1 -1
- package/dist/show/render.d.cts +3 -0
- package/dist/show/render.d.mts +3 -0
- package/dist/show/render.d.ts +3 -0
- package/dist/sources/projector.cjs +3 -0
- package/dist/sources/projector.cjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/view/app-dist/.vite/manifest.json +2 -2
- package/dist/view/app-dist/assets/index-CmVoXbwG.js +63 -0
- package/dist/view/app-dist/assets/{quality-cost-scatter-CFB3wnkN.js → quality-cost-scatter-BuLISaH4.js} +1 -1
- package/dist/view/app-dist/index.html +1 -1
- package/dist/view/cli/contribution.cjs +54 -21
- package/dist/view/cli/contribution.cjs.map +1 -1
- package/dist/view/cli/contribution.d.cts +2 -1
- package/dist/view/cli/contribution.d.mts +2 -1
- package/dist/view/cli/contribution.d.ts +2 -1
- package/dist/view/function-runtime.mjs +13231 -11647
- package/dist/view/http-protocol.cjs +3 -0
- package/dist/view/http-protocol.cjs.map +1 -1
- package/dist/view/http-protocol.d.cts +8 -0
- package/dist/view/http-protocol.d.mts +8 -0
- package/dist/view/http-protocol.d.ts +8 -0
- package/dist/view/inspection-host.cjs +17 -1
- package/dist/view/inspection-host.cjs.map +1 -1
- package/dist/view/render.cjs +1 -0
- package/dist/view/render.cjs.map +1 -1
- package/dist/view/render.d.cts +2 -1
- package/dist/view/render.d.mts +2 -1
- package/dist/view/render.d.ts +2 -1
- package/dist/view/revision.cjs.map +1 -1
- package/dist/view/revision.d.cts +12 -0
- package/dist/view/revision.d.mts +12 -0
- package/dist/view/revision.d.ts +12 -0
- package/dist/view/server.cjs +10 -9
- package/dist/view/server.cjs.map +1 -1
- package/docs-site/zh/examples/ai-agent-application.mdx +1 -1
- package/docs-site/zh/explanation/adapter.mdx +2 -2
- package/docs-site/zh/explanation/assert.mdx +60 -24
- package/docs-site/zh/explanation/drive.mdx +1 -1
- package/docs-site/zh/explanation/evals.mdx +31 -29
- package/docs-site/zh/explanation/experiment.mdx +15 -15
- package/docs-site/zh/explanation/judge.mdx +23 -15
- package/docs-site/zh/explanation/overview.mdx +44 -21
- package/docs-site/zh/explanation/record.mdx +28 -13
- package/docs-site/zh/explanation/results-flow.mdx +37 -0
- package/docs-site/zh/explanation/runner.mdx +27 -6
- package/docs-site/zh/index.mdx +22 -115
- package/docs-site/zh/introduction.mdx +89 -61
- package/docs-site/zh/reference/cli.mdx +50 -26
- package/docs-site/zh/reference/define-agent.mdx +37 -5
- package/docs-site/zh/reference/define-eval.mdx +130 -29
- package/docs-site/zh/reference/define-experiment.mdx +251 -0
- package/docs-site/zh/reference/events.mdx +34 -30
- package/docs-site/zh/reference/expect.mdx +77 -2
- package/docs-site/zh/reference/official-adapters.mdx +2 -2
- package/docs-site/zh/troubleshooting/debug-sandbox.mdx +43 -24
- package/docs-site/zh/troubleshooting/debugging.mdx +65 -42
- package/docs-site/zh/troubleshooting/recover-after-kill.mdx +35 -28
- package/docs-site/zh/tutorials/accept-results.mdx +34 -24
- package/docs-site/zh/tutorials/agent-feedback-loop.mdx +74 -43
- package/docs-site/zh/tutorials/agent-onboarding.mdx +27 -20
- package/docs-site/zh/tutorials/authoring.mdx +138 -121
- package/docs-site/zh/tutorials/ci-integration.mdx +46 -22
- package/docs-site/zh/tutorials/compare-runs.mdx +40 -13
- package/docs-site/zh/tutorials/concurrency.mdx +66 -62
- package/docs-site/zh/tutorials/configuration.mdx +17 -17
- package/docs-site/zh/tutorials/connect-otel.mdx +48 -37
- package/docs-site/zh/tutorials/connect-your-agent.mdx +80 -173
- package/docs-site/zh/tutorials/control-run-cost.mdx +63 -12
- package/docs-site/zh/tutorials/criteria-files.mdx +28 -21
- package/docs-site/zh/tutorials/custom-application.mdx +75 -55
- package/docs-site/zh/tutorials/dataset-fanout.mdx +32 -22
- package/docs-site/zh/tutorials/debug-lifecycle-plan.mdx +38 -31
- package/docs-site/zh/tutorials/docker-in-docker.mdx +83 -89
- package/docs-site/zh/tutorials/eval-groups.mdx +70 -89
- package/docs-site/zh/tutorials/evaluation-kinds.mdx +12 -5
- package/docs-site/zh/tutorials/experiment-services.mdx +243 -0
- package/docs-site/zh/tutorials/fixtures.mdx +42 -26
- package/docs-site/zh/tutorials/handle-execution-failures.mdx +41 -19
- package/docs-site/zh/tutorials/install-custom-sandbox-agent.mdx +21 -16
- package/docs-site/zh/tutorials/niceeval-taste-application.mdx +394 -0
- package/docs-site/zh/tutorials/niceeval-taste.mdx +190 -0
- package/docs-site/zh/tutorials/nixos-managed-dind.mdx +51 -39
- package/docs-site/zh/tutorials/plugins.mdx +55 -31
- package/docs-site/zh/tutorials/prebuilt-sandbox.mdx +204 -0
- package/docs-site/zh/tutorials/quickstart.mdx +91 -47
- package/docs-site/zh/tutorials/reporters.mdx +45 -30
- package/docs-site/zh/tutorials/rerun-and-cache.mdx +39 -40
- package/docs-site/zh/tutorials/sandbox-agent.mdx +65 -40
- package/docs-site/zh/tutorials/sandbox-providers.mdx +104 -282
- package/docs-site/zh/tutorials/sandbox-reuse.mdx +65 -97
- package/docs-site/zh/tutorials/select-and-preview.mdx +25 -20
- package/docs-site/zh/tutorials/verify-judge.mdx +49 -26
- package/docs-site/zh/tutorials/viewing-results.mdx +130 -80
- package/docs-site/zh/tutorials/write-experiment.mdx +116 -298
- package/docs-site/zh/tutorials/write-send.mdx +53 -52
- package/node_modules/undici/docs/docs/api/Agent.md +8 -8
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
- package/node_modules/undici/docs/docs/api/Errors.md +25 -0
- package/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
- package/node_modules/undici/docs/docs/api/Pool.md +5 -6
- package/node_modules/undici/lib/api/readable.js +1 -2
- package/node_modules/undici/lib/core/request.js +23 -2
- package/node_modules/undici/lib/core/util.js +0 -39
- package/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
- package/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
- package/node_modules/undici/lib/dispatcher/client.js +1 -1
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +3 -2
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
- package/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
- package/node_modules/undici/lib/dispatcher/pool.js +90 -7
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
- package/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
- package/node_modules/undici/lib/handler/redirect-handler.js +5 -0
- package/node_modules/undici/lib/handler/retry-handler.js +72 -13
- package/node_modules/undici/lib/interceptor/cache.js +4 -1
- package/node_modules/undici/lib/interceptor/decompress.js +236 -69
- package/node_modules/undici/lib/web/cache/cache.js +17 -8
- package/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
- package/node_modules/undici/lib/web/cookies/index.js +19 -7
- package/node_modules/undici/lib/web/cookies/util.js +3 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
- package/node_modules/undici/lib/web/fetch/body.js +22 -15
- package/node_modules/undici/lib/web/fetch/data-url.js +6 -6
- package/node_modules/undici/lib/web/fetch/formdata.js +30 -36
- package/node_modules/undici/lib/web/fetch/headers.js +34 -31
- package/node_modules/undici/lib/web/fetch/index.js +38 -14
- package/node_modules/undici/lib/web/fetch/request.js +74 -79
- package/node_modules/undici/lib/web/fetch/response.js +43 -44
- package/node_modules/undici/lib/web/fetch/util.js +7 -7
- package/node_modules/undici/lib/web/infra/index.js +16 -1
- package/node_modules/undici/lib/web/webidl/index.js +2 -14
- package/node_modules/undici/lib/web/websocket/events.js +43 -26
- package/node_modules/undici/lib/web/websocket/receiver.js +5 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
- package/node_modules/undici/lib/web/websocket/websocket.js +44 -41
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/diagnostics-channel.d.ts +2 -1
- package/node_modules/undici/types/interceptors.d.ts +1 -1
- package/node_modules/undici/types/webidl.d.ts +13 -7
- package/package.json +4 -4
- package/dist/view/app-dist/assets/index-DFzw1L97.js +0 -63
- package/docs-site/zh/tutorials/experiments.mdx +0 -101
package/dist/index.js
CHANGED
|
@@ -7,14 +7,14 @@ const __niceevalExport1 = __niceevalCanonical["ExperimentFatalError"];
|
|
|
7
7
|
export { __niceevalExport1 as ExperimentFatalError };
|
|
8
8
|
const __niceevalExport2 = __niceevalCanonical["MigrationRequiredError"];
|
|
9
9
|
export { __niceevalExport2 as MigrationRequiredError };
|
|
10
|
-
const __niceevalExport3 = __niceevalCanonical["
|
|
11
|
-
export { __niceevalExport3 as
|
|
12
|
-
const __niceevalExport4 = __niceevalCanonical["
|
|
13
|
-
export { __niceevalExport4 as
|
|
14
|
-
const __niceevalExport5 = __niceevalCanonical["
|
|
15
|
-
export { __niceevalExport5 as
|
|
16
|
-
const __niceevalExport6 = __niceevalCanonical["
|
|
17
|
-
export { __niceevalExport6 as
|
|
10
|
+
const __niceevalExport3 = __niceevalCanonical["defineAdapter"];
|
|
11
|
+
export { __niceevalExport3 as defineAdapter };
|
|
12
|
+
const __niceevalExport4 = __niceevalCanonical["defineAdapterContract"];
|
|
13
|
+
export { __niceevalExport4 as defineAdapterContract };
|
|
14
|
+
const __niceevalExport5 = __niceevalCanonical["defineConfig"];
|
|
15
|
+
export { __niceevalExport5 as defineConfig };
|
|
16
|
+
const __niceevalExport6 = __niceevalCanonical["defineContextMatch"];
|
|
17
|
+
export { __niceevalExport6 as defineContextMatch };
|
|
18
18
|
const __niceevalExport7 = __niceevalCanonical["defineEval"];
|
|
19
19
|
export { __niceevalExport7 as defineEval };
|
|
20
20
|
const __niceevalExport8 = __niceevalCanonical["defineEvalGroup"];
|
|
@@ -23,26 +23,28 @@ const __niceevalExport9 = __niceevalCanonical["defineExperiment"];
|
|
|
23
23
|
export { __niceevalExport9 as defineExperiment };
|
|
24
24
|
const __niceevalExport10 = __niceevalCanonical["defineJudge"];
|
|
25
25
|
export { __niceevalExport10 as defineJudge };
|
|
26
|
-
const __niceevalExport11 = __niceevalCanonical["
|
|
27
|
-
export { __niceevalExport11 as
|
|
28
|
-
const __niceevalExport12 = __niceevalCanonical["
|
|
29
|
-
export { __niceevalExport12 as
|
|
30
|
-
const __niceevalExport13 = __niceevalCanonical["
|
|
31
|
-
export { __niceevalExport13 as
|
|
32
|
-
const __niceevalExport14 = __niceevalCanonical["
|
|
33
|
-
export { __niceevalExport14 as
|
|
34
|
-
const __niceevalExport15 = __niceevalCanonical["
|
|
35
|
-
export { __niceevalExport15 as
|
|
36
|
-
const __niceevalExport16 = __niceevalCanonical["
|
|
37
|
-
export { __niceevalExport16 as
|
|
38
|
-
const __niceevalExport17 = __niceevalCanonical["
|
|
39
|
-
export { __niceevalExport17 as
|
|
40
|
-
const __niceevalExport18 = __niceevalCanonical["
|
|
41
|
-
export { __niceevalExport18 as
|
|
42
|
-
const __niceevalExport19 = __niceevalCanonical["
|
|
43
|
-
export { __niceevalExport19 as
|
|
44
|
-
const __niceevalExport20 = __niceevalCanonical["
|
|
45
|
-
export { __niceevalExport20 as
|
|
46
|
-
const __niceevalExport21 = __niceevalCanonical["
|
|
47
|
-
export { __niceevalExport21 as
|
|
26
|
+
const __niceevalExport11 = __niceevalCanonical["defineMaterialMatch"];
|
|
27
|
+
export { __niceevalExport11 as defineMaterialMatch };
|
|
28
|
+
const __niceevalExport12 = __niceevalCanonical["defineScoreEval"];
|
|
29
|
+
export { __niceevalExport12 as defineScoreEval };
|
|
30
|
+
const __niceevalExport13 = __niceevalCanonical["defineScoreMatch"];
|
|
31
|
+
export { __niceevalExport13 as defineScoreMatch };
|
|
32
|
+
const __niceevalExport14 = __niceevalCanonical["factuality"];
|
|
33
|
+
export { __niceevalExport14 as factuality };
|
|
34
|
+
const __niceevalExport15 = __niceevalCanonical["failureClassOf"];
|
|
35
|
+
export { __niceevalExport15 as failureClassOf };
|
|
36
|
+
const __niceevalExport16 = __niceevalCanonical["faithfulness"];
|
|
37
|
+
export { __niceevalExport16 as faithfulness };
|
|
38
|
+
const __niceevalExport17 = __niceevalCanonical["getEnv"];
|
|
39
|
+
export { __niceevalExport17 as getEnv };
|
|
40
|
+
const __niceevalExport18 = __niceevalCanonical["instructionFollowing"];
|
|
41
|
+
export { __niceevalExport18 as instructionFollowing };
|
|
42
|
+
const __niceevalExport19 = __niceevalCanonical["pairwisePreference"];
|
|
43
|
+
export { __niceevalExport19 as pairwisePreference };
|
|
44
|
+
const __niceevalExport20 = __niceevalCanonical["readScoreMatchAudit"];
|
|
45
|
+
export { __niceevalExport20 as readScoreMatchAudit };
|
|
46
|
+
const __niceevalExport21 = __niceevalCanonical["requireEnv"];
|
|
47
|
+
export { __niceevalExport21 as requireEnv };
|
|
48
|
+
const __niceevalExport22 = __niceevalCanonical["stripComments"];
|
|
49
|
+
export { __niceevalExport22 as stripComments };
|
|
48
50
|
//# sourceMappingURL=index.js.map
|
package/dist/index.mjs
CHANGED
|
@@ -7,14 +7,14 @@ const __niceevalExport1 = __niceevalCanonical["ExperimentFatalError"];
|
|
|
7
7
|
export { __niceevalExport1 as ExperimentFatalError };
|
|
8
8
|
const __niceevalExport2 = __niceevalCanonical["MigrationRequiredError"];
|
|
9
9
|
export { __niceevalExport2 as MigrationRequiredError };
|
|
10
|
-
const __niceevalExport3 = __niceevalCanonical["
|
|
11
|
-
export { __niceevalExport3 as
|
|
12
|
-
const __niceevalExport4 = __niceevalCanonical["
|
|
13
|
-
export { __niceevalExport4 as
|
|
14
|
-
const __niceevalExport5 = __niceevalCanonical["
|
|
15
|
-
export { __niceevalExport5 as
|
|
16
|
-
const __niceevalExport6 = __niceevalCanonical["
|
|
17
|
-
export { __niceevalExport6 as
|
|
10
|
+
const __niceevalExport3 = __niceevalCanonical["defineAdapter"];
|
|
11
|
+
export { __niceevalExport3 as defineAdapter };
|
|
12
|
+
const __niceevalExport4 = __niceevalCanonical["defineAdapterContract"];
|
|
13
|
+
export { __niceevalExport4 as defineAdapterContract };
|
|
14
|
+
const __niceevalExport5 = __niceevalCanonical["defineConfig"];
|
|
15
|
+
export { __niceevalExport5 as defineConfig };
|
|
16
|
+
const __niceevalExport6 = __niceevalCanonical["defineContextMatch"];
|
|
17
|
+
export { __niceevalExport6 as defineContextMatch };
|
|
18
18
|
const __niceevalExport7 = __niceevalCanonical["defineEval"];
|
|
19
19
|
export { __niceevalExport7 as defineEval };
|
|
20
20
|
const __niceevalExport8 = __niceevalCanonical["defineEvalGroup"];
|
|
@@ -23,26 +23,28 @@ const __niceevalExport9 = __niceevalCanonical["defineExperiment"];
|
|
|
23
23
|
export { __niceevalExport9 as defineExperiment };
|
|
24
24
|
const __niceevalExport10 = __niceevalCanonical["defineJudge"];
|
|
25
25
|
export { __niceevalExport10 as defineJudge };
|
|
26
|
-
const __niceevalExport11 = __niceevalCanonical["
|
|
27
|
-
export { __niceevalExport11 as
|
|
28
|
-
const __niceevalExport12 = __niceevalCanonical["
|
|
29
|
-
export { __niceevalExport12 as
|
|
30
|
-
const __niceevalExport13 = __niceevalCanonical["
|
|
31
|
-
export { __niceevalExport13 as
|
|
32
|
-
const __niceevalExport14 = __niceevalCanonical["
|
|
33
|
-
export { __niceevalExport14 as
|
|
34
|
-
const __niceevalExport15 = __niceevalCanonical["
|
|
35
|
-
export { __niceevalExport15 as
|
|
36
|
-
const __niceevalExport16 = __niceevalCanonical["
|
|
37
|
-
export { __niceevalExport16 as
|
|
38
|
-
const __niceevalExport17 = __niceevalCanonical["
|
|
39
|
-
export { __niceevalExport17 as
|
|
40
|
-
const __niceevalExport18 = __niceevalCanonical["
|
|
41
|
-
export { __niceevalExport18 as
|
|
42
|
-
const __niceevalExport19 = __niceevalCanonical["
|
|
43
|
-
export { __niceevalExport19 as
|
|
44
|
-
const __niceevalExport20 = __niceevalCanonical["
|
|
45
|
-
export { __niceevalExport20 as
|
|
46
|
-
const __niceevalExport21 = __niceevalCanonical["
|
|
47
|
-
export { __niceevalExport21 as
|
|
26
|
+
const __niceevalExport11 = __niceevalCanonical["defineMaterialMatch"];
|
|
27
|
+
export { __niceevalExport11 as defineMaterialMatch };
|
|
28
|
+
const __niceevalExport12 = __niceevalCanonical["defineScoreEval"];
|
|
29
|
+
export { __niceevalExport12 as defineScoreEval };
|
|
30
|
+
const __niceevalExport13 = __niceevalCanonical["defineScoreMatch"];
|
|
31
|
+
export { __niceevalExport13 as defineScoreMatch };
|
|
32
|
+
const __niceevalExport14 = __niceevalCanonical["factuality"];
|
|
33
|
+
export { __niceevalExport14 as factuality };
|
|
34
|
+
const __niceevalExport15 = __niceevalCanonical["failureClassOf"];
|
|
35
|
+
export { __niceevalExport15 as failureClassOf };
|
|
36
|
+
const __niceevalExport16 = __niceevalCanonical["faithfulness"];
|
|
37
|
+
export { __niceevalExport16 as faithfulness };
|
|
38
|
+
const __niceevalExport17 = __niceevalCanonical["getEnv"];
|
|
39
|
+
export { __niceevalExport17 as getEnv };
|
|
40
|
+
const __niceevalExport18 = __niceevalCanonical["instructionFollowing"];
|
|
41
|
+
export { __niceevalExport18 as instructionFollowing };
|
|
42
|
+
const __niceevalExport19 = __niceevalCanonical["pairwisePreference"];
|
|
43
|
+
export { __niceevalExport19 as pairwisePreference };
|
|
44
|
+
const __niceevalExport20 = __niceevalCanonical["readScoreMatchAudit"];
|
|
45
|
+
export { __niceevalExport20 as readScoreMatchAudit };
|
|
46
|
+
const __niceevalExport21 = __niceevalCanonical["requireEnv"];
|
|
47
|
+
export { __niceevalExport21 as requireEnv };
|
|
48
|
+
const __niceevalExport22 = __niceevalCanonical["stripComments"];
|
|
49
|
+
export { __niceevalExport22 as stripComments };
|
|
48
50
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.InspectionArtifactError = exports.InspectionArtifactResultSchema = exports.InspectionArtifactLimitSchema = exports.InspectionArtifactOffsetSchema = exports.InspectionArtifactLimits = void 0;
|
|
4
4
|
exports.projectAttemptArtifact = projectAttemptArtifact;
|
|
5
5
|
exports.readInspectionArtifactBytes = readInspectionArtifactBytes;
|
|
6
|
+
exports.readInspectionArtifactDescriptors = readInspectionArtifactDescriptors;
|
|
6
7
|
const effect_1 = require("effect");
|
|
7
8
|
const attempt_locator_ts_1 = require("../attempt-locator.cjs");
|
|
8
9
|
const content_ts_1 = require("../record/attachment/content.cjs");
|
|
@@ -122,76 +123,104 @@ function projectAttemptArtifact(resolved, request) {
|
|
|
122
123
|
}));
|
|
123
124
|
}
|
|
124
125
|
}
|
|
126
|
+
/** Hydrates and verifies every sealed artifact descriptor of the exact origin Attempt. */
|
|
127
|
+
function hydrateArtifactDescriptors(resolved) {
|
|
128
|
+
if ((0, attempt_locator_ts_1.encodeAttemptLocator)(resolved.attempt.attemptId) !== resolved.locator ||
|
|
129
|
+
resolved.attempt.originRunId !== resolved.origin.run.runId) {
|
|
130
|
+
throw new Error("Artifact origin does not match the requested Attempt locator.");
|
|
131
|
+
}
|
|
132
|
+
const attachments = resolved.origin.attachments.filter(({ physical }) => physical.ownerKind === "attempt" && physical.ownerAttemptId === resolved.attempt.attemptId &&
|
|
133
|
+
physical.family === definition_ts_1.attemptArtifactsRecordAttachment.family);
|
|
134
|
+
if (attachments.length !== 1)
|
|
135
|
+
throw new Error("Artifact owner attachment is unavailable.");
|
|
136
|
+
const attachment = attachments[0];
|
|
137
|
+
if (attachment.physical.ownerRunId !== resolved.attempt.originRunId ||
|
|
138
|
+
attachment.physical.familyRevision !== persistence_ts_1.attemptArtifactsRecordAttachmentPersistence.revision ||
|
|
139
|
+
attachment.physical.references.length !== 0) {
|
|
140
|
+
throw new Error("Artifact attachment ownership or revision is invalid.");
|
|
141
|
+
}
|
|
142
|
+
const byLogicalHandle = new Map(attachment.physical.contents.map((content) => [content.logicalHandle, content]));
|
|
143
|
+
const bound = new WeakMap();
|
|
144
|
+
const used = new Set();
|
|
145
|
+
if (byLogicalHandle.size !== attachment.physical.contents.length)
|
|
146
|
+
throw new Error("Duplicate artifact content handle.");
|
|
147
|
+
const hydrated = (0, protocol_ts_1.hydrateRecordAttachmentCurrent)(definition_ts_1.attemptArtifactsRecordAttachment, attachment.value, {
|
|
148
|
+
content: (token, declaration) => {
|
|
149
|
+
const marker = decodeMarker(token);
|
|
150
|
+
if (effect_1.Result.isFailure(marker))
|
|
151
|
+
return effect_1.Result.succeed(undefined);
|
|
152
|
+
const logicalHandle = marker.success["$niceeval.record.content"];
|
|
153
|
+
const persisted = byLogicalHandle.get(logicalHandle);
|
|
154
|
+
if (persisted === undefined || used.has(logicalHandle) || declaration.kind !== "bytes" ||
|
|
155
|
+
declaration.maximumBytes !== undefined && persisted.byteLength > declaration.maximumBytes) {
|
|
156
|
+
return effect_1.Result.fail({ code: "current-content-bind-failed" });
|
|
157
|
+
}
|
|
158
|
+
const handle = (0, content_ts_1.mintRecordContentHandle)("bytes");
|
|
159
|
+
bound.set(handle, persisted);
|
|
160
|
+
used.add(logicalHandle);
|
|
161
|
+
return effect_1.Result.succeed(handle);
|
|
162
|
+
},
|
|
163
|
+
reference: () => effect_1.Result.succeed(undefined),
|
|
164
|
+
});
|
|
165
|
+
if (effect_1.Result.isFailure(hydrated) || used.size !== attachment.physical.contents.length) {
|
|
166
|
+
throw new Error("Artifact content closure is invalid.");
|
|
167
|
+
}
|
|
168
|
+
return Object.freeze(hydrated.success.artifacts.map((descriptor) => {
|
|
169
|
+
const metadata = bound.get(descriptor.content);
|
|
170
|
+
if (metadata === undefined || metadata.byteLength !== descriptor.byteLength || metadata.digest !== descriptor.sha256 ||
|
|
171
|
+
descriptor.byteLength < 0) {
|
|
172
|
+
throw new Error("Artifact descriptor does not match sealed content metadata.");
|
|
173
|
+
}
|
|
174
|
+
return Object.freeze({
|
|
175
|
+
artifactId: descriptor.artifactId,
|
|
176
|
+
name: descriptor.label,
|
|
177
|
+
mediaType: descriptor.mediaType,
|
|
178
|
+
byteLength: descriptor.byteLength,
|
|
179
|
+
sha256: descriptor.sha256,
|
|
180
|
+
content: metadata,
|
|
181
|
+
});
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
125
184
|
/** Internal fixed-family closure reader. It verifies the whole sealed artifact. */
|
|
126
185
|
function readInspectionArtifactBytes(resolved, artifactId, maximumBytes) {
|
|
127
186
|
if (effect_1.Result.isFailure(decodeRequest({ artifactId })))
|
|
128
187
|
return requestInvalid("Invalid artifact ID.");
|
|
129
188
|
try {
|
|
130
|
-
|
|
131
|
-
resolved.attempt.originRunId !== resolved.origin.run.runId) {
|
|
132
|
-
throw new Error("Artifact origin does not match the requested Attempt locator.");
|
|
133
|
-
}
|
|
134
|
-
const attachments = resolved.origin.attachments.filter(({ physical }) => physical.ownerKind === "attempt" && physical.ownerAttemptId === resolved.attempt.attemptId &&
|
|
135
|
-
physical.family === definition_ts_1.attemptArtifactsRecordAttachment.family);
|
|
136
|
-
if (attachments.length !== 1)
|
|
137
|
-
throw new Error("Artifact owner attachment is unavailable.");
|
|
138
|
-
const attachment = attachments[0];
|
|
139
|
-
if (attachment.physical.ownerRunId !== resolved.attempt.originRunId ||
|
|
140
|
-
attachment.physical.familyRevision !== persistence_ts_1.attemptArtifactsRecordAttachmentPersistence.revision ||
|
|
141
|
-
attachment.physical.references.length !== 0) {
|
|
142
|
-
throw new Error("Artifact attachment ownership or revision is invalid.");
|
|
143
|
-
}
|
|
144
|
-
const byLogicalHandle = new Map(attachment.physical.contents.map((content) => [content.logicalHandle, content]));
|
|
145
|
-
const bound = new WeakMap();
|
|
146
|
-
const used = new Set();
|
|
147
|
-
if (byLogicalHandle.size !== attachment.physical.contents.length)
|
|
148
|
-
throw new Error("Duplicate artifact content handle.");
|
|
149
|
-
const hydrated = (0, protocol_ts_1.hydrateRecordAttachmentCurrent)(definition_ts_1.attemptArtifactsRecordAttachment, attachment.value, {
|
|
150
|
-
content: (token, declaration) => {
|
|
151
|
-
const marker = decodeMarker(token);
|
|
152
|
-
if (effect_1.Result.isFailure(marker))
|
|
153
|
-
return effect_1.Result.succeed(undefined);
|
|
154
|
-
const logicalHandle = marker.success["$niceeval.record.content"];
|
|
155
|
-
const persisted = byLogicalHandle.get(logicalHandle);
|
|
156
|
-
if (persisted === undefined || used.has(logicalHandle) || declaration.kind !== "bytes" ||
|
|
157
|
-
declaration.maximumBytes !== undefined && persisted.byteLength > declaration.maximumBytes) {
|
|
158
|
-
return effect_1.Result.fail({ code: "current-content-bind-failed" });
|
|
159
|
-
}
|
|
160
|
-
const handle = (0, content_ts_1.mintRecordContentHandle)("bytes");
|
|
161
|
-
bound.set(handle, persisted);
|
|
162
|
-
used.add(logicalHandle);
|
|
163
|
-
return effect_1.Result.succeed(handle);
|
|
164
|
-
},
|
|
165
|
-
reference: () => effect_1.Result.succeed(undefined),
|
|
166
|
-
});
|
|
167
|
-
if (effect_1.Result.isFailure(hydrated) || used.size !== attachment.physical.contents.length) {
|
|
168
|
-
throw new Error("Artifact content closure is invalid.");
|
|
169
|
-
}
|
|
170
|
-
for (const descriptor of hydrated.success.artifacts) {
|
|
171
|
-
const metadata = bound.get(descriptor.content);
|
|
172
|
-
if (metadata === undefined || metadata.byteLength !== descriptor.byteLength || metadata.digest !== descriptor.sha256) {
|
|
173
|
-
throw new Error("Artifact descriptor does not match sealed content metadata.");
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
const artifact = hydrated.success.artifacts.find((entry) => entry.artifactId === artifactId);
|
|
189
|
+
const artifact = hydrateArtifactDescriptors(resolved).find((entry) => entry.artifactId === artifactId);
|
|
177
190
|
if (artifact === undefined)
|
|
178
191
|
return effect_1.Result.succeed(undefined);
|
|
179
|
-
const content = bound.get(artifact.content);
|
|
180
|
-
if (content === undefined || content.byteLength !== artifact.byteLength || content.digest !== artifact.sha256 ||
|
|
181
|
-
artifact.byteLength < 0) {
|
|
182
|
-
throw new Error("Artifact descriptor does not match sealed content metadata.");
|
|
183
|
-
}
|
|
184
192
|
if (artifact.byteLength > maximumBytes)
|
|
185
193
|
return requestInvalid("Artifact exceeds the evidence parsing budget.");
|
|
186
194
|
return effect_1.Result.succeed(Object.freeze({
|
|
187
195
|
artifactId,
|
|
188
|
-
name: artifact.
|
|
196
|
+
name: artifact.name,
|
|
189
197
|
mediaType: artifact.mediaType,
|
|
190
198
|
byteLength: artifact.byteLength,
|
|
191
199
|
sha256: artifact.sha256,
|
|
192
|
-
bytes: readVerifiedRange(resolved.origin.source, content, 0, artifact.byteLength),
|
|
200
|
+
bytes: readVerifiedRange(resolved.origin.source, artifact.content, 0, artifact.byteLength),
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
catch (cause) {
|
|
204
|
+
return effect_1.Result.fail(new InspectionArtifactError({
|
|
205
|
+
code: "inspection-record-integrity-failure",
|
|
206
|
+
reason: cause instanceof Error ? cause.message : "Artifact content validation failed.",
|
|
193
207
|
}));
|
|
194
208
|
}
|
|
209
|
+
}
|
|
210
|
+
/** Descriptor-only closure reader for references that must not load bytes, such as display images. */
|
|
211
|
+
function readInspectionArtifactDescriptors(resolved) {
|
|
212
|
+
try {
|
|
213
|
+
const hasArtifacts = resolved.origin.attachments.some(({ physical }) => physical.ownerKind === "attempt" && physical.ownerAttemptId === resolved.attempt.attemptId &&
|
|
214
|
+
physical.family === definition_ts_1.attemptArtifactsRecordAttachment.family);
|
|
215
|
+
if (!hasArtifacts)
|
|
216
|
+
return effect_1.Result.succeed(new Map());
|
|
217
|
+
return effect_1.Result.succeed(new Map(hydrateArtifactDescriptors(resolved).map((artifact) => [artifact.artifactId, Object.freeze({
|
|
218
|
+
artifactId: artifact.artifactId,
|
|
219
|
+
mediaType: artifact.mediaType,
|
|
220
|
+
byteLength: artifact.byteLength,
|
|
221
|
+
sha256: artifact.sha256,
|
|
222
|
+
})])));
|
|
223
|
+
}
|
|
195
224
|
catch (cause) {
|
|
196
225
|
return effect_1.Result.fail(new InspectionArtifactError({
|
|
197
226
|
code: "inspection-record-integrity-failure",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["artifacts.ts"],"names":[],"mappings":";;;AAsDA,wDA+EC;AAED,kEA2EC;AAlND,mCAA8C;AAC9C,8DAA6D;AAC7D,gEAA0E;AAC1E,kEAAkF;AAClF,qDAAkE;AAClE,mEAAsF;AACtF,4EAA4F;AAC5F,8EAAwG;AACxG,0DAA2G;AAE3G,yCAAiE;AAGpD,QAAA,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,EAAE,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AAqC,CAAC,CAAC;YAC3D,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;YAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACtF,IAAI,GAAG,GAAG,KAAK;gBACX,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,GAAG,UAAU,EAAE,GAAG,GAAG,UAAU,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,CAAC;YAC3F,UAAU,IAAI,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC;YACrC,eAAe,IAAI,CAAC,CAAC;QACzB,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI;YACzB,MAAM;QACV,IAAI,IAAI,CAAC,WAAW,KAAK,eAAe,GAAG,CAAC,IAAI,eAAe,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;YACrF,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QACjE,CAAC;QACD,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC;IACpC,CAAC;IACD,IAAI,UAAU,KAAK,QAAQ,CAAC,UAAU,IAAI,eAAe,KAAK,QAAQ,CAAC,UAAU,IAAI,MAAM,CAAC,SAAS,EAAE,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;QAC1H,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { Data, Result, Schema } from \"effect\";\nimport { encodeAttemptLocator } from \"../attempt-locator.ts\";\nimport { mintRecordContentHandle } from \"../record/attachment/content.ts\";\nimport { hydrateRecordAttachmentCurrent } from \"../record/attachment/protocol.ts\";\nimport { RecordExactParseOptions } from \"../record/codec/core.ts\";\nimport { ArtifactIdSchema, Sha256DigestSchema } from \"../record/codec/identifiers.ts\";\nimport { attemptArtifactsRecordAttachment } from \"../record/family/artifacts/definition.ts\";\nimport { attemptArtifactsRecordAttachmentPersistence } from \"../record/family/artifacts/persistence.ts\";\nimport { MediaTypeSchema, NonNegativeSafeIntegerSchema, SafeTextSchema } from \"../record/family/common.ts\";\nimport type { PersistedContentMetadata } from \"../record/sqlite/types.ts\";\nimport { encodeBase64Bytes, InspectionSha256 } from \"./bytes.ts\";\nimport type { ResolvedInspectionAttempt } from \"./facts.ts\";\nimport type { InspectionFactSource } from \"./source.ts\";\nexport const InspectionArtifactLimits = Object.freeze({ defaultBytes: 64 * 1024, maximumBytes: 256 * 1024 });\nexport const InspectionArtifactOffsetSchema = NonNegativeSafeIntegerSchema;\nexport const InspectionArtifactLimitSchema = NonNegativeSafeIntegerSchema.pipe(Schema.check(Schema.makeFilter((value) => value > 0 && value <= InspectionArtifactLimits.maximumBytes)));\nconst ReadRequestSchema = Schema.Struct({\n artifactId: ArtifactIdSchema,\n offset: Schema.optional(InspectionArtifactOffsetSchema),\n limit: Schema.optional(InspectionArtifactLimitSchema),\n});\nexport type InspectionArtifactRequest = Schema.Schema.Type<typeof ReadRequestSchema>;\nexport const InspectionArtifactResultSchema = Schema.Union([\n Schema.Struct({ state: Schema.Literal(\"not-found\"), artifactId: ArtifactIdSchema }),\n Schema.Struct({\n state: Schema.Literal(\"available\"),\n artifactId: ArtifactIdSchema,\n name: Schema.toType(SafeTextSchema),\n mediaType: Schema.toType(MediaTypeSchema),\n byteLength: NonNegativeSafeIntegerSchema,\n sha256: Sha256DigestSchema,\n offset: InspectionArtifactOffsetSchema,\n base64: Schema.String.pipe(Schema.check(Schema.makeFilter((value) => value.length <= Math.ceil(InspectionArtifactLimits.maximumBytes / 3) * 4 &&\n value.length % 4 === 0 && /^[A-Za-z0-9+/]*={0,2}$/.test(value)))),\n nextOffset: Schema.NullOr(InspectionArtifactOffsetSchema),\n }),\n]);\nexport type InspectionArtifactResult = Schema.Schema.Type<typeof InspectionArtifactResultSchema>;\nexport interface InspectionArtifactBytes {\n readonly artifactId: string;\n readonly name: string;\n readonly mediaType: string;\n readonly byteLength: number;\n readonly sha256: string;\n readonly bytes: Uint8Array;\n}\nexport class InspectionArtifactError extends Data.TaggedError(\"InspectionArtifactError\")<{\n readonly code: \"inspection-request-invalid\" | \"inspection-record-integrity-failure\";\n readonly reason: string;\n}> {\n}\nconst decodeRequest = Schema.decodeUnknownResult(ReadRequestSchema, RecordExactParseOptions);\nconst decodeMarker = Schema.decodeUnknownResult(Schema.Struct({ \"$niceeval.record.content\": Schema.String }), RecordExactParseOptions);\n/** Reads the exact origin's sealed bytes; only the requested range is retained in memory. */\nexport function projectAttemptArtifact(resolved: ResolvedInspectionAttempt, request: InspectionArtifactRequest): Result.Result<InspectionArtifactResult, InspectionArtifactError> {\n const decoded = decodeRequest(request);\n if (Result.isFailure(decoded))\n return requestInvalid(\"Invalid artifact ID, offset, or limit.\");\n const { artifactId, offset = 0, limit = InspectionArtifactLimits.defaultBytes } = decoded.success;\n try {\n if (encodeAttemptLocator(resolved.attempt.attemptId) !== resolved.locator ||\n resolved.attempt.originRunId !== resolved.origin.run.runId) {\n throw new Error(\"Artifact origin does not match the requested Attempt locator.\");\n }\n const attachments = resolved.origin.attachments.filter(({ physical }) => physical.ownerKind === \"attempt\" && physical.ownerAttemptId === resolved.attempt.attemptId &&\n physical.family === attemptArtifactsRecordAttachment.family);\n if (attachments.length === 0)\n return Result.succeed(Object.freeze({ state: \"not-found\", artifactId }));\n if (attachments.length !== 1)\n throw new Error(\"Artifact owner has duplicate attachments.\");\n const attachment = attachments[0]!;\n if (attachment.physical.ownerRunId !== resolved.attempt.originRunId ||\n attachment.physical.familyRevision !== attemptArtifactsRecordAttachmentPersistence.revision ||\n attachment.physical.references.length !== 0) {\n throw new Error(\"Artifact attachment ownership or revision is invalid.\");\n }\n const byLogicalHandle = new Map(attachment.physical.contents.map((content) => [content.logicalHandle, content]));\n const bound = new WeakMap<object, PersistedContentMetadata>();\n const used = new Set<string>();\n if (byLogicalHandle.size !== attachment.physical.contents.length)\n throw new Error(\"Duplicate artifact content handle.\");\n const hydrated = hydrateRecordAttachmentCurrent(attemptArtifactsRecordAttachment, attachment.value, {\n content: (token, declaration) => {\n const marker = decodeMarker(token);\n if (Result.isFailure(marker))\n return Result.succeed(undefined);\n const logicalHandle = marker.success[\"$niceeval.record.content\"];\n const metadata = byLogicalHandle.get(logicalHandle);\n if (metadata === undefined || used.has(logicalHandle) || declaration.kind !== \"bytes\" ||\n declaration.maximumBytes !== undefined && metadata.byteLength > declaration.maximumBytes) {\n return Result.fail({ code: \"current-content-bind-failed\" as const });\n }\n const handle = mintRecordContentHandle(\"bytes\");\n bound.set(handle, metadata);\n used.add(logicalHandle);\n return Result.succeed(handle);\n },\n reference: () => Result.succeed(undefined),\n });\n if (Result.isFailure(hydrated) || used.size !== attachment.physical.contents.length) {\n throw new Error(\"Artifact content closure is invalid.\");\n }\n // Validate every descriptor, even when the requested ID is absent.\n for (const artifact of hydrated.success.artifacts) {\n const metadata = bound.get(artifact.content);\n if (metadata === undefined || metadata.byteLength !== artifact.byteLength || metadata.digest !== artifact.sha256) {\n throw new Error(\"Artifact descriptor does not match sealed content metadata.\");\n }\n }\n const artifact = hydrated.success.artifacts.find((item) => item.artifactId === artifactId);\n if (artifact === undefined)\n return Result.succeed(Object.freeze({ state: \"not-found\", artifactId }));\n if (offset > artifact.byteLength)\n return requestInvalid(\"Artifact offset exceeds its byte length.\");\n const bytes = readVerifiedRange(resolved.origin.source, bound.get(artifact.content)!, offset, limit);\n return Result.succeed(Object.freeze({\n state: \"available\",\n artifactId,\n name: artifact.label,\n mediaType: artifact.mediaType,\n byteLength: artifact.byteLength,\n sha256: artifact.sha256,\n offset,\n base64: encodeBase64Bytes(bytes),\n nextOffset: offset + bytes.byteLength < artifact.byteLength ? offset + bytes.byteLength : null,\n }));\n }\n catch (cause) {\n return Result.fail(new InspectionArtifactError({\n code: \"inspection-record-integrity-failure\",\n reason: cause instanceof Error ? cause.message : \"Artifact content validation failed.\",\n }));\n }\n}\n/** Internal fixed-family closure reader. It verifies the whole sealed artifact. */\nexport function readInspectionArtifactBytes(resolved: ResolvedInspectionAttempt, artifactId: string, maximumBytes: number): Result.Result<InspectionArtifactBytes | undefined, InspectionArtifactError> {\n if (Result.isFailure(decodeRequest({ artifactId })))\n return requestInvalid(\"Invalid artifact ID.\");\n try {\n if (encodeAttemptLocator(resolved.attempt.attemptId) !== resolved.locator ||\n resolved.attempt.originRunId !== resolved.origin.run.runId) {\n throw new Error(\"Artifact origin does not match the requested Attempt locator.\");\n }\n const attachments = resolved.origin.attachments.filter(({ physical }) => physical.ownerKind === \"attempt\" && physical.ownerAttemptId === resolved.attempt.attemptId &&\n physical.family === attemptArtifactsRecordAttachment.family);\n if (attachments.length !== 1)\n throw new Error(\"Artifact owner attachment is unavailable.\");\n const attachment = attachments[0]!;\n if (attachment.physical.ownerRunId !== resolved.attempt.originRunId ||\n attachment.physical.familyRevision !== attemptArtifactsRecordAttachmentPersistence.revision ||\n attachment.physical.references.length !== 0) {\n throw new Error(\"Artifact attachment ownership or revision is invalid.\");\n }\n const byLogicalHandle = new Map(attachment.physical.contents.map((content) => [content.logicalHandle, content]));\n const bound = new WeakMap<object, PersistedContentMetadata>();\n const used = new Set<string>();\n if (byLogicalHandle.size !== attachment.physical.contents.length)\n throw new Error(\"Duplicate artifact content handle.\");\n const hydrated = hydrateRecordAttachmentCurrent(attemptArtifactsRecordAttachment, attachment.value, {\n content: (token, declaration) => {\n const marker = decodeMarker(token);\n if (Result.isFailure(marker))\n return Result.succeed(undefined);\n const logicalHandle = marker.success[\"$niceeval.record.content\"];\n const persisted = byLogicalHandle.get(logicalHandle);\n if (persisted === undefined || used.has(logicalHandle) || declaration.kind !== \"bytes\" ||\n declaration.maximumBytes !== undefined && persisted.byteLength > declaration.maximumBytes) {\n return Result.fail({ code: \"current-content-bind-failed\" as const });\n }\n const handle = mintRecordContentHandle(\"bytes\");\n bound.set(handle, persisted);\n used.add(logicalHandle);\n return Result.succeed(handle);\n },\n reference: () => Result.succeed(undefined),\n });\n if (Result.isFailure(hydrated) || used.size !== attachment.physical.contents.length) {\n throw new Error(\"Artifact content closure is invalid.\");\n }\n for (const descriptor of hydrated.success.artifacts) {\n const metadata = bound.get(descriptor.content);\n if (metadata === undefined || metadata.byteLength !== descriptor.byteLength || metadata.digest !== descriptor.sha256) {\n throw new Error(\"Artifact descriptor does not match sealed content metadata.\");\n }\n }\n const artifact = hydrated.success.artifacts.find((entry) => entry.artifactId === artifactId);\n if (artifact === undefined)\n return Result.succeed(undefined);\n const content = bound.get(artifact.content);\n if (content === undefined || content.byteLength !== artifact.byteLength || content.digest !== artifact.sha256 ||\n artifact.byteLength < 0) {\n throw new Error(\"Artifact descriptor does not match sealed content metadata.\");\n }\n if (artifact.byteLength > maximumBytes)\n return requestInvalid(\"Artifact exceeds the evidence parsing budget.\");\n return Result.succeed(Object.freeze({\n artifactId,\n name: artifact.label,\n mediaType: artifact.mediaType,\n byteLength: artifact.byteLength,\n sha256: artifact.sha256,\n bytes: readVerifiedRange(resolved.origin.source, content, 0, artifact.byteLength),\n }));\n }\n catch (cause) {\n return Result.fail(new InspectionArtifactError({\n code: \"inspection-record-integrity-failure\",\n reason: cause instanceof Error ? cause.message : \"Artifact content validation failed.\",\n }));\n }\n}\nfunction requestInvalid(reason: string): Result.Result<never, InspectionArtifactError> {\n return Result.fail(new InspectionArtifactError({ code: \"inspection-request-invalid\", reason }));\n}\nfunction readVerifiedRange(source: InspectionFactSource, metadata: PersistedContentMetadata, offset: number, limit: number): Uint8Array {\n const output = new Uint8Array(Math.min(limit, metadata.byteLength - offset));\n const digest = new InspectionSha256();\n let byteOffset = 0;\n let expectedOrdinal = 0;\n let afterOrdinal = -1;\n while (true) {\n // One bounded storage chunk at a time, including bytes outside the requested range.\n const page = source.readContentPage(metadata.contentId, afterOrdinal, 1);\n if (page.contentId !== metadata.contentId || page.afterOrdinal !== afterOrdinal || page.chunks.length > 1 ||\n page.chunks.length === 0 && page.nextOrdinal !== null)\n throw new Error(\"Artifact content page is invalid.\");\n for (const chunk of page.chunks) {\n if (chunk.ordinal !== expectedOrdinal || expectedOrdinal >= metadata.chunkCount ||\n byteOffset + chunk.bytes.byteLength > metadata.byteLength)\n throw new Error(\"Artifact chunk sequence is invalid.\");\n digest.update(chunk.bytes);\n const start = Math.max(offset, byteOffset);\n const end = Math.min(offset + output.byteLength, byteOffset + chunk.bytes.byteLength);\n if (end > start)\n output.set(chunk.bytes.subarray(start - byteOffset, end - byteOffset), start - offset);\n byteOffset += chunk.bytes.byteLength;\n expectedOrdinal += 1;\n }\n if (page.nextOrdinal === null)\n break;\n if (page.nextOrdinal !== expectedOrdinal - 1 || expectedOrdinal >= metadata.chunkCount) {\n throw new Error(\"Artifact content continuation is invalid.\");\n }\n afterOrdinal = page.nextOrdinal;\n }\n if (byteOffset !== metadata.byteLength || expectedOrdinal !== metadata.chunkCount || digest.digestHex() !== metadata.digest) {\n throw new Error(\"Artifact bytes do not match their sealed digest.\");\n }\n return output;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["artifacts.ts"],"names":[],"mappings":";;;AAsDA,wDA+EC;AAoED,kEAwBC;AAQD,8EAmBC;AA5PD,mCAA8C;AAC9C,8DAA6D;AAC7D,gEAA0E;AAC1E,kEAAkF;AAClF,qDAAkE;AAClE,mEAAsF;AACtF,4EAA4F;AAC5F,8EAAwG;AACxG,0DAA2G;AAE3G,yCAAiE;AAGpD,QAAA,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,EAAE,GAAG,IAAI,EAAE,YAAY,EAAE,GAAG,GAAG,IAAI,EAAE,CAAC,CAAC;AAChG,QAAA,8BAA8B,GAAG,wCAA4B,CAAC;AAC9D,QAAA,6B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AAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACtF,IAAI,GAAG,GAAG,KAAK;gBACX,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,GAAG,UAAU,EAAE,GAAG,GAAG,UAAU,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,CAAC;YAC3F,UAAU,IAAI,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC;YACrC,eAAe,IAAI,CAAC,CAAC;QACzB,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI;YACzB,MAAM;QACV,IAAI,IAAI,CAAC,WAAW,KAAK,eAAe,GAAG,CAAC,IAAI,eAAe,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;YACrF,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QACjE,CAAC;QACD,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC;IACpC,CAAC;IACD,IAAI,UAAU,KAAK,QAAQ,CAAC,UAAU,IAAI,eAAe,KAAK,QAAQ,CAAC,UAAU,IAAI,MAAM,CAAC,SAAS,EAAE,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;QAC1H,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { Data, Result, Schema } from \"effect\";\nimport { encodeAttemptLocator } from \"../attempt-locator.ts\";\nimport { mintRecordContentHandle } from \"../record/attachment/content.ts\";\nimport { hydrateRecordAttachmentCurrent } from \"../record/attachment/protocol.ts\";\nimport { RecordExactParseOptions } from \"../record/codec/core.ts\";\nimport { ArtifactIdSchema, Sha256DigestSchema } from \"../record/codec/identifiers.ts\";\nimport { attemptArtifactsRecordAttachment } from \"../record/family/artifacts/definition.ts\";\nimport { attemptArtifactsRecordAttachmentPersistence } from \"../record/family/artifacts/persistence.ts\";\nimport { MediaTypeSchema, NonNegativeSafeIntegerSchema, SafeTextSchema } from \"../record/family/common.ts\";\nimport type { PersistedContentMetadata } from \"../record/sqlite/types.ts\";\nimport { encodeBase64Bytes, InspectionSha256 } from \"./bytes.ts\";\nimport type { ResolvedInspectionAttempt } from \"./facts.ts\";\nimport type { InspectionFactSource } from \"./source.ts\";\nexport const InspectionArtifactLimits = Object.freeze({ defaultBytes: 64 * 1024, maximumBytes: 256 * 1024 });\nexport const InspectionArtifactOffsetSchema = NonNegativeSafeIntegerSchema;\nexport const InspectionArtifactLimitSchema = NonNegativeSafeIntegerSchema.pipe(Schema.check(Schema.makeFilter((value) => value > 0 && value <= InspectionArtifactLimits.maximumBytes)));\nconst ReadRequestSchema = Schema.Struct({\n artifactId: ArtifactIdSchema,\n offset: Schema.optional(InspectionArtifactOffsetSchema),\n limit: Schema.optional(InspectionArtifactLimitSchema),\n});\nexport type InspectionArtifactRequest = Schema.Schema.Type<typeof ReadRequestSchema>;\nexport const InspectionArtifactResultSchema = Schema.Union([\n Schema.Struct({ state: Schema.Literal(\"not-found\"), artifactId: ArtifactIdSchema }),\n Schema.Struct({\n state: Schema.Literal(\"available\"),\n artifactId: ArtifactIdSchema,\n name: Schema.toType(SafeTextSchema),\n mediaType: Schema.toType(MediaTypeSchema),\n byteLength: NonNegativeSafeIntegerSchema,\n sha256: Sha256DigestSchema,\n offset: InspectionArtifactOffsetSchema,\n base64: Schema.String.pipe(Schema.check(Schema.makeFilter((value) => value.length <= Math.ceil(InspectionArtifactLimits.maximumBytes / 3) * 4 &&\n value.length % 4 === 0 && /^[A-Za-z0-9+/]*={0,2}$/.test(value)))),\n nextOffset: Schema.NullOr(InspectionArtifactOffsetSchema),\n }),\n]);\nexport type InspectionArtifactResult = Schema.Schema.Type<typeof InspectionArtifactResultSchema>;\nexport interface InspectionArtifactBytes {\n readonly artifactId: string;\n readonly name: string;\n readonly mediaType: string;\n readonly byteLength: number;\n readonly sha256: string;\n readonly bytes: Uint8Array;\n}\nexport class InspectionArtifactError extends Data.TaggedError(\"InspectionArtifactError\")<{\n readonly code: \"inspection-request-invalid\" | \"inspection-record-integrity-failure\";\n readonly reason: string;\n}> {\n}\nconst decodeRequest = Schema.decodeUnknownResult(ReadRequestSchema, RecordExactParseOptions);\nconst decodeMarker = Schema.decodeUnknownResult(Schema.Struct({ \"$niceeval.record.content\": Schema.String }), RecordExactParseOptions);\n/** Reads the exact origin's sealed bytes; only the requested range is retained in memory. */\nexport function projectAttemptArtifact(resolved: ResolvedInspectionAttempt, request: InspectionArtifactRequest): Result.Result<InspectionArtifactResult, InspectionArtifactError> {\n const decoded = decodeRequest(request);\n if (Result.isFailure(decoded))\n return requestInvalid(\"Invalid artifact ID, offset, or limit.\");\n const { artifactId, offset = 0, limit = InspectionArtifactLimits.defaultBytes } = decoded.success;\n try {\n if (encodeAttemptLocator(resolved.attempt.attemptId) !== resolved.locator ||\n resolved.attempt.originRunId !== resolved.origin.run.runId) {\n throw new Error(\"Artifact origin does not match the requested Attempt locator.\");\n }\n const attachments = resolved.origin.attachments.filter(({ physical }) => physical.ownerKind === \"attempt\" && physical.ownerAttemptId === resolved.attempt.attemptId &&\n physical.family === attemptArtifactsRecordAttachment.family);\n if (attachments.length === 0)\n return Result.succeed(Object.freeze({ state: \"not-found\", artifactId }));\n if (attachments.length !== 1)\n throw new Error(\"Artifact owner has duplicate attachments.\");\n const attachment = attachments[0]!;\n if (attachment.physical.ownerRunId !== resolved.attempt.originRunId ||\n attachment.physical.familyRevision !== attemptArtifactsRecordAttachmentPersistence.revision ||\n attachment.physical.references.length !== 0) {\n throw new Error(\"Artifact attachment ownership or revision is invalid.\");\n }\n const byLogicalHandle = new Map(attachment.physical.contents.map((content) => [content.logicalHandle, content]));\n const bound = new WeakMap<object, PersistedContentMetadata>();\n const used = new Set<string>();\n if (byLogicalHandle.size !== attachment.physical.contents.length)\n throw new Error(\"Duplicate artifact content handle.\");\n const hydrated = hydrateRecordAttachmentCurrent(attemptArtifactsRecordAttachment, attachment.value, {\n content: (token, declaration) => {\n const marker = decodeMarker(token);\n if (Result.isFailure(marker))\n return Result.succeed(undefined);\n const logicalHandle = marker.success[\"$niceeval.record.content\"];\n const metadata = byLogicalHandle.get(logicalHandle);\n if (metadata === undefined || used.has(logicalHandle) || declaration.kind !== \"bytes\" ||\n declaration.maximumBytes !== undefined && metadata.byteLength > declaration.maximumBytes) {\n return Result.fail({ code: \"current-content-bind-failed\" as const });\n }\n const handle = mintRecordContentHandle(\"bytes\");\n bound.set(handle, metadata);\n used.add(logicalHandle);\n return Result.succeed(handle);\n },\n reference: () => Result.succeed(undefined),\n });\n if (Result.isFailure(hydrated) || used.size !== attachment.physical.contents.length) {\n throw new Error(\"Artifact content closure is invalid.\");\n }\n // Validate every descriptor, even when the requested ID is absent.\n for (const artifact of hydrated.success.artifacts) {\n const metadata = bound.get(artifact.content);\n if (metadata === undefined || metadata.byteLength !== artifact.byteLength || metadata.digest !== artifact.sha256) {\n throw new Error(\"Artifact descriptor does not match sealed content metadata.\");\n }\n }\n const artifact = hydrated.success.artifacts.find((item) => item.artifactId === artifactId);\n if (artifact === undefined)\n return Result.succeed(Object.freeze({ state: \"not-found\", artifactId }));\n if (offset > artifact.byteLength)\n return requestInvalid(\"Artifact offset exceeds its byte length.\");\n const bytes = readVerifiedRange(resolved.origin.source, bound.get(artifact.content)!, offset, limit);\n return Result.succeed(Object.freeze({\n state: \"available\",\n artifactId,\n name: artifact.label,\n mediaType: artifact.mediaType,\n byteLength: artifact.byteLength,\n sha256: artifact.sha256,\n offset,\n base64: encodeBase64Bytes(bytes),\n nextOffset: offset + bytes.byteLength < artifact.byteLength ? offset + bytes.byteLength : null,\n }));\n }\n catch (cause) {\n return Result.fail(new InspectionArtifactError({\n code: \"inspection-record-integrity-failure\",\n reason: cause instanceof Error ? cause.message : \"Artifact content validation failed.\",\n }));\n }\n}\ninterface HydratedArtifactDescriptor {\n readonly artifactId: string;\n readonly name: string;\n readonly mediaType: string;\n readonly byteLength: number;\n readonly sha256: string;\n readonly content: PersistedContentMetadata;\n}\n/** Hydrates and verifies every sealed artifact descriptor of the exact origin Attempt. */\nfunction hydrateArtifactDescriptors(resolved: ResolvedInspectionAttempt): readonly HydratedArtifactDescriptor[] {\n if (encodeAttemptLocator(resolved.attempt.attemptId) !== resolved.locator ||\n resolved.attempt.originRunId !== resolved.origin.run.runId) {\n throw new Error(\"Artifact origin does not match the requested Attempt locator.\");\n }\n const attachments = resolved.origin.attachments.filter(({ physical }) => physical.ownerKind === \"attempt\" && physical.ownerAttemptId === resolved.attempt.attemptId &&\n physical.family === attemptArtifactsRecordAttachment.family);\n if (attachments.length !== 1)\n throw new Error(\"Artifact owner attachment is unavailable.\");\n const attachment = attachments[0]!;\n if (attachment.physical.ownerRunId !== resolved.attempt.originRunId ||\n attachment.physical.familyRevision !== attemptArtifactsRecordAttachmentPersistence.revision ||\n attachment.physical.references.length !== 0) {\n throw new Error(\"Artifact attachment ownership or revision is invalid.\");\n }\n const byLogicalHandle = new Map(attachment.physical.contents.map((content) => [content.logicalHandle, content]));\n const bound = new WeakMap<object, PersistedContentMetadata>();\n const used = new Set<string>();\n if (byLogicalHandle.size !== attachment.physical.contents.length)\n throw new Error(\"Duplicate artifact content handle.\");\n const hydrated = hydrateRecordAttachmentCurrent(attemptArtifactsRecordAttachment, attachment.value, {\n content: (token, declaration) => {\n const marker = decodeMarker(token);\n if (Result.isFailure(marker))\n return Result.succeed(undefined);\n const logicalHandle = marker.success[\"$niceeval.record.content\"];\n const persisted = byLogicalHandle.get(logicalHandle);\n if (persisted === undefined || used.has(logicalHandle) || declaration.kind !== \"bytes\" ||\n declaration.maximumBytes !== undefined && persisted.byteLength > declaration.maximumBytes) {\n return Result.fail({ code: \"current-content-bind-failed\" as const });\n }\n const handle = mintRecordContentHandle(\"bytes\");\n bound.set(handle, persisted);\n used.add(logicalHandle);\n return Result.succeed(handle);\n },\n reference: () => Result.succeed(undefined),\n });\n if (Result.isFailure(hydrated) || used.size !== attachment.physical.contents.length) {\n throw new Error(\"Artifact content closure is invalid.\");\n }\n return Object.freeze(hydrated.success.artifacts.map((descriptor) => {\n const metadata = bound.get(descriptor.content);\n if (metadata === undefined || metadata.byteLength !== descriptor.byteLength || metadata.digest !== descriptor.sha256 ||\n descriptor.byteLength < 0) {\n throw new Error(\"Artifact descriptor does not match sealed content metadata.\");\n }\n return Object.freeze({\n artifactId: descriptor.artifactId,\n name: descriptor.label,\n mediaType: descriptor.mediaType,\n byteLength: descriptor.byteLength,\n sha256: descriptor.sha256,\n content: metadata,\n });\n }));\n}\n/** Internal fixed-family closure reader. It verifies the whole sealed artifact. */\nexport function readInspectionArtifactBytes(resolved: ResolvedInspectionAttempt, artifactId: string, maximumBytes: number): Result.Result<InspectionArtifactBytes | undefined, InspectionArtifactError> {\n if (Result.isFailure(decodeRequest({ artifactId })))\n return requestInvalid(\"Invalid artifact ID.\");\n try {\n const artifact = hydrateArtifactDescriptors(resolved).find((entry) => entry.artifactId === artifactId);\n if (artifact === undefined)\n return Result.succeed(undefined);\n if (artifact.byteLength > maximumBytes)\n return requestInvalid(\"Artifact exceeds the evidence parsing budget.\");\n return Result.succeed(Object.freeze({\n artifactId,\n name: artifact.name,\n mediaType: artifact.mediaType,\n byteLength: artifact.byteLength,\n sha256: artifact.sha256,\n bytes: readVerifiedRange(resolved.origin.source, artifact.content, 0, artifact.byteLength),\n }));\n }\n catch (cause) {\n return Result.fail(new InspectionArtifactError({\n code: \"inspection-record-integrity-failure\",\n reason: cause instanceof Error ? cause.message : \"Artifact content validation failed.\",\n }));\n }\n}\nexport interface InspectionArtifactDescriptor {\n readonly artifactId: string;\n readonly mediaType: string;\n readonly byteLength: number;\n readonly sha256: string;\n}\n/** Descriptor-only closure reader for references that must not load bytes, such as display images. */\nexport function readInspectionArtifactDescriptors(resolved: ResolvedInspectionAttempt): Result.Result<ReadonlyMap<string, InspectionArtifactDescriptor>, InspectionArtifactError> {\n try {\n const hasArtifacts = resolved.origin.attachments.some(({ physical }) => physical.ownerKind === \"attempt\" && physical.ownerAttemptId === resolved.attempt.attemptId &&\n physical.family === attemptArtifactsRecordAttachment.family);\n if (!hasArtifacts)\n return Result.succeed(new Map());\n return Result.succeed(new Map(hydrateArtifactDescriptors(resolved).map((artifact) => [artifact.artifactId, Object.freeze({\n artifactId: artifact.artifactId,\n mediaType: artifact.mediaType,\n byteLength: artifact.byteLength,\n sha256: artifact.sha256,\n })] as const)));\n }\n catch (cause) {\n return Result.fail(new InspectionArtifactError({\n code: \"inspection-record-integrity-failure\",\n reason: cause instanceof Error ? cause.message : \"Artifact content validation failed.\",\n }));\n }\n}\nfunction requestInvalid(reason: string): Result.Result<never, InspectionArtifactError> {\n return Result.fail(new InspectionArtifactError({ code: \"inspection-request-invalid\", reason }));\n}\nfunction readVerifiedRange(source: InspectionFactSource, metadata: PersistedContentMetadata, offset: number, limit: number): Uint8Array {\n const output = new Uint8Array(Math.min(limit, metadata.byteLength - offset));\n const digest = new InspectionSha256();\n let byteOffset = 0;\n let expectedOrdinal = 0;\n let afterOrdinal = -1;\n while (true) {\n // One bounded storage chunk at a time, including bytes outside the requested range.\n const page = source.readContentPage(metadata.contentId, afterOrdinal, 1);\n if (page.contentId !== metadata.contentId || page.afterOrdinal !== afterOrdinal || page.chunks.length > 1 ||\n page.chunks.length === 0 && page.nextOrdinal !== null)\n throw new Error(\"Artifact content page is invalid.\");\n for (const chunk of page.chunks) {\n if (chunk.ordinal !== expectedOrdinal || expectedOrdinal >= metadata.chunkCount ||\n byteOffset + chunk.bytes.byteLength > metadata.byteLength)\n throw new Error(\"Artifact chunk sequence is invalid.\");\n digest.update(chunk.bytes);\n const start = Math.max(offset, byteOffset);\n const end = Math.min(offset + output.byteLength, byteOffset + chunk.bytes.byteLength);\n if (end > start)\n output.set(chunk.bytes.subarray(start - byteOffset, end - byteOffset), start - offset);\n byteOffset += chunk.bytes.byteLength;\n expectedOrdinal += 1;\n }\n if (page.nextOrdinal === null)\n break;\n if (page.nextOrdinal !== expectedOrdinal - 1 || expectedOrdinal >= metadata.chunkCount) {\n throw new Error(\"Artifact content continuation is invalid.\");\n }\n afterOrdinal = page.nextOrdinal;\n }\n if (byteOffset !== metadata.byteLength || expectedOrdinal !== metadata.chunkCount || digest.digestHex() !== metadata.digest) {\n throw new Error(\"Artifact bytes do not match their sealed digest.\");\n }\n return output;\n}\n"]}
|
|
@@ -47,4 +47,12 @@ export declare class InspectionArtifactError extends InspectionArtifactError_bas
|
|
|
47
47
|
export declare function projectAttemptArtifact(resolved: ResolvedInspectionAttempt, request: InspectionArtifactRequest): Result.Result<InspectionArtifactResult, InspectionArtifactError>;
|
|
48
48
|
/** Internal fixed-family closure reader. It verifies the whole sealed artifact. */
|
|
49
49
|
export declare function readInspectionArtifactBytes(resolved: ResolvedInspectionAttempt, artifactId: string, maximumBytes: number): Result.Result<InspectionArtifactBytes | undefined, InspectionArtifactError>;
|
|
50
|
+
export interface InspectionArtifactDescriptor {
|
|
51
|
+
readonly artifactId: string;
|
|
52
|
+
readonly mediaType: string;
|
|
53
|
+
readonly byteLength: number;
|
|
54
|
+
readonly sha256: string;
|
|
55
|
+
}
|
|
56
|
+
/** Descriptor-only closure reader for references that must not load bytes, such as display images. */
|
|
57
|
+
export declare function readInspectionArtifactDescriptors(resolved: ResolvedInspectionAttempt): Result.Result<ReadonlyMap<string, InspectionArtifactDescriptor>, InspectionArtifactError>;
|
|
50
58
|
export {};
|
|
@@ -47,4 +47,12 @@ export declare class InspectionArtifactError extends InspectionArtifactError_bas
|
|
|
47
47
|
export declare function projectAttemptArtifact(resolved: ResolvedInspectionAttempt, request: InspectionArtifactRequest): Result.Result<InspectionArtifactResult, InspectionArtifactError>;
|
|
48
48
|
/** Internal fixed-family closure reader. It verifies the whole sealed artifact. */
|
|
49
49
|
export declare function readInspectionArtifactBytes(resolved: ResolvedInspectionAttempt, artifactId: string, maximumBytes: number): Result.Result<InspectionArtifactBytes | undefined, InspectionArtifactError>;
|
|
50
|
+
export interface InspectionArtifactDescriptor {
|
|
51
|
+
readonly artifactId: string;
|
|
52
|
+
readonly mediaType: string;
|
|
53
|
+
readonly byteLength: number;
|
|
54
|
+
readonly sha256: string;
|
|
55
|
+
}
|
|
56
|
+
/** Descriptor-only closure reader for references that must not load bytes, such as display images. */
|
|
57
|
+
export declare function readInspectionArtifactDescriptors(resolved: ResolvedInspectionAttempt): Result.Result<ReadonlyMap<string, InspectionArtifactDescriptor>, InspectionArtifactError>;
|
|
50
58
|
export {};
|
|
@@ -47,4 +47,12 @@ export declare class InspectionArtifactError extends InspectionArtifactError_bas
|
|
|
47
47
|
export declare function projectAttemptArtifact(resolved: ResolvedInspectionAttempt, request: InspectionArtifactRequest): Result.Result<InspectionArtifactResult, InspectionArtifactError>;
|
|
48
48
|
/** Internal fixed-family closure reader. It verifies the whole sealed artifact. */
|
|
49
49
|
export declare function readInspectionArtifactBytes(resolved: ResolvedInspectionAttempt, artifactId: string, maximumBytes: number): Result.Result<InspectionArtifactBytes | undefined, InspectionArtifactError>;
|
|
50
|
+
export interface InspectionArtifactDescriptor {
|
|
51
|
+
readonly artifactId: string;
|
|
52
|
+
readonly mediaType: string;
|
|
53
|
+
readonly byteLength: number;
|
|
54
|
+
readonly sha256: string;
|
|
55
|
+
}
|
|
56
|
+
/** Descriptor-only closure reader for references that must not load bytes, such as display images. */
|
|
57
|
+
export declare function readInspectionArtifactDescriptors(resolved: ResolvedInspectionAttempt): Result.Result<ReadonlyMap<string, InspectionArtifactDescriptor>, InspectionArtifactError>;
|
|
50
58
|
export {};
|
|
@@ -15,4 +15,6 @@ const __niceevalExport5 = __niceevalCanonical["projectAttemptArtifact"];
|
|
|
15
15
|
export { __niceevalExport5 as projectAttemptArtifact };
|
|
16
16
|
const __niceevalExport6 = __niceevalCanonical["readInspectionArtifactBytes"];
|
|
17
17
|
export { __niceevalExport6 as readInspectionArtifactBytes };
|
|
18
|
+
const __niceevalExport7 = __niceevalCanonical["readInspectionArtifactDescriptors"];
|
|
19
|
+
export { __niceevalExport7 as readInspectionArtifactDescriptors };
|
|
18
20
|
//# sourceMappingURL=artifacts.js.map
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.projectAttemptAssertionIndex = projectAttemptAssertionIndex;
|
|
4
4
|
exports.projectAttemptAssertionDetail = projectAttemptAssertionDetail;
|
|
5
5
|
exports.projectAttemptAssertionImage = projectAttemptAssertionImage;
|
|
6
|
+
// @concord-file ne-eval-inspection-assertion-projection
|
|
7
|
+
// @concord-implements docs/feature/inspection/README.md
|
|
8
|
+
// @concord-implements docs/feature/assertions/README.md
|
|
6
9
|
const effect_1 = require("effect");
|
|
7
10
|
const content_ts_1 = require("../record/attachment/content.cjs");
|
|
8
11
|
const derive_ts_1 = require("../o11y/derive.cjs");
|
|
@@ -58,7 +61,7 @@ function projectAttemptAssertionDetail(source, input, agentTurns, entryId) {
|
|
|
58
61
|
check: projectCheck(entry),
|
|
59
62
|
matcher: projectMatcher(entry, agentTurns),
|
|
60
63
|
}));
|
|
61
|
-
if (jsonByteLength(result) > limits_ts_1.
|
|
64
|
+
if (jsonByteLength(result) > limits_ts_1.INSPECTION_ASSERTION_DETAIL_BYTE_LIMIT) {
|
|
62
65
|
throw new Error("Assertion detail exceeds its fixed result byte limit");
|
|
63
66
|
}
|
|
64
67
|
return decodeAssertionDetail(result);
|