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
@@ -2,7 +2,7 @@
2
2
  const { pathToFileURL: __niceevalPathToFileURL } = require("node:url");
3
3
  const __niceevalImportMetaUrl = __niceevalPathToFileURL(__filename).href;
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.REPORT_STATIC_RENDERER = exports.REPORT_THEME_STYLESHEET_PATH = exports.ReportFileSystem = void 0;
5
+ exports.REPORT_APP_RENDERER = exports.REPORT_THEME_STYLESHEET_PATH = exports.ReportFileSystem = void 0;
6
6
  exports.buildSiteRevision = buildSiteRevision;
7
7
  exports.signClosedSiteRevision = signClosedSiteRevision;
8
8
  exports.closeStaticThemeStylesheet = closeStaticThemeStylesheet;
@@ -16,260 +16,33 @@ const paths_ts_1 = require("../execution/paths.cjs");
16
16
  const locale_ts_1 = require("../model/locale.cjs");
17
17
  const theme_ts_1 = require("../theme.cjs");
18
18
  const site_assets_ts_1 = require("./site-assets.cjs");
19
- const site_runtime_ts_1 = require("./site-runtime.cjs");
20
19
  class ReportFileSystem extends effect_1.Context.Tag("@niceeval/report/ReportFileSystem")() {
21
20
  }
22
21
  exports.ReportFileSystem = ReportFileSystem;
23
22
  /** The one Host-owned static resource path for a closed Theme stylesheet. */
24
23
  exports.REPORT_THEME_STYLESHEET_PATH = "_niceeval/theme.css";
25
24
  /** The Host-owned renderer identity carried by every static revision. */
26
- exports.REPORT_STATIC_RENDERER = "niceeval.report-ssg/v1";
25
+ exports.REPORT_APP_RENDERER = "niceeval.report-spa/v1";
27
26
  const MANIFEST_PATH = "_niceeval/manifest.json";
28
27
  const PROBLEMS_PATH = "_niceeval/problems.json";
29
28
  const PROJECTIONS_PATH = "_niceeval/data/projections.json";
29
+ const REPORT_APP_PATH = "_niceeval/app.js";
30
+ const REPORT_FRAGMENT_ROOT = "_niceeval/fragments";
30
31
  const COMPLETE_PATH = "_niceeval/complete";
31
- const NICEEVAL_BRAND_HREF = "https://niceeval.com/?utm_source=report&utm_medium=brand";
32
32
  const encoder = new TextEncoder();
33
33
  const decoder = new TextDecoder();
34
34
  const PRODUCT_STYLESHEET = (0, node_fs_1.readFileSync)(new URL("../assets/styles.css", __niceevalImportMetaUrl), "utf8");
