niceeval 0.13.2 → 0.13.3

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 (494) hide show
  1. package/dist/agents/bub.cjs +4 -4
  2. package/dist/agents/bub.cjs.map +1 -1
  3. package/dist/agents/bub.d.cts +2 -2
  4. package/dist/agents/bub.d.mts +2 -2
  5. package/dist/agents/bub.d.ts +2 -2
  6. package/dist/agents/claude-code-native.cjs +213 -0
  7. package/dist/agents/claude-code-native.cjs.map +1 -0
  8. package/dist/agents/claude-code-native.d.cts +5 -0
  9. package/dist/agents/claude-code-native.d.mts +5 -0
  10. package/dist/agents/claude-code-native.d.ts +5 -0
  11. package/dist/agents/claude-code-native.js +6 -0
  12. package/dist/agents/claude-code-native.js.map +1 -0
  13. package/dist/agents/claude-code.cjs +26 -80
  14. package/dist/agents/claude-code.cjs.map +1 -1
  15. package/dist/agents/codex-app-server.cjs +314 -0
  16. package/dist/agents/codex-app-server.cjs.map +1 -0
  17. package/dist/agents/codex-app-server.d.cts +9 -0
  18. package/dist/agents/codex-app-server.d.mts +9 -0
  19. package/dist/agents/codex-app-server.d.ts +9 -0
  20. package/dist/agents/codex-app-server.js +6 -0
  21. package/dist/agents/codex-app-server.js.map +1 -0
  22. package/dist/agents/codex.cjs +19 -68
  23. package/dist/agents/codex.cjs.map +1 -1
  24. package/dist/agents/codex.d.cts +3 -3
  25. package/dist/agents/codex.d.mts +3 -3
  26. package/dist/agents/codex.d.ts +3 -3
  27. package/dist/agents/index.cjs +3 -1
  28. package/dist/agents/index.cjs.map +1 -1
  29. package/dist/agents/index.d.cts +1 -0
  30. package/dist/agents/index.d.mts +1 -0
  31. package/dist/agents/index.d.ts +1 -0
  32. package/dist/agents/index.js +84 -82
  33. package/dist/agents/index.mjs +84 -82
  34. package/dist/agents/managed-jsonl.cjs +207 -0
  35. package/dist/agents/managed-jsonl.cjs.map +1 -0
  36. package/dist/agents/managed-jsonl.d.cts +39 -0
  37. package/dist/agents/managed-jsonl.d.mts +39 -0
  38. package/dist/agents/managed-jsonl.d.ts +39 -0
  39. package/dist/agents/managed-jsonl.js +6 -0
  40. package/dist/agents/managed-jsonl.js.map +1 -0
  41. package/dist/agents/managed-process.cjs +31 -0
  42. package/dist/agents/managed-process.cjs.map +1 -0
  43. package/dist/agents/managed-process.d.cts +3 -0
  44. package/dist/agents/managed-process.d.mts +3 -0
  45. package/dist/agents/managed-process.d.ts +3 -0
  46. package/dist/agents/managed-process.js +6 -0
  47. package/dist/agents/managed-process.js.map +1 -0
  48. package/dist/agents/omp.cjs +18 -1
  49. package/dist/agents/omp.cjs.map +1 -1
  50. package/dist/agents/sdk-streams.cjs +11 -4
  51. package/dist/agents/sdk-streams.cjs.map +1 -1
  52. package/dist/agents/types.cjs.map +1 -1
  53. package/dist/agents/types.d.cts +8 -0
  54. package/dist/agents/types.d.mts +8 -0
  55. package/dist/agents/types.d.ts +8 -0
  56. package/dist/analysis/bindings.cjs +74 -19
  57. package/dist/analysis/bindings.cjs.map +1 -1
  58. package/dist/analysis/bindings.d.cts +534 -156
  59. package/dist/analysis/bindings.d.mts +534 -156
  60. package/dist/analysis/bindings.d.ts +534 -156
  61. package/dist/analysis/domain-view.cjs.map +1 -1
  62. package/dist/analysis/domain-view.d.cts +137 -8
  63. package/dist/analysis/domain-view.d.mts +137 -8
  64. package/dist/analysis/domain-view.d.ts +137 -8
  65. package/dist/analysis/index.cjs.map +1 -1
  66. package/dist/analysis/index.d.cts +1 -1
  67. package/dist/analysis/index.d.mts +1 -1
  68. package/dist/analysis/index.d.ts +1 -1
  69. package/dist/assertions/api.cjs.map +1 -1
  70. package/dist/assertions/api.d.cts +62 -0
  71. package/dist/assertions/api.d.mts +62 -0
  72. package/dist/assertions/api.d.ts +62 -0
  73. package/dist/assertions/judge.cjs +56 -5
  74. package/dist/assertions/judge.cjs.map +1 -1
  75. package/dist/assertions/match.cjs +66 -42
  76. package/dist/assertions/match.cjs.map +1 -1
  77. package/dist/assertions/match.d.cts +13 -0
  78. package/dist/assertions/match.d.mts +13 -0
  79. package/dist/assertions/match.d.ts +13 -0
  80. package/dist/assertions/record/attachment.cjs +104 -33
  81. package/dist/assertions/record/attachment.cjs.map +1 -1
  82. package/dist/assertions/record/attachment.d.cts +294 -57
  83. package/dist/assertions/record/attachment.d.mts +294 -57
  84. package/dist/assertions/record/attachment.d.ts +294 -57
  85. package/dist/assertions/record/codec.cjs +91 -17
  86. package/dist/assertions/record/codec.cjs.map +1 -1
  87. package/dist/assertions/record/codec.d.cts +280 -52
  88. package/dist/assertions/record/codec.d.mts +280 -52
  89. package/dist/assertions/record/codec.d.ts +280 -52
  90. package/dist/assertions/record/index.js +2 -0
  91. package/dist/assertions/record/model.cjs +16 -0
  92. package/dist/assertions/record/model.cjs.map +1 -1
  93. package/dist/assertions/record/model.d.cts +120 -13
  94. package/dist/assertions/record/model.d.mts +120 -13
  95. package/dist/assertions/record/model.d.ts +120 -13
  96. package/dist/assertions/record/model.js +2 -0
  97. package/dist/assertions/record/producer.cjs +70 -50
  98. package/dist/assertions/record/producer.cjs.map +1 -1
  99. package/dist/assertions/record/producer.d.cts +8 -7
  100. package/dist/assertions/record/producer.d.mts +8 -7
  101. package/dist/assertions/record/producer.d.ts +8 -7
  102. package/dist/assertions/runtime.cjs +49 -7
  103. package/dist/assertions/runtime.cjs.map +1 -1
  104. package/dist/cli/application.cjs +40 -0
  105. package/dist/cli/application.cjs.map +1 -0
  106. package/dist/cli/application.d.cts +129 -0
  107. package/dist/cli/application.d.mts +129 -0
  108. package/dist/cli/application.d.ts +129 -0
  109. package/dist/cli/application.js +24 -0
  110. package/dist/cli/application.js.map +1 -0
  111. package/dist/cli/bootstrap.cjs +10 -4
  112. package/dist/cli/bootstrap.cjs.map +1 -1
  113. package/dist/cli/node-application.cjs +123 -0
  114. package/dist/cli/node-application.cjs.map +1 -0
  115. package/dist/cli/node-application.d.cts +14 -0
  116. package/dist/cli/node-application.d.mts +14 -0
  117. package/dist/cli/node-application.d.ts +14 -0
  118. package/dist/cli/node-application.js +26 -0
  119. package/dist/cli/node-application.js.map +1 -0
  120. package/dist/cli/program.cjs +2807 -0
  121. package/dist/cli/program.cjs.map +1 -0
  122. package/dist/cli/program.d.cts +352 -0
  123. package/dist/cli/program.d.mts +352 -0
  124. package/dist/cli/program.d.ts +352 -0
  125. package/dist/cli/program.js +36 -0
  126. package/dist/cli/program.js.map +1 -0
  127. package/dist/cli/project-configuration.cjs +134 -0
  128. package/dist/cli/project-configuration.cjs.map +1 -0
  129. package/dist/cli/project-configuration.d.cts +64 -0
  130. package/dist/cli/project-configuration.d.mts +64 -0
  131. package/dist/cli/project-configuration.d.ts +64 -0
  132. package/dist/cli/project-configuration.js +22 -0
  133. package/dist/cli/project-configuration.js.map +1 -0
  134. package/dist/cli/record.cjs +20 -4
  135. package/dist/cli/record.cjs.map +1 -1
  136. package/dist/cli/record.d.cts +3 -3
  137. package/dist/cli/record.d.mts +3 -3
  138. package/dist/cli/record.d.ts +3 -3
  139. package/dist/cli.cjs +19 -3130
  140. package/dist/cli.cjs.map +1 -1
  141. package/dist/cli.d.cts +2 -148
  142. package/dist/cli.d.mts +2 -148
  143. package/dist/cli.d.ts +2 -148
  144. package/dist/cli.js +22 -30
  145. package/dist/context/assert-first.cjs +21 -15
  146. package/dist/context/assert-first.cjs.map +1 -1
  147. package/dist/context/assert-first.d.cts +1 -0
  148. package/dist/context/assert-first.d.mts +1 -0
  149. package/dist/context/assert-first.d.ts +1 -0
  150. package/dist/context/attempt-resources.cjs +13 -0
  151. package/dist/context/attempt-resources.cjs.map +1 -0
  152. package/dist/context/attempt-resources.d.cts +3 -0
  153. package/dist/context/attempt-resources.d.mts +3 -0
  154. package/dist/context/attempt-resources.d.ts +3 -0
  155. package/dist/context/attempt-resources.js +8 -0
  156. package/dist/context/attempt-resources.js.map +1 -0
  157. package/dist/context/session.cjs +4 -3
  158. package/dist/context/session.cjs.map +1 -1
  159. package/dist/context/session.d.cts +1 -0
  160. package/dist/context/session.d.mts +1 -0
  161. package/dist/context/session.d.ts +1 -0
  162. package/dist/eval/record/verdict.cjs +3 -2
  163. package/dist/eval/record/verdict.cjs.map +1 -1
  164. package/dist/experiment/host/index.cjs +1 -6
  165. package/dist/experiment/host/index.cjs.map +1 -1
  166. package/dist/experiment/host/index.d.cts +1 -0
  167. package/dist/experiment/host/index.d.mts +1 -0
  168. package/dist/experiment/host/index.d.ts +1 -0
  169. package/dist/load-config.cjs +13 -4
  170. package/dist/load-config.cjs.map +1 -1
  171. package/dist/load-config.d.cts +4 -3
  172. package/dist/load-config.d.mts +4 -3
  173. package/dist/load-config.d.ts +4 -3
  174. package/dist/load-config.js +4 -2
  175. package/dist/o11y/parsers/codex.cjs +29 -7
  176. package/dist/o11y/parsers/codex.cjs.map +1 -1
  177. package/dist/record/codec/core.d.cts +0 -2
  178. package/dist/record/codec/core.d.mts +0 -2
  179. package/dist/record/codec/core.d.ts +0 -2
  180. package/dist/record/codec/identifiers.cjs +2 -3
  181. package/dist/record/codec/identifiers.cjs.map +1 -1
  182. package/dist/record/codec/identifiers.d.cts +1 -2
  183. package/dist/record/codec/identifiers.d.mts +1 -2
  184. package/dist/record/codec/identifiers.d.ts +1 -2
  185. package/dist/record/codec/identifiers.js +10 -12
  186. package/dist/record/codec/index.js +42 -44
  187. package/dist/record/definition/attachment.cjs +1 -0
  188. package/dist/record/definition/attachment.cjs.map +1 -1
  189. package/dist/record/definition/attachment.d.cts +14 -0
  190. package/dist/record/definition/attachment.d.mts +14 -0
  191. package/dist/record/definition/attachment.d.ts +14 -0
  192. package/dist/record/family/assertions-v1.cjs +104 -0
  193. package/dist/record/family/assertions-v1.cjs.map +1 -0
  194. package/dist/record/family/assertions-v1.d.cts +2 -0
  195. package/dist/record/family/assertions-v1.d.mts +2 -0
  196. package/dist/record/family/assertions-v1.d.ts +2 -0
  197. package/dist/record/family/assertions-v1.js +6 -0
  198. package/dist/record/family/assertions-v1.js.map +1 -0
  199. package/dist/record/family/assertions.cjs +16 -5
  200. package/dist/record/family/assertions.cjs.map +1 -1
  201. package/dist/record/family/assertions.d.cts +510 -56
  202. package/dist/record/family/assertions.d.mts +510 -56
  203. package/dist/record/family/assertions.d.ts +510 -56
  204. package/dist/record/family/assertions.js +14 -10
  205. package/dist/record/family/catalog.cjs +17 -1
  206. package/dist/record/family/catalog.cjs.map +1 -1
  207. package/dist/record/family/catalog.d.cts +1292 -104
  208. package/dist/record/family/catalog.d.mts +1292 -104
  209. package/dist/record/family/catalog.d.ts +1292 -104
  210. package/dist/record/family/catalog.js +22 -20
  211. package/dist/record/family/index.js +144 -138
  212. package/dist/record/family/observability-v1.cjs +5 -0
  213. package/dist/record/family/observability-v1.cjs.map +1 -1
  214. package/dist/record/family/observability.cjs +1 -1
  215. package/dist/record/family/observability.cjs.map +1 -1
  216. package/dist/record/host/runtime.cjs +323 -173
  217. package/dist/record/host/runtime.cjs.map +1 -1
  218. package/dist/record/host/types.cjs.map +1 -1
  219. package/dist/record/host/types.d.cts +9 -7
  220. package/dist/record/host/types.d.mts +9 -7
  221. package/dist/record/host/types.d.ts +9 -7
  222. package/dist/record/model/core.cjs.map +1 -1
  223. package/dist/record/model/core.d.cts +1 -2
  224. package/dist/record/model/core.d.mts +1 -2
  225. package/dist/record/model/core.d.ts +1 -2
  226. package/dist/record/model/definition.cjs +1 -2
  227. package/dist/record/model/definition.cjs.map +1 -1
  228. package/dist/record/model/definition.d.cts +1 -7
  229. package/dist/record/model/definition.d.mts +1 -7
  230. package/dist/record/model/definition.d.ts +1 -7
  231. package/dist/record/model/identifiers.cjs +2 -3
  232. package/dist/record/model/identifiers.cjs.map +1 -1
  233. package/dist/record/model/identifiers.d.cts +1 -3
  234. package/dist/record/model/identifiers.d.mts +1 -3
  235. package/dist/record/model/identifiers.d.ts +1 -3
  236. package/dist/record/model/identifiers.js +36 -38
  237. package/dist/record/model/index.js +60 -62
  238. package/dist/record/platform/node.cjs +17 -7
  239. package/dist/record/platform/node.cjs.map +1 -1
  240. package/dist/record/platform/services.cjs.map +1 -1
  241. package/dist/record/platform/services.d.cts +8 -3
  242. package/dist/record/platform/services.d.mts +8 -3
  243. package/dist/record/platform/services.d.ts +8 -3
  244. package/dist/record/reader/format.cjs +16 -65
  245. package/dist/record/reader/format.cjs.map +1 -1
  246. package/dist/record/reader/format.d.cts +5 -9
  247. package/dist/record/reader/format.d.mts +5 -9
  248. package/dist/record/reader/format.d.ts +5 -9
  249. package/dist/record/reader/index.js +10 -8
  250. package/dist/record/reader/runtime.cjs +63 -32
  251. package/dist/record/reader/runtime.cjs.map +1 -1
  252. package/dist/record/reader/runtime.d.cts +40 -4
  253. package/dist/record/reader/runtime.d.mts +40 -4
  254. package/dist/record/reader/runtime.d.ts +40 -4
  255. package/dist/record/reader/runtime.js +6 -4
  256. package/dist/report/assets/enhance.js +5 -5
  257. package/dist/report/assets/styles.css +190 -24
  258. package/dist/report/built-in/result-components.cjs +8 -5
  259. package/dist/report/built-in/result-components.cjs.map +1 -1
  260. package/dist/report/built-in/standard.cjs +3 -0
  261. package/dist/report/built-in/standard.cjs.map +1 -1
  262. package/dist/report/built-in/standard.d.cts +2 -0
  263. package/dist/report/built-in/standard.d.mts +2 -0
  264. package/dist/report/built-in/standard.d.ts +2 -0
  265. package/dist/report/client-dist/app.js +53 -0
  266. package/dist/report/components/attempt-detail/compute.cjs +108 -231
  267. package/dist/report/components/attempt-detail/compute.cjs.map +1 -1
  268. package/dist/report/components/attempt-detail/compute.d.cts +11 -45
  269. package/dist/report/components/attempt-detail/compute.d.mts +11 -45
  270. package/dist/report/components/attempt-detail/compute.d.ts +11 -45
  271. package/dist/report/components/attempt-detail/compute.js +2 -4
  272. package/dist/report/components/attempt-detail/content.cjs +4 -4
  273. package/dist/report/components/attempt-detail/content.cjs.map +1 -1
  274. package/dist/report/components/attempt-detail/validate.cjs +47 -4
  275. package/dist/report/components/attempt-detail/validate.cjs.map +1 -1
  276. package/dist/report/components/entity-lists/compute.cjs +9 -15
  277. package/dist/report/components/entity-lists/compute.cjs.map +1 -1
  278. package/dist/report/components/entity-lists/content.cjs +53 -40
  279. package/dist/report/components/entity-lists/content.cjs.map +1 -1
  280. package/dist/report/components/entity-lists/index.cjs +1 -3
  281. package/dist/report/components/entity-lists/index.cjs.map +1 -1
  282. package/dist/report/components/experiment-detail/compute.cjs +4 -6
  283. package/dist/report/components/experiment-detail/compute.cjs.map +1 -1
  284. package/dist/report/components/summaries/index.cjs +5 -1
  285. package/dist/report/components/summaries/index.cjs.map +1 -1
  286. package/dist/report/definition/cell.cjs +14 -7
  287. package/dist/report/definition/cell.cjs.map +1 -1
  288. package/dist/report/definition/cell.d.cts +4 -0
  289. package/dist/report/definition/cell.d.mts +4 -0
  290. package/dist/report/definition/cell.d.ts +4 -0
  291. package/dist/report/definition/primitives/assertion-evidence.cjs +96 -0
  292. package/dist/report/definition/primitives/assertion-evidence.cjs.map +1 -0
  293. package/dist/report/definition/primitives/assertion-evidence.d.cts +11 -0
  294. package/dist/report/definition/primitives/assertion-evidence.d.mts +11 -0
  295. package/dist/report/definition/primitives/assertion-evidence.d.ts +11 -0
  296. package/dist/report/definition/primitives/assertion-evidence.js +6 -0
  297. package/dist/report/definition/primitives/assertion-evidence.js.map +1 -0
  298. package/dist/report/definition/primitives/conversation.cjs +7 -0
  299. package/dist/report/definition/primitives/conversation.cjs.map +1 -1
  300. package/dist/report/definition/primitives/conversation.d.cts +2 -0
  301. package/dist/report/definition/primitives/conversation.d.mts +2 -0
  302. package/dist/report/definition/primitives/conversation.d.ts +2 -0
  303. package/dist/report/definition/primitives/turn-trace.cjs +53 -3
  304. package/dist/report/definition/primitives/turn-trace.cjs.map +1 -1
  305. package/dist/report/definition/primitives.cjs +14 -1
  306. package/dist/report/definition/primitives.cjs.map +1 -1
  307. package/dist/report/definition/report.cjs +16 -8
  308. package/dist/report/definition/report.cjs.map +1 -1
  309. package/dist/report/definition/report.d.cts +6 -0
  310. package/dist/report/definition/report.d.mts +6 -0
  311. package/dist/report/definition/report.d.ts +6 -0
  312. package/dist/report/definition/table-text.cjs +12 -3
  313. package/dist/report/definition/table-text.cjs.map +1 -1
  314. package/dist/report/definition/table-text.d.cts +6 -1
  315. package/dist/report/definition/table-text.d.mts +6 -1
  316. package/dist/report/definition/table-text.d.ts +6 -1
  317. package/dist/report/execution/model.cjs +6 -14
  318. package/dist/report/execution/model.cjs.map +1 -1
  319. package/dist/report/execution/model.d.cts +5 -10
  320. package/dist/report/execution/model.d.mts +5 -10
  321. package/dist/report/execution/model.d.ts +5 -10
  322. package/dist/report/execution/model.js +6 -6
  323. package/dist/report/execution/paths.cjs +0 -11
  324. package/dist/report/execution/paths.cjs.map +1 -1
  325. package/dist/report/execution/paths.d.cts +0 -1
  326. package/dist/report/execution/paths.d.mts +0 -1
  327. package/dist/report/execution/paths.d.ts +0 -1
  328. package/dist/report/execution/paths.js +6 -8
  329. package/dist/report/host/execute.cjs +13 -22
  330. package/dist/report/host/execute.cjs.map +1 -1
  331. package/dist/report/host/execute.d.cts +1 -4
  332. package/dist/report/host/execute.d.mts +1 -4
  333. package/dist/report/host/execute.d.ts +1 -4
  334. package/dist/report/host/from-record.cjs +3 -0
  335. package/dist/report/host/from-record.cjs.map +1 -1
  336. package/dist/report/host/from-record.d.cts +4 -1
  337. package/dist/report/host/from-record.d.mts +4 -1
  338. package/dist/report/host/from-record.d.ts +4 -1
  339. package/dist/report/host/site-assets.cjs +1 -2
  340. package/dist/report/host/site-assets.cjs.map +1 -1
  341. package/dist/report/host/site-assets.d.cts +0 -1
  342. package/dist/report/host/site-assets.d.mts +0 -1
  343. package/dist/report/host/site-assets.d.ts +0 -1
  344. package/dist/report/host/site-assets.js +2 -4
  345. package/dist/report/host/static.cjs +71 -346
  346. package/dist/report/host/static.cjs.map +1 -1
  347. package/dist/report/host/static.d.cts +1 -3
  348. package/dist/report/host/static.d.mts +1 -3
  349. package/dist/report/host/static.d.ts +1 -3
  350. package/dist/report/host/static.js +2 -2
  351. package/dist/report/host/view-session.cjs.map +1 -1
  352. package/dist/report/host/view-session.d.cts +1 -1
  353. package/dist/report/host/view-session.d.mts +1 -1
  354. package/dist/report/host/view-session.d.ts +1 -1
  355. package/dist/report/model/locale.cjs +1 -1
  356. package/dist/report/model/locale.cjs.map +1 -1
  357. package/dist/report/model/locale.d.cts +1 -1
  358. package/dist/report/model/locale.d.mts +1 -1
  359. package/dist/report/model/locale.d.ts +1 -1
  360. package/dist/report/model/pricing.cjs +2 -2
  361. package/dist/report/model/pricing.cjs.map +1 -1
  362. package/dist/report/react/enhance.js +5 -5
  363. package/dist/report/react/styles.css +190 -24
  364. package/dist/runner/adoption.cjs +4 -7
  365. package/dist/runner/adoption.cjs.map +1 -1
  366. package/dist/runner/attempt-resources.cjs +60 -0
  367. package/dist/runner/attempt-resources.cjs.map +1 -0
  368. package/dist/runner/attempt-resources.d.cts +13 -0
  369. package/dist/runner/attempt-resources.d.mts +13 -0
  370. package/dist/runner/attempt-resources.d.ts +13 -0
  371. package/dist/runner/attempt-resources.js +6 -0
  372. package/dist/runner/attempt-resources.js.map +1 -0
  373. package/dist/runner/attempt.cjs +37 -3
  374. package/dist/runner/attempt.cjs.map +1 -1
  375. package/dist/runner/feedback/failure.cjs +77 -2
  376. package/dist/runner/feedback/failure.cjs.map +1 -1
  377. package/dist/runner/feedback/failure.d.cts +2 -1
  378. package/dist/runner/feedback/failure.d.mts +2 -1
  379. package/dist/runner/feedback/failure.d.ts +2 -1
  380. package/dist/runner/project-current.cjs +2 -13
  381. package/dist/runner/project-current.cjs.map +1 -1
  382. package/dist/runner/project-current.d.cts +4 -2
  383. package/dist/runner/project-current.d.mts +4 -2
  384. package/dist/runner/project-current.d.ts +4 -2
  385. package/dist/runner/reporters/braintrust.cjs +7 -7
  386. package/dist/runner/reporters/braintrust.cjs.map +1 -1
  387. package/dist/runner/reuse-readback.cjs +3 -4
  388. package/dist/runner/reuse-readback.cjs.map +1 -1
  389. package/dist/runner/run.cjs +5 -2
  390. package/dist/runner/run.cjs.map +1 -1
  391. package/dist/sandbox/backend.cjs +32 -2
  392. package/dist/sandbox/backend.cjs.map +1 -1
  393. package/dist/sandbox/backend.d.cts +12 -1
  394. package/dist/sandbox/backend.d.mts +12 -1
  395. package/dist/sandbox/backend.d.ts +12 -1
  396. package/dist/sandbox/backend.js +28 -22
  397. package/dist/sandbox/docker.cjs +140 -0
  398. package/dist/sandbox/docker.cjs.map +1 -1
  399. package/dist/sandbox/docker.d.cts +3 -1
  400. package/dist/sandbox/docker.d.mts +3 -1
  401. package/dist/sandbox/docker.d.ts +3 -1
  402. package/dist/sandbox/e2b.cjs +42 -0
  403. package/dist/sandbox/e2b.cjs.map +1 -1
  404. package/dist/sandbox/e2b.d.cts +2 -0
  405. package/dist/sandbox/e2b.d.mts +2 -0
  406. package/dist/sandbox/e2b.d.ts +2 -0
  407. package/dist/sandbox/local.cjs +64 -0
  408. package/dist/sandbox/local.cjs.map +1 -1
  409. package/dist/sandbox/local.d.cts +3 -1
  410. package/dist/sandbox/local.d.mts +3 -1
  411. package/dist/sandbox/local.d.ts +3 -1
  412. package/dist/sandbox/managed-process.cjs +49 -0
  413. package/dist/sandbox/managed-process.cjs.map +1 -0
  414. package/dist/sandbox/managed-process.d.cts +11 -0
  415. package/dist/sandbox/managed-process.d.mts +11 -0
  416. package/dist/sandbox/managed-process.d.ts +11 -0
  417. package/dist/sandbox/managed-process.js +6 -0
  418. package/dist/sandbox/managed-process.js.map +1 -0
  419. package/dist/sandbox/types.cjs.map +1 -1
  420. package/dist/sandbox/types.d.cts +24 -0
  421. package/dist/sandbox/types.d.mts +24 -0
  422. package/dist/sandbox/types.d.ts +24 -0
  423. package/dist/sandbox/vercel.cjs +1 -0
  424. package/dist/sandbox/vercel.cjs.map +1 -1
  425. package/dist/sandbox/vercel.d.cts +1 -0
  426. package/dist/sandbox/vercel.d.mts +1 -0
  427. package/dist/sandbox/vercel.d.ts +1 -0
  428. package/dist/view/server.cjs +2 -37
  429. package/dist/view/server.cjs.map +1 -1
  430. package/dist/view/server.d.cts +0 -3
  431. package/dist/view/server.d.mts +0 -3
  432. package/dist/view/server.d.ts +0 -3
  433. package/docs-site/zh/reference/builtin-agents.mdx +7 -7
  434. package/docs-site/zh/reference/official-adapters.mdx +4 -4
  435. package/docs-site/zh/reference/report-components.mdx +2 -2
  436. package/docs-site/zh/tutorials/configuration.mdx +2 -2
  437. package/docs-site/zh/tutorials/deploy-report-site.mdx +24 -2
  438. package/docs-site/zh/tutorials/publish-report.mdx +4 -4
  439. package/docs-site/zh/tutorials/sandbox-agent.mdx +5 -5
  440. package/docs-site/zh/tutorials/theming.mdx +2 -2
  441. package/package.json +4 -6
  442. package/dist/record/migration/index.cjs +0 -5
  443. package/dist/record/migration/index.cjs.map +0 -1
  444. package/dist/record/migration/index.d.cts +0 -11
  445. package/dist/record/migration/index.d.mts +0 -11
  446. package/dist/record/migration/index.d.ts +0 -11
  447. package/dist/record/migration/index.js +0 -6
  448. package/dist/record/migration/index.js.map +0 -1
  449. package/dist/report/host/site-runtime.cjs +0 -92
  450. package/dist/report/host/site-runtime.cjs.map +0 -1
  451. package/dist/report/host/site-runtime.d.cts +0 -9
  452. package/dist/report/host/site-runtime.d.mts +0 -9
  453. package/dist/report/host/site-runtime.d.ts +0 -9
  454. package/dist/report/host/site-runtime.js +0 -10
  455. package/dist/report/host/site-runtime.js.map +0 -1
  456. package/dist/view/client-dist/app.css +0 -2
  457. package/dist/view/client-dist/app.js +0 -49
  458. package/dist/view/data.cjs +0 -3
  459. package/dist/view/data.cjs.map +0 -1
  460. package/dist/view/data.d.cts +0 -9
  461. package/dist/view/data.d.mts +0 -9
  462. package/dist/view/data.d.ts +0 -9
  463. package/dist/view/data.js +0 -4
  464. package/dist/view/data.js.map +0 -1
  465. package/dist/view/index.cjs +0 -24
  466. package/dist/view/index.cjs.map +0 -1
  467. package/dist/view/index.d.cts +0 -9
  468. package/dist/view/index.d.mts +0 -9
  469. package/dist/view/index.d.ts +0 -9
  470. package/dist/view/index.js +0 -28
  471. package/dist/view/index.js.map +0 -1
  472. package/dist/view/report-view-cache.cjs +0 -200
  473. package/dist/view/report-view-cache.cjs.map +0 -1
  474. package/dist/view/report-view-cache.d.cts +0 -67
  475. package/dist/view/report-view-cache.d.mts +0 -67
  476. package/dist/view/report-view-cache.d.ts +0 -67
  477. package/dist/view/report-view-cache.js +0 -8
  478. package/dist/view/report-view-cache.js.map +0 -1
  479. package/dist/view/shared/types.cjs +0 -3
  480. package/dist/view/shared/types.cjs.map +0 -1
  481. package/dist/view/shared/types.d.cts +0 -51
  482. package/dist/view/shared/types.d.mts +0 -51
  483. package/dist/view/shared/types.d.ts +0 -51
  484. package/dist/view/shared/types.js +0 -4
  485. package/dist/view/shared/types.js.map +0 -1
  486. package/dist/view/site.cjs +0 -32
  487. package/dist/view/site.cjs.map +0 -1
  488. package/dist/view/site.d.cts +0 -24
  489. package/dist/view/site.d.mts +0 -24
  490. package/dist/view/site.d.ts +0 -24
  491. package/dist/view/site.js +0 -8
  492. package/dist/view/site.js.map +0 -1
  493. package/dist/view/styles.css +0 -170
  494. package/dist/view/template.html +0 -17
