niceeval 0.13.0 → 0.13.2-canary.35

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 (172) hide show
  1. package/INDEX.md +1 -0
  2. package/README.md +9 -10
  3. package/README.zh.md +9 -10
  4. package/dist/agents/ai-sdk.cjs.map +1 -1
  5. package/dist/agents/ai-sdk.d.cts +1 -1
  6. package/dist/agents/ai-sdk.d.mts +1 -1
  7. package/dist/agents/ai-sdk.d.ts +1 -1
  8. package/dist/agents/coding-cli-versions.cjs +10 -1
  9. package/dist/agents/coding-cli-versions.cjs.map +1 -1
  10. package/dist/agents/coding-cli-versions.d.cts +8 -3
  11. package/dist/agents/coding-cli-versions.d.mts +8 -3
  12. package/dist/agents/coding-cli-versions.d.ts +8 -3
  13. package/dist/agents/coding-cli-versions.js +18 -12
  14. package/dist/agents/deepseek-harness.cjs +103 -0
  15. package/dist/agents/deepseek-harness.cjs.map +1 -0
  16. package/dist/agents/deepseek-harness.d.cts +12 -0
  17. package/dist/agents/deepseek-harness.d.mts +12 -0
  18. package/dist/agents/deepseek-harness.d.ts +12 -0
  19. package/dist/agents/deepseek-harness.js +7 -0
  20. package/dist/agents/deepseek-harness.js.map +1 -0
  21. package/dist/agents/index.cjs +5 -1
  22. package/dist/agents/index.cjs.map +1 -1
  23. package/dist/agents/index.d.cts +4 -0
  24. package/dist/agents/index.d.mts +4 -0
  25. package/dist/agents/index.d.ts +4 -0
  26. package/dist/agents/index.js +54 -50
  27. package/dist/agents/index.mjs +54 -50
  28. package/dist/agents/omp.cjs +170 -0
  29. package/dist/agents/omp.cjs.map +1 -0
  30. package/dist/agents/omp.d.cts +14 -0
  31. package/dist/agents/omp.d.mts +14 -0
  32. package/dist/agents/omp.d.ts +14 -0
  33. package/dist/agents/omp.js +7 -0
  34. package/dist/agents/omp.js.map +1 -0
  35. package/dist/agents/types.cjs.map +1 -1
  36. package/dist/agents/types.d.cts +2 -2
  37. package/dist/agents/types.d.mts +2 -2
  38. package/dist/agents/types.d.ts +2 -2
  39. package/dist/analysis/api.cjs +9 -1
  40. package/dist/analysis/api.cjs.map +1 -1
  41. package/dist/analysis/api.d.cts +21 -0
  42. package/dist/analysis/api.d.mts +21 -0
  43. package/dist/analysis/api.d.ts +21 -0
  44. package/dist/analysis/api.js +8 -6
  45. package/dist/cli.cjs +10 -1
  46. package/dist/cli.cjs.map +1 -1
  47. package/dist/i18n/en.cjs +7 -2
  48. package/dist/i18n/en.cjs.map +1 -1
  49. package/dist/i18n/en.d.cts +7 -2
  50. package/dist/i18n/en.d.mts +7 -2
  51. package/dist/i18n/en.d.ts +7 -2
  52. package/dist/o11y/parsers/hermes.cjs +1 -1
  53. package/dist/o11y/parsers/hermes.cjs.map +1 -1
  54. package/dist/report/built-in/analysis-values.cjs +21 -5
  55. package/dist/report/built-in/analysis-values.cjs.map +1 -1
  56. package/dist/report/built-in/analysis-values.d.cts +11 -9
  57. package/dist/report/built-in/analysis-values.d.mts +11 -9
  58. package/dist/report/built-in/analysis-values.d.ts +11 -9
  59. package/dist/report/built-in/overview.cjs +1 -0
  60. package/dist/report/built-in/overview.cjs.map +1 -1
  61. package/dist/report/built-in/result-components.cjs +58 -12
  62. package/dist/report/built-in/result-components.cjs.map +1 -1
  63. package/dist/report/built-in/result-components.d.cts +15 -0
  64. package/dist/report/built-in/result-components.d.mts +15 -0
  65. package/dist/report/built-in/result-components.d.ts +15 -0
  66. package/dist/report/built-in/run-membership-overview.cjs +100 -4
  67. package/dist/report/built-in/run-membership-overview.cjs.map +1 -1
  68. package/dist/report/built-in/standard.cjs +1 -0
  69. package/dist/report/built-in/standard.cjs.map +1 -1
  70. package/dist/report/built-in/standard.d.cts +1 -0
  71. package/dist/report/built-in/standard.d.mts +1 -0
  72. package/dist/report/built-in/standard.d.ts +1 -0
  73. package/dist/report/components/entity-lists/compute.cjs +40 -3
  74. package/dist/report/components/entity-lists/compute.cjs.map +1 -1
  75. package/dist/report/components/entity-lists/compute.d.cts +8 -6
  76. package/dist/report/components/entity-lists/compute.d.mts +8 -6
  77. package/dist/report/components/entity-lists/compute.d.ts +8 -6
  78. package/dist/report/components/entity-lists/content.cjs +31 -6
  79. package/dist/report/components/entity-lists/content.cjs.map +1 -1
  80. package/dist/report/components/entity-lists/index.cjs +3 -2
  81. package/dist/report/components/entity-lists/index.cjs.map +1 -1
  82. package/dist/report/components/entity-lists/index.d.cts +1 -1
  83. package/dist/report/components/entity-lists/index.d.mts +1 -1
  84. package/dist/report/components/entity-lists/index.d.ts +1 -1
  85. package/dist/report/definition/cell.cjs +3 -0
  86. package/dist/report/definition/cell.cjs.map +1 -1
  87. package/dist/report/definition/cell.d.cts +2 -0
  88. package/dist/report/definition/cell.d.mts +2 -0
  89. package/dist/report/definition/cell.d.ts +2 -0
  90. package/dist/report/definition/primitives.cjs +9 -2
  91. package/dist/report/definition/primitives.cjs.map +1 -1
  92. package/dist/report/execution/machine.cjs +1 -1
  93. package/dist/report/execution/machine.cjs.map +1 -1
  94. package/dist/report/host/execute.cjs +14 -4
  95. package/dist/report/host/execute.cjs.map +1 -1
  96. package/dist/report/host/execute.d.cts +5 -0
  97. package/dist/report/host/execute.d.mts +5 -0
  98. package/dist/report/host/execute.d.ts +5 -0
  99. package/dist/report/host/from-record.cjs +6 -1
  100. package/dist/report/host/from-record.cjs.map +1 -1
  101. package/dist/report/host/from-record.d.cts +5 -0
  102. package/dist/report/host/from-record.d.mts +5 -0
  103. package/dist/report/host/from-record.d.ts +5 -0
  104. package/dist/report/runtime/resolved-page.cjs +16 -6
  105. package/dist/report/runtime/resolved-page.cjs.map +1 -1
  106. package/dist/report/runtime/resolved-page.d.cts +3 -0
  107. package/dist/report/runtime/resolved-page.d.mts +3 -0
  108. package/dist/report/runtime/resolved-page.d.ts +3 -0
  109. package/dist/report/runtime/text.cjs +1 -0
  110. package/dist/report/runtime/text.cjs.map +1 -1
  111. package/dist/report/runtime/text.d.cts +4 -0
  112. package/dist/report/runtime/text.d.mts +4 -0
  113. package/dist/report/runtime/text.d.ts +4 -0
  114. package/dist/runner/feedback/human.cjs +180 -16
  115. package/dist/runner/feedback/human.cjs.map +1 -1
  116. package/dist/runner/run.cjs +43 -0
  117. package/dist/runner/run.cjs.map +1 -1
  118. package/dist/sample/capability.cjs +93 -0
  119. package/dist/sample/capability.cjs.map +1 -1
  120. package/dist/sample/capability.d.cts +3 -1
  121. package/dist/sample/capability.d.mts +3 -1
  122. package/dist/sample/capability.d.ts +3 -1
  123. package/dist/sample/capability.js +8 -6
  124. package/dist/sandbox/docker-agent-image.cjs +5 -1
  125. package/dist/sandbox/docker-agent-image.cjs.map +1 -1
  126. package/dist/sandbox/docker-agent-image.d.cts +2 -0
  127. package/dist/sandbox/docker-agent-image.d.mts +2 -0
  128. package/dist/sandbox/docker-agent-image.d.ts +2 -0
  129. package/dist/sandbox/docker-agent-image.js +14 -10
  130. package/dist/sandbox/index.cjs +4 -2
  131. package/dist/sandbox/index.cjs.map +1 -1
  132. package/dist/sandbox/index.d.cts +1 -1
  133. package/dist/sandbox/index.d.mts +1 -1
  134. package/dist/sandbox/index.d.ts +1 -1
  135. package/dist/sandbox/index.js +120 -116
  136. package/dist/sandbox/index.mjs +120 -116
  137. package/docs-site/images/hitl-handshake-zh.svg +3 -3
  138. package/docs-site/zh/examples/integrations/ai-sdk-v7.mdx +3 -3
  139. package/docs-site/zh/examples/integrations/claude-sdk.mdx +3 -3
  140. package/docs-site/zh/examples/integrations/codex-sdk.mdx +5 -5
  141. package/docs-site/zh/examples/integrations/langgraph.mdx +3 -3
  142. package/docs-site/zh/examples/integrations/pi-sdk.mdx +5 -5
  143. package/docs-site/zh/explanation/adapter.mdx +5 -5
  144. package/docs-site/zh/explanation/assert.mdx +1 -1
  145. package/docs-site/zh/explanation/drive.mdx +3 -1
  146. package/docs-site/zh/explanation/evals.mdx +3 -1
  147. package/docs-site/zh/explanation/hitl.mdx +7 -7
  148. package/docs-site/zh/explanation/runner.mdx +2 -2
  149. package/docs-site/zh/index.mdx +2 -2
  150. package/docs-site/zh/reference/builtin-agents.mdx +4 -4
  151. package/docs-site/zh/reference/capabilities.mdx +1 -1
  152. package/docs-site/zh/reference/cli.mdx +14 -14
  153. package/docs-site/zh/reference/events.mdx +11 -11
  154. package/docs-site/zh/reference/official-adapters.mdx +1 -1
  155. package/docs-site/zh/reference/results-data.mdx +6 -0
  156. package/docs-site/zh/troubleshooting/debugging.mdx +2 -2
  157. package/docs-site/zh/tutorials/agent-feedback-loop.mdx +2 -2
  158. package/docs-site/zh/tutorials/ci-integration.mdx +1 -1
  159. package/docs-site/zh/tutorials/connect-your-agent.mdx +2 -2
  160. package/docs-site/zh/tutorials/custom-reports.mdx +4 -4
  161. package/docs-site/zh/tutorials/deploy-report-site.mdx +3 -3
  162. package/docs-site/zh/tutorials/docker-in-docker.mdx +3 -0
  163. package/docs-site/zh/tutorials/experiments.mdx +2 -2
  164. package/docs-site/zh/tutorials/handle-execution-failures.mdx +1 -1
  165. package/docs-site/zh/tutorials/install-custom-sandbox-agent.mdx +1 -1
  166. package/docs-site/zh/tutorials/nixos-managed-dind.mdx +160 -0
  167. package/docs-site/zh/tutorials/publish-report.mdx +4 -4
  168. package/docs-site/zh/tutorials/reporters.mdx +1 -1
  169. package/docs-site/zh/tutorials/rerun-and-cache.mdx +16 -0
  170. package/docs-site/zh/tutorials/viewing-results.mdx +28 -10
  171. package/docs-site/zh/tutorials/write-send.mdx +7 -6
  172. package/package.json +1 -1
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.experimentListContent = experimentListContent;
4
4
  exports.attemptListContent = attemptListContent;
