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
@@ -35,19 +35,32 @@ export interface MatchDiagnosticChild {
35
35
  readonly diagnostic?: MatchDiagnostic;
36
36
  }
37
37
  export type MatchEvaluationState = "matched" | "mismatched" | "unavailable";
38
+ export interface CollectionEvaluationReceipt {
39
+ readonly examined: number;
40
+ readonly matched: number;
41
+ readonly mismatched: number;
42
+ readonly unavailable: number;
43
+ readonly knownTotal: number | null;
44
+ readonly complete: boolean;
45
+ readonly exhaustive: boolean;
46
+ readonly decisive: boolean;
47
+ }
38
48
  /** 一个单候选 matcher 的内部三态结果。 */
39
49
  export type BooleanMatchEvaluation<R> = {
40
50
  readonly state: "matched";
41
51
  /** 永远是传入 candidate 本身,只是在类型层收窄。 */
42
52
  readonly value: R;
43
53
  readonly diagnostic?: MatchDiagnostic;
54
+ readonly receipt?: CollectionEvaluationReceipt;
44
55
  } | {
45
56
  readonly state: "mismatched";
46
57
  readonly diagnostic: MatchDiagnostic;
58
+ readonly receipt?: CollectionEvaluationReceipt;
47
59
  } | {
48
60
  readonly state: "unavailable";
49
61
  readonly reason: string;
50
62
  readonly diagnostic: MatchDiagnostic;
63
+ readonly receipt?: CollectionEvaluationReceipt;
51
64
  };
52
65
  declare const matchInputBrand: unique symbol;
53
66
  declare const matchRefinementBrand: unique symbol;
@@ -35,19 +35,32 @@ export interface MatchDiagnosticChild {
35
35
  readonly diagnostic?: MatchDiagnostic;
36
36
  }
37
37
  export type MatchEvaluationState = "matched" | "mismatched" | "unavailable";
38
+ export interface CollectionEvaluationReceipt {
39
+ readonly examined: number;
40
+ readonly matched: number;
41
+ readonly mismatched: number;
42
+ readonly unavailable: number;
43
+ readonly knownTotal: number | null;
44
+ readonly complete: boolean;
45
+ readonly exhaustive: boolean;
46
+ readonly decisive: boolean;
47
+ }
38
48
  /** 一个单候选 matcher 的内部三态结果。 */
39
49
  export type BooleanMatchEvaluation<R> = {
40
50
  readonly state: "matched";
41
51
  /** 永远是传入 candidate 本身,只是在类型层收窄。 */
42
52
  readonly value: R;
43
53
  readonly diagnostic?: MatchDiagnostic;
54
+ readonly receipt?: CollectionEvaluationReceipt;
44
55
  } | {
45
56
  readonly state: "mismatched";
46
57
  readonly diagnostic: MatchDiagnostic;
58
+ readonly receipt?: CollectionEvaluationReceipt;
47
59
  } | {
48
60
  readonly state: "unavailable";
49
61
  readonly reason: string;
50
62
  readonly diagnostic: MatchDiagnostic;
63
+ readonly receipt?: CollectionEvaluationReceipt;
51
64
  };
52
65
  declare const matchInputBrand: unique symbol;
53
66
  declare const matchRefinementBrand: unique symbol;
@@ -35,19 +35,32 @@ export interface MatchDiagnosticChild {
35
35
  readonly diagnostic?: MatchDiagnostic;
36
36
  }
37
37
  export type MatchEvaluationState = "matched" | "mismatched" | "unavailable";
38
+ export interface CollectionEvaluationReceipt {
39
+ readonly examined: number;
40
+ readonly matched: number;
41
+ readonly mismatched: number;
42
+ readonly unavailable: number;
43
+ readonly knownTotal: number | null;
44
+ readonly complete: boolean;
45
+ readonly exhaustive: boolean;
46
+ readonly decisive: boolean;
47
+ }
38
48
  /** 一个单候选 matcher 的内部三态结果。 */
39
49
  export type BooleanMatchEvaluation<R> = {
40
50
  readonly state: "matched";
41
51
  /** 永远是传入 candidate 本身,只是在类型层收窄。 */
42
52
  readonly value: R;
43
53
  readonly diagnostic?: MatchDiagnostic;
54
+ readonly receipt?: CollectionEvaluationReceipt;
44
55
  } | {
45
56
  readonly state: "mismatched";
46
57
  readonly diagnostic: MatchDiagnostic;
58
+ readonly receipt?: CollectionEvaluationReceipt;
47
59
  } | {
48
60
  readonly state: "unavailable";
49
61
  readonly reason: string;
50
62
  readonly diagnostic: MatchDiagnostic;
63
+ readonly receipt?: CollectionEvaluationReceipt;
51
64
  };
52
65
  declare const matchInputBrand: unique symbol;
53
66
  declare const matchRefinementBrand: unique symbol;
@@ -32,8 +32,8 @@ function assertionBlobRefs(document) {
32
32
  refs.push(material.ref);
33
33
  };
34
34
  for (const entry of document.entries) {
35
- collect(entry.subject);
36
- for (const material of entry.evidence)
35
+ collect(entry.materials.source);
36
+ for (const material of entry.materials.evidence)
37
37
  collect(material);
38
38
  }
39
39
  return Object.freeze(refs);
@@ -58,13 +58,32 @@ function encodeSnapshotObject(value) {
58
58
  }
59
59
  return Object.freeze(encoded);
60
60
  }
