@tangle-network/agent-eval 0.215.1 → 0.216.1

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 (400) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/adapters/http.d.ts +3 -3
  3. package/dist/{agent-profile-DmzL8KaJ.d.ts → agent-profile-VFcQncbW.d.ts} +5 -5
  4. package/dist/{agent-profile-DmzL8KaJ.d.ts.map → agent-profile-VFcQncbW.d.ts.map} +1 -1
  5. package/dist/{agent-profile-cell-BYc0bxsL.js → agent-profile-cell-BK8mlqlq.js} +3 -3
  6. package/dist/{agent-profile-cell-BYc0bxsL.js.map → agent-profile-cell-BK8mlqlq.js.map} +1 -1
  7. package/dist/agreement-irr-BEWLIF3_.js +186 -0
  8. package/dist/agreement-irr-BEWLIF3_.js.map +1 -0
  9. package/dist/analyst/index.d.ts +487 -14
  10. package/dist/analyst/index.d.ts.map +1 -1
  11. package/dist/analyst/index.js +1547 -12
  12. package/dist/analyst/index.js.map +1 -1
  13. package/dist/{analyze-runs-3xpby3p2.js → analyze-runs-C84irm4i.js} +608 -604
  14. package/dist/analyze-runs-C84irm4i.js.map +1 -0
  15. package/dist/{analyze-runs-BhFLOztS.d.ts → analyze-runs-D68fd-su.d.ts} +17 -15
  16. package/dist/analyze-runs-D68fd-su.d.ts.map +1 -0
  17. package/dist/{baseline-Dm8966du.js → baseline-Udi_PLuT.js} +5 -5
  18. package/dist/{baseline-Dm8966du.js.map → baseline-Udi_PLuT.js.map} +1 -1
  19. package/dist/{benchmark-BywPeAUo.js → benchmark-CXmVVHH2.js} +2 -2
  20. package/dist/{benchmark-BywPeAUo.js.map → benchmark-CXmVVHH2.js.map} +1 -1
  21. package/dist/{benchmark-command-CgpGi7vY.js → benchmark-command-By0vh8q7.js} +71 -70
  22. package/dist/benchmark-command-By0vh8q7.js.map +1 -0
  23. package/dist/benchmarks/index.d.ts +5 -5
  24. package/dist/benchmarks/index.js +3 -3
  25. package/dist/builder-eval/index.js +2 -2
  26. package/dist/campaign/index.d.ts +7 -7
  27. package/dist/campaign/index.js +14 -14
  28. package/dist/{campaign-CpnsCgfz.js → campaign-BudZ70zo.js} +245 -247
  29. package/dist/campaign-BudZ70zo.js.map +1 -0
  30. package/dist/{campaign-evidence-OcUciD-N.js → campaign-evidence-Clrn4hBV.js} +8 -8
  31. package/dist/campaign-evidence-Clrn4hBV.js.map +1 -0
  32. package/dist/{canonical-BsZVgBhW.js → canonical-B2RqLofv.js} +2 -2
  33. package/dist/{canonical-BsZVgBhW.js.map → canonical-B2RqLofv.js.map} +1 -1
  34. package/dist/{chat-client-DthPOYGd.js → chat-client-l-MVDlDk.js} +2 -2
  35. package/dist/{chat-client-DthPOYGd.js.map → chat-client-l-MVDlDk.js.map} +1 -1
  36. package/dist/{chat-json-call-BrKsyspg.js → chat-json-call-puMArmtW.js} +2 -2
  37. package/dist/{chat-json-call-BrKsyspg.js.map → chat-json-call-puMArmtW.js.map} +1 -1
  38. package/dist/{claim-BXcZw-jo.js → claim-q4HQhK1G.js} +4 -4
  39. package/dist/claim-q4HQhK1G.js.map +1 -0
  40. package/dist/cli.js +9 -9
  41. package/dist/cli.js.map +1 -1
  42. package/dist/cluster-bootstrap-qcUWYFl-.js +66 -0
  43. package/dist/cluster-bootstrap-qcUWYFl-.js.map +1 -0
  44. package/dist/contract/index.d.ts +11 -11
  45. package/dist/contract/index.js +1023 -1079
  46. package/dist/contract/index.js.map +1 -1
  47. package/dist/{cost-ledger-D2FnJPBF.js → cost-ledger-BP8V4kUQ.js} +835 -816
  48. package/dist/cost-ledger-BP8V4kUQ.js.map +1 -0
  49. package/dist/{cost-ledger-CO7UyEcQ.d.ts → cost-ledger-Jk62OBfF.d.ts} +12 -47
  50. package/dist/cost-ledger-Jk62OBfF.d.ts.map +1 -0
  51. package/dist/{counterfactual-DtMWvn7D.js → counterfactual-Dn3veueY.js} +2 -2
  52. package/dist/{counterfactual-DtMWvn7D.js.map → counterfactual-Dn3veueY.js.map} +1 -1
  53. package/dist/{default-registry-KP4-Tolz.js → default-registry-COhk9g36.js} +744 -759
  54. package/dist/default-registry-COhk9g36.js.map +1 -0
  55. package/dist/{default-registry-B4B7GMvI.d.ts → default-registry-DzHiGruW.d.ts} +6 -6
  56. package/dist/{default-registry-B4B7GMvI.d.ts.map → default-registry-DzHiGruW.d.ts.map} +1 -1
  57. package/dist/{define-agent-eval-BdfnqXeP.js → define-agent-eval-CNTPzIkp.js} +10 -10
  58. package/dist/define-agent-eval-CNTPzIkp.js.map +1 -0
  59. package/dist/{define-agent-eval-DfXvNho5.d.ts → define-agent-eval-WSck0CZJ.d.ts} +8 -8
  60. package/dist/{define-agent-eval-DfXvNho5.d.ts.map → define-agent-eval-WSck0CZJ.d.ts.map} +1 -1
  61. package/dist/{descriptive-CnU8Yq29.js → descriptive-DboxPZrG.js} +2 -2
  62. package/dist/{descriptive-CnU8Yq29.js.map → descriptive-DboxPZrG.js.map} +1 -1
  63. package/dist/diagnosis/index.d.ts +3 -3
  64. package/dist/diagnosis/index.js +4 -4
  65. package/dist/{dspy-rlm-engine-DZfHM7kT.js → dspy-rlm-engine-LRCu61m5.js} +3 -3
  66. package/dist/{dspy-rlm-engine-DZfHM7kT.js.map → dspy-rlm-engine-LRCu61m5.js.map} +1 -1
  67. package/dist/{effect-sizes-DiH8MGOH.js → effect-sizes-BhzEpXMc.js} +2 -2
  68. package/dist/{effect-sizes-DiH8MGOH.js.map → effect-sizes-BhzEpXMc.js.map} +1 -1
  69. package/dist/{engine-C37HS2kr.d.ts → engine-3A_4jOlI.d.ts} +5 -5
  70. package/dist/{engine-C37HS2kr.d.ts.map → engine-3A_4jOlI.d.ts.map} +1 -1
  71. package/dist/{equal-terms-Blx9Zk5I.js → equal-terms-BtdXayCJ.js} +2 -2
  72. package/dist/{equal-terms-Blx9Zk5I.js.map → equal-terms-BtdXayCJ.js.map} +1 -1
  73. package/dist/{errors-Dngq5h35.js → errors-DVZiqS7K.js} +6 -2
  74. package/dist/{errors-Dngq5h35.js.map → errors-DVZiqS7K.js.map} +1 -1
  75. package/dist/{eval-campaign-4byTtqrf.js → eval-campaign-90jeaCAI.js} +6 -6
  76. package/dist/{eval-campaign-4byTtqrf.js.map → eval-campaign-90jeaCAI.js.map} +1 -1
  77. package/dist/evaluation-6Yoi74gM.d.ts +75 -0
  78. package/dist/evaluation-6Yoi74gM.d.ts.map +1 -0
  79. package/dist/evaluation.d.ts +2 -74
  80. package/dist/evaluation.js +1 -1
  81. package/dist/{exact-types-Dlb73wN4.d.ts → exact-types-ClugMJfI.d.ts} +2 -2
  82. package/dist/{exact-types-Dlb73wN4.d.ts.map → exact-types-ClugMJfI.d.ts.map} +1 -1
  83. package/dist/experiment/index.d.ts +404 -3
  84. package/dist/experiment/index.d.ts.map +1 -1
  85. package/dist/experiment/index.js +313 -19
  86. package/dist/experiment/index.js.map +1 -1
  87. package/dist/{external-optimizer-process-GngofQML.js → external-optimizer-process-BjMGUuds.js} +3 -3
  88. package/dist/{external-optimizer-process-GngofQML.js.map → external-optimizer-process-BjMGUuds.js.map} +1 -1
  89. package/dist/{external-optimizer-subprocess-BUxifb8g.js → external-optimizer-subprocess-BqW0hHcI.js} +791 -532
  90. package/dist/external-optimizer-subprocess-BqW0hHcI.js.map +1 -0
  91. package/dist/{feedback-trajectory-BLN_6fEs.d.ts → feedback-trajectory-C4EG0nNH.d.ts} +5 -8
  92. package/dist/feedback-trajectory-C4EG0nNH.d.ts.map +1 -0
  93. package/dist/fuzz.d.ts +1 -1
  94. package/dist/fuzz.js +3 -3
  95. package/dist/hosted/index.js +1 -1
  96. package/dist/{index-CPJJr98o.d.ts → index-BFRO6chs.d.ts} +3 -2
  97. package/dist/index-BFRO6chs.d.ts.map +1 -0
  98. package/dist/{index-Ch9VxCpK.d.ts → index-BO41eGj5.d.ts} +2 -2
  99. package/dist/{index-Ch9VxCpK.d.ts.map → index-BO41eGj5.d.ts.map} +1 -1
  100. package/dist/{index-B3WBm953.d.ts → index-CyszSg4O.d.ts} +165 -162
  101. package/dist/index-CyszSg4O.d.ts.map +1 -0
  102. package/dist/{index-B7m2uzJL.d.ts → index-DPcngtwt.d.ts} +30 -17
  103. package/dist/index-DPcngtwt.d.ts.map +1 -0
  104. package/dist/{index-tYLUvk_w.d.ts → index-DV-jSzxF.d.ts} +9 -9
  105. package/dist/{index-tYLUvk_w.d.ts.map → index-DV-jSzxF.d.ts.map} +1 -1
  106. package/dist/index.d.ts +1969 -1871
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +162 -201
  109. package/dist/index.js.map +1 -1
  110. package/dist/{integrity-BvnVARVl.js → integrity-BXOsAb3i.js} +2 -2
  111. package/dist/{integrity-BvnVARVl.js.map → integrity-BXOsAb3i.js.map} +1 -1
  112. package/dist/{integrity-CCAxGVK6.d.ts → integrity-DAMEDFaC.d.ts} +2 -2
  113. package/dist/{integrity-CCAxGVK6.d.ts.map → integrity-DAMEDFaC.d.ts.map} +1 -1
  114. package/dist/{integrity-BV1ZDf42.js → integrity-dLiDe2kD.js} +2 -5
  115. package/dist/integrity-dLiDe2kD.js.map +1 -0
  116. package/dist/{internal-CRHwS9iz.js → internal-Epl-YBZW.js} +3 -3
  117. package/dist/{internal-CRHwS9iz.js.map → internal-Epl-YBZW.js.map} +1 -1
  118. package/dist/interval-CELpye1n.js +219 -0
  119. package/dist/interval-CELpye1n.js.map +1 -0
  120. package/dist/interval-ohuOJurX.d.ts +47 -0
  121. package/dist/interval-ohuOJurX.d.ts.map +1 -0
  122. package/dist/{journal-DvKCvjty.js → journal-DfRz9kps.js} +2 -2
  123. package/dist/{journal-DvKCvjty.js.map → journal-DfRz9kps.js.map} +1 -1
  124. package/dist/{judge-calibration-N44V04Se.js → judge-calibration-BpCy5XQl.js} +3 -3
  125. package/dist/{judge-calibration-N44V04Se.js.map → judge-calibration-BpCy5XQl.js.map} +1 -1
  126. package/dist/{judge-gate-DNcUrRFA.d.ts → judge-gate-CE7CQAgt.d.ts} +3 -3
  127. package/dist/{judge-gate-DNcUrRFA.d.ts.map → judge-gate-CE7CQAgt.d.ts.map} +1 -1
  128. package/dist/{judge-gate-B1qYnkpi.js → judge-gate-iY9s4L44.js} +3 -3
  129. package/dist/judge-gate-iY9s4L44.js.map +1 -0
  130. package/dist/{kind-factory-AaEhUADH.js → kind-factory-BobI5Jy3.js} +5 -5
  131. package/dist/{kind-factory-AaEhUADH.js.map → kind-factory-BobI5Jy3.js.map} +1 -1
  132. package/dist/ledger-core/index.js +3 -3
  133. package/dist/{ledger-core-B2hahzrt.js → ledger-core-Gq7yp8lP.js} +4 -4
  134. package/dist/{ledger-core-B2hahzrt.js.map → ledger-core-Gq7yp8lP.js.map} +1 -1
  135. package/dist/{llm-client-DQveoxSM.js → llm-client-CyBAoYiX.js} +192 -219
  136. package/dist/llm-client-CyBAoYiX.js.map +1 -0
  137. package/dist/{llm-judge-Cd5s5Ei6.js → llm-judge-CG12SQJq.js} +499 -921
  138. package/dist/llm-judge-CG12SQJq.js.map +1 -0
  139. package/dist/matrix/index.d.ts +2 -2
  140. package/dist/matrix/index.js +1 -1
  141. package/dist/{matrix-DXVAJMLD.d.ts → matrix-DSrSxjjy.d.ts} +4 -4
  142. package/dist/{matrix-DXVAJMLD.d.ts.map → matrix-DSrSxjjy.d.ts.map} +1 -1
  143. package/dist/{matrix-_BV9-Lk5.js → matrix-Dm0BQW7U.js} +7 -11
  144. package/dist/matrix-Dm0BQW7U.js.map +1 -0
  145. package/dist/{paired-tests-jbwPdSz5.js → mean-DHoMiudD.js} +11 -5
  146. package/dist/mean-DHoMiudD.js.map +1 -0
  147. package/dist/meta-eval/index.d.ts +3 -3
  148. package/dist/meta-eval/index.js +9 -70
  149. package/dist/meta-eval/index.js.map +1 -1
  150. package/dist/mint-DNU8QPG4.d.ts +81 -0
  151. package/dist/mint-DNU8QPG4.d.ts.map +1 -0
  152. package/dist/{mint-Csor1BLJ.js → mint-QaD5cA0u.js} +3 -3
  153. package/dist/{mint-Csor1BLJ.js.map → mint-QaD5cA0u.js.map} +1 -1
  154. package/dist/{multiplicity-D9cjmStq.js → multiplicity-DQUFcbW4.js} +2 -2
  155. package/dist/{multiplicity-D9cjmStq.js.map → multiplicity-DQUFcbW4.js.map} +1 -1
  156. package/dist/multishot/golden/index.d.ts +1 -1
  157. package/dist/multishot/golden/index.d.ts.map +1 -1
  158. package/dist/multishot/golden/index.js +3 -6
  159. package/dist/multishot/golden/index.js.map +1 -1
  160. package/dist/multishot/index.d.ts +2 -2
  161. package/dist/multishot/index.js +1 -1
  162. package/dist/nonnegative-number-DvdMxg_f.js +9 -0
  163. package/dist/nonnegative-number-DvdMxg_f.js.map +1 -0
  164. package/dist/openapi.json +1 -1
  165. package/dist/{otel-spans-C8YIJWy1.js → otel-spans-B9tUXRHF.js} +3 -3
  166. package/dist/{otel-spans-C8YIJWy1.js.map → otel-spans-B9tUXRHF.js.map} +1 -1
  167. package/dist/{paired-arms-DzKn0TfY.js → paired-arms-CwMGJsrS.js} +5 -5
  168. package/dist/{paired-arms-DzKn0TfY.js.map → paired-arms-CwMGJsrS.js.map} +1 -1
  169. package/dist/{paired-binary-Q36bhn2R.js → paired-binary-CvpFHfKZ.js} +2 -2
  170. package/dist/{paired-binary-Q36bhn2R.js.map → paired-binary-CvpFHfKZ.js.map} +1 -1
  171. package/dist/{paired-promotion-decision-BN6IQTiu.js → paired-promotion-decision-DsAPYGCm.js} +3 -3
  172. package/dist/{paired-promotion-decision-BN6IQTiu.js.map → paired-promotion-decision-DsAPYGCm.js.map} +1 -1
  173. package/dist/{search-kernel-BztlERLv.js → pareto-Cm6ndrWN.js} +883 -861
  174. package/dist/pareto-Cm6ndrWN.js.map +1 -0
  175. package/dist/pipelines/index.d.ts +2 -2
  176. package/dist/pipelines/index.js +3 -3
  177. package/dist/{power-and-mde-fK5Qocwo.js → power-and-mde-Hj2ubb4B.js} +2 -2
  178. package/dist/{power-and-mde-fK5Qocwo.js.map → power-and-mde-Hj2ubb4B.js.map} +1 -1
  179. package/dist/predicate-FdKmElA_.js +38 -0
  180. package/dist/predicate-FdKmElA_.js.map +1 -0
  181. package/dist/{prime-protocol-DcAK9pC8.js → prime-protocol-CHKgA3a6.js} +2 -2
  182. package/dist/{prime-protocol-DcAK9pC8.js.map → prime-protocol-CHKgA3a6.js.map} +1 -1
  183. package/dist/{prime-protocol-BHia9vDz.d.ts → prime-protocol-HiB9HX7E.d.ts} +3 -3
  184. package/dist/{prime-protocol-BHia9vDz.d.ts.map → prime-protocol-HiB9HX7E.d.ts.map} +1 -1
  185. package/dist/{produced-state-BGp4BX8t.js → produced-state-BsDmnwxc.js} +8 -8
  186. package/dist/{produced-state-BGp4BX8t.js.map → produced-state-BsDmnwxc.js.map} +1 -1
  187. package/dist/profile-cell.js +1 -1
  188. package/dist/{release-confidence-BK2QCB5M.d.ts → promotion-gate-BawrdPYr.d.ts} +102 -102
  189. package/dist/promotion-gate-BawrdPYr.d.ts.map +1 -0
  190. package/dist/{promotion-policy-CWW35UWq.js → promotion-policy-KO57gbyV.js} +4 -4
  191. package/dist/{promotion-policy-CWW35UWq.js.map → promotion-policy-KO57gbyV.js.map} +1 -1
  192. package/dist/{proposal-findings-CXblsskH.js → proposal-findings-CY1xKn_a.js} +2 -36
  193. package/dist/proposal-findings-CY1xKn_a.js.map +1 -0
  194. package/dist/{query-B1D1qp2Z.js → query-BUCZCK7F.js} +3 -3
  195. package/dist/{query-B1D1qp2Z.js.map → query-BUCZCK7F.js.map} +1 -1
  196. package/dist/{random-Dn5fPWkt.js → random-ByUSnV9w.js} +2 -2
  197. package/dist/{random-Dn5fPWkt.js.map → random-ByUSnV9w.js.map} +1 -1
  198. package/dist/{raw-provider-sink-rB2DYxr6.js → raw-provider-sink-DoHz4JNG.js} +2 -2
  199. package/dist/{raw-provider-sink-rB2DYxr6.js.map → raw-provider-sink-DoHz4JNG.js.map} +1 -1
  200. package/dist/{redact-Dk1ZdJEm.js → redact-B5xXKqQ3.js} +97 -98
  201. package/dist/redact-B5xXKqQ3.js.map +1 -0
  202. package/dist/{redact-Cveoq6fJ.d.ts → redact-mtCCcT8z.d.ts} +4 -20
  203. package/dist/redact-mtCCcT8z.d.ts.map +1 -0
  204. package/dist/{registry-CMYIaDgS.d.ts → registry-D7_hm2fK.d.ts} +11 -13
  205. package/dist/registry-D7_hm2fK.d.ts.map +1 -0
  206. package/dist/{release-confidence-Dbe9AS_X.js → release-confidence-CpuP65S5.js} +5 -5
  207. package/dist/{release-confidence-Dbe9AS_X.js.map → release-confidence-CpuP65S5.js.map} +1 -1
  208. package/dist/{report-command-CtIIsQKP.js → report-command-SC9nqb4M.js} +128 -177
  209. package/dist/report-command-SC9nqb4M.js.map +1 -0
  210. package/dist/reporting-html-Kvlc8oMt.js +100 -0
  211. package/dist/reporting-html-Kvlc8oMt.js.map +1 -0
  212. package/dist/reporting.d.ts +3 -3
  213. package/dist/reporting.js +6 -6
  214. package/dist/{researcher-f6mZhh58.d.ts → researcher-CEcfku-T.d.ts} +5 -5
  215. package/dist/{researcher-f6mZhh58.d.ts.map → researcher-CEcfku-T.d.ts.map} +1 -1
  216. package/dist/reward-CpCmAM8L.d.ts +78 -0
  217. package/dist/reward-CpCmAM8L.d.ts.map +1 -0
  218. package/dist/{reward-hacking-BFcQgkux.js → reward-hacking-E0d-WVcP.js} +2 -2
  219. package/dist/{reward-hacking-BFcQgkux.js.map → reward-hacking-E0d-WVcP.js.map} +1 -1
  220. package/dist/{reward-hacking-DHA7c1l8.d.ts → reward-hacking-RVdZ6Kkt.d.ts} +2 -2
  221. package/dist/{reward-hacking-DHA7c1l8.d.ts.map → reward-hacking-RVdZ6Kkt.d.ts.map} +1 -1
  222. package/dist/rl.d.ts +8 -8
  223. package/dist/rl.js +14 -14
  224. package/dist/rollout/index.d.ts +3 -2
  225. package/dist/rollout/index.js +2 -2
  226. package/dist/{rollout-D9bKKBnZ.js → rollout-DZV1t2Wg.js} +2 -2
  227. package/dist/{rollout-D9bKKBnZ.js.map → rollout-DZV1t2Wg.js.map} +1 -1
  228. package/dist/round-decimal-COrKglMh.js +10 -0
  229. package/dist/round-decimal-COrKglMh.js.map +1 -0
  230. package/dist/{rubric-predictive-validity-2SgHxoa5.d.ts → rubric-predictive-validity-C03EC7ZE.d.ts} +2 -2
  231. package/dist/{rubric-predictive-validity-2SgHxoa5.d.ts.map → rubric-predictive-validity-C03EC7ZE.d.ts.map} +1 -1
  232. package/dist/{rubric-predictive-validity-BsgkBfT0.js → rubric-predictive-validity-DaFW70y9.js} +3 -3
  233. package/dist/{rubric-predictive-validity-BsgkBfT0.js.map → rubric-predictive-validity-DaFW70y9.js.map} +1 -1
  234. package/dist/{run-record-DlTZ_lqe.js → run-record-Boc5IUTp.js} +4 -4
  235. package/dist/{run-record-DlTZ_lqe.js.map → run-record-Boc5IUTp.js.map} +1 -1
  236. package/dist/{run-record-D1Hw-Jml.d.ts → run-record-C1E24G2A.d.ts} +2 -2
  237. package/dist/{run-record-D1Hw-Jml.d.ts.map → run-record-C1E24G2A.d.ts.map} +1 -1
  238. package/dist/{run-record-ES07wfz9.js → run-record-C5e7FjhJ.js} +3 -5
  239. package/dist/run-record-C5e7FjhJ.js.map +1 -0
  240. package/dist/search/index.d.ts +46 -32
  241. package/dist/search/index.d.ts.map +1 -1
  242. package/dist/search/index.js +3 -3
  243. package/dist/{search-kernel-BqyBZ9Wm.d.ts → search-kernel-DyNEa6IU.d.ts} +14 -10
  244. package/dist/search-kernel-DyNEa6IU.d.ts.map +1 -0
  245. package/dist/{search-ledger-d7V8o9Lk.js → search-ledger-CVUGLDZp.js} +189 -199
  246. package/dist/search-ledger-CVUGLDZp.js.map +1 -0
  247. package/dist/{search-ledger-file-BqOo-bVo.js → search-ledger-file-DDQUgvCg.js} +4 -4
  248. package/dist/{search-ledger-file-BqOo-bVo.js.map → search-ledger-file-DDQUgvCg.js.map} +1 -1
  249. package/dist/search-ledger-types-p2xKfiDJ.d.ts.map +1 -1
  250. package/dist/{search-shipper-er4pK5_Y.js → search-shipper-BOSD46qv.js} +3 -3
  251. package/dist/{search-shipper-er4pK5_Y.js.map → search-shipper-BOSD46qv.js.map} +1 -1
  252. package/dist/{search-summary-CBvz3u_S.js → search-summary-BQCSWf1g.js} +5 -5
  253. package/dist/{search-summary-CBvz3u_S.js.map → search-summary-BQCSWf1g.js.map} +1 -1
  254. package/dist/{semantic-concept-judge-BPqbwIVs.js → semantic-concept-judge-BQF8te0T.js} +12 -14
  255. package/dist/semantic-concept-judge-BQF8te0T.js.map +1 -0
  256. package/dist/{sequential-D-1PPCmM.js → sequential-Bf_pbE50.js} +5 -5
  257. package/dist/{sequential-D-1PPCmM.js.map → sequential-Bf_pbE50.js.map} +1 -1
  258. package/dist/{sequential-eprocess-D1jKoihe.js → sequential-eprocess-DM_qENCl.js} +2 -2
  259. package/dist/{sequential-eprocess-D1jKoihe.js.map → sequential-eprocess-DM_qENCl.js.map} +1 -1
  260. package/dist/{server-DbcC7xMl.js → server-e9oWO_bN.js} +4 -4
  261. package/dist/{server-DbcC7xMl.js.map → server-e9oWO_bN.js.map} +1 -1
  262. package/dist/{single-run-lock-fVu3MZWH.js → single-run-lock-CV9Eyd_q.js} +2 -2
  263. package/dist/{single-run-lock-fVu3MZWH.js.map → single-run-lock-CV9Eyd_q.js.map} +1 -1
  264. package/dist/{skillopt-optimization-method-Dcepr6QL.js → skillopt-optimization-method-BiwA8nfX.js} +427 -12
  265. package/dist/skillopt-optimization-method-BiwA8nfX.js.map +1 -0
  266. package/dist/{spans-D9_ehFuk.d.ts → spans-BHAUXMGN.d.ts} +2 -2
  267. package/dist/{spans-D9_ehFuk.d.ts.map → spans-BHAUXMGN.d.ts.map} +1 -1
  268. package/dist/{statistical-heldout-1Gbmex7v.js → statistical-heldout-42NlCNDe.js} +3 -3
  269. package/dist/{statistical-heldout-1Gbmex7v.js.map → statistical-heldout-42NlCNDe.js.map} +1 -1
  270. package/dist/{statistical-heldout-CJTj2EoS.d.ts → statistical-heldout-CYpGaoDH.d.ts} +3 -3
  271. package/dist/{statistical-heldout-CJTj2EoS.d.ts.map → statistical-heldout-CYpGaoDH.d.ts.map} +1 -1
  272. package/dist/{store-otlp-DWVhUgEj.js → store-otlp-DJ9dtA5x.js} +135 -132
  273. package/dist/store-otlp-DJ9dtA5x.js.map +1 -0
  274. package/dist/{store-tool-spans-BNICrhsb.js → store-tool-spans-CIX5arAG.js} +7 -7
  275. package/dist/{store-tool-spans-BNICrhsb.js.map → store-tool-spans-CIX5arAG.js.map} +1 -1
  276. package/dist/{store-tool-spans-BNzls3OD.d.ts → store-tool-spans-DdCSPa7C.d.ts} +162 -161
  277. package/dist/store-tool-spans-DdCSPa7C.d.ts.map +1 -0
  278. package/dist/storyboard/index.d.ts.map +1 -1
  279. package/dist/storyboard/index.js +20 -3
  280. package/dist/storyboard/index.js.map +1 -1
  281. package/dist/{student-t-BQeKJx2N.js → student-t-DVPW7CdL.js} +2 -2
  282. package/dist/{student-t-BQeKJx2N.js.map → student-t-DVPW7CdL.js.map} +1 -1
  283. package/dist/{summary-report-DtdRucM0.js → summary-report-V_JACR4Y.js} +526 -614
  284. package/dist/summary-report-V_JACR4Y.js.map +1 -0
  285. package/dist/{summary-report-C-CtItCN.d.ts → summary-report-bdFDXq0b.d.ts} +10 -5
  286. package/dist/summary-report-bdFDXq0b.d.ts.map +1 -0
  287. package/dist/supervisor-run/index.d.ts +154 -150
  288. package/dist/supervisor-run/index.d.ts.map +1 -1
  289. package/dist/supervisor-run/index.js +65 -3
  290. package/dist/supervisor-run/index.js.map +1 -1
  291. package/dist/systemone-BomhHr2c.d.ts +135 -0
  292. package/dist/systemone-BomhHr2c.d.ts.map +1 -0
  293. package/dist/systemone-protocol.js +1 -1
  294. package/dist/{systemone-review-C4dZgrgN.d.ts → systemone-review-CUVcQJu6.d.ts} +2 -2
  295. package/dist/{systemone-review-C4dZgrgN.d.ts.map → systemone-review-CUVcQJu6.d.ts.map} +1 -1
  296. package/dist/{systemone-review-DTClwgmE.js → systemone-review-D7sXwsqq.js} +3 -3
  297. package/dist/{systemone-review-DTClwgmE.js.map → systemone-review-D7sXwsqq.js.map} +1 -1
  298. package/dist/systemone.d.ts +4 -134
  299. package/dist/systemone.js +4 -4
  300. package/dist/{task-failure-attributes-DngaLdE4.js → task-failure-attributes-hEmASjix.js} +2 -2
  301. package/dist/{task-failure-attributes-DngaLdE4.js.map → task-failure-attributes-hEmASjix.js.map} +1 -1
  302. package/dist/{terminal-record-BHocwFw1.js → terminal-record-DZyQZ3pz.js} +14 -10
  303. package/dist/terminal-record-DZyQZ3pz.js.map +1 -0
  304. package/dist/{tool-groups-BKRrtqy4.d.ts → tool-groups-C3NEcdCM.d.ts} +3 -3
  305. package/dist/tool-groups-C3NEcdCM.d.ts.map +1 -0
  306. package/dist/{tool-waste-Wi4g6Ekb.d.ts → tool-waste-BKgvd-TP.d.ts} +30 -30
  307. package/dist/tool-waste-BKgvd-TP.d.ts.map +1 -0
  308. package/dist/{tool-waste-BYt5rdt8.js → tool-waste-BlesqTqW.js} +5 -158
  309. package/dist/tool-waste-BlesqTqW.js.map +1 -0
  310. package/dist/{trace-questions-CLx8vt6t.d.ts → trace-questions-CM2CAocU.d.ts} +4 -4
  311. package/dist/{trace-questions-CLx8vt6t.d.ts.map → trace-questions-CM2CAocU.d.ts.map} +1 -1
  312. package/dist/trace-repair/index.d.ts +3 -3
  313. package/dist/trace-repair/index.d.ts.map +1 -1
  314. package/dist/trace-repair/index.js +7 -13
  315. package/dist/trace-repair/index.js.map +1 -1
  316. package/dist/traces.d.ts +76 -58
  317. package/dist/traces.d.ts.map +1 -1
  318. package/dist/traces.js +9 -9
  319. package/dist/trajectory-replay/index.js +3 -3
  320. package/dist/{tree-rXLW3M_4.js → tree-C1XYeXvy.js} +2277 -2339
  321. package/dist/tree-C1XYeXvy.js.map +1 -0
  322. package/dist/{types-DjOMwGY_.d.ts → types-BqkVmHfv.d.ts} +7 -1
  323. package/dist/types-BqkVmHfv.d.ts.map +1 -0
  324. package/dist/{types-DBZ7keha.d.ts → types-C02qtnG8.d.ts} +4 -46
  325. package/dist/types-C02qtnG8.d.ts.map +1 -0
  326. package/dist/{types-DHb5TI36.d.ts → types-C1tnkEgM.d.ts} +347 -6
  327. package/dist/types-C1tnkEgM.d.ts.map +1 -0
  328. package/dist/{types-DinHtRJp.d.ts → types-Cbe2fWBa.d.ts} +3 -3
  329. package/dist/{types-DinHtRJp.d.ts.map → types-Cbe2fWBa.d.ts.map} +1 -1
  330. package/dist/{types-CGEmVYOk.d.ts → types-Cq8mSbq8.d.ts} +78 -72
  331. package/dist/types-Cq8mSbq8.d.ts.map +1 -0
  332. package/dist/{types-CW5b90JH.js → types-IXD2HJzu.js} +16 -3
  333. package/dist/types-IXD2HJzu.js.map +1 -0
  334. package/dist/{verdict-DhPoXApk.js → verdict-Dl0tiT1X.js} +2 -2
  335. package/dist/{verdict-DhPoXApk.js.map → verdict-Dl0tiT1X.js.map} +1 -1
  336. package/dist/{verdict-cache-BQEsVy9n.js → verdict-cache-Bm8EKL2s.js} +2 -2
  337. package/dist/{verdict-cache-BQEsVy9n.js.map → verdict-cache-Bm8EKL2s.js.map} +1 -1
  338. package/dist/wire/index.d.ts +3 -3
  339. package/dist/wire/index.js +1 -1
  340. package/docs/concepts.md +1 -0
  341. package/docs/design/mlbenchmarks-book-review.md +1 -1
  342. package/docs/design/mlbenchmarks-review/probes.mts +23 -31
  343. package/docs/experiment.md +1 -1
  344. package/docs/finding-layers.md +69 -0
  345. package/package.json +1 -1
  346. package/dist/analyze-runs-3xpby3p2.js.map +0 -1
  347. package/dist/analyze-runs-BhFLOztS.d.ts.map +0 -1
  348. package/dist/ast-DJ6Bc7ab.js +0 -558
  349. package/dist/ast-DJ6Bc7ab.js.map +0 -1
  350. package/dist/ast-hI-vjW6J.d.ts +0 -457
  351. package/dist/ast-hI-vjW6J.d.ts.map +0 -1
  352. package/dist/benchmark-command-CgpGi7vY.js.map +0 -1
  353. package/dist/campaign-CpnsCgfz.js.map +0 -1
  354. package/dist/campaign-evidence-OcUciD-N.js.map +0 -1
  355. package/dist/claim-BXcZw-jo.js.map +0 -1
  356. package/dist/cost-ledger-CO7UyEcQ.d.ts.map +0 -1
  357. package/dist/cost-ledger-D2FnJPBF.js.map +0 -1
  358. package/dist/default-registry-KP4-Tolz.js.map +0 -1
  359. package/dist/define-agent-eval-BdfnqXeP.js.map +0 -1
  360. package/dist/evaluation.d.ts.map +0 -1
  361. package/dist/external-optimizer-subprocess-BUxifb8g.js.map +0 -1
  362. package/dist/feedback-trajectory-BLN_6fEs.d.ts.map +0 -1
  363. package/dist/index-B3WBm953.d.ts.map +0 -1
  364. package/dist/index-B7m2uzJL.d.ts.map +0 -1
  365. package/dist/index-CPJJr98o.d.ts.map +0 -1
  366. package/dist/integrity-BV1ZDf42.js.map +0 -1
  367. package/dist/judge-gate-B1qYnkpi.js.map +0 -1
  368. package/dist/llm-client-DQveoxSM.js.map +0 -1
  369. package/dist/llm-judge-Cd5s5Ei6.js.map +0 -1
  370. package/dist/matrix-_BV9-Lk5.js.map +0 -1
  371. package/dist/mint-DCGoBYhB.d.ts +0 -155
  372. package/dist/mint-DCGoBYhB.d.ts.map +0 -1
  373. package/dist/paired-tests-jbwPdSz5.js.map +0 -1
  374. package/dist/proposal-findings-CXblsskH.js.map +0 -1
  375. package/dist/redact-Cveoq6fJ.d.ts.map +0 -1
  376. package/dist/redact-Dk1ZdJEm.js.map +0 -1
  377. package/dist/registry-CMYIaDgS.d.ts.map +0 -1
  378. package/dist/release-confidence-BK2QCB5M.d.ts.map +0 -1
  379. package/dist/report-command-CtIIsQKP.js.map +0 -1
  380. package/dist/run-record-ES07wfz9.js.map +0 -1
  381. package/dist/search-kernel-BqyBZ9Wm.d.ts.map +0 -1
  382. package/dist/search-kernel-BztlERLv.js.map +0 -1
  383. package/dist/search-ledger-d7V8o9Lk.js.map +0 -1
  384. package/dist/semantic-concept-judge-BPqbwIVs.js.map +0 -1
  385. package/dist/skillopt-optimization-method-Dcepr6QL.js.map +0 -1
  386. package/dist/store-otlp-DWVhUgEj.js.map +0 -1
  387. package/dist/store-tool-spans-BNzls3OD.d.ts.map +0 -1
  388. package/dist/summary-report-C-CtItCN.d.ts.map +0 -1
  389. package/dist/summary-report-DtdRucM0.js.map +0 -1
  390. package/dist/systemone.d.ts.map +0 -1
  391. package/dist/terminal-record-BHocwFw1.js.map +0 -1
  392. package/dist/tool-groups-BKRrtqy4.d.ts.map +0 -1
  393. package/dist/tool-waste-BYt5rdt8.js.map +0 -1
  394. package/dist/tool-waste-Wi4g6Ekb.d.ts.map +0 -1
  395. package/dist/tree-rXLW3M_4.js.map +0 -1
  396. package/dist/types-CGEmVYOk.d.ts.map +0 -1
  397. package/dist/types-CW5b90JH.js.map +0 -1
  398. package/dist/types-DBZ7keha.d.ts.map +0 -1
  399. package/dist/types-DHb5TI36.d.ts.map +0 -1
  400. package/dist/types-DjOMwGY_.d.ts.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,52 +1,143 @@
1
+ import { _ as PendingCostCallView, a as CostLedgerHandle, c as CostLedgerSummary, d as CostReceiptInput, f as CostUsage, g as PendingCostCall, h as PaidCallResult, i as CostLedgerFilter, l as CostProvenance, m as MaximumCharge, n as ChannelRollup, o as CostLedgerOptions, p as CustomTokenPricing, r as CostChannel, s as CostLedgerPersistence, t as CostLedger, u as CostReceipt, v as RunPaidCallInput } from "./cost-ledger-Jk62OBfF.js";
1
2
  import { a as JudgeError, c as ValidationError, i as ConfigError, n as AgentEvalErrorCode, s as NotFoundError, t as AgentEvalError } from "./errors-DEE6u6ot.js";
2
- import { C as PendingCostCall, D as costForUsage, E as costForTokenPricing, O as modelPriceKey, S as PaidCallResult, T as RunPaidCallInput, _ as CostReservationExceededError, a as CostChannel, b as CustomTokenPricing, c as CostLedgerHandle, d as CostLedgerPersistenceError, f as CostLedgerSummary, g as CostReceiptInput, h as CostReceiptCaptureError, i as CostCeilingReachedError, l as CostLedgerOptions, m as CostReceipt, n as CostAccountingIncompleteError, o as CostLedger, p as CostProvenance, r as CostCallConflictError, s as CostLedgerFilter, t as ChannelRollup, u as CostLedgerPersistence, v as CostResult, w as PendingCostCallView, x as MaximumCharge, y as CostUsage } from "./cost-ledger-CO7UyEcQ.js";
3
3
  import { S as verifyAgentProfileCell, _ as buildAgentProfileCell, b as toAgentProfileJson, i as AgentProfileCellInput, l as AgentProfileJson, m as agentProfileCellKey, p as AgentProfileSourceInput, r as AgentProfileCell, s as AgentProfileDimensionValue, t as AGENT_PROFILE_KINDS, v as groupRunsByAgentProfileCell } from "./agent-profile-cell-BNp-Js9F.js";
4
4
  import { C as ToolSpan, D as isToolSpan, E as isLlmSpan, T as isJudgeSpan, a as FAILURE_CLASSES, c as JudgeSpan, f as Run, g as RunStatus, l as LlmSpan, n as BudgetLedgerEntry, o as FailureClass, p as RunCaptureReport, r as BudgetSpec, s as GenericSpan, t as Artifact, v as Span, w as TraceEvent } from "./schema-2g7trUwH.js";
5
- import { _ as runTaskScore, a as RunRecord, c as RunSplitTag, d as RunTokenUsage, f as RunTraceRef, g as parseRunRecordSafe, h as modelHasSnapshot, i as RunOutcome, l as RunTaskFailure, m as isRunRecord, n as RunCostProvenance, o as RunRecordValidationError, p as UNKNOWN_MODEL, r as RunJudgeMetadata, s as RunSearchCoordinates, t as JudgeScoresRecord, u as RunTerminalOutcome, v as searchCellRunId, y as validateRunRecord } from "./run-record-D1Hw-Jml.js";
6
- import { A as DEFAULT_TRACE_ANALYST_BUDGETS, B as TraceAnalystSpan, F as SearchTraceResult, G as ViewTraceOversized, H as TraceAnalystSpanStatus, I as SpanMatchRecord, K as ViewTraceResult, L as TRACE_ANALYST_TRUNCATION_MARKER_PREFIX, M as ErrorCluster, N as QueryTracesPage, O as TraceAnalysisStore, P as SearchSpanResult, R as TraceAnalystByteBudgets, S as createBoundedTraceAnalysisStore, U as TraceAnalystTraceSummary, V as TraceAnalystSpanKind, W as ViewSpansResult, _ as ProposalFinding, b as makeFinding, c as AnalystRunInputs, d as AnalystSeverity, f as AnalystUsageReceipt, i as AnalystFinding, j as DatasetOverview, l as AnalystRunResult, n as AnalystContext, p as EvidenceRef, s as AnalystRunEvent, t as Analyst, u as AnalystRunSummary, x as makeProposalFinding, y as computeFindingId, z as TraceAnalystFilters } from "./types-DHb5TI36.js";
7
- import { $ as NoopRawProviderSink, A as createChatClient, B as LlmToolCall, C as ChatResponse, Ct as judgeFamily, D as MockTransportOpts, E as CustomTransportOpts, F as LlmChargeBounds, G as costReceiptFromLlmError, H as LlmToolDefinition, I as LlmMessage, J as stripFencedJson, K as isTransientLlmError, L as LlmResponseError, M as LlmCallMetadata, N as LlmCallRequest, O as OpenAiCompatibleTransportOpts, P as LlmCallResult, S as ChatRequest, St as assertCrossFamily, T as CreateChatClientOpts, U as LlmUsage, V as LlmToolChoice, W as costReceiptFromLlm, Y as FileSystemRawProviderSink, Z as InMemoryRawProviderSink, _ as ScenarioResult, _t as checkServedModel, a as CompletionCriterion, b as ChatCallOpts, bt as CrossFamilyError, c as JudgeInput, ct as AssertServedModelOptions, d as PersonaConfig, dt as ServedModelCheck, f as ProductClientConfig, ft as ServedModelPolicy, g as ScenarioFile, gt as assertServedModels, h as Scenario, ht as assertServedModel, i as CollectedArtifacts, j as LlmCallError, k as SandboxSdkTransportOpts, l as JudgeRubric, lt as ModelSubstitutionError, m as RubricDimension, mt as assertCrossFamilyServed, n as ArtifactResult, nt as RawProviderEvent, o as DriverState, p as RouteMap, pt as ServedModelVerdict, q as maximumChargeForLlmRequest, r as CheckResult, rt as RawProviderSink, s as JudgeFn, st as AssertCrossFamilyServedOptions, t as ArtifactCheck, u as JudgeScore, ut as ServedCrossFamilyError, v as Turn, vt as servedModelAcceptable, w as ChatTransport, x as ChatClient, xt as JudgeFamily, y as TurnResult, yt as AssertCrossFamilyOptions, z as LlmTokenLogprob } from "./types-DBZ7keha.js";
5
+ import { _ as runTaskScore, a as RunRecord, c as RunSplitTag, d as RunTokenUsage, f as RunTraceRef, g as parseRunRecordSafe, h as modelHasSnapshot, i as RunOutcome, l as RunTaskFailure, m as isRunRecord, n as RunCostProvenance, o as RunRecordValidationError, p as UNKNOWN_MODEL, r as RunJudgeMetadata, s as RunSearchCoordinates, t as JudgeScoresRecord, u as RunTerminalOutcome, v as searchCellRunId, y as validateRunRecord } from "./run-record-C1E24G2A.js";
6
+ import { $ as DatasetOverview, C as makeFinding, Q as DEFAULT_TRACE_ANALYST_BUDGETS, S as computeFindingId, W as createBoundedTraceAnalysisStore, X as TraceAnalysisStore, a as AnalystFinding, at as TRACE_ANALYST_TRUNCATION_MARKER_PREFIX, b as ProposalFinding, ct as TraceAnalystSpan, d as AnalystRunResult, dt as TraceAnalystTraceSummary, et as ErrorCluster, f as AnalystRunSummary, ft as ViewSpansResult, h as EvidenceRef, it as SpanMatchRecord, l as AnalystRunEvent, lt as TraceAnalystSpanKind, m as AnalystUsageReceipt, mt as ViewTraceResult, n as Analyst, nt as SearchSpanResult, ot as TraceAnalystByteBudgets, p as AnalystSeverity, pt as ViewTraceOversized, r as AnalystContext, rt as SearchTraceResult, st as TraceAnalystFilters, tt as QueryTracesPage, u as AnalystRunInputs, ut as TraceAnalystSpanStatus, w as makeProposalFinding } from "./types-C1tnkEgM.js";
7
+ import { A as createChatClient, B as LlmToolDefinition, C as ChatResponse, D as MockTransportOpts, E as CustomTransportOpts, F as LlmMessage, H as FileSystemRawProviderSink, K as NoopRawProviderSink, L as LlmTokenLogprob, M as LlmCallRequest, N as LlmCallResult, O as OpenAiCompatibleTransportOpts, P as LlmChargeBounds, R as LlmToolCall, S as ChatRequest, T as CreateChatClientOpts, V as LlmUsage, W as InMemoryRawProviderSink, X as RawProviderSink, Y as RawProviderEvent, _ as ScenarioResult, a as CompletionCriterion, at as ServedModelPolicy, b as ChatCallOpts, c as JudgeInput, ct as assertServedModel, d as PersonaConfig, dt as servedModelAcceptable, et as AssertCrossFamilyServedOptions, f as ProductClientConfig, ft as AssertCrossFamilyOptions, g as ScenarioFile, gt as judgeFamily, h as Scenario, ht as assertCrossFamily, i as CollectedArtifacts, it as ServedModelCheck, j as LlmCallMetadata, k as SandboxSdkTransportOpts, l as JudgeRubric, lt as assertServedModels, m as RubricDimension, mt as JudgeFamily, n as ArtifactResult, nt as ModelSubstitutionError, o as DriverState, ot as ServedModelVerdict, p as RouteMap, pt as CrossFamilyError, r as CheckResult, rt as ServedCrossFamilyError, s as JudgeFn, st as assertCrossFamilyServed, t as ArtifactCheck, tt as AssertServedModelOptions, u as JudgeScore, ut as checkServedModel, v as Turn, w as ChatTransport, x as ChatClient, y as TurnResult, z as LlmToolChoice } from "./types-C02qtnG8.js";
8
8
  import { a as ContinuousCalibrationResult, d as calibrateJudgeContinuous, f as continuousAgreement, h as verbosityBias, i as ContinuousAgreementOptions, l as VerbosityBiasResult, n as CandidateScore, o as GoldenItem, r as ContinuousAgreement, t as CalibrationResult, u as calibrateJudge } from "./judge-calibration-DFtEMlde.js";
9
- import { G as CorpusAgreementPerDimension, H as SeriesConvergenceResult, J as corpusInterRaterAgreement, K as CorpusAgreementReport, U as analyzeSeries, V as SeriesConvergenceOptions, W as CorpusAgreementOptions, X as interRaterReliability, Y as corpusInterRaterAgreementFromJudgeScores, _ as assertJudgeMayGate, a as JudgeCalibrationSet, b as registerCalibrationSet, c as JudgeGateDecision, d as JudgeGateRefusedError, f as JudgeGateStatus, g as addCalibrationVerdicts, h as OwnerVerdict, i as JudgeAgreement, l as JudgeGateInput, m as JudgeRunMeta, n as CalibrationMerge, o as JudgeConfusion, p as JudgeRun, q as CorpusScoreRecord, r as DEFAULT_JUDGE_GATE_POLICY, s as JudgeExampleAgreement, t as CalibrationExample, u as JudgeGatePolicy, v as judgeGateDecision, x as snapshotFromJudgeAgreement, y as measureJudgeAgreement } from "./judge-gate-DNcUrRFA.js";
9
+ import { G as CorpusAgreementPerDimension, H as SeriesConvergenceResult, J as corpusInterRaterAgreement, K as CorpusAgreementReport, U as analyzeSeries, V as SeriesConvergenceOptions, W as CorpusAgreementOptions, X as interRaterReliability, Y as corpusInterRaterAgreementFromJudgeScores, _ as assertJudgeMayGate, a as JudgeCalibrationSet, b as registerCalibrationSet, c as JudgeGateDecision, d as JudgeGateRefusedError, f as JudgeGateStatus, g as addCalibrationVerdicts, h as OwnerVerdict, i as JudgeAgreement, l as JudgeGateInput, m as JudgeRunMeta, n as CalibrationMerge, o as JudgeConfusion, p as JudgeRun, q as CorpusScoreRecord, r as DEFAULT_JUDGE_GATE_POLICY, s as JudgeExampleAgreement, t as CalibrationExample, u as JudgeGatePolicy, v as judgeGateDecision, x as snapshotFromJudgeAgreement, y as measureJudgeAgreement } from "./judge-gate-CE7CQAgt.js";
10
10
  import { a as partialCredit, c as spearmanR, d as weightedMean, i as confidenceInterval, l as summarizeNumberSeries, n as WeightedCompositeInput, o as pearsonR, r as WeightedCompositeResult, s as ranks, t as SeriesDistribution, u as weightedComposite } from "./descriptive-B2iPaT9J.js";
11
11
  import { n as bonferroni, r as holm, t as benjaminiHochberg } from "./multiplicity-DIWHvysC.js";
12
- import { A as PairArmsOptions, At as EProcess, Bt as isBinaryOutcomeVector, C as hashJson, D as ComparePairedArmsOptions, F as PairedCorrectness, Ft as ExactRiskDifferenceResult, Gt as pairedRiskDifferenceScore, Ht as pairedBinaryScale, I as PairedMetricDelta, It as McNemarResult, Kt as passAtK, L as comparePairedArms, Lt as ProportionInterval, M as PairRunRecordsResult, Mt as EProcessState, N as PairedArmRow, Nt as EProcessStep, O as MatchedPair, P as PairedArmsComparison, Pt as eProcess, R as pairArms, Rt as RiskDifferenceResult, Ut as pairedRiskDifference, Vt as mcnemar, Wt as pairedRiskDifferenceExact, _t as AttestationProvenance, bt as attest, et as Objective, gt as ATTESTATION_ALGORITHM, j as PairArmsResult, jt as EProcessOptions, k as MatchedRunRecordPair, nt as dominates, qt as wilson, rt as paretoFrontier, tt as ParetoResult, vt as AttestationVerification, w as manifestContentDigest, xt as verifyAttestation, yt as AttestedReport, z as pairRunRecords, zt as ScoreRiskDifferenceResult } from "./statistical-heldout-CJTj2EoS.js";
12
+ import { A as PairArmsOptions, At as EProcess, Bt as isBinaryOutcomeVector, C as hashJson, D as ComparePairedArmsOptions, F as PairedCorrectness, Ft as ExactRiskDifferenceResult, Gt as pairedRiskDifferenceScore, Ht as pairedBinaryScale, I as PairedMetricDelta, It as McNemarResult, Kt as passAtK, L as comparePairedArms, Lt as ProportionInterval, M as PairRunRecordsResult, Mt as EProcessState, N as PairedArmRow, Nt as EProcessStep, O as MatchedPair, P as PairedArmsComparison, Pt as eProcess, R as pairArms, Rt as RiskDifferenceResult, Ut as pairedRiskDifference, Vt as mcnemar, Wt as pairedRiskDifferenceExact, _t as AttestationProvenance, bt as attest, et as Objective, gt as ATTESTATION_ALGORITHM, j as PairArmsResult, jt as EProcessOptions, k as MatchedRunRecordPair, nt as dominates, qt as wilson, rt as paretoFrontier, tt as ParetoResult, vt as AttestationVerification, w as manifestContentDigest, xt as verifyAttestation, yt as AttestedReport, z as pairRunRecords, zt as ScoreRiskDifferenceResult } from "./statistical-heldout-CYpGaoDH.js";
13
13
  import { _ as pairedSignTest, a as PairedPromotionDecision, c as BOOTSTRAP_GATE_MIN_N, d as PairedBootstrapResult, f as PairedSignTestResult, g as pairedDeltaTieFraction, h as pairedBootstrap, i as PairedMcNemarEvidence, l as DECISION_PAIRED_DELTA_STATISTIC, m as SignTestAlternative, n as PairedDecisionShape, o as PairedPromotionDecisionOptions, p as PairedTTestResult, r as PairedDecisionStatistic, s as decidePairedPromotion, t as PairedDecisionMethod, u as PairedBootstrapOptions, v as pairedTTest } from "./paired-promotion-decision-DPKz8ZnF.js";
14
14
  import { a as requiredPairedSampleSize, i as pairedMde, n as mcnemarPower, o as requiredSampleSize, r as mcnemarRequiredN, t as mulberry32 } from "./random-DGEyr3zG.js";
15
- import { C as WilcoxonSignedRankResult, S as RankTestOptions, T as wilcoxonSignedRank, _ as bootstrapCi, a as ReleaseConfidenceIssue, b as RankTestMethod, f as evaluateReleaseConfidence, g as Verdict, i as ReleaseConfidenceInput, m as BootstrapResult, o as ReleaseConfidenceMetrics, p as BootstrapOptions, s as ReleaseConfidenceScorecard, t as ActionableSideInfo, u as ReleaseTraceEvidence, w as mannWhitneyU, x as RankTestMethodRequest, y as MannWhitneyResult } from "./release-confidence-BK2QCB5M.js";
15
+ import { C as WilcoxonSignedRankResult, S as RankTestOptions, T as wilcoxonSignedRank, a as bootstrapCi, b as RankTestMethod, d as ReleaseConfidenceIssue, f as ReleaseConfidenceMetrics, g as ReleaseTraceEvidence, i as Verdict, n as BootstrapResult, p as ReleaseConfidenceScorecard, s as ActionableSideInfo, t as BootstrapOptions, u as ReleaseConfidenceInput, v as evaluateReleaseConfidence, w as mannWhitneyU, x as RankTestMethodRequest, y as MannWhitneyResult } from "./promotion-gate-BawrdPYr.js";
16
+ import { Ar as DEFAULT_RED_TEAM_CORPUS, At as RequirementCheck, Br as CanaryKind, Ct as extractProducedState, Dt as LlmCorrectnessCheckerOpts, Et as CorrectnessChecker, Fr as redTeamDataset, Ft as verifyCompletion, Hr as CanaryReport, Ir as redTeamReport, Ji as llmJudge, Lr as scoreRedTeamOutput, Mr as RedTeamCategory, Mt as TaskGold, Nr as RedTeamFinding, Nt as completionVerdict, Ot as ProducedProposal, Pr as RedTeamReport, Pt as createLlmCorrectnessChecker, Qi as transientDispatchFailure, Rr as CanaryAlert, St as ToolCallEventLike, Tt as CompletionVerdict, Ur as runCanaries, Vr as CanaryOptions, Zi as quotaExhaustedUntil, _t as assertRealBackend, bt as ProposalEventLike, da as CampaignCellFailureReceipt, fa as CampaignCellRetryPolicy, gt as BackendIntegrityReport, ht as BackendIntegrityError, jr as RedTeamCase, jt as SatisfiedBy, kt as ProducedState, ma as runCampaign, pa as RunCampaignOptions, qi as LlmJudgeOptions, vt as summarizeBackendIntegrity, wt as CompletionRequirement, xt as RuntimeEventLike, yt as ArtifactEventLike, zr as CanaryEvaluation } from "./index-CyszSg4O.js";
17
+ import { R as Scenario$1, S as JudgeConfig, _ as GateDecision, a as CampaignResult, w as JudgeScore$1 } from "./types-Cq8mSbq8.js";
16
18
  import { a as RunFilter, i as InMemoryTraceStore, n as FileSystemTraceStore, o as SpanFilter, s as TraceStore, t as EventFilter } from "./store-C4avFjIi.js";
17
19
  import { a as MintedRolloutLine } from "./schema-C-ziyJD7.js";
18
- import { a as mintRolloutRows, c as ScorePreference, i as RolloutSearchLineage, n as MintRolloutResult, t as MintRolloutOptions } from "./mint-DCGoBYhB.js";
19
- import { R as Scenario$1, S as JudgeConfig, _ as GateDecision, a as CampaignResult, w as JudgeScore$1 } from "./types-CGEmVYOk.js";
20
- import { Ar as DEFAULT_RED_TEAM_CORPUS, At as RequirementCheck, Br as CanaryKind, Ct as extractProducedState, Dt as LlmCorrectnessCheckerOpts, Et as CorrectnessChecker, Fr as redTeamDataset, Ft as verifyCompletion, Hr as CanaryReport, Ir as redTeamReport, Ji as llmJudge, Lr as scoreRedTeamOutput, Mr as RedTeamCategory, Mt as TaskGold, Nr as RedTeamFinding, Nt as completionVerdict, Ot as ProducedProposal, Pr as RedTeamReport, Pt as createLlmCorrectnessChecker, Qi as transientDispatchFailure, Rr as CanaryAlert, St as ToolCallEventLike, Tt as CompletionVerdict, Ur as runCanaries, Vr as CanaryOptions, Zi as quotaExhaustedUntil, _a as runCampaign, _t as assertRealBackend, bt as ProposalEventLike, ga as RunCampaignOptions, gt as BackendIntegrityReport, ha as CampaignCellRetryPolicy, ht as BackendIntegrityError, jr as RedTeamCase, jt as SatisfiedBy, kt as ProducedState, ma as CampaignCellFailureReceipt, qi as LlmJudgeOptions, vt as summarizeBackendIntegrity, wt as CompletionRequirement, xt as RuntimeEventLike, yt as ArtifactEventLike, zr as CanaryEvaluation } from "./index-B3WBm953.js";
21
- import { a as ProfileAxisSpec, c as expandProfileAxes, i as HarnessType, l as harnessAxisOf, n as CODING_HARNESSES, o as agentProfileHash, r as HARNESS_NATIVE_MODEL, s as agentProfileId, t as AgentProfile } from "./agent-profile-DmzL8KaJ.js";
20
+ import { n as ScorePreference } from "./reward-CpCmAM8L.js";
21
+ import { a as mintRolloutRows, i as RolloutSearchLineage, n as MintRolloutResult, t as MintRolloutOptions } from "./mint-DNU8QPG4.js";
22
+ import { a as ProfileAxisSpec, c as expandProfileAxes, i as HarnessType, l as harnessAxisOf, n as CODING_HARNESSES, o as agentProfileHash, r as HARNESS_NATIVE_MODEL, s as agentProfileId, t as AgentProfile } from "./agent-profile-VFcQncbW.js";
22
23
  import { i as DatasetSplit, n as DatasetManifest, r as DatasetScenario, t as Dataset } from "./dataset-DQqhOCPt.js";
23
24
  import { C as defineEquivalenceCheck, S as buildEquivalenceRecord, _ as StrategyChecker, a as CheckerIdentity, b as VerificationStrategyProfile, c as EquivalenceCheckDefinition, d as EquivalenceCheckerInput, f as EquivalenceCheckerResult, g as EquivalenceRecord, h as EquivalenceProtocolError, i as equivalenceVerdict, l as EquivalenceCheckSpec, m as EquivalenceObligationStatus, n as VerdictCertification, o as CheckerOutcome, p as EquivalenceObligation, r as certificationEvidenceDigest, s as EquivalenceArm, t as DefaultVerdict, u as EquivalenceChecker, v as VERIFICATION_STRATEGIES, w as runEquivalenceCheck, x as VerificationStrategySource, y as VERIFICATION_STRATEGY_SOURCES } from "./verdict-E4eRNf7-.js";
24
25
  import { a as MultiLayerVerifier, c as VerifyOptions, i as LayerStatus, l as gradeSemanticStatus, n as Layer, o as Severity, r as LayerResult, s as VerificationReport, t as Finding } from "./multi-layer-verifier-BUaQ4C17.js";
25
- import { C as HeldOutGateConfig, S as HeldOutGate, T as SplitCoverage, _ as paretoChart, a as ParetoPoint, b as GateDecision$1, d as ResearchReportOptions, g as gainHistogram, h as SummaryTableRow, m as SummaryTableOptions, n as GainDistributionFigureSpec, p as SummaryTable, r as GainDistributionOptions, s as ResearchReport, t as GainDistributionBin, w as HeldOutGateRejectionCode, x as GateEvidence, y as summaryTable } from "./summary-report-C-CtItCN.js";
26
+ import { C as HeldOutGateConfig, S as HeldOutGate, T as SplitCoverage, _ as gainHistogram, a as ResearchReportOptions, b as GateDecision$1, d as GainDistributionOptions, g as SummaryTableRow, h as SummaryTableOptions, l as GainDistributionBin, m as SummaryTable, p as ParetoPoint, t as ResearchReport, u as GainDistributionFigureSpec, v as paretoChart, w as HeldOutGateRejectionCode, x as GateEvidence, y as summaryTable } from "./summary-report-bdFDXq0b.js";
26
27
  import { a as FAILURE_BLAME, c as FailureContext, d as INFRA_FAILURE_BLAMES, f as classifyFailure, i as DEFAULT_FAILURE_REASON_RULES, l as FailureReasonRule, m as failureBlame, o as FailureBlame, p as classifyFailureReason, r as failureClusterView, s as FailureClassification, u as FailureRule } from "./failure-cluster-CbgEDcFJ.js";
27
- import { d as InsightReport, i as analyzeRuns, t as AnalyzeRunsOptions } from "./analyze-runs-BhFLOztS.js";
28
- import { i as ExactAnalystRunEvent, l as ExactCapableAnalyst, o as ExactAnalystRunResult } from "./exact-types-Dlb73wN4.js";
29
- import { c as RegistryRunOpts, i as BudgetPolicy, n as AnalystRegistry, r as AnalystRegistryOptions, s as ExactRegistryRunOpts } from "./registry-CMYIaDgS.js";
30
- import { _ as SelfImproveMethodResult, a as DefinedAgentEval, c as SelfImproveMethodOptions, d as SelfImproveProposerOptions, f as SelfImproveProposerResult, g as SelfImproveMethodProvenance, h as selfImprove, i as DefineAgentEvalOptions, l as SelfImproveOptions, n as AgentEvalEvaluateOptions, o as defineAgentEval, p as SelfImproveResult, r as AgentEvalImproveOptions, s as SelfImproveBudget, t as AgentEvalAgent, u as SelfImproveProgressEvent } from "./define-agent-eval-DfXvNho5.js";
31
- import { a as createTraceAnalyst, i as TraceAnalystDefinition, n as buildDefaultAnalystRegistry, r as CreateTraceAnalystOptions, t as DefaultAnalystRegistryOptions } from "./default-registry-B4B7GMvI.js";
32
- import { i as TraceAnalysisEngineResult, l as RawAnalystFinding, n as TraceAnalysisEngine, t as DEFAULT_TRACE_ANALYST_OUTPUT_TOKENS } from "./engine-C37HS2kr.js";
33
- import { A as SemanticConceptJudgeInput, C as DspyRlmTraceEngineOptions, D as ConceptFinding, E as createChatTraceEngine, M as SemanticConceptJudgeResult, N as runSemanticConceptJudge, O as ConceptSpec, T as ChatTraceEngineOptions, _ as FindingSubject, a as FAILURE_MODE_KIND_SPEC, d as FindingsStore, f as PersistedFinding, j as SemanticConceptJudgeOptions, k as SEMANTIC_CONCEPT_JUDGE_VERSION, l as DiffPolicy, m as diffFindings, t as DEFAULT_TRACE_ANALYST_KINDS, u as FindingsDiff, v as FindingSubjectKind, w as createDspyRlmTraceEngine } from "./index-tYLUvk_w.js";
34
- import { i as BenchmarkEvaluation } from "./types-DinHtRJp.js";
28
+ import { d as InsightReport, n as analyzeRuns, t as AnalyzeRunsOptions } from "./analyze-runs-D68fd-su.js";
29
+ import { i as ExactAnalystRunEvent, l as ExactCapableAnalyst, o as ExactAnalystRunResult } from "./exact-types-ClugMJfI.js";
30
+ import { a as BudgetPolicy, c as RegistryRunOpts, i as AnalystRegistryOptions, s as ExactRegistryRunOpts, t as AnalystRegistry } from "./registry-D7_hm2fK.js";
31
+ import { _ as SelfImproveMethodResult, a as DefinedAgentEval, c as SelfImproveMethodOptions, d as SelfImproveProposerOptions, f as SelfImproveProposerResult, g as SelfImproveMethodProvenance, h as selfImprove, i as DefineAgentEvalOptions, l as SelfImproveOptions, n as AgentEvalEvaluateOptions, o as defineAgentEval, p as SelfImproveResult, r as AgentEvalImproveOptions, s as SelfImproveBudget, t as AgentEvalAgent, u as SelfImproveProgressEvent } from "./define-agent-eval-WSck0CZJ.js";
32
+ import { a as createTraceAnalyst, i as TraceAnalystDefinition, n as buildDefaultAnalystRegistry, r as CreateTraceAnalystOptions, t as DefaultAnalystRegistryOptions } from "./default-registry-DzHiGruW.js";
33
+ import { i as TraceAnalysisEngineResult, l as RawAnalystFinding, n as TraceAnalysisEngine, t as DEFAULT_TRACE_ANALYST_OUTPUT_TOKENS } from "./engine-3A_4jOlI.js";
34
+ import { A as SemanticConceptJudgeInput, C as DspyRlmTraceEngineOptions, D as ConceptFinding, E as createChatTraceEngine, M as SemanticConceptJudgeResult, N as runSemanticConceptJudge, O as ConceptSpec, T as ChatTraceEngineOptions, _ as FindingSubject, a as FAILURE_MODE_KIND_SPEC, d as FindingsStore, f as PersistedFinding, j as SemanticConceptJudgeOptions, k as SEMANTIC_CONCEPT_JUDGE_VERSION, l as DiffPolicy, m as diffFindings, t as DEFAULT_TRACE_ANALYST_KINDS, u as FindingsDiff, v as FindingSubjectKind, w as createDspyRlmTraceEngine } from "./index-DV-jSzxF.js";
35
+ import { i as BenchmarkEvaluation } from "./types-Cbe2fWBa.js";
35
36
  import { a as SpanHandle, n as CaptureWrite, o as TraceEmitter, s as TraceEmitterOptions, t as CaptureErrorHandler } from "./emitter-HcCmFQl_.js";
36
37
  import { n as SandboxDriver } from "./sandbox-harness-BlSOu4LX.js";
37
- import { S as shareAllowed, b as redactForShare, d as ShareSafetyVerdict, f as assessShareSafety, i as RedactOptions, o as RedactionProfile, r as REDACTION_VERSION, s as RedactionReport, u as ShareSafetyStatus, x as redactText, y as redact } from "./redact-Cveoq6fJ.js";
38
+ import { _ as redactText, d as ShareSafetyVerdict, f as assessShareSafety, g as redactForShare, h as redact, i as RedactOptions, o as RedactionProfile, r as REDACTION_VERSION, s as RedactionReport, u as ShareSafetyStatus, v as shareAllowed } from "./redact-mtCCcT8z.js";
38
39
  import { a as PairedEvalueStep, c as SequentialDecision, i as PairedEvalueSequence, l as evaluateInterimReleaseConfidence, n as InterimReleaseConfidenceInput, r as PairedEvalueOptions, t as InterimReleaseConfidence, u as pairedEvalueSequence } from "./sequential-BhsrMupG.js";
40
+ import { _ as WelchTestResult, b as welchsTTest, d as ToolStats, f as ToolUseMetrics, i as toolWasteView, m as computeToolUseMetrics, p as ToolUseOptions, s as judgeAgreementView, u as budgetBreachView, v as WelchTestStatus, y as iqr } from "./tool-waste-BKgvd-TP.js";
41
+ import { A as AnalystFindingDigest, B as ControlRunResult, C as createFeedbackTrajectory, D as renderPreferenceMemoryMarkdown, E as feedbackTrajectoryToOptimizerRow, F as ControlActionOutcome, G as StopDecision, H as ControlRuntimeError, I as ControlBudget, L as ControlContext, M as AnalystRunDigest, N as analystFindingDigest, O as summarizePreferenceMemory, P as analystRunDigest, R as ControlDecision, S as controlRunToFeedbackTrajectory, T as feedbackTrajectoriesToOptimizerRows, U as ControlSeverity, V as ControlRuntimeConfig, W as ControlStep, _ as PreferenceMemoryEntry, a as FeedbackLabel, b as analystRunToReviewRequests, c as FeedbackOptimizerRow, d as FeedbackTask, f as FeedbackTrajectory, g as InMemoryFeedbackTrajectoryStore, h as FileSystemFeedbackTrajectoryStore, i as FeedbackAttempt, j as AnalystReviewDecision, k as withAssignedFeedbackSplit, l as FeedbackOutcome, m as FeedbackTrajectoryStore, n as AnalystReviewRequest, o as FeedbackLabelKind, p as FeedbackTrajectoryFilter, r as FeedbackArtifactType, s as FeedbackLabelSource, t as AnalystFeedbackTrajectoryOptions, u as FeedbackSplitPolicy, v as ProposedSideEffect, w as feedbackTrajectoriesToDatasetScenarios, x as assignFeedbackSplit, y as analystRunToFeedbackTrajectory, z as ControlEvalResult } from "./feedback-trajectory-C4EG0nNH.js";
42
+ import { B as inferDomainKeywords, C as exportRunAsOtlp, F as buildTraceInsightContext, G as scoreTraceInsightReadiness, I as buildTraceInsightPrompt, K as tokenizeDomainWords, M as TraceInsightReadiness, N as TraceInsightSuite, R as describeTraceInsightScope, S as OtlpSpan, X as analyzeTraces, Y as AnalyzeTracesResult, _ as spanRecordsToTraceAnalysisStore, a as captureFetchToRawSink, b as OtlpExport, c as ExtractedUsage, f as extractUsageFromSse, g as otlpTextToTraceAnalysisStore, h as SpanRecordsToTraceAnalysisStoreOptions, n as toolSpansToTraceAnalysisStore, o as OtlpFlatLine, p as OtlpFileTraceStore, u as extractUsage, z as domainEvidencePattern } from "./store-tool-spans-DdCSPa7C.js";
43
+ import { a as RunIntegrityReport, o as assertRunCaptured, t as RunIntegrityError } from "./integrity-DAMEDFaC.js";
44
+ import { a as SteeringChange, c as CampaignRunContext, d as CampaignVariant, f as EvalCampaignOptions, h as runEvalCampaign, i as Researcher, l as CampaignRunOutcome, m as FailedRun, n as ExperimentResult, o as CampaignFactoryParams, p as EvalCampaignResult, r as FailureMode, s as CampaignIntegrityPolicy, t as ExperimentPlan, u as CampaignScenario } from "./researcher-CEcfku-T.js";
45
+ import "./index-BFRO6chs.js";
39
46
  import { n as TrajectoryStep, r as buildTrajectory, t as Trajectory } from "./trajectory-Y1fmdlw7.js";
40
47
  import { a as runCounterfactual, i as CounterfactualRunner, n as CounterfactualMutation, r as CounterfactualResult, t as CounterfactualContext } from "./counterfactual-CPaWN99-.js";
41
- import { A as AnalystFindingDigest, B as ControlRunResult, C as createFeedbackTrajectory, D as renderPreferenceMemoryMarkdown, E as feedbackTrajectoryToOptimizerRow, F as ControlActionOutcome, G as StopDecision, H as ControlRuntimeError, I as ControlBudget, J as subjectiveEval, K as objectiveEval, L as ControlContext, M as AnalystRunDigest, N as analystFindingDigest, O as summarizePreferenceMemory, P as analystRunDigest, R as ControlDecision, S as controlRunToFeedbackTrajectory, T as feedbackTrajectoriesToOptimizerRows, U as ControlSeverity, V as ControlRuntimeConfig, W as ControlStep, _ as PreferenceMemoryEntry, a as FeedbackLabel, b as analystRunToReviewRequests, c as FeedbackOptimizerRow, d as FeedbackTask, f as FeedbackTrajectory, g as InMemoryFeedbackTrajectoryStore, h as FileSystemFeedbackTrajectoryStore, i as FeedbackAttempt, j as AnalystReviewDecision, k as withAssignedFeedbackSplit, l as FeedbackOutcome, m as FeedbackTrajectoryStore, n as AnalystReviewRequest, o as FeedbackLabelKind, p as FeedbackTrajectoryFilter, q as runAgentControlLoop, r as FeedbackArtifactType, s as FeedbackLabelSource, t as AnalystFeedbackTrajectoryOptions, u as FeedbackSplitPolicy, v as ProposedSideEffect, w as feedbackTrajectoriesToDatasetScenarios, x as assignFeedbackSplit, y as analystRunToFeedbackTrajectory, z as ControlEvalResult } from "./feedback-trajectory-BLN_6fEs.js";
42
48
  import { y as OUTPUT_VALUE } from "./attribute-vocabulary-CcXqHODT.js";
43
- import { A as scoreTraceInsightReadiness, B as OtlpSpan, C as describeTraceInsightScope, F as analyzeTraces, I as OtlpFlatLine, J as extractUsage, K as ExtractedUsage, P as AnalyzeTracesResult, R as OtlpExport, T as inferDomainKeywords, V as exportRunAsOtlp, W as captureFetchToRawSink, X as extractUsageFromSse, _ as TraceInsightReadiness, a as SpanRecordsToTraceAnalysisStoreOptions, b as buildTraceInsightContext, c as spanRecordsToTraceAnalysisStore, j as tokenizeDomainWords, n as toolSpansToTraceAnalysisStore, r as OtlpFileTraceStore, s as otlpTextToTraceAnalysisStore, v as TraceInsightSuite, w as domainEvidencePattern, x as buildTraceInsightPrompt } from "./store-tool-spans-BNzls3OD.js";
44
- import { a as RunIntegrityReport, o as assertRunCaptured, t as RunIntegrityError } from "./integrity-CCAxGVK6.js";
45
49
  import { d as runsForScenario, i as argHash, s as judgeSpans } from "./query-DK1nWcmp.js";
46
- import { a as SteeringChange, c as CampaignRunContext, d as CampaignVariant, f as EvalCampaignOptions, h as runEvalCampaign, i as Researcher, l as CampaignRunOutcome, m as FailedRun, n as ExperimentResult, o as CampaignFactoryParams, p as EvalCampaignResult, r as FailureMode, s as CampaignIntegrityPolicy, t as ExperimentPlan, u as CampaignScenario } from "./researcher-f6mZhh58.js";
47
- import "./index-CPJJr98o.js";
48
- import { _ as WelchTestResult, a as ToolStats, b as welchsTTest, c as computeToolUseMetrics, d as judgeAgreementView, i as toolWasteView, m as budgetBreachView, o as ToolUseMetrics, s as ToolUseOptions, v as WelchTestStatus, y as iqr } from "./tool-waste-Wi4g6Ekb.js";
49
50
  import { SpanKind } from "@tangle-network/agent-trace-contract";
51
+ //#region src/cost-ledger/errors.d.ts
52
+ export declare class CostCeilingReachedError extends ValidationError {
53
+ constructor(ceilingUsd: number, committedUsd: number, requestedUsd: number, phase: string, actor: string);
54
+ }
55
+ export declare class CostAccountingIncompleteError extends ValidationError {}
56
+ export declare class CostReservationExceededError extends ValidationError {
57
+ constructor(actor: string, actualUsd: number, maximumUsd: number);
58
+ }
59
+ export declare class CostCallConflictError extends ValidationError {
60
+ readonly callId?: string;
61
+ readonly receipt?: CostReceipt;
62
+ constructor(message: string, options?: {
63
+ callId?: string;
64
+ receipt?: CostReceipt;
65
+ cause?: unknown;
66
+ });
67
+ }
68
+ export declare class CostLedgerPersistenceError extends ValidationError {
69
+ readonly callId?: string;
70
+ readonly receipt?: CostReceipt;
71
+ constructor(cause: unknown, callId?: string, receipt?: CostReceipt);
72
+ }
73
+ export declare class CostReceiptCaptureError extends ValidationError {
74
+ readonly callId: string;
75
+ readonly receipt?: CostReceipt;
76
+ readonly receiptError: Error;
77
+ constructor(callId: string, cause: unknown, receiptError: unknown, receipt?: CostReceipt);
78
+ }
79
+ //#endregion
80
+ //#region src/cost-ledger/pricing.d.ts
81
+ /** Return the canonical pricing-table key, or null when the model is unpriced. */
82
+ export declare function modelPriceKey(model: string): string | null;
83
+ interface CostResult {
84
+ costUsd: number;
85
+ costUnknown: boolean;
86
+ }
87
+ export declare function costForUsage(model: string, usage: CostUsage): CostResult;
88
+ /** Price token counts with caller-supplied per-million rates. */
89
+ export declare function costForTokenPricing(pricing: CustomTokenPricing, usage: Pick<CostUsage, 'inputTokens' | 'outputTokens' | 'cachedTokens' | 'cacheWriteTokens'>): number;
90
+ //#endregion
91
+ //#region src/llm-client/accounting.d.ts
92
+ export declare function maximumChargeForLlmRequest(request: Pick<LlmCallRequest, 'model' | 'messages' | 'jsonSchema' | 'tools' | 'toolChoice' | 'maxTokens' | 'thinking'>, options?: LlmChargeBounds): MaximumCharge | undefined;
93
+ /** Convert a provider result into the canonical paid-call receipt input.
94
+ * The receipt is JSON-clean: absent optional fields are omitted, never carried
95
+ * as explicit-undefined keys. Receipts cross JSON boundaries (the external
96
+ * optimizer's loopback proxy validates them with `assertJsonValue`), where an
97
+ * explicit-undefined value is rejected as non-serializable. */
98
+ export declare function costReceiptFromLlm(result: LlmCallResult, customTokenPricing?: CustomTokenPricing): CostReceiptInput;
99
+ /** Structured-response failures retain their completed provider receipt. */
100
+ export declare function costReceiptFromLlmError(error: Error, customTokenPricing?: CustomTokenPricing): CostReceiptInput | undefined;
101
+ //#endregion
102
+ //#region src/llm-client/errors.d.ts
103
+ export declare class LlmCallError extends AgentEvalError {
104
+ readonly status: number;
105
+ readonly body: string;
106
+ readonly model: string;
107
+ constructor(message: string, status: number, body: string, model: string);
108
+ }
109
+ /** A provider response completed and incurred measurable usage, but its content
110
+ * could not satisfy the caller's response contract. The response envelope is
111
+ * retained so accounting can commit the receipt before the error propagates. */
112
+ export declare class LlmResponseError extends AgentEvalError {
113
+ readonly result: LlmCallResult;
114
+ constructor(message: string, result: LlmCallResult, options?: {
115
+ cause?: unknown;
116
+ });
117
+ }
118
+ //#endregion
119
+ //#region src/llm-client/json.d.ts
120
+ /**
121
+ * Strip a ```json / ``` code fence if the model emitted one.
122
+ * Idempotent for naked JSON. Some models (claude-code via router, certain
123
+ * deepseek models) wrap output even under json_object.
124
+ */
125
+ export declare function stripFencedJson(raw: string): string;
126
+ //#endregion
127
+ //#region src/llm-client/resilience.d.ts
128
+ /**
129
+ * True when an error is a transient transport/network fault worth retrying,
130
+ * as opposed to a deterministic failure (4xx schema reject, JSON parse) that
131
+ * a retry cannot fix. Inspects `LlmCallError.status`, then the error's
132
+ * name/message/code, then recurses into `error.cause` — undici nests the
133
+ * real socket fault one or more levels under `.cause`.
134
+ *
135
+ * This is the retry classifier for the package: `callLlm` and
136
+ * `withJudgeRetry` both route through it, so connection failures are treated
137
+ * consistently across transports.
138
+ */
139
+ export declare function isTransientLlmError(err: unknown): boolean;
140
+ //#endregion
50
141
  //#region src/statistics/effect-sizes.d.ts
51
142
  /**
52
143
  * Standardized effect sizes: Cohen's d family and Cliff's delta, with the
@@ -151,694 +242,824 @@ export declare function sampleMedian(values: readonly number[]): number | null;
151
242
  /** Descriptive facts, not stability policy or a significance test. */
152
243
  export declare function summarizeSample(values: readonly number[], options?: SampleSummaryOptions): SampleSummary | null;
153
244
  //#endregion
154
- //#region src/profile/baselines.d.ts
245
+ //#region src/analyst/policy-edit.d.ts
246
+ type PolicyEditSchemaVersion = 'policy-edit/v1';
247
+ declare const POLICY_EDIT_AXES: readonly ['carrier', 'representation', 'budget', 'sampling', 'output_contract', 'tool_contract', 'routing', 'memory', 'agent_profile', 'deployment_target'];
248
+ type PolicyEditAxis = (typeof POLICY_EDIT_AXES)[number];
249
+ declare const POLICY_EDIT_TARGET_SURFACES: readonly ['prompt', 'tool-contract', 'runtime-config', 'memory', 'agent-profile', 'code', 'deployment'];
250
+ type PolicyEditTargetSurface = (typeof POLICY_EDIT_TARGET_SURFACES)[number];
251
+ type PolicyEditRisk = 'low' | 'medium' | 'high' | 'unknown';
252
+ type PolicyEditGainDirection = 'increase' | 'decrease';
253
+ type PolicyEditGainUnit = 'absolute' | 'relative' | 'percent' | 'score';
254
+ interface PolicyEditTarget {
255
+ surface: PolicyEditTargetSurface;
256
+ /** Stable path inside the target surface, for example `system-prompt:tools`
257
+ * or `budget.maxTurns`. */
258
+ path?: string;
259
+ /** Optional canonical deployment identity. Store the existing cell, not a
260
+ * local profile shape. */
261
+ agentProfileCell?: AgentProfileCell;
262
+ /** Human label when the path is not enough for a readable audit trail. */
263
+ label?: string;
264
+ }
265
+ type PolicyEditChange = {
266
+ kind: 'text';
267
+ mode: 'append' | 'prepend' | 'replace';
268
+ value: string;
269
+ /** Required when `mode === 'replace'`; exact match only. */
270
+ find?: string;
271
+ } | {
272
+ kind: 'json';
273
+ mode: 'set' | 'merge' | 'remove';
274
+ path: string;
275
+ value?: AgentProfileJson;
276
+ };
277
+ interface PolicyEditExpectedGain {
278
+ /** Metric this edit is expected to move, e.g. `holdout.composite`. */
279
+ metric: string;
280
+ direction: PolicyEditGainDirection;
281
+ /** Positive magnitude in the metric's native units. */
282
+ amount: number;
283
+ unit?: PolicyEditGainUnit;
284
+ rationale?: string;
285
+ }
286
+ interface PolicyEditSource {
287
+ findingIds: string[];
288
+ analystIds: string[];
289
+ evidenceRefs: EvidenceRef[];
290
+ /** Mirrors `AnalystFinding.derived_from_judge`; admission rejects it. */
291
+ derivedFromJudge?: boolean;
292
+ }
293
+ interface PolicyEdit {
294
+ schemaVersion: PolicyEditSchemaVersion;
295
+ editId: string;
296
+ axis: PolicyEditAxis;
297
+ target: PolicyEditTarget;
298
+ change: PolicyEditChange;
299
+ claim: string;
300
+ expectedGain: PolicyEditExpectedGain;
301
+ confidence: number;
302
+ risk: PolicyEditRisk;
303
+ source: PolicyEditSource;
304
+ rationale?: string;
305
+ validationPlan?: string;
306
+ metadata?: Record<string, unknown>;
307
+ }
308
+ export declare const POLICY_EDIT_CANDIDATE_RECORD_SCHEMA: 'tangle.policy-edit-candidate.v1';
309
+ /** JSON-safe attribution carried with a measured candidate and its scores. */
310
+ interface PolicyEditCandidateRecord {
311
+ schema: typeof POLICY_EDIT_CANDIDATE_RECORD_SCHEMA;
312
+ policyEdit: PolicyEdit;
313
+ }
314
+ type PolicyEditInit = Omit<PolicyEdit, 'schemaVersion' | 'editId'> & {
315
+ schemaVersion?: PolicyEditSchemaVersion;
316
+ editId?: string;
317
+ };
318
+ export declare class PolicyEditValidationError extends ValidationError {
319
+ readonly path: string;
320
+ constructor(message: string, path?: string);
321
+ }
322
+ interface FindingToPolicyEditOptions {
323
+ expectedGain?: PolicyEditExpectedGain | ((finding: AnalystFinding) => PolicyEditExpectedGain | null | undefined);
324
+ risk?: PolicyEditRisk | ((finding: AnalystFinding) => PolicyEditRisk);
325
+ defaultAxis?: PolicyEditAxis;
326
+ defaultTargetSurface?: PolicyEditTargetSurface;
327
+ }
328
+ interface PolicyEditAdmissionOptions {
329
+ minScore?: number;
330
+ minExpectedGain?: number;
331
+ allowHighRisk?: boolean;
332
+ requireEvidence?: boolean;
333
+ }
334
+ interface PolicyEditAdmission {
335
+ edit: PolicyEdit;
336
+ decision: 'admit' | 'reject';
337
+ score: number;
338
+ reasons: string[];
339
+ }
340
+ export declare function makePolicyEdit(init: PolicyEditInit): PolicyEdit;
341
+ export declare function computePolicyEditId(edit: Omit<PolicyEdit, 'editId'> | PolicyEdit): string;
342
+ export declare function validatePolicyEdit(input: unknown): PolicyEdit;
343
+ export declare function makePolicyEditCandidateRecord(edit: PolicyEdit): PolicyEditCandidateRecord;
344
+ export declare function validatePolicyEditCandidateRecord(input: unknown): PolicyEditCandidateRecord;
345
+ export declare function policyEditsFromFindings(findings: ReadonlyArray<AnalystFinding>, opts?: FindingToPolicyEditOptions): PolicyEdit[];
346
+ export declare function admitPolicyEdit(edit: PolicyEdit, opts?: PolicyEditAdmissionOptions): PolicyEditAdmission;
347
+ export declare function applyPolicyEditToSurface(surface: unknown, edit: PolicyEdit): unknown;
348
+ //#endregion
349
+ //#region src/capability-headroom.d.ts
155
350
  /**
156
- * Strong, generically-useful baseline ROLES — the top zone of an `AgentProfile`
157
- * before any domain layer. A product composes one of these with its own
158
- * environment description (its sandbox) and its domain guidance, which lives in
159
- * the product repo (not here): a profile is `<baseline role> + <environment> +
160
- * <domain sections>`. Domain strength is NOT generalized into the substrate —
161
- * it is lifted here only once ≥2 products genuinely reuse it.
351
+ * Capability-headroom gate — "can this task set even SEE the capability
352
+ * you're about to A/B?"
162
353
  *
163
- * Three roles cover the common shapes:
164
- * - `engineerRole` — builds + verifies real artifacts in a sandbox. Distilled
165
- * from agent-runtime's `coderProfile` doctrine (minimal
166
- * correct change, run the checks, fix the root cause,
167
- * never weaken a test or hide an error).
168
- * - `researcherRole` — gathers from real sources and grounds every claim
169
- * (cite or mark inferred; never fabricate).
170
- * - `generalistRole` — a strong default: helpful, grounded, verify-before-assert.
354
+ * A capability A/B (grant one arm a tool, a skill, extra context — anything)
355
+ * can only detect the capability on tasks the capability-ABSENT baseline
356
+ * FAILS. A task the baseline already passes is saturated: the treatment arm
357
+ * has no headroom to demonstrate anything, and averaging saturated tasks into
358
+ * the comparison dilutes a real effect toward a false null. Calibrate before
359
+ * measuring: run the baseline arm first, classify every task's headroom, and
360
+ * refuse to run the comparison when no task has a gap.
171
361
  *
172
- * All three are verification-first and domain-agnostic. They describe HOW a
173
- * capable IC operates, not WHAT domain it works in.
362
+ * Fail-closed on unknown outcomes: a baseline run whose outcome could not be
363
+ * determined (infra loss, unverified, missing) NEVER counts as a failure —
364
+ * treating "couldn't tell" as "failed" would manufacture headroom out of
365
+ * telemetry gaps and launder infra noise into a treatment effect.
366
+ *
367
+ * Domain-free by construction: the capability under test never appears here.
368
+ * Callers decide what the baseline arm lacks; this module only classifies
369
+ * baseline outcomes per task.
174
370
  */
175
- /** Senior-IC engineer operating in a sandbox — produces real artifacts and
176
- * verifies them before declaring done. The shared operator foundation for any
177
- * file-producing, tool-using product agent. */
178
- declare const engineerRole: string;
179
- /** Researcher who grounds every claim in real sources — gathers, cites, and
180
- * distinguishes verified fact from inference. */
181
- declare const researcherRole: string;
182
- /** Strong general-purpose default — helpful, grounded, verifies before asserting. */
183
- declare const generalistRole: string;
184
- /** The named baseline roles, for selection by key (e.g. from a product config). */
185
- declare const BASELINE_ROLES: {
186
- readonly engineer: string;
187
- readonly researcher: string;
188
- readonly generalist: string;
189
- };
190
- type BaselineRoleKey = keyof typeof BASELINE_ROLES;
191
- declare namespace index_d_exports {
192
- export { AgentProfileSection, BASELINE_ROLES, BaselineRoleKey, ProfileSkill, PromptProfile, applyDomainPatch, baselineProfile, baselineProfileFromRole, engineerRole, generalistRole, prodProfile, profileToSurface, renderProfile, researcherRole, sectionHash };
371
+ /** One baseline-arm (capability-absent) observation of one task. */
372
+ interface HeadroomInput {
373
+ /** Stable task identity; multiple rows per task are multiple baseline reps. */
374
+ taskId: string;
375
+ /** Baseline outcome. 'unknown' = the outcome could not be determined —
376
+ * distinct from 'fail' and never counted as one. */
377
+ baselineOutcome: 'pass' | 'fail' | 'unknown';
193
378
  }
194
- /** A named, addressable region of the system prompt. `evolvable` marks whether
195
- * the self-improvement loop is allowed to patch its body; fixed scaffolding
196
- * (e.g. a compliance preamble) sets `evolvable: false`. */
197
- interface AgentProfileSection {
198
- id: string;
199
- title: string;
200
- body: string;
201
- evolvable: boolean;
379
+ /** Headroom classification for one task.
380
+ * - 'gap': the baseline fails it — the comparison can see the capability here.
381
+ * - 'saturated': the baseline already passes it — no headroom.
382
+ * - 'unknown': every baseline outcome is unknown — fail-closed, not a gap. */
383
+ type HeadroomClass = 'gap' | 'saturated' | 'unknown';
384
+ interface TaskHeadroom {
385
+ taskId: string;
386
+ /** Total baseline observations for this task (known + unknown). */
387
+ n: number;
388
+ /** Observations with a known ('pass' | 'fail') outcome — the evidence the
389
+ * classification actually rests on. A large `n` with a small `nKnown`
390
+ * means the headroom verdict is thin, not well-replicated. */
391
+ nKnown: number;
392
+ /** Pass rate over KNOWN outcomes only; NaN when every outcome is unknown
393
+ * (no data ≠ measured zero). */
394
+ baselinePassRate: number;
395
+ headroom: HeadroomClass;
202
396
  }
203
- /** A skill the agent can invoke. `triggers` are the phrases/conditions that
204
- * should activate it; `scriptsDir` points at its executable scripts when the
205
- * skill ships code (mirrors Harvey's `skills/<name>/scripts/`). */
206
- interface ProfileSkill {
207
- name: string;
208
- description: string;
209
- triggers: string[];
210
- scriptsDir?: string;
397
+ interface CapabilityHeadroomOptions {
398
+ /** A task counts as 'gap' when its baseline pass rate is ≤ this. Default 0
399
+ * (the baseline must fail every known rep). Must be in [0, 1) — a
400
+ * threshold of 1 would classify a fully-saturated task as a gap. */
401
+ keepThreshold?: number;
211
402
  }
212
- /** The structured system prompt. The first four fields are fixed scaffolding;
213
- * `domain` is the evolvable surface the loop optimizes. */
214
- interface PromptProfile {
215
- role: string;
216
- environment: string;
217
- toolConventions: string;
218
- skills: ProfileSkill[];
219
- domain: AgentProfileSection[];
403
+ interface CapabilityHeadroomResult {
404
+ /** Per-task classification, sorted by `taskId`. */
405
+ tasks: TaskHeadroom[];
406
+ summary: {
407
+ tasksWithGap: number;
408
+ tasksSaturated: number;
409
+ tasksUnknown: number;
410
+ /** Total unknown-outcome reps across ALL tasks (including tasks that
411
+ * still classified via their known reps) — the size of the telemetry
412
+ * hole behind the classifications. */
413
+ repsUnknown: number;
414
+ };
220
415
  }
221
416
  /**
222
- * Emit the sectioned system prompt in fixed order: role text, then
223
- * `## Environment`, `## Tool conventions`, `## Skills` (each skill as
224
- * `### <name>` + description + triggers), `## Domain guidance` (each section as
225
- * `### <title>` + body). The order is load-bearing — the loop diffs rendered
226
- * text, and reordering would make every candidate look like a full rewrite.
417
+ * Classify every task's baseline headroom from capability-absent baseline
418
+ * outcomes.
419
+ *
420
+ * A task is 'gap' when it has ≥ 1 known outcome and its pass rate over known
421
+ * outcomes is ≤ `keepThreshold`; 'saturated' when the rate exceeds the
422
+ * threshold; 'unknown' when every outcome is unknown. Unknown reps never
423
+ * count toward the rate in either direction (fail-closed — see the module
424
+ * doc), and evidence strength stays visible: each task reports `nKnown`
425
+ * alongside `n`, and the summary totals the unknown reps in `repsUnknown`.
426
+ * Throws on empty input, an out-of-range `keepThreshold`, or an
427
+ * unrecognized outcome value (rows are often projected from untyped records).
227
428
  */
228
- declare function renderProfile(p: PromptProfile): string;
229
- /** The string `MutableSurface` the self-improvement loop scores — a profile
230
- * renders to exactly the text a candidate is graded on. */
231
- declare function profileToSurface(p: PromptProfile): string;
232
- /**
233
- * The fixed-scaffolding baseline: a `role`/`environment`/`toolConventions`
234
- * profile with the stock skill roster and NO domain guidance. The
235
- * production profile is this plus shipped domain sections.
236
- */
237
- declare function baselineProfile(args: {
238
- role: string;
239
- environment?: string;
240
- toolConventions?: string;
241
- skills?: ProfileSkill[];
242
- }): PromptProfile;
243
- /**
244
- * Baseline from one of the strong generic roles (`'engineer' | 'researcher' |
245
- * 'generalist'`) — the common case: pick a role foundation, optionally override
246
- * the environment to describe THIS product's sandbox, then layer domain via
247
- * `prodProfile`. Domain guidance stays in the product repo; this only supplies
248
- * the generically-useful role + stock scaffolding.
249
- */
250
- declare function baselineProfileFromRole(role: BaselineRoleKey, args?: {
251
- environment?: string;
252
- toolConventions?: string;
253
- skills?: ProfileSkill[];
254
- }): PromptProfile;
255
- /** The production profile: the baseline scaffolding plus the domain sections
256
- * shipped after self-improvement. Differs from the baseline ONLY in `domain`
257
- * (and any skills the caller layered into the baseline) — the role,
258
- * environment, and tool conventions are carried through unchanged. */
259
- declare function prodProfile(baseline: PromptProfile, shipped: AgentProfileSection[]): PromptProfile;
429
+ export declare function capabilityHeadroom(rows: readonly HeadroomInput[], opts?: CapabilityHeadroomOptions): CapabilityHeadroomResult;
430
+ interface AssertCapabilityHeadroomOptions {
431
+ /** Minimum tasks classified 'gap' for the comparison to proceed. Default 1. */
432
+ minTasksWithGap?: number;
433
+ }
260
434
  /**
261
- * Section-scoped edit — replace the body of ONE domain section by id, leaving
262
- * every other section byte-identical. This is how the loop targets a single
263
- * evolvable surface. Throws on an unknown section id (a patch that hits no
264
- * section is a silent no-op otherwise — fail loud). Throws when the targeted
265
- * section is `evolvable: false`.
435
+ * The go/no-go guard: throws when fewer than `minTasksWithGap` tasks have
436
+ * baseline headroom — i.e. the benchmark cannot see the capability, so any
437
+ * comparison run on it would measure noise. Call between the baseline
438
+ * calibration run and the treatment run.
266
439
  */
267
- declare function applyDomainPatch(p: PromptProfile, sectionId: string, newBody: string): PromptProfile;
440
+ export declare function assertCapabilityHeadroom(result: CapabilityHeadroomResult, opts?: AssertCapabilityHeadroomOptions): void;
441
+ //#endregion
442
+ //#region src/cost-tracker.d.ts
268
443
  /**
269
- * Content hash of a single section — its loop identity. Delegates to the
270
- * campaign provenance `surfaceContentHash` (the same helper the loop's
271
- * provenance record uses for full surfaces), so a section hash is byte-for-byte
272
- * comparable with the `sha256:`-prefixed content hashes that record carries.
273
- * Two sections that render identically (same title + body) share a hash; the
274
- * `id` and `evolvable` flag are excluded — they are routing metadata, not
275
- * content.
444
+ * Cost tracker — token + USD accounting per scenario and per run.
445
+ *
446
+ * Adapted from generic usage-event accounting. Every
447
+ * optimizer needs to know "is the quality gain worth the cost delta?",
448
+ * and every dashboard needs dollars-per-completed-task. MODEL_PRICING
449
+ * from metrics.ts stays authoritative for estimate math; this module
450
+ * adds the aggregation + per-scenario roll-up that was duplicated
451
+ * across 4 verticals.
276
452
  */
277
- declare function sectionHash(section: AgentProfileSection): string;
278
- //#endregion
279
- //#region src/budget-guard.d.ts
280
- export declare class BudgetBreachError extends AgentEvalError {
281
- dimension: keyof BudgetSpec;
282
- limit: number;
283
- attempted: number;
284
- constructor(dimension: keyof BudgetSpec, limit: number, attempted: number);
285
- }
286
- export declare class BudgetGuard {
287
- private consumed;
288
- private emitter;
289
- private budget;
290
- private startedAt;
291
- constructor(emitter: TraceEmitter, budget: BudgetSpec, now?: () => number);
292
- /** Record consumption. Throws `BudgetBreachError` if any dimension exceeds its cap. */
293
- charge(delta: Partial<Record<keyof BudgetSpec, number>>, spanId?: string): Promise<void>;
294
- /** Convenience: advance wall-clock budget based on elapsed wall time. */
295
- tickWall(nowMs: number, spanId?: string): Promise<void>;
296
- get state(): Record<keyof BudgetSpec, number>;
297
- }
298
- //#endregion
299
- //#region src/run-score.d.ts
300
- interface RunScore {
301
- success: number;
302
- goalProgress: number;
303
- repoGroundedness: number;
304
- driftPenalty: number;
305
- toolUseQuality: number;
306
- patchQuality: number;
307
- testReality: number;
308
- finalGate: number;
309
- reviewerBlockers: number;
310
- costUsd: number;
311
- wallSeconds: number;
312
- notes?: string[];
313
- }
314
- interface RunScoreWeights {
315
- success: number;
316
- goalProgress: number;
317
- repoGroundedness: number;
318
- driftPenalty: number;
319
- toolUseQuality: number;
320
- patchQuality: number;
321
- testReality: number;
322
- finalGate: number;
323
- reviewerBlockers: number;
324
- costUsd: number;
325
- wallSeconds: number;
326
- }
327
- export declare function aggregateRunScore(score: RunScore, weights?: Partial<RunScoreWeights>): number;
328
- export declare function clamp01(value: number): number;
329
- //#endregion
330
- //#region src/scorecard.d.ts
331
- /** One commit's measurement of one (scenario, profile) cell. */
332
- interface ScorecardEntry {
333
- commitSha: string;
334
- /** ISO timestamp the entry was recorded. */
335
- timestamp: string;
336
- /** Per-seed (or per-rep) scores for this cell at this commit. */
337
- scores: number[];
338
- /** Median of `scores` — the cell's headline score for the commit. */
339
- composite: number;
340
- /** Per-dimension means, when the runs carried a judge breakdown. */
341
- perDimension?: Record<string, number>;
342
- /** RunRecord ids folded into this entry — provenance. */
343
- runIds: string[];
344
- }
345
- /** A (scenario, profile) cell and its commit-ordered score timeline. */
346
- interface ScorecardCell {
347
- scenarioId: string;
348
- profileHash: string;
349
- /** Model id — denormalised from the profile for readable filtering. */
350
- model: string;
351
- timeline: ScorecardEntry[];
352
- }
353
- /** The folded scorecard: every cell, plus the profile definitions by hash. */
354
- interface Scorecard {
355
- cells: ScorecardCell[];
356
- /** Profile definitions seen — keeps the scorecard self-describing. */
357
- profiles: Record<string, AgentProfile>;
453
+ interface TokenSpec {
454
+ inputTokens: number;
455
+ outputTokens: number;
456
+ cachedTokens?: number;
457
+ reasoningTokens?: number;
358
458
  }
359
- /** One append-only log line — a single cell's entry for a single commit. */
360
- interface ScorecardLogLine {
459
+ interface CostEntry extends TokenSpec {
361
460
  scenarioId: string;
362
- profileHash: string;
363
461
  model: string;
364
- profile: AgentProfile;
365
- entry: ScorecardEntry;
366
- }
367
- interface RecordRunsOptions {
368
- /** The profile that produced these runs — keys the cell. */
369
- profile: AgentProfile;
370
- commitSha: string;
371
- /** Defaults to `new Date().toISOString()`. */
372
- timestamp?: string;
462
+ /** Override estimate with an observed cost (e.g. from provider response). */
463
+ actualCostUsd?: number;
464
+ timestamp: number;
465
+ /** Free-form tags (variant id, round #, etc.). */
466
+ tags?: Record<string, string>;
373
467
  }
374
- /**
375
- * Fold a benchmark's `RunRecord[]` into per-cell scorecard log lines — one
376
- * line per scenario the runs cover. All runs are attributed to the single
377
- * `profile` in `opts` (the harness ran them under it); the cell key is
378
- * `(scenarioId, agentProfileHash(profile))`.
379
- */
380
- export declare function recordRuns(runs: RunRecord[], opts: RecordRunsOptions): ScorecardLogLine[];
381
- /** Record runs and append them to the log in one call. Returns the lines. */
382
- export declare function recordRunsToScorecard(logPath: string, runs: RunRecord[], opts: RecordRunsOptions): ScorecardLogLine[];
383
- /**
384
- * Fold the JSONL log into a queryable `Scorecard`. A missing file yields an
385
- * empty scorecard; a malformed line is skipped — a corrupt append never
386
- * breaks the read. Each cell's timeline is sorted chronologically.
387
- */
388
- export declare function loadScorecard(logPath: string): Scorecard;
389
- type CellVerdict = 'improved' | 'regressed' | 'flat' | 'new';
390
- interface ScorecardCellDiff {
468
+ interface ScenarioCost {
391
469
  scenarioId: string;
392
- profileHash: string;
393
- model: string;
394
- verdict: CellVerdict;
395
- /** Composite of the latest entry. */
396
- current: number;
397
- /** Composite of the comparison entry — `null` when `verdict === 'new'`. */
398
- baseline: number | null;
399
- /** `current − baseline` — `null` when new. */
400
- delta: number | null;
401
- /** Cohen's d of current vs baseline samples — `null` when new or n < 2. */
402
- cohensD: number | null;
403
- /** Welch's t-test p-value — `null` when new or n < 2. */
404
- pValue: number | null;
405
- currentCommit: string;
406
- baselineCommit: string | null;
407
- }
408
- interface ScorecardDiff {
409
- cells: ScorecardCellDiff[];
410
- summary: {
411
- improved: number;
412
- regressed: number;
413
- flat: number;
414
- new: number;
415
- };
470
+ entries: CostEntry[];
471
+ totalInputTokens: number;
472
+ totalOutputTokens: number;
473
+ totalCachedTokens: number;
474
+ totalCostUsd: number;
475
+ /** Pass flag — set by consumer via markOutcome; used for cost-per-completed-task. */
476
+ completed?: boolean;
416
477
  }
417
- interface DiffScorecardOptions {
418
- /** Compare each cell against this commit instead of its immediate predecessor. */
419
- baselineCommit?: string;
420
- /** |Cohen's d| at/above which a move counts as real. Default 0.5. */
421
- minEffect?: number;
422
- /** p-value at/below which a move is significant. Default 0.05. */
423
- maxP?: number;
478
+ export declare class CostTracker {
479
+ private byScenario;
480
+ record(entry: Omit<CostEntry, 'timestamp'> & {
481
+ timestamp?: number;
482
+ }): CostEntry;
483
+ markOutcome(scenarioId: string, completed: boolean): void;
424
484
  /**
425
- * |delta| at/above which a move counts when statistics are unavailable
426
- * (a cell with fewer than 2 samples on either side). Default 0.05.
485
+ * Convenience: record + markOutcome in one call from a
486
+ * `{ usage, verdict }`-shaped response (starter-foundry's
487
+ * `invokeMetaJudge` returns this shape; consumers that wrap any
488
+ * judge/critic can follow the same convention).
489
+ *
490
+ * `usage.model` must be present in `MODEL_PRICING` for cost math to
491
+ * populate; otherwise totalCostUsd stays at 0 for the entry but
492
+ * tokens still aggregate.
427
493
  */
428
- minDelta?: number;
494
+ recordVerdict(verdict: {
495
+ usage?: {
496
+ inputTokens: number;
497
+ outputTokens: number;
498
+ model: string;
499
+ cachedTokens?: number;
500
+ reasoningTokens?: number;
501
+ };
502
+ verdict?: 'pass' | 'fail' | 'borderline' | string;
503
+ }, scenarioId: string, tags?: Record<string, string>): CostEntry | null;
504
+ get(scenarioId: string): ScenarioCost | undefined;
505
+ list(): ScenarioCost[];
506
+ summary(): CostSummary;
507
+ }
508
+ interface CostSummary {
509
+ scenarioCount: number;
510
+ completedCount: number;
511
+ totalInputTokens: number;
512
+ totalOutputTokens: number;
513
+ totalCostUsd: number;
514
+ avgCostPerScenarioUsd: number;
515
+ /** Total USD / completed scenarios — null when nothing completed. */
516
+ costPerCompletedTaskUsd: number | null;
429
517
  }
430
- /**
431
- * Compare the latest entry of every cell against its predecessor (or against
432
- * `baselineCommit`) and classify the move. A move is `improved`/`regressed`
433
- * only when it clears both the effect-size and significance gates; otherwise
434
- * `flat`. Cells with no prior entry are `new`.
435
- */
436
- export declare function diffScorecard(scorecard: Scorecard, opts?: DiffScorecardOptions): ScorecardDiff;
437
- /**
438
- * Render a scorecard diff as a human-readable report — the block a feature
439
- * PR prints. Regressions are listed first; flat cells are summarised, not
440
- * enumerated.
441
- */
442
- export declare function formatScorecardDiff(diff: ScorecardDiff): string;
443
518
  //#endregion
444
- //#region src/trace-contracts/types.d.ts
445
- /**
446
- * Minimal structural span the checker reads. The eval-side `Span`
447
- * (trace/schema) and the output of {@link contractSpansFromOtlp} satisfy it.
448
- */
449
- interface ContractSpan {
450
- spanId?: string;
451
- parentSpanId?: string | null;
452
- name?: string;
453
- /** Eval kinds (`tool`, `llm`, ...) or contract kinds (`TOOL`, `LLM`, ...). */
454
- kind?: string;
455
- startedAt?: number;
456
- endedAt?: number;
457
- status?: string;
458
- error?: string;
459
- /** Typed field on eval-side ToolSpans; OTLP flattenings drop it (see
460
- * {@link contractSpanToolName}). */
461
- toolName?: string;
462
- /** Typed field on eval-side LlmSpans. */
463
- model?: string;
464
- inputTokens?: number;
465
- outputTokens?: number;
466
- /** Typed field on eval-side ToolSpans. */
467
- args?: unknown;
468
- /** False when the source observed the call but did not capture its arguments. */
469
- argsCaptured?: boolean;
470
- attributes?: Record<string, unknown>;
519
+ //#region src/detectors/index.d.ts
520
+ type DetectorSeverity = 'info' | 'warn' | 'critical';
521
+ /** A normalized step a detector folds over. Fields are optional; each detector reads only what it
522
+ * needs (repeated-action → `actionFingerprint`; no-progress → `stateFingerprint` + `score`;
523
+ * error-streak → `status`). */
524
+ interface DetectorEvent {
525
+ /** Fingerprint of the action/tool-call this step took (caller pre-hashes). */
526
+ readonly actionFingerprint?: string;
527
+ /** Fingerprint of observable state AFTER this step. */
528
+ readonly stateFingerprint?: string;
529
+ /** Score after this step (the score-flat half of no-progress). */
530
+ readonly score?: number;
531
+ /** Whether this step errored. */
532
+ readonly status?: 'ok' | 'error';
533
+ /** Free-form label carried into the signal evidence (e.g. the tool name). */
534
+ readonly label?: string;
471
535
  }
472
- /**
473
- * The run a `run` rule reads. The eval-side `Run` satisfies it. When no run is
474
- * passed, the checker derives it from the trace's single root span; a trace
475
- * with no unique root leaves the run unknown and every `run` rule fails.
476
- */
477
- interface ContractRun {
478
- status?: string;
479
- startedAt?: number;
480
- endedAt?: number;
536
+ interface DetectorSignal {
537
+ readonly detector: string;
538
+ readonly severity: DetectorSeverity;
539
+ readonly failureClass?: FailureClass;
540
+ readonly reason: string;
541
+ /** Consecutive matching steps at the moment the signal fired. */
542
+ readonly streak: number;
543
+ readonly evidence?: Record<string, unknown>;
481
544
  }
482
- /** JSON-safe RegExp form — what the builder normalizes RegExp matchers to. */
483
- interface SerializedRegex {
484
- $regex: string;
485
- flags: string;
545
+ interface StreamingDetector {
546
+ readonly id: string;
547
+ /** Current streak (consecutive matching steps) — for telemetry/introspection between observes. */
548
+ readonly streak: number;
549
+ /** Fold one event; return a signal when the threshold trips, else null. */
550
+ observe(event: DetectorEvent): DetectorSignal | null;
551
+ /** Clear all state. */
552
+ reset(): void;
486
553
  }
487
- /** Matches when the value equals one of the listed strings. */
488
- interface OneOfMatcher {
489
- oneOf: string[];
554
+ interface RepeatedActionOptions {
555
+ /** Signal once the same action fingerprint repeats this many CONSECUTIVE steps (default 3).
556
+ * `<= 0` disables the signal (the streak is still tracked, for telemetry). */
557
+ readonly maxRepeated?: number;
558
+ readonly severity?: DetectorSeverity;
559
+ /** Failure class to stamp on the signal (default `tool_recovery_failure`). */
560
+ readonly failureClass?: FailureClass;
490
561
  }
491
- type TextMatcher = string | RegExp | SerializedRegex | OneOfMatcher;
562
+ /** Same action fingerprint N consecutive steps = a stuck loop (the #1 long-horizon failure mode). */
563
+ export declare function repeatedActionDetector(opts?: RepeatedActionOptions): StreamingDetector;
564
+ interface ErrorStreakOptions {
565
+ /** Signal once this many CONSECUTIVE steps errored (default 3). `<= 0` disables. */
566
+ readonly maxErrors?: number;
567
+ readonly severity?: DetectorSeverity;
568
+ readonly failureClass?: FailureClass;
569
+ }
570
+ /** N consecutive tool errors = the worker is hammering a broken approach. */
571
+ export declare function errorStreakDetector(opts?: ErrorStreakOptions): StreamingDetector;
572
+ /** Fold one event through many detectors at once; returns every signal that fired this step. The
573
+ * natural shape for an online pipe watching with a whole panel of detectors. */
574
+ export declare function observeAll(detectors: ReadonlyArray<StreamingDetector>, event: DetectorEvent): DetectorSignal[];
575
+ //#endregion
576
+ //#region src/error-count-extractor.d.ts
492
577
  /**
493
- * Proposition over one span. All specified fields must match (AND); `not`
494
- * must NOT match. At least one field is required — an empty predicate would
495
- * match every span and is rejected.
578
+ * Toolchain error-count extractor.
496
579
  *
497
- * `kind` compares against the span's contract kind (`TOOL`, `LLM`, `AGENT`,
498
- * ...), resolved by agent-trace-contract's classifier, so eval kinds
499
- * (`tool`, `llm`) and OTLP spans that declare no kind are read the same way.
580
+ * Given stderr/stdout from a compiler or test runner, count the number
581
+ * of reported errors/failures. Patterns are deliberately narrow —
582
+ * unknown stderr returns `null` rather than zero so callers can
583
+ * distinguish "no errors" from "different toolchain, couldn't parse".
500
584
  *
501
- * `tool` resolves through {@link contractSpanToolName}; `model` through the
502
- * typed `model` field and the gen_ai model attributes.
585
+ * All patterns are anchored to the start of a line and use bounded
586
+ * character classes to avoid catastrophic backtracking on pathological
587
+ * inputs.
503
588
  *
504
- * `attr` values match by strict equality, or regex-test when the value is a
505
- * RegExp/SerializedRegex and the attribute is a string. Structured attribute
506
- * values need `custom`, or an `argument` rule for tool arguments.
589
+ * Add new toolchains by appending to {@link ERROR_COUNT_PATTERNS};
590
+ * order matters only in the sense that the first matching pattern wins.
507
591
  */
508
- interface SpanPredicate {
509
- name?: TextMatcher;
510
- tool?: TextMatcher;
511
- model?: TextMatcher;
512
- kind?: SpanKind;
513
- attr?: Record<string, unknown>;
514
- not?: SpanPredicate;
515
- custom?: (span: ContractSpan) => boolean;
516
- /** Stamped by the builder when `custom` is present. Survives JSON while
517
- * the function does not, so evaluation of a deserialized contract throws
518
- * instead of silently dropping the check. */
519
- requiresCustom?: true;
592
+ interface ErrorCountPattern {
593
+ /** Stable identifier for logging + tests. */
594
+ name: string;
595
+ /** Must be global (`g` flag) — the extractor counts matches. */
596
+ regex: RegExp;
597
+ /** Optional post-processing to extract a count from a single captured match. */
598
+ transform?: (match: RegExpMatchArray) => number;
520
599
  }
521
- declare const ORDER_MODES: readonly ['start-order', 'finish-before-start', 'all-occurrences'];
522
- type OrderMode = (typeof ORDER_MODES)[number];
523
- declare const ARGUMENT_OCCURRENCES: readonly ['first', 'last', 'any', 'all'];
524
- type ArgumentOccurrence = (typeof ARGUMENT_OCCURRENCES)[number];
525
- declare const ARGUMENT_TYPES: readonly ['string', 'number', 'boolean', 'object', 'array', 'null'];
526
- type ArgumentType = (typeof ARGUMENT_TYPES)[number];
527
- type ArgumentCheck = {
528
- op: 'exists';
529
- } | {
530
- op: 'equals';
531
- value: unknown;
532
- } | {
533
- op: 'oneOf';
534
- values: unknown[];
535
- } | {
536
- op: 'type';
537
- type: ArgumentType;
538
- };
539
- /** A tool whose calls change state outside the run. */
540
- interface RetryWrite {
541
- tool: string;
542
- /** RFC 6901 JSON Pointer to the idempotency key in the call's arguments.
543
- * Without it, a repeated call of this tool always fails. */
544
- idempotencyKey?: string;
600
+ export declare const ERROR_COUNT_PATTERNS: ErrorCountPattern[];
601
+ interface ExtractOptions {
602
+ /** Restrict to named patterns — default: all patterns. */
603
+ only?: string[];
604
+ /** Additional patterns to consider BEFORE the built-in list. */
605
+ extra?: ErrorCountPattern[];
545
606
  }
546
- interface RunChecks {
547
- /** The run's status is `completed` and its end time is recorded. A failed
548
- * or aborted run fails this check. */
549
- requireCompleted?: boolean;
550
- /** The run's status must be one of these. */
551
- allowedStatuses?: RunStatus[];
552
- /** End minus start, in milliseconds. An unknown duration fails. */
553
- maxDurationMs?: number;
607
+ interface ExtractResult {
608
+ /** Total count of matched errors, or null when no pattern matched. */
609
+ count: number | null;
610
+ /** Name of the pattern that matched, or null. */
611
+ matched: string | null;
612
+ /** Original matches for callers that want to surface specifics. */
613
+ samples: string[];
554
614
  }
555
- type ContractRule = {
556
- kind: 'always' | 'never' | 'eventually';
557
- label: string;
558
- p: SpanPredicate;
559
- } | {
560
- kind: 'precedes';
561
- label: string;
562
- a: SpanPredicate;
563
- b: SpanPredicate;
564
- order?: OrderMode;
565
- } | {
566
- kind: 'neverUnless';
567
- label: string;
568
- p: SpanPredicate;
569
- prior: SpanPredicate;
570
- order?: OrderMode;
571
- } | {
572
- kind: 'atMost';
573
- label: string;
574
- p: SpanPredicate;
575
- max: number;
576
- } | {
577
- kind: 'tokensAtMost';
578
- label: string;
579
- p: SpanPredicate;
580
- max: number;
581
- } | ({
582
- kind: 'run';
583
- label: string;
584
- } & RunChecks) | {
585
- kind: 'argument';
586
- label: string;
587
- p: SpanPredicate;
588
- /** RFC 6901 JSON Pointer into the call's arguments; `''` is the whole value. */
589
- pointer: string;
590
- check: ArgumentCheck;
591
- /** Which matching calls must satisfy the check. Default `all`. */
592
- occurrence?: ArgumentOccurrence;
593
- } | {
594
- /**
595
- * The tools the harness offered the model (the OTel GenAI
596
- * `gen_ai.tool.definitions` attribute) are recorded, every tool call is
597
- * one of them, and, when `declared` is set, every offered tool is
598
- * declared. A trace that records no offered tools fails: what the
599
- * harness enforced is unknown.
600
- */
601
- kind: 'toolsOffered';
602
- label: string;
603
- declared?: string[];
604
- } | {
605
- /**
606
- * A tool called again with the same arguments repeats its side effect.
607
- * A repeated `reads` call passes; a repeated `writes` call passes only
608
- * when every call carries the same idempotency key; a repeated call of
609
- * any other tool fails, because its side effect is unknown.
610
- */
611
- kind: 'retrySafe';
612
- label: string;
613
- reads?: string[];
614
- writes?: RetryWrite[];
615
- };
616
- /** One legitimate alternate path. The contract passes only when the base
617
- * rules pass and at least one alternative passes completely. */
618
- interface ContractAlternative {
615
+ /**
616
+ * Try each pattern in order; return the first with matches.
617
+ *
618
+ * Returning `null` (instead of zero) on no-match is deliberate — a
619
+ * callsite that greps for "typescript errors" on cargo output should
620
+ * NOT treat that as "zero TS errors" because the toolchain is wrong.
621
+ */
622
+ export declare function extractErrorCount(text: string, opts?: ExtractOptions): ExtractResult;
623
+ //#endregion
624
+ //#region src/knowledge/types.d.ts
625
+ type KnowledgeRequirementCategory = 'user_specific' | 'company_specific' | 'domain_specific' | 'codebase_specific' | 'market_specific' | 'regulatory' | 'tool_api' | 'credential_or_secret' | 'runtime_environment' | 'preference' | 'historical_context';
626
+ type KnowledgeAcquisitionMode = 'ask_user' | 'search_web' | 'query_connector' | 'inspect_repo' | 'run_command' | 'infer_low_confidence' | 'not_available';
627
+ type KnowledgeImportance = 'blocking' | 'high' | 'medium' | 'low';
628
+ type KnowledgeFreshness = 'static' | 'monthly' | 'weekly' | 'daily' | 'realtime';
629
+ type KnowledgeSensitivity = 'public' | 'private' | 'secret';
630
+ type KnowledgeFallbackPolicy = 'block' | 'ask' | 'continue_with_caveat' | 'use_default';
631
+ interface KnowledgeRequirement {
619
632
  id: string;
620
- rules: ContractRule[];
621
- }
622
- /** Serializable plain object — `traceContract(name)....build()` output. */
623
- interface TraceContract {
624
- name: string;
625
- /** What the contract protects, for reports and `explainTraceContract`. */
626
- description?: string;
627
- /** Evaluate only the span matching `root` and its descendants. Exactly one
628
- * span must match; zero or several make every rule an error. */
629
- scope?: {
630
- root: SpanPredicate;
631
- };
632
- rules: ContractRule[];
633
- alternatives?: ContractAlternative[];
634
- }
635
- type ContractStatus = 'pass' | 'fail' | 'error';
636
- interface ContractViolation {
637
- rule: string;
638
- spanId?: string;
639
- detail: string;
633
+ description: string;
634
+ requiredFor: string[];
635
+ category: KnowledgeRequirementCategory;
636
+ acquisitionMode: KnowledgeAcquisitionMode;
637
+ importance: KnowledgeImportance;
638
+ freshness: KnowledgeFreshness;
639
+ sensitivity: KnowledgeSensitivity;
640
+ confidenceNeeded: number;
641
+ currentConfidence: number;
642
+ evidenceIds: string[];
643
+ fallbackPolicy: KnowledgeFallbackPolicy;
644
+ /**
645
+ * ISO timestamp after which this requirement must be treated as stale.
646
+ * Stale requirements score as missing even when they still have evidence.
647
+ */
648
+ validUntil?: string;
649
+ /** ISO timestamp for the last source-grounding or human verification pass. */
650
+ lastVerifiedAt?: string;
651
+ metadata?: Record<string, unknown>;
640
652
  }
641
- /** What happened to one rule. `error` means it could not be evaluated. */
642
- interface ContractRuleExecution {
643
- rule: string;
644
- /** Set for rules inside `alternatives`. */
645
- alternative?: string;
646
- status: ContractStatus;
647
- violations: number;
648
- error?: string;
653
+ interface KnowledgeBundle {
654
+ taskId: string;
655
+ requirements: KnowledgeRequirement[];
656
+ evidenceIds: string[];
657
+ claimIds: string[];
658
+ wikiPageIds: string[];
659
+ userAnswers: Record<string, string>;
660
+ missing: KnowledgeRequirement[];
661
+ readinessScore: number;
662
+ metadata?: Record<string, unknown>;
649
663
  }
650
- interface ContractVerdict extends DefaultVerdict {
651
- /** Contract name — keys this verdict in multi-contract reports. */
652
- contract: string;
653
- status: ContractStatus;
654
- /** `status === 'pass'`. */
655
- valid: boolean;
656
- /** Fraction of rules that passed, in [0, 1]. An errored rule is not a pass. */
657
- score: number;
658
- /** 0|1 per evaluated base rule, keyed by label, plus `anyOf` when the
659
- * contract has alternatives. Errored rules are absent, never 0. */
660
- scores: Record<string, number>;
661
- violations: ContractViolation[];
662
- ruleExecutions: ContractRuleExecution[];
663
- /** Why rules errored, one line per errored rule or scope failure. */
664
- errors: string[];
664
+ type KnowledgeRecommendedAction = 'run_agent' | 'ask_user' | 'collect_web_data' | 'query_connectors' | 'inspect_repo' | 'build_domain_wiki' | 'continue_with_caveat' | 'abort_or_rescope';
665
+ interface KnowledgeReadinessReport {
666
+ taskId: string;
667
+ readinessScore: number;
668
+ blockingMissingRequirements: KnowledgeRequirement[];
669
+ nonBlockingGaps: KnowledgeRequirement[];
670
+ recommendedAction: KnowledgeRecommendedAction;
671
+ bundle: KnowledgeBundle;
672
+ severity: ControlSeverity;
673
+ reason: string;
665
674
  }
666
- interface ContractCheckResult {
667
- verdicts: ContractVerdict[];
668
- /** `error` if any verdict errored, else `fail` if any failed, else `pass`. */
669
- status: ContractStatus;
670
- allValid: boolean;
675
+ interface UserQuestion {
676
+ id: string;
677
+ question: string;
678
+ reason: string;
679
+ requirementId: string;
680
+ importance: KnowledgeImportance;
681
+ answerType: 'free_text' | 'select_one' | 'multi_select' | 'file_upload' | 'credential' | 'url';
682
+ defaultIfSkipped?: string;
683
+ impactIfUnknown: string;
684
+ options?: string[];
685
+ metadata?: Record<string, unknown>;
671
686
  }
672
- interface EvaluateTraceContractOptions {
673
- /** The run `run` rules read. Ignored under `scope`, where the scope root is the run. */
674
- run?: ContractRun;
687
+ interface DataAcquisitionPlan {
688
+ id: string;
689
+ requirementIds: string[];
690
+ mode: Exclude<KnowledgeAcquisitionMode, 'not_available' | 'infer_low_confidence'> | 'build_domain_wiki';
691
+ description: string;
692
+ priority: KnowledgeImportance;
693
+ expectedEvidenceIds?: string[];
694
+ questions?: UserQuestion[];
695
+ metadata?: Record<string, unknown>;
675
696
  }
676
697
  //#endregion
677
- //#region src/trace-contracts/builder.d.ts
678
- interface OrderOptions {
679
- order?: OrderMode;
680
- }
681
- interface ArgumentRuleOptions {
682
- pointer: string;
683
- check: ArgumentCheck;
684
- occurrence?: ArgumentOccurrence;
698
+ //#region src/leaderboard.d.ts
699
+ interface LeaderboardRow {
700
+ /** Group key — the agent-profile cellId by default, else a caller dimension. */
701
+ key: string;
702
+ /** Display label: `harness · model` when the profile carries them, else the key. */
703
+ label: string;
704
+ harness?: string;
705
+ model?: string;
706
+ rank: number;
707
+ /** Measured runs in this group. */
708
+ n: number;
709
+ passRate: number;
710
+ passRateCi95: [number, number];
711
+ /** Observability rollup — means over the group; null when no run reported it. */
712
+ meanCostUsd: number | null;
713
+ meanTokensIn: number | null;
714
+ meanTokensOut: number | null;
715
+ meanWallMs: number | null;
685
716
  }
686
- declare class TraceContractBuilder {
687
- private readonly name;
688
- private readonly rules;
689
- private readonly alternativeList;
690
- private scopeRoot;
691
- constructor(name: string);
692
- /** Every span in the trace must satisfy `p`. */
693
- always(p: SpanPredicate, label?: string): this;
694
- /** No span in the trace may satisfy `p`. */
695
- never(p: SpanPredicate, label?: string): this;
696
- /** At least one span in the trace must satisfy `p`. */
697
- eventually(p: SpanPredicate, label?: string): this;
698
- /** Both `a` and `b` must occur, with `a` first under `options.order`
699
- * (default `start-order`). For "every `b` needs an earlier `a`, and a run
700
- * without `b` passes", use {@link neverUnless}. */
701
- precedes(a: SpanPredicate, b: SpanPredicate, label?: string, options?: OrderOptions): this;
702
- /** Every `p`-match needs an earlier `prior`-match; a run without `p` passes. */
703
- neverUnless(p: SpanPredicate, prior: SpanPredicate, label?: string, options?: OrderOptions): this;
704
- /** At most `max` spans may satisfy `p`. */
705
- atMost(p: SpanPredicate, max: number, label?: string): this;
706
- /** Spans satisfying `p` may use at most `max` input+output tokens in total. */
707
- tokensAtMost(p: SpanPredicate, max: number, label?: string): this;
708
- /** Terminal status and duration of the run. */
709
- run(checks: RunChecks, label?: string): this;
710
- /** A JSON Pointer check on the arguments of calls matching `p`. */
711
- argument(p: SpanPredicate, options: ArgumentRuleOptions, label?: string): this;
712
- /** The trace records the tools offered to the model, every call is one of
713
- * them, and, with `declared`, every offered tool is declared. */
714
- toolsOffered(declared?: string[], label?: string): this;
715
- /** No call repeats a side effect that is not proven safe to repeat. */
716
- retrySafe(options: {
717
- reads?: string[];
718
- writes?: RetryWrite[];
719
- }, label?: string): this;
720
- /** Evaluate only the subtree rooted at the one span matching `root`. */
721
- scope(root: SpanPredicate): this;
722
- /** A named alternate path; at least one alternative must pass completely. */
723
- alternative(id: string, define: (branch: TraceContractBuilder) => TraceContractBuilder): this;
724
- build(): TraceContract;
725
- private where;
726
- private add;
717
+ interface LeaderboardOptions {
718
+ /** Per-run pass predicate — the benchmark defines what "passed" means (real-build
719
+ * hit-rate, test-pass, etc.). The leaderboard owns only the grouping + stats. */
720
+ passed: (record: RunRecord) => boolean;
721
+ /** Group key. Default: the agent-profile cellId (harness × model × dimensions),
722
+ * so persona/harness/model sweeps separate without parsing labels. */
723
+ groupBy?: (record: RunRecord) => string;
727
724
  }
728
- export declare function traceContract(name: string): TraceContractBuilder;
729
- //#endregion
730
- //#region src/trace-contracts/evaluate.d.ts
731
- /**
732
- * Evaluate one contract over a span sequence. Pure and synchronous — works on
733
- * `Span[]` from a TraceStore, `contractSpansFromOtlp` output, or any array
734
- * satisfying `ContractSpan`. Throws
735
- * `ValidationError` for a malformed contract; a rule that cannot be evaluated
736
- * is reported as `error` in the verdict instead.
737
- */
738
- export declare function evaluateTraceContract(contract: TraceContract, spans: readonly ContractSpan[], options?: EvaluateTraceContractOptions): ContractVerdict;
739
725
  /**
740
- * Evaluate many contracts over one span sequence. Throws on an empty
741
- * contract list — `allValid: true` over zero contracts is a silent pass.
726
+ * Group `records`, compute pass-rate + Wilson CI + cost/token/latency means per
727
+ * group, and rank by pass-rate (cost as the tiebreaker — cheaper wins a tie).
728
+ * Pure projection: no I/O, deterministic, safe to call on any RunRecord[].
742
729
  */
743
- export declare function checkTraceContracts(spans: readonly ContractSpan[], contracts: readonly TraceContract[], options?: EvaluateTraceContractOptions): ContractCheckResult;
744
- //#endregion
745
- //#region src/trace-contracts/explain.d.ts
746
- /** Plain-language statement of everything a contract checks, one rule per line. */
747
- export declare function explainTraceContract(contract: TraceContract): string;
730
+ export declare function leaderboard(records: RunRecord[], opts: LeaderboardOptions): LeaderboardRow[];
748
731
  //#endregion
749
- //#region src/trace-contracts/spec.d.ts
750
- interface ToolArgumentSpec {
751
- tool: string;
752
- /** RFC 6901 JSON Pointer into the call's arguments; `''` is the whole value. */
753
- pointer: string;
754
- /** Which calls must satisfy the check. Default `all`. */
755
- occurrence?: ArgumentOccurrence;
756
- /** Exactly one of `exists`, `equals`, `oneOf`, `type`. */
757
- exists?: true;
758
- equals?: unknown;
759
- oneOf?: unknown[];
760
- type?: ArgumentType;
732
+ //#region src/paired-delta-test.d.ts
733
+ interface PairedDeltaTestOptions extends PairedBootstrapOptions {
734
+ /** Smallest candidate-minus-baseline delta that counts as improvement. Default 0. */
735
+ threshold?: number;
736
+ /** Caller-required paired observations. The exact test may impose a higher minimum. */
737
+ minPairs?: number;
761
738
  }
762
- interface ToolsSpec {
763
- /** Each must be called at least once. */
764
- required?: string[];
765
- /** None may be called. */
766
- forbidden?: string[];
767
- /** Every tool call must name one of these; a call without a name fails. */
768
- allowed?: string[];
769
- /** Ceiling on tool calls of any name. */
770
- maxCalls?: number;
771
- /** Ceiling per tool name. */
772
- maxCallsPerTool?: Record<string, number>;
773
- /** Each tool is called, and each comes before the next under `orderMode`. */
774
- requiredOrder?: string[];
775
- /** Default `start-order`. */
776
- orderMode?: OrderMode;
777
- arguments?: ToolArgumentSpec[];
778
- /** The trace records the tools the harness offered the model
779
- * (`gen_ai.tool.definitions`), every call is one of them, and, with
780
- * `allowed`, every offered tool is allowed. */
781
- enforced?: true;
739
+ interface PairedDeltaTestResult {
740
+ bootstrap: PairedBootstrapResult;
741
+ method: 'bootstrap-ci' | 'exact-sign';
742
+ /** Exact one-sided p-value below the bootstrap minimum; otherwise null. */
743
+ pValue: number | null;
744
+ /** Effective observation minimum after accounting for confidence. */
745
+ minimumPairs: number;
746
+ sufficient: boolean;
747
+ /**
748
+ * The bootstrap interval has zero width (or is non-finite), so it carries no
749
+ * information about how far the estimate could be wrong and cannot support a
750
+ * decision in either direction. See {@link pairedDeltaTest}.
751
+ */
752
+ indeterminate: boolean;
753
+ significant: boolean;
782
754
  }
783
- interface RetriesSpec {
784
- /** Tools that change nothing outside the run: repeating a call is safe. */
785
- reads?: string[];
786
- /** Tools that change state outside the run: a repeated call must carry one
787
- * idempotency key. Any other tool called twice with the same arguments fails. */
788
- writes?: RetryWrite[];
755
+ /** Smallest all-positive sample that can clear a one-sided exact sign test. */
756
+ export declare function minimumPairsForPairedDeltaTest(confidence?: number): number;
757
+ /**
758
+ * Tests whether a paired candidate-minus-baseline delta clears a threshold.
759
+ *
760
+ * At 20 or more pairs, the percentile bootstrap lower bound carries the
761
+ * decision. Below that point the interval is descriptive only, so the function
762
+ * switches to a pre-registered one-sided exact sign test. The exact path is
763
+ * deliberately conservative: it requires both a point estimate above the
764
+ * threshold and enough consistently positive paired differences.
765
+ *
766
+ * ## A zero-width interval is never significant
767
+ *
768
+ * When every paired delta is identical the resample distribution is a point
769
+ * mass and the interval collapses: `[0, 0]` when all pairs tie, `[g, g]` on n
770
+ * identical deltas of g. Neither says the effect is certain — both say the
771
+ * sample carries no information about how far the estimate could be wrong, and
772
+ * `low > threshold` then answers on the point estimate alone. It fails in both
773
+ * directions: `[0, 0]` clears every NEGATIVE threshold, which is how a
774
+ * tie-dominated pass/fail comparison laundered a regression into a
775
+ * noninferiority pass, and `[g, g]` clears every threshold below g with no
776
+ * spread behind it. Under a bounded asymmetric null whose true mean paired
777
+ * delta is exactly 0 — 2 % of pairs dropping by 1.0, the rest gaining 0.0204 —
778
+ * every sample that misses the drop is exactly that shape, and deciding on
779
+ * `low > 0` promoted 65.65 % of samples at n = 20 against a nominal 5 %.
780
+ *
781
+ * So `indeterminate` is reported and `significant` is false whenever the
782
+ * interval has zero width, on BOTH paths: at small n the exact sign test is a
783
+ * test of the MEDIAN and a zero-spread sample is precisely where it stops
784
+ * saying anything about the mean the caller is thresholding.
785
+ *
786
+ * `threshold` may be negative — that is a noninferiority margin, and it is the
787
+ * regime the zero-width hole is worst in. For a two-point (pass/fail) outcome
788
+ * the percentile bootstrap is not a valid interval at a nonzero margin at all;
789
+ * use {@link decidePairedPromotion}, which routes those to Tango's score
790
+ * interval, rather than thresholding this function's bootstrap directly.
791
+ */
792
+ export declare function pairedDeltaTest(before: number[], after: number[], options?: PairedDeltaTestOptions): PairedDeltaTestResult;
793
+ //#endregion
794
+ //#region src/partition-held-out.d.ts
795
+ interface PartitionHeldOutOptions {
796
+ /** Partition seed. Bumping it reshuffles every assignment — do that only when
797
+ * the corpus/policy changes meaningfully so old and new records can't pair.
798
+ * Default 'held-out-v1'. */
799
+ seed?: string;
800
+ /** Fraction routed to the held-out bucket, in (0, 1). Default 0.5. */
801
+ holdoutFraction?: number;
802
+ /**
803
+ * Minimum held-out ids required for the split to be admissible. Below this,
804
+ * a paired comparison has too few observations to be significant, so the
805
+ * partition throws rather than hand back an underpowered holdout. Default 1
806
+ * (only the empty-holdout degenerate case is rejected). Raise it to enforce
807
+ * real statistical power. */
808
+ minHoldout?: number;
809
+ /** Same floor for the search side. Default 1. */
810
+ minSearch?: number;
789
811
  }
790
- interface LlmSpec {
791
- maxCalls?: number;
792
- /** Input plus output tokens across LLM calls; an unrecorded count fails. */
793
- maxTotalTokens?: number;
794
- /** Every LLM call must name one of these models; a call without one fails. */
795
- allowedModels?: string[];
812
+ interface HeldOutPartition {
813
+ /** Ids the optimizer is allowed to read/optimize against. */
814
+ search: string[];
815
+ /** Ids reserved for gated, held-out evaluation. */
816
+ holdout: string[];
817
+ seed: string;
818
+ holdoutFraction: number;
796
819
  }
797
- /** The checks one path carries: the base contract or one alternative. */
798
- interface PathSpec {
799
- run?: RunChecks;
800
- tools?: ToolsSpec;
801
- llm?: LlmSpec;
802
- retries?: RetriesSpec;
803
- /** Low-level rules in their serialized form. */
804
- rules?: ContractRule[];
820
+ /**
821
+ * Partition a list of stable ids into disjoint `search` / `holdout` sets by a
822
+ * deterministic hash. Fail-loud:
823
+ * - empty input throws,
824
+ * - duplicate ids throw (a dup would be observed on both sides, double-counting),
825
+ * - a holdout (or search) set below its floor throws (underpowered comparison).
826
+ *
827
+ * Order within each bucket follows the input order, so the result is stable and
828
+ * reproducible.
829
+ */
830
+ export declare function partitionHeldOut(ids: string[], options?: PartitionHeldOutOptions): HeldOutPartition;
831
+ interface TrainSelectionTestOptions<T> {
832
+ /** Partition seed. Bumping it reshuffles every unit. Default 'train-selection-test-v1'. */
833
+ seed?: string;
834
+ /** Share of units routed to selection, in (0, 1). Default 0.25. */
835
+ selectionFraction?: number;
836
+ /** Share of units routed to test, in (0, 1). Default 0.25. */
837
+ testFraction?: number;
838
+ /**
839
+ * The independent unit an item samples, such as the task a fresh run repeats.
840
+ * Every item of one unit lands in the same partition, so a final test never
841
+ * scores a unit the optimizer read. Default: the item id.
842
+ */
843
+ unitOf?: (item: T) => string;
844
+ /** Minimum items per partition. Defaults 1, 1 and 1. */
845
+ minTrain?: number;
846
+ minSelection?: number;
847
+ minTest?: number;
805
848
  }
806
- interface AlternativeSpec extends PathSpec {
849
+ interface TrainSelectionTestPartition<T> {
850
+ /** Items an optimizer may learn from. */
851
+ train: T[];
852
+ /** Items an optimizer may use to accept candidates and stop. */
853
+ selection: T[];
854
+ /** Items reserved for the final comparison. */
855
+ test: T[];
856
+ seed: string;
857
+ selectionFraction: number;
858
+ testFraction: number;
859
+ }
860
+ /**
861
+ * Partition items into disjoint train, selection and test sets, the three
862
+ * partitions `compareOptimizationMethods` and Runtime `improve()` take.
863
+ *
864
+ * Assignment is per unit: `hashToUnit(unit, seed)` below `testFraction` is
865
+ * test, below `testFraction + selectionFraction` is selection, and the rest is
866
+ * train. A unit therefore keeps its partition as the corpus grows, and items of
867
+ * one unit never straddle two partitions. Fail-loud like `partitionHeldOut`:
868
+ * empty input, a duplicate or empty id, an empty unit, fractions outside
869
+ * (0, 1) or summing to 1 or more, and a partition below its floor all throw.
870
+ * Order within each partition follows the input order.
871
+ */
872
+ export declare function partitionTrainSelectionTest<T extends {
807
873
  id: string;
874
+ }>(items: readonly T[], options?: TrainSelectionTestOptions<T>): TrainSelectionTestPartition<T>;
875
+ //#endregion
876
+ //#region src/product-benchmark/export.d.ts
877
+ interface ProductBenchmarkExportOptions {
878
+ /** Source eval run directories, each containing a `records.jsonl` of RunRecord rows. */
879
+ readonly runDirs: readonly string[];
880
+ /** Destination directory for the bundle (manifest + records + materialized source runs). */
881
+ readonly outDir: string;
882
+ readonly projectId: string;
883
+ readonly benchmarkId: string;
884
+ /** Repo-relative path of the product's canonical agent profile source. */
885
+ readonly agentProfilePath: string;
886
+ /** Pass threshold applied when a row carries no explicit `outcome.raw.pass`. Default 0.7. */
887
+ readonly passThreshold?: number;
888
+ /**
889
+ * First scenario tag. Defaults to `projectId` with a trailing `-agent`
890
+ * stripped (`tax-agent` → `tax`), matching the product exporters.
891
+ */
892
+ readonly scenarioTagPrefix?: string;
893
+ /** Profile id used when a row has no `agentProfile.profileId`. Defaults to the row's arm id. */
894
+ readonly fallbackProfileId?: string;
895
+ /** Arm mutable surfaces recorded in the manifest. Defaults to the full superset. */
896
+ readonly mutableSurfaces?: readonly string[];
897
+ /**
898
+ * Copy each run dir into `<outDir>/source-runs/` and record
899
+ * bundle-relative artifact paths (portable, self-contained). When false,
900
+ * artifacts keep absolute paths into the original run dirs. Default true.
901
+ */
902
+ readonly materializeSourceRuns?: boolean;
903
+ /**
904
+ * Override split classification for a row. Return undefined to fall back
905
+ * to the default (`outcome.raw.safety === 1` → safety, then splitTag).
906
+ */
907
+ readonly classifySplit?: (record: RunRecord) => ProductBenchmarkSplit | undefined;
908
+ /** Recovers a tool-call count when the row's raw bag carries none (e.g. from turn artifacts). */
909
+ readonly toolCallFallback?: (record: RunRecord, runDir: string) => number;
910
+ /** Backend version recorded per row. Defaults to the cwd package.json's `@tangle-network/sandbox` range. */
911
+ readonly backendVersion?: string;
912
+ /**
913
+ * Explicit substrate versions for the manifest, merged over what the cwd
914
+ * package.json / node_modules resolve. Use when a substrate package is not
915
+ * installed where the export runs — the validator refuses an `'unknown'`
916
+ * version, so provide the real one rather than shipping the sentinel.
917
+ */
918
+ readonly substrate?: Partial<ProductBenchmarkManifest['substrate']>;
808
919
  }
809
- interface TraceContractSpec extends PathSpec {
810
- name: string;
811
- description?: string;
812
- /** Check only the one span matching `root` and its descendants: one
813
- * sub-agent (`{ "kind": "AGENT", "name": "researcher" }`) or one search
814
- * node (`{ "attr": { "agent.branch.id": "n7" } }`). */
815
- scope?: {
816
- root: SpanPredicate;
817
- };
818
- /** At least one alternative must pass completely, as well as the base checks. */
819
- alternatives?: {
820
- anyOf: AlternativeSpec[];
821
- };
920
+ interface ProductBenchmarkSingleRunExportOptions extends Omit<ProductBenchmarkExportOptions, 'runDirs'> {
921
+ readonly runDir: string;
822
922
  }
923
+ interface ProductBenchmarkExportResult {
924
+ readonly manifestPath: string;
925
+ readonly recordsPath: string;
926
+ readonly records: number;
927
+ }
928
+ /** Repo identity from the exporting process's cwd. `'unknown'` values are flagged by `validateProductBenchmarkRun`. */
929
+ export declare function productBenchmarkRepoIdentity(): ProductBenchmarkManifest['repo'];
930
+ /** Single-run convenience wrapper over `exportProductBenchmarkRuns`. */
931
+ export declare function exportProductBenchmark(options: ProductBenchmarkSingleRunExportOptions): ProductBenchmarkExportResult;
823
932
  /**
824
- * Parse and compile a declarative contract. Throws `ValidationError` naming
825
- * the path of the first problem: an unknown key, a wrong type, an unknown
826
- * status, or a contract that checks nothing.
933
+ * Export one or more product eval run dirs into a validated product
934
+ * benchmark bundle at `outDir`. Both the manifest and every record are
935
+ * run through the contract validators before anything is written.
827
936
  */
828
- export declare function compileTraceContractSpec(input: unknown): TraceContract;
829
- interface ContractLintFinding {
830
- /** `error`: the contract can never pass, or contradicts itself.
831
- * `warning`: the contract works but likely does not say what was meant. */
832
- level: 'error' | 'warning';
833
- code: string;
834
- path: string;
835
- message: string;
937
+ export declare function exportProductBenchmarkRuns(options: ProductBenchmarkExportOptions): ProductBenchmarkExportResult;
938
+ //#endregion
939
+ //#region src/product-benchmark/index.d.ts
940
+ declare const productBenchmarkSplits: readonly ['practice', 'dev', 'holdout', 'safety', 'sentinel'];
941
+ type ProductBenchmarkSplit = (typeof productBenchmarkSplits)[number];
942
+ interface ProductBenchmarkRepoRef {
943
+ readonly url: string;
944
+ readonly commit: string;
945
+ readonly branch: string;
946
+ }
947
+ interface ProductBenchmarkSubstrateVersions {
948
+ readonly agentEval: string;
949
+ readonly agentRuntime: string;
950
+ readonly agentInterface: string;
951
+ readonly sandbox: string;
952
+ readonly agentBench?: string;
953
+ }
954
+ interface ProductBenchmarkProfileRef {
955
+ readonly id: string;
956
+ readonly profileHash: string;
957
+ readonly agentProfilePath: string;
958
+ }
959
+ interface ProductBenchmarkArm {
960
+ readonly id: string;
961
+ readonly profileId: string;
962
+ readonly mutableSurfaces: readonly string[];
963
+ readonly policyAxes: Record<string, unknown>;
964
+ }
965
+ interface ProductBenchmarkScenario {
966
+ readonly id: string;
967
+ readonly split: ProductBenchmarkSplit;
968
+ readonly tags: readonly string[];
969
+ readonly sourceAllowedForSynthesis: boolean;
970
+ }
971
+ interface ProductBenchmarkBudgets {
972
+ readonly maxUsd: number;
973
+ readonly maxCells: number;
974
+ readonly maxWallMs: number;
975
+ }
976
+ interface ProductBenchmarkManifest {
977
+ readonly schemaVersion: 1;
978
+ readonly projectId: string;
979
+ readonly benchmarkId: string;
980
+ readonly repo: ProductBenchmarkRepoRef;
981
+ readonly substrate: ProductBenchmarkSubstrateVersions;
982
+ readonly profiles: readonly ProductBenchmarkProfileRef[];
983
+ readonly arms: readonly ProductBenchmarkArm[];
984
+ readonly scenarios: readonly ProductBenchmarkScenario[];
985
+ readonly budgets: ProductBenchmarkBudgets;
986
+ readonly expectedArtifactDir: string;
836
987
  }
988
+ interface ProductBenchmarkValidationReport {
989
+ readonly manifestPath: string;
990
+ readonly recordsPath: string;
991
+ readonly records: number;
992
+ /** Manifest repo fields that are empty or the `'unknown'` export sentinel. */
993
+ readonly repoFailures: readonly string[];
994
+ /** Manifest substrate versions that are empty or the `'unknown'` export
995
+ * sentinel — a bundle without substrate identity is not reproducible. */
996
+ readonly substrateFailures: readonly string[];
997
+ readonly projects: readonly string[];
998
+ readonly benchmarks: readonly string[];
999
+ readonly arms: readonly string[];
1000
+ readonly scenarios: readonly string[];
1001
+ readonly passed: number;
1002
+ readonly failed: number;
1003
+ readonly inputTokens: number;
1004
+ readonly outputTokens: number;
1005
+ readonly costUsd: number;
1006
+ readonly wallMs: number;
1007
+ readonly integrityFailures: readonly string[];
1008
+ readonly missingArtifacts: readonly string[];
1009
+ }
1010
+ export declare function readProductBenchmarkManifest(path: string): ProductBenchmarkManifest;
837
1011
  /**
838
- * Find contradictions and likely mistakes in a declarative contract. Parses
839
- * strictly first, so a malformed spec throws instead of linting.
1012
+ * Fail-loud gate over a bundle directory: locates the manifest + records,
1013
+ * runs `validateProductBenchmarkRun`, and throws with every repo,
1014
+ * integrity, and artifact failure listed. Returns the report when clean.
840
1015
  */
841
- export declare function lintTraceContractSpec(input: unknown): ContractLintFinding[];
1016
+ export declare function assertProductBenchmarkRun(runDir: string): ProductBenchmarkValidationReport;
1017
+ //#endregion
1018
+ //#region src/runtime-trajectory.d.ts
1019
+ interface RuntimeTrajectoryHookEvent {
1020
+ id: string;
1021
+ runId: string;
1022
+ scenarioId?: string;
1023
+ target: string;
1024
+ phase: string;
1025
+ timestamp: number;
1026
+ stepIndex?: number;
1027
+ parentId?: string;
1028
+ payload?: unknown;
1029
+ metadata?: Record<string, unknown>;
1030
+ }
1031
+ interface RuntimeTrajectoryRecord {
1032
+ id?: string;
1033
+ scenarioId?: string;
1034
+ splitTag?: RunSplitTag;
1035
+ runtimeEvents?: unknown;
1036
+ [key: string]: unknown;
1037
+ }
1038
+ interface RuntimeTrajectoryRunRecord {
1039
+ runId: string;
1040
+ scenarioId?: string;
1041
+ splitTag: RunSplitTag;
1042
+ }
1043
+ interface RuntimeTrajectoryEvidenceSummary {
1044
+ recordCount: number;
1045
+ recordWithRuntimeEventsCount: number;
1046
+ runtimeRunCount: number;
1047
+ lifecycleEventCount: number;
1048
+ defaultedSplitCount: number;
1049
+ }
1050
+ interface RuntimeTrajectoryEvidenceProjection {
1051
+ runs: RuntimeTrajectoryRunRecord[];
1052
+ events: RuntimeTrajectoryHookEvent[];
1053
+ summary: RuntimeTrajectoryEvidenceSummary;
1054
+ diagnostics: string[];
1055
+ }
1056
+ interface ProjectRuntimeTrajectoryEvidenceOptions<TRecord extends RuntimeTrajectoryRecord = RuntimeTrajectoryRecord> {
1057
+ records: TRecord[];
1058
+ defaultSplitTag?: RunSplitTag;
1059
+ recordIdOf?: (record: TRecord, index: number) => string | undefined;
1060
+ scenarioIdOf?: (record: TRecord, index: number) => string | undefined;
1061
+ }
1062
+ export declare function projectRuntimeTrajectoryEvidence<TRecord extends RuntimeTrajectoryRecord>(options: ProjectRuntimeTrajectoryEvidenceOptions<TRecord>): RuntimeTrajectoryEvidenceProjection;
842
1063
  //#endregion
843
1064
  //#region src/active-learning.d.ts
844
1065
  type SynthesisReason = 'high-variance' | 'undersampled' | 'failure-cluster' | 'difficulty-gap';
@@ -1061,85 +1282,6 @@ interface BoundedProcessResult {
1061
1282
  }
1062
1283
  export declare function runBoundedProcess(input: BoundedProcessInput): Promise<BoundedProcessResult>;
1063
1284
  //#endregion
1064
- //#region src/client.d.ts
1065
- /**
1066
- * ProductClient — configurable HTTP client for exercising any agent's APIs.
1067
- *
1068
- * Routes are config, not hardcoded. Each agent provides its own RouteMap.
1069
- *
1070
- * @deprecated A one-product REST client does not belong in the generic
1071
- * substrate. Moves to the product repo in the next major
1072
- * (tangle-network/agent-runtime#694); vendor it if you construct it directly.
1073
- */
1074
- export declare class ProductClient {
1075
- private baseUrl;
1076
- private routes;
1077
- private cookies;
1078
- private timeoutMs;
1079
- constructor(config: ProductClientConfig);
1080
- private route;
1081
- /**
1082
- * Single HTTP boundary for every JSON request. Aborts after `timeoutMs`,
1083
- * checks `res.ok` BEFORE parsing, and throws `${method} ${path} failed:
1084
- * HTTP ${status} — ${body}` on a non-ok response so a 4xx/5xx error body
1085
- * can never be parsed as a success shape. Callers inspect the resolved
1086
- * value only after a successful return.
1087
- */
1088
- private request;
1089
- /**
1090
- * Read a required collection field. A missing/non-array field is a contract
1091
- * violation (wrong route, drift, partial body) — surface it loud instead of
1092
- * masking it as a healthy empty set. A genuinely empty `[]` passes through.
1093
- */
1094
- private requireArray;
1095
- signup(name: string, email: string, password: string): Promise<{
1096
- userId: string;
1097
- }>;
1098
- login(email: string, password: string): Promise<void>;
1099
- createWorkspace(name: string, type?: string): Promise<string>;
1100
- createThread(workspaceId: string): Promise<string>;
1101
- chat(workspaceId: string, threadId: string, content: string, _opts?: {
1102
- blockPatterns?: RegExp[];
1103
- }): Promise<{
1104
- text: string;
1105
- blocks: {
1106
- type: string;
1107
- title: string;
1108
- }[];
1109
- }>;
1110
- getTasks(workspaceId: string): Promise<{
1111
- id: string;
1112
- title: string;
1113
- status: string;
1114
- priority: string;
1115
- }[]>;
1116
- getEvents(workspaceId: string): Promise<{
1117
- id: string;
1118
- title: string;
1119
- type: string;
1120
- }[]>;
1121
- getApprovals(workspaceId: string): Promise<{
1122
- id: string;
1123
- title: string;
1124
- status: string;
1125
- type: string;
1126
- }[]>;
1127
- getVaultTree(workspaceId: string): Promise<string[]>;
1128
- approveAction(workspaceId: string, id: string): Promise<void>;
1129
- rejectAction(workspaceId: string, id: string, reason: string): Promise<void>;
1130
- getGenerations(workspaceId: string): Promise<{
1131
- id: string;
1132
- type: string;
1133
- prompt: string;
1134
- }[]>;
1135
- /** Generic GET for custom routes */
1136
- get(path: string): Promise<Record<string, unknown>>;
1137
- /** Generic POST for custom routes */
1138
- post(path: string, body: Record<string, unknown>): Promise<Record<string, unknown>>;
1139
- /** Generic PATCH for custom routes */
1140
- patch(path: string, body: Record<string, unknown>): Promise<Record<string, unknown>>;
1141
- }
1142
- //#endregion
1143
1285
  //#region src/command-runner.d.ts
1144
1286
  /**
1145
1287
  * CommandRunner — abstract subprocess execution surface.
@@ -1567,891 +1709,875 @@ interface ReflectionProposal {
1567
1709
  */
1568
1710
  export declare function parseReflectionResponse(raw: string, maxProposals?: number): ReflectionProposal[];
1569
1711
  //#endregion
1570
- //#region src/analyst/policy-edit.d.ts
1571
- type PolicyEditSchemaVersion = 'policy-edit/v1';
1572
- declare const POLICY_EDIT_AXES: readonly ['carrier', 'representation', 'budget', 'sampling', 'output_contract', 'tool_contract', 'routing', 'memory', 'agent_profile', 'deployment_target'];
1573
- type PolicyEditAxis = (typeof POLICY_EDIT_AXES)[number];
1574
- declare const POLICY_EDIT_TARGET_SURFACES: readonly ['prompt', 'tool-contract', 'runtime-config', 'memory', 'agent-profile', 'code', 'deployment'];
1575
- type PolicyEditTargetSurface = (typeof POLICY_EDIT_TARGET_SURFACES)[number];
1576
- type PolicyEditRisk = 'low' | 'medium' | 'high' | 'unknown';
1577
- type PolicyEditGainDirection = 'increase' | 'decrease';
1578
- type PolicyEditGainUnit = 'absolute' | 'relative' | 'percent' | 'score';
1579
- interface PolicyEditTarget {
1580
- surface: PolicyEditTargetSurface;
1581
- /** Stable path inside the target surface, for example `system-prompt:tools`
1582
- * or `budget.maxTurns`. */
1583
- path?: string;
1584
- /** Optional canonical deployment identity. Store the existing cell, not a
1585
- * local profile shape. */
1586
- agentProfileCell?: AgentProfileCell;
1587
- /** Human label when the path is not enough for a readable audit trail. */
1588
- label?: string;
1589
- }
1590
- type PolicyEditChange = {
1591
- kind: 'text';
1592
- mode: 'append' | 'prepend' | 'replace';
1593
- value: string;
1594
- /** Required when `mode === 'replace'`; exact match only. */
1595
- find?: string;
1596
- } | {
1597
- kind: 'json';
1598
- mode: 'set' | 'merge' | 'remove';
1599
- path: string;
1600
- value?: AgentProfileJson;
1601
- };
1602
- interface PolicyEditExpectedGain {
1603
- /** Metric this edit is expected to move, e.g. `holdout.composite`. */
1604
- metric: string;
1605
- direction: PolicyEditGainDirection;
1606
- /** Positive magnitude in the metric's native units. */
1607
- amount: number;
1608
- unit?: PolicyEditGainUnit;
1609
- rationale?: string;
1610
- }
1611
- interface PolicyEditSource {
1612
- findingIds: string[];
1613
- analystIds: string[];
1614
- evidenceRefs: EvidenceRef[];
1615
- /** Mirrors `AnalystFinding.derived_from_judge`; admission rejects it. */
1616
- derivedFromJudge?: boolean;
1617
- }
1618
- interface PolicyEdit {
1619
- schemaVersion: PolicyEditSchemaVersion;
1620
- editId: string;
1621
- axis: PolicyEditAxis;
1622
- target: PolicyEditTarget;
1623
- change: PolicyEditChange;
1624
- claim: string;
1625
- expectedGain: PolicyEditExpectedGain;
1626
- confidence: number;
1627
- risk: PolicyEditRisk;
1628
- source: PolicyEditSource;
1629
- rationale?: string;
1630
- validationPlan?: string;
1631
- metadata?: Record<string, unknown>;
1712
+ //#region src/eval-trace-store.d.ts
1713
+ /**
1714
+ * Backing persistence for `EvalTraceStore`. The in-memory store is the default;
1715
+ * the JSONL file store appends one validated `RunRecord` per line. Both keep an
1716
+ * append order so `getBest` / `compareRuns` are reproducible.
1717
+ */
1718
+ interface RunRecordBackend {
1719
+ append(record: RunRecord): Promise<void>;
1720
+ load(): Promise<RunRecord[]>;
1632
1721
  }
1633
- export declare const POLICY_EDIT_CANDIDATE_RECORD_SCHEMA: 'tangle.policy-edit-candidate.v1';
1634
- /** JSON-safe attribution carried with a measured candidate and its scores. */
1635
- interface PolicyEditCandidateRecord {
1636
- schema: typeof POLICY_EDIT_CANDIDATE_RECORD_SCHEMA;
1637
- policyEdit: PolicyEdit;
1722
+ /**
1723
+ * JSONL-backed store at `path`, one `RunRecord` per line. Malformed lines fail
1724
+ * loud on load (a corrupt corpus must not silently shrink the analysis set);
1725
+ * pass `skipInvalid` only for forensics on a known-bad file.
1726
+ */
1727
+ export declare function jsonlRunRecordBackend(path: string, opts?: {
1728
+ skipInvalid?: boolean;
1729
+ }): RunRecordBackend;
1730
+ //#endregion
1731
+ //#region src/integrity/preflight.d.ts
1732
+ interface ModelPreflight {
1733
+ /** The model id as supplied by the caller. */
1734
+ model: string;
1735
+ /** Membership in the `{baseUrl}/models` served set. */
1736
+ listed: boolean;
1737
+ /**
1738
+ * The router reached a provider for this model. `null` when `probe` was not
1739
+ * requested. True on a 2xx, and also when the provider answered by
1740
+ * exhausting its reasoning budget — that proves reachability while leaving
1741
+ * identity unproven (see `budgetExhausted`).
1742
+ */
1743
+ served: boolean | null;
1744
+ /** HTTP status of the probe. `null` when not probed. */
1745
+ status: number | null;
1746
+ /** Probe body's `error.message` when present, else `null`. */
1747
+ detail: string | null;
1748
+ /**
1749
+ * The probe died on the token budget rather than on the model. Identity is
1750
+ * unproven, not refuted: raise `probeMaxTokens` to resolve it.
1751
+ */
1752
+ budgetExhausted: boolean;
1753
+ /**
1754
+ * Identity of the model that answered the probe, compared against `model`.
1755
+ * `null` when the model was not probed or the probe failed.
1756
+ */
1757
+ substitution: ServedModelCheck | null;
1638
1758
  }
1639
- type PolicyEditInit = Omit<PolicyEdit, 'schemaVersion' | 'editId'> & {
1640
- schemaVersion?: PolicyEditSchemaVersion;
1641
- editId?: string;
1759
+ /** One check Agent Eval asks the caller's endpoint to perform. */
1760
+ type ModelEndpointCheck = {
1761
+ readonly kind: 'list-models';
1762
+ } | {
1763
+ readonly kind: 'probe';
1764
+ readonly model: string;
1765
+ /** Output-token budget the probe completion may bill. */
1766
+ readonly maxOutputTokens: number;
1642
1767
  };
1643
- export declare class PolicyEditValidationError extends ValidationError {
1644
- readonly path: string;
1645
- constructor(message: string, path?: string);
1646
- }
1647
- interface FindingToPolicyEditOptions {
1648
- expectedGain?: PolicyEditExpectedGain | ((finding: AnalystFinding) => PolicyEditExpectedGain | null | undefined);
1649
- risk?: PolicyEditRisk | ((finding: AnalystFinding) => PolicyEditRisk);
1650
- defaultAxis?: PolicyEditAxis;
1651
- defaultTargetSurface?: PolicyEditTargetSurface;
1652
- }
1653
- interface PolicyEditAdmissionOptions {
1654
- minScore?: number;
1655
- minExpectedGain?: number;
1656
- allowHighRisk?: boolean;
1657
- requireEvidence?: boolean;
1768
+ /**
1769
+ * Caller-owned request into the model endpoint. The caller binds the base URL
1770
+ * and the credential and returns the raw `Response`; a `list-models` request
1771
+ * answers with an OpenAI-compatible `{ data: [{ id }] }` body, and a `probe`
1772
+ * request answers with one minimal chat completion for `model`.
1773
+ */
1774
+ type ModelEndpointRequest = (check: ModelEndpointCheck) => Promise<Response>;
1775
+ interface PreflightModelsOptions {
1776
+ /** Caller-owned endpoint request. Agent Eval issues no provider HTTP itself. */
1777
+ request: ModelEndpointRequest;
1778
+ /** Model ids to check. */
1779
+ models: string[];
1780
+ /** When true, additionally spend a small chat probe per model. Default false. */
1781
+ probe?: boolean;
1782
+ /**
1783
+ * Output-token budget per probe. Default `PROBE_MAX_TOKENS`. Lowering it
1784
+ * below the reasoning floor makes healthy reasoning models report
1785
+ * `budgetExhausted` instead of proving their identity.
1786
+ */
1787
+ probeMaxTokens?: number;
1658
1788
  }
1659
- interface PolicyEditAdmission {
1660
- edit: PolicyEdit;
1661
- decision: 'admit' | 'reject';
1662
- score: number;
1663
- reasons: string[];
1789
+ interface PreflightOutcome {
1790
+ succeeded: boolean;
1791
+ value: ModelPreflight[] | null;
1792
+ error: string | null;
1664
1793
  }
1665
- export declare function makePolicyEdit(init: PolicyEditInit): PolicyEdit;
1666
- export declare function computePolicyEditId(edit: Omit<PolicyEdit, 'editId'> | PolicyEdit): string;
1667
- export declare function validatePolicyEdit(input: unknown): PolicyEdit;
1668
- export declare function makePolicyEditCandidateRecord(edit: PolicyEdit): PolicyEditCandidateRecord;
1669
- export declare function validatePolicyEditCandidateRecord(input: unknown): PolicyEditCandidateRecord;
1670
- export declare function policyEditsFromFindings(findings: ReadonlyArray<AnalystFinding>, opts?: FindingToPolicyEditOptions): PolicyEdit[];
1671
- export declare function admitPolicyEdit(edit: PolicyEdit, opts?: PolicyEditAdmissionOptions): PolicyEditAdmission;
1672
- export declare function applyPolicyEditToSurface(surface: unknown, edit: PolicyEdit): unknown;
1673
- //#endregion
1674
- //#region src/analyst/steer-firewall.d.ts
1675
1794
  /**
1676
- * THE steer firewall. Fail-loud guard for any path that admits analyst findings
1677
- * as STEERING input (the `f(trace)` role): rejects — naming the offenders — any
1678
- * finding whose provenance is a judge verdict, rather than let `J` leak into the
1679
- * loop. Returns the findings unchanged for chaining.
1680
- *
1681
- * Call this at the chokepoint where a detector that ALSO scores/gates has its
1682
- * findings turned into a steer (the judge-and-steer dual-role case). It keys on
1683
- * provenance, so it correctly admits evidence-less trace-analyst observations and
1684
- * correctly rejects an artifact-citing judge verdict — the cases an evidence
1685
- * check gets backwards.
1795
+ * Check that `models` are reachable on the router. Returns a typed outcome —
1796
+ * a network failure yields `{ succeeded: false, error }`, never a throw and
1797
+ * never a partial result silently reported as success. No retries, no
1798
+ * fallbacks.
1686
1799
  *
1687
- * It is necessary, not sufficient: it stops PROVENANCE-tagged verdicts. A judge
1688
- * whose output is laundered through a hand-built finding with no provenance flag
1689
- * is out of its reach — provenance must be honestly set at every judge→finding
1690
- * lift (today: createJudgeAdapter). That is why the integrity rule lives at the
1691
- * lift site, and why ProposeContext.judgeScores?: never is the complementary
1692
- * compile-time tripwire on the obvious direct channel.
1800
+ * The membership check (one GET) always runs. When `probe` is true, each model
1801
+ * additionally gets a small chat probe so a model that is listed but
1802
+ * unconfigured (a 401 `model_not_found` from the router) is caught.
1693
1803
  */
1694
- export declare function assertNoJudgeVerdict(findings: ReadonlyArray<AnalystFinding>, context?: string): ReadonlyArray<AnalystFinding>;
1804
+ export declare function preflightModels(opts: PreflightModelsOptions): Promise<PreflightOutcome>;
1695
1805
  //#endregion
1696
- //#region src/capability-headroom.d.ts
1806
+ //#region src/model-seats.d.ts
1807
+ interface ModelSeats {
1808
+ /** The model under evaluation — what the agent itself dispatches with. */
1809
+ worker?: string;
1810
+ /** Judge-panel model ids — thread into `ensembleJudge({ models })`. */
1811
+ judges?: string[];
1812
+ /** Analyst model — `analyzeRuns` / analyst-registry LLM calls. */
1813
+ analyst?: string;
1814
+ /** Reflection or candidate-generation model. */
1815
+ reflection?: string;
1816
+ /** Verifier model — completion/objective checking. */
1817
+ verifier?: string;
1818
+ }
1819
+ type SeatName = keyof ModelSeats;
1697
1820
  /**
1698
- * Capability-headroom gate — "can this task set even SEE the capability
1699
- * you're about to A/B?"
1821
+ * Tier presets — plain data, swap or spread freely.
1700
1822
  *
1701
- * A capability A/B (grant one arm a tool, a skill, extra context — anything)
1702
- * can only detect the capability on tasks the capability-ABSENT baseline
1703
- * FAILS. A task the baseline already passes is saturated: the treatment arm
1704
- * has no headroom to demonstrate anything, and averaging saturated tasks into
1705
- * the comparison dilutes a real effect toward a false null. Calibrate before
1706
- * measuring: run the baseline arm first, classify every task's headroom, and
1707
- * refuse to run the comparison when no task has a gap.
1823
+ * A preset names REQUESTED ids, and a requested id is NOT a guarantee of
1824
+ * family, of provider, or of liveness. A routing gateway can accept any id
1825
+ * below and answer from a different model on HTTP 200, with only the response
1826
+ * body's `model` field betraying the swap. The served assertion is the
1827
+ * guarantee: gate a run on `assertModelsServed({ probe: true })` and assert
1828
+ * `assertServedModel` per call. `assertCrossFamily` over these ids proves the
1829
+ * configuration is diverse; only `assertCrossFamilyServed` over the ids that
1830
+ * ANSWERED proves the run was.
1708
1831
  *
1709
- * Fail-closed on unknown outcomes: a baseline run whose outcome could not be
1710
- * determined (infra loss, unverified, missing) NEVER counts as a failure —
1711
- * treating "couldn't tell" as "failed" would manufacture headroom out of
1712
- * telemetry gaps and launder infra noise into a treatment effect.
1832
+ * `economy` names ids a live router probe answered from the provider their
1833
+ * name implies, so the judge trio spanned three provider families (deepseek /
1834
+ * zhipu / google) as configured and, at that probe, as served. A preset is
1835
+ * only as good as its last probe: ids go dead and start resolving elsewhere
1836
+ * without notice, so re-probe rather than trusting this list.
1713
1837
  *
1714
- * Domain-free by construction: the capability under test never appears here.
1715
- * Callers decide what the baseline arm lacks; this module only classifies
1716
- * baseline outcomes per task.
1838
+ * `frontier` is deliberately EMPTY: entitled frontier ids vary per router
1839
+ * account, and a hardcoded claude/gpt-5 id 401s on keys that lack it. Supply
1840
+ * your own: `{ ...seatPresets.frontier, worker: '<your-frontier-id>', … }` —
1841
+ * `resolveSeat` throws on every seat you haven't filled.
1717
1842
  */
1718
- /** One baseline-arm (capability-absent) observation of one task. */
1719
- interface HeadroomInput {
1720
- /** Stable task identity; multiple rows per task are multiple baseline reps. */
1721
- taskId: string;
1722
- /** Baseline outcome. 'unknown' = the outcome could not be determined —
1723
- * distinct from 'fail' and never counted as one. */
1724
- baselineOutcome: 'pass' | 'fail' | 'unknown';
1725
- }
1726
- /** Headroom classification for one task.
1727
- * - 'gap': the baseline fails it — the comparison can see the capability here.
1728
- * - 'saturated': the baseline already passes it — no headroom.
1729
- * - 'unknown': every baseline outcome is unknown — fail-closed, not a gap. */
1730
- type HeadroomClass = 'gap' | 'saturated' | 'unknown';
1731
- interface TaskHeadroom {
1732
- taskId: string;
1733
- /** Total baseline observations for this task (known + unknown). */
1734
- n: number;
1735
- /** Observations with a known ('pass' | 'fail') outcome — the evidence the
1736
- * classification actually rests on. A large `n` with a small `nKnown`
1737
- * means the headroom verdict is thin, not well-replicated. */
1738
- nKnown: number;
1739
- /** Pass rate over KNOWN outcomes only; NaN when every outcome is unknown
1740
- * (no data ≠ measured zero). */
1741
- baselinePassRate: number;
1742
- headroom: HeadroomClass;
1743
- }
1744
- interface CapabilityHeadroomOptions {
1745
- /** A task counts as 'gap' when its baseline pass rate is ≤ this. Default 0
1746
- * (the baseline must fail every known rep). Must be in [0, 1) — a
1747
- * threshold of 1 would classify a fully-saturated task as a gap. */
1748
- keepThreshold?: number;
1749
- }
1750
- interface CapabilityHeadroomResult {
1751
- /** Per-task classification, sorted by `taskId`. */
1752
- tasks: TaskHeadroom[];
1753
- summary: {
1754
- tasksWithGap: number;
1755
- tasksSaturated: number;
1756
- tasksUnknown: number;
1757
- /** Total unknown-outcome reps across ALL tasks (including tasks that
1758
- * still classified via their known reps) — the size of the telemetry
1759
- * hole behind the classifications. */
1760
- repsUnknown: number;
1761
- };
1762
- }
1843
+ export declare const seatPresets: Record<'economy' | 'frontier', ModelSeats>;
1763
1844
  /**
1764
- * Classify every task's baseline headroom from capability-absent baseline
1765
- * outcomes.
1766
- *
1767
- * A task is 'gap' when it has ≥ 1 known outcome and its pass rate over known
1768
- * outcomes is ≤ `keepThreshold`; 'saturated' when the rate exceeds the
1769
- * threshold; 'unknown' when every outcome is unknown. Unknown reps never
1770
- * count toward the rate in either direction (fail-closed — see the module
1771
- * doc), and evidence strength stays visible: each task reports `nKnown`
1772
- * alongside `n`, and the summary totals the unknown reps in `repsUnknown`.
1773
- * Throws on empty input, an out-of-range `keepThreshold`, or an
1774
- * unrecognized outcome value (rows are often projected from untyped records).
1845
+ * Read one seat. Blank strings and empty arrays count as unset (env-var
1846
+ * plumbing produces them); malformed values (non-string seat, non-array or
1847
+ * blank-entry `judges`) throw `ValidationError`. When the seat is unset, an
1848
+ * explicit `fallback` is returned (`[fallback]` for `judges` — a one-model
1849
+ * panel); without one, `SeatUnsetError`.
1775
1850
  */
1776
- export declare function capabilityHeadroom(rows: readonly HeadroomInput[], opts?: CapabilityHeadroomOptions): CapabilityHeadroomResult;
1777
- interface AssertCapabilityHeadroomOptions {
1778
- /** Minimum tasks classified 'gap' for the comparison to proceed. Default 1. */
1779
- minTasksWithGap?: number;
1780
- }
1851
+ export declare function resolveSeat(seats: ModelSeats, seat: 'judges', fallback?: string): string[];
1852
+ export declare function resolveSeat(seats: ModelSeats, seat: Exclude<SeatName, 'judges'>, fallback?: string): string;
1853
+ export declare function resolveSeat(seats: ModelSeats, seat: SeatName, fallback?: string): string | string[];
1854
+ //#endregion
1855
+ //#region src/prompt-registry.d.ts
1781
1856
  /**
1782
- * The go/no-go guard: throws when fewer than `minTasksWithGap` tasks have
1783
- * baseline headroom — i.e. the benchmark cannot see the capability, so any
1784
- * comparison run on it would measure noise. Call between the baseline
1785
- * calibration run and the treatment run.
1857
+ * Versioned prompt registry.
1858
+ *
1859
+ * Every prompt used in an eval run is registered with an explicit version.
1860
+ * Reports include the content hash so A/B compares are rigorous: if the
1861
+ * hash changes between two reports, the prompt actually changed; if it
1862
+ * matches, the variance is elsewhere.
1863
+ *
1864
+ * Hash is SHA-256(content), truncated to 12 hex chars for readability.
1865
+ * Uses the Web Crypto API (works in Workers, Node 22+, browsers).
1786
1866
  */
1787
- export declare function assertCapabilityHeadroom(result: CapabilityHeadroomResult, opts?: AssertCapabilityHeadroomOptions): void;
1867
+ interface PromptHandle {
1868
+ /** Stable human-readable id, e.g. 'browser.system' */
1869
+ id: string;
1870
+ /** Caller-chosen version string, e.g. 'v3' or '2026-04-20' */
1871
+ version: string;
1872
+ /** SHA-256 of content, 12-hex-char prefix */
1873
+ hash: string;
1874
+ /** Full prompt body */
1875
+ content: string;
1876
+ }
1877
+ export declare class PromptRegistry {
1878
+ private readonly entries;
1879
+ /**
1880
+ * Register a prompt. Re-registering the same id+version with DIFFERENT
1881
+ * content throws — versions are immutable. Re-registering with the SAME
1882
+ * content is a no-op (idempotent).
1883
+ */
1884
+ register(id: string, version: string, content: string): Promise<PromptHandle>;
1885
+ /** Look up a registered prompt. Throws if unknown — no implicit defaults. */
1886
+ get(id: string, version: string): PromptHandle;
1887
+ /** Return all versions of an id, newest-first (lex-descending on version). */
1888
+ listVersions(id: string): PromptHandle[];
1889
+ /** Snapshot the whole registry — useful for including in reports. */
1890
+ list(): PromptHandle[];
1891
+ /** Verify a hash against registered content. Returns null if not found. */
1892
+ verifyHash(id: string, version: string, expectedHash: string): boolean | null;
1893
+ }
1894
+ /** SHA-256(content) → first 12 hex chars. Stable across runtimes. */
1895
+ export declare function hashContent(content: string): Promise<string>;
1788
1896
  //#endregion
1789
- //#region src/cost-tracker.d.ts
1897
+ //#region src/reference-replay.d.ts
1790
1898
  /**
1791
- * Cost tracker — token + USD accounting per scenario and per run.
1899
+ * Reference replay — score an agent against withheld historical outcomes.
1792
1900
  *
1793
- * Adapted from generic usage-event accounting. Every
1794
- * optimizer needs to know "is the quality gain worth the cost delta?",
1795
- * and every dashboard needs dollars-per-completed-task. MODEL_PRICING
1796
- * from metrics.ts stays authoritative for estimate math; this module
1797
- * adds the aggregation + per-scenario roll-up that was duplicated
1798
- * across 4 verticals.
1901
+ * This is the generic version of the public-audit replay pattern:
1902
+ * run a candidate system on an old task, keep the reference answers hidden
1903
+ * until after execution, then score recall/precision and gate promotion
1904
+ * across train/dev/test/holdout splits.
1799
1905
  */
1800
- interface TokenSpec {
1801
- inputTokens: number;
1802
- outputTokens: number;
1803
- cachedTokens?: number;
1804
- reasoningTokens?: number;
1906
+ type ReferenceReplaySplit = 'train' | 'dev' | 'test' | 'holdout';
1907
+ interface ReferenceReplayItem {
1908
+ id: string;
1909
+ title: string;
1910
+ description?: string;
1911
+ severity?: string;
1912
+ tags?: string[];
1913
+ weight?: number;
1914
+ }
1915
+ interface ReferenceReplayCandidate {
1916
+ id: string;
1917
+ title: string;
1918
+ description?: string;
1919
+ severity?: string;
1920
+ tags?: string[];
1921
+ metadata?: Record<string, unknown>;
1922
+ }
1923
+ interface ReferenceReplayMatch {
1924
+ scenarioId: string;
1925
+ referenceId: string;
1926
+ candidateId: string | null;
1927
+ score: number;
1928
+ matched: boolean;
1929
+ weight: number;
1930
+ reason: string;
1931
+ }
1932
+ interface ReferenceReplayScenarioScore {
1933
+ scenarioId: string;
1934
+ split: ReferenceReplaySplit;
1935
+ matched: number;
1936
+ total: number;
1937
+ falsePositives: number;
1938
+ matchedWeight: number;
1939
+ totalWeight: number;
1940
+ precision: number;
1941
+ recall: number;
1942
+ f1: number;
1943
+ matches: ReferenceReplayMatch[];
1944
+ }
1945
+ interface ReferenceReplayAggregate {
1946
+ matched: number;
1947
+ total: number;
1948
+ falsePositives: number;
1949
+ matchedWeight: number;
1950
+ totalWeight: number;
1951
+ precision: number;
1952
+ recall: number;
1953
+ f1: number;
1954
+ weightedRecall: number;
1805
1955
  }
1806
- interface CostEntry extends TokenSpec {
1807
- scenarioId: string;
1808
- model: string;
1809
- /** Override estimate with an observed cost (e.g. from provider response). */
1810
- actualCostUsd?: number;
1811
- timestamp: number;
1812
- /** Free-form tags (variant id, round #, etc.). */
1813
- tags?: Record<string, string>;
1956
+ interface ReferenceReplayScore {
1957
+ scenarios: ReferenceReplayScenarioScore[];
1958
+ aggregate: ReferenceReplayAggregate;
1959
+ bySplit: Partial<Record<ReferenceReplaySplit, ReferenceReplayAggregate>>;
1814
1960
  }
1815
- interface ScenarioCost {
1816
- scenarioId: string;
1817
- entries: CostEntry[];
1818
- totalInputTokens: number;
1819
- totalOutputTokens: number;
1820
- totalCachedTokens: number;
1821
- totalCostUsd: number;
1822
- /** Pass flag — set by consumer via markOutcome; used for cost-per-completed-task. */
1823
- completed?: boolean;
1961
+ interface ReferenceReplayCaseRun<Input = unknown> {
1962
+ caseId: string;
1963
+ split: ReferenceReplaySplit;
1964
+ input: Input;
1965
+ metadata?: Record<string, unknown>;
1966
+ references: ReferenceReplayItem[];
1967
+ candidates: ReferenceReplayCandidate[];
1968
+ score: ReferenceReplayScenarioScore;
1969
+ durationMs: number;
1970
+ error?: string;
1824
1971
  }
1825
- export declare class CostTracker {
1826
- private byScenario;
1827
- record(entry: Omit<CostEntry, 'timestamp'> & {
1828
- timestamp?: number;
1829
- }): CostEntry;
1830
- markOutcome(scenarioId: string, completed: boolean): void;
1831
- /**
1832
- * Convenience: record + markOutcome in one call from a
1833
- * `{ usage, verdict }`-shaped response (starter-foundry's
1834
- * `invokeMetaJudge` returns this shape; consumers that wrap any
1835
- * judge/critic can follow the same convention).
1836
- *
1837
- * `usage.model` must be present in `MODEL_PRICING` for cost math to
1838
- * populate; otherwise totalCostUsd stays at 0 for the entry but
1839
- * tokens still aggregate.
1840
- */
1841
- recordVerdict(verdict: {
1842
- usage?: {
1843
- inputTokens: number;
1844
- outputTokens: number;
1845
- model: string;
1846
- cachedTokens?: number;
1847
- reasoningTokens?: number;
1848
- };
1849
- verdict?: 'pass' | 'fail' | 'borderline' | string;
1850
- }, scenarioId: string, tags?: Record<string, string>): CostEntry | null;
1851
- get(scenarioId: string): ScenarioCost | undefined;
1852
- list(): ScenarioCost[];
1853
- summary(): CostSummary;
1972
+ interface ReferenceReplayRun<Input = unknown> {
1973
+ id: string;
1974
+ variantId?: string;
1975
+ startedAt: number;
1976
+ completedAt: number;
1977
+ durationMs: number;
1978
+ cases: ReferenceReplayCaseRun<Input>[];
1979
+ score: ReferenceReplayScore;
1980
+ metadata?: Record<string, unknown>;
1854
1981
  }
1855
- interface CostSummary {
1856
- scenarioCount: number;
1857
- completedCount: number;
1858
- totalInputTokens: number;
1859
- totalOutputTokens: number;
1860
- totalCostUsd: number;
1861
- avgCostPerScenarioUsd: number;
1862
- /** Total USD / completed scenarios — null when nothing completed. */
1863
- costPerCompletedTaskUsd: number | null;
1982
+ //#endregion
1983
+ //#region src/steering.d.ts
1984
+ interface SteeringRolePrompt {
1985
+ system?: string;
1986
+ append?: string;
1987
+ }
1988
+ interface SteeringBundle {
1989
+ id: string;
1990
+ coderPrompt?: string;
1991
+ continuePrompt?: string;
1992
+ reviewerPrompts?: Record<string, string>;
1993
+ skills?: string[];
1994
+ rolePrompts?: Record<string, SteeringRolePrompt>;
1995
+ metadata?: Record<string, unknown>;
1864
1996
  }
1865
1997
  //#endregion
1866
- //#region src/detectors/index.d.ts
1867
- type DetectorSeverity = 'info' | 'warn' | 'critical';
1868
- /** A normalized step a detector folds over. Fields are optional; each detector reads only what it
1869
- * needs (repeated-action → `actionFingerprint`; no-progress → `stateFingerprint` + `score`;
1870
- * error-streak → `status`). */
1871
- interface DetectorEvent {
1872
- /** Fingerprint of the action/tool-call this step took (caller pre-hashes). */
1873
- readonly actionFingerprint?: string;
1874
- /** Fingerprint of observable state AFTER this step. */
1875
- readonly stateFingerprint?: string;
1876
- /** Score after this step (the score-flat half of no-progress). */
1877
- readonly score?: number;
1878
- /** Whether this step errored. */
1879
- readonly status?: 'ok' | 'error';
1880
- /** Free-form label carried into the signal evidence (e.g. the tool name). */
1881
- readonly label?: string;
1998
+ //#region src/run-score.d.ts
1999
+ interface RunScore {
2000
+ success: number;
2001
+ goalProgress: number;
2002
+ repoGroundedness: number;
2003
+ driftPenalty: number;
2004
+ toolUseQuality: number;
2005
+ patchQuality: number;
2006
+ testReality: number;
2007
+ finalGate: number;
2008
+ reviewerBlockers: number;
2009
+ costUsd: number;
2010
+ wallSeconds: number;
2011
+ notes?: string[];
1882
2012
  }
1883
- interface DetectorSignal {
1884
- readonly detector: string;
1885
- readonly severity: DetectorSeverity;
1886
- readonly failureClass?: FailureClass;
1887
- readonly reason: string;
1888
- /** Consecutive matching steps at the moment the signal fired. */
1889
- readonly streak: number;
1890
- readonly evidence?: Record<string, unknown>;
2013
+ interface RunScoreWeights {
2014
+ success: number;
2015
+ goalProgress: number;
2016
+ repoGroundedness: number;
2017
+ driftPenalty: number;
2018
+ toolUseQuality: number;
2019
+ patchQuality: number;
2020
+ testReality: number;
2021
+ finalGate: number;
2022
+ reviewerBlockers: number;
2023
+ costUsd: number;
2024
+ wallSeconds: number;
1891
2025
  }
1892
- interface StreamingDetector {
1893
- readonly id: string;
1894
- /** Current streak (consecutive matching steps) — for telemetry/introspection between observes. */
1895
- readonly streak: number;
1896
- /** Fold one event; return a signal when the threshold trips, else null. */
1897
- observe(event: DetectorEvent): DetectorSignal | null;
1898
- /** Clear all state. */
1899
- reset(): void;
2026
+ export declare function aggregateRunScore(score: RunScore, weights?: Partial<RunScoreWeights>): number;
2027
+ export declare function clamp01(value: number): number;
2028
+ //#endregion
2029
+ //#region src/steering-optimizer.d.ts
2030
+ type SteeringOptimizerBackend = 'pairwise';
2031
+ interface SteeringOptimizationRow {
2032
+ variantId: string;
2033
+ scenarioId: string;
2034
+ bundle: SteeringBundle;
2035
+ score: RunScore;
2036
+ metadata?: Record<string, unknown>;
1900
2037
  }
1901
- interface RepeatedActionOptions {
1902
- /** Signal once the same action fingerprint repeats this many CONSECUTIVE steps (default 3).
1903
- * `<= 0` disables the signal (the streak is still tracked, for telemetry). */
1904
- readonly maxRepeated?: number;
1905
- readonly severity?: DetectorSeverity;
1906
- /** Failure class to stamp on the signal (default `tool_recovery_failure`). */
1907
- readonly failureClass?: FailureClass;
2038
+ interface SteeringOptimizationSelector {
2039
+ backend: SteeringOptimizerBackend;
2040
+ signature?: string;
2041
+ labels?: string[];
2042
+ rationale?: string;
1908
2043
  }
1909
- /** Same action fingerprint N consecutive steps = a stuck loop (the #1 long-horizon failure mode). */
1910
- export declare function repeatedActionDetector(opts?: RepeatedActionOptions): StreamingDetector;
1911
- interface ErrorStreakOptions {
1912
- /** Signal once this many CONSECUTIVE steps errored (default 3). `<= 0` disables. */
1913
- readonly maxErrors?: number;
1914
- readonly severity?: DetectorSeverity;
1915
- readonly failureClass?: FailureClass;
2044
+ interface SteeringOptimizationResult {
2045
+ backend: SteeringOptimizerBackend;
2046
+ recommendedVariantId: string;
2047
+ rationale: string;
2048
+ rankings: Array<{
2049
+ variantId: string;
2050
+ mean: number;
2051
+ runs: number;
2052
+ }>;
2053
+ selector?: SteeringOptimizationSelector;
2054
+ skipped?: boolean;
2055
+ }
2056
+ interface SteeringOptimizerConfig {
2057
+ weights?: Partial<RunScoreWeights>;
1916
2058
  }
1917
- /** N consecutive tool errors = the worker is hammering a broken approach. */
1918
- export declare function errorStreakDetector(opts?: ErrorStreakOptions): StreamingDetector;
1919
- /** Fold one event through many detectors at once; returns every signal that fired this step. The
1920
- * natural shape for an online pipe watching with a whole panel of detectors. */
1921
- export declare function observeAll(detectors: ReadonlyArray<StreamingDetector>, event: DetectorEvent): DetectorSignal[];
1922
- //#endregion
1923
- //#region src/error-count-extractor.d.ts
1924
2059
  /**
1925
- * Toolchain error-count extractor.
1926
- *
1927
- * Given stderr/stdout from a compiler or test runner, count the number
1928
- * of reported errors/failures. Patterns are deliberately narrow —
1929
- * unknown stderr returns `null` rather than zero so callers can
1930
- * distinguish "no errors" from "different toolchain, couldn't parse".
1931
- *
1932
- * All patterns are anchored to the start of a line and use bounded
1933
- * character classes to avoid catastrophic backtracking on pathological
1934
- * inputs.
2060
+ * Rank already-evaluated steering variants.
1935
2061
  *
1936
- * Add new toolchains by appending to {@link ERROR_COUNT_PATTERNS};
1937
- * order matters only in the sense that the first matching pattern wins.
2062
+ * Model-backed candidate generation belongs to the official GEPA campaign
2063
+ * integration. This class only performs the deterministic selection it owns.
1938
2064
  */
1939
- interface ErrorCountPattern {
1940
- /** Stable identifier for logging + tests. */
1941
- name: string;
1942
- /** Must be global (`g` flag) — the extractor counts matches. */
1943
- regex: RegExp;
1944
- /** Optional post-processing to extract a count from a single captured match. */
1945
- transform?: (match: RegExpMatchArray) => number;
2065
+ export declare class PairwiseSteeringOptimizer {
2066
+ optimize(rows: SteeringOptimizationRow[], config?: SteeringOptimizerConfig): SteeringOptimizationResult;
1946
2067
  }
1947
- export declare const ERROR_COUNT_PATTERNS: ErrorCountPattern[];
1948
- interface ExtractOptions {
1949
- /** Restrict to named patterns — default: all patterns. */
1950
- only?: string[];
1951
- /** Additional patterns to consider BEFORE the built-in list. */
1952
- extra?: ErrorCountPattern[];
2068
+ //#endregion
2069
+ //#region src/scorecard.d.ts
2070
+ /** One commit's measurement of one (scenario, profile) cell. */
2071
+ interface ScorecardEntry {
2072
+ commitSha: string;
2073
+ /** ISO timestamp the entry was recorded. */
2074
+ timestamp: string;
2075
+ /** Per-seed (or per-rep) scores for this cell at this commit. */
2076
+ scores: number[];
2077
+ /** Median of `scores` — the cell's headline score for the commit. */
2078
+ composite: number;
2079
+ /** Per-dimension means, when the runs carried a judge breakdown. */
2080
+ perDimension?: Record<string, number>;
2081
+ /** RunRecord ids folded into this entry — provenance. */
2082
+ runIds: string[];
1953
2083
  }
1954
- interface ExtractResult {
1955
- /** Total count of matched errors, or null when no pattern matched. */
1956
- count: number | null;
1957
- /** Name of the pattern that matched, or null. */
1958
- matched: string | null;
1959
- /** Original matches for callers that want to surface specifics. */
1960
- samples: string[];
2084
+ /** A (scenario, profile) cell and its commit-ordered score timeline. */
2085
+ interface ScorecardCell {
2086
+ scenarioId: string;
2087
+ profileHash: string;
2088
+ /** Model id — denormalised from the profile for readable filtering. */
2089
+ model: string;
2090
+ timeline: ScorecardEntry[];
1961
2091
  }
1962
- /**
1963
- * Try each pattern in order; return the first with matches.
1964
- *
1965
- * Returning `null` (instead of zero) on no-match is deliberate — a
1966
- * callsite that greps for "typescript errors" on cargo output should
1967
- * NOT treat that as "zero TS errors" because the toolchain is wrong.
1968
- */
1969
- export declare function extractErrorCount(text: string, opts?: ExtractOptions): ExtractResult;
1970
- //#endregion
1971
- //#region src/knowledge/types.d.ts
1972
- type KnowledgeRequirementCategory = 'user_specific' | 'company_specific' | 'domain_specific' | 'codebase_specific' | 'market_specific' | 'regulatory' | 'tool_api' | 'credential_or_secret' | 'runtime_environment' | 'preference' | 'historical_context';
1973
- type KnowledgeAcquisitionMode = 'ask_user' | 'search_web' | 'query_connector' | 'inspect_repo' | 'run_command' | 'infer_low_confidence' | 'not_available';
1974
- type KnowledgeImportance = 'blocking' | 'high' | 'medium' | 'low';
1975
- type KnowledgeFreshness = 'static' | 'monthly' | 'weekly' | 'daily' | 'realtime';
1976
- type KnowledgeSensitivity = 'public' | 'private' | 'secret';
1977
- type KnowledgeFallbackPolicy = 'block' | 'ask' | 'continue_with_caveat' | 'use_default';
1978
- interface KnowledgeRequirement {
1979
- id: string;
1980
- description: string;
1981
- requiredFor: string[];
1982
- category: KnowledgeRequirementCategory;
1983
- acquisitionMode: KnowledgeAcquisitionMode;
1984
- importance: KnowledgeImportance;
1985
- freshness: KnowledgeFreshness;
1986
- sensitivity: KnowledgeSensitivity;
1987
- confidenceNeeded: number;
1988
- currentConfidence: number;
1989
- evidenceIds: string[];
1990
- fallbackPolicy: KnowledgeFallbackPolicy;
1991
- /**
1992
- * ISO timestamp after which this requirement must be treated as stale.
1993
- * Stale requirements score as missing even when they still have evidence.
1994
- */
1995
- validUntil?: string;
1996
- /** ISO timestamp for the last source-grounding or human verification pass. */
1997
- lastVerifiedAt?: string;
1998
- metadata?: Record<string, unknown>;
2092
+ /** The folded scorecard: every cell, plus the profile definitions by hash. */
2093
+ interface Scorecard {
2094
+ cells: ScorecardCell[];
2095
+ /** Profile definitions seen — keeps the scorecard self-describing. */
2096
+ profiles: Record<string, AgentProfile>;
1999
2097
  }
2000
- interface KnowledgeBundle {
2001
- taskId: string;
2002
- requirements: KnowledgeRequirement[];
2003
- evidenceIds: string[];
2004
- claimIds: string[];
2005
- wikiPageIds: string[];
2006
- userAnswers: Record<string, string>;
2007
- missing: KnowledgeRequirement[];
2008
- readinessScore: number;
2009
- metadata?: Record<string, unknown>;
2098
+ /** One append-only log line — a single cell's entry for a single commit. */
2099
+ interface ScorecardLogLine {
2100
+ scenarioId: string;
2101
+ profileHash: string;
2102
+ model: string;
2103
+ profile: AgentProfile;
2104
+ entry: ScorecardEntry;
2010
2105
  }
2011
- type KnowledgeRecommendedAction = 'run_agent' | 'ask_user' | 'collect_web_data' | 'query_connectors' | 'inspect_repo' | 'build_domain_wiki' | 'continue_with_caveat' | 'abort_or_rescope';
2012
- interface KnowledgeReadinessReport {
2013
- taskId: string;
2014
- readinessScore: number;
2015
- blockingMissingRequirements: KnowledgeRequirement[];
2016
- nonBlockingGaps: KnowledgeRequirement[];
2017
- recommendedAction: KnowledgeRecommendedAction;
2018
- bundle: KnowledgeBundle;
2019
- severity: ControlSeverity;
2020
- reason: string;
2106
+ interface RecordRunsOptions {
2107
+ /** The profile that produced these runs — keys the cell. */
2108
+ profile: AgentProfile;
2109
+ commitSha: string;
2110
+ /** Defaults to `new Date().toISOString()`. */
2111
+ timestamp?: string;
2021
2112
  }
2022
- interface UserQuestion {
2023
- id: string;
2024
- question: string;
2025
- reason: string;
2026
- requirementId: string;
2027
- importance: KnowledgeImportance;
2028
- answerType: 'free_text' | 'select_one' | 'multi_select' | 'file_upload' | 'credential' | 'url';
2029
- defaultIfSkipped?: string;
2030
- impactIfUnknown: string;
2031
- options?: string[];
2032
- metadata?: Record<string, unknown>;
2113
+ /**
2114
+ * Fold a benchmark's `RunRecord[]` into per-cell scorecard log lines — one
2115
+ * line per scenario the runs cover. All runs are attributed to the single
2116
+ * `profile` in `opts` (the harness ran them under it); the cell key is
2117
+ * `(scenarioId, agentProfileHash(profile))`.
2118
+ */
2119
+ export declare function recordRuns(runs: RunRecord[], opts: RecordRunsOptions): ScorecardLogLine[];
2120
+ /** Record runs and append them to the log in one call. Returns the lines. */
2121
+ export declare function recordRunsToScorecard(logPath: string, runs: RunRecord[], opts: RecordRunsOptions): ScorecardLogLine[];
2122
+ /**
2123
+ * Fold the JSONL log into a queryable `Scorecard`. A missing file yields an
2124
+ * empty scorecard; a malformed line is skipped — a corrupt append never
2125
+ * breaks the read. Each cell's timeline is sorted chronologically.
2126
+ */
2127
+ export declare function loadScorecard(logPath: string): Scorecard;
2128
+ type CellVerdict = 'improved' | 'regressed' | 'flat' | 'new';
2129
+ interface ScorecardCellDiff {
2130
+ scenarioId: string;
2131
+ profileHash: string;
2132
+ model: string;
2133
+ verdict: CellVerdict;
2134
+ /** Composite of the latest entry. */
2135
+ current: number;
2136
+ /** Composite of the comparison entry — `null` when `verdict === 'new'`. */
2137
+ baseline: number | null;
2138
+ /** `current − baseline` — `null` when new. */
2139
+ delta: number | null;
2140
+ /** Cohen's d of current vs baseline samples — `null` when new or n < 2. */
2141
+ cohensD: number | null;
2142
+ /** Welch's t-test p-value — `null` when new or n < 2. */
2143
+ pValue: number | null;
2144
+ currentCommit: string;
2145
+ baselineCommit: string | null;
2033
2146
  }
2034
- interface DataAcquisitionPlan {
2035
- id: string;
2036
- requirementIds: string[];
2037
- mode: Exclude<KnowledgeAcquisitionMode, 'not_available' | 'infer_low_confidence'> | 'build_domain_wiki';
2038
- description: string;
2039
- priority: KnowledgeImportance;
2040
- expectedEvidenceIds?: string[];
2041
- questions?: UserQuestion[];
2042
- metadata?: Record<string, unknown>;
2147
+ interface ScorecardDiff {
2148
+ cells: ScorecardCellDiff[];
2149
+ summary: {
2150
+ improved: number;
2151
+ regressed: number;
2152
+ flat: number;
2153
+ new: number;
2154
+ };
2043
2155
  }
2044
- //#endregion
2045
- //#region src/knowledge/readiness.d.ts
2046
- interface ScoreKnowledgeReadinessOptions {
2047
- taskId: string;
2048
- requirements: KnowledgeRequirement[];
2049
- evidenceIds?: string[];
2050
- claimIds?: string[];
2051
- wikiPageIds?: string[];
2052
- userAnswers?: Record<string, string>;
2053
- metadata?: Record<string, unknown>;
2054
- now?: Date;
2156
+ interface DiffScorecardOptions {
2157
+ /** Compare each cell against this commit instead of its immediate predecessor. */
2158
+ baselineCommit?: string;
2159
+ /** |Cohen's d| at/above which a move counts as real. Default 0.5. */
2160
+ minEffect?: number;
2161
+ /** p-value at/below which a move is significant. Default 0.05. */
2162
+ maxP?: number;
2163
+ /**
2164
+ * |delta| at/above which a move counts when statistics are unavailable
2165
+ * (a cell with fewer than 2 samples on either side). Default 0.05.
2166
+ */
2167
+ minDelta?: number;
2055
2168
  }
2056
- export declare function scoreKnowledgeReadiness(options: ScoreKnowledgeReadinessOptions): KnowledgeReadinessReport;
2057
- export declare function blockingKnowledgeEval(report: KnowledgeReadinessReport, options?: {
2058
- id?: string;
2059
- minimumScore?: number;
2060
- emitter?: TraceEmitter;
2061
- }): ControlEvalResult;
2062
- export declare function knowledgeReadinessTracePayload(report: KnowledgeReadinessReport, options?: {
2063
- passed?: boolean;
2064
- minimumScore?: number;
2065
- }): Record<string, unknown>;
2066
- export declare function userQuestionsForKnowledgeGaps(gaps: KnowledgeRequirement[]): UserQuestion[];
2067
- export declare function acquisitionPlansForKnowledgeGaps(gaps: KnowledgeRequirement[]): DataAcquisitionPlan[];
2169
+ /**
2170
+ * Compare the latest entry of every cell against its predecessor (or against
2171
+ * `baselineCommit`) and classify the move. A move is `improved`/`regressed`
2172
+ * only when it clears both the effect-size and significance gates; otherwise
2173
+ * `flat`. Cells with no prior entry are `new`.
2174
+ */
2175
+ export declare function diffScorecard(scorecard: Scorecard, opts?: DiffScorecardOptions): ScorecardDiff;
2176
+ /**
2177
+ * Render a scorecard diff as a human-readable report — the block a feature
2178
+ * PR prints. Regressions are listed first; flat cells are summarised, not
2179
+ * enumerated.
2180
+ */
2181
+ export declare function formatScorecardDiff(diff: ScorecardDiff): string;
2068
2182
  //#endregion
2069
- //#region src/leaderboard.d.ts
2070
- interface LeaderboardRow {
2071
- /** Group key — the agent-profile cellId by default, else a caller dimension. */
2072
- key: string;
2073
- /** Display label: `harness · model` when the profile carries them, else the key. */
2074
- label: string;
2075
- harness?: string;
2183
+ //#region src/trace-contracts/types.d.ts
2184
+ /**
2185
+ * Minimal structural span the checker reads. The eval-side `Span`
2186
+ * (trace/schema) and the output of {@link contractSpansFromOtlp} satisfy it.
2187
+ */
2188
+ interface ContractSpan {
2189
+ spanId?: string;
2190
+ parentSpanId?: string | null;
2191
+ name?: string;
2192
+ /** Eval kinds (`tool`, `llm`, ...) or contract kinds (`TOOL`, `LLM`, ...). */
2193
+ kind?: string;
2194
+ startedAt?: number;
2195
+ endedAt?: number;
2196
+ status?: string;
2197
+ error?: string;
2198
+ /** Typed field on eval-side ToolSpans; OTLP flattenings drop it (see
2199
+ * {@link contractSpanToolName}). */
2200
+ toolName?: string;
2201
+ /** Typed field on eval-side LlmSpans. */
2076
2202
  model?: string;
2077
- rank: number;
2078
- /** Measured runs in this group. */
2079
- n: number;
2080
- passRate: number;
2081
- passRateCi95: [number, number];
2082
- /** Observability rollup — means over the group; null when no run reported it. */
2083
- meanCostUsd: number | null;
2084
- meanTokensIn: number | null;
2085
- meanTokensOut: number | null;
2086
- meanWallMs: number | null;
2087
- }
2088
- interface LeaderboardOptions {
2089
- /** Per-run pass predicate — the benchmark defines what "passed" means (real-build
2090
- * hit-rate, test-pass, etc.). The leaderboard owns only the grouping + stats. */
2091
- passed: (record: RunRecord) => boolean;
2092
- /** Group key. Default: the agent-profile cellId (harness × model × dimensions),
2093
- * so persona/harness/model sweeps separate without parsing labels. */
2094
- groupBy?: (record: RunRecord) => string;
2203
+ inputTokens?: number;
2204
+ outputTokens?: number;
2205
+ /** Typed field on eval-side ToolSpans. */
2206
+ args?: unknown;
2207
+ /** False when the source observed the call but did not capture its arguments. */
2208
+ argsCaptured?: boolean;
2209
+ attributes?: Record<string, unknown>;
2095
2210
  }
2096
2211
  /**
2097
- * Group `records`, compute pass-rate + Wilson CI + cost/token/latency means per
2098
- * group, and rank by pass-rate (cost as the tiebreaker — cheaper wins a tie).
2099
- * Pure projection: no I/O, deterministic, safe to call on any RunRecord[].
2212
+ * The run a `run` rule reads. The eval-side `Run` satisfies it. When no run is
2213
+ * passed, the checker derives it from the trace's single root span; a trace
2214
+ * with no unique root leaves the run unknown and every `run` rule fails.
2100
2215
  */
2101
- export declare function leaderboard(records: RunRecord[], opts: LeaderboardOptions): LeaderboardRow[];
2102
- //#endregion
2103
- //#region src/metrics.d.ts
2104
- interface TokenPrice {
2105
- input: number;
2106
- output: number;
2216
+ interface ContractRun {
2217
+ status?: string;
2218
+ startedAt?: number;
2219
+ endedAt?: number;
2107
2220
  }
2108
- /** Per-1K token pricing for exact model ids. */
2109
- export declare const MODEL_PRICING: Record<string, TokenPrice>;
2110
- /** Resolve pricing for a model id: exact table, then family fallback.
2111
- * Returns null when the id matches nothing (caller decides — never a
2112
- * silent-zero masquerading as a real $0 cost). */
2113
- export declare function resolveModelPricing(model: string): TokenPrice | null;
2114
- /** True when `model` has known pricing (exact or family). Lets cost-aware
2115
- * callers distinguish a real $0 from an unpriced model. */
2116
- export declare function isModelPriced(model: string): boolean;
2117
- /** Estimate token count from string length (chars / 4 approximation) */
2118
- export declare function estimateTokens(text: string): number;
2119
- /** Calculate cost in USD from token counts and model. Unknown models warn
2120
- * once (not a silent zero) and return 0 so callers that ignore pricing keep
2121
- * working; cost-sensitive callers should gate on {@link isModelPriced}. */
2122
- export declare function estimateCost(inputTokens: number, outputTokens: number, model: string): number;
2123
- //#endregion
2124
- //#region src/paired-delta-test.d.ts
2125
- interface PairedDeltaTestOptions extends PairedBootstrapOptions {
2126
- /** Smallest candidate-minus-baseline delta that counts as improvement. Default 0. */
2127
- threshold?: number;
2128
- /** Caller-required paired observations. The exact test may impose a higher minimum. */
2129
- minPairs?: number;
2221
+ /** JSON-safe RegExp form — what the builder normalizes RegExp matchers to. */
2222
+ interface SerializedRegex {
2223
+ $regex: string;
2224
+ flags: string;
2130
2225
  }
2131
- interface PairedDeltaTestResult {
2132
- bootstrap: PairedBootstrapResult;
2133
- method: 'bootstrap-ci' | 'exact-sign';
2134
- /** Exact one-sided p-value below the bootstrap minimum; otherwise null. */
2135
- pValue: number | null;
2136
- /** Effective observation minimum after accounting for confidence. */
2137
- minimumPairs: number;
2138
- sufficient: boolean;
2139
- /**
2140
- * The bootstrap interval has zero width (or is non-finite), so it carries no
2141
- * information about how far the estimate could be wrong and cannot support a
2142
- * decision in either direction. See {@link pairedDeltaTest}.
2143
- */
2144
- indeterminate: boolean;
2145
- significant: boolean;
2226
+ /** Matches when the value equals one of the listed strings. */
2227
+ interface OneOfMatcher {
2228
+ oneOf: string[];
2146
2229
  }
2147
- /** Smallest all-positive sample that can clear a one-sided exact sign test. */
2148
- export declare function minimumPairsForPairedDeltaTest(confidence?: number): number;
2230
+ type TextMatcher = string | RegExp | SerializedRegex | OneOfMatcher;
2149
2231
  /**
2150
- * Tests whether a paired candidate-minus-baseline delta clears a threshold.
2151
- *
2152
- * At 20 or more pairs, the percentile bootstrap lower bound carries the
2153
- * decision. Below that point the interval is descriptive only, so the function
2154
- * switches to a pre-registered one-sided exact sign test. The exact path is
2155
- * deliberately conservative: it requires both a point estimate above the
2156
- * threshold and enough consistently positive paired differences.
2157
- *
2158
- * ## A zero-width interval is never significant
2232
+ * Proposition over one span. All specified fields must match (AND); `not`
2233
+ * must NOT match. At least one field is required — an empty predicate would
2234
+ * match every span and is rejected.
2159
2235
  *
2160
- * When every paired delta is identical the resample distribution is a point
2161
- * mass and the interval collapses: `[0, 0]` when all pairs tie, `[g, g]` on n
2162
- * identical deltas of g. Neither says the effect is certain — both say the
2163
- * sample carries no information about how far the estimate could be wrong, and
2164
- * `low > threshold` then answers on the point estimate alone. It fails in both
2165
- * directions: `[0, 0]` clears every NEGATIVE threshold, which is how a
2166
- * tie-dominated pass/fail comparison laundered a regression into a
2167
- * noninferiority pass, and `[g, g]` clears every threshold below g with no
2168
- * spread behind it. Under a bounded asymmetric null whose true mean paired
2169
- * delta is exactly 0 — 2 % of pairs dropping by 1.0, the rest gaining 0.0204 —
2170
- * every sample that misses the drop is exactly that shape, and deciding on
2171
- * `low > 0` promoted 65.65 % of samples at n = 20 against a nominal 5 %.
2236
+ * `kind` compares against the span's contract kind (`TOOL`, `LLM`, `AGENT`,
2237
+ * ...), resolved by agent-trace-contract's classifier, so eval kinds
2238
+ * (`tool`, `llm`) and OTLP spans that declare no kind are read the same way.
2172
2239
  *
2173
- * So `indeterminate` is reported and `significant` is false whenever the
2174
- * interval has zero width, on BOTH paths: at small n the exact sign test is a
2175
- * test of the MEDIAN and a zero-spread sample is precisely where it stops
2176
- * saying anything about the mean the caller is thresholding.
2240
+ * `tool` resolves through {@link contractSpanToolName}; `model` through the
2241
+ * typed `model` field and the gen_ai model attributes.
2177
2242
  *
2178
- * `threshold` may be negative — that is a noninferiority margin, and it is the
2179
- * regime the zero-width hole is worst in. For a two-point (pass/fail) outcome
2180
- * the percentile bootstrap is not a valid interval at a nonzero margin at all;
2181
- * use {@link decidePairedPromotion}, which routes those to Tango's score
2182
- * interval, rather than thresholding this function's bootstrap directly.
2243
+ * `attr` values match by strict equality, or regex-test when the value is a
2244
+ * RegExp/SerializedRegex and the attribute is a string. Structured attribute
2245
+ * values need `custom`, or an `argument` rule for tool arguments.
2183
2246
  */
2184
- export declare function pairedDeltaTest(before: number[], after: number[], options?: PairedDeltaTestOptions): PairedDeltaTestResult;
2185
- //#endregion
2186
- //#region src/partition-held-out.d.ts
2187
- interface PartitionHeldOutOptions {
2188
- /** Partition seed. Bumping it reshuffles every assignment — do that only when
2189
- * the corpus/policy changes meaningfully so old and new records can't pair.
2190
- * Default 'held-out-v1'. */
2191
- seed?: string;
2192
- /** Fraction routed to the held-out bucket, in (0, 1). Default 0.5. */
2193
- holdoutFraction?: number;
2194
- /**
2195
- * Minimum held-out ids required for the split to be admissible. Below this,
2196
- * a paired comparison has too few observations to be significant, so the
2197
- * partition throws rather than hand back an underpowered holdout. Default 1
2198
- * (only the empty-holdout degenerate case is rejected). Raise it to enforce
2199
- * real statistical power. */
2200
- minHoldout?: number;
2201
- /** Same floor for the search side. Default 1. */
2202
- minSearch?: number;
2203
- }
2204
- interface HeldOutPartition {
2205
- /** Ids the optimizer is allowed to read/optimize against. */
2206
- search: string[];
2207
- /** Ids reserved for gated, held-out evaluation. */
2208
- holdout: string[];
2209
- seed: string;
2210
- holdoutFraction: number;
2247
+ interface SpanPredicate {
2248
+ name?: TextMatcher;
2249
+ tool?: TextMatcher;
2250
+ model?: TextMatcher;
2251
+ kind?: SpanKind;
2252
+ attr?: Record<string, unknown>;
2253
+ not?: SpanPredicate;
2254
+ custom?: (span: ContractSpan) => boolean;
2255
+ /** Stamped by the builder when `custom` is present. Survives JSON while
2256
+ * the function does not, so evaluation of a deserialized contract throws
2257
+ * instead of silently dropping the check. */
2258
+ requiresCustom?: true;
2211
2259
  }
2212
- /**
2213
- * Partition a list of stable ids into disjoint `search` / `holdout` sets by a
2214
- * deterministic hash. Fail-loud:
2215
- * - empty input throws,
2216
- * - duplicate ids throw (a dup would be observed on both sides, double-counting),
2217
- * - a holdout (or search) set below its floor throws (underpowered comparison).
2218
- *
2219
- * Order within each bucket follows the input order, so the result is stable and
2220
- * reproducible.
2221
- */
2222
- export declare function partitionHeldOut(ids: string[], options?: PartitionHeldOutOptions): HeldOutPartition;
2223
- interface TrainSelectionTestOptions<T> {
2224
- /** Partition seed. Bumping it reshuffles every unit. Default 'train-selection-test-v1'. */
2225
- seed?: string;
2226
- /** Share of units routed to selection, in (0, 1). Default 0.25. */
2227
- selectionFraction?: number;
2228
- /** Share of units routed to test, in (0, 1). Default 0.25. */
2229
- testFraction?: number;
2230
- /**
2231
- * The independent unit an item samples, such as the task a fresh run repeats.
2232
- * Every item of one unit lands in the same partition, so a final test never
2233
- * scores a unit the optimizer read. Default: the item id.
2234
- */
2235
- unitOf?: (item: T) => string;
2236
- /** Minimum items per partition. Defaults 1, 1 and 1. */
2237
- minTrain?: number;
2238
- minSelection?: number;
2239
- minTest?: number;
2260
+ declare const ORDER_MODES: readonly ['start-order', 'finish-before-start', 'all-occurrences'];
2261
+ type OrderMode = (typeof ORDER_MODES)[number];
2262
+ declare const ARGUMENT_OCCURRENCES: readonly ['first', 'last', 'any', 'all'];
2263
+ type ArgumentOccurrence = (typeof ARGUMENT_OCCURRENCES)[number];
2264
+ declare const ARGUMENT_TYPES: readonly ['string', 'number', 'boolean', 'object', 'array', 'null'];
2265
+ type ArgumentType = (typeof ARGUMENT_TYPES)[number];
2266
+ type ArgumentCheck = {
2267
+ op: 'exists';
2268
+ } | {
2269
+ op: 'equals';
2270
+ value: unknown;
2271
+ } | {
2272
+ op: 'oneOf';
2273
+ values: unknown[];
2274
+ } | {
2275
+ op: 'type';
2276
+ type: ArgumentType;
2277
+ };
2278
+ /** A tool whose calls change state outside the run. */
2279
+ interface RetryWrite {
2280
+ tool: string;
2281
+ /** RFC 6901 JSON Pointer to the idempotency key in the call's arguments.
2282
+ * Without it, a repeated call of this tool always fails. */
2283
+ idempotencyKey?: string;
2240
2284
  }
2241
- interface TrainSelectionTestPartition<T> {
2242
- /** Items an optimizer may learn from. */
2243
- train: T[];
2244
- /** Items an optimizer may use to accept candidates and stop. */
2245
- selection: T[];
2246
- /** Items reserved for the final comparison. */
2247
- test: T[];
2248
- seed: string;
2249
- selectionFraction: number;
2250
- testFraction: number;
2285
+ interface RunChecks {
2286
+ /** The run's status is `completed` and its end time is recorded. A failed
2287
+ * or aborted run fails this check. */
2288
+ requireCompleted?: boolean;
2289
+ /** The run's status must be one of these. */
2290
+ allowedStatuses?: RunStatus[];
2291
+ /** End minus start, in milliseconds. An unknown duration fails. */
2292
+ maxDurationMs?: number;
2251
2293
  }
2252
- /**
2253
- * Partition items into disjoint train, selection and test sets, the three
2254
- * partitions `compareOptimizationMethods` and Runtime `improve()` take.
2255
- *
2256
- * Assignment is per unit: `hashToUnit(unit, seed)` below `testFraction` is
2257
- * test, below `testFraction + selectionFraction` is selection, and the rest is
2258
- * train. A unit therefore keeps its partition as the corpus grows, and items of
2259
- * one unit never straddle two partitions. Fail-loud like `partitionHeldOut`:
2260
- * empty input, a duplicate or empty id, an empty unit, fractions outside
2261
- * (0, 1) or summing to 1 or more, and a partition below its floor all throw.
2262
- * Order within each partition follows the input order.
2263
- */
2264
- export declare function partitionTrainSelectionTest<T extends {
2265
- id: string;
2266
- }>(items: readonly T[], options?: TrainSelectionTestOptions<T>): TrainSelectionTestPartition<T>;
2267
- //#endregion
2268
- //#region src/product-benchmark/export.d.ts
2269
- interface ProductBenchmarkExportOptions {
2270
- /** Source eval run directories, each containing a `records.jsonl` of RunRecord rows. */
2271
- readonly runDirs: readonly string[];
2272
- /** Destination directory for the bundle (manifest + records + materialized source runs). */
2273
- readonly outDir: string;
2274
- readonly projectId: string;
2275
- readonly benchmarkId: string;
2276
- /** Repo-relative path of the product's canonical agent profile source. */
2277
- readonly agentProfilePath: string;
2278
- /** Pass threshold applied when a row carries no explicit `outcome.raw.pass`. Default 0.7. */
2279
- readonly passThreshold?: number;
2280
- /**
2281
- * First scenario tag. Defaults to `projectId` with a trailing `-agent`
2282
- * stripped (`tax-agent` → `tax`), matching the product exporters.
2283
- */
2284
- readonly scenarioTagPrefix?: string;
2285
- /** Profile id used when a row has no `agentProfile.profileId`. Defaults to the row's arm id. */
2286
- readonly fallbackProfileId?: string;
2287
- /** Arm mutable surfaces recorded in the manifest. Defaults to the full superset. */
2288
- readonly mutableSurfaces?: readonly string[];
2289
- /**
2290
- * Copy each run dir into `<outDir>/source-runs/` and record
2291
- * bundle-relative artifact paths (portable, self-contained). When false,
2292
- * artifacts keep absolute paths into the original run dirs. Default true.
2293
- */
2294
- readonly materializeSourceRuns?: boolean;
2294
+ type ContractRule = {
2295
+ kind: 'always' | 'never' | 'eventually';
2296
+ label: string;
2297
+ p: SpanPredicate;
2298
+ } | {
2299
+ kind: 'precedes';
2300
+ label: string;
2301
+ a: SpanPredicate;
2302
+ b: SpanPredicate;
2303
+ order?: OrderMode;
2304
+ } | {
2305
+ kind: 'neverUnless';
2306
+ label: string;
2307
+ p: SpanPredicate;
2308
+ prior: SpanPredicate;
2309
+ order?: OrderMode;
2310
+ } | {
2311
+ kind: 'atMost';
2312
+ label: string;
2313
+ p: SpanPredicate;
2314
+ max: number;
2315
+ } | {
2316
+ kind: 'tokensAtMost';
2317
+ label: string;
2318
+ p: SpanPredicate;
2319
+ max: number;
2320
+ } | ({
2321
+ kind: 'run';
2322
+ label: string;
2323
+ } & RunChecks) | {
2324
+ kind: 'argument';
2325
+ label: string;
2326
+ p: SpanPredicate;
2327
+ /** RFC 6901 JSON Pointer into the call's arguments; `''` is the whole value. */
2328
+ pointer: string;
2329
+ check: ArgumentCheck;
2330
+ /** Which matching calls must satisfy the check. Default `all`. */
2331
+ occurrence?: ArgumentOccurrence;
2332
+ } | {
2295
2333
  /**
2296
- * Override split classification for a row. Return undefined to fall back
2297
- * to the default (`outcome.raw.safety === 1` → safety, then splitTag).
2334
+ * The tools the harness offered the model (the OTel GenAI
2335
+ * `gen_ai.tool.definitions` attribute) are recorded, every tool call is
2336
+ * one of them, and, when `declared` is set, every offered tool is
2337
+ * declared. A trace that records no offered tools fails: what the
2338
+ * harness enforced is unknown.
2298
2339
  */
2299
- readonly classifySplit?: (record: RunRecord) => ProductBenchmarkSplit | undefined;
2300
- /** Recovers a tool-call count when the row's raw bag carries none (e.g. from turn artifacts). */
2301
- readonly toolCallFallback?: (record: RunRecord, runDir: string) => number;
2302
- /** Backend version recorded per row. Defaults to the cwd package.json's `@tangle-network/sandbox` range. */
2303
- readonly backendVersion?: string;
2340
+ kind: 'toolsOffered';
2341
+ label: string;
2342
+ declared?: string[];
2343
+ } | {
2304
2344
  /**
2305
- * Explicit substrate versions for the manifest, merged over what the cwd
2306
- * package.json / node_modules resolve. Use when a substrate package is not
2307
- * installed where the export runs — the validator refuses an `'unknown'`
2308
- * version, so provide the real one rather than shipping the sentinel.
2345
+ * A tool called again with the same arguments repeats its side effect.
2346
+ * A repeated `reads` call passes; a repeated `writes` call passes only
2347
+ * when every call carries the same idempotency key; a repeated call of
2348
+ * any other tool fails, because its side effect is unknown.
2309
2349
  */
2310
- readonly substrate?: Partial<ProductBenchmarkManifest['substrate']>;
2311
- }
2312
- interface ProductBenchmarkSingleRunExportOptions extends Omit<ProductBenchmarkExportOptions, 'runDirs'> {
2313
- readonly runDir: string;
2350
+ kind: 'retrySafe';
2351
+ label: string;
2352
+ reads?: string[];
2353
+ writes?: RetryWrite[];
2354
+ };
2355
+ /** One legitimate alternate path. The contract passes only when the base
2356
+ * rules pass and at least one alternative passes completely. */
2357
+ interface ContractAlternative {
2358
+ id: string;
2359
+ rules: ContractRule[];
2314
2360
  }
2315
- interface ProductBenchmarkExportResult {
2316
- readonly manifestPath: string;
2317
- readonly recordsPath: string;
2318
- readonly records: number;
2361
+ /** Serializable plain object — `traceContract(name)....build()` output. */
2362
+ interface TraceContract {
2363
+ name: string;
2364
+ /** What the contract protects, for reports and `explainTraceContract`. */
2365
+ description?: string;
2366
+ /** Evaluate only the span matching `root` and its descendants. Exactly one
2367
+ * span must match; zero or several make every rule an error. */
2368
+ scope?: {
2369
+ root: SpanPredicate;
2370
+ };
2371
+ rules: ContractRule[];
2372
+ alternatives?: ContractAlternative[];
2319
2373
  }
2320
- /** Repo identity from the exporting process's cwd. `'unknown'` values are flagged by `validateProductBenchmarkRun`. */
2321
- export declare function productBenchmarkRepoIdentity(): ProductBenchmarkManifest['repo'];
2322
- /** Single-run convenience wrapper over `exportProductBenchmarkRuns`. */
2323
- export declare function exportProductBenchmark(options: ProductBenchmarkSingleRunExportOptions): ProductBenchmarkExportResult;
2324
- /**
2325
- * Export one or more product eval run dirs into a validated product
2326
- * benchmark bundle at `outDir`. Both the manifest and every record are
2327
- * run through the contract validators before anything is written.
2328
- */
2329
- export declare function exportProductBenchmarkRuns(options: ProductBenchmarkExportOptions): ProductBenchmarkExportResult;
2330
- //#endregion
2331
- //#region src/product-benchmark/index.d.ts
2332
- declare const productBenchmarkSplits: readonly ['practice', 'dev', 'holdout', 'safety', 'sentinel'];
2333
- type ProductBenchmarkSplit = (typeof productBenchmarkSplits)[number];
2334
- interface ProductBenchmarkRepoRef {
2335
- readonly url: string;
2336
- readonly commit: string;
2337
- readonly branch: string;
2374
+ type ContractStatus = 'pass' | 'fail' | 'error';
2375
+ interface ContractViolation {
2376
+ rule: string;
2377
+ spanId?: string;
2378
+ detail: string;
2338
2379
  }
2339
- interface ProductBenchmarkSubstrateVersions {
2340
- readonly agentEval: string;
2341
- readonly agentRuntime: string;
2342
- readonly agentInterface: string;
2343
- readonly sandbox: string;
2344
- readonly agentBench?: string;
2380
+ /** What happened to one rule. `error` means it could not be evaluated. */
2381
+ interface ContractRuleExecution {
2382
+ rule: string;
2383
+ /** Set for rules inside `alternatives`. */
2384
+ alternative?: string;
2385
+ status: ContractStatus;
2386
+ violations: number;
2387
+ error?: string;
2345
2388
  }
2346
- interface ProductBenchmarkProfileRef {
2347
- readonly id: string;
2348
- readonly profileHash: string;
2349
- readonly agentProfilePath: string;
2389
+ interface ContractVerdict extends DefaultVerdict {
2390
+ /** Contract name — keys this verdict in multi-contract reports. */
2391
+ contract: string;
2392
+ status: ContractStatus;
2393
+ /** `status === 'pass'`. */
2394
+ valid: boolean;
2395
+ /** Fraction of rules that passed, in [0, 1]. An errored rule is not a pass. */
2396
+ score: number;
2397
+ /** 0|1 per evaluated base rule, keyed by label, plus `anyOf` when the
2398
+ * contract has alternatives. Errored rules are absent, never 0. */
2399
+ scores: Record<string, number>;
2400
+ violations: ContractViolation[];
2401
+ ruleExecutions: ContractRuleExecution[];
2402
+ /** Why rules errored, one line per errored rule or scope failure. */
2403
+ errors: string[];
2350
2404
  }
2351
- interface ProductBenchmarkArm {
2352
- readonly id: string;
2353
- readonly profileId: string;
2354
- readonly mutableSurfaces: readonly string[];
2355
- readonly policyAxes: Record<string, unknown>;
2405
+ interface ContractCheckResult {
2406
+ verdicts: ContractVerdict[];
2407
+ /** `error` if any verdict errored, else `fail` if any failed, else `pass`. */
2408
+ status: ContractStatus;
2409
+ allValid: boolean;
2356
2410
  }
2357
- interface ProductBenchmarkScenario {
2358
- readonly id: string;
2359
- readonly split: ProductBenchmarkSplit;
2360
- readonly tags: readonly string[];
2361
- readonly sourceAllowedForSynthesis: boolean;
2411
+ interface EvaluateTraceContractOptions {
2412
+ /** The run `run` rules read. Ignored under `scope`, where the scope root is the run. */
2413
+ run?: ContractRun;
2362
2414
  }
2363
- interface ProductBenchmarkBudgets {
2364
- readonly maxUsd: number;
2365
- readonly maxCells: number;
2366
- readonly maxWallMs: number;
2415
+ //#endregion
2416
+ //#region src/trace-contracts/builder.d.ts
2417
+ interface OrderOptions {
2418
+ order?: OrderMode;
2367
2419
  }
2368
- interface ProductBenchmarkManifest {
2369
- readonly schemaVersion: 1;
2370
- readonly projectId: string;
2371
- readonly benchmarkId: string;
2372
- readonly repo: ProductBenchmarkRepoRef;
2373
- readonly substrate: ProductBenchmarkSubstrateVersions;
2374
- readonly profiles: readonly ProductBenchmarkProfileRef[];
2375
- readonly arms: readonly ProductBenchmarkArm[];
2376
- readonly scenarios: readonly ProductBenchmarkScenario[];
2377
- readonly budgets: ProductBenchmarkBudgets;
2378
- readonly expectedArtifactDir: string;
2420
+ interface ArgumentRuleOptions {
2421
+ pointer: string;
2422
+ check: ArgumentCheck;
2423
+ occurrence?: ArgumentOccurrence;
2379
2424
  }
2380
- interface ProductBenchmarkValidationReport {
2381
- readonly manifestPath: string;
2382
- readonly recordsPath: string;
2383
- readonly records: number;
2384
- /** Manifest repo fields that are empty or the `'unknown'` export sentinel. */
2385
- readonly repoFailures: readonly string[];
2386
- /** Manifest substrate versions that are empty or the `'unknown'` export
2387
- * sentinel — a bundle without substrate identity is not reproducible. */
2388
- readonly substrateFailures: readonly string[];
2389
- readonly projects: readonly string[];
2390
- readonly benchmarks: readonly string[];
2391
- readonly arms: readonly string[];
2392
- readonly scenarios: readonly string[];
2393
- readonly passed: number;
2394
- readonly failed: number;
2395
- readonly inputTokens: number;
2396
- readonly outputTokens: number;
2397
- readonly costUsd: number;
2398
- readonly wallMs: number;
2399
- readonly integrityFailures: readonly string[];
2400
- readonly missingArtifacts: readonly string[];
2425
+ declare class TraceContractBuilder {
2426
+ private readonly name;
2427
+ private readonly rules;
2428
+ private readonly alternativeList;
2429
+ private scopeRoot;
2430
+ constructor(name: string);
2431
+ /** Every span in the trace must satisfy `p`. */
2432
+ always(p: SpanPredicate, label?: string): this;
2433
+ /** No span in the trace may satisfy `p`. */
2434
+ never(p: SpanPredicate, label?: string): this;
2435
+ /** At least one span in the trace must satisfy `p`. */
2436
+ eventually(p: SpanPredicate, label?: string): this;
2437
+ /** Both `a` and `b` must occur, with `a` first under `options.order`
2438
+ * (default `start-order`). For "every `b` needs an earlier `a`, and a run
2439
+ * without `b` passes", use {@link neverUnless}. */
2440
+ precedes(a: SpanPredicate, b: SpanPredicate, label?: string, options?: OrderOptions): this;
2441
+ /** Every `p`-match needs an earlier `prior`-match; a run without `p` passes. */
2442
+ neverUnless(p: SpanPredicate, prior: SpanPredicate, label?: string, options?: OrderOptions): this;
2443
+ /** At most `max` spans may satisfy `p`. */
2444
+ atMost(p: SpanPredicate, max: number, label?: string): this;
2445
+ /** Spans satisfying `p` may use at most `max` input+output tokens in total. */
2446
+ tokensAtMost(p: SpanPredicate, max: number, label?: string): this;
2447
+ /** Terminal status and duration of the run. */
2448
+ run(checks: RunChecks, label?: string): this;
2449
+ /** A JSON Pointer check on the arguments of calls matching `p`. */
2450
+ argument(p: SpanPredicate, options: ArgumentRuleOptions, label?: string): this;
2451
+ /** The trace records the tools offered to the model, every call is one of
2452
+ * them, and, with `declared`, every offered tool is declared. */
2453
+ toolsOffered(declared?: string[], label?: string): this;
2454
+ /** No call repeats a side effect that is not proven safe to repeat. */
2455
+ retrySafe(options: {
2456
+ reads?: string[];
2457
+ writes?: RetryWrite[];
2458
+ }, label?: string): this;
2459
+ /** Evaluate only the subtree rooted at the one span matching `root`. */
2460
+ scope(root: SpanPredicate): this;
2461
+ /** A named alternate path; at least one alternative must pass completely. */
2462
+ alternative(id: string, define: (branch: TraceContractBuilder) => TraceContractBuilder): this;
2463
+ build(): TraceContract;
2464
+ private where;
2465
+ private add;
2401
2466
  }
2402
- export declare function readProductBenchmarkManifest(path: string): ProductBenchmarkManifest;
2467
+ export declare function traceContract(name: string): TraceContractBuilder;
2468
+ //#endregion
2469
+ //#region src/trace-contracts/evaluate.d.ts
2403
2470
  /**
2404
- * Fail-loud gate over a bundle directory: locates the manifest + records,
2405
- * runs `validateProductBenchmarkRun`, and throws with every repo,
2406
- * integrity, and artifact failure listed. Returns the report when clean.
2471
+ * Evaluate one contract over a span sequence. Pure and synchronous — works on
2472
+ * `Span[]` from a TraceStore, `contractSpansFromOtlp` output, or any array
2473
+ * satisfying `ContractSpan`. Throws
2474
+ * `ValidationError` for a malformed contract; a rule that cannot be evaluated
2475
+ * is reported as `error` in the verdict instead.
2407
2476
  */
2408
- export declare function assertProductBenchmarkRun(runDir: string): ProductBenchmarkValidationReport;
2477
+ export declare function evaluateTraceContract(contract: TraceContract, spans: readonly ContractSpan[], options?: EvaluateTraceContractOptions): ContractVerdict;
2478
+ /**
2479
+ * Evaluate many contracts over one span sequence. Throws on an empty
2480
+ * contract list — `allValid: true` over zero contracts is a silent pass.
2481
+ */
2482
+ export declare function checkTraceContracts(spans: readonly ContractSpan[], contracts: readonly TraceContract[], options?: EvaluateTraceContractOptions): ContractCheckResult;
2483
+ //#endregion
2484
+ //#region src/trace-contracts/explain.d.ts
2485
+ /** Plain-language statement of everything a contract checks, one rule per line. */
2486
+ export declare function explainTraceContract(contract: TraceContract): string;
2409
2487
  //#endregion
2410
- //#region src/runtime-trajectory.d.ts
2411
- interface RuntimeTrajectoryHookEvent {
2412
- id: string;
2413
- runId: string;
2414
- scenarioId?: string;
2415
- target: string;
2416
- phase: string;
2417
- timestamp: number;
2418
- stepIndex?: number;
2419
- parentId?: string;
2420
- payload?: unknown;
2421
- metadata?: Record<string, unknown>;
2488
+ //#region src/trace-contracts/spec.d.ts
2489
+ interface ToolArgumentSpec {
2490
+ tool: string;
2491
+ /** RFC 6901 JSON Pointer into the call's arguments; `''` is the whole value. */
2492
+ pointer: string;
2493
+ /** Which calls must satisfy the check. Default `all`. */
2494
+ occurrence?: ArgumentOccurrence;
2495
+ /** Exactly one of `exists`, `equals`, `oneOf`, `type`. */
2496
+ exists?: true;
2497
+ equals?: unknown;
2498
+ oneOf?: unknown[];
2499
+ type?: ArgumentType;
2422
2500
  }
2423
- interface RuntimeTrajectoryRecord {
2424
- id?: string;
2425
- scenarioId?: string;
2426
- splitTag?: RunSplitTag;
2427
- runtimeEvents?: unknown;
2428
- [key: string]: unknown;
2501
+ interface ToolsSpec {
2502
+ /** Each must be called at least once. */
2503
+ required?: string[];
2504
+ /** None may be called. */
2505
+ forbidden?: string[];
2506
+ /** Every tool call must name one of these; a call without a name fails. */
2507
+ allowed?: string[];
2508
+ /** Ceiling on tool calls of any name. */
2509
+ maxCalls?: number;
2510
+ /** Ceiling per tool name. */
2511
+ maxCallsPerTool?: Record<string, number>;
2512
+ /** Each tool is called, and each comes before the next under `orderMode`. */
2513
+ requiredOrder?: string[];
2514
+ /** Default `start-order`. */
2515
+ orderMode?: OrderMode;
2516
+ arguments?: ToolArgumentSpec[];
2517
+ /** The trace records the tools the harness offered the model
2518
+ * (`gen_ai.tool.definitions`), every call is one of them, and, with
2519
+ * `allowed`, every offered tool is allowed. */
2520
+ enforced?: true;
2429
2521
  }
2430
- interface RuntimeTrajectoryRunRecord {
2431
- runId: string;
2432
- scenarioId?: string;
2433
- splitTag: RunSplitTag;
2522
+ interface RetriesSpec {
2523
+ /** Tools that change nothing outside the run: repeating a call is safe. */
2524
+ reads?: string[];
2525
+ /** Tools that change state outside the run: a repeated call must carry one
2526
+ * idempotency key. Any other tool called twice with the same arguments fails. */
2527
+ writes?: RetryWrite[];
2434
2528
  }
2435
- interface RuntimeTrajectoryEvidenceSummary {
2436
- recordCount: number;
2437
- recordWithRuntimeEventsCount: number;
2438
- runtimeRunCount: number;
2439
- lifecycleEventCount: number;
2440
- defaultedSplitCount: number;
2529
+ interface LlmSpec {
2530
+ maxCalls?: number;
2531
+ /** Input plus output tokens across LLM calls; an unrecorded count fails. */
2532
+ maxTotalTokens?: number;
2533
+ /** Every LLM call must name one of these models; a call without one fails. */
2534
+ allowedModels?: string[];
2441
2535
  }
2442
- interface RuntimeTrajectoryEvidenceProjection {
2443
- runs: RuntimeTrajectoryRunRecord[];
2444
- events: RuntimeTrajectoryHookEvent[];
2445
- summary: RuntimeTrajectoryEvidenceSummary;
2446
- diagnostics: string[];
2536
+ /** The checks one path carries: the base contract or one alternative. */
2537
+ interface PathSpec {
2538
+ run?: RunChecks;
2539
+ tools?: ToolsSpec;
2540
+ llm?: LlmSpec;
2541
+ retries?: RetriesSpec;
2542
+ /** Low-level rules in their serialized form. */
2543
+ rules?: ContractRule[];
2447
2544
  }
2448
- interface ProjectRuntimeTrajectoryEvidenceOptions<TRecord extends RuntimeTrajectoryRecord = RuntimeTrajectoryRecord> {
2449
- records: TRecord[];
2450
- defaultSplitTag?: RunSplitTag;
2451
- recordIdOf?: (record: TRecord, index: number) => string | undefined;
2452
- scenarioIdOf?: (record: TRecord, index: number) => string | undefined;
2545
+ interface AlternativeSpec extends PathSpec {
2546
+ id: string;
2453
2547
  }
2454
- export declare function projectRuntimeTrajectoryEvidence<TRecord extends RuntimeTrajectoryRecord>(options: ProjectRuntimeTrajectoryEvidenceOptions<TRecord>): RuntimeTrajectoryEvidenceProjection;
2548
+ interface TraceContractSpec extends PathSpec {
2549
+ name: string;
2550
+ description?: string;
2551
+ /** Check only the one span matching `root` and its descendants: one
2552
+ * sub-agent (`{ "kind": "AGENT", "name": "researcher" }`) or one search
2553
+ * node (`{ "attr": { "agent.branch.id": "n7" } }`). */
2554
+ scope?: {
2555
+ root: SpanPredicate;
2556
+ };
2557
+ /** At least one alternative must pass completely, as well as the base checks. */
2558
+ alternatives?: {
2559
+ anyOf: AlternativeSpec[];
2560
+ };
2561
+ }
2562
+ /**
2563
+ * Parse and compile a declarative contract. Throws `ValidationError` naming
2564
+ * the path of the first problem: an unknown key, a wrong type, an unknown
2565
+ * status, or a contract that checks nothing.
2566
+ */
2567
+ export declare function compileTraceContractSpec(input: unknown): TraceContract;
2568
+ interface ContractLintFinding {
2569
+ /** `error`: the contract can never pass, or contradicts itself.
2570
+ * `warning`: the contract works but likely does not say what was meant. */
2571
+ level: 'error' | 'warning';
2572
+ code: string;
2573
+ path: string;
2574
+ message: string;
2575
+ }
2576
+ /**
2577
+ * Find contradictions and likely mistakes in a declarative contract. Parses
2578
+ * strictly first, so a malformed spec throws instead of linting.
2579
+ */
2580
+ export declare function lintTraceContractSpec(input: unknown): ContractLintFinding[];
2455
2581
  //#endregion
2456
2582
  //#region src/action-policy.d.ts
2457
2583
  interface ActionExecutionPolicy {
@@ -3374,375 +3500,347 @@ interface VerdictCacheStore {
3374
3500
  */
3375
3501
  export declare function fileVerdictCache(path: string): VerdictCacheStore;
3376
3502
  //#endregion
3377
- //#region src/anti-slop.d.ts
3378
- interface AntiSlopConfig {
3379
- /** Domain label — appears in the JudgeScore output */
3380
- domain?: string;
3381
- /** Case-insensitive substrings that must not appear. Each occurrence = penalty. */
3382
- bannedPhrases?: string[];
3383
- /** Regexes matching opening formulas to penalize (e.g. /^great question/i). */
3384
- bannedOpenings?: RegExp[];
3385
- /** Regexes matching hedges (e.g. /i could be wrong/i). Ratio of hedged sentences drives score. */
3386
- hedgingPatterns?: RegExp[];
3387
- /** Regexes matching apology padding. */
3388
- apologyPatterns?: RegExp[];
3389
- /** Fraction of sentences that can be duplicates before penalty (default 0.15 = 15%). */
3390
- repetitionThreshold?: number;
3391
- /** Min output length in chars; below this the turn is deemed too terse. */
3392
- minLength?: number;
3393
- /** Max output length in chars; above this the turn is deemed too verbose. */
3394
- maxLength?: number;
3395
- /** How heavily each violation class reduces the score (default 1). */
3396
- penaltyWeights?: Partial<Record<SlopCategory, number>>;
3397
- }
3398
- type SlopCategory = 'banned_phrase' | 'banned_opening' | 'hedging' | 'apology' | 'repetition' | 'length';
3399
- /** Create a reusable Judge function from an anti-slop config. */
3400
- export declare function createAntiSlopJudge(config?: AntiSlopConfig): JudgeFn;
3401
- interface AntiSlopIssue {
3402
- category: SlopCategory;
3403
- detail: string;
3404
- example?: string;
3405
- }
3406
- interface AntiSlopReport {
3407
- /** 0–10 score; 10 is clean, lower values mean more slop. */
3408
- score: number;
3409
- issues: AntiSlopIssue[];
3410
- /** Count of each category for programmatic aggregation. */
3411
- counts: Record<SlopCategory, number>;
3412
- }
3413
- /**
3414
- * Pure function — analyze one or more outputs against the config. Exposed
3415
- * separately so consumers can build their own reporters on top.
3416
- */
3417
- export declare function analyzeAntiSlop(outputs: string[], config: Omit<Required<AntiSlopConfig>, 'domain'> & {
3418
- penaltyWeights: Record<SlopCategory, number>;
3419
- }): AntiSlopReport;
3420
- //#endregion
3421
- //#region src/eval-trace-store.d.ts
3422
- /**
3423
- * Backing persistence for `EvalTraceStore`. The in-memory store is the default;
3424
- * the JSONL file store appends one validated `RunRecord` per line. Both keep an
3425
- * append order so `getBest` / `compareRuns` are reproducible.
3426
- */
3427
- interface RunRecordBackend {
3428
- append(record: RunRecord): Promise<void>;
3429
- load(): Promise<RunRecord[]>;
3430
- }
3503
+ //#region src/profile/baselines.d.ts
3431
3504
  /**
3432
- * JSONL-backed store at `path`, one `RunRecord` per line. Malformed lines fail
3433
- * loud on load (a corrupt corpus must not silently shrink the analysis set);
3434
- * pass `skipInvalid` only for forensics on a known-bad file.
3505
+ * Strong, generically-useful baseline ROLES — the top zone of an `AgentProfile`
3506
+ * before any domain layer. A product composes one of these with its own
3507
+ * environment description (its sandbox) and its domain guidance, which lives in
3508
+ * the product repo (not here): a profile is `<baseline role> + <environment> +
3509
+ * <domain sections>`. Domain strength is NOT generalized into the substrate —
3510
+ * it is lifted here only once ≥2 products genuinely reuse it.
3511
+ *
3512
+ * Three roles cover the common shapes:
3513
+ * - `engineerRole` — builds + verifies real artifacts in a sandbox. Distilled
3514
+ * from agent-runtime's `coderProfile` doctrine (minimal
3515
+ * correct change, run the checks, fix the root cause,
3516
+ * never weaken a test or hide an error).
3517
+ * - `researcherRole` — gathers from real sources and grounds every claim
3518
+ * (cite or mark inferred; never fabricate).
3519
+ * - `generalistRole` — a strong default: helpful, grounded, verify-before-assert.
3520
+ *
3521
+ * All three are verification-first and domain-agnostic. They describe HOW a
3522
+ * capable IC operates, not WHAT domain it works in.
3435
3523
  */
3436
- export declare function jsonlRunRecordBackend(path: string, opts?: {
3437
- skipInvalid?: boolean;
3438
- }): RunRecordBackend;
3439
- //#endregion
3440
- //#region src/integrity/preflight.d.ts
3441
- interface ModelPreflight {
3442
- /** The model id as supplied by the caller. */
3443
- model: string;
3444
- /** Membership in the `{baseUrl}/models` served set. */
3445
- listed: boolean;
3446
- /**
3447
- * The router reached a provider for this model. `null` when `probe` was not
3448
- * requested. True on a 2xx, and also when the provider answered by
3449
- * exhausting its reasoning budget — that proves reachability while leaving
3450
- * identity unproven (see `budgetExhausted`).
3451
- */
3452
- served: boolean | null;
3453
- /** HTTP status of the probe. `null` when not probed. */
3454
- status: number | null;
3455
- /** Probe body's `error.message` when present, else `null`. */
3456
- detail: string | null;
3457
- /**
3458
- * The probe died on the token budget rather than on the model. Identity is
3459
- * unproven, not refuted: raise `probeMaxTokens` to resolve it.
3460
- */
3461
- budgetExhausted: boolean;
3462
- /**
3463
- * Identity of the model that answered the probe, compared against `model`.
3464
- * `null` when the model was not probed or the probe failed.
3465
- */
3466
- substitution: ServedModelCheck | null;
3467
- }
3468
- /** One check Agent Eval asks the caller's endpoint to perform. */
3469
- type ModelEndpointCheck = {
3470
- readonly kind: 'list-models';
3471
- } | {
3472
- readonly kind: 'probe';
3473
- readonly model: string;
3474
- /** Output-token budget the probe completion may bill. */
3475
- readonly maxOutputTokens: number;
3524
+ /** Senior-IC engineer operating in a sandbox — produces real artifacts and
3525
+ * verifies them before declaring done. The shared operator foundation for any
3526
+ * file-producing, tool-using product agent. */
3527
+ declare const engineerRole: string;
3528
+ /** Researcher who grounds every claim in real sources — gathers, cites, and
3529
+ * distinguishes verified fact from inference. */
3530
+ declare const researcherRole: string;
3531
+ /** Strong general-purpose default — helpful, grounded, verifies before asserting. */
3532
+ declare const generalistRole: string;
3533
+ /** The named baseline roles, for selection by key (e.g. from a product config). */
3534
+ declare const BASELINE_ROLES: {
3535
+ readonly engineer: string;
3536
+ readonly researcher: string;
3537
+ readonly generalist: string;
3476
3538
  };
3477
- /**
3478
- * Caller-owned request into the model endpoint. The caller binds the base URL
3479
- * and the credential and returns the raw `Response`; a `list-models` request
3480
- * answers with an OpenAI-compatible `{ data: [{ id }] }` body, and a `probe`
3481
- * request answers with one minimal chat completion for `model`.
3482
- */
3483
- type ModelEndpointRequest = (check: ModelEndpointCheck) => Promise<Response>;
3484
- interface PreflightModelsOptions {
3485
- /** Caller-owned endpoint request. Agent Eval issues no provider HTTP itself. */
3486
- request: ModelEndpointRequest;
3487
- /** Model ids to check. */
3488
- models: string[];
3489
- /** When true, additionally spend a small chat probe per model. Default false. */
3490
- probe?: boolean;
3491
- /**
3492
- * Output-token budget per probe. Default `PROBE_MAX_TOKENS`. Lowering it
3493
- * below the reasoning floor makes healthy reasoning models report
3494
- * `budgetExhausted` instead of proving their identity.
3495
- */
3496
- probeMaxTokens?: number;
3539
+ type BaselineRoleKey = keyof typeof BASELINE_ROLES;
3540
+ declare namespace index_d_exports {
3541
+ export { AgentProfileSection, BASELINE_ROLES, BaselineRoleKey, ProfileSkill, PromptProfile, applyDomainPatch, baselineProfile, baselineProfileFromRole, engineerRole, generalistRole, prodProfile, profileToSurface, renderProfile, researcherRole, sectionHash };
3497
3542
  }
3498
- interface PreflightOutcome {
3499
- succeeded: boolean;
3500
- value: ModelPreflight[] | null;
3501
- error: string | null;
3543
+ /** A named, addressable region of the system prompt. `evolvable` marks whether
3544
+ * the self-improvement loop is allowed to patch its body; fixed scaffolding
3545
+ * (e.g. a compliance preamble) sets `evolvable: false`. */
3546
+ interface AgentProfileSection {
3547
+ id: string;
3548
+ title: string;
3549
+ body: string;
3550
+ evolvable: boolean;
3551
+ }
3552
+ /** A skill the agent can invoke. `triggers` are the phrases/conditions that
3553
+ * should activate it; `scriptsDir` points at its executable scripts when the
3554
+ * skill ships code (mirrors Harvey's `skills/<name>/scripts/`). */
3555
+ interface ProfileSkill {
3556
+ name: string;
3557
+ description: string;
3558
+ triggers: string[];
3559
+ scriptsDir?: string;
3560
+ }
3561
+ /** The structured system prompt. The first four fields are fixed scaffolding;
3562
+ * `domain` is the evolvable surface the loop optimizes. */
3563
+ interface PromptProfile {
3564
+ role: string;
3565
+ environment: string;
3566
+ toolConventions: string;
3567
+ skills: ProfileSkill[];
3568
+ domain: AgentProfileSection[];
3502
3569
  }
3503
3570
  /**
3504
- * Check that `models` are reachable on the router. Returns a typed outcome —
3505
- * a network failure yields `{ succeeded: false, error }`, never a throw and
3506
- * never a partial result silently reported as success. No retries, no
3507
- * fallbacks.
3508
- *
3509
- * The membership check (one GET) always runs. When `probe` is true, each model
3510
- * additionally gets a small chat probe so a model that is listed but
3511
- * unconfigured (a 401 `model_not_found` from the router) is caught.
3571
+ * Emit the sectioned system prompt in fixed order: role text, then
3572
+ * `## Environment`, `## Tool conventions`, `## Skills` (each skill as
3573
+ * `### <name>` + description + triggers), `## Domain guidance` (each section as
3574
+ * `### <title>` + body). The order is load-bearing — the loop diffs rendered
3575
+ * text, and reordering would make every candidate look like a full rewrite.
3512
3576
  */
3513
- export declare function preflightModels(opts: PreflightModelsOptions): Promise<PreflightOutcome>;
3514
- //#endregion
3515
- //#region src/model-seats.d.ts
3516
- interface ModelSeats {
3517
- /** The model under evaluation — what the agent itself dispatches with. */
3518
- worker?: string;
3519
- /** Judge-panel model ids — thread into `ensembleJudge({ models })`. */
3520
- judges?: string[];
3521
- /** Analyst model — `analyzeRuns` / analyst-registry LLM calls. */
3522
- analyst?: string;
3523
- /** Reflection or candidate-generation model. */
3524
- reflection?: string;
3525
- /** Verifier model — completion/objective checking. */
3526
- verifier?: string;
3527
- }
3528
- type SeatName = keyof ModelSeats;
3577
+ declare function renderProfile(p: PromptProfile): string;
3578
+ /** The string `MutableSurface` the self-improvement loop scores — a profile
3579
+ * renders to exactly the text a candidate is graded on. */
3580
+ declare function profileToSurface(p: PromptProfile): string;
3529
3581
  /**
3530
- * Tier presets — plain data, swap or spread freely.
3531
- *
3532
- * A preset names REQUESTED ids, and a requested id is NOT a guarantee of
3533
- * family, of provider, or of liveness. A routing gateway can accept any id
3534
- * below and answer from a different model on HTTP 200, with only the response
3535
- * body's `model` field betraying the swap. The served assertion is the
3536
- * guarantee: gate a run on `assertModelsServed({ probe: true })` and assert
3537
- * `assertServedModel` per call. `assertCrossFamily` over these ids proves the
3538
- * configuration is diverse; only `assertCrossFamilyServed` over the ids that
3539
- * ANSWERED proves the run was.
3540
- *
3541
- * `economy` names ids a live router probe answered from the provider their
3542
- * name implies, so the judge trio spanned three provider families (deepseek /
3543
- * zhipu / google) as configured and, at that probe, as served. A preset is
3544
- * only as good as its last probe: ids go dead and start resolving elsewhere
3545
- * without notice, so re-probe rather than trusting this list.
3546
- *
3547
- * `frontier` is deliberately EMPTY: entitled frontier ids vary per router
3548
- * account, and a hardcoded claude/gpt-5 id 401s on keys that lack it. Supply
3549
- * your own: `{ ...seatPresets.frontier, worker: '<your-frontier-id>', … }` —
3550
- * `resolveSeat` throws on every seat you haven't filled.
3582
+ * The fixed-scaffolding baseline: a `role`/`environment`/`toolConventions`
3583
+ * profile with the stock skill roster and NO domain guidance. The
3584
+ * production profile is this plus shipped domain sections.
3551
3585
  */
3552
- export declare const seatPresets: Record<'economy' | 'frontier', ModelSeats>;
3586
+ declare function baselineProfile(args: {
3587
+ role: string;
3588
+ environment?: string;
3589
+ toolConventions?: string;
3590
+ skills?: ProfileSkill[];
3591
+ }): PromptProfile;
3553
3592
  /**
3554
- * Read one seat. Blank strings and empty arrays count as unset (env-var
3555
- * plumbing produces them); malformed values (non-string seat, non-array or
3556
- * blank-entry `judges`) throw `ValidationError`. When the seat is unset, an
3557
- * explicit `fallback` is returned (`[fallback]` for `judges` — a one-model
3558
- * panel); without one, `SeatUnsetError`.
3593
+ * Baseline from one of the strong generic roles (`'engineer' | 'researcher' |
3594
+ * 'generalist'`) — the common case: pick a role foundation, optionally override
3595
+ * the environment to describe THIS product's sandbox, then layer domain via
3596
+ * `prodProfile`. Domain guidance stays in the product repo; this only supplies
3597
+ * the generically-useful role + stock scaffolding.
3559
3598
  */
3560
- export declare function resolveSeat(seats: ModelSeats, seat: 'judges', fallback?: string): string[];
3561
- export declare function resolveSeat(seats: ModelSeats, seat: Exclude<SeatName, 'judges'>, fallback?: string): string;
3562
- export declare function resolveSeat(seats: ModelSeats, seat: SeatName, fallback?: string): string | string[];
3599
+ declare function baselineProfileFromRole(role: BaselineRoleKey, args?: {
3600
+ environment?: string;
3601
+ toolConventions?: string;
3602
+ skills?: ProfileSkill[];
3603
+ }): PromptProfile;
3604
+ /** The production profile: the baseline scaffolding plus the domain sections
3605
+ * shipped after self-improvement. Differs from the baseline ONLY in `domain`
3606
+ * (and any skills the caller layered into the baseline) — the role,
3607
+ * environment, and tool conventions are carried through unchanged. */
3608
+ declare function prodProfile(baseline: PromptProfile, shipped: AgentProfileSection[]): PromptProfile;
3609
+ /**
3610
+ * Section-scoped edit — replace the body of ONE domain section by id, leaving
3611
+ * every other section byte-identical. This is how the loop targets a single
3612
+ * evolvable surface. Throws on an unknown section id (a patch that hits no
3613
+ * section is a silent no-op otherwise — fail loud). Throws when the targeted
3614
+ * section is `evolvable: false`.
3615
+ */
3616
+ declare function applyDomainPatch(p: PromptProfile, sectionId: string, newBody: string): PromptProfile;
3617
+ /**
3618
+ * Content hash of a single section — its loop identity. Delegates to the
3619
+ * campaign provenance `surfaceContentHash` (the same helper the loop's
3620
+ * provenance record uses for full surfaces), so a section hash is byte-for-byte
3621
+ * comparable with the `sha256:`-prefixed content hashes that record carries.
3622
+ * Two sections that render identically (same title + body) share a hash; the
3623
+ * `id` and `evolvable` flag are excluded — they are routing metadata, not
3624
+ * content.
3625
+ */
3626
+ declare function sectionHash(section: AgentProfileSection): string;
3563
3627
  //#endregion
3564
- //#region src/prompt-registry.d.ts
3628
+ //#region src/budget-guard.d.ts
3629
+ export declare class BudgetBreachError extends AgentEvalError {
3630
+ dimension: keyof BudgetSpec;
3631
+ limit: number;
3632
+ attempted: number;
3633
+ constructor(dimension: keyof BudgetSpec, limit: number, attempted: number);
3634
+ }
3635
+ export declare class BudgetGuard {
3636
+ private consumed;
3637
+ private emitter;
3638
+ private budget;
3639
+ private startedAt;
3640
+ constructor(emitter: TraceEmitter, budget: BudgetSpec, now?: () => number);
3641
+ /** Record consumption. Throws `BudgetBreachError` if any dimension exceeds its cap. */
3642
+ charge(delta: Partial<Record<keyof BudgetSpec, number>>, spanId?: string): Promise<void>;
3643
+ /** Convenience: advance wall-clock budget based on elapsed wall time. */
3644
+ tickWall(nowMs: number, spanId?: string): Promise<void>;
3645
+ get state(): Record<keyof BudgetSpec, number>;
3646
+ }
3647
+ //#endregion
3648
+ //#region src/client.d.ts
3565
3649
  /**
3566
- * Versioned prompt registry.
3650
+ * ProductClient — configurable HTTP client for exercising any agent's APIs.
3567
3651
  *
3568
- * Every prompt used in an eval run is registered with an explicit version.
3569
- * Reports include the content hash so A/B compares are rigorous: if the
3570
- * hash changes between two reports, the prompt actually changed; if it
3571
- * matches, the variance is elsewhere.
3652
+ * Routes are config, not hardcoded. Each agent provides its own RouteMap.
3572
3653
  *
3573
- * Hash is SHA-256(content), truncated to 12 hex chars for readability.
3574
- * Uses the Web Crypto API (works in Workers, Node 22+, browsers).
3654
+ * @deprecated A one-product REST client does not belong in the generic
3655
+ * substrate. Moves to the product repo in the next major
3656
+ * (tangle-network/agent-runtime#694); vendor it if you construct it directly.
3575
3657
  */
3576
- interface PromptHandle {
3577
- /** Stable human-readable id, e.g. 'browser.system' */
3578
- id: string;
3579
- /** Caller-chosen version string, e.g. 'v3' or '2026-04-20' */
3580
- version: string;
3581
- /** SHA-256 of content, 12-hex-char prefix */
3582
- hash: string;
3583
- /** Full prompt body */
3584
- content: string;
3585
- }
3586
- export declare class PromptRegistry {
3587
- private readonly entries;
3658
+ export declare class ProductClient {
3659
+ private baseUrl;
3660
+ private routes;
3661
+ private cookies;
3662
+ private timeoutMs;
3663
+ constructor(config: ProductClientConfig);
3664
+ private route;
3588
3665
  /**
3589
- * Register a prompt. Re-registering the same id+version with DIFFERENT
3590
- * content throws — versions are immutable. Re-registering with the SAME
3591
- * content is a no-op (idempotent).
3666
+ * Single HTTP boundary for every JSON request. Aborts after `timeoutMs`,
3667
+ * checks `res.ok` BEFORE parsing, and throws `${method} ${path} failed:
3668
+ * HTTP ${status} — ${body}` on a non-ok response so a 4xx/5xx error body
3669
+ * can never be parsed as a success shape. Callers inspect the resolved
3670
+ * value only after a successful return.
3592
3671
  */
3593
- register(id: string, version: string, content: string): Promise<PromptHandle>;
3594
- /** Look up a registered prompt. Throws if unknown — no implicit defaults. */
3595
- get(id: string, version: string): PromptHandle;
3596
- /** Return all versions of an id, newest-first (lex-descending on version). */
3597
- listVersions(id: string): PromptHandle[];
3598
- /** Snapshot the whole registry — useful for including in reports. */
3599
- list(): PromptHandle[];
3600
- /** Verify a hash against registered content. Returns null if not found. */
3601
- verifyHash(id: string, version: string, expectedHash: string): boolean | null;
3672
+ private request;
3673
+ /**
3674
+ * Read a required collection field. A missing/non-array field is a contract
3675
+ * violation (wrong route, drift, partial body) — surface it loud instead of
3676
+ * masking it as a healthy empty set. A genuinely empty `[]` passes through.
3677
+ */
3678
+ private requireArray;
3679
+ signup(name: string, email: string, password: string): Promise<{
3680
+ userId: string;
3681
+ }>;
3682
+ login(email: string, password: string): Promise<void>;
3683
+ createWorkspace(name: string, type?: string): Promise<string>;
3684
+ createThread(workspaceId: string): Promise<string>;
3685
+ chat(workspaceId: string, threadId: string, content: string, _opts?: {
3686
+ blockPatterns?: RegExp[];
3687
+ }): Promise<{
3688
+ text: string;
3689
+ blocks: {
3690
+ type: string;
3691
+ title: string;
3692
+ }[];
3693
+ }>;
3694
+ getTasks(workspaceId: string): Promise<{
3695
+ id: string;
3696
+ title: string;
3697
+ status: string;
3698
+ priority: string;
3699
+ }[]>;
3700
+ getEvents(workspaceId: string): Promise<{
3701
+ id: string;
3702
+ title: string;
3703
+ type: string;
3704
+ }[]>;
3705
+ getApprovals(workspaceId: string): Promise<{
3706
+ id: string;
3707
+ title: string;
3708
+ status: string;
3709
+ type: string;
3710
+ }[]>;
3711
+ getVaultTree(workspaceId: string): Promise<string[]>;
3712
+ approveAction(workspaceId: string, id: string): Promise<void>;
3713
+ rejectAction(workspaceId: string, id: string, reason: string): Promise<void>;
3714
+ getGenerations(workspaceId: string): Promise<{
3715
+ id: string;
3716
+ type: string;
3717
+ prompt: string;
3718
+ }[]>;
3719
+ /** Generic GET for custom routes */
3720
+ get(path: string): Promise<Record<string, unknown>>;
3721
+ /** Generic POST for custom routes */
3722
+ post(path: string, body: Record<string, unknown>): Promise<Record<string, unknown>>;
3723
+ /** Generic PATCH for custom routes */
3724
+ patch(path: string, body: Record<string, unknown>): Promise<Record<string, unknown>>;
3602
3725
  }
3603
- /** SHA-256(content) → first 12 hex chars. Stable across runtimes. */
3604
- export declare function hashContent(content: string): Promise<string>;
3605
3726
  //#endregion
3606
- //#region src/reference-replay.d.ts
3727
+ //#region src/control-runtime.d.ts
3728
+ export declare function runAgentControlLoop<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult>(config: ControlRuntimeConfig<TState, TAction, TActionResult, TEval>): Promise<ControlRunResult<TState, TAction, TActionResult, TEval>>;
3729
+ //#endregion
3730
+ //#region src/control-runtime/policy.d.ts
3731
+ export declare function objectiveEval(input: Omit<ControlEvalResult, 'objective'>): ControlEvalResult;
3732
+ export declare function subjectiveEval(input: Omit<ControlEvalResult, 'objective'>): ControlEvalResult;
3733
+ //#endregion
3734
+ //#region src/analyst/steer-firewall.d.ts
3607
3735
  /**
3608
- * Reference replay — score an agent against withheld historical outcomes.
3736
+ * THE steer firewall. Fail-loud guard for any path that admits analyst findings
3737
+ * as STEERING input (the `f(trace)` role): rejects — naming the offenders — any
3738
+ * finding whose provenance is a judge verdict, rather than let `J` leak into the
3739
+ * loop. Returns the findings unchanged for chaining.
3609
3740
  *
3610
- * This is the generic version of the public-audit replay pattern:
3611
- * run a candidate system on an old task, keep the reference answers hidden
3612
- * until after execution, then score recall/precision and gate promotion
3613
- * across train/dev/test/holdout splits.
3741
+ * Call this at the chokepoint where a detector that ALSO scores/gates has its
3742
+ * findings turned into a steer (the judge-and-steer dual-role case). It keys on
3743
+ * provenance, so it correctly admits evidence-less trace-analyst observations and
3744
+ * correctly rejects an artifact-citing judge verdict — the cases an evidence
3745
+ * check gets backwards.
3746
+ *
3747
+ * It is necessary, not sufficient: it stops PROVENANCE-tagged verdicts. A judge
3748
+ * whose output is laundered through a hand-built finding with no provenance flag
3749
+ * is out of its reach — provenance must be honestly set at every judge→finding
3750
+ * lift (today: createJudgeAdapter). That is why the integrity rule lives at the
3751
+ * lift site, and why ProposeContext.judgeScores?: never is the complementary
3752
+ * compile-time tripwire on the obvious direct channel.
3614
3753
  */
3615
- type ReferenceReplaySplit = 'train' | 'dev' | 'test' | 'holdout';
3616
- interface ReferenceReplayItem {
3617
- id: string;
3618
- title: string;
3619
- description?: string;
3620
- severity?: string;
3621
- tags?: string[];
3622
- weight?: number;
3623
- }
3624
- interface ReferenceReplayCandidate {
3625
- id: string;
3626
- title: string;
3627
- description?: string;
3628
- severity?: string;
3629
- tags?: string[];
3630
- metadata?: Record<string, unknown>;
3631
- }
3632
- interface ReferenceReplayMatch {
3633
- scenarioId: string;
3634
- referenceId: string;
3635
- candidateId: string | null;
3636
- score: number;
3637
- matched: boolean;
3638
- weight: number;
3639
- reason: string;
3640
- }
3641
- interface ReferenceReplayScenarioScore {
3642
- scenarioId: string;
3643
- split: ReferenceReplaySplit;
3644
- matched: number;
3645
- total: number;
3646
- falsePositives: number;
3647
- matchedWeight: number;
3648
- totalWeight: number;
3649
- precision: number;
3650
- recall: number;
3651
- f1: number;
3652
- matches: ReferenceReplayMatch[];
3653
- }
3654
- interface ReferenceReplayAggregate {
3655
- matched: number;
3656
- total: number;
3657
- falsePositives: number;
3658
- matchedWeight: number;
3659
- totalWeight: number;
3660
- precision: number;
3661
- recall: number;
3662
- f1: number;
3663
- weightedRecall: number;
3664
- }
3665
- interface ReferenceReplayScore {
3666
- scenarios: ReferenceReplayScenarioScore[];
3667
- aggregate: ReferenceReplayAggregate;
3668
- bySplit: Partial<Record<ReferenceReplaySplit, ReferenceReplayAggregate>>;
3669
- }
3670
- interface ReferenceReplayCaseRun<Input = unknown> {
3671
- caseId: string;
3672
- split: ReferenceReplaySplit;
3673
- input: Input;
3674
- metadata?: Record<string, unknown>;
3675
- references: ReferenceReplayItem[];
3676
- candidates: ReferenceReplayCandidate[];
3677
- score: ReferenceReplayScenarioScore;
3678
- durationMs: number;
3679
- error?: string;
3680
- }
3681
- interface ReferenceReplayRun<Input = unknown> {
3682
- id: string;
3683
- variantId?: string;
3684
- startedAt: number;
3685
- completedAt: number;
3686
- durationMs: number;
3687
- cases: ReferenceReplayCaseRun<Input>[];
3688
- score: ReferenceReplayScore;
3689
- metadata?: Record<string, unknown>;
3690
- }
3754
+ export declare function assertNoJudgeVerdict(findings: ReadonlyArray<AnalystFinding>, context?: string): ReadonlyArray<AnalystFinding>;
3691
3755
  //#endregion
3692
- //#region src/steering.d.ts
3693
- interface SteeringRolePrompt {
3694
- system?: string;
3695
- append?: string;
3696
- }
3697
- interface SteeringBundle {
3698
- id: string;
3699
- coderPrompt?: string;
3700
- continuePrompt?: string;
3701
- reviewerPrompts?: Record<string, string>;
3702
- skills?: string[];
3703
- rolePrompts?: Record<string, SteeringRolePrompt>;
3756
+ //#region src/knowledge/readiness.d.ts
3757
+ interface ScoreKnowledgeReadinessOptions {
3758
+ taskId: string;
3759
+ requirements: KnowledgeRequirement[];
3760
+ evidenceIds?: string[];
3761
+ claimIds?: string[];
3762
+ wikiPageIds?: string[];
3763
+ userAnswers?: Record<string, string>;
3704
3764
  metadata?: Record<string, unknown>;
3765
+ now?: Date;
3705
3766
  }
3767
+ export declare function scoreKnowledgeReadiness(options: ScoreKnowledgeReadinessOptions): KnowledgeReadinessReport;
3768
+ export declare function blockingKnowledgeEval(report: KnowledgeReadinessReport, options?: {
3769
+ id?: string;
3770
+ minimumScore?: number;
3771
+ emitter?: TraceEmitter;
3772
+ }): ControlEvalResult;
3773
+ export declare function knowledgeReadinessTracePayload(report: KnowledgeReadinessReport, options?: {
3774
+ passed?: boolean;
3775
+ minimumScore?: number;
3776
+ }): Record<string, unknown>;
3777
+ export declare function userQuestionsForKnowledgeGaps(gaps: KnowledgeRequirement[]): UserQuestion[];
3778
+ export declare function acquisitionPlansForKnowledgeGaps(gaps: KnowledgeRequirement[]): DataAcquisitionPlan[];
3706
3779
  //#endregion
3707
- //#region src/steering-optimizer.d.ts
3708
- type SteeringOptimizerBackend = 'pairwise';
3709
- interface SteeringOptimizationRow {
3710
- variantId: string;
3711
- scenarioId: string;
3712
- bundle: SteeringBundle;
3713
- score: RunScore;
3714
- metadata?: Record<string, unknown>;
3780
+ //#region src/metrics.d.ts
3781
+ interface TokenPrice {
3782
+ input: number;
3783
+ output: number;
3715
3784
  }
3716
- interface SteeringOptimizationSelector {
3717
- backend: SteeringOptimizerBackend;
3718
- signature?: string;
3719
- labels?: string[];
3720
- rationale?: string;
3785
+ /** Per-1K token pricing for exact model ids. */
3786
+ export declare const MODEL_PRICING: Record<string, TokenPrice>;
3787
+ /** Resolve pricing for a model id: exact table, then family fallback.
3788
+ * Returns null when the id matches nothing (caller decides — never a
3789
+ * silent-zero masquerading as a real $0 cost). */
3790
+ export declare function resolveModelPricing(model: string): TokenPrice | null;
3791
+ /** True when `model` has known pricing (exact or family). Lets cost-aware
3792
+ * callers distinguish a real $0 from an unpriced model. */
3793
+ export declare function isModelPriced(model: string): boolean;
3794
+ /** Estimate token count from string length (chars / 4 approximation) */
3795
+ export declare function estimateTokens(text: string): number;
3796
+ /** Calculate cost in USD from token counts and model. Unknown models warn
3797
+ * once (not a silent zero) and return 0 so callers that ignore pricing keep
3798
+ * working; cost-sensitive callers should gate on {@link isModelPriced}. */
3799
+ export declare function estimateCost(inputTokens: number, outputTokens: number, model: string): number;
3800
+ //#endregion
3801
+ //#region src/anti-slop.d.ts
3802
+ interface AntiSlopConfig {
3803
+ /** Domain label — appears in the JudgeScore output */
3804
+ domain?: string;
3805
+ /** Case-insensitive substrings that must not appear. Each occurrence = penalty. */
3806
+ bannedPhrases?: string[];
3807
+ /** Regexes matching opening formulas to penalize (e.g. /^great question/i). */
3808
+ bannedOpenings?: RegExp[];
3809
+ /** Regexes matching hedges (e.g. /i could be wrong/i). Ratio of hedged sentences drives score. */
3810
+ hedgingPatterns?: RegExp[];
3811
+ /** Regexes matching apology padding. */
3812
+ apologyPatterns?: RegExp[];
3813
+ /** Fraction of sentences that can be duplicates before penalty (default 0.15 = 15%). */
3814
+ repetitionThreshold?: number;
3815
+ /** Min output length in chars; below this the turn is deemed too terse. */
3816
+ minLength?: number;
3817
+ /** Max output length in chars; above this the turn is deemed too verbose. */
3818
+ maxLength?: number;
3819
+ /** How heavily each violation class reduces the score (default 1). */
3820
+ penaltyWeights?: Partial<Record<SlopCategory, number>>;
3721
3821
  }
3722
- interface SteeringOptimizationResult {
3723
- backend: SteeringOptimizerBackend;
3724
- recommendedVariantId: string;
3725
- rationale: string;
3726
- rankings: Array<{
3727
- variantId: string;
3728
- mean: number;
3729
- runs: number;
3730
- }>;
3731
- selector?: SteeringOptimizationSelector;
3732
- skipped?: boolean;
3822
+ type SlopCategory = 'banned_phrase' | 'banned_opening' | 'hedging' | 'apology' | 'repetition' | 'length';
3823
+ /** Create a reusable Judge function from an anti-slop config. */
3824
+ export declare function createAntiSlopJudge(config?: AntiSlopConfig): JudgeFn;
3825
+ interface AntiSlopIssue {
3826
+ category: SlopCategory;
3827
+ detail: string;
3828
+ example?: string;
3733
3829
  }
3734
- interface SteeringOptimizerConfig {
3735
- weights?: Partial<RunScoreWeights>;
3830
+ interface AntiSlopReport {
3831
+ /** 0–10 score; 10 is clean, lower values mean more slop. */
3832
+ score: number;
3833
+ issues: AntiSlopIssue[];
3834
+ /** Count of each category for programmatic aggregation. */
3835
+ counts: Record<SlopCategory, number>;
3736
3836
  }
3737
3837
  /**
3738
- * Rank already-evaluated steering variants.
3739
- *
3740
- * Model-backed candidate generation belongs to the official GEPA campaign
3741
- * integration. This class only performs the deterministic selection it owns.
3838
+ * Pure function — analyze one or more outputs against the config. Exposed
3839
+ * separately so consumers can build their own reporters on top.
3742
3840
  */
3743
- export declare class PairwiseSteeringOptimizer {
3744
- optimize(rows: SteeringOptimizationRow[], config?: SteeringOptimizerConfig): SteeringOptimizationResult;
3745
- }
3841
+ export declare function analyzeAntiSlop(outputs: string[], config: Omit<Required<AntiSlopConfig>, 'domain'> & {
3842
+ penaltyWeights: Record<SlopCategory, number>;
3843
+ }): AntiSlopReport;
3746
3844
  //#endregion
3747
- export { AGENT_PROFILE_KINDS, ATTESTATION_ALGORITHM, type ActionExecutionPolicy, type ActionPolicyDecision, type ActionableSideInfo, type ActiveLearningOptions, type AgentEvalAgent, AgentEvalError, type AgentEvalErrorCode, type AgentEvalEvaluateOptions, type AgentEvalImproveOptions, type AgentProfile, type AgentProfileCell, type AgentProfileCellInput, type AgentProfileDimensionValue, type AgentProfileJson, type AgentProfileSourceInput, type Analyst, type AnalystContext, type AnalystFeedbackTrajectoryOptions, type AnalystFinding, type AnalystFindingDigest, AnalystRegistry, type AnalystRegistryOptions, type AnalystReviewDecision, type AnalystReviewRequest, type AnalystRunDigest, type AnalystRunEvent, type AnalystRunInputs, type AnalystRunResult, type AnalystRunSummary, type AnalystSeverity, type AnalystUsageReceipt, type AnalyzeRunsOptions, type AnalyzeTracesResult, type ArgumentCheck, type Artifact, type ArtifactCheck, type ArtifactEventLike, type ArtifactResult, type AssertCapabilityHeadroomOptions, type AssertCrossFamilyOptions, type AssertCrossFamilyServedOptions, type AssertServedModelOptions, type AssertSingleBackendOptions, type AttestationProvenance, type AttestationVerification, type AttestedReport, BOOTSTRAP_GATE_MIN_N, type BackendDescriptor, BackendIntegrityError, type BackendIntegrityReport, type BenchmarkEvaluation, type BlendWeights, type BootstrapOptions, type BootstrapResult, type BoundedProcessInput, type BoundedProcessResult, type BudgetLedgerEntry, type BudgetPolicy, type BudgetSpec, CODING_HARNESSES, type CalibrationExample, type CalibrationMerge, type CalibrationResult, type CampaignCellFailureReceipt, type CampaignCellRetryPolicy, type CampaignFactoryParams, type CampaignIntegrityPolicy, type CampaignResult, type CampaignRunContext, type CampaignRunOutcome, type CampaignScenario, type CampaignVariant, type CanaryAlert, type CanaryEvaluation, type CanaryKind, type CanaryLeak, type CanaryOptions, type CanaryReport, type CandidateScore, type CapabilityHeadroomOptions, type CapabilityHeadroomResult, type CaptureErrorHandler, type CaptureWrite, type CellVerdict, type ChannelRollup, type ChatCallOpts, type ChatClient, type ChatRequest, type ChatResponse, type ChatTraceEngineOptions, type ChatTransport, type CheckResult, type CheckerIdentity, type CheckerOutcome, type CliffsMagnitude, type CollectedArtifacts, type CommandRunner, type ComparePairedArmsOptions, type CompletionCriterion, type CompletionRequirement, type CompletionVerdict, type ConceptFinding, type ConceptSpec, ConfigError, type ContinuousAgreement, type ContinuousAgreementOptions, type ContinuousCalibrationResult, type ContractCheckResult, type ContractLintFinding, type ContractRule, type ContractRuleExecution, type ContractRun, type ContractSpan, type ContractStatus, type ContractVerdict, type ControlActionOutcome, type ControlBudget, type ControlContext, type ControlDecision, type ControlEvalResult, type ControlRunResult, type ControlRuntimeConfig, type ControlRuntimeError, type ControlStep, type CorpusAgreementOptions, type CorpusAgreementPerDimension, type CorpusAgreementReport, type CorpusScoreRecord, type CorrectnessChecker, CostAccountingIncompleteError, CostCallConflictError, CostCeilingReachedError, type CostChannel, type CostEntry, CostLedger, type CostLedgerFilter, type CostLedgerHandle, type CostLedgerOptions, type CostLedgerPersistence, CostLedgerPersistenceError, type CostLedgerSummary, type CostProvenance, type CostReceipt, CostReceiptCaptureError, type CostReceiptInput, CostReservationExceededError, type CostResult, type CostSummary, type CostUsage, type CounterfactualContext, type CounterfactualMutation, type CounterfactualResult, type CounterfactualRunner, type CreateChatClientOpts, type CreateTraceAnalystOptions, CrossFamilyError, type CustomTokenPricing, type CustomTransportOpts, DECISION_PAIRED_DELTA_STATISTIC, DEFAULT_FAILURE_REASON_RULES, DEFAULT_JUDGE_GATE_POLICY, DEFAULT_RED_TEAM_CORPUS, DEFAULT_TRACE_ANALYST_BUDGETS, DEFAULT_TRACE_ANALYST_KINDS, DEFAULT_TRACE_ANALYST_OUTPUT_TOKENS, type DataAcquisitionPlan, type DatasetManifest, type DatasetOverview, type DatasetScenario, type DatasetSplit, type DefaultAnalystRegistryOptions, type DefaultVerdict, type DefineAgentEvalOptions, type DefinedAgentEval, type DeployGateLayerInput, type DeployRunResult, type DeployRunner, type DetectorEvent, type DetectorSignal, type DiffPolicy, type DiffScorecardOptions, type JudgeScore as DimensionJudgeScore, type DirEntry, type DiscoverPersonasOptions, type DiscoveredPersona, type DriverState, type DspyRlmTraceEngineOptions, type EProcess, type EProcessOptions, type EProcessState, type EProcessStep, type EnsembleAggregate, type EnsembleJudgeOptions, type EquivalenceArm, type EquivalenceCheckDefinition, type EquivalenceCheckSpec, type EquivalenceChecker, type EquivalenceCheckerInput, type EquivalenceCheckerResult, type EquivalenceObligation, type EquivalenceObligationStatus, EquivalenceProtocolError, type EquivalenceRecord, type ErrorCluster, type ErrorCountPattern, type ErrorStreakOptions, type EvalCampaignOptions, type EvalCampaignResult, type EventFilter, type EvidenceRef, type ExactAnalystRunEvent, type ExactAnalystRunResult, type ExactCapableAnalyst, type ExactRegistryRunOpts, type ExactRiskDifferenceResult, type ExperimentPlan, type ExperimentRep, type ExperimentResult, type ExperimentStats, type ExtractOptions, type ExtractResult, type ExtractedUsage, FAILURE_BLAME, FAILURE_CLASSES, FAILURE_MODE_KIND_SPEC, type FailedRun, type FailureBlame, type FailureClass, type FailureClassification, type FailureContext, type FailureMode, type FailureReasonRule, type FailureRule, type FeedbackArtifactType, type FeedbackAttempt, type FeedbackLabel, type FeedbackLabelKind, type FeedbackLabelSource, type FeedbackOptimizerRow, type FeedbackOutcome, type FeedbackSplitPolicy, type FeedbackTask, type FeedbackTrajectory, type FeedbackTrajectoryFilter, type FeedbackTrajectoryStore, type FieldDestination, FileSystemFeedbackTrajectoryStore, FileSystemRawProviderSink, FileSystemTraceStore, type Finding, type FindingSubject, type FindingSubjectKind, type FindingToPolicyEditOptions, type FindingsDiff, FindingsStore, type GainDistributionBin, type GainDistributionFigureSpec, type GainDistributionOptions, type GateDecision, type GateEvidence, type GenericSpan, type GoldenItem, HARNESS_NATIVE_MODEL, type HarnessType, type HeadroomInput, HeldOutGate, type HeldOutGateConfig, type GateDecision$1 as HeldOutGateDecision, type HeldOutGateRejectionCode, type HeldOutPartition, type HiddenCriteriaGrader, type HiddenGradeResult, type HiddenLeak, INFRA_FAILURE_BLAMES, type ImprovementThresholds, type ImprovementVerdictResult, InMemoryFeedbackTrajectoryStore, InMemoryRawProviderSink, InMemoryTraceStore, type InsightReport, type IntentMatchInput, type IntentMatchOptions, type IntentMatchResult, type InterimReleaseConfidence, type InterimReleaseConfidenceInput, type JudgeAgreement, type JudgeCalibrationSet, type JudgeConfusion, JudgeError, type JudgeExampleAgreement, type JudgeFamily, type JudgeFn, type JudgeGateDecision, type JudgeGateInput, type JudgeGatePolicy, JudgeGateRefusedError, type JudgeGateStatus, type JudgeInput, type JudgeRetryOutcome, type JudgeRetryPolicy, type JudgeRubric, type JudgeRun, type JudgeRunMeta, type JudgeScore$1 as JudgeScore, type JudgeScoreInput, type JudgeScoresRecord, type JudgeSpan, type JudgeVerdict, type KeywordConceptSpec, type KeywordCoverageFinding, type KeywordCoverageOptions, type KeywordCoverageResult, type KnowledgeAcquisitionMode, type KnowledgeBundle, type KnowledgeFreshness, type KnowledgeImportance, type KnowledgeReadinessReport, type KnowledgeRequirement, type KnowledgeRequirementCategory, type KnowledgeSensitivity, type Layer, type LayerResult, type LayerStatus, type LeaderboardOptions, type LeaderboardRow, type LinearRegressionResult, LlmCallError, type LlmCallMetadata, type LlmCallRequest, type LlmCallResult, type LlmChargeBounds, type LlmCorrectnessCheckerOpts, type LlmJudgeOptions, type LlmMessage, LlmResponseError, type LlmReviewerConfig, type LlmSpan, type LlmTokenLogprob, type LlmToolCall, type LlmToolChoice, type LlmToolDefinition, type LlmUsage, type MannWhitneyResult, type MatchedPair, type MatchedRunRecordPair, type MaximumCharge, type McNemarResult, type MintRolloutOptions, type MintRolloutResult, type MintedRolloutLine, type MockTransportOpts, type ModelEndpointCheck, type ModelEndpointRequest, type ModelSeats, ModelSubstitutionError, MultiLayerVerifier, type NoLeakOptions, NoopRawProviderSink, NotFoundError, OUTPUT_VALUE, type Objective, type OpenAiCompatibleTransportOpts, type Oracle, type OracleObservation, type OracleReport, type OracleResult, type OrderMode, type OtlpExport, OtlpFileTraceStore, type OtlpFlatLine, type OtlpSpan, type OwnerVerdict, type PaidCallResult, type PairArmsOptions, type PairArmsResult, type PairRunRecordsResult, type PairedArmRow, type PairedArmsComparison, type PairedBootstrapOptions, type PairedBootstrapResult, type PairedCorrectness, type PairedDecisionMethod, type PairedDecisionShape, type PairedDecisionStatistic, type PairedDeltaTestOptions, type PairedDeltaTestResult, type PairedEvalueOptions, type PairedEvalueSequence, type PairedEvalueStep, type PairedMcNemarEvidence, type PairedMetricDelta, type PairedPromotionAlternative, type PairedPromotionAlternativeCell, type PairedPromotionCallRates, type PairedPromotionDecision, type PairedPromotionDecisionOptions, type PairedPromotionPowerCall, type PairedPromotionPowerOptions, type PairedPromotionPowerResult, type PairedSignTestResult, type PairedTTestResult, type PairedValueLaw, type ParetoPoint, type ParetoResult, type PartitionHeldOutOptions, type PendingCostCall, type PendingCostCallView, type PersistedFinding, type PersonaConfig, type PolicyEdit, type PolicyEditAdmission, type PolicyEditAdmissionOptions, type PolicyEditAxis, type PolicyEditCandidateRecord, type PolicyEditChange, type PolicyEditExpectedGain, type PolicyEditGainDirection, type PolicyEditGainUnit, type PolicyEditInit, type PolicyEditRisk, type PolicyEditSchemaVersion, type PolicyEditSource, type PolicyEditTarget, type PolicyEditTargetSurface, type PreferenceMemoryEntry, type ProducedProposal, type ProducedState, type ProductBenchmarkExportOptions, type ProductBenchmarkExportResult, type ProductBenchmarkManifest, type ProductBenchmarkSingleRunExportOptions, type ProductBenchmarkSplit, type ProductBenchmarkValidationReport, type ProductClientConfig, type Scenario as ProductScenario, type ProfileAxisSpec, type ProjectRuntimeTrajectoryEvidenceOptions, type PromptHandle, type ProportionInterval, type ProposalEventLike, type ProposalFinding, type ProposeFn, type ProposeInput, type ProposeOutput, type ProposeReviewConfig, type ProposeReviewControlAction, type ProposeReviewControlConfig, type ProposeReviewControlResult, type ProposeReviewControlState, type ProposeReviewReport, type ProposedSideEffect, type QueryTracesPage, REDACTION_VERSION, type RankTestMethod, type RankTestMethodRequest, type RankTestOptions, type RawAnalystFinding, type RawProviderEvent, type RawProviderSink, type RecordRunsOptions, type RedTeamCase, type RedTeamCategory, type RedTeamFinding, type RedTeamReport, type RedactOptions, type RedactionProfile, type RedactionReport, type ReferenceReplayCaseRun, type ReferenceReplayRun, type ReferenceReplaySplit, type ReflectionContext, type ReflectionProposal, type RegistryRunOpts, type ReleaseConfidenceInput, type ReleaseConfidenceIssue, type ReleaseConfidenceMetrics, type ReleaseConfidenceScorecard, type ReleaseTraceEvidence, type RepeatedActionOptions, type RequiredPairsForPairedPromotionOptions, type RequiredPairsForPairedPromotionResult, type RequirementCheck, type ResearchReport, type ResearchReportOptions, type Researcher, type RetryWrite, type Review, type ReviewFn, type ReviewInput, type ReviewMemoryEntry, type ReviewMemoryStore, type RiskDifferenceResult, type RolloutSearchLineage, type RouteMap, type RoutedField, type RubricDimension, type Run, type RunCampaignOptions, type RunCaptureReport, type RunCommandInput, type RunCommandResult, type RunCostProvenance, type RunFilter, RunIntegrityError, type RunIntegrityReport, type RunJudgeMetadata, type RunOutcome, type RunPaidCallInput, type RunRecord, type RunRecordBackend, RunRecordValidationError, type RunScore, type RunScoreWeights, type RunSearchCoordinates, type RunSplitTag, type RunStatus, type RunTaskFailure, type RunTerminalOutcome, type RunTokenUsage, type RunTraceRef, type RuntimeEventLike, type RuntimeTrajectoryEvidenceProjection, type RuntimeTrajectoryEvidenceSummary, type RuntimeTrajectoryHookEvent, type RuntimeTrajectoryRecord, type RuntimeTrajectoryRunRecord, SEMANTIC_CONCEPT_JUDGE_VERSION, type SampleSummary, type SampleSummaryOptions, type SandboxDriver, type SandboxSdkTransportOpts, type SatisfiedBy, type Scenario$1 as Scenario, type ScenarioCost, type ScenarioFile, type ScenarioResult, type ScorePreference, type ScoreRiskDifferenceResult, type Scorecard, type ScorecardCell, type ScorecardCellDiff, type ScorecardDiff, type ScorecardEntry, type ScorecardLogLine, type SearchSpanResult, type SearchTraceResult, type SelfImproveBudget, type SelfImproveMethodOptions, type SelfImproveMethodProvenance, type SelfImproveMethodResult, type SelfImproveOptions, type SelfImproveProgressEvent, type SelfImproveProposerOptions, type SelfImproveProposerResult, type SelfImproveResult, type SemanticConceptJudgeInput, type SemanticConceptJudgeOptions, type SemanticConceptJudgeResult, type SequentialDecision, type SeriesConvergenceOptions, type SeriesConvergenceResult, type SeriesDistribution, ServedCrossFamilyError, type ServedModelCheck, type ServedModelPolicy, type ServedModelVerdict, type Severity, type ShareSafetyStatus, type ShareSafetyVerdict, type SignTestAlternative, type SingleBackendDivergence, type SingleBackendReport, type Span, type SpanFilter, type SpanHandle, type SpanMatchRecord, type SpanPredicate, type SpanRecordsToTraceAnalysisStoreOptions, type SplitCoverage, type SteeringBundle, type SteeringChange, type SteeringOptimizationResult, type SteeringOptimizationRow, type StopDecision, type StrategyChecker, type StreamingDetector, type SummaryTable, type SummaryTableOptions, type SummaryTableRow, type SynthesisTarget, TRACE_ANALYST_TRUNCATION_MARKER_PREFIX, type TaskGold, type TaskHeadroom, type ToolCallEventLike, type ToolSpan, type ToolStats, type ToolUseMetrics, type ToolUseOptions, type TraceAnalysisEngine, type TraceAnalysisEngineResult, type TraceAnalysisStore, type TraceAnalystByteBudgets, type TraceAnalystDefinition, type TraceAnalystFilters, type TraceAnalystSpan, type TraceAnalystSpanKind, type TraceAnalystSpanStatus, type TraceAnalystTraceSummary, type TraceContract, type TraceContractSpec, TraceEmitter, type TraceEmitterOptions, type TraceEvent, type TraceInsightReadiness, type TraceInsightSuite, type TraceStore, type TrainSelectionTestOptions, type TrainSelectionTestPartition, type Trajectory, type TrajectoryStep, type TreatmentGate, type TreatmentGateInput, type TreatmentGateOptions, type TrialTrace, type Turn, type TurnResult, UNKNOWN_MODEL, type UserQuestion, VERIFICATION_STRATEGIES, VERIFICATION_STRATEGY_SOURCES, ValidationError, type VerbosityBiasResult, type Verdict, type VerdictCacheStore, type VerdictCertification, type Verification, type VerificationReport, type VerificationStrategyProfile, type VerificationStrategySource, type VerifyFn, type VerifyOptions, type ViewSpansResult, type ViewTraceOversized, type ViewTraceResult, type ViteDeployRunnerInput, type WeightedCompositeInput, type WeightedCompositeResult, type WelchTestResult, type WelchTestStatus, type WilcoxonSignedRankResult, type WranglerDeployRunnerInput, addCalibrationVerdicts, agentProfileCellKey, agentProfileHash, agentProfileId, analystFindingDigest, analystRunDigest, analystRunToFeedbackTrajectory, analystRunToReviewRequests, analyzeRuns, analyzeSeries, analyzeTraces, argHash, assertCrossFamily, assertCrossFamilyServed, assertJudgeMayGate, assertRealBackend, assertRunCaptured, assertServedModel, assertServedModels, assessShareSafety, assignFeedbackSplit, attest, benjaminiHochberg, bonferroni, bootstrapCi, budgetBreachView, buildAgentProfileCell, buildDefaultAnalystRegistry, buildEquivalenceRecord, buildTraceInsightContext, buildTraceInsightPrompt, buildTrajectory, calibrateJudge, calibrateJudgeContinuous, captureFetchToRawSink, certificationEvidenceDigest, checkServedModel, classifyFailure, classifyFailureReason, comparePairedArms, completionVerdict, computeFindingId, computeToolUseMetrics, confidenceInterval, continuousAgreement, controlRunToFeedbackTrajectory, corpusInterRaterAgreement, corpusInterRaterAgreementFromJudgeScores, costForTokenPricing, costForUsage, costReceiptFromLlm, costReceiptFromLlmError, createBoundedTraceAnalysisStore, createChatClient, createChatTraceEngine, createDspyRlmTraceEngine, createFeedbackTrajectory, createLlmCorrectnessChecker, createTraceAnalyst, decidePairedPromotion, defineAgentEval, defineEquivalenceCheck, describeTraceInsightScope, diffFindings, domainEvidencePattern, dominates, eProcess, equivalenceVerdict, evaluateInterimReleaseConfidence, evaluateReleaseConfidence, expandProfileAxes, exportRunAsOtlp, extractProducedState, extractUsage, extractUsageFromSse, failureBlame, failureClusterView, feedbackTrajectoriesToDatasetScenarios, feedbackTrajectoriesToOptimizerRows, feedbackTrajectoryToOptimizerRow, gainHistogram, gradeSemanticStatus, groupRunsByAgentProfileCell, harnessAxisOf, hashJson, holm, inferDomainKeywords, interRaterReliability, iqr, isBinaryOutcomeVector, isJudgeSpan, isLlmSpan, isRunRecord, isToolSpan, isTransientLlmError, judgeAgreementView, judgeFamily, judgeGateDecision, judgeSpans, llmJudge, makeFinding, makeProposalFinding, manifestContentDigest, mannWhitneyU, maximumChargeForLlmRequest, mcnemar, mcnemarPower, mcnemarRequiredN, measureJudgeAgreement, mintRolloutRows, modelHasSnapshot, modelPriceKey, mulberry32, objectiveEval, otlpTextToTraceAnalysisStore, pairArms, pairRunRecords, pairedBinaryScale, pairedBootstrap, pairedDeltaTieFraction, pairedEvalueSequence, pairedMde, pairedRiskDifference, pairedRiskDifferenceExact, pairedRiskDifferenceScore, pairedSignTest, pairedTTest, paretoChart, paretoFrontier, parseRunRecordSafe, partialCredit, passAtK, pearsonR, index_d_exports as profile, quotaExhaustedUntil, ranks, redTeamDataset, redTeamReport, redact, redactForShare, redactText, registerCalibrationSet, renderPreferenceMemoryMarkdown, requiredPairedSampleSize, requiredSampleSize, runAgentControlLoop, runCampaign, runCanaries, runCounterfactual, runEquivalenceCheck, runEvalCampaign, runSemanticConceptJudge, runTaskScore, runsForScenario, scoreRedTeamOutput, scoreTraceInsightReadiness, searchCellRunId, selfImprove, servedModelAcceptable, shareAllowed, snapshotFromJudgeAgreement, spanRecordsToTraceAnalysisStore, spearmanR, stripFencedJson, subjectiveEval, summarizeBackendIntegrity, summarizeNumberSeries, summarizePreferenceMemory, summaryTable, toAgentProfileJson, tokenizeDomainWords, toolSpansToTraceAnalysisStore, toolWasteView, transientDispatchFailure, validateRunRecord, verbosityBias, verifyAgentProfileCell, verifyAttestation, verifyCompletion, weightedComposite, weightedMean, welchsTTest, wilcoxonSignedRank, wilson, withAssignedFeedbackSplit };
3845
+ export { AGENT_PROFILE_KINDS, ATTESTATION_ALGORITHM, type ActionExecutionPolicy, type ActionPolicyDecision, type ActionableSideInfo, type ActiveLearningOptions, type AgentEvalAgent, AgentEvalError, type AgentEvalErrorCode, type AgentEvalEvaluateOptions, type AgentEvalImproveOptions, type AgentProfile, type AgentProfileCell, type AgentProfileCellInput, type AgentProfileDimensionValue, type AgentProfileJson, type AgentProfileSourceInput, type Analyst, type AnalystContext, type AnalystFeedbackTrajectoryOptions, type AnalystFinding, type AnalystFindingDigest, AnalystRegistry, type AnalystRegistryOptions, type AnalystReviewDecision, type AnalystReviewRequest, type AnalystRunDigest, type AnalystRunEvent, type AnalystRunInputs, type AnalystRunResult, type AnalystRunSummary, type AnalystSeverity, type AnalystUsageReceipt, type AnalyzeRunsOptions, type AnalyzeTracesResult, type ArgumentCheck, type Artifact, type ArtifactCheck, type ArtifactEventLike, type ArtifactResult, type AssertCapabilityHeadroomOptions, type AssertCrossFamilyOptions, type AssertCrossFamilyServedOptions, type AssertServedModelOptions, type AssertSingleBackendOptions, type AttestationProvenance, type AttestationVerification, type AttestedReport, BOOTSTRAP_GATE_MIN_N, type BackendDescriptor, BackendIntegrityError, type BackendIntegrityReport, type BenchmarkEvaluation, type BlendWeights, type BootstrapOptions, type BootstrapResult, type BoundedProcessInput, type BoundedProcessResult, type BudgetLedgerEntry, type BudgetPolicy, type BudgetSpec, CODING_HARNESSES, type CalibrationExample, type CalibrationMerge, type CalibrationResult, type CampaignCellFailureReceipt, type CampaignCellRetryPolicy, type CampaignFactoryParams, type CampaignIntegrityPolicy, type CampaignResult, type CampaignRunContext, type CampaignRunOutcome, type CampaignScenario, type CampaignVariant, type CanaryAlert, type CanaryEvaluation, type CanaryKind, type CanaryLeak, type CanaryOptions, type CanaryReport, type CandidateScore, type CapabilityHeadroomOptions, type CapabilityHeadroomResult, type CaptureErrorHandler, type CaptureWrite, type CellVerdict, type ChannelRollup, type ChatCallOpts, type ChatClient, type ChatRequest, type ChatResponse, type ChatTraceEngineOptions, type ChatTransport, type CheckResult, type CheckerIdentity, type CheckerOutcome, type CliffsMagnitude, type CollectedArtifacts, type CommandRunner, type ComparePairedArmsOptions, type CompletionCriterion, type CompletionRequirement, type CompletionVerdict, type ConceptFinding, type ConceptSpec, ConfigError, type ContinuousAgreement, type ContinuousAgreementOptions, type ContinuousCalibrationResult, type ContractCheckResult, type ContractLintFinding, type ContractRule, type ContractRuleExecution, type ContractRun, type ContractSpan, type ContractStatus, type ContractVerdict, type ControlActionOutcome, type ControlBudget, type ControlContext, type ControlDecision, type ControlEvalResult, type ControlRunResult, type ControlRuntimeConfig, type ControlRuntimeError, type ControlStep, type CorpusAgreementOptions, type CorpusAgreementPerDimension, type CorpusAgreementReport, type CorpusScoreRecord, type CorrectnessChecker, type CostChannel, type CostEntry, CostLedger, type CostLedgerFilter, type CostLedgerHandle, type CostLedgerOptions, type CostLedgerPersistence, type CostLedgerSummary, type CostProvenance, type CostReceipt, type CostReceiptInput, type CostResult, type CostSummary, type CostUsage, type CounterfactualContext, type CounterfactualMutation, type CounterfactualResult, type CounterfactualRunner, type CreateChatClientOpts, type CreateTraceAnalystOptions, CrossFamilyError, type CustomTokenPricing, type CustomTransportOpts, DECISION_PAIRED_DELTA_STATISTIC, DEFAULT_FAILURE_REASON_RULES, DEFAULT_JUDGE_GATE_POLICY, DEFAULT_RED_TEAM_CORPUS, DEFAULT_TRACE_ANALYST_BUDGETS, DEFAULT_TRACE_ANALYST_KINDS, DEFAULT_TRACE_ANALYST_OUTPUT_TOKENS, type DataAcquisitionPlan, type DatasetManifest, type DatasetOverview, type DatasetScenario, type DatasetSplit, type DefaultAnalystRegistryOptions, type DefaultVerdict, type DefineAgentEvalOptions, type DefinedAgentEval, type DeployGateLayerInput, type DeployRunResult, type DeployRunner, type DetectorEvent, type DetectorSignal, type DiffPolicy, type DiffScorecardOptions, type JudgeScore as DimensionJudgeScore, type DirEntry, type DiscoverPersonasOptions, type DiscoveredPersona, type DriverState, type DspyRlmTraceEngineOptions, type EProcess, type EProcessOptions, type EProcessState, type EProcessStep, type EnsembleAggregate, type EnsembleJudgeOptions, type EquivalenceArm, type EquivalenceCheckDefinition, type EquivalenceCheckSpec, type EquivalenceChecker, type EquivalenceCheckerInput, type EquivalenceCheckerResult, type EquivalenceObligation, type EquivalenceObligationStatus, EquivalenceProtocolError, type EquivalenceRecord, type ErrorCluster, type ErrorCountPattern, type ErrorStreakOptions, type EvalCampaignOptions, type EvalCampaignResult, type EventFilter, type EvidenceRef, type ExactAnalystRunEvent, type ExactAnalystRunResult, type ExactCapableAnalyst, type ExactRegistryRunOpts, type ExactRiskDifferenceResult, type ExperimentPlan, type ExperimentRep, type ExperimentResult, type ExperimentStats, type ExtractOptions, type ExtractResult, type ExtractedUsage, FAILURE_BLAME, FAILURE_CLASSES, FAILURE_MODE_KIND_SPEC, type FailedRun, type FailureBlame, type FailureClass, type FailureClassification, type FailureContext, type FailureMode, type FailureReasonRule, type FailureRule, type FeedbackArtifactType, type FeedbackAttempt, type FeedbackLabel, type FeedbackLabelKind, type FeedbackLabelSource, type FeedbackOptimizerRow, type FeedbackOutcome, type FeedbackSplitPolicy, type FeedbackTask, type FeedbackTrajectory, type FeedbackTrajectoryFilter, type FeedbackTrajectoryStore, type FieldDestination, FileSystemFeedbackTrajectoryStore, FileSystemRawProviderSink, FileSystemTraceStore, type Finding, type FindingSubject, type FindingSubjectKind, type FindingToPolicyEditOptions, type FindingsDiff, FindingsStore, type GainDistributionBin, type GainDistributionFigureSpec, type GainDistributionOptions, type GateDecision, type GateEvidence, type GenericSpan, type GoldenItem, HARNESS_NATIVE_MODEL, type HarnessType, type HeadroomInput, HeldOutGate, type HeldOutGateConfig, type GateDecision$1 as HeldOutGateDecision, type HeldOutGateRejectionCode, type HeldOutPartition, type HiddenCriteriaGrader, type HiddenGradeResult, type HiddenLeak, INFRA_FAILURE_BLAMES, type ImprovementThresholds, type ImprovementVerdictResult, InMemoryFeedbackTrajectoryStore, InMemoryRawProviderSink, InMemoryTraceStore, type InsightReport, type IntentMatchInput, type IntentMatchOptions, type IntentMatchResult, type InterimReleaseConfidence, type InterimReleaseConfidenceInput, type JudgeAgreement, type JudgeCalibrationSet, type JudgeConfusion, JudgeError, type JudgeExampleAgreement, type JudgeFamily, type JudgeFn, type JudgeGateDecision, type JudgeGateInput, type JudgeGatePolicy, JudgeGateRefusedError, type JudgeGateStatus, type JudgeInput, type JudgeRetryOutcome, type JudgeRetryPolicy, type JudgeRubric, type JudgeRun, type JudgeRunMeta, type JudgeScore$1 as JudgeScore, type JudgeScoreInput, type JudgeScoresRecord, type JudgeSpan, type JudgeVerdict, type KeywordConceptSpec, type KeywordCoverageFinding, type KeywordCoverageOptions, type KeywordCoverageResult, type KnowledgeAcquisitionMode, type KnowledgeBundle, type KnowledgeFreshness, type KnowledgeImportance, type KnowledgeReadinessReport, type KnowledgeRequirement, type KnowledgeRequirementCategory, type KnowledgeSensitivity, type Layer, type LayerResult, type LayerStatus, type LeaderboardOptions, type LeaderboardRow, type LinearRegressionResult, type LlmCallMetadata, type LlmCallRequest, type LlmCallResult, type LlmChargeBounds, type LlmCorrectnessCheckerOpts, type LlmJudgeOptions, type LlmMessage, type LlmReviewerConfig, type LlmSpan, type LlmTokenLogprob, type LlmToolCall, type LlmToolChoice, type LlmToolDefinition, type LlmUsage, type MannWhitneyResult, type MatchedPair, type MatchedRunRecordPair, type MaximumCharge, type McNemarResult, type MintRolloutOptions, type MintRolloutResult, type MintedRolloutLine, type MockTransportOpts, type ModelEndpointCheck, type ModelEndpointRequest, type ModelSeats, ModelSubstitutionError, MultiLayerVerifier, type NoLeakOptions, NoopRawProviderSink, NotFoundError, OUTPUT_VALUE, type Objective, type OpenAiCompatibleTransportOpts, type Oracle, type OracleObservation, type OracleReport, type OracleResult, type OrderMode, type OtlpExport, OtlpFileTraceStore, type OtlpFlatLine, type OtlpSpan, type OwnerVerdict, type PaidCallResult, type PairArmsOptions, type PairArmsResult, type PairRunRecordsResult, type PairedArmRow, type PairedArmsComparison, type PairedBootstrapOptions, type PairedBootstrapResult, type PairedCorrectness, type PairedDecisionMethod, type PairedDecisionShape, type PairedDecisionStatistic, type PairedDeltaTestOptions, type PairedDeltaTestResult, type PairedEvalueOptions, type PairedEvalueSequence, type PairedEvalueStep, type PairedMcNemarEvidence, type PairedMetricDelta, type PairedPromotionAlternative, type PairedPromotionAlternativeCell, type PairedPromotionCallRates, type PairedPromotionDecision, type PairedPromotionDecisionOptions, type PairedPromotionPowerCall, type PairedPromotionPowerOptions, type PairedPromotionPowerResult, type PairedSignTestResult, type PairedTTestResult, type PairedValueLaw, type ParetoPoint, type ParetoResult, type PartitionHeldOutOptions, type PendingCostCall, type PendingCostCallView, type PersistedFinding, type PersonaConfig, type PolicyEdit, type PolicyEditAdmission, type PolicyEditAdmissionOptions, type PolicyEditAxis, type PolicyEditCandidateRecord, type PolicyEditChange, type PolicyEditExpectedGain, type PolicyEditGainDirection, type PolicyEditGainUnit, type PolicyEditInit, type PolicyEditRisk, type PolicyEditSchemaVersion, type PolicyEditSource, type PolicyEditTarget, type PolicyEditTargetSurface, type PreferenceMemoryEntry, type ProducedProposal, type ProducedState, type ProductBenchmarkExportOptions, type ProductBenchmarkExportResult, type ProductBenchmarkManifest, type ProductBenchmarkSingleRunExportOptions, type ProductBenchmarkSplit, type ProductBenchmarkValidationReport, type ProductClientConfig, type Scenario as ProductScenario, type ProfileAxisSpec, type ProjectRuntimeTrajectoryEvidenceOptions, type PromptHandle, type ProportionInterval, type ProposalEventLike, type ProposalFinding, type ProposeFn, type ProposeInput, type ProposeOutput, type ProposeReviewConfig, type ProposeReviewControlAction, type ProposeReviewControlConfig, type ProposeReviewControlResult, type ProposeReviewControlState, type ProposeReviewReport, type ProposedSideEffect, type QueryTracesPage, REDACTION_VERSION, type RankTestMethod, type RankTestMethodRequest, type RankTestOptions, type RawAnalystFinding, type RawProviderEvent, type RawProviderSink, type RecordRunsOptions, type RedTeamCase, type RedTeamCategory, type RedTeamFinding, type RedTeamReport, type RedactOptions, type RedactionProfile, type RedactionReport, type ReferenceReplayCaseRun, type ReferenceReplayRun, type ReferenceReplaySplit, type ReflectionContext, type ReflectionProposal, type RegistryRunOpts, type ReleaseConfidenceInput, type ReleaseConfidenceIssue, type ReleaseConfidenceMetrics, type ReleaseConfidenceScorecard, type ReleaseTraceEvidence, type RepeatedActionOptions, type RequiredPairsForPairedPromotionOptions, type RequiredPairsForPairedPromotionResult, type RequirementCheck, type ResearchReport, type ResearchReportOptions, type Researcher, type RetryWrite, type Review, type ReviewFn, type ReviewInput, type ReviewMemoryEntry, type ReviewMemoryStore, type RiskDifferenceResult, type RolloutSearchLineage, type RouteMap, type RoutedField, type RubricDimension, type Run, type RunCampaignOptions, type RunCaptureReport, type RunCommandInput, type RunCommandResult, type RunCostProvenance, type RunFilter, RunIntegrityError, type RunIntegrityReport, type RunJudgeMetadata, type RunOutcome, type RunPaidCallInput, type RunRecord, type RunRecordBackend, RunRecordValidationError, type RunScore, type RunScoreWeights, type RunSearchCoordinates, type RunSplitTag, type RunStatus, type RunTaskFailure, type RunTerminalOutcome, type RunTokenUsage, type RunTraceRef, type RuntimeEventLike, type RuntimeTrajectoryEvidenceProjection, type RuntimeTrajectoryEvidenceSummary, type RuntimeTrajectoryHookEvent, type RuntimeTrajectoryRecord, type RuntimeTrajectoryRunRecord, SEMANTIC_CONCEPT_JUDGE_VERSION, type SampleSummary, type SampleSummaryOptions, type SandboxDriver, type SandboxSdkTransportOpts, type SatisfiedBy, type Scenario$1 as Scenario, type ScenarioCost, type ScenarioFile, type ScenarioResult, type ScorePreference, type ScoreRiskDifferenceResult, type Scorecard, type ScorecardCell, type ScorecardCellDiff, type ScorecardDiff, type ScorecardEntry, type ScorecardLogLine, type SearchSpanResult, type SearchTraceResult, type SelfImproveBudget, type SelfImproveMethodOptions, type SelfImproveMethodProvenance, type SelfImproveMethodResult, type SelfImproveOptions, type SelfImproveProgressEvent, type SelfImproveProposerOptions, type SelfImproveProposerResult, type SelfImproveResult, type SemanticConceptJudgeInput, type SemanticConceptJudgeOptions, type SemanticConceptJudgeResult, type SequentialDecision, type SeriesConvergenceOptions, type SeriesConvergenceResult, type SeriesDistribution, ServedCrossFamilyError, type ServedModelCheck, type ServedModelPolicy, type ServedModelVerdict, type Severity, type ShareSafetyStatus, type ShareSafetyVerdict, type SignTestAlternative, type SingleBackendDivergence, type SingleBackendReport, type Span, type SpanFilter, type SpanHandle, type SpanMatchRecord, type SpanPredicate, type SpanRecordsToTraceAnalysisStoreOptions, type SplitCoverage, type SteeringBundle, type SteeringChange, type SteeringOptimizationResult, type SteeringOptimizationRow, type StopDecision, type StrategyChecker, type StreamingDetector, type SummaryTable, type SummaryTableOptions, type SummaryTableRow, type SynthesisTarget, TRACE_ANALYST_TRUNCATION_MARKER_PREFIX, type TaskGold, type TaskHeadroom, type ToolCallEventLike, type ToolSpan, type ToolStats, type ToolUseMetrics, type ToolUseOptions, type TraceAnalysisEngine, type TraceAnalysisEngineResult, type TraceAnalysisStore, type TraceAnalystByteBudgets, type TraceAnalystDefinition, type TraceAnalystFilters, type TraceAnalystSpan, type TraceAnalystSpanKind, type TraceAnalystSpanStatus, type TraceAnalystTraceSummary, type TraceContract, type TraceContractSpec, TraceEmitter, type TraceEmitterOptions, type TraceEvent, type TraceInsightReadiness, type TraceInsightSuite, type TraceStore, type TrainSelectionTestOptions, type TrainSelectionTestPartition, type Trajectory, type TrajectoryStep, type TreatmentGate, type TreatmentGateInput, type TreatmentGateOptions, type TrialTrace, type Turn, type TurnResult, UNKNOWN_MODEL, type UserQuestion, VERIFICATION_STRATEGIES, VERIFICATION_STRATEGY_SOURCES, ValidationError, type VerbosityBiasResult, type Verdict, type VerdictCacheStore, type VerdictCertification, type Verification, type VerificationReport, type VerificationStrategyProfile, type VerificationStrategySource, type VerifyFn, type VerifyOptions, type ViewSpansResult, type ViewTraceOversized, type ViewTraceResult, type ViteDeployRunnerInput, type WeightedCompositeInput, type WeightedCompositeResult, type WelchTestResult, type WelchTestStatus, type WilcoxonSignedRankResult, type WranglerDeployRunnerInput, addCalibrationVerdicts, agentProfileCellKey, agentProfileHash, agentProfileId, analystFindingDigest, analystRunDigest, analystRunToFeedbackTrajectory, analystRunToReviewRequests, analyzeRuns, analyzeSeries, analyzeTraces, argHash, assertCrossFamily, assertCrossFamilyServed, assertJudgeMayGate, assertRealBackend, assertRunCaptured, assertServedModel, assertServedModels, assessShareSafety, assignFeedbackSplit, attest, benjaminiHochberg, bonferroni, bootstrapCi, budgetBreachView, buildAgentProfileCell, buildDefaultAnalystRegistry, buildEquivalenceRecord, buildTraceInsightContext, buildTraceInsightPrompt, buildTrajectory, calibrateJudge, calibrateJudgeContinuous, captureFetchToRawSink, certificationEvidenceDigest, checkServedModel, classifyFailure, classifyFailureReason, comparePairedArms, completionVerdict, computeFindingId, computeToolUseMetrics, confidenceInterval, continuousAgreement, controlRunToFeedbackTrajectory, corpusInterRaterAgreement, corpusInterRaterAgreementFromJudgeScores, createBoundedTraceAnalysisStore, createChatClient, createChatTraceEngine, createDspyRlmTraceEngine, createFeedbackTrajectory, createLlmCorrectnessChecker, createTraceAnalyst, decidePairedPromotion, defineAgentEval, defineEquivalenceCheck, describeTraceInsightScope, diffFindings, domainEvidencePattern, dominates, eProcess, equivalenceVerdict, evaluateInterimReleaseConfidence, evaluateReleaseConfidence, expandProfileAxes, exportRunAsOtlp, extractProducedState, extractUsage, extractUsageFromSse, failureBlame, failureClusterView, feedbackTrajectoriesToDatasetScenarios, feedbackTrajectoriesToOptimizerRows, feedbackTrajectoryToOptimizerRow, gainHistogram, gradeSemanticStatus, groupRunsByAgentProfileCell, harnessAxisOf, hashJson, holm, inferDomainKeywords, interRaterReliability, iqr, isBinaryOutcomeVector, isJudgeSpan, isLlmSpan, isRunRecord, isToolSpan, judgeAgreementView, judgeFamily, judgeGateDecision, judgeSpans, llmJudge, makeFinding, makeProposalFinding, manifestContentDigest, mannWhitneyU, mcnemar, mcnemarPower, mcnemarRequiredN, measureJudgeAgreement, mintRolloutRows, modelHasSnapshot, mulberry32, otlpTextToTraceAnalysisStore, pairArms, pairRunRecords, pairedBinaryScale, pairedBootstrap, pairedDeltaTieFraction, pairedEvalueSequence, pairedMde, pairedRiskDifference, pairedRiskDifferenceExact, pairedRiskDifferenceScore, pairedSignTest, pairedTTest, paretoChart, paretoFrontier, parseRunRecordSafe, partialCredit, passAtK, pearsonR, index_d_exports as profile, quotaExhaustedUntil, ranks, redTeamDataset, redTeamReport, redact, redactForShare, redactText, registerCalibrationSet, renderPreferenceMemoryMarkdown, requiredPairedSampleSize, requiredSampleSize, runCampaign, runCanaries, runCounterfactual, runEquivalenceCheck, runEvalCampaign, runSemanticConceptJudge, runTaskScore, runsForScenario, scoreRedTeamOutput, scoreTraceInsightReadiness, searchCellRunId, selfImprove, servedModelAcceptable, shareAllowed, snapshotFromJudgeAgreement, spanRecordsToTraceAnalysisStore, spearmanR, summarizeBackendIntegrity, summarizeNumberSeries, summarizePreferenceMemory, summaryTable, toAgentProfileJson, tokenizeDomainWords, toolSpansToTraceAnalysisStore, toolWasteView, transientDispatchFailure, validateRunRecord, verbosityBias, verifyAgentProfileCell, verifyAttestation, verifyCompletion, weightedComposite, weightedMean, welchsTTest, wilcoxonSignedRank, wilson, withAssignedFeedbackSplit };
3748
3846
  //# sourceMappingURL=index.d.ts.map