5
5
  const locale_ts_1 = require("../../model/locale.cjs");
6
+ const format_ts_1 = require("../../model/format.cjs");
6
7
  const compute_ts_1 = require("./compute.cjs");
7
8
  /** 覆盖缺口占位行共用的原因码;missingText(code) 经 locale 键给出文案。 */
8
9
  const NO_CURRENT_RESULT = "noCurrentResult";
@@ -15,6 +16,7 @@ const HEADER = {
15
16
  agent: (0, locale_ts_1.localizedMessage)("table.agent"),
16
17
  durationMs: (0, locale_ts_1.localizedMessage)("experimentList.avgDuration"),
17
18
  passRate: (0, locale_ts_1.localizedMessage)("experimentList.passRate"),
19
+ totalScore: (0, locale_ts_1.localizedMessage)("experimentList.totalScore"),
18
20
  tokens: (0, locale_ts_1.localizedMessage)("experimentList.tokens"),
19
21
  costUSD: (0, locale_ts_1.localizedMessage)("experimentList.cost"),
20
22
  record: (0, locale_ts_1.localizedMessage)("experimentList.result"),
@@ -78,19 +80,29 @@ function attemptCells(attempt) {
78
80
  // 层级表的判定构成列:该次判定,与 verdict 格同值。
79
81
  record: verdictCell(attempt.verdict),
80
82
  durationMs: measureCell(attempt.durationMs),
83
+ ...(attempt.totalScore === undefined ? {} : { totalScore: { kind: "score", earned: attempt.totalScore } }),
81
84
  ...(attempt.costUSD === undefined ? {} : { costUSD: measureCell(attempt.costUSD) }),
82
85
  };
83
86
  }
