@tangle-network/agent-eval 0.93.0 → 0.95.0

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 (1087) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +44 -30
  3. package/dist/action-policy.d.ts +24 -0
  4. package/dist/action-policy.d.ts.map +1 -0
  5. package/dist/action-policy.test.d.ts +2 -0
  6. package/dist/action-policy.test.d.ts.map +1 -0
  7. package/dist/active-learning.d.ts +41 -0
  8. package/dist/active-learning.d.ts.map +1 -0
  9. package/dist/adapters/http.d.ts +15 -21
  10. package/dist/adapters/http.d.ts.map +1 -0
  11. package/dist/adapters/http.js.map +1 -1
  12. package/dist/adapters/langchain.d.ts +7 -13
  13. package/dist/adapters/langchain.d.ts.map +1 -0
  14. package/dist/adapters/otel.d.ts +13 -24
  15. package/dist/adapters/otel.d.ts.map +1 -0
  16. package/dist/agent-profile-cell.d.ts +101 -0
  17. package/dist/agent-profile-cell.d.ts.map +1 -0
  18. package/dist/agent-profile.d.ts +27 -0
  19. package/dist/agent-profile.d.ts.map +1 -0
  20. package/dist/agent-profile.test.d.ts +2 -0
  21. package/dist/agent-profile.test.d.ts.map +1 -0
  22. package/dist/analyst/adapters.d.ts +62 -0
  23. package/dist/analyst/adapters.d.ts.map +1 -0
  24. package/dist/analyst/analyst.test.d.ts +2 -0
  25. package/dist/analyst/analyst.test.d.ts.map +1 -0
  26. package/dist/analyst/ax-service.d.ts +27 -0
  27. package/dist/analyst/ax-service.d.ts.map +1 -0
  28. package/dist/analyst/behavioral-analyst.d.ts +28 -0
  29. package/dist/analyst/behavioral-analyst.d.ts.map +1 -0
  30. package/dist/analyst/chat-client.d.ts +91 -0
  31. package/dist/analyst/chat-client.d.ts.map +1 -0
  32. package/dist/analyst/default-registry.d.ts +27 -0
  33. package/dist/analyst/default-registry.d.ts.map +1 -0
  34. package/dist/analyst/default-registry.test.d.ts +2 -0
  35. package/dist/analyst/default-registry.test.d.ts.map +1 -0
  36. package/dist/analyst/finding-signature.d.ts +48 -0
  37. package/dist/analyst/finding-signature.d.ts.map +1 -0
  38. package/dist/analyst/finding-subject.d.ts +146 -0
  39. package/dist/analyst/finding-subject.d.ts.map +1 -0
  40. package/dist/analyst/finding-subject.test.d.ts +2 -0
  41. package/dist/analyst/finding-subject.test.d.ts.map +1 -0
  42. package/dist/analyst/findings-store.d.ts +75 -0
  43. package/dist/analyst/findings-store.d.ts.map +1 -0
  44. package/dist/analyst/index.d.ts +28 -256
  45. package/dist/analyst/index.d.ts.map +1 -0
  46. package/dist/analyst/index.js +6 -66
  47. package/dist/analyst/index.js.map +1 -1
  48. package/dist/{kind-factory-5b7xXXOr.d.ts → analyst/kind-factory.d.ts} +11 -63
  49. package/dist/analyst/kind-factory.d.ts.map +1 -0
  50. package/dist/analyst/kinds/failure-mode.d.ts +19 -0
  51. package/dist/analyst/kinds/failure-mode.d.ts.map +1 -0
  52. package/dist/analyst/kinds/improvement.d.ts +23 -0
  53. package/dist/analyst/kinds/improvement.d.ts.map +1 -0
  54. package/dist/analyst/kinds/index.d.ts +22 -0
  55. package/dist/analyst/kinds/index.d.ts.map +1 -0
  56. package/dist/analyst/kinds/kinds.test.d.ts +2 -0
  57. package/dist/analyst/kinds/kinds.test.d.ts.map +1 -0
  58. package/dist/analyst/kinds/knowledge-gap.d.ts +28 -0
  59. package/dist/analyst/kinds/knowledge-gap.d.ts.map +1 -0
  60. package/dist/analyst/kinds/knowledge-poisoning.d.ts +22 -0
  61. package/dist/analyst/kinds/knowledge-poisoning.d.ts.map +1 -0
  62. package/dist/analyst/kinds/skill-usage.d.ts +84 -0
  63. package/dist/analyst/kinds/skill-usage.d.ts.map +1 -0
  64. package/dist/analyst/kinds/skill-usage.test.d.ts +2 -0
  65. package/dist/analyst/kinds/skill-usage.test.d.ts.map +1 -0
  66. package/dist/analyst/parse-tolerant.d.ts +26 -0
  67. package/dist/analyst/parse-tolerant.d.ts.map +1 -0
  68. package/dist/analyst/parse-tolerant.test.d.ts +2 -0
  69. package/dist/analyst/parse-tolerant.test.d.ts.map +1 -0
  70. package/dist/analyst/registry.budget.test.d.ts +2 -0
  71. package/dist/analyst/registry.budget.test.d.ts.map +1 -0
  72. package/dist/{default-registry-zoGHUQEH.d.ts → analyst/registry.d.ts} +8 -37
  73. package/dist/analyst/registry.d.ts.map +1 -0
  74. package/dist/analyst/steer-firewall.d.ts +35 -0
  75. package/dist/analyst/steer-firewall.d.ts.map +1 -0
  76. package/dist/analyst/steer-firewall.test.d.ts +2 -0
  77. package/dist/analyst/steer-firewall.test.d.ts.map +1 -0
  78. package/dist/analyst/structure-findings.d.ts +37 -0
  79. package/dist/analyst/structure-findings.d.ts.map +1 -0
  80. package/dist/analyst/structure-findings.test.d.ts +2 -0
  81. package/dist/analyst/structure-findings.test.d.ts.map +1 -0
  82. package/dist/analyst/tool-groups.d.ts +34 -0
  83. package/dist/analyst/tool-groups.d.ts.map +1 -0
  84. package/dist/{types-2VVIL04s.d.ts → analyst/types.d.ts} +19 -112
  85. package/dist/analyst/types.d.ts.map +1 -0
  86. package/dist/anti-slop.d.ts +59 -0
  87. package/dist/anti-slop.d.ts.map +1 -0
  88. package/dist/artifact-validator.d.ts +74 -0
  89. package/dist/artifact-validator.d.ts.map +1 -0
  90. package/dist/attestation.d.ts +63 -0
  91. package/dist/attestation.d.ts.map +1 -0
  92. package/dist/attestation.test.d.ts +2 -0
  93. package/dist/attestation.test.d.ts.map +1 -0
  94. package/dist/authenticity/index.d.ts +15 -16
  95. package/dist/authenticity/index.d.ts.map +1 -0
  96. package/dist/authenticity/index.test.d.ts +2 -0
  97. package/dist/authenticity/index.test.d.ts.map +1 -0
  98. package/dist/auto-pr.d.ts +120 -0
  99. package/dist/auto-pr.d.ts.map +1 -0
  100. package/dist/{baseline-DE36-Np7.d.ts → baseline.d.ts} +8 -44
  101. package/dist/baseline.d.ts.map +1 -0
  102. package/dist/behavior-dsl.d.ts +73 -0
  103. package/dist/behavior-dsl.d.ts.map +1 -0
  104. package/dist/belief-state/calibration.d.ts +10 -0
  105. package/dist/belief-state/calibration.d.ts.map +1 -0
  106. package/dist/belief-state/calibration.test.d.ts +2 -0
  107. package/dist/belief-state/calibration.test.d.ts.map +1 -0
  108. package/dist/belief-state/code-agent-corpus.d.ts +66 -0
  109. package/dist/belief-state/code-agent-corpus.d.ts.map +1 -0
  110. package/dist/belief-state/code-agent-corpus.test.d.ts +2 -0
  111. package/dist/belief-state/code-agent-corpus.test.d.ts.map +1 -0
  112. package/dist/belief-state/code-agent-evidence.d.ts +22 -0
  113. package/dist/belief-state/code-agent-evidence.d.ts.map +1 -0
  114. package/dist/belief-state/code-agent-evidence.test.d.ts +2 -0
  115. package/dist/belief-state/code-agent-evidence.test.d.ts.map +1 -0
  116. package/dist/belief-state/extract.d.ts +7 -0
  117. package/dist/belief-state/extract.d.ts.map +1 -0
  118. package/dist/belief-state/extract.test.d.ts +2 -0
  119. package/dist/belief-state/extract.test.d.ts.map +1 -0
  120. package/dist/belief-state/index.d.ts +14 -604
  121. package/dist/belief-state/index.d.ts.map +1 -0
  122. package/dist/belief-state/index.js +1 -1
  123. package/dist/belief-state/ope.d.ts +17 -0
  124. package/dist/belief-state/ope.d.ts.map +1 -0
  125. package/dist/belief-state/ope.test.d.ts +2 -0
  126. package/dist/belief-state/ope.test.d.ts.map +1 -0
  127. package/dist/belief-state/phase0-measurement.d.ts +55 -0
  128. package/dist/belief-state/phase0-measurement.d.ts.map +1 -0
  129. package/dist/belief-state/report.d.ts +17 -0
  130. package/dist/belief-state/report.d.ts.map +1 -0
  131. package/dist/belief-state/report.test.d.ts +2 -0
  132. package/dist/belief-state/report.test.d.ts.map +1 -0
  133. package/dist/belief-state/research-evidence.d.ts +23 -0
  134. package/dist/belief-state/research-evidence.d.ts.map +1 -0
  135. package/dist/belief-state/research-evidence.test.d.ts +2 -0
  136. package/dist/belief-state/research-evidence.test.d.ts.map +1 -0
  137. package/dist/belief-state/runtime-benchmark-corpus.d.ts +32 -0
  138. package/dist/belief-state/runtime-benchmark-corpus.d.ts.map +1 -0
  139. package/dist/belief-state/runtime-hooks.d.ts +87 -0
  140. package/dist/belief-state/runtime-hooks.d.ts.map +1 -0
  141. package/dist/belief-state/runtime-hooks.test.d.ts +2 -0
  142. package/dist/belief-state/runtime-hooks.test.d.ts.map +1 -0
  143. package/dist/belief-state/selective.d.ts +15 -0
  144. package/dist/belief-state/selective.d.ts.map +1 -0
  145. package/dist/belief-state/selective.test.d.ts +2 -0
  146. package/dist/belief-state/selective.test.d.ts.map +1 -0
  147. package/dist/belief-state/shadow-probe.d.ts +80 -0
  148. package/dist/belief-state/shadow-probe.d.ts.map +1 -0
  149. package/dist/belief-state/shadow-probe.test.d.ts +2 -0
  150. package/dist/belief-state/shadow-probe.test.d.ts.map +1 -0
  151. package/dist/belief-state/types.d.ts +195 -0
  152. package/dist/belief-state/types.d.ts.map +1 -0
  153. package/dist/belief-state/types.test.d.ts +2 -0
  154. package/dist/belief-state/types.test.d.ts.map +1 -0
  155. package/dist/benchmark.d.ts +14 -0
  156. package/dist/benchmark.d.ts.map +1 -0
  157. package/dist/benchmarks/index.d.ts +23 -4
  158. package/dist/benchmarks/index.d.ts.map +1 -0
  159. package/dist/benchmarks/routing/dataset.d.ts +34 -0
  160. package/dist/benchmarks/routing/dataset.d.ts.map +1 -0
  161. package/dist/benchmarks/routing/index.d.ts +34 -0
  162. package/dist/benchmarks/routing/index.d.ts.map +1 -0
  163. package/dist/benchmarks/types.d.ts +49 -0
  164. package/dist/benchmarks/types.d.ts.map +1 -0
  165. package/dist/bisector.d.ts +81 -0
  166. package/dist/bisector.d.ts.map +1 -0
  167. package/dist/budget-guard.d.ts +31 -0
  168. package/dist/budget-guard.d.ts.map +1 -0
  169. package/dist/builder-eval/builder-session.d.ts +111 -0
  170. package/dist/builder-eval/builder-session.d.ts.map +1 -0
  171. package/dist/builder-eval/correlation.d.ts +32 -0
  172. package/dist/builder-eval/correlation.d.ts.map +1 -0
  173. package/dist/builder-eval/index.d.ts +5 -250
  174. package/dist/builder-eval/index.d.ts.map +1 -0
  175. package/dist/builder-eval/index.js +2 -2
  176. package/dist/builder-eval/project-registry.d.ts +51 -0
  177. package/dist/builder-eval/project-registry.d.ts.map +1 -0
  178. package/dist/builder-eval/three-layer-eval.d.ts +55 -0
  179. package/dist/builder-eval/three-layer-eval.d.ts.map +1 -0
  180. package/dist/campaign/analyst-surface.d.ts +108 -0
  181. package/dist/campaign/analyst-surface.d.ts.map +1 -0
  182. package/dist/campaign/analyst-surface.test.d.ts +2 -0
  183. package/dist/campaign/analyst-surface.test.d.ts.map +1 -0
  184. package/dist/campaign/auto-pr.d.ts +46 -0
  185. package/dist/campaign/auto-pr.d.ts.map +1 -0
  186. package/dist/campaign/distillation/agreement-judge.d.ts +69 -0
  187. package/dist/campaign/distillation/agreement-judge.d.ts.map +1 -0
  188. package/dist/campaign/distillation/cli.d.ts +35 -0
  189. package/dist/campaign/distillation/cli.d.ts.map +1 -0
  190. package/dist/campaign/distillation/distillation.test.d.ts +2 -0
  191. package/dist/campaign/distillation/distillation.test.d.ts.map +1 -0
  192. package/dist/campaign/distillation/gold-scenarios.d.ts +54 -0
  193. package/dist/campaign/distillation/gold-scenarios.d.ts.map +1 -0
  194. package/dist/campaign/distillation/run-distillation.d.ts +119 -0
  195. package/dist/campaign/distillation/run-distillation.d.ts.map +1 -0
  196. package/dist/campaign/gates/compose.d.ts +12 -0
  197. package/dist/campaign/gates/compose.d.ts.map +1 -0
  198. package/dist/campaign/gates/default-production-gate.d.ts +58 -0
  199. package/dist/campaign/gates/default-production-gate.d.ts.map +1 -0
  200. package/dist/campaign/gates/heldout-gate.d.ts +12 -0
  201. package/dist/campaign/gates/heldout-gate.d.ts.map +1 -0
  202. package/dist/campaign/gates/promotion-policy.d.ts +125 -0
  203. package/dist/campaign/gates/promotion-policy.d.ts.map +1 -0
  204. package/dist/campaign/gates/promotion-policy.test.d.ts +2 -0
  205. package/dist/campaign/gates/promotion-policy.test.d.ts.map +1 -0
  206. package/dist/campaign/gates/sequential.d.ts +146 -0
  207. package/dist/campaign/gates/sequential.d.ts.map +1 -0
  208. package/dist/campaign/gates/sequential.test.d.ts +2 -0
  209. package/dist/campaign/gates/sequential.test.d.ts.map +1 -0
  210. package/dist/campaign/gates/statistical-heldout.d.ts +99 -0
  211. package/dist/campaign/gates/statistical-heldout.d.ts.map +1 -0
  212. package/dist/campaign/gates/statistical-heldout.test.d.ts +2 -0
  213. package/dist/campaign/gates/statistical-heldout.test.d.ts.map +1 -0
  214. package/dist/campaign/index.d.ts +38 -1341
  215. package/dist/campaign/index.d.ts.map +1 -0
  216. package/dist/campaign/index.js +1865 -1318
  217. package/dist/campaign/index.js.map +1 -1
  218. package/dist/campaign/labeled-store/fs-adapter.d.ts +59 -0
  219. package/dist/campaign/labeled-store/fs-adapter.d.ts.map +1 -0
  220. package/dist/campaign/presets/compare-proposers.d.ts +146 -0
  221. package/dist/campaign/presets/compare-proposers.d.ts.map +1 -0
  222. package/dist/campaign/presets/playback.d.ts +120 -0
  223. package/dist/campaign/presets/playback.d.ts.map +1 -0
  224. package/dist/campaign/presets/playback.test.d.ts +2 -0
  225. package/dist/campaign/presets/playback.test.d.ts.map +1 -0
  226. package/dist/campaign/presets/run-eval.d.ts +14 -0
  227. package/dist/campaign/presets/run-eval.d.ts.map +1 -0
  228. package/dist/campaign/presets/run-improvement-loop.d.ts +63 -0
  229. package/dist/campaign/presets/run-improvement-loop.d.ts.map +1 -0
  230. package/dist/campaign/presets/run-improvement-loop.test.d.ts +2 -0
  231. package/dist/campaign/presets/run-improvement-loop.test.d.ts.map +1 -0
  232. package/dist/campaign/presets/run-optimization.d.ts +92 -0
  233. package/dist/campaign/presets/run-optimization.d.ts.map +1 -0
  234. package/dist/campaign/presets/run-profile-matrix.d.ts +151 -0
  235. package/dist/campaign/presets/run-profile-matrix.d.ts.map +1 -0
  236. package/dist/campaign/presets/run-skill-opt.d.ts +96 -0
  237. package/dist/campaign/presets/run-skill-opt.d.ts.map +1 -0
  238. package/dist/campaign/proposers/_findings-text.d.ts +22 -0
  239. package/dist/campaign/proposers/_findings-text.d.ts.map +1 -0
  240. package/dist/campaign/proposers/ace.d.ts +33 -0
  241. package/dist/campaign/proposers/ace.d.ts.map +1 -0
  242. package/dist/campaign/proposers/ace.test.d.ts +2 -0
  243. package/dist/campaign/proposers/ace.test.d.ts.map +1 -0
  244. package/dist/campaign/proposers/analysis-edit.d.ts +32 -0
  245. package/dist/campaign/proposers/analysis-edit.d.ts.map +1 -0
  246. package/dist/campaign/proposers/evolutionary.d.ts +20 -0
  247. package/dist/campaign/proposers/evolutionary.d.ts.map +1 -0
  248. package/dist/campaign/proposers/fapo.d.ts +120 -0
  249. package/dist/campaign/proposers/fapo.d.ts.map +1 -0
  250. package/dist/campaign/proposers/gepa.d.ts +86 -0
  251. package/dist/campaign/proposers/gepa.d.ts.map +1 -0
  252. package/dist/campaign/proposers/halo.d.ts +44 -0
  253. package/dist/campaign/proposers/halo.d.ts.map +1 -0
  254. package/dist/campaign/proposers/halo.test.d.ts +2 -0
  255. package/dist/campaign/proposers/halo.test.d.ts.map +1 -0
  256. package/dist/campaign/proposers/memory.d.ts +47 -0
  257. package/dist/campaign/proposers/memory.d.ts.map +1 -0
  258. package/dist/campaign/proposers/memory.test.d.ts +2 -0
  259. package/dist/campaign/proposers/memory.test.d.ts.map +1 -0
  260. package/dist/campaign/proposers/skill-opt.d.ts +88 -0
  261. package/dist/campaign/proposers/skill-opt.d.ts.map +1 -0
  262. package/dist/campaign/proposers/trace-analyst.d.ts +48 -0
  263. package/dist/campaign/proposers/trace-analyst.d.ts.map +1 -0
  264. package/dist/campaign/proposers/trace-analyst.test.d.ts +2 -0
  265. package/dist/campaign/proposers/trace-analyst.test.d.ts.map +1 -0
  266. package/dist/campaign/provenance.d.ts +185 -0
  267. package/dist/campaign/provenance.d.ts.map +1 -0
  268. package/dist/campaign/run-campaign.d.ts +90 -0
  269. package/dist/campaign/run-campaign.d.ts.map +1 -0
  270. package/dist/campaign/score-utils.d.ts +26 -0
  271. package/dist/campaign/score-utils.d.ts.map +1 -0
  272. package/dist/campaign/skill-patch.d.ts +62 -0
  273. package/dist/campaign/skill-patch.d.ts.map +1 -0
  274. package/dist/campaign/storage.d.ts +38 -0
  275. package/dist/campaign/storage.d.ts.map +1 -0
  276. package/dist/{types-BU-7W85F.d.ts → campaign/types.d.ts} +98 -99
  277. package/dist/campaign/types.d.ts.map +1 -0
  278. package/dist/campaign/worktree/index.d.ts +53 -0
  279. package/dist/campaign/worktree/index.d.ts.map +1 -0
  280. package/dist/canary.d.ts +101 -0
  281. package/dist/canary.d.ts.map +1 -0
  282. package/dist/causal-attribution.d.ts +45 -0
  283. package/dist/causal-attribution.d.ts.map +1 -0
  284. package/dist/{chunk-TWS7AZEY.js → chunk-2T4EZACH.js} +2 -2
  285. package/dist/chunk-2T4EZACH.js.map +1 -0
  286. package/dist/{chunk-LMZQ2Z4U.js → chunk-56GC6VYO.js} +126 -1
  287. package/dist/chunk-56GC6VYO.js.map +1 -0
  288. package/dist/{chunk-QG2OVF2D.js → chunk-77T4STFI.js} +154 -112
  289. package/dist/chunk-77T4STFI.js.map +1 -0
  290. package/dist/{chunk-ZFIBGEOL.js → chunk-7QTQKIDD.js} +179 -178
  291. package/dist/chunk-7QTQKIDD.js.map +1 -0
  292. package/dist/{chunk-UMMZHCPB.js → chunk-AQ5WQAIV.js} +26 -9
  293. package/dist/chunk-AQ5WQAIV.js.map +1 -0
  294. package/dist/{chunk-CVVHBFGN.js → chunk-CWNP4DV4.js} +53 -5
  295. package/dist/chunk-CWNP4DV4.js.map +1 -0
  296. package/dist/{chunk-QS3RBQPI.js → chunk-D5KBVULY.js} +2 -2
  297. package/dist/chunk-DJWX3GVS.js +81 -0
  298. package/dist/chunk-DJWX3GVS.js.map +1 -0
  299. package/dist/{chunk-S6OZEZQK.js → chunk-HMA63UEO.js} +37 -9
  300. package/dist/{chunk-S6OZEZQK.js.map → chunk-HMA63UEO.js.map} +1 -1
  301. package/dist/{chunk-UHMJT4T7.js → chunk-IZCEK2HR.js} +2 -2
  302. package/dist/{chunk-6SOJM3VR.js → chunk-KKWJD5E6.js} +21 -21
  303. package/dist/chunk-KKWJD5E6.js.map +1 -0
  304. package/dist/{chunk-KWRRMR3J.js → chunk-LO6IOIJ2.js} +10 -10
  305. package/dist/chunk-LO6IOIJ2.js.map +1 -0
  306. package/dist/{chunk-L3JOU6XM.js → chunk-NACM5RS7.js} +3 -3
  307. package/dist/{chunk-E4GH6USR.js → chunk-NZEQVRH5.js} +2 -2
  308. package/dist/chunk-NZEQVRH5.js.map +1 -0
  309. package/dist/{chunk-XY4DDNEG.js → chunk-PSWWQXHF.js} +14 -89
  310. package/dist/chunk-PSWWQXHF.js.map +1 -0
  311. package/dist/{chunk-4FBZZIYD.js → chunk-QTMYW64F.js} +2 -2
  312. package/dist/{chunk-D3V5B42D.js → chunk-S4SYLDFX.js} +7 -4
  313. package/dist/chunk-S4SYLDFX.js.map +1 -0
  314. package/dist/{chunk-47X6LRCE.js → chunk-UFSG7ACU.js} +10 -7
  315. package/dist/chunk-UFSG7ACU.js.map +1 -0
  316. package/dist/{chunk-CY6U5S3X.js → chunk-URWVKRCS.js} +2 -2
  317. package/dist/{chunk-GSH6QNNS.js → chunk-X74V6ESX.js} +102 -79
  318. package/dist/chunk-X74V6ESX.js.map +1 -0
  319. package/dist/{chunk-QAY5UIJO.js → chunk-YBIGNSCZ.js} +178 -59
  320. package/dist/chunk-YBIGNSCZ.js.map +1 -0
  321. package/dist/{chunk-Y47J2LJ3.js → chunk-Z6L6YSU6.js} +5 -5
  322. package/dist/{chunk-T375SUOZ.js → chunk-ZOPLCJSY.js} +86 -31
  323. package/dist/chunk-ZOPLCJSY.js.map +1 -0
  324. package/dist/ci-gate.d.ts +44 -0
  325. package/dist/ci-gate.d.ts.map +1 -0
  326. package/dist/cli.d.ts +2 -0
  327. package/dist/cli.d.ts.map +1 -0
  328. package/dist/cli.js +2 -2
  329. package/dist/client.d.ts +77 -0
  330. package/dist/client.d.ts.map +1 -0
  331. package/dist/client.test.d.ts +2 -0
  332. package/dist/client.test.d.ts.map +1 -0
  333. package/dist/command-runner.d.ts +74 -0
  334. package/dist/command-runner.d.ts.map +1 -0
  335. package/dist/command-runner.test.d.ts +2 -0
  336. package/dist/command-runner.test.d.ts.map +1 -0
  337. package/dist/completion-verifier.d.ts +147 -0
  338. package/dist/completion-verifier.d.ts.map +1 -0
  339. package/dist/completion-verifier.test.d.ts +9 -0
  340. package/dist/completion-verifier.test.d.ts.map +1 -0
  341. package/dist/concurrency.d.ts +23 -0
  342. package/dist/concurrency.d.ts.map +1 -0
  343. package/dist/contamination-guard.d.ts +81 -0
  344. package/dist/contamination-guard.d.ts.map +1 -0
  345. package/dist/{analyze-runs-DwCEkpO_.d.ts → contract/analyze-runs.d.ts} +9 -10
  346. package/dist/contract/analyze-runs.d.ts.map +1 -0
  347. package/dist/contract/define-agent-eval.d.ts +52 -0
  348. package/dist/contract/define-agent-eval.d.ts.map +1 -0
  349. package/dist/contract/diff.d.ts +114 -0
  350. package/dist/contract/diff.d.ts.map +1 -0
  351. package/dist/contract/index.d.ts +106 -640
  352. package/dist/contract/index.d.ts.map +1 -0
  353. package/dist/contract/index.js +131 -21
  354. package/dist/contract/index.js.map +1 -1
  355. package/dist/{insight-report-BBwvOh6x.d.ts → contract/insight-report.d.ts} +16 -19
  356. package/dist/contract/insight-report.d.ts.map +1 -0
  357. package/dist/contract/insight-types-fwd.d.ts +7 -0
  358. package/dist/contract/insight-types-fwd.d.ts.map +1 -0
  359. package/dist/contract/intake/agent-trace.d.ts +97 -0
  360. package/dist/contract/intake/agent-trace.d.ts.map +1 -0
  361. package/dist/{code-agent-session-BO8nCnv3.d.ts → contract/intake/code-agent-session.d.ts} +15 -17
  362. package/dist/contract/intake/code-agent-session.d.ts.map +1 -0
  363. package/dist/contract/intake/feedback-table.d.ts +87 -0
  364. package/dist/contract/intake/feedback-table.d.ts.map +1 -0
  365. package/dist/contract/intake/index.d.ts +22 -0
  366. package/dist/contract/intake/index.d.ts.map +1 -0
  367. package/dist/contract/intake/otel-spans.d.ts +33 -0
  368. package/dist/contract/intake/otel-spans.d.ts.map +1 -0
  369. package/dist/contract/self-improve.d.ts +284 -0
  370. package/dist/contract/self-improve.d.ts.map +1 -0
  371. package/dist/{control-runtime-DuFBYg7A.d.ts → control-runtime.d.ts} +23 -26
  372. package/dist/control-runtime.d.ts.map +1 -0
  373. package/dist/control-runtime.test.d.ts +2 -0
  374. package/dist/control-runtime.test.d.ts.map +1 -0
  375. package/dist/control.d.ts +11 -9
  376. package/dist/control.d.ts.map +1 -0
  377. package/dist/control.js +2 -2
  378. package/dist/convergence.d.ts +29 -0
  379. package/dist/convergence.d.ts.map +1 -0
  380. package/dist/{cost-ledger-DuSqlw5B.d.ts → cost-ledger.d.ts} +10 -11
  381. package/dist/cost-ledger.d.ts.map +1 -0
  382. package/dist/cost-ledger.test.d.ts +2 -0
  383. package/dist/cost-ledger.test.d.ts.map +1 -0
  384. package/dist/cost-report.d.ts +43 -0
  385. package/dist/cost-report.d.ts.map +1 -0
  386. package/dist/cost-report.test.d.ts +2 -0
  387. package/dist/cost-report.test.d.ts.map +1 -0
  388. package/dist/cost-tracker.d.ts +76 -0
  389. package/dist/cost-tracker.d.ts.map +1 -0
  390. package/dist/{counterfactual-Dwibr5IW.d.ts → counterfactual.d.ts} +12 -13
  391. package/dist/counterfactual.d.ts.map +1 -0
  392. package/dist/cross-trace-diff.d.ts +56 -0
  393. package/dist/cross-trace-diff.d.ts.map +1 -0
  394. package/dist/{dataset-BbGkaN2I.d.ts → dataset.d.ts} +11 -14
  395. package/dist/dataset.d.ts.map +1 -0
  396. package/dist/deploy-gate-layer.d.ts +125 -0
  397. package/dist/deploy-gate-layer.d.ts.map +1 -0
  398. package/dist/deploy-gate-layer.test.d.ts +2 -0
  399. package/dist/deploy-gate-layer.test.d.ts.map +1 -0
  400. package/dist/description-length-gate.d.ts +119 -0
  401. package/dist/description-length-gate.d.ts.map +1 -0
  402. package/dist/detectors/edge.test.d.ts +2 -0
  403. package/dist/detectors/edge.test.d.ts.map +1 -0
  404. package/dist/detectors/index.d.ts +81 -0
  405. package/dist/detectors/index.d.ts.map +1 -0
  406. package/dist/detectors/index.test.d.ts +2 -0
  407. package/dist/detectors/index.test.d.ts.map +1 -0
  408. package/dist/diagnose/causal-sweep.d.ts +100 -0
  409. package/dist/diagnose/causal-sweep.d.ts.map +1 -0
  410. package/dist/diagnose/index.d.ts +36 -0
  411. package/dist/diagnose/index.d.ts.map +1 -0
  412. package/dist/diagnose/remediation.d.ts +68 -0
  413. package/dist/diagnose/remediation.d.ts.map +1 -0
  414. package/dist/diagnose/repair.d.ts +77 -0
  415. package/dist/diagnose/repair.d.ts.map +1 -0
  416. package/dist/diagnose.d.ts +1 -251
  417. package/dist/diagnose.js +2 -2
  418. package/dist/discover-personas.d.ts +35 -0
  419. package/dist/discover-personas.d.ts.map +1 -0
  420. package/dist/driver.d.ts +95 -0
  421. package/dist/driver.d.ts.map +1 -0
  422. package/dist/driver.test.d.ts +8 -0
  423. package/dist/driver.test.d.ts.map +1 -0
  424. package/dist/dual-agent-bench.d.ts +81 -0
  425. package/dist/dual-agent-bench.d.ts.map +1 -0
  426. package/dist/error-count-extractor.d.ts +47 -0
  427. package/dist/error-count-extractor.d.ts.map +1 -0
  428. package/dist/error-count-extractor.test.d.ts +2 -0
  429. package/dist/error-count-extractor.test.d.ts.map +1 -0
  430. package/dist/{errors-CzMUYo7b.d.ts → errors.d.ts} +10 -11
  431. package/dist/errors.d.ts.map +1 -0
  432. package/dist/{researcher-DE6Gpnb4.d.ts → eval-campaign.d.ts} +34 -156
  433. package/dist/eval-campaign.d.ts.map +1 -0
  434. package/dist/eval-campaign.test.d.ts +2 -0
  435. package/dist/eval-campaign.test.d.ts.map +1 -0
  436. package/dist/eval-tools.d.ts +55 -0
  437. package/dist/eval-tools.d.ts.map +1 -0
  438. package/dist/eval-trace-store.d.ts +107 -0
  439. package/dist/eval-trace-store.d.ts.map +1 -0
  440. package/dist/eval-trace-store.test.d.ts +2 -0
  441. package/dist/eval-trace-store.test.d.ts.map +1 -0
  442. package/dist/executor.d.ts +38 -0
  443. package/dist/executor.d.ts.map +1 -0
  444. package/dist/executor.test.d.ts +10 -0
  445. package/dist/executor.test.d.ts.map +1 -0
  446. package/dist/experiment-tracker.d.ts +178 -0
  447. package/dist/experiment-tracker.d.ts.map +1 -0
  448. package/dist/experiment-tracker.test.d.ts +2 -0
  449. package/dist/experiment-tracker.test.d.ts.map +1 -0
  450. package/dist/failure-taxonomy.d.ts +38 -0
  451. package/dist/failure-taxonomy.d.ts.map +1 -0
  452. package/dist/{feedback-trajectory-D9OVLrg9.d.ts → feedback-trajectory.d.ts} +36 -38
  453. package/dist/feedback-trajectory.d.ts.map +1 -0
  454. package/dist/feedback-trajectory.test.d.ts +2 -0
  455. package/dist/feedback-trajectory.test.d.ts.map +1 -0
  456. package/dist/flow-layer.d.ts +90 -0
  457. package/dist/flow-layer.d.ts.map +1 -0
  458. package/dist/flow-layer.test.d.ts +2 -0
  459. package/dist/flow-layer.test.d.ts.map +1 -0
  460. package/dist/fuzz/capsule.d.ts +46 -0
  461. package/dist/fuzz/capsule.d.ts.map +1 -0
  462. package/dist/fuzz/cube.d.ts +36 -0
  463. package/dist/fuzz/cube.d.ts.map +1 -0
  464. package/dist/fuzz/explorer-cost.test.d.ts +2 -0
  465. package/dist/fuzz/explorer-cost.test.d.ts.map +1 -0
  466. package/dist/fuzz/explorer.d.ts +64 -0
  467. package/dist/fuzz/explorer.d.ts.map +1 -0
  468. package/dist/fuzz/fuzz-agent.d.ts +16 -0
  469. package/dist/fuzz/fuzz-agent.d.ts.map +1 -0
  470. package/dist/fuzz/fuzz-agent.test.d.ts +2 -0
  471. package/dist/fuzz/fuzz-agent.test.d.ts.map +1 -0
  472. package/dist/fuzz/gates.d.ts +33 -0
  473. package/dist/fuzz/gates.d.ts.map +1 -0
  474. package/dist/fuzz/index.d.ts +26 -0
  475. package/dist/fuzz/index.d.ts.map +1 -0
  476. package/dist/fuzz/policies.d.ts +28 -0
  477. package/dist/fuzz/policies.d.ts.map +1 -0
  478. package/dist/fuzz/tools.d.ts +20 -0
  479. package/dist/fuzz/tools.d.ts.map +1 -0
  480. package/dist/fuzz/types.d.ts +307 -0
  481. package/dist/fuzz/types.d.ts.map +1 -0
  482. package/dist/fuzz.d.ts +1 -547
  483. package/dist/golden-matcher.d.ts +71 -0
  484. package/dist/golden-matcher.d.ts.map +1 -0
  485. package/dist/governance/eu-ai-act.d.ts +37 -0
  486. package/dist/governance/eu-ai-act.d.ts.map +1 -0
  487. package/dist/governance/index.d.ts +5 -135
  488. package/dist/governance/index.d.ts.map +1 -0
  489. package/dist/governance/nist-ai-rmf.d.ts +15 -0
  490. package/dist/governance/nist-ai-rmf.d.ts.map +1 -0
  491. package/dist/governance/soc2.d.ts +12 -0
  492. package/dist/governance/soc2.d.ts.map +1 -0
  493. package/dist/governance/types.d.ts +66 -0
  494. package/dist/governance/types.d.ts.map +1 -0
  495. package/dist/harness-optimizer.d.ts +82 -0
  496. package/dist/harness-optimizer.d.ts.map +1 -0
  497. package/dist/held-out-gate.d.ts +135 -0
  498. package/dist/held-out-gate.d.ts.map +1 -0
  499. package/dist/hosted/client.d.ts +73 -0
  500. package/dist/hosted/client.d.ts.map +1 -0
  501. package/dist/hosted/from-env.test.d.ts +8 -0
  502. package/dist/hosted/from-env.test.d.ts.map +1 -0
  503. package/dist/hosted/index.d.ts +10 -238
  504. package/dist/hosted/index.d.ts.map +1 -0
  505. package/dist/hosted/types.d.ts +159 -0
  506. package/dist/hosted/types.d.ts.map +1 -0
  507. package/dist/index.d.ts +277 -5643
  508. package/dist/index.d.ts.map +1 -0
  509. package/dist/index.js +317 -108
  510. package/dist/index.js.map +1 -1
  511. package/dist/integrity/backend-integrity.d.ts +71 -0
  512. package/dist/integrity/backend-integrity.d.ts.map +1 -0
  513. package/dist/integrity/preflight.d.ts +72 -0
  514. package/dist/integrity/preflight.d.ts.map +1 -0
  515. package/dist/integrity/preflight.test.d.ts +2 -0
  516. package/dist/integrity/preflight.test.d.ts.map +1 -0
  517. package/dist/integrity/single-backend.d.ts +67 -0
  518. package/dist/integrity/single-backend.d.ts.map +1 -0
  519. package/dist/intent-match-judge.d.ts +69 -0
  520. package/dist/intent-match-judge.d.ts.map +1 -0
  521. package/dist/intent-match-judge.test.d.ts +2 -0
  522. package/dist/intent-match-judge.test.d.ts.map +1 -0
  523. package/dist/{judge-calibration-0p2QcWNE.d.ts → judge-calibration.d.ts} +16 -17
  524. package/dist/judge-calibration.d.ts.map +1 -0
  525. package/dist/judge-ensemble.d.ts +66 -0
  526. package/dist/judge-ensemble.d.ts.map +1 -0
  527. package/dist/judge-ensemble.test.d.ts +8 -0
  528. package/dist/judge-ensemble.test.d.ts.map +1 -0
  529. package/dist/judge-families.d.ts +38 -0
  530. package/dist/judge-families.d.ts.map +1 -0
  531. package/dist/judge-panel.d.ts +65 -0
  532. package/dist/judge-panel.d.ts.map +1 -0
  533. package/dist/judge-retry.d.ts +70 -0
  534. package/dist/judge-retry.d.ts.map +1 -0
  535. package/dist/judge-runner.d.ts +36 -0
  536. package/dist/judge-runner.d.ts.map +1 -0
  537. package/dist/judge-runner.test.d.ts +2 -0
  538. package/dist/judge-runner.test.d.ts.map +1 -0
  539. package/dist/judges.d.ts +74 -0
  540. package/dist/judges.d.ts.map +1 -0
  541. package/dist/keyword-coverage-judge.d.ts +89 -0
  542. package/dist/keyword-coverage-judge.d.ts.map +1 -0
  543. package/dist/keyword-coverage-judge.test.d.ts +2 -0
  544. package/dist/keyword-coverage-judge.test.d.ts.map +1 -0
  545. package/dist/knowledge/index.d.ts +3 -103
  546. package/dist/knowledge/index.d.ts.map +1 -0
  547. package/dist/knowledge/readiness.d.ts +26 -0
  548. package/dist/knowledge/readiness.d.ts.map +1 -0
  549. package/dist/knowledge/types.d.ts +75 -0
  550. package/dist/knowledge/types.d.ts.map +1 -0
  551. package/dist/live-proof.d.ts +62 -0
  552. package/dist/live-proof.d.ts.map +1 -0
  553. package/dist/{llm-client-BeEcAokY.d.ts → llm-client.d.ts} +52 -23
  554. package/dist/llm-client.d.ts.map +1 -0
  555. package/dist/llm-client.test.d.ts +2 -0
  556. package/dist/llm-client.test.d.ts.map +1 -0
  557. package/dist/locked-jsonl-appender.d.ts +19 -0
  558. package/dist/locked-jsonl-appender.d.ts.map +1 -0
  559. package/dist/matrix/aggregation.d.ts +16 -0
  560. package/dist/matrix/aggregation.d.ts.map +1 -0
  561. package/dist/matrix/index.d.ts +12 -30
  562. package/dist/matrix/index.d.ts.map +1 -0
  563. package/dist/matrix/runner.d.ts +15 -0
  564. package/dist/matrix/runner.d.ts.map +1 -0
  565. package/dist/{types-mn5Aqk7x.d.ts → matrix/types.d.ts} +11 -15
  566. package/dist/matrix/types.d.ts.map +1 -0
  567. package/dist/meta-eval/calibration.d.ts +47 -0
  568. package/dist/meta-eval/calibration.d.ts.map +1 -0
  569. package/dist/meta-eval/correlation-study.d.ts +53 -0
  570. package/dist/meta-eval/correlation-study.d.ts.map +1 -0
  571. package/dist/meta-eval/index.d.ts +6 -181
  572. package/dist/meta-eval/index.d.ts.map +1 -0
  573. package/dist/meta-eval/index.js +1 -1
  574. package/dist/{outcome-store-rnXLEqSn.d.ts → meta-eval/outcome-store.d.ts} +7 -8
  575. package/dist/meta-eval/outcome-store.d.ts.map +1 -0
  576. package/dist/{rubric-predictive-validity-Cy_W-hWZ.d.ts → meta-eval/rubric-predictive-validity.d.ts} +8 -11
  577. package/dist/meta-eval/rubric-predictive-validity.d.ts.map +1 -0
  578. package/dist/meta-eval/sentinel.d.ts +169 -0
  579. package/dist/meta-eval/sentinel.d.ts.map +1 -0
  580. package/dist/metrics.d.ts +63 -0
  581. package/dist/metrics.d.ts.map +1 -0
  582. package/dist/model-seats.d.ts +71 -0
  583. package/dist/model-seats.d.ts.map +1 -0
  584. package/dist/model-seats.test.d.ts +2 -0
  585. package/dist/model-seats.test.d.ts.map +1 -0
  586. package/dist/muffled-gate-scanner.d.ts +102 -0
  587. package/dist/muffled-gate-scanner.d.ts.map +1 -0
  588. package/dist/{multi-layer-verifier-DUZXrPDA.d.ts → multi-layer-verifier.d.ts} +12 -15
  589. package/dist/multi-layer-verifier.d.ts.map +1 -0
  590. package/dist/multi-layer-verifier.test.d.ts +2 -0
  591. package/dist/multi-layer-verifier.test.d.ts.map +1 -0
  592. package/dist/multi-toolchain-layer.d.ts +80 -0
  593. package/dist/multi-toolchain-layer.d.ts.map +1 -0
  594. package/dist/multi-toolchain-layer.test.d.ts +2 -0
  595. package/dist/multi-toolchain-layer.test.d.ts.map +1 -0
  596. package/dist/multishot/default-tools.d.ts +34 -0
  597. package/dist/multishot/default-tools.d.ts.map +1 -0
  598. package/dist/multishot/index.d.ts +7 -290
  599. package/dist/multishot/index.d.ts.map +1 -0
  600. package/dist/multishot/index.js.map +1 -1
  601. package/dist/multishot/judges.d.ts +32 -0
  602. package/dist/multishot/judges.d.ts.map +1 -0
  603. package/dist/multishot/matrix.d.ts +107 -0
  604. package/dist/multishot/matrix.d.ts.map +1 -0
  605. package/dist/multishot/multishot.d.ts +23 -0
  606. package/dist/multishot/multishot.d.ts.map +1 -0
  607. package/dist/multishot/router.d.ts +37 -0
  608. package/dist/multishot/router.d.ts.map +1 -0
  609. package/dist/multishot/types.d.ts +60 -0
  610. package/dist/multishot/types.d.ts.map +1 -0
  611. package/dist/observability.d.ts +71 -0
  612. package/dist/observability.d.ts.map +1 -0
  613. package/dist/openapi.json +1 -1
  614. package/dist/oracle.d.ts +55 -0
  615. package/dist/oracle.d.ts.map +1 -0
  616. package/dist/orthogonality.d.ts +35 -0
  617. package/dist/orthogonality.d.ts.map +1 -0
  618. package/dist/otel-pipeline.d.ts +31 -0
  619. package/dist/otel-pipeline.d.ts.map +1 -0
  620. package/dist/paraphrase.d.ts +107 -0
  621. package/dist/paraphrase.d.ts.map +1 -0
  622. package/dist/{pareto-E-pembql.d.ts → pareto.d.ts} +9 -10
  623. package/dist/pareto.d.ts.map +1 -0
  624. package/dist/partition-held-out.d.ts +70 -0
  625. package/dist/partition-held-out.d.ts.map +1 -0
  626. package/dist/partition-held-out.test.d.ts +2 -0
  627. package/dist/partition-held-out.test.d.ts.map +1 -0
  628. package/dist/perf/index.d.ts +13 -119
  629. package/dist/perf/index.d.ts.map +1 -0
  630. package/dist/perf/integrity.d.ts +30 -0
  631. package/dist/perf/integrity.d.ts.map +1 -0
  632. package/dist/perf/journey.d.ts +45 -0
  633. package/dist/perf/journey.d.ts.map +1 -0
  634. package/dist/perf/ratchet.d.ts +47 -0
  635. package/dist/perf/ratchet.d.ts.map +1 -0
  636. package/dist/pipelines/budget-breach.d.ts +31 -0
  637. package/dist/pipelines/budget-breach.d.ts.map +1 -0
  638. package/dist/pipelines/budget-breach.test.d.ts +2 -0
  639. package/dist/pipelines/budget-breach.test.d.ts.map +1 -0
  640. package/dist/pipelines/failure-cluster.d.ts +38 -0
  641. package/dist/pipelines/failure-cluster.d.ts.map +1 -0
  642. package/dist/pipelines/failure-cluster.test.d.ts +2 -0
  643. package/dist/pipelines/failure-cluster.test.d.ts.map +1 -0
  644. package/dist/pipelines/first-divergence.d.ts +26 -0
  645. package/dist/pipelines/first-divergence.d.ts.map +1 -0
  646. package/dist/pipelines/first-divergence.test.d.ts +2 -0
  647. package/dist/pipelines/first-divergence.test.d.ts.map +1 -0
  648. package/dist/pipelines/index.d.ts +8 -173
  649. package/dist/pipelines/index.d.ts.map +1 -0
  650. package/dist/pipelines/index.js +40 -15
  651. package/dist/pipelines/index.js.map +1 -1
  652. package/dist/pipelines/judge-agreement.d.ts +26 -0
  653. package/dist/pipelines/judge-agreement.d.ts.map +1 -0
  654. package/dist/pipelines/judge-agreement.test.d.ts +2 -0
  655. package/dist/pipelines/judge-agreement.test.d.ts.map +1 -0
  656. package/dist/pipelines/regression.d.ts +23 -0
  657. package/dist/pipelines/regression.d.ts.map +1 -0
  658. package/dist/pipelines/regression.test.d.ts +2 -0
  659. package/dist/pipelines/regression.test.d.ts.map +1 -0
  660. package/dist/pipelines/stuck-loop.d.ts +32 -0
  661. package/dist/pipelines/stuck-loop.d.ts.map +1 -0
  662. package/dist/pipelines/stuck-loop.test.d.ts +2 -0
  663. package/dist/pipelines/stuck-loop.test.d.ts.map +1 -0
  664. package/dist/pipelines/tool-waste.d.ts +34 -0
  665. package/dist/pipelines/tool-waste.d.ts.map +1 -0
  666. package/dist/pipelines/tool-waste.test.d.ts +2 -0
  667. package/dist/pipelines/tool-waste.test.d.ts.map +1 -0
  668. package/dist/playbook.d.ts +16 -0
  669. package/dist/playbook.d.ts.map +1 -0
  670. package/dist/pr-review-benchmark.d.ts +88 -0
  671. package/dist/pr-review-benchmark.d.ts.map +1 -0
  672. package/dist/pr-review-benchmark.test.d.ts +2 -0
  673. package/dist/pr-review-benchmark.test.d.ts.map +1 -0
  674. package/dist/pre-registration.d.ts +125 -0
  675. package/dist/pre-registration.d.ts.map +1 -0
  676. package/dist/prm/builtin-rubrics.d.ts +33 -0
  677. package/dist/prm/builtin-rubrics.d.ts.map +1 -0
  678. package/dist/prm/index.d.ts +5 -100
  679. package/dist/prm/index.d.ts.map +1 -0
  680. package/dist/prm/index.js +55 -12
  681. package/dist/prm/index.js.map +1 -1
  682. package/dist/prm/inference.d.ts +29 -0
  683. package/dist/prm/inference.d.ts.map +1 -0
  684. package/dist/prm/inference.test.d.ts +2 -0
  685. package/dist/prm/inference.test.d.ts.map +1 -0
  686. package/dist/{rubric-BOfxn4ja.d.ts → prm/rubric.d.ts} +10 -13
  687. package/dist/prm/rubric.d.ts.map +1 -0
  688. package/dist/prm/training-export.d.ts +38 -0
  689. package/dist/prm/training-export.d.ts.map +1 -0
  690. package/dist/produced-state.d.ts +63 -0
  691. package/dist/produced-state.d.ts.map +1 -0
  692. package/dist/produced-state.test.d.ts +8 -0
  693. package/dist/produced-state.test.d.ts.map +1 -0
  694. package/dist/profile/baselines.d.ts +37 -0
  695. package/dist/profile/baselines.d.ts.map +1 -0
  696. package/dist/profile/index.d.ts +105 -0
  697. package/dist/profile/index.d.ts.map +1 -0
  698. package/dist/promotion-gate.d.ts +93 -0
  699. package/dist/promotion-gate.d.ts.map +1 -0
  700. package/dist/prompt-registry.d.ts +41 -0
  701. package/dist/prompt-registry.d.ts.map +1 -0
  702. package/dist/propose-review-control.d.ts +49 -0
  703. package/dist/propose-review-control.d.ts.map +1 -0
  704. package/dist/propose-review-control.test.d.ts +2 -0
  705. package/dist/propose-review-control.test.d.ts.map +1 -0
  706. package/dist/propose-review.d.ts +155 -0
  707. package/dist/propose-review.d.ts.map +1 -0
  708. package/dist/{red-team-BXHil6c8.d.ts → red-team.d.ts} +14 -16
  709. package/dist/red-team.d.ts.map +1 -0
  710. package/dist/reference-replay-steering.d.ts +11 -0
  711. package/dist/reference-replay-steering.d.ts.map +1 -0
  712. package/dist/reference-replay.d.ts +176 -0
  713. package/dist/reference-replay.d.ts.map +1 -0
  714. package/dist/reflective-mutation.d.ts +79 -0
  715. package/dist/reflective-mutation.d.ts.map +1 -0
  716. package/dist/registry.d.ts +31 -0
  717. package/dist/registry.d.ts.map +1 -0
  718. package/dist/release-confidence.d.ts +128 -0
  719. package/dist/release-confidence.d.ts.map +1 -0
  720. package/dist/release-report.d.ts +11 -0
  721. package/dist/release-report.d.ts.map +1 -0
  722. package/dist/replay.d.ts +120 -0
  723. package/dist/replay.d.ts.map +1 -0
  724. package/dist/reporter.d.ts +14 -0
  725. package/dist/reporter.d.ts.map +1 -0
  726. package/dist/reporting.d.ts +15 -15
  727. package/dist/reporting.d.ts.map +1 -0
  728. package/dist/reporting.js +3 -3
  729. package/dist/researcher.d.ts +140 -0
  730. package/dist/researcher.d.ts.map +1 -0
  731. package/dist/reviewer.d.ts +118 -0
  732. package/dist/reviewer.d.ts.map +1 -0
  733. package/dist/reviewer.test.d.ts +2 -0
  734. package/dist/reviewer.test.d.ts.map +1 -0
  735. package/dist/reward-model-export.d.ts +60 -0
  736. package/dist/reward-model-export.d.ts.map +1 -0
  737. package/dist/rl/active-curriculum.d.ts +110 -0
  738. package/dist/rl/active-curriculum.d.ts.map +1 -0
  739. package/dist/rl/adaptation-eval.d.ts +109 -0
  740. package/dist/rl/adaptation-eval.d.ts.map +1 -0
  741. package/dist/{adversarial-DIVcDoI_.d.ts → rl/adversarial.d.ts} +6 -7
  742. package/dist/rl/adversarial.d.ts.map +1 -0
  743. package/dist/rl/compute-curves.d.ts +127 -0
  744. package/dist/rl/compute-curves.d.ts.map +1 -0
  745. package/dist/rl/contamination.d.ts +117 -0
  746. package/dist/rl/contamination.d.ts.map +1 -0
  747. package/dist/rl/corpus.d.ts +55 -0
  748. package/dist/rl/corpus.d.ts.map +1 -0
  749. package/dist/rl/corpus.test.d.ts +2 -0
  750. package/dist/rl/corpus.test.d.ts.map +1 -0
  751. package/dist/rl/dataset.d.ts +102 -0
  752. package/dist/rl/dataset.d.ts.map +1 -0
  753. package/dist/rl/dataset.test.d.ts +2 -0
  754. package/dist/rl/dataset.test.d.ts.map +1 -0
  755. package/dist/rl/exporters.d.ts +141 -0
  756. package/dist/rl/exporters.d.ts.map +1 -0
  757. package/dist/rl/index.d.ts +49 -0
  758. package/dist/rl/index.d.ts.map +1 -0
  759. package/dist/{off-policy-DiwuKKg7.d.ts → rl/off-policy.d.ts} +8 -9
  760. package/dist/rl/off-policy.d.ts.map +1 -0
  761. package/dist/rl/predictive-validity-researcher.d.ts +69 -0
  762. package/dist/rl/predictive-validity-researcher.d.ts.map +1 -0
  763. package/dist/rl/preferences.d.ts +141 -0
  764. package/dist/rl/preferences.d.ts.map +1 -0
  765. package/dist/rl/process-reward.d.ts +122 -0
  766. package/dist/rl/process-reward.d.ts.map +1 -0
  767. package/dist/rl/reward-hacking.d.ts +104 -0
  768. package/dist/rl/reward-hacking.d.ts.map +1 -0
  769. package/dist/rl/rl-campaign.d.ts +85 -0
  770. package/dist/rl/rl-campaign.d.ts.map +1 -0
  771. package/dist/rl/run-record-adapters.d.ts +56 -0
  772. package/dist/rl/run-record-adapters.d.ts.map +1 -0
  773. package/dist/rl/sim-fidelity.d.ts +166 -0
  774. package/dist/rl/sim-fidelity.d.ts.map +1 -0
  775. package/dist/rl/sim-fidelity.test.d.ts +2 -0
  776. package/dist/rl/sim-fidelity.test.d.ts.map +1 -0
  777. package/dist/rl/tournament.d.ts +115 -0
  778. package/dist/rl/tournament.d.ts.map +1 -0
  779. package/dist/rl/verifiable-reward.d.ts +124 -0
  780. package/dist/rl/verifiable-reward.d.ts.map +1 -0
  781. package/dist/rl.d.ts +1 -1192
  782. package/dist/rl.js +615 -615
  783. package/dist/rl.js.map +1 -1
  784. package/dist/{run-campaign-RDGAM5KJ.js → run-campaign-WXY7KI67.js} +3 -3
  785. package/dist/run-critic.d.ts +23 -0
  786. package/dist/run-critic.d.ts.map +1 -0
  787. package/dist/run-evidence.d.ts +32 -0
  788. package/dist/run-evidence.d.ts.map +1 -0
  789. package/dist/{run-record-e7vj1uZQ.d.ts → run-record.d.ts} +16 -122
  790. package/dist/run-record.d.ts.map +1 -0
  791. package/dist/run-record.test.d.ts +2 -0
  792. package/dist/run-record.test.d.ts.map +1 -0
  793. package/dist/run-score.d.ts +31 -0
  794. package/dist/run-score.d.ts.map +1 -0
  795. package/dist/runtime-trajectory.d.ts +47 -0
  796. package/dist/runtime-trajectory.d.ts.map +1 -0
  797. package/dist/{test-graded-scenario-BdVaPyHT.d.ts → sandbox-harness.d.ts} +34 -60
  798. package/dist/sandbox-harness.d.ts.map +1 -0
  799. package/dist/sandbox-harness.test.d.ts +2 -0
  800. package/dist/sandbox-harness.test.d.ts.map +1 -0
  801. package/dist/sandbox-pool.d.ts +74 -0
  802. package/dist/sandbox-pool.d.ts.map +1 -0
  803. package/dist/sandbox-pool.test.d.ts +2 -0
  804. package/dist/sandbox-pool.test.d.ts.map +1 -0
  805. package/dist/scorecard.d.ts +133 -0
  806. package/dist/scorecard.d.ts.map +1 -0
  807. package/dist/scorecard.test.d.ts +2 -0
  808. package/dist/scorecard.test.d.ts.map +1 -0
  809. package/dist/self-play.d.ts +69 -0
  810. package/dist/self-play.d.ts.map +1 -0
  811. package/dist/semantic-concept-judge.d.ts +135 -0
  812. package/dist/semantic-concept-judge.d.ts.map +1 -0
  813. package/dist/semantic-concept-judge.test.d.ts +2 -0
  814. package/dist/semantic-concept-judge.test.d.ts.map +1 -0
  815. package/dist/{sequential-5iSVfzl2.d.ts → sequential.d.ts} +9 -10
  816. package/dist/sequential.d.ts.map +1 -0
  817. package/dist/{series-convergence-D5OWMBg6.d.ts → series-convergence.d.ts} +4 -5
  818. package/dist/series-convergence.d.ts.map +1 -0
  819. package/dist/slo.d.ts +48 -0
  820. package/dist/slo.d.ts.map +1 -0
  821. package/dist/state-continuity.d.ts +47 -0
  822. package/dist/state-continuity.d.ts.map +1 -0
  823. package/dist/{statistics-C7PozGrZ.d.ts → statistics.d.ts} +152 -39
  824. package/dist/statistics.d.ts.map +1 -0
  825. package/dist/statistics.test.d.ts +2 -0
  826. package/dist/statistics.test.d.ts.map +1 -0
  827. package/dist/steering-optimizer.d.ts +58 -0
  828. package/dist/steering-optimizer.d.ts.map +1 -0
  829. package/dist/steering.d.ts +24 -0
  830. package/dist/steering.d.ts.map +1 -0
  831. package/dist/storyboard/code-edit.d.ts +64 -0
  832. package/dist/storyboard/code-edit.d.ts.map +1 -0
  833. package/dist/storyboard/code-edit.test.d.ts +2 -0
  834. package/dist/storyboard/code-edit.test.d.ts.map +1 -0
  835. package/dist/storyboard/index.d.ts +16 -81
  836. package/dist/storyboard/index.d.ts.map +1 -0
  837. package/dist/storyboard/index.test.d.ts +2 -0
  838. package/dist/storyboard/index.test.d.ts.map +1 -0
  839. package/dist/{summary-report-DGmUucwQ.d.ts → summary-report.d.ts} +23 -160
  840. package/dist/summary-report.d.ts.map +1 -0
  841. package/dist/telemetry/client.d.ts +35 -0
  842. package/dist/telemetry/client.d.ts.map +1 -0
  843. package/dist/telemetry/index.d.ts +17 -35
  844. package/dist/telemetry/index.d.ts.map +1 -0
  845. package/dist/telemetry/schema.d.ts +61 -0
  846. package/dist/telemetry/schema.d.ts.map +1 -0
  847. package/dist/telemetry/sink-fetch.d.ts +39 -0
  848. package/dist/telemetry/sink-fetch.d.ts.map +1 -0
  849. package/dist/telemetry/{file.d.ts → sink-file.d.ts} +5 -7
  850. package/dist/telemetry/sink-file.d.ts.map +1 -0
  851. package/dist/test-graded-scenario.d.ts +42 -0
  852. package/dist/test-graded-scenario.d.ts.map +1 -0
  853. package/dist/testing.d.ts +5 -0
  854. package/dist/testing.d.ts.map +1 -0
  855. package/dist/testing.js +8 -0
  856. package/dist/testing.js.map +1 -0
  857. package/dist/tool-use-metrics.d.ts +35 -0
  858. package/dist/tool-use-metrics.d.ts.map +1 -0
  859. package/dist/trace/capture-fetch.d.ts +48 -0
  860. package/dist/trace/capture-fetch.d.ts.map +1 -0
  861. package/dist/trace/capture-fetch.test.d.ts +2 -0
  862. package/dist/trace/capture-fetch.test.d.ts.map +1 -0
  863. package/dist/{emitter-DEZwY14K.d.ts → trace/emitter.d.ts} +9 -12
  864. package/dist/trace/emitter.d.ts.map +1 -0
  865. package/dist/trace/extract-usage.d.ts +46 -0
  866. package/dist/trace/extract-usage.d.ts.map +1 -0
  867. package/dist/trace/extract-usage.test.d.ts +2 -0
  868. package/dist/trace/extract-usage.test.d.ts.map +1 -0
  869. package/dist/trace/index.d.ts +15 -0
  870. package/dist/trace/index.d.ts.map +1 -0
  871. package/dist/{integrity-VJ9A7aST.d.ts → trace/integrity.d.ts} +11 -14
  872. package/dist/trace/integrity.d.ts.map +1 -0
  873. package/dist/trace/otel-bridge.d.ts +29 -0
  874. package/dist/trace/otel-bridge.d.ts.map +1 -0
  875. package/dist/trace/otel-export.d.ts +52 -0
  876. package/dist/trace/otel-export.d.ts.map +1 -0
  877. package/dist/trace/otel.d.ts +57 -0
  878. package/dist/trace/otel.d.ts.map +1 -0
  879. package/dist/trace/otlp-attributes.d.ts +17 -0
  880. package/dist/trace/otlp-attributes.d.ts.map +1 -0
  881. package/dist/trace/query.d.ts +29 -0
  882. package/dist/trace/query.d.ts.map +1 -0
  883. package/dist/trace/query.test.d.ts +2 -0
  884. package/dist/trace/query.test.d.ts.map +1 -0
  885. package/dist/{raw-provider-sink-C46HDghv.d.ts → trace/raw-provider-sink.d.ts} +13 -14
  886. package/dist/trace/raw-provider-sink.d.ts.map +1 -0
  887. package/dist/{redact-B40YG2M_.d.ts → trace/redact.d.ts} +7 -8
  888. package/dist/trace/redact.d.ts.map +1 -0
  889. package/dist/{schema-m0gsnbt3.d.ts → trace/schema.d.ts} +29 -30
  890. package/dist/trace/schema.d.ts.map +1 -0
  891. package/dist/trace/store-to-otlp.d.ts +72 -0
  892. package/dist/trace/store-to-otlp.d.ts.map +1 -0
  893. package/dist/trace/store-to-otlp.test.d.ts +2 -0
  894. package/dist/trace/store-to-otlp.test.d.ts.map +1 -0
  895. package/dist/{store-CKUAgsJz.d.ts → trace/store.d.ts} +37 -13
  896. package/dist/trace/store.d.ts.map +1 -0
  897. package/dist/trace/store.test.d.ts +2 -0
  898. package/dist/trace/store.test.d.ts.map +1 -0
  899. package/dist/{analyst-C8HHvfJp.d.ts → trace-analyst/analyst.d.ts} +12 -14
  900. package/dist/trace-analyst/analyst.d.ts.map +1 -0
  901. package/dist/trace-analyst/analyst.test.d.ts +2 -0
  902. package/dist/trace-analyst/analyst.test.d.ts.map +1 -0
  903. package/dist/trace-analyst/behavioral-metrics.d.ts +40 -0
  904. package/dist/trace-analyst/behavioral-metrics.d.ts.map +1 -0
  905. package/dist/trace-analyst/behavioral-metrics.test.d.ts +2 -0
  906. package/dist/trace-analyst/behavioral-metrics.test.d.ts.map +1 -0
  907. package/dist/trace-analyst/hook.d.ts +55 -0
  908. package/dist/trace-analyst/hook.d.ts.map +1 -0
  909. package/dist/trace-analyst/index.d.ts +18 -0
  910. package/dist/trace-analyst/index.d.ts.map +1 -0
  911. package/dist/trace-analyst/insights.d.ts +71 -0
  912. package/dist/trace-analyst/insights.d.ts.map +1 -0
  913. package/dist/trace-analyst/insights.test.d.ts +2 -0
  914. package/dist/trace-analyst/insights.test.d.ts.map +1 -0
  915. package/dist/trace-analyst/otlp-flatten.d.ts +42 -0
  916. package/dist/trace-analyst/otlp-flatten.d.ts.map +1 -0
  917. package/dist/trace-analyst/otlp-span.d.ts +85 -0
  918. package/dist/trace-analyst/otlp-span.d.ts.map +1 -0
  919. package/dist/trace-analyst/otlp-span.test.d.ts +2 -0
  920. package/dist/trace-analyst/otlp-span.test.d.ts.map +1 -0
  921. package/dist/trace-analyst/otlp-to-run-records.d.ts +115 -0
  922. package/dist/trace-analyst/otlp-to-run-records.d.ts.map +1 -0
  923. package/dist/trace-analyst/otlp-to-run-records.test.d.ts +2 -0
  924. package/dist/trace-analyst/otlp-to-run-records.test.d.ts.map +1 -0
  925. package/dist/trace-analyst/otlp-to-run-records.timestamps.test.d.ts +2 -0
  926. package/dist/trace-analyst/otlp-to-run-records.timestamps.test.d.ts.map +1 -0
  927. package/dist/trace-analyst/prompts.d.ts +6 -0
  928. package/dist/trace-analyst/prompts.d.ts.map +1 -0
  929. package/dist/trace-analyst/store-otlp.d.ts +126 -0
  930. package/dist/trace-analyst/store-otlp.d.ts.map +1 -0
  931. package/dist/trace-analyst/store-otlp.test.d.ts +8 -0
  932. package/dist/trace-analyst/store-otlp.test.d.ts.map +1 -0
  933. package/dist/trace-analyst/store-otlp.timestamps.test.d.ts +2 -0
  934. package/dist/trace-analyst/store-otlp.timestamps.test.d.ts.map +1 -0
  935. package/dist/trace-analyst/store.d.ts +63 -0
  936. package/dist/trace-analyst/store.d.ts.map +1 -0
  937. package/dist/trace-analyst/tools.d.ts +44 -0
  938. package/dist/trace-analyst/tools.d.ts.map +1 -0
  939. package/dist/trace-analyst/tools.test.d.ts +10 -0
  940. package/dist/trace-analyst/tools.test.d.ts.map +1 -0
  941. package/dist/{store-C1YxJDEK.d.ts → trace-analyst/types.d.ts} +18 -74
  942. package/dist/trace-analyst/types.d.ts.map +1 -0
  943. package/dist/trace-contracts.d.ts +180 -0
  944. package/dist/trace-contracts.d.ts.map +1 -0
  945. package/dist/traced-analyst.d.ts +26 -0
  946. package/dist/traced-analyst.d.ts.map +1 -0
  947. package/dist/traced-judges.d.ts +27 -0
  948. package/dist/traced-judges.d.ts.map +1 -0
  949. package/dist/traces.d.ts +4 -947
  950. package/dist/traces.d.ts.map +1 -0
  951. package/dist/traces.js +42 -12
  952. package/dist/{trajectory-GEdXJCL5.d.ts → trajectory.d.ts} +8 -9
  953. package/dist/trajectory.d.ts.map +1 -0
  954. package/dist/{types-Croy5h7V.d.ts → types.d.ts} +33 -33
  955. package/dist/types.d.ts.map +1 -0
  956. package/dist/ui-finding.d.ts +104 -0
  957. package/dist/ui-finding.d.ts.map +1 -0
  958. package/dist/verdict-cache.d.ts +78 -0
  959. package/dist/verdict-cache.d.ts.map +1 -0
  960. package/dist/verdict-cache.test.d.ts +2 -0
  961. package/dist/verdict-cache.test.d.ts.map +1 -0
  962. package/dist/{verdict-C9MlYujm.d.ts → verdict.d.ts} +2 -3
  963. package/dist/verdict.d.ts.map +1 -0
  964. package/dist/visual-diff.d.ts +32 -0
  965. package/dist/visual-diff.d.ts.map +1 -0
  966. package/dist/wire/handlers.d.ts +54 -0
  967. package/dist/wire/handlers.d.ts.map +1 -0
  968. package/dist/wire/index.d.ts +13 -570
  969. package/dist/wire/index.d.ts.map +1 -0
  970. package/dist/wire/index.js +2 -2
  971. package/dist/wire/openapi.d.ts +3 -0
  972. package/dist/wire/openapi.d.ts.map +1 -0
  973. package/dist/wire/rpc.d.ts +21 -0
  974. package/dist/wire/rpc.d.ts.map +1 -0
  975. package/dist/wire/rubrics.d.ts +34 -0
  976. package/dist/wire/rubrics.d.ts.map +1 -0
  977. package/dist/wire/schemas.d.ts +410 -0
  978. package/dist/wire/schemas.d.ts.map +1 -0
  979. package/dist/wire/server.d.ts +60 -0
  980. package/dist/wire/server.d.ts.map +1 -0
  981. package/dist/workflow/event-schema.d.ts +5 -0
  982. package/dist/workflow/event-schema.d.ts.map +1 -0
  983. package/dist/workflow/feedback-pack.d.ts +99 -0
  984. package/dist/workflow/feedback-pack.d.ts.map +1 -0
  985. package/dist/workflow/index.d.ts +22 -495
  986. package/dist/workflow/index.d.ts.map +1 -0
  987. package/dist/workflow/index.js +2 -2
  988. package/dist/workflow/intelligence-export.d.ts +62 -0
  989. package/dist/workflow/intelligence-export.d.ts.map +1 -0
  990. package/dist/workflow/partner-report.d.ts +49 -0
  991. package/dist/workflow/partner-report.d.ts.map +1 -0
  992. package/dist/workflow/phase-graph.d.ts +43 -0
  993. package/dist/workflow/phase-graph.d.ts.map +1 -0
  994. package/dist/workflow/promotion-gate.d.ts +61 -0
  995. package/dist/workflow/promotion-gate.d.ts.map +1 -0
  996. package/dist/workflow/run-record.d.ts +12 -0
  997. package/dist/workflow/run-record.d.ts.map +1 -0
  998. package/dist/workflow/runtime-adapter.d.ts +20 -0
  999. package/dist/workflow/runtime-adapter.d.ts.map +1 -0
  1000. package/dist/workflow/sanitize.d.ts +21 -0
  1001. package/dist/workflow/sanitize.d.ts.map +1 -0
  1002. package/dist/workflow/schema.d.ts +5 -0
  1003. package/dist/workflow/schema.d.ts.map +1 -0
  1004. package/dist/workflow/summary.d.ts +43 -0
  1005. package/dist/workflow/summary.d.ts.map +1 -0
  1006. package/dist/workflow/trace-event-fields.d.ts +6 -0
  1007. package/dist/workflow/trace-event-fields.d.ts.map +1 -0
  1008. package/dist/workflow/trajectory.d.ts +15 -0
  1009. package/dist/workflow/trajectory.d.ts.map +1 -0
  1010. package/dist/workflow/types.d.ts +68 -0
  1011. package/dist/workflow/types.d.ts.map +1 -0
  1012. package/dist/workspace-inspector.d.ts +67 -0
  1013. package/dist/workspace-inspector.d.ts.map +1 -0
  1014. package/dist/wrangler-deploy-runner.test.d.ts +2 -0
  1015. package/dist/wrangler-deploy-runner.test.d.ts.map +1 -0
  1016. package/docs/campaign-proposers.md +170 -0
  1017. package/docs/concepts.md +8 -4
  1018. package/docs/customer-journeys.md +15 -13
  1019. package/docs/design/loop-taxonomy.md +34 -66
  1020. package/docs/distributed-driver.md +14 -14
  1021. package/docs/feature-guide.md +1 -1
  1022. package/docs/hosted-ingest-spec.md +2 -3
  1023. package/docs/multi-shot-optimization.md +8 -8
  1024. package/docs/product-eval-adoption.md +1 -1
  1025. package/docs/self-improvement-map.md +33 -29
  1026. package/package.json +9 -15
  1027. package/dist/calibration-Cpr3WaX3.d.ts +0 -101
  1028. package/dist/chunk-47X6LRCE.js.map +0 -1
  1029. package/dist/chunk-6SOJM3VR.js.map +0 -1
  1030. package/dist/chunk-CVVHBFGN.js.map +0 -1
  1031. package/dist/chunk-D3V5B42D.js.map +0 -1
  1032. package/dist/chunk-E4GH6USR.js.map +0 -1
  1033. package/dist/chunk-GSH6QNNS.js.map +0 -1
  1034. package/dist/chunk-KWRRMR3J.js.map +0 -1
  1035. package/dist/chunk-LMZQ2Z4U.js.map +0 -1
  1036. package/dist/chunk-QAY5UIJO.js.map +0 -1
  1037. package/dist/chunk-QG2OVF2D.js.map +0 -1
  1038. package/dist/chunk-T375SUOZ.js.map +0 -1
  1039. package/dist/chunk-TWS7AZEY.js.map +0 -1
  1040. package/dist/chunk-UMMZHCPB.js.map +0 -1
  1041. package/dist/chunk-XY4DDNEG.js.map +0 -1
  1042. package/dist/chunk-ZFIBGEOL.js.map +0 -1
  1043. package/dist/control-_Qb7skHX.d.ts +0 -259
  1044. package/dist/corpus-BoR-041R.d.ts +0 -560
  1045. package/dist/failure-cluster-CL7IVgkJ.d.ts +0 -76
  1046. package/dist/harness-optimizer-EnEnQPsr.d.ts +0 -106
  1047. package/dist/index-Bx3gZ8xl.d.ts +0 -159
  1048. package/dist/pre-registration-mAnCugl9.d.ts +0 -523
  1049. package/dist/provenance-LnqRT0sS.d.ts +0 -441
  1050. package/dist/query-CqTxMwDw.d.ts +0 -31
  1051. package/dist/release-report-euXIV_Sk.d.ts +0 -233
  1052. package/dist/run-critic-BAIjX99r.d.ts +0 -56
  1053. package/dist/run-improvement-loop-5z_l5zDz.d.ts +0 -427
  1054. package/dist/runtime-trajectory-BDgfGZSr.d.ts +0 -49
  1055. package/dist/semantic-concept-judge-Dn8Z6KEG.d.ts +0 -624
  1056. package/dist/sink-fetch-B1Yg4Til.d.ts +0 -101
  1057. package/docs/design/external-agent-wedge.md +0 -89
  1058. package/docs/design/phase-d-rfc.md +0 -125
  1059. package/docs/design/phase4-consumer-migration.md +0 -70
  1060. package/docs/design/primitives-integration-spec.md +0 -393
  1061. package/docs/design/product-self-improvement-loop.md +0 -146
  1062. package/docs/design/self-improvement-engine.md +0 -140
  1063. package/docs/design/self-improvement-protocol.md +0 -223
  1064. package/docs/design/self-improvement-roadmap.md +0 -106
  1065. package/docs/design/substrate-gaps.md +0 -118
  1066. package/docs/phase-b-pairing-kit.md +0 -188
  1067. package/docs/phase-b-runbook.md +0 -176
  1068. package/docs/pilot/README.md +0 -62
  1069. package/docs/pilot/customer-checklist.md +0 -90
  1070. package/docs/pilot/integration-foreign-stack.md +0 -296
  1071. package/docs/pilot/integration-tangle-stack.md +0 -248
  1072. package/docs/pilot/one-pager.md +0 -161
  1073. package/docs/pilot/sample-insight-report.json +0 -172
  1074. package/docs/quickstart-external.md +0 -229
  1075. package/docs/research/belief-state-agent-eval-roadmap.md +0 -593
  1076. package/docs/research/research-roadmap.md +0 -205
  1077. package/docs/specs/driver-honest-spec.md +0 -251
  1078. package/docs/specs/hermes-self-improvement-audit.md +0 -93
  1079. package/docs/specs/profile-versioning.md +0 -291
  1080. package/docs/three-package-architecture.md +0 -168
  1081. /package/dist/{chunk-QS3RBQPI.js.map → chunk-D5KBVULY.js.map} +0 -0
  1082. /package/dist/{chunk-UHMJT4T7.js.map → chunk-IZCEK2HR.js.map} +0 -0
  1083. /package/dist/{chunk-L3JOU6XM.js.map → chunk-NACM5RS7.js.map} +0 -0
  1084. /package/dist/{chunk-4FBZZIYD.js.map → chunk-QTMYW64F.js.map} +0 -0
  1085. /package/dist/{chunk-CY6U5S3X.js.map → chunk-URWVKRCS.js.map} +0 -0
  1086. /package/dist/{chunk-Y47J2LJ3.js.map → chunk-Z6L6YSU6.js.map} +0 -0
  1087. /package/dist/{run-campaign-RDGAM5KJ.js.map → run-campaign-WXY7KI67.js.map} +0 -0
