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/dist/report/flag.d.ts
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { AttemptHandle } from "../results/types.ts";
|
|
2
|
+
import type { DimensionOptions, DimensionRef, NumericAxis, NumericAxisOptions, NumericRunConfigAxisOptions, RunConfigKey } from "./types.ts";
|
|
3
|
+
/** experiment 声明的 flags(快照级投影优先;第三方落盘只拼在条目上时回退 result.experiment)。 */
|
|
4
|
+
export declare function flagValueOf(attempt: AttemptHandle, name: string): unknown;
|
|
5
|
+
/**
|
|
6
|
+
* runConfig() 的取值:读快照的 `ExperimentRunInfo` 投影,外加桥接到快照顶层权威字段的
|
|
7
|
+
* `model` / `agent` 两个键(与 "model" / "agent" 内置维度同一读法,不另造第二套口径)。
|
|
8
|
+
* 未投影 → undefined。
|
|
9
|
+
*/
|
|
10
|
+
export declare function runConfigValueOf(attempt: AttemptHandle, name: RunConfigKey): unknown;
|
|
11
|
+
/**
|
|
12
|
+
* 把 experiment 声明的一个 flag 当分组维度(rows / columns / points / series / by 槽)。
|
|
13
|
+
* 分组显示键按稳定 JSON 规则生成(字符串直接显示,其它值用键递归排序后的 JSON),
|
|
14
|
+
* 缺失值显示内置文案 `(missing)`;显示键冲突时计算报错并要求改用 CustomDimension。
|
|
15
|
+
*/
|
|
16
|
+
export declare function flag(name: string, options?: DimensionOptions): DimensionRef;
|
|
17
|
+
/**
|
|
18
|
+
* 把一项顶层运行配置当分组维度,与 {@link flag} 同一套用法。读快照的 `ExperimentRunInfo`
|
|
19
|
+
* 投影;可用键由 RunConfigKey 在类型层穷尽(那张接口的字段全集,外加桥接到快照顶层权威
|
|
20
|
+
* 字段的 `model` / `agent`),拼错键在编译期就被拒绝。
|
|
21
|
+
*/
|
|
22
|
+
export declare function runConfig(name: RunConfigKey, options?: DimensionOptions): DimensionRef;
|
|
23
|
+
/**
|
|
24
|
+
* MetricLine 的 x 轴:只接受落盘值为 number 的 flag。未声明或非数值的 attempt 返回 null
|
|
25
|
+
* (折线不绘该点并报告缺失),不猜 `low < medium < high`。
|
|
26
|
+
*/
|
|
27
|
+
export declare function numericFlag(name: string, options?: NumericAxisOptions): NumericAxis;
|
|
28
|
+
/**
|
|
29
|
+
* 顶层运行配置作数值轴:数值配置直接返回该值;字符串配置必须显式给 `map`
|
|
30
|
+
* (如 { low: 1, medium: 2, high: 3 })。未声明、未投影、非数值或未命中 map 的值返回 null。
|
|
31
|
+
*/
|
|
32
|
+
export declare function numericRunConfig(name: RunConfigKey, options?: NumericRunConfigAxisOptions): NumericAxis;
|
package/dist/report/flag.js
CHANGED
|
@@ -1,8 +1,96 @@
|
|
|
1
|
-
// flag()
|
|
1
|
+
// flag() / runConfig() / numericFlag() / numericRunConfig():把 experiment 声明的变量当
|
|
2
|
+
// 分组维度或数值轴(docs/feature/reports/library/metrics.md「维度与数值轴」)。
|
|
2
3
|
// 变量来自配置,不来自命名 —— 报告不解析 experiment id 字符串抠变量。
|
|
3
|
-
|
|
4
|
+
// flag() 只读 `ExperimentDef.flags` 里显式声明的 KV;model / reasoningEffort / budget / runs
|
|
5
|
+
// 这类顶层运行配置不在 flags 里,用 runConfig() 读快照的 ExperimentRunInfo 投影。
|
|
6
|
+
/** experiment 声明的 flags(快照级投影优先;第三方落盘只拼在条目上时回退 result.experiment)。 */
|
|
7
|
+
export function flagValueOf(attempt, name) {
|
|
8
|
+
const info = attempt.snapshot?.experiment ?? attempt.result.experiment;
|
|
9
|
+
return info?.flags?.[name];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* runConfig() 的取值:读快照的 `ExperimentRunInfo` 投影,外加桥接到快照顶层权威字段的
|
|
13
|
+
* `model` / `agent` 两个键(与 "model" / "agent" 内置维度同一读法,不另造第二套口径)。
|
|
14
|
+
* 未投影 → undefined。
|
|
15
|
+
*/
|
|
16
|
+
export function runConfigValueOf(attempt, name) {
|
|
17
|
+
if (name === "model")
|
|
18
|
+
return attempt.result.model ?? attempt.snapshot?.model;
|
|
19
|
+
if (name === "agent")
|
|
20
|
+
return attempt.result.agent || attempt.snapshot?.agent;
|
|
21
|
+
const info = attempt.snapshot?.experiment ?? attempt.result.experiment;
|
|
22
|
+
// ExperimentRunInfo 是穷尽可序列化投影;按字段名取值,新增投影字段无需改这里
|
|
23
|
+
return info?.[name];
|
|
24
|
+
}
|
|
25
|
+
function assertName(name, fn, hint) {
|
|
4
26
|
if (typeof name !== "string" || name.length === 0) {
|
|
5
|
-
throw new Error(
|
|
27
|
+
throw new Error(`${fn}: name must be a non-empty string (${hint}).`);
|
|
6
28
|
}
|
|
7
|
-
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 把 experiment 声明的一个 flag 当分组维度(rows / columns / points / series / by 槽)。
|
|
32
|
+
* 分组显示键按稳定 JSON 规则生成(字符串直接显示,其它值用键递归排序后的 JSON),
|
|
33
|
+
* 缺失值显示内置文案 `(missing)`;显示键冲突时计算报错并要求改用 CustomDimension。
|
|
34
|
+
*/
|
|
35
|
+
export function flag(name, options) {
|
|
36
|
+
assertName(name, "flag", "the key declared in the experiment's flags");
|
|
37
|
+
return {
|
|
38
|
+
kind: "flag",
|
|
39
|
+
name,
|
|
40
|
+
...(options?.label !== undefined ? { label: options.label } : {}),
|
|
41
|
+
...(options?.unit !== undefined ? { unit: options.unit } : {}),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 把一项顶层运行配置当分组维度,与 {@link flag} 同一套用法。读快照的 `ExperimentRunInfo`
|
|
46
|
+
* 投影;可用键由 RunConfigKey 在类型层穷尽(那张接口的字段全集,外加桥接到快照顶层权威
|
|
47
|
+
* 字段的 `model` / `agent`),拼错键在编译期就被拒绝。
|
|
48
|
+
*/
|
|
49
|
+
export function runConfig(name, options) {
|
|
50
|
+
assertName(name, "runConfig", 'an ExperimentRunInfo field, or the bridged "model" / "agent" keys');
|
|
51
|
+
return {
|
|
52
|
+
kind: "runConfig",
|
|
53
|
+
name,
|
|
54
|
+
...(options?.label !== undefined ? { label: options.label } : {}),
|
|
55
|
+
...(options?.unit !== undefined ? { unit: options.unit } : {}),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* MetricLine 的 x 轴:只接受落盘值为 number 的 flag。未声明或非数值的 attempt 返回 null
|
|
60
|
+
* (折线不绘该点并报告缺失),不猜 `low < medium < high`。
|
|
61
|
+
*/
|
|
62
|
+
export function numericFlag(name, options) {
|
|
63
|
+
assertName(name, "numericFlag", "the key declared in the experiment's flags");
|
|
64
|
+
return {
|
|
65
|
+
name,
|
|
66
|
+
...(options?.label !== undefined ? { label: options.label } : {}),
|
|
67
|
+
...(options?.unit !== undefined ? { unit: options.unit } : {}),
|
|
68
|
+
of(attempt) {
|
|
69
|
+
const value = flagValueOf(attempt, name);
|
|
70
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 顶层运行配置作数值轴:数值配置直接返回该值;字符串配置必须显式给 `map`
|
|
76
|
+
* (如 { low: 1, medium: 2, high: 3 })。未声明、未投影、非数值或未命中 map 的值返回 null。
|
|
77
|
+
*/
|
|
78
|
+
export function numericRunConfig(name, options) {
|
|
79
|
+
assertName(name, "numericRunConfig", 'an ExperimentRunInfo field, or the bridged "model" / "agent" keys');
|
|
80
|
+
const map = options?.map;
|
|
81
|
+
return {
|
|
82
|
+
name,
|
|
83
|
+
...(options?.label !== undefined ? { label: options.label } : {}),
|
|
84
|
+
...(options?.unit !== undefined ? { unit: options.unit } : {}),
|
|
85
|
+
of(attempt) {
|
|
86
|
+
const value = runConfigValueOf(attempt, name);
|
|
87
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
88
|
+
return value;
|
|
89
|
+
if (typeof value === "string" && map !== undefined) {
|
|
90
|
+
const mapped = map[value];
|
|
91
|
+
return typeof mapped === "number" && Number.isFinite(mapped) ? mapped : null;
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
},
|
|
95
|
+
};
|
|
8
96
|
}
|
package/dist/report/format.d.ts
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Verdict } from "../types.ts";
|
|
2
|
+
import { type LocalizedText, type ReportLocale } from "./locale.ts";
|
|
3
|
+
/**
|
|
4
|
+
* experiment 行的显示名:给了父路径 `relativeTo` 且它确是前缀,就去掉 `relativeTo + "/"`,
|
|
5
|
+
* 只留 id 末段——用在已经以组为标题的上下文(如默认 `ExperimentComparison` 的每组面板)里,
|
|
6
|
+
* 避免每行重复文件夹名。组键就是 experiment id 的父目录,因此这里的末段与 `MetricScatter`
|
|
7
|
+
* 点标签取的末段同源。不给 `relativeTo`、或它不是前缀(如根目录单例组)时原样返回完整 id。
|
|
8
|
+
* 完整 id 仍是排序 / 着色 / 折叠的键,调用方不要拿这个显示名当身份用。
|
|
9
|
+
*/
|
|
10
|
+
export declare function experimentDisplayName(experimentId: string, relativeTo?: string): string;
|
|
2
11
|
export declare function formatMetricValue(value: number, unit?: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* MetricCell.display 的生成:为官方生成面覆盖的每个 locale(DISPLAY_LOCALES)各生成一份;
|
|
14
|
+
* 全部相同(内置 unit 格式化都是 locale 无关的)时折叠成单个字符串,renderer 按
|
|
15
|
+
* LocalizedText 回退规则选择。`make` 抛错由调用方(computeCell)带 metric 上下文包装。
|
|
16
|
+
*/
|
|
17
|
+
export declare function localizedDisplay(make: (locale: ReportLocale) => string): LocalizedText;
|
|
3
18
|
/** 无单位纯数字(scoreboard 总分等):一位小数,去尾零。 */
|
|
4
19
|
export declare function formatPlainNumber(value: number): string;
|
|
5
20
|
/** 全 null / 无样本的统一文案。绝不画 0(docs/feature/reports/architecture.md「指标聚合不变量」)。 */
|
|
@@ -13,14 +28,7 @@ export declare function formatPercent(ratio: number): string;
|
|
|
13
28
|
/** passed / failed / errored / skipped 的判定符。 */
|
|
14
29
|
export declare function verdictMark(verdict: Verdict): string;
|
|
15
30
|
/**
|
|
16
|
-
*
|
|
17
|
-
* (
|
|
18
|
-
* compute.ts 的 `reasonFor(EvalResult)` 同一口径,只是输入换成瘦身后的 AttemptListItem——
|
|
19
|
-
* 没有 `skipReason` 字段(AttemptListItem 不携带),skipped 的 attempt 因此没有原因摘要,
|
|
20
|
-
* 这与它们本来就不该出现在「为什么失败」列表里的事实一致。EvalList / ExperimentList 的
|
|
21
|
-
* 逐 attempt 徽标行用它给每个 attempt 自己的原因(而不是复用整道题的代表原因)。
|
|
31
|
+
* `AttemptListItem.failureSummary` 的宽度收口:摘要已在计算侧按 Scoring display 契约折好,
|
|
32
|
+
* 渲染面只做尾截,不重算摘要。maxChars 是渲染面的宽度预算(如两行单元格 = 2 × 列宽)。
|
|
22
33
|
*/
|
|
23
|
-
export declare function
|
|
24
|
-
error?: string;
|
|
25
|
-
assertions: AssertionResult[];
|
|
26
|
-
}): string | undefined;
|
|
34
|
+
export declare function fitFailureSummary(summary: string, maxChars: number): string;
|
package/dist/report/format.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
// unit 驱动的内置格式化(docs/feature/reports/library.md「指标」):
|
|
2
2
|
// "%" → 87% "ms" → 1.2s "$" → $0.31 其余 → 1.2k 缩写(带 unit 后缀)
|
|
3
3
|
// metric.display 可整体覆盖;这里只负责默认。
|
|
4
|
+
import { DISPLAY_LOCALES } from "./locale.js";
|
|
5
|
+
/**
|
|
6
|
+
* experiment 行的显示名:给了父路径 `relativeTo` 且它确是前缀,就去掉 `relativeTo + "/"`,
|
|
7
|
+
* 只留 id 末段——用在已经以组为标题的上下文(如默认 `ExperimentComparison` 的每组面板)里,
|
|
8
|
+
* 避免每行重复文件夹名。组键就是 experiment id 的父目录,因此这里的末段与 `MetricScatter`
|
|
9
|
+
* 点标签取的末段同源。不给 `relativeTo`、或它不是前缀(如根目录单例组)时原样返回完整 id。
|
|
10
|
+
* 完整 id 仍是排序 / 着色 / 折叠的键,调用方不要拿这个显示名当身份用。
|
|
11
|
+
*/
|
|
12
|
+
export function experimentDisplayName(experimentId, relativeTo) {
|
|
13
|
+
if (relativeTo && experimentId.startsWith(`${relativeTo}/`)) {
|
|
14
|
+
return experimentId.slice(relativeTo.length + 1);
|
|
15
|
+
}
|
|
16
|
+
return experimentId;
|
|
17
|
+
}
|
|
4
18
|
/** 一位小数、去掉无意义的 ".0" 尾巴。 */
|
|
5
19
|
function trimmed(n) {
|
|
6
20
|
const s = n.toFixed(1);
|
|
@@ -44,6 +58,18 @@ export function formatMetricValue(value, unit) {
|
|
|
44
58
|
const n = abbreviate(abs);
|
|
45
59
|
return unit ? `${sign}${n} ${unit}` : `${sign}${n}`;
|
|
46
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* MetricCell.display 的生成:为官方生成面覆盖的每个 locale(DISPLAY_LOCALES)各生成一份;
|
|
63
|
+
* 全部相同(内置 unit 格式化都是 locale 无关的)时折叠成单个字符串,renderer 按
|
|
64
|
+
* LocalizedText 回退规则选择。`make` 抛错由调用方(computeCell)带 metric 上下文包装。
|
|
65
|
+
*/
|
|
66
|
+
export function localizedDisplay(make) {
|
|
67
|
+
const entries = DISPLAY_LOCALES.map((locale) => [locale, make(locale)]);
|
|
68
|
+
const first = entries[0][1];
|
|
69
|
+
if (entries.every(([, text]) => text === first))
|
|
70
|
+
return first;
|
|
71
|
+
return Object.fromEntries(entries);
|
|
72
|
+
}
|
|
47
73
|
/** 无单位纯数字(scoreboard 总分等):一位小数,去尾零。 */
|
|
48
74
|
export function formatPlainNumber(value) {
|
|
49
75
|
const sign = value < 0 ? "-" : "";
|
|
@@ -92,18 +118,9 @@ export function verdictMark(verdict) {
|
|
|
92
118
|
}
|
|
93
119
|
}
|
|
94
120
|
/**
|
|
95
|
-
*
|
|
96
|
-
* (
|
|
97
|
-
* compute.ts 的 `reasonFor(EvalResult)` 同一口径,只是输入换成瘦身后的 AttemptListItem——
|
|
98
|
-
* 没有 `skipReason` 字段(AttemptListItem 不携带),skipped 的 attempt 因此没有原因摘要,
|
|
99
|
-
* 这与它们本来就不该出现在「为什么失败」列表里的事实一致。EvalList / ExperimentList 的
|
|
100
|
-
* 逐 attempt 徽标行用它给每个 attempt 自己的原因(而不是复用整道题的代表原因)。
|
|
121
|
+
* `AttemptListItem.failureSummary` 的宽度收口:摘要已在计算侧按 Scoring display 契约折好,
|
|
122
|
+
* 渲染面只做尾截,不重算摘要。maxChars 是渲染面的宽度预算(如两行单元格 = 2 × 列宽)。
|
|
101
123
|
*/
|
|
102
|
-
export function
|
|
103
|
-
|
|
104
|
-
return item.error;
|
|
105
|
-
const gates = item.assertions.filter((a) => !a.passed && a.severity === "gate");
|
|
106
|
-
if (gates.length === 0)
|
|
107
|
-
return undefined;
|
|
108
|
-
return gates.map((a) => (a.detail ? `${a.name}: ${a.detail}` : a.name)).join(", ");
|
|
124
|
+
export function fitFailureSummary(summary, maxChars) {
|
|
125
|
+
return summary.length <= maxChars ? summary : `${summary.slice(0, Math.max(0, maxChars - 1))}…`;
|
|
109
126
|
}
|
package/dist/report/index.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export { defineMetric,
|
|
2
|
-
export { flag } from "./flag.ts";
|
|
3
|
-
export { defineReport, isReportDefinition, renderReportToText } from "./report.ts";
|
|
4
|
-
export type {
|
|
5
|
-
export { defineComponent } from "./tree.ts";
|
|
6
|
-
export type { ComponentFaces, ReportComponent, ReportElement, ReportNode, TextContext, TextRenderOptions, WebContext, } from "./tree.ts";
|
|
7
|
-
export {
|
|
8
|
-
export type { LayoutProps, SectionProps, StyleProps, TableColumn, TableProps, TableRow } from "./primitives.tsx";
|
|
1
|
+
export { assistantTurns, costUSD, defineMetric, durationMs, endToEndPassRate, examScore, executionReliability, repeatedFailedCommands, taskPassRate, tokens, } from "./metrics.ts";
|
|
2
|
+
export { flag, numericFlag, numericRunConfig, runConfig } from "./flag.ts";
|
|
3
|
+
export { buildReportMeta, defineReport, isReportDefinition, pickReportPage, renderReportToText, renderReportTreeToText, reportTitleText, resolveReportTitle, ReportPageNotFoundError, DEFAULT_PAGE_ID, } from "./report.ts";
|
|
4
|
+
export type { HostCommandContext, NonEmptyArray, RenderReportTextOptions, RenderTreeTextOptions, ReportTreeHostContext, ReportAsset, ReportDef, ReportDefinition, ReportHostContext, ReportLink, ReportMeta, ReportPage, ReportShell, } from "./report.ts";
|
|
5
|
+
export { defineComponent, createTextContext, renderNodeToText, resolveReportTree, validateReportTree, ResolveMemo } from "./tree.ts";
|
|
6
|
+
export type { ComponentFaces, ComposeContext, ReportComponent, ReportElement, ReportNode, ResolveContext, ResolveEnv, TextContext, TextRenderOptions, WebContext, } from "./tree.ts";
|
|
7
|
+
export { Col, Row, Section, Style, Tab, Table, Tabs, Text } from "./primitives.tsx";
|
|
8
|
+
export type { ColProps, LayoutProps, RowProps, SectionProps, StyleProps, TabProps, TableColumn, TableProps, TableRow, TabsProps, TextProps, } from "./primitives.tsx";
|
|
9
9
|
export { stringWidth, padDisplay as padEnd, padStartDisplay as padStart, wrapDisplay as wrapText, indentBlock as indent, textBar as bar, joinColumns as columns, } from "./text/layout.ts";
|
|
10
10
|
export type { ColumnAlign } from "./text/layout.ts";
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export
|
|
14
|
-
export {
|
|
15
|
-
export
|
|
16
|
-
export type {
|
|
17
|
-
export type { Aggregator, AttemptListItem, AttemptLocator, DeltaData,
|
|
18
|
-
export type { AttemptHandle, Results,
|
|
11
|
+
export { DEFAULT_REPORT_LOCALE, localizedTextEquals, resolveLocalizedText, resolveMetricLabel } from "./locale.ts";
|
|
12
|
+
export type { LocalizedText, ReportLocale } from "./locale.ts";
|
|
13
|
+
export { AttemptList, DeltaTable, EvalList, ExperimentComparison, ExperimentList, FailureList, MetricBars, MetricLine, MetricMatrix, MetricScatter, MetricTable, Scoreboard, ScopeSummary, } from "./components.tsx";
|
|
14
|
+
export type { AttemptListProps, DataProps, DeltaTableProps, EvalListProps, ExperimentComparisonProps, ExperimentListProps, FailureListProps, MetricBarsProps, MetricLineProps, MetricMatrixProps, MetricScatterProps, MetricTableProps, ScoreboardProps, ScopeSummaryProps, } from "./components.tsx";
|
|
15
|
+
export { attemptListData, deltaTableData, evalListData, experimentComparisonData, experimentListData, metricLineData, metricMatrixData, metricScatterData, metricTableData, pairsByFlag, scopeSummaryData, scoreboardData, } from "./compute.ts";
|
|
16
|
+
export type { DeltaTableOptions, MetricLineOptions, MetricMatrixOptions, MetricScatterOptions, MetricTableOptions, ScoreboardOptions, } from "./compute.ts";
|
|
17
|
+
export type { Aggregator, AttemptListItem, AttemptLocator, BuiltInDimension, CustomDimension, DeltaData, DeltaPair, DimensionInput, DimensionOptions, DimensionRef, EntityListDataOptions, EvalListItem, ExperimentComparisonData, ExperimentComparisonGroupData, ExperimentListEvalRow, ExperimentListItem, FlagPairs, LineData, MatrixData, Metric, MetricAggregate, MetricCell, MetricColumn, NumericAxis, NumericAxisOptions, NumericRunConfigAxisOptions, ReportInput, RunConfigKey, ScatterData, ScopeSummaryData, ScopeWarning, ScoreboardData, TableData, VerdictTally, } from "./types.ts";
|
|
18
|
+
export type { AttemptHandle, Results, Scope, Snapshot } from "../results/types.ts";
|
|
19
19
|
export { experimentGroupOf } from "../shared/aggregate.ts";
|
package/dist/report/index.js
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
// niceeval/report —— 报告积木:指标 × 计算函数 × 双面组件 × defineReport。
|
|
2
|
-
// 契约见 docs/feature/reports/README.md
|
|
3
|
-
// 与 report-components.mdx。
|
|
2
|
+
// 契约见 docs/feature/reports/README.md 与 docs/feature/reports/library/ 分篇。
|
|
4
3
|
//
|
|
5
|
-
// import 边界即运行时边界:计算函数(
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export { Row, Col, Section, Text, Style, Table } from "./primitives.js";
|
|
4
|
+
// import 边界即运行时边界:计算函数(*Data)会经句柄触碰文件系统(懒加载 artifact),
|
|
5
|
+
// 只能进服务端 / 脚本;组件的渲染面纯同步零 IO。text 宿主遍历渲染不需要 react-dom
|
|
6
|
+
// (renderReportToText);web 宿主的 renderReportToStaticHtml 在 ./web.ts,只有那一侧
|
|
7
|
+
// import react-dom。写报告文件的项目要装 react(.tsx 编译产物 import react/jsx-runtime)。
|
|
8
|
+
// 指标与维度读取器
|
|
9
|
+
export { assistantTurns, costUSD, defineMetric, durationMs, endToEndPassRate, examScore, executionReliability, repeatedFailedCommands, taskPassRate, tokens, } from "./metrics.js";
|
|
10
|
+
export { flag, numericFlag, numericRunConfig, runConfig } from "./flag.js";
|
|
11
|
+
// 报告定义与组件基座
|
|
12
|
+
export { buildReportMeta, defineReport, isReportDefinition, pickReportPage, renderReportToText, renderReportTreeToText, reportTitleText, resolveReportTitle, ReportPageNotFoundError, DEFAULT_PAGE_ID, } from "./report.js";
|
|
13
|
+
export { defineComponent, createTextContext, renderNodeToText, resolveReportTree, validateReportTree, ResolveMemo } from "./tree.js";
|
|
14
|
+
// 排版原语(八个内置双面组件)
|
|
15
|
+
export { Col, Row, Section, Style, Tab, Table, Tabs, Text } from "./primitives.js";
|
|
18
16
|
// 文本排版工具箱:自定义组件的 text 面用的就是官方组件那把尺子。
|
|
19
17
|
// 表格有 <Table> 承担,这里只给表以外的形态用 —— 尤其别拿 String.prototype.padEnd 对齐:
|
|
20
18
|
// 它数 UTF-16 码元不数显示列宽,一带中文列就撕歪。renderAlignedRows 刻意不导出。
|
|
21
19
|
export { stringWidth, padDisplay as padEnd, padStartDisplay as padStart, wrapDisplay as wrapText, indentBlock as indent, textBar as bar, joinColumns as columns, } from "./text/layout.js";
|
|
22
|
-
//
|
|
23
|
-
export {
|
|
24
|
-
//
|
|
25
|
-
export {
|
|
26
|
-
//
|
|
27
|
-
|
|
20
|
+
// locale:官方组件 chrome 文案的语言(内置词典覆盖 en / zh-CN,其它 locale 走回退)
|
|
21
|
+
export { DEFAULT_REPORT_LOCALE, localizedTextEquals, resolveLocalizedText, resolveMetricLabel } from "./locale.js";
|
|
22
|
+
// 官方双面组件(spec / data 双形态;配套 *Data 计算函数在下面成对导出)
|
|
23
|
+
export { AttemptList, DeltaTable, EvalList, ExperimentComparison, ExperimentList, FailureList, MetricBars, MetricLine, MetricMatrix, MetricScatter, MetricTable, Scoreboard, ScopeSummary, } from "./components.js";
|
|
24
|
+
// 计算函数(组件解析面的具名形式,与组件成对;spec 形态下由管线代调,data 形态与
|
|
25
|
+
// 嵌入场景下由作者手工调)
|
|
26
|
+
export { attemptListData, deltaTableData, evalListData, experimentComparisonData, experimentListData, metricLineData, metricMatrixData, metricScatterData, metricTableData, pairsByFlag, scopeSummaryData, scoreboardData, } from "./compute.js";
|
|
28
27
|
// experiment id 的组键推导(id 的目录前缀,如 `compare/bub-low` 的 `compare`)。
|
|
29
28
|
// 重新导出,让自定义报告能按同一份口径把 experiment 分组,不必自己重写这两行逻辑。
|
|
30
29
|
export { experimentGroupOf } from "../shared/aggregate.js";
|
package/dist/report/load.js
CHANGED
|
@@ -21,7 +21,7 @@ export class ReportLoadError extends Error {
|
|
|
21
21
|
export async function loadReportFile(cwd, path, options) {
|
|
22
22
|
const abs = resolve(cwd, path);
|
|
23
23
|
if (!existsSync(abs)) {
|
|
24
|
-
throw new ReportLoadError(`Report file not found: ${abs}. Pass --report an explicit path to a module whose default export is defineReport(...).`);
|
|
24
|
+
throw new ReportLoadError(`Report file not found: ${abs}. Pass --report an explicit path to a module whose default export is a defineReport(...) product.`);
|
|
25
25
|
}
|
|
26
26
|
const plain = pathToFileURL(abs);
|
|
27
27
|
const url = new URL(plain.href);
|
|
@@ -50,7 +50,8 @@ export async function loadReportFile(cwd, path, options) {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
if (!isReportDefinition(mod.default)) {
|
|
53
|
-
throw new ReportLoadError(`${path} does not default-export a report. Export
|
|
53
|
+
throw new ReportLoadError(`${path} does not default-export a report. Export the product of defineReport(...) from "niceeval/report" as the default export — ` +
|
|
54
|
+
`a tree (defineReport(<ExperimentComparison />)) or a config object (defineReport({ title, content | pages, … })).`);
|
|
54
55
|
}
|
|
55
56
|
return mod.default;
|
|
56
57
|
}
|
package/dist/report/locale.d.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
1
|
+
import type { LocalizedText } from "../types.ts";
|
|
2
|
+
export type { LocalizedText };
|
|
3
|
+
/** 报告渲染的 locale(BCP 47 标签,开放);默认 "en"(`niceeval show` 缺省输出不变)。 */
|
|
4
|
+
export type ReportLocale = string;
|
|
3
5
|
export declare const DEFAULT_REPORT_LOCALE: ReportLocale;
|
|
6
|
+
/** MetricCell.display 生成面覆盖的 locale 全集;其它 locale 按 LocalizedText 回退取 en。 */
|
|
7
|
+
export declare const DISPLAY_LOCALES: readonly ReportLocale[];
|
|
8
|
+
/**
|
|
9
|
+
* LocalizedText 的确定回退:取当前 locale;缺失时取 en;仍缺失时取按 locale 键字典序的
|
|
10
|
+
* 第一个非空值。对象没有任何非空值时报错,不渲染空文案
|
|
11
|
+
* (docs/feature/reports/library/shell.md「行为约束」)。
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveLocalizedText(text: LocalizedText, locale: ReportLocale): string;
|
|
14
|
+
/** LocalizedText 按字段值深相等(键顺序无关;标题回退链的「唯一且相同」判定用)。 */
|
|
15
|
+
export declare function localizedTextEquals(a: LocalizedText, b: LocalizedText): boolean;
|
|
4
16
|
declare const en: {
|
|
5
17
|
readonly "verdict.passed": "passed";
|
|
6
18
|
readonly "verdict.failed": "failed";
|
|
@@ -11,6 +23,7 @@ declare const en: {
|
|
|
11
23
|
readonly "cell.measuredTitle": "{samples}/{total} attempts measured";
|
|
12
24
|
readonly "cell.noneMeasurableTitle": "0/{total} attempts measurable";
|
|
13
25
|
readonly "cell.coverageTitle": "coverage {samples}/{total}: this metric is null for the remaining attempts";
|
|
26
|
+
readonly "cell.missingValue": "(missing)";
|
|
14
27
|
readonly "table.higherBetter": "higher is better";
|
|
15
28
|
readonly "table.lowerBetter": "lower is better";
|
|
16
29
|
readonly "table.model": "Model";
|
|
@@ -24,39 +37,47 @@ declare const en: {
|
|
|
24
37
|
readonly "table.attempt": "attempt";
|
|
25
38
|
readonly "experimentList.experiment": "Experiment";
|
|
26
39
|
readonly "experimentList.avgDuration": "Avg duration";
|
|
27
|
-
readonly "experimentList.passRate": "
|
|
40
|
+
readonly "experimentList.passRate": "End-to-end pass rate";
|
|
28
41
|
readonly "experimentList.tokens": "Tokens";
|
|
29
|
-
readonly "experimentList.
|
|
42
|
+
readonly "experimentList.cost": "Cost";
|
|
30
43
|
readonly "experimentList.result": "Result";
|
|
31
44
|
readonly "experimentList.status": "Status";
|
|
32
45
|
readonly "experimentList.evalAttempt": "Eval / Attempt";
|
|
33
46
|
readonly "experimentList.duration": "Duration";
|
|
34
|
-
readonly "experimentList.cost": "Cost";
|
|
35
47
|
readonly "experimentList.filterPlaceholder": "Filter experiments…";
|
|
36
48
|
readonly "experimentList.defaultModel": "default";
|
|
37
49
|
readonly "experimentList.flags": "Flags";
|
|
50
|
+
readonly "entityList.average": "{value} avg";
|
|
51
|
+
readonly "entityList.moreFailures.one": "+{n} more failure";
|
|
52
|
+
readonly "entityList.moreFailures.other": "+{n} more failures";
|
|
38
53
|
/** <Table> 压到下限仍放不下时,从右侧丢列并如实报数。 */
|
|
39
54
|
readonly "table.columnsHidden.one": "({n} more column not shown)";
|
|
40
55
|
readonly "table.columnsHidden.other": "({n} more columns not shown)";
|
|
41
|
-
|
|
42
|
-
readonly "
|
|
43
|
-
readonly "
|
|
44
|
-
readonly "
|
|
45
|
-
readonly "
|
|
46
|
-
readonly "
|
|
47
|
-
readonly "
|
|
56
|
+
/** ScopeSummary 的 KPI 标签。 */
|
|
57
|
+
readonly "scopeSummary.experiments": "Experiments";
|
|
58
|
+
readonly "scopeSummary.evals": "Evals";
|
|
59
|
+
readonly "scopeSummary.attempts": "attempts";
|
|
60
|
+
readonly "scopeSummary.passRate": "End-to-end pass rate";
|
|
61
|
+
readonly "scopeSummary.totalCost": "Total cost";
|
|
62
|
+
readonly "scopeSummary.range": "{from} – {to}";
|
|
63
|
+
readonly "scopeSummary.votesEval": "eval verdicts";
|
|
64
|
+
readonly "scopeSummary.votesAttempt": "attempt verdicts";
|
|
48
65
|
readonly "overview.experiments.one": "{n} experiment";
|
|
49
66
|
readonly "overview.experiments.other": "{n} experiments";
|
|
50
67
|
readonly "overview.evalsCount": "{n} evals";
|
|
51
68
|
readonly "overview.attemptsCount": "{n} attempts";
|
|
52
|
-
|
|
53
|
-
readonly "
|
|
54
|
-
readonly "
|
|
55
|
-
readonly "
|
|
56
|
-
readonly
|
|
57
|
-
readonly "
|
|
69
|
+
readonly "overview.evals": "Evals";
|
|
70
|
+
readonly "overview.passRate": "End-to-end pass rate";
|
|
71
|
+
readonly "overview.totalCost": "Cost";
|
|
72
|
+
readonly "experimentComparison.groups": "Experiment groups";
|
|
73
|
+
readonly "experimentComparison.group": "Experiment group";
|
|
74
|
+
readonly "experimentComparison.results": "Eval results";
|
|
75
|
+
readonly "experimentComparison.lastRun": "Last run";
|
|
76
|
+
readonly "experimentComparison.selectGroup": "Select experiment group {group}";
|
|
77
|
+
readonly "experimentComparison.commandsHead": "Group details:";
|
|
78
|
+
readonly "experimentComparison.empty": "No experiment groups";
|
|
79
|
+
/** 方向提示唯一文案:轴向已随 better 反正,「更好」恒指向右上(两轴都声明 better 时才显示)。 */
|
|
58
80
|
readonly "scatter.betterUpperRight": "better → upper right";
|
|
59
|
-
readonly "scatter.axisReversed": "(axis reversed: right = better)";
|
|
60
81
|
/** 0 个可画点:x/y 指标没有可用数据。 */
|
|
61
82
|
readonly "scatter.noData": "No data to plot {x} × {y}";
|
|
62
83
|
readonly "pointsMissing.one": "{n} point missing data";
|
|
@@ -65,30 +86,33 @@ declare const en: {
|
|
|
65
86
|
readonly "attemptList.truncated": "and {n} more not shown";
|
|
66
87
|
readonly "attemptList.truncatedText": "({n} more not shown)";
|
|
67
88
|
readonly "attemptList.score": "score {score}";
|
|
89
|
+
readonly "attemptList.unavailable": "unavailable";
|
|
68
90
|
readonly "attemptList.details": "details";
|
|
69
91
|
readonly "scoreboard.total": "Total";
|
|
70
92
|
readonly "scoreboard.totalText": "total";
|
|
71
|
-
readonly "scoreboard.
|
|
72
|
-
readonly "scoreboard.
|
|
73
|
-
readonly "scoreboard.
|
|
93
|
+
readonly "scoreboard.notRun.one": "{n} eval not run, scored 0";
|
|
94
|
+
readonly "scoreboard.notRun.other": "{n} evals not run, scored 0";
|
|
95
|
+
readonly "scoreboard.unscorable.one": "{n} eval unscorable, scored 0";
|
|
96
|
+
readonly "scoreboard.unscorable.other": "{n} evals unscorable, scored 0";
|
|
97
|
+
readonly "scoreboard.notRunText": "({n} not run)";
|
|
98
|
+
readonly "scoreboard.unscorableText": "({n} unscorable)";
|
|
99
|
+
readonly "scoreboard.ignored.one": "{n} eval outside the question set ignored";
|
|
100
|
+
readonly "scoreboard.ignored.other": "{n} evals outside the question set ignored";
|
|
74
101
|
readonly "scoreboard.weights": "weights:";
|
|
75
102
|
readonly "scoreboard.allWeights": "all evals ×1";
|
|
76
103
|
readonly "scoreboard.othersWeight": "others ×1";
|
|
77
|
-
readonly "scoreboard.subjectTitle": "{
|
|
104
|
+
readonly "scoreboard.subjectTitle": "{questions} evals, weighted {earned} of {possible}";
|
|
78
105
|
readonly "delta.pairHeader": "pair (A → B)";
|
|
79
|
-
readonly "
|
|
80
|
-
readonly "
|
|
106
|
+
readonly "delta.empty": "{experiments} experiments, 0 comparable pairs";
|
|
107
|
+
readonly "tabs.tab": "Tab";
|
|
81
108
|
};
|
|
82
109
|
export type ReportMessageKey = keyof typeof en;
|
|
83
|
-
/** 查字典 + 简单插值({name} 占位符)
|
|
110
|
+
/** 查字典 + 简单插值({name} 占位符)。内置词典未覆盖的 locale 回退 en。 */
|
|
84
111
|
export declare function localeText(locale: ReportLocale, key: ReportMessageKey, vars?: Record<string, string | number>): string;
|
|
85
112
|
/** 带单复数的计数文案:n === 1 用 `<base>.one`,其余 `<base>.other`(zh-CN 两键同值)。 */
|
|
86
|
-
export declare function countText(locale: ReportLocale, base: "overview.experiments" | "
|
|
87
|
-
/** 指标 label 的可本地化形态:字符串,或按 locale 给的字典(缺项回退 en,再回退任一非空值)。 */
|
|
88
|
-
export type LocalizedLabel = string | Partial<Record<ReportLocale, string>>;
|
|
113
|
+
export declare function countText(locale: ReportLocale, base: "overview.experiments" | "pointsMissing" | "scoreboard.notRun" | "scoreboard.unscorable" | "scoreboard.ignored" | "entityList.moreFailures" | "table.columnsHidden", n: number): string;
|
|
89
114
|
/**
|
|
90
|
-
* 按 locale 解析指标 label
|
|
91
|
-
*
|
|
115
|
+
* 按 locale 解析指标 / 列 label:字符串原样;字典按 LocalizedText 回退规则取值;
|
|
116
|
+
* undefined 回退 fallback(= metric.name)。渲染面(web / text)共用。
|
|
92
117
|
*/
|
|
93
|
-
export declare function resolveMetricLabel(label:
|
|
94
|
-
export {};
|
|
118
|
+
export declare function resolveMetricLabel(label: LocalizedText | undefined, locale: ReportLocale, fallback: string): string;
|