niceeval 0.13.3-canary.37 → 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 (383) 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/codex-app-server.cjs +2 -3
  7. package/dist/agents/codex-app-server.cjs.map +1 -1
  8. package/dist/agents/codex.cjs +4 -4
  9. package/dist/agents/codex.cjs.map +1 -1
  10. package/dist/agents/codex.d.cts +3 -3
  11. package/dist/agents/codex.d.mts +3 -3
  12. package/dist/agents/codex.d.ts +3 -3
  13. package/dist/agents/sdk-streams.cjs +11 -4
  14. package/dist/agents/sdk-streams.cjs.map +1 -1
  15. package/dist/analysis/bindings.cjs +74 -19
  16. package/dist/analysis/bindings.cjs.map +1 -1
  17. package/dist/analysis/bindings.d.cts +534 -156
  18. package/dist/analysis/bindings.d.mts +534 -156
  19. package/dist/analysis/bindings.d.ts +534 -156
  20. package/dist/analysis/domain-view.cjs.map +1 -1
  21. package/dist/analysis/domain-view.d.cts +137 -8
  22. package/dist/analysis/domain-view.d.mts +137 -8
  23. package/dist/analysis/domain-view.d.ts +137 -8
  24. package/dist/analysis/index.cjs.map +1 -1
  25. package/dist/analysis/index.d.cts +1 -1
  26. package/dist/analysis/index.d.mts +1 -1
  27. package/dist/analysis/index.d.ts +1 -1
  28. package/dist/assertions/api.cjs.map +1 -1
  29. package/dist/assertions/api.d.cts +62 -0
  30. package/dist/assertions/api.d.mts +62 -0
  31. package/dist/assertions/api.d.ts +62 -0
  32. package/dist/assertions/judge.cjs +56 -5
  33. package/dist/assertions/judge.cjs.map +1 -1
  34. package/dist/assertions/match.cjs +66 -42
  35. package/dist/assertions/match.cjs.map +1 -1
  36. package/dist/assertions/match.d.cts +13 -0
  37. package/dist/assertions/match.d.mts +13 -0
  38. package/dist/assertions/match.d.ts +13 -0
  39. package/dist/assertions/record/attachment.cjs +104 -33
  40. package/dist/assertions/record/attachment.cjs.map +1 -1
  41. package/dist/assertions/record/attachment.d.cts +294 -57
  42. package/dist/assertions/record/attachment.d.mts +294 -57
  43. package/dist/assertions/record/attachment.d.ts +294 -57
  44. package/dist/assertions/record/codec.cjs +91 -17
  45. package/dist/assertions/record/codec.cjs.map +1 -1
  46. package/dist/assertions/record/codec.d.cts +280 -52
  47. package/dist/assertions/record/codec.d.mts +280 -52
  48. package/dist/assertions/record/codec.d.ts +280 -52
  49. package/dist/assertions/record/index.js +2 -0
  50. package/dist/assertions/record/model.cjs +16 -0
  51. package/dist/assertions/record/model.cjs.map +1 -1
  52. package/dist/assertions/record/model.d.cts +120 -13
  53. package/dist/assertions/record/model.d.mts +120 -13
  54. package/dist/assertions/record/model.d.ts +120 -13
  55. package/dist/assertions/record/model.js +2 -0
  56. package/dist/assertions/record/producer.cjs +70 -50
  57. package/dist/assertions/record/producer.cjs.map +1 -1
  58. package/dist/assertions/record/producer.d.cts +8 -7
  59. package/dist/assertions/record/producer.d.mts +8 -7
  60. package/dist/assertions/record/producer.d.ts +8 -7
  61. package/dist/assertions/runtime.cjs +49 -7
  62. package/dist/assertions/runtime.cjs.map +1 -1
  63. package/dist/cli/application.cjs +40 -0
  64. package/dist/cli/application.cjs.map +1 -0
  65. package/dist/cli/application.d.cts +129 -0
  66. package/dist/cli/application.d.mts +129 -0
  67. package/dist/cli/application.d.ts +129 -0
  68. package/dist/cli/application.js +24 -0
  69. package/dist/cli/application.js.map +1 -0
  70. package/dist/cli/bootstrap.cjs +10 -4
  71. package/dist/cli/bootstrap.cjs.map +1 -1
  72. package/dist/cli/node-application.cjs +123 -0
  73. package/dist/cli/node-application.cjs.map +1 -0
  74. package/dist/cli/node-application.d.cts +14 -0
  75. package/dist/cli/node-application.d.mts +14 -0
  76. package/dist/cli/node-application.d.ts +14 -0
  77. package/dist/cli/node-application.js +26 -0
  78. package/dist/cli/node-application.js.map +1 -0
  79. package/dist/cli/program.cjs +2807 -0
  80. package/dist/cli/program.cjs.map +1 -0
  81. package/dist/cli/program.d.cts +352 -0
  82. package/dist/cli/program.d.mts +352 -0
  83. package/dist/cli/program.d.ts +352 -0
  84. package/dist/cli/program.js +36 -0
  85. package/dist/cli/program.js.map +1 -0
  86. package/dist/cli/project-configuration.cjs +134 -0
  87. package/dist/cli/project-configuration.cjs.map +1 -0
  88. package/dist/cli/project-configuration.d.cts +64 -0
  89. package/dist/cli/project-configuration.d.mts +64 -0
  90. package/dist/cli/project-configuration.d.ts +64 -0
  91. package/dist/cli/project-configuration.js +22 -0
  92. package/dist/cli/project-configuration.js.map +1 -0
  93. package/dist/cli/record.cjs +20 -4
  94. package/dist/cli/record.cjs.map +1 -1
  95. package/dist/cli/record.d.cts +3 -3
  96. package/dist/cli/record.d.mts +3 -3
  97. package/dist/cli/record.d.ts +3 -3
  98. package/dist/cli.cjs +19 -3130
  99. package/dist/cli.cjs.map +1 -1
  100. package/dist/cli.d.cts +2 -148
  101. package/dist/cli.d.mts +2 -148
  102. package/dist/cli.d.ts +2 -148
  103. package/dist/cli.js +22 -30
  104. package/dist/context/assert-first.cjs +20 -15
  105. package/dist/context/assert-first.cjs.map +1 -1
  106. package/dist/eval/record/verdict.cjs +3 -2
  107. package/dist/eval/record/verdict.cjs.map +1 -1
  108. package/dist/experiment/host/index.cjs +1 -6
  109. package/dist/experiment/host/index.cjs.map +1 -1
  110. package/dist/experiment/host/index.d.cts +1 -0
  111. package/dist/experiment/host/index.d.mts +1 -0
  112. package/dist/experiment/host/index.d.ts +1 -0
  113. package/dist/load-config.cjs +13 -4
  114. package/dist/load-config.cjs.map +1 -1
  115. package/dist/load-config.d.cts +4 -3
  116. package/dist/load-config.d.mts +4 -3
  117. package/dist/load-config.d.ts +4 -3
  118. package/dist/load-config.js +4 -2
  119. package/dist/o11y/parsers/codex.cjs +29 -7
  120. package/dist/o11y/parsers/codex.cjs.map +1 -1
  121. package/dist/record/codec/core.d.cts +0 -2
  122. package/dist/record/codec/core.d.mts +0 -2
  123. package/dist/record/codec/core.d.ts +0 -2
  124. package/dist/record/codec/identifiers.cjs +2 -3
  125. package/dist/record/codec/identifiers.cjs.map +1 -1
  126. package/dist/record/codec/identifiers.d.cts +1 -2
  127. package/dist/record/codec/identifiers.d.mts +1 -2
  128. package/dist/record/codec/identifiers.d.ts +1 -2
  129. package/dist/record/codec/identifiers.js +10 -12
  130. package/dist/record/codec/index.js +42 -44
  131. package/dist/record/definition/attachment.cjs +1 -0
  132. package/dist/record/definition/attachment.cjs.map +1 -1
  133. package/dist/record/definition/attachment.d.cts +14 -0
  134. package/dist/record/definition/attachment.d.mts +14 -0
  135. package/dist/record/definition/attachment.d.ts +14 -0
  136. package/dist/record/family/assertions-v1.cjs +104 -0
  137. package/dist/record/family/assertions-v1.cjs.map +1 -0
  138. package/dist/record/family/assertions-v1.d.cts +2 -0
  139. package/dist/record/family/assertions-v1.d.mts +2 -0
  140. package/dist/record/family/assertions-v1.d.ts +2 -0
  141. package/dist/record/family/assertions-v1.js +6 -0
  142. package/dist/record/family/assertions-v1.js.map +1 -0
  143. package/dist/record/family/assertions.cjs +16 -5
  144. package/dist/record/family/assertions.cjs.map +1 -1
  145. package/dist/record/family/assertions.d.cts +510 -56
  146. package/dist/record/family/assertions.d.mts +510 -56
  147. package/dist/record/family/assertions.d.ts +510 -56
  148. package/dist/record/family/assertions.js +14 -10
  149. package/dist/record/family/catalog.cjs +17 -1
  150. package/dist/record/family/catalog.cjs.map +1 -1
  151. package/dist/record/family/catalog.d.cts +1292 -104
  152. package/dist/record/family/catalog.d.mts +1292 -104
  153. package/dist/record/family/catalog.d.ts +1292 -104
  154. package/dist/record/family/catalog.js +22 -20
  155. package/dist/record/family/index.js +144 -138
  156. package/dist/record/family/observability-v1.cjs +5 -0
  157. package/dist/record/family/observability-v1.cjs.map +1 -1
  158. package/dist/record/family/observability.cjs +1 -1
  159. package/dist/record/family/observability.cjs.map +1 -1
  160. package/dist/record/host/runtime.cjs +323 -173
  161. package/dist/record/host/runtime.cjs.map +1 -1
  162. package/dist/record/host/types.cjs.map +1 -1
  163. package/dist/record/host/types.d.cts +9 -7
  164. package/dist/record/host/types.d.mts +9 -7
  165. package/dist/record/host/types.d.ts +9 -7
  166. package/dist/record/model/core.cjs.map +1 -1
  167. package/dist/record/model/core.d.cts +1 -2
  168. package/dist/record/model/core.d.mts +1 -2
  169. package/dist/record/model/core.d.ts +1 -2
  170. package/dist/record/model/definition.cjs +1 -2
  171. package/dist/record/model/definition.cjs.map +1 -1
  172. package/dist/record/model/definition.d.cts +1 -7
  173. package/dist/record/model/definition.d.mts +1 -7
  174. package/dist/record/model/definition.d.ts +1 -7
  175. package/dist/record/model/identifiers.cjs +2 -3
  176. package/dist/record/model/identifiers.cjs.map +1 -1
  177. package/dist/record/model/identifiers.d.cts +1 -3
  178. package/dist/record/model/identifiers.d.mts +1 -3
  179. package/dist/record/model/identifiers.d.ts +1 -3
  180. package/dist/record/model/identifiers.js +36 -38
  181. package/dist/record/model/index.js +60 -62
  182. package/dist/record/platform/node.cjs +17 -7
  183. package/dist/record/platform/node.cjs.map +1 -1
  184. package/dist/record/platform/services.cjs.map +1 -1
  185. package/dist/record/platform/services.d.cts +8 -3
  186. package/dist/record/platform/services.d.mts +8 -3
  187. package/dist/record/platform/services.d.ts +8 -3
  188. package/dist/record/reader/format.cjs +16 -65
  189. package/dist/record/reader/format.cjs.map +1 -1
  190. package/dist/record/reader/format.d.cts +5 -9
  191. package/dist/record/reader/format.d.mts +5 -9
  192. package/dist/record/reader/format.d.ts +5 -9
  193. package/dist/record/reader/index.js +10 -8
  194. package/dist/record/reader/runtime.cjs +63 -32
  195. package/dist/record/reader/runtime.cjs.map +1 -1
  196. package/dist/record/reader/runtime.d.cts +40 -4
  197. package/dist/record/reader/runtime.d.mts +40 -4
  198. package/dist/record/reader/runtime.d.ts +40 -4
  199. package/dist/record/reader/runtime.js +6 -4
  200. package/dist/report/assets/enhance.js +5 -5
  201. package/dist/report/assets/styles.css +186 -24
  202. package/dist/report/built-in/result-components.cjs +8 -5
  203. package/dist/report/built-in/result-components.cjs.map +1 -1
  204. package/dist/report/built-in/standard.cjs +3 -0
  205. package/dist/report/built-in/standard.cjs.map +1 -1
  206. package/dist/report/built-in/standard.d.cts +2 -0
  207. package/dist/report/built-in/standard.d.mts +2 -0
  208. package/dist/report/built-in/standard.d.ts +2 -0
  209. package/dist/report/client-dist/app.js +53 -0
  210. package/dist/report/components/attempt-detail/compute.cjs +106 -231
  211. package/dist/report/components/attempt-detail/compute.cjs.map +1 -1
  212. package/dist/report/components/attempt-detail/compute.d.cts +9 -43
  213. package/dist/report/components/attempt-detail/compute.d.mts +9 -43
  214. package/dist/report/components/attempt-detail/compute.d.ts +9 -43
  215. package/dist/report/components/attempt-detail/compute.js +2 -4
  216. package/dist/report/components/attempt-detail/content.cjs +3 -4
  217. package/dist/report/components/attempt-detail/content.cjs.map +1 -1
  218. package/dist/report/components/attempt-detail/validate.cjs +44 -2
  219. package/dist/report/components/attempt-detail/validate.cjs.map +1 -1
  220. package/dist/report/components/entity-lists/compute.cjs +9 -15
  221. package/dist/report/components/entity-lists/compute.cjs.map +1 -1
  222. package/dist/report/components/entity-lists/content.cjs +53 -40
  223. package/dist/report/components/entity-lists/content.cjs.map +1 -1
  224. package/dist/report/components/entity-lists/index.cjs +1 -3
  225. package/dist/report/components/entity-lists/index.cjs.map +1 -1
  226. package/dist/report/components/experiment-detail/compute.cjs +4 -6
  227. package/dist/report/components/experiment-detail/compute.cjs.map +1 -1
  228. package/dist/report/definition/cell.cjs +14 -7
  229. package/dist/report/definition/cell.cjs.map +1 -1
  230. package/dist/report/definition/cell.d.cts +4 -0
  231. package/dist/report/definition/cell.d.mts +4 -0
  232. package/dist/report/definition/cell.d.ts +4 -0
  233. package/dist/report/definition/primitives/assertion-evidence.cjs +96 -0
  234. package/dist/report/definition/primitives/assertion-evidence.cjs.map +1 -0
  235. package/dist/report/definition/primitives/assertion-evidence.d.cts +11 -0
  236. package/dist/report/definition/primitives/assertion-evidence.d.mts +11 -0
  237. package/dist/report/definition/primitives/assertion-evidence.d.ts +11 -0
  238. package/dist/report/definition/primitives/assertion-evidence.js +6 -0
  239. package/dist/report/definition/primitives/assertion-evidence.js.map +1 -0
  240. package/dist/report/definition/primitives.cjs +14 -1
  241. package/dist/report/definition/primitives.cjs.map +1 -1
  242. package/dist/report/definition/report.cjs +16 -8
  243. package/dist/report/definition/report.cjs.map +1 -1
  244. package/dist/report/definition/report.d.cts +6 -0
  245. package/dist/report/definition/report.d.mts +6 -0
  246. package/dist/report/definition/report.d.ts +6 -0
  247. package/dist/report/definition/table-text.cjs +12 -3
  248. package/dist/report/definition/table-text.cjs.map +1 -1
  249. package/dist/report/definition/table-text.d.cts +6 -1
  250. package/dist/report/definition/table-text.d.mts +6 -1
  251. package/dist/report/definition/table-text.d.ts +6 -1
  252. package/dist/report/execution/model.cjs +6 -14
  253. package/dist/report/execution/model.cjs.map +1 -1
  254. package/dist/report/execution/model.d.cts +5 -10
  255. package/dist/report/execution/model.d.mts +5 -10
  256. package/dist/report/execution/model.d.ts +5 -10
  257. package/dist/report/execution/model.js +6 -6
  258. package/dist/report/execution/paths.cjs +0 -11
  259. package/dist/report/execution/paths.cjs.map +1 -1
  260. package/dist/report/execution/paths.d.cts +0 -1
  261. package/dist/report/execution/paths.d.mts +0 -1
  262. package/dist/report/execution/paths.d.ts +0 -1
  263. package/dist/report/execution/paths.js +6 -8
  264. package/dist/report/host/execute.cjs +13 -22
  265. package/dist/report/host/execute.cjs.map +1 -1
  266. package/dist/report/host/execute.d.cts +1 -4
  267. package/dist/report/host/execute.d.mts +1 -4
  268. package/dist/report/host/execute.d.ts +1 -4
  269. package/dist/report/host/from-record.cjs +3 -0
  270. package/dist/report/host/from-record.cjs.map +1 -1
  271. package/dist/report/host/from-record.d.cts +4 -1
  272. package/dist/report/host/from-record.d.mts +4 -1
  273. package/dist/report/host/from-record.d.ts +4 -1
  274. package/dist/report/host/site-assets.cjs +1 -2
  275. package/dist/report/host/site-assets.cjs.map +1 -1
  276. package/dist/report/host/site-assets.d.cts +0 -1
  277. package/dist/report/host/site-assets.d.mts +0 -1
  278. package/dist/report/host/site-assets.d.ts +0 -1
  279. package/dist/report/host/site-assets.js +2 -4
  280. package/dist/report/host/static.cjs +71 -346
  281. package/dist/report/host/static.cjs.map +1 -1
  282. package/dist/report/host/static.d.cts +1 -3
  283. package/dist/report/host/static.d.mts +1 -3
  284. package/dist/report/host/static.d.ts +1 -3
  285. package/dist/report/host/static.js +2 -2
  286. package/dist/report/host/view-session.cjs.map +1 -1
  287. package/dist/report/host/view-session.d.cts +1 -1
  288. package/dist/report/host/view-session.d.mts +1 -1
  289. package/dist/report/host/view-session.d.ts +1 -1
  290. package/dist/report/model/locale.cjs +1 -1
  291. package/dist/report/model/locale.cjs.map +1 -1
  292. package/dist/report/model/locale.d.cts +1 -1
  293. package/dist/report/model/locale.d.mts +1 -1
  294. package/dist/report/model/locale.d.ts +1 -1
  295. package/dist/report/model/pricing.cjs +2 -2
  296. package/dist/report/model/pricing.cjs.map +1 -1
  297. package/dist/report/react/enhance.js +5 -5
  298. package/dist/report/react/styles.css +186 -24
  299. package/dist/runner/adoption.cjs +4 -7
  300. package/dist/runner/adoption.cjs.map +1 -1
  301. package/dist/runner/feedback/failure.cjs +77 -2
  302. package/dist/runner/feedback/failure.cjs.map +1 -1
  303. package/dist/runner/feedback/failure.d.cts +2 -1
  304. package/dist/runner/feedback/failure.d.mts +2 -1
  305. package/dist/runner/feedback/failure.d.ts +2 -1
  306. package/dist/runner/project-current.cjs +2 -13
  307. package/dist/runner/project-current.cjs.map +1 -1
  308. package/dist/runner/project-current.d.cts +4 -2
  309. package/dist/runner/project-current.d.mts +4 -2
  310. package/dist/runner/project-current.d.ts +4 -2
  311. package/dist/runner/reporters/braintrust.cjs +7 -7
  312. package/dist/runner/reporters/braintrust.cjs.map +1 -1
  313. package/dist/runner/reuse-readback.cjs +3 -4
  314. package/dist/runner/reuse-readback.cjs.map +1 -1
  315. package/dist/runner/run.cjs +5 -2
  316. package/dist/runner/run.cjs.map +1 -1
  317. package/dist/view/server.cjs +2 -37
  318. package/dist/view/server.cjs.map +1 -1
  319. package/dist/view/server.d.cts +0 -3
  320. package/dist/view/server.d.mts +0 -3
  321. package/dist/view/server.d.ts +0 -3
  322. package/docs-site/zh/reference/builtin-agents.mdx +7 -7
  323. package/docs-site/zh/reference/official-adapters.mdx +4 -4
  324. package/docs-site/zh/reference/report-components.mdx +2 -2
  325. package/docs-site/zh/tutorials/configuration.mdx +2 -2
  326. package/docs-site/zh/tutorials/deploy-report-site.mdx +24 -2
  327. package/docs-site/zh/tutorials/publish-report.mdx +4 -4
  328. package/docs-site/zh/tutorials/sandbox-agent.mdx +5 -5
  329. package/docs-site/zh/tutorials/theming.mdx +2 -2
  330. package/package.json +4 -6
  331. package/dist/record/migration/index.cjs +0 -5
  332. package/dist/record/migration/index.cjs.map +0 -1
  333. package/dist/record/migration/index.d.cts +0 -11
  334. package/dist/record/migration/index.d.mts +0 -11
  335. package/dist/record/migration/index.d.ts +0 -11
  336. package/dist/record/migration/index.js +0 -6
  337. package/dist/record/migration/index.js.map +0 -1
  338. package/dist/report/host/site-runtime.cjs +0 -92
  339. package/dist/report/host/site-runtime.cjs.map +0 -1
  340. package/dist/report/host/site-runtime.d.cts +0 -9
  341. package/dist/report/host/site-runtime.d.mts +0 -9
  342. package/dist/report/host/site-runtime.d.ts +0 -9
  343. package/dist/report/host/site-runtime.js +0 -10
  344. package/dist/report/host/site-runtime.js.map +0 -1
  345. package/dist/view/client-dist/app.css +0 -2
  346. package/dist/view/client-dist/app.js +0 -49
  347. package/dist/view/data.cjs +0 -3
  348. package/dist/view/data.cjs.map +0 -1
  349. package/dist/view/data.d.cts +0 -9
  350. package/dist/view/data.d.mts +0 -9
  351. package/dist/view/data.d.ts +0 -9
  352. package/dist/view/data.js +0 -4
  353. package/dist/view/data.js.map +0 -1
  354. package/dist/view/index.cjs +0 -24
  355. package/dist/view/index.cjs.map +0 -1
  356. package/dist/view/index.d.cts +0 -9
  357. package/dist/view/index.d.mts +0 -9
  358. package/dist/view/index.d.ts +0 -9
  359. package/dist/view/index.js +0 -28
  360. package/dist/view/index.js.map +0 -1
  361. package/dist/view/report-view-cache.cjs +0 -200
  362. package/dist/view/report-view-cache.cjs.map +0 -1
  363. package/dist/view/report-view-cache.d.cts +0 -67
  364. package/dist/view/report-view-cache.d.mts +0 -67
  365. package/dist/view/report-view-cache.d.ts +0 -67
  366. package/dist/view/report-view-cache.js +0 -8
  367. package/dist/view/report-view-cache.js.map +0 -1
  368. package/dist/view/shared/types.cjs +0 -3
  369. package/dist/view/shared/types.cjs.map +0 -1
  370. package/dist/view/shared/types.d.cts +0 -51
  371. package/dist/view/shared/types.d.mts +0 -51
  372. package/dist/view/shared/types.d.ts +0 -51
  373. package/dist/view/shared/types.js +0 -4
  374. package/dist/view/shared/types.js.map +0 -1
  375. package/dist/view/site.cjs +0 -32
  376. package/dist/view/site.cjs.map +0 -1
  377. package/dist/view/site.d.cts +0 -24
  378. package/dist/view/site.d.mts +0 -24
  379. package/dist/view/site.d.ts +0 -24
  380. package/dist/view/site.js +0 -8
  381. package/dist/view/site.js.map +0 -1
  382. package/dist/view/styles.css +0 -170
  383. package/dist/view/template.html +0 -17
