python-yama 0.4.0__tar.gz → 0.6.0__tar.gz

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.
Files changed (60) hide show
  1. {python_yama-0.4.0 → python_yama-0.6.0}/PKG-INFO +16 -2
  2. {python_yama-0.4.0 → python_yama-0.6.0}/README.md +14 -1
  3. {python_yama-0.4.0 → python_yama-0.6.0}/README.zh-CN.md +14 -1
  4. {python_yama-0.4.0 → python_yama-0.6.0}/docs/agent-skill-test-framework-design.md +276 -36
  5. python_yama-0.6.0/docs/case-schema-reference.md +976 -0
  6. python_yama-0.6.0/docs/yama-intro.html +815 -0
  7. {python_yama-0.4.0 → python_yama-0.6.0}/pyproject.toml +1 -0
  8. {python_yama-0.4.0 → python_yama-0.6.0}/skills/eval-plugin-with-yama/SKILL.md +122 -6
  9. {python_yama-0.4.0 → python_yama-0.6.0}/skills/eval-plugin-with-yama/references/case-schema.md +41 -4
  10. {python_yama-0.4.0 → python_yama-0.6.0}/skills/eval-plugin-with-yama/references/debugging.md +27 -4
  11. {python_yama-0.4.0 → python_yama-0.6.0}/tests/test_assertions.py +68 -0
  12. {python_yama-0.4.0 → python_yama-0.6.0}/tests/test_cli.py +497 -15
  13. python_yama-0.6.0/tests/test_dashboard.py +263 -0
  14. {python_yama-0.4.0 → python_yama-0.6.0}/tests/test_framework.py +193 -1
  15. python_yama-0.6.0/tests/test_llm.py +183 -0
  16. python_yama-0.6.0/tests/test_preview.py +337 -0
  17. python_yama-0.6.0/tests/test_report.py +698 -0
  18. python_yama-0.6.0/tests/test_run_plan.py +150 -0
  19. python_yama-0.6.0/tests/test_runner.py +325 -0
  20. python_yama-0.6.0/tests/test_thread_case.py +807 -0
  21. {python_yama-0.4.0 → python_yama-0.6.0}/tests/test_workspace.py +33 -0
  22. {python_yama-0.4.0 → python_yama-0.6.0}/uv.lock +2 -0
  23. {python_yama-0.4.0 → python_yama-0.6.0}/yama/assertions.py +32 -3
  24. {python_yama-0.4.0 → python_yama-0.6.0}/yama/cli.py +298 -27
  25. python_yama-0.6.0/yama/dashboard.py +320 -0
  26. {python_yama-0.4.0 → python_yama-0.6.0}/yama/llm.py +52 -18
  27. python_yama-0.6.0/yama/preview.py +384 -0
  28. python_yama-0.6.0/yama/report.py +1423 -0
  29. {python_yama-0.4.0 → python_yama-0.6.0}/yama/runner.py +221 -18
  30. python_yama-0.6.0/yama/thread_case.py +401 -0
  31. python_yama-0.4.0/tests/test_report.py +0 -220
  32. python_yama-0.4.0/yama/report.py +0 -925
  33. {python_yama-0.4.0 → python_yama-0.6.0}/.github/workflows/publish.yml +0 -0
  34. {python_yama-0.4.0 → python_yama-0.6.0}/.gitignore +0 -0
  35. {python_yama-0.4.0 → python_yama-0.6.0}/CLAUDE.md +0 -0
  36. {python_yama-0.4.0 → python_yama-0.6.0}/LICENSE +0 -0
  37. {python_yama-0.4.0 → python_yama-0.6.0}/tests/test_cli_shim.py +0 -0
  38. {python_yama-0.4.0 → python_yama-0.6.0}/tests/test_main_entrypoint.py +0 -0
  39. {python_yama-0.4.0 → python_yama-0.6.0}/tests/test_mocks.py +0 -0
  40. {python_yama-0.4.0 → python_yama-0.6.0}/tests/test_public_api.py +0 -0
  41. {python_yama-0.4.0 → python_yama-0.6.0}/tests/test_skill_tool.py +0 -0
  42. {python_yama-0.4.0 → python_yama-0.6.0}/tests/test_tool_loader.py +0 -0
  43. {python_yama-0.4.0 → python_yama-0.6.0}/tests/test_usage.py +0 -0
  44. {python_yama-0.4.0 → python_yama-0.6.0}/yama/__init__.py +0 -0
  45. {python_yama-0.4.0 → python_yama-0.6.0}/yama/__main__.py +0 -0
  46. {python_yama-0.4.0 → python_yama-0.6.0}/yama/loaders/__init__.py +0 -0
  47. {python_yama-0.4.0 → python_yama-0.6.0}/yama/loaders/case.py +0 -0
  48. {python_yama-0.4.0 → python_yama-0.6.0}/yama/loaders/common.py +0 -0
  49. {python_yama-0.4.0 → python_yama-0.6.0}/yama/loaders/tool_loader.py +0 -0
  50. {python_yama-0.4.0 → python_yama-0.6.0}/yama/mocks.py +0 -0
  51. {python_yama-0.4.0 → python_yama-0.6.0}/yama/models.py +0 -0
  52. {python_yama-0.4.0 → python_yama-0.6.0}/yama/tools/__init__.py +0 -0
  53. {python_yama-0.4.0 → python_yama-0.6.0}/yama/tools/base.py +0 -0
  54. {python_yama-0.4.0 → python_yama-0.6.0}/yama/tools/bash/__init__.py +0 -0
  55. {python_yama-0.4.0 → python_yama-0.6.0}/yama/tools/bash/_cli_shim.py +0 -0
  56. {python_yama-0.4.0 → python_yama-0.6.0}/yama/tools/bash/bash.py +0 -0
  57. {python_yama-0.4.0 → python_yama-0.6.0}/yama/tools/bash/fs.py +0 -0
  58. {python_yama-0.4.0 → python_yama-0.6.0}/yama/tools/skill/__init__.py +0 -0
  59. {python_yama-0.4.0 → python_yama-0.6.0}/yama/tools/skill/skill.py +0 -0
  60. {python_yama-0.4.0 → python_yama-0.6.0}/yama/workspace.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-yama
3
- Version: 0.4.0
3
+ Version: 0.6.0
4
4
  Summary: A reproducible evaluation runner for tool-using Agent skills
5
5
  Project-URL: Repository, https://github.com/world-sim-dev/yama
6
6
  Project-URL: Issues, https://github.com/world-sim-dev/yama/issues
@@ -19,6 +19,7 @@ Requires-Dist: fastapi>=0.139.0
19
19
  Requires-Dist: jinja2>=3.1
20
20
  Requires-Dist: litellm<2.0,>=1.80
21
21
  Requires-Dist: orjson>=3.11.9
22
+ Requires-Dist: python-dotenv>=1.0
22
23
  Requires-Dist: pyyaml>=6.0
23
24
  Requires-Dist: rich<15.0,>=14.1
24
25
  Description-Content-Type: text/markdown
@@ -40,6 +41,8 @@ OPENAI_API_KEY=... uv run --project yama yama
40
41
  OPENAI_API_KEY=... uv run --project yama yama --plugin dingding-simple