@@ -1 +1 @@
1
- {"version":3,"file":"braintrust.js","sourceRoot":"","sources":["braintrust.ts"],"names":[],"mappings":";;AAqGA,gCA8CC;AAOD,8CA8EC;AA/MD,iDAAqD;AAoErD,MAAM,wBAAwB,GAAyB,MAAM,CAAC,MAAM,CAAC;IACjE,KAAK,EAAE,eAAwB;IAC/B,MAAM,EAAE,uDAAgE;CAC3E,CAAC,CAAC;AACH;;;GAGG;AACH,SAAgB,UAAU,CAAC,SAA2B,EAAE;IACpD,IAAI,GAA8B,CAAC;IACnC,IAAI,UAA4C,CAAC;IACjD,OAAO;QACH,KAAK,CAAC,iBAAiB,CAAC,KAAK;YACzB,GAAG,GAAG,MAAM,iBAAiB,EAAE,CAAC;YAChC,UAAU,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC;gBACxB,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CA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AI,CAAC,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW;YAC9C,OAAO,CAAC,CAAC,IAAI,CAAC;IACtB,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AACD,uEAAuE;AACvE,MAAM,kBAAkB,GAAG,YAAY,CAAC;AACxC,KAAK,UAAU,iBAAiB;IAC5B,IAAI,CAAC;QACD,OAAO,CAAC,MAAM,uBAAuB,CAAC,kBAAkB,CAAC,CAA6B,CAAC;IAC3F,CAAC;IACD,MAAM,CAAC;QACH,MAAM,IAAI,KAAK,CAAC,2JAA2J,CAAC,CAAC;IACjL,CAAC;AACL,CAAC","sourcesContent":["// Braintrust 报告器:把一次 niceeval 运行作为一个 Braintrust experiment 上报,\n// 每个 attempt 一行(scores = 断言,metrics = 时长/token/成本),跨提交比较与团队共享。\n// `braintrust` 是可选依赖:动态 import,装了才用得上,没装在 onInvocationStart 报错\n// (reporter 错误按框架约定只记 diagnostic,不会让运行崩)。\nimport type { EvalResult, JsonValue, Reporter } from \"../../types.ts\";\nimport type { AssertionCoverage, AssertionEntryRead, AssertionLimitation, AssertionsProjection, ScoreContribution, } from \"../../assertions/record/model.ts\";\nimport type { ScoreProjection } from \"../../eval/record/score.ts\";\n/** Closed assessment rows; this reporter does not reopen Record. */\ntype AttemptSlotProjectedEntry<Value> = {\n readonly state: \"excluded\" | \"not-recorded\" | \"core-invalid\";\n} | {\n readonly state: \"attachment-result\";\n readonly attachment: {\n readonly state: \"available\";\n readonly value: Value;\n } | {\n readonly state: \"unavailable\" | \"unsupported\" | \"invalid\";\n } | {\n readonly state: \"migration-required\";\n readonly from: string;\n readonly to: string;\n readonly command?: string;\n };\n};\nimport type { Verdict } from \"../../shared/types.ts\";\nimport { reportActivity } from \"../feedback/sink.ts\";\nexport interface BraintrustConfig {\n /** Braintrust 项目名;省略时用 \"niceeval\"。 */\n project?: string;\n /** Braintrust 项目 id;与 project 给一个即可。 */\n projectId?: string;\n /** 实验名;省略时由 Braintrust 自动命名。 */\n experiment?: string;\n /** 作为对比基线(diff base)的既有实验名。 */\n baseExperiment?: string;\n /** 作为对比基线(diff base)的既有实验 id。 */\n baseExperimentId?: string;\n /** true = 更新同名既有实验,而不是新建一个。 */\n update?: boolean;\n /** 实验级附加 metadata;与 niceeval 自动写入的字段合并,同名以这里为准。 */\n metadata?: globalThis.Record<string, JsonValue>;\n /** API key;省略时 SDK 读 BRAINTRUST_API_KEY 环境变量。 */\n apiKey?: string;\n}\n/**\n * Braintrust SDK 的最小类型面。本地声明是为了不把 `braintrust` 变成编译期依赖;\n * 动态 import 后按这个形状断言。\n */\ninterface BraintrustSdk {\n // SDK 里 init 同步返回(登录与建实验都是惰性的);统一 await,同步/异步都兼容。\n init(options: {\n project?: string;\n projectId?: string;\n experiment?: string;\n baseExperiment?: string;\n baseExperimentId?: string;\n update?: boolean;\n apiKey?: string;\n metadata?: globalThis.Record<string, JsonValue>;\n setCurrent?: boolean;\n }): BraintrustExperiment | Promise<BraintrustExperiment>;\n flush(): Promise<void>;\n}\ninterface BraintrustExperiment {\n log(event: BraintrustLogEvent): void;\n summarize(): Promise<{\n experimentUrl?: string;\n }>;\n}\nexport interface BraintrustLogEvent {\n id?: string;\n input?: string;\n output?: string;\n error?: EvalResult[\"error\"];\n scores?: globalThis.Record<string, number>;\n metadata?: globalThis.Record<string, JsonValue>;\n metrics?: globalThis.Record<string, number>;\n}\n/**\n * A post-Record Projection calculation supplies this optional assessment. The\n * live Reporter callback currently has no RecordProjection input, so its\n * absence is represented explicitly rather than as a made-up Attachment read.\n */\nexport type BraintrustAssessment = {\n readonly state: \"projected\";\n /** Exact Report-style public projections, including every data state. */\n readonly assertions: AttemptSlotProjectedEntry<AssertionsProjection<unknown>>;\n readonly verdict: AttemptSlotProjectedEntry<Verdict>;\n readonly score?: AttemptSlotProjectedEntry<ScoreProjection>;\n} | {\n readonly state: \"not-projected\";\n readonly reason: \"reporter-contract-does-not-provide-record-projections\";\n};\nconst NOT_PROJECTED_ASSESSMENT: BraintrustAssessment = Object.freeze({\n state: \"not-projected\" as const,\n reason: \"reporter-contract-does-not-provide-record-projections\" as const,\n});\n/**\n * 创建 Braintrust 报告器。挂在 `defineConfig({ reporters })` 上观测整次运行,\n * 或挂在单个 eval 的 `reporters` 上只观测它(同一实例被多个 eval 引用时共享一个实验)。\n */\nexport function Braintrust(config: BraintrustConfig = {}): Reporter {\n let sdk: BraintrustSdk | undefined;\n let experiment: BraintrustExperiment | undefined;\n return {\n async onInvocationStart(evals) {\n sdk = await loadBraintrustSdk();\n experiment = await sdk.init({\n project: config.projectId ? undefined : (config.project ?? \"niceeval\"),\n projectId: config.projectId,\n experiment: config.experiment,\n baseExperiment: config.baseExperiment,\n baseExperimentId: config.baseExperimentId,\n update: config.update,\n apiKey: config.apiKey,\n // 不再写顶层单一 agent:一次 Invocation 可能横跨多个 (agent, model, flags) 配置,\n // 启动时还没有任何结果,写一个必然只代表其中一份配置的值就是撒谎(见\n // docs/runner.md「Reporter 与运行器事件」)。每行自己的 agent 身份仍在\n // toBraintrustEvent() 的 metadata.agent 里,逐 attempt 精确;跨行的 agent 集合可以\n // 从 Braintrust 自己按 metadata.agent 分组得到,不需要实验级再存一份。\n metadata: {\n evals: evals.map((e) => e.id),\n ...config.metadata,\n },\n // 不设为全局 current experiment,避免污染用户代码里的 braintrust 全局态。\n setCurrent: false,\n });\n },\n onEvalComplete(result) {\n experiment?.log(toBraintrustEvent(result, NOT_PROJECTED_ASSESSMENT));\n },\n async onInvocationComplete() {\n if (!experiment)\n return;\n try {\n await sdk?.flush();\n const summary = await experiment.summarize();\n if (summary.experimentUrl) {\n reportActivity(`Braintrust experiment: ${summary.experimentUrl}`);\n }\n }\n finally {\n experiment = undefined;\n sdk = undefined;\n }\n },\n };\n}\n/**\n * EvalResult identity/transport data plus an optional post-Record assessment\n * become one Braintrust row. Assertions, Verdict, and Score only enter through\n * that assessment's public Attachment projections; this function never reads\n * a historical result graph.\n */\nexport function toBraintrustEvent(result: EvalResult, assessment: BraintrustAssessment = NOT_PROJECTED_ASSESSMENT): BraintrustLogEvent {\n const projectedVerdict = assessment.state === \"projected\"\n ? availableProjectionValue(assessment.verdict)\n : undefined;\n const verdict = projectedVerdict ?? result.verdict;\n const metrics: globalThis.Record<string, number> = {};\n if (result.startedAt) {\n const start = Date.parse(result.startedAt) / 1000;\n if (Number.isFinite(start)) {\n metrics.start = start;\n metrics.end = start + result.durationMs / 1000;\n }\n }\n if (result.usage) {\n const { inputTokens, outputTokens, cacheReadTokens, cacheCreationTokens, reasoningTokens, requests } = result.usage;\n if (inputTokens !== undefined)\n metrics.prompt_tokens = inputTokens;\n if (outputTokens !== undefined)\n metrics.completion_tokens = outputTokens;\n if (inputTokens !== undefined && outputTokens !== undefined)\n metrics.tokens = inputTokens + outputTokens;\n if (cacheReadTokens !== undefined)\n metrics.cache_read_tokens = cacheReadTokens;\n if (cacheCreationTokens !== undefined)\n metrics.cache_creation_tokens = cacheCreationTokens;\n if (reasoningTokens !== undefined)\n metrics.reasoning_tokens = reasoningTokens;\n if (requests !== undefined)\n metrics.requests = requests;\n }\n // estimated_cost_usd 恒为价目表估算(EvalResult.estimatedCostUSD,见 estimateCost);\n // observed 成本单独留在 result.usage.costUSD,不混入本指标。\n if (result.estimatedCostUSD !== undefined)\n metrics.estimated_cost_usd = result.estimatedCostUSD;\n const metadata: globalThis.Record<string, JsonValue> = {\n eval: result.id,\n agent: result.agent,\n attempt: result.attempt,\n verdict,\n status: verdict,\n evaluationAlgorithm: result.evaluationAlgorithm,\n evaluationKind: result.evaluationKind,\n assessmentProjection: assessment.state,\n };\n const scores: globalThis.Record<string, number> = {};\n if (assessment.state === \"projected\") {\n metadata.assertions = projectionMetadata(assessment.assertions, (assertions) => ({ entries: assertionMetadata(assertions.entries) }));\n metadata.verdictProjection = projectionMetadata(assessment.verdict, (value) => ({ value }));\n if (assessment.score !== undefined) {\n metadata.score = projectionMetadata(assessment.score, scoreMetadata);\n const score = availableProjectionValue(assessment.score);\n if (score?.state === \"complete\")\n scores[\"niceeval:score\"] = score.earned;\n }\n }\n else {\n metadata.assessmentProjectionReason = assessment.reason;\n }\n if (result.model !== undefined)\n metadata.model = result.model;\n if (result.experimentId !== undefined)\n metadata.experiment = result.experimentId;\n if (result.experiment?.flags && Object.keys(result.experiment.flags).length > 0) {\n metadata.flags = result.experiment.flags;\n }\n if (result.skipReason !== undefined)\n metadata.skipReason = result.skipReason;\n // 一次运行内 (experiment, eval, agent, model, attempt) 唯一;Braintrust 按 id 合并重复行。\n const id = [result.experimentId ?? \"\", result.id, result.agent, result.model ?? \"\", `a${result.attempt}`].join(\"|\");\n return {\n id,\n input: result.description ?? result.id,\n output: lastAssistantText(result.events),\n error: result.error,\n metadata,\n metrics,\n ...(Object.keys(scores).length > 0 ? { scores } : {}),\n };\n}\nfunction availableProjectionValue<Value>(entry: AttemptSlotProjectedEntry<Value>): Value | undefined {\n return entry.state === \"attachment-result\" && entry.attachment.state === \"available\"\n ? entry.attachment.value\n : undefined;\n}\nfunction projectionMetadata<Value>(entry: AttemptSlotProjectedEntry<Value>, available: (value: Value) => globalThis.Record<string, JsonValue>): JsonValue {\n if (entry.state !== \"attachment-result\") {\n return { state: entry.state };\n }\n switch (entry.attachment.state) {\n case \"available\":\n return { state: \"available\", ...available(entry.attachment.value) };\n case \"unavailable\":\n return { state: \"unavailable\" };\n case \"migration-required\":\n return {\n state: \"migration-required\",\n from: entry.attachment.from,\n to: entry.attachment.to,\n ...(entry.attachment.command === undefined ? {} : { command: entry.attachment.command }),\n };\n case \"unsupported\":\n case \"invalid\":\n return { state: entry.attachment.state };\n }\n}\nfunction assertionMetadata(entries: readonly AssertionEntryRead<unknown>[]): JsonValue {\n const metadata: JsonValue[] = [];\n for (const entry of entries) {\n const display = entry.entry.display;\n const result = entry.entry.result;\n const item: globalThis.Record<string, JsonValue> = {\n entryId: entry.entry.entryId,\n groupPath: [...display.groupPath],\n outcome: entry.state === \"available\" ? result.state : entry.state,\n coverage: coverageMetadata(entry.entry.coverage),\n limitations: entry.entry.limitations.map(limitationMetadata),\n scoreContribution: scoreContributionMetadata(result.score),\n };\n if (display.label !== undefined)\n item.label = display.label;\n if (display.key !== undefined)\n item.key = display.key;\n const reason = assertionReason(entry);\n if (reason !== undefined)\n item.reason = reason;\n metadata.push(item);\n }\n return metadata;\n}\nfunction assertionReason(entry: AssertionEntryRead<unknown>): string | undefined {\n if (entry.state !== \"available\")\n return entry.reason;\n switch (entry.entry.result.state) {\n case \"matched\":\n return undefined;\n case \"mismatched\":\n case \"unavailable\":\n case \"errored\":\n case \"not-applicable\":\n return entry.entry.result.reason;\n }\n}\nfunction coverageMetadata(coverage: AssertionCoverage): globalThis.Record<string, JsonValue> {\n const metadata: globalThis.Record<string, JsonValue> = { state: coverage.state };\n if (coverage.state !== \"complete\")\n metadata.reason = coverage.reason;\n return metadata;\n}\nfunction limitationMetadata(limitation: AssertionLimitation): globalThis.Record<string, JsonValue> {\n switch (limitation.kind) {\n case \"redacted\":\n return { kind: limitation.kind, fieldCount: limitation.fieldCount };\n case \"sampled\":\n return {\n kind: limitation.kind,\n captured: limitation.captured,\n ...(limitation.knownTotal === undefined ? {} : { knownTotal: limitation.knownTotal }),\n };\n case \"truncated\":\n return { kind: limitation.kind, omittedBytes: limitation.omittedBytes };\n case \"provider-limited\":\n return { kind: limitation.kind };\n }\n}\nfunction scoreContributionMetadata(contribution: ScoreContribution): globalThis.Record<string, JsonValue> {\n switch (contribution.state) {\n case \"not-scored\":\n return { state: contribution.state };\n case \"earned\":\n return {\n state: contribution.state,\n points: contribution.points,\n earned: contribution.earned,\n };\n case \"unavailable\":\n return {\n state: contribution.state,\n points: contribution.points,\n reason: contribution.reason,\n };\n }\n}\nfunction scoreMetadata(score: ScoreProjection): globalThis.Record<string, JsonValue> {\n switch (score.state) {\n case \"complete\":\n return { state: score.state, earned: score.earned, comparable: score.comparable };\n case \"partial\":\n return {\n state: score.state,\n earned: score.earned,\n reasons: [...score.reasons],\n comparable: score.comparable,\n };\n case \"unavailable\":\n return {\n state: score.state,\n reasons: [...score.reasons],\n comparable: score.comparable,\n };\n }\n}\n/** agent 的最终回复文本(事件流里最后一条 assistant message);没有就不填。 */\nfunction lastAssistantText(events: EvalResult[\"events\"]): string | undefined {\n if (!events)\n return undefined;\n for (let i = events.length - 1; i >= 0; i--) {\n const e = events[i];\n if (e.type === \"message\" && e.role === \"assistant\")\n return e.text;\n }\n return undefined;\n}\n/** 动态 import 说明:specifier 放变量里,`braintrust` 不进编译期依赖,没装也能 typecheck。 */\nconst BRAINTRUST_PACKAGE = \"braintrust\";\nasync function loadBraintrustSdk(): Promise<BraintrustSdk> {\n try {\n return (await __niceevalDynamicImport(BRAINTRUST_PACKAGE)) as unknown as BraintrustSdk;\n }\n catch {\n throw new Error(\"The 'braintrust' package is required for the Braintrust reporter but was not found. Install it with: npm install braintrust (and set BRAINTRUST_API_KEY).\");\n }\n}\n"]}
1
+ {"version":3,"file":"braintrust.js","sourceRoot":"","sources":["braintrust.ts"],"names":[],"mappings":";;AAqGA,gCA8CC;AAOD,8CA8EC;AA/MD,iDAAqD;AAoErD,MAAM,wBAAwB,GAAyB,MAAM,CAAC,MAAM,CAAC;IACjE,KAAK,EAAE,eAAwB;IAC/B,MAAM,EAAE,uDAAgE;CAC3E,CAAC,CAAC;AACH;;;GAGG;AACH,SAAgB,UAAU,CAAC,SAA2B,EAAE;IACpD,IAAI,GAA8B,CAAC;IACnC,IAAI,UAA4C,CAAC;IACjD,OAAO;QACH,KAAK,CAAC,iBAAiB,CAAC,KAAK;YACzB,GAAG,GAAG,MAAM,iBAAiB,EAAE,CAAC;YAChC,UAAU,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC;gBACxB,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,UAAU,CAAC;gBACtE,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,UAAU,EAAE,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CAAC,IAAI,KAAK,WAAW;YAC9C,OAAO,CAAC,CAAC,IAAI,CAAC;IACtB,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AACD,uEAAuE;AACvE,MAAM,kBAAkB,GAAG,YAAY,CAAC;AACxC,KAAK,UAAU,iBAAiB;IAC5B,IAAI,CAAC;QACD,OAAO,CAAC,MAAM,uBAAuB,CAAC,kBAAkB,CAAC,CAA6B,CAAC;IAC3F,CAAC;IACD,MAAM,CAAC;QACH,MAAM,IAAI,KAAK,CAAC,2JAA2J,CAAC,CAAC;IACjL,CAAC;AACL,CAAC","sourcesContent":["// Braintrust 报告器:把一次 niceeval 运行作为一个 Braintrust experiment 上报,\n// 每个 attempt 一行(scores = 断言,metrics = 时长/token/成本),跨提交比较与团队共享。\n// `braintrust` 是可选依赖:动态 import,装了才用得上,没装在 onInvocationStart 报错\n// (reporter 错误按框架约定只记 diagnostic,不会让运行崩)。\nimport type { EvalResult, JsonValue, Reporter } from \"../../types.ts\";\nimport type { AssertionCoverage, AssertionEntryRead, AssertionLimitation, AssertionsProjection, ScoreContribution, } from \"../../assertions/record/model.ts\";\nimport type { ScoreProjection } from \"../../eval/record/score.ts\";\n/** Closed assessment rows; this reporter does not reopen Record. */\ntype AttemptSlotProjectedEntry<Value> = {\n readonly state: \"excluded\" | \"not-recorded\" | \"core-invalid\";\n} | {\n readonly state: \"attachment-result\";\n readonly attachment: {\n readonly state: \"available\";\n readonly value: Value;\n } | {\n readonly state: \"unavailable\" | \"unsupported\" | \"invalid\";\n } | {\n readonly state: \"migration-required\";\n readonly from: string;\n readonly to: string;\n readonly command?: string;\n };\n};\nimport type { Verdict } from \"../../shared/types.ts\";\nimport { reportActivity } from \"../feedback/sink.ts\";\nexport interface BraintrustConfig {\n /** Braintrust 项目名;省略时用 \"niceeval\"。 */\n project?: string;\n /** Braintrust 项目 id;与 project 给一个即可。 */\n projectId?: string;\n /** 实验名;省略时由 Braintrust 自动命名。 */\n experiment?: string;\n /** 作为对比基线(diff base)的既有实验名。 */\n baseExperiment?: string;\n /** 作为对比基线(diff base)的既有实验 id。 */\n baseExperimentId?: string;\n /** true = 更新同名既有实验,而不是新建一个。 */\n update?: boolean;\n /** 实验级附加 metadata;与 niceeval 自动写入的字段合并,同名以这里为准。 */\n metadata?: globalThis.Record<string, JsonValue>;\n /** API key;省略时 SDK 读 BRAINTRUST_API_KEY 环境变量。 */\n apiKey?: string;\n}\n/**\n * Braintrust SDK 的最小类型面。本地声明是为了不把 `braintrust` 变成编译期依赖;\n * 动态 import 后按这个形状断言。\n */\ninterface BraintrustSdk {\n // SDK 里 init 同步返回(登录与建实验都是惰性的);统一 await,同步/异步都兼容。\n init(options: {\n project?: string;\n projectId?: string;\n experiment?: string;\n baseExperiment?: string;\n baseExperimentId?: string;\n update?: boolean;\n apiKey?: string;\n metadata?: globalThis.Record<string, JsonValue>;\n setCurrent?: boolean;\n }): BraintrustExperiment | Promise<BraintrustExperiment>;\n flush(): Promise<void>;\n}\ninterface BraintrustExperiment {\n log(event: BraintrustLogEvent): void;\n summarize(): Promise<{\n experimentUrl?: string;\n }>;\n}\nexport interface BraintrustLogEvent {\n id?: string;\n input?: string;\n output?: string;\n error?: EvalResult[\"error\"];\n scores?: globalThis.Record<string, number>;\n metadata?: globalThis.Record<string, JsonValue>;\n metrics?: globalThis.Record<string, number>;\n}\n/**\n * A post-Record Projection calculation supplies this optional assessment. The\n * live Reporter callback currently has no RecordProjection input, so its\n * absence is represented explicitly rather than as a made-up Attachment read.\n */\nexport type BraintrustAssessment = {\n readonly state: \"projected\";\n /** Exact Report-style public projections, including every data state. */\n readonly assertions: AttemptSlotProjectedEntry<AssertionsProjection<unknown>>;\n readonly verdict: AttemptSlotProjectedEntry<Verdict>;\n readonly score?: AttemptSlotProjectedEntry<ScoreProjection>;\n} | {\n readonly state: \"not-projected\";\n readonly reason: \"reporter-contract-does-not-provide-record-projections\";\n};\nconst NOT_PROJECTED_ASSESSMENT: BraintrustAssessment = Object.freeze({\n state: \"not-projected\" as const,\n reason: \"reporter-contract-does-not-provide-record-projections\" as const,\n});\n/**\n * 创建 Braintrust 报告器。挂在 `defineConfig({ reporters })` 上观测整次运行,\n * 或挂在单个 eval 的 `reporters` 上只观测它(同一实例被多个 eval 引用时共享一个实验)。\n */\nexport function Braintrust(config: BraintrustConfig = {}): Reporter {\n let sdk: BraintrustSdk | undefined;\n let experiment: BraintrustExperiment | undefined;\n return {\n async onInvocationStart(evals) {\n sdk = await loadBraintrustSdk();\n experiment = await sdk.init({\n project: config.projectId ? undefined : (config.project ?? \"niceeval\"),\n projectId: config.projectId,\n experiment: config.experiment,\n baseExperiment: config.baseExperiment,\n baseExperimentId: config.baseExperimentId,\n update: config.update,\n apiKey: config.apiKey,\n // 不再写顶层单一 agent:一次 Invocation 可能横跨多个 (agent, model, flags) 配置,\n // 启动时还没有任何结果,写一个必然只代表其中一份配置的值就是撒谎(见\n // docs/runner.md「Reporter 与运行器事件」)。每行自己的 agent 身份仍在\n // toBraintrustEvent() 的 metadata.agent 里,逐 attempt 精确;跨行的 agent 集合可以\n // 从 Braintrust 自己按 metadata.agent 分组得到,不需要实验级再存一份。\n metadata: {\n evals: evals.map((e) => e.id),\n ...config.metadata,\n },\n // 不设为全局 current experiment,避免污染用户代码里的 braintrust 全局态。\n setCurrent: false,\n });\n },\n onEvalComplete(result) {\n experiment?.log(toBraintrustEvent(result, NOT_PROJECTED_ASSESSMENT));\n },\n async onInvocationComplete() {\n if (!experiment)\n return;\n try {\n await sdk?.flush();\n const summary = await experiment.summarize();\n if (summary.experimentUrl) {\n reportActivity(`Braintrust experiment: ${summary.experimentUrl}`);\n }\n }\n finally {\n experiment = undefined;\n sdk = undefined;\n }\n },\n };\n}\n/**\n * EvalResult identity/transport data plus an optional post-Record assessment\n * become one Braintrust row. Assertions, Verdict, and Score only enter through\n * that assessment's public Attachment projections; this function never reads\n * a historical result graph.\n */\nexport function toBraintrustEvent(result: EvalResult, assessment: BraintrustAssessment = NOT_PROJECTED_ASSESSMENT): BraintrustLogEvent {\n const projectedVerdict = assessment.state === \"projected\"\n ? availableProjectionValue(assessment.verdict)\n : undefined;\n const verdict = projectedVerdict ?? result.verdict;\n const metrics: globalThis.Record<string, number> = {};\n if (result.startedAt) {\n const start = Date.parse(result.startedAt) / 1000;\n if (Number.isFinite(start)) {\n metrics.start = start;\n metrics.end = start + result.durationMs / 1000;\n }\n }\n if (result.usage) {\n const { inputTokens, outputTokens, cacheReadTokens, cacheCreationTokens, reasoningTokens, requests } = result.usage;\n if (inputTokens !== undefined)\n metrics.prompt_tokens = inputTokens;\n if (outputTokens !== undefined)\n metrics.completion_tokens = outputTokens;\n if (inputTokens !== undefined && outputTokens !== undefined)\n metrics.tokens = inputTokens + outputTokens;\n if (cacheReadTokens !== undefined)\n metrics.cache_read_tokens = cacheReadTokens;\n if (cacheCreationTokens !== undefined)\n metrics.cache_creation_tokens = cacheCreationTokens;\n if (reasoningTokens !== undefined)\n metrics.reasoning_tokens = reasoningTokens;\n if (requests !== undefined)\n metrics.requests = requests;\n }\n // estimated_cost_usd 恒为价目表估算(EvalResult.estimatedCostUSD,见 estimateCost);\n // observed 成本单独留在 result.usage.costUSD,不混入本指标。\n if (result.estimatedCostUSD !== undefined)\n metrics.estimated_cost_usd = result.estimatedCostUSD;\n const metadata: globalThis.Record<string, JsonValue> = {\n eval: result.id,\n agent: result.agent,\n attempt: result.attempt,\n verdict,\n status: verdict,\n evaluationAlgorithm: result.evaluationAlgorithm,\n evaluationKind: result.evaluationKind,\n assessmentProjection: assessment.state,\n };\n const scores: globalThis.Record<string, number> = {};\n if (assessment.state === \"projected\") {\n metadata.assertions = projectionMetadata(assessment.assertions, (assertions) => ({ entries: assertionMetadata(assertions.entries) }));\n metadata.verdictProjection = projectionMetadata(assessment.verdict, (value) => ({ value }));\n if (assessment.score !== undefined) {\n metadata.score = projectionMetadata(assessment.score, scoreMetadata);\n const score = availableProjectionValue(assessment.score);\n if (score?.state === \"complete\")\n scores[\"niceeval:score\"] = score.earned;\n }\n }\n else {\n metadata.assessmentProjectionReason = assessment.reason;\n }\n if (result.model !== undefined)\n metadata.model = result.model;\n if (result.experimentId !== undefined)\n metadata.experiment = result.experimentId;\n if (result.experiment?.flags && Object.keys(result.experiment.flags).length > 0) {\n metadata.flags = result.experiment.flags;\n }\n if (result.skipReason !== undefined)\n metadata.skipReason = result.skipReason;\n // 一次运行内 (experiment, eval, agent, model, attempt) 唯一;Braintrust 按 id 合并重复行。\n const id = [result.experimentId ?? \"\", result.id, result.agent, result.model ?? \"\", `a${result.attempt}`].join(\"|\");\n return {\n id,\n input: result.description ?? result.id,\n output: lastAssistantText(result.events),\n error: result.error,\n metadata,\n metrics,\n ...(Object.keys(scores).length > 0 ? { scores } : {}),\n };\n}\nfunction availableProjectionValue<Value>(entry: AttemptSlotProjectedEntry<Value>): Value | undefined {\n return entry.state === \"attachment-result\" && entry.attachment.state === \"available\"\n ? entry.attachment.value\n : undefined;\n}\nfunction projectionMetadata<Value>(entry: AttemptSlotProjectedEntry<Value>, available: (value: Value) => globalThis.Record<string, JsonValue>): JsonValue {\n if (entry.state !== \"attachment-result\") {\n return { state: entry.state };\n }\n switch (entry.attachment.state) {\n case \"available\":\n return { state: \"available\", ...available(entry.attachment.value) };\n case \"unavailable\":\n return { state: \"unavailable\" };\n case \"migration-required\":\n return {\n state: \"migration-required\",\n from: entry.attachment.from,\n to: entry.attachment.to,\n ...(entry.attachment.command === undefined ? {} : { command: entry.attachment.command }),\n };\n case \"unsupported\":\n case \"invalid\":\n return { state: entry.attachment.state };\n }\n}\nfunction assertionMetadata(entries: readonly AssertionEntryRead<unknown>[]): JsonValue {\n const metadata: JsonValue[] = [];\n for (const entry of entries) {\n const display = entry.entry.display;\n const decision = entry.entry.decision;\n const item: globalThis.Record<string, JsonValue> = {\n entryId: entry.entry.entryId,\n groupPath: [...display.groupPath],\n outcome: entry.state === \"available\" ? decision.result : entry.state,\n coverage: coverageMetadata(entry.entry.materials.coverage),\n limitations: entry.entry.materials.limitations.map(limitationMetadata),\n scoreContribution: scoreContributionMetadata(entry.entry.contribution),\n };\n if (display.label !== undefined)\n item.label = display.label;\n if (display.key !== undefined)\n item.key = display.key;\n const reason = assertionReason(entry);\n if (reason !== undefined)\n item.reason = reason;\n metadata.push(item);\n }\n return metadata;\n}\nfunction assertionReason(entry: AssertionEntryRead<unknown>): string | undefined {\n if (entry.state !== \"available\")\n return entry.reason;\n switch (entry.entry.decision.result) {\n case \"matched\":\n return undefined;\n case \"mismatched\":\n case \"unavailable\":\n case \"errored\":\n case \"not-applicable\":\n return entry.entry.decision.reason ?? undefined;\n }\n}\nfunction coverageMetadata(coverage: AssertionCoverage): globalThis.Record<string, JsonValue> {\n const metadata: globalThis.Record<string, JsonValue> = { state: coverage.state };\n if (coverage.state !== \"complete\")\n metadata.reason = coverage.reason;\n return metadata;\n}\nfunction limitationMetadata(limitation: AssertionLimitation): globalThis.Record<string, JsonValue> {\n switch (limitation.kind) {\n case \"redacted\":\n return { kind: limitation.kind, fieldCount: limitation.fieldCount };\n case \"sampled\":\n return {\n kind: limitation.kind,\n captured: limitation.captured,\n ...(limitation.knownTotal === undefined ? {} : { knownTotal: limitation.knownTotal }),\n };\n case \"truncated\":\n return { kind: limitation.kind, omittedBytes: limitation.omittedBytes };\n case \"provider-limited\":\n return { kind: limitation.kind };\n }\n}\nfunction scoreContributionMetadata(contribution: ScoreContribution): globalThis.Record<string, JsonValue> {\n switch (contribution.state) {\n case \"not-scored\":\n return { state: contribution.state };\n case \"earned\":\n return {\n state: contribution.state,\n points: contribution.points,\n earned: contribution.earned,\n };\n case \"unavailable\":\n return {\n state: contribution.state,\n points: contribution.points,\n reason: contribution.reason,\n };\n }\n}\nfunction scoreMetadata(score: ScoreProjection): globalThis.Record<string, JsonValue> {\n switch (score.state) {\n case \"complete\":\n return { state: score.state, earned: score.earned, comparable: score.comparable };\n case \"partial\":\n return {\n state: score.state,\n earned: score.earned,\n reasons: [...score.reasons],\n comparable: score.comparable,\n };\n case \"unavailable\":\n return {\n state: score.state,\n reasons: [...score.reasons],\n comparable: score.comparable,\n };\n }\n}\n/** agent 的最终回复文本(事件流里最后一条 assistant message);没有就不填。 */\nfunction lastAssistantText(events: EvalResult[\"events\"]): string | undefined {\n if (!events)\n return undefined;\n for (let i = events.length - 1; i >= 0; i--) {\n const e = events[i];\n if (e.type === \"message\" && e.role === \"assistant\")\n return e.text;\n }\n return undefined;\n}\n/** 动态 import 说明:specifier 放变量里,`braintrust` 不进编译期依赖,没装也能 typecheck。 */\nconst BRAINTRUST_PACKAGE = \"braintrust\";\nasync function loadBraintrustSdk(): Promise<BraintrustSdk> {\n try {\n return (await __niceevalDynamicImport(BRAINTRUST_PACKAGE)) as unknown as BraintrustSdk;\n }\n catch {\n throw new Error(\"The 'braintrust' package is required for the Braintrust reporter but was not found. Install it with: npm install braintrust (and set BRAINTRUST_API_KEY).\");\n }\n}\n"]}
@@ -65,11 +65,10 @@ function readSourceAttempt(input) {
65
65
  ? effect_1.Effect.succeed(read.value)
66
66
  : effect_1.Effect.fail(invalid("source-attempt-unavailable"))));
