niceeval 0.6.1 → 0.7.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 +23 -23
- package/README.zh.md +6 -6
- package/dist/agents/types.d.ts +69 -7
- package/dist/context/types.d.ts +32 -12
- package/dist/i18n/en.d.ts +54 -0
- package/dist/i18n/zh-CN.d.ts +57 -3
- package/dist/o11y/types.d.ts +16 -2
- package/dist/report/aggregate.d.ts +32 -24
- package/dist/report/aggregate.js +158 -50
- package/dist/report/built-in/index.d.ts +2 -0
- package/dist/report/built-in/index.js +8 -0
- package/dist/report/components.d.ts +93 -160
- package/dist/report/components.js +377 -114
- package/dist/report/compute.d.ts +87 -81
- package/dist/report/compute.js +597 -417
- package/dist/report/flag.d.ts +32 -6
- package/dist/report/flag.js +92 -4
- package/dist/report/format.d.ts +19 -11
- package/dist/report/format.js +30 -13
- package/dist/report/index.d.ts +16 -16
- package/dist/report/index.js +20 -21
- package/dist/report/load.js +3 -2
- package/dist/report/locale.d.ts +57 -33
- package/dist/report/locale.js +122 -56
- package/dist/report/metrics.d.ts +23 -4
- package/dist/report/metrics.js +110 -25
- package/dist/report/primitives.d.ts +48 -15
- package/dist/report/primitives.js +135 -26
- package/dist/report/react/AttemptList.d.ts +9 -7
- package/dist/report/react/AttemptList.js +17 -10
- package/dist/report/react/DeltaTable.js +19 -18
- package/dist/report/react/EvalList.d.ts +4 -4
- package/dist/report/react/EvalList.js +0 -0
- package/dist/report/react/ExperimentComparison.d.ts +10 -0
- package/dist/report/react/ExperimentComparison.js +12 -0
- package/dist/report/react/ExperimentList.d.ts +4 -3
- package/dist/report/react/ExperimentList.js +17 -18
- package/dist/report/react/MetricBars.js +5 -4
- package/dist/report/react/MetricLine.js +12 -5
- package/dist/report/react/MetricMatrix.js +1 -1
- package/dist/report/react/MetricScatter.js +59 -28
- package/dist/report/react/MetricTable.js +2 -12
- package/dist/report/react/ScopeSummary.d.ts +10 -0
- package/dist/report/react/ScopeSummary.js +17 -0
- package/dist/report/react/Scoreboard.js +6 -6
- package/dist/report/react/cell.js +2 -2
- package/dist/report/react/chart-math.d.ts +23 -6
- package/dist/report/react/chart-math.js +71 -19
- package/dist/report/react/fixtures.d.ts +5 -9
- package/dist/report/react/fixtures.js +110 -147
- package/dist/report/react/index.d.ts +15 -5
- package/dist/report/react/index.js +18 -7
- package/dist/report/report.d.ts +137 -16
- package/dist/report/report.js +259 -28
- package/dist/report/text/faces.d.ts +17 -19
- package/dist/report/text/faces.js +253 -184
- package/dist/report/text/plot.js +1 -1
- package/dist/report/text/table.js +38 -7
- package/dist/report/tree.d.ts +90 -40
- package/dist/report/tree.js +252 -94
- package/dist/report/types.d.ts +247 -284
- package/dist/report/types.js +4 -3
- package/dist/report/web.d.ts +21 -5
- package/dist/report/web.js +42 -16
- package/dist/results/select.d.ts +38 -16
- package/dist/results/select.js +73 -25
- package/dist/results/types.d.ts +49 -14
- package/dist/runner/feedback/sink.d.ts +110 -0
- package/dist/runner/types.d.ts +513 -22
- package/dist/sandbox/docker.d.ts +23 -2
- package/dist/sandbox/e2b.d.ts +15 -1
- package/dist/sandbox/errors.d.ts +30 -3
- package/dist/sandbox/io-retry.d.ts +17 -0
- package/dist/sandbox/registry.d.ts +2 -0
- package/dist/sandbox/resolve.d.ts +18 -5
- package/dist/sandbox/retry.d.ts +11 -1
- package/dist/sandbox/types.d.ts +39 -5
- package/dist/sandbox/vercel.d.ts +7 -1
- package/dist/scoring/coverage.d.ts +30 -0
- package/dist/scoring/display.d.ts +21 -0
- package/dist/scoring/display.js +120 -0
- package/dist/scoring/types.d.ts +103 -20
- package/dist/shared/aggregate.d.ts +4 -2
- package/dist/shared/aggregate.js +8 -7
- package/dist/shared/types.d.ts +28 -0
- package/dist/tty-line.d.ts +0 -4
- package/dist/util.d.ts +23 -0
- package/docs-site/zh/README.md +44 -0
- package/docs-site/zh/examples/ai-agent-application.mdx +63 -0
- package/docs-site/zh/examples/coding-agent-extensions.mdx +57 -0
- package/docs-site/zh/examples/index.mdx +50 -0
- package/docs-site/zh/{concepts → explanation}/adapter.mdx +31 -13
- package/docs-site/zh/{concepts → explanation}/assert.mdx +7 -7
- package/docs-site/zh/{concepts → explanation}/drive.mdx +8 -8
- package/docs-site/zh/{concepts → explanation}/evals.mdx +4 -4
- package/docs-site/zh/{concepts → explanation}/experiment.mdx +8 -8
- package/docs-site/zh/{concepts → explanation}/hitl.mdx +8 -8
- package/docs-site/zh/{concepts → explanation}/judge.mdx +5 -5
- package/docs-site/zh/{concepts → explanation}/overview.mdx +11 -11
- package/docs-site/zh/{guides → explanation}/runner.mdx +18 -8
- package/docs-site/zh/{concepts → explanation}/tier.mdx +6 -6
- package/docs-site/zh/{guides → how-to}/agent-feedback-loop.mdx +35 -33
- package/docs-site/zh/{guides → how-to}/authoring.mdx +35 -2
- package/docs-site/zh/{guides → how-to}/ci-integration.mdx +23 -12
- package/docs-site/zh/{guides → how-to}/connect-otel.mdx +6 -6
- package/docs-site/zh/{guides → how-to}/connect-your-agent.mdx +47 -21
- package/docs-site/zh/{guides → how-to}/custom-reports.mdx +34 -39
- package/docs-site/zh/{guides → how-to}/dataset-fanout.mdx +25 -3
- package/docs-site/zh/{guides → how-to}/experiments.mdx +12 -5
- package/docs-site/zh/how-to/publish-report.mdx +105 -0
- package/docs-site/zh/{guides → how-to}/reporters.mdx +2 -2
- package/docs-site/zh/{guides → how-to}/sandbox-agent.mdx +56 -7
- package/docs-site/zh/how-to/sandbox-providers.mdx +350 -0
- package/docs-site/zh/{guides → how-to}/scoring-guide.mdx +4 -4
- package/docs-site/zh/{guides → how-to}/viewing-results.mdx +82 -39
- package/docs-site/zh/{guides → how-to}/write-experiment.mdx +6 -4
- package/docs-site/zh/{guides → how-to}/write-send.mdx +30 -14
- package/docs-site/zh/index.mdx +24 -26
- package/docs-site/zh/introduction.mdx +8 -8
- package/docs-site/zh/reference/builtin-agents.mdx +32 -5
- package/docs-site/zh/reference/capabilities.mdx +8 -8
- package/docs-site/zh/reference/cli.mdx +40 -12
- package/docs-site/zh/reference/define-agent.mdx +58 -5
- package/docs-site/zh/reference/define-config.mdx +1 -1
- package/docs-site/zh/reference/define-eval.mdx +42 -9
- package/docs-site/zh/reference/events.mdx +3 -3
- package/docs-site/zh/reference/expect.mdx +26 -1
- package/docs-site/zh/{guides → reference}/official-adapters.mdx +32 -8
- package/docs-site/zh/{guides → reference}/report-components.mdx +45 -33
- package/docs-site/zh/{guides → reference}/results-data.mdx +21 -13
- package/docs-site/zh/troubleshooting/debug-sandbox.mdx +57 -0
- package/docs-site/zh/troubleshooting/debugging.mdx +212 -0
- package/docs-site/zh/{quickstart.mdx → tutorials/quickstart.mdx} +5 -17
- package/package.json +10 -2
- package/src/agents/ai-sdk-otel.test.ts +1 -0
- package/src/agents/ai-sdk.test.ts +3 -0
- package/src/agents/ai-sdk.ts +3 -0
- package/src/agents/bub-install-spec.test.ts +34 -0
- package/src/agents/bub-install-spec.ts +32 -0
- package/src/agents/bub.ts +31 -32
- package/src/agents/claude-code.test.ts +130 -9
- package/src/agents/claude-code.ts +76 -4
- package/src/agents/codex.test.ts +189 -40
- package/src/agents/codex.ts +155 -14
- package/src/agents/coding-cli-versions.test.ts +15 -0
- package/src/agents/coding-cli-versions.ts +3 -0
- package/src/agents/index.ts +13 -2
- package/src/agents/langgraph.test.ts +204 -0
- package/src/agents/langgraph.ts +495 -0
- package/src/agents/marketplace.ts +85 -0
- package/src/agents/native-config.test.ts +179 -0
- package/src/agents/native-config.ts +267 -0
- package/src/agents/openai-compat.test.ts +1 -0
- package/src/agents/openai-compat.ts +1 -1
- package/src/agents/openclaw.test.ts +31 -0
- package/src/agents/openclaw.ts +171 -0
- package/src/agents/plugin-config.test.ts +1 -0
- package/src/agents/sdk-streams.test.ts +79 -0
- package/src/agents/sdk-streams.ts +55 -10
- package/src/agents/skills.test.ts +1 -0
- package/src/agents/streaming.test.ts +3 -9
- package/src/agents/streaming.ts +2 -2
- package/src/agents/types.ts +71 -8
- package/src/agents/ui-message-stream.test.ts +3 -0
- package/src/cli.ts +446 -124
- package/src/context/context.test.ts +51 -12
- package/src/context/context.ts +162 -30
- package/src/context/session.test.ts +2 -1
- package/src/context/session.ts +115 -7
- package/src/context/types.ts +30 -12
- package/src/define.test.ts +13 -8
- package/src/define.ts +25 -4
- package/src/expect/index.ts +53 -23
- package/src/i18n/en.ts +81 -17
- package/src/i18n/zh-CN.ts +80 -17
- package/src/o11y/cost.test.ts +1 -0
- package/src/o11y/execution-tree.test.ts +1 -20
- package/src/o11y/otlp/mappers/claude-code.test.ts +1 -0
- package/src/o11y/otlp/parse.test.ts +1 -0
- package/src/o11y/otlp/turn-otel.test.ts +1 -0
- package/src/o11y/parsers/bub.test.ts +1 -0
- package/src/o11y/parsers/claude-code.test.ts +1 -34
- package/src/o11y/parsers/openclaw.test.ts +154 -0
- package/src/o11y/parsers/openclaw.ts +310 -0
- package/src/o11y/prices.json +746 -311
- package/src/o11y/tool-names.test.ts +1 -0
- package/src/o11y/types.ts +16 -2
- package/src/report/aggregate.ts +178 -61
- package/src/report/built-in/index.tsx +9 -0
- package/src/report/components.tsx +625 -279
- package/src/report/compute.ts +723 -491
- package/src/report/dual-render.test.tsx +741 -1024
- package/src/report/flag.ts +104 -12
- package/src/report/format.ts +32 -12
- package/src/report/index.ts +119 -46
- package/src/report/load.ts +3 -2
- package/src/report/locale.ts +136 -65
- package/src/report/metrics.ts +108 -25
- package/src/report/primitives.tsx +196 -45
- package/src/report/react/AttemptList.tsx +30 -43
- package/src/report/react/DeltaTable.tsx +63 -45
- package/src/report/react/EvalList.tsx +0 -0
- package/src/report/react/ExperimentComparison.tsx +73 -0
- package/src/report/react/ExperimentList.tsx +50 -32
- package/src/report/react/MetricBars.tsx +5 -4
- package/src/report/react/MetricLine.tsx +13 -8
- package/src/report/react/MetricMatrix.tsx +2 -2
- package/src/report/react/MetricScatter.tsx +86 -34
- package/src/report/react/MetricTable.tsx +4 -76
- package/src/report/react/ScopeSummary.tsx +86 -0
- package/src/report/react/Scoreboard.tsx +28 -10
- package/src/report/react/cell.tsx +2 -2
- package/src/report/react/chart-math.test.ts +85 -0
- package/src/report/react/chart-math.ts +101 -22
- package/src/report/react/enhance.js +89 -5
- package/src/report/react/fixtures.ts +114 -154
- package/src/report/react/index.tsx +24 -39
- package/src/report/react/render.test.tsx +138 -158
- package/src/report/react/styles.css +243 -82
- package/src/report/report.test.ts +779 -841
- package/src/report/report.ts +423 -41
- package/src/report/text/faces.ts +290 -193
- package/src/report/text/plot.ts +1 -1
- package/src/report/text/table.ts +44 -7
- package/src/report/tree.ts +362 -104
- package/src/report/types.ts +261 -271
- package/src/report/web.ts +63 -20
- package/src/results/annotated-source.test.ts +62 -9
- package/src/results/annotated-source.ts +64 -6
- package/src/results/attempt-evidence.test.ts +13 -11
- package/src/results/attempt-evidence.ts +20 -13
- package/src/results/attempt-source.ts +6 -3
- package/src/results/copy.ts +150 -60
- package/src/results/host-equivalence.test.ts +34 -20
- package/src/results/index.ts +12 -4
- package/src/results/locator.test.ts +1 -22
- package/src/results/open.ts +15 -5
- package/src/results/publish.ts +149 -0
- package/src/results/results.test.ts +89 -54
- package/src/results/select.ts +104 -34
- package/src/results/truncate.ts +90 -0
- package/src/results/types.ts +43 -14
- package/src/results/writer.ts +31 -13
- package/src/runner/attempt.test.ts +138 -7
- package/src/runner/attempt.ts +603 -104
- package/src/runner/discover.test.ts +47 -0
- package/src/runner/discover.ts +36 -2
- package/src/runner/eval-source.test.ts +1 -27
- package/src/runner/feedback/agent.test.ts +504 -0
- package/src/runner/feedback/agent.ts +409 -0
- package/src/runner/feedback/ci.test.ts +562 -0
- package/src/runner/feedback/ci.ts +401 -0
- package/src/runner/feedback/coordinator.test.ts +317 -0
- package/src/runner/feedback/coordinator.ts +397 -0
- package/src/runner/feedback/failure.ts +40 -0
- package/src/runner/feedback/human.test.ts +616 -0
- package/src/runner/feedback/human.ts +535 -0
- package/src/runner/feedback/index.ts +66 -0
- package/src/runner/feedback/io.ts +78 -0
- package/src/runner/feedback/profile.test.ts +50 -0
- package/src/runner/feedback/profile.ts +58 -0
- package/src/runner/feedback/reducer.test.ts +395 -0
- package/src/runner/feedback/reducer.ts +260 -0
- package/src/runner/feedback/renderer.ts +82 -0
- package/src/runner/feedback/sink.ts +203 -0
- package/src/runner/feedback/testing.ts +106 -0
- package/src/runner/ledger.test.ts +230 -0
- package/src/runner/ledger.ts +329 -0
- package/src/runner/report.test.ts +128 -3
- package/src/runner/report.ts +33 -9
- package/src/runner/reporters/artifacts.ts +8 -2
- package/src/runner/reporters/braintrust.test.ts +8 -7
- package/src/runner/reporters/braintrust.ts +9 -2
- package/src/runner/reporters/index.ts +2 -2
- package/src/runner/reporters/json.test.ts +162 -0
- package/src/runner/reporters/json.ts +35 -8
- package/src/runner/reporters/shared.ts +1 -5
- package/src/runner/run.test.ts +760 -3
- package/src/runner/run.ts +243 -37
- package/src/runner/sandbox-prep.ts +3 -42
- package/src/runner/timing.ts +158 -0
- package/src/runner/types.ts +518 -22
- package/src/sandbox/checkpoint.test.ts +55 -0
- package/src/sandbox/checkpoint.ts +29 -8
- package/src/sandbox/cli-commands.ts +407 -0
- package/src/sandbox/docker.ts +115 -16
- package/src/sandbox/e2b-agent-template.test.ts +56 -0
- package/src/sandbox/e2b-agent-template.ts +94 -0
- package/src/sandbox/e2b.ts +74 -9
- package/src/sandbox/errors.ts +111 -4
- package/src/sandbox/index.ts +2 -0
- package/src/sandbox/io-retry.test.ts +58 -0
- package/src/sandbox/io-retry.ts +45 -0
- package/src/sandbox/keep-registry.test.ts +86 -0
- package/src/sandbox/keep-registry.ts +142 -0
- package/src/sandbox/keep.ts +178 -0
- package/src/sandbox/paths.test.ts +1 -0
- package/src/sandbox/paths.ts +19 -8
- package/src/sandbox/registry.ts +20 -3
- package/src/sandbox/resolve.ts +76 -11
- package/src/sandbox/retry.test.ts +70 -0
- package/src/sandbox/retry.ts +46 -4
- package/src/sandbox/types.ts +44 -6
- package/src/sandbox/vercel.ts +43 -20
- package/src/scoring/collector.ts +60 -17
- package/src/scoring/coverage.ts +95 -0
- package/src/scoring/diff.ts +81 -0
- package/src/scoring/display.test.ts +121 -0
- package/src/scoring/display.ts +133 -0
- package/src/scoring/evidence.test.ts +189 -0
- package/src/scoring/judge.test.ts +142 -0
- package/src/scoring/judge.ts +15 -18
- package/src/scoring/scoped.ts +217 -50
- package/src/scoring/types.ts +117 -20
- package/src/scoring/verdict.ts +16 -4
- package/src/shared/aggregate.ts +8 -6
- package/src/shared/types.ts +31 -0
- package/src/show/compose.ts +50 -67
- package/src/show/index.ts +127 -56
- package/src/show/render.ts +662 -131
- package/src/show/report-host.test.ts +188 -0
- package/src/show/report-host.ts +375 -0
- package/src/show/show.test.ts +320 -54
- package/src/tty-line.ts +8 -26
- package/src/util.test.ts +1 -0
- package/src/util.ts +41 -0
- package/src/view/app/App.test.tsx +69 -0
- package/src/view/app/App.tsx +144 -48
- package/src/view/app/components/AttemptModal.tsx +423 -11
- package/src/view/app/components/CodeView.tsx +41 -14
- package/src/view/app/components/CopyControls.tsx +2 -2
- package/src/view/app/i18n.ts +37 -17
- package/src/view/app/lib/attempt-route.test.ts +1 -0
- package/src/view/app/lib/verdict.ts +7 -9
- package/src/view/app/main.tsx +13 -8
- package/src/view/app/pages/{RunsPage.tsx → AttemptsPage.tsx} +6 -6
- package/src/view/app/types.ts +4 -1
- package/src/view/artifact-serving.test.ts +2 -1
- package/src/view/client-dist/app.css +1 -1
- package/src/view/client-dist/app.js +17 -17
- package/src/view/data.test.ts +10 -3
- package/src/view/data.ts +155 -49
- package/src/view/index.ts +56 -41
- package/src/view/server.ts +37 -15
- package/src/view/shared/types.ts +34 -5
- package/src/view/styles.css +227 -0
- package/src/view/view-report.test.ts +167 -62
- package/dist/report/built-ins/experiment-comparison.d.ts +0 -1
- package/dist/report/built-ins/experiment-comparison.js +0 -13
- package/dist/report/built-ins/index.d.ts +0 -1
- package/dist/report/built-ins/index.js +0 -2
- package/dist/report/react/GroupSummary.d.ts +0 -8
- package/dist/report/react/GroupSummary.js +0 -8
- package/dist/report/react/RunOverview.d.ts +0 -8
- package/dist/report/react/RunOverview.js +0 -12
- package/docs-site/zh/example/ai-agent-application.mdx +0 -152
- package/docs-site/zh/example/claude-code-codex-plugin.mdx +0 -167
- package/docs-site/zh/example/claude-code-codex-skill.mdx +0 -152
- package/docs-site/zh/example/showcase.mdx +0 -39
- package/docs-site/zh/guides/publish-report.mdx +0 -91
- package/docs-site/zh/guides/sandbox-providers.mdx +0 -102
- package/src/report/built-in-user-parity.test.tsx +0 -640
- package/src/report/built-ins/experiment-comparison.tsx +0 -19
- package/src/report/built-ins/index.ts +0 -2
- package/src/report/react/GroupSummary.tsx +0 -66
- package/src/report/react/RunOverview.tsx +0 -109
- package/src/runner/reporters/console.ts +0 -70
- package/src/runner/reporters/live.test.ts +0 -56
- package/src/runner/reporters/live.ts +0 -247
- package/src/runner/reporters/quiet.test.ts +0 -66
- package/src/runner/reporters/quiet.ts +0 -49
- package/src/runner/reporters/table.ts +0 -277
- /package/docs-site/zh/{example/tier1-ai-sdk-v7.mdx → examples/integrations/ai-sdk-v7.mdx} +0 -0
- /package/docs-site/zh/{example/tier1-claude-sdk.mdx → examples/integrations/claude-sdk.mdx} +0 -0
- /package/docs-site/zh/{example/tier1-codex-sdk.mdx → examples/integrations/codex-sdk.mdx} +0 -0
- /package/docs-site/zh/{example/tier1-langgraph.mdx → examples/integrations/langgraph.mdx} +0 -0
- /package/docs-site/zh/{example/tier1-pi-sdk.mdx → examples/integrations/pi-sdk.mdx} +0 -0
- /package/docs-site/zh/{guides → how-to}/fixtures.mdx +0 -0
package/src/report/types.ts
CHANGED
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
// niceeval/report 的公开类型:指标(Metric)、维度(Dimension / flag())
|
|
2
|
-
//
|
|
3
|
-
// 这些不是持久化格式,没有 format / schemaVersion 信封,兼容性跟随 npm
|
|
1
|
+
// niceeval/report 的公开类型:指标(Metric)、维度(Dimension / flag() / runConfig())与
|
|
2
|
+
// 计算函数产物(即组件的 data)。数据契约照 docs/feature/reports/library/ 各分篇;
|
|
3
|
+
// 这些不是持久化格式,没有 format / schemaVersion 信封,兼容性跟随 npm 版本
|
|
4
|
+
// (组件消费 data 时校验结构,不符按完整用户反馈报错并提示版本漂移)。
|
|
4
5
|
|
|
5
|
-
import type { AttemptHandle,
|
|
6
|
+
import type { AttemptHandle, Scope, ScopeWarning, Snapshot } from "../results/types.ts";
|
|
6
7
|
import type { AttemptLocator } from "../results/locator.ts";
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
8
|
+
import type { ExperimentRunInfo, JsonValue, Verdict } from "../types.ts";
|
|
9
|
+
import type { LocalizedText, ReportLocale } from "./locale.ts";
|
|
9
10
|
|
|
10
|
-
export type {
|
|
11
|
+
export type { ScopeWarning };
|
|
11
12
|
export type { AttemptLocator };
|
|
12
|
-
export type {
|
|
13
|
+
export type { LocalizedText, ReportLocale };
|
|
14
|
+
|
|
15
|
+
/** 所有官方计算函数的第一参:Scope(warnings 随行)或手工挑的快照数组(没有挑选过程,自然无警告)。 */
|
|
16
|
+
export type ReportInput = Scope | readonly Snapshot[];
|
|
13
17
|
|
|
14
18
|
// ───────────────────────── 指标与聚合 ─────────────────────────
|
|
15
19
|
|
|
16
20
|
/** 两级聚合里单级的折叠方式。 */
|
|
17
|
-
export type Aggregator = "mean" | "sum" | "min" | "max" | ((values: number[]) => number);
|
|
21
|
+
export type Aggregator = "mean" | "sum" | "min" | "max" | ((values: readonly number[]) => number);
|
|
18
22
|
|
|
19
23
|
/**
|
|
20
24
|
* 两级聚合:「每格 attempt 数相等」是幻觉(earlyExit 让失败的题天然比通过的题样本多),
|
|
21
25
|
* 平铺求均值会让分数和重试策略纠缠;所以先题内折叠、再跨题折叠,默认宏平均。
|
|
22
26
|
*/
|
|
23
27
|
export interface MetricAggregate {
|
|
24
|
-
/** 第一级:同一
|
|
28
|
+
/** 第一级:同一 experiment × eval 的多个 attempt 先折成题级值;默认 "mean"。 */
|
|
25
29
|
perEval?: Aggregator;
|
|
26
|
-
/**
|
|
27
|
-
|
|
30
|
+
/** 第二级:题级值再跨 experiment × eval 折成终值;默认 "mean"。 */
|
|
31
|
+
acrossEvals?: Aggregator;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
/**
|
|
31
35
|
* 指标:纯函数,吃一个 AttemptHandle 吐一个值(null = 此 attempt 测不了这个指标,
|
|
32
36
|
* 不进聚合;0 = 测了结果是零,照常进),外加名字、两级聚合方式和渲染提示。
|
|
33
37
|
* 内置指标与自定义指标是同一个类型,没有特权。name 走字面量泛型:列键锚在指标
|
|
34
|
-
* 对象上(`row.cells[
|
|
38
|
+
* 对象上(`row.cells[taskPassRate.name]`),拼错列名编译不过。
|
|
35
39
|
*/
|
|
36
40
|
export interface Metric<Name extends string = string> {
|
|
37
41
|
/** MetricColumn.key 与列头的来源;同一次计算里重名是错误。 */
|
|
38
42
|
name: Name;
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*/
|
|
43
|
-
label?: LocalizedLabel;
|
|
44
|
-
description?: string;
|
|
45
|
-
/** 渲染提示:越高越好还是越低越好(排序方向、轴向、涨跌配色用)。 */
|
|
46
|
-
better?: "higher" | "lower";
|
|
43
|
+
/** 列头;省略时用 name。渲染面按 locale 解析,缺项走 LocalizedText 回退规则。 */
|
|
44
|
+
label?: LocalizedText;
|
|
45
|
+
description?: LocalizedText;
|
|
47
46
|
/** 驱动内置格式化:"%" → 87%、"ms" → 1.2s、"$" → $0.31、其余 → 1.2k 缩写。 */
|
|
48
47
|
unit?: string;
|
|
48
|
+
/** 渲染提示:越高越好还是越低越好(排序方向、轴向、涨跌配色用)。 */
|
|
49
|
+
better?: "higher" | "lower";
|
|
49
50
|
/**
|
|
50
51
|
* 声明式前置:不满足 → null,语义等价于在 value 开头 return null。
|
|
51
52
|
* 单独设字段是因为这一步最容易忘(忘了它,code-golf 会奖励「写得短的坏代码」)。
|
|
@@ -53,49 +54,71 @@ export interface Metric<Name extends string = string> {
|
|
|
53
54
|
where?: (attempt: AttemptHandle) => boolean;
|
|
54
55
|
value(attempt: AttemptHandle): number | null | Promise<number | null>;
|
|
55
56
|
aggregate?: MetricAggregate;
|
|
56
|
-
/** 覆盖 unit
|
|
57
|
-
display?: (value: number) => string;
|
|
57
|
+
/** 覆盖 unit 驱动的内置格式化;只格式化同一个终值,不按 locale 分裂计算口径。 */
|
|
58
|
+
display?: (value: number, locale: ReportLocale) => string;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
// ─────────────────────────
|
|
61
|
+
// ───────────────────────── 维度与数值轴 ─────────────────────────
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
|
-
*
|
|
64
|
-
* - "evalGroup" = eval id
|
|
65
|
-
* - "snapshot" = "<experimentId> @ <startedAt>"
|
|
64
|
+
* 内置维度就是结果已有的身份字段。
|
|
65
|
+
* - "evalGroup" = eval id 的完整父路径("a/b/c" → "a/b";无 "/" 取完整 id,与可比组同一条派生规则)
|
|
66
|
+
* - "snapshot" = "<experimentId> @ <startedAt>",把两次快照并排成行
|
|
66
67
|
*/
|
|
67
|
-
export type
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
| { name: string; of: (attempt: AttemptHandle) => string };
|
|
68
|
+
export type BuiltInDimension = "agent" | "model" | "experiment" | "eval" | "evalGroup" | "snapshot";
|
|
69
|
+
|
|
70
|
+
/** 自定义维度:一个函数把 attempt 分到组。 */
|
|
71
|
+
export interface CustomDimension {
|
|
72
|
+
name: string;
|
|
73
|
+
of(attempt: AttemptHandle): string;
|
|
74
|
+
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
|
-
* flag() 的产物:把 experiment 声明的
|
|
78
|
-
*
|
|
79
|
-
*
|
|
77
|
+
* flag() / runConfig() 的产物:把 experiment 声明的 flag 或顶层运行配置当分组维度。
|
|
78
|
+
* 读取的 JSON 值可能是任意形状,分组显示键按稳定 JSON 规则生成;缺失值显示内置文案
|
|
79
|
+
* `(missing)`,不同原始值撞出同一显示键时计算报错并要求改用 CustomDimension。
|
|
80
80
|
*/
|
|
81
|
-
export interface
|
|
82
|
-
readonly kind: "flag";
|
|
81
|
+
export interface DimensionRef {
|
|
82
|
+
readonly kind: "flag" | "runConfig";
|
|
83
83
|
readonly name: string;
|
|
84
|
-
|
|
85
|
-
readonly label?: string | ((value: string | number | boolean) => string);
|
|
84
|
+
readonly label?: LocalizedText;
|
|
86
85
|
readonly unit?: string;
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
/**
|
|
90
|
-
export type DimensionInput =
|
|
88
|
+
/** 维度槽的输入:内置维度、自定义维度,或 flag() / runConfig() 的产物。 */
|
|
89
|
+
export type DimensionInput = BuiltInDimension | CustomDimension | DimensionRef;
|
|
90
|
+
|
|
91
|
+
/** MetricLine 的 x 轴:必须是数值;字符串配置显式映射,组件不猜 low < medium < high。 */
|
|
92
|
+
export interface NumericAxis {
|
|
93
|
+
name: string;
|
|
94
|
+
label?: LocalizedText;
|
|
95
|
+
unit?: string;
|
|
96
|
+
of(attempt: AttemptHandle): number | null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface DimensionOptions {
|
|
100
|
+
label?: LocalizedText;
|
|
101
|
+
unit?: string;
|
|
102
|
+
}
|
|
91
103
|
|
|
92
|
-
|
|
104
|
+
export interface NumericAxisOptions extends DimensionOptions {}
|
|
105
|
+
|
|
106
|
+
export interface NumericRunConfigAxisOptions extends NumericAxisOptions {
|
|
107
|
+
/** 字符串配置到数值轴的显式映射;数值配置不需要。 */
|
|
108
|
+
map?: Readonly<Record<string, number>>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** runConfig() 的可用键:ExperimentRunInfo 字段全集,外加桥接到快照顶层权威字段的 model / agent。 */
|
|
112
|
+
export type RunConfigKey = keyof ExperimentRunInfo | "model" | "agent";
|
|
113
|
+
|
|
114
|
+
// ───────────────────────── 计算产物(组件 data)─────────────────────────
|
|
93
115
|
|
|
94
116
|
export interface MetricColumn {
|
|
95
117
|
/** = metric.name,与 cells 的键对应。 */
|
|
96
118
|
key: string;
|
|
97
|
-
/** 数据层原样携带 metric.label(可本地化)
|
|
98
|
-
label:
|
|
119
|
+
/** 数据层原样携带 metric.label(可本地化);渲染面按 locale 解析。 */
|
|
120
|
+
label: LocalizedText;
|
|
121
|
+
description?: LocalizedText;
|
|
99
122
|
unit?: string;
|
|
100
123
|
/** 渲染提示:排序方向、轴向、涨跌配色。 */
|
|
101
124
|
better?: "higher" | "lower";
|
|
@@ -104,314 +127,281 @@ export interface MetricColumn {
|
|
|
104
127
|
export interface MetricCell {
|
|
105
128
|
/** 聚合后的值;null = 该组没有任何有效样本。 */
|
|
106
129
|
value: number | null;
|
|
107
|
-
/**
|
|
108
|
-
|
|
109
|
-
|
|
130
|
+
/**
|
|
131
|
+
* 已格式化的显示值;计算函数为官方生成面覆盖的每个 locale(当前 en、zh-CN)生成,
|
|
132
|
+
* renderer 按 LocalizedText 回退规则选择,其它 locale 回退 en。
|
|
133
|
+
*/
|
|
134
|
+
display: LocalizedText;
|
|
135
|
+
/** 有效 attempt 数(指标返回非 null 的 attempt)。 */
|
|
110
136
|
samples: number;
|
|
111
|
-
/**
|
|
137
|
+
/** 本格子覆盖的 attempt 总数,包含值为 null 的 attempt。 */
|
|
112
138
|
total: number;
|
|
113
139
|
/**
|
|
114
|
-
*
|
|
140
|
+
* 本格子覆盖的全部 attempt(包含指标值为 null 的证据)—— 回到证据的引用。必填(可空数组):
|
|
115
141
|
* 「每个数字点进去就是证据」是页面的核心承诺,可选字段会让深链静默缺失。
|
|
116
142
|
*/
|
|
117
143
|
refs: AttemptLocator[];
|
|
118
144
|
}
|
|
119
145
|
|
|
120
146
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* `lastRunAt` 则渲染成行键下的一行紧凑摘要——与 view 原生榜单同一份信息密度。
|
|
125
|
-
* `MetricTable` 只表达维度 × 指标,没有实体下钻——要展开到 experiment 的 Eval 或
|
|
126
|
-
* Eval 的 Attempt,用 `ExperimentList` / `EvalList`,这里不再有 `subRows`。
|
|
147
|
+
* 数据形状的字段命名规则(docs/feature/reports/library/metric-views.md「共用数据形状」):
|
|
148
|
+
* 维度名字段 = 产生它的选项名 + `Dimension` 后缀,值是解析后的维度 name;
|
|
149
|
+
* 条目数组一律叫 `rows`(Matrix 的稀疏格子叫 `cells`);条目内的 key / series 是维度值,不带后缀。
|
|
127
150
|
*/
|
|
128
|
-
export interface
|
|
129
|
-
|
|
130
|
-
model?: string;
|
|
131
|
-
/** eval 级折叠计票(foldEvalVerdict 口径,与 view 榜单同一套):每题折成单一判定后计数。 */
|
|
132
|
-
verdicts?: { passed: number; failed: number; errored: number; skipped: number };
|
|
133
|
-
/**
|
|
134
|
-
* `rows: "experiment"` 专属:这一行覆盖的 eval 数(去重后,summarizeItems 口径,与
|
|
135
|
-
* `verdicts` 四项之和一致)。其它行维度(agent/eval/自定义…)没有「这一行是几道题」的
|
|
136
|
-
* 独立语义(题本身就是行),不携带这个字段。
|
|
137
|
-
*/
|
|
138
|
-
evals?: number;
|
|
139
|
-
/**
|
|
140
|
-
* `rows: "experiment"` 专属:这一行覆盖的 attempt 总数(原始计数,含多轮重试)。
|
|
141
|
-
* 大于 `evals` 说明存在多轮重试(early-exit 复测 / flaky 重跑);等于 `evals` 说明
|
|
142
|
-
* 每题只跑了一轮。同上,只在 `rows: "experiment"` 时语义成立。
|
|
143
|
-
*/
|
|
144
|
-
attempts?: number;
|
|
145
|
-
/**
|
|
146
|
-
* `rows: "experiment"` 专属:这一行覆盖范围内快照 `startedAt` 的最大值(最近一次运行
|
|
147
|
-
* 时间,ISO 8601,字符串比较即可比大小)。组内没有任何 item 时缺席。
|
|
148
|
-
*/
|
|
149
|
-
lastRunAt?: string;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/** 列键 K 来自 columns 元组的字面量 name:拼错列名编译不过,不是运行时 undefined。 */
|
|
153
|
-
export interface TableData<K extends string = string> {
|
|
154
|
-
/** 行维度名,如 "agent"。 */
|
|
155
|
-
dimension: string;
|
|
151
|
+
export interface TableData {
|
|
152
|
+
rowDimension: string;
|
|
156
153
|
columns: MetricColumn[];
|
|
157
|
-
rows: {
|
|
154
|
+
rows: Array<{
|
|
155
|
+
key: string;
|
|
156
|
+
cells: Record<string, MetricCell>;
|
|
157
|
+
}>;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
export interface MatrixData {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
/** 列维度名,如 "agent"。 */
|
|
164
|
-
columns: string;
|
|
161
|
+
rowDimension: string;
|
|
162
|
+
columnDimension: string;
|
|
165
163
|
metric: MetricColumn;
|
|
166
|
-
/**
|
|
167
|
-
cells: { row: string; column: string; cell: MetricCell }
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export interface ScoreboardData {
|
|
171
|
-
/**
|
|
172
|
-
* 被打分的维度名,如 "agent"。
|
|
173
|
-
* (计算函数的维度槽叫 rows,与 MetricTable.data 统一;数据形状上行数组已占用
|
|
174
|
-
* rows 一词,维度名沿用 TableData 的 dimension。)
|
|
175
|
-
*/
|
|
176
|
-
dimension: string;
|
|
177
|
-
fullMarks: number;
|
|
178
|
-
/** 实际生效的权重表(按匹配顺序:最长前缀在前)—— 成绩单可审计。 */
|
|
179
|
-
weights: { prefix: string; weight: number }[];
|
|
180
|
-
rows: {
|
|
181
|
-
key: string;
|
|
182
|
-
/** 已折算到 fullMarks。 */
|
|
183
|
-
total: { value: number; display: string };
|
|
184
|
-
subjects: {
|
|
185
|
-
/** 科目(subjects 维度的值)。 */
|
|
186
|
-
key: string;
|
|
187
|
-
/** 加权得分。 */
|
|
188
|
-
earned: number;
|
|
189
|
-
/** 科目分值合计。 */
|
|
190
|
-
possible: number;
|
|
191
|
-
/** 题数。 */
|
|
192
|
-
evals: number;
|
|
193
|
-
/** 无任何样本、按 0 计的题数 —— 固定分母的如实注脚。 */
|
|
194
|
-
missing: number;
|
|
195
|
-
}[];
|
|
196
|
-
}[];
|
|
164
|
+
/** 稀疏格子:没有 attempt 的组合不生成格子。 */
|
|
165
|
+
cells: Array<{ row: string; column: string; cell: MetricCell }>;
|
|
197
166
|
}
|
|
198
167
|
|
|
199
168
|
export interface ScatterData {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
series?: string;
|
|
204
|
-
/** better: "lower" → 组件反向画轴,「好」的角落恒在右上。 */
|
|
169
|
+
pointDimension: string;
|
|
170
|
+
seriesDimension?: string;
|
|
171
|
+
/** 轴方向跟随 better:lower 反向渲染(值大在左/下),「更好」恒指向右上;刻度显示真实值。 */
|
|
205
172
|
x: MetricColumn;
|
|
206
173
|
y: MetricColumn;
|
|
207
|
-
rows: {
|
|
208
|
-
/** 点的键,如 "compare/bub-high"。 */
|
|
174
|
+
rows: Array<{
|
|
209
175
|
key: string;
|
|
210
|
-
/** 所属系列,如 "bub"。 */
|
|
211
176
|
series?: string;
|
|
212
177
|
x: MetricCell;
|
|
213
178
|
/** 任一为 null 的点组件不画,注脚如实报数(点仍留在 rows 里,可数)。 */
|
|
214
179
|
y: MetricCell;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/** MetricLine 的 x 轴:experiment 声明的 flag,数值驱动刻度。 */
|
|
219
|
-
export interface LineAxis {
|
|
220
|
-
/** flag 名。 */
|
|
221
|
-
key: string;
|
|
222
|
-
label: string;
|
|
223
|
-
unit?: string;
|
|
180
|
+
}>;
|
|
224
181
|
}
|
|
225
182
|
|
|
226
183
|
export interface LineData {
|
|
227
|
-
x:
|
|
228
|
-
|
|
229
|
-
series?: string;
|
|
184
|
+
x: { key: string; label: LocalizedText; unit?: string };
|
|
185
|
+
seriesDimension?: string;
|
|
230
186
|
y: MetricColumn;
|
|
231
|
-
rows: {
|
|
232
|
-
/**
|
|
187
|
+
rows: Array<{
|
|
188
|
+
/** 点身份 = (series, x):x 值的稳定十进制字符串,同一 series 内唯一。 */
|
|
233
189
|
key: string;
|
|
234
190
|
series?: string;
|
|
235
|
-
/** flag 声明值;未声明或非数值 → null,点不画、注脚报数。 */
|
|
236
191
|
x: number | null;
|
|
237
|
-
|
|
238
|
-
xDisplay: string;
|
|
192
|
+
xDisplay: LocalizedText;
|
|
239
193
|
y: MetricCell;
|
|
240
|
-
}
|
|
194
|
+
}>;
|
|
241
195
|
}
|
|
242
196
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
export interface OverviewData {
|
|
279
|
-
snapshots: { experimentId: string; agent: string; model?: string; startedAt: string }[];
|
|
280
|
-
totals: {
|
|
281
|
-
evals: number;
|
|
282
|
-
attempts: number;
|
|
283
|
-
/**
|
|
284
|
-
* 四个 attempt 原始判定计票(一个 attempt 一票),独立于 `passRate`:驱动页头的
|
|
285
|
-
* 判定计数展示,不是通过率公式的输入——不要从这四个数现场重算百分比。
|
|
286
|
-
*/
|
|
287
|
-
passed: number;
|
|
288
|
-
failed: number;
|
|
289
|
-
errored: number;
|
|
290
|
-
skipped: number;
|
|
291
|
-
/**
|
|
292
|
-
* 通过率的唯一官方口径:`computeCell(passRate, items)`,与 `MetricTable.data(...,
|
|
293
|
-
* columns: [passRate])` 同一台两级聚合引擎(题内折叠 perEval、跨题折叠 across,默认都是
|
|
294
|
-
* mean)——一道题内多个 attempt 部分通过,贡献的是小数份额而不是二元票。`samples`/`total`
|
|
295
|
-
* 是两级聚合口径下的 attempt 计数(`total` 含 skipped,`samples` 不含),不等于上面四个
|
|
296
|
-
* verdict 计票的任何一个之和。
|
|
297
|
-
*/
|
|
298
|
-
passRate: MetricCell;
|
|
299
|
-
/** 任一 attempt 报了成本才有;全缺 = null,不编 0。 */
|
|
300
|
-
costUSD: number | null;
|
|
301
|
-
durationMs: number;
|
|
302
|
-
};
|
|
303
|
-
/** Selection 的警告随行(结构化,含渲染好的 message),RunOverview 直接渲染。 */
|
|
304
|
-
warnings: SelectionWarning[];
|
|
197
|
+
export interface ScoreboardData {
|
|
198
|
+
rowDimension: string;
|
|
199
|
+
questions: string[];
|
|
200
|
+
fullMarks: number;
|
|
201
|
+
/** 实际生效的权重表(最长前缀在前)—— 成绩单可审计。 */
|
|
202
|
+
weights: Array<{ prefix: string; weight: number }>;
|
|
203
|
+
/** Scope 中存在但不在题集内、被忽略的 eval 数(注脚显示)。 */
|
|
204
|
+
ignoredEvals: number;
|
|
205
|
+
rows: Array<{
|
|
206
|
+
key: string;
|
|
207
|
+
total: {
|
|
208
|
+
/** fullMarks × earned / possible。 */
|
|
209
|
+
value: number;
|
|
210
|
+
display: LocalizedText;
|
|
211
|
+
/** 题集中该行完全没有 attempt 的题数(按 0 计,分开计数)。 */
|
|
212
|
+
notRun: number;
|
|
213
|
+
/** 有 attempt 但指标为 null(测不了)的题数(按 0 计,分开计数)。 */
|
|
214
|
+
unscorable: number;
|
|
215
|
+
refs: AttemptLocator[];
|
|
216
|
+
};
|
|
217
|
+
subjects: Array<{
|
|
218
|
+
key: string;
|
|
219
|
+
/** 加权后的 [0, 1] 题目分数之和。 */
|
|
220
|
+
earned: number;
|
|
221
|
+
/** 本分科题目的权重之和。 */
|
|
222
|
+
possible: number;
|
|
223
|
+
questions: number;
|
|
224
|
+
notRun: number;
|
|
225
|
+
unscorable: number;
|
|
226
|
+
display: LocalizedText;
|
|
227
|
+
refs: AttemptLocator[];
|
|
228
|
+
}>;
|
|
229
|
+
}>;
|
|
305
230
|
}
|
|
306
231
|
|
|
307
|
-
export interface DeltaData
|
|
232
|
+
export interface DeltaData {
|
|
233
|
+
byDimension: string;
|
|
308
234
|
columns: MetricColumn[];
|
|
309
|
-
|
|
310
|
-
|
|
235
|
+
/** FlagPairs 派生形态下的配对域实验数;字面 pairs 不携带(空态文案用)。 */
|
|
236
|
+
experiments?: number;
|
|
237
|
+
rows: Array<{
|
|
311
238
|
key: string;
|
|
312
|
-
/**
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
b: {
|
|
239
|
+
/** 作者在 DeltaPair 里声明(或派生规则生成)的 label,原样透传;renderer 据此显示行名。 */
|
|
240
|
+
label: LocalizedText;
|
|
241
|
+
a: { key: string };
|
|
242
|
+
b: { key: string };
|
|
316
243
|
cells: Record<
|
|
317
|
-
|
|
244
|
+
string,
|
|
318
245
|
{
|
|
319
246
|
a: MetricCell;
|
|
320
247
|
b: MetricCell;
|
|
321
|
-
/** b.value - a.value
|
|
248
|
+
/** b.value - a.value;任一侧缺失则为 null。 */
|
|
322
249
|
delta: number | null;
|
|
323
|
-
|
|
324
|
-
|
|
250
|
+
display: LocalizedText;
|
|
251
|
+
outcome: "improved" | "regressed" | "unchanged" | "unavailable";
|
|
325
252
|
}
|
|
326
253
|
>;
|
|
327
|
-
}
|
|
254
|
+
}>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export interface DeltaPair {
|
|
258
|
+
label: LocalizedText;
|
|
259
|
+
a: string;
|
|
260
|
+
b: string;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/** pairsByFlag() 的产物:按一个 flag 机械导出全部 A/B 对;只在 by 为 "experiment" 时成立。 */
|
|
264
|
+
export interface FlagPairs {
|
|
265
|
+
readonly kind: "flagPairs";
|
|
266
|
+
readonly flag: string;
|
|
267
|
+
/** a 侧的 flag 取值;缺省表示「未声明该 flag」的实验作 a。 */
|
|
268
|
+
readonly baseline?: JsonValue;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// ───────────────────────── 概览(ScopeSummary / ExperimentComparison)─────────────────────────
|
|
272
|
+
|
|
273
|
+
export interface VerdictTally {
|
|
274
|
+
passed: number;
|
|
275
|
+
failed: number;
|
|
276
|
+
errored: number;
|
|
277
|
+
skipped: number;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* 一个范围的摘要:快照时间窗、experiment / eval / attempt 数、两级判定计票、端到端成功率
|
|
282
|
+
* 和总成本。eval 的身份键是 experimentId + evalId;data 恒携带两级计票,渲染面显示哪一级
|
|
283
|
+
* 由呈现 prop `votes` 决定,不改变 data(docs/feature/reports/library/summaries.md)。
|
|
284
|
+
*/
|
|
285
|
+
export interface ScopeSummaryData {
|
|
286
|
+
/** 贡献当前数据的快照时间范围;空范围为 null,不编造当前时间。 */
|
|
287
|
+
range: { earliestStartedAt: string | null; latestStartedAt: string | null };
|
|
288
|
+
experiments: number;
|
|
289
|
+
/** experimentId + evalId 的去重计数,与 evalVerdicts 同分母。 */
|
|
290
|
+
evals: number;
|
|
291
|
+
attempts: number;
|
|
292
|
+
/** 每个 experimentId + evalId 先折成最终 verdict 后计票。 */
|
|
293
|
+
evalVerdicts: VerdictTally;
|
|
294
|
+
/** attempt 原始计票,不折叠。 */
|
|
295
|
+
attemptVerdicts: VerdictTally;
|
|
296
|
+
/** 官方两级 endToEndPassRate,不从任一计票重算。 */
|
|
297
|
+
endToEndPassRate: MetricCell;
|
|
298
|
+
/** costUSD 按 attempt 求和;缺失成本不伪造为 0。 */
|
|
299
|
+
totalCostUSD: MetricCell;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/** 一个可比组的数据;三个子块都只消费本组快照,不能含其它父目录的引用。 */
|
|
303
|
+
export interface ExperimentComparisonGroupData {
|
|
304
|
+
/** experiment id 的完整父路径;根目录 experiment 使用完整 id。 */
|
|
305
|
+
key: string;
|
|
306
|
+
summary: ScopeSummaryData;
|
|
307
|
+
scatter: ScatterData;
|
|
308
|
+
experiments: ExperimentListItem[];
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export interface ExperimentComparisonData {
|
|
312
|
+
groups: ExperimentComparisonGroupData[];
|
|
328
313
|
}
|
|
329
314
|
|
|
330
315
|
// ───────────────────────── 实体列表(ExperimentList / EvalList / AttemptList)─────────────────────────
|
|
331
316
|
//
|
|
332
317
|
// 三个组件按「experiment → experimentId × eval → attempt」逐级下钻,固定展示实体事实,
|
|
333
|
-
//
|
|
334
|
-
//
|
|
335
|
-
// `EvalListItem.attempts` 的元素,报告作者可以直接把这些嵌套数组喂给 `<AttemptList items={...} />`。
|
|
318
|
+
// 没有列配置。每一级都以下一级的 `AttemptListItem[]` 收尾——同一个类型既是 `AttemptList`
|
|
319
|
+
// 自己的 data,也是 `ExperimentListEvalRow.attempts` / `EvalListItem.attempts` 的元素。
|
|
336
320
|
|
|
337
321
|
/**
|
|
338
|
-
* `AttemptList` 一项 =
|
|
339
|
-
*
|
|
322
|
+
* `AttemptList` 一项 = 一次 attempt:身份、判定、算好的单行结果摘要与证据引用。
|
|
323
|
+
* 完整 assertions、Judge evidence、diagnostics、cause 与 stack 不进列表 data;
|
|
324
|
+
* 需要完整结构时经 locator 回读取面(resolveLocator → AttemptHandle)。
|
|
340
325
|
*/
|
|
341
326
|
export interface AttemptListItem {
|
|
342
|
-
evalId: string;
|
|
343
327
|
experimentId: string;
|
|
328
|
+
evalId: string;
|
|
344
329
|
attempt: number;
|
|
345
330
|
agent: string;
|
|
346
331
|
verdict: Verdict;
|
|
347
|
-
|
|
348
|
-
|
|
332
|
+
/**
|
|
333
|
+
* 该轮的单行结果摘要,已按 Scoring display 契约折好:failed 取主失败断言摘要,
|
|
334
|
+
* errored 取结构化 error 的一层摘要(phase · code · message),passed / skipped 为 null。
|
|
335
|
+
* 渲染面只做宽度截断,不重算摘要。
|
|
336
|
+
*/
|
|
337
|
+
failureSummary: string | null;
|
|
338
|
+
/** 主失败之外还有几条失败断言("+N more failures" 的 N);无失败为 0。 */
|
|
339
|
+
moreFailures: number;
|
|
340
|
+
/** 当前 attempt 的 examScore 与证据引用。 */
|
|
341
|
+
examScore: MetricCell;
|
|
349
342
|
durationMs: number;
|
|
350
|
-
|
|
343
|
+
/** 缺失为 null(测不了),不伪造 0;attempt 级条目的缺失一律用 null,不用省略字段。 */
|
|
344
|
+
costUSD: number | null;
|
|
351
345
|
locator: AttemptLocator;
|
|
352
346
|
}
|
|
353
347
|
|
|
354
348
|
/**
|
|
355
|
-
* `
|
|
356
|
-
*
|
|
357
|
-
* 该 Eval 内 attempt 的平均耗时/成本(两级聚合引擎在单一 eval 上退化成组内均值),以及这道题
|
|
358
|
-
* 的全部 Attempt(升序,供进一步展开到 `AttemptList`)。
|
|
349
|
+
* `EvalList` 一项 = 一个 `experimentId + evalId`(同一个 Eval 跑在两个 experiment 上是
|
|
350
|
+
* 两条不同结果,不合并)。失败原因只存在于各 AttemptListItem,不在 Eval 父项重复一份。
|
|
359
351
|
*/
|
|
352
|
+
export interface EvalListItem {
|
|
353
|
+
experimentId: string;
|
|
354
|
+
evalId: string;
|
|
355
|
+
/** 任一轮 passed 即 passed,否则 failed > errored > skipped。 */
|
|
356
|
+
verdict: Verdict;
|
|
357
|
+
examScore: MetricCell;
|
|
358
|
+
durationMs: MetricCell;
|
|
359
|
+
costUSD: MetricCell;
|
|
360
|
+
attempts: AttemptListItem[];
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** `ExperimentList` 一项里,一个 Eval 的展开行。 */
|
|
360
364
|
export interface ExperimentListEvalRow {
|
|
361
365
|
evalId: string;
|
|
362
|
-
/** 折叠判定(任一 attempt 通过则通过,否则取最严重的)。 */
|
|
363
366
|
verdict: Verdict;
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
duration: MetricCell;
|
|
367
|
-
/** 这道题内 attempt 的平均成本。 */
|
|
368
|
-
cost: MetricCell;
|
|
369
|
-
/** 这道题的全部 Attempt,按 attempt 序号升序。 */
|
|
367
|
+
durationMs: MetricCell;
|
|
368
|
+
costUSD: MetricCell;
|
|
370
369
|
attempts: AttemptListItem[];
|
|
371
370
|
}
|
|
372
371
|
|
|
373
372
|
/**
|
|
374
|
-
* `
|
|
375
|
-
* 声明的 flags、
|
|
376
|
-
*
|
|
377
|
-
*
|
|
373
|
+
* `experimentListData` 的一项 = 一个 experiment:身份(experimentId/agent/model)、
|
|
374
|
+
* 声明的 flags、eval 级最终 verdict 计票、官方两级聚合汇总指标,以及展开到每道 Eval 的
|
|
375
|
+
* `evalRows`(按 eval id 升序)。一行只有一套 agent / model / flags 是输入约束:
|
|
376
|
+
* 同一 experiment 混入不一致可比性配置时计算按完整用户反馈失败。
|
|
378
377
|
*/
|
|
379
378
|
export interface ExperimentListItem {
|
|
380
379
|
experimentId: string;
|
|
381
380
|
agent: string;
|
|
382
381
|
model?: string;
|
|
383
|
-
flags?: Record<string,
|
|
384
|
-
/** eval
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
duration: MetricCell;
|
|
382
|
+
flags?: Record<string, JsonValue>;
|
|
383
|
+
/** eval 级最终 verdict 计票(Result 列的构成)。 */
|
|
384
|
+
evalVerdicts: VerdictTally;
|
|
385
|
+
endToEndPassRate: MetricCell;
|
|
386
|
+
costUSD: MetricCell;
|
|
387
|
+
durationMs: MetricCell;
|
|
390
388
|
tokens: MetricCell;
|
|
391
|
-
/** 这个 experiment 覆盖的 eval 数(去重后,与
|
|
389
|
+
/** 这个 experiment 覆盖的 eval 数(去重后,与 evalVerdicts 四项之和一致)。 */
|
|
392
390
|
evals: number;
|
|
393
391
|
/** 这个 experiment 覆盖的 attempt 总数(原始计数,含多轮重试)。 */
|
|
394
392
|
attempts: number;
|
|
395
393
|
/** 所含快照中最近的 startedAt。 */
|
|
396
394
|
lastRunAt: string;
|
|
397
|
-
/** 展开到这个 experiment 的 Eval,按 eval id 升序。 */
|
|
398
395
|
evalRows: ExperimentListEvalRow[];
|
|
399
396
|
}
|
|
400
397
|
|
|
401
|
-
/**
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
verdict: Verdict;
|
|
411
|
-
reason?: string;
|
|
412
|
-
/** examScore 的两级聚合;单一 eval 分组下即这道题的题级分数。 */
|
|
413
|
-
score: MetricCell;
|
|
414
|
-
duration: MetricCell;
|
|
415
|
-
cost: MetricCell;
|
|
416
|
-
attempts: AttemptListItem[];
|
|
398
|
+
/** 三个实体列表共用的计算选项。 */
|
|
399
|
+
export interface EntityListDataOptions {
|
|
400
|
+
/**
|
|
401
|
+
* 展示层遮蔽:只改写这次组件数据中的自由文本——条目本身与任何嵌套 attempt 条目的
|
|
402
|
+
* `failureSummary`;身份与分类字段(experimentId、evalId、locator、数值指标)不经它。
|
|
403
|
+
* 只作用于这次计算产出的组件数据,不改盘上或任何导出目录里的 artifact;
|
|
404
|
+
* 发布 artifact 的脱敏用 copySnapshots({ redact })。
|
|
405
|
+
*/
|
|
406
|
+
redact?: (text: string) => string;
|
|
417
407
|
}
|