@@ -1,31 +1,16 @@
1
1
  import {
2
2
  runCanaries,
3
3
  scoreRedTeamOutput
4
- } from "./chunk-ZFIBGEOL.js";
4
+ } from "./chunk-7QTQKIDD.js";
5
5
  import {
6
6
  runCampaign
7
- } from "./chunk-TWS7AZEY.js";
7
+ } from "./chunk-2T4EZACH.js";
8
8
  import {
9
9
  detectRewardHacking
10
10
  } from "./chunk-5HRORJQY.js";
11
11
  import {
12
12
  pairedBootstrap
13
- } from "./chunk-LMZQ2Z4U.js";
14
-
15
- // src/campaign/drivers/evolutionary.ts
16
- function evolutionaryDriver(opts) {
17
- return {
18
- kind: `evolutionary:${opts.mutator.kind}`,
19
- async propose({ currentSurface, findings, populationSize, signal }) {
20
- return opts.mutator.mutate({
21
- findings: findings.length > 0 ? findings : opts.findings ?? [],
22
- currentSurface,
23
- populationSize,
24
- signal
25
- });
26
- }
27
- };
28
- }
13
+ } from "./chunk-56GC6VYO.js";
29
14
 
30
15
  // src/campaign/gates/compose.ts
31
16
  function composeGate(...gates) {
@@ -419,8 +404,22 @@ async function runEval(opts) {
419
404
  return runCampaign(opts);
420
405
  }
421
406
 
407
+ // src/campaign/proposers/evolutionary.ts
408
+ function evolutionaryProposer(opts) {
409
+ return {
410
+ kind: `evolutionary:${opts.mutator.kind}`,
411
+ async propose({ currentSurface, findings, populationSize, signal }) {
412
+ return opts.mutator.mutate({
413
+ findings: findings.length > 0 ? findings : opts.findings ?? [],
414
+ currentSurface,
415
+ populationSize,
416
+ signal
417
+ });
418
+ }
419
+ };
420
+ }
421
+
422
422
  export {
423
- evolutionaryDriver,
424
423
  composeGate,
425
424
  pairHoldout,
426
425
  heldoutSignificance,
@@ -430,6 +429,7 @@ export {
430
429
  buildEvidenceVector,
431
430
  paretoPolicy,
432
431
  paretoSignificanceGate,
433
- runEval
432
+ runEval,
433
+ evolutionaryProposer
434
434
  };
435
- //# sourceMappingURL=chunk-6SOJM3VR.js.map
435
+ //# sourceMappingURL=chunk-KKWJD5E6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/campaign/gates/compose.ts","../src/campaign/gates/statistical-heldout.ts","../src/campaign/gates/default-production-gate.ts","../src/campaign/gates/promotion-policy.ts","../src/campaign/presets/run-eval.ts","../src/campaign/proposers/evolutionary.ts"],"sourcesContent":["/**\n * Compose multiple `Gate` implementations — every gate must pass for the\n * composite to ship. Closes the alignment reviewer's \"default-only\n * heldOutGate + costGate would happily promote a reward-hacked prompt\"\n * concern by making safety gates first-class composable defaults.\n */\n\nimport type { Gate, GateContext, GateDecision, GateResult, Scenario } from '../types'\n\n/** Compose gates — all must `ship` for the composite to `ship`. First\n * non-ship verdict short-circuits the composite verdict, but ALL gates run\n * (so the result records every gate's reason — useful for diagnostics). */\nexport function composeGate<TArtifact = unknown, TScenario extends Scenario = Scenario>(\n ...gates: Array<Gate<TArtifact, TScenario>>\n): Gate<TArtifact, TScenario> {\n if (gates.length === 0) {\n throw new Error('composeGate requires at least one gate')\n }\n return {\n name: `composed(${gates.map((g) => g.name).join(',')})`,\n async decide(ctx: GateContext<TArtifact, TScenario>): Promise<GateResult> {\n const results: Array<{ gate: Gate<TArtifact, TScenario>; res: GateResult }> = []\n for (const gate of gates) {\n const res = await gate.decide(ctx)\n results.push({ gate, res })\n }\n\n // Substrate-wide verdict policy:\n // - all 'ship' → 'ship'\n // - any 'arch_ceiling' → 'arch_ceiling' (architectural ceiling beats other holds)\n // - any 'model_ceiling' → 'model_ceiling'\n // - any 'hold' → 'hold'\n // - else 'need_more_work'\n const decisions = results.map((r) => r.res.decision)\n const overall: GateDecision = decisions.every((d) => d === 'ship')\n ? 'ship'\n : decisions.includes('arch_ceiling')\n ? 'arch_ceiling'\n : decisions.includes('model_ceiling')\n ? 'model_ceiling'\n : decisions.includes('hold')\n ? 'hold'\n : 'need_more_work'\n\n const contributing = results.flatMap((r) =>\n r.res.contributingGates.length > 0\n ? r.res.contributingGates\n : [{ name: r.gate.name, passed: r.res.decision === 'ship', detail: r.res }],\n )\n\n const reasons = results.flatMap((r) =>\n r.res.reasons.map((reason) => `[${r.gate.name}] ${reason}`),\n )\n\n return {\n decision: overall,\n reasons,\n contributingGates: contributing,\n delta: results[0]?.res.delta,\n }\n },\n }\n}\n","/**\n * Statistical held-out promotion machinery — the trustworthy core the\n * point-estimate `heldout-delta` gate lacked.\n *\n * The shipped false positive it prevents: a winner re-scored against the\n * baseline on the holdout read run-to-run model NOISE (e.g. 91 vs 95) as a\n * \"+4 lift\" and shipped, because the gate compared point estimates with no\n * confidence interval. Here we pair candidate vs baseline holdout observations\n * and bootstrap a CI on the paired delta — a candidate ships only when the CI\n * lower bound clears the effect-size threshold (the gain is real at the\n * confidence level, not noise), and is blocked when a critical dimension\n * (e.g. `hallucination_free` for a legal agent) significantly regresses even if\n * the net composite rose (anti-Goodhart).\n *\n * Two traps this module is built around (both produce a NEW false positive if\n * gotten wrong):\n * 1. PAIRING GRANULARITY — pairs by FULL `cellId` (`scenario:rep`), never by\n * `scenarioId` (which averages reps away and destroys the within-pair\n * variance reduction that makes a paired bootstrap tighter than unpaired).\n * One paired observation per cell ⇒ reps multiply n.\n * 2. SCALE — a judge may emit composites/dimensions on [0,1] or 0-100. The\n * threshold + tolerance are interpreted in the judge's NATIVE scale; the\n * per-dimension tolerance auto-scales off the observed baseline magnitudes\n * so `-0.10` on [0,1] doesn't silently become a no-op on a 0-100 dimension.\n */\n\nimport { type PairedBootstrapResult, pairedBootstrap } from '../../statistics'\nimport type { JudgeScore } from '../types'\n\nexport interface PairedHoldout {\n /** Baseline scalar per paired cell (same order as `after`/`cellIds`). */\n before: number[]\n /** Candidate scalar per paired cell. */\n after: number[]\n /** The full cellIds (`scenario:rep`) that paired, in order. */\n cellIds: string[]\n}\n\n/**\n * Pair candidate vs baseline holdout observations by FULL cellId. `select`\n * pulls the scalar from a cell's judge reports (composite, or a named\n * dimension); a cell contributes the mean of `select` across its judges. Cells\n * whose scenario is not in `scenarioIds`, or where `select` is undefined for\n * every judge on either side, are skipped on BOTH sides so the arrays stay\n * paired. Throws when the two maps disagree on which holdout cells exist — a\n * load-bearing invariant: the baseline + winner holdout campaigns run the same\n * scenarios with the same seed base, so their cellIds MUST align; a mismatch\n * means a silent pairing bug, not a soft fallback.\n */\nexport function pairHoldout(\n candidate: Map<string, Record<string, JudgeScore>>,\n baseline: Map<string, Record<string, JudgeScore>>,\n scenarioIds: Set<string>,\n select: (s: JudgeScore) => number | undefined,\n): PairedHoldout {\n const cellValue = (\n byCell: Map<string, Record<string, JudgeScore>>,\n cellId: string,\n ): number | undefined => {\n const scores = byCell.get(cellId)\n if (!scores) return undefined\n const vals: number[] = []\n for (const s of Object.values(scores)) {\n const v = select(s)\n if (typeof v === 'number' && Number.isFinite(v)) vals.push(v)\n }\n if (vals.length === 0) return undefined\n return vals.reduce((a, b) => a + b, 0) / vals.length\n }\n\n const inScope = (cellId: string) => scenarioIds.has(cellId.split(':')[0] ?? '')\n const candCells = [...candidate.keys()].filter(inScope).sort()\n const baseCells = [...baseline.keys()].filter(inScope).sort()\n // Alignment invariant — the holdout campaigns share scenarios + seed, so the\n // cell sets must be identical. Differ ⇒ a real pairing bug; fail loud.\n if (candCells.length !== baseCells.length || candCells.some((c, i) => c !== baseCells[i])) {\n throw new Error(\n `pairHoldout: candidate/baseline holdout cells do not align — ` +\n `candidate=[${candCells.join(',')}] baseline=[${baseCells.join(',')}]. ` +\n `Both holdout campaigns must run the same scenarios with the same seed base.`,\n )\n }\n\n const before: number[] = []\n const after: number[] = []\n const cellIds: string[] = []\n for (const cellId of candCells) {\n const b = cellValue(baseline, cellId)\n const a = cellValue(candidate, cellId)\n // Only pair when BOTH sides produced the scalar (a dimension absent on one\n // side would otherwise create an unpaired observation).\n if (b === undefined || a === undefined) continue\n before.push(b)\n after.push(a)\n cellIds.push(cellId)\n }\n return { before, after, cellIds }\n}\n\nexport interface HeldoutSignificance {\n paired: PairedHoldout\n bootstrap: PairedBootstrapResult\n /** n paired observations. */\n n: number\n /** True iff n >= minProductiveRuns AND the CI lower bound clears the threshold. */\n significant: boolean\n /** Set when n < minProductiveRuns — too little evidence to claim significance. */\n fewRuns: boolean\n}\n\nexport interface HeldoutSignificanceOptions {\n deltaThreshold?: number\n minProductiveRuns?: number\n confidence?: number\n resamples?: number\n /** Fixed by default for a deterministic, reproducible gate verdict. */\n seed?: number\n statistic?: 'mean' | 'median'\n}\n\n/** Significance of the held-out composite lift: ship only when the paired\n * bootstrap CI lower bound on (candidate − baseline) exceeds `deltaThreshold`\n * (default 0 ⇒ \"confidently positive\"). Below `minProductiveRuns` paired\n * observations there is not enough evidence to claim significance → not\n * significant (`fewRuns`). Interpret `deltaThreshold` in the judge's native\n * composite scale. */\nexport function heldoutSignificance(\n paired: PairedHoldout,\n opts: HeldoutSignificanceOptions = {},\n): HeldoutSignificance {\n const deltaThreshold = opts.deltaThreshold ?? 0\n const minProductiveRuns = opts.minProductiveRuns ?? 3\n const bootstrap = pairedBootstrap(paired.before, paired.after, {\n confidence: opts.confidence ?? 0.95,\n resamples: opts.resamples ?? 2000,\n statistic: opts.statistic ?? 'median',\n seed: opts.seed ?? 1337,\n })\n const n = paired.before.length\n const fewRuns = n < minProductiveRuns\n const significant = !fewRuns && bootstrap.low > deltaThreshold\n return { paired, bootstrap, n, significant, fewRuns }\n}\n\nexport interface DimensionRegression {\n dimension: string\n bootstrap: PairedBootstrapResult\n /** True iff the CI lower bound on (candidate − baseline) is below −tolerance:\n * the candidate may have regressed this dimension by more than tolerance. */\n regressed: boolean\n tolerance: number\n n: number\n}\n\n/** Detect the native scale of a set of scores: 0-100 when any magnitude clears\n * 1.5, else [0,1]. Used to auto-scale the regression tolerance so a default\n * expressed for [0,1] is not silently a no-op on a 0-100 dimension. */\nexport function detectScale(values: number[]): 1 | 100 {\n return values.some((v) => Math.abs(v) > 1.5) ? 100 : 1\n}\n\n/** Per-critical-dimension regression guard. For each dimension, pair the\n * candidate vs baseline values by full cellId and bootstrap the paired delta;\n * a dimension is \"regressed\" when the CI lower bound < −tolerance (conservative\n * — blocks if the credible worst case exceeds tolerance, which is the right\n * posture for safety dimensions like `hallucination_free`). When `tolerance`\n * is omitted it auto-scales: 0.05 on [0,1], 5 on 0-100. */\nexport function dimensionRegressions(\n candidate: Map<string, Record<string, JudgeScore>>,\n baseline: Map<string, Record<string, JudgeScore>>,\n scenarioIds: Set<string>,\n criticalDimensions: string[],\n opts: { tolerance?: number; confidence?: number; resamples?: number; seed?: number } = {},\n): DimensionRegression[] {\n const out: DimensionRegression[] = []\n for (const dim of criticalDimensions) {\n const paired = pairHoldout(candidate, baseline, scenarioIds, (s) => s.dimensions[dim])\n if (paired.before.length === 0) continue // dimension not scored on this judge\n const tolerance = opts.tolerance ?? 0.05 * detectScale([...paired.before, ...paired.after])\n const bootstrap = pairedBootstrap(paired.before, paired.after, {\n confidence: opts.confidence ?? 0.95,\n resamples: opts.resamples ?? 2000,\n statistic: 'median',\n seed: opts.seed ?? 1337,\n })\n out.push({\n dimension: dim,\n bootstrap,\n regressed: bootstrap.low < -tolerance,\n tolerance,\n n: paired.before.length,\n })\n }\n return out\n}\n","/**\n * `defaultProductionGate` — composes the substrate's existing safety\n * primitives (red-team / reward-hacking / canary / heldout) into a single\n * Gate.decide shape. Closes the alignment + Anthropic-SI reviewers' \"safety\n * primitives are off the critical path\" blocker.\n *\n * The composition is opinionated — when consumers wire `runImprovementLoop`,\n * THIS gate is the default. Consumers can still pass a custom gate to\n * override; the recommended pattern is to compose THIS gate with whatever\n * extra domain-specific gates they need (`composeGate(defaultProductionGate(...), customGate)`).\n */\n\nimport type { CanaryReport } from '../../canary'\nimport { runCanaries } from '../../canary'\nimport type { RedTeamCase } from '../../red-team'\nimport { scoreRedTeamOutput } from '../../red-team'\nimport type { RewardHackingReport } from '../../rl/reward-hacking'\nimport { detectRewardHacking } from '../../rl/reward-hacking'\nimport type { RunRecord } from '../../run-record'\nimport type { Gate, GateContext, GateResult, Scenario } from '../types'\nimport { dimensionRegressions, heldoutSignificance, pairHoldout } from './statistical-heldout'\n\nexport interface DefaultProductionGateOptions {\n /** Required: scenarios held out from training; substrate compares\n * candidate-on-holdout vs baseline-on-holdout. */\n holdoutScenarios: Scenario[]\n /** Minimum held-out lift the **paired-bootstrap CI lower bound** must clear\n * to ship — NOT a point estimate. Default 0 ⇒ \"confidently positive at the\n * confidence level\". Interpreted in the judge's native composite scale (set\n * e.g. 2 for a 0-100 rubric to require a ≥2-point significant gain). */\n deltaThreshold?: number\n /** Confidence level for the held-out + dimension bootstraps. Default 0.95. */\n confidence?: number\n /** Bootstrap resamples. Default 2000. */\n bootstrapResamples?: number\n /** Fixed bootstrap seed for a deterministic verdict. Default 1337. */\n bootstrapSeed?: number\n /** Minimum paired holdout observations (scenarios × reps) before a\n * significance claim is allowed; below it the gate HOLDS with `few_runs`\n * rather than reading a degenerate CI. Default 3. */\n minProductiveRuns?: number\n /** Critical judge dimensions that must NOT significantly regress even when\n * the net composite rises (anti-Goodhart). The gate HOLDS if any listed\n * dimension's paired-delta CI lower bound < −`regressionTolerance`. E.g.\n * `['hallucination_free']` for a legal agent. */\n criticalDimensions?: string[]\n /** Tolerance for the per-dimension regression guard, in the dimension's\n * native scale. When omitted it auto-scales off observed magnitudes:\n * 0.05 on [0,1], 5 on 0-100. */\n regressionTolerance?: number\n /** Total $ budget for ALL cells in this campaign — including baseline + candidate.\n * Composite verdict refuses to ship when spend exceeded budget. */\n budgetUsd?: number\n /** Red-team cases to probe candidate outputs against. When omitted the\n * substrate uses `DEFAULT_RED_TEAM_CORPUS`. Provide a domain-specific\n * battery for tighter coverage. */\n redTeamBattery?: RedTeamCase[]\n /** Run records (oldest-first) needed for the reward-hacking detector.\n * Substrate populates from prior production-loop generations. */\n recentRuns?: RunRecord[]\n /** When true, the gate refuses to ship if the reward-hacking detector\n * fires at the `gaming` severity. Default true. */\n blockOnRewardHackingGaming?: boolean\n}\n\nexport function defaultProductionGate<TArtifact, TScenario extends Scenario>(\n options: DefaultProductionGateOptions,\n): Gate<TArtifact, TScenario> {\n const deltaThreshold = options.deltaThreshold ?? 0\n const confidence = options.confidence ?? 0.95\n const resamples = options.bootstrapResamples ?? 2000\n const seed = options.bootstrapSeed ?? 1337\n const minProductiveRuns = options.minProductiveRuns ?? 3\n const blockOnGaming = options.blockOnRewardHackingGaming ?? true\n\n return {\n name: 'defaultProductionGate',\n async decide(ctx: GateContext<TArtifact, TScenario>): Promise<GateResult> {\n const reasons: string[] = []\n const contributing: Array<{ name: string; passed: boolean; detail: unknown }> = []\n\n // ── (1) heldout composite lift — paired-bootstrap CI, NOT a point estimate\n // The shipped false positive: the baseline re-scored against itself read\n // run-to-run model noise (91 vs 95) as a \"+4 lift\" and shipped, because a\n // point estimate carries no confidence interval. Pair candidate vs\n // baseline holdout cells by FULL cellId (never averaging reps away) and\n // ship only when the bootstrap CI lower bound clears the threshold —\n // i.e. the gain is real at the confidence level, not noise.\n const scenarioIds = new Set(options.holdoutScenarios.map((s) => s.id))\n const sig = heldoutSignificance(\n pairHoldout(\n ctx.judgeScores,\n ctx.baselineJudgeScores ?? ctx.judgeScores,\n scenarioIds,\n (s) => s.composite,\n ),\n { deltaThreshold, minProductiveRuns, confidence, resamples, seed },\n )\n const delta = sig.bootstrap.median\n const heldoutPass = sig.significant\n contributing.push({\n name: 'heldout-significance',\n passed: heldoutPass,\n detail: {\n n: sig.n,\n deltaMedian: sig.bootstrap.median,\n ciLow: sig.bootstrap.low,\n ciHigh: sig.bootstrap.high,\n confidence: sig.bootstrap.confidence,\n deltaThreshold,\n fewRuns: sig.fewRuns,\n },\n })\n if (!heldoutPass) {\n reasons.push(\n sig.fewRuns\n ? `held-out: only ${sig.n} paired runs (< ${minProductiveRuns}) — too few to claim significance`\n : `held-out CI.low ${sig.bootstrap.low.toFixed(3)} ≤ threshold ${deltaThreshold} (median ${sig.bootstrap.median.toFixed(3)}, ${(sig.bootstrap.confidence * 100).toFixed(0)}% CI [${sig.bootstrap.low.toFixed(3)}, ${sig.bootstrap.high.toFixed(3)}])`,\n )\n }\n\n // ── (1b) per-dimension regression guard (anti-Goodhart) ──────────\n // A net composite gain can hide a regression on a safety-critical\n // dimension (e.g. hallucination_free for a legal agent — the verified run\n // gained +25/+25 on deadline/fee while LOSING -30 on hallucination, and\n // the composite-only gate never saw it). Block ship if any guarded\n // dimension's paired-delta CI lower bound falls below −tolerance.\n const dimRegs = options.criticalDimensions?.length\n ? dimensionRegressions(\n ctx.judgeScores,\n ctx.baselineJudgeScores ?? ctx.judgeScores,\n scenarioIds,\n options.criticalDimensions,\n { tolerance: options.regressionTolerance, confidence, resamples, seed },\n )\n : []\n const regressed = dimRegs.filter((d) => d.regressed)\n const dimPass = regressed.length === 0\n contributing.push({\n name: 'dimension-regression',\n passed: dimPass,\n detail: {\n guarded: options.criticalDimensions ?? [],\n regressions: dimRegs.map((d) => ({\n dimension: d.dimension,\n ciLow: d.bootstrap.low,\n median: d.bootstrap.median,\n tolerance: d.tolerance,\n n: d.n,\n regressed: d.regressed,\n })),\n },\n })\n if (!dimPass) {\n reasons.push(\n `critical dimension(s) regressed: ${regressed.map((d) => `${d.dimension} CI.low ${d.bootstrap.low.toFixed(3)} < -${d.tolerance}`).join('; ')}`,\n )\n }\n\n // ── (2) budget gate ─────────────────────────────────────────────\n const budgetPass =\n options.budgetUsd === undefined ||\n ctx.cost.candidate + ctx.cost.baseline <= options.budgetUsd\n contributing.push({\n name: 'budget',\n passed: budgetPass,\n detail: {\n candidateUsd: ctx.cost.candidate,\n baselineUsd: ctx.cost.baseline,\n budgetUsd: options.budgetUsd,\n },\n })\n if (!budgetPass) {\n reasons.push(\n `spend ${(ctx.cost.candidate + ctx.cost.baseline).toFixed(2)} > budget ${options.budgetUsd}`,\n )\n }\n\n // ── (3) red-team probe on candidate ─────────────────────────────\n const redTeamFindings = options.redTeamBattery\n ? probeRedTeam(ctx.candidateArtifacts, options.redTeamBattery)\n : { passed: true, findings: [] }\n contributing.push({\n name: 'red-team',\n passed: redTeamFindings.passed,\n detail: {\n failures: redTeamFindings.findings.length,\n sample: redTeamFindings.findings.slice(0, 3),\n },\n })\n if (!redTeamFindings.passed) {\n reasons.push(`red-team probe failed (${redTeamFindings.findings.length} findings)`)\n }\n\n // ── (4) reward-hacking detector on the run-history window ───────\n let rewardHackingReport: RewardHackingReport | null = null\n if (options.recentRuns && options.recentRuns.length >= 10) {\n rewardHackingReport = detectRewardHacking({ runs: options.recentRuns })\n }\n // reward-hacking severity is numeric (0..1). \"gaming\" threshold per\n // detectRewardHacking defaults = 0.6. Block when ANY finding is at\n // gaming threshold OR the report verdict is 'gaming'.\n const gamingThreshold = 0.6\n const gamingFindings = (rewardHackingReport?.findings ?? []).filter(\n (f) => f.severity >= gamingThreshold,\n )\n const rewardHackingPass =\n !rewardHackingReport ||\n !blockOnGaming ||\n (gamingFindings.length === 0 && rewardHackingReport.verdict !== 'gaming')\n contributing.push({\n name: 'reward-hacking',\n passed: rewardHackingPass,\n detail: { report: rewardHackingReport, gamingFindingCount: gamingFindings.length },\n })\n if (!rewardHackingPass) {\n reasons.push(\n `reward-hacking detector flagged ${gamingFindings.length} gaming-severity findings (verdict=${rewardHackingReport!.verdict})`,\n )\n }\n\n // ── (5) canary check on runs ────────────────────────────────────\n let canaryReport: CanaryReport | null = null\n if (options.recentRuns && options.recentRuns.length >= 10) {\n canaryReport = runCanaries(options.recentRuns, {})\n }\n // CanarySeverity is 'info' | 'warn' | 'error' — block on 'error'.\n const errorAlerts = (canaryReport?.alerts ?? []).filter((a) => a.severity === 'error')\n const canaryPass = errorAlerts.length === 0\n contributing.push({\n name: 'canary',\n passed: canaryPass,\n detail: { totalAlerts: canaryReport?.alerts.length ?? 0, errorAlerts: errorAlerts.length },\n })\n if (!canaryPass) {\n reasons.push(`canary error alerts: ${errorAlerts.length}`)\n }\n\n // ── Verdict ─────────────────────────────────────────────────────\n const allPassed = contributing.every((c) => c.passed)\n const decision = allPassed ? 'ship' : 'hold'\n\n return {\n decision,\n reasons: reasons.length > 0 ? reasons : ['all gates passed'],\n contributingGates: contributing,\n delta,\n }\n },\n }\n}\n\nfunction probeRedTeam<TArtifact>(\n artifacts: Map<string, TArtifact>,\n battery: RedTeamCase[],\n): { passed: boolean; findings: Array<{ scenarioId: string; reason: string }> } {\n const findings: Array<{ scenarioId: string; reason: string }> = []\n for (const [_cellId, artifact] of artifacts) {\n const text = extractText(artifact)\n if (text === undefined) continue\n for (const rtCase of battery) {\n const finding = scoreRedTeamOutput(text, [], rtCase)\n if (!finding.passed) {\n findings.push({ scenarioId: rtCase.id, reason: finding.reason ?? 'red-team probe failed' })\n }\n }\n }\n return { passed: findings.length === 0, findings }\n}\n\nfunction extractText(artifact: unknown): string | undefined {\n if (typeof artifact === 'string') return artifact\n if (artifact && typeof artifact === 'object') {\n const rec = artifact as Record<string, unknown>\n if (typeof rec.text === 'string') return rec.text\n if (typeof rec.output === 'string') return rec.output\n if (typeof rec.content === 'string') return rec.content\n }\n return undefined\n}\n","/**\n * Promotion policy over the evidence VECTOR — the substrate's answer to \"never\n * collapse the multi-objective promotion decision into one scalar.\" A\n * `defaultProductionGate` is one opinionated composition; this module factors\n * the decision into two reusable pieces so MANY policies can compete over the\n * SAME evidence (the quant-desk pattern: one evidence bus, plural strategies):\n *\n * buildEvidenceVector(ctx, objectives, opts) -> EvidenceVector // the bus\n * PromotionPolicy = (ev: EvidenceVector) => GateResult // a strategy\n * paretoPolicy(ev) // the default strategy\n * paretoSignificanceGate(options): Gate // bus + policy as a Gate\n *\n * The Pareto policy is SYMMETRIC multi-objective: every objective is BOTH a\n * potential gain source AND a safety floor (unlike `defaultProductionGate`,\n * where only `composite` can win and `criticalDimensions` are pure floors). A\n * candidate ships iff it weakly DOMINATES the baseline at the confidence level —\n * no objective credibly worse (CI floor breach) AND at least one objective\n * credibly better (CI gain). Insufficient evidence on ANY axis -> need_more_work\n * (NOT folded into hold: \"gather more reps\" and \"reject\" are different actions).\n *\n * Cost/latency are NOT CI axes here — `GateContext` carries only an aggregate\n * per-side cost, no per-cell observation vector to bootstrap. Treat them as hard\n * constraints (compose with a budget gate via `composeGate`), not faked CIs.\n */\n\nimport type { Direction } from '../../pareto'\nimport { type PairedBootstrapResult, pairedBootstrap } from '../../statistics'\nimport type { Gate, GateContext, GateDecision, GateResult, JudgeScore, Scenario } from '../types'\nimport { detectScale, pairHoldout } from './statistical-heldout'\n\n/** Where an objective's per-cell scalar comes from. `composite` reads the\n * judge's composite; `dimension` reads a named per-dimension score. */\nexport type ObjectiveSource = { kind: 'composite' } | { kind: 'dimension'; dimension: string }\n\nexport interface PromotionObjective {\n /** Stable label used in reports + `contributingGates`. */\n name: string\n source: ObjectiveSource\n /** 'maximize' (quality dims) or 'minimize' (error/risk/length dims). Orients\n * the paired delta so a positive bootstrap always means \"candidate better\". */\n direction: Direction\n /** The good-direction paired-delta CI lower bound must EXCEED this to count\n * as a significant gain on this axis. Interpreted in the judge's native\n * scale. Default 0 (⇒ \"confidently better\"). */\n gainThreshold?: number\n /** A floor breach (regression) is declared when the good-direction CI lower\n * bound is below −floorTolerance. When omitted it auto-scales off observed\n * magnitudes (0.05 on [0,1], 5 on 0-100), matching `dimensionRegressions`. */\n floorTolerance?: number\n}\n\n/** Per-axis verdict from the good-direction paired bootstrap. */\nexport type AxisVerdict = 'improved' | 'regressed' | 'flat' | 'few_runs'\n\nexport interface AxisEvidence {\n name: string\n source: ObjectiveSource\n direction: Direction\n /** Paired bootstrap on the GOOD-DIRECTION delta (oriented by `direction`):\n * a positive value means the candidate is better on this axis. */\n bootstrap: PairedBootstrapResult\n /** Paired observations contributing to this axis. */\n n: number\n gainThreshold: number\n floorTolerance: number\n verdict: AxisVerdict\n}\n\nexport interface EvidenceVector {\n /** One entry per objective — NOTHING averaged across axes. */\n axes: AxisEvidence[]\n /** Smallest paired n across axes that produced observations — the binding\n * evidence-sufficiency constraint. 0 when no axis produced observations. */\n minN: number\n /** Aggregate per-side cost from the gate context (a constraint input, not a\n * CI axis — see the module header). */\n cost: { candidate: number; baseline: number }\n}\n\n/** A promotion strategy: a pure function from the evidence vector to a verdict.\n * Many policies can run over the same `EvidenceVector` and disagree — that's\n * the point (competing strategies, shared evidence). */\nexport type PromotionPolicy = (ev: EvidenceVector) => GateResult\n\nexport interface BuildEvidenceVectorOptions {\n /** Minimum paired observations before an axis can claim significance; below\n * it the axis is `few_runs`. Default 3. */\n minProductiveRuns?: number\n /** Confidence level for every axis bootstrap. Default 0.95. */\n confidence?: number\n /** Bootstrap resamples. Default 2000. */\n resamples?: number\n /** Fixed bootstrap seed for a deterministic, reproducible verdict. Default 1337. */\n seed?: number\n}\n\n/**\n * The Evidence Bus. For each objective, pair candidate vs baseline by full\n * cellId and bootstrap a CI on the good-direction paired delta. Reuses the\n * exact `pairHoldout` + `pairedBootstrap` machinery the held-out gate uses, so\n * a single source of truth governs pairing granularity + scale handling.\n */\nexport function buildEvidenceVector<TArtifact, TScenario extends Scenario>(\n ctx: GateContext<TArtifact, TScenario>,\n objectives: PromotionObjective[],\n opts: BuildEvidenceVectorOptions = {},\n): EvidenceVector {\n if (objectives.length === 0) {\n throw new Error('buildEvidenceVector: at least 1 objective required')\n }\n const minProductiveRuns = opts.minProductiveRuns ?? 3\n const confidence = opts.confidence ?? 0.95\n const resamples = opts.resamples ?? 2000\n const seed = opts.seed ?? 1337\n const baseline = ctx.baselineJudgeScores ?? ctx.judgeScores\n const scenarioIds = new Set(ctx.scenarios.map((s) => s.id))\n\n const axes: AxisEvidence[] = []\n for (const obj of objectives) {\n let select: (s: JudgeScore) => number | undefined\n if (obj.source.kind === 'composite') {\n select = (s) => s.composite\n } else {\n const dim = obj.source.dimension\n select = (s) => s.dimensions[dim]\n }\n const paired = pairHoldout(ctx.judgeScores, baseline, scenarioIds, select)\n // Orient to the good direction: maximize ⇒ bootstrap (candidate − baseline);\n // minimize ⇒ bootstrap (baseline − candidate) by swapping args, so a\n // positive bootstrap always reads as \"candidate better on this axis\".\n const before = obj.direction === 'maximize' ? paired.before : paired.after\n const after = obj.direction === 'maximize' ? paired.after : paired.before\n const bootstrap = pairedBootstrap(before, after, {\n confidence,\n resamples,\n statistic: 'median',\n seed,\n })\n const n = paired.before.length\n const floorTolerance =\n obj.floorTolerance ?? 0.05 * detectScale([...paired.before, ...paired.after])\n const gainThreshold = obj.gainThreshold ?? 0\n // Floor check precedes the gain check: a credible regression must never be\n // masked as \"improved\". With the defaults (gainThreshold 0, positive floor)\n // the regions are disjoint and order is moot, but a consumer who sets a\n // negative gainThreshold (\"accept small dips\") could otherwise have a real\n // floor breach classified as a gain — anti-Goodhart wins the tie.\n const verdict: AxisVerdict =\n n < minProductiveRuns\n ? 'few_runs'\n : bootstrap.low < -floorTolerance\n ? 'regressed'\n : bootstrap.low > gainThreshold\n ? 'improved'\n : 'flat'\n axes.push({\n name: obj.name,\n source: obj.source,\n direction: obj.direction,\n bootstrap,\n n,\n gainThreshold,\n floorTolerance,\n verdict,\n })\n }\n const ns = axes.map((a) => a.n).filter((n) => n > 0)\n const minN = ns.length > 0 ? Math.min(...ns) : 0\n return { axes, minN, cost: { candidate: ctx.cost.candidate, baseline: ctx.cost.baseline } }\n}\n\n/**\n * The default strategy: symmetric multi-objective Pareto significance. Ship iff\n * the candidate weakly dominates the baseline at the confidence level — no axis\n * credibly worse AND ≥1 axis credibly better. Floor breach on any axis → hold\n * (anti-Goodhart, dominates everything). Insufficient evidence on any axis →\n * need_more_work. Statistically equivalent → hold (never ship noise).\n */\nexport const paretoPolicy: PromotionPolicy = (ev) => {\n const contributingGates = ev.axes.map((ax) => ({\n name: `objective:${ax.name}`,\n passed: ax.verdict === 'improved',\n detail: {\n direction: ax.direction,\n source: ax.source,\n verdict: ax.verdict,\n n: ax.n,\n deltaMedian: ax.bootstrap.median,\n ciLow: ax.bootstrap.low,\n ciHigh: ax.bootstrap.high,\n confidence: ax.bootstrap.confidence,\n gainThreshold: ax.gainThreshold,\n floorTolerance: ax.floorTolerance,\n },\n }))\n\n const regressed = ev.axes.filter((a) => a.verdict === 'regressed')\n const fewRuns = ev.axes.filter((a) => a.verdict === 'few_runs')\n const improved = ev.axes.filter((a) => a.verdict === 'improved')\n\n let decision: GateDecision\n const reasons: string[] = []\n if (regressed.length > 0) {\n // Floor breach dominates: a credible regression on ANY axis blocks ship even\n // if another axis improved. This makes the +gain/−safety false positive\n // structurally impossible whenever the safety dim is an objective.\n decision = 'hold'\n for (const a of regressed) {\n reasons.push(\n `objective '${a.name}' regressed: good-direction CI.low ${a.bootstrap.low.toFixed(3)} < -${a.floorTolerance} (n=${a.n})`,\n )\n }\n } else if (fewRuns.length > 0) {\n // No credible regression on the scored axes, but ≥1 axis lacks the evidence\n // to claim a gain ⇒ gather more reps, do NOT reject.\n decision = 'need_more_work'\n for (const a of fewRuns) {\n reasons.push(\n `objective '${a.name}' has only n=${a.n} paired runs — insufficient evidence to claim significance`,\n )\n }\n } else if (improved.length > 0) {\n // Weakly dominates (no axis worse) AND strictly better on ≥1 axis ⇒ a Pareto\n // improvement at the confidence level.\n decision = 'ship'\n reasons.push(\n `Pareto improvement at the confidence level: ${improved\n .map(\n (a) =>\n `'${a.name}' +${a.bootstrap.median.toFixed(3)} (CI.low ${a.bootstrap.low.toFixed(3)})`,\n )\n .join(', ')}; no objective regressed`,\n )\n } else {\n // Enough evidence, nothing credibly better or worse ⇒ statistically\n // equivalent. Do NOT ship a no-op.\n decision = 'hold'\n reasons.push(\n 'no Pareto improvement: candidate statistically equivalent to baseline on every objective',\n )\n }\n\n // `delta` surfaces the composite axis if present, else the first axis — a\n // single convenience scalar; the vector lives in `contributingGates`.\n const composite = ev.axes.find((a) => a.source.kind === 'composite') ?? ev.axes[0]\n return { decision, reasons, contributingGates, delta: composite?.bootstrap.median }\n}\n\nexport interface ParetoSignificanceGateOptions extends BuildEvidenceVectorOptions {\n /** The objective vector. Every axis is both a gain source and a safety floor. */\n objectives: PromotionObjective[]\n /** Strategy applied to the evidence vector. Default `paretoPolicy`. Override\n * to run a stricter/looser strategy over the SAME bus (competing policies). */\n policy?: PromotionPolicy\n /** Override the gate name in reports. */\n name?: string\n}\n\n/**\n * Wrap the bus + a policy as a `Gate`. Plugs into the existing\n * `runImprovementLoop({ gate })` slot and composes via `composeGate`; default\n * loop behavior is unchanged because consumers opt in by passing this gate.\n */\nexport function paretoSignificanceGate<TArtifact = unknown, TScenario extends Scenario = Scenario>(\n options: ParetoSignificanceGateOptions,\n): Gate<TArtifact, TScenario> {\n if (options.objectives.length === 0) {\n throw new Error('paretoSignificanceGate: at least 1 objective required')\n }\n const policy = options.policy ?? paretoPolicy\n return {\n name: options.name ?? 'paretoSignificanceGate',\n async decide(ctx: GateContext<TArtifact, TScenario>): Promise<GateResult> {\n const ev = buildEvidenceVector(ctx, options.objectives, options)\n return policy(ev)\n },\n }\n}\n","/**\n * `runEval` — the simplest preset over `runCampaign`. No optimizer, no\n * gate, no auto-PR. Just: run scenarios through dispatch, score with\n * judges, return CampaignResult.\n *\n * The 80% case for consumers who want a scorecard, not an improvement loop.\n */\n\nimport { type RunCampaignOptions, runCampaign } from '../run-campaign'\nimport type { CampaignResult, Scenario } from '../types'\n\nexport interface RunEvalOptions<TScenario extends Scenario, TArtifact>\n extends Omit<RunCampaignOptions<TScenario, TArtifact>, 'runDir'> {\n runDir: string\n}\n\nexport async function runEval<TScenario extends Scenario, TArtifact>(\n opts: RunEvalOptions<TScenario, TArtifact>,\n): Promise<CampaignResult<TArtifact, TScenario>> {\n return runCampaign(opts)\n}\n","/**\n * `evolutionaryProposer` — adapts a stateless `Mutator` (population mutation:\n * GEPA / AxGEPA / reflective-mutation) into a `SurfaceProposer`. This is\n * the evolutionary strategy: each generation, mutate the current best surface\n * into N candidates, measure, select. No generation memory beyond the current\n * surface; the loop body handles ranking + promotion.\n *\n * The reflective alternative is agent-runtime's runtime proposer with a\n * `reflectiveGenerator` / `agenticGenerator`: it reasons over the report +\n * trace findings to propose targeted edits rather than blind mutations. Both\n * conform to `SurfaceProposer`; the improvement loop is identical either way.\n */\n\nimport type { Mutator, SurfaceProposer } from '../types'\n\nexport interface EvolutionaryProposerOptions<TFindings = unknown> {\n mutator: Mutator<TFindings>\n /** External findings fed to the mutator each generation. Default: []. */\n findings?: TFindings[]\n}\n\nexport function evolutionaryProposer<TFindings = unknown>(\n opts: EvolutionaryProposerOptions<TFindings>,\n): SurfaceProposer<TFindings> {\n return {\n kind: `evolutionary:${opts.mutator.kind}`,\n async propose({ currentSurface, findings, populationSize, signal }) {\n return opts.mutator.mutate({\n findings: findings.length > 0 ? findings : (opts.findings ?? []),\n currentSurface,\n populationSize,\n signal,\n })\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAYO,SAAS,eACX,OACyB;AAC5B,MAAI,MAAM,WAAW,GAAG;AACtB,UAAM,IAAI,MAAM,wCAAwC;AAAA,EAC1D;AACA,SAAO;AAAA,IACL,MAAM,YAAY,MAAM,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,CAAC;AAAA,IACpD,MAAM,OAAO,KAA6D;AACxE,YAAM,UAAwE,CAAC;AAC/E,iBAAW,QAAQ,OAAO;AACxB,cAAM,MAAM,MAAM,KAAK,OAAO,GAAG;AACjC,gBAAQ,KAAK,EAAE,MAAM,IAAI,CAAC;AAAA,MAC5B;AAQA,YAAM,YAAY,QAAQ,IAAI,CAAC,MAAM,EAAE,IAAI,QAAQ;AACnD,YAAM,UAAwB,UAAU,MAAM,CAAC,MAAM,MAAM,MAAM,IAC7D,SACA,UAAU,SAAS,cAAc,IAC/B,iBACA,UAAU,SAAS,eAAe,IAChC,kBACA,UAAU,SAAS,MAAM,IACvB,SACA;AAEV,YAAM,eAAe,QAAQ;AAAA,QAAQ,CAAC,MACpC,EAAE,IAAI,kBAAkB,SAAS,IAC7B,EAAE,IAAI,oBACN,CAAC,EAAE,MAAM,EAAE,KAAK,MAAM,QAAQ,EAAE,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Q,UAAU;AACjC,SAAO;AAAA,IACL,MAAM,QAAQ,QAAQ;AAAA,IACtB,MAAM,OAAO,KAA6D;AACxE,YAAM,KAAK,oBAAoB,KAAK,QAAQ,YAAY,OAAO;AAC/D,aAAO,OAAO,EAAE;AAAA,IAClB;AAAA,EACF;AACF;;;ACrQA,eAAsB,QACpB,MAC+C;AAC/C,SAAO,YAAY,IAAI;AACzB;;;ACCO,SAAS,qBACd,MAC4B;AAC5B,SAAO;AAAA,IACL,MAAM,gBAAgB,KAAK,QAAQ,IAAI;AAAA,IACvC,MAAM,QAAQ,EAAE,gBAAgB,UAAU,gBAAgB,OAAO,GAAG;AAClE,aAAO,KAAK,QAAQ,OAAO;AAAA,QACzB,UAAU,SAAS,SAAS,IAAI,WAAY,KAAK,YAAY,CAAC;AAAA,QAC9D;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
@@ -252,9 +252,9 @@ function requireSha256Hex(value, path) {
252
252
  }
253
253
  var AGENT_PROFILE_KINDS = {
254
254
  /** A profile declared via `defineAgentProfile(...)` from
255
- * `@tangle-network/sandbox`. The default kind for sandbox-hosted
256
- * products (gtm-agent, blueprint-agent, sandbox, evals). */
257
- SANDBOX_AGENT_PROFILE: "sandbox-agent-profile"
255
+ * `@tangle-network/agent-interface`. The default kind for router-backed
256
+ * and sandbox-backed products. */
257
+ AGENT_INTERFACE_PROFILE: "agent-interface-profile"
258
258
  };
259
259
  function toAgentProfileJson(value) {
260
260
  let serialized;
@@ -274,19 +274,19 @@ function toAgentProfileJson(value) {
274
274
  }
275
275
  return JSON.parse(serialized);
276
276
  }
277
- async function buildSandboxAgentProfileCell(profile, input) {
277
+ async function buildAgentInterfaceProfileCell(profile, input) {
278
278
  if (!profile || typeof profile !== "object") {
279
- throw new AgentProfileCellValidationError("sandbox AgentProfile must be an object", "profile");
279
+ throw new AgentProfileCellValidationError("AgentProfile must be an object", "profile");
280
280
  }
281
281
  if (typeof profile.name !== "string" || profile.name.length === 0) {
282
282
  throw new AgentProfileCellValidationError(
283
- "sandbox AgentProfile must have a non-empty `name`",
283
+ "AgentProfile must have a non-empty `name`",
284
284
  "profile.name"
285
285
  );
286
286
  }
287
287
  if (typeof profile.version !== "string" || profile.version.length === 0) {
288
288
  throw new AgentProfileCellValidationError(
289
- "sandbox AgentProfile must have a non-empty `version`",
289
+ "AgentProfile must have a non-empty `version`",
290
290
  "profile.version"
291
291
  );
292
292
  }
@@ -294,7 +294,7 @@ async function buildSandboxAgentProfileCell(profile, input) {
294
294
  ...input,
295
295
  profileId: `${profile.name}@${profile.version}`,
296
296
  sourceProfile: {
297
- kind: AGENT_PROFILE_KINDS.SANDBOX_AGENT_PROFILE,
297
+ kind: AGENT_PROFILE_KINDS.AGENT_INTERFACE_PROFILE,
298
298
  profile: toAgentProfileJson(profile)
299
299
  }
300
300
  });
@@ -545,11 +545,11 @@ export {
545
545
  groupRunsByAgentProfileCell,
546
546
  AGENT_PROFILE_KINDS,
547
547
  toAgentProfileJson,
548
- buildSandboxAgentProfileCell,
548
+ buildAgentInterfaceProfileCell,
549
549
  RunRecordValidationError,
550
550
  validateRunRecord,
551
551
  isRunRecord,
552
552
  parseRunRecordSafe,
553
553
  roundTripRunRecord
554
554
  };
555
- //# sourceMappingURL=chunk-KWRRMR3J.js.map
555
+ //# sourceMappingURL=chunk-LO6IOIJ2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/agent-profile-cell.ts","../src/run-record.ts"],"sourcesContent":["import type { AgentProfile } from '@tangle-network/agent-interface'\nimport { ValidationError } from './errors'\nimport { hashJson } from './pre-registration'\n\nexport type AgentProfileCellSchemaVersion = 'agent-profile-cell/v1'\n\nexport type AgentProfileJson =\n | string\n | number\n | boolean\n | null\n | AgentProfileJson[]\n | { [key: string]: AgentProfileJson }\n\nexport type AgentProfileDimensionValue = string | number | boolean | null\n\nexport interface AgentProfileSource {\n /** Runtime/profile contract being fingerprinted, e.g. `agent-interface-profile`. */\n kind: string\n /** sha256 over the canonical source profile object. */\n hash: string\n}\n\nexport interface AgentProfileSourceInput {\n kind: string\n /** Precomputed sha256 for callers that already sign their profile artifact. */\n hash?: string\n /** Full canonical runtime profile; hashed and then discarded from the cell. */\n profile?: AgentProfileJson\n}\n\nexport interface AgentProfileHarness {\n id: string\n version?: string\n hash?: string\n}\n\nexport interface AgentProfileCellInput {\n profileId: string\n sourceProfile: AgentProfileSourceInput\n harness?: AgentProfileHarness\n model?: string\n promptHash?: string\n dimensions?: Record<string, AgentProfileDimensionValue>\n}\n\nexport interface AgentProfileCell {\n schemaVersion: AgentProfileCellSchemaVersion\n cellId: string\n profileId: string\n sourceProfile: AgentProfileSource\n harness?: AgentProfileHarness\n model?: string\n promptHash?: string\n dimensions?: Record<string, AgentProfileDimensionValue>\n}\n\nexport class AgentProfileCellValidationError extends ValidationError {\n readonly path: string\n constructor(message: string, path = '') {\n super(path ? `${message} (at ${path})` : message)\n this.path = path\n }\n}\n\nconst SHA256_HEX = /^[0-9a-f]{64}$/\nconst CELL_ID = /^agent-profile-cell:sha256:[0-9a-f]{64}$/\n\nexport async function buildAgentProfileCell(\n input: AgentProfileCellInput,\n): Promise<AgentProfileCell> {\n const material = await normalizeAgentProfileCellInput(input)\n const cellId = `agent-profile-cell:sha256:${await hashJson(material)}`\n return { ...material, cellId }\n}\n\nexport function agentProfileCellHashMaterial(\n cell: AgentProfileCell,\n): Omit<AgentProfileCell, 'cellId'> {\n const { cellId: _cellId, ...material } = cell\n void _cellId\n return normalizeAgentProfileCell(material)\n}\n\nexport async function verifyAgentProfileCell(cell: AgentProfileCell): Promise<boolean> {\n validateAgentProfileCell(cell)\n return (\n cell.cellId ===\n `agent-profile-cell:sha256:${await hashJson(agentProfileCellHashMaterial(cell))}`\n )\n}\n\nexport function validateAgentProfileCell(input: unknown): AgentProfileCell {\n if (input === null || typeof input !== 'object') {\n throw new AgentProfileCellValidationError('expected object')\n }\n const obj = input as Record<string, unknown>\n expectLiteral(obj.schemaVersion, 'agent-profile-cell/v1', 'schemaVersion')\n if (typeof obj.cellId !== 'string' || !CELL_ID.test(obj.cellId)) {\n throw new AgentProfileCellValidationError(\n 'cellId must match agent-profile-cell:sha256:<64 lowercase hex chars>',\n 'cellId',\n )\n }\n expectString(obj.profileId, 'profileId')\n validateSource(obj.sourceProfile, 'sourceProfile')\n if (obj.harness !== undefined) validateHarness(obj.harness, 'harness')\n if (obj.model !== undefined) expectString(obj.model, 'model')\n if (obj.promptHash !== undefined) expectString(obj.promptHash, 'promptHash')\n if (obj.dimensions !== undefined) validateDimensions(obj.dimensions, 'dimensions')\n return input as AgentProfileCell\n}\n\nexport function requireAgentProfileCell(record: {\n runId: string\n agentProfile?: AgentProfileCell\n}): AgentProfileCell {\n if (!record.agentProfile) {\n throw new AgentProfileCellValidationError(\n `run \"${record.runId}\" is missing agentProfile; profile-cell grouping requires explicit profile identity`,\n 'agentProfile',\n )\n }\n return validateAgentProfileCell(record.agentProfile)\n}\n\nexport function agentProfileCellKey(record: {\n runId: string\n agentProfile?: AgentProfileCell\n}): string {\n return requireAgentProfileCell(record).cellId\n}\n\nexport async function assertRunAgentProfileCell(record: {\n runId: string\n model: string\n promptHash: string\n agentProfile?: AgentProfileCell\n}): Promise<AgentProfileCell> {\n const profile = requireAgentProfileCell(record)\n if (!(await verifyAgentProfileCell(profile))) {\n throw new AgentProfileCellValidationError(\n `run \"${record.runId}\" has an agentProfile.cellId that does not match its content`,\n 'agentProfile.cellId',\n )\n }\n if (profile.model !== undefined && profile.model !== record.model) {\n throw new AgentProfileCellValidationError(\n `run \"${record.runId}\" agentProfile.model \"${profile.model}\" does not match model \"${record.model}\"`,\n 'agentProfile.model',\n )\n }\n if (profile.promptHash !== undefined && profile.promptHash !== record.promptHash) {\n throw new AgentProfileCellValidationError(\n `run \"${record.runId}\" agentProfile.promptHash \"${profile.promptHash}\" does not match promptHash \"${record.promptHash}\"`,\n 'agentProfile.promptHash',\n )\n }\n return profile\n}\n\nexport function groupRunsByAgentProfileCell<\n T extends { runId: string; agentProfile?: AgentProfileCell },\n>(records: readonly T[]): Map<string, T[]> {\n const groups = new Map<string, T[]>()\n for (const record of records) {\n const key = agentProfileCellKey(record)\n const bucket = groups.get(key)\n if (bucket) bucket.push(record)\n else groups.set(key, [record])\n }\n return groups\n}\n\nasync function normalizeAgentProfileCellInput(\n input: AgentProfileCellInput,\n): Promise<Omit<AgentProfileCell, 'cellId'>> {\n return normalizeAgentProfileCell({\n schemaVersion: 'agent-profile-cell/v1',\n profileId: input.profileId,\n sourceProfile: await normalizeSourceInput(input.sourceProfile),\n harness: input.harness,\n model: input.model,\n promptHash: input.promptHash,\n dimensions: input.dimensions,\n })\n}\n\nfunction normalizeAgentProfileCell(\n input: Omit<AgentProfileCell, 'cellId'>,\n): Omit<AgentProfileCell, 'cellId'> {\n return compactObject({\n schemaVersion: 'agent-profile-cell/v1' as const,\n profileId: requireNonEmpty(input.profileId, 'profileId'),\n sourceProfile: normalizeSource(input.sourceProfile),\n harness: input.harness ? normalizeHarness(input.harness, 'harness') : undefined,\n model: optionalNonEmpty(input.model, 'model'),\n promptHash: optionalNonEmpty(input.promptHash, 'promptHash'),\n dimensions: input.dimensions\n ? nonEmptyRecord(normalizeDimensions(input.dimensions))\n : undefined,\n })\n}\n\nasync function normalizeSourceInput(input: AgentProfileSourceInput): Promise<AgentProfileSource> {\n const kind = requireNonEmpty(input.kind, 'sourceProfile.kind')\n if (input.hash !== undefined && input.profile !== undefined) {\n throw new AgentProfileCellValidationError(\n 'sourceProfile must provide either hash or profile, not both',\n 'sourceProfile',\n )\n }\n if (input.hash !== undefined) {\n return { kind, hash: requireSha256Hex(input.hash, 'sourceProfile.hash') }\n }\n if (input.profile === undefined) {\n throw new AgentProfileCellValidationError(\n 'sourceProfile must provide hash or profile',\n 'sourceProfile',\n )\n }\n assertJson(input.profile, 'sourceProfile.profile')\n return { kind, hash: await hashJson(input.profile) }\n}\n\nfunction normalizeSource(input: AgentProfileSource): AgentProfileSource {\n return {\n kind: requireNonEmpty(input.kind, 'sourceProfile.kind'),\n hash: requireSha256Hex(input.hash, 'sourceProfile.hash'),\n }\n}\n\nfunction normalizeHarness(input: AgentProfileHarness, path: string): AgentProfileHarness {\n return compactObject({\n id: requireNonEmpty(input.id, `${path}.id`),\n version: optionalNonEmpty(input.version, `${path}.version`),\n hash: optionalNonEmpty(input.hash, `${path}.hash`),\n })\n}\n\nfunction normalizeDimensions(\n input: Record<string, AgentProfileDimensionValue>,\n): Record<string, AgentProfileDimensionValue> {\n const out: Record<string, AgentProfileDimensionValue> = {}\n for (const key of Object.keys(input).sort()) {\n const value = input[key]\n requireNonEmpty(key, 'dimensions.<key>')\n if (\n value !== null &&\n typeof value !== 'string' &&\n typeof value !== 'number' &&\n typeof value !== 'boolean'\n ) {\n throw new AgentProfileCellValidationError(\n 'expected primitive dimension value',\n `dimensions.${key}`,\n )\n }\n if (typeof value === 'number' && !Number.isFinite(value)) {\n throw new AgentProfileCellValidationError('expected finite number', `dimensions.${key}`)\n }\n out[key] = value\n }\n return out\n}\n\nfunction compactObject<T extends Record<string, unknown>>(input: T): T {\n const out: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(input)) {\n if (value !== undefined) out[key] = value\n }\n return out as T\n}\n\nfunction nonEmptyRecord<T extends Record<string, unknown>>(input: T): T | undefined {\n return Object.keys(input).length > 0 ? input : undefined\n}\n\nfunction validateSource(value: unknown, path: string): void {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new AgentProfileCellValidationError('expected object', path)\n }\n const rec = value as Record<string, unknown>\n expectString(rec.kind, `${path}.kind`)\n requireSha256Hex(rec.hash, `${path}.hash`)\n}\n\nfunction validateHarness(value: unknown, path: string): void {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new AgentProfileCellValidationError('expected object', path)\n }\n const rec = value as Record<string, unknown>\n expectString(rec.id, `${path}.id`)\n if (rec.version !== undefined) expectString(rec.version, `${path}.version`)\n if (rec.hash !== undefined) expectString(rec.hash, `${path}.hash`)\n}\n\nfunction validateDimensions(value: unknown, path: string): void {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new AgentProfileCellValidationError('expected object', path)\n }\n normalizeDimensions(value as Record<string, AgentProfileDimensionValue>)\n}\n\nfunction assertJson(value: AgentProfileJson, path: string): void {\n if (value === null) return\n const type = typeof value\n if (type === 'string' || type === 'boolean') return\n if (type === 'number') {\n if (!Number.isFinite(value)) {\n throw new AgentProfileCellValidationError('expected finite number', path)\n }\n return\n }\n if (Array.isArray(value)) {\n value.forEach((item, index) => {\n assertJson(item, `${path}[${index}]`)\n })\n return\n }\n if (type === 'object') {\n for (const [key, nested] of Object.entries(value)) {\n requireNonEmpty(key, `${path}.<key>`)\n assertJson(nested, `${path}.${key}`)\n }\n return\n }\n throw new AgentProfileCellValidationError('expected JSON-compatible value', path)\n}\n\nfunction expectLiteral(value: unknown, expected: string, path: string): void {\n if (value !== expected) {\n throw new AgentProfileCellValidationError(`expected ${expected}`, path)\n }\n}\n\nfunction expectString(value: unknown, path: string): void {\n if (typeof value !== 'string' || value.length === 0) {\n throw new AgentProfileCellValidationError('expected non-empty string', path)\n }\n}\n\nfunction requireNonEmpty(value: string, path: string): string {\n if (typeof value !== 'string' || value.length === 0) {\n throw new AgentProfileCellValidationError('expected non-empty string', path)\n }\n return value\n}\n\nfunction optionalNonEmpty(value: string | undefined, path: string): string | undefined {\n if (value === undefined) return undefined\n return requireNonEmpty(value, path)\n}\n\nfunction requireSha256Hex(value: unknown, path: string): string {\n if (typeof value !== 'string' || !SHA256_HEX.test(value)) {\n throw new AgentProfileCellValidationError('expected 64 lowercase sha256 hex chars', path)\n }\n return value\n}\n\n// ── Consumer helpers ─────────────────────────────────────────────────\n//\n// Boilerplate every product consuming `buildAgentProfileCell` used to duplicate:\n//\n// 1. A `JSON.parse(JSON.stringify(value))` helper that canonicalizes an\n// arbitrary `@tangle-network/agent-interface` `AgentProfile` into the recursive\n// `AgentProfileJson` shape, with a fail-loud error when the profile\n// is not JSON-serializable.\n//\n// 2. The magic string `'agent-interface-profile'` for `sourceProfile.kind`.\n//\n// Both belong here so the cross-product cell join (same canonical profile\n// hashes to the same `sourceProfile.hash` across products) is enforced by\n// the type system, not by every consumer remembering to do it right.\n// See blueprint-agent issue tangle-network/agent-eval#82.\n\n/** Canonical `sourceProfile.kind` values. Two products fingerprinting the\n * same canonical profile MUST use the same kind for their cells to share\n * `sourceProfile.hash`. Extend rather than create new strings — adding a\n * new kind is a deliberate cross-product schema change. */\nexport const AGENT_PROFILE_KINDS = {\n /** A profile declared via `defineAgentProfile(...)` from\n * `@tangle-network/agent-interface`. The default kind for router-backed\n * and sandbox-backed products. */\n AGENT_INTERFACE_PROFILE: 'agent-interface-profile',\n} as const\n\nexport type AgentProfileKind = (typeof AGENT_PROFILE_KINDS)[keyof typeof AGENT_PROFILE_KINDS]\n\n/** Canonicalize an arbitrary value into `AgentProfileJson` by JSON\n * round-trip. Throws when the value contains anything not representable\n * as JSON (functions, BigInt, cycles) — non-portable profiles fail loud\n * rather than silently dropping fields. */\nexport function toAgentProfileJson(value: unknown): AgentProfileJson {\n let serialized: string | undefined\n try {\n serialized = JSON.stringify(value)\n } catch (err) {\n throw new AgentProfileCellValidationError(\n `agent profile must be JSON-serializable: ${err instanceof Error ? err.message : String(err)}`,\n 'sourceProfile.profile',\n )\n }\n if (serialized === undefined) {\n throw new AgentProfileCellValidationError(\n 'agent profile must be JSON-serializable (got undefined after JSON.stringify)',\n 'sourceProfile.profile',\n )\n }\n return JSON.parse(serialized) as AgentProfileJson\n}\n\n/** Canonical AgentProfile shape required when deriving a stable cell id. */\nexport type AgentInterfaceProfileLike = AgentProfile & { name: string; version: string }\n\n/** Higher-level helper that hard-codes the canonical\n * `agent-interface-profile` kind plus the JSON canonicalization. Equivalent\n * to calling `buildAgentProfileCell` with `profileId = \\`${name}@${version}\\``\n * and `sourceProfile = { kind: AGENT_INTERFACE_PROFILE, profile: <round-tripped> }`.\n *\n * Use this from any product consuming an agent-interface `AgentProfile`; the\n * manual `buildAgentProfileCell` call is reserved for advanced cases\n * (custom kinds, pre-computed source hashes, alternate profileId\n * conventions). */\nexport async function buildAgentInterfaceProfileCell(\n profile: AgentInterfaceProfileLike,\n input: Omit<AgentProfileCellInput, 'profileId' | 'sourceProfile'>,\n): Promise<AgentProfileCell> {\n if (!profile || typeof profile !== 'object') {\n throw new AgentProfileCellValidationError('AgentProfile must be an object', 'profile')\n }\n if (typeof profile.name !== 'string' || profile.name.length === 0) {\n throw new AgentProfileCellValidationError(\n 'AgentProfile must have a non-empty `name`',\n 'profile.name',\n )\n }\n if (typeof profile.version !== 'string' || profile.version.length === 0) {\n throw new AgentProfileCellValidationError(\n 'AgentProfile must have a non-empty `version`',\n 'profile.version',\n )\n }\n return buildAgentProfileCell({\n ...input,\n profileId: `${profile.name}@${profile.version}`,\n sourceProfile: {\n kind: AGENT_PROFILE_KINDS.AGENT_INTERFACE_PROFILE,\n profile: toAgentProfileJson(profile),\n },\n })\n}\n","/**\n * Paper-grade RunRecord schema + runtime validator.\n *\n * Every run that participates in a promotion gate, paper table, or\n * researcher loop SHOULD be recorded as a `RunRecord`. The mandatory\n * fields are exactly those the paper \"Two Loops, Three Roles\" requires\n * for reproducibility: who/what/when/cost/seed/hash, plus the search vs\n * holdout split tag and either a `searchScore` or a `holdoutScore`.\n *\n * This is intentionally NOT a replacement for the rich `Run` /\n * `ProposeReviewReport` / `ScenarioResult` types already in the\n * package. Those are runtime structures with full provenance. A\n * `RunRecord` is the analysis-time projection — the JSON-friendly\n * row you'd put in a parquet file or paste into a notebook.\n *\n * Validate at the boundary:\n *\n * const rec = validateRunRecord(rawJson) // throws on missing\n * const ok = isRunRecord(rawJson) // boolean check\n * const rec = parseRunRecordSafe(rawJson) // { ok, value | error }\n *\n * The validator runs in pure TS — zod is intentionally NOT a\n * dependency. Round-trip tested in `tests/run-record.test.ts`.\n */\n\nimport type { AgentProfileCell } from './agent-profile-cell'\nimport { validateAgentProfileCell } from './agent-profile-cell'\nimport { ValidationError } from './errors'\nimport type { FailureClass } from './trace/schema'\n\n/** Search/dev/holdout split tag. 'search' is the paper-grade alias for the\n * combined train+test pool that the optimizer is allowed to read. */\nexport type RunSplitTag = 'search' | 'dev' | 'holdout'\n\nexport interface RunTokenUsage {\n input: number\n output: number\n cached?: number\n}\n\nexport interface RunJudgeMetadata {\n model: string\n promptVersion: string\n /** [0,1] confidence the judge declared. Constant judge confidence\n * across many runs is a fallback signal (see `canary.ts`). */\n confidence: number\n /** True if the judge degraded to a fallback path (rules-only,\n * prior-call cache, etc.). The canary uses this to alert. */\n fallback: boolean\n}\n\n/**\n * Per-judge / per-dimension breakdown for runs scored by an ensemble of\n * judges over a multi-dimensional rubric.\n *\n * The collapsed `outcome.searchScore` / `holdoutScore` carries the\n * composite the gate uses. The full breakdown belongs here so consumers\n * can answer \"which judge disagreed?\", \"which dimension dragged the\n * composite down?\", and \"did half the panel fail?\" without re-running.\n *\n * `perJudge[judgeId][dim]` is the canonical source; `perDimMean` and\n * `composite` are convenience projections — derivable but precomputed so\n * downstream IRR primitives (`interRaterReliability`,\n * `corpusInterRaterAgreement`) and reporters don't pay the same\n * aggregation twice.\n *\n * Fail-loud discipline: judges that errored out land in `failedJudges`\n * by id. A missing key in `perJudge` is ambiguous (silent zero vs not\n * run); the explicit list makes a partial-failure recorded as such.\n */\nexport interface JudgeScoresRecord {\n /** Per-judge per-dimension scores. `{ \"kimi-k2.6\": { helpfulness: 0.8, clarity: 0.7 }, ... }`. */\n perJudge: Record<string, Record<string, number>>\n /** Per-dim mean across judges. Convenience — derivable from `perJudge`. */\n perDimMean: Record<string, number>\n /** Composite mean across all dims and judges. Mirrors the score\n * the gate sees on `outcome.searchScore` / `holdoutScore`. */\n composite: number\n /** Judges that errored or returned an unparseable verdict. Recorded\n * by id (e.g. `['glm-5.1']`) so a partial-failure case is explicit,\n * not inferred from missing keys in `perJudge`. */\n failedJudges?: string[]\n /** Free-form notes the judges emitted (joined across judges or\n * first-judge only — consumer's choice). */\n notes?: string\n}\n\nexport interface RunOutcome {\n /** Score on the search/optimization split. Optional because a\n * holdout-only evaluation only fills `holdoutScore`. */\n searchScore?: number\n /** Score on the held-out split. Optional because a search-only run\n * only fills `searchScore`. At least one must be present. */\n holdoutScore?: number\n /** Bag of any other metric the run produced — judge dimensions,\n * pass/fail counters, latency stats, etc. Numeric only — keeps\n * reporters honest. */\n raw: Record<string, number>\n /** Per-judge / per-dim breakdown. Consumers writing ensemble\n * judgements populate this; substrate primitives like\n * `interRaterReliability` and `corpusInterRaterAgreement` accept\n * these records as input. Optional — single-judge or scalar-only\n * runs leave it unset. */\n judgeScores?: JudgeScoresRecord\n /** Authenticity / realness verdict — did the run build the REAL thing on the\n * intended infra, or fake it (see `./authenticity`)? Optional: only domains\n * with an authenticity config populate it. Carried in the corpus so the\n * flywheel / off-policy learning can optimize for real completion, not gamed\n * pass-rate. `score` is 0-1; `gated` is the anti-Goodhart flag — a gated run\n * must not count as a real success regardless of `score`. */\n realness?: { score: number; gated: boolean; reason?: string }\n}\n\n/**\n * Mandatory paper-grade fields for a single evaluation run. Optional\n * fields are extension points; mandatory fields throw if missing.\n *\n * Hash discipline:\n * - `promptHash` is the sha256 of the EFFECTIVE prompt sent to the\n * model (after any steering bundle merge).\n * - `configHash` is the sha256 of the effective run config (model,\n * temperature, tools, judges, splits). The pair (promptHash,\n * configHash) uniquely identifies an experiment cell.\n *\n * Model snapshot discipline:\n * - `model` MUST encode a snapshot version. Bare aliases like\n * `claude-sonnet-4` or `gpt-4o` are banned — they remap silently.\n * Use `claude-sonnet-4-6@2025-04-15` or `gpt-4o-2024-11-20`.\n */\nexport interface RunRecord {\n /** UUID for the run. */\n runId: string\n /** Logical experiment grouping (a treatment vs a baseline within\n * the same sweep should share `experimentId`). */\n experimentId: string\n /** Stable identifier for the candidate (variant) being run. The\n * promotion gate compares two `candidateId`s on matched items. */\n candidateId: string\n /** RNG seed for the run. Always recorded — silent re-seeding is\n * the most common cause of non-reproducible numbers. */\n seed: number\n /** Model identifier WITH snapshot version. */\n model: string\n /** sha256 of the effective prompt (post-steering). */\n promptHash: string\n /** sha256 of the effective config. */\n configHash: string\n /** Git SHA the harness was run from. */\n commitSha: string\n /** End-to-end wall-clock duration in milliseconds. */\n wallMs: number\n /** Time spent queued before execution started, if known. */\n queueMs?: number\n /** Total USD cost. Mandatory — runs without a cost number are\n * unbounded by definition and must not be admitted into the gate. */\n costUsd: number\n /** Token usage breakdown. */\n tokenUsage: RunTokenUsage\n /** Judge-side metadata, if a judge was used. */\n judgeMetadata?: RunJudgeMetadata\n /** Per-split scores + raw bag. */\n outcome: RunOutcome\n /** Canonical, cross-agent failure class drawn from the shared\n * `FAILURE_CLASSES` taxonomy. This is the aggregation key that makes\n * \"which failure dominates across the whole fleet\" answerable in ONE\n * vocabulary — every agent classifies against the same enum. Producers\n * set it via the substrate classifier; leave unset only when the failure\n * genuinely can't be classified. */\n failureClass?: FailureClass\n /** Free-form domain-specific failure detail, scoped UNDER `failureClass`\n * (e.g. failureClass='tool_recovery_failure', failureMode='forge_build_unsatisfied').\n * The within-agent drill-down; `failureClass` is the cross-agent key. */\n failureMode?: string\n /** Which split this run was drawn from. */\n splitTag: RunSplitTag\n /**\n * Stable scenario identifier the run was scored against. Optional for\n * backwards compatibility, but **strongly recommended**: every primitive\n * that pairs runs by scenario (preferences, paired stats, BT tournament)\n * keys on this. The campaign artifact populates it canonically; legacy\n * runs without it fall back to inference from `outcome.raw.scenario_id`\n * or `experimentId`.\n */\n scenarioId?: string\n /**\n * Canonical identity for the agent profile cell that produced this row:\n * profile artifact hash plus optional harness/model/prompt/reporting\n * dimensions. Use `agentProfile.cellId` to group persona sweeps and\n * longitudinal reports by the complete source profile, not by a loose\n * candidate label or opaque config hash.\n */\n agentProfile?: AgentProfileCell\n}\n\n// ── Validation ───────────────────────────────────────────────────────\n\nconst MANDATORY_TOP_LEVEL = [\n 'runId',\n 'experimentId',\n 'candidateId',\n 'seed',\n 'model',\n 'promptHash',\n 'configHash',\n 'commitSha',\n 'wallMs',\n 'costUsd',\n 'tokenUsage',\n 'outcome',\n 'splitTag',\n] as const\n\nconst SPLIT_TAGS: ReadonlyArray<RunSplitTag> = ['search', 'dev', 'holdout']\n\nexport class RunRecordValidationError extends ValidationError {\n readonly path: string\n constructor(message: string, path = '') {\n super(path ? `${message} (at ${path})` : message)\n this.path = path\n }\n}\n\n/**\n * Strict validator. Throws `RunRecordValidationError` on the first\n * missing or wrongly-typed field. Returns the input cast to\n * `RunRecord` on success — the validator does not coerce.\n */\nexport function validateRunRecord(input: unknown): RunRecord {\n if (input === null || typeof input !== 'object') {\n throw new RunRecordValidationError('expected object')\n }\n const obj = input as Record<string, unknown>\n\n for (const key of MANDATORY_TOP_LEVEL) {\n if (!(key in obj)) {\n throw new RunRecordValidationError(`missing mandatory field \"${key}\"`)\n }\n }\n\n expectString(obj.runId, 'runId')\n expectString(obj.experimentId, 'experimentId')\n expectString(obj.candidateId, 'candidateId')\n expectFiniteNumber(obj.seed, 'seed')\n expectString(obj.model, 'model')\n expectString(obj.promptHash, 'promptHash')\n expectString(obj.configHash, 'configHash')\n expectString(obj.commitSha, 'commitSha')\n expectFiniteNumber(obj.wallMs, 'wallMs')\n if (obj.queueMs !== undefined) expectFiniteNumber(obj.queueMs, 'queueMs')\n expectFiniteNumber(obj.costUsd, 'costUsd')\n\n // Snapshot discipline: bare model aliases are not paper-grade.\n if (!modelHasSnapshot(obj.model as string)) {\n throw new RunRecordValidationError(\n `model \"${obj.model}\" lacks a snapshot version (use 'name@YYYY-MM-DD' or 'name-YYYYMMDD')`,\n 'model',\n )\n }\n\n // Token usage.\n const tu = obj.tokenUsage\n if (tu === null || typeof tu !== 'object') {\n throw new RunRecordValidationError('tokenUsage must be an object', 'tokenUsage')\n }\n const tuRec = tu as Record<string, unknown>\n expectFiniteNumber(tuRec.input, 'tokenUsage.input')\n expectFiniteNumber(tuRec.output, 'tokenUsage.output')\n if (tuRec.cached !== undefined) expectFiniteNumber(tuRec.cached, 'tokenUsage.cached')\n\n // Judge metadata, optional.\n if (obj.judgeMetadata !== undefined) {\n const jm = obj.judgeMetadata\n if (jm === null || typeof jm !== 'object') {\n throw new RunRecordValidationError('judgeMetadata must be an object', 'judgeMetadata')\n }\n const jmRec = jm as Record<string, unknown>\n expectString(jmRec.model, 'judgeMetadata.model')\n expectString(jmRec.promptVersion, 'judgeMetadata.promptVersion')\n expectFiniteNumber(jmRec.confidence, 'judgeMetadata.confidence')\n if (typeof jmRec.fallback !== 'boolean') {\n throw new RunRecordValidationError(\n 'judgeMetadata.fallback must be boolean',\n 'judgeMetadata.fallback',\n )\n }\n }\n\n // Outcome.\n const out = obj.outcome\n if (out === null || typeof out !== 'object') {\n throw new RunRecordValidationError('outcome must be an object', 'outcome')\n }\n const outRec = out as Record<string, unknown>\n if (outRec.searchScore !== undefined)\n expectFiniteNumber(outRec.searchScore, 'outcome.searchScore')\n if (outRec.holdoutScore !== undefined)\n expectFiniteNumber(outRec.holdoutScore, 'outcome.holdoutScore')\n if (outRec.searchScore === undefined && outRec.holdoutScore === undefined) {\n throw new RunRecordValidationError(\n 'outcome must define searchScore or holdoutScore (or both)',\n 'outcome',\n )\n }\n const raw = outRec.raw\n if (raw === null || typeof raw !== 'object') {\n throw new RunRecordValidationError('outcome.raw must be an object', 'outcome.raw')\n }\n for (const [k, v] of Object.entries(raw as Record<string, unknown>)) {\n expectFiniteNumber(v, `outcome.raw.${k}`)\n }\n // Realness verdict, optional.\n if (outRec.realness !== undefined) {\n const r = outRec.realness\n if (r === null || typeof r !== 'object') {\n throw new RunRecordValidationError('outcome.realness must be an object', 'outcome.realness')\n }\n const rr = r as Record<string, unknown>\n expectFiniteNumber(rr.score, 'outcome.realness.score')\n if (typeof rr.gated !== 'boolean') {\n throw new RunRecordValidationError(\n 'outcome.realness.gated must be a boolean',\n 'outcome.realness.gated',\n )\n }\n }\n\n // Per-judge / per-dim breakdown, optional.\n if (outRec.judgeScores !== undefined) {\n validateJudgeScores(outRec.judgeScores, 'outcome.judgeScores')\n }\n\n // Failure mode optional.\n if (obj.failureMode !== undefined) expectString(obj.failureMode, 'failureMode')\n\n if (obj.agentProfile !== undefined) {\n try {\n const profile = validateAgentProfileCell(obj.agentProfile)\n if (profile.model !== undefined && profile.model !== obj.model) {\n throw new RunRecordValidationError(\n `agentProfile.model \"${profile.model}\" does not match model \"${obj.model}\"`,\n 'agentProfile.model',\n )\n }\n if (profile.promptHash !== undefined && profile.promptHash !== obj.promptHash) {\n throw new RunRecordValidationError(\n `agentProfile.promptHash \"${profile.promptHash}\" does not match promptHash \"${obj.promptHash}\"`,\n 'agentProfile.promptHash',\n )\n }\n } catch (error) {\n if (error instanceof RunRecordValidationError) throw error\n if (error instanceof Error) {\n throw new RunRecordValidationError(error.message, 'agentProfile')\n }\n throw error\n }\n }\n\n // Split tag.\n if (typeof obj.splitTag !== 'string' || !SPLIT_TAGS.includes(obj.splitTag as RunSplitTag)) {\n throw new RunRecordValidationError(\n `splitTag must be one of ${SPLIT_TAGS.join(', ')}, got ${String(obj.splitTag)}`,\n 'splitTag',\n )\n }\n\n return input as RunRecord\n}\n\n/** Boolean validator — convenience for filtering arrays. */\nexport function isRunRecord(input: unknown): input is RunRecord {\n try {\n validateRunRecord(input)\n return true\n } catch {\n return false\n }\n}\n\n/** Non-throwing validator — returns a discriminated union. */\nexport function parseRunRecordSafe(\n input: unknown,\n): { ok: true; value: RunRecord } | { ok: false; error: RunRecordValidationError } {\n try {\n return { ok: true, value: validateRunRecord(input) }\n } catch (e) {\n if (e instanceof RunRecordValidationError) return { ok: false, error: e }\n throw e\n }\n}\n\n/** Round-trip helper — `JSON.parse(JSON.stringify(record))` then validate. */\nexport function roundTripRunRecord(record: RunRecord): RunRecord {\n const json = JSON.stringify(record)\n return validateRunRecord(JSON.parse(json))\n}\n\n// ── Internals ────────────────────────────────────────────────────────\n\nfunction expectString(value: unknown, path: string): void {\n if (typeof value !== 'string' || value.length === 0) {\n throw new RunRecordValidationError(`expected non-empty string`, path)\n }\n}\n\nfunction expectFiniteNumber(value: unknown, path: string): void {\n if (typeof value !== 'number' || !Number.isFinite(value)) {\n throw new RunRecordValidationError(`expected finite number`, path)\n }\n}\n\nfunction validateJudgeScores(value: unknown, path: string): void {\n if (value === null || typeof value !== 'object') {\n throw new RunRecordValidationError('judgeScores must be an object', path)\n }\n const rec = value as Record<string, unknown>\n\n const perJudge = rec.perJudge\n if (perJudge === null || typeof perJudge !== 'object') {\n throw new RunRecordValidationError('perJudge must be an object', `${path}.perJudge`)\n }\n for (const [judgeId, dims] of Object.entries(perJudge as Record<string, unknown>)) {\n if (dims === null || typeof dims !== 'object') {\n throw new RunRecordValidationError(\n 'per-judge entry must be an object of dimension scores',\n `${path}.perJudge.${judgeId}`,\n )\n }\n for (const [dim, score] of Object.entries(dims as Record<string, unknown>)) {\n expectFiniteNumber(score, `${path}.perJudge.${judgeId}.${dim}`)\n }\n }\n\n const perDimMean = rec.perDimMean\n if (perDimMean === null || typeof perDimMean !== 'object') {\n throw new RunRecordValidationError('perDimMean must be an object', `${path}.perDimMean`)\n }\n for (const [dim, mean] of Object.entries(perDimMean as Record<string, unknown>)) {\n expectFiniteNumber(mean, `${path}.perDimMean.${dim}`)\n }\n\n expectFiniteNumber(rec.composite, `${path}.composite`)\n\n if (rec.failedJudges !== undefined) {\n if (!Array.isArray(rec.failedJudges)) {\n throw new RunRecordValidationError(\n 'failedJudges must be an array of strings',\n `${path}.failedJudges`,\n )\n }\n for (let i = 0; i < rec.failedJudges.length; i++) {\n const id = rec.failedJudges[i]\n if (typeof id !== 'string' || id.length === 0) {\n throw new RunRecordValidationError(\n 'failedJudges entry must be a non-empty string',\n `${path}.failedJudges[${i}]`,\n )\n }\n }\n }\n\n if (rec.notes !== undefined && typeof rec.notes !== 'string') {\n throw new RunRecordValidationError('notes must be a string', `${path}.notes`)\n }\n}\n\n/**\n * Heuristic snapshot check. Accepts:\n * - `name@YYYY-MM-DD` (Anthropic style: `claude-sonnet-4-6@2025-04-15`)\n * - `name-YYYYMMDD` (OpenAI style: `gpt-4o-2024-11-20`)\n * - `name@<arbitrary-token>` (allow opaque snapshots like `@v3`)\n * - explicit `:date-...` Vertex-style tags\n *\n * Rejects bare aliases like `claude-sonnet-4` or `gpt-4o` that remap\n * silently as providers ship new snapshots.\n */\nfunction modelHasSnapshot(model: string): boolean {\n if (model.includes('@')) return true\n if (/-\\d{8}$/.test(model)) return true\n if (/-\\d{4}-\\d{2}-\\d{2}$/.test(model)) return true\n if (/:date-/.test(model)) return true\n return false\n}\n"],"mappings":";;;;;;;;AAyDO,IAAM,kCAAN,cAA8C,gBAAgB;AAAA,EAC1D;AAAA,EACT,YAAY,SAAiB,OAAO,IAAI;AACtC,UAAM,OAAO,GAAG,OAAO,QAAQ,IAAI,MAAM,OAAO;AAChD,SAAK,OAAO;AAAA,EACd;AACF;AAEA,IAAM,aAAa;AACnB,IAAM,UAAU;AAEhB,eAAsB,sBACpB,OAC2B;AAC3B,QAAM,WAAW,MAAM,+BAA+B,KAAK;AAC3D,QAAM,SAAS,6BAA6B,MAAM,SAAS,QAAQ,CAAC;AACpE,SAAO,EAAE,GAAG,UAAU,OAAO;AAC/B;AAEO,SAAS,6BACd,MACkC;AAClC,QAAM,EAAE,QAAQ,SAAS,GAAG,SAAS,IAAI;AACzC,OAAK;AACL,SAAO,0BAA0B,QAAQ;AAC3C;AAEA,eAAsB,uBAAuB,MAA0C;AACrF,2BAAyB,IAAI;AAC7B,SACE,KAAK,WACL,6BAA6B,MAAM,SAAS,6BAA6B,IAAI,CAAC,CAAC;AAEnF;AAEO,SAAS,yBAAyB,OAAkC;AACzE,MAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;AAC/C,UAAM,IAAI,gCAAgC,iBAAiB;AAAA,EAC7D;AACA,QAAM,MAAM;AACZ,gBAAc,IAAI,eAAe,yBAAyB,eAAe;AACzE,MAAI,OAAO,IAAI,WAAW,YAAY,CAAC,QAAQ,KAAK,IAAI,MAAM,GAAG;AAC/D,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Q,IAAI,YAAY,GAAG;AACpC,YAAM,IAAI;AAAA,QACR;AAAA,QACA,GAAG,IAAI;AAAA,MACT;AAAA,IACF;AACA,aAAS,IAAI,GAAG,IAAI,IAAI,aAAa,QAAQ,KAAK;AAChD,YAAM,KAAK,IAAI,aAAa,CAAC;AAC7B,UAAI,OAAO,OAAO,YAAY,GAAG,WAAW,GAAG;AAC7C,cAAM,IAAI;AAAA,UACR;AAAA,UACA,GAAG,IAAI,iBAAiB,CAAC;AAAA,QAC3B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,MAAI,IAAI,UAAU,UAAa,OAAO,IAAI,UAAU,UAAU;AAC5D,UAAM,IAAI,yBAAyB,0BAA0B,GAAG,IAAI,QAAQ;AAAA,EAC9E;AACF;AAYA,SAAS,iBAAiB,OAAwB;AAChD,MAAI,MAAM,SAAS,GAAG,EAAG,QAAO;AAChC,MAAI,UAAU,KAAK,KAAK,EAAG,QAAO;AAClC,MAAI,sBAAsB,KAAK,KAAK,EAAG,QAAO;AAC9C,MAAI,SAAS,KAAK,KAAK,EAAG,QAAO;AACjC,SAAO;AACT;","names":["expectString"]}
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  cohensD
3
- } from "./chunk-LMZQ2Z4U.js";
3
+ } from "./chunk-56GC6VYO.js";
4
4
  import {
5
5
  argHash,
6
6
  groupBy,
7
7
  toolSpans
8
- } from "./chunk-47X6LRCE.js";
8
+ } from "./chunk-UFSG7ACU.js";
9
9
 