84
- /** 层级表列集:主读数列随题型构成在场,其余固定。当前 facade 只有通过制读数。 */
85
- const HIERARCHY_COLUMNS = [
87
+ const HIERARCHY_COLUMNS_PREFIX = [
86
88
  { key: "entity", header: HEADER.entity },
87
89
  { key: "model", header: HEADER.model },
88
90
  { key: "agent", header: HEADER.agent },
89
91
  { key: "durationMs", better: "lower", header: HEADER.durationMs },
90
- { key: "passRate", better: "higher", header: HEADER.passRate },
92
+ ];
93
+ const HIERARCHY_COLUMNS_SUFFIX = [
91
94
  { key: "tokens", better: "lower", header: HEADER.tokens },
92
95
  { key: "record", header: HEADER.record },
93
96
  ];
97
+ function hierarchyColumns(items) {
98
+ const composition = (0, format_ts_1.experimentListEvaluationKindComposition)(items.map((item) => ({ evaluationKind: item.evaluationKind, attempts: item.evalRows.length })));
99
+ const primary = [];
100
+ if (composition !== "points")
101
+ primary.push({ key: "passRate", better: "higher", header: HEADER.passRate });
102
+ if (composition !== "pass")
103
+ primary.push({ key: "totalScore", better: "higher", header: HEADER.totalScore });
104
+ return [...HIERARCHY_COLUMNS_PREFIX, ...primary, ...HIERARCHY_COLUMNS_SUFFIX];
105
+ }
94
106
  const COST_COLUMN = { key: "costUSD", better: "lower", header: HEADER.costUSD };
95
107
  /** Attempt 平铺表的列集(AttemptList / FailureList 同一份)。 */
96
108
  const FLAT_ENTITY_COLUMNS = [
@@ -151,6 +163,8 @@ function evalRow(row, label, view) {
151
163
  // 判定构成列:该题 attempts 的计票,与 experiment 行计票同一形态。
152
164
  record: verdictCountsCell(row.attempts),
153
165
  durationMs: measureCell(row.durationMs),
166
+ ...(row.evaluationKind === "pass" ? { passRate: measureCell(row.endToEndPassRate) } : {}),
167
+ ...(row.totalScore === undefined ? {} : { totalScore: { kind: "score", earned: row.totalScore } }),
154
168
  ...(row.costUSD === undefined ? {} : { costUSD: measureCell(row.costUSD) }),
155
169
  };
156
170
  return {
@@ -201,7 +215,17 @@ function groupTableRow(node, item, view) {
201
215
  const bag = {
202
216
  entity: identityCell(node.segment, groupEntityDetail(evals, knownEvals)),
203
217
  durationMs: groupMetricValue(metrics, "durationMs"),
204
- passRate: groupMetricValue(metrics, "passRate"),
218
+ ...(evalRows.every((row) => row.evaluationKind === "pass")
219
+ ? { passRate: groupMetricValue(metrics, "passRate") }
220
+ : {}),
221
+ ...(evalRows.some((row) => row.totalScore !== undefined)
222
+ ? {
223
+ totalScore: {
224
+ kind: "score",
225
+ earned: evalRows.reduce((sum, row) => sum + (row.totalScore ?? 0), 0),
226
+ },
227
+ }
228
+ : {}),
205
229
  tokens: groupMetricValue(metrics, "tokens"),
206
230
  ...(metrics?.costUSD === undefined ? {} : { costUSD: measureCell(metrics.costUSD) }),
207
231
  record: evals === 0
@@ -246,7 +270,8 @@ function experimentRow(item, view) {
246
270
  model: item.model === null ? { kind: "notApplicable" } : textCell(item.model),
247
271
  agent: item.agent === null ? { kind: "notApplicable" } : textCell(item.agent),
248
272
  durationMs: measureCell(item.durationMs),
249
- passRate: measureCell(item.endToEndPassRate),
273
+ ...(item.evaluationKind === "pass" ? { passRate: measureCell(item.endToEndPassRate) } : {}),
274
+ ...(item.totalScore === undefined ? {} : { totalScore: { kind: "score", earned: item.totalScore } }),
250
275
  tokens: measureCell(item.tokens),
251
276
  ...(item.costUSD === undefined ? {} : { costUSD: measureCell(item.costUSD) }),
252
277
  record: verdictCountsCell(attempts),
@@ -258,7 +283,7 @@ function experimentRow(item, view) {
258
283
  };
259
284
  }
260
285
  function experimentListContent(items) {
261
- const columns = columnsWithCost(HIERARCHY_COLUMNS, items.some((item) => item.costUSD !== undefined));
286
+ const columns = columnsWithCost(hierarchyColumns(items), items.some((item) => item.costUSD !== undefined));
262
287
  return {
263
288
  columns,
264
289
  rows: items.map((item) => experimentRow(item, { columns, item, labelPrefix: "" })),
@@ -1 +1 @@
1
- {"version":3,"file":"content.js","sourceRoot":"","sources":["content.ts"],"names":[],"mappings":";;AA6RA,sDAMC;AACD,gDAOC;AAvSD,qDAAyD;AAGzD,6CAAgM;AAChM,sDAAsD;AACtD,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAC5C,uBAAuB;AACvB,MAAM,gBAAgB,GAAG,WAAW,CAAC;AACrC,2DAA2D;AAC3D,MAAM,MAAM,GAAG;IACX,MAAM,EAAE,IAAA,4BAAgB,EAAC,2BAA2B,CAAC;IACrD,KAAK,EAAE,IAAA,4BAAgB,EAAC,aAAa,CAAC;IACtC,KAAK,EAAE,IAAA,4BAAgB,EAAC,aAAa,CAAC;IACtC,UAAU,EAAE,IAAA,4BAAgB,EAAC,4BAA4B,CAAC;IAC1D,QAAQ,EAAE,IAAA,4BAAgB,EAAC,yBAAyB,CAAC;IACrD,MAAM,EAAE,IAAA,4BAAgB,EAAC,uBAAuB,CAAC;IACjD,OAAO,EAAE,IAAA,4BAAgB,EAAC,qBAAqB,CAAC;IAChD,MAAM,EAAE,IAAA,4BAAgB,EAAC,uBAAuB,CAAC;IACjD,OAAO,EAAE,IAAA,4BAAgB,EAAC,uBAAuB,CAAC;IAClD,MAAM,EAAE,IAAA,4BAAgB,EA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,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACvD,CAAC;AACN,CAAC","sourcesContent":["// 实体列表 Table Content 投影(docs/feature/reports/library.md)。\n// Experiment 层级在这里从闭合 ExperimentListItem + 组读数投影成 TableContent.subRows;\n// 组件本体是中立 Table 原语,不知道 experiment / Eval / Attempt 语义。\nimport type { Cell, ColumnSpec, TableContent, TableContentRow, } from \"../../definition/cell.ts\";\nimport { localizedMessage } from \"../../model/locale.ts\";\nimport type { Verdict } from \"../../../shared/types.ts\";\nimport type { MetricValue } from \"../../../analysis/index.ts\";\nimport { experimentEvalLayout, relativeEvalLabel, type AttemptListItem, type ExperimentListEvalRow, type ExperimentListItem, type ExperimentMetrics, type EvalLayoutNode, } from \"./compute.ts\";\n/** 覆盖缺口占位行共用的原因码;missingText(code) 经 locale 键给出文案。 */\nconst NO_CURRENT_RESULT = \"noCurrentResult\";\n/** 组内零样本读数格的结构化原因码。 */\nconst GROUP_NO_SAMPLES = \"noSamples\";\n/** 三张实体表共用的列表头。文案单源在 locale 字典,这里只烤成随列走的 LocalizedText。 */\nconst HEADER = {\n entity: localizedMessage(\"experimentList.experiment\"),\n model: localizedMessage(\"table.model\"),\n agent: localizedMessage(\"table.agent\"),\n durationMs: localizedMessage(\"experimentList.avgDuration\"),\n passRate: localizedMessage(\"experimentList.passRate\"),\n tokens: localizedMessage(\"experimentList.tokens\"),\n costUSD: localizedMessage(\"experimentList.cost\"),\n record: localizedMessage(\"experimentList.result\"),\n verdict: localizedMessage(\"experimentList.status\"),\n result: localizedMessage(\"experimentList.result\"),\n};\n/**\n * 一行的「格子原料」:这一行自己算得出的全部格子,与任何列集无关。\n * 原料裁成行由 `projectCells` 做——列集外的原料丢掉,原料没覆盖的列显式填\n * notApplicable,不靠缺格回落成 \"—\"(memory/cell-key-must-match-column-set.md)。\n */\ntype CellBag = Readonly<globalThis.Record<string, Cell>>;\nfunction projectCells(bag: CellBag, columns: readonly ColumnSpec[]): globalThis.Record<string, Cell> {\n const cells: globalThis.Record<string, Cell> = {};\n for (const column of columns) {\n cells[column.key] = bag[column.key] ?? { kind: \"notApplicable\" };\n }\n return cells;\n}\nfunction measureCell(value: MetricValue): Cell {\n return { kind: \"metric\", metric: value };\n}\n/** 一组判定 → 计票。experiment / 组行数题、Eval 行数 attempt,同一形态同一构造。 */\nfunction tallyVerdicts(attempts: readonly AttemptListItem[]): {\n readonly passed: number;\n readonly failed: number;\n readonly errored: number;\n readonly skipped: number;\n} {\n const counts = { passed: 0, failed: 0, errored: 0, skipped: 0 };\n for (const attempt of attempts) {\n if (attempt.verdict === null)\n continue;\n counts[attempt.verdict] += 1;\n }\n return counts;\n}\nfunction verdictCountsCell(attempts: readonly AttemptListItem[]): Cell {\n return { kind: \"verdict\", counts: tallyVerdicts(attempts) };\n}\nfunction verdictCell(verdict: Verdict | null): Cell {\n if (verdict === null)\n return { kind: \"notApplicable\" };\n return { kind: \"verdict\", verdict };\n}\nfunction locatorCell(attempt: AttemptListItem): Cell {\n return {\n kind: \"locator\",\n locator: attempt.locator,\n ...(attempt.verdict === null ? {} : { verdict: attempt.verdict }),\n };\n}\nfunction textCell(text: string, detail?: string): Cell {\n return detail ? { kind: \"text\", text, detail } : { kind: \"text\", text };\n}\n/** 失败摘要格:closed 摘录缺失时如实显示 \"—\",不发明文案。 */\nfunction resultCell(attempt: AttemptListItem): Cell {\n return attempt.failureSummary === null\n ? { kind: \"text\", text: \"—\" }\n : { kind: \"summary\", text: attempt.failureSummary };\n}\n/**\n * attempt 行的格子原料。层级表取 entity / record / durationMs / costUSD,\n * 平铺表取 entity / verdict / result / durationMs / costUSD;\n * 两张表各自裁自这一份,不各写一份构造。\n */\nfunction attemptCells(attempt: AttemptListItem): CellBag {\n return {\n entity: locatorCell(attempt),\n verdict: verdictCell(attempt.verdict),\n result: resultCell(attempt),\n // 层级表的判定构成列:该次判定,与 verdict 格同值。\n record: verdictCell(attempt.verdict),\n durationMs: measureCell(attempt.durationMs),\n ...(attempt.costUSD === undefined ? {} : { costUSD: measureCell(attempt.costUSD) }),\n };\n}\n/** 层级表列集:主读数列随题型构成在场,其余固定。当前 facade 只有通过制读数。 */\nconst HIERARCHY_COLUMNS: readonly ColumnSpec[] = [\n { key: \"entity\", header: HEADER.entity },\n { key: \"model\", header: HEADER.model },\n { key: \"agent\", header: HEADER.agent },\n { key: \"durationMs\", better: \"lower\", header: HEADER.durationMs },\n { key: \"passRate\", better: \"higher\", header: HEADER.passRate },\n { key: \"tokens\", better: \"lower\", header: HEADER.tokens },\n { key: \"record\", header: HEADER.record },\n];\nconst COST_COLUMN: ColumnSpec = { key: \"costUSD\", better: \"lower\", header: HEADER.costUSD };\n/** Attempt 平铺表的列集(AttemptList / FailureList 同一份)。 */\nconst FLAT_ENTITY_COLUMNS: readonly ColumnSpec[] = [\n { key: \"entity\", header: HEADER.entity },\n { key: \"verdict\", header: HEADER.verdict },\n { key: \"result\", header: HEADER.result },\n { key: \"durationMs\", better: \"lower\", header: HEADER.durationMs },\n];\nfunction columnsWithCost(columns: readonly ColumnSpec[], includeCost: boolean): readonly ColumnSpec[] {\n if (!includeCost)\n return columns;\n const recordIndex = columns.findIndex((column) => column.key === \"record\");\n if (recordIndex < 0)\n return [...columns, COST_COLUMN];\n return [...columns.slice(0, recordIndex), COST_COLUMN, ...columns.slice(recordIndex)];\n}\n/** 层级实体的计数属于身份说明,必须留在同一个首格而不是渲染成续行。 */\nfunction identityCell(name: string, metadata: string): Cell {\n return textCell(`${name} (${metadata})`);\n}\n/** 组内题数与已知题数:\"3/4 evals\" 只在有缺口时出现。 */\nfunction groupEntityDetail(evals: number, knownEvals: number): string {\n return knownEvals > evals ? `${evals}/${knownEvals} evals` : `${evals} evals`;\n}\n/**\n * 组行读数格:直接用 Analysis-owned 组 MetricValue;组前缀聚合缺失时才是\n * missing(本该有却没跑到),不是 \"—\"(对这一行没有意义)。\n */\nfunction groupMetricValue(metrics: ExperimentMetrics | undefined, key: keyof ExperimentMetrics): Cell {\n const metric = metrics?.[key];\n return metric === undefined ? { kind: \"missing\", code: GROUP_NO_SAMPLES } : measureCell(metric);\n}\n/** 覆盖缺口占位行:code 与补跑命令同行——都是「当前配置下没有结果」这一个事实。 */\nfunction placeholderRow(experimentId: string, evalId: string, label: string, columns: readonly ColumnSpec[]): TableContentRow {\n const bag: CellBag = {\n entity: textCell(label),\n record: {\n kind: \"missing\",\n code: NO_CURRENT_RESULT,\n detail: `niceeval exp ${experimentId}`,\n },\n };\n return {\n key: `${experimentId}:${evalId}:missing`,\n variant: \"placeholder\",\n cells: projectCells(bag, columns),\n };\n}\ninterface HierarchyView {\n readonly columns: readonly ColumnSpec[];\n readonly item: ExperimentListItem;\n readonly labelPrefix: string;\n}\nfunction attemptRow(attempt: AttemptListItem, columns: readonly ColumnSpec[]): TableContentRow {\n return {\n key: attempt.locator,\n cells: projectCells(attemptCells(attempt), columns),\n };\n}\nfunction evalRow(row: ExperimentListEvalRow, label: string, view: HierarchyView): TableContentRow {\n const bag: CellBag = {\n entity: textCell(label),\n // 判定构成列:该题 attempts 的计票,与 experiment 行计票同一形态。\n record: verdictCountsCell(row.attempts),\n durationMs: measureCell(row.durationMs),\n ...(row.costUSD === undefined ? {} : { costUSD: measureCell(row.costUSD) }),\n };\n return {\n key: row.evalId,\n cells: projectCells(bag, view.columns),\n subRows: row.attempts.map((attempt) => attemptRow(attempt, view.columns)),\n };\n}\nfunction leafTableRow(node: Extract<EvalLayoutNode, {\n readonly kind: \"leaf\";\n}>, view: HierarchyView): TableContentRow {\n const label = relativeEvalLabel(node.evalId, view.labelPrefix);\n const row = view.item.evalRows.find((candidate) => candidate.evalId === node.evalId);\n return row === undefined\n ? placeholderRow(view.item.experimentId, node.evalId, label, view.columns)\n : evalRow(row, label, view);\n}\n/** 组行的成员 attempt 列表(用于判定计票)。 */\nfunction attemptsUnder(node: EvalLayoutNode, evalRows: readonly ExperimentListEvalRow[]): readonly AttemptListItem[] {\n const members = new Set<string>();\n const collect = (list: readonly EvalLayoutNode[]): void => {\n for (const entry of list) {\n if (entry.kind === \"leaf\")\n members.add(entry.evalId);\n else\n collect(entry.children);\n }\n };\n collect([node]);\n return evalRows\n .filter((row) => members.has(row.evalId))\n .flatMap((row) => row.attempts);\n}\nfunction groupTableRow(node: Extract<EvalLayoutNode, {\n readonly kind: \"group\";\n}>, item: ExperimentListItem, view: HierarchyView): TableContentRow {\n const evalIds = new Set<string>();\n const collect = (list: readonly EvalLayoutNode[]): void => {\n for (const entry of list) {\n if (entry.kind === \"leaf\")\n evalIds.add(entry.evalId);\n else\n collect(entry.children);\n }\n };\n collect([node]);\n const evalRows = item.evalRows.filter((row) => evalIds.has(row.evalId));\n const knownEvals = evalIds.size;\n const evals = evalRows.length;\n const metrics = item.groupMetrics.get(node.prefix);\n const attempts = attemptsUnder(node, item.evalRows);\n const bag: CellBag = {\n entity: identityCell(node.segment, groupEntityDetail(evals, knownEvals)),\n durationMs: groupMetricValue(metrics, \"durationMs\"),\n passRate: groupMetricValue(metrics, \"passRate\"),\n tokens: groupMetricValue(metrics, \"tokens\"),\n ...(metrics?.costUSD === undefined ? {} : { costUSD: measureCell(metrics.costUSD) }),\n record: evals === 0\n ? { kind: \"missing\", code: GROUP_NO_SAMPLES }\n : verdictCountsCell(attempts),\n };\n return {\n key: `group:${node.prefix}`,\n variant: \"group\",\n cells: projectCells(bag, view.columns),\n subRows: groupChildren(node.children, { ...view, labelPrefix: node.prefix }),\n };\n}\n/** 同一层的组行按主读数降序(缺数据沉底,同值按段名收口),叶子恒在组行之后。 */\nfunction groupChildren(nodes: readonly EvalLayoutNode[], view: HierarchyView): TableContentRow[] {\n const groups = nodes\n .filter((node): node is Extract<EvalLayoutNode, {\n readonly kind: \"group\";\n }> => node.kind === \"group\")\n .slice()\n .sort((left, right) => {\n const leftPrimary = view.item.groupMetrics.get(left.prefix)?.passRate.value ?? null;\n const rightPrimary = view.item.groupMetrics.get(right.prefix)?.passRate.value ?? null;\n if (leftPrimary === null && rightPrimary === null)\n return left.segment.localeCompare(right.segment);\n if (leftPrimary === null)\n return 1;\n if (rightPrimary === null)\n return -1;\n return rightPrimary - leftPrimary || left.segment.localeCompare(right.segment);\n });\n const leaves = nodes.filter((node): node is Extract<EvalLayoutNode, {\n readonly kind: \"leaf\";\n }> => node.kind === \"leaf\");\n return [\n ...groups.map((node) => groupTableRow(node, view.item, view)),\n ...leaves.map((node) => leafTableRow(node, view)),\n ];\n}\nfunction experimentRow(item: ExperimentListItem, view: HierarchyView): TableContentRow {\n const evalIds = new Set(item.evalRows.map((row) => row.evalId));\n const members: readonly EvalLayoutNode[] = experimentEvalLayout([...new Set([...evalIds, ...item.missingEvalIds])]);\n const attempts = item.evalRows.flatMap((row) => row.attempts);\n const bag: CellBag = {\n entity: textCell(item.experimentId),\n model: item.model === null ? { kind: \"notApplicable\" } : textCell(item.model),\n agent: item.agent === null ? { kind: \"notApplicable\" } : textCell(item.agent),\n durationMs: measureCell(item.durationMs),\n passRate: measureCell(item.endToEndPassRate),\n tokens: measureCell(item.tokens),\n ...(item.costUSD === undefined ? {} : { costUSD: measureCell(item.costUSD) }),\n record: verdictCountsCell(attempts),\n };\n return {\n key: item.experimentId,\n cells: projectCells(bag, view.columns),\n subRows: members.length > 0 ? groupChildren(members, view) : [],\n };\n}\nexport function experimentListContent(items: readonly ExperimentListItem[]): TableContent {\n const columns = columnsWithCost(HIERARCHY_COLUMNS, items.some((item) => item.costUSD !== undefined));\n return {\n columns,\n rows: items.map((item) => experimentRow(item, { columns, item, labelPrefix: \"\" })),\n };\n}\nexport function attemptListContent(items: readonly AttemptListItem[]): TableContent {\n const columns = columnsWithCost(FLAT_ENTITY_COLUMNS, items.some((item) => item.costUSD !== undefined));\n return {\n columns,\n // 与层级表里的 attempt 行同一份格子原料,只是裁到平铺列集。\n rows: items.map((item) => attemptRow(item, columns)),\n };\n}\n"]}
1
+ {"version":3,"file":"content.js","sourceRoot":"","sources":["content.ts"],"names":[],"mappings":";;AAsTA,s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,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;KACrF,CAAC;AACN,CAAC;AACD,SAAgB,kBAAkB,CAAC,KAAiC;IAChE,MAAM,OAAO,GAAG,eAAe,CAAC,mBAAmB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC;IACvG,OAAO;QACH,OAAO;QACP,oCAAoC;QACpC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACvD,CAAC;AACN,CAAC","sourcesContent":["// 实体列表 Table Content 投影(docs/feature/reports/library.md)。\n// Experiment 层级在这里从闭合 ExperimentListItem + 组读数投影成 TableContent.subRows;\n// 组件本体是中立 Table 原语,不知道 experiment / Eval / Attempt 语义。\nimport type { Cell, ColumnSpec, TableContent, TableContentRow, } from \"../../definition/cell.ts\";\nimport { localizedMessage } from \"../../model/locale.ts\";\nimport type { Verdict } from \"../../../shared/types.ts\";\nimport type { MetricValue } from \"../../../analysis/index.ts\";\nimport { experimentListEvaluationKindComposition } from \"../../model/format.ts\";\nimport { experimentEvalLayout, relativeEvalLabel, type AttemptListItem, type ExperimentListEvalRow, type ExperimentListItem, type ExperimentMetrics, type EvalLayoutNode, } from \"./compute.ts\";\n/** 覆盖缺口占位行共用的原因码;missingText(code) 经 locale 键给出文案。 */\nconst NO_CURRENT_RESULT = \"noCurrentResult\";\n/** 组内零样本读数格的结构化原因码。 */\nconst GROUP_NO_SAMPLES = \"noSamples\";\n/** 三张实体表共用的列表头。文案单源在 locale 字典,这里只烤成随列走的 LocalizedText。 */\nconst HEADER = {\n entity: localizedMessage(\"experimentList.experiment\"),\n model: localizedMessage(\"table.model\"),\n agent: localizedMessage(\"table.agent\"),\n durationMs: localizedMessage(\"experimentList.avgDuration\"),\n passRate: localizedMessage(\"experimentList.passRate\"),\n totalScore: localizedMessage(\"experimentList.totalScore\"),\n tokens: localizedMessage(\"experimentList.tokens\"),\n costUSD: localizedMessage(\"experimentList.cost\"),\n record: localizedMessage(\"experimentList.result\"),\n verdict: localizedMessage(\"experimentList.status\"),\n result: localizedMessage(\"experimentList.result\"),\n};\n/**\n * 一行的「格子原料」:这一行自己算得出的全部格子,与任何列集无关。\n * 原料裁成行由 `projectCells` 做——列集外的原料丢掉,原料没覆盖的列显式填\n * notApplicable,不靠缺格回落成 \"—\"(memory/cell-key-must-match-column-set.md)。\n */\ntype CellBag = Readonly<globalThis.Record<string, Cell>>;\nfunction projectCells(bag: CellBag, columns: readonly ColumnSpec[]): globalThis.Record<string, Cell> {\n const cells: globalThis.Record<string, Cell> = {};\n for (const column of columns) {\n cells[column.key] = bag[column.key] ?? { kind: \"notApplicable\" };\n }\n return cells;\n}\nfunction measureCell(value: MetricValue): Cell {\n return { kind: \"metric\", metric: value };\n}\n/** 一组判定 → 计票。experiment / 组行数题、Eval 行数 attempt,同一形态同一构造。 */\nfunction tallyVerdicts(attempts: readonly AttemptListItem[]): {\n readonly passed: number;\n readonly failed: number;\n readonly errored: number;\n readonly skipped: number;\n} {\n const counts = { passed: 0, failed: 0, errored: 0, skipped: 0 };\n for (const attempt of attempts) {\n if (attempt.verdict === null)\n continue;\n counts[attempt.verdict] += 1;\n }\n return counts;\n}\nfunction verdictCountsCell(attempts: readonly AttemptListItem[]): Cell {\n return { kind: \"verdict\", counts: tallyVerdicts(attempts) };\n}\nfunction verdictCell(verdict: Verdict | null): Cell {\n if (verdict === null)\n return { kind: \"notApplicable\" };\n return { kind: \"verdict\", verdict };\n}\nfunction locatorCell(attempt: AttemptListItem): Cell {\n return {\n kind: \"locator\",\n locator: attempt.locator,\n ...(attempt.verdict === null ? {} : { verdict: attempt.verdict }),\n };\n}\nfunction textCell(text: string, detail?: string): Cell {\n return detail ? { kind: \"text\", text, detail } : { kind: \"text\", text };\n}\n/** 失败摘要格:closed 摘录缺失时如实显示 \"—\",不发明文案。 */\nfunction resultCell(attempt: AttemptListItem): Cell {\n return attempt.failureSummary === null\n ? { kind: \"text\", text: \"—\" }\n : { kind: \"summary\", text: attempt.failureSummary };\n}\n/**\n * attempt 行的格子原料。层级表取 entity / record / durationMs / costUSD,\n * 平铺表取 entity / verdict / result / durationMs / costUSD;\n * 两张表各自裁自这一份,不各写一份构造。\n */\nfunction attemptCells(attempt: AttemptListItem): CellBag {\n return {\n entity: locatorCell(attempt),\n verdict: verdictCell(attempt.verdict),\n result: resultCell(attempt),\n // 层级表的判定构成列:该次判定,与 verdict 格同值。\n record: verdictCell(attempt.verdict),\n durationMs: measureCell(attempt.durationMs),\n ...(attempt.totalScore === undefined ? {} : { totalScore: { kind: \"score\", earned: attempt.totalScore } as const }),\n ...(attempt.costUSD === undefined ? {} : { costUSD: measureCell(attempt.costUSD) }),\n };\n}\nconst HIERARCHY_COLUMNS_PREFIX: readonly ColumnSpec[] = [\n { key: \"entity\", header: HEADER.entity },\n { key: \"model\", header: HEADER.model },\n { key: \"agent\", header: HEADER.agent },\n { key: \"durationMs\", better: \"lower\", header: HEADER.durationMs },\n];\nconst HIERARCHY_COLUMNS_SUFFIX: readonly ColumnSpec[] = [\n { key: \"tokens\", better: \"lower\", header: HEADER.tokens },\n { key: \"record\", header: HEADER.record },\n];\nfunction hierarchyColumns(items: readonly ExperimentListItem[]): readonly ColumnSpec[] {\n const composition = experimentListEvaluationKindComposition(items.map((item) => ({ evaluationKind: item.evaluationKind, attempts: item.evalRows.length })));\n const primary: ColumnSpec[] = [];\n if (composition !== \"points\")\n primary.push({ key: \"passRate\", better: \"higher\", header: HEADER.passRate });\n if (composition !== \"pass\")\n primary.push({ key: \"totalScore\", better: \"higher\", header: HEADER.totalScore });\n return [...HIERARCHY_COLUMNS_PREFIX, ...primary, ...HIERARCHY_COLUMNS_SUFFIX];\n}\nconst COST_COLUMN: ColumnSpec = { key: \"costUSD\", better: \"lower\", header: HEADER.costUSD };\n/** Attempt 平铺表的列集(AttemptList / FailureList 同一份)。 */\nconst FLAT_ENTITY_COLUMNS: readonly ColumnSpec[] = [\n { key: \"entity\", header: HEADER.entity },\n { key: \"verdict\", header: HEADER.verdict },\n { key: \"result\", header: HEADER.result },\n { key: \"durationMs\", better: \"lower\", header: HEADER.durationMs },\n];\nfunction columnsWithCost(columns: readonly ColumnSpec[], includeCost: boolean): readonly ColumnSpec[] {\n if (!includeCost)\n return columns;\n const recordIndex = columns.findIndex((column) => column.key === \"record\");\n if (recordIndex < 0)\n return [...columns, COST_COLUMN];\n return [...columns.slice(0, recordIndex), COST_COLUMN, ...columns.slice(recordIndex)];\n}\n/** 层级实体的计数属于身份说明,必须留在同一个首格而不是渲染成续行。 */\nfunction identityCell(name: string, metadata: string): Cell {\n return textCell(`${name} (${metadata})`);\n}\n/** 组内题数与已知题数:\"3/4 evals\" 只在有缺口时出现。 */\nfunction groupEntityDetail(evals: number, knownEvals: number): string {\n return knownEvals > evals ? `${evals}/${knownEvals} evals` : `${evals} evals`;\n}\n/**\n * 组行读数格:直接用 Analysis-owned 组 MetricValue;组前缀聚合缺失时才是\n * missing(本该有却没跑到),不是 \"—\"(对这一行没有意义)。\n */\nfunction groupMetricValue(metrics: ExperimentMetrics | undefined, key: keyof ExperimentMetrics): Cell {\n const metric = metrics?.[key];\n return metric === undefined ? { kind: \"missing\", code: GROUP_NO_SAMPLES } : measureCell(metric);\n}\n/** 覆盖缺口占位行:code 与补跑命令同行——都是「当前配置下没有结果」这一个事实。 */\nfunction placeholderRow(experimentId: string, evalId: string, label: string, columns: readonly ColumnSpec[]): TableContentRow {\n const bag: CellBag = {\n entity: textCell(label),\n record: {\n kind: \"missing\",\n code: NO_CURRENT_RESULT,\n detail: `niceeval exp ${experimentId}`,\n },\n };\n return {\n key: `${experimentId}:${evalId}:missing`,\n variant: \"placeholder\",\n cells: projectCells(bag, columns),\n };\n}\ninterface HierarchyView {\n readonly columns: readonly ColumnSpec[];\n readonly item: ExperimentListItem;\n readonly labelPrefix: string;\n}\nfunction attemptRow(attempt: AttemptListItem, columns: readonly ColumnSpec[]): TableContentRow {\n return {\n key: attempt.locator,\n cells: projectCells(attemptCells(attempt), columns),\n };\n}\nfunction evalRow(row: ExperimentListEvalRow, label: string, view: HierarchyView): TableContentRow {\n const bag: CellBag = {\n entity: textCell(label),\n // 判定构成列:该题 attempts 的计票,与 experiment 行计票同一形态。\n record: verdictCountsCell(row.attempts),\n durationMs: measureCell(row.durationMs),\n ...(row.evaluationKind === \"pass\" ? { passRate: measureCell(row.endToEndPassRate) } : {}),\n ...(row.totalScore === undefined ? {} : { totalScore: { kind: \"score\", earned: row.totalScore } as const }),\n ...(row.costUSD === undefined ? {} : { costUSD: measureCell(row.costUSD) }),\n };\n return {\n key: row.evalId,\n cells: projectCells(bag, view.columns),\n subRows: row.attempts.map((attempt) => attemptRow(attempt, view.columns)),\n };\n}\nfunction leafTableRow(node: Extract<EvalLayoutNode, {\n readonly kind: \"leaf\";\n}>, view: HierarchyView): TableContentRow {\n const label = relativeEvalLabel(node.evalId, view.labelPrefix);\n const row = view.item.evalRows.find((candidate) => candidate.evalId === node.evalId);\n return row === undefined\n ? placeholderRow(view.item.experimentId, node.evalId, label, view.columns)\n : evalRow(row, label, view);\n}\n/** 组行的成员 attempt 列表(用于判定计票)。 */\nfunction attemptsUnder(node: EvalLayoutNode, evalRows: readonly ExperimentListEvalRow[]): readonly AttemptListItem[] {\n const members = new Set<string>();\n const collect = (list: readonly EvalLayoutNode[]): void => {\n for (const entry of list) {\n if (entry.kind === \"leaf\")\n members.add(entry.evalId);\n else\n collect(entry.children);\n }\n };\n collect([node]);\n return evalRows\n .filter((row) => members.has(row.evalId))\n .flatMap((row) => row.attempts);\n}\nfunction groupTableRow(node: Extract<EvalLayoutNode, {\n readonly kind: \"group\";\n}>, item: ExperimentListItem, view: HierarchyView): TableContentRow {\n const evalIds = new Set<string>();\n const collect = (list: readonly EvalLayoutNode[]): void => {\n for (const entry of list) {\n if (entry.kind === \"leaf\")\n evalIds.add(entry.evalId);\n else\n collect(entry.children);\n }\n };\n collect([node]);\n const evalRows = item.evalRows.filter((row) => evalIds.has(row.evalId));\n const knownEvals = evalIds.size;\n const evals = evalRows.length;\n const metrics = item.groupMetrics.get(node.prefix);\n const attempts = attemptsUnder(node, item.evalRows);\n const bag: CellBag = {\n entity: identityCell(node.segment, groupEntityDetail(evals, knownEvals)),\n durationMs: groupMetricValue(metrics, \"durationMs\"),\n ...(evalRows.every((row) => row.evaluationKind === \"pass\")\n ? { passRate: groupMetricValue(metrics, \"passRate\") }\n : {}),\n ...(evalRows.some((row) => row.totalScore !== undefined)\n ? {\n totalScore: {\n kind: \"score\",\n earned: evalRows.reduce((sum, row) => sum + (row.totalScore ?? 0), 0),\n } as const,\n }\n : {}),\n tokens: groupMetricValue(metrics, \"tokens\"),\n ...(metrics?.costUSD === undefined ? {} : { costUSD: measureCell(metrics.costUSD) }),\n record: evals === 0\n ? { kind: \"missing\", code: GROUP_NO_SAMPLES }\n : verdictCountsCell(attempts),\n };\n return {\n key: `group:${node.prefix}`,\n variant: \"group\",\n cells: projectCells(bag, view.columns),\n subRows: groupChildren(node.children, { ...view, labelPrefix: node.prefix }),\n };\n}\n/** 同一层的组行按主读数降序(缺数据沉底,同值按段名收口),叶子恒在组行之后。 */\nfunction groupChildren(nodes: readonly EvalLayoutNode[], view: HierarchyView): TableContentRow[] {\n const groups = nodes\n .filter((node): node is Extract<EvalLayoutNode, {\n readonly kind: \"group\";\n }> => node.kind === \"group\")\n .slice()\n .sort((left, right) => {\n const leftPrimary = view.item.groupMetrics.get(left.prefix)?.passRate.value ?? null;\n const rightPrimary = view.item.groupMetrics.get(right.prefix)?.passRate.value ?? null;\n if (leftPrimary === null && rightPrimary === null)\n return left.segment.localeCompare(right.segment);\n if (leftPrimary === null)\n return 1;\n if (rightPrimary === null)\n return -1;\n return rightPrimary - leftPrimary || left.segment.localeCompare(right.segment);\n });\n const leaves = nodes.filter((node): node is Extract<EvalLayoutNode, {\n readonly kind: \"leaf\";\n }> => node.kind === \"leaf\");\n return [\n ...groups.map((node) => groupTableRow(node, view.item, view)),\n ...leaves.map((node) => leafTableRow(node, view)),\n ];\n}\nfunction experimentRow(item: ExperimentListItem, view: HierarchyView): TableContentRow {\n const evalIds = new Set(item.evalRows.map((row) => row.evalId));\n const members: readonly EvalLayoutNode[] = experimentEvalLayout([...new Set([...evalIds, ...item.missingEvalIds])]);\n const attempts = item.evalRows.flatMap((row) => row.attempts);\n const bag: CellBag = {\n entity: textCell(item.experimentId),\n model: item.model === null ? { kind: \"notApplicable\" } : textCell(item.model),\n agent: item.agent === null ? { kind: \"notApplicable\" } : textCell(item.agent),\n durationMs: measureCell(item.durationMs),\n ...(item.evaluationKind === \"pass\" ? { passRate: measureCell(item.endToEndPassRate) } : {}),\n ...(item.totalScore === undefined ? {} : { totalScore: { kind: \"score\", earned: item.totalScore } as const }),\n tokens: measureCell(item.tokens),\n ...(item.costUSD === undefined ? {} : { costUSD: measureCell(item.costUSD) }),\n record: verdictCountsCell(attempts),\n };\n return {\n key: item.experimentId,\n cells: projectCells(bag, view.columns),\n subRows: members.length > 0 ? groupChildren(members, view) : [],\n };\n}\nexport function experimentListContent(items: readonly ExperimentListItem[]): TableContent {\n const columns = columnsWithCost(hierarchyColumns(items), items.some((item) => item.costUSD !== undefined));\n return {\n columns,\n rows: items.map((item) => experimentRow(item, { columns, item, labelPrefix: \"\" })),\n };\n}\nexport function attemptListContent(items: readonly AttemptListItem[]): TableContent {\n const columns = columnsWithCost(FLAT_ENTITY_COLUMNS, items.some((item) => item.costUSD !== undefined));\n return {\n columns,\n // 与层级表里的 attempt 行同一份格子原料,只是裁到平铺列集。\n rows: items.map((item) => attemptRow(item, columns)),\n };\n}\n"]}
@@ -6,6 +6,7 @@ const tree_ts_1 = require("../../definition/tree.cjs");
6
6
  const primitives_tsx_1 = require("../../definition/primitives.cjs");
7
7
  const compute_ts_1 = require("./compute.cjs");
8
8
  const content_ts_1 = require("./content.cjs");
9
+ const format_ts_1 = require("../../model/format.cjs");
9
10
  var compute_ts_2 = require("./compute.cjs");
10
11
  Object.defineProperty(exports, "attemptListData", { enumerable: true, get: function () { return compute_ts_2.attemptListData; } });
11
12
  Object.defineProperty(exports, "experimentListData", { enumerable: true, get: function () { return compute_ts_2.experimentListData; } });
@@ -40,8 +41,8 @@ exports.AttemptList.displayName = "AttemptList";
40
41
  exports.ExperimentTable = (0, tree_ts_1.defineComponent)(async (props, ctx) => {
41
42
  const sample = props.input ?? ctx.scope;
42
43
  const rows = props.rows ?? await (0, compute_ts_1.experimentListData)(sample, ctx.report.pricing);
43
- // 当前 facade 只发布通过制读数,默认排序恒为 passRate 降序(数据本身已按此排好)。
44
- const defaultSort = "passRate";
44
+ const composition = (0, format_ts_1.experimentListEvaluationKindComposition)(rows.map((row) => ({ evaluationKind: row.evaluationKind, attempts: row.evalRows.length })));
45
+ const defaultSort = composition === "pass" ? "passRate" : "totalScore";
45
46
  return (0, jsx_runtime_1.jsx)(primitives_tsx_1.TableContentView, { data: (0, content_ts_1.experimentListContent)(rows), sort: props.sort ?? defaultSort, searchable: props.searchable ?? true, locale: props.locale, className: props.className });
46
47
  });
47
48
  exports.ExperimentTable.displayName = "ExperimentTable";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";;;;AAIA,sDAA2D;AAC3D,mEAAmE;AAEnE,6CAAmH;AACnH,6CAAyE;AACzE,2CAA6G;AAApG,6GAAA,eAAe,OAAA;AAAE,gHAAA,kBAAkB,OAAA;AAAE,kHAAA,oBAAoB,OAAA;AAAE,+GAAA,iBAAiB,OAAA;AAErF,2CAAyE;AAAhE,gHAAA,kBAAkB,OAAA;AAAE,mHAAA,qBAAqB,OAAA;AAUlD,sEAAsE;AACzD,QAAA,WAAW,GAAG,IAAA,yBAAe,EAAmB,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;IAC9E,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,IA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,yBAAe,EAAmB,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;IAC9E,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,MAAM,IAAA,4BAAe,EAAC,KAAK,CAAC,KAAK,IAAI,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/F,OAAO,uBAAC,iCAAgB,IAAC,IAAI,EAAE,IAAA,+BAAkB,EAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC;AACjH,CAAC,CAAC,CAAC;AACH,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC;AAY3B,QAAA,eAAe,GAAG,IAAA,yBAAe,EAAuB,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;IACtF,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC;IACxC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,MAAM,IAAA,+BAAkB,EAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAChF,oDAAoD;IACpD,MAAM,WAAW,GAAG,UAAU,CAAC;IAC/B,OAAO,uBAAC,iCAAgB,IAAC,IAAI,EAAE,IAAA,kCAAqB,EAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,WAAW,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC;AAC3L,CAAC,CAAC,CAAC;AACH,uBAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["// 实体列表组合件:FailureList / AttemptList / ExperimentTable。\n// 列表本体是中立 Table 原语(TableContentView);语义全部住在 compute.ts 与\n// content.ts 的投影层,docs/feature/reports/library.md。\nimport type { Sample } from \"../../../analysis/index.ts\";\nimport { defineComponent } from \"../../definition/tree.ts\";\nimport { TableContentView } from \"../../definition/primitives.tsx\";\nimport type { ReportLocale } from \"../../model/locale.ts\";\nimport { attemptListData, experimentListData, type AttemptListItem, type ExperimentListItem, } from \"./compute.ts\";\nimport { attemptListContent, experimentListContent } from \"./content.ts\";\nexport { attemptListData, experimentListData, experimentEvalLayout, relativeEvalLabel, } from \"./compute.ts\";\nexport type { AttemptListItem, EvalLayoutNode, EvaluationKindComposition, ExperimentListEvalRow, ExperimentListItem, ExperimentMetrics, } from \"./compute.ts\";\nexport { attemptListContent, experimentListContent } from \"./content.ts\";\nexport interface FailureListProps {\n readonly limit?: number;\n /** 显式 Sample;省略时用当前组合上下文的 `ctx.scope`。 */\n readonly input?: Sample;\n /** 已闭合的行;省略时按 `input` 计算。 */\n readonly rows?: readonly AttemptListItem[];\n readonly locale?: ReportLocale;\n readonly className?: string;\n}\n/** 失败处理台:只列 failed / errored attempt,按 startedAt 新到旧、locator 升序收口。 */\nexport const FailureList = defineComponent<FailureListProps>(async (props, ctx) => {\n const sample = props.input ?? ctx.scope;\n const all = props.rows ?? await attemptListData(sample, ctx.report.pricing);\n const failures = all\n .filter((item) => item.verdict === \"failed\" || item.verdict === \"errored\")\n .sort((left, right) => {\n const leftStarted = left.startedAt ?? Number.NEGATIVE_INFINITY;\n const rightStarted = right.startedAt ?? Number.NEGATIVE_INFINITY;\n if (leftStarted !== rightStarted)\n return leftStarted > rightStarted ? -1 : 1;\n return left.locator < right.locator ? -1 : left.locator > right.locator ? 1 : 0;\n });\n const limit = props.limit ?? 20;\n return <TableContentView data={attemptListContent(failures.slice(0, limit))} locale={props.locale} className={props.className}/>;\n});\nFailureList.displayName = \"FailureList\";\nexport interface AttemptListProps {\n /** 显式 Sample;省略时用当前组合上下文的 `ctx.scope`。 */\n readonly input?: Sample;\n /** 已闭合的行;省略时按 `input` 计算。 */\n readonly rows?: readonly AttemptListItem[];\n readonly locale?: ReportLocale;\n readonly className?: string;\n}\n/** 薄组合:attemptListData + Table。顺序保持传入顺序(不重排)。 */\nexport const AttemptList = defineComponent<AttemptListProps>(async (props, ctx) => {\n const rows = props.rows ?? await attemptListData(props.input ?? ctx.scope, ctx.report.pricing);\n return <TableContentView data={attemptListContent(rows)} locale={props.locale} className={props.className}/>;\n});\nAttemptList.displayName = \"AttemptList\";\nexport interface ExperimentTableProps {\n /** 显式 Sample;省略时用当前组合上下文的 `ctx.scope`。 */\n readonly input?: Sample;\n /** 已闭合的行;省略时按 `input` 计算。 */\n readonly rows?: readonly ExperimentListItem[];\n /** 显示排序列;省略时按列表自身主读数(当前 facade 恒为 passRate)降序。 */\n readonly sort?: string;\n readonly searchable?: boolean;\n readonly locale?: ReportLocale;\n readonly className?: string;\n}\nexport const ExperimentTable = defineComponent<ExperimentTableProps>(async (props, ctx) => {\n const sample = props.input ?? ctx.scope;\n const rows = props.rows ?? await experimentListData(sample, ctx.report.pricing);\n // 当前 facade 只发布通过制读数,默认排序恒为 passRate 降序(数据本身已按此排好)。\n const defaultSort = \"passRate\";\n return <TableContentView data={experimentListContent(rows)} sort={props.sort ?? defaultSort} searchable={props.searchable ?? true} locale={props.locale} className={props.className}/>;\n});\nExperimentTable.displayName = \"ExperimentTable\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";;;;AAIA,sDAA2D;AAC3D,mEAAmE;AAEnE,6CAAmH;AACnH,6CAAyE;AACzE,qDAAgF;AAChF,2CAA6G;AAApG,6GAAA,eAAe,OAAA;AAAE,gHAAA,kBAAkB,OAAA;AAAE,kHAAA,oBAAoB,OAAA;AAAE,+GAAA,iBAAiB,OAAA;AAErF,2CAAyE;AAAhE,gHAAA,kBAAkB,OAAA;AAAE,mHAAA,qBAAqB,OAAA;AAUlD,sEAAsE;AACzD,QAAA,WAAW,GAAG,IAAA,yBAAe,EAAmB,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE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,WAAW,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC;AAC3L,CAAC,CAAC,CAAC;AACH,uBAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["// 实体列表组合件:FailureList / AttemptList / ExperimentTable。\n// 列表本体是中立 Table 原语(TableContentView);语义全部住在 compute.ts 与\n// content.ts 的投影层,docs/feature/reports/library.md。\nimport type { Sample } from \"../../../analysis/index.ts\";\nimport { defineComponent } from \"../../definition/tree.ts\";\nimport { TableContentView } from \"../../definition/primitives.tsx\";\nimport type { ReportLocale } from \"../../model/locale.ts\";\nimport { attemptListData, experimentListData, type AttemptListItem, type ExperimentListItem, } from \"./compute.ts\";\nimport { attemptListContent, experimentListContent } from \"./content.ts\";\nimport { experimentListEvaluationKindComposition } from \"../../model/format.ts\";\nexport { attemptListData, experimentListData, experimentEvalLayout, relativeEvalLabel, } from \"./compute.ts\";\nexport type { AttemptListItem, EvalLayoutNode, EvaluationKindComposition, ExperimentListEvalRow, ExperimentListItem, ExperimentMetrics, } from \"./compute.ts\";\nexport { attemptListContent, experimentListContent } from \"./content.ts\";\nexport interface FailureListProps {\n readonly limit?: number;\n /** 显式 Sample;省略时用当前组合上下文的 `ctx.scope`。 */\n readonly input?: Sample;\n /** 已闭合的行;省略时按 `input` 计算。 */\n readonly rows?: readonly AttemptListItem[];\n readonly locale?: ReportLocale;\n readonly className?: string;\n}\n/** 失败处理台:只列 failed / errored attempt,按 startedAt 新到旧、locator 升序收口。 */\nexport const FailureList = defineComponent<FailureListProps>(async (props, ctx) => {\n const sample = props.input ?? ctx.scope;\n const all = props.rows ?? await attemptListData(sample, ctx.report.pricing);\n const failures = all\n .filter((item) => item.verdict === \"failed\" || item.verdict === \"errored\")\n .sort((left, right) => {\n const leftStarted = left.startedAt ?? Number.NEGATIVE_INFINITY;\n const rightStarted = right.startedAt ?? Number.NEGATIVE_INFINITY;\n if (leftStarted !== rightStarted)\n return leftStarted > rightStarted ? -1 : 1;\n return left.locator < right.locator ? -1 : left.locator > right.locator ? 1 : 0;\n });\n const limit = props.limit ?? 20;\n return <TableContentView data={attemptListContent(failures.slice(0, limit))} locale={props.locale} className={props.className}/>;\n});\nFailureList.displayName = \"FailureList\";\nexport interface AttemptListProps {\n /** 显式 Sample;省略时用当前组合上下文的 `ctx.scope`。 */\n readonly input?: Sample;\n /** 已闭合的行;省略时按 `input` 计算。 */\n readonly rows?: readonly AttemptListItem[];\n readonly locale?: ReportLocale;\n readonly className?: string;\n}\n/** 薄组合:attemptListData + Table。顺序保持传入顺序(不重排)。 */\nexport const AttemptList = defineComponent<AttemptListProps>(async (props, ctx) => {\n const rows = props.rows ?? await attemptListData(props.input ?? ctx.scope, ctx.report.pricing);\n return <TableContentView data={attemptListContent(rows)} locale={props.locale} className={props.className}/>;\n});\nAttemptList.displayName = \"AttemptList\";\nexport interface ExperimentTableProps {\n /** 显式 Sample;省略时用当前组合上下文的 `ctx.scope`。 */\n readonly input?: Sample;\n /** 已闭合的行;省略时按 `input` 计算。 */\n readonly rows?: readonly ExperimentListItem[];\n /** 显示排序列;省略时按列表自身题型选择 passRate 或 totalScore。 */\n readonly sort?: string;\n readonly searchable?: boolean;\n readonly locale?: ReportLocale;\n readonly className?: string;\n}\nexport const ExperimentTable = defineComponent<ExperimentTableProps>(async (props, ctx) => {\n const sample = props.input ?? ctx.scope;\n const rows = props.rows ?? await experimentListData(sample, ctx.report.pricing);\n const composition = experimentListEvaluationKindComposition(rows.map((row) => ({ evaluationKind: row.evaluationKind, attempts: row.evalRows.length })));\n const defaultSort = composition === \"pass\" ? \"passRate\" : \"totalScore\";\n return <TableContentView data={experimentListContent(rows)} sort={props.sort ?? defaultSort} searchable={props.searchable ?? true} locale={props.locale} className={props.className}/>;\n});\nExperimentTable.displayName = \"ExperimentTable\";\n"]}
@@ -30,7 +30,7 @@ export interface ExperimentTableProps {
30
30
  readonly input?: Sample;
31
31
  /** 已闭合的行;省略时按 `input` 计算。 */
32
32
  readonly rows?: readonly ExperimentListItem[];
33
- /** 显示排序列;省略时按列表自身主读数(当前 facade 恒为 passRate)降序。 */
33
+ /** 显示排序列;省略时按列表自身题型选择 passRate 或 totalScore。 */
34
34
  readonly sort?: string;
35
35
  readonly searchable?: boolean;
36
36
  readonly locale?: ReportLocale;
@@ -30,7 +30,7 @@ export interface ExperimentTableProps {
30
30
  readonly input?: Sample;
31
31
  /** 已闭合的行;省略时按 `input` 计算。 */
32
32
  readonly rows?: readonly ExperimentListItem[];
33
- /** 显示排序列;省略时按列表自身主读数(当前 facade 恒为 passRate)降序。 */
33
+ /** 显示排序列;省略时按列表自身题型选择 passRate 或 totalScore。 */
34
34
  readonly sort?: string;
35
35
  readonly searchable?: boolean;
36
36
  readonly locale?: ReportLocale;
@@ -30,7 +30,7 @@ export interface ExperimentTableProps {
30
30
  readonly input?: Sample;
31
31
  /** 已闭合的行;省略时按 `input` 计算。 */
32
32
  readonly rows?: readonly ExperimentListItem[];
33
- /** 显示排序列;省略时按列表自身主读数(当前 facade 恒为 passRate)降序。 */
33
+ /** 显示排序列;省略时按列表自身题型选择 passRate 或 totalScore。 */
34
34
  readonly sort?: string;
35
35
  readonly searchable?: boolean;
36
36
  readonly locale?: ReportLocale;
@@ -52,6 +52,9 @@ function formatCellText(cell, locale) {
52
52
  const closed = (0, pricing_ts_1.formatCostProjectionCellText)(cell.metric, locale ?? locale_ts_1.DEFAULT_REPORT_LOCALE);
53
53
  return closed.detail ? `${closed.text}\n ${closed.detail}` : closed.text;
54
54
  }
55
+ if (cell.showCoverage === false) {
56
+ return (0, format_ts_1.formatMetricScalar)(cell.metric.value, cell.metric.unit, cell.metric.format, locale ?? locale_ts_1.DEFAULT_REPORT_LOCALE);
57
+ }
55
58
  return (0, format_ts_1.formatMetricValue)(cell.metric, locale ?? locale_ts_1.DEFAULT_REPORT_LOCALE);
56
59
  }
57
60
  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id / Stat 共用这份判别联合;自定义 Source 要交给这些原语必须适配成这个形状。\nimport type { AttemptLocator } from \"../../attempt-locator.ts\";\nimport type { LocalizedText } from \"../../shared/types.ts\";\nimport type { Verdict } from \"../../shared/types.ts\";\nimport type { MetricValue } from \"../../analysis/index.ts\";\nimport { formatMetricValue, missingText, verdictMark } from \"../model/format.ts\";\nimport { formatCostProjectionCellText, isCostMetricValue } from \"../model/pricing.ts\";\nimport { DEFAULT_REPORT_LOCALE, localeText, resolveLocalizedText, type ReportLocale, } from \"../model/locale.ts\";\n/** 判定计票:passed / failed / errored / skipped。 */\nexport interface VerdictCounts {\n readonly passed: number;\n readonly failed: number;\n readonly errored: number;\n readonly skipped: number;\n}\n/**\n * 官方表格一格。三条不变量:\n * - metric 格永远带证据(不得压成 text);\n * - notApplicable 与 missing 不合并;\n * - summary 的文本已在上游折好。\n */\nexport type Cell = {\n readonly kind: \"metric\";\n readonly metric: MetricValue;\n} | {\n readonly kind: \"verdict\";\n readonly verdict?: Verdict | \"skipped\";\n readonly counts?: VerdictCounts;\n /** 计票覆盖的 attempt 引用(有证据可下钻的计票格才携带,如稳定性矩阵)。 */\n readonly refs?: readonly AttemptLocator[];\n // 两种形态:counts = 判定构成计票(experiment / Eval 行);verdict = 单判定(attempt 行)。\n // 格子只带值,计票怎么来的(折叠、分桶)在实体投影侧,渲染面不算数。\n /** 单判定形态省略判定词、只留判定符(如对照矩阵逐格只放得下一个符号的场景)。 */\n readonly bare?: boolean;\n} | {\n readonly kind: \"score\";\n readonly earned: number;\n readonly possible?: number;\n} | {\n readonly kind: \"summary\";\n readonly text: string;\n readonly more?: number;\n} | {\n readonly kind: \"locator\";\n readonly locator: AttemptLocator;\n /** 有判定的 attempt 行:判定长在 locator 上(判定符 + 语义色),没有判定就省略。 */\n readonly verdict?: Verdict | \"skipped\";\n} | {\n readonly kind: \"text\";\n readonly text: string;\n readonly detail?: string;\n} | {\n readonly kind: \"notApplicable\";\n} | {\n readonly kind: \"missing\";\n readonly code: string;\n /** 补上这一格的命令,可直接复制(如 `niceeval exp <experimentId>`)。 */\n readonly detail?: string;\n};\nexport interface ColumnSpec {\n readonly key: string;\n readonly unit?: string;\n readonly better?: \"higher\" | \"lower\";\n /**\n * 列表头。text / web 两面按当前 locale 解析同一份;省略时按 key 原样显示\n * (维度值列——条件名、实验 id 这类列名即数据的列——用这一支)。\n * Table 原语自己不携带列名词表,表头只来自这里\n * (docs/feature/reports/library.md「Content 协议」)。\n */\n readonly header?: LocalizedText;\n}\n/**\n * 表行 Content。与布局原语 `Row` 组件不同名。\n * placeholder 行照常渲染,但不进任何列的聚合读数。\n * group 行的读数由自己的 subRows 聚合而来,不是一条独立事实。\n */\nexport interface TableContentRow {\n readonly key: string;\n readonly cells: Readonly<Record<string, Cell>>;\n readonly subRows?: readonly TableContentRow[];\n /** group 行的读数由自己的 subRows 聚合而来,不是一条独立事实。 */\n readonly variant?: \"normal\" | \"placeholder\" | \"group\";\n}\nexport interface TableContent {\n readonly columns: readonly ColumnSpec[];\n readonly rows: readonly TableContentRow[];\n}\n/** 把 Cell 折成 text 面可见字符串(缺数据 / 不适用统一不补成 0)。 */\nexport function formatCellText(cell: Cell | null | undefined, locale?: ReportLocale): string {\n if (cell == null)\n return \"—\";\n switch (cell.kind) {\n case \"notApplicable\":\n return \"—\";\n case \"missing\": {\n const loc = locale ?? DEFAULT_REPORT_LOCALE;\n const reason = missingText(cell.code, loc);\n return cell.detail ? `${reason} · ${cell.detail}` : reason;\n }\n case \"text\":\n return cell.detail ? `${cell.text}\\n ${cell.detail}` : cell.text;\n case \"locator\": {\n const mark = cell.verdict !== undefined ? `${verdictMark(cell.verdict === \"skipped\" ? \"skipped\" : cell.verdict)} ` : \"\";\n return `${mark}${cell.locator}`;\n }\n case \"summary\": {\n const more = cell.more && cell.more > 0 ? ` +${cell.more} more` : \"\";\n return `${cell.text}${more}`;\n }\n case \"score\":\n return cell.possible !== undefined ? `${cell.earned} / ${cell.possible}` : String(cell.earned);\n case \"verdict\": {\n const loc = locale ?? DEFAULT_REPORT_LOCALE;\n if (cell.counts) {\n const parts = ([\"passed\", \"failed\", \"errored\", \"skipped\"] as const)\n .filter((k) => cell.counts![k] > 0)\n .map((k) => `${cell.counts![k]} ${localeText(loc, `verdict.${k === \"skipped\" ? \"skipped\" : k}`)}`);\n return parts.join(\" · \") || \"—\";\n }\n if (cell.verdict !== undefined) {\n const v = cell.verdict === \"skipped\" ? \"skipped\" : cell.verdict;\n // 判定符与判定词同场,与 locator 格、web 面同一条纪律:单色打印下照样读得出。\n // bare 省略判定词,只留判定符,供逐格空间紧张的场景(如对照矩阵)使用。\n if (cell.bare)\n return verdictMark(v);\n return `${verdictMark(v)} ${localeText(loc, `verdict.${v}`)}`;\n }\n return \"—\";\n }\n case \"metric\": {\n if (isCostMetricValue(cell.metric)) {\n const closed = formatCostProjectionCellText(cell.metric, locale ?? DEFAULT_REPORT_LOCALE);\n return closed.detail ? `${closed.text}\\n ${closed.detail}` : closed.text;\n }\n return formatMetricValue(cell.metric, locale ?? DEFAULT_REPORT_LOCALE);\n }\n default: {\n const _exhaustive: never = cell;\n return _exhaustive;\n }\n }\n}\n/** 把 TableContent 展平为 text 排版器用的预格式化行(含 subRows 缩进前缀)。 */\nexport function flattenTableContentForText(content: TableContent, locale?: string): {\n columns: Array<{\n key: string;\n header: string;\n align?: \"left\" | \"right\";\n }>;\n /** depth 是行树里的层数(顶层 0);text 面按它画组边界横线,不认识具体实体。 */\n rows: Array<{\n key: string;\n cells: Record<string, string | null>;\n variant?: string;\n depth: number;\n }>;\n} {\n // 表头与 web 面同源:走列声明的 header,缺省才回落 key。\n const columns = content.columns.map((c) => ({\n key: c.key,\n header: c.header !== undefined ? resolveLocalizedText(c.header, locale ?? DEFAULT_REPORT_LOCALE) : c.key,\n align: (c.better ? \"right\" : \"left\") as \"left\" | \"right\",\n }));\n const rows: Array<{\n key: string;\n cells: Record<string, string | null>;\n variant?: string;\n depth: number;\n }> = [];\n const walk = (row: TableContentRow, depth: number): void => {\n const cells: Record<string, string | null> = {};\n for (const col of content.columns) {\n const cell = row.cells[col.key];\n let text = formatCellText(cell, locale);\n if (depth > 0 && col === content.columns[0] && text !== \"—\") {\n text = `${\" \".repeat(depth)}${text}`;\n }\n cells[col.key] = text;\n }\n rows.push({ key: row.key, cells, variant: row.variant, depth });\n for (const child of row.subRows ?? [])\n walk(child, depth + 1);\n };\n for (const row of content.rows)\n walk(row, 0);\n return { columns, rows };\n}\n"]}
1
+ {"version":3,"file":"cell.js","sourceRoot":"","sources":["cell.tsx"],"names":[],"mappings":";;AA2FA,wCAwDC;AAED,gEA2CC;AA1LD,kDAAqG;AACrG,oDAAsF;AACtF,kDAAiH;AAkFjH,+CAA+C;AAC/C,SAAgB,cAAc,CAAC,IAA6B,EAAE,MAAqB;IAC/E,IAAI,IAAI,IAAI,IAAI;QACZ,OAAO,GAAG,CAAC;IACf,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAChB,KAAK,eAAe;YAChB,OAAO,GAAG,CAAC;QACf,KAAK,SAAS,CAAC,CAAC,CAAC;YACb,MAAM,GAAG,GAAG,MAAM,IAAI,iCAAqB,CAAC;YAC5C,MAAM,MAAM,GAAG,IAAA,uBAAW,EAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAC3C,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;QAC/D,CAAC;QACD,KAAK,MAAM;YACP,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACtE,KAAK,SAAS,CAAC,CAAC,CAAC;YACb,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,IAAA,uBAAW,EAAC,IAAI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B,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QAChE,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,OAAO,IAAI,EAAE;YACjC,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IAC/B,CAAC,CAAC;IACF,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,IAAI;QAC1B,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["// 官方表格数据协议的单元格类型(docs/feature/reports/library.md「单元格类型」)。\n// Table / Grid / Stat 共用这份判别联合;自定义 Source 要交给这些原语必须适配成这个形状。\nimport type { AttemptLocator } from \"../../attempt-locator.ts\";\nimport type { LocalizedText } from \"../../shared/types.ts\";\nimport type { Verdict } from \"../../shared/types.ts\";\nimport type { MetricValue } from \"../../analysis/index.ts\";\nimport { formatMetricScalar, formatMetricValue, missingText, verdictMark } from \"../model/format.ts\";\nimport { formatCostProjectionCellText, isCostMetricValue } from \"../model/pricing.ts\";\nimport { DEFAULT_REPORT_LOCALE, localeText, resolveLocalizedText, type ReportLocale, } from \"../model/locale.ts\";\n/** 判定计票:passed / failed / errored / skipped。 */\nexport interface VerdictCounts {\n readonly passed: number;\n readonly failed: number;\n readonly errored: number;\n readonly skipped: number;\n}\n/**\n * 官方表格一格。三条不变量:\n * - metric 格永远带证据(不得压成 text);\n * - notApplicable 与 missing 不合并;\n * - summary 的文本已在上游折好。\n */\nexport type Cell = {\n readonly kind: \"metric\";\n readonly metric: MetricValue;\n /** Hide the compact samples/total suffix only when an adjacent region presents coverage. */\n readonly showCoverage?: boolean;\n} | {\n readonly kind: \"verdict\";\n readonly verdict?: Verdict | \"skipped\";\n readonly counts?: VerdictCounts;\n /** 计票覆盖的 attempt 引用(有证据可下钻的计票格才携带,如稳定性矩阵)。 */\n readonly refs?: readonly AttemptLocator[];\n // 两种形态:counts = 判定构成计票(experiment / Eval 行);verdict = 单判定(attempt 行)。\n // 格子只带值,计票怎么来的(折叠、分桶)在实体投影侧,渲染面不算数。\n /** 单判定形态省略判定词、只留判定符(如对照矩阵逐格只放得下一个符号的场景)。 */\n readonly bare?: boolean;\n} | {\n readonly kind: \"score\";\n readonly earned: number;\n readonly possible?: number;\n} | {\n readonly kind: \"summary\";\n readonly text: string;\n readonly more?: number;\n} | {\n readonly kind: \"locator\";\n readonly locator: AttemptLocator;\n /** 有判定的 attempt 行:判定长在 locator 上(判定符 + 语义色),没有判定就省略。 */\n readonly verdict?: Verdict | \"skipped\";\n} | {\n readonly kind: \"text\";\n readonly text: string;\n readonly detail?: string;\n} | {\n readonly kind: \"notApplicable\";\n} | {\n readonly kind: \"missing\";\n readonly code: string;\n /** 补上这一格的命令,可直接复制(如 `niceeval exp <experimentId>`)。 */\n readonly detail?: string;\n};\nexport interface ColumnSpec {\n readonly key: string;\n readonly unit?: string;\n readonly better?: \"higher\" | \"lower\";\n /**\n * 列表头。text / web 两面按当前 locale 解析同一份;省略时按 key 原样显示\n * (维度值列——条件名、实验 id 这类列名即数据的列——用这一支)。\n * Table 原语自己不携带列名词表,表头只来自这里\n * (docs/feature/reports/library.md「Content 协议」)。\n */\n readonly header?: LocalizedText;\n}\n/**\n * 表行 Content。与布局原语 `Row` 组件不同名。\n * placeholder 行照常渲染,但不进任何列的聚合读数。\n * group 行的读数由自己的 subRows 聚合而来,不是一条独立事实。\n */\nexport interface TableContentRow {\n readonly key: string;\n readonly cells: Readonly<Record<string, Cell>>;\n readonly subRows?: readonly TableContentRow[];\n /** group 行的读数由自己的 subRows 聚合而来,不是一条独立事实。 */\n readonly variant?: \"normal\" | \"placeholder\" | \"group\";\n}\nexport interface TableContent {\n readonly columns: readonly ColumnSpec[];\n readonly rows: readonly TableContentRow[];\n}\n/** 把 Cell 折成 text 面可见字符串(缺数据 / 不适用统一不补成 0)。 */\nexport function formatCellText(cell: Cell | null | undefined, locale?: ReportLocale): string {\n if (cell == null)\n return \"—\";\n switch (cell.kind) {\n case \"notApplicable\":\n return \"—\";\n case \"missing\": {\n const loc = locale ?? DEFAULT_REPORT_LOCALE;\n const reason = missingText(cell.code, loc);\n return cell.detail ? `${reason} · ${cell.detail}` : reason;\n }\n case \"text\":\n return cell.detail ? `${cell.text}\\n ${cell.detail}` : cell.text;\n case \"locator\": {\n const mark = cell.verdict !== undefined ? `${verdictMark(cell.verdict === \"skipped\" ? \"skipped\" : cell.verdict)} ` : \"\";\n return `${mark}${cell.locator}`;\n }\n case \"summary\": {\n const more = cell.more && cell.more > 0 ? ` +${cell.more} more` : \"\";\n return `${cell.text}${more}`;\n }\n case \"score\":\n return cell.possible !== undefined ? `${cell.earned} / ${cell.possible}` : String(cell.earned);\n case \"verdict\": {\n const loc = locale ?? DEFAULT_REPORT_LOCALE;\n if (cell.counts) {\n const parts = ([\"passed\", \"failed\", \"errored\", \"skipped\"] as const)\n .filter((k) => cell.counts![k] > 0)\n .map((k) => `${cell.counts![k]} ${localeText(loc, `verdict.${k === \"skipped\" ? \"skipped\" : k}`)}`);\n return parts.join(\" · \") || \"—\";\n }\n if (cell.verdict !== undefined) {\n const v = cell.verdict === \"skipped\" ? \"skipped\" : cell.verdict;\n // 判定符与判定词同场,与 locator 格、web 面同一条纪律:单色打印下照样读得出。\n // bare 省略判定词,只留判定符,供逐格空间紧张的场景(如对照矩阵)使用。\n if (cell.bare)\n return verdictMark(v);\n return `${verdictMark(v)} ${localeText(loc, `verdict.${v}`)}`;\n }\n return \"—\";\n }\n case \"metric\": {\n if (isCostMetricValue(cell.metric)) {\n const closed = formatCostProjectionCellText(cell.metric, locale ?? DEFAULT_REPORT_LOCALE);\n return closed.detail ? `${closed.text}\\n ${closed.detail}` : closed.text;\n }\n if (cell.showCoverage === false) {\n return formatMetricScalar(cell.metric.value, cell.metric.unit, cell.metric.format, locale ?? DEFAULT_REPORT_LOCALE);\n }\n return formatMetricValue(cell.metric, locale ?? DEFAULT_REPORT_LOCALE);\n }\n default: {\n const _exhaustive: never = cell;\n return _exhaustive;\n }\n }\n}\n/** 把 TableContent 展平为 text 排版器用的预格式化行(含 subRows 缩进前缀)。 */\nexport function flattenTableContentForText(content: TableContent, locale?: string): {\n columns: Array<{\n key: string;\n header: string;\n align?: \"left\" | \"right\";\n }>;\n /** depth 是行树里的层数(顶层 0);text 面按它画组边界横线,不认识具体实体。 */\n rows: Array<{\n key: string;\n cells: Record<string, string | null>;\n variant?: string;\n depth: number;\n }>;\n} {\n // 表头与 web 面同源:走列声明的 header,缺省才回落 key。\n const columns = content.columns.map((c) => ({\n key: c.key,\n header: c.header !== undefined ? resolveLocalizedText(c.header, locale ?? DEFAULT_REPORT_LOCALE) : c.key,\n align: (c.better ? \"right\" : \"left\") as \"left\" | \"right\",\n }));\n const rows: Array<{\n key: string;\n cells: Record<string, string | null>;\n variant?: string;\n depth: number;\n }> = [];\n const walk = (row: TableContentRow, depth: number): void => {\n const cells: Record<string, string | null> = {};\n for (const col of content.columns) {\n const cell = row.cells[col.key];\n let text = formatCellText(cell, locale);\n if (depth > 0 && col === content.columns[0] && text !== \"—\") {\n text = `${\" \".repeat(depth)}${text}`;\n }\n cells[col.key] = text;\n }\n rows.push({ key: row.key, cells, variant: row.variant, depth });\n for (const child of row.subRows ?? [])\n walk(child, depth + 1);\n };\n for (const row of content.rows)\n walk(row, 0);\n return { columns, rows };\n}\n"]}
@@ -19,6 +19,8 @@ export interface VerdictCounts {
19
19
  export type Cell = {
20
20
  readonly kind: "metric";
21
21
  readonly metric: MetricValue;
22
+ /** Hide the compact samples/total suffix only when an adjacent region presents coverage. */
23
+ readonly showCoverage?: boolean;
22
24
  } | {
23
25
  readonly kind: "verdict";
24
26
  readonly verdict?: Verdict | "skipped";
@@ -19,6 +19,8 @@ export interface VerdictCounts {
19
19
  export type Cell = {
20
20
  readonly kind: "metric";
21
21
  readonly metric: MetricValue;
22
+ /** Hide the compact samples/total suffix only when an adjacent region presents coverage. */
23
+ readonly showCoverage?: boolean;
22
24
  } | {
23
25
  readonly kind: "verdict";
24
26
  readonly verdict?: Verdict | "skipped";
@@ -19,6 +19,8 @@ export interface VerdictCounts {
19
19
  export type Cell = {
20
20
  readonly kind: "metric";
21
21
  readonly metric: MetricValue;
22
+ /** Hide the compact samples/total suffix only when an adjacent region presents coverage. */
23
+ readonly showCoverage?: boolean;
22
24
  } | {
23
25
  readonly kind: "verdict";
24
26
  readonly verdict?: Verdict | "skipped";
@@ -469,7 +469,14 @@ function plainRowsToTableContent(rows, columnSpecs, locale) {
469
469
  throw new Error("Table needs at least one column: pass columns, or provide a non-empty rows array with fields.");
470
470
  }
471
471
  const columns = columnSpecs.map((spec) => {
472
- const sample = rows.map((row) => row[spec.field]).find(metrics_ts_1.isMetricValue);
472
+ const sample = rows
473
+ .map((row) => {
474
+ const value = row[spec.field];
475
+ if ((0, metrics_ts_1.isMetricValue)(value))
476
+ return value;
477
+ return isPlainCellValue(value) && value.kind === "metric" ? value.metric : undefined;
478
+ })
479
+ .find((value) => value !== undefined);
473
480
  // 语义适配:当前 MetricValue.better 含 "neutral";列排序方向只认 higher/lower。
474
481
  const better = sample?.better === "higher" || sample?.better === "lower" ? sample.better : undefined;
475
482
  return {
@@ -634,7 +641,7 @@ function renderCellWeb(cell, ctx) {
634
641
  return ((0, jsx_runtime_1.jsxs)("span", { className: cx("niceeval-verdict", `niceeval-verdict-${verdict}`), children: [(0, format_ts_1.verdictMark)(verdict === "skipped" ? "skipped" : verdict), !cell.bare ? (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [" ", (0, locale_ts_1.localeText)(ctx.locale, `verdict.${verdict === "skipped" ? "skipped" : verdict}`)] }) : null] }));
635
642
  }
636
643
  case "metric":
637
- return ((0, jsx_runtime_1.jsx)(MetricCellView, { cell: cell.metric, href: ctx.showMeasureRefs === false ? undefined : ctx.href, locale: ctx.locale }));
644
+ return ((0, jsx_runtime_1.jsx)(MetricCellView, { cell: cell.metric, href: ctx.showMeasureRefs === false ? undefined : ctx.href, locale: ctx.locale, showCoverage: cell.showCoverage !== false }));
638
645
  default: {
639
646
  const _e = cell;
640
647
  return _e;