41
42
  ```
42
43
 
44
+ Instead of prefixing every command, you can put credentials in a `.env` file: on startup the CLI loads the nearest `.env` found from the working directory upward (variables already set in the environment are not overridden).
45
+
43
46
  ## Writing a Case
44
47
 
45
48
  A Case is a YAML file organized as `context` (what the model sees) → `mocks` (how tool calls get executed) → `steps` (user turns sent in order, each with assertions) → `outcome` (the pass bar for the whole Case):
@@ -96,11 +99,22 @@ uv run --project yama yama --plugin dingding-simple --report
96
99
  | `-k, --filter PATTERN` (repeatable) | Only run cases whose case key (path relative to the plugin root) matches — a substring, or an fnmatch glob when the pattern contains `*` `?` `[`; with several patterns a case runs if any matches |
97
100
  | `--result-dir PATH` | Override the artifact root (default `<plugin_root>/.yama/runs`) |
98
101
  | `--concurrency N` | Maximum number of cases running in parallel (default 10; `1` runs cases one at a time) |
99
- | `--report [PATH]` | Also generate a single-file HTML report (default `.yama/reports/latest.html`) |
102
+ | `--report [PATH]` | Also generate a single-file HTML report. Without PATH it writes a timestamped `.yama/reports/report-<ts>.html` (history accumulates) and keeps `.yama/reports/latest.html` as a symlink to the newest one; an explicit PATH writes exactly that file |
103
+ | `--preview` | Don't run anything (no LLM calls): resolve the collected Cases and write an HTML case preview (default `.yama/reports/preview.html`; `--report PATH` overrides), or print a JSON preview to stdout when combined with `--json` |
100
104
  | `--list` | Only print the collected Cases, without running them |
101
105
  | `--no-artifacts` | Write no artifact files at all |
102
106
  | `--json` | Emit machine-readable JSON instead of Rich tables |
103
107
 
104
108
  `--plugin`, `--all-plugins`, and `--plugin-root` are mutually exclusive. When none of them is given, yama walks up from the current directory to the nearest directory containing `yama.toml` and uses it as the workspace root (falling back to the cwd), running it as a single plugin root.
105
109
 
110
+ ### Dashboard
111
+
112
+ ```bash
113
+ uv run --project yama yama dashboard --plugin dingding-simple
114
+ ```
115
+
116
+ `yama dashboard` starts a local HTTP server (default `http://127.0.0.1:8765/`, change with `--host`/`--port`; it also accepts the same plugin selection flags as the main command plus `-k/--filter` and `--result-dir`). The index page lists the historical HTML reports accumulated under `.yama/reports/` (newest first, with the `latest` one flagged), `/reports/<name>` serves each report, and `/preview` renders the same case preview as `--preview` — re-collecting and re-resolving the case files on every refresh (collection errors render as an error page), so you can edit a Case YAML and just reload the browser. No LLM calls are ever made by the dashboard.
117
+
118
+ ### Output
119
+
106
120
  Cases run in parallel, up to 10 at a time by default (`--concurrency` changes the cap); runs within one case stay sequential, and results keep collection order regardless of completion order. While several cases run concurrently, a transient dashboard at the bottom of the terminal shows one row per case, updated in place — waiting, then a spinner with the run/step currently executing, then its ✓/✗ verdict — and each case's full run/step detail is printed above the dashboard as one block the moment it finishes, so blocks of different cases never interleave. With `--concurrency 1` (or a single collected case) it streams instead — a spinner marks the step currently executing (on a terminal), and each case, run, and assertion result is printed the moment it completes. Either way a per-case summary table closes the output, and with `--json` the progress stream goes to stderr so stdout stays valid JSON.
@@ -15,6 +15,8 @@ OPENAI_API_KEY=... uv run --project yama yama
15
15
  OPENAI_API_KEY=... uv run --project yama yama --plugin dingding-simple
16
16
  ```
17
17
 
18
+ Instead of prefixing every command, you can put credentials in a `.env` file: on startup the CLI loads the nearest `.env` found from the working directory upward (variables already set in the environment are not overridden).
19
+
18
20
  ## Writing a Case
19
21
 
20
22
  A Case is a YAML file organized as `context` (what the model sees) → `mocks` (how tool calls get executed) → `steps` (user turns sent in order, each with assertions) → `outcome` (the pass bar for the whole Case):
@@ -71,11 +73,22 @@ uv run --project yama yama --plugin dingding-simple --report
71
73
  | `-k, --filter PATTERN` (repeatable) | Only run cases whose case key (path relative to the plugin root) matches — a substring, or an fnmatch glob when the pattern contains `*` `?` `[`; with several patterns a case runs if any matches |
72
74
  | `--result-dir PATH` | Override the artifact root (default `<plugin_root>/.yama/runs`) |
73
75
  | `--concurrency N` | Maximum number of cases running in parallel (default 10; `1` runs cases one at a time) |
74
- | `--report [PATH]` | Also generate a single-file HTML report (default `.yama/reports/latest.html`) |
76
+ | `--report [PATH]` | Also generate a single-file HTML report. Without PATH it writes a timestamped `.yama/reports/report-<ts>.html` (history accumulates) and keeps `.yama/reports/latest.html` as a symlink to the newest one; an explicit PATH writes exactly that file |
77
+ | `--preview` | Don't run anything (no LLM calls): resolve the collected Cases and write an HTML case preview (default `.yama/reports/preview.html`; `--report PATH` overrides), or print a JSON preview to stdout when combined with `--json` |
75
78
  | `--list` | Only print the collected Cases, without running them |
76
79
  | `--no-artifacts` | Write no artifact files at all |
77
80
  | `--json` | Emit machine-readable JSON instead of Rich tables |
78
81
 
79
82
  `--plugin`, `--all-plugins`, and `--plugin-root` are mutually exclusive. When none of them is given, yama walks up from the current directory to the nearest directory containing `yama.toml` and uses it as the workspace root (falling back to the cwd), running it as a single plugin root.
80
83
 
84
+ ### Dashboard
85
+
86
+ ```bash
87
+ uv run --project yama yama dashboard --plugin dingding-simple
88
+ ```
89
+
90
+ `yama dashboard` starts a local HTTP server (default `http://127.0.0.1:8765/`, change with `--host`/`--port`; it also accepts the same plugin selection flags as the main command plus `-k/--filter` and `--result-dir`). The index page lists the historical HTML reports accumulated under `.yama/reports/` (newest first, with the `latest` one flagged), `/reports/<name>` serves each report, and `/preview` renders the same case preview as `--preview` — re-collecting and re-resolving the case files on every refresh (collection errors render as an error page), so you can edit a Case YAML and just reload the browser. No LLM calls are ever made by the dashboard.
91
+
92
+ ### Output
93
+
81
94
  Cases run in parallel, up to 10 at a time by default (`--concurrency` changes the cap); runs within one case stay sequential, and results keep collection order regardless of completion order. While several cases run concurrently, a transient dashboard at the bottom of the terminal shows one row per case, updated in place — waiting, then a spinner with the run/step currently executing, then its ✓/✗ verdict — and each case's full run/step detail is printed above the dashboard as one block the moment it finishes, so blocks of different cases never interleave. With `--concurrency 1` (or a single collected case) it streams instead — a spinner marks the step currently executing (on a terminal), and each case, run, and assertion result is printed the moment it completes. Either way a per-case summary table closes the output, and with `--json` the progress stream goes to stderr so stdout stays valid JSON.
@@ -15,6 +15,8 @@ OPENAI_API_KEY=... uv run --project yama yama
15
15
  OPENAI_API_KEY=... uv run --project yama yama --plugin dingding-simple
16
16
  ```
17
17
 
18
+ 也可以把凭据写进 `.env` 文件,省去每次命令前缀:CLI 启动时会从当前目录向上查找并加载最近的 `.env`(已在环境中设置的变量不会被覆盖)。
19
+
18
20
  ## 编写一个 Case
19
21
 
20
22
  一个 Case 是一份 YAML 文件,按 `context`(模型看到什么)→ `mocks`(Tool 怎么被执行)→ `steps`(依次发送的用户回合与断言)→ `outcome`(整个 Case 的通过门槛)的结构组织:
@@ -71,11 +73,22 @@ uv run --project yama yama --plugin dingding-simple --report
71
73
  | `-k, --filter PATTERN`(可重复) | 只运行 case key(相对 Plugin Root 的路径)匹配 PATTERN 的 Case——默认子串匹配,PATTERN 含 `*` `?` `[` 时按 fnmatch 通配符匹配;传多个时命中任意一个即运行 |
72
74
  | `--result-dir PATH` | 覆盖产物根目录(默认 `<plugin_root>/.yama/runs`) |
73
75
  | `--concurrency N` | 同时运行的 Case 数上限(默认 10;`1` 表示逐个顺序执行) |
74
- | `--report [PATH]` | 额外生成单文件 HTML 报告(默认 `.yama/reports/latest.html`) |
76
+ | `--report [PATH]` | 额外生成单文件 HTML 报告。省略 PATH 时写带时间戳的 `.yama/reports/report-<ts>.html`(历史累积),并把 `.yama/reports/latest.html` 维护成指向最新报告的软链;显式给 PATH 时精确写到该文件 |
77
+ | `--preview` | 不运行、不发起任何 LLM 调用:解析收集到的 Case 后生成用例预览 HTML(默认 `.yama/reports/preview.html`,`--report PATH` 可覆盖);与 `--json` 组合时改为向 stdout 打印 JSON 预览 |
75
78
  | `--list` | 只打印匹配到的 Case,不运行 |
76
79
  | `--no-artifacts` | 不写任何产物文件 |
77
80
  | `--json` | 输出机器可读 JSON 而不是 Rich 表格 |
78
81
 
79
82
  `--plugin`/`--all-plugins`/`--plugin-root` 三者互斥;都不提供时默认用当前目录向上搜索到的 `yama.toml` 所在目录作为 Workspace Root(找不到则用 cwd),把该目录当作单一 Plugin Root 运行。
80
83
 
84
+ ### Dashboard
85
+
86
+ ```bash
87
+ uv run --project yama yama dashboard --plugin dingding-simple
88
+ ```
89
+
90
+ `yama dashboard` 启动一个本地 HTTP 服务(默认 `http://127.0.0.1:8765/`,可用 `--host`/`--port` 调整;同样接受主命令的 Plugin 选择参数以及 `-k/--filter`、`--result-dir`)。首页列出 `.yama/reports/` 下累积的历史 HTML 报告(时间倒序,标注 `latest` 指向的那份),`/reports/<name>` 提供各报告文件,`/preview` 渲染与 `--preview` 相同的用例预览页——每次刷新都重新收集、重新解析 Case 文件(收集失败会渲染成错误页),改完 Case YAML 刷新浏览器即可看到效果。dashboard 不会发起任何 LLM 调用。
91
+
92
+ ### 输出
93
+
81
94
  Case 之间并行执行,默认最多同时 10 个(用 `--concurrency` 调整上限);同一 Case 内的多个 run 仍顺序执行,结果始终保持收集顺序,与完成先后无关。多个 Case 并发运行时,终端底部会有一张原地刷新的状态面板,每个 Case 固定占一行——排队等待、转圈显示当前执行到的 Run/Step、完成后原地翻成 ✓/✗——任何一个 Case 一完成,它的完整 Run/Step 明细就作为一个整块打印到面板上方,不同 Case 的块不会交错。使用 `--concurrency 1`(或只收集到一个 Case)时则实时流式输出——正在执行的 Step 会显示转圈的 loading 状态(终端下),每个 Case、Run、断言一完成就立即打印结果。两种模式最后都以逐 Case 的汇总表格收尾;使用 `--json` 时进度流打印到 stderr,stdout 保持为纯 JSON。
@@ -224,15 +224,46 @@ yama --plugin-root ./dingding-simple
224
224
  | `-k, --filter PATTERN`(可重复) | Case 筛选:只保留 case key 匹配 PATTERN 的 Case(见下) |
225
225
  | `--result-dir PATH` | 覆盖产物根目录(默认每个 Case 写到其所属 `plugin_root/.yama/runs`) |
226
226
  | `--concurrency N` | 同时运行的 Case 数上限(必须 ≥ 1,默认 10);`1` 表示按收集顺序逐个执行 |
227
- | `--report [PATH]` | 额外写一份单文件 HTML 报告;省略路径时默认写到 `<第一个 result_root 的上级>/reports/latest.html` |
227
+ | `--report [PATH]` | 额外写一份单文件 HTML 报告;省略路径时写到 `<第一个 result_root 的上级>/reports/report-<时间戳>.html`(历史累积),并把同目录的 `latest.html` 维护成指向最新报告的软链;显式给 PATH 时精确写到该文件、不建软链 |
228
+ | `--preview` | 不运行任何 Case、不发起任何 LLM 调用:解析收集到的 Case 后输出**用例预览**。默认写一张与报告同风格的 HTML(`<第一个 result_root 的上级>/reports/preview.html`,`--report PATH` 可覆盖目标路径);与 `--json` 组合时改为向 stdout 打印逐 Case 的 JSON 预览数组(见第 13 节) |
228
229
  | `--list` | 只收集并打印 `case_key` 列表,不运行 |
229
230
  | `--no-artifacts` | 不写任何产物文件 |
230
- | `--json` | 以机器可读 JSON 数组打印结果(进度流转到 stderr,stdout 保持纯 JSON) |
231
+ | `--json` | 以机器可读 JSON 数组打印结果(进度流转到 stderr,stdout 保持纯 JSON);与 `--preview` 组合时打印的是预览 payload |
231
232
 
232
233
  `--plugin`/`--all-plugins`/`--plugin-root` 三者互斥,都不提供时默认用 cwd 向上搜索到的
233
234
  Workspace Root(或 cwd 本身)作为单一 Plugin Root——这正是 `cd dingding-simple && yama`
234
235
  可行的原因。
235
236
 
237
+ **`yama dashboard` 子命令(`cli.py:_run_dashboard` + `dashboard.py`)。** 主命令之外
238
+ 唯一的子命令(`main()` 在 argv 首位是 `dashboard` 时分发到独立的
239
+ `_dashboard_parser`),启动一个本地 HTTP 服务(标准库 `ThreadingHTTPServer`,
240
+ 无新增依赖):
241
+
242
+ ```bash
243
+ yama dashboard # 默认 http://127.0.0.1:8765/
244
+ yama dashboard --plugin dingding-simple --port 9000
245
+ ```
246
+
247
+ | 参数 | 含义 |
248
+ | --- | --- |
249
+ | `--plugin-root PATH` / `--plugin NAME`(可重复) / `--all-plugins` | 与主命令相同的 Plugin 选择语义(同一 `_resolve_targets`) |
250
+ | `-k, --filter PATTERN`(可重复) | 只把匹配的 Case 纳入 `/preview` 页面 |
251
+ | `--result-dir PATH` | 覆盖产物根目录;报告从其**同级** `reports/` 目录读取 |
252
+ | `--host` | 绑定地址,默认 `127.0.0.1` |
253
+ | `--port` | 端口,默认 `8765`;`0` 表示随机可用端口 |
254
+
255
+ 路由共三个(见第 13 节的页面内容说明):
256
+
257
+ - `/`:报告索引页,列出 reports 目录下的历史报告(时间倒序、标注 `latest`
258
+ 指向的那份、逐份展示通过状态 / Case 与 Run 通过数 / tokens——这些数据来自
259
+ 报告 HTML `<head>` 里内嵌的 meta JSON,见下);
260
+ - `/reports/<name>`:提供报告文件本身(含 `latest.html`;文件名做了路径穿越
261
+ 校验,符号链接解析后必须仍落在 reports 目录内);
262
+ - `/preview`:**每次请求都从头重新收集并解析** Case(`yama.toml` 与 YAML 的
263
+ 修改无需重启即可生效),渲染与 `--preview` 相同的用例预览页——这就是编写
264
+ Case 的人工预览回路:改 YAML → 刷新浏览器。收集/解析失败(YAML 损坏、
265
+ fixture 缺失等)时渲染成带完整错误信息的错误页(HTTP 500),服务本身不退出。
266
+
236
267
  **Case 筛选(`-k/--filter`,`workspace.py:matches_case_filter`)。** 收集阶段
237
268
  (`collect_case_paths`)在 glob/显式路径展开之后、YAML 解析之前,用 case key
238
269
  (`case_key_for_path`:Case 路径相对 Plugin Root 的 POSIX 形式,Plugin Root 之外
@@ -289,6 +320,22 @@ path = "dingding-simple"
289
320
  path = "another-plugin"
290
321
  ```
291
322
 
323
+ `repeat` 除了整数还接受**运行矩阵**(TOML 表数组):每个条目声明一份模型配置
324
+ (与解析后的 Case `model` 浅合并)和可选的重复次数 `times`(默认 1),同一个
325
+ Case 会依次用每份配置各跑 `times` 次,报告按条目的 `label`(默认取该条目的
326
+ 模型名)分组对比(完整语义见 8.5 节):
327
+
328
+ ```toml
329
+ [[defaults.execution.repeat]]
330
+ model = { name = "gpt-5" }
331
+ times = 2
332
+
333
+ [[defaults.execution.repeat]]
334
+ label = "sonnet"
335
+ model = { name = "anthropic/claude-sonnet-5" }
336
+ times = 2
337
+ ```
338
+
292
339
  Plugin 可以覆盖约定;`[plugins."<name>"]` 支持的扁平字段是 `path`(必填)、
293
340
  `system_prompt`、`skills_dir`、`skill_entry`、`case_patterns`、`model`(dict,覆盖
294
341
  `defaults.model`)、`execution`(dict,覆盖 `defaults.execution`):
@@ -1006,7 +1053,7 @@ transcript,不提供"只影响这一次请求"的临时选项,也不支持 `
1006
1053
 
1007
1054
  ## 8. Case Schema
1008
1055
 
1009
- Case Schema 按"模型与 Context → Tool 执行 → 对话 Step → Step 断言 → Case 结果门槛"的层级组织。Case 相对 Plugin Root 的文件路径就是唯一身份(`case_key`),不再重复声明 `id` 或 `tags`;可选的顶层 `description` 只是给人看的一句话说明(这个 Case 测试什么),不参与身份判定,会展示在 CLI 进度/汇总输出与 HTML 报告的 Case 头部(`loaders/case.py` 解析时校验必须是字符串并 strip 首尾空白)。
1056
+ Case Schema 按"模型与 Context → Tool 执行 → 对话 Step → Step 断言 → Case 结果门槛"的层级组织。Case 相对 Plugin Root 的文件路径就是唯一身份(`case_key`),不再重复声明 `id` 或 `tags`;可选的顶层 `description` 只是给人看的一句话说明(这个 Case 测试什么),不参与身份判定,会展示在 CLI 进度/汇总输出,并作为 HTML 报告 Case 头部的标题(没有 `description` 时标题回退为 `case_key`;文件路径始终显示在标题下方)(`loaders/case.py` 解析时校验必须是字符串并 strip 首尾空白)。
1010
1057
 
1011
1058
  ```text
1012
1059
  Case
@@ -1052,7 +1099,7 @@ Runner 把例如 `__evals__/cases/image-led-mv.yaml` 的相对路径规范化为
1052
1099
 
1053
1100
  ### 8.2 `model`:本 Case 的模型覆盖
1054
1101
 
1055
- `model` 描述当前 Case 使用的被测模型。未声明字段继承 Plugin / Workspace 默认值。框架通过 `litellm.acompletion()` 执行完整 History + Tool Loop,模型名使用 LiteLLM 的 `provider/model` 路由格式。
1102
+ `model` 描述当前 Case 使用的被测模型。未声明字段继承 Plugin / Workspace 默认值。框架通过 `litellm.acompletion()` 执行完整 History + Tool Loop,模型名使用 LiteLLM 的 `provider/model` 路由格式。调用前框架会设置 `litellm.suppress_debug_info = True`,屏蔽 litellm 解析不认识的厂商前缀时(如 OpenRouter 模型 `openrouter/moonshotai/...` 被内部去前缀后再解析)向终端打印的红色 `Provider List:` 噪音;真实错误仍正常抛出。
1056
1103
 
1057
1104
  ```yaml
1058
1105
  model:
@@ -1091,7 +1138,7 @@ model:
1091
1138
  name: anthropic/claude-sonnet-4-6
1092
1139
  ```
1093
1140
 
1094
- Provider 凭据由 LiteLLM 从其标准环境变量或运行环境读取,不属于 Message,也不写入 Case。Case 可用 `model.api_base` / `model.base_url` 覆盖地址(二选一,`llm.py:_litellm_call_arguments` 统一弹出并合并为 LiteLLM 的 `api_base` 实参)。
1141
+ Provider 凭据由 LiteLLM 从其标准环境变量或运行环境读取,不属于 Message,也不写入 Case。为方便本地配置,CLI 入口(`cli.py:main`)在解析参数前会通过 python-dotenv 加载 `.env` 文件:从当前工作目录向上查找最近的一个 `.env`(与 `yama.toml` 的查找方式一致),且不覆盖真实环境中已设置的变量(真实环境优先)。Case 可用 `model.api_base` / `model.base_url` 覆盖地址(二选一,`llm.py:_litellm_call_arguments` 统一弹出并合并为 LiteLLM 的 `api_base` 实参)。
1095
1142
 
1096
1143
  每个 request artifact 由 `runner.py:_run_step` 构造,把执行定位信息放在顶层,真实模型调用单独保存在 `invocation`(其中 `method`/`arguments` 来自 `LLMClient.last_request`):
1097
1144
 
@@ -1108,11 +1155,12 @@ Provider 凭据由 LiteLLM 从其标准环境变量或运行环境读取,不
1108
1155
  }
1109
1156
  },
1110
1157
  "resolved_provider": { "name": "openrouter", "model": "openrouter/anthropic/claude-sonnet-4.6" },
1111
- "response": { "role": "assistant", "content": "..." }
1158
+ "response": { "role": "assistant", "content": "..." },
1159
+ "duration_ms": 842.317
1112
1160
  }
1113
1161
  ```
1114
1162
 
1115
- `resolved_provider` 是原设计未提及的额外字段(来自 `LLMClient.last_provider`);请求失败时该记录会多一个 `"error": "<ExceptionType>: <message>"` 字段,而不是 `response`。报告中的 `LLM Request` 只渲染 `invocation.method` 和 `invocation.arguments`;`step_id`、`request_index`、`resolved_provider`、响应和错误均不伪装成模型调用参数。
1163
+ `resolved_provider` 是原设计未提及的额外字段(来自 `LLMClient.last_provider`);请求失败时该记录会多一个 `"error": "<ExceptionType>: <message>"` 字段,而不是 `response`。`duration_ms` 由 `runner.py:_run_step` 用 `time.perf_counter()` 环绕 `self.llm.complete` 调用测得(四舍五入到 3 位小数),记录这一轮从发起调用到拿到返回(或抛出异常)的耗时,成功、失败都会写入。执行时间线里每次 assistant 响应的摘要行、以及 run 底部 `LLM requests (N)` 里每条 Request 的摘要行,都会在 token 用量后追加这个耗时(`N ms`,`report.py:_duration_inline`)。时间线里嵌套的 `LLM request` 折叠卡仍然只渲染 `invocation.method` 和 `invocation.arguments`(响应已经在上方的 Assistant text content 里展示,不重复);run 底部 `LLM requests (N)` 列表里的每条 Request 除了同样的 Method / Arguments,还会追加一个 Response 区块——成功时是这一轮模型返回的完整 assistant message(含 `tool_calls`),失败时是报错文本(`report.py:_render_llm_response_details`)。`step_id`、`request_index`、`resolved_provider` 均不伪装成模型调用参数。
1116
1164
 
1117
1165
  Judge 使用的模型写在 `steps[].assert.judge.model` 或全局 Judge 配置中(省略时回退到当前 Case 的 `model`,见 12.2 节)。
1118
1166
 
@@ -1531,6 +1579,19 @@ execution:
1531
1579
  repeat: 3
1532
1580
  ```
1533
1581
 
1582
+ `repeat` 也可以写成**运行矩阵**,用不同模型配置执行同一 Case 并在报告中对比:
1583
+
1584
+ ```yaml
1585
+ execution:
1586
+ repeat:
1587
+ - model: { name: gpt-5 }
1588
+ times: 2 # 该配置跑几次,默认 1
1589
+ - label: sonnet # 报告/CLI 的分组标签,默认取模型名
1590
+ model: { name: anthropic/claude-sonnet-5 }
1591
+ times: 2
1592
+ - claude-haiku-4-5 # 字符串条目 ≡ {model: {name: ...}}
1593
+ ```
1594
+
1534
1595
  - `timeout_seconds_per_step`:单个 Step 的总时限,默认 **120**。通过
1535
1596
  `asyncio.wait_for` 真实生效(`runner.py:_run_once`),但需要注意:超时触发的是
1536
1597
  `asyncio.TimeoutError`,**没有**被单独捕获转换成"仅本 Step 失败、run 继续"——它
@@ -1542,6 +1603,24 @@ execution:
1542
1603
  超出时该 Step 会被标记为一条硬失败(`type: max_tool_rounds_exceeded`),
1543
1604
  Transcript 回滚到该 Step 开始前的状态,run 继续执行后续 Step(见第 10 节)。
1544
1605
  - `repeat`:同一 Case 重复运行次数,用于统计稳定通过率,默认 **1**,必须 ≥ 1;每次运行使用全新构造、独立深拷贝的 Mock Tool state(`MockToolRegistry` 每次重新实例化)。
1606
+ 也接受上面的运行矩阵列表(`runner.py:resolve_run_plan` 在 `run_case` 开头展开与校验,
1607
+ 校验失败与 `repeat < 1` 一样以 `ValueError` 走 CLI 的 Collection error 出口):
1608
+ - 条目字段只有 `model`(dict)、`times`(int ≥ 1,默认 1)、`label`(str);
1609
+ 字符串条目是 `{model: {name: <字符串>}}` 的简写;未知字段、空列表、非法
1610
+ `times` 都直接报错。
1611
+ - 条目 `model` 与 Case 解析后的 `model` **浅合并**(与 defaults → plugin →
1612
+ Case 的合并规则一致):未覆盖的键(如 `temperature`/`provider`/`api_base`)
1613
+ 原样继承,跨供应商切换时如需避免继承需在条目里显式覆盖。
1614
+ - `label` 缺省取合并后的模型名;label 是报告/CLI 的分组维度,条目之间必须
1615
+ 唯一(两个条目共用同一模型名时必须显式给 `label`),否则报错。
1616
+ - 总 run 数 = Σ times,`run_index` 跨条目连续递增;`passed`/`pass_rate`
1617
+ 语义不变(所有 run 都通过 Case 才算过)。每个 `RunResult` 记录本 run 的
1618
+ `label` 与生效 `model`(进 `result.json` 与 `--json` 输出)。
1619
+ - 变体模型只作用于被测 Agent 的 Tool Loop;**Judge 的 `default_model`
1620
+ 固定为 Case 级 `model`**(`judge.model` 仍可显式覆盖),保证不同变体的
1621
+ 评分口径一致、可对比。
1622
+ - `repeat` 在 defaults / plugin / Case 三层间按整值替换(`dict.update`),
1623
+ 不做逐条目合并:Case 写 `repeat: 3` 会整体覆盖全局矩阵,反之亦然。
1545
1624
 
1546
1625
  ### 8.6 `steps[]`:确定性推进的用户回合
1547
1626
 
@@ -1583,7 +1662,7 @@ steps:
1583
1662
  - Part 顺序原样保留并写入 resolved Case。
1584
1663
  - `filename` 和 `media_type` 可显式覆盖;未写时从 fixture 推导。
1585
1664
  - `input_image.delivery` 与 `input_file.delivery` 支持 `file_path_inline` 和 `file_content`,均默认为 `file_path_inline`。
1586
- - `file_path_inline` 不上传附件内容,而是把当前 User Message 中所有采用该方式的附件绝对路径追加到同一条 text content:`<text content>\nFiles:\n- <file_path_1>\n- <file_path_2>`。这适合"模型选择工具、专用工具读取图片、音频或视频内容"的生产契约。
1665
+ - `file_path_inline` 不上传附件内容,而是把当前 User Message 中所有采用该方式的附件绝对路径追加到同一条 text content:`<text content>\nFiles:\n- <file_path_1>\n- <file_path_2>`(消息没有 text part 时,`Files:` 块在第一个该方式附件的位置自成一条 text part)。这适合"模型选择工具、专用工具读取图片、音频或视频内容"的生产契约。这层合并抽在 `llm.delivered_content`(合并后 path-inline 附件 part 即被丢弃——交付的只有路径):`_litellm_content` 基于它产出 provider payload,预览页复用同一函数渲染 user/注入/history 消息,保证预览展示的内容与模型实际收到的一致。
1587
1666
  - `file_content` 在调用前转换为 LiteLLM Chat Completion 的 `image_url` 或 `file` part,由 LiteLLM 再适配目标 Provider。
1588
1667
  - 旧值 `metadata` 与 `content` 仍分别兼容并规范化为 `file_path_inline` 与 `file_content`(这层归一化在 `loaders/case.py` 与 `llm.py` 中各自实现了一份,两处逻辑一致但确实有重复)。
1589
1668
  - 每个 fixture 记录物化解析后的绝对路径(`fixture`)、字节数(`bytes`)、media type 与 SHA-256(`sha256`),使报告可重放;不单独保留"原始相对路径"字段。
@@ -1624,23 +1703,33 @@ assert:
1624
1703
 
1625
1704
  断言默认只作用于当前 Step;需要检查最终跨 Step 状态时,使用 Python Checker 或 `outcome` 中的 Case 级要求。`assistant_semantic_count` 的实际语义见 12.1 节——它并非真正的语义理解,而是大小写不敏感的字面子串计数,命名有历史包袱。
1626
1705
 
1706
+ `assert.hard` 每条断言还可以带一个可选的 `tag` 平级字段(断言类型 key 之外的
1707
+ 另一个 key,同一条断言最多一个 tag),用于在 8.8 节的 `outcome.require.tags`
1708
+ 里按 tag 设置不同的通过率容忍度;不打 tag 的断言默认归入 `must_pass`。允许的 tag
1709
+ 固定为 `must_pass` / `high_confidence` / `tolerant` / `informational` 四种,写其它
1710
+ 值会在运行时报 `AssertionConfigurationError`。
1711
+
1627
1712
  ### 8.8 `outcome`:整个 Case 的最终门槛
1628
1713
 
1629
1714
  ```yaml
1630
1715
  outcome:
1631
1716
  require:
1632
- hard_checks: all_pass
1717
+ tags:
1718
+ high_confidence: 0.9
1719
+ tolerant: 0.8
1720
+ informational: 0.0
1633
1721
  judge:
1634
1722
  overall_gte: 0.8
1635
1723
  each_dimension_gte: 0.6
1636
1724
  ```
1637
1725
 
1638
- "所有 Step 必须 `hard_pass`"这条门槛在 `runner.py:_case_passed` 中是**硬编码行为**
1639
- (`if not all(step.hard_pass for step in steps): return False`),代码里**没有**
1640
- 一个真正读取 `hard_checks: all_pass` 这个具体配置键的地方——写不写它、写成什么值都
1641
- 不影响实际判定,这条门槛始终生效且不可关闭。`judge.overall_gte`/
1642
- `judge.each_dimension_gte` 则是真实读取的配置键(见 12.3 节)。Judge 门槛只决定
1643
- 质量是否达标,不会把协议错误变成通过。
1726
+ 判定逻辑由 `runner.py` 里的共享函数 `tag_pass_summary(steps, outcome)` 计算:按每条
1727
+ hard check 的固定 tag 分组(未打 tag 的默认归入 `must_pass`),每组算
1728
+ `rate = passed / total`,阈值取 `outcome.require.tags` 里对应 tag 的配置值或固定默认
1729
+ 值。默认阈值为:`must_pass: 1.0`(固定,不可降低)、`high_confidence: 0.9`、
1730
+ `tolerant: 0.8`、`informational: 0.0`。这就是"所有未标注断言都必须通过"这条旧规则
1731
+ 的等价表述(详见 12.3 节)。`judge.overall_gte`/`judge.each_dimension_gte` 仍是真实
1732
+ 读取的配置键。Judge 门槛只决定质量是否达标,不会把协议错误变成通过。
1644
1733
 
1645
1734
  ### 8.9 完整示例:用人物图片与歌曲规划 MV 风格
1646
1735
 
@@ -1713,7 +1802,6 @@ steps:
1713
1802
 
1714
1803
  outcome:
1715
1804
  require:
1716
- hard_checks: all_pass
1717
1805
  judge: { overall_gte: 0.8 }
1718
1806
  ```
1719
1807
 
@@ -2255,7 +2343,7 @@ class ToolCallRecord:
2255
2343
  ├── mock-state.json
2256
2344
  ├── hard-checks.json # {step_id: hard_checks}
2257
2345
  ├── judge-result.json # {step_id: judge_result}(只含有 Judge 结果的 Step;含 Judge 调用的 usage)
2258
- └── result.json # RunResult.to_dict()(含 run 级 usage 汇总)+ generated_at + traceback?
2346
+ └── result.json # RunResult.to_dict()(含 run 级 usage 汇总、本 run 的 label 与生效 model)+ generated_at + traceback?
2259
2347
  ```
2260
2348
 
2261
2349
  写产物前,`YamaRunner.run_case` 会先整体删除该 Case 的产物目录
@@ -2265,9 +2353,11 @@ class ToolCallRecord:
2265
2353
  扫描 `.yama/runs` 时会把旧执行误当成本次结果。`--no-artifacts` 时不写也不删任何
2266
2354
  产物目录(用户显式选择不落盘,不应顺带删掉历史产物),但 fs-runs 工作目录照常清理。
2267
2355
 
2268
- `--report` 触发的单文件 HTML 报告(`report.py:write_html_report`)是 CLI 层面单独
2269
- 生成的汇总产物,**不属于**上面这份逐 Case/逐 run 的产物列表,也不是按 Plugin 拆分的
2270
- 多个文件——一次 CLI 调用只写一个 HTML 文件,汇总本次涉及的所有 Case(见第 13 节)。
2356
+ `--report` 触发的单文件 HTML 报告(`report.py:write_html_report` /
2357
+ `write_timestamped_report`)是 CLI 层面单独生成的汇总产物,**不属于**上面这份逐
2358
+ Case/逐 run 的产物列表,也不是按 Plugin 拆分的多个文件——一次 CLI 调用只写一个
2359
+ HTML 文件,汇总本次涉及的所有 Case;默认位置下按时间戳累积历史、不参与
2360
+ `_clean_case_dirs` 的清理(见第 13 节)。
2271
2361
 
2272
2362
  ## 12. 断言与评分
2273
2363
 
@@ -2453,16 +2543,27 @@ Judge 实际返回的结构化结果(`run_judge` 在 Judge LLM 的原始输出
2453
2543
  ```yaml
2454
2544
  outcome:
2455
2545
  require:
2456
- hard_checks: all_pass
2546
+ tags:
2547
+ high_confidence: 0.9
2548
+ tolerant: 0.8
2549
+ informational: 0.0
2457
2550
  judge:
2458
2551
  overall_gte: 0.8
2459
2552
  each_dimension_gte: 0.6
2460
2553
  ```
2461
2554
 
2462
2555
  `judge.overall_gte`/`judge.each_dimension_gte` 是真实生效的配置键(对所有跑过 Judge
2463
- 的 Step 的 `overall`/各维度分别取阈值);`hard_checks: all_pass` 描述的行为
2464
- (所有 Step 必须 `hard_pass`)是硬编码在 `runner.py:_case_passed` 里的、不可关闭的
2465
- 门槛,这个具体的配置键本身并不被代码读取(写不写、写成什么值都不影响结果)。
2556
+ 的 Step 的 `overall`/各维度分别取阈值)。`outcome.require.tags` 按固定 tag 设置
2557
+ hard check 的通过率阈值(`[0, 1]` 区间的数字):`runner.py:tag_pass_summary`
2558
+ 按这次 run 里每条 hard check 的 tag 分组,算出 `rate = passed / total`,与该 tag
2559
+ 的阈值比较。允许的 tag 固定为 `must_pass` / `high_confidence` / `tolerant` /
2560
+ `informational` 四种;断言未写 tag 时归入 `must_pass`。默认阈值分别是
2561
+ `1.0` / `0.9` / `0.8` / `0.0`,其中 `must_pass` 固定为 `1.0` 不可降低。完全不使用
2562
+ 这个字段的 Case 行为不变:所有断言都落进 `must_pass`,等价于旧版"所有 Step 必须
2563
+ hard_pass"这条规则。未知 tag/key、阈值不是 `[0, 1]` 区间内的数字、或试图降低
2564
+ `must_pass`,都会在运行时抛 `AssertionConfigurationError`,体现为这次 run 的
2565
+ `error`。`_case_passed` 的判定顺序是:先看 `tag_pass_summary` 的每个分组是否都
2566
+ `ok`,任一不 `ok` 直接判失败;再走 Judge 门槛。
2466
2567
 
2467
2568
  实际的最终结果结构是 `CaseResult`(`runner.py`),**不存在**原设计设想的
2468
2569
  `{"passed", "hard_pass", "judge_pass", "quality_score", "reason"}` 这种顶层扁平
@@ -2475,6 +2576,9 @@ outcome:
2475
2576
  "passed": true,
2476
2577
  "pass_rate": 1.0,
2477
2578
  "usage": { "prompt_tokens": 2000, "completion_tokens": 460, "total_tokens": 2460 },
2579
+ "tag_summary": {
2580
+ "must_pass": { "passed": 4, "total": 4, "rate": 1.0, "threshold": 1.0, "ok": true }
2581
+ },
2478
2582
  "runs": [
2479
2583
  {
2480
2584
  "run_index": 1,
@@ -2485,7 +2589,10 @@ outcome:
2485
2589
  "mock_events": [ "..." ],
2486
2590
  "mock_state": { "...": "..." },
2487
2591
  "requests": [ "..." ],
2488
- "artifact_dir": ".yama/runs/.../run-001"
2592
+ "artifact_dir": ".yama/runs/.../run-001",
2593
+ "tag_summary": {
2594
+ "must_pass": { "passed": 4, "total": 4, "rate": 1.0, "threshold": 1.0, "ok": true }
2595
+ }
2489
2596
  }
2490
2597
  ]
2491
2598
  }
@@ -2493,8 +2600,8 @@ outcome:
2493
2600
 
2494
2601
  (Case/run 级的 `usage` 是第 11 节所述的聚合结果;无任何用量数据时为 `null`。)
2495
2602
 
2496
- 质量分不能抵消硬检查失败:`_case_passed` 先判空 `all(step.hard_pass for step in
2497
- steps)`,任一为 `False` 就直接返回 `False`,Judge 相关逻辑不会再被求值。
2603
+ 质量分不能抵消硬检查失败:`_case_passed` 先算 `tag_pass_summary`(见 12.3 节),
2604
+ 任一分组不达标就直接返回 `False`,Judge 相关逻辑不会再被求值。
2498
2605
 
2499
2606
  ## 13. 多 Plugin 隔离与报告
2500
2607
 
@@ -2531,11 +2638,114 @@ Step——不是按 Plugin 拆开的多个文件,也没有 JSON 版的 `summar
2531
2638
  用量(第 11 节的聚合链)在报告的每一层都有展示:顶部摘要多一张「LLM tokens」
2532
2639
  卡片(总量 + in/out 拆分),Case 头部 metadata 多一格逐 Case 汇总,Run/Step 的
2533
2640
  summary 行、执行时间线里的每次 assistant 响应、LLM requests 诊断列表和 Judge
2534
- 小节各自带本层级的 token 数;没有用量数据的层级显示 `–` 或不显示:
2641
+ 小节各自带本层级的 token 数;没有用量数据的层级显示 `–` 或不显示。Case 头部还会
2642
+ 展示 **Case tag summary**:如果只跑一次,它等于唯一 run 的 tag 结果;如果跑多次,
2643
+ 按同名 tag 汇总所有 run 的 `passed/total` 后重新计算整体 `rate` 和 `ok`。每个 run
2644
+ 明细内部仍保留 **Pass rate by tag** 折叠表,展示该 run 自己的 tag 通过率。
2645
+
2646
+ 跑了多个 run 的 Case(`len(runs) > 1`)在 metadata 与 Planned runs 折叠卡之间
2647
+ 多一节 **Run comparison**(`report.py:_render_run_comparison`):
2648
+
2649
+ - 每个 run 一行对比(结果、Steps 通过数、hard check 通过数、Judge overall
2650
+ 均值、tokens);run 因异常中断时在 Steps 列标注 `(run error)`。
2651
+ - **唯一最优的 run 标一枚冠军奖杯 🏆**(`_champion_run_index`)。排序依据依次
2652
+ 为:是否通过 → Steps 通过数 → hard check 通过数 → Judge overall(无 Judge
2653
+ 结果排最后)→ token 消耗(更少者优,无用量数据排最后)。最优 run 在所有
2654
+ 维度上与他人打平时不发奖杯(含糊的冠军不如没有)。
2655
+ - `execution.repeat` 声明了模型变体时,按每个变体的 run 数分两种形态:
2656
+ - **每个变体恰好跑一次**(运行矩阵的常见用法):只渲染**一张合并表**
2657
+ (`_render_merged_variant_comparison`),每个变体一行,直接携带其唯一
2658
+ run 的明细列(Steps、hard checks、Judge、tokens)——不再额外渲染逐 run
2659
+ 表,也没有"通过 run 数 / 通过率"这类对单次运行冗余的聚合列。
2660
+ - **任一变体跑了多次**:先渲染按 label 分组的变体聚合表(变体、通过 run
2661
+ 数、通过率、Judge overall 均值、tokens),再渲染逐 run 表(多一列
2662
+ Variant),奖杯标在逐 run 表的最优 run 上。
2663
+ - 两种形态都**没有独立的 Model 列**:label 默认就是模型名,仅当 label 与
2664
+ 实际模型名不同时才在 label 下方以浅色附注显示模型名
2665
+ (`_variant_name_cell`)。Run summary 行仍带 label 徽标,Case metadata
2666
+ 的 Model 格显示各 run 实际使用的模型集合(无变体时保持原样:单模型名、
2667
+ 无 Variant 列、无聚合表)。
2668
+ - Judge overall 均值只对有 Judge 结果的 run 计算,没有任何 Judge 结果时显示
2669
+ `–`(不能把"无数据"渲染成 0%)。
2670
+
2671
+ `--report` 省略路径时报告写到默认位置(`report.py:write_timestamped_report`):
2535
2672
 
2536
2673
  ```text
2537
- <result_root 的上级>/reports/latest.html # --report 省略路径时的默认位置
2538
- ```
2674
+ <result_root 的上级>/reports/report-<YYYYMMDD-HHMMSS>.html # 每次执行新增一份,历史累积
2675
+ <result_root 的上级>/reports/latest.html # 指向最新一份的软链
2676
+ ```
2677
+
2678
+ - 同一秒内的第二次写入追加 `-2`、`-3` 序号后缀,绝不覆盖已有历史。
2679
+ - `latest.html` 每次重指向最新文件(相对路径软链,目录整体移动仍有效);平台
2680
+ 不支持软链(如无权限的 Windows)时退化为复制一份文件内容。
2681
+ - 显式 `--report PATH` 保持旧语义:精确写到该文件,不加时间戳、不动 `latest.html`。
2682
+
2683
+ 报告 `<head>` 里内嵌一段惰性的 meta JSON(`render_page` 的 `meta` 参数,
2684
+ `<script type="application/json" id="yama-report-meta">`),携带 `kind`/
2685
+ `generated_at`/`passed`/Case-Run-check 通过数/总 tokens——dashboard 索引页靠它
2686
+ 列出每份历史报告的统计,而不必解析报告正文标记。
2687
+
2688
+ **用例预览页(`preview.py`,`--preview` 与 dashboard `/preview` 共用)。**
2689
+ `render_preview_html` 复用报告的页面外壳与版式(`report.py:render_page` +
2690
+ `_PAGE_CSS`),渲染"这个 Case 将发送什么、期望什么",但不含任何执行数据——
2691
+ verdict 图章一律是中性的 `PREVIEW`(没有 PASS/FAIL),对话里的 assistant 位置
2692
+ 是一张虚线占位卡("Not executed yet",工具调用与 mock 结果同样缺席)。
2693
+
2694
+ 每个 Case 是一个**默认折叠**的 `<details class="case">`,收起时只显示 Case 头
2695
+ (description 标题 + 文件路径 + PREVIEW 图章 + Step 数);展开后 Case 内所有
2696
+ 可折叠 section 使用**同一种折叠卡样式**(`report.py:_fold` 生成的
2697
+ `details.fold`:与报告 Run/Step 摘要条同款的标题条 + 右侧 meta,嵌套的二级、
2698
+ 三级折叠卡持续同款;报告侧的 Execution timeline / Planned runs,以及
2699
+ Step 内的 Resolved transcript 和 run 底部的 `LLM requests (N)` / `Mock events
2700
+ (N)` / `Final mock state` 也都渲染成同一种折叠卡——`LLM requests (N)` 等计数
2701
+ 保留在标题文本里,是外部工具按字面切分的稳定标记——保证两页公共部分一致)。
2702
+ 展开后的内容顺序:
2703
+
2704
+ - metadata 格(Model / Tools / Skills / **Planned runs**——用
2705
+ `resolve_run_plan` 展开 `execution.repeat` 后的 run 数与变体 label 摘要;
2706
+ repeat 配置非法时这里直接显示错误,这是收集期不校验 repeat 的第一道可见
2707
+ 反馈);
2708
+ - **Planned runs** 折叠卡(`report.py:_render_planned_runs`,与报告共用——
2709
+ 报告侧放在 Run comparison 之后、runs 之前):`resolve_run_plan` 展开后的
2710
+ 逐 run 计划表。运行矩阵显示 Variant 列,单元格与 Run comparison 表同款
2711
+ (label 加粗,模型名仅在与 label 不同时以浅色附注出现,
2712
+ `_variant_name_cell` 共用);普通整数 repeat 则显示 Model 列。
2713
+ execution/model JSON 收在嵌套的 raw disclosure(Execution & model
2714
+ config)里;repeat 非法时表格位置显示错误全文。没有单独的
2715
+ fixtures/System prompt 展示——fixture 细节看 `--json` payload 的
2716
+ `fixtures` 与各消息的附件卡片,System Prompt 在下方 Conversation
2717
+ history(报告侧在执行时间线首条消息);
2718
+ - **Conversation history**(默认展开):第一条事件即渲染后的 System Prompt,
2719
+ 其后是 `context.messages` 注入的初始对话;
2720
+ - 每个 Step 一张折叠卡(默认展开),摘要为 **`Step N` 前缀 + step id 徽标**
2721
+ (报告的 Step 摘要同样是 `Step N` + id 徽标,两页一致);卡内是同款二级
2722
+ 折叠卡:**Planned conversation**(`message_inject` 按 position 就位、user
2723
+ 消息、assistant 占位卡)、**Hard checks (configured)** 表(逐条断言类型 +
2724
+ 配置 JSON)、**Judge (configured)**(维度卡片:name/criteria/min_score/
2725
+ weight,其余 judge 设置是嵌套的 Judge settings 折叠卡)、Raw step config;
2726
+ - 预览页渲染的 user / 注入 / history 消息一律先过 `llm.delivered_content`,
2727
+ 只显示模型真实收到的内容:`file_path_inline` 附件的绝对路径以 `Files:` 块
2728
+ 合并进 text part(与模型实际收到的文本一字不差),该附件不再单独渲染
2729
+ 卡片;`file_content` 附件内容真的会上传,保留附件卡片并带
2730
+ `file content — uploaded as base64 content` 标注
2731
+ (`report.py:_render_content` 对带 `delivery` 字段的 part 通用);
2732
+ - Mock configuration(`mocks` 全文 JSON,标题列出 mock 的 tool 名)、
2733
+ Available tools(与报告相同的 schema 卡片网格,`_tool_defs` 共用)、
2734
+ Outcome requirements——均为同款折叠卡,默认收起。
2735
+
2736
+ `--preview --json` 打印的预览 payload(`preview.py:preview_payload`)是逐 Case 的
2737
+ JSON 对象数组:`case_key`/`description`/`path`/`plugin_root`/`evals_root`/
2738
+ `model`/`execution`/`run_plan`(展开后的计划 run 列表,非法 repeat 时为
2739
+ `{"error": ...}`)/`context`/`mocks`/`steps`(解析后的 Step,含 fixture 展开)/
2740
+ `outcome`/`system_prompt`(渲染后的最终文本)/`skills`/`tools`(provider 形态
2741
+ schema)/`initial_messages`/`fixtures`。
2742
+
2743
+ **dashboard 页面(`dashboard.py`)。** 索引页 `/` 复用同一页面外壳:顶部摘要卡
2744
+ (报告数、最新 verdict、最新生成时间、`/preview` 入口),下方是历史报告表
2745
+ (`scan_reports`:时间倒序;`latest.html` 与 `preview.html` 本身是别名/静态快照、
2746
+ 不作为历史列出;`latest` 指向的那份带徽标;meta 缺失的旧文件各统计列显示 `–`)。
2747
+ `/preview` 页的页眉标注 "refresh to re-resolve"(区别于 `--preview` 写盘的
2748
+ static snapshot 措辞)。
2539
2749
 
2540
2750
  终端输出(不用 `--json` 时)在执行过程中**实时流式打印进度**,形态取决于并发模式
2541
2751
  (见 4.3 节的 `--concurrency`);两种模式最后都以逐 Case 的汇总表格收尾。
@@ -2591,8 +2801,11 @@ Yama Eval Results
2591
2801
 
2592
2802
  流式进度由 `YamaRunner` 的进度回调驱动(`runner.py:RunnerEventCallback`,
2593
2803
  构造参数 `on_event`)。每个 Case 的事件顺序固定为:`case_start`
2594
- `{case_key, description, repeat}` → 每个 run:`run_start` `{case_key, run_index,
2595
- repeat}` → 每个 Step:`step_start` `{case_key, run_index, step_id}`、`step_end`
2804
+ `{case_key, description, repeat}`(`repeat` 是展开后的**总 run 数**,运行矩阵下
2805
+ = Σ times)→ 每个 run:`run_start` `{case_key, run_index, repeat, label}`
2806
+ (`label` 是该 run 的变体标签,整数 `repeat` 时为 None;CLI 的顺序模式
2807
+ `Run i/N` 行、并发面板行与 `build_case_tree` 的 Run 节点都会把非空 label 显示为
2808
+ `Run i/N · <label>`)→ 每个 Step:`step_start` `{case_key, run_index, step_id}`、`step_end`
2596
2809
  `{case_key, run_index, step: StepResult}` → `run_end` `{case_key, run:
2597
2810
  RunResult}` → `case_end` `{result: CaseResult}`。`step_end` 在该 Step 的 hard
2598
2811
  check 与 Judge 都结算完之后才触发(含 max-tool-rounds 失败的 Step),payload
@@ -2627,7 +2840,32 @@ CLI 侧按并发模式挑选回调实现,两者的**已完成结果**都只做
2627
2840
 
2628
2841
  `--json` 输出机器可读的 `[CaseResult.to_dict(), ...]` 数组(此时进度流打印到
2629
2842
  stderr,保证 stdout 是纯 JSON);`--list` 只打印 `case_key` 列表,不运行任何
2630
- Case。
2843
+ Case;`--preview` 在收集/解析之后、执行之前返回(LLM client 根本不会被构造),
2844
+ `--list` 与 `--preview` 同时给出时 `--list` 优先。
2845
+
2846
+ `yama from-thread` 是 `cli.py:main` 里的独立子命令分支(和 `dashboard` 一样在主 parser
2847
+ 之前按 `argv[:1]` 分发),用于把后台某条模型调用记录转换为 Case YAML 起点。它从选中
2848
+ record 的 request 生成 `context.skills`/`context.tools`/`context.messages`;传入
2849
+ `--commit-id` 时通过 SSH `git show <commit>:dsl.json` 取得 DSL 并写入
2850
+ `mocks.state.dsl`。当 DSL workflow 和 request history 足够完整时,还会自动生成一条
2851
+ `steps[]`:
2852
+
2853
+ - 当前 step id 来自 `dsl.workflow.steps`,优先第一条 `status == "in_progress"`,否则取
2854
+ 第一条非 `completed`/`skipped`;若全部完成/跳过、没有 DSL、或步骤缺少 id,则不填充
2855
+ step。
2856
+ - 最近一条非纯 `<system-reminder>...</system-reminder>` 的用户消息成为
2857
+ `steps[0].user`,`context.messages` 截断到这条消息之前,避免运行 Case 时重复发送同一
2858
+ 用户回合。
2859
+ - 如果该用户消息下一条就是纯 `<system-reminder>` 用户消息,则写入
2860
+ `steps[0].message_inject`,`position: after_user_message`。
2861
+ - 从该用户消息之后的 assistant tool calls 和选中 record 的 response message 中收集
2862
+ Tool 名,按首次出现顺序聚合调用次数,生成带 `times: <count>` 和 `tag: must_pass`
2863
+ 的 `tool_called` hard checks。
2864
+
2865
+ 自动 step 只表达“复现这一轮输入并期待相同 Tool 类型被调用”。它不生成 `mocks.tools`、
2866
+ 更精细的参数断言或 Judge;这些仍由 Case 作者按评测目标补齐。生成的 Case 会固定写入
2867
+ `outcome.require.hard_checks: all_pass`。若无法推导当前 workflow step 或真实用户输入,
2868
+ 则保留 `steps: []`,stdout 仍只输出 YAML,stderr 只输出 record/response/DSL 抓取诊断信息。
2631
2869
 
2632
2870
  `cli.py:main` 的错误出口按层归类(退出码都是 2):`ConfigurationError`/
2633
2871
  `CollectionError`/`ValueError` 打印 `Collection error: ...`(Case 还没跑起来,
@@ -2715,8 +2953,9 @@ Case。
2715
2953
  的 `.j2` 渲染模板——当前渲染是硬编码 Python 字符串拼接,`jinja2` 依赖未被使用。
2716
2954
  - **Tool Call 录制/回放**:把真实 Tool 调用录制下来供之后回放——当前只有
2717
2955
  `ScriptedLLMClient` 能回放 **LLM 响应**,没有对应的 Tool Call 录制/回放机制。
2718
- - **参数矩阵**:对同一 Case 用多组参数矩阵批量展开执行——当前 `execution.repeat`
2719
- 只是一个单纯的重复次数整数,不是参数矩阵。
2956
+ - **参数矩阵**:**模型维度已实现**——`execution.repeat` 接受运行矩阵列表,同一
2957
+ Case 用多份模型配置展开执行并在报告中分组对比(见 8.5 节);但矩阵维度仅限
2958
+ `model`,没有对 Step 输入、Mock 配置等任意参数做笛卡尔展开的通用参数矩阵。
2720
2959
  - **HTML Transcript Viewer 的进一步能力**、**人工评分与 Judge 校准**、**远程
2721
2960
  执行**:`report.py` 目前只产出一个静态汇总 HTML,没有专门的单 Case 交互式
2722
2961
  Transcript Viewer;Case 级的本地并发调度已实现(CLI `--concurrency`,默认 10,
@@ -2737,7 +2976,8 @@ Case。
2737
2976
  (`steps[].message_inject`,4 个插入位置 + Tool Call matcher,collection 期
2738
2977
  严格校验,见 7.6 节)。
2739
2978
  - 纯文本与多模态 Message Part、fixture manifest。
2740
- - 9 种硬检查、多维 LLM Judge、`execution.repeat` 稳定通过率统计。
2979
+ - 9 种硬检查、多维 LLM Judge、`execution.repeat` 稳定通过率统计(含多模型
2980
+ 运行矩阵与报告中的分组对比)。
2741
2981
  - JSON 产物(逐 Case/逐 run)与单文件 HTML 汇总报告。
2742
2982
  - LLM token 用量统计:逐请求采集、run/Case 级聚合、CLI 与 HTML 报告展示
2743
2983
  (见第 11 节与第 13 节)。