35
- const PRODUCT_ENHANCER = (0, node_fs_1.readFileSync)(new URL("../assets/enhance.js", __niceevalImportMetaUrl), "utf8");
36
- /**
37
- * Host-owned parameterized-Page dialog for the shared view/static runtime.
38
- * A click on a same-site `<pageId>/<key>/index.html` href writes the legacy
39
- * hash deep link and opens a native `<dialog>` filled with that standalone
40
- * detail document's own slot bytes. No-JS and direct hrefs keep reading the
41
- * same document. The route list comes from the revision's closed pages, not
42
- * from any author declaration. The report content inside the dialog is styled
43
- * by the existing product stylesheet; only the dialog chrome is styled here.
44
- */
45
- const PARAM_PAGE_DIALOG_RUNTIME = `(() => {
46
- "use strict";
47
- if (typeof window === "undefined" || typeof HTMLDialogElement !== "function") return;
48
- if (location.protocol !== "http:" && location.protocol !== "https:") return;
49
- const routes = (document.documentElement.getAttribute("data-niceeval-param-routes") || "")
50
- .split(" ")
51
- .filter((value) => value.length > 0);
52
- if (routes.length === 0) return;
53
- const siteRoot = document.documentElement.getAttribute("data-niceeval-site-root") || "index.html";
54
-
55
- function closest(target, selector) {
56
- return target && target.closest ? target.closest(selector) : null;
57
- }
58
-
59
- function escapeRegExp(value) {
60
- const special = ".+*?^$()[]{}|";
61
- let escaped = "";
62
- for (const character of value) {
63
- if (special.includes(character) || character.charCodeAt(0) === 92) {
64
- escaped += String.fromCharCode(92);
65
- }
66
- escaped += character;
67
- }
68
- return escaped;
69
- }
70
-
71
- function matchTarget(url) {
72
- if (url.origin !== location.origin) return null;
73
- for (const prefix of routes) {
74
- const root = new URL(siteRoot, document.baseURI);
75
- const pattern = new RegExp("^" + escapeRegExp(new URL(prefix + "/", root).pathname) + "([^/]+)/index\\\\.html$");
76
- const match = pattern.exec(url.pathname);
77
- if (!match) continue;
78
- let key;
79
- try {
80
- key = decodeURIComponent(match[1]);
81
- } catch {
82
- return null;
83
- }
84
- if (!key || key.includes("/")) return null;
85
- return { prefix, key, url };
86
- }
87
- return null;
88
- }
89
-
90
- function targetFromHash() {
91
- const match = location.hash.startsWith("#/") ? location.hash.slice(2).split("/") : [];
92
- if (match.length !== 2 || !routes.includes(match[0]) || !match[1]) return null;
93
- const root = new URL(siteRoot, document.baseURI);
94
- return {
95
- prefix: match[0],
96
- key: match[1],
97
- url: new URL(match[0] + "/" + encodeURIComponent(match[1]) + "/index.html", root),
98
- };
99
- }
100
-
101
- function hashForTarget(target) {
102
- return "#/" + target.prefix + "/" + target.key;
103
- }
104
-
105
- function currentLocale() {
106
- return document.documentElement.lang === "zh-CN" ? "zh-CN" : "en";
107
- }
108
-
109
- function rebaseSlotUrls(slot, responseUrl) {
110
- for (const element of slot.querySelectorAll("[href], [src]")) {
111
- for (const attribute of ["href", "src"]) {
112
- const value = element.getAttribute(attribute);
113
- if (value === null) continue;
114
- // Fragment and non-document schemes retain their literal browser
115
- // meaning. Every other relative reference must keep the fetched
116
- // detail document as its base after this slot moves into the root
117
- // page's dialog.
118
- if (value.startsWith("#") || /^(?:data:|mailto:|tel:)/i.test(value)) continue;
119
- try {
120
- element.setAttribute(attribute, new URL(value, responseUrl).href);
121
- } catch {
122
- // Leave malformed author data untouched; the standalone document
123
- // would have the same browser-level handling.
124
- }
125
- }
126
- }
127
- }
128
-
129
- function extractDocument(html, locale, responseUrl) {
130
- const parsed = new DOMParser().parseFromString(html, "text/html");
131
- const slot = parsed.querySelector('.niceeval-view-report-slot[data-niceeval-locale="' + locale + '"]');
132
- if (!slot) return null;
133
- rebaseSlotUrls(slot, responseUrl);
134
- return { title: parsed.title, content: slot.innerHTML };
135
- }
136
-
137
- let dialog = null;
138
- let ownsHistory = false;
139
- let requestRevision = 0;
140
- let requestedTarget = null;
141
-
142
- function ensureDialog() {
143
- if (dialog !== null) return;
144
- dialog = document.createElement("dialog");
145
- dialog.className = "niceeval-view-dialog";
146
- const head = document.createElement("div");
147
- head.className = "niceeval-view-dialog-head";
148
- const title = document.createElement("span");
149
- title.className = "niceeval-view-dialog-title";
150
- title.id = "niceeval-view-dialog-title";
151
- const close = document.createElement("button");
152
- close.type = "button";
153
- close.className = "niceeval-view-dialog-close";
154
- close.setAttribute("aria-label", "Close");
155
- // Keep the static host visually identical to the legacy React/Radix
156
- // dialog. The old DialogClose renders a literal x, rather than the
157
- // typographic multiplication sign.
158
- close.textContent = "x";
159
- close.addEventListener("click", closeFromUi);
160
- head.appendChild(title);
161
- head.appendChild(close);
162
- const body = document.createElement("div");
163
- body.className = "niceeval-view-dialog-body niceeval-view-report-slot";
164
- dialog.appendChild(head);
165
- dialog.appendChild(body);
166
- dialog.setAttribute("aria-labelledby", title.id);
167
- dialog.addEventListener("click", (event) => {
168
- if (event.target === dialog) closeFromUi();
169
- });
170
- dialog.addEventListener("cancel", (event) => {
171
- event.preventDefault();
172
- closeFromUi();
173
- });
174
- document.body.appendChild(dialog);
175
- }
176
-
177
- function closeFromUi() {
178
- if (dialog === null || !dialog.open) return;
179
- requestedTarget = null;
180
- requestRevision++;
181
- if (!ownsHistory) {
182
- dialog.close();
183
- history.replaceState(null, "", location.pathname + location.search);
184
- return;
185
- }
186
- ownsHistory = false;
187
- history.back();
188
- }
189
-
190
- function openTarget(target, nextOwnsHistory) {
191
- ensureDialog();
192
- requestedTarget = target;
193
- const revision = ++requestRevision;
194
- fetch(target.url.href, { credentials: "same-origin" })
195
- .then((response) => {
196
- if (!response.ok) throw new Error("http " + response.status);
197
- return response.text().then((html) => ({ html, responseUrl: response.url || target.url.href }));
198
- })
199
- .then(({ html, responseUrl }) => {
200
- if (revision !== requestRevision || requestedTarget !== target) return;
201
- const extracted = extractDocument(html, currentLocale(), responseUrl);
202
- if (extracted === null) {
203
- location.href = target.url.href;
204
- return;
205
- }
206
- dialog.querySelector(".niceeval-view-dialog-title").textContent = extracted.title;
207
- dialog.querySelector(".niceeval-view-dialog-close").setAttribute(
208
- "aria-label",
209
- currentLocale() === "zh-CN" ? "关闭" : "Close",
210
- );
211
- dialog.querySelector(".niceeval-view-dialog-body").innerHTML = extracted.content;
212
- if (!dialog.open) dialog.showModal();
213
- ownsHistory = nextOwnsHistory;
214
- })
215
- .catch(() => {
216
- if (revision === requestRevision && requestedTarget === target) location.href = target.url.href;
217
- });
218
- }
219
-
220
- function onHashChange() {
221
- const target = targetFromHash();
222
- if (target !== null) {
223
- openTarget(target, true);
224
- return;
225
- }
226
- requestedTarget = null;
227
- requestRevision++;
228
- ownsHistory = false;
229
- if (dialog !== null && dialog.open) dialog.close();
230
- }
231
-
232
- const initialTarget = targetFromHash();
233
- if (initialTarget !== null) openTarget(initialTarget, false);
234
- window.addEventListener("hashchange", onHashChange);
235
- window.addEventListener("popstate", () => {
236
- if (location.hash) return;
237
- onHashChange();
238
- });
239
-
240
- document.addEventListener("click", (event) => {
241
- if (event.defaultPrevented || event.button !== 0) return;
242
- if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
243
- const anchor = closest(event.target, "a[href]");
244
- if (!anchor) return;
245
- const anchorTarget = anchor.getAttribute("target");
246
- if (anchorTarget !== null && anchorTarget !== "_self") return;
247
- if (anchor.hasAttribute("download")) return;
248
- let url;
249
- try {
250
- url = new URL(anchor.getAttribute("href"), document.baseURI);
251
- } catch {
252
- return;
253
- }
254
- const target = matchTarget(url);
255
- if (target === null) return;
256
- event.preventDefault();
257
- location.hash = hashForTarget(target);
258
- });
259
- })();`;
35
+ const PRODUCT_APP = (0, node_fs_1.readFileSync)(new URL("../client-dist/app.js", __niceevalImportMetaUrl), "utf8");
260
36
  /** Forms one byte-complete revision; neither view nor static renders afterward. */
