niceeval 0.9.1 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (432) hide show
  1. package/INDEX.md +31 -33
  2. package/dist/agents/types.d.ts +20 -17
  3. package/dist/context/types.d.ts +21 -21
  4. package/dist/i18n/en.d.ts +10 -2
  5. package/dist/i18n/zh-CN.d.ts +14 -6
  6. package/dist/o11y/execution-tree.d.ts +103 -0
  7. package/dist/o11y/otlp/select.d.ts +22 -0
  8. package/dist/report/{react → assets}/colors.d.ts +8 -0
  9. package/dist/report/{react → assets}/colors.js +23 -0
  10. package/dist/report/built-in/index.d.ts +2 -2
  11. package/dist/report/built-in/index.js +2 -2
  12. package/dist/report/built-in/standard.d.ts +8 -1
  13. package/dist/report/built-in/standard.js +17 -7
  14. package/dist/report/components/attempt-detail/AttemptAssertions.d.ts +6 -0
  15. package/dist/report/components/attempt-detail/AttemptAssertions.js +17 -0
  16. package/dist/report/components/attempt-detail/AttemptConversation.d.ts +10 -0
  17. package/dist/report/components/attempt-detail/AttemptConversation.js +74 -0
  18. package/dist/report/components/attempt-detail/AttemptDiagnostics.d.ts +6 -0
  19. package/dist/report/components/attempt-detail/AttemptDiagnostics.js +7 -0
  20. package/dist/report/components/attempt-detail/AttemptDiff.d.ts +6 -0
  21. package/dist/report/components/attempt-detail/AttemptDiff.js +11 -0
  22. package/dist/report/components/attempt-detail/AttemptError.d.ts +6 -0
  23. package/dist/report/components/attempt-detail/AttemptError.js +16 -0
  24. package/dist/report/components/attempt-detail/AttemptFixPrompt.d.ts +6 -0
  25. package/dist/report/components/attempt-detail/AttemptFixPrompt.js +7 -0
  26. package/dist/report/components/attempt-detail/AttemptSource.d.ts +6 -0
  27. package/dist/report/components/attempt-detail/AttemptSource.js +97 -0
  28. package/dist/report/components/attempt-detail/AttemptSummary.d.ts +8 -0
  29. package/dist/report/components/attempt-detail/AttemptSummary.js +20 -0
  30. package/dist/report/components/attempt-detail/AttemptTimeline.d.ts +6 -0
  31. package/dist/report/components/attempt-detail/AttemptTimeline.js +28 -0
  32. package/dist/report/components/attempt-detail/AttemptTrace.d.ts +6 -0
  33. package/dist/report/components/attempt-detail/AttemptTrace.js +29 -0
  34. package/dist/report/components/attempt-detail/AttemptUsage.d.ts +6 -0
  35. package/dist/report/components/attempt-detail/AttemptUsage.js +20 -0
  36. package/dist/report/components/attempt-detail/compute.d.ts +24 -0
  37. package/dist/report/components/attempt-detail/compute.js +297 -0
  38. package/dist/report/components/attempt-detail/faces.d.ts +14 -0
  39. package/dist/report/components/attempt-detail/faces.js +239 -0
  40. package/dist/report/components/attempt-detail/index.d.ts +38 -0
  41. package/dist/report/components/attempt-detail/index.js +547 -0
  42. package/dist/report/{react → components}/cell.d.ts +5 -3
  43. package/dist/report/{react → components}/cell.js +3 -3
  44. package/dist/report/{react → components/entity-lists}/AttemptList.d.ts +8 -4
  45. package/dist/report/{react → components/entity-lists}/AttemptList.js +16 -10
  46. package/dist/report/{react → components/entity-lists}/EvalList.d.ts +3 -3
  47. package/dist/report/{react → components/entity-lists}/EvalList.js +0 -0
  48. package/dist/report/{react → components/entity-lists}/ExperimentList.d.ts +4 -5
  49. package/dist/report/{react → components/entity-lists}/ExperimentList.js +12 -11
  50. package/dist/report/components/entity-lists/compute.d.ts +23 -0
  51. package/dist/report/components/entity-lists/compute.js +171 -0
  52. package/dist/report/components/entity-lists/faces.d.ts +5 -0
  53. package/dist/report/components/entity-lists/faces.js +175 -0
  54. package/dist/report/components/entity-lists/index.d.ts +49 -0
  55. package/dist/report/components/entity-lists/index.js +169 -0
  56. package/dist/report/{react → components}/fixtures.d.ts +2 -2
  57. package/dist/report/{react → components}/fixtures.js +1 -1
  58. package/dist/report/{react → components/metric-views}/DeltaTable.d.ts +2 -2
  59. package/dist/report/{react → components/metric-views}/DeltaTable.js +4 -4
  60. package/dist/report/{react → components/metric-views}/MetricBars.d.ts +3 -3
  61. package/dist/report/{react → components/metric-views}/MetricBars.js +3 -3
  62. package/dist/report/{react → components/metric-views}/MetricLine.d.ts +2 -2
  63. package/dist/report/{react → components/metric-views}/MetricLine.js +8 -5
  64. package/dist/report/{react → components/metric-views}/MetricMatrix.d.ts +3 -3
  65. package/dist/report/{react → components/metric-views}/MetricMatrix.js +4 -4
  66. package/dist/report/components/metric-views/MetricScatter.d.ts +11 -0
  67. package/dist/report/{react → components/metric-views}/MetricScatter.js +27 -60
  68. package/dist/report/{react → components/metric-views}/MetricTable.d.ts +3 -3
  69. package/dist/report/{react → components/metric-views}/MetricTable.js +4 -4
  70. package/dist/report/{react → components/metric-views}/Scoreboard.d.ts +2 -2
  71. package/dist/report/{react → components/metric-views}/Scoreboard.js +3 -3
  72. package/dist/report/components/metric-views/compute.d.ts +89 -0
  73. package/dist/report/{compute.js → components/metric-views/compute.js} +32 -415
  74. package/dist/report/components/metric-views/faces.d.ts +13 -0
  75. package/dist/report/components/metric-views/faces.js +381 -0
  76. package/dist/report/components/metric-views/index.d.ts +50 -0
  77. package/dist/report/components/metric-views/index.js +273 -0
  78. package/dist/report/{text → components/metric-views}/plot.js +1 -1
  79. package/dist/report/components/shared-compute.d.ts +22 -0
  80. package/dist/report/components/shared-compute.js +47 -0
  81. package/dist/report/components/shared-faces.d.ts +9 -0
  82. package/dist/report/components/shared-faces.js +26 -0
  83. package/dist/report/components/shared.d.ts +68 -0
  84. package/dist/report/components/shared.js +125 -0
  85. package/dist/report/{react → components/site-components}/CopyFixPrompt.d.ts +2 -2
  86. package/dist/report/{react → components/site-components}/CopyFixPrompt.js +2 -2
  87. package/dist/report/{react → components/site-components}/HeroCard.d.ts +2 -2
  88. package/dist/report/{react → components/site-components}/HeroCard.js +2 -2
  89. package/dist/report/{react → components/site-components}/ScopeWarnings.d.ts +2 -2
  90. package/dist/report/{react → components/site-components}/ScopeWarnings.js +3 -3
  91. package/dist/report/{react → components/site-components}/TraceWaterfall.d.ts +3 -3
  92. package/dist/report/{react → components/site-components}/TraceWaterfall.js +5 -5
  93. package/dist/report/components/site-components/compute.d.ts +28 -0
  94. package/dist/report/components/site-components/compute.js +132 -0
  95. package/dist/report/components/site-components/faces.d.ts +21 -0
  96. package/dist/report/components/site-components/faces.js +75 -0
  97. package/dist/report/components/site-components/index.d.ts +74 -0
  98. package/dist/report/components/site-components/index.js +220 -0
  99. package/dist/report/{scope-warnings.d.ts → components/site-components/scope-warnings.d.ts} +2 -2
  100. package/dist/report/{scope-warnings.js → components/site-components/scope-warnings.js} +2 -2
  101. package/dist/report/{react → components/summaries}/ScopeSummary.d.ts +2 -2
  102. package/dist/report/{react → components/summaries}/ScopeSummary.js +17 -8
  103. package/dist/report/components/summaries/compute.d.ts +7 -0
  104. package/dist/report/components/summaries/compute.js +51 -0
  105. package/dist/report/components/summaries/faces.d.ts +7 -0
  106. package/dist/report/components/summaries/faces.js +38 -0
  107. package/dist/report/components/summaries/index.d.ts +27 -0
  108. package/dist/report/components/summaries/index.js +78 -0
  109. package/dist/report/definition/grid-layout.d.ts +50 -0
  110. package/dist/report/definition/grid-layout.js +89 -0
  111. package/dist/report/{primitives.d.ts → definition/primitives.d.ts} +34 -4
  112. package/dist/report/{primitives.js → definition/primitives.js} +101 -10
  113. package/dist/report/{report.d.ts → definition/report.d.ts} +36 -65
  114. package/dist/report/{report.js → definition/report.js} +58 -90
  115. package/dist/report/{text/table.d.ts → definition/table-text.d.ts} +2 -2
  116. package/dist/report/{text/table.js → definition/table-text.js} +2 -2
  117. package/dist/report/{tree.d.ts → definition/tree.d.ts} +43 -11
  118. package/dist/report/{tree.js → definition/tree.js} +9 -11
  119. package/dist/report/index.d.ts +33 -18
  120. package/dist/report/index.js +23 -14
  121. package/dist/report/{aggregate.d.ts → model/aggregate.d.ts} +12 -4
  122. package/dist/report/{aggregate.js → model/aggregate.js} +28 -8
  123. package/dist/report/{flag.d.ts → model/flag.d.ts} +14 -1
  124. package/dist/report/{flag.js → model/flag.js} +35 -0
  125. package/dist/report/{format.d.ts → model/format.d.ts} +13 -7
  126. package/dist/report/{format.js → model/format.js} +79 -9
  127. package/dist/report/{locale.d.ts → model/locale.d.ts} +17 -17
  128. package/dist/report/{locale.js → model/locale.js} +31 -33
  129. package/dist/report/{metrics.d.ts → model/metrics.d.ts} +2 -2
  130. package/dist/report/{metrics.js → model/metrics.js} +2 -2
  131. package/dist/report/{types.d.ts → model/types.d.ts} +154 -20
  132. package/dist/report/react/index.d.ts +32 -21
  133. package/dist/report/react/index.js +33 -21
  134. package/dist/report/{load.d.ts → runtime/load.d.ts} +1 -1
  135. package/dist/report/{load.js → runtime/load.js} +1 -1
  136. package/dist/report/runtime/text.d.ts +67 -0
  137. package/dist/report/runtime/text.js +114 -0
  138. package/dist/report/runtime/web.d.ts +35 -0
  139. package/dist/report/runtime/web.js +70 -0
  140. package/dist/results/annotated-source.d.ts +87 -0
  141. package/dist/results/attempt-evidence.d.ts +74 -0
  142. package/dist/results/attempt-source.d.ts +15 -0
  143. package/dist/results/select.d.ts +11 -1
  144. package/dist/results/select.js +27 -5
  145. package/dist/runner/eval-selection.d.ts +26 -0
  146. package/dist/runner/feedback/sink.d.ts +26 -1
  147. package/dist/runner/types.d.ts +151 -24
  148. package/dist/sandbox/docker.d.ts +6 -0
  149. package/dist/sandbox/e2b.d.ts +0 -1
  150. package/dist/sandbox/types.d.ts +23 -21
  151. package/dist/scoring/display.d.ts +7 -2
  152. package/dist/scoring/display.js +42 -4
  153. package/dist/scoring/types.d.ts +3 -3
  154. package/dist/shared/aggregate.d.ts +14 -0
  155. package/dist/shared/aggregate.js +31 -0
  156. package/dist/shared/types.d.ts +6 -1
  157. package/docs-site/images/logo-dark.svg +7 -0
  158. package/docs-site/images/logo.svg +6 -5
  159. package/docs-site/zh/README.md +8 -7
  160. package/docs-site/zh/examples/ai-agent-application.mdx +5 -5
  161. package/docs-site/zh/examples/coding-agent-extensions.mdx +4 -4
  162. package/docs-site/zh/examples/index.mdx +3 -3
  163. package/docs-site/zh/examples/integrations/ai-sdk-v7.mdx +6 -6
  164. package/docs-site/zh/examples/integrations/claude-sdk.mdx +3 -3
  165. package/docs-site/zh/examples/integrations/codex-sdk.mdx +3 -3
  166. package/docs-site/zh/examples/integrations/langgraph.mdx +3 -3
  167. package/docs-site/zh/examples/integrations/pi-sdk.mdx +2 -2
  168. package/docs-site/zh/explanation/adapter.mdx +19 -19
  169. package/docs-site/zh/explanation/assert.mdx +9 -9
  170. package/docs-site/zh/explanation/drive.mdx +4 -4
  171. package/docs-site/zh/explanation/evals.mdx +8 -8
  172. package/docs-site/zh/explanation/experiment.mdx +8 -8
  173. package/docs-site/zh/explanation/hitl.mdx +13 -13
  174. package/docs-site/zh/explanation/judge.mdx +3 -3
  175. package/docs-site/zh/explanation/overview.mdx +7 -7
  176. package/docs-site/zh/explanation/runner.mdx +17 -13
  177. package/docs-site/zh/explanation/tier.mdx +6 -6
  178. package/docs-site/zh/index.mdx +14 -14
  179. package/docs-site/zh/introduction.mdx +13 -16
  180. package/docs-site/zh/reference/builtin-agents.mdx +61 -28
  181. package/docs-site/zh/reference/capabilities.mdx +7 -27
  182. package/docs-site/zh/reference/cli.mdx +36 -33
  183. package/docs-site/zh/reference/define-agent.mdx +32 -31
  184. package/docs-site/zh/reference/define-config.mdx +6 -6
  185. package/docs-site/zh/reference/define-eval.mdx +33 -20
  186. package/docs-site/zh/reference/events.mdx +4 -4
  187. package/docs-site/zh/reference/expect.mdx +3 -3
  188. package/docs-site/zh/reference/official-adapters.mdx +17 -17
  189. package/docs-site/zh/reference/report-components.mdx +195 -121
  190. package/docs-site/zh/reference/results-data.mdx +13 -13
  191. package/docs-site/zh/troubleshooting/debug-sandbox.mdx +11 -11
  192. package/docs-site/zh/troubleshooting/debugging.mdx +40 -16
  193. package/docs-site/zh/{how-to → tutorials}/agent-feedback-loop.mdx +38 -38
  194. package/docs-site/zh/tutorials/agent-onboarding.mdx +100 -0
  195. package/docs-site/zh/tutorials/authoring.mdx +211 -0
  196. package/docs-site/zh/{how-to → tutorials}/ci-integration.mdx +8 -8
  197. package/docs-site/zh/{how-to → tutorials}/connect-otel.mdx +22 -22
  198. package/docs-site/zh/{how-to → tutorials}/connect-your-agent.mdx +58 -63
  199. package/docs-site/zh/tutorials/custom-reports.mdx +453 -0
  200. package/docs-site/zh/{how-to → tutorials}/dataset-fanout.mdx +4 -4
  201. package/docs-site/zh/tutorials/experiments.mdx +102 -0
  202. package/docs-site/zh/{how-to → tutorials}/fixtures.mdx +9 -9
  203. package/docs-site/zh/{how-to → tutorials}/publish-report.mdx +6 -6
  204. package/docs-site/zh/tutorials/quickstart.mdx +18 -18
  205. package/docs-site/zh/{how-to → tutorials}/reporters.mdx +6 -6
  206. package/docs-site/zh/{how-to → tutorials}/sandbox-agent.mdx +6 -6
  207. package/docs-site/zh/{how-to → tutorials}/sandbox-providers.mdx +41 -19
  208. package/docs-site/zh/{how-to → tutorials}/scoring-guide.mdx +4 -4
  209. package/docs-site/zh/{how-to → tutorials}/viewing-results.mdx +60 -57
  210. package/docs-site/zh/tutorials/write-experiment.mdx +353 -0
  211. package/docs-site/zh/{how-to → tutorials}/write-send.mdx +40 -40
  212. package/package.json +10 -7
  213. package/src/agents/bub.ts +21 -8
  214. package/src/agents/claude-code.ts +23 -10
  215. package/src/agents/codex.test.ts +22 -7
  216. package/src/agents/codex.ts +22 -9
  217. package/src/agents/index.ts +2 -2
  218. package/src/agents/openai-compat.ts +1 -1
  219. package/src/agents/post-setup.ts +45 -22
  220. package/src/agents/streaming.ts +1 -1
  221. package/src/agents/types.ts +20 -17
  222. package/src/agents/ui-message-stream.test.ts +10 -0
  223. package/src/agents/ui-message-stream.ts +12 -1
  224. package/src/cli.ts +75 -59
  225. package/src/context/types.ts +21 -21
  226. package/src/define.ts +13 -0
  227. package/src/i18n/en.ts +27 -12
  228. package/src/i18n/zh-CN.ts +27 -12
  229. package/src/index.ts +2 -0
  230. package/src/o11y/prices.json +176 -99
  231. package/src/report/{react → assets}/colors.ts +22 -0
  232. package/src/report/{react → assets}/enhance.js +1 -33
  233. package/src/report/assets/styles.css +1785 -0
  234. package/src/report/built-in/index.tsx +2 -2
  235. package/src/report/built-in/standard.tsx +18 -6
  236. package/src/report/components/attempt-detail/AttemptAssertions.tsx +67 -0
  237. package/src/report/components/attempt-detail/AttemptConversation.tsx +158 -0
  238. package/src/report/components/attempt-detail/AttemptDiagnostics.tsx +38 -0
  239. package/src/report/components/attempt-detail/AttemptDiff.tsx +35 -0
  240. package/src/report/components/attempt-detail/AttemptError.tsx +31 -0
  241. package/src/report/components/attempt-detail/AttemptFixPrompt.tsx +26 -0
  242. package/src/report/components/attempt-detail/AttemptSource.tsx +224 -0
  243. package/src/report/components/attempt-detail/AttemptSummary.tsx +74 -0
  244. package/src/report/components/attempt-detail/AttemptTimeline.tsx +108 -0
  245. package/src/report/components/attempt-detail/AttemptTrace.tsx +63 -0
  246. package/src/report/components/attempt-detail/AttemptUsage.tsx +29 -0
  247. package/src/report/components/attempt-detail/attempt-components.test.tsx +758 -0
  248. package/src/report/components/attempt-detail/compute.ts +336 -0
  249. package/src/report/components/attempt-detail/faces.ts +260 -0
  250. package/src/report/components/attempt-detail/index.tsx +600 -0
  251. package/src/report/components/attempt-detail/validate.test.ts +252 -0
  252. package/src/report/{react → components}/cell.tsx +6 -3
  253. package/src/report/{report.test.ts → components/compute.test.ts} +316 -46
  254. package/src/report/{react → components/entity-lists}/AttemptList.tsx +24 -16
  255. package/src/report/{react → components/entity-lists}/EvalList.tsx +0 -0
  256. package/src/report/{react → components/entity-lists}/ExperimentList.tsx +33 -27
  257. package/src/report/components/entity-lists/compute.ts +196 -0
  258. package/src/report/components/entity-lists/faces.ts +208 -0
  259. package/src/report/components/entity-lists/index.tsx +238 -0
  260. package/src/report/components/entity-lists/validate.test.ts +114 -0
  261. package/src/report/{react → components}/fixtures.ts +2 -2
  262. package/src/report/{react → components/metric-views}/DeltaTable.tsx +5 -5
  263. package/src/report/{react → components/metric-views}/MetricBars.tsx +5 -5
  264. package/src/report/{react → components/metric-views}/MetricLine.tsx +9 -6
  265. package/src/report/{react → components/metric-views}/MetricMatrix.tsx +6 -6
  266. package/src/report/{react → components/metric-views}/MetricScatter.tsx +42 -70
  267. package/src/report/{react → components/metric-views}/MetricTable.tsx +6 -6
  268. package/src/report/{react → components/metric-views}/Scoreboard.tsx +4 -4
  269. package/src/report/{compute.ts → components/metric-views/compute.ts} +51 -477
  270. package/src/report/components/metric-views/faces.ts +423 -0
  271. package/src/report/components/metric-views/index.tsx +352 -0
  272. package/src/report/{text → components/metric-views}/plot.ts +1 -1
  273. package/src/report/components/metric-views/validate.test.ts +211 -0
  274. package/src/report/{react → components}/render.test.tsx +66 -26
  275. package/src/report/components/shared-compute.ts +59 -0
  276. package/src/report/components/shared-faces.ts +30 -0
  277. package/src/report/components/shared.ts +192 -0
  278. package/src/report/{react → components/site-components}/CopyFixPrompt.tsx +3 -3
  279. package/src/report/{react → components/site-components}/HeroCard.tsx +3 -3
  280. package/src/report/{react → components/site-components}/ScopeWarnings.tsx +4 -4
  281. package/src/report/{react → components/site-components}/TraceWaterfall.tsx +13 -10
  282. package/src/report/components/site-components/compute.ts +144 -0
  283. package/src/report/components/site-components/faces.ts +80 -0
  284. package/src/report/components/site-components/index.tsx +265 -0
  285. package/src/report/{scope-warnings.ts → components/site-components/scope-warnings.ts} +3 -3
  286. package/src/report/{site-components.test.tsx → components/site-components/site-components.test.tsx} +23 -21
  287. package/src/report/components/site-components/validate.test.ts +89 -0
  288. package/src/report/{react → components/summaries}/ScopeSummary.tsx +26 -11
  289. package/src/report/components/summaries/compute.ts +56 -0
  290. package/src/report/components/summaries/faces.ts +48 -0
  291. package/src/report/components/summaries/index.tsx +127 -0
  292. package/src/report/components/summaries/validate.test.ts +49 -0
  293. package/src/report/definition/grid-layout.test.ts +124 -0
  294. package/src/report/definition/grid-layout.ts +146 -0
  295. package/src/report/{primitives.tsx → definition/primitives.tsx} +168 -18
  296. package/src/report/{report.ts → definition/report.ts} +98 -165
  297. package/src/report/{shell-head.test.ts → definition/shell-head.test.ts} +2 -2
  298. package/src/report/{text/table.ts → definition/table-text.ts} +4 -4
  299. package/src/report/{tree.ts → definition/tree.ts} +56 -20
  300. package/src/report/index.ts +128 -66
  301. package/src/report/{aggregate.ts → model/aggregate.ts} +31 -9
  302. package/src/report/{flag.ts → model/flag.ts} +39 -1
  303. package/src/report/{format.ts → model/format.ts} +89 -10
  304. package/src/report/{locale.ts → model/locale.ts} +34 -36
  305. package/src/report/{metrics.ts → model/metrics.ts} +3 -3
  306. package/src/report/{types.ts → model/types.ts} +159 -22
  307. package/src/report/react/index.tsx +54 -26
  308. package/src/report/{dual-render.test.tsx → runtime/dual-render.test.tsx} +601 -53
  309. package/src/report/runtime/host.test.ts +44 -0
  310. package/src/report/runtime/host.ts +138 -0
  311. package/src/report/{load.ts → runtime/load.ts} +1 -1
  312. package/src/report/runtime/text.ts +192 -0
  313. package/src/report/runtime/web.ts +106 -0
  314. package/src/results/attempt-evidence.ts +5 -1
  315. package/src/results/host-equivalence.test.ts +53 -2
  316. package/src/results/select.ts +29 -5
  317. package/src/runner/attempt.test.ts +48 -1
  318. package/src/runner/attempt.ts +62 -42
  319. package/src/runner/cleanup-timeout.test.ts +16 -0
  320. package/src/runner/cleanup-timeout.ts +23 -0
  321. package/src/runner/discover.ts +1 -2
  322. package/src/runner/eval-selection.test.ts +187 -0
  323. package/src/runner/eval-selection.ts +109 -0
  324. package/src/runner/experiment-cleanup-registry.test.ts +89 -0
  325. package/src/runner/experiment-cleanup-registry.ts +39 -0
  326. package/src/runner/experiment-labels.test.ts +71 -0
  327. package/src/runner/feedback/agent.test.ts +33 -1
  328. package/src/runner/feedback/agent.ts +12 -16
  329. package/src/runner/feedback/ci.test.ts +35 -1
  330. package/src/runner/feedback/ci.ts +16 -18
  331. package/src/runner/feedback/coordinator.ts +28 -0
  332. package/src/runner/feedback/human.test.ts +108 -1
  333. package/src/runner/feedback/human.ts +71 -21
  334. package/src/runner/feedback/reducer.test.ts +64 -0
  335. package/src/runner/feedback/reducer.ts +26 -0
  336. package/src/runner/feedback/sink.ts +40 -1
  337. package/src/runner/fingerprint.ts +2 -1
  338. package/src/runner/report.test.ts +14 -0
  339. package/src/runner/report.ts +3 -1
  340. package/src/runner/run.test.ts +390 -12
  341. package/src/runner/run.ts +259 -26
  342. package/src/runner/sandbox-selection.test.ts +13 -3
  343. package/src/runner/sandbox-selection.ts +4 -2
  344. package/src/runner/types.ts +160 -24
  345. package/src/sandbox/docker.ts +7 -0
  346. package/src/sandbox/e2b-reconcile.test.ts +125 -0
  347. package/src/sandbox/e2b.ts +47 -12
  348. package/src/sandbox/types.ts +23 -21
  349. package/src/scoring/display.test.ts +28 -2
  350. package/src/scoring/display.ts +38 -5
  351. package/src/scoring/types.ts +3 -3
  352. package/src/shared/aggregate.test.ts +52 -0
  353. package/src/shared/aggregate.ts +29 -0
  354. package/src/shared/types.ts +6 -1
  355. package/src/show/command.test.ts +34 -0
  356. package/src/show/command.ts +16 -0
  357. package/src/show/compose.ts +1 -1
  358. package/src/show/index.ts +56 -20
  359. package/src/show/render.ts +15 -239
  360. package/src/show/show.test.ts +127 -34
  361. package/src/view/app/App.test.tsx +1 -1
  362. package/src/view/app/App.tsx +119 -47
  363. package/src/view/app/i18n.ts +7 -147
  364. package/src/view/app/lib/attempt-dialog.test.ts +65 -0
  365. package/src/view/app/lib/attempt-dialog.ts +69 -0
  366. package/src/view/app/main.tsx +0 -1
  367. package/src/view/app/types.ts +3 -86
  368. package/src/view/artifact-serving.test.ts +22 -38
  369. package/src/view/client-dist/app.css +1 -1
  370. package/src/view/client-dist/app.js +15 -22
  371. package/src/view/data.test.ts +48 -36
  372. package/src/view/data.ts +105 -83
  373. package/src/view/index.ts +1 -1
  374. package/src/view/server.ts +32 -2
  375. package/src/view/shared/types.ts +6 -31
  376. package/src/view/site-parity.test.ts +24 -1
  377. package/src/view/site.ts +144 -17
  378. package/src/view/styles.css +0 -805
  379. package/src/view/view-report.test.ts +143 -22
  380. package/dist/report/components.d.ts +0 -179
  381. package/dist/report/components.js +0 -544
  382. package/dist/report/compute.d.ts +0 -139
  383. package/dist/report/react/ExperimentComparison.d.ts +0 -10
  384. package/dist/report/react/ExperimentComparison.js +0 -12
  385. package/dist/report/react/MetricScatter.d.ts +0 -9
  386. package/dist/report/react/format.d.ts +0 -3
  387. package/dist/report/react/format.js +0 -7
  388. package/dist/report/text/faces.d.ts +0 -45
  389. package/dist/report/text/faces.js +0 -671
  390. package/dist/report/web.d.ts +0 -32
  391. package/dist/report/web.js +0 -48
  392. package/docs-site/zh/how-to/authoring.mdx +0 -162
  393. package/docs-site/zh/how-to/custom-reports.mdx +0 -414
  394. package/docs-site/zh/how-to/experiments.mdx +0 -86
  395. package/docs-site/zh/how-to/write-experiment.mdx +0 -164
  396. package/src/report/components.tsx +0 -925
  397. package/src/report/react/ExperimentComparison.tsx +0 -73
  398. package/src/report/react/format.ts +0 -9
  399. package/src/report/react/styles.css +0 -945
  400. package/src/report/text/faces.ts +0 -767
  401. package/src/report/web.ts +0 -77
  402. package/src/show/report-host.test.ts +0 -205
  403. package/src/show/report-host.ts +0 -389
  404. package/src/view/app/components/AttemptModal.tsx +0 -496
  405. package/src/view/app/components/CodeView.test.tsx +0 -142
  406. package/src/view/app/components/CodeView.tsx +0 -310
  407. package/src/view/app/components/CopyControls.tsx +0 -106
  408. package/src/view/app/components/Trace.tsx +0 -100
  409. package/src/view/app/components/Transcript.tsx +0 -157
  410. package/src/view/app/components/ui/badge.tsx +0 -21
  411. package/src/view/app/lib/artifact-url.ts +0 -17
  412. package/src/view/app/lib/attempt-route.test.ts +0 -80
  413. package/src/view/app/lib/attempt-route.ts +0 -52
  414. package/src/view/app/lib/format.ts +0 -70
  415. package/src/view/app/lib/guards.test.ts +0 -108
  416. package/src/view/app/lib/guards.ts +0 -71
  417. package/src/view/app/lib/rows.ts +0 -22
  418. package/src/view/app/lib/transcript-data.tsx +0 -151
  419. package/src/view/app/lib/verdict.ts +0 -23
  420. package/src/view/app/shared.ts +0 -8
  421. /package/dist/report/{react → components/metric-views}/chart-math.d.ts +0 -0
  422. /package/dist/report/{react → components/metric-views}/chart-math.js +0 -0
  423. /package/dist/report/{text → components/metric-views}/plot.d.ts +0 -0
  424. /package/dist/report/{react → components/site-components}/PoweredBy.d.ts +0 -0
  425. /package/dist/report/{react → components/site-components}/PoweredBy.js +0 -0
  426. /package/dist/report/{text/layout.d.ts → model/text-layout.d.ts} +0 -0
  427. /package/dist/report/{text/layout.js → model/text-layout.js} +0 -0
  428. /package/dist/report/{types.js → model/types.js} +0 -0
  429. /package/src/report/{react → components/metric-views}/chart-math.test.ts +0 -0
  430. /package/src/report/{react → components/metric-views}/chart-math.ts +0 -0
  431. /package/src/report/{react → components/site-components}/PoweredBy.tsx +0 -0
  432. /package/src/report/{text/layout.ts → model/text-layout.ts} +0 -0