61
+ function explanationValue(value) {
62
+ if (value === null || typeof value === "boolean" || typeof value === "string" ||
63
+ (typeof value === "number" && Number.isFinite(value))) {
64
+ return Object.freeze({ kind: "value", value });
65
+ }
66
+ if (Array.isArray(value)) {
67
+ return Object.freeze({ kind: "list", items: Object.freeze(value.map(explanationValue)) });
68
+ }
69
+ if (typeof value === "object" && value !== null) {
70
+ return Object.freeze({
71
+ kind: "fields",
72
+ fields: Object.freeze(Object.entries(value).map(([label, nested]) => Object.freeze({
73
+ label,
74
+ value: explanationValue(nested),
75
+ }))),
76
+ });
77
+ }
78
+ return Object.freeze({ kind: "unavailable", reason: "source-unavailable" });
79
+ }
61
80
  function encodeCriterion(criterion) {
62
81
  switch (criterion.kind) {
63
82
  case "value-match":
64
83
  return Object.freeze({
65
84
  kind: "builtin",
66
85
  id: "value-match/v1",
67
- data: Object.freeze({ subject: criterion.subject }),
86
+ data: Object.freeze({ subject: criterion.subject, matcher: criterion.matcher }),
68
87
  });
69
88
  case "scope-status":
70
89
  return Object.freeze({
@@ -226,6 +245,7 @@ function encodeAssertionResult(result) {
226
245
  const diagnostic = result.diagnostic === undefined
227
246
  ? {}
228
247
  : { diagnostic: encodeSnapshotObject(result.diagnostic) };
248
+ const receipt = result.receipt === undefined ? {} : { receipt: Object.freeze({ ...result.receipt }) };
229
249
  switch (result.state) {
230
250
  case "matched":
231
251
  return Object.freeze({
@@ -235,6 +255,7 @@ function encodeAssertionResult(result) {
235
255
  ? Object.freeze({ state: "earned", points: result.score.points, earned: result.score.earned })
236
256
  : Object.freeze({ state: "not-scored" }),
237
257
  ...diagnostic,
258
+ ...receipt,
238
259
  });
239
260
  case "mismatched":
240
261
  return Object.freeze({
@@ -245,6 +266,7 @@ function encodeAssertionResult(result) {
245
266
  ? Object.freeze({ state: "earned", points: result.score.points, earned: result.score.earned })
246
267
  : Object.freeze({ state: "not-scored" }),
247
268
  ...diagnostic,
269
+ ...receipt,
248
270
  });
249
271
  case "unavailable":
250
272
  return Object.freeze({
@@ -255,6 +277,7 @@ function encodeAssertionResult(result) {
255
277
  ? Object.freeze({ state: "unavailable", points: result.score.points, reason: result.score.reason })
256
278
  : Object.freeze({ state: "not-scored" }),
257
279
  ...diagnostic,
280
+ ...receipt,
258
281
  });
259
282
  case "errored":
260
283
  return Object.freeze({
@@ -265,6 +288,7 @@ function encodeAssertionResult(result) {
265
288
  ? Object.freeze({ state: "unavailable", points: result.score.points, reason: result.score.reason })
266
289
  : Object.freeze({ state: "not-scored" }),
267
290
  ...diagnostic,
291
+ ...receipt,
268
292
  });
269
293
  case "not-applicable":
270
294
  return Object.freeze({
@@ -275,23 +299,48 @@ function encodeAssertionResult(result) {
275
299
  ? Object.freeze({ state: "unavailable", points: result.score.points, reason: result.score.reason })
276
300
  : Object.freeze({ state: "not-scored" }),
277
301
  ...diagnostic,
302
+ ...receipt,
278
303
  });
279
304
  }
280
305
  }
281
306
  /** Private Runtime → durable Assertions codec bridge. */
282
307
  function encodeSealedAssertionEntry(entry) {
308
+ const criterion = encodeCriterion(entry.criterion);
309
+ const subject = encodeMaterial(entry.subject);
310
+ const result = encodeAssertionResult(entry.result);
283
311
  return Object.freeze({
284
312
  display: Object.freeze({
285
313
  ...(entry.display.key === undefined ? {} : { key: entry.display.key }),
286
314
  ...(entry.display.label === undefined ? {} : { label: entry.display.label }),
287
315
  groupPath: Object.freeze([...entry.display.groupPath]),
288
316
  }),
289
- criterion: encodeCriterion(entry.criterion),
290
- subject: encodeMaterial(entry.subject),
291
- evidence: Object.freeze(entry.evidence.map(encodeMaterial)),
292
- coverage: encodeCoverage(entry.coverage),
293
- limitations: encodeLimitations(entry.limitations),
294
- result: encodeAssertionResult(entry.result),
317
+ criterion: Object.freeze({ state: "available", value: criterion }),
318
+ materials: Object.freeze({
319
+ source: subject,
320
+ evidence: Object.freeze(entry.evidence.map(encodeMaterial)),
321
+ coverage: encodeCoverage(entry.coverage),
322
+ limitations: encodeLimitations(entry.limitations),
323
+ }),
324
+ evaluation: Object.freeze({
325
+ observed: explanationValue(entry.observed),
326
+ ...(result.receipt === undefined ? {} : { receipt: result.receipt }),
327
+ }),
328
+ decision: Object.freeze({
329
+ result: result.state,
330
+ reason: "reason" in result ? result.reason : null,
331
+ gate: result.gate,
332
+ }),
333
+ policy: Object.freeze({
334
+ requirement: Object.freeze({ state: "available", value: entry.policy.requirement }),
335
+ condition: Object.freeze({ state: "available", value: entry.policy.condition }),
336
+ }),
337
+ contribution: result.score,
338
+ explanationRetention: result.diagnostic === undefined
339
+ ? Object.freeze({ state: "retained", value: Object.freeze({
340
+ kind: "unavailable",
341
+ reason: "not-declared",
342
+ }) })
343
+ : Object.freeze({ state: "retained", value: explanationValue(result.diagnostic) }),
295
344
  });
296
345
  }
297
346
  function makeProvisionalBlobRef() {
@@ -299,6 +348,8 @@ function makeProvisionalBlobRef() {
299
348
  }
300
349
  function provisionalMaterial(material) {
301
350
  switch (material.kind) {
351
+ case "unavailable":
352
+ return material;
302
353
  case "snapshot":
303
354
  return Object.freeze({ kind: "snapshot", value: material.value });
304
355
  case "blob":
@@ -316,20 +367,32 @@ function provisionalEntry(entry) {
316
367
  return Object.freeze({
317
368
  display: entry.display,
318
369
  criterion: entry.criterion,
319
- subject: provisionalMaterial(entry.subject),
320
- evidence: Object.freeze(entry.evidence.map(provisionalMaterial)),
321
- coverage: entry.coverage,
322
- limitations: entry.limitations,
323
- result: entry.result,
370
+ materials: Object.freeze({
371
+ source: provisionalMaterial(entry.materials.source),
372
+ evidence: Object.freeze(entry.materials.evidence.map(provisionalMaterial)),
373
+ coverage: entry.materials.coverage,
374
+ limitations: entry.materials.limitations,
375
+ }),
376
+ evaluation: entry.evaluation,
377
+ decision: entry.decision,
378
+ policy: entry.policy,
379
+ contribution: entry.contribution,
380
+ explanationRetention: entry.explanationRetention,
324
381
  });
325
382
  }
326
383
  function captureEntrySources(entry) {
327
384
  return Object.freeze({
328
- subject: entry.subject,
329
- evidence: Object.freeze([...entry.evidence]),
385
+ source: entry.materials.source,
386
+ evidence: Object.freeze([...entry.materials.evidence]),
330
387
  });
331
388
  }
332
389
  function materializeMaterial(material, source, blobs, drafts) {
390
+ if (material.kind === "unavailable") {
391
+ if (source.kind !== "unavailable") {
392
+ throw new Error("Assertions producer changed a sealed material kind");
393
+ }
394
+ return material;
395
+ }
333
396
  if (material.kind === "snapshot") {
334
397
  if (source.kind !== "snapshot") {
335
398
  throw new Error("Assertions producer changed a sealed material kind");
@@ -351,16 +414,18 @@ function materializeMaterial(material, source, blobs, drafts) {
351
414
  });
352
415
  }
353
416
  function outerCriterion(criterion) {
417
+ if (criterion.state === "unavailable")
418
+ return criterion;
354
419
  // Effect's structural decoder reads fields before a trailing filter. Keep
355
420
  // the descriptor-aware raw check in front so accessors are never executed.
356
- if (!(0, codec_ts_1.isBoundedJsonObject)(criterion)) {
357
- throw new Error("An Assertions v1 writer criterion must be bounded JSON");
421
+ if (!(0, codec_ts_1.isBoundedJsonObject)(criterion.value)) {
422
+ throw new Error("An Assertions writer criterion must be bounded JSON");
358
423
  }
359
- const decoded = effect_1.Schema.decodeUnknownEither(codec_ts_1.BoundedJsonObjectSchema, codec_ts_1.AssertionsExactParseOptions)(criterion);
424
+ const decoded = effect_1.Schema.decodeUnknownEither(codec_ts_1.BoundedJsonObjectSchema, codec_ts_1.AssertionsExactParseOptions)(criterion.value);
360
425
  if (effect_1.Either.isLeft(decoded)) {
361
- throw new Error("An Assertions v1 writer criterion must be bounded JSON");
426
+ throw new Error("An Assertions writer criterion must be bounded JSON");
362
427
  }
363
- return decoded.right;
428
+ return Object.freeze({ state: "available", value: decoded.right });
364
429
  }
365
430
  function materializeDocument(sources, sealedEntries, sourceSites, blobs) {
366
431
  const drafts = [];
@@ -370,24 +435,30 @@ function materializeDocument(sources, sealedEntries, sourceSites, blobs) {
370
435
  if (source === undefined) {
371
436
  throw new Error("Assertions producer lost a sealed entry source");
372
437
  }
373
- if (source.evidence.length !== sealed.evidence.length) {
438
+ if (source.evidence.length !== sealed.materials.evidence.length) {
374
439
  throw new Error("Assertions producer changed sealed evidence cardinality");
375
440
  }
376
441
  materializedEntries.push(Object.freeze({
377
442
  entryId: sealed.entryId,
378
443
  display: sealed.display,
379
444
  criterion: outerCriterion(sealed.criterion),
380
- subject: materializeMaterial(sealed.subject, source.subject, blobs, drafts),
381
- evidence: Object.freeze(sealed.evidence.map((material, evidenceIndex) => {
382
- const evidenceSource = source.evidence[evidenceIndex];
383
- if (evidenceSource === undefined) {
384
- throw new Error("Assertions producer lost a sealed evidence source");
385
- }
386
- return materializeMaterial(material, evidenceSource, blobs, drafts);
387
- })),
388
- coverage: sealed.coverage,
389
- limitations: sealed.limitations,
390
- result: sealed.result,
445
+ materials: Object.freeze({
446
+ source: materializeMaterial(sealed.materials.source, source.source, blobs, drafts),
447
+ evidence: Object.freeze(sealed.materials.evidence.map((material, evidenceIndex) => {
448
+ const evidenceSource = source.evidence[evidenceIndex];
449
+ if (evidenceSource === undefined) {
450
+ throw new Error("Assertions producer lost a sealed evidence source");
451
+ }
452
+ return materializeMaterial(material, evidenceSource, blobs, drafts);
453
+ })),
454
+ coverage: sealed.materials.coverage,
455
+ limitations: sealed.materials.limitations,
456
+ }),
457
+ evaluation: sealed.evaluation,
458
+ decision: sealed.decision,
459
+ policy: sealed.policy,
460
+ contribution: sealed.contribution,
461
+ explanationRetention: sealed.explanationRetention,
391
462
  }));
392
463
  }
393
464
  return Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"attachment.js","sourceRoot":"","sources":["attachment.ts"],"names":[],"mappings":";;;AA+BA,8CAYC;AA8MD,sDAuDC;AAED,gEAcC;AAgID,gFA4CC;AAMD,8DAOC;AAzfD,6CAAyC;AACzC,mCAAgD;AAChD,+DAAsV;AACtV,sEAAuE;AAIvE,yCAAkR;AAClR,+CAAuL;AAEvL;;;;;GAKG;AACH,MAAM,2BAA2B,GAAuD,eAAM,CAAC,OAAO,CAAgB,CAAC,KAAK,EAA0B,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC;AAStM,MAAM,kCAAkC,GAAgD,eAAM,CAAC,MAAM,CAAC;IAClG,IAAI,EAAE,eAAM,CAAC,OAAO,CAAC,iCAAiC,CAAC;CAC1D,CAAC,CAAC;AACU,QAAA,uBAAuB,GAAG,IAAA,wCAA6B,EAAC,2BAA2B,CAAC,CAAC;AAClG,MAAM,yBAAyB,GAAG,IAAA,wCAA6B,EAAC,kCAAkC,CAAC,CAAC;AACpG,gFAAgF;AAChF,SAAgB,iBAAiB,CAAC,QAAgD;IAC9E,MAAM,IAAI,GAAoB,EAAE,CAAC;IACjC,MAAM,OAAO,GAAG,CAAC,QAAgD,EAAQ,EAAE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L,OAAO,CAAC,KAA4D;YAChE,OAAO,IAAA,oCAAyB,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACtD,CAAC;KACJ,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { Either, Schema, Stream } from \"effect\";\nimport { makeFixedRecordAttachmentWrite, makeRecordBlobSource, validateRecordAttachmentWrite, type FixedAttachmentWriteSpec, type RecordAttachmentBlobBuilder, type RecordAttachmentBlobDraft, type RecordAttachmentPayloadSnapshot, type RecordAttachmentWrite, type RecordBlobRef, type RecordBlobSource, } from \"../../record/attachment/index.ts\";\nimport { Sha256DigestSchema } from \"../../record/codec/identifiers.ts\";\nimport type { AssertionSourceSite, AssertionsAttachment, } from \"../../record/family/assertions.ts\";\nimport type { Sha256Digest } from \"../../record/model/identifiers.ts\";\nimport type { AssertionCoverage, AssertionCriterion, AssertionLimitation, AssertionMaterial, AssertionResult, AssertionSnapshotObject, AssertionSnapshotValue, SealedAssertionEntry, } from \"../api.ts\";\nimport { AssertionEntryIdSchema, AssertionsExactParseOptions, BoundedJsonObjectSchema, BoundedJsonValueSchema, MAX_ASSERTION_DOCUMENT_BYTES, createAssertionsRecordSchemas, isBoundedJsonObject, projectAssertionsDocument, type ThirdPartyCriterionRegistry, } from \"./codec.ts\";\nimport { createAssertionsDocumentBuilder, type AssertionEntryInput, type AssertionsDocumentBuilder, type AssertionsEntryIdSource, type AssertionsProducerError, } from \"./producer.ts\";\nimport type { AssertionEntryId, AssertionEntry, AssertionEntryOuter, AssertionCoverage as RecordAssertionCoverage, AssertionLimitation as RecordAssertionLimitation, AssertionMaterial as RecordAssertionMaterial, AssertionsDocumentOuter, AssertionsProjection, BoundedJsonObject, BoundedJsonValue, SealedAssertionResult, WritableCriterionEnvelope, } from \"./model.ts\";\n/**\n * The Record attachment runtime keeps the real ref authority private. This\n * positional schema only lets the Assertions schema carry a package ref;\n * generic Record closure validation still rejects every ref not minted by the\n * current Attachment builder.\n */\nconst RecordBlobRefPositionSchema: Schema.Schema<RecordBlobRef, RecordBlobRef, never> = Schema.declare<RecordBlobRef>((value): value is RecordBlobRef => typeof value === \"object\" && value !== null);\n/**\n * Producer preflight needs to validate the strict writer document before the\n * real Attachment builder exists. This is deliberately not a RecordBlobRef:\n * final payloads replace it with a ref minted by `blobs.add` below.\n */\ninterface AssertionsProvisionalBlobRef {\n readonly kind: \"assertions-provisional-blob-ref\";\n}\nconst AssertionsProvisionalBlobRefSchema: Schema.Schema<AssertionsProvisionalBlobRef> = Schema.Struct({\n kind: Schema.Literal(\"assertions-provisional-blob-ref\"),\n});\nexport const assertionsRecordSchemas = createAssertionsRecordSchemas(RecordBlobRefPositionSchema);\nconst assertionsProducerSchemas = createAssertionsRecordSchemas(AssertionsProvisionalBlobRefSchema);\n/** Complete payload-order projection required by Record's closure validator. */\nexport function assertionBlobRefs(document: AssertionsDocumentOuter<RecordBlobRef>): readonly RecordBlobRef[] {\n const refs: RecordBlobRef[] = [];\n const collect = (material: RecordAssertionMaterial<RecordBlobRef>): void => {\n if (material.kind === \"blob\")\n refs.push(material.ref);\n };\n for (const entry of document.entries) {\n collect(entry.subject);\n for (const material of entry.evidence)\n collect(material);\n }\n return Object.freeze(refs);\n}\nexport type AssertionMaterialInput<E, R> = {\n readonly kind: \"snapshot\";\n readonly value: BoundedJsonValue;\n} | {\n readonly kind: \"blob\";\n readonly source: RecordBlobSource<E, R>;\n readonly encoding: \"utf-8\" | \"binary\";\n readonly byteLength: number;\n /** Digest declared by the producer and checked against sealed bytes. */\n readonly sha256: Sha256Digest;\n readonly preview: string;\n};\nexport interface AssertionsAttachmentEntryInput<E, R> {\n readonly display: AssertionEntryInput<RecordBlobRef>[\"display\"];\n readonly criterion: AssertionEntryInput<RecordBlobRef>[\"criterion\"];\n readonly subject: AssertionMaterialInput<E, R>;\n readonly evidence: readonly AssertionMaterialInput<E, R>[];\n readonly coverage: AssertionEntryInput<RecordBlobRef>[\"coverage\"];\n readonly limitations: AssertionEntryInput<RecordBlobRef>[\"limitations\"];\n readonly result: AssertionEntryInput<RecordBlobRef>[\"result\"];\n}\nfunction encodeSnapshotValue(value: AssertionSnapshotValue): BoundedJsonValue {\n if (value === null || typeof value === \"boolean\" || typeof value === \"number\" || typeof value === \"string\") {\n return value;\n }\n if (Array.isArray(value)) {\n return Object.freeze(value.map(encodeSnapshotValue));\n }\n const encoded: globalThis.Record<string, BoundedJsonValue> = {};\n for (const [key, nested] of Object.entries(value)) {\n encoded[key] = encodeSnapshotValue(nested);\n }\n return Object.freeze(encoded);\n}\nfunction encodeSnapshotObject(value: AssertionSnapshotObject): BoundedJsonObject {\n const encoded: globalThis.Record<string, BoundedJsonValue> = {};\n for (const [key, nested] of Object.entries(value)) {\n encoded[key] = encodeSnapshotValue(nested);\n }\n return Object.freeze(encoded);\n}\nfunction encodeCriterion(criterion: AssertionCriterion): WritableCriterionEnvelope {\n switch (criterion.kind) {\n case \"value-match\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"value-match/v1\" as const,\n data: Object.freeze({ subject: criterion.subject }),\n });\n case \"scope-status\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"scope-status/v1\" as const,\n data: Object.freeze({ scope: criterion.scope, assertion: criterion.assertion }),\n });\n case \"occurrence\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"occurrence/v1\" as const,\n data: Object.freeze({\n scope: criterion.scope,\n occurrence: criterion.occurrence,\n assertion: criterion.assertion,\n ...(criterion.matcher === undefined ? {} : { matcher: criterion.matcher }),\n ...(criterion.quantifier === undefined\n ? {}\n : {\n quantifier: criterion.quantifier.kind === \"absent\"\n ? Object.freeze({ kind: \"absent\" as const })\n : Object.freeze({ kind: criterion.quantifier.kind, count: criterion.quantifier.count }),\n }),\n }),\n });\n case \"judge-measurement\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"judge-measurement/v1\" as const,\n data: Object.freeze({ recipe: criterion.recipe, scale: criterion.scale }),\n });\n case \"sandbox-result\": {\n switch (criterion.operation) {\n case \"changed-paths\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"sandbox-result/v1\" as const,\n data: Object.freeze({ operation: \"changed-paths\" as const, paths: Object.freeze([...criterion.paths]) }),\n });\n case \"no-changes\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"sandbox-result/v1\" as const,\n data: Object.freeze({ operation: \"no-changes\" as const }),\n });\n case \"file-changed\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"sandbox-result/v1\" as const,\n data: Object.freeze({\n operation: \"file-changed\" as const,\n path: criterion.path,\n ...(criterion.status === undefined ? {} : { status: criterion.status }),\n ...(criterion.before === undefined ? {} : { before: criterion.before }),\n ...(criterion.after === undefined ? {} : { after: criterion.after }),\n }),\n });\n case \"file-deleted\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"sandbox-result/v1\" as const,\n data: Object.freeze({ operation: \"file-deleted\" as const, path: criterion.path }),\n });\n case \"not-in-diff\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"sandbox-result/v1\" as const,\n data: Object.freeze({\n operation: \"not-in-diff\" as const,\n pattern: criterion.pattern,\n flags: criterion.flags,\n content: criterion.content,\n }),\n });\n }\n }\n case \"direct-score\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"direct-score/v1\" as const,\n data: Object.freeze({ source: criterion.source }),\n });\n case \"third-party\":\n return Object.freeze({\n name: criterion.name,\n schemaId: criterion.schemaId,\n data: encodeSnapshotValue(criterion.data),\n });\n }\n}\nfunction encodeMaterial(material: AssertionMaterial): AssertionMaterialInput<never, never> {\n switch (material.kind) {\n case \"snapshot\": {\n const value = encodeSnapshotValue(material.value);\n const bytes = new TextEncoder().encode(JSON.stringify(value));\n const inline = Schema.decodeUnknownEither(BoundedJsonValueSchema, AssertionsExactParseOptions)(value);\n if (bytes.byteLength > 32 * 1024 || Either.isLeft(inline)) {\n const digest = Schema.decodeUnknownEither(Sha256DigestSchema)(createHash(\"sha256\").update(bytes).digest(\"hex\"));\n if (Either.isLeft(digest)) {\n throw new Error(\"Assertions snapshot produced an invalid SHA-256 digest\");\n }\n return Object.freeze({\n kind: \"blob\" as const,\n source: makeRecordBlobSource(Stream.succeed(bytes)),\n encoding: \"utf-8\" as const,\n byteLength: bytes.byteLength,\n sha256: digest.right,\n preview: `JSON Assertion material stored as a ${bytes.byteLength}-byte blob`,\n });\n }\n return Object.freeze({\n kind: \"snapshot\" as const,\n value: inline.right,\n });\n }\n case \"record-attachment\":\n return Object.freeze({\n // The durable Assertions closure cannot hold a capability into the\n // File Changes family. Keep only the already-safe display material.\n kind: \"snapshot\" as const,\n value: Object.freeze({\n kind: \"file-changes\",\n preview: material.preview,\n }),\n });\n }\n}\nfunction encodeCoverage(coverage: AssertionCoverage): AssertionCoverage {\n switch (coverage.state) {\n case \"complete\":\n return Object.freeze({ state: \"complete\" as const });\n case \"partial\":\n return Object.freeze({ state: \"partial\" as const, reason: coverage.reason });\n case \"unavailable\":\n return Object.freeze({ state: \"unavailable\" as const, reason: coverage.reason });\n case \"not-applicable\":\n return Object.freeze({ state: \"not-applicable\" as const, reason: coverage.reason });\n }\n}\nfunction encodeLimitations(limitations: readonly AssertionLimitation[]): readonly AssertionLimitation[] {\n return Object.freeze(limitations.map((limitation): AssertionLimitation => {\n switch (limitation.kind) {\n case \"redacted\":\n return Object.freeze({ kind: \"redacted\" as const, fieldCount: limitation.fieldCount });\n case \"sampled\":\n return Object.freeze({\n kind: \"sampled\" as const,\n captured: limitation.captured,\n ...(limitation.knownTotal === undefined ? {} : { knownTotal: limitation.knownTotal }),\n });\n case \"truncated\":\n return Object.freeze({ kind: \"truncated\" as const, omittedBytes: limitation.omittedBytes });\n case \"provider-limited\":\n return Object.freeze({ kind: \"provider-limited\" as const });\n }\n }));\n}\nexport function encodeAssertionResult(result: AssertionResult): SealedAssertionResult {\n const diagnostic = result.diagnostic === undefined\n ? {}\n : { diagnostic: encodeSnapshotObject(result.diagnostic) };\n switch (result.state) {\n case \"matched\":\n return Object.freeze({\n state: \"matched\" as const,\n gate: result.gate,\n score: result.score.state === \"earned\"\n ? Object.freeze({ state: \"earned\" as const, points: result.score.points, earned: result.score.earned })\n : Object.freeze({ state: \"not-scored\" as const }),\n ...diagnostic,\n });\n case \"mismatched\":\n return Object.freeze({\n state: \"mismatched\" as const,\n reason: result.reason,\n gate: result.gate,\n score: result.score.state === \"earned\"\n ? Object.freeze({ state: \"earned\" as const, points: result.score.points, earned: result.score.earned })\n : Object.freeze({ state: \"not-scored\" as const }),\n ...diagnostic,\n });\n case \"unavailable\":\n return Object.freeze({\n state: \"unavailable\" as const,\n reason: result.reason,\n gate: result.gate,\n score: result.score.state === \"unavailable\"\n ? Object.freeze({ state: \"unavailable\" as const, points: result.score.points, reason: result.score.reason })\n : Object.freeze({ state: \"not-scored\" as const }),\n ...diagnostic,\n });\n case \"errored\":\n return Object.freeze({\n state: \"errored\" as const,\n reason: result.reason,\n gate: result.gate,\n score: result.score.state === \"unavailable\"\n ? Object.freeze({ state: \"unavailable\" as const, points: result.score.points, reason: result.score.reason })\n : Object.freeze({ state: \"not-scored\" as const }),\n ...diagnostic,\n });\n case \"not-applicable\":\n return Object.freeze({\n state: \"not-applicable\" as const,\n reason: result.reason,\n gate: result.gate,\n score: result.score.state === \"unavailable\"\n ? Object.freeze({ state: \"unavailable\" as const, points: result.score.points, reason: result.score.reason })\n : Object.freeze({ state: \"not-scored\" as const }),\n ...diagnostic,\n });\n }\n}\n/** Private Runtime → durable Assertions codec bridge. */\nexport function encodeSealedAssertionEntry(entry: SealedAssertionEntry): AssertionsAttachmentEntryInput<never, never> {\n return Object.freeze({\n display: Object.freeze({\n ...(entry.display.key === undefined ? {} : { key: entry.display.key }),\n ...(entry.display.label === undefined ? {} : { label: entry.display.label }),\n groupPath: Object.freeze([...entry.display.groupPath]),\n }),\n criterion: encodeCriterion(entry.criterion),\n subject: encodeMaterial(entry.subject),\n evidence: Object.freeze(entry.evidence.map(encodeMaterial)),\n coverage: encodeCoverage(entry.coverage),\n limitations: encodeLimitations(entry.limitations),\n result: encodeAssertionResult(entry.result),\n });\n}\nexport interface AssertionsAttachmentProducer<E, R> {\n readonly append: (entry: AssertionsAttachmentEntryInput<E, R>) => Either.Either<AssertionEntryId, AssertionsProducerError>;\n readonly seal: (input?: AssertionsAttachmentSealInput) => Either.Either<RecordAttachmentWrite<\"attempt\", E, R>, AssertionsProducerError>;\n}\nexport interface AssertionsAttachmentSealInput {\n /** Semantic joins to origin-Run Sources, embedded in this fixed family. */\n readonly sourceSites?: readonly AssertionSourceSite[];\n}\nfunction makeProvisionalBlobRef(): AssertionsProvisionalBlobRef {\n return Object.freeze({ kind: \"assertions-provisional-blob-ref\" });\n}\nfunction provisionalMaterial<E, R>(material: AssertionMaterialInput<E, R>): RecordAssertionMaterial<AssertionsProvisionalBlobRef> {\n switch (material.kind) {\n case \"snapshot\":\n return Object.freeze({ kind: \"snapshot\", value: material.value });\n case \"blob\":\n return Object.freeze({\n kind: \"blob\",\n ref: makeProvisionalBlobRef(),\n encoding: material.encoding,\n byteLength: material.byteLength,\n sha256: material.sha256,\n preview: material.preview,\n });\n }\n}\nfunction provisionalEntry<E, R>(entry: AssertionsAttachmentEntryInput<E, R>): AssertionEntryInput<AssertionsProvisionalBlobRef> {\n return Object.freeze({\n display: entry.display,\n criterion: entry.criterion,\n subject: provisionalMaterial(entry.subject),\n evidence: Object.freeze(entry.evidence.map(provisionalMaterial)),\n coverage: entry.coverage,\n limitations: entry.limitations,\n result: entry.result,\n });\n}\ninterface AssertionsAttachmentEntrySources<E, R> {\n readonly subject: AssertionMaterialInput<E, R>;\n readonly evidence: readonly AssertionMaterialInput<E, R>[];\n}\nfunction captureEntrySources<E, R>(entry: AssertionsAttachmentEntryInput<E, R>): AssertionsAttachmentEntrySources<E, R> {\n return Object.freeze({\n subject: entry.subject,\n evidence: Object.freeze([...entry.evidence]),\n });\n}\nfunction materializeMaterial<E, R>(material: RecordAssertionMaterial<AssertionsProvisionalBlobRef>, source: AssertionMaterialInput<E, R>, blobs: RecordAttachmentBlobBuilder, drafts: RecordAttachmentBlobDraft<E, R>[]): RecordAssertionMaterial<RecordBlobRef> {\n if (material.kind === \"snapshot\") {\n if (source.kind !== \"snapshot\") {\n throw new Error(\"Assertions producer changed a sealed material kind\");\n }\n return Object.freeze({ kind: \"snapshot\", value: material.value });\n }\n if (source.kind !== \"blob\") {\n throw new Error(\"Assertions producer changed a sealed material kind\");\n }\n const draft = blobs.add(source.source);\n drafts.push(draft);\n return Object.freeze({\n kind: \"blob\",\n ref: draft.ref,\n encoding: material.encoding,\n byteLength: material.byteLength,\n sha256: material.sha256,\n preview: material.preview,\n });\n}\nfunction outerCriterion(criterion: AssertionEntry<AssertionsProvisionalBlobRef>[\"criterion\"]): AssertionEntryOuter<RecordBlobRef>[\"criterion\"] {\n // Effect's structural decoder reads fields before a trailing filter. Keep\n // the descriptor-aware raw check in front so accessors are never executed.\n if (!isBoundedJsonObject(criterion)) {\n throw new Error(\"An Assertions v1 writer criterion must be bounded JSON\");\n }\n const decoded = Schema.decodeUnknownEither(BoundedJsonObjectSchema, AssertionsExactParseOptions)(criterion);\n if (Either.isLeft(decoded)) {\n throw new Error(\"An Assertions v1 writer criterion must be bounded JSON\");\n }\n return decoded.right;\n}\nfunction materializeDocument<E, R>(sources: readonly AssertionsAttachmentEntrySources<E, R>[], sealedEntries: readonly AssertionEntry<AssertionsProvisionalBlobRef>[], sourceSites: readonly AssertionSourceSite[], blobs: RecordAttachmentBlobBuilder): {\n readonly payload: AssertionsAttachment;\n readonly blobs: readonly RecordAttachmentBlobDraft<E, R>[];\n} {\n const drafts: RecordAttachmentBlobDraft<E, R>[] = [];\n const materializedEntries: AssertionEntryOuter<RecordBlobRef>[] = [];\n for (const [index, sealed] of sealedEntries.entries()) {\n const source = sources[index];\n if (source === undefined) {\n throw new Error(\"Assertions producer lost a sealed entry source\");\n }\n if (source.evidence.length !== sealed.evidence.length) {\n throw new Error(\"Assertions producer changed sealed evidence cardinality\");\n }\n materializedEntries.push(Object.freeze({\n entryId: sealed.entryId,\n display: sealed.display,\n criterion: outerCriterion(sealed.criterion),\n subject: materializeMaterial(sealed.subject, source.subject, blobs, drafts),\n evidence: Object.freeze(sealed.evidence.map((material, evidenceIndex) => {\n const evidenceSource = source.evidence[evidenceIndex];\n if (evidenceSource === undefined) {\n throw new Error(\"Assertions producer lost a sealed evidence source\");\n }\n return materializeMaterial(material, evidenceSource, blobs, drafts);\n })),\n coverage: sealed.coverage,\n limitations: sealed.limitations,\n result: sealed.result,\n }));\n }\n return Object.freeze({\n payload: Object.freeze({\n entries: Object.freeze(materializedEntries),\n // Source sites are joined into this fixed family by the runner's source\n // capture before final sealing. A producer with no captured site writes\n // the exact empty sequence instead of another durable family.\n sourceSites: Object.freeze([...sourceSites]),\n }),\n blobs: Object.freeze(drafts),\n });\n}\n/**\n * Collects completed facts in declaration order, then mints every blob ref\n * inside one generic RecordAttachment write. Callers never receive a raw ref,\n * path, key, or bytes channel, so cross-Attachment closure is impossible.\n */\nexport function createAssertionsAttachmentProducer<E, R>(config: {\n readonly entryIds: AssertionsEntryIdSource;\n /** Injected by the fixed catalog consumer to avoid a catalog initialization cycle. */\n readonly write: FixedAttachmentWriteSpec<\"attempt\", AssertionsAttachment>;\n}): AssertionsAttachmentProducer<E, R> {\n const documentBuilder: AssertionsDocumentBuilder<AssertionsProvisionalBlobRef> = createAssertionsDocumentBuilder({\n documentSchema: assertionsProducerSchemas.document,\n entryIds: config.entryIds,\n });\n const sources: AssertionsAttachmentEntrySources<E, R>[] = [];\n let sealed: Either.Either<RecordAttachmentWrite<\"attempt\", E, R>, AssertionsProducerError> | undefined;\n const producer: AssertionsAttachmentProducer<E, R> = {\n append(entry) {\n const appended = documentBuilder.append(provisionalEntry(entry));\n if (Either.isRight(appended))\n sources.push(captureEntrySources(entry));\n return appended;\n },\n seal(sealInput: AssertionsAttachmentSealInput = {}) {\n if (sealed !== undefined)\n return sealed;\n const sourceSites = Object.freeze([...(sealInput.sourceSites ?? [])]);\n const emptyEntriesBytes = new TextEncoder().encode(JSON.stringify({ entries: [] })).byteLength;\n const sourceSitesFramingBytes = new TextEncoder().encode(JSON.stringify({\n entries: [],\n sourceSites,\n })).byteLength - emptyEntriesBytes;\n const document = documentBuilder.seal({\n maximumBytes: MAX_ASSERTION_DOCUMENT_BYTES - sourceSitesFramingBytes,\n });\n if (Either.isLeft(document)) {\n sealed = Either.left(document.left);\n return sealed;\n }\n const write = makeFixedRecordAttachmentWrite(config.write, (blobs) => materializeDocument(sources, document.right.entries, sourceSites, blobs));\n const closure = validateRecordAttachmentWrite(write);\n if (Either.isLeft(closure)) {\n throw new Error(\"Assertions producer generated an invalid RecordAttachment closure\");\n }\n sealed = Either.right(write);\n return sealed;\n },\n };\n return Object.freeze(producer);\n}\nexport interface AssertionsProjectorDefinition {\n readonly write: FixedAttachmentWriteSpec<\"attempt\", AssertionsAttachment>;\n readonly project: (value: RecordAttachmentPayloadSnapshot<AssertionsAttachment>) => AssertionsProjection<RecordBlobRef>;\n}\n/** Typed, synchronous projection over one already-materialized Attachment value. */\nexport function defineAssertionsProjector(registry: ThirdPartyCriterionRegistry, write: FixedAttachmentWriteSpec<\"attempt\", AssertionsAttachment>): AssertionsProjectorDefinition {\n return Object.freeze({\n write,\n project(value: RecordAttachmentPayloadSnapshot<AssertionsAttachment>) {\n return projectAssertionsDocument(value, registry);\n },\n });\n}\n"]}
1
+ {"version":3,"file":"attachment.js","sourceRoot":"","sources":["attachment.ts"],"names":[],"mappings":";;;AA+BA,8CAYC;AA0OD,sDA6DC;AAED,gEAsCC;AAsJD,gFA4CC;AAMD,8DAOC;AAzkBD,6CAAyC;AACzC,mCAAgD;AAChD,+DAAsV;AACtV,sEAAuE;AAIvE,yCAAkR;AAClR,+CAAuL;AAEvL;;;;;GAKG;AACH,MAAM,2BAA2B,GAAuD,eAAM,CAAC,OAAO,CAAgB,CAAC,KAAK,EAA0B,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,K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,CAAC,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;YAChJ,MAAM,OAAO,GAAG,IAAA,wCAA6B,EAAC,KAAK,CAAC,CAAC;YACrD,IAAI,eAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;YACzF,CAAC;YACD,MAAM,GAAG,eAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC7B,OAAO,MAAM,CAAC;QAClB,CAAC;KACJ,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC;AAKD,oFAAoF;AACpF,SAAgB,yBAAyB,CAAC,QAAqC,EAAE,KAAgE;IAC7I,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,KAAK;QACL,OAAO,CAAC,KAA4D;YAChE,OAAO,IAAA,oCAAyB,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACtD,CAAC;KACJ,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { Either, Schema, Stream } from \"effect\";\nimport { makeFixedRecordAttachmentWrite, makeRecordBlobSource, validateRecordAttachmentWrite, type FixedAttachmentWriteSpec, type RecordAttachmentBlobBuilder, type RecordAttachmentBlobDraft, type RecordAttachmentPayloadSnapshot, type RecordAttachmentWrite, type RecordBlobRef, type RecordBlobSource, } from \"../../record/attachment/index.ts\";\nimport { Sha256DigestSchema } from \"../../record/codec/identifiers.ts\";\nimport type { AssertionSourceSite, AssertionsAttachment, } from \"../../record/family/assertions.ts\";\nimport type { Sha256Digest } from \"../../record/model/identifiers.ts\";\nimport type { AssertionCoverage, AssertionCriterion, AssertionLimitation, AssertionMaterial, AssertionResult, AssertionSnapshotObject, AssertionSnapshotValue, SealedAssertionEntry, } from \"../api.ts\";\nimport { AssertionEntryIdSchema, AssertionsExactParseOptions, BoundedJsonObjectSchema, BoundedJsonValueSchema, MAX_ASSERTION_DOCUMENT_BYTES, createAssertionsRecordSchemas, isBoundedJsonObject, projectAssertionsDocument, type ThirdPartyCriterionRegistry, } from \"./codec.ts\";\nimport { createAssertionsDocumentBuilder, type AssertionEntryInput, type AssertionsDocumentBuilder, type AssertionsEntryIdSource, type AssertionsProducerError, } from \"./producer.ts\";\nimport type { AssertionEntryId, AssertionFactValue, AssertionEntry, AssertionEntryOuter, AssertionCoverage as RecordAssertionCoverage, AssertionLimitation as RecordAssertionLimitation, AssertionMaterial as RecordAssertionMaterial, AssertionsDocumentOuter, AssertionsProjection, BoundedJsonObject, BoundedJsonValue, SealedAssertionResult, WritableCriterionEnvelope, } from \"./model.ts\";\n/**\n * The Record attachment runtime keeps the real ref authority private. This\n * positional schema only lets the Assertions schema carry a package ref;\n * generic Record closure validation still rejects every ref not minted by the\n * current Attachment builder.\n */\nconst RecordBlobRefPositionSchema: Schema.Schema<RecordBlobRef, RecordBlobRef, never> = Schema.declare<RecordBlobRef>((value): value is RecordBlobRef => typeof value === \"object\" && value !== null);\n/**\n * Producer preflight needs to validate the strict writer document before the\n * real Attachment builder exists. This is deliberately not a RecordBlobRef:\n * final payloads replace it with a ref minted by `blobs.add` below.\n */\ninterface AssertionsProvisionalBlobRef {\n readonly kind: \"assertions-provisional-blob-ref\";\n}\nconst AssertionsProvisionalBlobRefSchema: Schema.Schema<AssertionsProvisionalBlobRef> = Schema.Struct({\n kind: Schema.Literal(\"assertions-provisional-blob-ref\"),\n});\nexport const assertionsRecordSchemas = createAssertionsRecordSchemas(RecordBlobRefPositionSchema);\nconst assertionsProducerSchemas = createAssertionsRecordSchemas(AssertionsProvisionalBlobRefSchema);\n/** Complete payload-order projection required by Record's closure validator. */\nexport function assertionBlobRefs(document: AssertionsDocumentOuter<RecordBlobRef>): readonly RecordBlobRef[] {\n const refs: RecordBlobRef[] = [];\n const collect = (material: RecordAssertionMaterial<RecordBlobRef>): void => {\n if (material.kind === \"blob\")\n refs.push(material.ref);\n };\n for (const entry of document.entries) {\n collect(entry.materials.source);\n for (const material of entry.materials.evidence)\n collect(material);\n }\n return Object.freeze(refs);\n}\nexport type AssertionMaterialInput<E, R> = {\n readonly kind: \"unavailable\";\n readonly reason: \"not-recorded\";\n} | {\n readonly kind: \"snapshot\";\n readonly value: BoundedJsonValue;\n} | {\n readonly kind: \"blob\";\n readonly source: RecordBlobSource<E, R>;\n readonly encoding: \"utf-8\" | \"binary\";\n readonly byteLength: number;\n /** Digest declared by the producer and checked against sealed bytes. */\n readonly sha256: Sha256Digest;\n readonly preview: string;\n};\nexport interface AssertionsAttachmentEntryInput<E, R> {\n readonly display: AssertionEntryInput<RecordBlobRef>[\"display\"];\n readonly criterion: AssertionEntryInput<RecordBlobRef>[\"criterion\"];\n readonly materials: {\n readonly source: AssertionMaterialInput<E, R>;\n readonly evidence: readonly AssertionMaterialInput<E, R>[];\n readonly coverage: AssertionEntryInput<RecordBlobRef>[\"materials\"][\"coverage\"];\n readonly limitations: AssertionEntryInput<RecordBlobRef>[\"materials\"][\"limitations\"];\n };\n readonly evaluation: AssertionEntryInput<RecordBlobRef>[\"evaluation\"];\n readonly decision: AssertionEntryInput<RecordBlobRef>[\"decision\"];\n readonly policy: AssertionEntryInput<RecordBlobRef>[\"policy\"];\n readonly contribution: AssertionEntryInput<RecordBlobRef>[\"contribution\"];\n readonly explanationRetention: AssertionEntryInput<RecordBlobRef>[\"explanationRetention\"];\n}\nfunction encodeSnapshotValue(value: AssertionSnapshotValue): BoundedJsonValue {\n if (value === null || typeof value === \"boolean\" || typeof value === \"number\" || typeof value === \"string\") {\n return value;\n }\n if (Array.isArray(value)) {\n return Object.freeze(value.map(encodeSnapshotValue));\n }\n const encoded: globalThis.Record<string, BoundedJsonValue> = {};\n for (const [key, nested] of Object.entries(value)) {\n encoded[key] = encodeSnapshotValue(nested);\n }\n return Object.freeze(encoded);\n}\nfunction encodeSnapshotObject(value: AssertionSnapshotObject): BoundedJsonObject {\n const encoded: globalThis.Record<string, BoundedJsonValue> = {};\n for (const [key, nested] of Object.entries(value)) {\n encoded[key] = encodeSnapshotValue(nested);\n }\n return Object.freeze(encoded);\n}\nfunction explanationValue(value: unknown): AssertionFactValue {\n if (value === null || typeof value === \"boolean\" || typeof value === \"string\" ||\n (typeof value === \"number\" && Number.isFinite(value))) {\n return Object.freeze({ kind: \"value\" as const, value });\n }\n if (Array.isArray(value)) {\n return Object.freeze({ kind: \"list\" as const, items: Object.freeze(value.map(explanationValue)) });\n }\n if (typeof value === \"object\" && value !== null) {\n return Object.freeze({\n kind: \"fields\" as const,\n fields: Object.freeze(Object.entries(value).map(([label, nested]) => Object.freeze({\n label,\n value: explanationValue(nested),\n }))),\n });\n }\n return Object.freeze({ kind: \"unavailable\" as const, reason: \"source-unavailable\" as const });\n}\nfunction encodeCriterion(criterion: AssertionCriterion): WritableCriterionEnvelope {\n switch (criterion.kind) {\n case \"value-match\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"value-match/v1\" as const,\n data: Object.freeze({ subject: criterion.subject, matcher: criterion.matcher }),\n });\n case \"scope-status\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"scope-status/v1\" as const,\n data: Object.freeze({ scope: criterion.scope, assertion: criterion.assertion }),\n });\n case \"occurrence\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"occurrence/v1\" as const,\n data: Object.freeze({\n scope: criterion.scope,\n occurrence: criterion.occurrence,\n assertion: criterion.assertion,\n ...(criterion.matcher === undefined ? {} : { matcher: criterion.matcher }),\n ...(criterion.quantifier === undefined\n ? {}\n : {\n quantifier: criterion.quantifier.kind === \"absent\"\n ? Object.freeze({ kind: \"absent\" as const })\n : Object.freeze({ kind: criterion.quantifier.kind, count: criterion.quantifier.count }),\n }),\n }),\n });\n case \"judge-measurement\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"judge-measurement/v1\" as const,\n data: Object.freeze({ recipe: criterion.recipe, scale: criterion.scale }),\n });\n case \"sandbox-result\": {\n switch (criterion.operation) {\n case \"changed-paths\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"sandbox-result/v1\" as const,\n data: Object.freeze({ operation: \"changed-paths\" as const, paths: Object.freeze([...criterion.paths]) }),\n });\n case \"no-changes\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"sandbox-result/v1\" as const,\n data: Object.freeze({ operation: \"no-changes\" as const }),\n });\n case \"file-changed\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"sandbox-result/v1\" as const,\n data: Object.freeze({\n operation: \"file-changed\" as const,\n path: criterion.path,\n ...(criterion.status === undefined ? {} : { status: criterion.status }),\n ...(criterion.before === undefined ? {} : { before: criterion.before }),\n ...(criterion.after === undefined ? {} : { after: criterion.after }),\n }),\n });\n case \"file-deleted\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"sandbox-result/v1\" as const,\n data: Object.freeze({ operation: \"file-deleted\" as const, path: criterion.path }),\n });\n case \"not-in-diff\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"sandbox-result/v1\" as const,\n data: Object.freeze({\n operation: \"not-in-diff\" as const,\n pattern: criterion.pattern,\n flags: criterion.flags,\n content: criterion.content,\n }),\n });\n }\n }\n case \"direct-score\":\n return Object.freeze({\n kind: \"builtin\" as const,\n id: \"direct-score/v1\" as const,\n data: Object.freeze({ source: criterion.source }),\n });\n case \"third-party\":\n return Object.freeze({\n name: criterion.name,\n schemaId: criterion.schemaId,\n data: encodeSnapshotValue(criterion.data),\n });\n }\n}\nfunction encodeMaterial(material: AssertionMaterial): AssertionMaterialInput<never, never> {\n switch (material.kind) {\n case \"snapshot\": {\n const value = encodeSnapshotValue(material.value);\n const bytes = new TextEncoder().encode(JSON.stringify(value));\n const inline = Schema.decodeUnknownEither(BoundedJsonValueSchema, AssertionsExactParseOptions)(value);\n if (bytes.byteLength > 32 * 1024 || Either.isLeft(inline)) {\n const digest = Schema.decodeUnknownEither(Sha256DigestSchema)(createHash(\"sha256\").update(bytes).digest(\"hex\"));\n if (Either.isLeft(digest)) {\n throw new Error(\"Assertions snapshot produced an invalid SHA-256 digest\");\n }\n return Object.freeze({\n kind: \"blob\" as const,\n source: makeRecordBlobSource(Stream.succeed(bytes)),\n encoding: \"utf-8\" as const,\n byteLength: bytes.byteLength,\n sha256: digest.right,\n preview: `JSON Assertion material stored as a ${bytes.byteLength}-byte blob`,\n });\n }\n return Object.freeze({\n kind: \"snapshot\" as const,\n value: inline.right,\n });\n }\n case \"record-attachment\":\n return Object.freeze({\n // The durable Assertions closure cannot hold a capability into the\n // File Changes family. Keep only the already-safe display material.\n kind: \"snapshot\" as const,\n value: Object.freeze({\n kind: \"file-changes\",\n preview: material.preview,\n }),\n });\n }\n}\nfunction encodeCoverage(coverage: AssertionCoverage): AssertionCoverage {\n switch (coverage.state) {\n case \"complete\":\n return Object.freeze({ state: \"complete\" as const });\n case \"partial\":\n return Object.freeze({ state: \"partial\" as const, reason: coverage.reason });\n case \"unavailable\":\n return Object.freeze({ state: \"unavailable\" as const, reason: coverage.reason });\n case \"not-applicable\":\n return Object.freeze({ state: \"not-applicable\" as const, reason: coverage.reason });\n }\n}\nfunction encodeLimitations(limitations: readonly AssertionLimitation[]): readonly AssertionLimitation[] {\n return Object.freeze(limitations.map((limitation): AssertionLimitation => {\n switch (limitation.kind) {\n case \"redacted\":\n return Object.freeze({ kind: \"redacted\" as const, fieldCount: limitation.fieldCount });\n case \"sampled\":\n return Object.freeze({\n kind: \"sampled\" as const,\n captured: limitation.captured,\n ...(limitation.knownTotal === undefined ? {} : { knownTotal: limitation.knownTotal }),\n });\n case \"truncated\":\n return Object.freeze({ kind: \"truncated\" as const, omittedBytes: limitation.omittedBytes });\n case \"provider-limited\":\n return Object.freeze({ kind: \"provider-limited\" as const });\n }\n }));\n}\nexport function encodeAssertionResult(result: AssertionResult): SealedAssertionResult {\n const diagnostic = result.diagnostic === undefined\n ? {}\n : { diagnostic: encodeSnapshotObject(result.diagnostic) };\n const receipt = result.receipt === undefined ? {} : { receipt: Object.freeze({ ...result.receipt }) };\n switch (result.state) {\n case \"matched\":\n return Object.freeze({\n state: \"matched\" as const,\n gate: result.gate,\n score: result.score.state === \"earned\"\n ? Object.freeze({ state: \"earned\" as const, points: result.score.points, earned: result.score.earned })\n : Object.freeze({ state: \"not-scored\" as const }),\n ...diagnostic,\n ...receipt,\n });\n case \"mismatched\":\n return Object.freeze({\n state: \"mismatched\" as const,\n reason: result.reason,\n gate: result.gate,\n score: result.score.state === \"earned\"\n ? Object.freeze({ state: \"earned\" as const, points: result.score.points, earned: result.score.earned })\n : Object.freeze({ state: \"not-scored\" as const }),\n ...diagnostic,\n ...receipt,\n });\n case \"unavailable\":\n return Object.freeze({\n state: \"unavailable\" as const,\n reason: result.reason,\n gate: result.gate,\n score: result.score.state === \"unavailable\"\n ? Object.freeze({ state: \"unavailable\" as const, points: result.score.points, reason: result.score.reason })\n : Object.freeze({ state: \"not-scored\" as const }),\n ...diagnostic,\n ...receipt,\n });\n case \"errored\":\n return Object.freeze({\n state: \"errored\" as const,\n reason: result.reason,\n gate: result.gate,\n score: result.score.state === \"unavailable\"\n ? Object.freeze({ state: \"unavailable\" as const, points: result.score.points, reason: result.score.reason })\n : Object.freeze({ state: \"not-scored\" as const }),\n ...diagnostic,\n ...receipt,\n });\n case \"not-applicable\":\n return Object.freeze({\n state: \"not-applicable\" as const,\n reason: result.reason,\n gate: result.gate,\n score: result.score.state === \"unavailable\"\n ? Object.freeze({ state: \"unavailable\" as const, points: result.score.points, reason: result.score.reason })\n : Object.freeze({ state: \"not-scored\" as const }),\n ...diagnostic,\n ...receipt,\n });\n }\n}\n/** Private Runtime → durable Assertions codec bridge. */\nexport function encodeSealedAssertionEntry(entry: SealedAssertionEntry): AssertionsAttachmentEntryInput<never, never> {\n const criterion = encodeCriterion(entry.criterion);\n const subject = encodeMaterial(entry.subject);\n const result = encodeAssertionResult(entry.result);\n return Object.freeze({\n display: Object.freeze({\n ...(entry.display.key === undefined ? {} : { key: entry.display.key }),\n ...(entry.display.label === undefined ? {} : { label: entry.display.label }),\n groupPath: Object.freeze([...entry.display.groupPath]),\n }),\n criterion: Object.freeze({ state: \"available\" as const, value: criterion }),\n materials: Object.freeze({\n source: subject,\n evidence: Object.freeze(entry.evidence.map(encodeMaterial)),\n coverage: encodeCoverage(entry.coverage),\n limitations: encodeLimitations(entry.limitations),\n }),\n evaluation: Object.freeze({\n observed: explanationValue(entry.observed),\n ...(result.receipt === undefined ? {} : { receipt: result.receipt }),\n }),\n decision: Object.freeze({\n result: result.state,\n reason: \"reason\" in result ? result.reason : null,\n gate: result.gate,\n }),\n policy: Object.freeze({\n requirement: Object.freeze({ state: \"available\" as const, value: entry.policy.requirement }),\n condition: Object.freeze({ state: \"available\" as const, value: entry.policy.condition }),\n }),\n contribution: result.score,\n explanationRetention: result.diagnostic === undefined\n ? Object.freeze({ state: \"retained\" as const, value: Object.freeze({\n kind: \"unavailable\" as const,\n reason: \"not-declared\" as const,\n }) })\n : Object.freeze({ state: \"retained\" as const, value: explanationValue(result.diagnostic) }),\n });\n}\nexport interface AssertionsAttachmentProducer<E, R> {\n readonly append: (entry: AssertionsAttachmentEntryInput<E, R>) => Either.Either<AssertionEntryId, AssertionsProducerError>;\n readonly seal: (input?: AssertionsAttachmentSealInput) => Either.Either<RecordAttachmentWrite<\"attempt\", E, R>, AssertionsProducerError>;\n}\nexport interface AssertionsAttachmentSealInput {\n /** Semantic joins to origin-Run Sources, embedded in this fixed family. */\n readonly sourceSites?: readonly AssertionSourceSite[];\n}\nfunction makeProvisionalBlobRef(): AssertionsProvisionalBlobRef {\n return Object.freeze({ kind: \"assertions-provisional-blob-ref\" });\n}\nfunction provisionalMaterial<E, R>(material: AssertionMaterialInput<E, R>): RecordAssertionMaterial<AssertionsProvisionalBlobRef> {\n switch (material.kind) {\n case \"unavailable\":\n return material;\n case \"snapshot\":\n return Object.freeze({ kind: \"snapshot\", value: material.value });\n case \"blob\":\n return Object.freeze({\n kind: \"blob\",\n ref: makeProvisionalBlobRef(),\n encoding: material.encoding,\n byteLength: material.byteLength,\n sha256: material.sha256,\n preview: material.preview,\n });\n }\n}\nfunction provisionalEntry<E, R>(entry: AssertionsAttachmentEntryInput<E, R>): AssertionEntryInput<AssertionsProvisionalBlobRef> {\n return Object.freeze({\n display: entry.display,\n criterion: entry.criterion,\n materials: Object.freeze({\n source: provisionalMaterial(entry.materials.source),\n evidence: Object.freeze(entry.materials.evidence.map(provisionalMaterial)),\n coverage: entry.materials.coverage,\n limitations: entry.materials.limitations,\n }),\n evaluation: entry.evaluation,\n decision: entry.decision,\n policy: entry.policy,\n contribution: entry.contribution,\n explanationRetention: entry.explanationRetention,\n });\n}\ninterface AssertionsAttachmentEntrySources<E, R> {\n readonly source: AssertionMaterialInput<E, R>;\n readonly evidence: readonly AssertionMaterialInput<E, R>[];\n}\nfunction captureEntrySources<E, R>(entry: AssertionsAttachmentEntryInput<E, R>): AssertionsAttachmentEntrySources<E, R> {\n return Object.freeze({\n source: entry.materials.source,\n evidence: Object.freeze([...entry.materials.evidence]),\n });\n}\nfunction materializeMaterial<E, R>(material: RecordAssertionMaterial<AssertionsProvisionalBlobRef>, source: AssertionMaterialInput<E, R>, blobs: RecordAttachmentBlobBuilder, drafts: RecordAttachmentBlobDraft<E, R>[]): RecordAssertionMaterial<RecordBlobRef> {\n if (material.kind === \"unavailable\") {\n if (source.kind !== \"unavailable\") {\n throw new Error(\"Assertions producer changed a sealed material kind\");\n }\n return material;\n }\n if (material.kind === \"snapshot\") {\n if (source.kind !== \"snapshot\") {\n throw new Error(\"Assertions producer changed a sealed material kind\");\n }\n return Object.freeze({ kind: \"snapshot\", value: material.value });\n }\n if (source.kind !== \"blob\") {\n throw new Error(\"Assertions producer changed a sealed material kind\");\n }\n const draft = blobs.add(source.source);\n drafts.push(draft);\n return Object.freeze({\n kind: \"blob\",\n ref: draft.ref,\n encoding: material.encoding,\n byteLength: material.byteLength,\n sha256: material.sha256,\n preview: material.preview,\n });\n}\nfunction outerCriterion(criterion: AssertionEntry<AssertionsProvisionalBlobRef>[\"criterion\"]): AssertionEntryOuter<RecordBlobRef>[\"criterion\"] {\n if (criterion.state === \"unavailable\")\n return criterion;\n // Effect's structural decoder reads fields before a trailing filter. Keep\n // the descriptor-aware raw check in front so accessors are never executed.\n if (!isBoundedJsonObject(criterion.value)) {\n throw new Error(\"An Assertions writer criterion must be bounded JSON\");\n }\n const decoded = Schema.decodeUnknownEither(BoundedJsonObjectSchema, AssertionsExactParseOptions)(criterion.value);\n if (Either.isLeft(decoded)) {\n throw new Error(\"An Assertions writer criterion must be bounded JSON\");\n }\n return Object.freeze({ state: \"available\" as const, value: decoded.right });\n}\nfunction materializeDocument<E, R>(sources: readonly AssertionsAttachmentEntrySources<E, R>[], sealedEntries: readonly AssertionEntry<AssertionsProvisionalBlobRef>[], sourceSites: readonly AssertionSourceSite[], blobs: RecordAttachmentBlobBuilder): {\n readonly payload: AssertionsAttachment;\n readonly blobs: readonly RecordAttachmentBlobDraft<E, R>[];\n} {\n const drafts: RecordAttachmentBlobDraft<E, R>[] = [];\n const materializedEntries: AssertionEntryOuter<RecordBlobRef>[] = [];\n for (const [index, sealed] of sealedEntries.entries()) {\n const source = sources[index];\n if (source === undefined) {\n throw new Error(\"Assertions producer lost a sealed entry source\");\n }\n if (source.evidence.length !== sealed.materials.evidence.length) {\n throw new Error(\"Assertions producer changed sealed evidence cardinality\");\n }\n materializedEntries.push(Object.freeze({\n entryId: sealed.entryId,\n display: sealed.display,\n criterion: outerCriterion(sealed.criterion),\n materials: Object.freeze({\n source: materializeMaterial(sealed.materials.source, source.source, blobs, drafts),\n evidence: Object.freeze(sealed.materials.evidence.map((material, evidenceIndex) => {\n const evidenceSource = source.evidence[evidenceIndex];\n if (evidenceSource === undefined) {\n throw new Error(\"Assertions producer lost a sealed evidence source\");\n }\n return materializeMaterial(material, evidenceSource, blobs, drafts);\n })),\n coverage: sealed.materials.coverage,\n limitations: sealed.materials.limitations,\n }),\n evaluation: sealed.evaluation,\n decision: sealed.decision,\n policy: sealed.policy,\n contribution: sealed.contribution,\n explanationRetention: sealed.explanationRetention,\n }));\n }\n return Object.freeze({\n payload: Object.freeze({\n entries: Object.freeze(materializedEntries),\n // Source sites are joined into this fixed family by the runner's source\n // capture before final sealing. A producer with no captured site writes\n // the exact empty sequence instead of another durable family.\n sourceSites: Object.freeze([...sourceSites]),\n }),\n blobs: Object.freeze(drafts),\n });\n}\n/**\n * Collects completed facts in declaration order, then mints every blob ref\n * inside one generic RecordAttachment write. Callers never receive a raw ref,\n * path, key, or bytes channel, so cross-Attachment closure is impossible.\n */\nexport function createAssertionsAttachmentProducer<E, R>(config: {\n readonly entryIds: AssertionsEntryIdSource;\n /** Injected by the fixed catalog consumer to avoid a catalog initialization cycle. */\n readonly write: FixedAttachmentWriteSpec<\"attempt\", AssertionsAttachment>;\n}): AssertionsAttachmentProducer<E, R> {\n const documentBuilder: AssertionsDocumentBuilder<AssertionsProvisionalBlobRef> = createAssertionsDocumentBuilder({\n documentSchema: assertionsProducerSchemas.document,\n entryIds: config.entryIds,\n });\n const sources: AssertionsAttachmentEntrySources<E, R>[] = [];\n let sealed: Either.Either<RecordAttachmentWrite<\"attempt\", E, R>, AssertionsProducerError> | undefined;\n const producer: AssertionsAttachmentProducer<E, R> = {\n append(entry) {\n const appended = documentBuilder.append(provisionalEntry(entry));\n if (Either.isRight(appended))\n sources.push(captureEntrySources(entry));\n return appended;\n },\n seal(sealInput: AssertionsAttachmentSealInput = {}) {\n if (sealed !== undefined)\n return sealed;\n const sourceSites = Object.freeze([...(sealInput.sourceSites ?? [])]);\n const emptyEntriesBytes = new TextEncoder().encode(JSON.stringify({ entries: [] })).byteLength;\n const sourceSitesFramingBytes = new TextEncoder().encode(JSON.stringify({\n entries: [],\n sourceSites,\n })).byteLength - emptyEntriesBytes;\n const document = documentBuilder.seal({\n maximumBytes: MAX_ASSERTION_DOCUMENT_BYTES - sourceSitesFramingBytes,\n });\n if (Either.isLeft(document)) {\n sealed = Either.left(document.left);\n return sealed;\n }\n const write = makeFixedRecordAttachmentWrite(config.write, (blobs) => materializeDocument(sources, document.right.entries, sourceSites, blobs));\n const closure = validateRecordAttachmentWrite(write);\n if (Either.isLeft(closure)) {\n throw new Error(\"Assertions producer generated an invalid RecordAttachment closure\");\n }\n sealed = Either.right(write);\n return sealed;\n },\n };\n return Object.freeze(producer);\n}\nexport interface AssertionsProjectorDefinition {\n readonly write: FixedAttachmentWriteSpec<\"attempt\", AssertionsAttachment>;\n readonly project: (value: RecordAttachmentPayloadSnapshot<AssertionsAttachment>) => AssertionsProjection<RecordBlobRef>;\n}\n/** Typed, synchronous projection over one already-materialized Attachment value. */\nexport function defineAssertionsProjector(registry: ThirdPartyCriterionRegistry, write: FixedAttachmentWriteSpec<\"attempt\", AssertionsAttachment>): AssertionsProjectorDefinition {\n return Object.freeze({\n write,\n project(value: RecordAttachmentPayloadSnapshot<AssertionsAttachment>) {\n return projectAssertionsDocument(value, registry);\n },\n });\n}\n"]}