261
37
  function buildSiteRevision(input) {
262
38
  return effect_1.Effect.try({
263
39
  try: () => {
264
40
  const files = buildSiteFiles(input.site, input.theme ?? input.site.theme ?? theme_ts_1.basalt);
265
41
  assertFinalBuildBudgets(input.site.startedAtMs, input.site.baselineRssBytes);
266
- const defaultRoute = defaultRouteForSite(input.site);
267
42
  return signClosedSiteRevision({
268
43
  sampleIdentity: input.site.sampleIdentity,
269
44
  reportIdentity: input.site.reportIdentity,
270
45
  files,
271
- routes: input.site.pages.map(({ page }) => page.target.route),
272
- ...(defaultRoute === undefined ? {} : { defaultRoute }),
273
46
  });
274
47
  },
275
48
  catch: (cause) => isBudgetError(cause)
@@ -290,12 +63,9 @@ function signClosedSiteRevision(input) {
290
63
  sampleIdentity: input.sampleIdentity,
291
64
  reportIdentity: input.reportIdentity,
292
65
  files,
293
- ...(input.defaultRoute === undefined ? {} : { defaultRoute: input.defaultRoute }),
294
66
  problems,
295
67
  }),
296
68
  files,
297
- routes: input.routes,
298
- ...(input.defaultRoute === undefined ? {} : { defaultRoute: input.defaultRoute }),
299
69
  problems,
300
70
  });