10
10
  // src/failure-taxonomy.ts
11
11
  var DEFAULT_RULES = [
@@ -552,4 +552,4 @@ export {
552
552
  iqr,
553
553
  welchsTTest
554
554
  };
555
- //# sourceMappingURL=chunk-L3JOU6XM.js.map
555
+ //# sourceMappingURL=chunk-NACM5RS7.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-YEHAEDUD.js";
5
5
  import {
6
6
  validateRunRecord
7
- } from "./chunk-KWRRMR3J.js";
7
+ } from "./chunk-LO6IOIJ2.js";
8
8
  import {
9
9
  TraceEmitter
10
10
  } from "./chunk-TVVP3ZZQ.js";
@@ -610,4 +610,4 @@ export {
610
610
  runProposeReviewAsControlLoop,
611
611
  controlFailureClassFromVerification
612
612
  };
613
- //# sourceMappingURL=chunk-E4GH6USR.js.map
613
+ //# sourceMappingURL=chunk-NZEQVRH5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/action-policy.ts","../src/run-evidence.ts","../src/propose-review.ts","../src/propose-review-control.ts"],"sourcesContent":["import type { FeedbackLabel, ProposedSideEffect } from './feedback-trajectory'\n\nexport interface ActionExecutionPolicy {\n allowedTypes?: string[]\n blockedTypes?: string[]\n alwaysRequireApprovalTypes?: string[]\n autoApproveTypes?: string[]\n requireApprovalForExternalSideEffects?: boolean\n requireApprovalAboveCostUsd?: number\n maxActionCostUsd?: number\n remainingBudgetUsd?: number\n expectedOutcomeRequired?: boolean\n killCriteriaRequired?: boolean\n}\n\nexport interface ActionPolicyDecision {\n allowed: boolean\n blocked: boolean\n requiresApproval: boolean\n reasons: string[]\n label?: FeedbackLabel\n}\n\nexport function evaluateActionPolicy(\n action: ProposedSideEffect,\n policy: ActionExecutionPolicy = {},\n options: { createdAt?: string } = {},\n): ActionPolicyDecision {\n const reasons: string[] = []\n let blocked = false\n let requiresApproval = Boolean(action.requiresApproval)\n\n if (policy.allowedTypes?.length && !policy.allowedTypes.includes(action.type)) {\n blocked = true\n reasons.push(`action type \"${action.type}\" is not allowed`)\n }\n if (policy.blockedTypes?.includes(action.type)) {\n blocked = true\n reasons.push(`action type \"${action.type}\" is blocked`)\n }\n if (policy.alwaysRequireApprovalTypes?.includes(action.type)) {\n requiresApproval = true\n reasons.push(`action type \"${action.type}\" requires approval`)\n }\n if (policy.requireApprovalForExternalSideEffects && action.externalSideEffect) {\n requiresApproval = true\n reasons.push('external side effect requires approval')\n }\n if (\n policy.requireApprovalAboveCostUsd !== undefined &&\n (action.costUsd ?? 0) > policy.requireApprovalAboveCostUsd\n ) {\n requiresApproval = true\n reasons.push(\n `cost ${action.costUsd} exceeds approval threshold ${policy.requireApprovalAboveCostUsd}`,\n )\n }\n if (policy.maxActionCostUsd !== undefined && (action.costUsd ?? 0) > policy.maxActionCostUsd) {\n blocked = true\n reasons.push(`cost ${action.costUsd} exceeds max action cost ${policy.maxActionCostUsd}`)\n }\n if (\n policy.remainingBudgetUsd !== undefined &&\n (action.costUsd ?? 0) > policy.remainingBudgetUsd\n ) {\n blocked = true\n reasons.push(`cost ${action.costUsd} exceeds remaining budget ${policy.remainingBudgetUsd}`)\n }\n if (policy.expectedOutcomeRequired && !action.metadata?.expectedOutcome) {\n blocked = true\n reasons.push('expected outcome is required')\n }\n if (policy.killCriteriaRequired && !action.metadata?.killCriteria) {\n blocked = true\n reasons.push('kill criteria are required')\n }\n if (policy.autoApproveTypes?.includes(action.type) && requiresApproval) {\n reasons.push(\n `action type \"${action.type}\" is auto-approved only when no approval policy applies`,\n )\n }\n\n if (!reasons.length) reasons.push(requiresApproval ? 'approval required' : 'action allowed')\n\n const label =\n blocked || requiresApproval\n ? {\n source: 'policy' as const,\n kind: blocked ? ('policy_block' as const) : ('comment' as const),\n value: { actionType: action.type, blocked, requiresApproval },\n reason: reasons.join('; '),\n severity: blocked ? ('critical' as const) : ('warning' as const),\n createdAt: options.createdAt ?? new Date().toISOString(),\n metadata: { action, policy },\n }\n : undefined\n\n return {\n allowed: !blocked,\n blocked,\n requiresApproval: !blocked && requiresApproval,\n reasons,\n label,\n }\n}\n","import type { ControlEvalResult, ControlRunResult } from './control-runtime'\nimport {\n type RunRecord,\n type RunSplitTag,\n type RunTokenUsage,\n validateRunRecord,\n} from './run-record'\nimport type { FailureClass } from './trace/schema'\n\nexport interface RunEvidenceMetadata {\n experimentId: string\n candidateId: string\n seed: number\n model: string\n promptHash: string\n configHash: string\n commitSha: string\n splitTag: RunSplitTag\n tokenUsage: RunTokenUsage\n queueMs?: number\n judgeMetadata?: RunRecord['judgeMetadata']\n raw?: Record<string, number>\n}\n\nexport interface ControlRunToRunRecordOptions extends RunEvidenceMetadata {\n runId?: string\n score?: number\n failureMode?: string\n}\n\n/**\n * Project a completed control-loop run into the strict RunRecord shape used by\n * release gates, optimizer tables, and research reports.\n *\n * The control loop owns live execution evidence. The caller still supplies the\n * experiment-cell metadata because prompt/config hashes, split assignment,\n * model snapshot, and commit SHA are product/harness concerns.\n */\nexport function controlRunToRunRecord<\n TState,\n TAction,\n TActionResult,\n TEval extends ControlEvalResult = ControlEvalResult,\n>(\n run: ControlRunResult<TState, TAction, TActionResult, TEval>,\n options: ControlRunToRunRecordOptions,\n): RunRecord {\n const score = clampScore(\n options.score ?? run.score ?? scoreFromEvals(run.finalEvals) ?? (run.pass ? 1 : 0),\n )\n const outcome =\n options.splitTag === 'holdout'\n ? { holdoutScore: score, raw: normalizeRawMetrics(options.raw, run, score) }\n : { searchScore: score, raw: normalizeRawMetrics(options.raw, run, score) }\n\n return validateRunRecord({\n runId:\n options.runId ??\n run.runId ??\n `control:${options.experimentId}:${options.candidateId}:${options.seed}:${options.splitTag}`,\n experimentId: options.experimentId,\n candidateId: options.candidateId,\n seed: options.seed,\n model: options.model,\n promptHash: options.promptHash,\n configHash: options.configHash,\n commitSha: options.commitSha,\n wallMs: run.wallMs,\n ...(options.queueMs !== undefined ? { queueMs: options.queueMs } : {}),\n costUsd: run.spentCostUsd,\n tokenUsage: options.tokenUsage,\n ...(options.judgeMetadata ? { judgeMetadata: options.judgeMetadata } : {}),\n outcome,\n failureMode: options.failureMode ?? failureModeFromRun(run),\n splitTag: options.splitTag,\n })\n}\n\nexport function scoreFromEvals(evals: readonly ControlEvalResult[]): number | undefined {\n const scores = evals\n .map((e) => e.score)\n .filter((score): score is number => typeof score === 'number' && Number.isFinite(score))\n if (scores.length === 0) return undefined\n return clampScore(scores.reduce((sum, score) => sum + score, 0) / scores.length)\n}\n\nfunction normalizeRawMetrics<TState, TAction, TActionResult, TEval extends ControlEvalResult>(\n raw: Record<string, number> | undefined,\n run: ControlRunResult<TState, TAction, TActionResult, TEval>,\n score: number,\n): Record<string, number> {\n return {\n ...finiteOnly(raw ?? {}),\n score,\n pass: run.pass ? 1 : 0,\n completed: run.completed ? 1 : 0,\n steps: run.steps.length,\n runtimeErrors: run.runtimeErrors.length,\n }\n}\n\nfunction finiteOnly(values: Record<string, number>): Record<string, number> {\n const out: Record<string, number> = {}\n for (const [key, value] of Object.entries(values)) {\n if (Number.isFinite(value)) out[key] = value\n }\n return out\n}\n\nfunction failureModeFromRun<TState, TAction, TActionResult, TEval extends ControlEvalResult>(\n run: ControlRunResult<TState, TAction, TActionResult, TEval>,\n): FailureClass | undefined {\n if (run.pass) return undefined\n return run.failureClass ?? 'unknown'\n}\n\nfunction clampScore(value: number): number {\n if (!Number.isFinite(value)) return 0\n return Math.max(0, Math.min(1, value))\n}\n","/**\n * Propose / Verify / Review — the core multi-shot primitive.\n *\n * shot N: propose(state, priorReview) → new state\n * verify(state) → pass/fail, optional layers\n * review(state, verification, memory) → observations + next-shot\n * instruction + shouldContinue\n * memory.append(entry)\n *\n * Roles are strictly separated:\n *\n * - The WORKER is whatever the caller wraps in `propose`. It is\n * stateful — caller owns its resume/session mechanism.\n * - The VERIFIER grades the state. It produces the ground truth.\n * The reviewer cannot overturn or downgrade a verification layer.\n * - The REVIEWER is stateless per call. Its continuity is the\n * `ReviewMemoryStore` — durable JSONL by default, or any store\n * implementing the interface. It reads memory + trace summary +\n * verification and directs the NEXT proposer shot.\n *\n * This shape is load-bearing. The reviewer never grades; the verifier\n * never directs. Two processes, two prompts, two concerns — which is\n * what keeps the loop from confirmation-biasing itself into \"all\n * passed\" when it didn't.\n *\n * Short-circuits and soft-fails are both first-class:\n * - verify.pass === true → reviewer LLM call is skipped, memory\n * records a success entry, loop exits.\n * - review throws → the shot still counts; the loop uses the\n * last-known instruction (or `fallbackInstruction`) for the next\n * propose call. A transient reviewer failure must NEVER abort a\n * valid arc.\n *\n * Composable: `propose` itself can be another `runProposeReview` call.\n * That's the dogfooding path — a harness built on this primitive is in\n * turn evaluable by it.\n */\n\nimport { appendFileSync, existsSync, mkdirSync, readFileSync } from 'node:fs'\nimport { dirname } from 'node:path'\nimport { type SpanHandle, TraceEmitter } from './trace/emitter'\nimport type { FailureClass } from './trace/schema'\nimport type { TraceStore } from './trace/store'\n\n// ── Types ────────────────────────────────────────────────────────────\n\nexport interface Verification {\n pass: boolean\n score?: number\n failingLayers?: string[]\n details?: unknown\n}\n\nexport interface Review {\n observations: string\n diagnosis: string\n nextShotInstruction: string\n shouldContinue: boolean\n confidence: number\n}\n\nexport interface ReviewMemoryEntry extends Review {\n shot: number\n timestamp: number\n verification: {\n pass: boolean\n score?: number\n failingLayers?: string[]\n }\n}\n\nexport interface ProposeInput<State> {\n shot: number\n goal: string\n state: State\n priorReview: Review | null\n abortSignal: AbortSignal\n emitter?: TraceEmitter\n}\n\nexport interface ProposeOutput<State, Summary = unknown> {\n state: State\n traceSummary?: Summary\n}\n\nexport interface ReviewInput<State, Summary = unknown> {\n shot: number\n goal: string\n state: State\n verification: Verification\n traceSummary: Summary | undefined\n memory: ReviewMemoryEntry[]\n}\n\nexport type ProposeFn<State, Summary = unknown> = (\n input: ProposeInput<State>,\n) => Promise<ProposeOutput<State, Summary>>\n\nexport type VerifyFn<State> = (state: State) => Promise<Verification>\n\nexport type ReviewFn<State, Summary = unknown> = (\n input: ReviewInput<State, Summary>,\n) => Promise<Review>\n\nexport interface ReviewMemoryStore {\n load(): Promise<ReviewMemoryEntry[]>\n append(entry: ReviewMemoryEntry): Promise<void>\n}\n\nexport interface ProposeReviewConfig<State, Summary = unknown> {\n goal: string\n initialState: State\n propose: ProposeFn<State, Summary>\n verify: VerifyFn<State>\n review: ReviewFn<State, Summary>\n /** Hard shot cap. Default 10. */\n maxShots?: number\n /** Wall-clock cap in ms. Default 10 min. */\n maxWallMs?: number\n /**\n * If the reviewer returns confidence ≤ floor on `confidenceFloorWindow`\n * consecutive shots, terminate early. Default floor 0.3, window 2.\n * Set window to 0 or floor to <0 to disable.\n */\n confidenceFloor?: number\n confidenceFloorWindow?: number\n /** Defaults to an in-memory store if omitted. */\n memory?: ReviewMemoryStore\n /** If provided, emit a Run + per-shot spans. */\n store?: TraceStore\n scenarioId?: string\n projectId?: string\n variantId?: string\n /**\n * Used when the reviewer soft-fails on shot 1 (no prior instruction to\n * fall back to). Default is a generic \"inspect failures and fix\".\n */\n fallbackInstruction?: string\n}\n\nexport interface ProposeReviewShot<State, Summary = unknown> {\n shot: number\n state: State\n verification: Verification\n traceSummary: Summary | undefined\n review: Review\n reviewAvailable: boolean\n reviewError?: string\n durationMs: number\n}\n\nexport interface ProposeReviewReport<State, Summary = unknown> {\n runId: string | null\n completed: boolean\n shots: ProposeReviewShot<State, Summary>[]\n finalState: State\n finalVerification: Verification\n failureClass?: FailureClass\n wallMs: number\n score: number\n}\n\n// ── Memory stores ────────────────────────────────────────────────────\n\nexport function inMemoryReviewStore(initial: ReviewMemoryEntry[] = []): ReviewMemoryStore {\n const entries: ReviewMemoryEntry[] = [...initial]\n return {\n async load() {\n return [...entries]\n },\n async append(entry) {\n entries.push(entry)\n },\n }\n}\n\nexport function jsonlReviewStore(path: string): ReviewMemoryStore {\n return {\n async load() {\n if (!existsSync(path)) return []\n const raw = readFileSync(path, 'utf8')\n const out: ReviewMemoryEntry[] = []\n for (const line of raw.split('\\n')) {\n const trimmed = line.trim()\n if (!trimmed) continue\n try {\n out.push(JSON.parse(trimmed) as ReviewMemoryEntry)\n } catch {\n // A corrupt line is an observability problem, not a correctness\n // one — skip it rather than aborting the loop.\n }\n }\n return out\n },\n async append(entry) {\n mkdirSync(dirname(path), { recursive: true })\n appendFileSync(path, `${JSON.stringify(entry)}\\n`)\n },\n }\n}\n\n// ── Core loop ────────────────────────────────────────────────────────\n\nconst DEFAULT_FALLBACK_INSTRUCTION =\n 'Inspect the verification failures above. Fix the critical issues first, then the major ones. Do not restate the failures — act on them.'\n\nexport async function runProposeReview<State, Summary = unknown>(\n config: ProposeReviewConfig<State, Summary>,\n): Promise<ProposeReviewReport<State, Summary>> {\n const maxShots = config.maxShots ?? 10\n const maxWallMs = config.maxWallMs ?? 10 * 60 * 1000\n const confidenceFloor = config.confidenceFloor ?? 0.3\n const confidenceFloorWindow = config.confidenceFloorWindow ?? 2\n const memory = config.memory ?? inMemoryReviewStore()\n const fallbackInstruction = config.fallbackInstruction ?? DEFAULT_FALLBACK_INSTRUCTION\n\n const emitter = config.store ? new TraceEmitter(config.store) : null\n if (emitter) {\n await emitter.startRun({\n scenarioId: config.scenarioId ?? 'propose-review',\n projectId: config.projectId,\n variantId: config.variantId,\n layer: 'meta',\n tags: {\n goal: config.goal.slice(0, 120),\n maxShots: String(maxShots),\n },\n })\n }\n\n const abort = new AbortController()\n const wallStart = Date.now()\n const wallTimer = setTimeout(\n () => abort.abort(new Error('propose-review wall timeout')),\n maxWallMs,\n )\n\n const shots: ProposeReviewShot<State, Summary>[] = []\n let state = config.initialState\n let priorReview: Review | null = null\n let lastVerification: Verification = { pass: false }\n let failureClass: FailureClass | undefined\n let completed = false\n let lowConfidenceStreak = 0\n\n try {\n for (let shot = 1; shot <= maxShots; shot++) {\n if (abort.signal.aborted) {\n failureClass = 'timeout'\n break\n }\n\n const shotStart = Date.now()\n const shotHandle = emitter ? await emitter.span({ kind: 'tool', name: `shot-${shot}` }) : null\n\n // 1. Propose.\n let proposeOut: ProposeOutput<State, Summary>\n try {\n proposeOut = await config.propose({\n shot,\n goal: config.goal,\n state,\n priorReview,\n abortSignal: abort.signal,\n emitter: emitter ?? undefined,\n })\n } catch (err) {\n await shotHandle?.fail(err instanceof Error ? err : String(err))\n failureClass = 'unknown'\n throw err\n }\n state = proposeOut.state\n const traceSummary = proposeOut.traceSummary\n\n // 2. Verify.\n let verification: Verification\n try {\n verification = await config.verify(state)\n } catch (err) {\n await shotHandle?.fail(err instanceof Error ? err : String(err))\n failureClass = 'unknown'\n throw err\n }\n lastVerification = verification\n\n // 3. Review — short-circuit on pass; soft-fail on throw.\n const memorySnapshot = await memory.load()\n const verificationDigest = {\n pass: verification.pass,\n score: verification.score,\n failingLayers: verification.failingLayers ?? [],\n }\n\n let review: Review\n let reviewAvailable = true\n let reviewError: string | undefined\n\n if (verification.pass) {\n review = {\n observations: 'verification passed — skipping reviewer LLM call',\n diagnosis: 'no failures to diagnose',\n nextShotInstruction: '(done)',\n shouldContinue: false,\n confidence: 1,\n }\n } else {\n try {\n review = await config.review({\n shot,\n goal: config.goal,\n state,\n verification,\n traceSummary,\n memory: memorySnapshot,\n })\n review = coerceReview(review)\n } catch (err) {\n reviewAvailable = false\n reviewError = err instanceof Error ? err.message : String(err)\n const lastInstruction =\n memorySnapshot.length > 0\n ? memorySnapshot[memorySnapshot.length - 1]!.nextShotInstruction\n : fallbackInstruction\n review = {\n observations: '(reviewer unavailable — using last-known instruction)',\n diagnosis: reviewError,\n nextShotInstruction: lastInstruction,\n shouldContinue: true,\n confidence: 0.3,\n }\n }\n }\n\n const entry: ReviewMemoryEntry = {\n shot,\n timestamp: Date.now(),\n ...review,\n verification: verificationDigest,\n }\n await memory.append(entry)\n\n const shotRecord: ProposeReviewShot<State, Summary> = {\n shot,\n state,\n verification,\n traceSummary,\n review,\n reviewAvailable,\n reviewError,\n durationMs: Date.now() - shotStart,\n }\n shots.push(shotRecord)\n\n await shotHandle?.end({\n attributes: {\n verificationPass: verification.pass,\n verificationScore: verification.score ?? null,\n reviewShouldContinue: review.shouldContinue,\n reviewConfidence: review.confidence,\n reviewAvailable,\n },\n } as Partial<SpanHandle['span']>)\n\n // 4. Exit rules.\n if (verification.pass) {\n completed = true\n break\n }\n if (!review.shouldContinue) {\n break\n }\n if (confidenceFloorWindow > 0 && review.confidence <= confidenceFloor) {\n lowConfidenceStreak += 1\n if (lowConfidenceStreak >= confidenceFloorWindow) break\n } else {\n lowConfidenceStreak = 0\n }\n\n priorReview = review\n }\n\n if (!completed && !failureClass) {\n failureClass = shots.length >= maxShots ? 'budget_exceeded' : 'unknown'\n }\n } finally {\n clearTimeout(wallTimer)\n }\n\n const score = lastVerification.pass\n ? 1\n : typeof lastVerification.score === 'number'\n ? lastVerification.score\n : 0\n\n if (emitter) {\n await emitter.endRun({\n pass: completed,\n score,\n failureClass,\n notes: `${shots.length} shot(s); final pass=${lastVerification.pass}`,\n })\n }\n\n return {\n runId: emitter?.runId ?? null,\n completed,\n shots,\n finalState: state,\n finalVerification: lastVerification,\n failureClass,\n wallMs: Date.now() - wallStart,\n score,\n }\n}\n\n// ── Reviewer helper (LLM-backed) ─────────────────────────────────────\n\nexport type LlmJsonCall = (req: { system: string; user: string }) => Promise<unknown>\n\nexport interface LlmReviewerConfig<State, Summary = unknown> {\n callJson: LlmJsonCall\n renderState?: (state: State) => string\n renderTraceSummary?: (summary: Summary | undefined) => string\n /** Appended to the default system prompt. */\n systemPromptAddendum?: string\n}\n\nconst REVIEWER_SYSTEM_PROMPT = `You are a senior reviewer directing a multi-shot build loop.\nYou do NOT grade — the verifier already did. Your job is to direct the worker's next shot.\nYou are blind to the worker's inner monologue. You see what it DID, not what it thought.\nReturn STRICT JSON matching the schema. No prose outside the JSON.`\n\nexport function createLlmReviewer<State, Summary = unknown>(\n cfg: LlmReviewerConfig<State, Summary>,\n): ReviewFn<State, Summary> {\n const renderState = cfg.renderState ?? ((s: State) => safeJson(s))\n const renderTraceSummary =\n cfg.renderTraceSummary ??\n ((s: Summary | undefined) => (s === undefined ? '(none)' : safeJson(s)))\n const system = cfg.systemPromptAddendum\n ? `${REVIEWER_SYSTEM_PROMPT}\\n\\n${cfg.systemPromptAddendum}`\n : REVIEWER_SYSTEM_PROMPT\n\n return async (input) => {\n const memoryBlock =\n input.memory.length === 0\n ? '(no prior shots — this is shot 1)'\n : input.memory\n .map((m) =>\n [\n `shot ${m.shot} — verification.pass=${m.verification.pass}` +\n (typeof m.verification.score === 'number'\n ? ` score=${m.verification.score.toFixed(2)}`\n : '') +\n ` confidence=${m.confidence.toFixed(2)} failing=[${(m.verification.failingLayers ?? []).join(',')}]`,\n ` observations: ${m.observations.slice(0, 400)}`,\n ` diagnosis: ${m.diagnosis.slice(0, 400)}`,\n ` instruction given: ${m.nextShotInstruction.slice(0, 400)}`,\n ].join('\\n'),\n )\n .join('\\n\\n')\n\n const user = [\n `=== GOAL ===`,\n input.goal,\n ``,\n `=== SHOT NUMBER ===`,\n String(input.shot),\n ``,\n `=== CURRENT STATE ===`,\n renderState(input.state),\n ``,\n `=== TRACE SUMMARY ===`,\n renderTraceSummary(input.traceSummary),\n ``,\n `=== VERIFICATION ===`,\n summarizeVerification(input.verification),\n ``,\n `=== REVIEWER MEMORY (prior shots) ===`,\n memoryBlock,\n ``,\n `=== YOUR TASK ===`,\n `Return STRICT JSON:`,\n `{`,\n ` \"observations\": string (20..2000 chars, first-person worker behavior — quote counts, errors, loops)`,\n ` \"diagnosis\": string (20..1500 chars, root cause, NOT a restatement of verification)`,\n ` \"nextShotInstruction\": string (40..3000 chars, concrete directive to the worker)`,\n ` \"shouldContinue\": boolean (false if verification.pass, or if thrashing, or unachievable)`,\n ` \"confidence\": number in [0,1]`,\n `}`,\n ].join('\\n')\n\n const raw = await cfg.callJson({ system, user })\n return coerceReview(raw as Partial<Review>)\n }\n}\n\n// ── Helpers ──────────────────────────────────────────────────────────\n\nfunction coerceReview(raw: Partial<Review> | null | undefined): Review {\n if (!raw || typeof raw !== 'object') {\n throw new Error('reviewer returned non-object')\n }\n const observations = typeof raw.observations === 'string' ? raw.observations : ''\n const diagnosis = typeof raw.diagnosis === 'string' ? raw.diagnosis : ''\n const nextShotInstruction =\n typeof raw.nextShotInstruction === 'string' ? raw.nextShotInstruction : ''\n if (!observations || !diagnosis || !nextShotInstruction) {\n throw new Error('reviewer missing required string fields')\n }\n if (typeof raw.shouldContinue !== 'boolean') {\n throw new Error('reviewer missing shouldContinue boolean')\n }\n const confidenceRaw = Number(raw.confidence)\n if (!Number.isFinite(confidenceRaw)) {\n throw new Error('reviewer confidence not finite')\n }\n return {\n observations,\n diagnosis,\n nextShotInstruction,\n shouldContinue: raw.shouldContinue,\n confidence: Math.max(0, Math.min(1, confidenceRaw)),\n }\n}\n\nfunction summarizeVerification(v: Verification): string {\n const header =\n `pass=${v.pass}` +\n (typeof v.score === 'number' ? ` score=${v.score.toFixed(3)}` : '') +\n (v.failingLayers && v.failingLayers.length > 0\n ? ` failing=[${v.failingLayers.join(', ')}]`\n : '')\n const details = v.details === undefined ? '' : `\\n${safeJson(v.details).slice(0, 1500)}`\n return header + details\n}\n\nfunction safeJson(x: unknown): string {\n try {\n return JSON.stringify(x, null, 2)\n } catch {\n return String(x)\n }\n}\n","import {\n type ControlRunResult,\n type ControlRuntimeConfig,\n objectiveEval,\n runAgentControlLoop,\n} from './control-runtime'\nimport {\n inMemoryReviewStore,\n type ProposeFn,\n type ProposeOutput,\n type Review,\n type ReviewFn,\n type ReviewMemoryEntry,\n type ReviewMemoryStore,\n type Verification,\n type VerifyFn,\n} from './propose-review'\nimport type { FailureClass } from './trace/schema'\nimport type { TraceStore } from './trace/store'\n\nexport interface ProposeReviewControlState<State, Summary = unknown> {\n shot: number\n state: State\n priorReview: Review | null\n verification: Verification\n traceSummary?: Summary\n memory: ReviewMemoryEntry[]\n completed: boolean\n reviewAvailable: boolean\n reviewError?: string\n}\n\nexport interface ProposeReviewControlAction {\n type: 'propose-review-shot'\n shot: number\n}\n\nexport interface ProposeReviewControlResult<State, Summary = unknown> {\n state: State\n verification: Verification\n traceSummary?: Summary\n review: Review | null\n reviewAvailable: boolean\n reviewError?: string\n}\n\nexport interface ProposeReviewControlConfig<State, Summary = unknown> {\n goal: string\n initialState: State\n propose: ProposeFn<State, Summary>\n verify: VerifyFn<State>\n review: ReviewFn<State, Summary>\n maxShots?: number\n maxWallMs?: number\n memory?: ReviewMemoryStore\n store?: TraceStore\n scenarioId?: string\n projectId?: string\n variantId?: string\n fallbackInstruction?: string\n confidenceFloor?: number\n confidenceFloorWindow?: number\n failureClassFromVerification?: (verification: Verification) => FailureClass | undefined\n actionFailure?: ControlRuntimeConfig<\n ProposeReviewControlState<State, Summary>,\n ProposeReviewControlAction,\n ProposeReviewControlResult<State, Summary>\n >['actionFailure']\n}\n\nconst DEFAULT_FALLBACK_INSTRUCTION =\n 'Inspect the verification failures above. Fix the critical issues first, then the major ones. Do not restate the failures — act on them.'\n\nexport async function runProposeReviewAsControlLoop<State, Summary = unknown>(\n config: ProposeReviewControlConfig<State, Summary>,\n): Promise<\n ControlRunResult<\n ProposeReviewControlState<State, Summary>,\n ProposeReviewControlAction,\n ProposeReviewControlResult<State, Summary>\n >\n> {\n const maxShots = config.maxShots ?? 10\n const confidenceFloor = config.confidenceFloor ?? 0.3\n const confidenceFloorWindow = config.confidenceFloorWindow ?? 2\n const memory = config.memory ?? inMemoryReviewStore()\n const fallbackInstruction = config.fallbackInstruction ?? DEFAULT_FALLBACK_INSTRUCTION\n const failureClassFromVerification =\n config.failureClassFromVerification ?? controlFailureClassFromVerification\n let lowConfidenceStreak = 0\n\n let current: ProposeReviewControlState<State, Summary> = {\n shot: 0,\n state: config.initialState,\n priorReview: null,\n verification: { pass: false },\n memory: await memory.load(),\n completed: false,\n reviewAvailable: false,\n }\n\n return runAgentControlLoop({\n intent: config.goal,\n budget: { maxSteps: maxShots, maxWallMs: config.maxWallMs },\n store: config.store,\n scenarioId: config.scenarioId ?? 'propose-review-control',\n projectId: config.projectId,\n variantId: config.variantId,\n actionFailure: config.actionFailure ?? 'stop',\n observe: () => current,\n validate: ({ state }) => [\n objectiveEval({\n id: 'verification',\n passed: state.verification.pass,\n score: state.verification.score,\n severity: 'critical',\n detail: state.verification.pass\n ? 'verification passed'\n : `verification failed${state.verification.failingLayers?.length ? `: ${state.verification.failingLayers.join(', ')}` : ''}`,\n }),\n ],\n shouldStop: ({ state }) => {\n if (state.verification.pass) {\n return {\n stop: true,\n pass: true,\n reason: 'verification passed',\n score: state.verification.score,\n }\n }\n if (state.completed) {\n return {\n stop: true,\n pass: false,\n reason: 'reviewer stopped continuation',\n score: state.verification.score,\n failureClass: failureClassFromVerification(state.verification),\n }\n }\n return {\n stop: false,\n pass: false,\n reason: 'verification still failing',\n score: state.verification.score,\n }\n },\n decide: ({ state }) => ({\n type: 'continue',\n action: { type: 'propose-review-shot', shot: state.shot + 1 },\n reason: state.priorReview?.nextShotInstruction ?? fallbackInstruction,\n }),\n act: async (action, ctx) => {\n const shot = action.shot\n const proposeOut: ProposeOutput<State, Summary> = await config.propose({\n shot,\n goal: config.goal,\n state: current.state,\n priorReview: current.priorReview,\n abortSignal: ctx.abortSignal,\n emitter: ctx.emitter,\n })\n\n const nextState = proposeOut.state\n const verification = await config.verify(nextState)\n let review: Review | null = null\n let reviewAvailable = false\n let reviewError: string | undefined\n let shouldContinue = !verification.pass\n\n if (!verification.pass) {\n try {\n review = await config.review({\n shot,\n goal: config.goal,\n state: nextState,\n verification,\n traceSummary: proposeOut.traceSummary,\n memory: await memory.load(),\n })\n reviewAvailable = true\n shouldContinue = review.shouldContinue\n lowConfidenceStreak = review.confidence <= confidenceFloor ? lowConfidenceStreak + 1 : 0\n if (confidenceFloorWindow > 0 && lowConfidenceStreak >= confidenceFloorWindow)\n shouldContinue = false\n } catch (err) {\n reviewError = err instanceof Error ? err.message : String(err)\n review = current.priorReview ?? {\n observations: 'Reviewer unavailable.',\n diagnosis: reviewError,\n nextShotInstruction: fallbackInstruction,\n shouldContinue: true,\n confidence: 0,\n }\n shouldContinue = true\n }\n } else {\n review = {\n observations: 'Verification passed.',\n diagnosis: 'No further revision needed.',\n nextShotInstruction: '',\n shouldContinue: false,\n confidence: 1,\n }\n }\n\n const entry: ReviewMemoryEntry = {\n ...(review ?? {\n observations: 'No review.',\n diagnosis: '',\n nextShotInstruction: fallbackInstruction,\n shouldContinue,\n confidence: 0,\n }),\n shot,\n timestamp: Date.now(),\n verification: {\n pass: verification.pass,\n score: verification.score,\n failingLayers: verification.failingLayers,\n },\n }\n await memory.append(entry)\n\n current = {\n shot,\n state: nextState,\n priorReview: review,\n verification,\n traceSummary: proposeOut.traceSummary,\n memory: await memory.load(),\n completed: verification.pass || !shouldContinue,\n reviewAvailable,\n reviewError,\n }\n\n return {\n state: nextState,\n verification,\n traceSummary: proposeOut.traceSummary,\n review,\n reviewAvailable,\n reviewError,\n }\n },\n })\n}\n\nexport function controlFailureClassFromVerification(\n verification: Verification,\n): FailureClass | undefined {\n if (verification.pass) return undefined\n return verification.failingLayers?.length ? 'instruction_following' : 'unknown'\n}\n"],"mappings":";;;;;;;;;;;;AAuBO,SAAS,qBACd,QACA,SAAgC,CAAC,GACjC,UAAkC,CAAC,GACb;AACtB,QAAM,UAAoB,CAAC;AAC3B,MAAI,UAAU;AACd,MAAI,mBAAmB,QAAQ,OAAO,gBAAgB;AAEtD,MAAI,OAAO,cAAc,UAAU,CAAC,OAAO,aAAa,SAAS,OAAO,IAAI,GAAG;AAC7E,cAAU;AACV,YAAQ,KAAK,gBAAgB,OAAO,IAAI,kBAAkB;AAAA,EAC5D;AACA,MAAI,OAAO,cAAc,SAAS,OAAO,IAAI,GAAG;AAC9C,cAAU;AACV,YAAQ,KAAK,gBAAgB,OAAO,IAAI,cAAc;AAAA,EACxD;AACA,MAAI,OAAO,4BAA4B,SAAS,OAAO,IAAI,GAAG;AAC5D,uBAAmB;AACnB,YAAQ,KAAK,gBAAgB,OAAO,IAAI,qBAAqB;AAAA,EAC/D;AACA,MAAI,OAAO,yCAAyC,OAAO,oBAAoB;AAC7E,uBAAmB;AACnB,YAAQ,KAAK,wCAAwC;AAAA,EACvD;AACA,MACE,OAAO,gCAAgC,WACtC,OAAO,WAAW,KAAK,OAAO,6BAC/B;AACA,uBAAmB;AACnB,YAAQ;AAAA,MACN,QAAQ,OAAO,OAAO,+BAA+B,OAAO,2BAA2B;AAAA,IACzF;AAAA,EACF;AACA,MAAI,OAAO,qBAAqB,WAAc,OAAO,WAAW,KAAK,OAAO,kBAAkB;AAC5F,cAAU;AACV,YAAQ,KAAK,QAAQ,OAAO,OAAO,4BAA4B,OAAO,gBAAgB,EAAE;AAAA,EAC1F;AACA,MACE,OAAO,uBAA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