niceeval 0.5.4 → 0.6.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 +55 -0
- package/dist/agents/types.d.ts +317 -0
- package/dist/context/types.d.ts +335 -0
- package/dist/i18n/core.d.ts +11 -0
- package/dist/i18n/en.d.ts +181 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/zh-CN.d.ts +183 -0
- package/dist/o11y/execution-tree.d.ts +103 -0
- package/dist/o11y/otlp/parse.d.ts +3 -0
- package/dist/o11y/otlp/receiver.d.ts +21 -0
- package/dist/o11y/otlp/select.d.ts +22 -0
- package/dist/o11y/otlp/turn-otel.d.ts +43 -0
- package/dist/o11y/types.d.ts +190 -0
- package/dist/report/aggregate.d.ts +57 -0
- package/dist/report/aggregate.js +212 -0
- package/dist/report/built-ins/cost-pass-rate-comparison.d.ts +1 -0
- package/dist/report/built-ins/cost-pass-rate-comparison.js +17 -0
- package/dist/report/built-ins/index.d.ts +1 -0
- package/dist/report/built-ins/index.js +2 -0
- package/dist/report/components.d.ts +178 -0
- package/dist/report/components.js +132 -0
- package/dist/report/compute.d.ts +106 -0
- package/dist/report/compute.js +618 -0
- package/dist/report/flag.d.ts +6 -0
- package/dist/report/flag.js +8 -0
- package/dist/report/format.d.ts +32 -0
- package/dist/report/format.js +126 -0
- package/dist/report/index.d.ts +19 -0
- package/dist/report/index.js +30 -0
- package/dist/report/load.d.ts +12 -0
- package/dist/report/load.js +56 -0
- package/dist/report/locale.d.ts +83 -0
- package/dist/report/locale.js +160 -0
- package/dist/report/metrics.d.ts +21 -0
- package/dist/report/metrics.js +115 -0
- package/dist/report/primitives.d.ts +64 -0
- package/dist/report/primitives.js +113 -0
- package/dist/report/react/AttemptList.d.ts +23 -0
- package/dist/report/react/AttemptList.js +20 -0
- package/dist/report/react/DeltaTable.d.ts +8 -0
- package/dist/report/react/DeltaTable.js +24 -0
- package/dist/report/react/EvalList.d.ts +10 -0
- package/dist/report/react/EvalList.js +0 -0
- package/dist/report/react/ExperimentList.d.ts +10 -0
- package/dist/report/react/ExperimentList.js +15 -0
- package/dist/report/react/GroupSummary.d.ts +8 -0
- package/dist/report/react/GroupSummary.js +8 -0
- package/dist/report/react/MetricBars.d.ts +10 -0
- package/dist/report/react/MetricBars.js +48 -0
- package/dist/report/react/MetricLine.d.ts +9 -0
- package/dist/report/react/MetricLine.js +68 -0
- package/dist/report/react/MetricMatrix.d.ts +10 -0
- package/dist/report/react/MetricMatrix.js +23 -0
- package/dist/report/react/MetricScatter.d.ts +9 -0
- package/dist/report/react/MetricScatter.js +100 -0
- package/dist/report/react/MetricTable.d.ts +11 -0
- package/dist/report/react/MetricTable.js +26 -0
- package/dist/report/react/RunOverview.d.ts +8 -0
- package/dist/report/react/RunOverview.js +12 -0
- package/dist/report/react/Scoreboard.d.ts +8 -0
- package/dist/report/react/Scoreboard.js +26 -0
- package/dist/report/react/cell.d.ts +9 -0
- package/dist/report/react/cell.js +9 -0
- package/dist/report/react/chart-math.d.ts +14 -0
- package/dist/report/react/chart-math.js +68 -0
- package/dist/report/react/colors.d.ts +14 -0
- package/dist/report/react/colors.js +45 -0
- package/dist/report/react/fixtures.d.ts +19 -0
- package/dist/report/react/fixtures.js +393 -0
- package/dist/report/react/format.d.ts +3 -0
- package/dist/report/react/format.js +7 -0
- package/dist/report/react/index.d.ts +6 -0
- package/dist/report/react/index.js +14 -0
- package/dist/report/report.d.ts +24 -0
- package/dist/report/report.js +49 -0
- package/dist/report/text/faces.d.ts +29 -0
- package/dist/report/text/faces.js +503 -0
- package/dist/report/text/layout.d.ts +75 -0
- package/dist/report/text/layout.js +173 -0
- package/dist/report/text/plot.d.ts +37 -0
- package/dist/report/text/plot.js +81 -0
- package/dist/report/text/table.d.ts +8 -0
- package/dist/report/text/table.js +86 -0
- package/dist/report/tree.d.ts +99 -0
- package/dist/report/tree.js +228 -0
- package/dist/report/types.d.ts +420 -0
- package/dist/report/types.js +4 -0
- package/dist/report/web.d.ts +15 -0
- package/dist/report/web.js +37 -0
- package/dist/results/annotated-source.d.ts +61 -0
- package/dist/results/attempt-evidence.d.ts +69 -0
- package/dist/results/attempt-source.d.ts +15 -0
- package/dist/results/locator.d.ts +75 -0
- package/dist/results/locator.js +0 -0
- package/dist/results/select.d.ts +45 -0
- package/dist/results/select.js +230 -0
- package/dist/results/source-hash.d.ts +9 -0
- package/dist/results/types.d.ts +204 -0
- package/dist/runner/eval-source.d.ts +22 -0
- package/dist/runner/fingerprint.d.ts +23 -0
- package/dist/runner/types.d.ts +332 -0
- package/dist/sandbox/docker-stream.d.ts +24 -0
- package/dist/sandbox/docker.d.ts +84 -0
- package/dist/sandbox/e2b.d.ts +31 -0
- package/dist/sandbox/errors.d.ts +4 -0
- package/dist/sandbox/local-files.d.ts +6 -0
- package/dist/sandbox/paths.d.ts +4 -0
- package/dist/sandbox/registry.d.ts +13 -0
- package/dist/sandbox/resolve.d.ts +40 -0
- package/dist/sandbox/retry.d.ts +10 -0
- package/dist/sandbox/shell.d.ts +11 -0
- package/dist/sandbox/source-files.d.ts +13 -0
- package/dist/sandbox/types.d.ts +203 -0
- package/dist/sandbox/vercel.d.ts +37 -0
- package/dist/scoring/types.d.ts +70 -0
- package/dist/shared/aggregate.d.ts +29 -0
- package/dist/shared/aggregate.js +55 -0
- package/dist/shared/types.d.ts +27 -0
- package/dist/shared/verdict.d.ts +27 -0
- package/dist/shared/verdict.js +34 -0
- package/dist/tty-line.d.ts +6 -0
- package/dist/types.d.ts +7 -0
- package/dist/util.d.ts +22 -0
- package/docs-site/zh/concepts/adapter.mdx +5 -5
- package/docs-site/zh/concepts/assert.mdx +8 -8
- package/docs-site/zh/concepts/evals.mdx +5 -5
- package/docs-site/zh/concepts/experiment.mdx +2 -2
- package/docs-site/zh/concepts/judge.mdx +9 -9
- package/docs-site/zh/concepts/overview.mdx +2 -2
- package/docs-site/zh/concepts/tier.mdx +6 -6
- package/docs-site/zh/example/claude-code-codex-plugin.mdx +9 -5
- package/docs-site/zh/example/claude-code-codex-skill.mdx +12 -7
- package/docs-site/zh/guides/agent-feedback-loop.mdx +235 -78
- package/docs-site/zh/guides/connect-otel.mdx +3 -3
- package/docs-site/zh/guides/connect-your-agent.mdx +2 -2
- package/docs-site/zh/guides/custom-reports.mdx +196 -36
- package/docs-site/zh/guides/experiments.mdx +7 -1
- package/docs-site/zh/guides/fixtures.mdx +1 -1
- package/docs-site/zh/guides/official-adapters.mdx +31 -9
- package/docs-site/zh/guides/publish-report.mdx +3 -3
- package/docs-site/zh/guides/report-components.mdx +194 -55
- package/docs-site/zh/guides/reporters.mdx +2 -2
- package/docs-site/zh/guides/results-data.mdx +35 -34
- package/docs-site/zh/guides/runner.mdx +2 -2
- package/docs-site/zh/guides/sandbox-agent.mdx +2 -2
- package/docs-site/zh/guides/{sandbox-backends.mdx → sandbox-providers.mdx} +11 -11
- package/docs-site/zh/guides/viewing-results.mdx +199 -79
- package/docs-site/zh/guides/write-experiment.mdx +9 -1
- package/docs-site/zh/guides/write-send.mdx +2 -2
- package/docs-site/zh/index.mdx +4 -3
- package/docs-site/zh/introduction.mdx +2 -1
- package/docs-site/zh/quickstart.mdx +5 -3
- package/docs-site/zh/reference/builtin-agents.mdx +38 -13
- package/docs-site/zh/reference/capabilities.mdx +1 -1
- package/docs-site/zh/reference/cli.mdx +36 -13
- package/docs-site/zh/reference/define-agent.mdx +12 -12
- package/docs-site/zh/reference/define-config.mdx +1 -1
- package/docs-site/zh/reference/define-eval.mdx +3 -3
- package/docs-site/zh/reference/events.mdx +7 -1
- package/docs-site/zh/reference/expect.mdx +3 -3
- package/package.json +10 -6
- package/src/agents/bub.ts +129 -42
- package/src/agents/claude-code.test.ts +152 -0
- package/src/agents/claude-code.ts +127 -13
- package/src/agents/codex.test.ts +192 -0
- package/src/agents/codex.ts +151 -12
- package/src/agents/index.ts +9 -3
- package/src/agents/manifest.ts +41 -0
- package/src/agents/plugin-config.test.ts +94 -0
- package/src/agents/shared.ts +33 -2
- package/src/agents/skills.test.ts +214 -0
- package/src/agents/skills.ts +304 -0
- package/src/agents/streaming.ts +5 -5
- package/src/agents/types.ts +54 -2
- package/src/cli.ts +74 -47
- package/src/context/context.test.ts +20 -2
- package/src/context/control-flow.ts +1 -1
- package/src/context/session.test.ts +92 -1
- package/src/context/session.ts +23 -1
- package/src/context/types.ts +4 -4
- package/src/define.test.ts +8 -8
- package/src/define.ts +11 -11
- package/src/expect/index.ts +5 -5
- package/src/i18n/en.ts +34 -15
- package/src/i18n/zh-CN.ts +37 -21
- package/src/index.ts +1 -1
- package/src/o11y/execution-tree.test.ts +452 -0
- package/src/o11y/execution-tree.ts +367 -0
- package/src/o11y/otlp/receiver.ts +1 -1
- package/src/o11y/otlp/select.ts +7 -3
- package/src/o11y/parsers/claude-code.test.ts +175 -0
- package/src/o11y/parsers/claude-code.ts +32 -0
- package/src/o11y/types.ts +6 -1
- package/src/report/aggregate.ts +26 -20
- package/src/report/built-in-user-parity.test.tsx +643 -0
- package/src/report/built-ins/cost-pass-rate-comparison.tsx +23 -0
- package/src/report/built-ins/index.ts +2 -0
- package/src/report/components.tsx +223 -50
- package/src/report/compute.ts +358 -53
- package/src/report/dual-render.test.tsx +1125 -0
- package/src/report/flag.ts +1 -1
- package/src/report/format.ts +50 -2
- package/src/report/index.ts +48 -14
- package/src/report/load.ts +1 -1
- package/src/report/locale.ts +206 -0
- package/src/report/metrics.ts +39 -15
- package/src/report/primitives.tsx +100 -2
- package/src/report/react/AttemptList.tsx +115 -0
- package/src/report/react/DeltaTable.tsx +9 -6
- package/src/report/react/EvalList.tsx +0 -0
- package/src/report/react/ExperimentList.tsx +108 -0
- package/src/report/react/GroupSummary.tsx +66 -0
- package/src/report/react/MetricBars.tsx +24 -13
- package/src/report/react/MetricLine.tsx +21 -21
- package/src/report/react/MetricMatrix.tsx +8 -4
- package/src/report/react/MetricScatter.tsx +136 -96
- package/src/report/react/MetricTable.tsx +115 -15
- package/src/report/react/RunOverview.tsx +48 -26
- package/src/report/react/Scoreboard.tsx +15 -7
- package/src/report/react/cell.tsx +18 -9
- package/src/{view/app/lib/chart.ts → report/react/chart-math.ts} +2 -6
- package/src/report/react/colors.ts +24 -15
- package/src/report/react/enhance.js +129 -0
- package/src/report/react/fixtures.ts +163 -34
- package/src/report/react/format.ts +1 -1
- package/src/report/react/index.tsx +22 -6
- package/src/report/react/render.test.tsx +164 -31
- package/src/report/react/styles.css +405 -213
- package/src/report/report.test.ts +403 -94
- package/src/report/report.ts +29 -11
- package/src/report/text/faces.ts +303 -95
- package/src/report/text/layout.ts +76 -11
- package/src/report/text/table.ts +98 -0
- package/src/report/tree.ts +103 -20
- package/src/report/types.ts +196 -25
- package/src/report/web.ts +46 -19
- package/src/results/annotated-source.test.ts +146 -0
- package/src/results/annotated-source.ts +128 -0
- package/src/results/attempt-evidence.test.ts +158 -0
- package/src/results/attempt-evidence.ts +158 -0
- package/src/results/attempt-source.ts +48 -0
- package/src/results/copy.ts +154 -139
- package/src/results/format.ts +54 -47
- package/src/results/host-equivalence.test.ts +527 -0
- package/src/results/index.ts +56 -14
- package/src/results/locator.test.ts +198 -0
- package/src/results/locator.ts +0 -0
- package/src/results/open.ts +392 -175
- package/src/results/results.test.ts +943 -494
- package/src/results/select.ts +129 -23
- package/src/results/skipped-notice.ts +0 -0
- package/src/results/source-hash.ts +28 -0
- package/src/results/types.ts +98 -62
- package/src/results/writer.ts +304 -176
- package/src/runner/attempt.test.ts +170 -0
- package/src/runner/attempt.ts +48 -13
- package/src/runner/discover.test.ts +65 -0
- package/src/runner/discover.ts +6 -2
- package/src/runner/eval-source.test.ts +121 -0
- package/src/runner/eval-source.ts +45 -0
- package/src/runner/fingerprint.ts +54 -1
- package/src/runner/remote-sandbox.ts +1 -1
- package/src/runner/report.test.ts +6 -8
- package/src/runner/report.ts +5 -4
- package/src/runner/reporters/artifacts.ts +27 -41
- package/src/runner/reporters/braintrust.test.ts +3 -3
- package/src/runner/reporters/braintrust.ts +1 -1
- package/src/runner/reporters/console.ts +6 -6
- package/src/runner/reporters/json.ts +4 -4
- package/src/runner/reporters/live.test.ts +56 -0
- package/src/runner/reporters/live.ts +36 -10
- package/src/runner/reporters/quiet.test.ts +66 -0
- package/src/runner/reporters/quiet.ts +49 -0
- package/src/runner/reporters/shared.ts +5 -5
- package/src/runner/reporters/table.ts +17 -17
- package/src/runner/run.ts +61 -102
- package/src/runner/types.ts +43 -32
- package/src/sandbox/checkpoint.ts +1 -1
- package/src/sandbox/docker.ts +15 -2
- package/src/sandbox/e2b.ts +11 -5
- package/src/sandbox/errors.ts +13 -0
- package/src/sandbox/index.ts +3 -3
- package/src/sandbox/local-files.ts +1 -1
- package/src/sandbox/registry.ts +6 -5
- package/src/sandbox/resolve.ts +38 -23
- package/src/sandbox/retry.test.ts +68 -0
- package/src/sandbox/retry.ts +44 -0
- package/src/sandbox/types.ts +24 -24
- package/src/sandbox/vercel.ts +17 -3
- package/src/scoring/collector.ts +3 -3
- package/src/scoring/judge.ts +2 -2
- package/src/scoring/scoped.ts +13 -1
- package/src/scoring/types.ts +7 -7
- package/src/scoring/verdict.ts +4 -4
- package/src/shared/aggregate.ts +23 -3
- package/src/shared/types.ts +2 -2
- package/src/shared/{outcome.ts → verdict.ts} +15 -15
- package/src/show/compose.ts +12 -132
- package/src/show/index.ts +125 -94
- package/src/show/render.ts +660 -160
- package/src/show/show.test.ts +472 -253
- package/src/source-loc.ts +1 -1
- package/src/tty-line.ts +32 -0
- package/src/types.ts +2 -2
- package/src/util.test.ts +21 -1
- package/src/util.ts +5 -1
- package/src/view/app/App.tsx +33 -198
- package/src/view/app/components/AttemptModal.tsx +6 -6
- package/src/view/app/components/CodeView.tsx +2 -2
- package/src/view/app/components/CopyControls.tsx +32 -36
- package/src/view/app/components/SkippedRunsBanner.tsx +140 -0
- package/src/view/app/components/ui/badge.tsx +1 -1
- package/src/view/app/components/ui/dialog.tsx +2 -2
- package/src/view/app/i18n.ts +40 -31
- package/src/view/app/lib/artifact-url.ts +1 -1
- package/src/view/app/lib/attempt-route.test.ts +37 -47
- package/src/view/app/lib/attempt-route.ts +26 -26
- package/src/view/app/lib/rows.ts +9 -112
- package/src/view/app/lib/verdict.ts +25 -0
- package/src/view/app/main.tsx +9 -12
- package/src/view/app/pages/RunsPage.tsx +4 -4
- package/src/view/app/pages/TracesPage.tsx +3 -3
- package/src/view/app/shared.ts +0 -1
- package/src/view/app/types.ts +6 -51
- package/src/view/artifact-serving.test.ts +136 -0
- package/src/view/client-dist/app.css +1 -1
- package/src/view/client-dist/app.js +21 -21
- package/src/view/data.test.ts +214 -143
- package/src/view/data.ts +166 -120
- package/src/view/index.ts +23 -11
- package/src/view/server.ts +52 -17
- package/src/view/shared/types.ts +22 -31
- package/src/view/styles.css +117 -327
- package/src/view/view-report.test.ts +146 -98
- package/src/report/default-report.tsx +0 -222
- package/src/report/dual-face.test.tsx +0 -527
- package/src/report/react/CaseList.tsx +0 -70
- package/src/view/app/components/CostScoreChart.tsx +0 -147
- package/src/view/app/components/ExperimentTable.tsx +0 -284
- package/src/view/app/components/GroupSelector.tsx +0 -61
- package/src/view/app/components/primitives.tsx +0 -43
- package/src/view/app/lib/outcome.ts +0 -82
|
@@ -3,13 +3,22 @@
|
|
|
3
3
|
// MetricBars.data 就是 MetricMatrix.data(同一份矩阵数据的另一种摆法),别名显式化。
|
|
4
4
|
//
|
|
5
5
|
// 官方组件在宿主里自动接上证据室:web 面的 attemptHref 缺省取 ctx.attemptHref
|
|
6
|
-
// (宿主注入的证据室深链);显式传 prop 可覆盖(嵌进自己应用时自定去处)
|
|
6
|
+
// (宿主注入的证据室深链);显式传 prop 可覆盖(嵌进自己应用时自定去处)。三个实体列表
|
|
7
|
+
// (ExperimentList / EvalList / AttemptList)没有这个覆盖口子——它们的 locator 徽标恒经
|
|
8
|
+
// ctx.attemptHref / ctx.attemptCommand,不接受 attemptHref/attemptCommand prop(docs/feature/reports/library.md
|
|
9
|
+
// 「嵌入自己的 React 页面」的函数签名没有这个参数),证据室深链在这三个组件上不是可选行为。
|
|
7
10
|
|
|
8
11
|
import { defineComponent, isHostWebContextActive } from "./tree.ts";
|
|
9
|
-
import type {
|
|
12
|
+
import type { ReportComponent } from "./tree.ts";
|
|
13
|
+
import type { ReportLocale } from "./locale.ts";
|
|
14
|
+
import type { AttemptLocator } from "../results/locator.ts";
|
|
15
|
+
import type { Selection } from "../results/types.ts";
|
|
10
16
|
import type {
|
|
11
|
-
|
|
17
|
+
AttemptListItem,
|
|
12
18
|
DeltaData,
|
|
19
|
+
EvalListItem,
|
|
20
|
+
ExperimentListItem,
|
|
21
|
+
GroupSummaryData,
|
|
13
22
|
LineData,
|
|
14
23
|
MatrixData,
|
|
15
24
|
OverviewData,
|
|
@@ -18,8 +27,11 @@ import type {
|
|
|
18
27
|
TableData,
|
|
19
28
|
} from "./types.ts";
|
|
20
29
|
import {
|
|
21
|
-
|
|
30
|
+
attemptListData,
|
|
22
31
|
deltaData,
|
|
32
|
+
evalListData,
|
|
33
|
+
experimentListData,
|
|
34
|
+
groupSummaryData,
|
|
23
35
|
lineData,
|
|
24
36
|
matrixData,
|
|
25
37
|
overviewData,
|
|
@@ -27,10 +39,14 @@ import {
|
|
|
27
39
|
scoreboardData,
|
|
28
40
|
tableData,
|
|
29
41
|
} from "./compute.ts";
|
|
42
|
+
import type { ScatterDataOptions } from "./compute.ts";
|
|
30
43
|
import {
|
|
44
|
+
attemptListText,
|
|
31
45
|
barsText,
|
|
32
|
-
caseListText,
|
|
33
46
|
deltaText,
|
|
47
|
+
evalListText,
|
|
48
|
+
experimentListText,
|
|
49
|
+
groupSummaryText,
|
|
34
50
|
lineText,
|
|
35
51
|
matrixText,
|
|
36
52
|
overviewText,
|
|
@@ -39,6 +55,10 @@ import {
|
|
|
39
55
|
tableText,
|
|
40
56
|
} from "./text/faces.ts";
|
|
41
57
|
import { RunOverview as RunOverviewWeb } from "./react/RunOverview.tsx";
|
|
58
|
+
import { GroupSummary as GroupSummaryWeb } from "./react/GroupSummary.tsx";
|
|
59
|
+
import { ExperimentList as ExperimentListWeb } from "./react/ExperimentList.tsx";
|
|
60
|
+
import { EvalList as EvalListWeb } from "./react/EvalList.tsx";
|
|
61
|
+
import { AttemptList as AttemptListWeb } from "./react/AttemptList.tsx";
|
|
42
62
|
import { MetricTable as MetricTableWeb } from "./react/MetricTable.tsx";
|
|
43
63
|
import { MetricMatrix as MetricMatrixWeb } from "./react/MetricMatrix.tsx";
|
|
44
64
|
import { MetricBars as MetricBarsWeb } from "./react/MetricBars.tsx";
|
|
@@ -46,93 +66,248 @@ import { Scoreboard as ScoreboardWeb } from "./react/Scoreboard.tsx";
|
|
|
46
66
|
import { MetricScatter as MetricScatterWeb } from "./react/MetricScatter.tsx";
|
|
47
67
|
import { MetricLine as MetricLineWeb } from "./react/MetricLine.tsx";
|
|
48
68
|
import { DeltaTable as DeltaTableWeb } from "./react/DeltaTable.tsx";
|
|
49
|
-
import { CaseList as CaseListWeb } from "./react/CaseList.tsx";
|
|
50
69
|
|
|
51
70
|
// ───────────────────────── props ─────────────────────────
|
|
52
71
|
|
|
53
72
|
export interface RunOverviewProps {
|
|
54
73
|
data: OverviewData;
|
|
74
|
+
/** chrome 文案 locale;省略时随宿主上下文(宿主外默认 "en")。 */
|
|
75
|
+
locale?: ReportLocale;
|
|
76
|
+
className?: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface GroupSummaryProps {
|
|
80
|
+
data: GroupSummaryData;
|
|
81
|
+
/** chrome 文案 locale;省略时随宿主上下文(宿主外默认 "en")。 */
|
|
82
|
+
locale?: ReportLocale;
|
|
83
|
+
className?: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 三个实体列表都只收算好的 `items`(`.data(selection)` 的产物,报告作者先 `.filter()`/
|
|
88
|
+
* `.slice()` 再传入)——没有 selection-form,组件不提供另一套过滤 DSL
|
|
89
|
+
* (docs/feature/reports/library.md「实体列表」)。
|
|
90
|
+
*/
|
|
91
|
+
export interface ExperimentListProps {
|
|
92
|
+
items: ExperimentListItem[];
|
|
93
|
+
/** chrome 文案 locale;省略时随宿主上下文(宿主外默认 "en")。 */
|
|
94
|
+
locale?: ReportLocale;
|
|
95
|
+
className?: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface EvalListProps {
|
|
99
|
+
items: EvalListItem[];
|
|
100
|
+
/** chrome 文案 locale;省略时随宿主上下文(宿主外默认 "en")。 */
|
|
101
|
+
locale?: ReportLocale;
|
|
102
|
+
className?: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface AttemptListProps {
|
|
106
|
+
items: AttemptListItem[];
|
|
107
|
+
/** items 被 slice 时如实显示剩余数量;省略即 items.length(未截断)。 */
|
|
108
|
+
total?: number;
|
|
109
|
+
/** chrome 文案 locale;省略时随宿主上下文(宿主外默认 "en")。 */
|
|
110
|
+
locale?: ReportLocale;
|
|
55
111
|
className?: string;
|
|
56
112
|
}
|
|
57
113
|
|
|
58
114
|
export interface MetricTableProps {
|
|
59
115
|
data: TableData;
|
|
60
116
|
/** 传了,格子可点、下钻去处你定;不传,宿主里走证据室深链,宿主外纯展示。 */
|
|
61
|
-
attemptHref?: (
|
|
117
|
+
attemptHref?: (locator: AttemptLocator) => string;
|
|
118
|
+
/**
|
|
119
|
+
* web 面在表格前渲染一个过滤输入框(`<input class="nre-filter" data-nre-filter>`),
|
|
120
|
+
* 由渐进增强 runtime(enhance.js)接管:输入过滤行 textContent。无 JS 时输入框
|
|
121
|
+
* 静默无功能,表格内容依旧完整可读。默认 false;text 面不受影响。
|
|
122
|
+
*/
|
|
123
|
+
filter?: boolean;
|
|
124
|
+
/** chrome 文案 locale;省略时随宿主上下文(宿主外默认 "en")。 */
|
|
125
|
+
locale?: ReportLocale;
|
|
62
126
|
className?: string;
|
|
63
127
|
}
|
|
64
128
|
|
|
65
129
|
export interface MetricMatrixProps {
|
|
66
130
|
data: MatrixData;
|
|
67
|
-
attemptHref?: (
|
|
131
|
+
attemptHref?: (locator: AttemptLocator) => string;
|
|
132
|
+
/** chrome 文案 locale;省略时随宿主上下文(宿主外默认 "en")。 */
|
|
133
|
+
locale?: ReportLocale;
|
|
68
134
|
className?: string;
|
|
69
135
|
}
|
|
70
136
|
|
|
71
137
|
export interface ScoreboardProps {
|
|
72
138
|
data: ScoreboardData;
|
|
139
|
+
/** chrome 文案 locale;省略时随宿主上下文(宿主外默认 "en")。 */
|
|
140
|
+
locale?: ReportLocale;
|
|
73
141
|
className?: string;
|
|
74
142
|
}
|
|
75
143
|
|
|
76
|
-
|
|
77
|
-
|
|
144
|
+
/** MetricScatter 两臂共享的纯渲染选项(不含数据来源)。 */
|
|
145
|
+
interface MetricScatterRenderProps {
|
|
78
146
|
/** 点一个点 → 该配置的下钻页。 */
|
|
79
147
|
pointHref?: (row: ScatterData["rows"][number]) => string;
|
|
148
|
+
/** chrome 文案 locale;省略时随宿主上下文(宿主外默认 "en")。 */
|
|
149
|
+
locale?: ReportLocale;
|
|
80
150
|
className?: string;
|
|
81
151
|
}
|
|
82
152
|
|
|
153
|
+
/** resolve 之后 web / text 面看到的形态:数据已备好,零 IO。 */
|
|
154
|
+
export interface MetricScatterResolvedProps extends MetricScatterRenderProps {
|
|
155
|
+
data: ScatterData;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* 互斥两臂:要么直接给算好的 `data`(用于用户自己的 React 页面 / 预计算 / 跨边界序列化),
|
|
160
|
+
* 要么给 `selection` + 计算选项让宿主在渲染前解析(见 tree.ts 的 resolveReportTree)。
|
|
161
|
+
* 同时传 `data` 与 `selection`、或两者都不传,都在 typecheck 阶段失败。计算选项复用
|
|
162
|
+
* `ScatterDataOptions`,不手写会漂移的副本。
|
|
163
|
+
*/
|
|
164
|
+
export type MetricScatterProps =
|
|
165
|
+
| (MetricScatterResolvedProps & {
|
|
166
|
+
selection?: never;
|
|
167
|
+
points?: never;
|
|
168
|
+
series?: never;
|
|
169
|
+
x?: never;
|
|
170
|
+
y?: never;
|
|
171
|
+
})
|
|
172
|
+
| ({ data?: never } & ScatterDataOptions & MetricScatterRenderProps & { selection: Selection });
|
|
173
|
+
|
|
83
174
|
export interface MetricLineProps {
|
|
84
175
|
data: LineData;
|
|
85
176
|
pointHref?: (row: LineData["rows"][number]) => string;
|
|
177
|
+
/** chrome 文案 locale;省略时随宿主上下文(宿主外默认 "en")。 */
|
|
178
|
+
locale?: ReportLocale;
|
|
86
179
|
className?: string;
|
|
87
180
|
}
|
|
88
181
|
|
|
89
182
|
export interface DeltaTableProps {
|
|
90
183
|
data: DeltaData;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
export interface CaseListProps {
|
|
95
|
-
data: CaseListData;
|
|
96
|
-
attemptHref?: (ref: AttemptRef) => string;
|
|
184
|
+
/** chrome 文案 locale;省略时随宿主上下文(宿主外默认 "en")。 */
|
|
185
|
+
locale?: ReportLocale;
|
|
97
186
|
className?: string;
|
|
98
187
|
}
|
|
99
188
|
|
|
100
189
|
// ───────────────────────── 装配 ─────────────────────────
|
|
101
190
|
|
|
102
|
-
|
|
103
|
-
|
|
191
|
+
const SCATTER_UNRESOLVED_MESSAGE =
|
|
192
|
+
"MetricScatter received unresolved (selection-form) props outside the report host pipeline. " +
|
|
193
|
+
"Render through defineReport + niceeval show/view (or renderReportToText/renderReportToStaticHtml), " +
|
|
194
|
+
"or precompute with `await MetricScatter.data(selection, options)` and pass the result as `data`.";
|
|
195
|
+
|
|
196
|
+
/** 渲染面(web / text)只吃已解析的数据形态;selection 形态漏解析时直说,而不是画一张空组件。 */
|
|
197
|
+
function requireScatterData(props: { data?: ScatterData }): ScatterData {
|
|
198
|
+
if (props.data === undefined) throw new Error(SCATTER_UNRESOLVED_MESSAGE);
|
|
199
|
+
return props.data;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** 页头 KPI 条:何时跑的、几个配置、几道题、通过率、总成本;Selection 的警告随行显示在条内。 */
|
|
203
|
+
export const RunOverview: ReportComponent<RunOverviewProps> & { data: typeof overviewData } = Object.assign(
|
|
104
204
|
defineComponent<RunOverviewProps>({
|
|
105
|
-
web: (props) => <RunOverviewWeb {...props} />,
|
|
106
|
-
text: ({ data }) => overviewText(data),
|
|
205
|
+
web: (props, ctx) => <RunOverviewWeb {...props} locale={props.locale ?? ctx.locale} />,
|
|
206
|
+
text: ({ data }, ctx) => overviewText(data, ctx),
|
|
107
207
|
}),
|
|
108
208
|
{ data: overviewData },
|
|
109
209
|
);
|
|
110
210
|
RunOverview.displayName = "RunOverview";
|
|
111
211
|
|
|
212
|
+
/**
|
|
213
|
+
* 组摘要:一组 experiment(典型用法是同一 `<Section>` 内的全部 experiment)的紧凑统计——
|
|
214
|
+
* 通过率(旧 GroupSelector 卡片口径)、experiment/eval/attempt 数、eval 级折叠计票、
|
|
215
|
+
* 总成本、最后运行时间。
|
|
216
|
+
*/
|
|
217
|
+
export const GroupSummary: ReportComponent<GroupSummaryProps> & { data: typeof groupSummaryData } = Object.assign(
|
|
218
|
+
defineComponent<GroupSummaryProps>({
|
|
219
|
+
web: (props, ctx) => <GroupSummaryWeb {...props} locale={props.locale ?? ctx.locale} />,
|
|
220
|
+
text: ({ data }, ctx) => groupSummaryText(data, ctx),
|
|
221
|
+
}),
|
|
222
|
+
{ data: groupSummaryData },
|
|
223
|
+
);
|
|
224
|
+
GroupSummary.displayName = "GroupSummary";
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* 实验列表:每项一个 experiment,固定展示身份、配置(flags)、Eval 判定构成和官方两级聚合
|
|
228
|
+
* 汇总指标;展开到这个 experiment 的 Eval,每道题内联该题全部 Attempt 的 locator 徽标。
|
|
229
|
+
* 没有 selection-form:`ExperimentList.data(selection)` 产出普通数组,过滤由报告作者对
|
|
230
|
+
* 数组调用 `.filter()`。
|
|
231
|
+
*/
|
|
232
|
+
export const ExperimentList: ReportComponent<ExperimentListProps> & { data: typeof experimentListData } =
|
|
233
|
+
Object.assign(
|
|
234
|
+
defineComponent<ExperimentListProps>({
|
|
235
|
+
web: (props, ctx) => <ExperimentListWeb {...props} locale={props.locale ?? ctx.locale} attemptHref={ctx.attemptHref} />,
|
|
236
|
+
text: ({ items }, ctx) => experimentListText(items, ctx),
|
|
237
|
+
}),
|
|
238
|
+
{ data: experimentListData },
|
|
239
|
+
);
|
|
240
|
+
ExperimentList.displayName = "ExperimentList";
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Eval 列表:每项一个 `experimentId + evalId`,固定展示判定、Attempt 数、分数、成本、耗时
|
|
244
|
+
* 与失败原因;展开到这道题的 Attempt(与 AttemptList 同一份 AttemptListItem)。
|
|
245
|
+
*/
|
|
246
|
+
export const EvalList: ReportComponent<EvalListProps> & { data: typeof evalListData } = Object.assign(
|
|
247
|
+
defineComponent<EvalListProps>({
|
|
248
|
+
web: (props, ctx) => <EvalListWeb {...props} locale={props.locale ?? ctx.locale} attemptHref={ctx.attemptHref} />,
|
|
249
|
+
text: ({ items }, ctx) => evalListText(items, ctx),
|
|
250
|
+
}),
|
|
251
|
+
{ data: evalListData },
|
|
252
|
+
);
|
|
253
|
+
EvalList.displayName = "EvalList";
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Attempt 列表:实体列表的叶子层,每项一个 Attempt,固定展示判定、断言、error、Judge 评语
|
|
257
|
+
* (assertions 的 detail/evidence)与证据引用(locator + 证据能力标记)。它不预设只看失败;
|
|
258
|
+
* 报告作者过滤 `AttemptListItem[]`、用 `.slice()` 限量,`total` 让渲染面如实报告剩余数量。
|
|
259
|
+
*/
|
|
260
|
+
export const AttemptList: ReportComponent<AttemptListProps> & { data: typeof attemptListData } = Object.assign(
|
|
261
|
+
defineComponent<AttemptListProps>({
|
|
262
|
+
web: (props, ctx) => <AttemptListWeb {...props} locale={props.locale ?? ctx.locale} attemptHref={ctx.attemptHref} />,
|
|
263
|
+
text: ({ items, total }, ctx) => attemptListText(items, total, ctx),
|
|
264
|
+
}),
|
|
265
|
+
{ data: attemptListData },
|
|
266
|
+
);
|
|
267
|
+
AttemptList.displayName = "AttemptList";
|
|
268
|
+
|
|
112
269
|
/** 榜单:一行一个维度值、一列一个指标,回答「谁整体更好」。 */
|
|
113
|
-
export const MetricTable = Object.assign(
|
|
270
|
+
export const MetricTable: ReportComponent<MetricTableProps> & { data: typeof tableData } = Object.assign(
|
|
114
271
|
defineComponent<MetricTableProps>({
|
|
115
|
-
web: (props, ctx) =>
|
|
116
|
-
|
|
272
|
+
web: (props, ctx) => (
|
|
273
|
+
<MetricTableWeb
|
|
274
|
+
{...props}
|
|
275
|
+
locale={props.locale ?? ctx.locale}
|
|
276
|
+
attemptHref={props.attemptHref ?? (isHostWebContextActive() ? ctx.attemptHref : undefined)}
|
|
277
|
+
/>
|
|
278
|
+
),
|
|
279
|
+
text: ({ data }, ctx) => tableText(data, ctx),
|
|
117
280
|
}),
|
|
118
281
|
{ data: tableData },
|
|
119
282
|
);
|
|
120
283
|
MetricTable.displayName = "MetricTable";
|
|
121
284
|
|
|
122
285
|
/** 逐题格子:行 × 列两个维度、格子里一个指标,回答「哪道题谁挂了」。 */
|
|
123
|
-
export const MetricMatrix = Object.assign(
|
|
286
|
+
export const MetricMatrix: ReportComponent<MetricMatrixProps> & { data: typeof matrixData } = Object.assign(
|
|
124
287
|
defineComponent<MetricMatrixProps>({
|
|
125
|
-
web: (props, ctx) =>
|
|
126
|
-
|
|
288
|
+
web: (props, ctx) => (
|
|
289
|
+
<MetricMatrixWeb
|
|
290
|
+
{...props}
|
|
291
|
+
locale={props.locale ?? ctx.locale}
|
|
292
|
+
attemptHref={props.attemptHref ?? (isHostWebContextActive() ? ctx.attemptHref : undefined)}
|
|
293
|
+
/>
|
|
294
|
+
),
|
|
295
|
+
text: ({ data }, ctx) => matrixText(data, ctx),
|
|
127
296
|
}),
|
|
128
297
|
{ data: matrixData },
|
|
129
298
|
);
|
|
130
299
|
MetricMatrix.displayName = "MetricMatrix";
|
|
131
300
|
|
|
132
301
|
/** 分组条形:同一份矩阵数据的另一种摆法;MetricBars.data 就是 MetricMatrix.data 的别名。 */
|
|
133
|
-
export const MetricBars = Object.assign(
|
|
302
|
+
export const MetricBars: ReportComponent<MetricMatrixProps> & { data: typeof matrixData } = Object.assign(
|
|
134
303
|
defineComponent<MetricMatrixProps>({
|
|
135
|
-
web: (props, ctx) =>
|
|
304
|
+
web: (props, ctx) => (
|
|
305
|
+
<MetricBarsWeb
|
|
306
|
+
{...props}
|
|
307
|
+
locale={props.locale ?? ctx.locale}
|
|
308
|
+
attemptHref={props.attemptHref ?? (isHostWebContextActive() ? ctx.attemptHref : undefined)}
|
|
309
|
+
/>
|
|
310
|
+
),
|
|
136
311
|
text: ({ data }) => barsText(data),
|
|
137
312
|
}),
|
|
138
313
|
{ data: matrixData },
|
|
@@ -140,29 +315,37 @@ export const MetricBars = Object.assign(
|
|
|
140
315
|
MetricBars.displayName = "MetricBars";
|
|
141
316
|
|
|
142
317
|
/** 考试成绩单:总分 + 分科小计,固定分母、missing 如实报。 */
|
|
143
|
-
export const Scoreboard = Object.assign(
|
|
318
|
+
export const Scoreboard: ReportComponent<ScoreboardProps> & { data: typeof scoreboardData } = Object.assign(
|
|
144
319
|
defineComponent<ScoreboardProps>({
|
|
145
|
-
web: (props) => <ScoreboardWeb {...props} />,
|
|
146
|
-
text: ({ data }) => scoreboardText(data),
|
|
320
|
+
web: (props, ctx) => <ScoreboardWeb {...props} locale={props.locale ?? ctx.locale} />,
|
|
321
|
+
text: ({ data }, ctx) => scoreboardText(data, ctx),
|
|
147
322
|
}),
|
|
148
323
|
{ data: scoreboardData },
|
|
149
324
|
);
|
|
150
325
|
Scoreboard.displayName = "Scoreboard";
|
|
151
326
|
|
|
152
327
|
/** 质量 × 成本 frontier:每个点一个配置、两个指标各占一轴,「好」的角落恒在右上。 */
|
|
153
|
-
export const MetricScatter = Object.assign(
|
|
154
|
-
defineComponent<MetricScatterProps>({
|
|
155
|
-
|
|
156
|
-
|
|
328
|
+
export const MetricScatter: ReportComponent<MetricScatterProps> & { data: typeof scatterData } = Object.assign(
|
|
329
|
+
defineComponent<MetricScatterProps, MetricScatterResolvedProps>({
|
|
330
|
+
resolve: async (props) => {
|
|
331
|
+
if ("data" in props && props.data !== undefined) return props;
|
|
332
|
+
const { selection, points, series, x, y, ...rest } = props;
|
|
333
|
+
return { ...rest, data: await scatterData(selection, { points, series, x, y }) };
|
|
334
|
+
},
|
|
335
|
+
web: (props, ctx) => {
|
|
336
|
+
requireScatterData(props);
|
|
337
|
+
return <MetricScatterWeb {...props} locale={props.locale ?? ctx.locale} />;
|
|
338
|
+
},
|
|
339
|
+
text: (props, ctx) => scatterText(requireScatterData(props), ctx),
|
|
157
340
|
}),
|
|
158
341
|
{ data: scatterData },
|
|
159
342
|
);
|
|
160
343
|
MetricScatter.displayName = "MetricScatter";
|
|
161
344
|
|
|
162
345
|
/** 趋势线:x 是 experiment 声明的 flag(flag()),同系列按 x 排序连线。 */
|
|
163
|
-
export const MetricLine = Object.assign(
|
|
346
|
+
export const MetricLine: ReportComponent<MetricLineProps> & { data: typeof lineData } = Object.assign(
|
|
164
347
|
defineComponent<MetricLineProps>({
|
|
165
|
-
web: (props) => <MetricLineWeb {...props} />,
|
|
348
|
+
web: (props, ctx) => <MetricLineWeb {...props} locale={props.locale ?? ctx.locale} />,
|
|
166
349
|
text: ({ data }, ctx) => lineText(data, ctx),
|
|
167
350
|
}),
|
|
168
351
|
{ data: lineData },
|
|
@@ -170,21 +353,11 @@ export const MetricLine = Object.assign(
|
|
|
170
353
|
MetricLine.displayName = "MetricLine";
|
|
171
354
|
|
|
172
355
|
/** 成对对比:每行一对配置、格子里 A、B、Δ 三个值,涨跌好坏由 better 判定。 */
|
|
173
|
-
export const DeltaTable = Object.assign(
|
|
356
|
+
export const DeltaTable: ReportComponent<DeltaTableProps> & { data: typeof deltaData } = Object.assign(
|
|
174
357
|
defineComponent<DeltaTableProps>({
|
|
175
|
-
web: (props) => <DeltaTableWeb {...props} />,
|
|
176
|
-
text: ({ data }) => deltaText(data),
|
|
358
|
+
web: (props, ctx) => <DeltaTableWeb {...props} locale={props.locale ?? ctx.locale} />,
|
|
359
|
+
text: ({ data }, ctx) => deltaText(data, ctx),
|
|
177
360
|
}),
|
|
178
361
|
{ data: deltaData },
|
|
179
362
|
);
|
|
180
363
|
DeltaTable.displayName = "DeltaTable";
|
|
181
|
-
|
|
182
|
-
/** 失败案例清单:榜单回答「多少」,它回答「为什么」;truncated 如实报剩余。 */
|
|
183
|
-
export const CaseList = Object.assign(
|
|
184
|
-
defineComponent<CaseListProps>({
|
|
185
|
-
web: (props, ctx) => <CaseListWeb {...props} attemptHref={props.attemptHref ?? (isHostWebContextActive() ? ctx.attemptHref : undefined)} />,
|
|
186
|
-
text: (props, ctx) => caseListText(props.data, ctx),
|
|
187
|
-
}),
|
|
188
|
-
{ data: caseListData },
|
|
189
|
-
);
|
|
190
|
-
CaseList.displayName = "CaseList";
|