@@ -1,544 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { defineComponent, isHostWebContextActive, memoFetchOf, } from "./tree.js";
3
- import { attemptListData, copyFixPromptData, deltaTableData, evalListData, experimentComparisonData, experimentListData, heroData, metricLineData, metricMatrixData, metricScatterData, metricTableData, scopeSummaryData, scopeWarningsData, scoreboardData, traceWaterfallData, } from "./compute.js";
4
- import { collectItems, locatorOf, resolveInput } from "./aggregate.js";
5
- import { attemptListText, deltaText, evalListText, experimentComparisonText, experimentListText, barsText, heroCardText, lineText, matrixText, scatterText, scopeWarningsText, scoreboardText, scopeSummaryText, tableText, traceWaterfallText, } from "./text/faces.js";
6
- import { ScopeSummary as ScopeSummaryWeb } from "./react/ScopeSummary.js";
7
- import { ExperimentComparisonView } from "./react/ExperimentComparison.js";
8
- import { ExperimentList as ExperimentListWeb } from "./react/ExperimentList.js";
9
- import { EvalList as EvalListWeb } from "./react/EvalList.js";
10
- import { AttemptList as AttemptListWeb } from "./react/AttemptList.js";
11
- import { HeroCard as HeroCardWeb } from "./react/HeroCard.js";
12
- import { PoweredBy as PoweredByWeb } from "./react/PoweredBy.js";
13
- import { ScopeWarnings as ScopeWarningsWeb } from "./react/ScopeWarnings.js";
14
- import { CopyFixPrompt as CopyFixPromptWeb } from "./react/CopyFixPrompt.js";
15
- import { TraceWaterfall as TraceWaterfallWeb } from "./react/TraceWaterfall.js";
16
- import { MetricTable as MetricTableWeb } from "./react/MetricTable.js";
17
- import { MetricMatrix as MetricMatrixWeb } from "./react/MetricMatrix.js";
18
- import { MetricBars as MetricBarsWeb } from "./react/MetricBars.js";
19
- import { Scoreboard as ScoreboardWeb } from "./react/Scoreboard.js";
20
- import { MetricScatter as MetricScatterWeb } from "./react/MetricScatter.js";
21
- import { MetricLine as MetricLineWeb } from "./react/MetricLine.js";
22
- import { DeltaTable as DeltaTableWeb } from "./react/DeltaTable.js";
23
- // ───────────────────────── data 结构校验(版本漂移防线)─────────────────────────
24
- function isObject(value) {
25
- return typeof value === "object" && value !== null && !Array.isArray(value);
26
- }
27
- function isCell(value) {
28
- return (isObject(value) &&
29
- "value" in value &&
30
- "display" in value &&
31
- typeof value.samples === "number" &&
32
- typeof value.total === "number" &&
33
- Array.isArray(value.refs));
34
- }
35
- function isTally(value) {
36
- return (isObject(value) &&
37
- typeof value.passed === "number" &&
38
- typeof value.failed === "number" &&
39
- typeof value.errored === "number" &&
40
- typeof value.skipped === "number");
41
- }
42
- function dataShapeError(component, dataFnName, shape, problem) {
43
- return new Error(`<${component}> received data that does not match the current ${shape} shape: ${problem}. ` +
44
- `It may have been computed by a different niceeval version (component data carries no schemaVersion; the support window is same-version write and read). ` +
45
- `Recompute it with ${dataFnName}() from this niceeval version, then re-render.`);
46
- }
47
- const validateTableData = (data) => {
48
- if (!isObject(data))
49
- return "expected an object";
50
- if (typeof data.rowDimension !== "string")
51
- return 'missing "rowDimension" (string)';
52
- if (!Array.isArray(data.columns))
53
- return 'missing "columns" (array)';
54
- if (!Array.isArray(data.rows))
55
- return 'missing "rows" (array)';
56
- for (const row of data.rows) {
57
- if (!isObject(row) || typeof row.key !== "string" || !isObject(row.cells)) {
58
- return 'each row needs { key, cells }';
59
- }
60
- }
61
- return null;
62
- };
63
- const validateMatrixData = (data) => {
64
- if (!isObject(data))
65
- return "expected an object";
66
- if (typeof data.rowDimension !== "string" || typeof data.columnDimension !== "string") {
67
- return 'missing "rowDimension" / "columnDimension" (string)';
68
- }
69
- if (!isObject(data.metric))
70
- return 'missing "metric" (MetricColumn)';
71
- if (!Array.isArray(data.cells))
72
- return 'missing "cells" (array)';
73
- return null;
74
- };
75
- const validateScatterData = (data) => {
76
- if (!isObject(data))
77
- return "expected an object";
78
- if (typeof data.pointDimension !== "string")
79
- return 'missing "pointDimension" (string)';
80
- if (!isObject(data.x) || !isObject(data.y))
81
- return 'missing "x" / "y" (MetricColumn)';
82
- if (!Array.isArray(data.rows))
83
- return 'missing "rows" (array)';
84
- for (const row of data.rows) {
85
- if (!isObject(row) || typeof row.key !== "string" || !isCell(row.x) || !isCell(row.y)) {
86
- return "each row needs { key, x: MetricCell, y: MetricCell }";
87
- }
88
- }
89
- return null;
90
- };
91
- const validateLineData = (data) => {
92
- if (!isObject(data))
93
- return "expected an object";
94
- if (!isObject(data.x) || typeof data.x.key !== "string")
95
- return 'missing "x" axis descriptor';
96
- if (!isObject(data.y))
97
- return 'missing "y" (MetricColumn)';
98
- if (!Array.isArray(data.rows))
99
- return 'missing "rows" (array)';
100
- return null;
101
- };
102
- const validateScoreboardData = (data) => {
103
- if (!isObject(data))
104
- return "expected an object";
105
- if (typeof data.rowDimension !== "string")
106
- return 'missing "rowDimension" (string)';
107
- if (!Array.isArray(data.questions))
108
- return 'missing "questions" (array)';
109
- if (typeof data.fullMarks !== "number")
110
- return 'missing "fullMarks" (number)';
111
- if (typeof data.ignoredEvals !== "number")
112
- return 'missing "ignoredEvals" (number)';
113
- if (!Array.isArray(data.rows))
114
- return 'missing "rows" (array)';
115
- for (const row of data.rows) {
116
- if (!isObject(row) || !isObject(row.total) || typeof row.total.notRun !== "number") {
117
- return 'each row needs { key, total: { value, display, notRun, unscorable, refs }, subjects }';
118
- }
119
- }
120
- return null;
121
- };
122
- const validateDeltaData = (data) => {
123
- if (!isObject(data))
124
- return "expected an object";
125
- if (typeof data.byDimension !== "string")
126
- return 'missing "byDimension" (string)';
127
- if (!Array.isArray(data.columns) || !Array.isArray(data.rows))
128
- return 'missing "columns" / "rows" (array)';
129
- for (const row of data.rows) {
130
- if (!isObject(row) || row.label === undefined || !isObject(row.a) || !isObject(row.b)) {
131
- return "each row needs { key, label, a, b, cells }";
132
- }
133
- }
134
- return null;
135
- };
136
- const validateScopeSummaryData = (data) => {
137
- if (!isObject(data))
138
- return "expected an object";
139
- if (!isObject(data.range))
140
- return 'missing "range" ({ earliestStartedAt, latestStartedAt })';
141
- if (!isTally(data.evalVerdicts) || !isTally(data.attemptVerdicts)) {
142
- return 'missing "evalVerdicts" / "attemptVerdicts" tallies';
143
- }
144
- if (!isCell(data.endToEndPassRate) || !isCell(data.totalCostUSD)) {
145
- return 'missing "endToEndPassRate" / "totalCostUSD" (MetricCell)';
146
- }
147
- return null;
148
- };
149
- const validateComparisonData = (data) => {
150
- if (!isObject(data))
151
- return "expected an object";
152
- if (!Array.isArray(data.groups))
153
- return 'missing "groups" (array)';
154
- for (const group of data.groups) {
155
- if (!isObject(group) || typeof group.key !== "string" || validateScopeSummaryData(group.summary) !== null) {
156
- return "each group needs { key, summary, scatter, experiments }";
157
- }
158
- }
159
- return null;
160
- };
161
- const validateExperimentListData = (data) => {
162
- if (!Array.isArray(data))
163
- return "expected an array of ExperimentListItem";
164
- for (const item of data) {
165
- if (!isObject(item) || typeof item.experimentId !== "string" || !isTally(item.evalVerdicts) || !isCell(item.endToEndPassRate)) {
166
- return "each item needs { experimentId, evalVerdicts, endToEndPassRate, costUSD, durationMs, tokens, evalRows, … }";
167
- }
168
- }
169
- return null;
170
- };
171
- const validateEvalListData = (data) => {
172
- if (!Array.isArray(data))
173
- return "expected an array of EvalListItem";
174
- for (const item of data) {
175
- if (!isObject(item) || typeof item.evalId !== "string" || !isCell(item.examScore) || !Array.isArray(item.attempts)) {
176
- return "each item needs { experimentId, evalId, verdict, examScore, durationMs, costUSD, attempts }";
177
- }
178
- }
179
- return null;
180
- };
181
- const validateAttemptListData = (data) => {
182
- if (!Array.isArray(data))
183
- return "expected an array of AttemptListItem";
184
- for (const item of data) {
185
- if (!isObject(item) || typeof item.evalId !== "string" || !("failureSummary" in item) || !("costUSD" in item)) {
186
- return "each item needs { experimentId, evalId, verdict, failureSummary, moreFailures, examScore, durationMs, costUSD, locator }";
187
- }
188
- }
189
- return null;
190
- };
191
- const validateHeroData = (data) => {
192
- if (!isObject(data))
193
- return "expected an object";
194
- if (!("latestStartedAt" in data) || (data.latestStartedAt !== null && typeof data.latestStartedAt !== "string")) {
195
- return 'missing "latestStartedAt" (string | null)';
196
- }
197
- if (typeof data.snapshots !== "number")
198
- return 'missing "snapshots" (number)';
199
- return null;
200
- };
201
- const validateScopeWarningsData = (data) => {
202
- if (!Array.isArray(data))
203
- return "expected an array of ScopeWarning";
204
- for (const item of data) {
205
- if (!isObject(item) || typeof item.kind !== "string" || typeof item.message !== "string") {
206
- return "each warning needs { kind, message, … }";
207
- }
208
- }
209
- return null;
210
- };
211
- const validateCopyFixPromptData = (data) => {
212
- if (!isObject(data))
213
- return "expected an object";
214
- if (typeof data.prompt !== "string")
215
- return 'missing "prompt" (string)';
216
- if (typeof data.failures !== "number")
217
- return 'missing "failures" (number)';
218
- return null;
219
- };
220
- const validateTraceWaterfallData = (data) => {
221
- if (!Array.isArray(data))
222
- return "expected an array of TraceWaterfallRow";
223
- for (const row of data) {
224
- if (!isObject(row) ||
225
- typeof row.experimentId !== "string" ||
226
- typeof row.evalId !== "string" ||
227
- typeof row.locator !== "string" ||
228
- !("durationMs" in row) ||
229
- (row.durationMs !== null && typeof row.durationMs !== "number") ||
230
- !Array.isArray(row.spans)) {
231
- return "each row needs { experimentId, evalId, locator, durationMs: number | null, spans }";
232
- }
233
- for (const span of row.spans) {
234
- if (!isObject(span) || typeof span.name !== "string" || typeof span.startOffsetMs !== "number") {
235
- return "each span needs { name, kind, startOffsetMs, durationMs, failed }";
236
- }
237
- }
238
- }
239
- return null;
240
- };
241
- function makeDataComponent(def) {
242
- const assertData = (data) => {
243
- const problem = def.validate(data);
244
- if (problem !== null)
245
- throw dataShapeError(def.name, def.dataFnName, def.shapeName, problem);
246
- return data;
247
- };
248
- const resolve = async (props, ctx) => {
249
- const givenSpec = def.specKeys.filter((key) => props[key] !== undefined);
250
- if (props.data !== undefined) {
251
- if (givenSpec.length > 0 || props.input !== undefined) {
252
- const extras = [...givenSpec, ...(props.input !== undefined ? ["input"] : [])];
253
- throw new Error(`<${def.name}> got both \`data\` and spec field${extras.length > 1 ? "s" : ""} (${extras.join(", ")}) — the two data sources are exclusive and niceeval will not silently pick one. ` +
254
- `Keep \`data\` (precomputed with ${def.dataFnName}()) and drop the spec fields, or drop \`data\` and let the pipeline compute from the spec.`);
255
- }
256
- assertData(props.data);
257
- return props;
258
- }
259
- const options = {};
260
- for (const key of givenSpec)
261
- options[key] = props[key];
262
- const input = props.input ?? ctx.input;
263
- const data = await memoFetchOf(ctx)(def.dataFn, input, options, () => def.dataFn(input, options));
264
- const rest = { ...props };
265
- delete rest.input;
266
- for (const key of def.specKeys)
267
- delete rest[key];
268
- return { ...rest, data };
269
- };
270
- const component = defineComponent({
271
- resolve,
272
- web: (props, ctx) => {
273
- assertData(props.data);
274
- return def.web(props, ctx);
275
- },
276
- text: (props, ctx) => {
277
- assertData(props.data);
278
- return def.text(props, ctx);
279
- },
280
- });
281
- component.displayName = def.name;
282
- return component;
283
- }
284
- /** 宿主内缺省接证据室,显式 prop 覆盖;宿主外不传 attemptHref 就是纯展示。 */
285
- function hrefOf(props, ctx) {
286
- return props.attemptHref ?? (isHostWebContextActive() ? ctx.attemptHref : undefined);
287
- }
288
- /** 范围摘要卡:时间窗、数量、两级计票、端到端成功率与总成本。 */
289
- export const ScopeSummary = makeDataComponent({
290
- name: "ScopeSummary",
291
- dataFnName: "scopeSummaryData",
292
- shapeName: "ScopeSummaryData",
293
- dataFn: (input) => scopeSummaryData(input),
294
- specKeys: [],
295
- validate: validateScopeSummaryData,
296
- web: (props, ctx) => _jsx(ScopeSummaryWeb, { ...props, locale: props.locale ?? ctx.locale }),
297
- text: (props, ctx) => scopeSummaryText(props.data, props.votes ?? "eval", ctx),
298
- });
299
- /**
300
- * 内建报告的默认组合件:先把 input 按可比组分区,再为每组分别计算 ScopeSummary、
301
- * 成本 × 端到端成功率散点和 ExperimentList。web 面持有完整组索引并一次聚焦一组;
302
- * text 面命中多个组时只显示组索引与可执行的单组查看命令,命中单组时才输出完整散点与列表。
303
- */
304
- export const ExperimentComparison = makeDataComponent({
305
- name: "ExperimentComparison",
306
- dataFnName: "experimentComparisonData",
307
- shapeName: "ExperimentComparisonData",
308
- dataFn: (input) => experimentComparisonData(input),
309
- specKeys: [],
310
- validate: validateComparisonData,
311
- web: (props, ctx) => (_jsx(ExperimentComparisonView, { data: props.data, locale: props.locale ?? ctx.locale, className: props.className, attemptHref: isHostWebContextActive() ? ctx.attemptHref : undefined })),
312
- text: (props, ctx) => experimentComparisonText(props.data, props.className, ctx),
313
- });
314
- /** 实验列表:每项一个 experiment,固定八列比较表 + 展开到 Eval / Attempt。 */
315
- export const ExperimentList = makeDataComponent({
316
- name: "ExperimentList",
317
- dataFnName: "experimentListData",
318
- shapeName: "ExperimentListItem[]",
319
- dataFn: (input) => experimentListData(input),
320
- specKeys: [],
321
- validate: validateExperimentListData,
322
- web: (props, ctx) => (_jsx(ExperimentListWeb, { data: props.data, filter: props.filter, relativeTo: props.relativeTo, locale: props.locale ?? ctx.locale, attemptHref: hrefOf(props, ctx) ?? ctx.attemptHref, className: props.className })),
323
- text: (props, ctx) => experimentListText(props.data, ctx, props.relativeTo),
324
- });
325
- /** Eval 列表:每项一个 experimentId + evalId,展开到这道题的 Attempt。 */
326
- export const EvalList = makeDataComponent({
327
- name: "EvalList",
328
- dataFnName: "evalListData",
329
- shapeName: "EvalListItem[]",
330
- dataFn: (input) => evalListData(input),
331
- specKeys: [],
332
- validate: validateEvalListData,
333
- web: (props, ctx) => (_jsx(EvalListWeb, { data: props.data, locale: props.locale ?? ctx.locale, attemptHref: hrefOf(props, ctx) ?? ctx.attemptHref, className: props.className })),
334
- text: (props, ctx) => evalListText(props.data, ctx),
335
- });
336
- /** Attempt 列表:实体列表的叶子层,每项一次 attempt 的判定、单行摘要与 locator。 */
337
- export const AttemptList = makeDataComponent({
338
- name: "AttemptList",
339
- dataFnName: "attemptListData",
340
- shapeName: "AttemptListItem[]",
341
- dataFn: (input) => attemptListData(input),
342
- specKeys: [],
343
- validate: validateAttemptListData,
344
- web: (props, ctx) => (_jsx(AttemptListWeb, { data: props.data, total: props.total, filter: props.filter, locale: props.locale ?? ctx.locale, attemptHref: hrefOf(props, ctx) ?? ctx.attemptHref, className: props.className })),
345
- text: (props, ctx) => attemptListText(props.data, props.total, ctx),
346
- });
347
- /**
348
- * 「现在有哪些失败要处理」的成品组合件:内部就是 attemptListData → 过滤 → AttemptList
349
- * data 形态,与手写组合严格等价、没有私有能力(docs/feature/reports/library/entity-lists.md)。
350
- * verdict ∈ failed / errored,按 attempt 开始时间降序(同刻按 locator 字典序),
351
- * 截断到 limit(默认 20),total 报告截断前总数。
352
- */
353
- export const FailureList = defineComponent(async (props, ctx) => {
354
- const input = props.input ?? ctx.scope;
355
- const all = await attemptListData(input);
356
- // attempt 开始时间不在列表条目里(它不是列表展示字段);从同一 input 的读取面按 locator 对回。
357
- const startedAtByLocator = new Map();
358
- for (const item of collectItems(resolveInput(input).snapshots)) {
359
- startedAtByLocator.set(locatorOf(item), item.attempt.result.startedAt ?? "");
360
- }
361
- const failures = all
362
- .filter((item) => item.verdict === "failed" || item.verdict === "errored")
363
- .sort((a, b) => {
364
- const ta = startedAtByLocator.get(a.locator) ?? "";
365
- const tb = startedAtByLocator.get(b.locator) ?? "";
366
- if (ta !== tb)
367
- return ta < tb ? 1 : -1; // 最近的失败在前
368
- return a.locator < b.locator ? -1 : a.locator > b.locator ? 1 : 0;
369
- });
370
- const limit = props.limit ?? 20;
371
- return (_jsx(AttemptList, { data: failures.slice(0, limit), total: failures.length, attemptHref: props.attemptHref, locale: props.locale, className: props.className }));
372
- });
373
- FailureList.displayName = "FailureList";
374
- /** HeroCard 的 data 校验入口(它不经 makeDataComponent,数据形态是唯一形态)。 */
375
- const assertHeroData = (data) => {
376
- const problem = validateHeroData(data);
377
- if (problem !== null)
378
- throw dataShapeError("HeroCard", "heroData", "HeroData", problem);
379
- return data;
380
- };
381
- /**
382
- * `HeroCard`:Hero 的渲染件,双面组件,只收 data 形态——标题输入是站点声明与 Scope 的
383
- * 合成物,没有单独的 spec 等价形。web 面渲染 hero 标题(h1)、按渲染 locale 格式化的运行
384
- * meta(latestStartedAt 为 null 时内置「暂无运行」文案)与品牌行(等同 PoweredBy,恒含、
385
- * 无拆除 prop);text 面输出标题行与 meta 行,不含品牌行
386
- * (docs/feature/reports/library/site-components.md「HeroCard」)。
387
- */
388
- export const HeroCard = defineComponent({
389
- web: (props, ctx) => {
390
- assertHeroData(props.data);
391
- return _jsx(HeroCardWeb, { title: props.title, data: props.data, className: props.className, locale: ctx.locale });
392
- },
393
- text: (props, ctx) => {
394
- assertHeroData(props.data);
395
- return heroCardText(props.title, props.data, ctx);
396
- },
397
- });
398
- HeroCard.displayName = "HeroCard";
399
- /**
400
- * `Hero`:页首的站点标题区——标题、最后运行时间、快照合成来源,恒含品牌行。官方组合组件,
401
- * 与手写 `<HeroCard title={title ?? ctx.report.title} data={await heroData(ctx.scope)} />`
402
- * 严格等价、没有私有能力;读 `ctx.report` 意味着输出跟随站点,要站点无关的标题区直接用
403
- * `HeroCard` 显式传值(docs/feature/reports/library/site-components.md「Hero」)。
404
- */
405
- export const Hero = defineComponent(async ({ title, className }, ctx) => (_jsx(HeroCard, { title: title ?? ctx.report.title, data: await heroData(ctx.scope), className: className })));
406
- Hero.displayName = "Hero";
407
- /**
408
- * `PoweredBy`:唯一的品牌件,无 props 双面组件。web 面渲染指向 niceeval 官网的一行品牌色
409
- * 小字(`utm_source=report&utm_medium=powered-by`,`rel` 仅 `noopener` 以保留 Referer);
410
- * text 面零输出。没有任何配置——品牌契约是「提供一个组件,不给开关」:不想要品牌就不用
411
- * 这些组件、自己写替代组件(docs/feature/reports/library/site-components.md「PoweredBy」)。
412
- */
413
- export const PoweredBy = defineComponent({
414
- web: () => _jsx(PoweredByWeb, {}),
415
- text: () => "",
416
- });
417
- PoweredBy.displayName = "PoweredBy";
418
- /**
419
- * `ScopeWarnings`:选择警告区,警告的唯一呈现组件。把 Scope 携带的 `ScopeWarning[]`
420
- * 按「下一步动作」聚合渲染(带 experimentId 的按实验聚合、非实验作用域按 kind 聚合;
421
- * integrity 组在前);web 面组头带去重后的可复制命令、明细收原生 `<details>`(总条数 ≤ 3
422
- * 默认展开),text 面同构但不折叠。空警告集与裸 `Snapshot[]` 输入两面零输出
423
- * (docs/feature/reports/library/site-components.md「ScopeWarnings」)。
424
- */
425
- export const ScopeWarnings = makeDataComponent({
426
- name: "ScopeWarnings",
427
- dataFnName: "scopeWarningsData",
428
- shapeName: "ScopeWarning[]",
429
- dataFn: (input) => scopeWarningsData(input),
430
- specKeys: [],
431
- validate: validateScopeWarningsData,
432
- web: (props, ctx) => props.data.length === 0 ? null : (_jsx(ScopeWarningsWeb, { data: props.data, locale: props.locale ?? ctx.locale, className: props.className })),
433
- text: (props, ctx) => scopeWarningsText(props.data, ctx),
434
- });
435
- /**
436
- * `CopyFixPrompt`:把当前范围的全部失败整理成一段可交给 coding agent 的修复 prompt。
437
- * prompt 在 resolve 阶段算好、烘进静态 HTML,无 JS 时在折叠块里完整可读,「复制」是增强层
438
- * 行为;`failures` 为 0 时两面零输出;text 面恒零输出——终端里的等价能力是 `show` 的
439
- * attempt 下钻命令本身(docs/feature/reports/library/site-components.md「CopyFixPrompt」)。
440
- */
441
- export const CopyFixPrompt = makeDataComponent({
442
- name: "CopyFixPrompt",
443
- dataFnName: "copyFixPromptData",
444
- shapeName: "CopyFixPromptData",
445
- dataFn: (input) => copyFixPromptData(input),
446
- specKeys: [],
447
- validate: validateCopyFixPromptData,
448
- web: (props, ctx) => props.data.failures === 0 ? null : (_jsx(CopyFixPromptWeb, { data: props.data, locale: props.locale ?? ctx.locale, className: props.className })),
449
- text: () => "",
450
- });
451
- /**
452
- * `TraceWaterfall`:每个 attempt 一行的执行时间瀑布,用 canonical OTel 字段显示被测 agent
453
- * 的原始 span(agent / model / tool)。web 面静态渲染顶层 span 分解条(失败 span 带失败
454
- * 标记),行链接 attempt 详情;text 面每 attempt 一行(locator、总耗时、span 计数与失败
455
- * 标记)+ 可复制的 `--timing` 下钻命令。trace 缺失的行照常出现并如实显示缺失;runner
456
- * 生命周期节点不进瀑布(docs/feature/reports/library/site-components.md「TraceWaterfall」)。
457
- */
458
- export const TraceWaterfall = makeDataComponent({
459
- name: "TraceWaterfall",
460
- dataFnName: "traceWaterfallData",
461
- shapeName: "TraceWaterfallRow[]",
462
- dataFn: (input) => traceWaterfallData(input),
463
- specKeys: [],
464
- validate: validateTraceWaterfallData,
465
- web: (props, ctx) => (_jsx(TraceWaterfallWeb, { data: props.data, attemptHref: hrefOf(props, ctx) ?? ctx.attemptHref, locale: props.locale ?? ctx.locale, className: props.className })),
466
- text: (props, ctx) => traceWaterfallText(props.data, ctx),
467
- });
468
- /** 榜单:一行一个维度值、一列一个指标,回答「谁整体更好」。 */
469
- export const MetricTable = makeDataComponent({
470
- name: "MetricTable",
471
- dataFnName: "metricTableData",
472
- shapeName: "TableData",
473
- dataFn: metricTableData,
474
- specKeys: ["rows", "columns", "sort", "evals"],
475
- validate: validateTableData,
476
- web: (props, ctx) => (_jsx(MetricTableWeb, { data: props.data, filter: props.filter, locale: props.locale ?? ctx.locale, attemptHref: hrefOf(props, ctx), className: props.className })),
477
- text: (props, ctx) => tableText(props.data, ctx),
478
- });
479
- /** 逐题格子:行 × 列两个维度、格子里一个指标,回答「哪道题谁挂了」。 */
480
- export const MetricMatrix = makeDataComponent({
481
- name: "MetricMatrix",
482
- dataFnName: "metricMatrixData",
483
- shapeName: "MatrixData",
484
- dataFn: metricMatrixData,
485
- specKeys: ["rows", "columns", "cell", "evals"],
486
- validate: validateMatrixData,
487
- web: (props, ctx) => (_jsx(MetricMatrixWeb, { data: props.data, locale: props.locale ?? ctx.locale, attemptHref: hrefOf(props, ctx), className: props.className })),
488
- text: (props, ctx) => matrixText(props.data, ctx),
489
- });
490
- /** 分组条形:同一份矩阵数据的另一种摆法;与 MetricMatrix 写同一份 spec 时只计算一次。 */
491
- export const MetricBars = makeDataComponent({
492
- name: "MetricBars",
493
- dataFnName: "metricMatrixData",
494
- shapeName: "MatrixData",
495
- dataFn: metricMatrixData,
496
- specKeys: ["rows", "columns", "cell", "evals"],
497
- validate: validateMatrixData,
498
- web: (props, ctx) => (_jsx(MetricBarsWeb, { data: props.data, locale: props.locale ?? ctx.locale, attemptHref: hrefOf(props, ctx), className: props.className })),
499
- text: (props, ctx) => barsText(props.data, ctx),
500
- });
501
- /** 考试成绩单:总分 + 分科小计,固定分母、notRun / unscorable 分开如实报。 */
502
- export const Scoreboard = makeDataComponent({
503
- name: "Scoreboard",
504
- dataFnName: "scoreboardData",
505
- shapeName: "ScoreboardData",
506
- dataFn: scoreboardData,
507
- specKeys: ["rows", "questions", "subject", "weights", "fullMarks", "score"],
508
- validate: validateScoreboardData,
509
- web: (props, ctx) => _jsx(ScoreboardWeb, { data: props.data, locale: props.locale ?? ctx.locale, className: props.className }),
510
- text: (props, ctx) => scoreboardText(props.data, ctx),
511
- });
512
- /** 两个指标之间的取舍:每个点一个维度值,x / y 各一个指标,series 只决定颜色和分组。 */
513
- export const MetricScatter = makeDataComponent({
514
- name: "MetricScatter",
515
- dataFnName: "metricScatterData",
516
- shapeName: "ScatterData",
517
- dataFn: metricScatterData,
518
- specKeys: ["points", "series", "x", "y", "evals"],
519
- validate: validateScatterData,
520
- web: (props, ctx) => (_jsx(MetricScatterWeb, { data: props.data, pointHref: props.pointHref, locale: props.locale ?? ctx.locale, className: props.className })),
521
- text: (props, ctx) => scatterText(props.data, ctx),
522
- });
523
- /** 趋势线:x 是 NumericAxis(参数轴),点身份 = (series, x)。 */
524
- export const MetricLine = makeDataComponent({
525
- name: "MetricLine",
526
- dataFnName: "metricLineData",
527
- shapeName: "LineData",
528
- dataFn: metricLineData,
529
- specKeys: ["x", "series", "y", "evals"],
530
- validate: validateLineData,
531
- web: (props, ctx) => (_jsx(MetricLineWeb, { data: props.data, pointHref: props.pointHref, locale: props.locale ?? ctx.locale, className: props.className })),
532
- text: (props, ctx) => lineText(props.data, ctx),
533
- });
534
- /** 成对对比:每行一对(字面声明或 pairsByFlag 派生),格子里 A、B、Δ 三个值。 */
535
- export const DeltaTable = makeDataComponent({
536
- name: "DeltaTable",
537
- dataFnName: "deltaTableData",
538
- shapeName: "DeltaData",
539
- dataFn: deltaTableData,
540
- specKeys: ["by", "pairs", "metrics", "evals"],
541
- validate: validateDeltaData,
542
- web: (props, ctx) => _jsx(DeltaTableWeb, { data: props.data, locale: props.locale ?? ctx.locale, className: props.className }),
543
- text: (props, ctx) => deltaText(props.data, ctx),
544
- });