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
@@ -2,6 +2,6 @@
2
2
  // 有自己的名字、一个源文件,按名字具名导出;默认导出恒等于 standard——裸宿主装载的那份
3
3
  // (docs/feature/reports/library/built-in.md)。新增内建视图 = 新文件 + 新具名导出,
4
4
  // 不需要注册表,也不改变装载管线。
5
- import { standard } from "./standard.js";
6
- export { standard };
5
+ import { standard, standardAttemptPage } from "./standard.js";
6
+ export { standard, standardAttemptPage };
7
7
  export default standard;
@@ -1 +1,8 @@
1
- export declare const standard: import("../report.ts").ReportDefinition;
1
+ export declare const standardAttemptPage: {
2
+ readonly id: "attempt";
3
+ readonly title: "Attempt";
4
+ readonly input: "attempt";
5
+ readonly navigation: false;
6
+ readonly content: import("react").JSX.Element;
7
+ };
8
+ export declare const standard: import("../index.ts").ReportDefinition;
@@ -1,14 +1,23 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // standard —— 内建视图之一:报告 / Attempts / 追踪三页的通用结果站,没有任何私有钩子
3
- // (docs/feature/reports/library/built-in.md)。裸 `niceeval show` 与 `niceeval view`
4
- // 装载的就是它:一份普通 defineReport,与用户的 --report 文件同层、走同一条
2
+ // standard —— 内建视图之一:报告 / Attempts / 追踪三页的通用结果站 + 一张隐藏的 attempt
3
+ // 详情页,没有任何私有钩子(docs/feature/reports/library/built-in.md)。裸 `niceeval show` 与
4
+ // `niceeval view` 装载的就是它:一份普通 defineReport,与用户的 --report 文件同层、走同一条
5
5
  // 装载 → resolve → validate → render 管线。「builtin」不是装载逻辑里的类别,
6
6
  // 只是宿主默认拿哪个值的事实;用户报告经 defineReport({ extends: standard, … }) 整站复用。
7
7
  //
