niceeval 0.6.2 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INDEX.md +23 -23
- package/README.zh.md +6 -6
- package/dist/agents/types.d.ts +2 -2
- package/dist/i18n/zh-CN.d.ts +3 -3
- package/dist/report/aggregate.d.ts +32 -26
- package/dist/report/aggregate.js +157 -76
- 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 +91 -164
- package/dist/report/components.js +377 -114
- package/dist/report/compute.d.ts +86 -73
- package/dist/report/compute.js +592 -432
- package/dist/report/flag.d.ts +28 -17
- package/dist/report/flag.js +86 -16
- package/dist/report/format.d.ts +11 -11
- package/dist/report/format.js +17 -15
- package/dist/report/index.d.ts +16 -17
- package/dist/report/index.js +20 -22
- package/dist/report/load.js +3 -2
- package/dist/report/locale.d.ts +49 -34
- package/dist/report/locale.js +106 -58
- package/dist/report/metrics.d.ts +10 -3
- package/dist/report/metrics.js +46 -12
- package/dist/report/primitives.d.ts +42 -15
- package/dist/report/primitives.js +135 -26
- package/dist/report/react/AttemptList.d.ts +10 -8
- package/dist/report/react/AttemptList.js +18 -10
- package/dist/report/react/DeltaTable.js +19 -18
- package/dist/report/react/EvalList.d.ts +3 -3
- package/dist/report/react/EvalList.js +0 -0
- package/dist/report/react/ExperimentComparison.d.ts +4 -2
- package/dist/report/react/ExperimentComparison.js +5 -4
- package/dist/report/react/ExperimentList.d.ts +3 -3
- package/dist/report/react/ExperimentList.js +16 -15
- 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 +54 -17
- 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/fixtures.d.ts +5 -9
- package/dist/report/react/fixtures.js +105 -149
- package/dist/report/react/index.d.ts +15 -5
- package/dist/report/react/index.js +18 -7
- package/dist/report/report.d.ts +137 -20
- package/dist/report/report.js +261 -34
- package/dist/report/text/faces.d.ts +17 -19
- package/dist/report/text/faces.js +225 -157
- package/dist/report/text/plot.js +1 -1
- package/dist/report/text/table.js +2 -2
- package/dist/report/tree.d.ts +90 -40
- package/dist/report/tree.js +252 -94
- package/dist/report/types.d.ts +245 -300
- 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 +38 -14
- package/dist/shared/aggregate.d.ts +3 -2
- package/dist/shared/aggregate.js +5 -4
- 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 +11 -11
- 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 +5 -5
- package/docs-site/zh/{guides → explanation}/runner.mdx +1 -1
- package/docs-site/zh/{concepts → explanation}/tier.mdx +6 -6
- package/docs-site/zh/{guides → how-to}/agent-feedback-loop.mdx +7 -7
- package/docs-site/zh/{guides → how-to}/authoring.mdx +2 -2
- package/docs-site/zh/{guides → how-to}/connect-otel.mdx +6 -6
- package/docs-site/zh/{guides → how-to}/connect-your-agent.mdx +18 -18
- package/docs-site/zh/{guides → how-to}/custom-reports.mdx +6 -6
- package/docs-site/zh/{guides → how-to}/experiments.mdx +3 -3
- package/docs-site/zh/{guides → how-to}/publish-report.mdx +2 -2
- package/docs-site/zh/{guides → how-to}/sandbox-agent.mdx +2 -2
- package/docs-site/zh/{guides → how-to}/sandbox-providers.mdx +1 -1
- package/docs-site/zh/{guides → how-to}/viewing-results.mdx +6 -6
- package/docs-site/zh/{guides → how-to}/write-experiment.mdx +3 -3
- package/docs-site/zh/{guides → how-to}/write-send.mdx +13 -13
- package/docs-site/zh/index.mdx +23 -25
- package/docs-site/zh/introduction.mdx +8 -8
- package/docs-site/zh/reference/builtin-agents.mdx +5 -5
- package/docs-site/zh/reference/capabilities.mdx +6 -6
- package/docs-site/zh/reference/cli.mdx +9 -7
- package/docs-site/zh/reference/define-agent.mdx +1 -1
- package/docs-site/zh/reference/events.mdx +3 -3
- package/docs-site/zh/{guides → reference}/official-adapters.mdx +7 -7
- package/docs-site/zh/{guides → reference}/report-components.mdx +5 -5
- package/docs-site/zh/{guides → reference}/results-data.mdx +5 -5
- package/docs-site/zh/{guides → troubleshooting}/debug-sandbox.mdx +2 -2
- package/docs-site/zh/{guides → troubleshooting}/debugging.mdx +4 -2
- package/docs-site/zh/{quickstart.mdx → tutorials/quickstart.mdx} +5 -17
- package/package.json +6 -2
- package/src/agents/index.ts +2 -2
- package/src/agents/openai-compat.ts +1 -1
- package/src/agents/streaming.ts +2 -2
- package/src/agents/types.ts +3 -3
- package/src/cli.ts +42 -23
- package/src/context/context.ts +1 -1
- package/src/context/session.test.ts +1 -1
- package/src/context/session.ts +1 -1
- package/src/i18n/en.ts +18 -16
- package/src/i18n/zh-CN.ts +16 -15
- package/src/report/aggregate.ts +175 -87
- package/src/report/built-in/index.tsx +9 -0
- package/src/report/components.tsx +625 -285
- package/src/report/compute.ts +717 -515
- package/src/report/dual-render.test.tsx +738 -1148
- package/src/report/flag.ts +97 -33
- package/src/report/format.ts +18 -22
- package/src/report/index.ts +113 -58
- package/src/report/load.ts +3 -2
- package/src/report/locale.ts +120 -69
- package/src/report/metrics.ts +42 -12
- package/src/report/primitives.tsx +190 -45
- package/src/report/react/AttemptList.tsx +32 -20
- package/src/report/react/DeltaTable.tsx +63 -45
- package/src/report/react/EvalList.tsx +0 -0
- package/src/report/react/ExperimentComparison.tsx +12 -7
- package/src/report/react/ExperimentList.tsx +38 -26
- 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 +74 -20
- 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/enhance.js +57 -5
- package/src/report/react/fixtures.ts +109 -156
- package/src/report/react/index.tsx +24 -39
- package/src/report/react/render.test.tsx +139 -104
- package/src/report/react/styles.css +181 -91
- package/src/report/report.test.ts +761 -1031
- package/src/report/report.ts +425 -47
- package/src/report/text/faces.ts +257 -164
- package/src/report/text/plot.ts +1 -1
- package/src/report/text/table.ts +2 -2
- package/src/report/tree.ts +362 -104
- package/src/report/types.ts +257 -287
- package/src/report/web.ts +63 -20
- package/src/results/attempt-evidence.test.ts +4 -4
- package/src/results/attempt-evidence.ts +5 -5
- package/src/results/copy.ts +6 -6
- package/src/results/host-equivalence.test.ts +26 -14
- package/src/results/index.ts +10 -4
- package/src/results/open.ts +8 -4
- package/src/results/results.test.ts +4 -3
- package/src/results/select.ts +104 -34
- package/src/results/types.ts +36 -14
- package/src/runner/feedback/human.test.ts +1 -1
- package/src/runner/run.ts +1 -1
- package/src/sandbox/cli-commands.ts +2 -2
- package/src/scoring/judge.test.ts +1 -1
- package/src/shared/aggregate.ts +5 -4
- package/src/show/compose.ts +50 -67
- package/src/show/index.ts +107 -56
- package/src/show/render.ts +43 -27
- package/src/show/report-host.test.ts +188 -0
- package/src/show/report-host.ts +375 -0
- package/src/show/show.test.ts +86 -36
- package/src/view/app/App.test.tsx +69 -0
- package/src/view/app/App.tsx +144 -48
- package/src/view/app/components/AttemptModal.tsx +324 -63
- package/src/view/app/components/CodeView.tsx +10 -4
- package/src/view/app/i18n.ts +31 -17
- package/src/view/app/lib/artifact-url.ts +14 -3
- 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 +21 -1
- package/src/view/client-dist/app.css +1 -1
- package/src/view/client-dist/app.js +6 -6
- package/src/view/data.test.ts +9 -3
- package/src/view/data.ts +145 -49
- package/src/view/index.ts +48 -44
- package/src/view/server.ts +35 -15
- package/src/view/shared/types.ts +34 -5
- package/src/view/styles.css +224 -0
- package/src/view/view-report.test.ts +161 -57
- package/dist/report/built-ins/experiment-comparison.d.ts +0 -39
- package/dist/report/built-ins/experiment-comparison.js +0 -119
- package/dist/report/built-ins/index.d.ts +0 -2
- 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/src/report/built-in-user-parity.test.tsx +0 -597
- package/src/report/built-ins/experiment-comparison.tsx +0 -179
- package/src/report/built-ins/index.ts +0 -7
- package/src/report/react/GroupSummary.tsx +0 -66
- package/src/report/react/RunOverview.tsx +0 -109
- /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}/ci-integration.mdx +0 -0
- /package/docs-site/zh/{guides → how-to}/dataset-fanout.mdx +0 -0
- /package/docs-site/zh/{guides → how-to}/fixtures.mdx +0 -0
- /package/docs-site/zh/{guides → how-to}/reporters.mdx +0 -0
- /package/docs-site/zh/{guides → how-to}/scoring-guide.mdx +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { formatMetricValue } from "../format.js";
|
|
3
|
-
import { DEFAULT_REPORT_LOCALE, countText, localeText, resolveMetricLabel } from "../locale.js";
|
|
3
|
+
import { DEFAULT_REPORT_LOCALE, countText, localeText, resolveLocalizedText, resolveMetricLabel } from "../locale.js";
|
|
4
4
|
import { niceTicks, placePointLabels } from "./chart-math.js";
|
|
5
5
|
import { colorClassForKey, seriesClassForKey } from "./colors.js";
|
|
6
6
|
import { cx } from "./format.js";
|
|
@@ -9,22 +9,55 @@ const HEIGHT = 360;
|
|
|
9
9
|
const MARGIN = { top: 26, right: 24, bottom: 46, left: 62 };
|
|
10
10
|
const PLOT_W = WIDTH - MARGIN.left - MARGIN.right;
|
|
11
11
|
const PLOT_H = HEIGHT - MARGIN.top - MARGIN.bottom;
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/**
|
|
13
|
+
* 点的直接标签:末段在当前 data 中唯一才缩成末段;重名时逐步加长为能区分它们的最短
|
|
14
|
+
* 路径后缀(完整 id 与两轴值仍进 <title>)。
|
|
15
|
+
*/
|
|
16
|
+
function pointLabels(keys) {
|
|
17
|
+
const segsOf = (key) => key.split("/").filter(Boolean);
|
|
18
|
+
const depth = new Map(keys.map((key) => [key, 1]));
|
|
19
|
+
for (;;) {
|
|
20
|
+
const byLabel = new Map();
|
|
21
|
+
for (const key of keys) {
|
|
22
|
+
const segs = segsOf(key);
|
|
23
|
+
const label = segs.slice(-Math.min(depth.get(key), segs.length)).join("/") || key;
|
|
24
|
+
byLabel.set(label, [...(byLabel.get(label) ?? []), key]);
|
|
25
|
+
}
|
|
26
|
+
let grew = false;
|
|
27
|
+
for (const group of byLabel.values()) {
|
|
28
|
+
if (group.length < 2)
|
|
29
|
+
continue;
|
|
30
|
+
for (const key of group) {
|
|
31
|
+
const segs = segsOf(key);
|
|
32
|
+
if (depth.get(key) < segs.length) {
|
|
33
|
+
depth.set(key, depth.get(key) + 1);
|
|
34
|
+
grew = true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (!grew) {
|
|
39
|
+
const out = new Map();
|
|
40
|
+
for (const key of keys) {
|
|
41
|
+
const segs = segsOf(key);
|
|
42
|
+
out.set(key, segs.slice(-Math.min(depth.get(key), segs.length)).join("/") || key);
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
15
47
|
}
|
|
16
48
|
/**
|
|
17
|
-
* 一根轴:niceTicks 撑出整齐的值域,值 →
|
|
18
|
-
* better: "lower"
|
|
49
|
+
* 一根轴:niceTicks 撑出整齐的值域,值 → 像素做线性映射。轴方向跟随指标的 `better`:
|
|
50
|
+
* `better: "lower"` 的轴反向渲染(值大的一端在左 / 下),「更好」因此恒指向右与上;
|
|
51
|
+
* 刻度标签始终显示真实值,反向只改方向不改数字(docs/feature/reports/library/metric-views.md)。
|
|
19
52
|
*/
|
|
20
|
-
function axisScale(values,
|
|
53
|
+
function axisScale(values, pixelLo, pixelHi, invert) {
|
|
21
54
|
const ticks = niceTicks(Math.min(...values), Math.max(...values), 5);
|
|
22
55
|
const lo = ticks[0];
|
|
23
56
|
const hi = ticks[ticks.length - 1];
|
|
24
57
|
const scale = (v) => {
|
|
25
58
|
let t = (v - lo) / (hi - lo || 1);
|
|
26
|
-
if (
|
|
27
|
-
t = 1 - t;
|
|
59
|
+
if (invert)
|
|
60
|
+
t = 1 - t;
|
|
28
61
|
return pixelLo + t * (pixelHi - pixelLo);
|
|
29
62
|
};
|
|
30
63
|
return { ticks, scale };
|
|
@@ -41,21 +74,25 @@ export function MetricScatter({ data, pointHref, className, locale = DEFAULT_REP
|
|
|
41
74
|
return (_jsxs("figure", { className: cx("nre", "nre-metric-scatter", className), children: [_jsx("p", { className: "nre-scatter-empty nre-missing", children: localeText(locale, "scatter.noData", { x: xLabel, y: yLabel }) }), missingNote] }));
|
|
42
75
|
}
|
|
43
76
|
const axisLabel = (label, col) => `${label}${col.unit ? `(${col.unit})` : ""}`;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
77
|
+
// 轴方向跟随 better:lower 反向(值大在左 / 下),higher 与未声明正向。
|
|
78
|
+
const xScale = axisScale(drawableRows.map((r) => r.x.value), MARGIN.left, MARGIN.left + PLOT_W, data.x.better === "lower");
|
|
79
|
+
// y 像素轴向下增长:正向 = 高值在上 → 映射到 [bottom, top];lower 反向 = 高值在下。
|
|
80
|
+
const yScale = axisScale(drawableRows.map((r) => r.y.value), MARGIN.top + PLOT_H, MARGIN.top, data.y.better === "lower");
|
|
81
|
+
const labelByKey = pointLabels(drawableRows.map((r) => r.key));
|
|
82
|
+
// 方向提示恒为「越靠右上越好」,仅当两轴都声明 better 时显示——任一轴未声明,
|
|
83
|
+
// 组件不猜「更好」朝哪边,整图无提示。
|
|
84
|
+
const showBetterHint = data.x.better !== undefined && data.y.better !== undefined;
|
|
47
85
|
const points = drawableRows.map((r) => {
|
|
48
86
|
const xValue = r.x.value;
|
|
49
87
|
const yValue = r.y.value;
|
|
50
88
|
return {
|
|
51
89
|
key: r.key,
|
|
52
90
|
series: r.series,
|
|
53
|
-
label:
|
|
91
|
+
label: labelByKey.get(r.key) ?? r.key,
|
|
54
92
|
xValue,
|
|
55
93
|
yValue,
|
|
56
|
-
// hover 内容:experiment(点键)+ 系列(
|
|
57
|
-
|
|
58
|
-
title: `${r.key}${r.series !== undefined ? `\n${r.series}` : ""}\n${xLabel}: ${r.x.display}(${r.x.samples}/${r.x.total})\n${yLabel}: ${r.y.display}(${r.y.samples}/${r.y.total})`,
|
|
94
|
+
// hover 内容:experiment(点键)+ 系列(有则加一行)+ 两轴 display 与 samples/total
|
|
95
|
+
title: `${r.key}${r.series !== undefined ? `\n${r.series}` : ""}\n${xLabel}: ${resolveLocalizedText(r.x.display, locale)}(${r.x.samples}/${r.x.total})\n${yLabel}: ${resolveLocalizedText(r.y.display, locale)}(${r.y.samples}/${r.y.total})`,
|
|
59
96
|
px: xScale.scale(xValue),
|
|
60
97
|
py: yScale.scale(yValue),
|
|
61
98
|
};
|
|
@@ -76,7 +113,7 @@ export function MetricScatter({ data, pointHref, className, locale = DEFAULT_REP
|
|
|
76
113
|
list.sort((a, b) => a.xValue - b.xValue);
|
|
77
114
|
// 直接标签的候选位择优布局:锚向、避让方向都由布局按空间决定,画布边界含边距
|
|
78
115
|
const labels = placePointLabels(points.map((p) => ({ cx: p.px, cy: p.py, width: p.label.length * 6.4 + 10 })), { x0: 2, y0: 2, x1: WIDTH - 2, y1: HEIGHT - 2 });
|
|
79
|
-
return (_jsxs("figure", { className: cx("nre", "nre-metric-scatter", className), children: [_jsxs("svg", { className: "nre-scatter-svg", viewBox: `0 0 ${WIDTH} ${HEIGHT}`, role: "img", "aria-label": `${axisLabel(xLabel, data.x)} × ${axisLabel(yLabel, data.y)}`, children: [_jsxs("g", { className: "nre-scatter-grid", children: [yScale.ticks.map((tick) => (_jsx("line", { x1: MARGIN.left, x2: MARGIN.left + PLOT_W, y1: yScale.scale(tick), y2: yScale.scale(tick) }, `gy${tick}`))), xScale.ticks.map((tick) => (_jsx("line", { y1: MARGIN.top, y2: MARGIN.top + PLOT_H, x1: xScale.scale(tick), x2: xScale.scale(tick) }, `gx${tick}`)))] }), _jsx("text", { className: "nre-scatter-better-hint", x: MARGIN.left + PLOT_W - 6, y: MARGIN.top + 14, textAnchor: "end", children: localeText(locale, "scatter.
|
|
116
|
+
return (_jsxs("figure", { className: cx("nre", "nre-metric-scatter", className), children: [_jsxs("svg", { className: "nre-scatter-svg", viewBox: `0 0 ${WIDTH} ${HEIGHT}`, role: "img", "aria-label": `${axisLabel(xLabel, data.x)} × ${axisLabel(yLabel, data.y)}`, children: [_jsxs("g", { className: "nre-scatter-grid", children: [yScale.ticks.map((tick) => (_jsx("line", { x1: MARGIN.left, x2: MARGIN.left + PLOT_W, y1: yScale.scale(tick), y2: yScale.scale(tick) }, `gy${tick}`))), xScale.ticks.map((tick) => (_jsx("line", { y1: MARGIN.top, y2: MARGIN.top + PLOT_H, x1: xScale.scale(tick), x2: xScale.scale(tick) }, `gx${tick}`)))] }), showBetterHint && (_jsx("text", { className: "nre-scatter-better-hint", x: MARGIN.left + PLOT_W - 6, y: MARGIN.top + 14, textAnchor: "end", children: localeText(locale, "scatter.betterUpperRight") })), _jsx("g", { className: "nre-scatter-axis nre-scatter-axis-y", children: yScale.ticks.map((tick) => (_jsx("text", { className: "nre-scatter-tick", x: MARGIN.left - 8, y: yScale.scale(tick) + 3, textAnchor: "end", children: formatMetricValue(tick, data.y.unit) }, `ay${tick}`))) }), _jsx("g", { className: "nre-scatter-axis nre-scatter-axis-x", children: xScale.ticks.map((tick) => (_jsx("text", { className: "nre-scatter-tick", x: xScale.scale(tick), y: MARGIN.top + PLOT_H + 16, textAnchor: "middle", children: formatMetricValue(tick, data.x.unit) }, `ax${tick}`))) }), _jsx("text", { className: "nre-scatter-xlabel", x: MARGIN.left + PLOT_W / 2, y: HEIGHT - 8, textAnchor: "middle", children: axisLabel(xLabel, data.x) }), _jsx("text", { className: "nre-scatter-ylabel", x: 14, y: MARGIN.top + PLOT_H / 2, textAnchor: "middle", transform: `rotate(-90 14 ${MARGIN.top + PLOT_H / 2})`, children: axisLabel(yLabel, data.y) }), seriesOrder.map((series) => {
|
|
80
117
|
const list = bySeries.get(series);
|
|
81
118
|
if (list.length < 2)
|
|
82
119
|
return null;
|
|
@@ -3,21 +3,11 @@ import { DEFAULT_REPORT_LOCALE, localeText, resolveMetricLabel } from "../locale
|
|
|
3
3
|
import { MetricCellView } from "./cell.js";
|
|
4
4
|
import { colorClassForKey } from "./colors.js";
|
|
5
5
|
import { cx } from "./format.js";
|
|
6
|
-
/** verdict 计票 pill(「3 passed / 1 failed」):非零判定各一枚,全零如实空。 */
|
|
7
|
-
function VerdictTally({ verdicts, locale, }) {
|
|
8
|
-
const kinds = ["passed", "failed", "errored", "skipped"].filter((k) => verdicts[k] > 0);
|
|
9
|
-
return (_jsxs("span", { className: "nre-verdict-tally", children: [kinds.map((kind) => (_jsxs("span", { className: cx("nre-verdict-pill", `nre-verdict-${kind}`), children: [verdicts[kind], " ", localeText(locale, `verdict.${kind}`)] }, kind))), kinds.length === 0 && _jsx("span", { className: "nre-missing", children: "\u2014" })] }));
|
|
10
|
-
}
|
|
11
6
|
export function MetricTable({ data, attemptHref, filter, className, locale = DEFAULT_REPORT_LOCALE, }) {
|
|
12
|
-
const
|
|
13
|
-
const hasModel = data.rows.some((row) => row.meta?.model !== undefined);
|
|
14
|
-
const hasVerdicts = data.rows.some((row) => row.meta?.verdicts !== undefined);
|
|
15
|
-
const table = (_jsxs("table", { className: cx("nre", "nre-metric-table", !filter && className), children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", className: "nre-dimension", "data-nre-sort": "", children: data.dimension }), hasMeta && hasModel && (_jsx("th", { scope: "col", className: "nre-meta-col", "data-nre-sort": "", children: localeText(locale, "table.model") })), hasMeta && (_jsx("th", { scope: "col", className: "nre-meta-col", "data-nre-sort": "", children: localeText(locale, "table.agent") })), data.columns.map((col) => (_jsxs("th", { scope: "col", className: "nre-metric-col", "data-nre-sort": "", children: [resolveMetricLabel(col.label, locale, col.key), col.unit && _jsxs("span", { className: "nre-unit", children: ["(", col.unit, ")"] }), col.better && (_jsx("span", { className: "nre-better", title: localeText(locale, col.better === "higher" ? "table.higherBetter" : "table.lowerBetter"), children: col.better === "higher" ? "↑" : "↓" }))] }, col.key))), hasVerdicts && (_jsx("th", { scope: "col", className: "nre-verdicts-col", "data-nre-sort": "", children: localeText(locale, "table.verdicts") }))] }) }), _jsx("tbody", { children: data.rows.map((row) => (_jsxs("tr", { children: [_jsxs("th", { scope: "row", className: cx("nre-row-key", "nre-key", colorClassForKey(row.key)), "data-sort-value": row.key, children: [row.key, row.meta?.evals !== undefined && (_jsxs("div", { className: "nre-row-meta-sub", children: [localeText(locale, "overview.evalsCount", { n: row.meta.evals }), row.meta.attempts !== undefined && row.meta.attempts > row.meta.evals
|
|
16
|
-
? ` · ${localeText(locale, "overview.attemptsCount", { n: row.meta.attempts })}`
|
|
17
|
-
: "", row.meta.lastRunAt ? ` · ${localeText(locale, "latestRun", { run: row.meta.lastRunAt })}` : ""] }))] }), hasMeta && hasModel && (_jsx("td", { className: "nre-td nre-meta-cell", "data-sort-value": row.meta?.model ?? "", children: row.meta?.model ?? _jsx("span", { className: "nre-missing", children: "\u2014" }) })), hasMeta && (_jsx("td", { className: "nre-td nre-meta-cell", "data-sort-value": row.meta?.agent ?? "", children: row.meta?.agent ?? _jsx("span", { className: "nre-missing", children: "\u2014" }) })), data.columns.map((col) => {
|
|
7
|
+
const table = (_jsxs("table", { className: cx("nre", "nre-metric-table", !filter && className), children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", className: "nre-dimension", "data-nre-sort": "", children: data.rowDimension }), data.columns.map((col) => (_jsxs("th", { scope: "col", className: "nre-metric-col", "data-nre-sort": "", children: [resolveMetricLabel(col.label, locale, col.key), col.unit && _jsxs("span", { className: "nre-unit", children: ["(", col.unit, ")"] }), col.better && (_jsx("span", { className: "nre-better", title: localeText(locale, col.better === "higher" ? "table.higherBetter" : "table.lowerBetter"), children: col.better === "higher" ? "↑" : "↓" }))] }, col.key)))] }) }), _jsx("tbody", { children: data.rows.map((row) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", className: cx("nre-row-key", "nre-key", colorClassForKey(row.key)), "data-sort-value": row.key, children: row.key }), data.columns.map((col) => {
|
|
18
8
|
const cell = row.cells[col.key];
|
|
19
9
|
return (_jsx("td", { className: "nre-td", "data-sort-value": cell?.value ?? "", children: cell ? (_jsx(MetricCellView, { cell: cell, attemptHref: attemptHref, locale: locale })) : (_jsx("span", { className: "nre-empty" })) }, col.key));
|
|
20
|
-
})
|
|
10
|
+
})] }, row.key))) })] }));
|
|
21
11
|
if (!filter)
|
|
22
12
|
return table;
|
|
23
13
|
// 过滤输入框渲染在表格前(同一个 wrap 里),enhance.js 经 data-nre-filter 接管;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { ScopeSummaryData } from "../types.ts";
|
|
3
|
+
import { type ReportLocale } from "../locale.ts";
|
|
4
|
+
export declare function ScopeSummary({ data, votes, className, locale, }: {
|
|
5
|
+
data: ScopeSummaryData;
|
|
6
|
+
/** 显示哪一级计票;默认 "eval"。data 恒携带两级,votes 只选择呈现。 */
|
|
7
|
+
votes?: "eval" | "attempt";
|
|
8
|
+
className?: string;
|
|
9
|
+
locale?: ReportLocale;
|
|
10
|
+
}): ReactElement;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DEFAULT_REPORT_LOCALE, localeText } from "../locale.js";
|
|
3
|
+
import { MetricCellView } from "./cell.js";
|
|
4
|
+
import { cx } from "./format.js";
|
|
5
|
+
function VerdictTallyView({ tally, locale }) {
|
|
6
|
+
const kinds = ["passed", "failed", "errored", "skipped"].filter((k) => tally[k] > 0);
|
|
7
|
+
return (_jsxs("span", { className: "nre-verdict-tally", children: [kinds.map((kind) => (_jsxs("span", { className: cx("nre-verdict-pill", `nre-verdict-${kind}`), children: [tally[kind], " ", localeText(locale, `verdict.${kind}`)] }, kind))), kinds.length === 0 && _jsx("span", { className: "nre-missing", children: "\u2014" })] }));
|
|
8
|
+
}
|
|
9
|
+
export function ScopeSummary({ data, votes = "eval", className, locale = DEFAULT_REPORT_LOCALE, }) {
|
|
10
|
+
const tally = votes === "attempt" ? data.attemptVerdicts : data.evalVerdicts;
|
|
11
|
+
return (_jsxs("div", { className: cx("nre", "nre-scope-summary", className), "data-votes": votes, children: [_jsxs("dl", { className: "nre-scope-kpis", children: [_jsxs("div", { className: "nre-scope-kpi nre-scope-kpi-rate", children: [_jsx("dt", { children: localeText(locale, "scopeSummary.passRate") }), _jsx("dd", { children: _jsx(MetricCellView, { cell: data.endToEndPassRate, locale: locale }) })] }), _jsxs("div", { className: "nre-scope-kpi", children: [_jsx("dt", { children: localeText(locale, "scopeSummary.experiments") }), _jsx("dd", { children: data.experiments })] }), _jsxs("div", { className: "nre-scope-kpi", children: [_jsx("dt", { children: localeText(locale, "scopeSummary.evals") }), _jsx("dd", { children: data.evals })] }), _jsxs("div", { className: "nre-scope-kpi", children: [_jsx("dt", { children: localeText(locale, "scopeSummary.attempts") }), _jsx("dd", { children: data.attempts })] }), _jsxs("div", { className: "nre-scope-kpi nre-scope-kpi-verdicts", children: [_jsx("dt", { children: localeText(locale, votes === "attempt" ? "scopeSummary.votesAttempt" : "scopeSummary.votesEval") }), _jsx("dd", { children: _jsx(VerdictTallyView, { tally: tally, locale: locale }) })] }), _jsxs("div", { className: "nre-scope-kpi", children: [_jsx("dt", { children: localeText(locale, "scopeSummary.totalCost") }), _jsx("dd", { children: _jsx(MetricCellView, { cell: data.totalCostUSD, locale: locale }) })] })] }), data.range.latestStartedAt !== null && (_jsx("p", { className: "nre-scope-summary-range", children: data.range.earliestStartedAt !== null && data.range.earliestStartedAt !== data.range.latestStartedAt
|
|
12
|
+
? localeText(locale, "scopeSummary.range", {
|
|
13
|
+
from: data.range.earliestStartedAt,
|
|
14
|
+
to: data.range.latestStartedAt,
|
|
15
|
+
})
|
|
16
|
+
: data.range.latestStartedAt }))] }));
|
|
17
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { DEFAULT_REPORT_LOCALE, countText, localeText } from "../locale.js";
|
|
2
|
+
import { DEFAULT_REPORT_LOCALE, countText, localeText, resolveLocalizedText } from "../locale.js";
|
|
3
3
|
import { colorClassForKey } from "./colors.js";
|
|
4
4
|
import { cx } from "./format.js";
|
|
5
5
|
export function Scoreboard({ data, className, locale = DEFAULT_REPORT_LOCALE, }) {
|
|
@@ -11,16 +11,16 @@ export function Scoreboard({ data, className, locale = DEFAULT_REPORT_LOCALE, })
|
|
|
11
11
|
subjectKeys.push(subject.key);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
return (_jsxs("section", { className: cx("nre", "nre-scoreboard", className), children: [_jsxs("table", { className: "nre-scoreboard-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", className: "nre-dimension", children: data.
|
|
14
|
+
return (_jsxs("section", { className: cx("nre", "nre-scoreboard", className), children: [_jsxs("table", { className: "nre-scoreboard-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", className: "nre-dimension", children: data.rowDimension }), _jsxs("th", { scope: "col", className: "nre-total-col", children: [localeText(locale, "scoreboard.total"), _jsxs("span", { className: "nre-full-marks", children: ["/ ", data.fullMarks] })] }), subjectKeys.map((key) => (_jsx("th", { scope: "col", className: "nre-subject-col", children: key }, key)))] }) }), _jsx("tbody", { children: data.rows.map((row) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", className: cx("nre-row-key", "nre-key", colorClassForKey(row.key)), children: row.key }), _jsxs("td", { className: "nre-total", children: [resolveLocalizedText(row.total.display, locale), row.total.notRun > 0 && (_jsx("span", { className: "nre-total-not-run", children: countText(locale, "scoreboard.notRun", row.total.notRun) })), row.total.unscorable > 0 && (_jsx("span", { className: "nre-total-unscorable", children: countText(locale, "scoreboard.unscorable", row.total.unscorable) }))] }), subjectKeys.map((key) => {
|
|
15
15
|
const subject = row.subjects.find((s) => s.key === key);
|
|
16
16
|
if (!subject)
|
|
17
17
|
return _jsx("td", { className: "nre-td-empty" }, key);
|
|
18
|
-
return (_jsxs("td", { className: "nre-subject", children: [
|
|
19
|
-
|
|
18
|
+
return (_jsxs("td", { className: "nre-subject", children: [_jsx("span", { className: "nre-subject-score", title: localeText(locale, "scoreboard.subjectTitle", {
|
|
19
|
+
questions: subject.questions,
|
|
20
20
|
earned: subject.earned,
|
|
21
21
|
possible: subject.possible,
|
|
22
|
-
}), children:
|
|
22
|
+
}), children: resolveLocalizedText(subject.display, locale) }), subject.notRun > 0 && (_jsx("span", { className: "nre-subject-not-run", children: localeText(locale, "scoreboard.notRunText", { n: subject.notRun }) })), subject.unscorable > 0 && (_jsx("span", { className: "nre-subject-unscorable", children: localeText(locale, "scoreboard.unscorableText", { n: subject.unscorable }) }))] }, key));
|
|
23
23
|
})] }, row.key))) })] }), _jsxs("p", { className: "nre-weights", children: [localeText(locale, "scoreboard.weights"), " ", data.weights.length === 0
|
|
24
24
|
? localeText(locale, "scoreboard.allWeights")
|
|
25
|
-
: data.weights.map((w) => (_jsxs("span", { className: "nre-weight", children: [w.prefix, " \u00D7", w.weight] }, w.prefix))), data.weights.length > 0 && _jsx("span", { className: "nre-weight-rest", children: localeText(locale, "scoreboard.othersWeight") })] })] }));
|
|
25
|
+
: data.weights.map((w) => (_jsxs("span", { className: "nre-weight", children: [w.prefix, " \u00D7", w.weight] }, w.prefix))), data.weights.length > 0 && _jsx("span", { className: "nre-weight-rest", children: localeText(locale, "scoreboard.othersWeight") })] }), data.ignoredEvals > 0 && (_jsx("p", { className: "nre-scoreboard-ignored", children: countText(locale, "scoreboard.ignored", data.ignoredEvals) }))] }));
|
|
26
26
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { DEFAULT_REPORT_LOCALE, localeText } from "../locale.js";
|
|
2
|
+
import { DEFAULT_REPORT_LOCALE, localeText, resolveLocalizedText } from "../locale.js";
|
|
3
3
|
export function MetricCellView({ cell, attemptHref, locale = DEFAULT_REPORT_LOCALE, }) {
|
|
4
4
|
// 全 null(没有任何有效样本)→ 缺数据文案,绝不画 0;total 仍如实入 title
|
|
5
5
|
if (cell.value === null) {
|
|
6
6
|
return (_jsx("span", { className: "nre-cell nre-cell-missing", children: _jsx("span", { className: "nre-missing", title: localeText(locale, "cell.noneMeasurableTitle", { total: cell.total }), children: localeText(locale, "cell.missing") }) }));
|
|
7
7
|
}
|
|
8
|
-
return (_jsxs("span", { className: "nre-cell", children: [_jsx("span", { className: "nre-value", title: localeText(locale, "cell.measuredTitle", { samples: cell.samples, total: cell.total }), children: cell.display }), cell.samples < cell.total && (_jsxs("sup", { className: "nre-coverage", title: localeText(locale, "cell.coverageTitle", { samples: cell.samples, total: cell.total }), children: [cell.samples, "/", cell.total] })), attemptHref && cell.refs && cell.refs.length > 0 && (_jsx("span", { className: "nre-refs", children: cell.refs.map((locator, i) => (_jsxs("a", { className: "nre-ref", href: attemptHref(locator), children: ["#", i + 1] }, locator))) }))] }));
|
|
8
|
+
return (_jsxs("span", { className: "nre-cell", children: [_jsx("span", { className: "nre-value", title: localeText(locale, "cell.measuredTitle", { samples: cell.samples, total: cell.total }), children: resolveLocalizedText(cell.display, locale) }), cell.samples < cell.total && (_jsxs("sup", { className: "nre-coverage", title: localeText(locale, "cell.coverageTitle", { samples: cell.samples, total: cell.total }), children: [cell.samples, "/", cell.total] })), attemptHref && cell.refs && cell.refs.length > 0 && (_jsx("span", { className: "nre-refs", children: cell.refs.map((locator, i) => (_jsxs("a", { className: "nre-ref", href: attemptHref(locator), children: ["#", i + 1] }, locator))) }))] }));
|
|
9
9
|
}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import type { AttemptListItem, DeltaData, EvalListItem, ExperimentListItem,
|
|
1
|
+
import type { AttemptListItem, DeltaData, EvalListItem, ExperimentListItem, LineData, MatrixData, MetricColumn, ScatterData, ScopeSummaryData, ScoreboardData, TableData } from "../types.ts";
|
|
2
2
|
export declare const passRateColumn: MetricColumn;
|
|
3
3
|
export declare const codeLinesColumn: MetricColumn;
|
|
4
4
|
export declare const costColumn: MetricColumn;
|
|
5
|
-
|
|
6
|
-
export declare const
|
|
7
|
-
|
|
8
|
-
export declare const groupSummaryData: GroupSummaryData;
|
|
9
|
-
export declare const tableData: TableData<"task-pass-rate" | "code-lines">;
|
|
10
|
-
/** rows: "experiment" 的榜单形态:行携带 agent/model 元信息与 eval 级折叠计票。 */
|
|
11
|
-
export declare const tableDataWithMeta: TableData<"task-pass-rate">;
|
|
5
|
+
/** scopeSummaryData 的产物形态:两级计票恒随行,成功率与总成本是官方 MetricCell。 */
|
|
6
|
+
export declare const scopeSummaryData: ScopeSummaryData;
|
|
7
|
+
export declare const tableData: TableData;
|
|
12
8
|
export declare const matrixData: MatrixData;
|
|
13
9
|
export declare const scoreboardData: ScoreboardData;
|
|
14
10
|
export declare const scatterData: ScatterData;
|
|
15
11
|
export declare const lineData: LineData;
|
|
16
|
-
export declare const deltaData: DeltaData
|
|
12
|
+
export declare const deltaData: DeltaData;
|
|
17
13
|
export declare const attemptListItems: AttemptListItem[];
|
|
18
14
|
export declare const evalListItems: EvalListItem[];
|
|
19
15
|
export declare const experimentListItems: ExperimentListItem[];
|