niceeval 0.6.1 → 0.6.2
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/dist/agents/types.d.ts +67 -5
- package/dist/context/types.d.ts +32 -12
- package/dist/i18n/en.d.ts +54 -0
- package/dist/i18n/zh-CN.d.ts +55 -1
- package/dist/o11y/types.d.ts +16 -2
- package/dist/report/aggregate.d.ts +5 -3
- package/dist/report/aggregate.js +32 -5
- package/dist/report/built-ins/experiment-comparison.d.ts +39 -1
- package/dist/report/built-ins/experiment-comparison.js +116 -10
- package/dist/report/built-ins/index.d.ts +1 -0
- package/dist/report/built-ins/index.js +1 -1
- package/dist/report/components.d.ts +8 -2
- package/dist/report/components.js +3 -3
- package/dist/report/compute.d.ts +11 -18
- package/dist/report/compute.js +54 -34
- package/dist/report/flag.d.ts +16 -1
- package/dist/report/flag.js +19 -1
- package/dist/report/format.d.ts +16 -8
- package/dist/report/format.js +27 -12
- package/dist/report/index.d.ts +4 -3
- package/dist/report/index.js +5 -4
- package/dist/report/locale.d.ts +11 -2
- package/dist/report/locale.js +23 -5
- package/dist/report/metrics.d.ts +13 -1
- package/dist/report/metrics.js +65 -14
- package/dist/report/primitives.d.ts +6 -0
- package/dist/report/react/AttemptList.d.ts +2 -2
- package/dist/report/react/AttemptList.js +5 -6
- package/dist/report/react/EvalList.d.ts +1 -1
- package/dist/report/react/EvalList.js +0 -0
- package/dist/report/react/ExperimentComparison.d.ts +8 -0
- package/dist/report/react/ExperimentComparison.js +11 -0
- package/dist/report/react/ExperimentList.d.ts +2 -1
- package/dist/report/react/ExperimentList.js +8 -10
- package/dist/report/react/MetricScatter.js +5 -11
- 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 +3 -3
- package/dist/report/react/fixtures.js +21 -14
- package/dist/report/report.d.ts +5 -1
- package/dist/report/report.js +6 -2
- package/dist/report/text/faces.d.ts +1 -1
- package/dist/report/text/faces.js +42 -41
- package/dist/report/text/table.js +36 -5
- package/dist/report/types.d.ts +39 -21
- package/dist/results/types.d.ts +11 -0
- 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 +1 -0
- package/dist/shared/aggregate.js +3 -3
- 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/concepts/adapter.mdx +22 -4
- package/docs-site/zh/concepts/experiment.mdx +1 -1
- package/docs-site/zh/concepts/overview.mdx +6 -6
- package/docs-site/zh/guides/agent-feedback-loop.mdx +28 -26
- package/docs-site/zh/guides/authoring.mdx +33 -0
- package/docs-site/zh/guides/ci-integration.mdx +23 -12
- package/docs-site/zh/guides/connect-your-agent.mdx +29 -3
- package/docs-site/zh/guides/custom-reports.mdx +29 -34
- package/docs-site/zh/guides/dataset-fanout.mdx +25 -3
- package/docs-site/zh/guides/debug-sandbox.mdx +57 -0
- package/docs-site/zh/guides/debugging.mdx +210 -0
- package/docs-site/zh/guides/experiments.mdx +10 -3
- package/docs-site/zh/guides/official-adapters.mdx +26 -2
- package/docs-site/zh/guides/publish-report.mdx +30 -16
- package/docs-site/zh/guides/report-components.mdx +42 -30
- package/docs-site/zh/guides/reporters.mdx +2 -2
- package/docs-site/zh/guides/results-data.mdx +17 -9
- package/docs-site/zh/guides/runner.mdx +17 -7
- package/docs-site/zh/guides/sandbox-agent.mdx +56 -7
- package/docs-site/zh/guides/sandbox-providers.mdx +257 -9
- package/docs-site/zh/guides/scoring-guide.mdx +4 -4
- package/docs-site/zh/guides/viewing-results.mdx +79 -36
- package/docs-site/zh/guides/write-experiment.mdx +5 -3
- package/docs-site/zh/guides/write-send.mdx +17 -1
- package/docs-site/zh/index.mdx +1 -1
- package/docs-site/zh/reference/builtin-agents.mdx +27 -0
- package/docs-site/zh/reference/capabilities.mdx +2 -2
- package/docs-site/zh/reference/cli.mdx +33 -7
- package/docs-site/zh/reference/define-agent.mdx +57 -4
- 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/expect.mdx +26 -1
- package/package.json +5 -1
- 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 +11 -0
- 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/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/types.ts +68 -5
- package/src/agents/ui-message-stream.test.ts +3 -0
- package/src/cli.ts +411 -108
- package/src/context/context.test.ts +51 -12
- package/src/context/context.ts +161 -29
- package/src/context/session.test.ts +1 -0
- package/src/context/session.ts +114 -6
- 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 +64 -2
- package/src/i18n/zh-CN.ts +65 -3
- 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 +34 -5
- package/src/report/built-in-user-parity.test.tsx +110 -153
- package/src/report/built-ins/experiment-comparison.tsx +173 -13
- package/src/report/built-ins/index.ts +6 -1
- package/src/report/components.tsx +9 -3
- package/src/report/compute.ts +70 -40
- package/src/report/dual-render.test.tsx +194 -67
- package/src/report/flag.ts +30 -2
- package/src/report/format.ts +35 -11
- package/src/report/index.ts +22 -4
- package/src/report/locale.ts +25 -5
- package/src/report/metrics.ts +67 -14
- package/src/report/primitives.tsx +6 -0
- package/src/report/react/AttemptList.tsx +6 -31
- package/src/report/react/EvalList.tsx +0 -0
- package/src/report/react/ExperimentComparison.tsx +68 -0
- package/src/report/react/ExperimentList.tsx +15 -9
- package/src/report/react/MetricScatter.tsx +12 -14
- 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 +33 -1
- package/src/report/react/fixtures.ts +24 -17
- package/src/report/react/render.test.tsx +9 -64
- package/src/report/react/styles.css +73 -2
- package/src/report/report.test.ts +306 -98
- package/src/report/report.ts +6 -2
- package/src/report/text/faces.ts +47 -43
- package/src/report/text/table.ts +42 -5
- package/src/report/types.ts +41 -21
- package/src/results/annotated-source.test.ts +62 -9
- package/src/results/annotated-source.ts +64 -6
- package/src/results/attempt-evidence.test.ts +9 -7
- package/src/results/attempt-evidence.ts +15 -8
- package/src/results/attempt-source.ts +6 -3
- package/src/results/copy.ts +145 -55
- package/src/results/host-equivalence.test.ts +8 -6
- package/src/results/index.ts +2 -0
- package/src/results/locator.test.ts +1 -22
- package/src/results/open.ts +7 -1
- package/src/results/publish.ts +149 -0
- package/src/results/results.test.ts +85 -51
- package/src/results/truncate.ts +90 -0
- package/src/results/types.ts +7 -0
- 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 +242 -36
- 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 +3 -2
- package/src/shared/types.ts +31 -0
- package/src/show/compose.ts +2 -2
- package/src/show/index.ts +21 -1
- package/src/show/render.ts +619 -104
- package/src/show/show.test.ts +235 -19
- package/src/tty-line.ts +8 -26
- package/src/util.test.ts +1 -0
- package/src/util.ts +41 -0
- package/src/view/app/components/AttemptModal.tsx +153 -2
- package/src/view/app/components/CodeView.tsx +32 -11
- package/src/view/app/components/CopyControls.tsx +2 -2
- package/src/view/app/i18n.ts +6 -0
- package/src/view/app/lib/attempt-route.test.ts +1 -0
- package/src/view/app/lib/verdict.ts +7 -9
- 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 +1 -0
- package/src/view/data.ts +11 -1
- package/src/view/index.ts +11 -0
- package/src/view/server.ts +2 -0
- package/src/view/styles.css +3 -0
- package/src/view/view-report.test.ts +6 -5
- 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/dist/report/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AttemptHandle, SelectionWarning } from "../results/types.ts";
|
|
2
2
|
import type { AttemptLocator } from "../results/locator.ts";
|
|
3
|
-
import type { AssertionResult, Verdict } from "../types.ts";
|
|
3
|
+
import type { AssertionResult, AttemptError, DiagnosticRecord, Verdict } from "../types.ts";
|
|
4
4
|
import type { LocalizedLabel, ReportLocale } from "./locale.ts";
|
|
5
5
|
export type { SelectionWarning };
|
|
6
6
|
export type { AttemptLocator };
|
|
@@ -21,7 +21,7 @@ export interface MetricAggregate {
|
|
|
21
21
|
* 指标:纯函数,吃一个 AttemptHandle 吐一个值(null = 此 attempt 测不了这个指标,
|
|
22
22
|
* 不进聚合;0 = 测了结果是零,照常进),外加名字、两级聚合方式和渲染提示。
|
|
23
23
|
* 内置指标与自定义指标是同一个类型,没有特权。name 走字面量泛型:列键锚在指标
|
|
24
|
-
* 对象上(`row.cells[
|
|
24
|
+
* 对象上(`row.cells[taskPassRate.name]`),拼错列名编译不过。
|
|
25
25
|
*/
|
|
26
26
|
export interface Metric<Name extends string = string> {
|
|
27
27
|
/** MetricColumn.key 与列头的来源;同一次计算里重名是错误。 */
|
|
@@ -67,8 +67,22 @@ export interface FlagRef {
|
|
|
67
67
|
readonly label?: string | ((value: string | number | boolean) => string);
|
|
68
68
|
readonly unit?: string;
|
|
69
69
|
}
|
|
70
|
-
/**
|
|
71
|
-
|
|
70
|
+
/**
|
|
71
|
+
* config() 的产物:把顶层运行配置(快照 `ExperimentRunInfo` 投影的字段全集,外加桥接到
|
|
72
|
+
* 快照顶层权威字段的 `model` / `agent` 两个键)当维度或轴,槽位用法与 {@link FlagRef} 一致。
|
|
73
|
+
* 未投影的值不猜:分组如实归「(unset)」,作轴不画点、注脚报数。
|
|
74
|
+
*/
|
|
75
|
+
export interface ConfigRef {
|
|
76
|
+
readonly kind: "config";
|
|
77
|
+
readonly name: string;
|
|
78
|
+
/** 组标签 / 轴标签;函数形态把投影值折成组名。 */
|
|
79
|
+
readonly label?: string | ((value: string | number | boolean) => string);
|
|
80
|
+
readonly unit?: string;
|
|
81
|
+
}
|
|
82
|
+
/** MetricLine 的 x 轴输入:experiment 声明的 flag,或顶层运行配置(config())。 */
|
|
83
|
+
export type AxisInput = FlagRef | ConfigRef;
|
|
84
|
+
/** 维度槽的输入:内置/自定义维度、experiment 声明的 flag,或顶层运行配置(config())。 */
|
|
85
|
+
export type DimensionInput = Dimension | FlagRef | ConfigRef;
|
|
72
86
|
export interface MetricColumn {
|
|
73
87
|
/** = metric.name,与 cells 的键对应。 */
|
|
74
88
|
key: string;
|
|
@@ -258,7 +272,7 @@ export interface GroupSummaryData {
|
|
|
258
272
|
/**
|
|
259
273
|
* 组的通过率:eval 级折叠计票的 `passed / (passed + failed + errored)`(`skipped` 不进
|
|
260
274
|
* 分母)——这是旧 `GroupSelector` 卡片的口径,不是 `OverviewData.totals.passRate` 那种
|
|
261
|
-
* `computeCell` 两级聚合(两者服务不同问题:「这组题多少算过」vs
|
|
275
|
+
* `computeCell` 两级聚合(两者服务不同问题:「这组题多少算过」vs「每次运行成功多少」)。
|
|
262
276
|
* 分母为 0(组内没有任何已跑的 eval)时 `value` 为 `null`,不编 0%。
|
|
263
277
|
*/
|
|
264
278
|
passRate: MetricCell;
|
|
@@ -286,10 +300,11 @@ export interface OverviewData {
|
|
|
286
300
|
errored: number;
|
|
287
301
|
skipped: number;
|
|
288
302
|
/**
|
|
289
|
-
*
|
|
290
|
-
* columns: [
|
|
303
|
+
* 默认成功率的唯一官方口径:`computeCell(endToEndPassRate, items)`,与 `MetricTable.data(...,
|
|
304
|
+
* columns: [endToEndPassRate])` 同一台两级聚合引擎(题内折叠 perEval、跨题折叠 across,默认都是
|
|
291
305
|
* mean)——一道题内多个 attempt 部分通过,贡献的是小数份额而不是二元票。`samples`/`total`
|
|
292
|
-
* 是两级聚合口径下的 attempt 计数(`total` 含 skipped
|
|
306
|
+
* 是两级聚合口径下的 attempt 计数(`total` 含 skipped 与 errored——endToEndPassRate 对
|
|
307
|
+
* errored 记 0、只对 skipped 记 null,`samples` 因此只不含 skipped),不等于上面四个
|
|
293
308
|
* verdict 计票的任何一个之和。
|
|
294
309
|
*/
|
|
295
310
|
passRate: MetricCell;
|
|
@@ -324,8 +339,11 @@ export interface DeltaData<K extends string = string> {
|
|
|
324
339
|
}[];
|
|
325
340
|
}
|
|
326
341
|
/**
|
|
327
|
-
* `AttemptList` 一项 = 一个 Attempt
|
|
328
|
-
*
|
|
342
|
+
* `AttemptList` 一项 = 一个 Attempt:身份、判定、断言、结构化 error、diagnostics、耗时、
|
|
343
|
+
* 成本和 locator。`ExperimentList` / `EvalList` 的下钻数组复用同一个类型,不是各自的精简版。
|
|
344
|
+
* 渲染面只显示一条主失败断言摘要或 error 的一层摘要;完整 assertions、cause / stack 与
|
|
345
|
+
* diagnostics 属于 locator 下钻详情,不塞进比较列表,但随数据携带 —— `AttemptList.data` 的 `redact`
|
|
346
|
+
* 钩子覆盖它们的自由文本(见 docs/feature/reports/library.md「AttemptList」)。
|
|
329
347
|
*/
|
|
330
348
|
export interface AttemptListItem {
|
|
331
349
|
evalId: string;
|
|
@@ -333,23 +351,24 @@ export interface AttemptListItem {
|
|
|
333
351
|
attempt: number;
|
|
334
352
|
agent: string;
|
|
335
353
|
verdict: Verdict;
|
|
336
|
-
error
|
|
354
|
+
/** 结构化执行错误(与 `EvalResult.error` 同构):列表只显示 `message` 一层摘要。 */
|
|
355
|
+
error?: AttemptError;
|
|
356
|
+
/** 本 attempt 的有界诊断(teardown / cleanup 失败等,与 verdict 独立);属于下钻详情。 */
|
|
357
|
+
diagnostics?: DiagnosticRecord[];
|
|
337
358
|
assertions: AssertionResult[];
|
|
338
359
|
durationMs: number;
|
|
339
360
|
costUSD?: number;
|
|
340
361
|
locator: AttemptLocator;
|
|
341
362
|
}
|
|
342
363
|
/**
|
|
343
|
-
* `ExperimentList` 一项里,一个 Eval 的展开行:折叠判定(`foldEvalVerdict`)
|
|
344
|
-
* (
|
|
345
|
-
*
|
|
346
|
-
* 的全部 Attempt(升序,供进一步展开到 `AttemptList`)。
|
|
364
|
+
* `ExperimentList` 一项里,一个 Eval 的展开行:折叠判定(`foldEvalVerdict`)、该 Eval 内
|
|
365
|
+
* attempt 的平均耗时/成本(两级聚合引擎在单一 eval 上退化成组内均值),以及这道题的全部
|
|
366
|
+
* Attempt(升序,供进一步展开到 `AttemptList`)。失败原因属于各 Attempt,不在父行挑一轮重复。
|
|
347
367
|
*/
|
|
348
368
|
export interface ExperimentListEvalRow {
|
|
349
369
|
evalId: string;
|
|
350
370
|
/** 折叠判定(任一 attempt 通过则通过,否则取最严重的)。 */
|
|
351
371
|
verdict: Verdict;
|
|
352
|
-
reason?: string;
|
|
353
372
|
/** 这道题内 attempt 的平均耗时(`computeCell(durationMs, …)`,单一 eval 分组下即均值)。 */
|
|
354
373
|
duration: MetricCell;
|
|
355
374
|
/** 这道题内 attempt 的平均成本。 */
|
|
@@ -360,7 +379,7 @@ export interface ExperimentListEvalRow {
|
|
|
360
379
|
/**
|
|
361
380
|
* `ExperimentList.data(selection)` 的一项 = 一个 experiment:身份(experimentId/agent/model)、
|
|
362
381
|
* 声明的 flags、Eval 判定构成(`foldEvalVerdict` 计票,与 view 榜单同一口径)、官方两级聚合
|
|
363
|
-
* 汇总指标(
|
|
382
|
+
* 汇总指标(endToEndPassRate/cost/duration/tokens,直接来自 `computeCell`,不现场重算),以及展开到
|
|
364
383
|
* 这个 experiment 每道 Eval 的 `evalRows`(按 eval id 升序)。
|
|
365
384
|
*/
|
|
366
385
|
export interface ExperimentListItem {
|
|
@@ -375,7 +394,7 @@ export interface ExperimentListItem {
|
|
|
375
394
|
errored: number;
|
|
376
395
|
skipped: number;
|
|
377
396
|
};
|
|
378
|
-
/**
|
|
397
|
+
/** 官方两级聚合口径(endToEndPassRate),与 `MetricTable.data(..., columns: [endToEndPassRate])` 同一台引擎。 */
|
|
379
398
|
passRate: MetricCell;
|
|
380
399
|
cost: MetricCell;
|
|
381
400
|
duration: MetricCell;
|
|
@@ -392,14 +411,13 @@ export interface ExperimentListItem {
|
|
|
392
411
|
/**
|
|
393
412
|
* `EvalList.data(selection)` 的一项 = 一个 `experimentId + evalId`(同一个 Eval 跑在两个
|
|
394
413
|
* experiment 上是两条不同结果,不合并)。判定、分数(examScore 的两级聚合)、这道题内 attempt
|
|
395
|
-
*
|
|
396
|
-
*
|
|
414
|
+
* 的平均耗时/成本,外加展开到这道题全部 Attempt 的 `attempts`(按 attempt 序号升序)。失败
|
|
415
|
+
* 原因只存在于各 `AttemptListItem` 的 error / assertions,不会在 Eval 父项重复一份。
|
|
397
416
|
*/
|
|
398
417
|
export interface EvalListItem {
|
|
399
418
|
evalId: string;
|
|
400
419
|
experimentId: string;
|
|
401
420
|
verdict: Verdict;
|
|
402
|
-
reason?: string;
|
|
403
421
|
/** examScore 的两级聚合;单一 eval 分组下即这道题的题级分数。 */
|
|
404
422
|
score: MetricCell;
|
|
405
423
|
duration: MetricCell;
|
package/dist/results/types.d.ts
CHANGED
|
@@ -33,6 +33,13 @@ export interface SnapshotMeta {
|
|
|
33
33
|
completedAt?: string;
|
|
34
34
|
/** 写入时刻该实验已知的 eval 并集 —— 残缺检测的分母随数据走(copySnapshots 自动补记,writer 可声明)。 */
|
|
35
35
|
knownEvalIds?: string[];
|
|
36
|
+
/**
|
|
37
|
+
* 发布拷贝的自描述标记:copySnapshots 补记,消毒函数 → "applied"、redact: false → "none";
|
|
38
|
+
* 本地事实根没有此字段。只声明流程,不证明无秘密;view --out 据此分级防呆。
|
|
39
|
+
*/
|
|
40
|
+
publish?: {
|
|
41
|
+
redaction: "applied" | "none";
|
|
42
|
+
};
|
|
36
43
|
/** 项目名(来自 config.name),透传给 `niceeval view` 顶部 hero 显示。 */
|
|
37
44
|
name?: LocalizedText;
|
|
38
45
|
}
|
|
@@ -110,6 +117,10 @@ export interface Snapshot {
|
|
|
110
117
|
dir: string;
|
|
111
118
|
/** 写入时刻该实验已知的 eval 并集(可选);copySnapshots 自动补记,writer.snapshot() 也可声明。 */
|
|
112
119
|
knownEvalIds?: string[];
|
|
120
|
+
/** 发布拷贝的自描述标记(见 SnapshotMeta.publish);本地事实根没有此字段。 */
|
|
121
|
+
publish?: {
|
|
122
|
+
redaction: "applied" | "none";
|
|
123
|
+
};
|
|
113
124
|
}
|
|
114
125
|
/** 一个实验的全部历史:同一 experiment id 的历次快照归在一起。 */
|
|
115
126
|
export interface Experiment {
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { AttemptLifecycleEvent, AttemptRef, FailureDetail } from "../types.ts";
|
|
2
|
+
import type { Verdict } from "../../scoring/types.ts";
|
|
3
|
+
import type { JsonValue } from "../../shared/types.ts";
|
|
4
|
+
import type { AttemptLocator } from "../../results/locator.ts";
|
|
5
|
+
/** `sink.diagnostic()` 的输入 —— 与 `DurableFeedbackEvent` 的 "diagnostic" 变体字段一致,
|
|
6
|
+
* 只是省略 `type`/`at`(由 coordinator 补上)。 */
|
|
7
|
+
export interface DiagnosticInput {
|
|
8
|
+
/** 稳定去重 key —— 同一种 warning/error 用同一个 key(见 cli.md「同一 dedupeKey 并发出现时
|
|
9
|
+
* 只留一条并显示次数」),不要把可变的实例细节(如具体 sandbox id)编进 key 本身,
|
|
10
|
+
* 那些细节放 `data`。 */
|
|
11
|
+
key: string;
|
|
12
|
+
severity: "warning" | "error";
|
|
13
|
+
/** 一句话人类可读摘要;renderer 的 appendDurable 直接展示,不需要再解析。 */
|
|
14
|
+
message: string;
|
|
15
|
+
identity?: AttemptRef;
|
|
16
|
+
data?: Readonly<Record<string, JsonValue>>;
|
|
17
|
+
}
|
|
18
|
+
/** `sink.failure()` 的输入 —— 与 `DurableFeedbackEvent` 的 "failure" 变体字段一致,只省略
|
|
19
|
+
* `type`/`at`(由 coordinator 补上)。`locator` 只有在 attempt 挂靠 experiment 时才存在
|
|
20
|
+
* (见 `results/locator.ts` 的 `encodeAttemptLocator`);调用方(run.ts)只在拿到 locator 之后
|
|
21
|
+
* 才应该调用这个函数——没有 locator 的裸 run 不产出这类永久失败通知。 */
|
|
22
|
+
export type FailureInput = FailureDetail;
|
|
23
|
+
/** `sink.budgetExhausted()` 的输入 —— 与 `DurableFeedbackEvent` 的 "budget-exhausted" 变体字段
|
|
24
|
+
* 一致,只省略 `type`/`at`。调用方(run.ts)对每一个因预算到顶而不派发的 attempt 各调一次
|
|
25
|
+
* (与 `AttemptLifecycleEvent` 的 "attempt:early-exit" 同构);`unstarted` 是调用方自己维护的、
|
|
26
|
+
* 发出这条时的累计未派发数,不是 reducer 能推导的值(见 reducer.ts 对应事件的注释)。 */
|
|
27
|
+
export interface BudgetExhaustedInput {
|
|
28
|
+
experimentId: string;
|
|
29
|
+
spent: number;
|
|
30
|
+
unstarted: number;
|
|
31
|
+
}
|
|
32
|
+
/** `sink.kept()` 的输入 —— 与 `DurableFeedbackEvent` 的 "kept" 变体字段一致,省略 type/at。 */
|
|
33
|
+
export interface KeptInput {
|
|
34
|
+
locator: AttemptLocator;
|
|
35
|
+
identity: AttemptRef;
|
|
36
|
+
who: string;
|
|
37
|
+
verdict: Verdict;
|
|
38
|
+
provider: string;
|
|
39
|
+
sandboxId: string;
|
|
40
|
+
enter?: string;
|
|
41
|
+
}
|
|
42
|
+
/** `sink.ts` façade 函数实际转发到的最小接口 —— `FeedbackCoordinator`(coordinator.ts)实现它。
|
|
43
|
+
* 定义在这里(而不是从 coordinator.ts 导入)是为了让 sink.ts 不必在运行时依赖 coordinator.ts,
|
|
44
|
+
* 避免两个模块互相 import 造成的循环依赖 —— coordinator.ts 反过来 `import type` 这个接口。 */
|
|
45
|
+
export interface FeedbackSink {
|
|
46
|
+
activity(text: string): void;
|
|
47
|
+
diagnostic(input: DiagnosticInput): void;
|
|
48
|
+
interrupted(): void;
|
|
49
|
+
reporterError(input: {
|
|
50
|
+
reporter: string;
|
|
51
|
+
required: boolean;
|
|
52
|
+
message: string;
|
|
53
|
+
}): void;
|
|
54
|
+
/** 一次失败/errored attempt 的永久通知(见 `FailureInput`)。 */
|
|
55
|
+
failure(input: FailureInput): void;
|
|
56
|
+
/** 一个因预算到顶而未被派发的 attempt(见 `BudgetExhaustedInput`)。 */
|
|
57
|
+
budgetExhausted(input: BudgetExhaustedInput): void;
|
|
58
|
+
/** 一次留存授予(--keep-sandbox);见 `KeptInput` 与 docs/feature/sandbox/cli.md。 */
|
|
59
|
+
kept(input: KeptInput): void;
|
|
60
|
+
/** attempt 生命周期事件(queued/start/phase/progress/complete/early-exit),见
|
|
61
|
+
* `AttemptLifecycleEvent`。只驱动 human dashboard 的 active slot,不落 RunSummary/结果文件,
|
|
62
|
+
* 所以没有活跃 coordinator 时(见 `reportAttemptLifecycle`)静默丢弃是安全的 —— 这类信息
|
|
63
|
+
* 本身就只服务「正在画着的 dashboard」,不是必须留痕的诊断。 */
|
|
64
|
+
lifecycle(event: AttemptLifecycleEvent): void;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* coordinator 进入「活跃」阶段时调用一次(见 coordinator.ts 的 start()),把自己注册为当前
|
|
68
|
+
* reportXxx() 调用的目的地。返回的函数用于退出活跃状态(见 coordinator.ts 的 finish())——
|
|
69
|
+
* 调用一次即失效,重复调用是安全的 no-op。
|
|
70
|
+
*/
|
|
71
|
+
export declare function activateFeedbackSink(sink: FeedbackSink): () => void;
|
|
72
|
+
/** 仅供测试:断言没有遗留未退出的活跃 coordinator(避免一个测试忘记 finish() 污染下一个)。 */
|
|
73
|
+
export declare function activeFeedbackSinkCount(): number;
|
|
74
|
+
/** 不需要去重、不进入 RunFeedbackState 的瞬时活动文本(docker 镜像拉取进度、vercel session
|
|
75
|
+
* rotate 成功通知……)。没有活跃 coordinator 时退回一行 stderr,与迁移前的裸写视觉效果一致。 */
|
|
76
|
+
export declare function reportActivity(text: string): void;
|
|
77
|
+
/** 需要去重、要出现在三种 profile 永久事件流里的一条 warning/error。 */
|
|
78
|
+
export declare function reportDiagnostic(input: DiagnosticInput): void;
|
|
79
|
+
/** 一次失败/errored attempt 的永久通知(见 `FailureInput`)。与 `reportDiagnostic` 同级别的
|
|
80
|
+
* 「必须留痕」信号 —— 没有活跃 coordinator 时退回一行 stderr,不像 `reportAttemptLifecycle`
|
|
81
|
+
* 那样静默丢弃(定位一次真实失败不该因为没接 coordinator 就彻底没有出口)。 */
|
|
82
|
+
export declare function reportFailure(input: FailureInput): void;
|
|
83
|
+
/** 一个因预算到顶而未被派发的 attempt(见 `BudgetExhaustedInput`)。没有活跃 coordinator 时的
|
|
84
|
+
* 兜底文案与 coordinator.ts 的 `fallbackTextFor` 对 "budget-exhausted" 事件的格式化保持一致。 */
|
|
85
|
+
/** 一次留存授予的永久通知(--keep-sandbox);没有活跃 coordinator 时退回一行 stderr。 */
|
|
86
|
+
export declare function reportKept(input: KeptInput): void;
|
|
87
|
+
export declare function reportBudgetExhausted(input: BudgetExhaustedInput): void;
|
|
88
|
+
/** 用户中断(Ctrl+C)。没有活跃 coordinator 时的兜底文案与迁移前的 `runner.interrupted` 完全
|
|
89
|
+
* 相同 —— 调用方(run.ts)不再需要自己持有这段 i18n 文案。 */
|
|
90
|
+
export declare function reportInterrupted(): void;
|
|
91
|
+
/**
|
|
92
|
+
* runner 自己驱动的 attempt 生命周期投影(见 docs/feature/experiments/cli.md「Attempt 阶段」)——
|
|
93
|
+
* `src/runner/attempt.ts`(phase/progress)与 `src/runner/run.ts`(start/complete/early-exit)是
|
|
94
|
+
* 目前仅有的两个调用方。没有活跃 coordinator 时(今天:CLI 还没接入 --output)静默 no-op ——
|
|
95
|
+
* 与其它 reportXxx() 不同,这里不退回 `writeStderrLine` 兜底:这类事件只服务尚不存在的
|
|
96
|
+
* dashboard,不是需要留痕的诊断,现有可观察行为(直到 CLI 接入真正的 coordinator 之前)因此
|
|
97
|
+
* 完全不变。
|
|
98
|
+
*/
|
|
99
|
+
export declare function reportAttemptLifecycle(event: AttemptLifecycleEvent): void;
|
|
100
|
+
/** 一个 reporter 的某次回调抛错(见 `runner/report.ts` 的 `runReporter`)。`reporter`/`required`
|
|
101
|
+
* 来自调用方注册这个 reporter 时的 `ReporterRegistration`(见其字段注释)——默认 artifacts、
|
|
102
|
+
* 显式 `--json`/`--junit` 传 `required: true`,用户 `config.reporters`/`EvalDef.reporters`
|
|
103
|
+
* 传 `required: false`。coordinator 把它折进 `RunFeedbackState.diagnostics`(reducer 按
|
|
104
|
+
* `reporter-error:<reporter>` 去重),调用方(`cli.ts` 的 `assembleRunCompletion`)据此把
|
|
105
|
+
* `required` 为真的失败折进 `RunCompletion.reporterErrors`,让 completion/CI 退出码判红。 */
|
|
106
|
+
export declare function reportReporterError(input: {
|
|
107
|
+
reporter: string;
|
|
108
|
+
required: boolean;
|
|
109
|
+
message: string;
|
|
110
|
+
}): void;
|