8
- // 三页站点:report(Hero + 警告 + 批量修复 prompt + 实验对比)、attempts(带过滤的
9
- // attempt 全列表)、traces(执行瀑布)。裸宿主导航上能看到的一切内容都在这份定义里;
10
- // 宿主保留的只有机器(docs/feature/reports/architecture.md「宿主保留的只有机器」)。
11
- import { AttemptList, Col, CopyFixPrompt, ExperimentComparison, Hero, ScopeWarnings, TraceWaterfall, defineReport, } from "../index.js";
8
+ // 四页:report(Hero + 警告 + 批量修复 prompt + 实验对比)、attempts(带过滤的 attempt
9
+ // 全列表)、traces(执行瀑布)三页进导航;第四张 standardAttemptPage 以 locator 为输入、
10
+ // 不进导航,locator 深链打开它,content 就是公开的 AttemptDetail 组合组件。裸宿主导航上能
11
+ // 看到的一切内容都在这份定义里;宿主保留的只有机器(docs/feature/reports/architecture.md
12
+ // 「宿主保留的只有机器」)。
13
+ import { AttemptDetail, AttemptList, Col, CopyFixPrompt, ExperimentComparison, Hero, ScopeWarnings, TraceWaterfall, defineReport, } from "../index.js";
14
+ export const standardAttemptPage = {
15
+ id: "attempt",
16
+ title: "Attempt",
17
+ input: "attempt",
18
+ navigation: false,
19
+ content: _jsx(AttemptDetail, {}),
20
+ };
12
21
  export const standard = defineReport({
13
22
  pages: [
14
23
  {
@@ -26,5 +35,6 @@ export const standard = defineReport({
26
35
  title: { en: "Traces", "zh-CN": "追踪" },
27
36
  content: (_jsxs(Col, { children: [_jsx(Hero, {}), _jsx(ScopeWarnings, {}), _jsx(TraceWaterfall, {})] })),
28
37
  },
38
+ standardAttemptPage,
29
39
  ],
30
40
  });
@@ -0,0 +1,6 @@
1
+ import type { ReactElement } from "react";
2
+ import type { AttemptAssertionsData } from "../../model/types.ts";
3
+ export declare function AttemptAssertions({ data, className, }: {
4
+ data: AttemptAssertionsData | null;
5
+ className?: string;
6
+ }): ReactElement | null;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cx } from "../shared.js";
3
+ function assertTone(a) {
4
+ if (a.outcome === "unavailable")
5
+ return "na";
6
+ if (a.outcome === "passed")
7
+ return "good";
8
+ return a.severity === "soft" ? "warn" : "bad";
9
+ }
10
+ function AssertionRow({ a }) {
11
+ return (_jsxs("details", { className: "nre-assertion-row", open: true, children: [_jsxs("summary", { children: [_jsx("span", { className: `nre-assertion-badge nre-tone-${assertTone(a)}`, children: a.outcome === "unavailable" ? "unavailable" : a.outcome }), _jsxs("span", { className: "nre-assertion-name", children: [a.groupPath?.length ? `${a.groupPath.join(" > ")} · ` : "", a.name] }), a.detail && a.detail !== a.name ? _jsx("span", { className: "nre-assertion-detail", children: a.detail }) : null] }), _jsxs("div", { className: "nre-assertion-body", children: [a.outcome === "unavailable" ? _jsx("div", { children: a.reason }) : null, a.outcome !== "unavailable" && a.expected !== undefined ? _jsxs("div", { children: ["expected: ", a.expected] }) : null, a.outcome !== "unavailable" && a.received !== undefined ? _jsxs("div", { children: ["received: ", a.received] }) : null] })] }));
12
+ }
13
+ export function AttemptAssertions({ data, className, }) {
14
+ if (data === null)
15
+ return null;
16
+ return (_jsxs("div", { className: cx("nre", "nre-attempt-assertions", className), children: [data.attention.map((a, i) => (_jsx(AssertionRow, { a: a }, i))), data.passedGroups.length > 0 ? (_jsxs("details", { className: "nre-assertions-passed", children: [_jsxs("summary", { children: ["passed \u00B7 ", data.passedGroups.reduce((n, g) => n + g.items.length, 0)] }), data.passedGroups.map(({ group, items }) => (_jsxs("details", { className: "nre-assertions-passed-group", children: [_jsxs("summary", { children: [group || "—", " \u00B7 ", items.length] }), items.map((a, i) => (_jsx(AssertionRow, { a: a }, i)))] }, group || "·")))] })) : null] }));
17
+ }
@@ -0,0 +1,10 @@
1
+ import type { ReactElement } from "react";
2
+ import type { AttemptConversationData, AttemptConversationReply } from "../../model/types.ts";
3
+ /** AttemptSource 复用同一份回复 renderer,把一轮执行挂回对应的 send 源码行。 */
4
+ export declare function ConversationReplies({ replies }: {
5
+ replies: AttemptConversationReply[];
6
+ }): ReactElement;
7
+ export declare function AttemptConversation({ data, className, }: {
8
+ data: AttemptConversationData | null;
9
+ className?: string;
10
+ }): ReactElement | null;
@@ -0,0 +1,74 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cx } from "../shared.js";
3
+ const TOOL_VERB = {
4
+ shell: "Bash",
5
+ file_read: "Read",
6
+ file_write: "Write",
7
+ file_edit: "Edit",
8
+ web_fetch: "Fetch",
9
+ web_search: "Search",
10
+ glob: "Glob",
11
+ grep: "Grep",
12
+ list_dir: "List",
13
+ agent_task: "Task",
14
+ };
15
+ function compact(value, max = 140) {
16
+ if (value === undefined || value === null)
17
+ return "";
18
+ const text = typeof value === "string" ? value : JSON.stringify(value);
19
+ const oneLine = text.replace(/\s+/g, " ").trim();
20
+ return oneLine.length > max ? `${oneLine.slice(0, max)}…` : oneLine;
21
+ }
22
+ function toolPrimaryArg(input) {
23
+ if (typeof input === "string")
24
+ return compact(input, 80);
25
+ if (input === null || Array.isArray(input) || typeof input !== "object")
26
+ return "";
27
+ for (const key of ["command", "cmd", "path", "file", "file_path", "pattern", "query", "url", "prompt", "description"]) {
28
+ const value = input[key];
29
+ if (typeof value === "string" && value)
30
+ return compact(value, 80);
31
+ if (key === "command" && Array.isArray(value))
32
+ return compact(value.filter((item) => typeof item === "string").join(" "), 80);
33
+ }
34
+ return compact(input, 80);
35
+ }
36
+ function ReplyRow({ reply }) {
37
+ switch (reply.kind) {
38
+ case "assistant":
39
+ return (_jsxs("div", { className: "nre-conv-assistant", children: [_jsx("span", { className: "nre-conv-role", children: "assistant" }), _jsx("div", { className: "nre-conv-text", children: reply.text })] }));
40
+ case "user":
41
+ return (_jsxs("div", { className: "nre-conv-user", children: [_jsx("span", { className: "nre-conv-role", children: "user" }), _jsx("div", { className: "nre-conv-text", children: reply.text })] }));
42
+ case "thinking":
43
+ return (_jsxs("details", { className: "nre-conv-thinking", children: [_jsx("summary", { children: "thinking" }), _jsx("div", { className: "nre-conv-text", children: reply.text })] }));
44
+ case "error":
45
+ return _jsxs("div", { className: "nre-conv-error", children: ["! ", reply.text] });
46
+ case "skill":
47
+ return (_jsxs("div", { className: "nre-conv-skill", children: [_jsx("span", { className: "nre-conv-role", children: "skill loaded" }), " ", reply.skill] }));
48
+ case "tool":
49
+ const verb = (reply.tool ? TOOL_VERB[reply.tool] : undefined) ?? reply.name;
50
+ const arg = toolPrimaryArg(reply.input);
51
+ const preview = compact(reply.output);
52
+ return (_jsxs("details", { className: "nre-conv-tool", children: [_jsxs("summary", { children: [_jsx("span", { className: cx("nre-conv-tool-dot", reply.status ? `nre-conv-tool-${reply.status}` : "nre-conv-tool-pending") }), _jsx("span", { className: "nre-conv-tool-name", title: arg ? `${verb}(${arg})` : verb, children: arg ? `${verb}(${arg})` : verb }), _jsxs("span", { className: "nre-conv-tool-preview", children: [reply.status ?? "pending", preview ? ` · ${preview}` : ""] })] }), _jsx("pre", { className: "nre-conv-tool-io", children: JSON.stringify(reply.input, null, 2) }), reply.output !== undefined ? _jsx("pre", { className: "nre-conv-tool-io", children: JSON.stringify(reply.output, null, 2) }) : null] }));
53
+ case "subagent":
54
+ return (_jsxs("details", { className: "nre-conv-subagent", children: [_jsxs("summary", { children: ["subagent ", reply.name, reply.status ? ` · ${reply.status}` : ""] }), reply.output !== undefined ? _jsx("pre", { className: "nre-conv-tool-io", children: JSON.stringify(reply.output, null, 2) }) : null] }));
55
+ case "input":
56
+ return _jsxs("div", { className: "nre-conv-input", children: ["input requested", reply.request.prompt ? `: ${reply.request.prompt}` : ""] });
57
+ case "compaction":
58
+ return _jsxs("div", { className: "nre-conv-compaction", children: ["compaction", reply.reason ? `: ${reply.reason}` : ""] });
59
+ case "raw":
60
+ return (_jsxs("details", { className: "nre-conv-raw", children: [_jsx("summary", { children: "unrecognized event" }), _jsx("pre", { className: "nre-conv-tool-io", children: JSON.stringify(reply.raw, null, 2) })] }));
61
+ }
62
+ }
63
+ /** AttemptSource 复用同一份回复 renderer,把一轮执行挂回对应的 send 源码行。 */
64
+ export function ConversationReplies({ replies }) {
65
+ return (_jsx("div", { className: "nre-conv-replies", children: replies.map((reply, i) => (_jsx(ReplyRow, { reply: reply }, i))) }));
66
+ }
67
+ function RoundCard({ round, index }) {
68
+ return (_jsxs("div", { className: "nre-conv-round", children: [_jsxs("div", { className: "nre-conv-round-head", children: ["round ", index + 1, round.loc ? (_jsxs("span", { className: "nre-conv-round-loc", title: `${round.loc.file}:${round.loc.line}`, children: [round.loc.file.split("/").pop(), ":", round.loc.line] })) : null] }), round.sentText ? _jsx("div", { className: "nre-conv-sent", children: round.sentText }) : null, _jsx(ConversationReplies, { replies: round.replies })] }));
69
+ }
70
+ export function AttemptConversation({ data, className, }) {
71
+ if (data === null)
72
+ return null;
73
+ return (_jsx("div", { className: cx("nre", "nre-attempt-conversation", className), children: data.rounds.map((round, i) => (_jsx(RoundCard, { round: round, index: i }, i))) }));
74
+ }
@@ -0,0 +1,6 @@
1
+ import type { ReactElement } from "react";
2
+ import type { AttemptDiagnosticsData } from "../../model/types.ts";
3
+ export declare function AttemptDiagnostics({ data, className, }: {
4
+ data: AttemptDiagnosticsData | null;
5
+ className?: string;
6
+ }): ReactElement | null;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cx } from "../shared.js";
3
+ export function AttemptDiagnostics({ data, className, }) {
4
+ if (data === null)
5
+ return null;
6
+ return (_jsx("div", { className: cx("nre", "nre-attempt-diagnostics", className), children: data.groups.map(({ phase, items }) => (_jsxs("div", { className: "nre-diagnostics-group", children: [_jsx("div", { className: "nre-diagnostics-phase", children: phase }), _jsx("ul", { children: items.map((d, i) => (_jsxs("li", { className: `nre-diagnostics-item nre-tone-${d.level === "error" ? "bad" : "warn"}`, children: [_jsxs("span", { className: "nre-diagnostics-meta", children: [d.level, " \u00B7 ", d.code] }), _jsxs("div", { children: [d.message, d.count && d.count > 1 ? ` (${d.count} occurrences)` : ""] })] }, i))) })] }, phase))) }));
7
+ }
@@ -0,0 +1,6 @@
1
+ import type { ReactElement } from "react";
2
+ import type { AttemptDiffData } from "../../model/types.ts";
3
+ export declare function AttemptDiff({ data, className }: {
4
+ data: AttemptDiffData | null;
5
+ className?: string;
6
+ }): ReactElement | null;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cx } from "../shared.js";
3
+ const NET_LABEL = { added: "generated", modified: "modified", deleted: "deleted" };
4
+ function FileRow({ file }) {
5
+ return (_jsxs("li", { className: cx("nre-diff-file", `nre-diff-${file.net}`), children: [_jsx("span", { className: "nre-diff-net", children: NET_LABEL[file.net] }), _jsx("span", { className: "nre-diff-path", children: file.path }), file.binary ? (_jsx("span", { className: "nre-diff-lines", children: "binary" })) : (_jsxs("span", { className: "nre-diff-lines", children: ["+", file.lines.added, " / -", file.lines.deleted] }))] }));
6
+ }
7
+ export function AttemptDiff({ data, className }) {
8
+ if (data === null)
9
+ return null;
10
+ return (_jsx("ul", { className: cx("nre", "nre-attempt-diff", className), children: data.files.map((f) => (_jsx(FileRow, { file: f }, f.path))) }));
11
+ }
@@ -0,0 +1,6 @@
1
+ import type { ReactElement } from "react";
2
+ import type { AttemptErrorData } from "../../model/types.ts";
3
+ export declare function AttemptError({ data, className }: {
4
+ data: AttemptErrorData | null;
5
+ className?: string;
6
+ }): ReactElement | null;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment } from "react";
3
+ import { cx } from "../shared.js";
4
+ export function AttemptError({ data, className }) {
5
+ if (data === null)
6
+ return null;
7
+ const rows = [
8
+ ["phase", data.phase],
9
+ ["code", data.code],
10
+ ["message", data.message],
11
+ ];
12
+ if (data.cause)
13
+ rows.push(["cause", data.cause.name ? `${data.cause.name} · ${data.cause.message}` : data.cause.message]);
14
+ const stack = data.stack?.replace(/\n+$/, "") ?? "";
15
+ return (_jsxs("div", { className: cx("nre", "nre-attempt-error", className), children: [_jsx("dl", { className: "nre-attempt-error-fields", children: rows.map(([k, v]) => (_jsxs(Fragment, { children: [_jsx("dt", { children: k }), _jsx("dd", { children: v })] }, k))) }), stack ? _jsx("pre", { className: "nre-attempt-error-stack", children: stack }) : null] }));
16
+ }
@@ -0,0 +1,6 @@
1
+ import type { ReactElement } from "react";
2
+ import type { AttemptFixPromptData } from "../../model/types.ts";
3
+ export declare function AttemptFixPrompt({ data, className, }: {
4
+ data: AttemptFixPromptData | null;
5
+ className?: string;
6
+ }): ReactElement | null;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cx } from "../shared.js";
3
+ export function AttemptFixPrompt({ data, className, }) {
4
+ if (data === null)
5
+ return null;
6
+ return (_jsxs("details", { className: cx("nre", "nre-attempt-fix-prompt", className), children: [_jsx("summary", { className: "nre-attempt-fix-prompt-summary", children: "Fix prompt" }), _jsx("button", { type: "button", className: "nre-attempt-fix-prompt-copy", "data-nre-copy": data.prompt, children: "Copy fix prompt" }), _jsx("pre", { className: "nre-attempt-fix-prompt-text", children: data.prompt })] }));
7
+ }
@@ -0,0 +1,6 @@
1
+ import type { ReactElement } from "react";
2
+ import type { AttemptSourceData } from "../../model/types.ts";
3
+ export declare function AttemptSource({ data, className }: {
4
+ data: AttemptSourceData | null;
5
+ className?: string;
6
+ }): ReactElement | null;
@@ -0,0 +1,97 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cx } from "../shared.js";
3
+ import { ConversationReplies } from "./AttemptConversation.js";
4
+ const TS_HL_RE = /(\/\/[^\n]*)|(\/\*[^]*?\*\/)|(`(?:\\.|[^`\\])*`|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')|\b(import|from|export|default|const|let|var|async|await|function|return|if|else|for|of|in|new|class|extends|typeof|void|true|false|null|undefined)\b|\b(\d[\d_.]*)\b|([A-Za-z_$][\w$]*)(?=\s*\()/g;
5
+ /** 逐行零依赖 TS 高亮;token class 是稳定的 web 展示语义,不改源码文本。 */
6
+ function highlightTs(line) {
7
+ const out = [];
8
+ let last = 0;
9
+ let i = 0;
10
+ let match;
11
+ TS_HL_RE.lastIndex = 0;
12
+ while ((match = TS_HL_RE.exec(line))) {
13
+ if (match.index > last)
14
+ out.push(line.slice(last, match.index));
15
+ const tokenClass = match[1] || match[2] ? "tok-comment" : match[3] ? "tok-str" : match[4] ? "tok-kw" : match[5] ? "tok-num" : "tok-fn";
16
+ out.push(_jsx("span", { className: tokenClass, children: match[0] }, i++));
17
+ last = match.index + match[0].length;
18
+ if (match[0].length === 0)
19
+ TS_HL_RE.lastIndex++;
20
+ }
21
+ if (last < line.length)
22
+ out.push(line.slice(last));
23
+ return out;
24
+ }
25
+ function assertTone(a) {
26
+ if (a.outcome === "unavailable")
27
+ return "na";
28
+ if (a.outcome === "passed")
29
+ return "good";
30
+ return a.severity === "soft" ? "warn" : "bad";
31
+ }
32
+ function lineTone(line) {
33
+ if (line.assertions.length === 0)
34
+ return undefined;
35
+ if (line.assertions.some((a) => assertTone(a) === "bad"))
36
+ return "bad";
37
+ if (line.assertions.some((a) => assertTone(a) === "warn"))
38
+ return "warn";
39
+ if (line.assertions.some((a) => assertTone(a) === "na"))
40
+ return "na";
41
+ return "good";
42
+ }
43
+ function formatDuration(ms) {
44
+ return ms >= 1000 ? `${(ms / 1000).toFixed(1)}s` : `${Math.round(ms)}ms`;
45
+ }
46
+ function thresholdScores(assertions) {
47
+ const scores = [];
48
+ for (const assertion of assertions) {
49
+ if (assertion.outcome !== "unavailable" && assertion.threshold !== undefined) {
50
+ scores.push(`${assertion.score}/${assertion.threshold}`);
51
+ }
52
+ }
53
+ return scores;
54
+ }
55
+ /** 行号位标记(与产品站示例卡同语言:图标顶替行号,不加独立状态列);内联 SVG,零图标依赖。 */
56
+ const MARK_ICONS = {
57
+ send: _jsx("path", { d: "M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z" }),
58
+ good: (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("path", { d: "m9 12 2 2 4-4" })] })),
59
+ bad: (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("path", { d: "m15 9-6 6" }), _jsx("path", { d: "m9 9 6 6" })] })),
60
+ warn: (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("line", { x1: "12", x2: "12", y1: "8", y2: "12" }), _jsx("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" })] })),
61
+ na: (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }), _jsx("path", { d: "M12 17h.01" })] })),
62
+ };
63
+ function LineNo({ line, tone, send }) {
64
+ const kind = tone ?? (send ? "send" : null);
65
+ if (kind === null)
66
+ return _jsx("span", { className: "nre-source-ln", children: line });
67
+ const label = kind === "bad" ? "failed" : kind === "warn" ? "soft failed" : kind === "good" ? "passed" : kind === "na" ? "unavailable" : "send";
68
+ return (_jsx("span", { className: "nre-source-ln nre-source-ln-mark", role: "img", "aria-label": label, title: label, children: _jsx("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: MARK_ICONS[kind] }) }));
69
+ }
70
+ function LineSummary({ line, tone }) {
71
+ const interactive = line.assertions.length > 0 || line.sends.length > 0 || line.turns.length > 0;
72
+ const scores = thresholdScores(line.assertions);
73
+ return (_jsxs("span", { className: "nre-source-line-summary", children: [_jsx(LineNo, { line: line.line, tone: tone, send: line.sends.length > 0 || line.turns.length > 0 }), _jsx("code", { className: "nre-source-text", children: highlightTs(line.text) }), _jsxs("span", { className: "nre-source-line-meta", children: [scores.length > 0 ? _jsx("span", { className: "nre-source-score-badge", children: scores.join(", ") }) : null, interactive ? _jsx("span", { className: "nre-source-chevron", children: "\u203A" }) : null] })] }));
74
+ }
75
+ function TurnDetail({ turn, showMeta = false, showSent = false }) {
76
+ return (_jsxs("div", { className: cx("nre-source-turn", `nre-source-turn-${turn.status}`), children: [showMeta ? (_jsxs("div", { className: "nre-source-turn-head", children: [_jsx("span", { children: turn.label }), _jsx("span", { children: turn.status }), turn.durationMs === undefined ? null : _jsx("span", { children: formatDuration(turn.durationMs) })] })) : null, showSent && turn.sentText ? _jsx("div", { className: "nre-conv-sent", children: turn.sentText }) : null, _jsx(ConversationReplies, { replies: turn.replies })] }));
77
+ }
78
+ function AssertionDetail({ assertion }) {
79
+ return (_jsxs("div", { className: `nre-assertion-row nre-tone-${assertTone(assertion)}`, children: [_jsxs("div", { className: "nre-source-assertion-head", children: [_jsx("span", { className: "nre-assertion-badge", children: assertion.outcome }), _jsx("span", { className: "nre-assertion-name", children: assertion.name }), assertion.outcome !== "unavailable" ? _jsx("span", { className: "nre-source-assertion-score", children: assertion.score }) : null] }), assertion.detail ? _jsx("div", { className: "nre-assertion-detail", children: assertion.detail }) : null, assertion.outcome === "unavailable" ? (_jsxs("div", { className: "nre-assertion-body", children: ["reason: ", assertion.reason] })) : assertion.expected !== undefined || assertion.received !== undefined || assertion.evidence !== undefined ? (_jsxs("div", { className: "nre-assertion-body", children: [assertion.expected !== undefined ? _jsxs("span", { children: ["expected: ", assertion.expected] }) : null, assertion.received !== undefined ? _jsxs("span", { children: ["received: ", assertion.received] }) : null, assertion.evidence !== undefined ? _jsxs("span", { children: ["evidence: ", assertion.evidence] }) : null] })) : null] }));
80
+ }
81
+ export function AttemptSource({ data, className }) {
82
+ if (data === null)
83
+ return null;
84
+ const firstAttentionLine = data.lines.find((line) => {
85
+ const tone = lineTone(line);
86
+ return tone === "bad" || tone === "warn" || tone === "na";
87
+ })?.line;
88
+ return (_jsxs("div", { className: cx("nre", "nre-attempt-source", className), children: [_jsx("div", { className: "nre-attempt-source-head", children: data.sourcePath }), _jsx("div", { className: "nre-attempt-source-lines", children: data.lines.map((line) => {
89
+ const tone = lineTone(line);
90
+ const interactive = line.assertions.length > 0 || line.sends.length > 0 || line.turns.length > 0;
91
+ const lineClass = cx("nre-source-line", tone ? `nre-tone-${tone}` : undefined, line.sends.length > 0 || line.turns.length > 0 ? "nre-source-line-send" : undefined);
92
+ if (!interactive) {
93
+ return (_jsx("div", { className: lineClass, children: _jsx(LineSummary, { line: line, tone: tone }) }, line.line));
94
+ }
95
+ return (_jsxs("details", { className: lineClass, open: line.line === firstAttentionLine, children: [_jsx("summary", { children: _jsx(LineSummary, { line: line, tone: tone }) }), _jsxs("div", { className: "nre-source-line-detail", children: [line.turns.map((turn, i) => (_jsx(TurnDetail, { turn: turn }, `${turn.label}-${i}`))), line.assertions.map((assertion, i) => (_jsx(AssertionDetail, { assertion: assertion }, i)))] })] }, line.line));
96
+ }) }), data.unmapped.length > 0 ? (_jsxs("div", { className: "nre-attempt-source-unmapped", children: [_jsx("div", { className: "nre-attempt-source-unmapped-head", children: "Other assertions" }), data.unmapped.map((a, i) => (_jsxs("div", { className: `nre-assertion-row nre-tone-${assertTone(a)}`, children: [a.groupPath?.length ? `${a.groupPath.join(" > ")} · ` : "", a.name] }, i)))] })) : null, data.unlocatedTurns.length > 0 ? (_jsxs("div", { className: "nre-attempt-source-unlocated", children: [_jsx("div", { className: "nre-attempt-source-unmapped-head", children: "Other conversation" }), data.unlocatedTurns.map((turn, i) => (_jsx(TurnDetail, { turn: turn, showMeta: true, showSent: true }, `${turn.label}-${i}`)))] })) : null] }));
97
+ }
@@ -0,0 +1,8 @@
1
+ import type { ReactElement } from "react";
2
+ import type { AttemptSummaryData } from "../../model/types.ts";
3
+ import { type ReportLocale } from "../../model/locale.ts";
4
+ export declare function AttemptSummary({ data, locale, className, }: {
5
+ data: AttemptSummaryData;
6
+ locale?: ReportLocale;
7
+ className?: string;
8
+ }): ReactElement;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DEFAULT_REPORT_LOCALE, localeText } from "../../model/locale.js";
3
+ import { cx } from "../shared.js";
4
+ const CAPABILITY_LABEL = {
5
+ source: "source",
6
+ execution: "execution",
7
+ timing: "timing",
8
+ diff: "diff",
9
+ };
10
+ export function AttemptSummary({ data, locale = DEFAULT_REPORT_LOCALE, className, }) {
11
+ const caps = Object.keys(data.capabilities).filter((k) => data.capabilities[k]);
12
+ return (_jsxs("div", { className: cx("nre", "nre-attempt-summary", className), children: [_jsxs("div", { className: "nre-attempt-summary-head", children: [_jsx("span", { className: `nre-verdict-pill nre-verdict-${data.verdict}`, children: localeText(locale, `verdict.${data.verdict}`) }), _jsx("span", { className: "nre-attempt-summary-locator", children: data.locator })] }), _jsxs("dl", { className: "nre-attempt-summary-kpis", children: [_jsxs("div", { children: [_jsx("dt", { children: "Experiment" }), _jsx("dd", { children: data.identity.experimentId })] }), _jsxs("div", { children: [_jsx("dt", { children: "Eval" }), _jsx("dd", { children: data.identity.evalId })] }), _jsxs("div", { children: [_jsx("dt", { children: "Attempt" }), _jsx("dd", { children: data.identity.attempt + 1 })] }), data.startedAt ? (_jsxs("div", { children: [_jsx("dt", { children: "Started" }), _jsx("dd", { children: data.startedAt })] })) : null, _jsxs("div", { children: [_jsx("dt", { children: "Duration" }), _jsx("dd", { children: formatDurationMs(data.durationMs) })] }), data.costUSD !== null ? (_jsxs("div", { children: [_jsx("dt", { children: "Cost" }), _jsxs("dd", { children: ["$", data.costUSD.toFixed(4)] })] })) : null] }), caps.length > 0 ? (_jsx("p", { className: "nre-attempt-summary-caps", children: caps.map((k) => CAPABILITY_LABEL[k]).join(" · ") })) : null] }));
13
+ }
14
+ function formatDurationMs(ms) {
15
+ if (ms >= 60_000)
16
+ return `${Math.floor(ms / 60_000)}m ${Math.round((ms % 60_000) / 1000)}s`;
17
+ if (ms >= 1000)
18
+ return `${(ms / 1000).toFixed(1)}s`;
19
+ return `${ms}ms`;
20
+ }
@@ -0,0 +1,6 @@
1
+ import type { ReactElement } from "react";
2
+ import type { AttemptTimelineData } from "../../model/types.ts";
3
+ export declare function AttemptTimeline({ data, className }: {
4
+ data: AttemptTimelineData | null;
5
+ className?: string;
6
+ }): ReactElement | null;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { formatDurationMs } from "../../model/format.js";
3
+ import { cx } from "../shared.js";
4
+ const CLOSING_PHASES = new Set(["eval.teardown", "agent.teardown", "sandbox.teardown", "sandbox.suspend", "sandbox.stop"]);
5
+ function TimingNodeRow({ node, trace }) {
6
+ const kids = node.children ?? [];
7
+ const spans = node.kind === "turn" && node.traceId && trace ? trace.filter((s) => s.traceId === node.traceId) : [];
8
+ const label = node.kind === "command" && node.command ? `shell · ${node.command.display}` : node.label;
9
+ if (kids.length === 0 && spans.length === 0) {
10
+ return (_jsxs("li", { className: cx("nre-timeline-node", node.failed ? "nre-timeline-failed" : undefined), children: [_jsx("span", { title: label, children: label }), " ", _jsx("span", { className: "nre-timeline-dur", children: formatDurationMs(node.durationMs) }), node.failed ? " ✗" : ""] }));
11
+ }
12
+ return (_jsx("li", { children: _jsxs("details", { open: Boolean(node.failed), children: [_jsxs("summary", { className: cx("nre-timeline-node", node.failed ? "nre-timeline-failed" : undefined), children: [_jsx("span", { title: label, children: label }), " ", _jsx("span", { className: "nre-timeline-dur", children: formatDurationMs(node.durationMs) }), node.failed ? " ✗" : ""] }), kids.length > 0 ? (_jsx("ul", { className: "nre-timeline-children", children: kids.map((child) => (_jsx(TimingNodeRow, { node: child, trace: trace }, child.id))) })) : null, spans.length > 0 ? (_jsx("ul", { className: "nre-timeline-spans", children: spans.map((s) => (_jsxs("li", { children: [s.kind, " \u00B7 ", s.name, " \u00B7 ", formatDurationMs(s.endMs - s.startMs)] }, s.spanId))) })) : null] }) }));
13
+ }
14
+ export function AttemptTimeline({ data, className }) {
15
+ if (data === null)
16
+ return null;
17
+ const main = data.phases.filter((p) => !CLOSING_PHASES.has(p.name));
18
+ const closing = data.phases.filter((p) => CLOSING_PHASES.has(p.name));
19
+ const total = main.reduce((sum, p) => sum + p.durationMs, 0);
20
+ const anyFailed = data.phases.some((p) => p.failed);
21
+ return (_jsxs("details", { className: cx("nre", "nre-attempt-timeline", className), open: anyFailed, children: [_jsxs("summary", { children: ["Timing ", _jsx("span", { className: "nre-timeline-dur", children: formatDurationMs(total) }), anyFailed ? " ✗" : ""] }), _jsx("ul", { className: "nre-timeline-phases", children: main.map((p, i) => {
22
+ const kids = p.children ?? [];
23
+ if (kids.length === 0) {
24
+ return (_jsxs("li", { className: cx("nre-timeline-phase", p.failed ? "nre-timeline-failed" : undefined), children: [p.name, " ", _jsx("span", { className: "nre-timeline-dur", children: formatDurationMs(p.durationMs) }), p.failed ? " ✗" : ""] }, i));
25
+ }
26
+ return (_jsx("li", { children: _jsxs("details", { open: Boolean(p.failed), children: [_jsxs("summary", { className: cx("nre-timeline-phase", p.failed ? "nre-timeline-failed" : undefined), children: [p.name, " ", _jsx("span", { className: "nre-timeline-dur", children: formatDurationMs(p.durationMs) }), p.failed ? " ✗" : ""] }), _jsx("ul", { className: "nre-timeline-children", children: kids.map((node) => (_jsx(TimingNodeRow, { node: node, trace: data.trace }, node.id))) })] }) }, i));
27
+ }) }), closing.length > 0 ? (_jsxs("div", { className: "nre-timeline-closing", children: [_jsx("div", { className: "nre-timeline-closing-head", children: "teardown" }), _jsx("ul", { className: "nre-timeline-phases", children: closing.map((p, i) => (_jsxs("li", { className: cx("nre-timeline-phase", p.failed ? "nre-timeline-failed" : undefined), children: [p.name, " ", _jsx("span", { className: "nre-timeline-dur", children: formatDurationMs(p.durationMs) }), p.failed ? " ✗" : ""] }, i))) })] })) : null] }));
28
+ }
@@ -0,0 +1,6 @@
1
+ import type { ReactElement } from "react";
2
+ import type { AttemptTraceData } from "../../model/types.ts";
3
+ export declare function AttemptTrace({ data, className }: {
4
+ data: AttemptTraceData | null;
5
+ className?: string;
6
+ }): ReactElement | null;
@@ -0,0 +1,29 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { formatDurationMs } from "../../model/format.js";
3
+ import { cx } from "../shared.js";
4
+ function buildForest(spans) {
5
+ const byId = new Map(spans.map((s) => [s.spanId, { span: s, children: [] }]));
6
+ const roots = [];
7
+ for (const node of byId.values()) {
8
+ const parent = node.span.parentSpanId ? byId.get(node.span.parentSpanId) : undefined;
9
+ if (parent)
10
+ parent.children.push(node);
11
+ else
12
+ roots.push(node);
13
+ }
14
+ return roots;
15
+ }
16
+ function SpanRow({ node }) {
17
+ const failed = node.span.status === "error";
18
+ const body = (_jsxs(_Fragment, { children: [_jsx("span", { className: cx("nre-span-kind", node.span.kind ? `nre-span-${node.span.kind}` : undefined), children: node.span.kind ?? "other" }), _jsx("span", { title: node.span.name, children: node.span.name }), _jsx("span", { className: "nre-span-dur", children: formatDurationMs(node.span.endMs - node.span.startMs) }), failed ? " ✗" : ""] }));
19
+ if (node.children.length === 0) {
20
+ return _jsx("li", { className: "nre-trace-span", children: body });
21
+ }
22
+ return (_jsx("li", { children: _jsxs("details", { open: failed, children: [_jsx("summary", { className: "nre-trace-span", children: body }), _jsx("ul", { className: "nre-trace-children", children: node.children.map((child) => (_jsx(SpanRow, { node: child }, child.span.spanId))) })] }) }));
23
+ }
24
+ export function AttemptTrace({ data, className }) {
25
+ if (data === null)
26
+ return null;
27
+ const forest = buildForest(data.spans);
28
+ return (_jsx("ul", { className: cx("nre", "nre-attempt-trace", className), children: forest.map((node) => (_jsx(SpanRow, { node: node }, node.span.spanId))) }));
29
+ }
@@ -0,0 +1,6 @@
1
+ import type { ReactElement } from "react";
2
+ import type { AttemptUsageData } from "../../model/types.ts";
3
+ export declare function AttemptUsage({ data, className }: {
4
+ data: AttemptUsageData | null;
5
+ className?: string;
6
+ }): ReactElement | null;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cx } from "../shared.js";
3
+ export function AttemptUsage({ data, className }) {
4
+ if (data === null)
5
+ return null;
6
+ const { usage } = data;
7
+ const rows = [
8
+ ["input tokens", usage.inputTokens.toLocaleString()],
9
+ ["output tokens", usage.outputTokens.toLocaleString()],
10
+ ];
11
+ if (usage.cacheReadTokens !== undefined)
12
+ rows.push(["cache read", usage.cacheReadTokens.toLocaleString()]);
13
+ if (usage.cacheWriteTokens !== undefined)
14
+ rows.push(["cache write", usage.cacheWriteTokens.toLocaleString()]);
15
+ if (usage.requests !== undefined)
16
+ rows.push(["requests", String(usage.requests)]);
17
+ if (data.costUSD !== null)
18
+ rows.push(["cost", `$${data.costUSD.toFixed(4)}`]);
19
+ return (_jsx("dl", { className: cx("nre", "nre-attempt-usage", className), children: rows.map(([k, v]) => (_jsxs("div", { className: "nre-attempt-usage-row", children: [_jsx("dt", { children: k }), _jsx("dd", { children: v })] }, k))) }));
20
+ }
@@ -0,0 +1,24 @@
1
+ import type { AttemptEvidence } from "../../../results/attempt-evidence.ts";
2
+ import type { AttemptAssertionsData, AttemptConversationData, AttemptDiagnosticsData, AttemptDiffData, AttemptErrorData, AttemptFixPromptData, AttemptSourceData, AttemptSummaryData, AttemptTimelineData, AttemptTraceData, AttemptUsageData } from "../../model/types.ts";
3
+ export declare function attemptSummaryData(evidence: AttemptEvidence): AttemptSummaryData;
4
+ export declare function attemptErrorData(evidence: AttemptEvidence): AttemptErrorData | null;
5
+ export declare function attemptAssertionsData(evidence: AttemptEvidence): AttemptAssertionsData | null;
6
+ export declare function attemptSourceData(evidence: AttemptEvidence): AttemptSourceData | null;
7
+ /** 单条 attempt 版的批量修复 prompt(与 CopyFixPrompt 的多条版本同一份步骤文案)。 */
8
+ export declare function attemptFixPromptData(evidence: AttemptEvidence): AttemptFixPromptData | null;
9
+ /** 收尾段的阶段名(见 docs/feature/results/architecture.md);两面渲染都把这些单列在主链之后,不计入主链总耗时。 */
10
+ export declare const TIMELINE_CLOSING_PHASES: ReadonlySet<string>;
11
+ export declare function attemptTimelineData(evidence: AttemptEvidence): AttemptTimelineData | null;
12
+ /**
13
+ * 标准事件流按 `loc` 分轮(docs/feature/reports/library/attempt-detail.md「Attempt 详情组件」):
14
+ * 带 loc 的 user 消息开一轮;无 loc 的 user 消息不开新轮——与当前轮 sent 同文本的回显直接
15
+ * 吃掉,其它(stop-hook 反馈、skill 注入等轮内注入)作为回复条目留在当前轮。流首出现无 loc
16
+ * 的 user 消息(没有当前轮可归入)时退化开一条 loc 缺省的兜底轮,不丢弃。未识别的事件类型
17
+ * 包成 `raw` 条目原样呈现,不吞没其余事件——StreamEvent 是随 artifact 版本演进的开放词表,
18
+ * 这份纯函数不能假设自己认识每一种将来会出现的 type。
19
+ */
20
+ export declare function attemptConversationData(evidence: AttemptEvidence): AttemptConversationData | null;
21
+ export declare function attemptDiagnosticsData(evidence: AttemptEvidence): AttemptDiagnosticsData | null;
22
+ export declare function attemptUsageData(evidence: AttemptEvidence): AttemptUsageData | null;
23
+ export declare function attemptTraceData(evidence: AttemptEvidence): AttemptTraceData | null;
24
+ export declare function attemptDiffData(evidence: AttemptEvidence): AttemptDiffData | null;