301
71
  }
@@ -306,14 +76,14 @@ function signClosedSiteRevision(input) {
306
76
  function closeStaticThemeStylesheet(theme) {
307
77
  return encoder.encode(`${(0, theme_ts_1.themeStylesheet)(theme)}\n${inlineThemeStyles(theme)}\n`);
308
78
  }
309
- function assertFinalBuildBudgets(startedAtMs, baselineRssBytes) {
79
+ function assertFinalBuildBudgets(startedAtMs, baselineRssBytes, target) {
310
80
  const elapsed = Date.now() - startedAtMs;
311
81
  if (elapsed > model_ts_1.REPORT_BUILD_TIME_MS_MAX) {
312
82
  throw (0, model_ts_1.reportBuildBudgetExceeded)("build-time", model_ts_1.REPORT_BUILD_TIME_MS_MAX, elapsed);
313
83
  }
314
84
  const rssGrowth = Math.max(0, process.memoryUsage().rss - baselineRssBytes);
315
85
  if (rssGrowth > model_ts_1.REPORT_BUILD_RSS_BYTES_MAX) {
316
- throw (0, model_ts_1.reportBuildBudgetExceeded)("build-rss", model_ts_1.REPORT_BUILD_RSS_BYTES_MAX, rssGrowth);
86
+ throw (0, model_ts_1.reportBuildBudgetExceeded)("build-rss", model_ts_1.REPORT_BUILD_RSS_BYTES_MAX, rssGrowth, target);
317
87
  }
318
88
  }
319
89
  /** Writes only the immutable revision mapping, then publishes its marker last. */
@@ -353,33 +123,40 @@ function buildSiteFiles(site, theme) {
353
123
  };
354
124
  const stylesheet = textFile(site_assets_ts_1.REPORT_STYLESHEET_PATH, PRODUCT_STYLESHEET, "text/css; charset=utf-8");
355
125
  const themeFile = binaryFile(exports.REPORT_THEME_STYLESHEET_PATH, "text/css; charset=utf-8", closeStaticThemeStylesheet(theme));
356
- const runtime = textFile(site_assets_ts_1.REPORT_REFRESH_RUNTIME_PATH, `${(0, site_runtime_ts_1.reportSiteRuntime)(PRODUCT_ENHANCER).trimEnd()}\n${PARAM_PAGE_DIALOG_RUNTIME}\n`, "text/javascript; charset=utf-8");
126
+ const app = textFile(REPORT_APP_PATH, PRODUCT_APP, "text/javascript; charset=utf-8");
357
127
  add(stylesheet, (0, paths_ts_1.hostStaticPath)(stylesheet.path));
358
128
  add(themeFile, (0, paths_ts_1.hostStaticPath)(themeFile.path));
359
- add(runtime, (0, paths_ts_1.hostStaticPath)(runtime.path));
129
+ add(app, (0, paths_ts_1.hostStaticPath)(app.path));
360
130
  const pages = [...site.pages].sort(compareSitePages);
361
- const paramRoutes = parameterizedRoutePrefixes(site);
362
- let siteHtmlBytes = 0;
131
+ let shellFragmentBytes = 0;
132
+ const fragmentFiles = new Map();
363
133
  for (const entry of pages) {
364
- assertFinalBuildBudgets(site.startedAtMs, site.baselineRssBytes);
134
+ assertFinalBuildBudgets(site.startedAtMs, site.baselineRssBytes, entry.page.target);
365
135
  const routeIssue = (0, paths_ts_1.validateReportRoute)(entry.page.target.route);
366
136
  if (routeIssue !== undefined || entry.page.target.route === "/_niceeval" ||
367
137
  entry.page.target.route.startsWith("/_niceeval/")) {
368
138
  throw siteFailure("path", routeIssue?.reason ?? "author routes cannot occupy /_niceeval");
369
139
  }
370
- const output = (0, paths_ts_1.staticPathForRoute)(entry.page.target.route);
371
- const pageFile = textFile(output.posix, renderPage(site, entry, paramRoutes), "text/html; charset=utf-8");
372
- if (pageFile.bytes.byteLength > model_ts_1.REPORT_PAGE_HTML_BYTES_MAX) {
373
- throw (0, model_ts_1.reportBuildBudgetExceeded)("page-html-bytes", model_ts_1.REPORT_PAGE_HTML_BYTES_MAX, pageFile.bytes.byteLength, { pageId: entry.page.target.pageId, route: entry.page.target.route });
140
+ const fragmentPath = fragmentPathForRoute(entry.page.target.route);
141
+ const fragment = textFile(fragmentPath, renderFragment(site, entry), "application/json; charset=utf-8");
142
+ if (fragment.bytes.byteLength > model_ts_1.REPORT_FRAGMENT_BYTES_MAX) {
143
+ throw (0, model_ts_1.reportBuildBudgetExceeded)("fragment-bytes", model_ts_1.REPORT_FRAGMENT_BYTES_MAX, fragment.bytes.byteLength, { pageId: entry.page.target.pageId, route: entry.page.target.route });
374
144
  }
375
- siteHtmlBytes += pageFile.bytes.byteLength;
376
- if (siteHtmlBytes > model_ts_1.REPORT_SITE_HTML_BYTES_MAX) {
377
- throw (0, model_ts_1.reportBuildBudgetExceeded)("site-html-bytes", model_ts_1.REPORT_SITE_HTML_BYTES_MAX, siteHtmlBytes);
145
+ shellFragmentBytes += fragment.bytes.byteLength;
146
+ if (shellFragmentBytes > model_ts_1.REPORT_SHELL_FRAGMENT_BYTES_MAX) {
147
+ throw (0, model_ts_1.reportBuildBudgetExceeded)("shell-fragment-bytes", model_ts_1.REPORT_SHELL_FRAGMENT_BYTES_MAX, shellFragmentBytes);
378
148
  }
379
- add(pageFile, output);
149
+ add(fragment, (0, paths_ts_1.hostStaticPath)(fragment.path));
150
+ fragmentFiles.set(entry.page.target.route, fragment.path);
380
151
  for (const asset of entry.page.assets)
381
152
  addPageAsset(add, asset);
382
153
  }
154
+ const shell = textFile("index.html", renderShell(site, pages), "text/html; charset=utf-8");
155
+ shellFragmentBytes += shell.bytes.byteLength;
156
+ if (shellFragmentBytes > model_ts_1.REPORT_SHELL_FRAGMENT_BYTES_MAX) {
157
+ throw (0, model_ts_1.reportBuildBudgetExceeded)("shell-fragment-bytes", model_ts_1.REPORT_SHELL_FRAGMENT_BYTES_MAX, shellFragmentBytes);
158
+ }
159
+ add(shell, (0, paths_ts_1.hostStaticPath)("index.html"));
383
160
  const downloads = collectDownloads(site.pages);
384
161
  if (downloads.length > model_ts_1.REPORT_DOWNLOAD_FILES_MAX) {
385
162
  throw (0, model_ts_1.reportBuildBudgetExceeded)("download-files", model_ts_1.REPORT_DOWNLOAD_FILES_MAX, downloads.length);
@@ -402,20 +179,31 @@ function buildSiteFiles(site, theme) {
402
179
  const projections = textFile(PROJECTIONS_PATH, `${canonicalJson(site.projections)}\n`, "application/json; charset=utf-8");
403
180
  add(projections, (0, paths_ts_1.hostStaticPath)(projections.path));
404
181
  assertAssetBudgets(files, site.pages);
182
+ const landing = landingPage(pages);
405
183
  const manifestValue = Object.freeze({
406
- format: "niceeval.report-static/v1",
184
+ format: "niceeval.report-static/v2",
407
185
  sampleIdentity: site.sampleIdentity,
408
186
  reportIdentity: site.reportIdentity,
187
+ title: {
188
+ en: (0, locale_ts_1.resolveLocalizedText)(site.title, "en"),
189
+ "zh-CN": (0, locale_ts_1.resolveLocalizedText)(site.title, "zh-CN"),
190
+ },
191
+ defaultRoute: landing.page.target.route,
409
192
  pages: pages.map((entry) => Object.freeze({
410
193
  pageId: entry.page.target.pageId,
411
194
  route: entry.page.target.route,
412
- path: (0, paths_ts_1.staticPathForRoute)(entry.page.target.route).posix,
195
+ fragment: fragmentFiles.get(entry.page.target.route),
196
+ title: {
197
+ en: (0, locale_ts_1.resolveLocalizedText)(entry.page.title, "en"),
198
+ "zh-CN": (0, locale_ts_1.resolveLocalizedText)(entry.page.title, "zh-CN"),
199
+ },
413
200
  navigation: entry.navigation,
201
+ presentation: entry.presentation,
414
202
  })),
415
203
  files: [...files.keys(), MANIFEST_PATH, COMPLETE_PATH].sort(model_ts_1.compareUtf8),
416
204
  stylesheet: site_assets_ts_1.REPORT_STYLESHEET_PATH,
417
205
  theme: exports.REPORT_THEME_STYLESHEET_PATH,
418
- runtime: site_assets_ts_1.REPORT_REFRESH_RUNTIME_PATH,
206
+ app: REPORT_APP_PATH,
419
207
  problems: PROBLEMS_PATH,
420
208
  projections: PROJECTIONS_PATH,
421
209
  });
@@ -429,92 +217,38 @@ function buildSiteFiles(site, theme) {
429
217
  }
430
218
  return Object.freeze([...files.values()].sort((left, right) => (0, model_ts_1.compareUtf8)(left.path, right.path)));
431
219
  }
432
- /**
433
- * The closed parameterized Page route prefixes of this site (the instance
434
- * route minus its final key segment, without the leading slash). The shared
435
- * dialog runtime uses them to recognize same-site detail hrefs.
436
- */
437
- function parameterizedRoutePrefixes(site) {
438
- const prefixes = new Set();
439
- for (const entry of site.pages) {
440
- if (entry.role?.kind === "experiment-group")
441
- continue;
442
- if (entry.page.target.params === undefined)
443
- continue;
444
- const route = entry.page.target.route;
445
- const cut = route.lastIndexOf("/");
446
- prefixes.add(route.slice(1, cut));
447
- }
448
- return Object.freeze([...prefixes].sort(model_ts_1.compareUtf8));
220
+ function fragmentPathForRoute(route) {
221
+ return route === "/" ? `${REPORT_FRAGMENT_ROOT}/root.json` : `${REPORT_FRAGMENT_ROOT}${route}.json`;
449
222
  }
450
- function renderPage(site, entry, paramRoutes) {
223
+ function renderFragment(site, entry) {
451
224
  const page = entry.page;
452
- const output = (0, paths_ts_1.staticPathForRoute)(page.target.route).posix;
453
- const stylesheetHref = relativeHref(output, site_assets_ts_1.REPORT_STYLESHEET_PATH);
454
- const themeHref = relativeHref(output, exports.REPORT_THEME_STYLESHEET_PATH);
455
- const runtimeHref = relativeHref(output, site_assets_ts_1.REPORT_REFRESH_RUNTIME_PATH);
456
- const titleEn = (0, locale_ts_1.resolveLocalizedText)(page.title, "en");
457
- const titleZh = (0, locale_ts_1.resolveLocalizedText)(page.title, "zh-CN");
458
- const authorHead = renderHead(page, output);
459
- const rendererAssets = page.assets.map((asset) => asset.kind === "style"
460
- ? `<link rel="stylesheet" href="${escapeAttribute(relativeHref(output, asset.path))}">`
225
+ const pageProblems = site.problems.filter((problem) => problem.path.length === 0 || (problem.path[0] === "page" && problem.path[1] === page.target.pageId));
226
+ return `${canonicalJson({
227
+ title: {
228
+ en: (0, locale_ts_1.resolveLocalizedText)(page.title, "en"),
229
+ "zh-CN": (0, locale_ts_1.resolveLocalizedText)(page.title, "zh-CN"),
230
+ },
231
+ html: {
232
+ en: `${projection(page, "en")}${renderProblems(pageProblems, "en")}`,
233
+ "zh-CN": `${projection(page, "zh-CN")}${renderProblems(pageProblems, "zh-CN")}`,
234
+ },
235
+ })}\n`;
236
+ }
237
+ function renderShell(site, pages) {
238
+ const first = pages[0];
239
+ const rendererAssets = [...new Map(pages.flatMap((entry) => entry.page.assets).map((asset) => [asset.path, asset])).values()]
240
+ .map((asset) => asset.kind === "style"
241
+ ? `<link rel="stylesheet" href="${escapeAttribute(asset.path)}">`
461
242
  : asset.kind === "script"
462
- ? `<script src="${escapeAttribute(relativeHref(output, asset.path))}" defer></script>`
243
+ ? `<script src="${escapeAttribute(asset.path)}" defer></script>`
463
244
  : "").join("");
464
- const bodyEn = projection(page, "en");
465
- const bodyZh = projection(page, "zh-CN");
466
- const navigationEn = renderNavigation(site.pages, page.target.route, output, "en");
467
- const navigationZh = renderNavigation(site.pages, page.target.route, output, "zh-CN");
468
- const groupsEn = renderExperimentGroupNavigation(site.pages, page.target.route, output, "en");
469
- const groupsZh = renderExperimentGroupNavigation(site.pages, page.target.route, output, "zh-CN");
470
- const pageProblems = site.problems.filter((problem) => problem.path.length === 0 || (problem.path[0] === "page" && problem.path[1] === page.target.pageId));
471
- const problemsEn = renderProblems(pageProblems, "en");
472
- const problemsZh = renderProblems(pageProblems, "zh-CN");
473
- const paramRoutesAttr = paramRoutes.length === 0
474
- ? ""
475
- : ` data-niceeval-param-routes="${escapeAttribute(paramRoutes.join(" "))}"`;
476
- const siteRootHref = relativeHref(output, "index.html");
477
- return `<!doctype html><html class="niceeval-view-document" lang="en" data-niceeval-title-en="${escapeAttribute(titleEn)}" data-niceeval-title-zh-cn="${escapeAttribute(titleZh)}" data-niceeval-site-root="${escapeAttribute(siteRootHref)}"${paramRoutesAttr}><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${escapeText(titleEn)}</title><link rel="stylesheet" href="${escapeAttribute(stylesheetHref)}"><link rel="stylesheet" href="${escapeAttribute(themeHref)}">${authorHead}${rendererAssets}<script src="${escapeAttribute(runtimeHref)}" defer></script></head><body><header class="niceeval-view-shell"><a class="niceeval-view-brand" href="${escapeAttribute(NICEEVAL_BRAND_HREF)}" target="_blank" rel="noopener"><span class="niceeval-view-mark" aria-hidden="true"></span><span>NiceEval</span></a><div class="niceeval-view-pages"><nav class="niceeval-view-nav" data-niceeval-locale="en" aria-label="Report pages">${navigationEn}</nav><nav class="niceeval-view-nav" data-niceeval-locale="zh-CN" aria-label="报告页面" hidden>${navigationZh}</nav></div><div class="niceeval-view-controls">${groupsEn}${groupsZh}<label class="niceeval-view-language"><select aria-label="Language" data-niceeval-locale-select><option value="en">EN</option><option value="zh-CN">中文</option></select></label></div></header><main class="niceeval-view-main"><div class="niceeval-view-report-slot" data-niceeval-locale="en" data-page-id="${escapeAttribute(page.target.pageId)}">${bodyEn}${problemsEn}</div><div class="niceeval-view-report-slot" data-niceeval-locale="zh-CN" data-page-id="${escapeAttribute(page.target.pageId)}" hidden>${bodyZh}${problemsZh}</div><noscript><p class="niceeval-view-noscript">This report remains readable without JavaScript; language selection is unavailable.</p></noscript></main></body></html>`;
478
- }
479
- function renderExperimentGroupNavigation(pages, currentRoute, sourceFile, locale) {
480
- const groups = pages.filter((entry) => entry.role?.kind === "experiment-group").sort(compareSitePages);
481
- if (groups.length < 2)
482
- return "";
483
- const options = groups.map(({ page }) => {
484
- const current = page.target.route === currentRoute ? " selected" : "";
485
- const href = relativeHref(sourceFile, (0, paths_ts_1.staticPathForRoute)(page.target.route).posix);
486
- const params = page.target.params;
487
- const label = typeof params?.groupId === "string" ? params.groupId
488
- : typeof params?.experimentId === "string" ? params.experimentId : page.target.route;
489
- return `<option value="${escapeAttribute(href)}"${current}>${escapeText(label)}</option>`;
490
- });
491
- const links = groups.map(({ page }) => {
492
- const current = page.target.route === currentRoute ? " aria-current=\"page\"" : "";
493
- const href = relativeHref(sourceFile, (0, paths_ts_1.staticPathForRoute)(page.target.route).posix);
494
- const params = page.target.params;
495
- const label = typeof params?.groupId === "string" ? params.groupId
496
- : typeof params?.experimentId === "string" ? params.experimentId : page.target.route;
497
- return `<li><a href="${escapeAttribute(href)}"${current}>${escapeText(label)}</a></li>`;
498
- });
499
- const hidden = locale === "zh-CN" ? " hidden" : "";
500
- const label = locale === "zh-CN" ? "实验" : "Experiments";
501
- return `<div class="niceeval-view-experiment" data-niceeval-locale="${locale}"${hidden}><label><span>${label}</span><select aria-label="${label}" data-niceeval-experiment-select>${options.join("")}</select></label><noscript><nav class="niceeval-view-nav" aria-label="${label}"><ul>${links.join("")}</ul></nav></noscript></div>`;
502
- }
503
- function renderNavigation(pages, currentRoute, sourceFile, locale) {
504
- const groups = pages.filter((entry) => entry.role?.kind === "experiment-group").sort(compareSitePages);
505
- const groupRoutes = new Set(groups.map((entry) => entry.page.target.route));
506
- const selectedGroupRoute = groupRoutes.has(currentRoute) ? currentRoute : groups[0]?.page.target.route;
507
- const items = pages.filter((entry) => entry.navigation).sort(compareSitePages).map(({ page }) => {
508
- const targetRoute = page.target.route === "/" && selectedGroupRoute !== undefined
509
- ? selectedGroupRoute
510
- : page.target.route;
511
- const current = page.target.route === currentRoute || (page.target.route === "/" && groupRoutes.has(currentRoute))
512
- ? " aria-current=\"page\""
513
- : "";
514
- const href = relativeHref(sourceFile, (0, paths_ts_1.staticPathForRoute)(targetRoute).posix);
515
- return `<li><a href="${escapeAttribute(href)}"${current}>${escapeText((0, locale_ts_1.resolveLocalizedText)(page.title, locale))}</a></li>`;
516
- });
517
- return `<ul>${items.join("")}</ul>`;
245
+ return `<!doctype html><html class="niceeval-view-document" lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${escapeText((0, locale_ts_1.resolveLocalizedText)(site.title, "en"))}</title><noscript><style>#root{display:none!important}</style></noscript><link rel="stylesheet" href="${site_assets_ts_1.REPORT_STYLESHEET_PATH}"><link rel="stylesheet" href="${exports.REPORT_THEME_STYLESHEET_PATH}">${renderHead(first.page, "index.html")}${rendererAssets}<script src="${REPORT_APP_PATH}" defer></script></head><body><noscript><main class="niceeval-view-js-required" role="alert"><h1>JavaScript required</h1><p>Enable JavaScript to view this NiceEval report.</p></main></noscript><div id="root"></div></body></html>`;
246
+ }
247
+ function landingPage(pages) {
248
+ const landing = pages.find((entry) => entry.presentation === "page");
249
+ if (landing === undefined)
250
+ throw siteFailure("render", "a report site requires at least one page presentation");
251
+ return landing;
518
252
  }
519
253
  function renderProblems(problems, locale) {
520
254
  const visible = problems.filter((problem) => !isGenericMissingSlotProblem(problem));
@@ -636,14 +370,6 @@ function inlineThemeStyles(theme) {
636
370
  }
637
371
  }).join("\n");
638
372
  }
639
- /** A grouped site always opens a concrete comparison; other sites use their first navigable Page. */
640
- function defaultRouteForSite(site) {
641
- return [...site.pages]
642
- .filter((entry) => entry.role?.kind === "experiment-group")
643
- .sort(compareSitePages)[0]?.page.target.route
644
- ?? site.pages.find((entry) => entry.navigation)?.page.target.route
645
- ?? site.pages[0]?.page.target.route;
646
- }
647
373
  function closedProblemsFromFiles(files) {
648
374
  const file = files.find((candidate) => candidate.path === PROBLEMS_PATH);
649
375
  if (file === undefined || file.mediaType !== "application/json; charset=utf-8") {
@@ -682,11 +408,10 @@ function closedProblemsFromFiles(files) {
682
408
  function siteRevisionIdentity(input) {
683
409
  const hash = (0, node_crypto_1.createHash)("sha256");
684
410
  hash.update(canonicalJson({
685
- format: "niceeval.report-site-revision/v1",
686
- renderer: exports.REPORT_STATIC_RENDERER,
411
+ format: "niceeval.report-site-revision/v2",
412
+ renderer: exports.REPORT_APP_RENDERER,
687
413
  sampleIdentity: input.sampleIdentity,
688
414
  reportIdentity: input.reportIdentity,
689
- ...(input.defaultRoute === undefined ? {} : { defaultRoute: input.defaultRoute }),
690
415
  problems: input.problems,
691
416
  }));
692
417
  hash.update("\0");