67
67
  }
68
- function scoreOf(entries) {
68
+ function scoreOf(contributions) {
69
69
  let earned = 0;
70
70
  let unavailable = false;
71
- for (const entry of entries) {
72
- const score = entry.result.score;
71
+ for (const score of contributions) {
73
72
  if (score.state === "earned" && typeof score.earned === "number")
74
73
  earned += score.earned;
75
74
  if (score.state === "unavailable")
@@ -110,7 +109,7 @@ function detailsFor(input) {
110
109
  })
111
110
  : nonAvailableRead(observability);
112
111
  const scoreAttachment = assertions.state === "available"
113
- ? Object.freeze({ state: "available", value: scoreOf(assertions.value.entries) })
112
+ ? Object.freeze({ state: "available", value: scoreOf(assertions.value.entries.map((entry) => entry.contribution)) })
114
113
  : nonAvailableRead(assertions);
115
114
  const score = input.evaluationKind === "score"
116
115
  ? Object.freeze({ state: "applicable", attachment: scoreAttachment })
@@ -1 +1 @@
1
- {"version":3,"file":"reuse-readback.js","sourceRoot":"","sources":["reuse-readback.ts"],"names":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,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;YACzC,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,SAAS;SAC5C,CAAC;QACF,cAAc,EAAE,MAAM,CAAC,cAAc;KACxC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { Effect, Either } from \"effect\";\nimport { encodeAttemptLocator } from \"../attempt-locator.ts\";\nimport type { RecordIssue } from \"../record/errors/record-errors.ts\";\nimport type { FixedFamilyRead, ReadableAttempt, RecordReadSession, SelectedAttemptRef, } from \"../record/host/types.ts\";\nimport type { RecordReaderReadError } from \"../record/reader/errors.ts\";\nimport { projectSourcesAttachment } from \"../sources/projector.ts\";\nimport type { Verdict } from \"../shared/types.ts\";\nimport { recordedAttemptVerdict, type ExecutionReusePlan, type ExecutionReusePlanSource, type ReusePlanSlot, type TargetSlot, } from \"./reuse-plan.ts\";\n/** Fixed-family read states remain visible; a readback never invents a result file. */\nexport type CurrentRecordRead<Value> = {\n readonly state: \"available\";\n readonly value: Value;\n} | {\n readonly state: \"not-recorded\";\n} | {\n readonly state: \"migration-required\";\n readonly family: string;\n readonly fromSchemaVersion: number;\n readonly toSchemaVersion: number;\n readonly command: \"niceeval migrate\";\n} | {\n readonly state: \"unsupported\";\n readonly family: string;\n readonly schemaVersion: number;\n} | {\n readonly state: \"invalid\";\n readonly issues: readonly RecordIssue[];\n};\nexport interface CurrentReusedAttemptReadback {\n readonly state: \"reused\";\n readonly target: CurrentReusedAttemptTarget;\n readonly source: CurrentReusedAttemptSource;\n readonly verdict: \"passed\" | \"failed\";\n readonly score: CurrentReusedAttemptScore;\n readonly executionErrors: CurrentRecordRead<readonly CurrentReusedExecutionError[]>;\n}\nexport interface CurrentReuseCandidateReadback {\n readonly state: \"prior\";\n readonly target: CurrentReusedAttemptTarget;\n readonly source: CurrentReusedAttemptSource;\n readonly verdict: CurrentRecordRead<Verdict>;\n readonly score: CurrentReusedAttemptScore;\n readonly executionErrors: CurrentRecordRead<readonly CurrentReusedExecutionError[]>;\n readonly sourceFiles: CurrentReuseSourceFiles;\n}\nexport type CurrentReuseReadback = CurrentReusedAttemptReadback | CurrentReuseCandidateReadback;\nexport interface CurrentReusedAttemptTarget {\n readonly runId: TargetSlot[\"runId\"];\n readonly slotId: TargetSlot[\"slotId\"];\n readonly experimentId: TargetSlot[\"experimentId\"];\n readonly evalId: TargetSlot[\"evalId\"];\n readonly attempt: TargetSlot[\"attempt\"];\n}\nexport interface CurrentReusedAttemptSource {\n readonly attempt: SelectedAttemptRef;\n readonly attemptId: ExecutionReusePlanSource[\"attemptId\"];\n readonly origin: ExecutionReusePlanSource[\"origin\"];\n readonly sourceBarrier: ExecutionReusePlanSource[\"sourceBarrier\"];\n readonly evaluationKind: ExecutionReusePlanSource[\"evaluationKind\"];\n}\nexport type CurrentReusedAttemptScore = {\n readonly state: \"not-applicable\";\n} | {\n readonly state: \"applicable\";\n readonly attachment: CurrentRecordRead<{\n readonly state: \"complete\" | \"partial\" | \"unavailable\";\n readonly earned?: number;\n }>;\n};\nexport interface CurrentReusedExecutionCause {\n readonly code: string;\n readonly summary: string;\n}\nexport interface CurrentReusedExecutionError {\n readonly kind: \"execution-error\";\n readonly code: string;\n readonly phase: string;\n readonly summary: string;\n readonly causes: readonly CurrentReusedExecutionCause[];\n}\nexport interface CurrentReuseSourceFile {\n readonly path: string;\n readonly sha256: string;\n}\nexport type CurrentReuseSourceFiles = CurrentRecordRead<readonly CurrentReuseSourceFile[]> | {\n readonly state: \"origin-run-missing\";\n} | {\n readonly state: \"origin-run-invalid\";\n readonly issues: readonly RecordIssue[];\n} | {\n readonly state: \"projection-invalid\";\n};\nexport interface CurrentReuseReadbackPlanInvalid {\n readonly code: \"current-reuse-readback-plan-invalid\";\n readonly reason: \"source-attempt-unavailable\" | \"source-verdict-unavailable\" | \"source-verdict-ineligible\";\n}\nexport interface CurrentReusedAttemptSourceSnapshot {\n readonly attemptId: string;\n readonly locator: string;\n readonly origin: {\n readonly runId: string;\n readonly slotId: string;\n };\n readonly sourceBarrier: {\n readonly runId: string;\n readonly startedAt: number;\n };\n readonly evaluationKind: CurrentReusedAttemptSource[\"evaluationKind\"];\n}\nexport interface CurrentReusedAttemptTargetSnapshot {\n readonly runId: string;\n readonly slotId: string;\n readonly experimentId: string;\n readonly evalId: string;\n readonly attempt: number;\n}\nexport interface CurrentReusedAttemptSnapshot {\n readonly state: \"reused\";\n readonly target: CurrentReusedAttemptTargetSnapshot;\n readonly source: CurrentReusedAttemptSourceSnapshot;\n readonly verdict: CurrentReusedAttemptReadback[\"verdict\"];\n readonly score: CurrentReusedAttemptScore;\n readonly executionErrors: CurrentReusedAttemptReadback[\"executionErrors\"];\n}\nexport interface CurrentReuseCandidateSnapshot {\n readonly state: \"prior\";\n readonly target: CurrentReusedAttemptTargetSnapshot;\n readonly source: CurrentReusedAttemptSourceSnapshot;\n readonly verdict: CurrentReuseCandidateReadback[\"verdict\"];\n readonly score: CurrentReusedAttemptScore;\n readonly executionErrors: CurrentReusedAttemptReadback[\"executionErrors\"];\n readonly sourceFiles: CurrentReuseSourceFiles;\n}\nexport type CurrentReuseReadbackSnapshot = CurrentReusedAttemptSnapshot | CurrentReuseCandidateSnapshot;\nfunction recordRead<Value>(value: FixedFamilyRead<Value>): CurrentRecordRead<Value> {\n switch (value.state) {\n case \"available\":\n return Object.freeze({ state: \"available\" as const, value: value.value as Value });\n case \"not-recorded\":\n return Object.freeze({ state: \"not-recorded\" as const });\n case \"unsupported\":\n return Object.freeze({\n state: \"unsupported\" as const,\n family: value.family,\n schemaVersion: value.schemaVersion,\n });\n case \"migration-required\":\n return Object.freeze({\n state: \"migration-required\" as const,\n family: value.family,\n fromSchemaVersion: value.fromSchemaVersion,\n toSchemaVersion: value.toSchemaVersion,\n command: value.command,\n });\n case \"invalid\":\n return Object.freeze({ state: \"invalid\" as const, issues: Object.freeze([...value.issues]) });\n }\n}\nfunction nonAvailableRead<Value>(value: Exclude<FixedFamilyRead<unknown>, {\n readonly state: \"available\";\n}>): CurrentRecordRead<Value> {\n switch (value.state) {\n case \"not-recorded\":\n return Object.freeze({ state: \"not-recorded\" as const });\n case \"unsupported\":\n return Object.freeze({\n state: \"unsupported\" as const,\n family: value.family,\n schemaVersion: value.schemaVersion,\n });\n case \"migration-required\":\n return Object.freeze({\n state: \"migration-required\" as const,\n family: value.family,\n fromSchemaVersion: value.fromSchemaVersion,\n toSchemaVersion: value.toSchemaVersion,\n command: value.command,\n });\n case \"invalid\":\n return Object.freeze({ state: \"invalid\" as const, issues: Object.freeze([...value.issues]) });\n }\n}\nfunction invalid(reason: CurrentReuseReadbackPlanInvalid[\"reason\"]): CurrentReuseReadbackPlanInvalid {\n return Object.freeze({ code: \"current-reuse-readback-plan-invalid\", reason });\n}\nfunction readSourceAttempt(input: {\n readonly reader: RecordReadSession;\n readonly source: ExecutionReusePlanSource;\n}): Effect.Effect<ReadableAttempt, RecordReaderReadError | CurrentReuseReadbackPlanInvalid> {\n return input.reader.readAttempt(input.source.attempt).pipe(Effect.flatMap((read) => read.state === \"available\"\n ? Effect.succeed(read.value)\n : Effect.fail(invalid(\"source-attempt-unavailable\"))));\n}\nfunction scoreOf(entries: readonly {\n readonly result: {\n readonly score: unknown;\n };\n}[]): {\n readonly state: \"complete\" | \"partial\" | \"unavailable\";\n readonly earned?: number;\n} {\n let earned = 0;\n let unavailable = false;\n for (const entry of entries) {\n const score = entry.result.score as {\n readonly state?: unknown;\n readonly earned?: unknown;\n };\n if (score.state === \"earned\" && typeof score.earned === \"number\")\n earned += score.earned;\n if (score.state === \"unavailable\")\n unavailable = true;\n }\n return unavailable\n ? Object.freeze({ state: earned > 0 ? \"partial\" as const : \"unavailable\" as const, ...(earned > 0 ? { earned } : {}) })\n : Object.freeze({ state: \"complete\" as const, earned });\n}\nfunction detailsFor(input: {\n readonly reader: RecordReadSession;\n readonly attempt: ReadableAttempt;\n readonly evaluationKind: ExecutionReusePlanSource[\"evaluationKind\"];\n}): Effect.Effect<{\n readonly assertions: CurrentRecordRead<Verdict>;\n readonly score: CurrentReusedAttemptScore;\n readonly executionErrors: CurrentRecordRead<readonly CurrentReusedExecutionError[]>;\n}, RecordReaderReadError> {\n return Effect.gen(function* () {\n const assertions = yield* input.reader.readAssertions(input.attempt.owner);\n const assertionRead: CurrentRecordRead<Verdict> = assertions.state === \"available\"\n ? Object.freeze({\n state: \"available\" as const,\n value: recordedAttemptVerdict({\n outcome: input.attempt.document.outcome,\n assertions: assertions.value,\n }) as Verdict,\n })\n : nonAvailableRead(assertions);\n const observability = yield* input.reader.readAttemptObservability(input.attempt.owner);\n const executionErrors: CurrentRecordRead<readonly CurrentReusedExecutionError[]> = observability.state === \"available\"\n ? Object.freeze({\n state: \"available\" as const,\n value: Object.freeze(observability.value.diagnostics.diagnostics\n .filter((diagnostic) => diagnostic.kind === \"execution-error\")\n .map((diagnostic) => Object.freeze({\n kind: \"execution-error\" as const,\n code: diagnostic.code,\n phase: diagnostic.phase,\n summary: diagnostic.summary,\n causes: Object.freeze(diagnostic.causes.map((cause) => Object.freeze({\n code: cause.code,\n summary: cause.summary,\n }))),\n }))),\n })\n : nonAvailableRead(observability);\n const scoreAttachment: CurrentRecordRead<{\n readonly state: \"complete\" | \"partial\" | \"unavailable\";\n readonly earned?: number;\n }> = assertions.state === \"available\"\n ? Object.freeze({ state: \"available\" as const, value: scoreOf(assertions.value.entries) })\n : nonAvailableRead(assertions);\n const score: CurrentReusedAttemptScore = input.evaluationKind === \"score\"\n ? Object.freeze({ state: \"applicable\" as const, attachment: scoreAttachment })\n : Object.freeze({ state: \"not-applicable\" as const });\n return Object.freeze({ assertions: assertionRead, score, executionErrors });\n });\n}\nexport function readCurrentReusedAttempt(input: {\n readonly reader: RecordReadSession;\n readonly slot: ReusePlanSlot;\n}): Effect.Effect<CurrentReusedAttemptReadback, RecordReaderReadError | CurrentReuseReadbackPlanInvalid> {\n return Effect.gen(function* () {\n const attempt = yield* readSourceAttempt({ reader: input.reader, source: input.slot.source });\n const details = yield* detailsFor({\n reader: input.reader,\n attempt,\n evaluationKind: input.slot.source.evaluationKind,\n });\n if (details.assertions.state !== \"available\") {\n return yield* Effect.fail(invalid(\"source-verdict-unavailable\"));\n }\n if (details.assertions.value !== \"passed\" && details.assertions.value !== \"failed\") {\n return yield* Effect.fail(invalid(\"source-verdict-ineligible\"));\n }\n return Object.freeze({\n state: \"reused\" as const,\n target: targetOf(input.slot),\n source: sourceOf(input.slot.source),\n verdict: details.assertions.value,\n score: details.score,\n executionErrors: details.executionErrors,\n });\n });\n}\nexport function readCurrentReuseCandidate(input: {\n readonly reader: RecordReadSession;\n readonly slot: Extract<ExecutionReusePlan[\"slots\"][number], {\n readonly state: \"gap\";\n }>;\n}): Effect.Effect<CurrentReuseCandidateReadback | undefined, RecordReaderReadError | CurrentReuseReadbackPlanInvalid> {\n return Effect.suspend(() => {\n const source = input.slot.candidate;\n if (source === undefined)\n return Effect.succeed(undefined);\n return Effect.gen(function* () {\n const attempt = yield* readSourceAttempt({ reader: input.reader, source });\n const details = yield* detailsFor({ reader: input.reader, attempt, evaluationKind: source.evaluationKind });\n const sourceFiles = yield* readCurrentReuseSourceFiles({ reader: input.reader, source });\n return Object.freeze({\n state: \"prior\" as const,\n target: targetOf(input.slot),\n source: sourceOf(source),\n verdict: details.assertions,\n score: details.score,\n executionErrors: details.executionErrors,\n sourceFiles,\n });\n });\n });\n}\nexport function readCurrentExecutionReusePlanReadbacks(input: {\n readonly reader: RecordReadSession;\n readonly plan: ExecutionReusePlan;\n}): Effect.Effect<readonly CurrentReuseReadback[], RecordReaderReadError | CurrentReuseReadbackPlanInvalid> {\n return Effect.forEach(input.plan.slots, (slot) => slot.state === \"reuse\"\n ? readCurrentReusedAttempt({ reader: input.reader, slot }).pipe(Effect.map((value): CurrentReuseReadback | undefined => value))\n : readCurrentReuseCandidate({ reader: input.reader, slot }), { concurrency: 1 }).pipe(Effect.map((values) => Object.freeze(values.flatMap((value) => value === undefined ? [] : [value]))));\n}\nexport function readCurrentExecutionReusePlanResults(input: {\n readonly reader: RecordReadSession;\n readonly plan: ExecutionReusePlan;\n}): Effect.Effect<readonly CurrentReusedAttemptReadback[], RecordReaderReadError | CurrentReuseReadbackPlanInvalid> {\n return Effect.forEach(input.plan.reuse, (slot) => readCurrentReusedAttempt({ reader: input.reader, slot }), { concurrency: 1 }).pipe(Effect.map((values) => Object.freeze(values)));\n}\nfunction readCurrentReuseSourceFiles(input: {\n readonly reader: RecordReadSession;\n readonly source: ExecutionReusePlanSource;\n}): Effect.Effect<CurrentReuseSourceFiles, RecordReaderReadError> {\n return Effect.gen(function* () {\n const origin = yield* input.reader.readRun(input.source.originRun);\n if (origin.state === \"missing\")\n return Object.freeze({ state: \"origin-run-missing\" as const });\n if (origin.state === \"core-invalid\") {\n return Object.freeze({ state: \"origin-run-invalid\" as const, issues: Object.freeze([...origin.issues]) });\n }\n const sources = yield* input.reader.readSources(origin.value.owner);\n if (sources.state !== \"available\")\n return nonAvailableRead(sources);\n const projection = projectSourcesAttachment(sources.value, sources.blobs);\n if (Either.isLeft(projection))\n return Object.freeze({ state: \"projection-invalid\" as const });\n return Object.freeze({\n state: \"available\" as const,\n value: Object.freeze(projection.right.items.map((item) => Object.freeze({\n path: item.path,\n sha256: item.sha256,\n }))),\n });\n });\n}\nexport function projectCurrentReuseReadback(readback: CurrentReuseReadback): CurrentReuseReadbackSnapshot {\n return readback.state === \"reused\"\n ? projectCurrentReusedAttemptReadback(readback)\n : projectCurrentReuseCandidateReadback(readback);\n}\nexport function projectCurrentReusedAttemptReadback(readback: CurrentReusedAttemptReadback): CurrentReusedAttemptSnapshot {\n return Object.freeze({\n state: \"reused\" as const,\n target: targetSnapshotOf(readback.target),\n source: sourceSnapshotOf(readback.source),\n verdict: readback.verdict,\n score: readback.score,\n executionErrors: readback.executionErrors,\n });\n}\nexport function projectCurrentReuseCandidateReadback(readback: CurrentReuseCandidateReadback): CurrentReuseCandidateSnapshot {\n return Object.freeze({\n state: \"prior\" as const,\n target: targetSnapshotOf(readback.target),\n source: sourceSnapshotOf(readback.source),\n verdict: readback.verdict,\n score: readback.score,\n executionErrors: readback.executionErrors,\n sourceFiles: readback.sourceFiles,\n });\n}\nfunction targetOf(slot: TargetSlot): CurrentReusedAttemptTarget {\n return Object.freeze({\n runId: slot.runId,\n slotId: slot.slotId,\n experimentId: slot.experimentId,\n evalId: slot.evalId,\n attempt: slot.attempt,\n });\n}\nfunction sourceOf(source: ExecutionReusePlanSource): CurrentReusedAttemptSource {\n return Object.freeze({\n attempt: source.attempt,\n attemptId: source.attemptId,\n origin: source.origin,\n sourceBarrier: source.sourceBarrier,\n evaluationKind: source.evaluationKind,\n });\n}\nfunction targetSnapshotOf(target: CurrentReusedAttemptTarget): CurrentReusedAttemptTargetSnapshot {\n return Object.freeze({\n runId: String(target.runId),\n slotId: String(target.slotId),\n experimentId: target.experimentId,\n evalId: target.evalId,\n attempt: target.attempt,\n });\n}\nfunction sourceSnapshotOf(source: CurrentReusedAttemptSource): CurrentReusedAttemptSourceSnapshot {\n return Object.freeze({\n attemptId: String(source.attemptId),\n locator: encodeAttemptLocator(source.attemptId),\n origin: Object.freeze({ runId: String(source.origin.runId), slotId: String(source.origin.slotId) }),\n sourceBarrier: Object.freeze({\n runId: String(source.sourceBarrier.runId),\n startedAt: source.sourceBarrier.startedAt,\n }),\n evaluationKind: source.evaluationKind,\n });\n}\n"]}
1
+ {"version":3,"file":"reuse-readback.js","sourceRoot":"","sources":["reuse-readback.ts"],"names":[],"mappings":";;AAoQA,4DA0BC;AACD,8DAyBC;AACD,wFAOC;AACD,oFAKC;AA2BD,kEAIC;AACD,kFASC;AACD,oFAUC;AA1XD,mCAAwC;AACxC,8DAA6D;AAK7D,0DAAmE;AAEnE,mDAAuJ;AA+HvJ,SAAS,UAAU,CAAQ,KAA6B;IACpD,QAAQ,KAAK,CAAC,KAAK,EAAE,CAAC;QAClB,KAAK,WAAW;YACZ,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,WAAoB,EAAE,KAAK,EAAE,KAAK,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SAAS;QAC3B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,cAAc,EAAE,MAAM,CAAC,cAAc;KACxC,CAAC,CAAC;AACP,CAAC;AACD,SAAS,gBAAgB,CAAC,MAAkC;IACxD,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QAC7B,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;KAC1B,CAAC,CAAC;AACP,CAAC;AACD,SAAS,gBAAgB,CAAC,MAAkC;IACxD,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;QACnC,OAAO,EAAE,IAAA,yCAAoB,EAAC,MAAM,CAAC,SAAS,CAAC;QAC/C,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACnG,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC;YACzB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;YACzC,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,SAAS;SAC5C,CAAC;QACF,cAAc,EAAE,MAAM,CAAC,cAAc;KACxC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { Effect, Either } from \"effect\";\nimport { encodeAttemptLocator } from \"../attempt-locator.ts\";\nimport type { ScoreContribution } from \"../assertions/record/model.ts\";\nimport type { RecordIssue } from \"../record/errors/record-errors.ts\";\nimport type { FixedFamilyRead, ReadableAttempt, RecordReadSession, SelectedAttemptRef, } from \"../record/host/types.ts\";\nimport type { RecordReaderReadError } from \"../record/reader/errors.ts\";\nimport { projectSourcesAttachment } from \"../sources/projector.ts\";\nimport type { Verdict } from \"../shared/types.ts\";\nimport { recordedAttemptVerdict, type ExecutionReusePlan, type ExecutionReusePlanSource, type ReusePlanSlot, type TargetSlot, } from \"./reuse-plan.ts\";\n/** Fixed-family read states remain visible; a readback never invents a result file. */\nexport type CurrentRecordRead<Value> = {\n readonly state: \"available\";\n readonly value: Value;\n} | {\n readonly state: \"not-recorded\";\n} | {\n readonly state: \"migration-required\";\n readonly family: string;\n readonly fromSchemaVersion: number;\n readonly toSchemaVersion: number;\n readonly command: \"niceeval migrate\";\n} | {\n readonly state: \"unsupported\";\n readonly family: string;\n readonly schemaVersion: number;\n} | {\n readonly state: \"invalid\";\n readonly issues: readonly RecordIssue[];\n};\nexport interface CurrentReusedAttemptReadback {\n readonly state: \"reused\";\n readonly target: CurrentReusedAttemptTarget;\n readonly source: CurrentReusedAttemptSource;\n readonly verdict: \"passed\" | \"failed\";\n readonly score: CurrentReusedAttemptScore;\n readonly executionErrors: CurrentRecordRead<readonly CurrentReusedExecutionError[]>;\n}\nexport interface CurrentReuseCandidateReadback {\n readonly state: \"prior\";\n readonly target: CurrentReusedAttemptTarget;\n readonly source: CurrentReusedAttemptSource;\n readonly verdict: CurrentRecordRead<Verdict>;\n readonly score: CurrentReusedAttemptScore;\n readonly executionErrors: CurrentRecordRead<readonly CurrentReusedExecutionError[]>;\n readonly sourceFiles: CurrentReuseSourceFiles;\n}\nexport type CurrentReuseReadback = CurrentReusedAttemptReadback | CurrentReuseCandidateReadback;\nexport interface CurrentReusedAttemptTarget {\n readonly runId: TargetSlot[\"runId\"];\n readonly slotId: TargetSlot[\"slotId\"];\n readonly experimentId: TargetSlot[\"experimentId\"];\n readonly evalId: TargetSlot[\"evalId\"];\n readonly attempt: TargetSlot[\"attempt\"];\n}\nexport interface CurrentReusedAttemptSource {\n readonly attempt: SelectedAttemptRef;\n readonly attemptId: ExecutionReusePlanSource[\"attemptId\"];\n readonly origin: ExecutionReusePlanSource[\"origin\"];\n readonly sourceBarrier: ExecutionReusePlanSource[\"sourceBarrier\"];\n readonly evaluationKind: ExecutionReusePlanSource[\"evaluationKind\"];\n}\nexport type CurrentReusedAttemptScore = {\n readonly state: \"not-applicable\";\n} | {\n readonly state: \"applicable\";\n readonly attachment: CurrentRecordRead<{\n readonly state: \"complete\" | \"partial\" | \"unavailable\";\n readonly earned?: number;\n }>;\n};\nexport interface CurrentReusedExecutionCause {\n readonly code: string;\n readonly summary: string;\n}\nexport interface CurrentReusedExecutionError {\n readonly kind: \"execution-error\";\n readonly code: string;\n readonly phase: string;\n readonly summary: string;\n readonly causes: readonly CurrentReusedExecutionCause[];\n}\nexport interface CurrentReuseSourceFile {\n readonly path: string;\n readonly sha256: string;\n}\nexport type CurrentReuseSourceFiles = CurrentRecordRead<readonly CurrentReuseSourceFile[]> | {\n readonly state: \"origin-run-missing\";\n} | {\n readonly state: \"origin-run-invalid\";\n readonly issues: readonly RecordIssue[];\n} | {\n readonly state: \"projection-invalid\";\n};\nexport interface CurrentReuseReadbackPlanInvalid {\n readonly code: \"current-reuse-readback-plan-invalid\";\n readonly reason: \"source-attempt-unavailable\" | \"source-verdict-unavailable\" | \"source-verdict-ineligible\";\n}\nexport interface CurrentReusedAttemptSourceSnapshot {\n readonly attemptId: string;\n readonly locator: string;\n readonly origin: {\n readonly runId: string;\n readonly slotId: string;\n };\n readonly sourceBarrier: {\n readonly runId: string;\n readonly startedAt: number;\n };\n readonly evaluationKind: CurrentReusedAttemptSource[\"evaluationKind\"];\n}\nexport interface CurrentReusedAttemptTargetSnapshot {\n readonly runId: string;\n readonly slotId: string;\n readonly experimentId: string;\n readonly evalId: string;\n readonly attempt: number;\n}\nexport interface CurrentReusedAttemptSnapshot {\n readonly state: \"reused\";\n readonly target: CurrentReusedAttemptTargetSnapshot;\n readonly source: CurrentReusedAttemptSourceSnapshot;\n readonly verdict: CurrentReusedAttemptReadback[\"verdict\"];\n readonly score: CurrentReusedAttemptScore;\n readonly executionErrors: CurrentReusedAttemptReadback[\"executionErrors\"];\n}\nexport interface CurrentReuseCandidateSnapshot {\n readonly state: \"prior\";\n readonly target: CurrentReusedAttemptTargetSnapshot;\n readonly source: CurrentReusedAttemptSourceSnapshot;\n readonly verdict: CurrentReuseCandidateReadback[\"verdict\"];\n readonly score: CurrentReusedAttemptScore;\n readonly executionErrors: CurrentReusedAttemptReadback[\"executionErrors\"];\n readonly sourceFiles: CurrentReuseSourceFiles;\n}\nexport type CurrentReuseReadbackSnapshot = CurrentReusedAttemptSnapshot | CurrentReuseCandidateSnapshot;\nfunction recordRead<Value>(value: FixedFamilyRead<Value>): CurrentRecordRead<Value> {\n switch (value.state) {\n case \"available\":\n return Object.freeze({ state: \"available\" as const, value: value.value as Value });\n case \"not-recorded\":\n return Object.freeze({ state: \"not-recorded\" as const });\n case \"unsupported\":\n return Object.freeze({\n state: \"unsupported\" as const,\n family: value.family,\n schemaVersion: value.schemaVersion,\n });\n case \"migration-required\":\n return Object.freeze({\n state: \"migration-required\" as const,\n family: value.family,\n fromSchemaVersion: value.fromSchemaVersion,\n toSchemaVersion: value.toSchemaVersion,\n command: value.command,\n });\n case \"invalid\":\n return Object.freeze({ state: \"invalid\" as const, issues: Object.freeze([...value.issues]) });\n }\n}\nfunction nonAvailableRead<Value>(value: Exclude<FixedFamilyRead<unknown>, {\n readonly state: \"available\";\n}>): CurrentRecordRead<Value> {\n switch (value.state) {\n case \"not-recorded\":\n return Object.freeze({ state: \"not-recorded\" as const });\n case \"unsupported\":\n return Object.freeze({\n state: \"unsupported\" as const,\n family: value.family,\n schemaVersion: value.schemaVersion,\n });\n case \"migration-required\":\n return Object.freeze({\n state: \"migration-required\" as const,\n family: value.family,\n fromSchemaVersion: value.fromSchemaVersion,\n toSchemaVersion: value.toSchemaVersion,\n command: value.command,\n });\n case \"invalid\":\n return Object.freeze({ state: \"invalid\" as const, issues: Object.freeze([...value.issues]) });\n }\n}\nfunction invalid(reason: CurrentReuseReadbackPlanInvalid[\"reason\"]): CurrentReuseReadbackPlanInvalid {\n return Object.freeze({ code: \"current-reuse-readback-plan-invalid\", reason });\n}\nfunction readSourceAttempt(input: {\n readonly reader: RecordReadSession;\n readonly source: ExecutionReusePlanSource;\n}): Effect.Effect<ReadableAttempt, RecordReaderReadError | CurrentReuseReadbackPlanInvalid> {\n return input.reader.readAttempt(input.source.attempt).pipe(Effect.flatMap((read) => read.state === \"available\"\n ? Effect.succeed(read.value)\n : Effect.fail(invalid(\"source-attempt-unavailable\"))));\n}\nfunction scoreOf(contributions: readonly ScoreContribution[]): {\n readonly state: \"complete\" | \"partial\" | \"unavailable\";\n readonly earned?: number;\n} {\n let earned = 0;\n let unavailable = false;\n for (const score of contributions) {\n if (score.state === \"earned\" && typeof score.earned === \"number\")\n earned += score.earned;\n if (score.state === \"unavailable\")\n unavailable = true;\n }\n return unavailable\n ? Object.freeze({ state: earned > 0 ? \"partial\" as const : \"unavailable\" as const, ...(earned > 0 ? { earned } : {}) })\n : Object.freeze({ state: \"complete\" as const, earned });\n}\nfunction detailsFor(input: {\n readonly reader: RecordReadSession;\n readonly attempt: ReadableAttempt;\n readonly evaluationKind: ExecutionReusePlanSource[\"evaluationKind\"];\n}): Effect.Effect<{\n readonly assertions: CurrentRecordRead<Verdict>;\n readonly score: CurrentReusedAttemptScore;\n readonly executionErrors: CurrentRecordRead<readonly CurrentReusedExecutionError[]>;\n}, RecordReaderReadError> {\n return Effect.gen(function* () {\n const assertions = yield* input.reader.readAssertions(input.attempt.owner);\n const assertionRead: CurrentRecordRead<Verdict> = assertions.state === \"available\"\n ? Object.freeze({\n state: \"available\" as const,\n value: recordedAttemptVerdict({\n outcome: input.attempt.document.outcome,\n assertions: assertions.value,\n }) as Verdict,\n })\n : nonAvailableRead(assertions);\n const observability = yield* input.reader.readAttemptObservability(input.attempt.owner);\n const executionErrors: CurrentRecordRead<readonly CurrentReusedExecutionError[]> = observability.state === \"available\"\n ? Object.freeze({\n state: \"available\" as const,\n value: Object.freeze(observability.value.diagnostics.diagnostics\n .filter((diagnostic) => diagnostic.kind === \"execution-error\")\n .map((diagnostic) => Object.freeze({\n kind: \"execution-error\" as const,\n code: diagnostic.code,\n phase: diagnostic.phase,\n summary: diagnostic.summary,\n causes: Object.freeze(diagnostic.causes.map((cause) => Object.freeze({\n code: cause.code,\n summary: cause.summary,\n }))),\n }))),\n })\n : nonAvailableRead(observability);\n const scoreAttachment: CurrentRecordRead<{\n readonly state: \"complete\" | \"partial\" | \"unavailable\";\n readonly earned?: number;\n }> = assertions.state === \"available\"\n ? Object.freeze({ state: \"available\" as const, value: scoreOf(assertions.value.entries.map((entry) => entry.contribution)) })\n : nonAvailableRead(assertions);\n const score: CurrentReusedAttemptScore = input.evaluationKind === \"score\"\n ? Object.freeze({ state: \"applicable\" as const, attachment: scoreAttachment })\n : Object.freeze({ state: \"not-applicable\" as const });\n return Object.freeze({ assertions: assertionRead, score, executionErrors });\n });\n}\nexport function readCurrentReusedAttempt(input: {\n readonly reader: RecordReadSession;\n readonly slot: ReusePlanSlot;\n}): Effect.Effect<CurrentReusedAttemptReadback, RecordReaderReadError | CurrentReuseReadbackPlanInvalid> {\n return Effect.gen(function* () {\n const attempt = yield* readSourceAttempt({ reader: input.reader, source: input.slot.source });\n const details = yield* detailsFor({\n reader: input.reader,\n attempt,\n evaluationKind: input.slot.source.evaluationKind,\n });\n if (details.assertions.state !== \"available\") {\n return yield* Effect.fail(invalid(\"source-verdict-unavailable\"));\n }\n if (details.assertions.value !== \"passed\" && details.assertions.value !== \"failed\") {\n return yield* Effect.fail(invalid(\"source-verdict-ineligible\"));\n }\n return Object.freeze({\n state: \"reused\" as const,\n target: targetOf(input.slot),\n source: sourceOf(input.slot.source),\n verdict: details.assertions.value,\n score: details.score,\n executionErrors: details.executionErrors,\n });\n });\n}\nexport function readCurrentReuseCandidate(input: {\n readonly reader: RecordReadSession;\n readonly slot: Extract<ExecutionReusePlan[\"slots\"][number], {\n readonly state: \"gap\";\n }>;\n}): Effect.Effect<CurrentReuseCandidateReadback | undefined, RecordReaderReadError | CurrentReuseReadbackPlanInvalid> {\n return Effect.suspend(() => {\n const source = input.slot.candidate;\n if (source === undefined)\n return Effect.succeed(undefined);\n return Effect.gen(function* () {\n const attempt = yield* readSourceAttempt({ reader: input.reader, source });\n const details = yield* detailsFor({ reader: input.reader, attempt, evaluationKind: source.evaluationKind });\n const sourceFiles = yield* readCurrentReuseSourceFiles({ reader: input.reader, source });\n return Object.freeze({\n state: \"prior\" as const,\n target: targetOf(input.slot),\n source: sourceOf(source),\n verdict: details.assertions,\n score: details.score,\n executionErrors: details.executionErrors,\n sourceFiles,\n });\n });\n });\n}\nexport function readCurrentExecutionReusePlanReadbacks(input: {\n readonly reader: RecordReadSession;\n readonly plan: ExecutionReusePlan;\n}): Effect.Effect<readonly CurrentReuseReadback[], RecordReaderReadError | CurrentReuseReadbackPlanInvalid> {\n return Effect.forEach(input.plan.slots, (slot) => slot.state === \"reuse\"\n ? readCurrentReusedAttempt({ reader: input.reader, slot }).pipe(Effect.map((value): CurrentReuseReadback | undefined => value))\n : readCurrentReuseCandidate({ reader: input.reader, slot }), { concurrency: 1 }).pipe(Effect.map((values) => Object.freeze(values.flatMap((value) => value === undefined ? [] : [value]))));\n}\nexport function readCurrentExecutionReusePlanResults(input: {\n readonly reader: RecordReadSession;\n readonly plan: ExecutionReusePlan;\n}): Effect.Effect<readonly CurrentReusedAttemptReadback[], RecordReaderReadError | CurrentReuseReadbackPlanInvalid> {\n return Effect.forEach(input.plan.reuse, (slot) => readCurrentReusedAttempt({ reader: input.reader, slot }), { concurrency: 1 }).pipe(Effect.map((values) => Object.freeze(values)));\n}\nfunction readCurrentReuseSourceFiles(input: {\n readonly reader: RecordReadSession;\n readonly source: ExecutionReusePlanSource;\n}): Effect.Effect<CurrentReuseSourceFiles, RecordReaderReadError> {\n return Effect.gen(function* () {\n const origin = yield* input.reader.readRun(input.source.originRun);\n if (origin.state === \"missing\")\n return Object.freeze({ state: \"origin-run-missing\" as const });\n if (origin.state === \"core-invalid\") {\n return Object.freeze({ state: \"origin-run-invalid\" as const, issues: Object.freeze([...origin.issues]) });\n }\n const sources = yield* input.reader.readSources(origin.value.owner);\n if (sources.state !== \"available\")\n return nonAvailableRead(sources);\n const projection = projectSourcesAttachment(sources.value, sources.blobs);\n if (Either.isLeft(projection))\n return Object.freeze({ state: \"projection-invalid\" as const });\n return Object.freeze({\n state: \"available\" as const,\n value: Object.freeze(projection.right.items.map((item) => Object.freeze({\n path: item.path,\n sha256: item.sha256,\n }))),\n });\n });\n}\nexport function projectCurrentReuseReadback(readback: CurrentReuseReadback): CurrentReuseReadbackSnapshot {\n return readback.state === \"reused\"\n ? projectCurrentReusedAttemptReadback(readback)\n : projectCurrentReuseCandidateReadback(readback);\n}\nexport function projectCurrentReusedAttemptReadback(readback: CurrentReusedAttemptReadback): CurrentReusedAttemptSnapshot {\n return Object.freeze({\n state: \"reused\" as const,\n target: targetSnapshotOf(readback.target),\n source: sourceSnapshotOf(readback.source),\n verdict: readback.verdict,\n score: readback.score,\n executionErrors: readback.executionErrors,\n });\n}\nexport function projectCurrentReuseCandidateReadback(readback: CurrentReuseCandidateReadback): CurrentReuseCandidateSnapshot {\n return Object.freeze({\n state: \"prior\" as const,\n target: targetSnapshotOf(readback.target),\n source: sourceSnapshotOf(readback.source),\n verdict: readback.verdict,\n score: readback.score,\n executionErrors: readback.executionErrors,\n sourceFiles: readback.sourceFiles,\n });\n}\nfunction targetOf(slot: TargetSlot): CurrentReusedAttemptTarget {\n return Object.freeze({\n runId: slot.runId,\n slotId: slot.slotId,\n experimentId: slot.experimentId,\n evalId: slot.evalId,\n attempt: slot.attempt,\n });\n}\nfunction sourceOf(source: ExecutionReusePlanSource): CurrentReusedAttemptSource {\n return Object.freeze({\n attempt: source.attempt,\n attemptId: source.attemptId,\n origin: source.origin,\n sourceBarrier: source.sourceBarrier,\n evaluationKind: source.evaluationKind,\n });\n}\nfunction targetSnapshotOf(target: CurrentReusedAttemptTarget): CurrentReusedAttemptTargetSnapshot {\n return Object.freeze({\n runId: String(target.runId),\n slotId: String(target.slotId),\n experimentId: target.experimentId,\n evalId: target.evalId,\n attempt: target.attempt,\n });\n}\nfunction sourceSnapshotOf(source: CurrentReusedAttemptSource): CurrentReusedAttemptSourceSnapshot {\n return Object.freeze({\n attemptId: String(source.attemptId),\n locator: encodeAttemptLocator(source.attemptId),\n origin: Object.freeze({ runId: String(source.origin.runId), slotId: String(source.origin.slotId) }),\n sourceBarrier: Object.freeze({\n runId: String(source.sourceBarrier.runId),\n startedAt: source.sourceBarrier.startedAt,\n }),\n evaluationKind: source.evaluationKind,\n });\n}\n"]}
@@ -2121,6 +2121,7 @@ function runEvals(opts) {
2121
2121
  // 且混进兄弟 fiber 的 interrupt 后被当成用户中断吞掉正文(见
2122
2122
  // docs/feature/error-classification/architecture.md「Effect 边界」:attempt fiber 的
2123
2123
  // E 恒为 never;memory/experiment-fatal-presented-as-user-interrupt.md)。
2124
+ let sealedEvaluation;
2124
2125
  const completed = yield* effect_1.Effect.scoped(effect_1.Effect.gen(function* () {
2125
2126
  const leased = poolSelection._tag === "Reuse"
2126
2127
  ? effect_1.Either.match(yield* effect_1.Effect.either(poolSelection.pool.acquire((0, timeout_ts_1.resolveAttemptTimeout)(a.run, a.evalDef, opts.config)?.timeoutMs, buildLocators)), {
@@ -2194,7 +2195,9 @@ function runEvals(opts) {
2194
2195
  },
2195
2196
  }
2196
2197
  : {}),
2197
- onSealedEvaluation: (sealed) => recordCoordinator.noteSealedOrMarkIncomplete(recordedAttempt, sealed),
2198
+ onSealedEvaluation: (sealed) => effect_1.Effect.sync(() => {
2199
+ sealedEvaluation = sealed;
2200
+ }).pipe(effect_1.Effect.zipRight(recordCoordinator.noteSealedOrMarkIncomplete(recordedAttempt, sealed))),
2198
2201
  });
2199
2202
  if (lease) {
2200
2203
  // Attempt 的 Eval/Agent 收尾已在 runAttemptEffect 内完成;reset 失败会淘汰实例,
@@ -2314,7 +2317,7 @@ function runEvals(opts) {
2314
2317
  // 的省略规则一致),且只报真正计入 results 的 attempt(上面的并发去重分支已经
2315
2318
  // return 掉、不会走到这里,不会为一条被丢弃的重复 attempt 误报失败)。
2316
2319
  if (locator) {
2317
- const failure = (0, failure_ts_1.failureDetailFromResult)(result);
2320
+ const failure = (0, failure_ts_1.failureDetailFromResult)(result, sealedEvaluation);
2318
2321
  if (failure)
2319
2322
  (0, sink_ts_1.reportFailure)(failure);
2320
2323
  }