@@ -20,7 +20,6 @@ exports.observedCostUSD = observedCostUSD;
20
20
  exports.usageTableData = usageTableData;
21
21
  exports.attemptDiffData = attemptDiffData;
22
22
  exports.attemptSourceData = attemptSourceData;
23
- exports.stableJson = stableJson;
24
23
  // ───────────────────────── AttemptSummary ─────────────────────────
25
24
  function attemptSummaryData(input) {
26
25
  return {
@@ -73,95 +72,12 @@ function attemptErrorData(input) {
73
72
  ...(hint ? { commandEvidenceHint: true } : {}),
74
73
  };
75
74
  }
76
- function jsonRecordOf(value) {
77
- if (value === undefined || typeof value !== "object" || value === null || Array.isArray(value))
78
- return undefined;
79
- return value;
80
- }
81
- function jsonStringOf(record, key) {
82
- const value = record[key];
83
- return typeof value === "string" ? value : undefined;
84
- }
85
- function jsonNumberOf(record, key) {
86
- const value = record[key];
87
- return typeof value === "number" && Number.isFinite(value) ? value : undefined;
88
- }
89
- function jsonStringArrayOf(record, key) {
90
- const value = record[key];
91
- if (!Array.isArray(value))
92
- return undefined;
93
- const items = [];
94
- for (const item of value) {
95
- if (typeof item !== "string")
96
- return undefined;
97
- items.push(item);
98
- }
99
- return items;
100
- }
101
- /** 整条 sealed assertion entry 的结构读取;读不懂(形状不符)返回 undefined,调用方跳过。 */
75
+ /** Typed Analysis entry → report view. No Record or matcher shape is parsed here. */
102
76
  function assertionEntryViewOf(value) {
103
- const record = jsonRecordOf(value);
104
- if (record === undefined)
105
- return undefined;
106
- const entryId = jsonStringOf(record, "entryId");
107
- const display = jsonRecordOf(record["display"]);
108
- const result = jsonRecordOf(record["result"]);
109
- const coverage = jsonRecordOf(record["coverage"]);
110
- if (entryId === undefined || display === undefined || result === undefined || coverage === undefined)
111
- return undefined;
112
- const state = jsonStringOf(result, "state");
113
- const gate = jsonStringOf(result, "gate");
114
- const score = jsonRecordOf(result["score"]);
115
- if (state === undefined || gate === undefined || score === undefined)
116
- return undefined;
117
- if (state !== "matched" && state !== "mismatched" && state !== "unavailable" && state !== "errored")
118
- return undefined;
119
- if (gate !== "not-gate" && gate !== "satisfied" && gate !== "failed" && gate !== "unavailable")
120
- return undefined;
121
- const scoreState = jsonStringOf(score, "state");
122
- if (scoreState !== "not-scored" && scoreState !== "earned" && scoreState !== "unavailable")
123
- return undefined;
124
- const coverageState = jsonStringOf(coverage, "state");
125
- if (coverageState !== "complete" && coverageState !== "partial" &&
126
- coverageState !== "unavailable" && coverageState !== "not-applicable")
127
- return undefined;
128
- const limitations = [];
129
- const rawLimitations = Array.isArray(record["limitations"]) ? record["limitations"] : [];
130
- for (const item of rawLimitations) {
131
- const kind = jsonStringOf(jsonRecordOf(item) ?? {}, "kind");
132
- if (kind !== undefined)
133
- limitations.push({ kind });
134
- }
135
- const earned = jsonNumberOf(score, "earned");
136
- const points = jsonNumberOf(score, "points");
137
- return {
138
- entryId,
139
- display: {
140
- ...(jsonStringOf(display, "label") === undefined ? {} : { label: jsonStringOf(display, "label") }),
141
- ...(jsonStringOf(display, "key") === undefined ? {} : { key: jsonStringOf(display, "key") }),
142
- groupPath: jsonStringArrayOf(display, "groupPath") ?? [],
143
- },
144
- result: {
145
- state,
146
- ...(jsonStringOf(result, "reason") === undefined ? {} : { reason: jsonStringOf(result, "reason") }),
147
- gate,
148
- score: {
149
- state: scoreState,
150
- ...(earned === undefined ? {} : { earned }),
151
- ...(points === undefined ? {} : { points }),
152
- },
153
- ...(result["diagnostic"] === undefined ? {} : { diagnostic: result["diagnostic"] }),
154
- },
155
- coverage: {
156
- state: coverageState,
157
- ...(jsonStringOf(coverage, "reason") === undefined ? {} : { reason: jsonStringOf(coverage, "reason") }),
158
- },
159
- limitations,
160
- };
77
+ return value;
161
78
  }
162
- /** sealed result → 展示 outcome;errored 归 failed,理由留在 detail。 */
163
79
  function assertionOutcomeOf(entry) {
164
- const state = entry.result.state;
80
+ const state = entry.decision.result;
165
81
  if (state === "matched")
166
82
  return "passed";
167
83
  if (state === "mismatched" || state === "errored")
@@ -169,113 +85,26 @@ function assertionOutcomeOf(entry) {
169
85
  return "unavailable";
170
86
  }
171
87
  function assertionSeverityOf(entry) {
172
- if (entry.result.gate === "failed" || entry.result.gate === "unavailable")
88
+ if (entry.decision.gate === "failed" || entry.decision.gate === "unavailable")
173
89
  return "gate";
174
- return entry.result.score.state === "not-scored" ? "recorded" : "soft";
90
+ return entry.decision.contribution.state === "not-scored" ? "recorded" : "soft";
175
91
  }
176
92
  function scoreOf(entry) {
177
- const score = entry.result.score;
93
+ const score = entry.decision.contribution;
178
94
  if (score.state === "not-scored")
179
95
  return undefined;
180
96
  return {
181
97
  state: score.state,
182
- points: score.points ?? 0,
183
- ...(score.state === "earned" ? { earned: score.earned ?? 0 } : {}),
98
+ points: score.points,
99
+ ...(score.state === "earned" ? { earned: score.earned } : {}),
184
100
  };
185
101
  }
186
- function diagnosticLocatorText(record) {
187
- const locator = jsonRecordOf(record["locator"]);
188
- if (locator === undefined)
189
- return undefined;
190
- const kind = jsonStringOf(locator, "kind");
191
- if (kind === "json-pointer") {
192
- const pointer = jsonStringOf(locator, "pointer");
193
- return pointer === undefined ? undefined : `location: ${pointer}`;
194
- }
195
- if (kind === "tool-occurrence") {
196
- const id = jsonStringOf(locator, "id");
197
- return id === undefined ? undefined : `location: tool occurrence ${id}`;
198
- }
199
- return undefined;
200
- }
201
- function childDiagnostics(record) {
202
- const children = record["children"];
203
- if (!Array.isArray(children))
204
- return [];
205
- return children.flatMap((child) => {
206
- const childRecord = jsonRecordOf(child);
207
- const diagnostic = childRecord === undefined ? undefined : jsonRecordOf(childRecord["diagnostic"]);
208
- return diagnostic === undefined ? [] : [diagnostic];
209
- });
210
- }
211
- function pathWitnessOf(record) {
212
- for (const child of childDiagnostics(record)) {
213
- if (jsonStringOf(child, "code") === "path-reference-match")
214
- return child;
215
- const nested = pathWitnessOf(child);
216
- if (nested !== undefined)
217
- return nested;
218
- }
219
- return undefined;
220
- }
221
- function diagnosticWasTruncated(record) {
222
- if (jsonStringOf(record, "code") === "diagnostic-truncated" || record["truncation"] !== undefined)
223
- return true;
224
- return childDiagnostics(record).some(diagnosticWasTruncated);
225
- }
226
- function diagnosticSummary(value) {
227
- const record = jsonRecordOf(value);
228
- if (record === undefined)
229
- return stableJson(value);
230
- const message = jsonStringOf(record, "message");
231
- if (message === undefined)
232
- return stableJson(value);
233
- const parts = [message];
234
- const expected = jsonStringOf(record, "expected");
235
- const received = jsonStringOf(record, "received");
236
- const reason = jsonStringOf(record, "reason");
237
- if (expected !== undefined)
238
- parts.push(`expected: ${expected}`);
239
- if (received !== undefined)
240
- parts.push(`received: ${received}`);
241
- if (reason !== undefined)
242
- parts.push(`diagnostic reason: ${reason}`);
243
- const locator = diagnosticLocatorText(record);
244
- if (locator !== undefined)
245
- parts.push(locator);
246
- const witness = pathWitnessOf(record);
247
- if (witness !== undefined) {
248
- const witnessMessage = jsonStringOf(witness, "message");
249
- const witnessExpected = jsonStringOf(witness, "expected");
250
- const witnessLocator = diagnosticLocatorText(witness);
251
- if (witnessMessage !== undefined)
252
- parts.push(witnessMessage);
253
- if (witnessExpected !== undefined)
254
- parts.push(`expected: ${witnessExpected}`);
255
- if (witnessLocator !== undefined)
256
- parts.push(witnessLocator);
257
- }
258
- if (diagnosticWasTruncated(record))
259
- parts.push("diagnostic details truncated");
260
- return parts.join(" · ");
261
- }
262
- /** 展示层预拼的判定详情;字段全闭合,不把 matcher diagnostic tree 当作文案。 */
263
102
  function assertionDetailOf(entry) {
264
103
  const parts = [];
265
- if (entry.result.state === "mismatched")
266
- parts.push(`reason: ${entry.result.reason}`);
267
- if (entry.result.state === "unavailable")
268
- parts.push(`reason: ${entry.result.reason}`);
269
- if (entry.result.state === "errored")
270
- parts.push(`reason: ${entry.result.reason}`);
271
- if (entry.coverage.state !== "complete") {
272
- parts.push(`coverage: ${entry.coverage.state}${entry.coverage.reason === undefined ? "" : ` (${entry.coverage.reason})`}`);
273
- }
274
- for (const limitation of entry.limitations) {
275
- parts.push(`limitations: ${limitation.kind}`);
276
- }
277
- if (entry.result.diagnostic !== undefined) {
278
- parts.push(`diagnostic: ${diagnosticSummary(entry.result.diagnostic)}`);
104
+ if (entry.decision.reason !== null)
105
+ parts.push(`reason: ${entry.decision.reason}`);
106
+ if (entry.source.coverage.state !== "complete") {
107
+ parts.push(`coverage: ${entry.source.coverage.state} (${entry.source.coverage.reason})`);
279
108
  }
280
109
  return parts.join(" · ");
281
110
  }
@@ -287,6 +116,88 @@ function assertionNameOf(entry) {
287
116
  return display.key;
288
117
  return entry.entryId;
289
118
  }
119
+ function factValue(value) {
120
+ return { kind: "value", value };
121
+ }
122
+ function limitationFact(limitation) {
123
+ switch (limitation.kind) {
124
+ case "redacted":
125
+ return { kind: "fields", fields: [
126
+ { label: "kind", value: factValue(limitation.kind) },
127
+ { label: "fieldCount", value: factValue(limitation.fieldCount) },
128
+ ] };
129
+ case "sampled":
130
+ return { kind: "fields", fields: [
131
+ { label: "kind", value: factValue(limitation.kind) },
132
+ { label: "captured", value: factValue(limitation.captured) },
133
+ ...(limitation.knownTotal === undefined
134
+ ? []
135
+ : [{ label: "knownTotal", value: factValue(limitation.knownTotal) }]),
136
+ ] };
137
+ case "truncated":
138
+ return { kind: "fields", fields: [
139
+ { label: "kind", value: factValue(limitation.kind) },
140
+ { label: "omittedBytes", value: factValue(limitation.omittedBytes) },
141
+ ] };
142
+ case "provider-limited":
143
+ return { kind: "fields", fields: [
144
+ { label: "kind", value: factValue(limitation.kind) },
145
+ ] };
146
+ }
147
+ }
148
+ function assertionEvidenceOf(entry) {
149
+ const coverageFields = [
150
+ { label: "state", value: factValue(entry.source.coverage.state) },
151
+ ];
152
+ if ("reason" in entry.source.coverage) {
153
+ coverageFields.push({ label: "reason", value: factValue(entry.source.coverage.reason) });
154
+ }
155
+ const source = {
156
+ kind: "fields",
157
+ fields: [
158
+ ...entry.source.fields,
159
+ { label: "coverage", value: { kind: "fields", fields: coverageFields } },
160
+ ...(entry.source.limitations.length === 0
161
+ ? []
162
+ : [{
163
+ label: "limitations",
164
+ value: { kind: "list", items: entry.source.limitations.map(limitationFact) },
165
+ }]),
166
+ ],
167
+ };
168
+ const receipt = entry.observed.receipt;
169
+ const observed = receipt === undefined
170
+ ? entry.observed
171
+ : {
172
+ kind: "fields",
173
+ fields: [
174
+ ...entry.observed.fields,
175
+ {
176
+ label: "receipt",
177
+ value: {
178
+ kind: "fields",
179
+ fields: [
180
+ { label: "examined", value: factValue(receipt.examined) },
181
+ { label: "matched", value: factValue(receipt.matched) },
182
+ { label: "mismatched", value: factValue(receipt.mismatched) },
183
+ { label: "unavailable", value: factValue(receipt.unavailable) },
184
+ { label: "knownTotal", value: factValue(receipt.knownTotal) },
185
+ { label: "complete", value: factValue(receipt.complete) },
186
+ { label: "exhaustive", value: factValue(receipt.exhaustive) },
187
+ { label: "decisive", value: factValue(receipt.decisive) },
188
+ ],
189
+ },
190
+ },
191
+ ],
192
+ };
193
+ return {
194
+ source,
195
+ check: entry.check,
196
+ observed: { kind: "fields", fields: observed.kind === "fields" ? observed.fields : [] },
197
+ expected: entry.expected,
198
+ explanation: entry.explanation,
199
+ };
200
+ }
290
201
  function assertionViewOf(entry) {
291
202
  const score = scoreOf(entry);
292
203
  return {
@@ -296,6 +207,7 @@ function assertionViewOf(entry) {
296
207
  outcome: assertionOutcomeOf(entry),
297
208
  groupPath: entry.display.groupPath,
298
209
  detail: assertionDetailOf(entry),
210
+ evidence: assertionEvidenceOf(entry),
299
211
  ...(score === undefined ? {} : { score }),
300
212
  };
301
213
  }
@@ -327,9 +239,7 @@ function scorePointsEarnedOf(assertions) {
327
239
  function attemptAssertionsData(detail) {
328
240
  if (detail === undefined)
329
241
  return null;
330
- const entries = detail.entries
331
- .map(assertionEntryViewOf)
332
- .filter((entry) => entry !== undefined);
242
+ const entries = detail.entries.map(assertionEntryViewOf);
333
243
  if (entries.length === 0)
334
244
  return null;
335
245
  const assertions = entries.map(assertionViewOf);
@@ -744,37 +654,16 @@ function attemptDiffData(detail, locator) {
744
654
  return { locator, collection: detail.collection, files };
745
655
  }
746
656
  // ───────────────────────── AttemptSource ─────────────────────────
747
- /** sourceSites 在 DomainView 边界是 JsonValue;这里做最小结构读取,读不到即跳过。 */
748
657
  function siteViewOf(value) {
749
- if (typeof value !== "object" || value === null || Array.isArray(value))
750
- return undefined;
751
- const record = value;
752
- const entryId = record["entryId"];
753
- const role = record["role"];
754
- const sourceOrder = record["sourceOrder"];
755
- const sourceItemId = record["sourceItemId"];
756
- const sha256 = record["sha256"];
757
- const start = record["start"];
758
- const end = record["end"];
759
- if (typeof entryId !== "string" ||
760
- typeof sourceOrder !== "number" ||
761
- !Number.isSafeInteger(sourceOrder) ||
762
- sourceOrder < 1 ||
763
- typeof role !== "string" ||
764
- typeof sourceItemId !== "string" ||
765
- typeof sha256 !== "string")
766
- return undefined;
767
- if (typeof start !== "object" || start === null || Array.isArray(start))
768
- return undefined;
769
- if (typeof end !== "object" || end === null || Array.isArray(end))
770
- return undefined;
771
- const startLine = start["line"];
772
- const endLine = end["line"];
773
- if (typeof startLine !== "number" || typeof endLine !== "number")
774
- return undefined;
775
- if (startLine < 1 || endLine < startLine)
776
- return undefined;
777
- return { entryId, sourceOrder, role, sourceItemId, sha256, startLine, endLine };
658
+ return {
659
+ entryId: value.entryId,
660
+ sourceOrder: value.sourceOrder,
661
+ role: value.role,
662
+ sourceItemId: value.sourceItemId,
663
+ sha256: value.sha256,
664
+ startLine: value.start.line,
665
+ endLine: value.end.line,
666
+ };
778
667
  }
779
668
  function attemptSourceData(input) {
780
669
  const { locator, items, sourceSites, entries, navigation } = input;
@@ -783,7 +672,7 @@ function attemptSourceData(input) {
783
672
  const knownEntryIds = new Set(entries.map((entry) => entry.entryId));
784
673
  const sites = sourceSites
785
674
  .map(siteViewOf)
786
- .filter((site) => site !== undefined && knownEntryIds.has(site.entryId));
675
+ .filter((site) => knownEntryIds.has(site.entryId));
787
676
  const firstOrderByItem = new Map();
788
677
  for (const site of sites) {
789
678
  const key = `${site.sourceItemId}:${site.sha256}`;
@@ -821,20 +710,6 @@ function attemptSourceData(input) {
821
710
  ...(navigation === undefined ? {} : { navigation }),
822
711
  };
823
712
  }
824
- // ───────────────────────── helpers ─────────────────────────
825
- function stableJson(value) {
826
- if (value === null || typeof value === "string" || typeof value === "boolean") {
827
- return typeof value === "string" ? value : String(value);
828
- }
829
- if (typeof value === "number")
830
- return String(value);
831
- if (Array.isArray(value))
832
- return JSON.stringify(value);
833
- const keys = Object.keys(value).sort(compareText);
834
- if (keys.length === 0)
835
- return "{}";
836
- return `{${keys.map((key) => `${JSON.stringify(key)}:${stableJson(value[key])}`).join(",")}}`;
837
- }
838
713
  function compareText(left, right) {
839
714
  return left < right ? -1 : left > right ? 1 : 0;
840
715
  }