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/agents/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Cleanup } from "../shared/types.ts";
|
|
1
|
+
import type { Cleanup, DiagnosticInput, ProgressUpdate } from "../shared/types.ts";
|
|
2
2
|
import type { StreamEvent, TraceSpan, Usage } from "../o11y/types.ts";
|
|
3
3
|
import type { Sandbox } from "../sandbox/types.ts";
|
|
4
4
|
/**
|
|
@@ -75,11 +75,51 @@ export interface AgentSetupManifest {
|
|
|
75
75
|
command: string;
|
|
76
76
|
args?: string[];
|
|
77
77
|
}>;
|
|
78
|
+
/**
|
|
79
|
+
* 官方原生配置文件(Claude Code `settings.json` / Codex `config.toml`):只记 Agent 名、
|
|
80
|
+
* 项目相对来源路径与原始字节的 SHA-256,不落正文 —— 任意官方配置都可能携带敏感字符串,
|
|
81
|
+
* 不能靠字段白名单证明适合原样落盘。
|
|
82
|
+
*/
|
|
83
|
+
nativeConfigFile?: {
|
|
84
|
+
agent: "claude-code" | "codex";
|
|
85
|
+
path: string;
|
|
86
|
+
sha256: string;
|
|
87
|
+
};
|
|
78
88
|
/** Bub 的 Python Plugin(规范化后的 package 串)。 */
|
|
79
89
|
pythonPlugins?: Array<{
|
|
80
90
|
package: string;
|
|
81
91
|
}>;
|
|
82
92
|
}
|
|
93
|
+
/** 证据通道的覆盖状态。省略(不声明)= unknown,不是 complete——消费侧与 unavailable 同样保守。 */
|
|
94
|
+
export type CoverageStatus = "complete" | "partial" | "unavailable";
|
|
95
|
+
/** 单个证据通道的覆盖声明:状态 + 可选的人可读原因(如 "stream reconnected mid-turn")。 */
|
|
96
|
+
export interface CoverageDeclaration {
|
|
97
|
+
status: CoverageStatus;
|
|
98
|
+
reason?: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 覆盖声明(EvidenceCoverage):完整性不是口头承诺,是随数据走的声明
|
|
102
|
+
* (见 docs/feature/adapters/architecture/evidence.md)。两层:
|
|
103
|
+
* - Agent 级默认(`defineAgent` / `defineSandboxAgent` 的 `coverage`)声明该 Adapter 的常态覆盖;
|
|
104
|
+
* 官方 SDK 适配器显式声明全通道 complete(用 `completeCoverage` 常量)。
|
|
105
|
+
* - Turn 级降级(`Turn.coverage`)只用于相对 Agent 默认值降级(这一轮流断了 / 拿不到 usage),
|
|
106
|
+
* 不能把 Agent 未声明的通道升格成 complete。
|
|
107
|
+
* 整个 Agent 不声明时全部通道视为 unknown。
|
|
108
|
+
*/
|
|
109
|
+
export interface EvidenceCoverage {
|
|
110
|
+
/** 完整事件流(event / notEvent / order 的依据)。 */
|
|
111
|
+
events?: CoverageDeclaration;
|
|
112
|
+
/** action 生命周期(工具正负断言、顺序、失败的依据)。 */
|
|
113
|
+
actions?: CoverageDeclaration;
|
|
114
|
+
/** assistant / user message(reply、messageIncludes 的依据)。 */
|
|
115
|
+
messages?: CoverageDeclaration;
|
|
116
|
+
/** usage(token / cost 上限断言的依据)。 */
|
|
117
|
+
usage?: CoverageDeclaration;
|
|
118
|
+
/** Turn status 的真实性(succeeded / parked 的依据)——恒 completed 的映射必须声明非 complete。 */
|
|
119
|
+
status?: CoverageDeclaration;
|
|
120
|
+
/** Turn.data(outputEquals / outputMatches 的依据)。 */
|
|
121
|
+
data?: CoverageDeclaration;
|
|
122
|
+
}
|
|
83
123
|
/** 随一轮消息附带的文件(图片等多模态输入)。 */
|
|
84
124
|
export interface InputFile {
|
|
85
125
|
/** 文件名(可选,供 adapter / 模型参考)。 */
|
|
@@ -115,6 +155,11 @@ export interface Turn {
|
|
|
115
155
|
readonly data?: unknown;
|
|
116
156
|
readonly status: "completed" | "failed" | "waiting";
|
|
117
157
|
readonly usage?: Usage;
|
|
158
|
+
/**
|
|
159
|
+
* 本轮相对 Agent 默认覆盖的降级声明(这一轮流断了、拿不到 usage 等);
|
|
160
|
+
* 只能降级,不能把 Agent 未声明的通道升格成 complete(见 EvidenceCoverage)。
|
|
161
|
+
*/
|
|
162
|
+
readonly coverage?: EvidenceCoverage;
|
|
118
163
|
}
|
|
119
164
|
/**
|
|
120
165
|
* 本次运行的 OTLP traces 接收信息(仅当配置了 OTel 接入时有——agent 的 `tracing` 块 /
|
|
@@ -241,10 +286,21 @@ export interface AgentContext {
|
|
|
241
286
|
*/
|
|
242
287
|
readonly telemetry?: Telemetry;
|
|
243
288
|
/**
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
* (
|
|
289
|
+
* 作用域反馈:报告此刻正在做什么(turn / tool / 安装进度)。短命状态——Human profile
|
|
290
|
+
* 更新 active 行,`agent`/`ci` 不逐条打印,也不进最终结果;不要每个 token/delta 都调用。
|
|
291
|
+
* runner 按当前回调所处的生命周期阶段(agent.setup / agent.run / agent.teardown)归因,
|
|
292
|
+
* 调用方不能冒充其它阶段(见 docs/feature/experiments/library.md)。
|
|
293
|
+
*/
|
|
294
|
+
progress(update: ProgressUpdate): void;
|
|
295
|
+
/**
|
|
296
|
+
* 作用域反馈:报告运行结束后仍应保留的问题(协议降级、数据不完整、cleanup 问题)。
|
|
297
|
+
* 永久事件,落进 attempt 的 diagnostics 并进各 profile 的永久输出;`dedupeKey` 去重。
|
|
298
|
+
* 即使 level 为 "error" 也不改变 Turn.status / verdict——无法继续时抛异常。
|
|
299
|
+
*/
|
|
300
|
+
diagnostic(input: DiagnosticInput): void;
|
|
301
|
+
/**
|
|
302
|
+
* `progress({ message: msg })` 的别名,不是第二条通道(见 docs/feature/experiments/cli.md
|
|
303
|
+
* 「Attempt 阶段」)。超时失败时最近若干行会并入结果的 error 信息,方便定位卡在哪一步。
|
|
248
304
|
*/
|
|
249
305
|
log(msg: string): void;
|
|
250
306
|
}
|
|
@@ -272,6 +328,8 @@ export interface Agent {
|
|
|
272
328
|
* `t.sandbox`/`t.sandbox.fileChanged()` 等文件系统断言,见 docs-site「能力从哪来」一节。
|
|
273
329
|
*/
|
|
274
330
|
readonly kind: "sandbox" | "remote";
|
|
331
|
+
/** 该 Adapter 的常态证据覆盖声明;省略 = 全通道 unknown(见 EvidenceCoverage)。 */
|
|
332
|
+
coverage?: EvidenceCoverage;
|
|
275
333
|
setup?: AgentSetup;
|
|
276
334
|
/** OTLP 导出配置(仅当此字段存在时运行器才为该 agent 开 OTLP 接收);与 setup 分开,见 AgentTracing。 */
|
|
277
335
|
tracing?: AgentTracing;
|
|
@@ -284,6 +342,8 @@ export interface Agent {
|
|
|
284
342
|
export interface SandboxAgentDef {
|
|
285
343
|
/** agent 的显示名/标识,原样进入 `Agent.name`——不是注册表查找 key,只用于展示、结果归属与去重指纹。 */
|
|
286
344
|
name: string;
|
|
345
|
+
/** 该 Adapter 的常态证据覆盖声明(完整采集的用 `completeCoverage` 常量);省略 = 全通道 unknown。 */
|
|
346
|
+
coverage?: EvidenceCoverage;
|
|
287
347
|
/**
|
|
288
348
|
* 每个沙箱一次(不是每轮一次):装 CLI、写 config.toml / 鉴权配置(model/base/auth 等
|
|
289
349
|
* 本轮内不变的东西)。运行器在沙箱备好(上传/基线/eval.setup 之后)、第一次 send 前
|
|
@@ -303,6 +363,8 @@ export interface SandboxAgentDef {
|
|
|
303
363
|
export interface RemoteAgentDef {
|
|
304
364
|
/** agent 的显示名/标识,原样进入 `Agent.name`——不是注册表查找 key,只用于展示、结果归属与去重指纹。 */
|
|
305
365
|
name: string;
|
|
366
|
+
/** 该 Adapter 的常态证据覆盖声明(完整采集的用 `completeCoverage` 常量);省略 = 全通道 unknown。 */
|
|
367
|
+
coverage?: EvidenceCoverage;
|
|
306
368
|
/**
|
|
307
369
|
* 每个 attempt 一次(remote agent 没有真实沙箱,运行器会传入一个仅含 `workdir`/`sandboxId`/
|
|
308
370
|
* `otlpHost`/`stop` 等元信息的 stub `Sandbox`,其余方法调用即抛错——不要在这里调用
|
package/dist/context/types.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { InputRequest, StreamEvent, ToolCall, Usage } from "../o11y/types.ts";
|
|
2
|
+
import type { DiagnosticInput, ProgressUpdate } from "../shared/types.ts";
|
|
2
3
|
import type { AssertionHandle, ValueAssertion } from "../scoring/types.ts";
|
|
3
4
|
import type { CommandOptions, CommandResult, ReadSourceFilesOptions, SandboxFile, SourceFiles } from "../sandbox/types.ts";
|
|
5
|
+
/** `t.send()` / `session.send()` 的入参:字符串,或带附件的结构化消息。 */
|
|
6
|
+
export type SendInput = string | {
|
|
7
|
+
text: string;
|
|
8
|
+
files?: readonly import("../agents/types.ts").InputFile[];
|
|
9
|
+
};
|
|
4
10
|
/** t.send() 返回的句柄:从事件流派生便利字段 + expectOk。 */
|
|
5
11
|
export interface TurnHandle {
|
|
6
12
|
/** 本轮的原始事件流(工具调用、消息增量等);下面的派生字段都算自它。 */
|
|
@@ -51,8 +57,8 @@ export interface TurnHandle {
|
|
|
51
57
|
calledSubagent(name: string, match?: SubagentMatch): AssertionHandle;
|
|
52
58
|
/** 断言本轮事件按给定类型顺序出现(允许中间夹杂其它事件)。 */
|
|
53
59
|
eventOrder(types: StreamEvent["type"][]): AssertionHandle;
|
|
54
|
-
/**
|
|
55
|
-
eventsSatisfy(predicate: (events: readonly StreamEvent[]) => boolean
|
|
60
|
+
/** 用自定义谓词对本轮整段事件流断言;label 必填、进断言标题(谓词不透明,解释责任在 label)。 */
|
|
61
|
+
eventsSatisfy(label: string, predicate: (events: readonly StreamEvent[]) => boolean): AssertionHandle;
|
|
56
62
|
/** 断言本轮 token 用量不超过 max。 */
|
|
57
63
|
maxTokens(max: number): AssertionHandle;
|
|
58
64
|
/** 断言本轮花费(USD)不超过 usd。 */
|
|
@@ -90,7 +96,11 @@ export interface DiffView {
|
|
|
90
96
|
}
|
|
91
97
|
/** 工具匹配小语言。 */
|
|
92
98
|
export interface ToolMatch {
|
|
93
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* 只匹配入参包含这些键值的调用:**深度部分匹配**——嵌套对象逐键下钻,数组按值比较;
|
|
101
|
+
* 值可以是 RegExp(对字符串字段测试,不命中时再对整个 input 的序列化串兜底测一次)
|
|
102
|
+
* 或谓词函数。不要求深度相等,多余的入参键不影响命中。
|
|
103
|
+
*/
|
|
94
104
|
input?: Record<string, unknown>;
|
|
95
105
|
/** 精确匹配调用次数,省略则只要求「至少一次」。 */
|
|
96
106
|
count?: number;
|
|
@@ -173,8 +183,8 @@ export interface SandboxHandle {
|
|
|
173
183
|
* 只看最后一轮要用 `send()` 返回的 TurnHandle。
|
|
174
184
|
*/
|
|
175
185
|
export interface SessionHandle {
|
|
176
|
-
/**
|
|
177
|
-
send(
|
|
186
|
+
/** 在这个会话里发一条消息(字符串或结构化消息),返回该轮的 TurnHandle。 */
|
|
187
|
+
send(input: SendInput): Promise<TurnHandle>;
|
|
178
188
|
/** 在这个会话里发一条带文件的消息,语义同 TestContext.sendFile。 */
|
|
179
189
|
sendFile(path: string, text?: string): Promise<TurnHandle>;
|
|
180
190
|
/** 取这个会话里等待中的 HITL 输入请求;拿不到就抛,语义同 TestContext.requireInputRequest。 */
|
|
@@ -219,8 +229,8 @@ export interface SessionHandle {
|
|
|
219
229
|
calledSubagent(name: string, match?: SubagentMatch): AssertionHandle;
|
|
220
230
|
/** 断言这个会话累计事件按给定类型顺序出现。 */
|
|
221
231
|
eventOrder(types: StreamEvent["type"][]): AssertionHandle;
|
|
222
|
-
/**
|
|
223
|
-
eventsSatisfy(predicate: (events: readonly StreamEvent[]) => boolean
|
|
232
|
+
/** 用自定义谓词对这个会话累计的整段事件流断言;label 必填、进断言标题。 */
|
|
233
|
+
eventsSatisfy(label: string, predicate: (events: readonly StreamEvent[]) => boolean): AssertionHandle;
|
|
224
234
|
/** 断言这个会话累计 token 用量不超过 max。 */
|
|
225
235
|
maxTokens(max: number): AssertionHandle;
|
|
226
236
|
/** 断言这个会话累计花费(USD)不超过 usd。 */
|
|
@@ -235,8 +245,8 @@ export interface SessionHandle {
|
|
|
235
245
|
* 用一个宽接口承载全部动作(运行时按 capability 守卫)。
|
|
236
246
|
*/
|
|
237
247
|
export interface TestContext {
|
|
238
|
-
/**
|
|
239
|
-
send(
|
|
248
|
+
/** 向默认会话发一条消息(字符串或结构化消息),返回该轮的 TurnHandle。事件同时累加进默认会话的累计事件流,供下面的作用域断言使用。 */
|
|
249
|
+
send(input: SendInput): Promise<TurnHandle>;
|
|
240
250
|
/** 发一条带文件(图片等多模态输入)的消息。`path` 相对项目根;读出后 base64 随 TurnInput.files 交给 adapter。 */
|
|
241
251
|
sendFile(path: string, text?: string): Promise<TurnHandle>;
|
|
242
252
|
/** 取默认会话里等待中的 HITL 输入请求;不传 filter 要求恰好一条,拿不到就抛。 */
|
|
@@ -268,7 +278,17 @@ export interface TestContext {
|
|
|
268
278
|
readonly reasoningEffort?: string;
|
|
269
279
|
/** 本次 attempt 生效的实验 flags(experiment.flags 的只读视图;实验条件,非命令行开关)。 */
|
|
270
280
|
readonly flags: Readonly<Record<string, unknown>>;
|
|
271
|
-
/**
|
|
281
|
+
/**
|
|
282
|
+
* 作用域反馈:报告 eval 自己执行的长步骤(上传 fixture、跑构建……)。短命状态,scope 固定
|
|
283
|
+
* 为 `eval.run`;只报告不断言(见 docs/feature/eval/library/context.md「向运行反馈长步骤」)。
|
|
284
|
+
*/
|
|
285
|
+
progress(update: ProgressUpdate): void;
|
|
286
|
+
/**
|
|
287
|
+
* 作用域反馈:报告运行结束后仍需保留的问题(永久事件,落 attempt diagnostics)。
|
|
288
|
+
* 即使 level 为 "error" 也不自动改变 verdict——测试结论仍由断言决定。
|
|
289
|
+
*/
|
|
290
|
+
diagnostic(input: DiagnosticInput): void;
|
|
291
|
+
/** `progress({ message: msg })` 的别名(调试日志),不出现在最终结果里。 */
|
|
272
292
|
log(msg: string): void;
|
|
273
293
|
/** 立即中止本 eval 并标记为 skipped(verdict / EvalResult.skipReason),reason 不能为空。 */
|
|
274
294
|
skip(reason: string): never;
|
|
@@ -320,8 +340,8 @@ export interface TestContext {
|
|
|
320
340
|
calledSubagent(name: string, match?: SubagentMatch): AssertionHandle;
|
|
321
341
|
/** 断言默认会话累计事件按给定类型顺序出现(允许中间夹杂其它事件)。 */
|
|
322
342
|
eventOrder(types: StreamEvent["type"][]): AssertionHandle;
|
|
323
|
-
/**
|
|
324
|
-
eventsSatisfy(predicate: (events: readonly StreamEvent[]) => boolean
|
|
343
|
+
/** 用自定义谓词对默认会话累计的整段事件流断言;label 必填、进断言标题。 */
|
|
344
|
+
eventsSatisfy(label: string, predicate: (events: readonly StreamEvent[]) => boolean): AssertionHandle;
|
|
325
345
|
/** 受限沙箱视图:能执行命令 / 读写文件 / 看最终 diff,不能 stop 沙箱本身(见 SandboxHandle)。 */
|
|
326
346
|
readonly sandbox: SandboxHandle;
|
|
327
347
|
/** 默认会话累计的 token 用量与估算成本。 */
|
package/dist/i18n/en.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export declare const en: {
|
|
|
12
12
|
"bub.installFailed": string;
|
|
13
13
|
"bub.setupNotRun": string;
|
|
14
14
|
"checkpoint.emptyTar": string;
|
|
15
|
+
"checkpoint.archiveFailed": string;
|
|
16
|
+
"checkpoint.restoreFailed": string;
|
|
15
17
|
"skill.localMissing": string;
|
|
16
18
|
"skill.localDirNoSkillFile": string;
|
|
17
19
|
"skill.localUnsupportedShape": string;
|
|
@@ -21,7 +23,16 @@ export declare const en: {
|
|
|
21
23
|
"skill.repoUnknownSkill": string;
|
|
22
24
|
"skill.copyFailed": string;
|
|
23
25
|
"plugin.marketplaceFailed": string;
|
|
26
|
+
"plugin.marketplaceVerifyFailed": string;
|
|
27
|
+
"plugin.marketplaceNameMismatch": string;
|
|
24
28
|
"plugin.installFailed": string;
|
|
29
|
+
"nativeConfig.pathNotProjectRelative": string;
|
|
30
|
+
"nativeConfig.missing": string;
|
|
31
|
+
"nativeConfig.escapesRoot": string;
|
|
32
|
+
"nativeConfig.notFile": string;
|
|
33
|
+
"nativeConfig.invalidSyntax": string;
|
|
34
|
+
"nativeConfig.reservedKeys": string;
|
|
35
|
+
"nativeConfig.uploadFailed": string;
|
|
25
36
|
"cli.all": string;
|
|
26
37
|
"cli.browserOpenFailed": string;
|
|
27
38
|
"cli.clean.done": string;
|
|
@@ -32,6 +43,7 @@ export declare const en: {
|
|
|
32
43
|
"cli.dry.row": string;
|
|
33
44
|
"cli.error": string;
|
|
34
45
|
"cli.flag.invalidNumber": string;
|
|
46
|
+
"cli.flag.invalidOutput": string;
|
|
35
47
|
"runner.budgetUnenforceable": string;
|
|
36
48
|
"judge.modelMissing": string;
|
|
37
49
|
"loaders.yamlMissing": string;
|
|
@@ -50,7 +62,10 @@ export declare const en: {
|
|
|
50
62
|
"cli.eval.noMatchHintExperiment": string;
|
|
51
63
|
"cli.eval.noMatchKnown": string;
|
|
52
64
|
"cli.exp.agentModelFlagUnsupported": string;
|
|
65
|
+
"cli.exp.viewerFlagUnsupported": string;
|
|
53
66
|
"cli.experiment.noMatch": string;
|
|
67
|
+
"cli.experiment.viewerCommandHint": string;
|
|
68
|
+
"cli.experiment.noEvalsSelected": string;
|
|
54
69
|
"cli.experimentGroup": string;
|
|
55
70
|
"cli.fallbackCleanupTimeout": string;
|
|
56
71
|
"cli.forceCleanupExit": string;
|
|
@@ -78,6 +93,7 @@ export declare const en: {
|
|
|
78
93
|
"define.evalIdRejected": string;
|
|
79
94
|
"define.evalTestRequired": string;
|
|
80
95
|
"define.experimentAgentRequired": string;
|
|
96
|
+
"define.experimentFlagNotJson": string;
|
|
81
97
|
"define.experimentIdRejected": string;
|
|
82
98
|
"define.sandboxAgentNameRequired": string;
|
|
83
99
|
"define.sandboxCreateRequired": string;
|
|
@@ -88,6 +104,41 @@ export declare const en: {
|
|
|
88
104
|
"docker.imagePullStart": string;
|
|
89
105
|
"docker.readFileFailed": string;
|
|
90
106
|
"docker.unsupportedRuntime": string;
|
|
107
|
+
"feedback.human.active": string;
|
|
108
|
+
"feedback.human.budgetExhausted": string;
|
|
109
|
+
"feedback.human.compare": string;
|
|
110
|
+
"feedback.human.counts": string;
|
|
111
|
+
"feedback.human.diffHint": string;
|
|
112
|
+
"feedback.human.evalHint": string;
|
|
113
|
+
"feedback.human.failuresHeader": string;
|
|
114
|
+
"feedback.human.heartbeat": string;
|
|
115
|
+
"feedback.human.inspect": string;
|
|
116
|
+
"feedback.human.moreActive": string;
|
|
117
|
+
"feedback.human.plan": string;
|
|
118
|
+
"feedback.human.resultFailed": string;
|
|
119
|
+
"feedback.human.resultIncomplete": string;
|
|
120
|
+
"feedback.human.resultInterrupted": string;
|
|
121
|
+
"feedback.human.resultPassed": string;
|
|
122
|
+
"feedback.human.resultsHeader": string;
|
|
123
|
+
"feedback.human.resultsMore": string;
|
|
124
|
+
"feedback.human.reuse": string;
|
|
125
|
+
"feedback.human.summaryLine": string;
|
|
126
|
+
"feedback.human.summaryAllReusedLine": string;
|
|
127
|
+
"feedback.human.suppressedFailures": string;
|
|
128
|
+
"feedback.human.trace": string;
|
|
129
|
+
"feedback.phase.agentSetup": string;
|
|
130
|
+
"feedback.phase.evalRun": string;
|
|
131
|
+
"feedback.phase.evalSetup": string;
|
|
132
|
+
"feedback.phase.sandboxCreate": string;
|
|
133
|
+
"feedback.phase.sandboxQueue": string;
|
|
134
|
+
"feedback.phase.sandboxSetup": string;
|
|
135
|
+
"feedback.phase.scoring": string;
|
|
136
|
+
"feedback.phase.teardown": string;
|
|
137
|
+
"feedback.phase.telemetryCollect": string;
|
|
138
|
+
"feedback.phase.telemetryConfigure": string;
|
|
139
|
+
"feedback.phase.workspaceBaseline": string;
|
|
140
|
+
"feedback.phase.workspaceDiff": string;
|
|
141
|
+
"feedback.rendererError": string;
|
|
91
142
|
"hitl.answerNeedsOptionOrText": string;
|
|
92
143
|
"hitl.invalidOption": string;
|
|
93
144
|
"hitl.noOptions": string;
|
|
@@ -139,6 +190,7 @@ export declare const en: {
|
|
|
139
190
|
"otel.portInUse": string;
|
|
140
191
|
"otel.windowAttribution": string;
|
|
141
192
|
"runner.diffProgress": string;
|
|
193
|
+
"runner.failFast": string;
|
|
142
194
|
"runner.driveAgent": string;
|
|
143
195
|
"runner.evalSetup": string;
|
|
144
196
|
"runner.interrupted": string;
|
|
@@ -167,6 +219,8 @@ export declare const en: {
|
|
|
167
219
|
"sandbox.dependencyMissing.e2b": string;
|
|
168
220
|
"sandbox.dependencyMissing.vercel": string;
|
|
169
221
|
"sandbox.forceCleanup": string;
|
|
222
|
+
"sandbox.provisionReconcileFailed": string;
|
|
223
|
+
"sandbox.provisionRetry": string;
|
|
170
224
|
"sandbox.stopFailed": string;
|
|
171
225
|
"sandbox.stopTimeout": string;
|
|
172
226
|
"scoring.evalError": string;
|
package/dist/i18n/zh-CN.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export declare const zhCN: {
|
|
|
12
12
|
readonly "bub.installFailed": "bub 安装失败(重试 {{attempts}} 次):\n{{tail}}";
|
|
13
13
|
readonly "bub.setupNotRun": "bub adapter 的 setup() 尚未在该沙箱运行(缺 home/workspace 信息);运行器应先调 setup 再 send。";
|
|
14
14
|
readonly "checkpoint.emptyTar": "checkpoint: tar 为空(paths: {{paths}})";
|
|
15
|
+
readonly "checkpoint.archiveFailed": "checkpoint 归档失败(exit {{exitCode}}): {{detail}}";
|
|
16
|
+
readonly "checkpoint.restoreFailed": "checkpoint 恢复失败(exit {{exitCode}}): {{detail}}";
|
|
15
17
|
readonly "skill.localMissing": "本地 skill 路径不存在:\"{{path}}\"(解析到 {{resolved}})。path 相对跑 niceeval 的项目根解析。";
|
|
16
18
|
readonly "skill.localDirNoSkillFile": "本地 skill 目录 \"{{path}}\" 里没有 SKILL.md。目录形态的 skill 必须在根下带一个 SKILL.md。";
|
|
17
19
|
readonly "skill.localUnsupportedShape": "本地 skill 路径 \"{{path}}\" 形态不支持。只接受:含 SKILL.md 的目录,或单个 .md 文件。";
|
|
@@ -21,7 +23,16 @@ export declare const zhCN: {
|
|
|
21
23
|
readonly "skill.repoUnknownSkill": "repo skill {{source}}(ref: {{ref}})里没有名为 \"{{skill}}\" 的 skill。可选:{{available}}。";
|
|
22
24
|
readonly "skill.copyFailed": "skill \"{{name}}\" 装进 {{dest}} 失败:\n{{tail}}";
|
|
23
25
|
readonly "plugin.marketplaceFailed": "{{agent}} marketplace \"{{name}}\" 连接失败(source: {{source}}, ref: {{ref}}):\n{{tail}}";
|
|
26
|
+
readonly "plugin.marketplaceVerifyFailed": "{{agent}} marketplace \"{{name}}\" add 后回读注册列表失败({{command}}):\n{{tail}}";
|
|
27
|
+
readonly "plugin.marketplaceNameMismatch": string;
|
|
24
28
|
readonly "plugin.installFailed": "{{agent}} plugin \"{{name}}\"(marketplace: {{marketplace}})安装失败:\n{{tail}}";
|
|
29
|
+
readonly "nativeConfig.pathNotProjectRelative": "{{agent}} {{field}} 只接受项目根内的相对路径,收到 \"{{path}}\"。绝对路径、包含 `..` 的路径和 `~` 路径都不行;项目根外的配置先复制进项目再引用。";
|
|
30
|
+
readonly "nativeConfig.missing": "{{agent}} {{field}} 指向的文件不存在:\"{{path}}\"(解析到 {{resolved}})。路径相对运行 niceeval 的项目根(含 niceeval.config.ts 的目录)解析,不相对 eval / experiment 源码文件。";
|
|
31
|
+
readonly "nativeConfig.escapesRoot": "{{agent}} {{field}} \"{{path}}\" 经符号链接解析到项目根之外({{resolved}})。配置文件必须真实位于项目根内。";
|
|
32
|
+
readonly "nativeConfig.notFile": "{{agent}} {{field}} \"{{path}}\" 不是普通文件。指向一份完整的官方配置文件。";
|
|
33
|
+
readonly "nativeConfig.invalidSyntax": "{{agent}} {{field}} \"{{path}}\" 不是合法的 {{format}}:{{detail}}";
|
|
34
|
+
readonly "nativeConfig.reservedKeys": "{{agent}} {{field}} \"{{path}}\" 含保留键:{{keys}}。这些键由 experiment 与 Adapter 拥有(model、鉴权、MCP、OTel 经独立配置层叠加),从文件里删掉再跑。";
|
|
35
|
+
readonly "nativeConfig.uploadFailed": "原生配置文件 \"{{path}}\" 上传沙箱失败({{dest}}):\n{{tail}}";
|
|
25
36
|
readonly "cli.all": "(全部)";
|
|
26
37
|
readonly "cli.browserOpenFailed": "无法自动打开浏览器,请手动访问:{{url}}\n";
|
|
27
38
|
readonly "cli.clean.done": "已删除 .niceeval/ 历史运行 artifact。\n";
|
|
@@ -32,6 +43,7 @@ export declare const zhCN: {
|
|
|
32
43
|
readonly "cli.dry.row": " {{who}}{{experiment}}: {{evals}} ×{{runs}}\n";
|
|
33
44
|
readonly "cli.error": "niceeval 出错:{{error}}\n";
|
|
34
45
|
readonly "cli.flag.invalidNumber": "标志 --{{flag}} 需要数字,收到 \"{{value}}\"。\n";
|
|
46
|
+
readonly "cli.flag.invalidOutput": "标志 --output 需要 auto|human|agent|ci 之一,收到 \"{{value}}\"。\n";
|
|
35
47
|
readonly "runner.budgetUnenforceable": "{{budgetKey}} 的 budget:连续多个 attempt 完成后都拿不到成本数据(agent 不上报用量且模型不在价格表)——该 agent 的 budget 无法执行,取消护栏继续跑。\n";
|
|
36
48
|
readonly "judge.modelMissing": string;
|
|
37
49
|
readonly "loaders.yamlMissing": "loadYaml(\"{{path}}\") 需要 YAML 解析器:请先 `pnpm add yaml`(或改用 loadJson + JSON 数据集)。";
|
|
@@ -49,8 +61,11 @@ export declare const zhCN: {
|
|
|
49
61
|
readonly "cli.eval.noMatch": "没有匹配的 eval:{{patterns}}。\n";
|
|
50
62
|
readonly "cli.eval.noMatchHintExperiment": "提示:\"{{pattern}}\" 是实验{{kind}},你大概想跑:niceeval exp {{pattern}}\n";
|
|
51
63
|
readonly "cli.eval.noMatchKnown": "已发现 {{count}} 个 eval:{{evals}}\n";
|
|
52
|
-
readonly "cli.exp.agentModelFlagUnsupported": "
|
|
64
|
+
readonly "cli.exp.agentModelFlagUnsupported": "experiment 运行不支持 --agent / --model。请新增或复制一个 experiment 文件并修改 model。\n";
|
|
65
|
+
readonly "cli.exp.viewerFlagUnsupported": "`{{flag}}` 只适用于 niceeval {{command}},不能用于 niceeval exp。\n";
|
|
53
66
|
readonly "cli.experiment.noMatch": "没有匹配的实验:{{arg}}。已发现:{{experiments}}\n";
|
|
67
|
+
readonly "cli.experiment.viewerCommandHint": "你可能想运行:niceeval {{command}}{{args}}\n";
|
|
68
|
+
readonly "cli.experiment.noEvalsSelected": "未选择任何 eval:{{selection}} 匹配到 0 个 eval。可用实验:{{experiments}}。\n";
|
|
54
69
|
readonly "cli.experimentGroup": "组";
|
|
55
70
|
readonly "cli.fallbackCleanupTimeout": "\ngraceful 清理超时,强制清理沙箱…\n";
|
|
56
71
|
readonly "cli.forceCleanupExit": "\n强制清理沙箱并退出…\n";
|
|
@@ -78,6 +93,7 @@ export declare const zhCN: {
|
|
|
78
93
|
readonly "define.evalIdRejected": "defineEval 不接受 id —— id 由文件路径推导。";
|
|
79
94
|
readonly "define.evalTestRequired": "defineEval 需要一个 async test(t) 函数。";
|
|
80
95
|
readonly "define.experimentAgentRequired": "defineExperiment 需要 agent。";
|
|
96
|
+
readonly "define.experimentFlagNotJson": "experiment.flags.{{key}} 不是可 JSON 序列化的值(函数 / undefined / 循环引用 / bigint 不允许);flags 会原样进入结果快照,必须是纯 JSON。";
|
|
81
97
|
readonly "define.experimentIdRejected": "defineExperiment 不接受 id —— id 由文件路径推导。";
|
|
82
98
|
readonly "define.sandboxAgentNameRequired": "defineSandboxAgent 需要 name。";
|
|
83
99
|
readonly "define.sandboxCreateRequired": "defineSandbox 需要一个 create() 函数。";
|
|
@@ -88,6 +104,41 @@ export declare const zhCN: {
|
|
|
88
104
|
readonly "docker.imagePullStart": "Pulling Docker image: {{image}}...";
|
|
89
105
|
readonly "docker.readFileFailed": "Failed to read file {{path}}: {{stderr}}";
|
|
90
106
|
readonly "docker.unsupportedRuntime": "Unsupported runtime: {{runtime}}";
|
|
107
|
+
readonly "feedback.human.active": "ACTIVE";
|
|
108
|
+
readonly "feedback.human.budgetExhausted": "{{experimentId}} 预算已耗尽(已花 {{spent}},未跑 {{unstarted}})";
|
|
109
|
+
readonly "feedback.human.compare": "Compare: niceeval view {{group}}";
|
|
110
|
+
readonly "feedback.human.counts": "共 {{total}} · 复用 {{reused}} · 运行中 {{running}} · 排队 {{queued}} · 已完成 {{completed}}";
|
|
111
|
+
readonly "feedback.human.diffHint": "Diff: niceeval show {{locator}} --diff";
|
|
112
|
+
readonly "feedback.human.evalHint": "Eval: niceeval show {{locator}} --eval";
|
|
113
|
+
readonly "feedback.human.failuresHeader": "FAILURES";
|
|
114
|
+
readonly "feedback.human.heartbeat": "已运行 {{elapsed}} · {{counts}}";
|
|
115
|
+
readonly "feedback.human.inspect": "Inspect: niceeval show {{locator}}";
|
|
116
|
+
readonly "feedback.human.moreActive": "… 还有 {{count}} 项运行中";
|
|
117
|
+
readonly "feedback.human.plan": "计划:{{total}} 个 attempt · {{evals}} 个 eval × {{configs}} 个配置 · 并发 {{concurrency}}";
|
|
118
|
+
readonly "feedback.human.resultFailed": "FAILED";
|
|
119
|
+
readonly "feedback.human.resultIncomplete": "INCOMPLETE";
|
|
120
|
+
readonly "feedback.human.resultInterrupted": "INTERRUPTED";
|
|
121
|
+
readonly "feedback.human.resultPassed": "PASSED";
|
|
122
|
+
readonly "feedback.human.resultsHeader": "Results:";
|
|
123
|
+
readonly "feedback.human.resultsMore": "… 还有 {{count}} 个";
|
|
124
|
+
readonly "feedback.human.reuse": "复用:{{total}} 中 {{reused}} 条来自缓存 · {{toRun}} 待跑";
|
|
125
|
+
readonly "feedback.human.summaryLine": "{{passed}} 通过 · {{failed}} 失败 · {{errored}} 出错 (复用 {{reused}})";
|
|
126
|
+
readonly "feedback.human.summaryAllReusedLine": "{{passed}} 通过 · {{failed}} 失败 · {{errored}} 出错 (全部 {{reused}} 条复用)";
|
|
127
|
+
readonly "feedback.human.suppressedFailures": "… 还有 {{count}} 条失败被折叠";
|
|
128
|
+
readonly "feedback.human.trace": "Trace: niceeval show {{locator}} --execution";
|
|
129
|
+
readonly "feedback.phase.agentSetup": "agent 预置";
|
|
130
|
+
readonly "feedback.phase.evalRun": "运行 eval";
|
|
131
|
+
readonly "feedback.phase.evalSetup": "eval 预置";
|
|
132
|
+
readonly "feedback.phase.sandboxCreate": "创建沙箱";
|
|
133
|
+
readonly "feedback.phase.sandboxQueue": "排队等沙箱";
|
|
134
|
+
readonly "feedback.phase.sandboxSetup": "沙箱预置";
|
|
135
|
+
readonly "feedback.phase.scoring": "评分";
|
|
136
|
+
readonly "feedback.phase.teardown": "清理中";
|
|
137
|
+
readonly "feedback.phase.telemetryCollect": "收集 trace";
|
|
138
|
+
readonly "feedback.phase.telemetryConfigure": "配置 telemetry";
|
|
139
|
+
readonly "feedback.phase.workspaceBaseline": "准备工作区";
|
|
140
|
+
readonly "feedback.phase.workspaceDiff": "采集 diff";
|
|
141
|
+
readonly "feedback.rendererError": " · [feedback] renderer 处理 {{context}} 失败(已忽略):{{message}}\n";
|
|
91
142
|
readonly "hitl.answerNeedsOptionOrText": "t.respond 的对象形式需要 optionId 或 text 二选一(两者都没给)。";
|
|
92
143
|
readonly "hitl.invalidOption": "回答 \"{{optionId}}\" 不是请求 {{requestId}} 的可选项({{options}})。";
|
|
93
144
|
readonly "hitl.noOptions": "该请求没有可选项";
|
|
@@ -139,6 +190,7 @@ export declare const zhCN: {
|
|
|
139
190
|
readonly "otel.portInUse": "OTLP 接收端口 {{port}} 已被占用(另一个进程占着这个端口)。在 defineConfig({ telemetry: { port } }) 里换一个空闲端口,或者停掉占用 {{port}} 的进程后重试。";
|
|
140
191
|
readonly "otel.windowAttribution": "otel:span 未带本轮 traceparent,按时间窗口归属(该 agent 的轮次已串行;应用支持 W3C 传播后自动并发)";
|
|
141
192
|
readonly "runner.diffProgress": "采 diff:{{changed}} 改 / {{deleted}} 删";
|
|
193
|
+
readonly "runner.failFast": "{{evalId}} 的错误 {{code}} 连续复现,判定为确定性错误;停止派发该配置剩余的 attempt(fail-fast)。";
|
|
142
194
|
readonly "runner.driveAgent": "驱动 agent…";
|
|
143
195
|
readonly "runner.evalSetup": "eval setup(装依赖)…";
|
|
144
196
|
readonly "runner.interrupted": " · 已中断:沙箱容器已清理,输出本次已完成的部分结果。\n";
|
|
@@ -167,6 +219,8 @@ export declare const zhCN: {
|
|
|
167
219
|
readonly "sandbox.dependencyMissing.e2b": "E2B sandbox requires 'e2b'. Install it with: pnpm add e2b";
|
|
168
220
|
readonly "sandbox.dependencyMissing.vercel": "Vercel sandbox requires '@vercel/sandbox'. Install it with: pnpm add @vercel/sandbox";
|
|
169
221
|
readonly "sandbox.forceCleanup": " · [sandbox] 强制清理 {{count}} 个沙箱…\n";
|
|
222
|
+
readonly "sandbox.provisionReconcileFailed": " · [sandbox] 创建重试前对账失败,放弃重试(可能已创建的实例无法核实/销毁):{{error}}\n";
|
|
223
|
+
readonly "sandbox.provisionRetry": " · [sandbox] 创建被限流,{{delayMs}}ms 后重试(第 {{attempt}}/{{maxAttempts}} 次)…\n";
|
|
170
224
|
readonly "sandbox.stopFailed": " · [sandbox] 停沙箱 {{id}} 失败(已忽略,靠 provider 过期兜底):{{message}}\n";
|
|
171
225
|
readonly "sandbox.stopTimeout": "stop 超时({{timeoutMs}}ms)";
|
|
172
226
|
readonly "scoring.evalError": "评估出错: {{error}}";
|
package/dist/o11y/types.d.ts
CHANGED
|
@@ -38,11 +38,23 @@ export interface InputRequest {
|
|
|
38
38
|
label?: string;
|
|
39
39
|
}[];
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* 落盘截断的结构化标记(见 docs/feature/results/architecture.md「大值截断」):
|
|
43
|
+
* `path` 是被截断的位置(事件里是字段名,如 "output";span 里是 attribute key,如 "output.value"),
|
|
44
|
+
* `originalBytes` 是截断前的 UTF-8 字节数。view 显示「输出过大,已截断」靠它,不正则匹配 marker。
|
|
45
|
+
*/
|
|
46
|
+
export interface Truncation {
|
|
47
|
+
path: string;
|
|
48
|
+
originalBytes: number;
|
|
49
|
+
}
|
|
41
50
|
/**
|
|
42
51
|
* 标准事件流的词汇(对标 docs/feature/adapters/architecture/events.md)。adapter 唯一的硬活就是把
|
|
43
52
|
* 各 agent 五花八门的原始 transcript 映射成 StreamEvent[];映射完,整套断言免费。
|
|
53
|
+
* `truncated` 只由 results writer 在落盘时刻写入(运行时全量,落盘截断);adapter 不产出它。
|
|
44
54
|
*/
|
|
45
|
-
export type StreamEvent =
|
|
55
|
+
export type StreamEvent = {
|
|
56
|
+
truncated?: Truncation[];
|
|
57
|
+
} & (
|
|
46
58
|
/** 一条文本消息(assistant 回复或 user 输入);`loc` 是可选的源码位置,用于把消息叠回 eval 源码。 */
|
|
47
59
|
{
|
|
48
60
|
type: "message";
|
|
@@ -107,7 +119,7 @@ export type StreamEvent =
|
|
|
107
119
|
| {
|
|
108
120
|
type: "error";
|
|
109
121
|
message: string;
|
|
110
|
-
};
|
|
122
|
+
});
|
|
111
123
|
/** core 从事件流折叠出的结构化事实(deriveRunFacts)。 */
|
|
112
124
|
export interface ToolCall {
|
|
113
125
|
callId: string;
|
|
@@ -162,6 +174,8 @@ export interface TraceSpan {
|
|
|
162
174
|
kind?: SpanKind;
|
|
163
175
|
/** OTLP span 属性(gen_ai.* / tool 名 / token 等),按 key 摊平。raw 属性始终保留供下钻。 */
|
|
164
176
|
attributes?: Record<string, JsonValue>;
|
|
177
|
+
/** 落盘截断标记(只由 results writer 在序列化时写入,运行时全量;见 Truncation)。 */
|
|
178
|
+
truncated?: Truncation[];
|
|
165
179
|
}
|
|
166
180
|
/** 给人 / 给 EVAL.ts 看的 o11y 摘要(注入沙箱 __niceeval__/results.json)。 */
|
|
167
181
|
export interface O11ySummary {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AttemptHandle, Selection, SelectionWarning, Snapshot } from "../results/types.ts";
|
|
2
2
|
import { type AttemptLocator } from "../results/locator.ts";
|
|
3
|
-
import type { Aggregator, DimensionInput, Metric, MetricCell, MetricColumn, FlagRef } from "./types.ts";
|
|
3
|
+
import type { Aggregator, AxisInput, ConfigRef, DimensionInput, Metric, MetricCell, MetricColumn, FlagRef } from "./types.ts";
|
|
4
4
|
import { evalPrefixPredicate } from "../shared/aggregate.ts";
|
|
5
5
|
/** flag 未声明时的组名:不猜,如实归一组。 */
|
|
6
6
|
export declare const FLAG_UNSET = "(unset)";
|
|
@@ -39,8 +39,10 @@ export declare function dimensionName(dimension: DimensionInput): string;
|
|
|
39
39
|
export declare function evalGroupOf(id: string): string;
|
|
40
40
|
/** flag 声明值 → 组标签:label 函数优先,其余 String();未声明 → FLAG_UNSET。 */
|
|
41
41
|
export declare function flagGroupKey(ref: FlagRef, item: Item): string;
|
|
42
|
-
/**
|
|
43
|
-
export declare function
|
|
42
|
+
/** config 投影值 → 组标签,规则与 flagGroupKey 一致;未投影 → FLAG_UNSET。 */
|
|
43
|
+
export declare function configGroupKey(ref: ConfigRef, item: Item): string;
|
|
44
|
+
/** flag / config 作轴:要求数值;未声明、未投影或非数值 → null(点不画,注脚报数)。 */
|
|
45
|
+
export declare function axisValue(ref: AxisInput, item: Item): number | null;
|
|
44
46
|
export declare function dimensionKey(dimension: DimensionInput, item: Item): string;
|
|
45
47
|
/** 按维度分组,保持首次出现顺序(无 sort 时表格行序即此序)。 */
|
|
46
48
|
export declare function groupItems(items: Item[], dimension: DimensionInput): Map<string, Item[]>;
|
package/dist/report/aggregate.js
CHANGED
|
@@ -79,29 +79,56 @@ export function evalGroupOf(id) {
|
|
|
79
79
|
function isFlagRef(dimension) {
|
|
80
80
|
return typeof dimension === "object" && "kind" in dimension && dimension.kind === "flag";
|
|
81
81
|
}
|
|
82
|
+
function isConfigRef(dimension) {
|
|
83
|
+
return typeof dimension === "object" && "kind" in dimension && dimension.kind === "config";
|
|
84
|
+
}
|
|
82
85
|
/** experiment 声明的 flags(经 runner 原样透传进持久化字段 ExperimentRunInfo.flags)。 */
|
|
83
86
|
function flagsOf(attempt) {
|
|
84
87
|
return attempt.result.experiment?.flags;
|
|
85
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* config() 的取值:读快照的 `ExperimentRunInfo` 投影(快照优先;第三方落盘只把投影拼在
|
|
91
|
+
* 条目上时回退 result.experiment),外加桥接到快照顶层权威字段的 `model` / `agent` 两个键
|
|
92
|
+
* (与 "model" / "agent" 内置维度同一读法,不另造第二套口径)。未投影 → undefined。
|
|
93
|
+
*/
|
|
94
|
+
function configValueOf(ref, item) {
|
|
95
|
+
if (ref.name === "model")
|
|
96
|
+
return item.attempt.result.model ?? item.snapshot.model;
|
|
97
|
+
if (ref.name === "agent")
|
|
98
|
+
return item.attempt.result.agent || item.snapshot.agent;
|
|
99
|
+
const info = item.snapshot.experiment ?? item.attempt.result.experiment;
|
|
100
|
+
// ExperimentRunInfo 是穷尽可序列化投影;按字段名取值,新增投影字段无需改这里
|
|
101
|
+
return info?.[ref.name];
|
|
102
|
+
}
|
|
86
103
|
/** flag 声明值 → 组标签:label 函数优先,其余 String();未声明 → FLAG_UNSET。 */
|
|
87
104
|
export function flagGroupKey(ref, item) {
|
|
88
|
-
|
|
105
|
+
return refGroupKey(ref, flagsOf(item.attempt)?.[ref.name]);
|
|
106
|
+
}
|
|
107
|
+
/** config 投影值 → 组标签,规则与 flagGroupKey 一致;未投影 → FLAG_UNSET。 */
|
|
108
|
+
export function configGroupKey(ref, item) {
|
|
109
|
+
return refGroupKey(ref, configValueOf(ref, item));
|
|
110
|
+
}
|
|
111
|
+
function refGroupKey(ref, value) {
|
|
89
112
|
if (value === undefined)
|
|
90
113
|
return FLAG_UNSET;
|
|
91
|
-
//
|
|
114
|
+
// 声明侧的合法标量就是这三种;非标量投影(sandbox / selectedEvalIds…)如实 JSON 化,不猜
|
|
92
115
|
if (typeof ref.label === "function")
|
|
93
116
|
return ref.label(value);
|
|
117
|
+
if (typeof value === "object" && value !== null)
|
|
118
|
+
return JSON.stringify(value);
|
|
94
119
|
return String(value);
|
|
95
120
|
}
|
|
96
|
-
/** flag
|
|
97
|
-
export function
|
|
98
|
-
const value = flagsOf(item.attempt)?.[ref.name];
|
|
121
|
+
/** flag / config 作轴:要求数值;未声明、未投影或非数值 → null(点不画,注脚报数)。 */
|
|
122
|
+
export function axisValue(ref, item) {
|
|
123
|
+
const value = ref.kind === "flag" ? flagsOf(item.attempt)?.[ref.name] : configValueOf(ref, item);
|
|
99
124
|
return typeof value === "number" ? value : null;
|
|
100
125
|
}
|
|
101
126
|
export function dimensionKey(dimension, item) {
|
|
102
127
|
if (typeof dimension !== "string") {
|
|
103
128
|
if (isFlagRef(dimension))
|
|
104
129
|
return flagGroupKey(dimension, item);
|
|
130
|
+
if (isConfigRef(dimension))
|
|
131
|
+
return configGroupKey(dimension, item);
|
|
105
132
|
return dimension.of(item.attempt);
|
|
106
133
|
}
|
|
107
134
|
const result = item.attempt.result;
|
|
@@ -1 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
import { type ReportDefinition } from "../report.ts";
|
|
2
|
+
import { type ReportComponent } from "../tree.ts";
|
|
3
|
+
import { type ReportLocale } from "../locale.ts";
|
|
4
|
+
import type { ExperimentListItem, GroupSummaryData, ScatterData } from "../types.ts";
|
|
5
|
+
import { type SnapshotsInput } from "../aggregate.ts";
|
|
6
|
+
/**
|
|
7
|
+
* 一个可比组的数据。三个子块都只消费本组快照,不能含其它父目录的引用。
|
|
8
|
+
*/
|
|
9
|
+
export interface ExperimentComparisonGroupData {
|
|
10
|
+
/** experiment id 的完整父路径;根目录 experiment 使用自己的完整 id。 */
|
|
11
|
+
key: string;
|
|
12
|
+
summary: GroupSummaryData;
|
|
13
|
+
/** 成本 × 端到端成功率散点(`MetricScatter.data` 的口径:points=experiment、series=agent)。 */
|
|
14
|
+
scatter: ScatterData;
|
|
15
|
+
/** 固定列 experiment 比较表(`ExperimentList.data` 的口径,已按端到端成功率排序)。 */
|
|
16
|
+
experiments: ExperimentListItem[];
|
|
17
|
+
}
|
|
18
|
+
/** `ExperimentComparison.data(selection)` 的穷尽产物:按 key 排序的独立可比组。 */
|
|
19
|
+
export interface ExperimentComparisonData {
|
|
20
|
+
groups: ExperimentComparisonGroupData[];
|
|
21
|
+
}
|
|
22
|
+
/** 完整父路径是组键;没有父路径的 experiment 不能互相比,自己形成单例组。 */
|
|
23
|
+
export declare function experimentComparisonGroupKey(experimentId: string): string;
|
|
24
|
+
/** 组合件的数据计算:先分区,再让三个官方子块在各组内并行计算。 */
|
|
25
|
+
declare function experimentComparisonData(input: SnapshotsInput): Promise<ExperimentComparisonData>;
|
|
26
|
+
export interface ExperimentComparisonProps {
|
|
27
|
+
data: ExperimentComparisonData;
|
|
28
|
+
/** chrome 文案 locale;省略时随宿主上下文(宿主外默认 "en")。 */
|
|
29
|
+
locale?: ReportLocale;
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 内置默认报告兼官方组合件:作为组件时收 `data`(`.data()` 的产物),两个渲染面直接摆
|
|
34
|
+
* 数据形态的子组件;作为默认报告时经 build 面走与用户 `--report` 完全相同的管线。
|
|
35
|
+
*/
|
|
36
|
+
export declare const ExperimentComparison: ReportComponent<ExperimentComparisonProps> & ReportDefinition & {
|
|
37
|
+
data: typeof experimentComparisonData;
|
|
38
|
+
};
|
|
39
|
+
export {};
|