niceeval 0.9.1 → 0.10.0
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 +31 -33
- package/dist/agents/types.d.ts +20 -17
- package/dist/context/types.d.ts +21 -21
- package/dist/i18n/en.d.ts +10 -2
- package/dist/i18n/zh-CN.d.ts +14 -6
- package/dist/o11y/execution-tree.d.ts +103 -0
- package/dist/o11y/otlp/select.d.ts +22 -0
- package/dist/report/{react → assets}/colors.d.ts +8 -0
- package/dist/report/{react → assets}/colors.js +23 -0
- package/dist/report/built-in/index.d.ts +2 -2
- package/dist/report/built-in/index.js +2 -2
- package/dist/report/built-in/standard.d.ts +8 -1
- package/dist/report/built-in/standard.js +17 -7
- package/dist/report/components/attempt-detail/AttemptAssertions.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptAssertions.js +17 -0
- package/dist/report/components/attempt-detail/AttemptConversation.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptConversation.js +34 -0
- package/dist/report/components/attempt-detail/AttemptDiagnostics.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptDiagnostics.js +7 -0
- package/dist/report/components/attempt-detail/AttemptDiff.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptDiff.js +11 -0
- package/dist/report/components/attempt-detail/AttemptError.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptError.js +16 -0
- package/dist/report/components/attempt-detail/AttemptFixPrompt.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptFixPrompt.js +7 -0
- package/dist/report/components/attempt-detail/AttemptSource.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptSource.js +27 -0
- package/dist/report/components/attempt-detail/AttemptSummary.d.ts +8 -0
- package/dist/report/components/attempt-detail/AttemptSummary.js +20 -0
- package/dist/report/components/attempt-detail/AttemptTimeline.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptTimeline.js +28 -0
- package/dist/report/components/attempt-detail/AttemptTrace.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptTrace.js +29 -0
- package/dist/report/components/attempt-detail/AttemptUsage.d.ts +6 -0
- package/dist/report/components/attempt-detail/AttemptUsage.js +20 -0
- package/dist/report/components/attempt-detail/compute.d.ts +24 -0
- package/dist/report/components/attempt-detail/compute.js +254 -0
- package/dist/report/components/attempt-detail/faces.d.ts +14 -0
- package/dist/report/components/attempt-detail/faces.js +235 -0
- package/dist/report/components/attempt-detail/index.d.ts +38 -0
- package/dist/report/components/attempt-detail/index.js +527 -0
- package/dist/report/{react → components}/cell.d.ts +5 -3
- package/dist/report/{react → components}/cell.js +3 -3
- package/dist/report/{react → components/entity-lists}/AttemptList.d.ts +8 -4
- package/dist/report/{react → components/entity-lists}/AttemptList.js +16 -10
- package/dist/report/{react → components/entity-lists}/EvalList.d.ts +3 -3
- package/dist/report/{react → components/entity-lists}/EvalList.js +0 -0
- package/dist/report/{react → components/entity-lists}/ExperimentList.d.ts +3 -3
- package/dist/report/{react → components/entity-lists}/ExperimentList.js +10 -10
- package/dist/report/components/entity-lists/compute.d.ts +23 -0
- package/dist/report/components/entity-lists/compute.js +171 -0
- package/dist/report/components/entity-lists/faces.d.ts +5 -0
- package/dist/report/components/entity-lists/faces.js +174 -0
- package/dist/report/components/entity-lists/index.d.ts +51 -0
- package/dist/report/components/entity-lists/index.js +165 -0
- package/dist/report/{react → components}/fixtures.d.ts +2 -2
- package/dist/report/{react → components}/fixtures.js +1 -1
- package/dist/report/{react → components/metric-views}/DeltaTable.d.ts +2 -2
- package/dist/report/{react → components/metric-views}/DeltaTable.js +4 -4
- package/dist/report/{react → components/metric-views}/MetricBars.d.ts +3 -3
- package/dist/report/{react → components/metric-views}/MetricBars.js +3 -3
- package/dist/report/{react → components/metric-views}/MetricLine.d.ts +2 -2
- package/dist/report/{react → components/metric-views}/MetricLine.js +8 -5
- package/dist/report/{react → components/metric-views}/MetricMatrix.d.ts +3 -3
- package/dist/report/{react → components/metric-views}/MetricMatrix.js +4 -4
- package/dist/report/components/metric-views/MetricScatter.d.ts +11 -0
- package/dist/report/{react → components/metric-views}/MetricScatter.js +26 -23
- package/dist/report/{react → components/metric-views}/MetricTable.d.ts +3 -3
- package/dist/report/{react → components/metric-views}/MetricTable.js +4 -4
- package/dist/report/{react → components/metric-views}/Scoreboard.d.ts +2 -2
- package/dist/report/{react → components/metric-views}/Scoreboard.js +3 -3
- package/dist/report/components/metric-views/compute.d.ts +89 -0
- package/dist/report/{compute.js → components/metric-views/compute.js} +32 -415
- package/dist/report/components/metric-views/faces.d.ts +13 -0
- package/dist/report/components/metric-views/faces.js +381 -0
- package/dist/report/components/metric-views/index.d.ts +50 -0
- package/dist/report/components/metric-views/index.js +273 -0
- package/dist/report/{text → components/metric-views}/plot.js +1 -1
- package/dist/report/components/shared-compute.d.ts +22 -0
- package/dist/report/components/shared-compute.js +47 -0
- package/dist/report/components/shared-faces.d.ts +9 -0
- package/dist/report/components/shared-faces.js +26 -0
- package/dist/report/components/shared.d.ts +68 -0
- package/dist/report/components/shared.js +125 -0
- package/dist/report/{react → components/site-components}/CopyFixPrompt.d.ts +2 -2
- package/dist/report/{react → components/site-components}/CopyFixPrompt.js +2 -2
- package/dist/report/{react → components/site-components}/HeroCard.d.ts +2 -2
- package/dist/report/{react → components/site-components}/HeroCard.js +2 -2
- package/dist/report/{react → components/site-components}/ScopeWarnings.d.ts +2 -2
- package/dist/report/{react → components/site-components}/ScopeWarnings.js +3 -3
- package/dist/report/{react → components/site-components}/TraceWaterfall.d.ts +3 -3
- package/dist/report/{react → components/site-components}/TraceWaterfall.js +5 -5
- package/dist/report/components/site-components/compute.d.ts +28 -0
- package/dist/report/components/site-components/compute.js +132 -0
- package/dist/report/components/site-components/faces.d.ts +21 -0
- package/dist/report/components/site-components/faces.js +75 -0
- package/dist/report/components/site-components/index.d.ts +74 -0
- package/dist/report/components/site-components/index.js +220 -0
- package/dist/report/{scope-warnings.d.ts → components/site-components/scope-warnings.d.ts} +2 -2
- package/dist/report/{scope-warnings.js → components/site-components/scope-warnings.js} +2 -2
- package/dist/report/{react → components/summaries}/ScopeSummary.d.ts +2 -2
- package/dist/report/{react → components/summaries}/ScopeSummary.js +17 -8
- package/dist/report/components/summaries/compute.d.ts +7 -0
- package/dist/report/components/summaries/compute.js +51 -0
- package/dist/report/components/summaries/faces.d.ts +7 -0
- package/dist/report/components/summaries/faces.js +38 -0
- package/dist/report/components/summaries/index.d.ts +27 -0
- package/dist/report/components/summaries/index.js +78 -0
- package/dist/report/definition/grid-layout.d.ts +50 -0
- package/dist/report/definition/grid-layout.js +89 -0
- package/dist/report/{primitives.d.ts → definition/primitives.d.ts} +34 -4
- package/dist/report/{primitives.js → definition/primitives.js} +101 -10
- package/dist/report/{report.d.ts → definition/report.d.ts} +36 -65
- package/dist/report/{report.js → definition/report.js} +58 -90
- package/dist/report/{text/table.d.ts → definition/table-text.d.ts} +2 -2
- package/dist/report/{text/table.js → definition/table-text.js} +2 -2
- package/dist/report/{tree.d.ts → definition/tree.d.ts} +43 -11
- package/dist/report/{tree.js → definition/tree.js} +9 -11
- package/dist/report/index.d.ts +33 -18
- package/dist/report/index.js +23 -14
- package/dist/report/{aggregate.d.ts → model/aggregate.d.ts} +12 -4
- package/dist/report/{aggregate.js → model/aggregate.js} +28 -8
- package/dist/report/{flag.d.ts → model/flag.d.ts} +14 -1
- package/dist/report/{flag.js → model/flag.js} +35 -0
- package/dist/report/{format.d.ts → model/format.d.ts} +11 -5
- package/dist/report/{format.js → model/format.js} +48 -4
- package/dist/report/{locale.d.ts → model/locale.d.ts} +17 -17
- package/dist/report/{locale.js → model/locale.js} +31 -33
- package/dist/report/{metrics.d.ts → model/metrics.d.ts} +2 -2
- package/dist/report/{metrics.js → model/metrics.js} +2 -2
- package/dist/report/{types.d.ts → model/types.d.ts} +140 -20
- package/dist/report/react/index.d.ts +32 -21
- package/dist/report/react/index.js +33 -21
- package/dist/report/{load.d.ts → runtime/load.d.ts} +1 -1
- package/dist/report/{load.js → runtime/load.js} +1 -1
- package/dist/report/runtime/text.d.ts +67 -0
- package/dist/report/runtime/text.js +114 -0
- package/dist/report/runtime/web.d.ts +35 -0
- package/dist/report/runtime/web.js +70 -0
- package/dist/results/annotated-source.d.ts +87 -0
- package/dist/results/attempt-evidence.d.ts +74 -0
- package/dist/results/attempt-source.d.ts +15 -0
- package/dist/results/select.d.ts +11 -1
- package/dist/results/select.js +27 -5
- package/dist/runner/eval-selection.d.ts +26 -0
- package/dist/runner/feedback/sink.d.ts +26 -1
- package/dist/runner/types.d.ts +149 -23
- package/dist/sandbox/docker.d.ts +6 -0
- package/dist/sandbox/types.d.ts +23 -21
- package/dist/scoring/display.d.ts +7 -2
- package/dist/scoring/display.js +42 -4
- package/dist/scoring/types.d.ts +3 -3
- package/dist/shared/aggregate.d.ts +14 -0
- package/dist/shared/aggregate.js +31 -0
- package/dist/shared/types.d.ts +6 -1
- package/docs-site/images/logo-dark.svg +7 -0
- package/docs-site/images/logo.svg +6 -5
- package/docs-site/zh/README.md +8 -7
- package/docs-site/zh/examples/ai-agent-application.mdx +5 -5
- package/docs-site/zh/examples/coding-agent-extensions.mdx +4 -4
- package/docs-site/zh/examples/index.mdx +3 -3
- package/docs-site/zh/examples/integrations/ai-sdk-v7.mdx +1 -1
- package/docs-site/zh/examples/integrations/claude-sdk.mdx +3 -3
- package/docs-site/zh/examples/integrations/codex-sdk.mdx +3 -3
- package/docs-site/zh/examples/integrations/langgraph.mdx +3 -3
- package/docs-site/zh/examples/integrations/pi-sdk.mdx +2 -2
- package/docs-site/zh/explanation/adapter.mdx +19 -19
- package/docs-site/zh/explanation/assert.mdx +9 -9
- package/docs-site/zh/explanation/drive.mdx +4 -4
- package/docs-site/zh/explanation/evals.mdx +8 -8
- package/docs-site/zh/explanation/experiment.mdx +8 -8
- package/docs-site/zh/explanation/hitl.mdx +13 -13
- package/docs-site/zh/explanation/judge.mdx +3 -3
- package/docs-site/zh/explanation/overview.mdx +7 -7
- package/docs-site/zh/explanation/runner.mdx +11 -11
- package/docs-site/zh/explanation/tier.mdx +6 -6
- package/docs-site/zh/index.mdx +14 -14
- package/docs-site/zh/introduction.mdx +13 -16
- package/docs-site/zh/reference/builtin-agents.mdx +61 -28
- package/docs-site/zh/reference/capabilities.mdx +7 -27
- package/docs-site/zh/reference/cli.mdx +35 -32
- package/docs-site/zh/reference/define-agent.mdx +32 -31
- package/docs-site/zh/reference/define-config.mdx +6 -6
- package/docs-site/zh/reference/define-eval.mdx +33 -20
- package/docs-site/zh/reference/events.mdx +4 -4
- package/docs-site/zh/reference/expect.mdx +3 -3
- package/docs-site/zh/reference/official-adapters.mdx +17 -17
- package/docs-site/zh/reference/report-components.mdx +193 -121
- package/docs-site/zh/reference/results-data.mdx +13 -13
- package/docs-site/zh/troubleshooting/debug-sandbox.mdx +11 -11
- package/docs-site/zh/troubleshooting/debugging.mdx +40 -16
- package/docs-site/zh/{how-to → tutorials}/agent-feedback-loop.mdx +38 -38
- package/docs-site/zh/tutorials/agent-onboarding.mdx +100 -0
- package/docs-site/zh/tutorials/authoring.mdx +211 -0
- package/docs-site/zh/{how-to → tutorials}/ci-integration.mdx +8 -8
- package/docs-site/zh/{how-to → tutorials}/connect-otel.mdx +22 -22
- package/docs-site/zh/{how-to → tutorials}/connect-your-agent.mdx +58 -63
- package/docs-site/zh/tutorials/custom-reports.mdx +453 -0
- package/docs-site/zh/{how-to → tutorials}/dataset-fanout.mdx +4 -4
- package/docs-site/zh/tutorials/experiments.mdx +103 -0
- package/docs-site/zh/{how-to → tutorials}/fixtures.mdx +9 -9
- package/docs-site/zh/{how-to → tutorials}/publish-report.mdx +6 -6
- package/docs-site/zh/tutorials/quickstart.mdx +18 -18
- package/docs-site/zh/{how-to → tutorials}/reporters.mdx +6 -6
- package/docs-site/zh/{how-to → tutorials}/sandbox-agent.mdx +6 -6
- package/docs-site/zh/{how-to → tutorials}/sandbox-providers.mdx +41 -19
- package/docs-site/zh/{how-to → tutorials}/scoring-guide.mdx +4 -4
- package/docs-site/zh/{how-to → tutorials}/viewing-results.mdx +49 -49
- package/docs-site/zh/tutorials/write-experiment.mdx +355 -0
- package/docs-site/zh/{how-to → tutorials}/write-send.mdx +40 -40
- package/package.json +8 -4
- package/src/agents/bub.ts +21 -8
- package/src/agents/claude-code.ts +23 -10
- package/src/agents/codex.test.ts +22 -7
- package/src/agents/codex.ts +22 -9
- package/src/agents/index.ts +2 -2
- package/src/agents/openai-compat.ts +1 -1
- package/src/agents/post-setup.ts +45 -22
- package/src/agents/streaming.ts +1 -1
- package/src/agents/types.ts +20 -17
- package/src/agents/ui-message-stream.test.ts +10 -0
- package/src/agents/ui-message-stream.ts +12 -1
- package/src/cli.ts +71 -57
- package/src/context/types.ts +21 -21
- package/src/define.ts +13 -0
- package/src/i18n/en.ts +27 -12
- package/src/i18n/zh-CN.ts +27 -12
- package/src/index.ts +2 -0
- package/src/report/{react → assets}/colors.ts +22 -0
- package/src/report/{react → assets}/enhance.js +1 -33
- package/src/report/{react → assets}/styles.css +124 -106
- package/src/report/built-in/index.tsx +2 -2
- package/src/report/built-in/standard.tsx +18 -6
- package/src/report/components/attempt-detail/AttemptAssertions.tsx +67 -0
- package/src/report/components/attempt-detail/AttemptConversation.tsx +110 -0
- package/src/report/components/attempt-detail/AttemptDiagnostics.tsx +38 -0
- package/src/report/components/attempt-detail/AttemptDiff.tsx +35 -0
- package/src/report/components/attempt-detail/AttemptError.tsx +31 -0
- package/src/report/components/attempt-detail/AttemptFixPrompt.tsx +26 -0
- package/src/report/components/attempt-detail/AttemptSource.tsx +80 -0
- package/src/report/components/attempt-detail/AttemptSummary.tsx +74 -0
- package/src/report/components/attempt-detail/AttemptTimeline.tsx +108 -0
- package/src/report/components/attempt-detail/AttemptTrace.tsx +63 -0
- package/src/report/components/attempt-detail/AttemptUsage.tsx +29 -0
- package/src/report/components/attempt-detail/attempt-components.test.tsx +680 -0
- package/src/report/components/attempt-detail/compute.ts +287 -0
- package/src/report/components/attempt-detail/faces.ts +257 -0
- package/src/report/components/attempt-detail/index.tsx +583 -0
- package/src/report/components/attempt-detail/validate.test.ts +235 -0
- package/src/report/{react → components}/cell.tsx +6 -3
- package/src/report/{report.test.ts → components/compute.test.ts} +316 -46
- package/src/report/{react → components/entity-lists}/AttemptList.tsx +24 -16
- package/src/report/{react → components/entity-lists}/EvalList.tsx +0 -0
- package/src/report/{react → components/entity-lists}/ExperimentList.tsx +23 -20
- package/src/report/components/entity-lists/compute.ts +196 -0
- package/src/report/components/entity-lists/faces.ts +207 -0
- package/src/report/components/entity-lists/index.tsx +241 -0
- package/src/report/components/entity-lists/validate.test.ts +114 -0
- package/src/report/{react → components}/fixtures.ts +2 -2
- package/src/report/{react → components/metric-views}/DeltaTable.tsx +5 -5
- package/src/report/{react → components/metric-views}/MetricBars.tsx +5 -5
- package/src/report/{react → components/metric-views}/MetricLine.tsx +9 -6
- package/src/report/{react → components/metric-views}/MetricMatrix.tsx +6 -6
- package/src/report/{react → components/metric-views}/MetricScatter.tsx +41 -33
- package/src/report/{react → components/metric-views}/MetricTable.tsx +6 -6
- package/src/report/{react → components/metric-views}/Scoreboard.tsx +4 -4
- package/src/report/{compute.ts → components/metric-views/compute.ts} +51 -477
- package/src/report/components/metric-views/faces.ts +423 -0
- package/src/report/components/metric-views/index.tsx +352 -0
- package/src/report/{text → components/metric-views}/plot.ts +1 -1
- package/src/report/components/metric-views/validate.test.ts +211 -0
- package/src/report/{react → components}/render.test.tsx +47 -17
- package/src/report/components/shared-compute.ts +59 -0
- package/src/report/components/shared-faces.ts +30 -0
- package/src/report/components/shared.ts +192 -0
- package/src/report/{react → components/site-components}/CopyFixPrompt.tsx +3 -3
- package/src/report/{react → components/site-components}/HeroCard.tsx +3 -3
- package/src/report/{react → components/site-components}/ScopeWarnings.tsx +4 -4
- package/src/report/{react → components/site-components}/TraceWaterfall.tsx +13 -10
- package/src/report/components/site-components/compute.ts +144 -0
- package/src/report/components/site-components/faces.ts +80 -0
- package/src/report/components/site-components/index.tsx +265 -0
- package/src/report/{scope-warnings.ts → components/site-components/scope-warnings.ts} +3 -3
- package/src/report/{site-components.test.tsx → components/site-components/site-components.test.tsx} +23 -21
- package/src/report/components/site-components/validate.test.ts +89 -0
- package/src/report/{react → components/summaries}/ScopeSummary.tsx +26 -11
- package/src/report/components/summaries/compute.ts +56 -0
- package/src/report/components/summaries/faces.ts +48 -0
- package/src/report/components/summaries/index.tsx +127 -0
- package/src/report/components/summaries/validate.test.ts +49 -0
- package/src/report/definition/grid-layout.test.ts +124 -0
- package/src/report/definition/grid-layout.ts +146 -0
- package/src/report/{primitives.tsx → definition/primitives.tsx} +168 -18
- package/src/report/{report.ts → definition/report.ts} +98 -165
- package/src/report/{shell-head.test.ts → definition/shell-head.test.ts} +2 -2
- package/src/report/{text/table.ts → definition/table-text.ts} +4 -4
- package/src/report/{tree.ts → definition/tree.ts} +56 -20
- package/src/report/index.ts +126 -66
- package/src/report/{aggregate.ts → model/aggregate.ts} +31 -9
- package/src/report/{flag.ts → model/flag.ts} +39 -1
- package/src/report/{format.ts → model/format.ts} +59 -5
- package/src/report/{locale.ts → model/locale.ts} +34 -36
- package/src/report/{metrics.ts → model/metrics.ts} +3 -3
- package/src/report/{types.ts → model/types.ts} +143 -22
- package/src/report/react/index.tsx +52 -26
- package/src/report/{dual-render.test.tsx → runtime/dual-render.test.tsx} +564 -49
- package/src/report/runtime/host.test.ts +44 -0
- package/src/report/runtime/host.ts +138 -0
- package/src/report/{load.ts → runtime/load.ts} +1 -1
- package/src/report/runtime/text.ts +192 -0
- package/src/report/runtime/web.ts +106 -0
- package/src/results/attempt-evidence.ts +5 -1
- package/src/results/host-equivalence.test.ts +53 -2
- package/src/results/select.ts +29 -5
- package/src/runner/attempt.test.ts +48 -1
- package/src/runner/attempt.ts +62 -42
- package/src/runner/cleanup-timeout.test.ts +16 -0
- package/src/runner/cleanup-timeout.ts +23 -0
- package/src/runner/discover.ts +1 -2
- package/src/runner/eval-selection.test.ts +187 -0
- package/src/runner/eval-selection.ts +109 -0
- package/src/runner/experiment-cleanup-registry.test.ts +89 -0
- package/src/runner/experiment-cleanup-registry.ts +39 -0
- package/src/runner/experiment-labels.test.ts +71 -0
- package/src/runner/feedback/agent.test.ts +33 -1
- package/src/runner/feedback/agent.ts +12 -16
- package/src/runner/feedback/ci.test.ts +35 -1
- package/src/runner/feedback/ci.ts +16 -18
- package/src/runner/feedback/coordinator.ts +28 -0
- package/src/runner/feedback/human.test.ts +108 -1
- package/src/runner/feedback/human.ts +71 -21
- package/src/runner/feedback/reducer.test.ts +64 -0
- package/src/runner/feedback/reducer.ts +26 -0
- package/src/runner/feedback/sink.ts +40 -1
- package/src/runner/fingerprint.ts +2 -1
- package/src/runner/report.test.ts +14 -0
- package/src/runner/report.ts +3 -1
- package/src/runner/run.test.ts +390 -12
- package/src/runner/run.ts +259 -26
- package/src/runner/sandbox-selection.test.ts +13 -3
- package/src/runner/sandbox-selection.ts +4 -2
- package/src/runner/types.ts +158 -23
- package/src/sandbox/docker.ts +7 -0
- package/src/sandbox/e2b.ts +12 -13
- package/src/sandbox/types.ts +23 -21
- package/src/scoring/display.test.ts +28 -2
- package/src/scoring/display.ts +38 -5
- package/src/scoring/types.ts +3 -3
- package/src/shared/aggregate.test.ts +52 -0
- package/src/shared/aggregate.ts +29 -0
- package/src/shared/types.ts +6 -1
- package/src/show/command.test.ts +34 -0
- package/src/show/command.ts +16 -0
- package/src/show/compose.ts +1 -1
- package/src/show/index.ts +56 -20
- package/src/show/render.ts +15 -239
- package/src/show/show.test.ts +127 -34
- package/src/view/app/App.test.tsx +1 -1
- package/src/view/app/App.tsx +119 -47
- package/src/view/app/i18n.ts +7 -147
- package/src/view/app/lib/attempt-dialog.test.ts +65 -0
- package/src/view/app/lib/attempt-dialog.ts +69 -0
- package/src/view/app/main.tsx +0 -1
- package/src/view/app/types.ts +3 -86
- package/src/view/artifact-serving.test.ts +22 -38
- package/src/view/client-dist/app.css +1 -1
- package/src/view/client-dist/app.js +15 -22
- package/src/view/data.test.ts +48 -36
- package/src/view/data.ts +105 -83
- package/src/view/index.ts +1 -1
- package/src/view/server.ts +32 -2
- package/src/view/shared/types.ts +6 -31
- package/src/view/site-parity.test.ts +24 -1
- package/src/view/site.ts +144 -17
- package/src/view/styles.css +0 -805
- package/src/view/view-report.test.ts +141 -22
- package/dist/report/components.d.ts +0 -179
- package/dist/report/components.js +0 -544
- package/dist/report/compute.d.ts +0 -139
- package/dist/report/react/ExperimentComparison.d.ts +0 -10
- package/dist/report/react/ExperimentComparison.js +0 -12
- package/dist/report/react/MetricScatter.d.ts +0 -9
- package/dist/report/react/format.d.ts +0 -3
- package/dist/report/react/format.js +0 -7
- package/dist/report/text/faces.d.ts +0 -45
- package/dist/report/text/faces.js +0 -671
- package/dist/report/web.d.ts +0 -32
- package/dist/report/web.js +0 -48
- package/docs-site/zh/how-to/authoring.mdx +0 -162
- package/docs-site/zh/how-to/custom-reports.mdx +0 -414
- package/docs-site/zh/how-to/experiments.mdx +0 -86
- package/docs-site/zh/how-to/write-experiment.mdx +0 -164
- package/src/report/components.tsx +0 -925
- package/src/report/react/ExperimentComparison.tsx +0 -73
- package/src/report/react/format.ts +0 -9
- package/src/report/text/faces.ts +0 -767
- package/src/report/web.ts +0 -77
- package/src/show/report-host.test.ts +0 -205
- package/src/show/report-host.ts +0 -389
- package/src/view/app/components/AttemptModal.tsx +0 -496
- package/src/view/app/components/CodeView.test.tsx +0 -142
- package/src/view/app/components/CodeView.tsx +0 -310
- package/src/view/app/components/CopyControls.tsx +0 -106
- package/src/view/app/components/Trace.tsx +0 -100
- package/src/view/app/components/Transcript.tsx +0 -157
- package/src/view/app/components/ui/badge.tsx +0 -21
- package/src/view/app/lib/artifact-url.ts +0 -17
- package/src/view/app/lib/attempt-route.test.ts +0 -80
- package/src/view/app/lib/attempt-route.ts +0 -52
- package/src/view/app/lib/format.ts +0 -70
- package/src/view/app/lib/guards.test.ts +0 -108
- package/src/view/app/lib/guards.ts +0 -71
- package/src/view/app/lib/rows.ts +0 -22
- package/src/view/app/lib/transcript-data.tsx +0 -151
- package/src/view/app/lib/verdict.ts +0 -23
- package/src/view/app/shared.ts +0 -8
- /package/dist/report/{react → components/metric-views}/chart-math.d.ts +0 -0
- /package/dist/report/{react → components/metric-views}/chart-math.js +0 -0
- /package/dist/report/{text → components/metric-views}/plot.d.ts +0 -0
- /package/dist/report/{react → components/site-components}/PoweredBy.d.ts +0 -0
- /package/dist/report/{react → components/site-components}/PoweredBy.js +0 -0
- /package/dist/report/{text/layout.d.ts → model/text-layout.d.ts} +0 -0
- /package/dist/report/{text/layout.js → model/text-layout.js} +0 -0
- /package/dist/report/{types.js → model/types.js} +0 -0
- /package/src/report/{react → components/metric-views}/chart-math.test.ts +0 -0
- /package/src/report/{react → components/metric-views}/chart-math.ts +0 -0
- /package/src/report/{react → components/site-components}/PoweredBy.tsx +0 -0
- /package/src/report/{text/layout.ts → model/text-layout.ts} +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { AssertionResult, PhaseTiming, SourceLoc, StreamEvent } from "../types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* 标回 `t.send(...)` 调用行的一轮 turn 头行事实(契约见 docs/feature/reports/show.md
|
|
4
|
+
* 「--eval:把断言放回源码」)。身份标签与 --execution / --timing / diff windows 同一套;
|
|
5
|
+
* 回复全文与轮内卡片不进这个模型——源码页只回答「这行代码对应哪一轮、这一轮成了没成」。
|
|
6
|
+
*/
|
|
7
|
+
export interface SendAnnotation {
|
|
8
|
+
/** `s<session>/t<turn>`。 */
|
|
9
|
+
label: string;
|
|
10
|
+
/** 轮的终态;时间树只记 failed 位,waiting 需要事件流佐证时由派生方给。 */
|
|
11
|
+
status: "completed" | "failed" | "waiting";
|
|
12
|
+
/** 该轮墙钟;时间树缺这一轮的节点时省略。 */
|
|
13
|
+
durationMs?: number;
|
|
14
|
+
/** send 调用位置(用户消息事件的 loc)。 */
|
|
15
|
+
loc: SourceLoc;
|
|
16
|
+
}
|
|
17
|
+
/** 一行源码 + 映射到这一行的全部断言与 send 标注(保持原始顺序;可以是空数组)。 */
|
|
18
|
+
export interface AnnotatedSourceLine {
|
|
19
|
+
/** 1-indexed 行号,与 SourceLoc.line 同一坐标系。 */
|
|
20
|
+
line: number;
|
|
21
|
+
/** 这一行的原始文本(已按 normalizeEvalSource 归一化,不含行尾换行符)。 */
|
|
22
|
+
text: string;
|
|
23
|
+
/**
|
|
24
|
+
* 映射到这一行的断言,按输入顺序(通常即执行顺序)排列。每条断言自带 severity / score /
|
|
25
|
+
* passed / detail / evidence —— 这就是"状态 / 严重度 / 分数 / detail / evidence"标回源码行
|
|
26
|
+
* 的完整信息,不需要额外的行级折叠字段:折叠成单一显示态是 renderer 的展示决定,不是这份
|
|
27
|
+
* 领域 model 的职责(与 indexAsserts() 的先例一致,它同样只分桶、不折叠)。
|
|
28
|
+
*/
|
|
29
|
+
assertions: AssertionResult[];
|
|
30
|
+
/**
|
|
31
|
+
* 映射到这一行的 send 标注,按轮次顺序;循环里的 send 一行多轮。与断言的 never-drop
|
|
32
|
+
* 契约不同,定位不到行的轮不进任何兜底桶——轮次的全量面是 --execution,这里只是指针。
|
|
33
|
+
*/
|
|
34
|
+
sends: SendAnnotation[];
|
|
35
|
+
}
|
|
36
|
+
export interface AnnotatedEvalSourceSummary {
|
|
37
|
+
/** 参与统计的断言总数 = mappedAssertions + unmappedAssertions。 */
|
|
38
|
+
totalAssertions: number;
|
|
39
|
+
/** 成功映射到某一行源码的断言数。 */
|
|
40
|
+
mappedAssertions: number;
|
|
41
|
+
/** 落进 unmapped 桶的断言数。 */
|
|
42
|
+
unmappedAssertions: number;
|
|
43
|
+
/** 按 passed 计票(映射与未映射的断言都计入)。 */
|
|
44
|
+
passed: number;
|
|
45
|
+
failed: number;
|
|
46
|
+
/** 按 severity 计票(映射与未映射的断言都计入)。 */
|
|
47
|
+
gate: number;
|
|
48
|
+
soft: number;
|
|
49
|
+
/** 源码总行数,等于 lines.length。 */
|
|
50
|
+
totalLines: number;
|
|
51
|
+
/** 至少挂了一条断言的行数。 */
|
|
52
|
+
annotatedLines: number;
|
|
53
|
+
}
|
|
54
|
+
export interface AnnotatedEvalSource {
|
|
55
|
+
/** 项目相对路径,与 SourceArtifact.path / SourceLoc.file 同一约定。 */
|
|
56
|
+
sourcePath: string;
|
|
57
|
+
/** 归一化后源码文本的 SHA-256(与 captureEvalSource() 的算法一致,见 source-hash.ts)。 */
|
|
58
|
+
sourceSha256: string;
|
|
59
|
+
lines: AnnotatedSourceLine[];
|
|
60
|
+
/**
|
|
61
|
+
* 没有落到 lines 里任何一行的断言,原始顺序保留,永不丢弃。三种情况都进这里:
|
|
62
|
+
* 没有 SourceLoc(如 skip 前就出错的 eval、或调用方尚未收集到位置)、SourceLoc 指向
|
|
63
|
+
* 另一个文件(loc.file !== sourcePath —— 罕见,如断言写在共享 helper 里)、
|
|
64
|
+
* SourceLoc 的行号落在这份源码的行范围之外(源码与断言记录不同步的边界情况)。
|
|
65
|
+
* 后两种不是文档明确要求的场景,但"never silently dropped"的契约对它们同样成立 ——
|
|
66
|
+
* 这份 model 是分桶断言的唯一出口,不属于任何一行就必须出现在这里。
|
|
67
|
+
*/
|
|
68
|
+
unmapped: AssertionResult[];
|
|
69
|
+
summary: AnnotatedEvalSourceSummary;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 从标准事件流与阶段时间树派生 send 标注:第 i 条用户消息开第 i 轮(与 --execution 的
|
|
73
|
+
* 分轮边界同一条规则,见 show/render.ts::executionText),头行事实取 `eval.run` 下第 i 个
|
|
74
|
+
* turn 节点;用户消息没有 loc 的轮不产出标注。纯函数,无 IO。
|
|
75
|
+
*/
|
|
76
|
+
export declare function deriveSendAnnotations(events: readonly StreamEvent[] | null, phases: readonly PhaseTiming[] | undefined): SendAnnotation[];
|
|
77
|
+
/**
|
|
78
|
+
* 纯函数:给定一份源码文本(未归一化也可以,内部会 normalizeEvalSource)与一批断言,
|
|
79
|
+
* 产出标注好的 AnnotatedEvalSource。幂等 / 无 IO —— 可以在渲染路径上安全调用。
|
|
80
|
+
*
|
|
81
|
+
* 断言 → 源码行的映射规则:`a.loc` 存在、`a.loc.file === source.path`、且
|
|
82
|
+
* `1 <= a.loc.line <= lines.length` 三者同时成立才落到对应行;否则进 `unmapped`。
|
|
83
|
+
*/
|
|
84
|
+
export declare function buildAnnotatedEvalSource(source: {
|
|
85
|
+
path: string;
|
|
86
|
+
content: string;
|
|
87
|
+
}, assertions: readonly AssertionResult[], sends?: readonly SendAnnotation[]): AnnotatedEvalSource;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { AttemptHandle } from "./types.ts";
|
|
2
|
+
import { type AttemptIdentity, type AttemptLocator } from "./locator.ts";
|
|
3
|
+
import { type AnnotatedEvalSource } from "./annotated-source.ts";
|
|
4
|
+
import { type ExecutionTree } from "../o11y/execution-tree.ts";
|
|
5
|
+
import type { DiffData, EvalResult, StreamEvent } from "../types.ts";
|
|
6
|
+
/**
|
|
7
|
+
* 一个 Attempt 的 artifact 落盘位置。单一目录足够:一个 attempt 的全部 artifact
|
|
8
|
+
* (events.json / trace.json / o11y.json / diff.json / sources.json,见 ARTIFACT_KINDS)
|
|
9
|
+
* 要么全在它自己的 attempt 目录,要么(--resume 携带条目——本轮没写任何新数据,
|
|
10
|
+
* 见 writer.ts 对携带分支的说明)全在 artifactBase 回退到的原快照 attempt 目录,
|
|
11
|
+
* 从不出现"这个 kind 在自己目录、那个 kind 在 artifactBase"的拆分场景,不需要
|
|
12
|
+
* 按 kind 逐个给路径。想要某一种 artifact 的具体文件,自己拼
|
|
13
|
+
* `join(artifactPaths.dir, "<kind>.json")`(kind 见 `ArtifactKind`)。
|
|
14
|
+
*
|
|
15
|
+
* 与 show/render.ts 的 `attemptArtifactsPath(attempt, cwd)` 是同一份"这个 attempt 的证据在哪"
|
|
16
|
+
* 知识的两种呈现:那边为 CLI 文本展示把它转成 cwd 相对的短路径,这里给 evidence 层的调用方
|
|
17
|
+
* (view / 静态导出 / 报告列表,它们没有统一的"cwd"概念)一份绝对路径,不做相对化。
|
|
18
|
+
*/
|
|
19
|
+
export interface EvidencePaths {
|
|
20
|
+
/** 绝对路径。 */
|
|
21
|
+
dir: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 每一位只在数据真的存在且非空时为 true——从不因为对应的 artifact 文件"存在"就点亮,
|
|
25
|
+
* 见本文件头注逐位的门槛说明。show/view/静态导出/报告列表读这四位来决定要不要显示
|
|
26
|
+
* 对应的证据切面,不自己重新判断"这个 attempt 有没有 X"。
|
|
27
|
+
*/
|
|
28
|
+
export interface AttemptEvidenceCapabilities {
|
|
29
|
+
/** evalSource 非空且有内容(源码行或断言二选一非空);对应 CLI 的 `--source` 证据切面。 */
|
|
30
|
+
source: boolean;
|
|
31
|
+
/** events 非空数组——有骨架可看。 */
|
|
32
|
+
execution: boolean;
|
|
33
|
+
/** result.json 带 phases(阶段计时)——`--timing` 时间树可渲染。 */
|
|
34
|
+
timing: boolean;
|
|
35
|
+
/** diff 非空且至少改动/删除了一个文件。 */
|
|
36
|
+
diff: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 一个 Attempt 的完整证据聚合。除 `locator` 外每个字段要么是别的模块已经产出的纯数据类型,
|
|
40
|
+
* 要么是这四样拼出来的判定——本类型自己不发明新的证据形状。
|
|
41
|
+
*/
|
|
42
|
+
export interface AttemptEvidence {
|
|
43
|
+
locator: AttemptLocator;
|
|
44
|
+
/** locator 派生自的不可变身份元组,与 `locator` 编码的是同一份数据,供不想解码 locator
|
|
45
|
+
* 的调用方直接读结构化字段(如按 experimentId 分组、按时间排序)。 */
|
|
46
|
+
identity: AttemptIdentity;
|
|
47
|
+
result: EvalResult;
|
|
48
|
+
/** 标准事件流(`--execution` 切面与 AttemptConversation 分轮的唯一事实来源);没有非空
|
|
49
|
+
* events() 就是 null。装配一次,`show` / `view` / 报告不再各自调用 `attempt.events()`。 */
|
|
50
|
+
events: readonly StreamEvent[] | null;
|
|
51
|
+
/** 运行时保存的 Eval 源码标注(`--source` 切面);没有 sources() 就是 null,不伪造空文档。 */
|
|
52
|
+
evalSource: AnnotatedEvalSource | null;
|
|
53
|
+
/** 标准事件流 + OTel enrichment(`--execution` 切面);没有非空 events 就是 null,
|
|
54
|
+
* 不产出一棵只剩 telemetry-only 节点、没有真实骨架的误导性树(见头注 execution 门槛)。 */
|
|
55
|
+
execution: ExecutionTree | null;
|
|
56
|
+
/** 被测 Agent 对 Sandbox 工作区的文件变化(`--diff` 切面);原样透传 attempt.diff()。 */
|
|
57
|
+
diff: DiffData | null;
|
|
58
|
+
/** OTel spans(`--timing` 把 turn 节点下的 agent/model/tool spans 挂回时间树);没有 trace 就是 null。 */
|
|
59
|
+
trace: import("../types.ts").TraceSpan[] | null;
|
|
60
|
+
artifactPaths: EvidencePaths;
|
|
61
|
+
capabilities: AttemptEvidenceCapabilities;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* 纯组合:一次性 await 好 attempt 的四类懒加载证据(events / trace / diff / 经
|
|
65
|
+
* loadAnnotatedEvalSource 解引用的 eval 源码),拼成一份 AttemptEvidence。不重新实现
|
|
66
|
+
* Eval 源码标注、ExecutionTree 合并或 diff 语义的任何一条规则——那些规则的家分别在
|
|
67
|
+
* annotated-source.ts / execution-tree.ts / attempt.diff() 自身,这里只调用与判定"够不够
|
|
68
|
+
* 亮起对应的证据切面"。
|
|
69
|
+
*
|
|
70
|
+
* `attempt.locator` 在真实读取路径(openResults() 产出的 handle)恒有值;缺失时按当前身份
|
|
71
|
+
* 元组按 encodeAttemptLocator 兜底算一份,同 open.ts 给 record.locator 做的兜底同一口径——
|
|
72
|
+
* 只服务手工构造 AttemptHandle 的测试场景,不改变真实读取路径的行为。
|
|
73
|
+
*/
|
|
74
|
+
export declare function loadAttemptEvidence(attempt: AttemptHandle): Promise<AttemptEvidence>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AttemptHandle } from "./types.ts";
|
|
2
|
+
import { type AnnotatedEvalSource, type SendAnnotation } from "./annotated-source.ts";
|
|
3
|
+
/**
|
|
4
|
+
* 给定一个 attempt,取回它的 eval 源码(经 sources() 解引用,可能来自本快照或
|
|
5
|
+
* artifactBase 回退到的原快照)与它的断言,产出标注好的 AnnotatedEvalSource。
|
|
6
|
+
*
|
|
7
|
+
* 没有 sources()(eval 从没被 `loc` 引用到、或落盘里压根没有 sources.json/artifactBase
|
|
8
|
+
* 已失效)时返回 null——没有源码就没有「标注源码」这回事,不伪造一份空文档。
|
|
9
|
+
*
|
|
10
|
+
* 一个 attempt 的 sources() 理论上可以有多份文件(主 eval 文件 + 罕见的跨文件 loc);
|
|
11
|
+
* 这里按「哪份文件被最多断言的 loc 命中」选一份作为主文件喂给 buildAnnotatedEvalSource——
|
|
12
|
+
* 只服务这条打通链路的验证目的,不是最终选择策略(后续阶段如需要为每份引用到的文件
|
|
13
|
+
* 都出一份 AnnotatedEvalSource,在这基础上很容易扩成返回数组)。
|
|
14
|
+
*/
|
|
15
|
+
export declare function loadAnnotatedEvalSource(attempt: AttemptHandle, sends?: readonly SendAnnotation[]): Promise<AnnotatedEvalSource | null>;
|
package/dist/results/select.d.ts
CHANGED
|
@@ -34,6 +34,12 @@ export interface ComparabilityConfig {
|
|
|
34
34
|
export declare function comparabilityConfigOf(snapshot: Snapshot): ComparabilityConfig;
|
|
35
35
|
/** 可序列化值的深相等(对象键序无关;undefined 字段与缺席字段等价)。 */
|
|
36
36
|
export declare function deepEqualJson(a: unknown, b: unknown): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* 一个快照实际选中的 eval id 全集:优先读落盘的 `experiment.selectedEvalIds`(niceeval 自己的
|
|
39
|
+
* 写入面必有此字段);第三方 harness 未实现该字段时退化为该快照实际写出的 `evals`,不把整份
|
|
40
|
+
* 来源排除在外(见 docs/feature/results/architecture.md「selectedEvalIds」)。
|
|
41
|
+
*/
|
|
42
|
+
export declare function selectedEvalIdsOf(snapshot: Snapshot): readonly string[];
|
|
37
43
|
/**
|
|
38
44
|
* 两个宿主(show / view)共用的现刻水位选择器:每个 experiment × eval 取「包含该 eval 的
|
|
39
45
|
* 最新快照」里的全部 attempt,跨 run 合成。results.latest() 只挑「每实验最新快照」,带 eval
|
|
@@ -68,7 +74,11 @@ export declare function dedupeAttempts(attempts: AttemptHandle[]): {
|
|
|
68
74
|
};
|
|
69
75
|
/** 快照新旧比较:startedAt 优先,同刻按快照目录名(时间戳 + 随机后缀,字典序即时序)。 */
|
|
70
76
|
export declare function isNewerSnapshot(a: Snapshot, b: Snapshot): boolean;
|
|
71
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* experiment 选择器过滤(--exp / latest({ experiments }) 同一语义,与 `niceeval exp` 位置参数
|
|
79
|
+
* 共用 matchExperimentSelector,见 docs/feature/experiments/cli.md「实验选择器怎样解析」);
|
|
80
|
+
* 包内使用,不进公共 barrel。
|
|
81
|
+
*/
|
|
72
82
|
export declare function filterExperiments(experiments: Experiment[], filter?: string | string[]): Experiment[];
|
|
73
83
|
/**
|
|
74
84
|
* stale 警告的人话时距:选粒度最大的单位,四舍五入。结构化形态是单源——message 的英文时距
|
package/dist/results/select.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// 选择器长在集合上(results.latest() / results.current()),不是 DSL,只是最常用的两种口径。
|
|
4
4
|
// 选择器必须诚实:残缺、落后、未收尾都被算出来,以结构化 warnings 随 Scope 走 ——
|
|
5
5
|
// 渲染与否在消费方(message 是渲染好的英文句子,以下一步收尾),但缺口不静默。
|
|
6
|
-
import { evalPrefixPredicate } from "../shared/aggregate.js";
|
|
6
|
+
import { evalPrefixPredicate, matchExperimentSelector } from "../shared/aggregate.js";
|
|
7
7
|
/**
|
|
8
8
|
* Results.latest() 的实现:每个实验取最新一次快照(= exp.snapshots[0]),生成挑选警告。
|
|
9
9
|
* 收整个 `Results` 而不是裸 `Experiment[]`,是为了同时取 `skipped` / `root` 生成
|
|
@@ -91,6 +91,14 @@ export function deepEqualJson(a, b) {
|
|
|
91
91
|
}
|
|
92
92
|
return false;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* 一个快照实际选中的 eval id 全集:优先读落盘的 `experiment.selectedEvalIds`(niceeval 自己的
|
|
96
|
+
* 写入面必有此字段);第三方 harness 未实现该字段时退化为该快照实际写出的 `evals`,不把整份
|
|
97
|
+
* 来源排除在外(见 docs/feature/results/architecture.md「selectedEvalIds」)。
|
|
98
|
+
*/
|
|
99
|
+
export function selectedEvalIdsOf(snapshot) {
|
|
100
|
+
return snapshot.experiment?.selectedEvalIds ?? snapshot.evals.map((ev) => ev.id);
|
|
101
|
+
}
|
|
94
102
|
/**
|
|
95
103
|
* 两个宿主(show / view)共用的现刻水位选择器:每个 experiment × eval 取「包含该 eval 的
|
|
96
104
|
* 最新快照」里的全部 attempt,跨 run 合成。results.latest() 只挑「每实验最新快照」,带 eval
|
|
@@ -119,8 +127,12 @@ export function selectCurrentResults(results, scope = {}) {
|
|
|
119
127
|
for (const snapshot of exp.snapshots) {
|
|
120
128
|
if (!deepEqualJson(comparabilityConfigOf(snapshot), baseline))
|
|
121
129
|
continue;
|
|
130
|
+
// 一个来源快照只贡献它自己选中的 eval——不在其 selectedEvalIds(或第三方退化后的实际
|
|
131
|
+
// evals)内的历史 attempt 不进入合成结果,即使它恰好出现在 snapshot.evals 里。第三方
|
|
132
|
+
// 无该字段时 selectedEvalIdsOf 退化为快照实际 evals,这里的过滤天然是 no-op。
|
|
133
|
+
const selectedIds = new Set(selectedEvalIdsOf(snapshot));
|
|
122
134
|
for (const ev of snapshot.evals) {
|
|
123
|
-
if (!match(ev.id) || taken.has(ev.id))
|
|
135
|
+
if (!selectedIds.has(ev.id) || !match(ev.id) || taken.has(ev.id))
|
|
124
136
|
continue;
|
|
125
137
|
taken.set(ev.id, { ev, snapshot });
|
|
126
138
|
}
|
|
@@ -138,12 +150,16 @@ export function selectCurrentResults(results, scope = {}) {
|
|
|
138
150
|
}
|
|
139
151
|
const evals = picks.map((p) => p.ev);
|
|
140
152
|
const base = exp.latest;
|
|
153
|
+
// 合成快照的 selectedEvalIds 重建为最终 picks 的有序 id 列表——不是照抄某一来源快照
|
|
154
|
+
// (通常是最新快照)的局部选择。base.experiment 缺失(第三方无 ExperimentRunInfo)时不
|
|
155
|
+
// 伪造一份不完整投影,继续靠 report 侧 fallback(见 selectedEvalIdsOf)。
|
|
156
|
+
const experiment = base.experiment !== undefined ? { ...base.experiment, selectedEvalIds: evals.map((ev) => ev.id) } : undefined;
|
|
141
157
|
snapshots.push({
|
|
142
158
|
experimentId: exp.id,
|
|
143
159
|
startedAt,
|
|
144
160
|
agent: base.agent,
|
|
145
161
|
...(base.model !== undefined ? { model: base.model } : {}),
|
|
146
|
-
...(
|
|
162
|
+
...(experiment !== undefined ? { experiment } : {}),
|
|
147
163
|
...(base.name !== undefined ? { name: base.name } : {}),
|
|
148
164
|
producer: base.producer,
|
|
149
165
|
schemaVersion: base.schemaVersion,
|
|
@@ -312,13 +328,19 @@ export function isNewerSnapshot(a, b) {
|
|
|
312
328
|
return byStart > 0;
|
|
313
329
|
return a.dir.localeCompare(b.dir) > 0;
|
|
314
330
|
}
|
|
315
|
-
/**
|
|
331
|
+
/**
|
|
332
|
+
* experiment 选择器过滤(--exp / latest({ experiments }) 同一语义,与 `niceeval exp` 位置参数
|
|
333
|
+
* 共用 matchExperimentSelector,见 docs/feature/experiments/cli.md「实验选择器怎样解析」);
|
|
334
|
+
* 包内使用,不进公共 barrel。
|
|
335
|
+
*/
|
|
316
336
|
export function filterExperiments(experiments, filter) {
|
|
317
337
|
if (filter === undefined)
|
|
318
338
|
return experiments;
|
|
319
339
|
// 允许 "compare/" 这种带尾斜杠的写法,与 "compare" 等价;分段匹配不误配 "compare2"。
|
|
320
340
|
const prefixes = (Array.isArray(filter) ? filter : [filter]).map((p) => p.replace(/\/+$/, ""));
|
|
321
|
-
|
|
341
|
+
const ids = experiments.map((exp) => exp.id);
|
|
342
|
+
const matched = new Set(prefixes.flatMap((p) => matchExperimentSelector(ids, p)));
|
|
343
|
+
return experiments.filter((exp) => matched.has(exp.id));
|
|
322
344
|
}
|
|
323
345
|
/**
|
|
324
346
|
* stale 警告的人话时距:选粒度最大的单位,四舍五入。结构化形态是单源——message 的英文时距
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AgentRun, DiscoveredEval, EvalDescriptor, ExperimentDef } from "./types.ts";
|
|
2
|
+
/** `DiscoveredEval` → 用户谓词可见的显式白名单投影;不透传内部路径/执行字段。 */
|
|
3
|
+
export declare function evalDescriptorOf(evalDef: DiscoveredEval): EvalDescriptor;
|
|
4
|
+
export interface ResolveExperimentEvalsInput {
|
|
5
|
+
experimentId: string;
|
|
6
|
+
selector: ExperimentDef["evals"];
|
|
7
|
+
cliPatterns: readonly string[];
|
|
8
|
+
evals: readonly DiscoveredEval[];
|
|
9
|
+
}
|
|
10
|
+
export interface ResolveExperimentEvalsResult {
|
|
11
|
+
selectedEvals: readonly DiscoveredEval[];
|
|
12
|
+
selectedEvalIds: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 对某个 experiment 的候选 eval 集合各求值谓词一次,与 CLI 追加的位置参数前缀取交集。
|
|
16
|
+
* 返回顺序 = discovery 稳定顺序,id 去重——这是 dry-run、attempt 派发顺序与落盘
|
|
17
|
+
* `selectedEvalIds` 的共同来源(见 docs/feature/eval/README.md「路径即身份」)。
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveExperimentEvals(input: ResolveExperimentEvalsInput): ResolveExperimentEvalsResult;
|
|
20
|
+
/**
|
|
21
|
+
* `evals` 选择器的审计指纹(数组内容 / 函数体哈希),进 `ExperimentRunInfo.evalFilterFingerprint`,
|
|
22
|
+
* 供「配置没变」判断;不存选择器本身、不参与报告选题(选题权威是 `selectedEvalIds`)。
|
|
23
|
+
*/
|
|
24
|
+
export declare function fingerprintEvalsFilter(evals: ExperimentDef["evals"], patterns: readonly string[]): string;
|
|
25
|
+
/** 所有消费者按已解析的 `selectedEvalIds` 取 eval;不持有、不调用用户谓词。 */
|
|
26
|
+
export declare function selectedEvalsForRun(all: readonly DiscoveredEval[], run: Pick<AgentRun, "selectedEvalIds">): DiscoveredEval[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AttemptLifecycleEvent, AttemptRef, FailureDetail } from "../types.ts";
|
|
1
|
+
import type { AttemptLifecycleEvent, AttemptRef, ExperimentHookName, FailureDetail } from "../types.ts";
|
|
2
2
|
import type { Verdict } from "../../scoring/types.ts";
|
|
3
3
|
import type { JsonValue } from "../../shared/types.ts";
|
|
4
4
|
import type { AttemptLocator } from "../../results/locator.ts";
|
|
@@ -29,6 +29,20 @@ export interface BudgetExhaustedInput {
|
|
|
29
29
|
spent: number;
|
|
30
30
|
unstarted: number;
|
|
31
31
|
}
|
|
32
|
+
/** `sink.experimentHook()` 的输入 —— 与 `DurableFeedbackEvent` 的 "experiment-hook" 变体字段
|
|
33
|
+
* 一致,省略 `type`/`at`(由 coordinator 补上)。调用方(run.ts)在钩子真正开始/结束时各调
|
|
34
|
+
* 一次;`durationMs` 只在 done/failed 上给。 */
|
|
35
|
+
export interface ExperimentHookInput {
|
|
36
|
+
experimentId: string;
|
|
37
|
+
hook: ExperimentHookName;
|
|
38
|
+
status: "started" | "done" | "failed";
|
|
39
|
+
durationMs?: number;
|
|
40
|
+
}
|
|
41
|
+
/** `sink.experimentProgress()` 的输入 —— 实验级 `ctx.progress` 压好的单行文本。 */
|
|
42
|
+
export interface ExperimentProgressInput {
|
|
43
|
+
experimentId: string;
|
|
44
|
+
detail: string;
|
|
45
|
+
}
|
|
32
46
|
/** `sink.kept()` 的输入 —— 与 `DurableFeedbackEvent` 的 "kept" 变体字段一致,省略 type/at。 */
|
|
33
47
|
export interface KeptInput {
|
|
34
48
|
locator: AttemptLocator;
|
|
@@ -57,6 +71,11 @@ export interface FeedbackSink {
|
|
|
57
71
|
budgetExhausted(input: BudgetExhaustedInput): void;
|
|
58
72
|
/** 一次留存授予(--keep-sandbox);见 `KeptInput` 与 docs/feature/sandbox/cli.md。 */
|
|
59
73
|
kept(input: KeptInput): void;
|
|
74
|
+
/** 实验级钩子(`ExperimentDef.setup` / teardown)的起止(见 `ExperimentHookInput`)。 */
|
|
75
|
+
experimentHook(input: ExperimentHookInput): void;
|
|
76
|
+
/** 实验级 `ctx.progress` 的短命投影:只更新运行级行的 detail。与 `lifecycle` 同级别的
|
|
77
|
+
* 「只服务正在画着的 dashboard」信号,没有活跃 coordinator 时静默丢弃是安全的。 */
|
|
78
|
+
experimentProgress(input: ExperimentProgressInput): void;
|
|
60
79
|
/** attempt 生命周期事件(queued/start/phase/progress/complete/early-exit),见
|
|
61
80
|
* `AttemptLifecycleEvent`。只驱动 human dashboard 的 active slot,不落 RunSummary/结果文件,
|
|
62
81
|
* 所以没有活跃 coordinator 时(见 `reportAttemptLifecycle`)静默丢弃是安全的 —— 这类信息
|
|
@@ -84,6 +103,12 @@ export declare function reportFailure(input: FailureInput): void;
|
|
|
84
103
|
* 兜底文案与 coordinator.ts 的 `fallbackTextFor` 对 "budget-exhausted" 事件的格式化保持一致。 */
|
|
85
104
|
/** 一次留存授予的永久通知(--keep-sandbox);没有活跃 coordinator 时退回一行 stderr。 */
|
|
86
105
|
export declare function reportKept(input: KeptInput): void;
|
|
106
|
+
/** 实验级钩子的起止(见 `ExperimentHookInput`)。没有活跃 coordinator 时退回一行 stderr ——
|
|
107
|
+
* 长 setup 的可见性正是这条通道存在的理由,不能像 lifecycle 那样静默丢弃。 */
|
|
108
|
+
export declare function reportExperimentHook(input: ExperimentHookInput): void;
|
|
109
|
+
/** 实验级 `ctx.progress` 的短命投影。与 `reportAttemptLifecycle` 同理:只服务正在画着的
|
|
110
|
+
* dashboard,没有活跃 coordinator 时静默 no-op。 */
|
|
111
|
+
export declare function reportExperimentProgress(input: ExperimentProgressInput): void;
|
|
87
112
|
export declare function reportBudgetExhausted(input: BudgetExhaustedInput): void;
|
|
88
113
|
/** 用户中断(Ctrl+C)。没有活跃 coordinator 时的兜底文案与迁移前的 `runner.interrupted` 完全
|
|
89
114
|
* 相同 —— 调用方(run.ts)不再需要自己持有这段 i18n 文案。 */
|