@tangle-network/agent-eval 1.0.40 → 2.0.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 (398) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/dist/adapters/http.d.ts +3 -3
  3. package/dist/{agent-profile-DgbRJpSi.js → agent-profile-CCw6EXWW.js} +2 -2
  4. package/dist/{agent-profile-DgbRJpSi.js.map → agent-profile-CCw6EXWW.js.map} +1 -1
  5. package/dist/{agent-profile-hytrwAnN.d.ts → agent-profile-CcOq7bOO.d.ts} +84 -5
  6. package/dist/agent-profile-CcOq7bOO.d.ts.map +1 -0
  7. package/dist/{agent-profile-cell-7Mt0wBkl.js → agent-profile-cell-CUthydZB.js} +2 -2
  8. package/dist/{agent-profile-cell-7Mt0wBkl.js.map → agent-profile-cell-CUthydZB.js.map} +1 -1
  9. package/dist/analyst/index.d.ts +15 -15
  10. package/dist/analyst/index.d.ts.map +1 -1
  11. package/dist/analyst/index.js +15 -15
  12. package/dist/analyst/index.js.map +1 -1
  13. package/dist/{analyze-runs-DqHx3Q_g.js → analyze-runs-C_9cXPZn.js} +9 -9
  14. package/dist/{analyze-runs-DqHx3Q_g.js.map → analyze-runs-C_9cXPZn.js.map} +1 -1
  15. package/dist/{analyze-runs-Ctuz-dd3.d.ts → analyze-runs-Ke0WbAf6.d.ts} +4 -4
  16. package/dist/{analyze-runs-Ctuz-dd3.d.ts.map → analyze-runs-Ke0WbAf6.d.ts.map} +1 -1
  17. package/dist/app-grade/index.d.ts +5 -5
  18. package/dist/app-grade/index.js +5 -5
  19. package/dist/authenticity/index.d.ts.map +1 -1
  20. package/dist/authenticity/index.js.map +1 -1
  21. package/dist/{benchmark-command-CJw3ijDV.js → benchmark-command-BIMwcK97.js} +15 -14
  22. package/dist/benchmark-command-BIMwcK97.js.map +1 -0
  23. package/dist/benchmarks/index.d.ts +9 -5
  24. package/dist/benchmarks/index.d.ts.map +1 -1
  25. package/dist/benchmarks/index.js +11 -6
  26. package/dist/benchmarks/index.js.map +1 -1
  27. package/dist/builder-eval/index.d.ts +1 -1
  28. package/dist/builder-eval/index.js +3 -3
  29. package/dist/{calibration-BBhY1QM6.js → calibration-Cfoup0xz.js} +3 -3
  30. package/dist/{calibration-BBhY1QM6.js.map → calibration-Cfoup0xz.js.map} +1 -1
  31. package/dist/campaign/index.d.ts +10 -10
  32. package/dist/campaign/index.js +16 -15
  33. package/dist/{campaign-DawSkDag.js → campaign-C4rXvh2q.js} +33 -25
  34. package/dist/campaign-C4rXvh2q.js.map +1 -0
  35. package/dist/{campaign-evidence-C1c6uihA.d.ts → campaign-evidence-BmMs8YJt.d.ts} +7 -7
  36. package/dist/{campaign-evidence-C1c6uihA.d.ts.map → campaign-evidence-BmMs8YJt.d.ts.map} +1 -1
  37. package/dist/{campaign-evidence-BX8OveG5.js → campaign-evidence-D_oBFfLc.js} +92 -32
  38. package/dist/campaign-evidence-D_oBFfLc.js.map +1 -0
  39. package/dist/{canonical-gLeHiqzd.d.ts → canonical-CGXS21f_.d.ts} +8 -5
  40. package/dist/{canonical-gLeHiqzd.d.ts.map → canonical-CGXS21f_.d.ts.map} +1 -1
  41. package/dist/{canonical-BANK6NOj.js → canonical-DKgL_Wby.js} +30 -8
  42. package/dist/canonical-DKgL_Wby.js.map +1 -0
  43. package/dist/{chat-client-DmPB31_2.js → chat-client-CvyDOQBv.js} +2 -2
  44. package/dist/{chat-client-DmPB31_2.js.map → chat-client-CvyDOQBv.js.map} +1 -1
  45. package/dist/{chat-json-call-Rfhu7JbJ.js → chat-json-call-DMrwmB-k.js} +2 -2
  46. package/dist/{chat-json-call-Rfhu7JbJ.js.map → chat-json-call-DMrwmB-k.js.map} +1 -1
  47. package/dist/{claim-C6LRiwz1.js → claim-BWEXwwBk.js} +2 -2
  48. package/dist/{claim-C6LRiwz1.js.map → claim-BWEXwwBk.js.map} +1 -1
  49. package/dist/cli.js +11 -11
  50. package/dist/{client-BIFwUg7I.d.ts → client-DUMIaMob.d.ts} +2 -2
  51. package/dist/{client-BIFwUg7I.d.ts.map → client-DUMIaMob.d.ts.map} +1 -1
  52. package/dist/{cluster-CSd0LE_M.d.ts → cluster-Bj90LK-1.d.ts} +2 -2
  53. package/dist/{cluster-CSd0LE_M.d.ts.map → cluster-Bj90LK-1.d.ts.map} +1 -1
  54. package/dist/{cluster-bootstrap-ClPYIWoX.js → cluster-bootstrap-DPzVy3_K.js} +2 -2
  55. package/dist/{cluster-bootstrap-ClPYIWoX.js.map → cluster-bootstrap-DPzVy3_K.js.map} +1 -1
  56. package/dist/{completion-verifier-oAgSwdFe.d.ts → completion-verifier-Cy38EpGE.d.ts} +3 -3
  57. package/dist/{completion-verifier-oAgSwdFe.d.ts.map → completion-verifier-Cy38EpGE.d.ts.map} +1 -1
  58. package/dist/{completion-verifier-C3q1T96h.js → completion-verifier-DsotH2l3.js} +7 -7
  59. package/dist/{completion-verifier-C3q1T96h.js.map → completion-verifier-DsotH2l3.js.map} +1 -1
  60. package/dist/containment-order-GCJ-y_FV.js +56 -0
  61. package/dist/containment-order-GCJ-y_FV.js.map +1 -0
  62. package/dist/contract/index.d.ts +14 -14
  63. package/dist/contract/index.js +17 -17
  64. package/dist/contract/index.js.map +1 -1
  65. package/dist/{cost-ledger-1CwUnVOd.js → cost-ledger-C5CCidPm.js} +9 -2
  66. package/dist/cost-ledger-C5CCidPm.js.map +1 -0
  67. package/dist/{cost-ledger-Czro9wmo.d.ts → cost-ledger-CSP-OfFe.d.ts} +7 -1
  68. package/dist/cost-ledger-CSP-OfFe.d.ts.map +1 -0
  69. package/dist/{decision-point-BN1YQNqk.js → decision-point-C46p-p9v.js} +9 -9
  70. package/dist/{decision-point-BN1YQNqk.js.map → decision-point-C46p-p9v.js.map} +1 -1
  71. package/dist/{default-registry-C5x2jyD6.d.ts → default-registry-CUuorCWZ.d.ts} +7 -7
  72. package/dist/{default-registry-C5x2jyD6.d.ts.map → default-registry-CUuorCWZ.d.ts.map} +1 -1
  73. package/dist/{default-registry-BE5Rj9ba.js → default-registry-D6WZm_vR.js} +9 -9
  74. package/dist/default-registry-D6WZm_vR.js.map +1 -0
  75. package/dist/{define-agent-eval-CyU7eAzj.js → define-agent-eval-CNvv_D6O.js} +20 -12
  76. package/dist/define-agent-eval-CNvv_D6O.js.map +1 -0
  77. package/dist/{define-agent-eval-C4yoCqkc.d.ts → define-agent-eval-D17XsdAt.d.ts} +22 -13
  78. package/dist/define-agent-eval-D17XsdAt.d.ts.map +1 -0
  79. package/dist/diagnosis/index.d.ts +3 -3
  80. package/dist/diagnosis/index.d.ts.map +1 -1
  81. package/dist/diagnosis/index.js +1 -1
  82. package/dist/diagnosis/index.js.map +1 -1
  83. package/dist/{dspy-rlm-engine-aM1RWOUT.js → dspy-rlm-engine-s6iexObG.js} +5 -4
  84. package/dist/dspy-rlm-engine-s6iexObG.js.map +1 -0
  85. package/dist/{emitter-DhQ65mza.js → emitter-BjW3NnX-.js} +15 -6
  86. package/dist/emitter-BjW3NnX-.js.map +1 -0
  87. package/dist/{emitter-mAXC5PSN.d.ts → emitter-Cw8ijO3v.d.ts} +4 -4
  88. package/dist/{emitter-mAXC5PSN.d.ts.map → emitter-Cw8ijO3v.d.ts.map} +1 -1
  89. package/dist/{engine-B2w3ARpj.d.ts → engine-BZVXOc6n.d.ts} +3 -3
  90. package/dist/{engine-B2w3ARpj.d.ts.map → engine-BZVXOc6n.d.ts.map} +1 -1
  91. package/dist/errors-DeEEV9Vx.js.map +1 -1
  92. package/dist/{eval-campaign-CWWh-1p1.js → eval-campaign-Cyk-tkLh.js} +5 -5
  93. package/dist/{eval-campaign-CWWh-1p1.js.map → eval-campaign-Cyk-tkLh.js.map} +1 -1
  94. package/dist/{evaluation-C_GJvEEG.js → evaluation-BAisv8ZR.js} +2 -2
  95. package/dist/{evaluation-C_GJvEEG.js.map → evaluation-BAisv8ZR.js.map} +1 -1
  96. package/dist/{evaluation-CQ-uAbqF.d.ts → evaluation-DfyLPVL1.d.ts} +5 -5
  97. package/dist/{evaluation-CQ-uAbqF.d.ts.map → evaluation-DfyLPVL1.d.ts.map} +1 -1
  98. package/dist/evaluation.d.ts +1 -1
  99. package/dist/evaluation.js +1 -1
  100. package/dist/{exact-types-B0_jA3V7.d.ts → exact-types-CiCXYhNK.d.ts} +2 -2
  101. package/dist/{exact-types-B0_jA3V7.d.ts.map → exact-types-CiCXYhNK.d.ts.map} +1 -1
  102. package/dist/{execution-insight-9No6Si55.d.ts → execution-insight-wUNXxo5Y.d.ts} +3 -3
  103. package/dist/{execution-insight-9No6Si55.d.ts.map → execution-insight-wUNXxo5Y.d.ts.map} +1 -1
  104. package/dist/experiment/index.d.ts +4 -4
  105. package/dist/experiment/index.d.ts.map +1 -1
  106. package/dist/experiment/index.js +10 -10
  107. package/dist/experiment/index.js.map +1 -1
  108. package/dist/{exporters-C9AwGDDK.js → exporters-CKFtnWmX.js} +2 -2
  109. package/dist/{exporters-C9AwGDDK.js.map → exporters-CKFtnWmX.js.map} +1 -1
  110. package/dist/external-optimizer-contracts-ZDBfbZ_s.js +123 -0
  111. package/dist/external-optimizer-contracts-ZDBfbZ_s.js.map +1 -0
  112. package/dist/{external-optimizer-process-DFEPdWJY.js → external-optimizer-process-wxSzICQX.js} +22 -26
  113. package/dist/external-optimizer-process-wxSzICQX.js.map +1 -0
  114. package/dist/{external-optimizer-subprocess-BspZ0bZb.js → external-optimizer-subprocess-DeMYwEd5.js} +11 -125
  115. package/dist/external-optimizer-subprocess-DeMYwEd5.js.map +1 -0
  116. package/dist/extract-usage-ISFqhfDz.js.map +1 -1
  117. package/dist/{feedback-trajectory-CCWiFzeE.d.ts → feedback-trajectory-HJticMDz.d.ts} +4 -4
  118. package/dist/{feedback-trajectory-CCWiFzeE.d.ts.map → feedback-trajectory-HJticMDz.d.ts.map} +1 -1
  119. package/dist/{finding-composition-BMgspnVI.js → finding-composition-CyWSTcAY.js} +2 -2
  120. package/dist/{finding-composition-BMgspnVI.js.map → finding-composition-CyWSTcAY.js.map} +1 -1
  121. package/dist/{findings-store-B8pq8Rhr.js → findings-store-D09YcDnR.js} +6 -6
  122. package/dist/{findings-store-B8pq8Rhr.js.map → findings-store-D09YcDnR.js.map} +1 -1
  123. package/dist/fuzz.d.ts +1 -1
  124. package/dist/fuzz.d.ts.map +1 -1
  125. package/dist/fuzz.js +2 -2
  126. package/dist/fuzz.js.map +1 -1
  127. package/dist/{harness-session-lines-Fd5aeSDV.js → harness-session-lines-CSxKR6no.js} +3 -3
  128. package/dist/{harness-session-lines-Fd5aeSDV.js.map → harness-session-lines-CSxKR6no.js.map} +1 -1
  129. package/dist/{hf-dataset-kthWy7xl.js → hf-dataset-B0s2ZAhQ.js} +4 -4
  130. package/dist/{hf-dataset-kthWy7xl.js.map → hf-dataset-B0s2ZAhQ.js.map} +1 -1
  131. package/dist/hosted/index.d.ts +2 -2
  132. package/dist/hosted/index.js +1 -1
  133. package/dist/{index-BuuUhU_V.d.ts → index-B_k8aY9k.d.ts} +44 -32
  134. package/dist/index-B_k8aY9k.d.ts.map +1 -0
  135. package/dist/{index-DtW7KhyE.d.ts → index-C6TG1LwA.d.ts} +5 -5
  136. package/dist/{index-DtW7KhyE.d.ts.map → index-C6TG1LwA.d.ts.map} +1 -1
  137. package/dist/{index-Bcy00QoN.d.ts → index-CKjqN9_U.d.ts} +87 -87
  138. package/dist/index-CKjqN9_U.d.ts.map +1 -0
  139. package/dist/{index-CXoFLNKI.d.ts → index-CR-guIiZ.d.ts} +11 -11
  140. package/dist/index-CR-guIiZ.d.ts.map +1 -0
  141. package/dist/{index-DwUGehqX.d.ts → index-DsgqP-Hg.d.ts} +2 -2
  142. package/dist/{index-DwUGehqX.d.ts.map → index-DsgqP-Hg.d.ts.map} +1 -1
  143. package/dist/{index-HdlzN11G.d.ts → index-Ucp54Pcl.d.ts} +9 -9
  144. package/dist/{index-HdlzN11G.d.ts.map → index-Ucp54Pcl.d.ts.map} +1 -1
  145. package/dist/{index-Bhc7H9e0.d.ts → index-oX0TuJFv.d.ts} +7 -7
  146. package/dist/{index-Bhc7H9e0.d.ts.map → index-oX0TuJFv.d.ts.map} +1 -1
  147. package/dist/{index-lRKqfyg4.d.ts → index-qy6buL6y.d.ts} +2 -2
  148. package/dist/{index-lRKqfyg4.d.ts.map → index-qy6buL6y.d.ts.map} +1 -1
  149. package/dist/index.d.ts +35 -35
  150. package/dist/index.js +42 -42
  151. package/dist/index.js.map +1 -1
  152. package/dist/{integrity-BMyCpnZ8.d.ts → integrity-B9320cw1.d.ts} +2 -2
  153. package/dist/{integrity-BMyCpnZ8.d.ts.map → integrity-B9320cw1.d.ts.map} +1 -1
  154. package/dist/{integrity-BSs9dgKW.js → integrity-BF0tJK21.js} +3 -3
  155. package/dist/{integrity-BSs9dgKW.js.map → integrity-BF0tJK21.js.map} +1 -1
  156. package/dist/{journal-DQsbHGjX.js → journal-3y-btqaP.js} +2 -2
  157. package/dist/{journal-DQsbHGjX.js.map → journal-3y-btqaP.js.map} +1 -1
  158. package/dist/journal-file-AekB57Er.js.map +1 -1
  159. package/dist/{json-recovery-b7O9WVTF.js → json-recovery-BRUCeQxo.js} +2 -2
  160. package/dist/{json-recovery-b7O9WVTF.js.map → json-recovery-BRUCeQxo.js.map} +1 -1
  161. package/dist/{judge-gate-LbmZU-pA.js → judge-gate-DqlzOBOm.js} +3 -3
  162. package/dist/{judge-gate-LbmZU-pA.js.map → judge-gate-DqlzOBOm.js.map} +1 -1
  163. package/dist/{kind-factory-B5FfFE5G.js → kind-factory-Bs-oaT61.js} +4 -4
  164. package/dist/kind-factory-Bs-oaT61.js.map +1 -0
  165. package/dist/ledger-core/index.d.ts +2 -2
  166. package/dist/ledger-core/index.js +3 -3
  167. package/dist/{ledger-core-7e6sXmhV.js → ledger-core-auznoaD7.js} +3 -3
  168. package/dist/ledger-core-auznoaD7.js.map +1 -0
  169. package/dist/{llm-client-CdHo3SH0.js → llm-client-Dw4x6EdE.js} +3 -3
  170. package/dist/{llm-client-CdHo3SH0.js.map → llm-client-Dw4x6EdE.js.map} +1 -1
  171. package/dist/{llm-judge-DHgx29ro.js → llm-judge-OZtO1yNS.js} +183 -78
  172. package/dist/llm-judge-OZtO1yNS.js.map +1 -0
  173. package/dist/matrix/index.d.ts +2 -2
  174. package/dist/{matrix-BKzNwIWb.d.ts → matrix-DlSrRl_v.d.ts} +4 -4
  175. package/dist/{matrix-BKzNwIWb.d.ts.map → matrix-DlSrRl_v.d.ts.map} +1 -1
  176. package/dist/meta-eval/index.d.ts +2 -2
  177. package/dist/meta-eval/index.js +9 -9
  178. package/dist/{mint-VN-qtJTc.js → mint-B4n1pRRd.js} +12 -6
  179. package/dist/mint-B4n1pRRd.js.map +1 -0
  180. package/dist/{model-comparison-BZr_Hu00.js → model-comparison-CgnVh4Ph.js} +3 -3
  181. package/dist/{model-comparison-BZr_Hu00.js.map → model-comparison-CgnVh4Ph.js.map} +1 -1
  182. package/dist/multishot/golden/index.d.ts +1 -1
  183. package/dist/multishot/index.d.ts +3 -3
  184. package/dist/multishot/index.js +2 -2
  185. package/dist/multishot/index.js.map +1 -1
  186. package/dist/openapi.json +1 -1
  187. package/dist/{outcome-observations-YFFmdGGW.js → outcome-observations-DL3CC8w1.js} +2 -2
  188. package/dist/{outcome-observations-YFFmdGGW.js.map → outcome-observations-DL3CC8w1.js.map} +1 -1
  189. package/dist/{paired-arms-DH376s4-.js → paired-arms-DZhH3FGu.js} +3 -3
  190. package/dist/{paired-arms-DH376s4-.js.map → paired-arms-DZhH3FGu.js.map} +1 -1
  191. package/dist/{paired-promotion-decision-BBSxTo-h.d.ts → paired-promotion-decision-ChHBuuHV.d.ts} +2 -2
  192. package/dist/{paired-promotion-decision-BBSxTo-h.d.ts.map → paired-promotion-decision-ChHBuuHV.d.ts.map} +1 -1
  193. package/dist/{paired-promotion-decision-BoWHWL1i.js → paired-promotion-decision-Dn3-jaq4.js} +2 -2
  194. package/dist/{paired-promotion-decision-BoWHWL1i.js.map → paired-promotion-decision-Dn3-jaq4.js.map} +1 -1
  195. package/dist/{paired-promotion-power-BXH3gzvs.js → paired-promotion-power-BlzXdgMD.js} +3 -3
  196. package/dist/{paired-promotion-power-BXH3gzvs.js.map → paired-promotion-power-BlzXdgMD.js.map} +1 -1
  197. package/dist/{pareto-BNWWbLNl.js → pareto-Bg75Gajo.js} +7 -7
  198. package/dist/{pareto-BNWWbLNl.js.map → pareto-Bg75Gajo.js.map} +1 -1
  199. package/dist/pipelines/index.d.ts +3 -3
  200. package/dist/pipelines/index.d.ts.map +1 -1
  201. package/dist/pipelines/index.js +19 -33
  202. package/dist/pipelines/index.js.map +1 -1
  203. package/dist/{prime-protocol-BR0xy0cF.d.ts → prime-protocol-iEaSEGZB.d.ts} +3 -3
  204. package/dist/{prime-protocol-BR0xy0cF.d.ts.map → prime-protocol-iEaSEGZB.d.ts.map} +1 -1
  205. package/dist/profile-cell.js +1 -1
  206. package/dist/{promotion-gate-XiTqW22r.d.ts → promotion-gate-CGkxh36r.d.ts} +3 -3
  207. package/dist/{promotion-gate-XiTqW22r.d.ts.map → promotion-gate-CGkxh36r.d.ts.map} +1 -1
  208. package/dist/{promotion-policy-CfgRPGx0.js → promotion-policy-CxDIh-9p.js} +4 -4
  209. package/dist/{promotion-policy-CfgRPGx0.js.map → promotion-policy-CxDIh-9p.js.map} +1 -1
  210. package/dist/{proposal-findings-DFQvA-k5.js → proposal-findings-Bi4ouHdc.js} +2 -2
  211. package/dist/{proposal-findings-DFQvA-k5.js.map → proposal-findings-Bi4ouHdc.js.map} +1 -1
  212. package/dist/{query-Ck6KhcDo.js → query-Dhjkwqyx.js} +2 -2
  213. package/dist/{query-Ck6KhcDo.js.map → query-Dhjkwqyx.js.map} +1 -1
  214. package/dist/{registry-D23oO0_f.d.ts → registry-V8o2kZtn.d.ts} +5 -5
  215. package/dist/{registry-D23oO0_f.d.ts.map → registry-V8o2kZtn.d.ts.map} +1 -1
  216. package/dist/{release-confidence-BdidB0mG.js → release-confidence-BLHOMK5Q.js} +3 -3
  217. package/dist/{release-confidence-BdidB0mG.js.map → release-confidence-BLHOMK5Q.js.map} +1 -1
  218. package/dist/reporting.d.ts +6 -6
  219. package/dist/reporting.js +5 -5
  220. package/dist/{research-report-BGKsOqkF.d.ts → research-report-D6XIK0eK.d.ts} +4 -4
  221. package/dist/{research-report-BGKsOqkF.d.ts.map → research-report-D6XIK0eK.d.ts.map} +1 -1
  222. package/dist/{researcher-DvFDa1o1.d.ts → researcher---DhHG4J.d.ts} +6 -6
  223. package/dist/{researcher-DvFDa1o1.d.ts.map → researcher---DhHG4J.d.ts.map} +1 -1
  224. package/dist/{reward-hacking-CLMvxEY_.d.ts → reward-hacking-4DsGTccp.d.ts} +2 -2
  225. package/dist/{reward-hacking-CLMvxEY_.d.ts.map → reward-hacking-4DsGTccp.d.ts.map} +1 -1
  226. package/dist/{reward-hacking-DNiHskry.js → reward-hacking-DKAflk2c.js} +2 -2
  227. package/dist/{reward-hacking-DNiHskry.js.map → reward-hacking-DKAflk2c.js.map} +1 -1
  228. package/dist/rl.d.ts +158 -42
  229. package/dist/rl.d.ts.map +1 -1
  230. package/dist/rl.js +420 -76
  231. package/dist/rl.js.map +1 -1
  232. package/dist/rollout/index.d.ts +4 -4
  233. package/dist/rollout/index.js +6 -6
  234. package/dist/{rollout-DDMkK_Lw.js → rollout-DVwpCHBC.js} +9 -9
  235. package/dist/rollout-DVwpCHBC.js.map +1 -0
  236. package/dist/{rollout-nodes-DzmHlPAC.js → rollout-nodes-Vas6OSxX.js} +2 -2
  237. package/dist/{rollout-nodes-DzmHlPAC.js.map → rollout-nodes-Vas6OSxX.js.map} +1 -1
  238. package/dist/{rubric-predictive-validity-Cln7r56F.js → rubric-predictive-validity--6z0q8s6.js} +2 -2
  239. package/dist/{rubric-predictive-validity-Cln7r56F.js.map → rubric-predictive-validity--6z0q8s6.js.map} +1 -1
  240. package/dist/{rubric-predictive-validity-B7rsN074.d.ts → rubric-predictive-validity-C9wc7f_D.d.ts} +2 -2
  241. package/dist/{rubric-predictive-validity-B7rsN074.d.ts.map → rubric-predictive-validity-C9wc7f_D.d.ts.map} +1 -1
  242. package/dist/{run-improvement-loop-BAxDnaPI.d.ts → run-improvement-loop-CtLyPb5-.d.ts} +140 -81
  243. package/dist/run-improvement-loop-CtLyPb5-.d.ts.map +1 -0
  244. package/dist/{run-record-c860wUR8.js → run-record-Bqg0NZ_e.js} +19 -4
  245. package/dist/run-record-Bqg0NZ_e.js.map +1 -0
  246. package/dist/{run-record-Dx64nPcX.js → run-record-CqUft6Yf.js} +2 -2
  247. package/dist/{run-record-Dx64nPcX.js.map → run-record-CqUft6Yf.js.map} +1 -1
  248. package/dist/{run-record-CCJR7q_j.d.ts → run-record-kuOr3BCF.d.ts} +2 -2
  249. package/dist/{run-record-CCJR7q_j.d.ts.map → run-record-kuOr3BCF.d.ts.map} +1 -1
  250. package/dist/{runtime-rollouts-CALol_Y4.js → runtime-rollouts-DdUijr_t.js} +7 -7
  251. package/dist/runtime-rollouts-DdUijr_t.js.map +1 -0
  252. package/dist/{schema-BTTzvMnn.d.ts → schema-BfSoJjD-.d.ts} +5 -1
  253. package/dist/schema-BfSoJjD-.d.ts.map +1 -0
  254. package/dist/{schema-b18jtzZw.js → schema-Bh9CfSZT.js} +3 -1
  255. package/dist/schema-Bh9CfSZT.js.map +1 -0
  256. package/dist/schema-CkIvnmLU.d.ts.map +1 -1
  257. package/dist/schema-D-xu3MU_.js.map +1 -1
  258. package/dist/search/index.d.ts +3 -3
  259. package/dist/search/index.d.ts.map +1 -1
  260. package/dist/search/index.js +3 -3
  261. package/dist/{search-kernel-DRHWY35J.d.ts → search-kernel-DXA1EhnN.d.ts} +7 -7
  262. package/dist/{search-kernel-DRHWY35J.d.ts.map → search-kernel-DXA1EhnN.d.ts.map} +1 -1
  263. package/dist/{search-ledger-oyqxZhry.js → search-ledger-C7t68cmy.js} +7 -7
  264. package/dist/{search-ledger-oyqxZhry.js.map → search-ledger-C7t68cmy.js.map} +1 -1
  265. package/dist/{search-ledger-file-DoHCYYLt.js → search-ledger-file-QuIbgz6b.js} +2 -2
  266. package/dist/search-ledger-file-QuIbgz6b.js.map +1 -0
  267. package/dist/{search-ledger-types-qiYRUo_N.d.ts → search-ledger-types-BhZE848w.d.ts} +2 -2
  268. package/dist/{search-ledger-types-qiYRUo_N.d.ts.map → search-ledger-types-BhZE848w.d.ts.map} +1 -1
  269. package/dist/{search-shipper-BwqeQ61l.js → search-shipper-CmDW9dU6.js} +3 -3
  270. package/dist/{search-shipper-BwqeQ61l.js.map → search-shipper-CmDW9dU6.js.map} +1 -1
  271. package/dist/{search-summary-CNHpHFfw.js → search-summary-B1x1Vmzh.js} +5 -5
  272. package/dist/{search-summary-CNHpHFfw.js.map → search-summary-B1x1Vmzh.js.map} +1 -1
  273. package/dist/{sequential-B-zx24n_.d.ts → sequential-BhbTSxpt.d.ts} +2 -2
  274. package/dist/{sequential-B-zx24n_.d.ts.map → sequential-BhbTSxpt.d.ts.map} +1 -1
  275. package/dist/{sequential-93xxuiiG.js → sequential-BphITa5b.js} +4 -4
  276. package/dist/{sequential-93xxuiiG.js.map → sequential-BphITa5b.js.map} +1 -1
  277. package/dist/{sequential-C6k0Wrb7.js → sequential-ux_XrjBf.js} +3 -3
  278. package/dist/{sequential-C6k0Wrb7.js.map → sequential-ux_XrjBf.js.map} +1 -1
  279. package/dist/{served-model-qhLmbutL.js → served-model-BXmeKm7D.js} +2 -2
  280. package/dist/{served-model-qhLmbutL.js.map → served-model-BXmeKm7D.js.map} +1 -1
  281. package/dist/{server-DnoEi4Sb.js → server-1fzBCxMh.js} +5 -5
  282. package/dist/{server-DnoEi4Sb.js.map → server-1fzBCxMh.js.map} +1 -1
  283. package/dist/{skillopt-optimization-method-Du3GbReg.js → skillopt-optimization-method-DTwL-L6q.js} +390 -68
  284. package/dist/skillopt-optimization-method-DTwL-L6q.js.map +1 -0
  285. package/dist/{statistical-heldout-BvcAVtof.js → statistical-heldout-CaS4T-43.js} +3 -3
  286. package/dist/{statistical-heldout-BvcAVtof.js.map → statistical-heldout-CaS4T-43.js.map} +1 -1
  287. package/dist/{statistics-CHs0jlsY.js → statistics-DSidA5I2.js} +184 -184
  288. package/dist/statistics-DSidA5I2.js.map +1 -0
  289. package/dist/statistics.d.ts +2 -2
  290. package/dist/statistics.js +1 -1
  291. package/dist/{store-otlp-DHc_E78m.js → store-otlp-Re9Gwt2B.js} +2 -2
  292. package/dist/{store-otlp-DHc_E78m.js.map → store-otlp-Re9Gwt2B.js.map} +1 -1
  293. package/dist/{store-tool-spans-C1lZKvvl.d.ts → store-tool-spans-C47hUUVM.d.ts} +8 -8
  294. package/dist/{store-tool-spans-C1lZKvvl.d.ts.map → store-tool-spans-C47hUUVM.d.ts.map} +1 -1
  295. package/dist/{store-tool-spans-BR4IhZYZ.js → store-tool-spans-MpjSz292.js} +4 -4
  296. package/dist/{store-tool-spans-BR4IhZYZ.js.map → store-tool-spans-MpjSz292.js.map} +1 -1
  297. package/dist/storyboard/index.d.ts.map +1 -1
  298. package/dist/storyboard/index.js.map +1 -1
  299. package/dist/{summary-report-CXiE1UrA.js → summary-report-CI4J6gxU.js} +4 -4
  300. package/dist/{summary-report-CXiE1UrA.js.map → summary-report-CI4J6gxU.js.map} +1 -1
  301. package/dist/{summary-report-figures-C4JW8fdy.d.ts → summary-report-figures-CJHygLgw.d.ts} +2 -2
  302. package/dist/{summary-report-figures-C4JW8fdy.d.ts.map → summary-report-figures-CJHygLgw.d.ts.map} +1 -1
  303. package/dist/supervisor-run/index.d.ts +2 -2
  304. package/dist/supervisor-run/index.d.ts.map +1 -1
  305. package/dist/supervisor-run/index.js +3 -3
  306. package/dist/{systemone-B_3Vd395.d.ts → systemone-MXhFSYdy.d.ts} +9 -9
  307. package/dist/{systemone-B_3Vd395.d.ts.map → systemone-MXhFSYdy.d.ts.map} +1 -1
  308. package/dist/systemone-protocol.js +1 -1
  309. package/dist/{systemone-review-ZAN-5m_2.d.ts → systemone-review-C9kbs3zD.d.ts} +2 -2
  310. package/dist/{systemone-review-ZAN-5m_2.d.ts.map → systemone-review-C9kbs3zD.d.ts.map} +1 -1
  311. package/dist/{systemone-review-CqNNZMiD.js → systemone-review-ir3Cbejl.js} +3 -3
  312. package/dist/{systemone-review-CqNNZMiD.js.map → systemone-review-ir3Cbejl.js.map} +1 -1
  313. package/dist/systemone.d.ts +3 -3
  314. package/dist/systemone.js +3 -3
  315. package/dist/{tool-groups-BOH1E-E4.d.ts → tool-groups-BSd08M7B.d.ts} +3 -3
  316. package/dist/tool-groups-BSd08M7B.d.ts.map +1 -0
  317. package/dist/tool-waste-CIhtU1ad.d.ts +217 -0
  318. package/dist/tool-waste-CIhtU1ad.d.ts.map +1 -0
  319. package/dist/{tool-waste-DzLI-JJg.js → tool-waste-u7JJ_BlE.js} +3 -3
  320. package/dist/{tool-waste-DzLI-JJg.js.map → tool-waste-u7JJ_BlE.js.map} +1 -1
  321. package/dist/{trace-questions-DBsrgY_H.d.ts → trace-questions-CJANeK9P.d.ts} +4 -4
  322. package/dist/{trace-questions-DBsrgY_H.d.ts.map → trace-questions-CJANeK9P.d.ts.map} +1 -1
  323. package/dist/trace-repair/index.d.ts +3 -3
  324. package/dist/trace-repair/index.d.ts.map +1 -1
  325. package/dist/trace-repair/index.js +4 -4
  326. package/dist/trace-repair/index.js.map +1 -1
  327. package/dist/traces.d.ts +7 -7
  328. package/dist/traces.js +6 -6
  329. package/dist/{training-admission-xaDOlQ_U.d.ts → training-admission-DGZCyntI.d.ts} +2 -2
  330. package/dist/{training-admission-xaDOlQ_U.d.ts.map → training-admission-DGZCyntI.d.ts.map} +1 -1
  331. package/dist/trajectory-CKVZaQoQ.js +144 -0
  332. package/dist/trajectory-CKVZaQoQ.js.map +1 -0
  333. package/dist/trajectory-replay/index.d.ts.map +1 -1
  334. package/dist/trajectory-replay/index.js +24 -11
  335. package/dist/trajectory-replay/index.js.map +1 -1
  336. package/dist/{tree-0r6gPODs.js → tree-DQMlcNFI.js} +18 -6
  337. package/dist/tree-DQMlcNFI.js.map +1 -0
  338. package/dist/{types-DmYd2Igl.d.ts → types-AGUuvnae.d.ts} +4 -4
  339. package/dist/{types-DmYd2Igl.d.ts.map → types-AGUuvnae.d.ts.map} +1 -1
  340. package/dist/{types-_dfu6Ox2.d.ts → types-BLv2Ngla.d.ts} +3 -3
  341. package/dist/{types-_dfu6Ox2.d.ts.map → types-BLv2Ngla.d.ts.map} +1 -1
  342. package/dist/{types-ClDpBoLt.d.ts → types-CE9JMZhk.d.ts} +3 -3
  343. package/dist/{types-ClDpBoLt.d.ts.map → types-CE9JMZhk.d.ts.map} +1 -1
  344. package/dist/{types-DGqGbNY4.d.ts → types-DD1eUTLn.d.ts} +23 -9
  345. package/dist/{types-DGqGbNY4.d.ts.map → types-DD1eUTLn.d.ts.map} +1 -1
  346. package/dist/{types-C8AyaiFi.js → types-_tlhWGUq.js} +2 -2
  347. package/dist/{types-C8AyaiFi.js.map → types-_tlhWGUq.js.map} +1 -1
  348. package/dist/{verdict-CKo1iZkI.js → verdict-5PVtsWT_.js} +2 -2
  349. package/dist/{verdict-CKo1iZkI.js.map → verdict-5PVtsWT_.js.map} +1 -1
  350. package/dist/{verdict-cache-DfzlHLdf.js → verdict-cache-BPaYxfG8.js} +2 -2
  351. package/dist/verdict-cache-BPaYxfG8.js.map +1 -0
  352. package/dist/wire/index.d.ts +5 -5
  353. package/dist/wire/index.js +1 -1
  354. package/docs/campaign-proposers.md +15 -2
  355. package/docs/concepts.md +4 -0
  356. package/docs/public-api.md +325 -87
  357. package/docs/rollout.md +2 -2
  358. package/docs/search-ledger.md +14 -2
  359. package/docs/statistical-evidence.md +9 -3
  360. package/docs/trajectory-replay.md +4 -0
  361. package/package.json +1 -1
  362. package/dist/agent-profile-hytrwAnN.d.ts.map +0 -1
  363. package/dist/benchmark-command-CJw3ijDV.js.map +0 -1
  364. package/dist/campaign-DawSkDag.js.map +0 -1
  365. package/dist/campaign-evidence-BX8OveG5.js.map +0 -1
  366. package/dist/canonical-BANK6NOj.js.map +0 -1
  367. package/dist/cost-ledger-1CwUnVOd.js.map +0 -1
  368. package/dist/cost-ledger-Czro9wmo.d.ts.map +0 -1
  369. package/dist/default-registry-BE5Rj9ba.js.map +0 -1
  370. package/dist/define-agent-eval-C4yoCqkc.d.ts.map +0 -1
  371. package/dist/define-agent-eval-CyU7eAzj.js.map +0 -1
  372. package/dist/dspy-rlm-engine-aM1RWOUT.js.map +0 -1
  373. package/dist/emitter-DhQ65mza.js.map +0 -1
  374. package/dist/external-optimizer-process-DFEPdWJY.js.map +0 -1
  375. package/dist/external-optimizer-subprocess-BspZ0bZb.js.map +0 -1
  376. package/dist/index-Bcy00QoN.d.ts.map +0 -1
  377. package/dist/index-BuuUhU_V.d.ts.map +0 -1
  378. package/dist/index-CXoFLNKI.d.ts.map +0 -1
  379. package/dist/kind-factory-B5FfFE5G.js.map +0 -1
  380. package/dist/ledger-core-7e6sXmhV.js.map +0 -1
  381. package/dist/llm-judge-DHgx29ro.js.map +0 -1
  382. package/dist/mint-VN-qtJTc.js.map +0 -1
  383. package/dist/rollout-DDMkK_Lw.js.map +0 -1
  384. package/dist/run-improvement-loop-BAxDnaPI.d.ts.map +0 -1
  385. package/dist/run-record-c860wUR8.js.map +0 -1
  386. package/dist/runtime-rollouts-CALol_Y4.js.map +0 -1
  387. package/dist/schema-BTTzvMnn.d.ts.map +0 -1
  388. package/dist/schema-b18jtzZw.js.map +0 -1
  389. package/dist/search-ledger-file-DoHCYYLt.js.map +0 -1
  390. package/dist/skillopt-optimization-method-Du3GbReg.js.map +0 -1
  391. package/dist/statistics-CHs0jlsY.js.map +0 -1
  392. package/dist/tool-groups-BOH1E-E4.d.ts.map +0 -1
  393. package/dist/tool-waste-CUASoTtk.d.ts +0 -139
  394. package/dist/tool-waste-CUASoTtk.d.ts.map +0 -1
  395. package/dist/trajectory-O3GDHmev.js +0 -55
  396. package/dist/trajectory-O3GDHmev.js.map +0 -1
  397. package/dist/tree-0r6gPODs.js.map +0 -1
  398. package/dist/verdict-cache-DfzlHLdf.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,107 @@ All notable changes to `@tangle-network/agent-eval` and its sibling `agent-eval-
4
4
 
5
5
  ---
6
6
 
7
+ ## [2.0.1] — 2026-11-20
8
+
9
+ No caller of 2.0.0 must change code. The public surface gains two optional members and loses none. Two behaviors change, and a run directory written by 2.0.1 has a downgrade limit.
10
+
11
+ Behavior changes:
12
+
13
+ - A zero-token call counts as work only when it was declared free before it ran. `runCampaign`'s `expectUsage` (and `selfImprove`'s, whose default is `'assert'`) and the per-loop provenance verdict read the cell's agent receipts. A call counts as work when it reports tokens, or a positive charge, or it was declared free and settled without error at a known $0. To declare a call free, pass `maximumCharge: { externallyEnforcedMaximumUsd: 0 }` to `ctx.cost.runPaidCall`, as a local retrieval or an in-process search does. In 2.0.0 every zero-token call was stub-mode, so a cell whose only call was free was refused with a message saying no call was made. Now it passes if the call was declared free.
14
+ - A zero-token call that reports $0, observed or estimated, without that declaration is still refused. A model call through a provider or proxy that drops usage reports exactly that, and the receipt cannot tell it from a free call. Fix it by reporting the call's usage, or by declaring a call that cannot spend with the zero maximum above. A caller that set `expectUsage: 'off'` only because its free calls were refused can declare them free and set `'assert'` again.
15
+ - The `expectUsage` error text changed. A cell that records no agent call now says that no call was recorded through `ctx.cost.runPaidCall`. A cell whose recorded calls all lack tokens, a charge and a free declaration now names the call count and gives the two fixes. A caller or test that matched the 2.0.0 text ("reported zero cost and zero tokens", "made no paid call") must match the new text or the cell's verdict instead.
16
+
17
+ `summarizeBackendIntegrity`, `assertRealBackend` and `runProfileMatrix`'s integrity assertion keep the 2.0.0 rule. They read run records, which carry no declaration, so a record with zero tokens is stub-mode whatever its cost. A matrix of free calls sets `integrity: 'off'`.
18
+
19
+ Additions (both optional, so a caller or method that ignores them is unchanged):
20
+
21
+ - `CostCallBase.declaredFree?: true` records the declaration on the pending call and on its settled receipt, in the persisted journal and so in the cell cache.
22
+ - `OptimizationMethod.ownsArtifactDescription` marks a method that describes artifacts to its optimizer itself, to redact what it shows or to bind the description into its evaluation identity. Such a method never receives its caller's `describeArtifact`. `compareOptimizationMethods` and `selfImprove` refuse a caller's `describeArtifact` beside it before any spend, with `method '<name>' describes its own artifacts, and its caller also set describeArtifact; set it once`, and the shared method boundary refuses an input that carries one before the method runs. `scopedOptimizationMethod` and `sequentialOptimizationMethod` declare it when a method they compose does. A method without it is unchanged, and so is the 2.0.0 rule for the GEPA, SkillOpt and external-text methods configured with their own `describeArtifact`: a different caller hook is refused, the same function is accepted.
23
+
24
+ Downgrade limit: a journal written before 2.0.1 carries no declaration, so a zero-token call in it stays stub-mode, as in 2.0.0. A run directory whose journal holds a declared-free call written by 2.0.1 cannot be resumed by 2.0.0. Finish or discard such a run before moving back to 2.0.0.
25
+
26
+ Fixes:
27
+
28
+ - The Python client passes `ruff check` (`gepa_bridge_proof.py` import order and two long lines), and the client's documented checks and the publish workflow run it.
29
+
30
+ Commits in this release:
31
+
32
+ - test(campaign): name the dropped-usage dispatch and repin the analyst benchmark implementation
33
+ - fix(campaign): count a zero-token call as work only when it was declared free before it ran
34
+ - test(campaign): a model call that reports zero tokens and $0 without declaring it free is a stub
35
+ - test(campaign): the sibling-drain refusal names the missing agent call; regenerate the API census
36
+ - fix(campaign): count a recorded free call as work and keep a caller's describeArtifact off a method that owns it
37
+ - test(campaign): give the free-call scenarios a kind
38
+ - test(campaign): a recorded free call and a method that owns artifact description
39
+
40
+ ## [2.0.0] — 2026-11-20
41
+
42
+ Breaking changes first. Each names what a caller must do.
43
+
44
+ - `Trajectory` gains a required `missingParents: TrajectoryMissingParent[]`. `buildTrajectory` fills it; a caller that builds a `Trajectory` literal (a test fixture, a replay) adds `missingParents: []`. A span whose parent is absent from the capture used to vanish from `steps` and from every count; it is now kept as a root and listed in `missingParents` with the parent id it names. A trace with no such hole is unchanged.
45
+ - `CounterfactualMutation.at` is a `TrajectoryStepRef`: a step index as before, or `{ spanId }`. A caller that only passes numbers changes nothing. A caller that reads `mutation.at` as a number must handle the span-id form. A runner implementing the counterfactual runner contract receives a required `inFlight: TrajectoryStep[]` on its context and a result now carries `targetSpanId: string`; a caller that builds either literal adds the field. The prefix before a mutation is no longer `steps.slice(0, index)`: it is the target's ancestors plus every step that ended before the target started, so a parallel branch's later steps no longer reach the replay. Steps still running at the target's start are `inFlight`, and `SandboxCounterfactualRunner` refuses a target with steps in flight before it opens a sandbox. A sequential trace's prefix is unchanged. `trajectoryTimingBoundary` is exported.
46
+ - `prmTrainingPairs` returns a `PrmPairingResult` (`triples` plus counts of the steps and contexts it could not use), not an array. A caller reads `.triples`. Its option `minPrefixLength` is removed; `minMargin` stays. A pair is now two actions taken in the same recorded context, represented by steps from two different runs: steps are grouped by context digest across runs, grouped again by action, and compared on mean reward, so two unrelated tasks that share span names no longer pair. `PrmTrainingTriple` gains required `contextDigest`, `chosenStepCount`, `chosenRunIds`, `rejectedStepCount` and `rejectedRunIds`; a caller that builds a triple by hand supplies them.
47
+ - `toPrmRows` refuses a triple with no `contextDigest`, and a triple that names no runs behind its means, instead of building a row. It checks the realness gate of every run behind either mean, and carries the digest, step counts and run ids on `meta`. A caller that built triples outside `prmTrainingPairs` must supply a `contextDigest` that names the shared context.
48
+ - `StepReward.stepIndex` is the span's position among all spans of the run, not a count of scored steps. `StepScorer.score` returns a `ScoredStep` (`StepReward` without identity, adds optional `contextDigest` and `actionDigest`). `extractStepRewards` gives each step a context digest (the run's scenario id, the recorded content of every span before the step, and the step's own input) and an action digest. A step's context is what was observable when it started: each span contributes its start content at `startedAt` and its end content at `endedAt`, so the end state of a span still open at that moment is no longer part of the context. A run whose scenario id is the emitter's default has no task identity and gets no context digest, and missing content yields no digest. `extractStepRewards` takes `contextAttributes` to name the attribute keys that count as context. `extractStepRewards` and `runwiseStepRewardSummary` are exported from `/rl`. A caller that relied on position among scored steps reads the new index.
49
+ - `campaignBreakdown` takes an optional second argument (`ArtifactEvidenceOptions`, with `describeArtifact`). A caller that passes one argument is unaffected. The per-scenario evidence it shows is now `campaignEvidence`: the lowest-scoring cell's artifact, as is for a string or as `describeArtifact` returns it, and nothing without the hook. Long text keeps its head and tail around an omitted-character count (`excerptEvidence`) in `campaignBreakdown` and `buildReflectionPrompt`, so the end of an output, where a failure usually is, reaches the reflection prompt; the head-only clip is gone. `runOptimization` takes the same `describeArtifact` hook, and the GEPA and SkillOpt callbacks send the same evidence as a JSON value (a described artifact may still carry inline images).
50
+ - The type re-exports `Span`, `TraceEvent` and `TraceStore` at the foot of `src/trajectory.ts` and `src/counterfactual.ts` are removed. No package entry exported them from there; a deep import of those paths takes them from `src/trace`.
51
+
52
+ Behavior and additions:
53
+
54
+ - `heldOutGate` counts each independent unit once. `HeldOutGateOptions` gains optional `independentUnitByScenarioId`; paired cells are averaged within a unit, and units count toward `n` and `minProductiveRuns`, so many decision points from one historical run cannot read as many independent tasks. A scored scenario missing from a supplied map raises the shared `aggregatePairedHoldout` error. With a map the reason names both counts and the detail adds `pairedCellN`, `observationUnit` and `unitIds`. Without a map nothing changes.
55
+ - Imported search cells carry the campaign cells that measured them. The GEPA and SkillOpt evaluation callback keeps a `CampaignCellMeasurement` of every campaign cell behind a request on that request's observation (optional `measurement`), and `importExternalEvaluations` records each distinct measured cell once, with its outcome, dimensions, tokens, cost, model, duration and attempt. A request answered from an earlier request's cells is logged as reused and adds no cell; every rep of a multi-rep evaluation is its own cell, and `maxCells` is the evaluation limit times the reps. `GepaEvaluationImport` reports `measuredCells` and `reusedRequests`. An observation log without measurements imports as before. Every campaign cell records `dimension.<judge>.<dimension>` for each successful judge, its cached prompt tokens, and a trace reason naming the attempt whose trace writer received its spans.
56
+ - `mintRolloutRows` reads `Trajectory.missingParents`: a line from a trace with a missing parent span keeps that span as a step, carries a `provenance.gap` naming how many spans are affected and is marked lossy, so training sinks exclude it. Each minted step carries the source `spanId` and, below a root, the `parentSpanId`; both are optional in `tangle.rollout.v1`, so earlier lines still validate.
57
+ - `jsonDocument` refuses a reference cycle with `LedgerCanonicalizationError`.
58
+ - `fix(harbor)`: a released case prunes its build records even when BuildKit reports them shared (#1298).
59
+ - Every campaign cell names its trace (#1309). `CampaignTraceWriter` gains an optional method `traceRef?(): SearchTraceRef`, and `CampaignCellResult` and `CampaignCellMeasurement` gain an optional `traceRef`. `runCampaign` reads `traceRef` once, after the attempt's final flush, and records it on the cell, on the failure receipt and in the cache, so a cached cell keeps the trace of the attempt that measured it. A writer without `traceRef`, or one that returns `{ unknown: <reason> }`, leaves the trace unknown with that reason. The default writer's trace id is the W3C id of `<runAttemptId>/<cellId>/attempt-<n>`; every span it writes carries it as `traceId`, and `traceRef` counts a span opened and never ended as dropped. Records written before this change have no `traceRef` and import as before. A caller must act on none of this: the fields and method are optional, and the cell's `traceRef` in the search ledger is now the real reference where it was unknown.
60
+ - `RunCampaignOptions.buildTraceWriter` is called with a third argument, the attempt (`runAttemptId` and `number`). A function that takes two parameters still works; a custom writer that wants its trace id derived from the attempt reads the third.
61
+ - An evaluation refused after it measured keeps its spend. When the GEPA or SkillOpt evaluation callback measures cells and then refuses (evidence no excerpt fits, no score for the case), the refusal observation carries `measurement` (only on `evaluation-failed`), `importExternalEvaluations` records those cells with their real tokens, cost and trace and an `evaluation-refused` outcome, and the failed evaluation is not cached, so a later request retries it. Before, the spend was lost. Observation logs written earlier import as before.
62
+ - Evidence over `maxEvidenceChars` is excerpted instead of refused. The judge notes, the error message and a text artifact keep their head and tail around an omitted-count marker, sharing the room the other fields leave. A described (non-string) artifact stays whole when the text fields alone can make room; otherwise it is sent as its excerpted JSON text, so a consumer of the evidence that expected a structured `artifact` must also accept a string there. Only a response whose scores, dimensions and ids alone exceed the bound is still refused. A caller that raised `maxEvidenceChars` to avoid the refusal can lower it again.
63
+ - `describeArtifact?` is accepted by `OptimizationMethodInput`, `CompareOptimizationMethodsOptions` and `SelfImproveOptions`, and forwarded through `selfImprove`, `compareOptimizationMethods` and the GEPA, SkillOpt and external-text methods, so every method's optimizer sees the same described evidence as the native proposer. A caller that already gave a method its own `describeArtifact` and now also passes one through `selfImprove`, `compareOptimizationMethods` or `OptimizationMethodInput` that is a different function gets an error naming the label (`describeArtifact is set both on the method and by its caller; set it once`) before the method runs: set it once, on the caller. The same function in both places is accepted.
64
+ - The maintainer skill, the public API census and the analyst benchmark pin are regenerated for these changes; tests for the removed head-only clip are deleted with it.
65
+ - `RunCampaignOptions.tracing: 'off'` does what it documented (#1311): every attempt gets a writer that keeps no span, and each cell's `traceRef` is unknown with that reason. Before, `'off'` was ignored and spans were captured. Combining it with `buildTraceWriter` is refused. A caller that passed `'off'` and still reads the spans removes `'off'`.
66
+ - The SkillOpt bridge checks each callback response against `maxEvidenceChars` by the TypeScript rule (the response's JSON length in UTF-16 code units), not the case and the response together, so it no longer refuses a response the callback excerpted to the bound (#1311).
67
+ - An external evaluation (GEPA or SkillOpt) whose campaign throws keeps what it spent (#1311): the refusal's `measurement` carries every cell that settled before the throw with its real accounting, and each cell the throw interrupted (`campaign-threw`, unknown tokens and cost, with the agent spend its receipts proved as the lower bound). Before, the evaluation was one cell with unknown cost and a $0 floor.
68
+ - `campaignToRunRecords`, `selfImprove`'s run records and `runProfileMatrix` records carry the campaign cell's known trace as `RunRecord.traceRef`; a cell whose trace is unknown leaves it absent (#1311).
69
+ - `pnpm lint` passes and the documented local gate runs it (#1311).
70
+
71
+ Commits in this release:
72
+
73
+ - chore(analyst): repin the benchmark implementation and regenerate the API census
74
+ - fix(campaign): keep a thrown evaluation's spend, carry cell traces onto run records, wire tracing off
75
+ - test(campaign): prove the #1310 accounting, trace and evidence-bound gaps
76
+ - chore(lint): make biome check src pass and run it in the documented gate
77
+
78
+ - chore(analyst): repin the benchmark implementation after merging main; format touched tests
79
+ - fix(campaign): read a run refusal's measurement without a dead kind check; repin analyst benchmark
80
+ - fix(campaign): name each cell's trace, keep a refused evaluation's spend, forward describeArtifact
81
+ - test(campaign): trace identity, refused-evaluation spend and describeArtifact forwarding
82
+ - chore(rl): regenerate the analyst pin and public API listing after merging main
83
+ - docs(skill): the maintainer skill states the current rules and routes multi-component optimization
84
+ - docs(rl): extractStepRewards states its context rule and its timing limit
85
+ - docs(census): regenerate the public API census with the rl step-reward exports
86
+ - chore(analyst): refresh the benchmark implementation pin for the canonical cycle refusal
87
+ - fix(rl): a step's context is what was observable when it started; pairs compare mean rewards
88
+ - test(rl): a realness-gated run behind a mean keeps its PRM row out
89
+ - chore(analyst): pin the benchmark implementation digest over the callback's measurement
90
+ - test(rl): contexts end at a step's start, pairs use mean reward, unknown tasks and cycles get no digest
91
+ - fix(campaign): native and external optimizers see the same cell evidence
92
+ - test(campaign): optimizers see the end of a long output and the same evidence
93
+ - fix(campaign): imported search cells carry the campaign cells that measured them
94
+ - test(campaign): imported search cells are the campaign cells that measured them
95
+ - fix(rollout): a minted line from a trace with a missing parent span says so
96
+ - feat(campaign): heldOutGate counts each independent unit once
97
+ - style(rl): keep the formatter's parentheses on the llm input default
98
+ - test(rollout): a minted line from a trace with a missing parent span carries no gap today
99
+ - fix(trajectory): keep orphan spans and draw the counterfactual prefix by span timing
100
+ - test(rl): the PRM exporter refuses a pipeline triple stripped of its context digest
101
+ - test(trajectory): orphan spans and a parallel counterfactual prefix fail today
102
+ - test(campaign): heldOutGate counts wakes from one historical run as one unit
103
+ - refactor(rl): a span's record is every field but identity, timing and accounting
104
+ - fix(rl): a process-reward pair is two actions taken in the same recorded context
105
+ - test(rl): a PRM row from two runs of different scenarios that share span names
106
+ - fix(harbor): a released case prunes its build records even when BuildKit reports them shared (#1298)
107
+
7
108
  ## [1.0.40] — 2026-11-18
8
109
 
9
110
  - fix(cost): selfImprove, compareOptimizationMethods and trace analysts report agent spend the ledger missed (#1296)
@@ -1,6 +1,6 @@
1
- import { d as CostReceipt } from "../cost-ledger-Czro9wmo.js";
2
- import { R as Scenario, d as DispatchContext, f as DispatchFn } from "../types-DGqGbNY4.js";
3
- import "../index-CXoFLNKI.js";
1
+ import { d as CostReceipt } from "../cost-ledger-CSP-OfFe.js";
2
+ import { R as Scenario, d as DispatchContext, f as DispatchFn } from "../types-DD1eUTLn.js";
3
+ import "../index-CR-guIiZ.js";
4
4
  export interface HttpDispatchOptions<TScenario extends Scenario, _TArtifact> {
5
5
  /** Static endpoint URL. Mutually exclusive with `resolveUrl`. */
6
6
  url?: string;
@@ -1,5 +1,5 @@
1
1
  import { s as ValidationError } from "./errors-DeEEV9Vx.js";
2
- import { r as canonicalString } from "./canonical-BANK6NOj.js";
2
+ import { r as canonicalString } from "./canonical-DKgL_Wby.js";
3
3
  import { createHash } from "node:crypto";
4
4
  import { harnessSupportsModel } from "@tangle-network/agent-interface";
5
5
  // src/agent-profile.ts
@@ -150,4 +150,4 @@ function agentProfileHash(profile) {
150
150
  }
151
151
  export { agentProfileModelId as a, agentProfileId as i, HARNESS_NATIVE_MODEL as n, expandProfileAxes as o, agentProfileHash as r, harnessAxisOf as s, CODING_HARNESSES as t };
152
152
 
153
- //# sourceMappingURL=agent-profile-DgbRJpSi.js.map
153
+ //# sourceMappingURL=agent-profile-CCw6EXWW.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-profile-DgbRJpSi.js","names":[],"sources":["../src/agent-profile.ts"],"sourcesContent":["import { createHash } from 'node:crypto'\nimport type { AgentProfile } from '@tangle-network/agent-interface'\nimport { type HarnessType, harnessSupportsModel } from '@tangle-network/agent-interface'\nimport { ValidationError } from './errors'\nimport { canonicalString } from './ledger-core/canonical'\n\nexport type { AgentProfile, HarnessType } from '@tangle-network/agent-interface'\n\n/**\n * The agentic coding harnesses an eval sweeps by default — the ones we care about\n * ranking. This is the SINGLE source of that list; consumers import it instead of\n * re-declaring their own (a re-declared list is how the fleet drifts). Pass an\n * explicit `harnesses` (e.g. `harnessTypeSchema.options` for literally every known\n * harness) to widen beyond these.\n */\nexport const CODING_HARNESSES: readonly HarnessType[] = [\n 'opencode',\n 'claude-code',\n 'codex',\n 'kimi-code',\n]\n\nexport interface ProfileAxisSpec {\n /** The domain profile to sweep. Its prompt/tools/skills are held fixed; only the\n * harness and model vary. `model.default` is the fallback model. */\n base: AgentProfile\n /** Harnesses to cross. Default: {@link CODING_HARNESSES}. */\n harnesses?: readonly HarnessType[]\n /** Models to cross. Default: `[base.model.default]` — one model, i.e. today's\n * single-model behaviour, so omitting this never changes an existing run. */\n models?: readonly string[]\n /** Force every (harness, model) pair verbatim, even ones the harness can't run —\n * for deliberately testing failure modes. Default (false): SNAP instead — a\n * vendor-locked harness runs only the swept models in its family, or its native\n * default when it supports none, so no harness is dropped and none gets a\n * guaranteed-failing foreign-model cell. */\n keepIncompatible?: boolean\n}\n\n/** Model sentinel for a vendor-locked harness that supports none of the swept models:\n * it carries no provider prefix, so `harnessSupportsModel` accepts it and the harness\n * resolves it to its own native default model at runtime. Lets `expandProfileAxes`\n * snap-instead-of-drop without a per-harness flagship table that would rot as router\n * catalogs change. */\nexport const HARNESS_NATIVE_MODEL = 'default'\n\n/**\n * Expand a base profile across the harness × model matrix into the `AgentProfile[]`\n * that `runProfileMatrix` / `selfImprove` score — the ONE place \"which harnesses ×\n * which models do we evaluate\" lives, so no product hand-rolls its own harness list\n * or column→profile mapping (the pattern that let those copies drift and silently\n * break the harness pivot).\n *\n * Each cell clones `base`, sets the canonical top-level `harness` and `model.default`,\n * and stamps `metadata.harness` + `metadata.harnessModel` for matrix grouping. Both\n * metadata fields are hash-bearing, so every cell gets a distinct `agentProfileId` row\n * and results join back by harness/model via {@link harnessAxisOf} with no\n * hand-recomputed key. A vendor-locked harness snaps to its family's swept models — or\n * its native default ({@link HARNESS_NATIVE_MODEL}) when it supports none — so every\n * requested harness runs; `keepIncompatible` forces every pair verbatim.\n *\n * Omit `harnesses`/`models` to sweep the full default set — the \"turn it on for\n * everything we care about\" switch, identical in shape whether one harness or all.\n */\nexport function expandProfileAxes(spec: ProfileAxisSpec): AgentProfile[] {\n const harnesses = spec.harnesses ?? CODING_HARNESSES\n if (harnesses.length === 0) throw new ValidationError('expandProfileAxes: no harnesses to sweep')\n const baseModel = spec.base.model?.default\n const models = spec.models ?? (baseModel ? [baseModel] : [])\n if (models.length === 0) {\n throw new ValidationError(\n 'expandProfileAxes: no models to sweep — base profile has no model.default and none were supplied',\n )\n }\n const out: AgentProfile[] = []\n const seen = new Set<string>()\n for (const harness of harnesses) {\n // Keep each requested harness on supported models, or its native default when none fit.\n // `keepIncompatible` forces every (harness, model) pair verbatim (failure-mode runs).\n const supported = spec.keepIncompatible\n ? models\n : models.filter((model) => harnessSupportsModel(harness, model))\n const effective = supported.length > 0 ? supported : [HARNESS_NATIVE_MODEL]\n for (const model of effective) {\n const profile: AgentProfile = {\n ...spec.base,\n harness,\n name: `${spec.base.name ?? 'agent'}/${harness}/${model}`,\n model: { ...spec.base.model, default: model },\n metadata: { ...(spec.base.metadata ?? {}), harness, harnessModel: model },\n }\n const id = agentProfileId(profile)\n if (seen.has(id)) continue\n seen.add(id)\n out.push(profile)\n }\n }\n if (out.length === 0) {\n // Unreachable in normal use — snapping guarantees ≥1 cell per harness — but keep a\n // fail-closed guard so a future refactor can't silently produce an empty sweep.\n throw new ValidationError(\n `expandProfileAxes: produced no profiles (harnesses=[${harnesses.join(', ')}], models=[${models.join(', ')}]).`,\n )\n }\n return out\n}\n\n/**\n * Read the (harness, model) a matrix cell ran under, off a profile or a result row's\n * profile — the join-back for a `byHarness` pivot. Returns undefined when the profile\n * wasn't produced by {@link expandProfileAxes}. Callers group `result.byProfile` by\n * this instead of recomputing an id (recomputing the wrong key is what broke the pivot\n * in the hand-rolled copies).\n */\nexport function harnessAxisOf(\n profile: Pick<AgentProfile, 'metadata'>,\n): { harness: HarnessType; model: string } | undefined {\n const m = profile.metadata as Record<string, unknown> | undefined\n const harness = m?.harness\n const model = m?.harnessModel\n if (typeof harness === 'string' && typeof model === 'string') {\n return { harness: harness as HarnessType, model }\n }\n return undefined\n}\n\n/**\n * Collision-resistant, path-safe, human-readable profile id for eval artifacts.\n * Scorecard joins still use `agentProfileHash`; this id is for run ids, matrix\n * keys, and directory names where two profiles must not collapse onto one row.\n * The suffix is the first 64 bits of the behaviour hash, enough for ordinary\n * eval matrices while keeping filenames readable.\n */\nexport function agentProfileId(profile: AgentProfile): string {\n const label = pathSafeProfileLabel(agentProfileDisplayLabel(profile)) ?? 'profile'\n return `${label}-${agentProfileHash(profile).slice(0, 16)}`\n}\n\n/**\n * Model snapshot used for `RunRecord.model`. Eval surfaces require a concrete\n * model id because run records reject bare/missing model aliases.\n */\nexport function agentProfileModelId(profile: AgentProfile): string {\n const model = profile.model?.default?.trim()\n if (!model) {\n const label = agentProfileDisplayLabel(profile) ?? 'unnamed profile'\n throw new ValidationError(\n `AgentProfile \"${label}\" has no model.default — cannot record eval run`,\n )\n }\n return model\n}\n\nfunction agentProfileDisplayLabel(profile: AgentProfile): string | undefined {\n return profile.name?.trim() || profile.version?.trim() || undefined\n}\n\nfunction pathSafeProfileLabel(label: string | undefined): string | undefined {\n const safe = label\n ?.trim()\n .replace(/[^A-Za-z0-9._-]+/g, '-')\n .replace(/-+/g, '-')\n .replace(/^-|-$/g, '')\n return safe || undefined\n}\n\nfunction compact<T extends Record<string, unknown>>(input: T): Partial<T> {\n const out: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(input)) {\n if (value !== undefined) out[key] = value\n }\n return out as Partial<T>\n}\n\n/**\n * Deterministic behaviour identity for the canonical\n * `@tangle-network/agent-interface` AgentProfile.\n *\n * `name` and `description` are labels and do not affect the hash. Profile\n * `version`, prompt, model hints, tools, resources, hooks, modes, permissions,\n * and extensions do affect the hash. Resource array order is hash-bearing\n * because mount order can change agent behaviour. Undefined fields are treated\n * as absent; explicit `null` fields remain hash-bearing.\n */\nexport function agentProfileHash(profile: AgentProfile): string {\n const model = agentProfileModelId(profile)\n const behaviour = compact({\n ...profile,\n name: undefined,\n description: undefined,\n tags: profile.tags ? [...profile.tags].sort() : undefined,\n model: compact({ ...profile.model, default: model }),\n })\n return createHash('sha256').update(canonicalString(behaviour)).digest('hex')\n}\n"],"mappings":";;;;;;;;;;;;AAeA,MAAa,mBAA2C;CACtD;CACA;CACA;CACA;AACF;;;;;;AAwBA,MAAa,uBAAuB;;;;;;;;;;;;;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../src/agent-profile.ts"],"sourcesContent":["import { createHash } from 'node:crypto'\nimport type { AgentProfile } from '@tangle-network/agent-interface'\nimport { type HarnessType, harnessSupportsModel } from '@tangle-network/agent-interface'\nimport { ValidationError } from './errors'\nimport { canonicalString } from './ledger-core/canonical'\n\nexport type { AgentProfile, HarnessType } from '@tangle-network/agent-interface'\n\n/**\n * The agentic coding harnesses an eval sweeps by default — the ones we care about\n * ranking. This is the SINGLE source of that list; consumers import it instead of\n * re-declaring their own (a re-declared list is how the fleet drifts). Pass an\n * explicit `harnesses` (e.g. `harnessTypeSchema.options` for literally every known\n * harness) to widen beyond these.\n */\nexport const CODING_HARNESSES: readonly HarnessType[] = [\n 'opencode',\n 'claude-code',\n 'codex',\n 'kimi-code',\n]\n\nexport interface ProfileAxisSpec {\n /** The domain profile to sweep. Its prompt/tools/skills are held fixed; only the\n * harness and model vary. `model.default` is the fallback model. */\n base: AgentProfile\n /** Harnesses to cross. Default: {@link CODING_HARNESSES}. */\n harnesses?: readonly HarnessType[]\n /** Models to cross. Default: `[base.model.default]` — one model, i.e. today's\n * single-model behaviour, so omitting this never changes an existing run. */\n models?: readonly string[]\n /** Force every (harness, model) pair verbatim, even ones the harness can't run —\n * for deliberately testing failure modes. Default (false): SNAP instead — a\n * vendor-locked harness runs only the swept models in its family, or its native\n * default when it supports none, so no harness is dropped and none gets a\n * guaranteed-failing foreign-model cell. */\n keepIncompatible?: boolean\n}\n\n/** Model sentinel for a vendor-locked harness that supports none of the swept models:\n * it carries no provider prefix, so `harnessSupportsModel` accepts it and the harness\n * resolves it to its own native default model at runtime. Lets `expandProfileAxes`\n * snap-instead-of-drop without a per-harness flagship table that would rot as router\n * catalogs change. */\nexport const HARNESS_NATIVE_MODEL = 'default'\n\n/**\n * Expand a base profile across the harness × model matrix into the `AgentProfile[]`\n * that `runProfileMatrix` / `selfImprove` score — the ONE place \"which harnesses ×\n * which models do we evaluate\" lives, so no product hand-rolls its own harness list\n * or column→profile mapping (the pattern that let those copies drift and silently\n * break the harness pivot).\n *\n * Each cell clones `base`, sets the canonical top-level `harness` and `model.default`,\n * and stamps `metadata.harness` + `metadata.harnessModel` for matrix grouping. Both\n * metadata fields are hash-bearing, so every cell gets a distinct `agentProfileId` row\n * and results join back by harness/model via {@link harnessAxisOf} with no\n * hand-recomputed key. A vendor-locked harness snaps to its family's swept models — or\n * its native default ({@link HARNESS_NATIVE_MODEL}) when it supports none — so every\n * requested harness runs; `keepIncompatible` forces every pair verbatim.\n *\n * Omit `harnesses`/`models` to sweep the full default set — the \"turn it on for\n * everything we care about\" switch, identical in shape whether one harness or all.\n */\nexport function expandProfileAxes(spec: ProfileAxisSpec): AgentProfile[] {\n const harnesses = spec.harnesses ?? CODING_HARNESSES\n if (harnesses.length === 0) throw new ValidationError('expandProfileAxes: no harnesses to sweep')\n const baseModel = spec.base.model?.default\n const models = spec.models ?? (baseModel ? [baseModel] : [])\n if (models.length === 0) {\n throw new ValidationError(\n 'expandProfileAxes: no models to sweep — base profile has no model.default and none were supplied',\n )\n }\n const out: AgentProfile[] = []\n const seen = new Set<string>()\n for (const harness of harnesses) {\n // Keep each requested harness on supported models, or its native default when none fit.\n // `keepIncompatible` forces every (harness, model) pair verbatim (failure-mode runs).\n const supported = spec.keepIncompatible\n ? models\n : models.filter((model) => harnessSupportsModel(harness, model))\n const effective = supported.length > 0 ? supported : [HARNESS_NATIVE_MODEL]\n for (const model of effective) {\n const profile: AgentProfile = {\n ...spec.base,\n harness,\n name: `${spec.base.name ?? 'agent'}/${harness}/${model}`,\n model: { ...spec.base.model, default: model },\n metadata: { ...(spec.base.metadata ?? {}), harness, harnessModel: model },\n }\n const id = agentProfileId(profile)\n if (seen.has(id)) continue\n seen.add(id)\n out.push(profile)\n }\n }\n if (out.length === 0) {\n // Unreachable in normal use — snapping guarantees ≥1 cell per harness — but keep a\n // fail-closed guard so a future refactor can't silently produce an empty sweep.\n throw new ValidationError(\n `expandProfileAxes: produced no profiles (harnesses=[${harnesses.join(', ')}], models=[${models.join(', ')}]).`,\n )\n }\n return out\n}\n\n/**\n * Read the (harness, model) a matrix cell ran under, off a profile or a result row's\n * profile — the join-back for a `byHarness` pivot. Returns undefined when the profile\n * wasn't produced by {@link expandProfileAxes}. Callers group `result.byProfile` by\n * this instead of recomputing an id (recomputing the wrong key is what broke the pivot\n * in the hand-rolled copies).\n */\nexport function harnessAxisOf(\n profile: Pick<AgentProfile, 'metadata'>,\n): { harness: HarnessType; model: string } | undefined {\n const m = profile.metadata as Record<string, unknown> | undefined\n const harness = m?.harness\n const model = m?.harnessModel\n if (typeof harness === 'string' && typeof model === 'string') {\n return { harness: harness as HarnessType, model }\n }\n return undefined\n}\n\n/**\n * Collision-resistant, path-safe, human-readable profile id for eval artifacts.\n * Scorecard joins still use `agentProfileHash`; this id is for run ids, matrix\n * keys, and directory names where two profiles must not collapse onto one row.\n * The suffix is the first 64 bits of the behaviour hash, enough for ordinary\n * eval matrices while keeping filenames readable.\n */\nexport function agentProfileId(profile: AgentProfile): string {\n const label = pathSafeProfileLabel(agentProfileDisplayLabel(profile)) ?? 'profile'\n return `${label}-${agentProfileHash(profile).slice(0, 16)}`\n}\n\n/**\n * Model snapshot used for `RunRecord.model`. Eval surfaces require a concrete\n * model id because run records reject bare/missing model aliases.\n */\nexport function agentProfileModelId(profile: AgentProfile): string {\n const model = profile.model?.default?.trim()\n if (!model) {\n const label = agentProfileDisplayLabel(profile) ?? 'unnamed profile'\n throw new ValidationError(\n `AgentProfile \"${label}\" has no model.default — cannot record eval run`,\n )\n }\n return model\n}\n\nfunction agentProfileDisplayLabel(profile: AgentProfile): string | undefined {\n return profile.name?.trim() || profile.version?.trim() || undefined\n}\n\nfunction pathSafeProfileLabel(label: string | undefined): string | undefined {\n const safe = label\n ?.trim()\n .replace(/[^A-Za-z0-9._-]+/g, '-')\n .replace(/-+/g, '-')\n .replace(/^-|-$/g, '')\n return safe || undefined\n}\n\nfunction compact<T extends Record<string, unknown>>(input: T): Partial<T> {\n const out: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(input)) {\n if (value !== undefined) out[key] = value\n }\n return out as Partial<T>\n}\n\n/**\n * Deterministic behaviour identity for the canonical\n * `@tangle-network/agent-interface` AgentProfile.\n *\n * `name` and `description` are labels and do not affect the hash. Profile\n * `version`, prompt, model hints, tools, resources, hooks, modes, permissions,\n * and extensions do affect the hash. Resource array order is hash-bearing\n * because mount order can change agent behaviour. Undefined fields are treated\n * as absent; explicit `null` fields remain hash-bearing.\n */\nexport function agentProfileHash(profile: AgentProfile): string {\n const model = agentProfileModelId(profile)\n const behaviour = compact({\n ...profile,\n name: undefined,\n description: undefined,\n tags: profile.tags ? [...profile.tags].sort() : undefined,\n model: compact({ ...profile.model, default: model }),\n })\n return createHash('sha256').update(canonicalString(behaviour)).digest('hex')\n}\n"],"mappings":";;;;;;;;;;;;AAeA,MAAa,mBAA2C;CACtD;CACA;CACA;CACA;AACF;;;;;;AAwBA,MAAa,uBAAuB;;;;;;;;;;;;;;;;;;;AAoBpC,SAAgB,kBAAkB,MAAuC;CACvE,MAAM,YAAY,KAAK,aAAa;CACpC,IAAI,UAAU,WAAW,GAAG,MAAM,IAAI,gBAAgB,0CAA0C;CAChG,MAAM,YAAY,KAAK,KAAK,OAAO;CACnC,MAAM,SAAS,KAAK,WAAW,YAAY,CAAC,SAAS,IAAI,CAAC;CAC1D,IAAI,OAAO,WAAW,GACpB,MAAM,IAAI,gBACR,kGACF;CAEF,MAAM,MAAsB,CAAC;CAC7B,MAAM,uBAAO,IAAI,IAAY;CAC7B,KAAK,MAAM,WAAW,WAAW;EAG/B,MAAM,YAAY,KAAK,mBACnB,SACA,OAAO,QAAQ,UAAU,qBAAqB,SAAS,KAAK,CAAC;EACjE,MAAM,YAAY,UAAU,SAAS,IAAI,YAAY,CAAC,oBAAoB;EAC1E,KAAK,MAAM,SAAS,WAAW;GAC7B,MAAM,UAAwB;IAC5B,GAAG,KAAK;IACR;IACA,MAAM,GAAG,KAAK,KAAK,QAAQ,QAAQ,GAAG,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A2C,OAAsB;CACxE,MAAM,MAA+B,CAAC;CACtC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAC7C,IAAI,UAAU,KAAA,GAAW,IAAI,OAAO;CAEtC,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,iBAAiB,SAA+B;CAC9D,MAAM,QAAQ,oBAAoB,OAAO;CACzC,MAAM,YAAY,QAAQ;EACxB,GAAG;EACH,MAAM,KAAA;EACN,aAAa,KAAA;EACb,MAAM,QAAQ,OAAO,CAAC,GAAG,QAAQ,IAAI,CAAC,CAAC,KAAK,IAAI,KAAA;EAChD,OAAO,QAAQ;GAAE,GAAG,QAAQ;GAAO,SAAS;EAAM,CAAC;CACrD,CAAC;CACD,OAAO,WAAW,QAAQ,CAAC,CAAC,OAAO,gBAAgB,SAAS,CAAC,CAAC,CAAC,OAAO,KAAK;AAC7E"}
@@ -1,6 +1,9 @@
1
- import { f as CostReceiptInput, m as CustomTokenPricing } from "./cost-ledger-Czro9wmo.js";
2
- import { Y as TraceAnalysisStore, i as AnalystFinding, m as EvidenceRef, p as AnalystUsageReceipt } from "./types-DmYd2Igl.js";
3
- import { A as ChatResponse, k as ChatRequest } from "./cluster-CSd0LE_M.js";
1
+ import { d as CostReceipt, f as CostReceiptInput, m as CustomTokenPricing } from "./cost-ledger-CSP-OfFe.js";
2
+ import { Y as TraceAnalysisStore, i as AnalystFinding, m as EvidenceRef, p as AnalystUsageReceipt } from "./types-AGUuvnae.js";
3
+ import { A as ChatResponse, k as ChatRequest } from "./cluster-Bj90LK-1.js";
4
+ import { E as SearchExecutionIdentity, Q as SearchTaskOutcome, a as SearchAttemptAccounting, et as SearchTraceRef, j as SearchModelIdentity, z as SearchOperationRecordedEvent } from "./search-ledger-types-BhZE848w.js";
5
+ import { r as CampaignCellResult } from "./types-DD1eUTLn.js";
6
+ import { o as SearchCellResult } from "./search-kernel-DXA1EhnN.js";
4
7
  import { AgentProfile, AgentProfile as AgentProfile$1, HarnessType, HarnessType as HarnessType$1 } from "@tangle-network/agent-interface";
5
8
  interface AnalystEvidenceExpectation {
6
9
  uri: string;
@@ -222,6 +225,62 @@ interface RunAnalystBenchmarkOptions<TInput> {
222
225
  signal?: AbortSignal;
223
226
  }
224
227
  declare function runAnalystBenchmark<TInput>(options: RunAnalystBenchmarkOptions<TInput>): Promise<AnalystBenchmarkResult>;
228
+ /**
229
+ * The facts `cell-settled` records about one campaign cell, without its
230
+ * artifact. JSON-safe, so a producer that measures cells out of process (the
231
+ * external-optimizer evaluation callback) can keep them in its observation log
232
+ * and record them later through the same mapping as an in-process executor.
233
+ */
234
+ interface CampaignCellMeasurement {
235
+ /** The campaign's cell id, `<scenarioId>:<rep>`; unique within one campaign only. */
236
+ cellId: string;
237
+ scenarioId: string;
238
+ rep: number;
239
+ /** The attempt that produced the result; null on a historical cached record without one. */
240
+ attempt: {
241
+ runAttemptId: string;
242
+ number: number;
243
+ } | null;
244
+ /** runCampaign read this result from its cache instead of dispatching it. */
245
+ cached: boolean;
246
+ outcome: SearchTaskOutcome;
247
+ accounting: SearchAttemptAccounting;
248
+ /** The model every agent receipt in the cell reported; absent for none or several. */
249
+ resolvedModel?: string;
250
+ durationMs: number;
251
+ /** The trace the measuring attempt's spans went to, or unknown with the
252
+ * reason. Absent in observation logs written before cells carried it. */
253
+ traceRef?: SearchTraceRef;
254
+ }
255
+ /**
256
+ * Project a campaign cell onto what `cell-settled` records: `passed` with the
257
+ * composite, each judge's composite and each judge dimension when every judge
258
+ * scored it, else `errored`, never retryable, because `runCampaign` already
259
+ * applied its own retry policy; its tokens and cost, with an uncaptured cost
260
+ * kept as a lower bound; the attempt that produced it and the trace its spans
261
+ * went to.
262
+ */
263
+ declare function campaignCellMeasurement<TArtifact>(cell: CampaignCellResult<TArtifact>): CampaignCellMeasurement;
264
+ /**
265
+ * What `cell-settled` records for one campaign cell, or for its measurement:
266
+ * the outcome and accounting of `campaignCellMeasurement`, the model the cell
267
+ * resolved, else the declared one, its duration, and the trace its trace
268
+ * writer named. A cell or measurement recorded before cells carried a trace
269
+ * keeps an unknown reference that names the attempt whose trace writer
270
+ * received its spans.
271
+ */
272
+ declare function campaignCellSearchResult<TArtifact>(cell: CampaignCellResult<TArtifact> | CampaignCellMeasurement, input: {
273
+ execution: SearchExecutionIdentity;
274
+ lane: string;
275
+ }): SearchCellResult;
276
+ /** A provider-reported model: a snapshot when its name pins one, else a moving alias. */
277
+ declare function searchModelIdentity(model: string, provider: string): SearchModelIdentity;
278
+ /** The accounting of a proposal's cost receipts: token and dollar sums, each
279
+ * unknown (with the known dollars as a lower bound) when a receipt lacks it. */
280
+ declare function searchReceiptAccounting(receipts: ReadonlyArray<CostReceipt>): SearchAttemptAccounting;
281
+ /** What ran a proposal: a model when it made a paid call other than a judge's,
282
+ * else deterministic code. */
283
+ declare function searchProposalExecution(receipts: ReadonlyArray<CostReceipt>, provider: string, source: SearchOperationRecordedEvent['execution']['source']): SearchOperationRecordedEvent['execution'];
225
284
  interface ExternalOptimizerProcessLimits {
226
285
  /** Maximum serialized input written for the child process. */
227
286
  maxInputBytes: number;
@@ -321,6 +380,16 @@ type ExternalOptimizerModelExecutionObservation = {
321
380
  readonly error: string;
322
381
  readonly execution: unknown;
323
382
  };
383
+ /**
384
+ * Which campaign cells answered one evaluation request. `measured`: this
385
+ * request ran them. `reused`: an earlier request for the same candidate and
386
+ * case ran them, and this one was answered from its result. The search ledger
387
+ * records each distinct cell once, so a reused request adds no cell.
388
+ */
389
+ interface ExternalEvaluationMeasurement {
390
+ readonly source: 'measured' | 'reused';
391
+ readonly cells: readonly CampaignCellMeasurement[];
392
+ }
324
393
  type ExternalOptimizerEvaluationRefusalReason = 'invalid-request' | 'evaluation-limit' | 'evaluation-failed';
325
394
  /**
326
395
  * Durable callback-side record of every candidate submitted for scoring,
@@ -341,6 +410,9 @@ type ExternalOptimizerEvaluationObservation = {
341
410
  /** One-based accepted evaluation number for this optimizer attempt. */
342
411
  readonly evaluationNumber: number;
343
412
  readonly response: unknown;
413
+ /** The campaign cells behind `response`. Absent in logs written before
414
+ * the callback recorded them, and for an evaluator that reports none. */
415
+ readonly measurement?: ExternalEvaluationMeasurement;
344
416
  } | {
345
417
  readonly kind: 'refusal';
346
418
  readonly sequence: number;
@@ -348,6 +420,13 @@ type ExternalOptimizerEvaluationObservation = {
348
420
  readonly candidate?: ExternalTextCandidate;
349
421
  readonly candidateHash?: string;
350
422
  readonly exampleId?: string;
423
+ /** The campaign cells an `evaluation-failed` refusal measured before it
424
+ * was refused, such as evidence no excerpt fits the bound; their spend
425
+ * is real. When the evaluation's campaign threw, these are the cells it
426
+ * settled, then each cell the throw interrupted, whose accounting is
427
+ * unknown. Absent for a refusal that measured nothing, and in logs
428
+ * written before refusals recorded them. */
429
+ readonly measurement?: ExternalEvaluationMeasurement;
351
430
  };
352
431
  interface ExternalOptimizerModelBudget {
353
432
  /** Optional optimizer-model spend ceiling, independent of task-evaluation spend. */
@@ -465,5 +544,5 @@ declare function agentProfileId(profile: AgentProfile): string;
465
544
  * as absent; explicit `null` fields remain hash-bearing.
466
545
  */
467
546
  declare function agentProfileHash(profile: AgentProfile): string;
468
- export { AnalystBenchmarkDescriptor as A, AnalystEvidenceResolution as B, ExternalOptimizerResumeMode as C, ExternalTextEvaluationRequest as D, ExternalTextCandidate as E, AnalystBenchmarkProvenance as F, AnalystLatencyDistribution as G, AnalystEvidenceResolver as H, AnalystBenchmarkResult as I, traceStoreEvidenceResolver as J, RunAnalystBenchmarkOptions as K, AnalystBenchmarkRunner as L, AnalystBenchmarkLabelState as M, AnalystBenchmarkObservation as N, AnalystBenchmarkCase as O, AnalystBenchmarkOutput as P, AnalystBenchmarkSummary as R, ExternalOptimizerProcessLimits as S, ExternalOptimizerWireCounts as T, AnalystFindingScore as U, AnalystEvidenceResolutionError as V, AnalystIssueExpectation as W, ExternalOptimizerModelBudget as _, ProfileAxisSpec as a, ExternalOptimizerModelCallResult as b, expandProfileAxes as c, DEFAULT_EXTERNAL_OPTIMIZER_PROCESS_LIMITS as d, ExternalOptimizerCallbackLimits as f, ExternalOptimizerEvaluationRefusalReason as g, ExternalOptimizerEvaluationObservation as h, HarnessType$1 as i, AnalystBenchmarkError as j, AnalystBenchmarkDatasetRef as k, harnessAxisOf as l, ExternalOptimizerEndpointFormat as m, CODING_HARNESSES as n, agentProfileHash as o, ExternalOptimizerChatRequest as p, runAnalystBenchmark as q, HARNESS_NATIVE_MODEL as r, agentProfileId as s, AgentProfile$1 as t, DEFAULT_EXTERNAL_OPTIMIZER_CALLBACK_LIMITS as u, ExternalOptimizerModelCall as v, ExternalOptimizerRunnerCommand as w, ExternalOptimizerModelExecutionObservation as x, ExternalOptimizerModelCallRequest as y, AnalystEvidenceExpectation as z };
469
- //# sourceMappingURL=agent-profile-hytrwAnN.d.ts.map
547
+ export { RunAnalystBenchmarkOptions as $, campaignCellMeasurement as A, AnalystBenchmarkObservation as B, ExternalOptimizerProcessLimits as C, ExternalTextCandidate as D, ExternalOptimizerWireCounts as E, AnalystBenchmarkCase as F, AnalystBenchmarkSummary as G, AnalystBenchmarkProvenance as H, AnalystBenchmarkDatasetRef as I, AnalystEvidenceResolutionError as J, AnalystEvidenceExpectation as K, AnalystBenchmarkDescriptor as L, searchModelIdentity as M, searchProposalExecution as N, ExternalTextEvaluationRequest as O, searchReceiptAccounting as P, AnalystLatencyDistribution as Q, AnalystBenchmarkError as R, ExternalOptimizerModelExecutionObservation as S, ExternalOptimizerRunnerCommand as T, AnalystBenchmarkResult as U, AnalystBenchmarkOutput as V, AnalystBenchmarkRunner as W, AnalystFindingScore as X, AnalystEvidenceResolver as Y, AnalystIssueExpectation as Z, ExternalOptimizerEvaluationRefusalReason as _, ProfileAxisSpec as a, ExternalOptimizerModelCallRequest as b, expandProfileAxes as c, DEFAULT_EXTERNAL_OPTIMIZER_PROCESS_LIMITS as d, runAnalystBenchmark as et, ExternalEvaluationMeasurement as f, ExternalOptimizerEvaluationObservation as g, ExternalOptimizerEndpointFormat as h, HarnessType$1 as i, campaignCellSearchResult as j, CampaignCellMeasurement as k, harnessAxisOf as l, ExternalOptimizerChatRequest as m, CODING_HARNESSES as n, agentProfileHash as o, ExternalOptimizerCallbackLimits as p, AnalystEvidenceResolution as q, HARNESS_NATIVE_MODEL as r, agentProfileId as s, AgentProfile$1 as t, traceStoreEvidenceResolver as tt, DEFAULT_EXTERNAL_OPTIMIZER_CALLBACK_LIMITS as u, ExternalOptimizerModelBudget as v, ExternalOptimizerResumeMode as w, ExternalOptimizerModelCallResult as x, ExternalOptimizerModelCall as y, AnalystBenchmarkLabelState as z };
548
+ //# sourceMappingURL=agent-profile-CcOq7bOO.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-profile-CcOq7bOO.d.ts","names":["_$___cost_ledger0.CostReceiptInput"],"sources":["../src/analyst/benchmark.ts","../src/campaign/search-campaign-cell.ts","../src/campaign/external-optimizer-contracts.ts","../src/agent-profile.ts"],"mappings":";;;;;;;UAUiB;EACf;EACA,OAAO;;UAGQ;EACf;EACA;EACA;EACA;EACA,oBAAoB;EACpB;;EAEA,4BAA4B;;KAGlB;UAEK,qBAAqB;EACpC;;EAEA;;EAEA,YAAY;EACZ,OAAO;EACP,yBAAyB;;EAEzB,2BAA2B;EAC3B;EACA,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;EACA,mBAAmB;EACnB;EACA;EACA;EACA;;EAEA;;EAEA;;EAEA;EACA;;UAGe;EACf,UAAU;EACV;EACA;;UAGe;EACf;EACA;EACA,oBAAoB;EACpB,QAAQ;;EAER;;KAGU,wBAAwB,qBAAqB;EACvD;EACA,WAAW;EACX,UAAU;EACV,SAAS;gBACK;;;;;iBAMA,2BAA2B,QACzC,WAAW,OAAO,WAAW,qBAC5B,wBAAwB;UAoBV;EACf,mBAAmB;EACnB,QAAQ;EACR,WAAW;;;;;EAKX;;EAEA,QAAQ;;UAGO;EACf;EACA;EACA;EACA;;UAGe,uBAAuB;EACtC;EACA,QACE,OAAO,QACP;IAAW;IAAgB;IAAo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} from "./errors-DeEEV9Vx.js";
2
- import { a as hashCanonical, o as jsonDocument, r as canonicalString } from "./canonical-BANK6NOj.js";
2
+ import { a as hashCanonical, o as jsonDocument, r as canonicalString } from "./canonical-DKgL_Wby.js";
3
3
  // src/pre-registration.ts
4
4
  /**
5
5
  * Pre-registered hypotheses — declare what you're testing BEFORE the
@@ -284,4 +284,4 @@ function toAgentProfileJson(value) {
284
284
  }
285
285
  export { groupRunsByAgentProfileCell as a, verifyAgentProfileCell as c, signManifest as d, verifyManifest as f, buildAgentProfileCell as i, hashJson as l, AgentProfileCellValidationError as n, toAgentProfileJson as o, agentProfileCellKey as r, validateAgentProfileCell as s, AGENT_PROFILE_KINDS as t, manifestContentDigest as u };
286
286
 
287
- //# sourceMappingURL=agent-profile-cell-7Mt0wBkl.js.map
287
+ //# sourceMappingURL=agent-profile-cell-CUthydZB.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-profile-cell-7Mt0wBkl.js","names":[],"sources":["../src/pre-registration.ts","../src/agent-profile-cell.ts"],"sourcesContent":["/**\n * Pre-registered hypotheses — declare what you're testing BEFORE the\n * run, check it AFTER. Prevents p-hacking, optional stopping, and the\n * \"we ran until it looked good\" failure mode.\n *\n * Manifest is a plain JSON-friendly object. Sign it with a content hash\n * + timestamp; the registered record becomes immutable. Post-run,\n * evaluate the manifest against observed results — the library refuses\n * to let you re-interpret a different metric as the declared one.\n *\n * A signed manifest carries its required digest scheme. Verification accepts\n * only RFC 8785 canonical JSON, using the same encoder as every new identity.\n */\n\nimport { hashCanonical } from './ledger-core/canonical'\n\nexport interface HypothesisManifest {\n id: string\n /** Human prose — goes into the audit trail. */\n hypothesis: string\n /** Metric the hypothesis claims to move. */\n metric: string\n /** 'increase' = candidate should score higher than baseline; 'decrease' = lower. */\n direction: 'increase' | 'decrease'\n /** Minimum effect size to count (same units as the metric). */\n minEffect: number\n /** Alpha threshold. */\n alpha: number\n /** Target statistical power at which sample size was pre-computed. */\n power: number\n /** Declared N per arm before running. */\n preRegisteredN: number\n /** ISO8601 timestamp the manifest was registered. */\n registeredAt: string\n /** Optional identifiers to tie into the trace corpus. */\n baselineLabel?: string\n candidateLabel?: string\n}\n\n/** SHA-256 over RFC 8785 canonical JSON, excluding `contentHash` and `algo`. */\nexport type SignedManifestAlgo = 'sha256-rfc8785'\n\nexport interface SignedManifest extends HypothesisManifest {\n /** sha256 hex of canonicalized manifest (everything except contentHash and algo). */\n contentHash: string\n /** Required digest scheme. Missing or unsupported schemes fail verification. */\n algo: SignedManifestAlgo\n}\n\nexport interface HypothesisResult {\n manifest: SignedManifest\n observedN: number\n observedEffect: number\n observedPValue: number\n /** True iff the observed effect hits the pre-declared direction with\n * magnitude ≥ minEffect AND p < alpha. */\n confirmed: boolean\n /** Enumerated reasons the hypothesis was rejected (each a machine-tag). */\n rejectionReasons: Array<\n 'wrong_direction' | 'effect_too_small' | 'not_significant' | 'undersampled'\n >\n notes?: string\n}\n\n/**\n * SHA-256 hex (full 64 chars) over the RFC 8785 canonical JSON encoding of\n * `obj` — the package's one identity scheme, shared with `ledger-core`.\n *\n * Values canonical JSON cannot represent faithfully — `undefined`, `NaN`,\n * class instances, cycles — are refused rather than coerced, because a\n * coercion maps two distinct records onto one digest.\n *\n * Named `hashJson` to disambiguate from `prompt-registry.ts`'s `hashContent`,\n * which takes a string input and returns a truncated 12-char prompt id.\n *\n * @example\n * const hash = await hashJson({ id: '1', kind: 'spec' })\n * // 'a3f1...' (64 hex chars)\n */\nexport async function hashJson<T>(obj: T): Promise<string> {\n return hashCanonical(obj).slice('sha256:'.length)\n}\n\n/**\n * Digest a manifest after validating its scheme, excluding `contentHash` and\n * `algo`. This synchronous check can refuse a manifest before consuming data.\n */\nexport function manifestContentDigest(manifest: SignedManifest): string {\n const { contentHash: _contentHash, algo, ...rest } = manifest\n void _contentHash\n if (algo !== 'sha256-rfc8785') {\n throw new Error(`pre-registration: unsupported manifest hash algo '${String(algo)}'`)\n }\n return hashCanonical(rest).slice('sha256:'.length)\n}\n\n/**\n * Sign a manifest with a SHA-256 content hash over its RFC 8785 canonical\n * JSON, with `contentHash` and `algo` stripped, and stamp the scheme in\n * `algo` so a later reader knows which encoder to verify with.\n */\nexport async function signManifest(m: HypothesisManifest): Promise<SignedManifest> {\n const signed: SignedManifest = { ...m, contentHash: '', algo: 'sha256-rfc8785' }\n return { ...signed, contentHash: manifestContentDigest(signed) }\n}\n\n/**\n * Verify that a signed manifest has not been tampered with, under the scheme\n * the manifest itself declares.\n */\nexport async function verifyManifest(m: SignedManifest): Promise<boolean> {\n try {\n return manifestContentDigest(m) === m.contentHash\n } catch {\n return false\n }\n}\n\n/**\n * Evaluate a pre-registered hypothesis against observed results.\n * Mechanical — no re-interpretation permitted.\n */\nexport async function evaluateHypothesis(\n manifest: SignedManifest,\n observed: { n: number; effect: number; pValue: number },\n): Promise<HypothesisResult> {\n if (!(await verifyManifest(manifest))) {\n throw new Error('evaluateHypothesis: unsupported manifest hash scheme or content hash mismatch')\n }\n const reasons: HypothesisResult['rejectionReasons'] = []\n const directionOk = manifest.direction === 'increase' ? observed.effect > 0 : observed.effect < 0\n if (!directionOk) reasons.push('wrong_direction')\n if (Math.abs(observed.effect) < manifest.minEffect) reasons.push('effect_too_small')\n if (observed.pValue >= manifest.alpha) reasons.push('not_significant')\n if (observed.n < manifest.preRegisteredN) reasons.push('undersampled')\n return {\n manifest,\n observedN: observed.n,\n observedEffect: observed.effect,\n observedPValue: observed.pValue,\n confirmed: reasons.length === 0,\n rejectionReasons: reasons,\n }\n}\n","import { ValidationError } from './errors'\nimport { canonicalString, jsonDocument } from './ledger-core/canonical'\nimport { hashJson } from './pre-registration'\n\nexport type AgentProfileCellSchemaVersion = 'agent-profile-cell/v1'\n\nexport type AgentProfileJsonObject = { [key: string]: AgentProfileJson }\n\nexport type AgentProfileJson =\n | string\n | number\n | boolean\n | null\n | AgentProfileJson[]\n | AgentProfileJsonObject\n\nexport type AgentProfileDimensionValue = string | number | boolean | null\n\nexport interface AgentProfileSource {\n /** Runtime/profile contract being fingerprinted, e.g. `agent-interface-profile`. */\n kind: string\n /** sha256 over the canonical source profile object. */\n hash: string\n}\n\nexport interface AgentProfileSourceInput {\n kind: string\n /** Precomputed sha256 for callers that already sign their profile artifact. */\n hash?: string\n /** Full canonical runtime profile; hashed and then discarded from the cell. */\n profile?: AgentProfileJson\n}\n\nexport interface AgentProfileHarness {\n id: string\n version?: string\n hash?: string\n}\n\nexport interface AgentProfileCellInput {\n profileId: string\n sourceProfile: AgentProfileSourceInput\n harness?: AgentProfileHarness\n model?: string\n promptHash?: string\n dimensions?: Record<string, AgentProfileDimensionValue>\n}\n\nexport interface AgentProfileCell {\n schemaVersion: AgentProfileCellSchemaVersion\n cellId: string\n profileId: string\n sourceProfile: AgentProfileSource\n harness?: AgentProfileHarness\n model?: string\n promptHash?: string\n dimensions?: Record<string, AgentProfileDimensionValue>\n}\n\nexport class AgentProfileCellValidationError extends ValidationError {\n readonly path: string\n constructor(message: string, path = '') {\n super(path ? `${message} (at ${path})` : message)\n this.path = path\n }\n}\n\nconst SHA256_HEX = /^[0-9a-f]{64}$/\n/** A cell id carries the canonical digest scheme required for verification. */\nconst CELL_ID = /^agent-profile-cell:sha256-rfc8785:[0-9a-f]{64}$/\nconst CELL_ID_PREFIX = 'agent-profile-cell:sha256-rfc8785:'\n\nexport async function buildAgentProfileCell(\n input: AgentProfileCellInput,\n): Promise<AgentProfileCell> {\n const material = await normalizeAgentProfileCellInput(input)\n const cellId = `${CELL_ID_PREFIX}${await hashJson(material)}`\n return { ...material, cellId }\n}\n\nfunction agentProfileCellHashMaterial(cell: AgentProfileCell): Omit<AgentProfileCell, 'cellId'> {\n const { cellId: _cellId, ...material } = cell\n void _cellId\n return normalizeAgentProfileCell(material)\n}\n\n/**\n * Verify an `AgentProfileCell`'s `cellId` matches the sha256 of its hash-material\n * fields, confirming the record has not been tampered with. Unsupported digest\n * schemes are refused before comparing the material.\n */\nexport async function verifyAgentProfileCell(cell: AgentProfileCell): Promise<boolean> {\n validateAgentProfileCell(cell)\n const material = agentProfileCellHashMaterial(cell)\n return cell.cellId === `${CELL_ID_PREFIX}${await hashJson(material)}`\n}\n\nexport function validateAgentProfileCell(input: unknown): AgentProfileCell {\n if (input === null || typeof input !== 'object') {\n throw new AgentProfileCellValidationError('expected object')\n }\n const obj = input as Record<string, unknown>\n expectLiteral(obj.schemaVersion, 'agent-profile-cell/v1', 'schemaVersion')\n if (typeof obj.cellId !== 'string' || !CELL_ID.test(obj.cellId)) {\n throw new AgentProfileCellValidationError(\n 'cellId must match agent-profile-cell:sha256-rfc8785:<64 lowercase hex chars>',\n 'cellId',\n )\n }\n expectString(obj.profileId, 'profileId')\n validateSource(obj.sourceProfile, 'sourceProfile')\n if (obj.harness !== undefined) validateHarness(obj.harness, 'harness')\n if (obj.model !== undefined) expectString(obj.model, 'model')\n if (obj.promptHash !== undefined) expectString(obj.promptHash, 'promptHash')\n if (obj.dimensions !== undefined) validateDimensions(obj.dimensions, 'dimensions')\n return input as AgentProfileCell\n}\n\nfunction requireAgentProfileCell(record: {\n runId: string\n agentProfile?: AgentProfileCell\n}): AgentProfileCell {\n if (!record.agentProfile) {\n throw new AgentProfileCellValidationError(\n `run \"${record.runId}\" is missing agentProfile; profile-cell grouping requires explicit profile identity`,\n 'agentProfile',\n )\n }\n return validateAgentProfileCell(record.agentProfile)\n}\n\nexport function agentProfileCellKey(record: {\n runId: string\n agentProfile?: AgentProfileCell\n}): string {\n return requireAgentProfileCell(record).cellId\n}\n\nexport function groupRunsByAgentProfileCell<\n T extends { runId: string; agentProfile?: AgentProfileCell },\n>(records: readonly T[]): Map<string, T[]> {\n const groups = new Map<string, T[]>()\n for (const record of records) {\n const key = agentProfileCellKey(record)\n const bucket = groups.get(key)\n if (bucket) bucket.push(record)\n else groups.set(key, [record])\n }\n return groups\n}\n\nasync function normalizeAgentProfileCellInput(\n input: AgentProfileCellInput,\n): Promise<Omit<AgentProfileCell, 'cellId'>> {\n return normalizeAgentProfileCell({\n schemaVersion: 'agent-profile-cell/v1',\n profileId: input.profileId,\n sourceProfile: await normalizeSourceInput(input.sourceProfile),\n harness: input.harness,\n model: input.model,\n promptHash: input.promptHash,\n dimensions: input.dimensions,\n })\n}\n\nfunction normalizeAgentProfileCell(\n input: Omit<AgentProfileCell, 'cellId'>,\n): Omit<AgentProfileCell, 'cellId'> {\n return compactObject({\n schemaVersion: 'agent-profile-cell/v1' as const,\n profileId: requireNonEmpty(input.profileId, 'profileId'),\n sourceProfile: normalizeSource(input.sourceProfile),\n harness: input.harness ? normalizeHarness(input.harness, 'harness') : undefined,\n model: optionalNonEmpty(input.model, 'model'),\n promptHash: optionalNonEmpty(input.promptHash, 'promptHash'),\n dimensions: input.dimensions\n ? nonEmptyRecord(normalizeDimensions(input.dimensions))\n : undefined,\n })\n}\n\nasync function normalizeSourceInput(input: AgentProfileSourceInput): Promise<AgentProfileSource> {\n const kind = requireNonEmpty(input.kind, 'sourceProfile.kind')\n if (input.hash !== undefined && input.profile !== undefined) {\n throw new AgentProfileCellValidationError(\n 'sourceProfile must provide either hash or profile, not both',\n 'sourceProfile',\n )\n }\n if (input.hash !== undefined) {\n return { kind, hash: requireSha256Hex(input.hash, 'sourceProfile.hash') }\n }\n if (input.profile === undefined) {\n throw new AgentProfileCellValidationError(\n 'sourceProfile must provide hash or profile',\n 'sourceProfile',\n )\n }\n assertJson(input.profile, 'sourceProfile.profile')\n return { kind, hash: await hashJson(input.profile) }\n}\n\nfunction normalizeSource(input: AgentProfileSource): AgentProfileSource {\n return {\n kind: requireNonEmpty(input.kind, 'sourceProfile.kind'),\n hash: requireSha256Hex(input.hash, 'sourceProfile.hash'),\n }\n}\n\nfunction normalizeHarness(input: AgentProfileHarness, path: string): AgentProfileHarness {\n return compactObject({\n id: requireNonEmpty(input.id, `${path}.id`),\n version: optionalNonEmpty(input.version, `${path}.version`),\n hash: optionalNonEmpty(input.hash, `${path}.hash`),\n })\n}\n\nfunction normalizeDimensions(\n input: Record<string, AgentProfileDimensionValue>,\n): Record<string, AgentProfileDimensionValue> {\n const out: Record<string, AgentProfileDimensionValue> = {}\n for (const key of Object.keys(input).sort()) {\n const value = input[key]\n requireNonEmpty(key, 'dimensions.<key>')\n if (\n value !== null &&\n typeof value !== 'string' &&\n typeof value !== 'number' &&\n typeof value !== 'boolean'\n ) {\n throw new AgentProfileCellValidationError(\n 'expected primitive dimension value',\n `dimensions.${key}`,\n )\n }\n if (typeof value === 'number' && !Number.isFinite(value)) {\n throw new AgentProfileCellValidationError('expected finite number', `dimensions.${key}`)\n }\n Object.defineProperty(out, key, { value, enumerable: true, writable: true, configurable: true })\n }\n return out\n}\n\nfunction compactObject<T extends Record<string, unknown>>(input: T): T {\n const out: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(input)) {\n if (value !== undefined) out[key] = value\n }\n return out as T\n}\n\nfunction nonEmptyRecord<T extends Record<string, unknown>>(input: T): T | undefined {\n return Object.keys(input).length > 0 ? input : undefined\n}\n\nfunction validateSource(value: unknown, path: string): void {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new AgentProfileCellValidationError('expected object', path)\n }\n const rec = value as Record<string, unknown>\n expectString(rec.kind, `${path}.kind`)\n requireSha256Hex(rec.hash, `${path}.hash`)\n}\n\nfunction validateHarness(value: unknown, path: string): void {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new AgentProfileCellValidationError('expected object', path)\n }\n const rec = value as Record<string, unknown>\n expectString(rec.id, `${path}.id`)\n if (rec.version !== undefined) expectString(rec.version, `${path}.version`)\n if (rec.hash !== undefined) expectString(rec.hash, `${path}.hash`)\n}\n\nfunction validateDimensions(value: unknown, path: string): void {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new AgentProfileCellValidationError('expected object', path)\n }\n normalizeDimensions(value as Record<string, AgentProfileDimensionValue>)\n}\n\nfunction assertJson(value: AgentProfileJson, path: string): void {\n if (value === null) return\n const type = typeof value\n if (type === 'string' || type === 'boolean') return\n if (type === 'number') {\n if (!Number.isFinite(value)) {\n throw new AgentProfileCellValidationError('expected finite number', path)\n }\n return\n }\n if (Array.isArray(value)) {\n value.forEach((item, index) => {\n assertJson(item, `${path}[${index}]`)\n })\n return\n }\n if (type === 'object') {\n for (const [key, nested] of Object.entries(value)) {\n requireNonEmpty(key, `${path}.<key>`)\n assertJson(nested, `${path}.${key}`)\n }\n return\n }\n throw new AgentProfileCellValidationError('expected JSON-compatible value', path)\n}\n\nfunction expectLiteral(value: unknown, expected: string, path: string): void {\n if (value !== expected) {\n throw new AgentProfileCellValidationError(`expected ${expected}`, path)\n }\n}\n\nfunction expectString(value: unknown, path: string): void {\n if (typeof value !== 'string' || value.length === 0) {\n throw new AgentProfileCellValidationError('expected non-empty string', path)\n }\n}\n\nfunction requireNonEmpty(value: string, path: string): string {\n if (typeof value !== 'string' || value.length === 0) {\n throw new AgentProfileCellValidationError('expected non-empty string', path)\n }\n return value\n}\n\nfunction optionalNonEmpty(value: string | undefined, path: string): string | undefined {\n if (value === undefined) return undefined\n return requireNonEmpty(value, path)\n}\n\nfunction requireSha256Hex(value: unknown, path: string): string {\n if (typeof value !== 'string' || !SHA256_HEX.test(value)) {\n throw new AgentProfileCellValidationError('expected 64 lowercase sha256 hex chars', path)\n }\n return value\n}\n\n// ── Consumer helpers ─────────────────────────────────────────────────\n//\n// Boilerplate every product consuming `buildAgentProfileCell` used to duplicate:\n//\n// 1. A `JSON.parse(JSON.stringify(value))` helper that canonicalizes an\n// arbitrary `@tangle-network/agent-interface` `AgentProfile` into the recursive\n// `AgentProfileJson` shape, with a fail-loud error when the profile\n// is not JSON-serializable.\n//\n// 2. The magic string `'agent-interface-profile'` for `sourceProfile.kind`.\n//\n// Both belong here so the cross-product cell join (same canonical profile\n// hashes to the same `sourceProfile.hash` across products) is enforced by\n// the type system, not by every consumer remembering to do it right.\n// See blueprint-agent issue tangle-network/agent-eval#82.\n\n/** Canonical `sourceProfile.kind` values. The profile alone determines\n * `sourceProfile.hash`; kind also contributes to cellId. Compare both kind and\n * hash when joining source identities across products. Extend rather than\n * create new strings — a new kind is a cross-product schema change. */\nexport const AGENT_PROFILE_KINDS = {\n /** A profile declared via `defineAgentProfile(...)` from\n * `@tangle-network/agent-interface`. The default kind for router-backed\n * and sandbox-backed products. */\n AGENT_INTERFACE_PROFILE: 'agent-interface-profile',\n} as const\n\n/** Convert a profile's JSON document form using the shared canonical encoder.\n * Undefined object properties are absent from the document; other values with\n * no faithful JSON representation are rejected before hashing. */\nexport function toAgentProfileJson(value: unknown): AgentProfileJson {\n try {\n return JSON.parse(canonicalString(jsonDocument(value))) as AgentProfileJson\n } catch (err) {\n throw new AgentProfileCellValidationError(\n `agent profile must be JSON-serializable: ${err instanceof Error ? err.message : String(err)}`,\n 'sourceProfile.profile',\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,eAAsB,SAAY,KAAyB;CACzD,OAAO,cAAc,GAAG,CAAC,CAAC,MAAM,CAAgB;AAClD;;;;;AAMA,SAAgB,sBAAsB,UAAkC;CACtE,MAAM,EAAE,aAAa,cAAc,MAAM,GAAG,SAAS;CAErD,IAAI,SAAS,kBACX,MAAM,IAAI,MAAM,qDAAqD,OAAO,IAAI,EAAE,EAAE;CAEtF,OAAO,cAAc,IAAI,CAAC,CAAC,MAAM,CAAgB;AACnD;;;;;;AAOA,eAAsB,aAAa,GAAgD;CACjF,MAAM,SAAyB;EAAE,GAAG;EAAG,aAAa;EAAI,MAAM;CAAiB;CAC/E,OAAO;EAAE,GAAG;EAAQ,aAAa,sBAAsB,MAAM;CAAE;AACjE;;;;;AAMA,eAAsB,eAAe,GAAqC;CACxE,IAAI;EACF,OAAO,sBAAsB,CAAC,MAAM,EAAE;CACxC,QAAQ;EACN,OAAO;CACT;AACF;;ACzDA,IAAa,kCAAb,cAAqD,gBAAgB;CACnE;CACA,YAAY,SAAiB,OAAO,IAAI;EACtC,MAAM,OAAO,GAAG,QAAQ,OAAO,KAAK,KAAK,OAAO;EAChD,KA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O;GACpC,WAAW,QAAQ,GAAG,KAAK,GAAG,KAAK;EACrC;EACA;CACF;CACA,MAAM,IAAI,gCAAgC,kCAAkC,IAAI;AAClF;AAEA,SAAS,cAAc,OAAgB,UAAkB,MAAoB;CAC3E,IAAI,UAAU,UACZ,MAAM,IAAI,gCAAgC,YAAY,YAAY,IAAI;AAE1E;AAEA,SAAS,aAAa,OAAgB,MAAoB;CACxD,IAAI,OAAO,UAAU,YAAY,MAAM,WAAW,GAChD,MAAM,IAAI,gCAAgC,6BAA6B,IAAI;AAE/E;AAEA,SAAS,gBAAgB,OAAe,MAAsB;CAC5D,IAAI,OAAO,UAAU,YAAY,MAAM,WAAW,GAChD,MAAM,IAAI,gCAAgC,6BAA6B,IAAI;CAE7E,OAAO;AACT;AAEA,SAAS,iBAAiB,OAA2B,MAAkC;CACrF,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,OAAO,gBAAgB,OAAO,IAAI;AACpC;AAEA,SAAS,iBAAiB,OAAgB,MAAsB;CAC9D,IAAI,OAAO,UAAU,YAAY,CAAC,WAAW,KAAK,KAAK,GACrD,MAAM,IAAI,gCAAgC,0CAA0C,IAAI;CAE1F,OAAO;AACT;;;;;AAsBA,MAAa,sBAAsB;;;;AAIjC,yBAAyB,0BAC3B;;;;AAKA,SAAgB,mBAAmB,OAAkC;CACnE,IAAI;EACF,OAAO,KAAK,MAAM,gBAAgB,aAAa,KAAK,CAAC,CAAC;CACxD,SAAS,KAAK;EACZ,MAAM,IAAI,gCACR,4CAA4C,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,KAC3F,uBACF;CACF;AACF"}
1
+ {"version":3,"file":"agent-profile-cell-CUthydZB.js","names":[],"sources":["../src/pre-registration.ts","../src/agent-profile-cell.ts"],"sourcesContent":["/**\n * Pre-registered hypotheses — declare what you're testing BEFORE the\n * run, check it AFTER. Prevents p-hacking, optional stopping, and the\n * \"we ran until it looked good\" failure mode.\n *\n * Manifest is a plain JSON-friendly object. Sign it with a content hash\n * + timestamp; the registered record becomes immutable. Post-run,\n * evaluate the manifest against observed results — the library refuses\n * to let you re-interpret a different metric as the declared one.\n *\n * A signed manifest carries its required digest scheme. Verification accepts\n * only RFC 8785 canonical JSON, using the same encoder as every new identity.\n */\n\nimport { hashCanonical } from './ledger-core/canonical'\n\nexport interface HypothesisManifest {\n id: string\n /** Human prose — goes into the audit trail. */\n hypothesis: string\n /** Metric the hypothesis claims to move. */\n metric: string\n /** 'increase' = candidate should score higher than baseline; 'decrease' = lower. */\n direction: 'increase' | 'decrease'\n /** Minimum effect size to count (same units as the metric). */\n minEffect: number\n /** Alpha threshold. */\n alpha: number\n /** Target statistical power at which sample size was pre-computed. */\n power: number\n /** Declared N per arm before running. */\n preRegisteredN: number\n /** ISO8601 timestamp the manifest was registered. */\n registeredAt: string\n /** Optional identifiers to tie into the trace corpus. */\n baselineLabel?: string\n candidateLabel?: string\n}\n\n/** SHA-256 over RFC 8785 canonical JSON, excluding `contentHash` and `algo`. */\nexport type SignedManifestAlgo = 'sha256-rfc8785'\n\nexport interface SignedManifest extends HypothesisManifest {\n /** sha256 hex of canonicalized manifest (everything except contentHash and algo). */\n contentHash: string\n /** Required digest scheme. Missing or unsupported schemes fail verification. */\n algo: SignedManifestAlgo\n}\n\nexport interface HypothesisResult {\n manifest: SignedManifest\n observedN: number\n observedEffect: number\n observedPValue: number\n /** True iff the observed effect hits the pre-declared direction with\n * magnitude ≥ minEffect AND p < alpha. */\n confirmed: boolean\n /** Enumerated reasons the hypothesis was rejected (each a machine-tag). */\n rejectionReasons: Array<\n 'wrong_direction' | 'effect_too_small' | 'not_significant' | 'undersampled'\n >\n notes?: string\n}\n\n/**\n * SHA-256 hex (full 64 chars) over the RFC 8785 canonical JSON encoding of\n * `obj` — the package's one identity scheme, shared with `ledger-core`.\n *\n * Values canonical JSON cannot represent faithfully — `undefined`, `NaN`,\n * class instances, cycles — are refused rather than coerced, because a\n * coercion maps two distinct records onto one digest.\n *\n * Named `hashJson` to disambiguate from `prompt-registry.ts`'s `hashContent`,\n * which takes a string input and returns a truncated 12-char prompt id.\n *\n * @example\n * const hash = await hashJson({ id: '1', kind: 'spec' })\n * // 'a3f1...' (64 hex chars)\n */\nexport async function hashJson<T>(obj: T): Promise<string> {\n return hashCanonical(obj).slice('sha256:'.length)\n}\n\n/**\n * Digest a manifest after validating its scheme, excluding `contentHash` and\n * `algo`. This synchronous check can refuse a manifest before consuming data.\n */\nexport function manifestContentDigest(manifest: SignedManifest): string {\n const { contentHash: _contentHash, algo, ...rest } = manifest\n void _contentHash\n if (algo !== 'sha256-rfc8785') {\n throw new Error(`pre-registration: unsupported manifest hash algo '${String(algo)}'`)\n }\n return hashCanonical(rest).slice('sha256:'.length)\n}\n\n/**\n * Sign a manifest with a SHA-256 content hash over its RFC 8785 canonical\n * JSON, with `contentHash` and `algo` stripped, and stamp the scheme in\n * `algo` so a later reader knows which encoder to verify with.\n */\nexport async function signManifest(m: HypothesisManifest): Promise<SignedManifest> {\n const signed: SignedManifest = { ...m, contentHash: '', algo: 'sha256-rfc8785' }\n return { ...signed, contentHash: manifestContentDigest(signed) }\n}\n\n/**\n * Verify that a signed manifest has not been tampered with, under the scheme\n * the manifest itself declares.\n */\nexport async function verifyManifest(m: SignedManifest): Promise<boolean> {\n try {\n return manifestContentDigest(m) === m.contentHash\n } catch {\n return false\n }\n}\n\n/**\n * Evaluate a pre-registered hypothesis against observed results.\n * Mechanical — no re-interpretation permitted.\n */\nexport async function evaluateHypothesis(\n manifest: SignedManifest,\n observed: { n: number; effect: number; pValue: number },\n): Promise<HypothesisResult> {\n if (!(await verifyManifest(manifest))) {\n throw new Error('evaluateHypothesis: unsupported manifest hash scheme or content hash mismatch')\n }\n const reasons: HypothesisResult['rejectionReasons'] = []\n const directionOk = manifest.direction === 'increase' ? observed.effect > 0 : observed.effect < 0\n if (!directionOk) reasons.push('wrong_direction')\n if (Math.abs(observed.effect) < manifest.minEffect) reasons.push('effect_too_small')\n if (observed.pValue >= manifest.alpha) reasons.push('not_significant')\n if (observed.n < manifest.preRegisteredN) reasons.push('undersampled')\n return {\n manifest,\n observedN: observed.n,\n observedEffect: observed.effect,\n observedPValue: observed.pValue,\n confirmed: reasons.length === 0,\n rejectionReasons: reasons,\n }\n}\n","import { ValidationError } from './errors'\nimport { canonicalString, jsonDocument } from './ledger-core/canonical'\nimport { hashJson } from './pre-registration'\n\nexport type AgentProfileCellSchemaVersion = 'agent-profile-cell/v1'\n\nexport type AgentProfileJsonObject = { [key: string]: AgentProfileJson }\n\nexport type AgentProfileJson =\n | string\n | number\n | boolean\n | null\n | AgentProfileJson[]\n | AgentProfileJsonObject\n\nexport type AgentProfileDimensionValue = string | number | boolean | null\n\nexport interface AgentProfileSource {\n /** Runtime/profile contract being fingerprinted, e.g. `agent-interface-profile`. */\n kind: string\n /** sha256 over the canonical source profile object. */\n hash: string\n}\n\nexport interface AgentProfileSourceInput {\n kind: string\n /** Precomputed sha256 for callers that already sign their profile artifact. */\n hash?: string\n /** Full canonical runtime profile; hashed and then discarded from the cell. */\n profile?: AgentProfileJson\n}\n\nexport interface AgentProfileHarness {\n id: string\n version?: string\n hash?: string\n}\n\nexport interface AgentProfileCellInput {\n profileId: string\n sourceProfile: AgentProfileSourceInput\n harness?: AgentProfileHarness\n model?: string\n promptHash?: string\n dimensions?: Record<string, AgentProfileDimensionValue>\n}\n\nexport interface AgentProfileCell {\n schemaVersion: AgentProfileCellSchemaVersion\n cellId: string\n profileId: string\n sourceProfile: AgentProfileSource\n harness?: AgentProfileHarness\n model?: string\n promptHash?: string\n dimensions?: Record<string, AgentProfileDimensionValue>\n}\n\nexport class AgentProfileCellValidationError extends ValidationError {\n readonly path: string\n constructor(message: string, path = '') {\n super(path ? `${message} (at ${path})` : message)\n this.path = path\n }\n}\n\nconst SHA256_HEX = /^[0-9a-f]{64}$/\n/** A cell id carries the canonical digest scheme required for verification. */\nconst CELL_ID = /^agent-profile-cell:sha256-rfc8785:[0-9a-f]{64}$/\nconst CELL_ID_PREFIX = 'agent-profile-cell:sha256-rfc8785:'\n\nexport async function buildAgentProfileCell(\n input: AgentProfileCellInput,\n): Promise<AgentProfileCell> {\n const material = await normalizeAgentProfileCellInput(input)\n const cellId = `${CELL_ID_PREFIX}${await hashJson(material)}`\n return { ...material, cellId }\n}\n\nfunction agentProfileCellHashMaterial(cell: AgentProfileCell): Omit<AgentProfileCell, 'cellId'> {\n const { cellId: _cellId, ...material } = cell\n void _cellId\n return normalizeAgentProfileCell(material)\n}\n\n/**\n * Verify an `AgentProfileCell`'s `cellId` matches the sha256 of its hash-material\n * fields, confirming the record has not been tampered with. Unsupported digest\n * schemes are refused before comparing the material.\n */\nexport async function verifyAgentProfileCell(cell: AgentProfileCell): Promise<boolean> {\n validateAgentProfileCell(cell)\n const material = agentProfileCellHashMaterial(cell)\n return cell.cellId === `${CELL_ID_PREFIX}${await hashJson(material)}`\n}\n\nexport function validateAgentProfileCell(input: unknown): AgentProfileCell {\n if (input === null || typeof input !== 'object') {\n throw new AgentProfileCellValidationError('expected object')\n }\n const obj = input as Record<string, unknown>\n expectLiteral(obj.schemaVersion, 'agent-profile-cell/v1', 'schemaVersion')\n if (typeof obj.cellId !== 'string' || !CELL_ID.test(obj.cellId)) {\n throw new AgentProfileCellValidationError(\n 'cellId must match agent-profile-cell:sha256-rfc8785:<64 lowercase hex chars>',\n 'cellId',\n )\n }\n expectString(obj.profileId, 'profileId')\n validateSource(obj.sourceProfile, 'sourceProfile')\n if (obj.harness !== undefined) validateHarness(obj.harness, 'harness')\n if (obj.model !== undefined) expectString(obj.model, 'model')\n if (obj.promptHash !== undefined) expectString(obj.promptHash, 'promptHash')\n if (obj.dimensions !== undefined) validateDimensions(obj.dimensions, 'dimensions')\n return input as AgentProfileCell\n}\n\nfunction requireAgentProfileCell(record: {\n runId: string\n agentProfile?: AgentProfileCell\n}): AgentProfileCell {\n if (!record.agentProfile) {\n throw new AgentProfileCellValidationError(\n `run \"${record.runId}\" is missing agentProfile; profile-cell grouping requires explicit profile identity`,\n 'agentProfile',\n )\n }\n return validateAgentProfileCell(record.agentProfile)\n}\n\nexport function agentProfileCellKey(record: {\n runId: string\n agentProfile?: AgentProfileCell\n}): string {\n return requireAgentProfileCell(record).cellId\n}\n\nexport function groupRunsByAgentProfileCell<\n T extends { runId: string; agentProfile?: AgentProfileCell },\n>(records: readonly T[]): Map<string, T[]> {\n const groups = new Map<string, T[]>()\n for (const record of records) {\n const key = agentProfileCellKey(record)\n const bucket = groups.get(key)\n if (bucket) bucket.push(record)\n else groups.set(key, [record])\n }\n return groups\n}\n\nasync function normalizeAgentProfileCellInput(\n input: AgentProfileCellInput,\n): Promise<Omit<AgentProfileCell, 'cellId'>> {\n return normalizeAgentProfileCell({\n schemaVersion: 'agent-profile-cell/v1',\n profileId: input.profileId,\n sourceProfile: await normalizeSourceInput(input.sourceProfile),\n harness: input.harness,\n model: input.model,\n promptHash: input.promptHash,\n dimensions: input.dimensions,\n })\n}\n\nfunction normalizeAgentProfileCell(\n input: Omit<AgentProfileCell, 'cellId'>,\n): Omit<AgentProfileCell, 'cellId'> {\n return compactObject({\n schemaVersion: 'agent-profile-cell/v1' as const,\n profileId: requireNonEmpty(input.profileId, 'profileId'),\n sourceProfile: normalizeSource(input.sourceProfile),\n harness: input.harness ? normalizeHarness(input.harness, 'harness') : undefined,\n model: optionalNonEmpty(input.model, 'model'),\n promptHash: optionalNonEmpty(input.promptHash, 'promptHash'),\n dimensions: input.dimensions\n ? nonEmptyRecord(normalizeDimensions(input.dimensions))\n : undefined,\n })\n}\n\nasync function normalizeSourceInput(input: AgentProfileSourceInput): Promise<AgentProfileSource> {\n const kind = requireNonEmpty(input.kind, 'sourceProfile.kind')\n if (input.hash !== undefined && input.profile !== undefined) {\n throw new AgentProfileCellValidationError(\n 'sourceProfile must provide either hash or profile, not both',\n 'sourceProfile',\n )\n }\n if (input.hash !== undefined) {\n return { kind, hash: requireSha256Hex(input.hash, 'sourceProfile.hash') }\n }\n if (input.profile === undefined) {\n throw new AgentProfileCellValidationError(\n 'sourceProfile must provide hash or profile',\n 'sourceProfile',\n )\n }\n assertJson(input.profile, 'sourceProfile.profile')\n return { kind, hash: await hashJson(input.profile) }\n}\n\nfunction normalizeSource(input: AgentProfileSource): AgentProfileSource {\n return {\n kind: requireNonEmpty(input.kind, 'sourceProfile.kind'),\n hash: requireSha256Hex(input.hash, 'sourceProfile.hash'),\n }\n}\n\nfunction normalizeHarness(input: AgentProfileHarness, path: string): AgentProfileHarness {\n return compactObject({\n id: requireNonEmpty(input.id, `${path}.id`),\n version: optionalNonEmpty(input.version, `${path}.version`),\n hash: optionalNonEmpty(input.hash, `${path}.hash`),\n })\n}\n\nfunction normalizeDimensions(\n input: Record<string, AgentProfileDimensionValue>,\n): Record<string, AgentProfileDimensionValue> {\n const out: Record<string, AgentProfileDimensionValue> = {}\n for (const key of Object.keys(input).sort()) {\n const value = input[key]\n requireNonEmpty(key, 'dimensions.<key>')\n if (\n value !== null &&\n typeof value !== 'string' &&\n typeof value !== 'number' &&\n typeof value !== 'boolean'\n ) {\n throw new AgentProfileCellValidationError(\n 'expected primitive dimension value',\n `dimensions.${key}`,\n )\n }\n if (typeof value === 'number' && !Number.isFinite(value)) {\n throw new AgentProfileCellValidationError('expected finite number', `dimensions.${key}`)\n }\n Object.defineProperty(out, key, { value, enumerable: true, writable: true, configurable: true })\n }\n return out\n}\n\nfunction compactObject<T extends Record<string, unknown>>(input: T): T {\n const out: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(input)) {\n if (value !== undefined) out[key] = value\n }\n return out as T\n}\n\nfunction nonEmptyRecord<T extends Record<string, unknown>>(input: T): T | undefined {\n return Object.keys(input).length > 0 ? input : undefined\n}\n\nfunction validateSource(value: unknown, path: string): void {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new AgentProfileCellValidationError('expected object', path)\n }\n const rec = value as Record<string, unknown>\n expectString(rec.kind, `${path}.kind`)\n requireSha256Hex(rec.hash, `${path}.hash`)\n}\n\nfunction validateHarness(value: unknown, path: string): void {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new AgentProfileCellValidationError('expected object', path)\n }\n const rec = value as Record<string, unknown>\n expectString(rec.id, `${path}.id`)\n if (rec.version !== undefined) expectString(rec.version, `${path}.version`)\n if (rec.hash !== undefined) expectString(rec.hash, `${path}.hash`)\n}\n\nfunction validateDimensions(value: unknown, path: string): void {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new AgentProfileCellValidationError('expected object', path)\n }\n normalizeDimensions(value as Record<string, AgentProfileDimensionValue>)\n}\n\nfunction assertJson(value: AgentProfileJson, path: string): void {\n if (value === null) return\n const type = typeof value\n if (type === 'string' || type === 'boolean') return\n if (type === 'number') {\n if (!Number.isFinite(value)) {\n throw new AgentProfileCellValidationError('expected finite number', path)\n }\n return\n }\n if (Array.isArray(value)) {\n value.forEach((item, index) => {\n assertJson(item, `${path}[${index}]`)\n })\n return\n }\n if (type === 'object') {\n for (const [key, nested] of Object.entries(value)) {\n requireNonEmpty(key, `${path}.<key>`)\n assertJson(nested, `${path}.${key}`)\n }\n return\n }\n throw new AgentProfileCellValidationError('expected JSON-compatible value', path)\n}\n\nfunction expectLiteral(value: unknown, expected: string, path: string): void {\n if (value !== expected) {\n throw new AgentProfileCellValidationError(`expected ${expected}`, path)\n }\n}\n\nfunction expectString(value: unknown, path: string): void {\n if (typeof value !== 'string' || value.length === 0) {\n throw new AgentProfileCellValidationError('expected non-empty string', path)\n }\n}\n\nfunction requireNonEmpty(value: string, path: string): string {\n if (typeof value !== 'string' || value.length === 0) {\n throw new AgentProfileCellValidationError('expected non-empty string', path)\n }\n return value\n}\n\nfunction optionalNonEmpty(value: string | undefined, path: string): string | undefined {\n if (value === undefined) return undefined\n return requireNonEmpty(value, path)\n}\n\nfunction requireSha256Hex(value: unknown, path: string): string {\n if (typeof value !== 'string' || !SHA256_HEX.test(value)) {\n throw new AgentProfileCellValidationError('expected 64 lowercase sha256 hex chars', path)\n }\n return value\n}\n\n// ── Consumer helpers ─────────────────────────────────────────────────\n//\n// Boilerplate every product consuming `buildAgentProfileCell` used to duplicate:\n//\n// 1. A `JSON.parse(JSON.stringify(value))` helper that canonicalizes an\n// arbitrary `@tangle-network/agent-interface` `AgentProfile` into the recursive\n// `AgentProfileJson` shape, with a fail-loud error when the profile\n// is not JSON-serializable.\n//\n// 2. The magic string `'agent-interface-profile'` for `sourceProfile.kind`.\n//\n// Both belong here so the cross-product cell join (same canonical profile\n// hashes to the same `sourceProfile.hash` across products) is enforced by\n// the type system, not by every consumer remembering to do it right.\n// See blueprint-agent issue tangle-network/agent-eval#82.\n\n/** Canonical `sourceProfile.kind` values. The profile alone determines\n * `sourceProfile.hash`; kind also contributes to cellId. Compare both kind and\n * hash when joining source identities across products. Extend rather than\n * create new strings — a new kind is a cross-product schema change. */\nexport const AGENT_PROFILE_KINDS = {\n /** A profile declared via `defineAgentProfile(...)` from\n * `@tangle-network/agent-interface`. The default kind for router-backed\n * and sandbox-backed products. */\n AGENT_INTERFACE_PROFILE: 'agent-interface-profile',\n} as const\n\n/** Convert a profile's JSON document form using the shared canonical encoder.\n * Undefined object properties are absent from the document; other values with\n * no faithful JSON representation are rejected before hashing. */\nexport function toAgentProfileJson(value: unknown): AgentProfileJson {\n try {\n return JSON.parse(canonicalString(jsonDocument(value))) as AgentProfileJson\n } catch (err) {\n throw new AgentProfileCellValidationError(\n `agent profile must be JSON-serializable: ${err instanceof Error ? err.message : String(err)}`,\n 'sourceProfile.profile',\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,eAAsB,SAAY,KAAyB;CACzD,OAAO,cAAc,GAAG,CAAC,CAAC,MAAM,CAAgB;AAClD;;;;;AAMA,SAAgB,sBAAsB,UAAkC;CACtE,MAAM,EAAE,aAAa,cAAc,MAAM,GAAG,SAAS;CAErD,IAAI,SAAS,kBACX,MAAM,IAAI,MAAM,qDAAqD,OAAO,IAAI,EAAE,EAAE;CAEtF,OAAO,cAA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AAyB,0BAC3B;;;;AAKA,SAAgB,mBAAmB,OAAkC;CACnE,IAAI;EACF,OAAO,KAAK,MAAM,gBAAgB,aAAa,KAAK,CAAC,CAAC;CACxD,SAAS,KAAK;EACZ,MAAM,IAAI,gCACR,4CAA4C,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,KAC3F,uBACF;CACF;AACF"}
@@ -1,20 +1,20 @@
1
- import { m as CustomTokenPricing, o as CostLedgerHandle } from "../cost-ledger-Czro9wmo.js";
2
- import { A as FindingParseOutcome, B as FindingTreatment, C as CalibrationInterval, D as FindingLayer, E as FindingEvidenceUnit, F as independentUnitCount, H as TreatmentLayer, I as lineageRoots, L as parseAnalystFinding, M as FindingScope, N as FindingScopeReading, O as FindingMeasure, P as ProposalFindingSchema, R as readFindingScope, S as makeProposalFinding, T as FindingCalibration, V as TREATMENT_LAYERS, Y as TraceAnalysisStore, _ as ExecutionProbeRequest, a as AnalystFindingSchemaVersion, b as computeFindingId, c as AnalystRunEvent, d as AnalystRunSummary, f as AnalystSeverity, g as ExecutionProbeOutcome, h as ExecutionProbe, i as AnalystFinding, j as FindingReaderLabel, k as FindingMethod, l as AnalystRunInputs, m as EvidenceRef, n as AnalystContext, o as AnalystInputKind, ot as TraceAnalystSpan, p as AnalystUsageReceipt, r as AnalystCost, s as AnalystRequirements, t as Analyst, u as AnalystRunResult, v as ProposalFinding, w as FINDING_LAYERS, x as makeFinding, y as ProposalFindingOrigin, z as FindingConditions } from "../types-DmYd2Igl.js";
3
- import { A as ChatResponse, D as ChatCallOpts, F as MockTransportOpts, I as OpenAiCompatibleTransportOpts, L as SandboxSdkTransportOpts, M as CreateChatClientOpts, N as CustomTransportOpts, O as ChatClient, R as createChatClient, j as ChatTransport, k as ChatRequest, t as BootstrapInterval } from "../cluster-CSd0LE_M.js";
4
- import { Wt as NominalAgreementOptions } from "../index-Bcy00QoN.js";
5
- import { A as AnalystBenchmarkDescriptor, B as AnalystEvidenceResolution, F as AnalystBenchmarkProvenance, G as AnalystLatencyDistribution, H as AnalystEvidenceResolver, I as AnalystBenchmarkResult, J as traceStoreEvidenceResolver, K as RunAnalystBenchmarkOptions, L as AnalystBenchmarkRunner, M as AnalystBenchmarkLabelState, N as AnalystBenchmarkObservation, O as AnalystBenchmarkCase, P as AnalystBenchmarkOutput, R as AnalystBenchmarkSummary, U as AnalystFindingScore, V as AnalystEvidenceResolutionError, W as AnalystIssueExpectation, j as AnalystBenchmarkError, k as AnalystBenchmarkDatasetRef, q as runAnalystBenchmark, t as AgentProfile, v as ExternalOptimizerModelCall, w as ExternalOptimizerRunnerCommand, x as ExternalOptimizerModelExecutionObservation, z as AnalystEvidenceExpectation } from "../agent-profile-hytrwAnN.js";
6
- import { C as BehavioralWindowPolicy, S as BehavioralTraceWindow, _ as BehavioralTraceEventMap, a as createTraceAnalyst, b as BehavioralTraceQuestionsOptions, c as BehavioralAnalystOptions, d as pinBehavioralFailureClass, f as BEHAVIORAL_TRACE_QUESTIONS, g as BehavioralTraceEvent, h as BehavioralTraceAnswer, i as TraceAnalystDefinition, l as assertFailureClasses, m as BehavioralQuestionCalibration, n as buildDefaultAnalystRegistry, o as runTraceAnalyst, p as BEHAVIORAL_TRACE_QUESTIONS_VERSION, r as CreateTraceAnalystOptions, s as BEHAVIORAL_FAILURE_CLASS, t as DefaultAnalystRegistryOptions, u as behavioralAnalyst, v as BehavioralTraceLayer, w as behavioralTraceQuestionDigest, x as BehavioralTraceSupport, y as BehavioralTraceQuestionId } from "../default-registry-C5x2jyD6.js";
7
- import { a as ExactAnalystRunPolicySnapshot, c as ExactAnalystSnapshot, d as ExactExecutionComponentSnapshot, i as ExactAnalystRunEvent, l as ExactCapableAnalyst, n as ExactAnalystExecutionPlanSnapshot, o as ExactAnalystRunResult, r as ExactAnalystRunCompletion, s as ExactAnalystRunSummary, t as ExactAnalystBudgetSnapshot, u as ExactExecutionComponentIdentity } from "../exact-types-B0_jA3V7.js";
1
+ import { m as CustomTokenPricing, o as CostLedgerHandle } from "../cost-ledger-CSP-OfFe.js";
2
+ import { A as FindingParseOutcome, B as FindingTreatment, C as CalibrationInterval, D as FindingLayer, E as FindingEvidenceUnit, F as independentUnitCount, H as TreatmentLayer, I as lineageRoots, L as parseAnalystFinding, M as FindingScope, N as FindingScopeReading, O as FindingMeasure, P as ProposalFindingSchema, R as readFindingScope, S as makeProposalFinding, T as FindingCalibration, V as TREATMENT_LAYERS, Y as TraceAnalysisStore, _ as ExecutionProbeRequest, a as AnalystFindingSchemaVersion, b as computeFindingId, c as AnalystRunEvent, d as AnalystRunSummary, f as AnalystSeverity, g as ExecutionProbeOutcome, h as ExecutionProbe, i as AnalystFinding, j as FindingReaderLabel, k as FindingMethod, l as AnalystRunInputs, m as EvidenceRef, n as AnalystContext, o as AnalystInputKind, ot as TraceAnalystSpan, p as AnalystUsageReceipt, r as AnalystCost, s as AnalystRequirements, t as Analyst, u as AnalystRunResult, v as ProposalFinding, w as FINDING_LAYERS, x as makeFinding, y as ProposalFindingOrigin, z as FindingConditions } from "../types-AGUuvnae.js";
3
+ import { A as ChatResponse, D as ChatCallOpts, F as MockTransportOpts, I as OpenAiCompatibleTransportOpts, L as SandboxSdkTransportOpts, M as CreateChatClientOpts, N as CustomTransportOpts, O as ChatClient, R as createChatClient, j as ChatTransport, k as ChatRequest, t as BootstrapInterval } from "../cluster-Bj90LK-1.js";
4
+ import { Wt as NominalAgreementOptions } from "../index-CKjqN9_U.js";
5
+ import { $ as RunAnalystBenchmarkOptions, B as AnalystBenchmarkObservation, F as AnalystBenchmarkCase, G as AnalystBenchmarkSummary, H as AnalystBenchmarkProvenance, I as AnalystBenchmarkDatasetRef, J as AnalystEvidenceResolutionError, K as AnalystEvidenceExpectation, L as AnalystBenchmarkDescriptor, Q as AnalystLatencyDistribution, R as AnalystBenchmarkError, S as ExternalOptimizerModelExecutionObservation, T as ExternalOptimizerRunnerCommand, U as AnalystBenchmarkResult, V as AnalystBenchmarkOutput, W as AnalystBenchmarkRunner, X as AnalystFindingScore, Y as AnalystEvidenceResolver, Z as AnalystIssueExpectation, et as runAnalystBenchmark, q as AnalystEvidenceResolution, t as AgentProfile, tt as traceStoreEvidenceResolver, y as ExternalOptimizerModelCall, z as AnalystBenchmarkLabelState } from "../agent-profile-CcOq7bOO.js";
6
+ import { C as BehavioralWindowPolicy, S as BehavioralTraceWindow, _ as BehavioralTraceEventMap, a as createTraceAnalyst, b as BehavioralTraceQuestionsOptions, c as BehavioralAnalystOptions, d as pinBehavioralFailureClass, f as BEHAVIORAL_TRACE_QUESTIONS, g as BehavioralTraceEvent, h as BehavioralTraceAnswer, i as TraceAnalystDefinition, l as assertFailureClasses, m as BehavioralQuestionCalibration, n as buildDefaultAnalystRegistry, o as runTraceAnalyst, p as BEHAVIORAL_TRACE_QUESTIONS_VERSION, r as CreateTraceAnalystOptions, s as BEHAVIORAL_FAILURE_CLASS, t as DefaultAnalystRegistryOptions, u as behavioralAnalyst, v as BehavioralTraceLayer, w as behavioralTraceQuestionDigest, x as BehavioralTraceSupport, y as BehavioralTraceQuestionId } from "../default-registry-CUuorCWZ.js";
7
+ import { a as ExactAnalystRunPolicySnapshot, c as ExactAnalystSnapshot, d as ExactExecutionComponentSnapshot, i as ExactAnalystRunEvent, l as ExactCapableAnalyst, n as ExactAnalystExecutionPlanSnapshot, o as ExactAnalystRunResult, r as ExactAnalystRunCompletion, s as ExactAnalystRunSummary, t as ExactAnalystBudgetSnapshot, u as ExactExecutionComponentIdentity } from "../exact-types-CiCXYhNK.js";
8
8
  import { g as SystemOneState } from "../systemone-protocol-C4t7JH4Y.js";
9
- import { B as DiffPolicy, F as FindingsTimeStep, H as FindingsStore, I as LedgerFinding, L as diffFindingsOverTime, M as FindingsLedgerOutcome, N as FindingsLedgerRead, P as FindingsQuery, R as openFindingsLedger, U as PersistedFinding, V as FindingsDiff, W as diffFindings, j as FindingsLedger, r as SystemOneEvaluatorOptions, z as queryFindings } from "../systemone-B_3Vd395.js";
10
- import { a as RAW_FINDING_SCHEMA_PROMPT, c as RawAnalystFindingSchema, i as TraceAnalystLimits, l as evidenceRefsFromRawFinding, n as TraceAnalysisEngineRequest, o as RawAnalystEvidence, r as TraceAnalysisEngineResult, s as RawAnalystFinding, t as TraceAnalysisEngine, u as parseRawFinding } from "../engine-B2w3ARpj.js";
11
- import { n as buildTraceToolsForGroup, t as TraceToolGroupName } from "../tool-groups-BOH1E-E4.js";
12
- import { a as BudgetPolicy, c as RegistryRunOpts, i as AnalystRegistryOptions, n as ExactAnalystRunExecutionError, o as ExactAnalystBudgetPolicy, r as AnalystHooks, s as ExactRegistryRunOpts, t as AnalystRegistry } from "../registry-D23oO0_f.js";
13
- import { T as SemanticConceptJudgeOptions, _ as DspyRlmTraceEngineOptions, a as FAILURE_MODE_KIND_SPEC, b as createChatTraceEngine, c as emitControlIntegrityFindings, d as FindingSubject, f as FindingSubjectKind, g as renderFindingSubject, h as parseFindingSubject, i as IMPROVEMENT_KIND_SPEC, l as FINDING_SUBJECT_KINDS, m as findingSubjectGrammarPromptFor, n as KNOWLEDGE_POISONING_KIND_SPEC, o as CONTROL_INTEGRITY_ANALYST, p as KIND_EXPECTED_SUBJECTS, r as KNOWLEDGE_GAP_KIND_SPEC, s as ControlIntegrityAnalyst, t as DEFAULT_TRACE_ANALYST_KINDS, u as FINDING_SUBJECT_SYNTAX, v as createDspyRlmTraceEngine, y as ChatTraceEngineOptions } from "../index-HdlzN11G.js";
14
- import { C as runPrimeExchange, D as ReplyRowDecoded, E as ReplyEnvelope, O as ReplyRowRejection, S as projectPrimeTrajectory, T as ReplyContract, _ as buildPrimePrompt, a as PrimeProjectionOutcome, b as normalizePrimeUsage, c as PrimeProtocolIdentity, d as PrimeRepairPromptSpec, f as PrimeRepairState, g as analystUsageReceiptFromPrimeUsage, h as PrimeTurnRecord, i as PrimeProjectionDelivery, l as PrimeRawUsage, m as PrimeRowDecoded, n as PrimeExchangeOutcome, o as PrimeProjectionSource, p as PrimeReplyContract, r as PrimeFailure, s as PrimePromptSpec, t as PrimeExchangeOptions, u as PrimeRejectedRow, v as buildPrimeRepairPrompt, w as DecodedReply, x as primeProtocolSha256, y as mergePrimeRawUsage } from "../prime-protocol-BR0xy0cF.js";
9
+ import { B as DiffPolicy, F as FindingsTimeStep, H as FindingsStore, I as LedgerFinding, L as diffFindingsOverTime, M as FindingsLedgerOutcome, N as FindingsLedgerRead, P as FindingsQuery, R as openFindingsLedger, U as PersistedFinding, V as FindingsDiff, W as diffFindings, j as FindingsLedger, r as SystemOneEvaluatorOptions, z as queryFindings } from "../systemone-MXhFSYdy.js";
10
+ import { a as RAW_FINDING_SCHEMA_PROMPT, c as RawAnalystFindingSchema, i as TraceAnalystLimits, l as evidenceRefsFromRawFinding, n as TraceAnalysisEngineRequest, o as RawAnalystEvidence, r as TraceAnalysisEngineResult, s as RawAnalystFinding, t as TraceAnalysisEngine, u as parseRawFinding } from "../engine-BZVXOc6n.js";
11
+ import { n as buildTraceToolsForGroup, t as TraceToolGroupName } from "../tool-groups-BSd08M7B.js";
12
+ import { a as BudgetPolicy, c as RegistryRunOpts, i as AnalystRegistryOptions, n as ExactAnalystRunExecutionError, o as ExactAnalystBudgetPolicy, r as AnalystHooks, s as ExactRegistryRunOpts, t as AnalystRegistry } from "../registry-V8o2kZtn.js";
13
+ import { T as SemanticConceptJudgeOptions, _ as DspyRlmTraceEngineOptions, a as FAILURE_MODE_KIND_SPEC, b as createChatTraceEngine, c as emitControlIntegrityFindings, d as FindingSubject, f as FindingSubjectKind, g as renderFindingSubject, h as parseFindingSubject, i as IMPROVEMENT_KIND_SPEC, l as FINDING_SUBJECT_KINDS, m as findingSubjectGrammarPromptFor, n as KNOWLEDGE_POISONING_KIND_SPEC, o as CONTROL_INTEGRITY_ANALYST, p as KIND_EXPECTED_SUBJECTS, r as KNOWLEDGE_GAP_KIND_SPEC, s as ControlIntegrityAnalyst, t as DEFAULT_TRACE_ANALYST_KINDS, u as FINDING_SUBJECT_SYNTAX, v as createDspyRlmTraceEngine, y as ChatTraceEngineOptions } from "../index-Ucp54Pcl.js";
14
+ import { C as runPrimeExchange, D as ReplyRowDecoded, E as ReplyEnvelope, O as ReplyRowRejection, S as projectPrimeTrajectory, T as ReplyContract, _ as buildPrimePrompt, a as PrimeProjectionOutcome, b as normalizePrimeUsage, c as PrimeProtocolIdentity, d as PrimeRepairPromptSpec, f as PrimeRepairState, g as analystUsageReceiptFromPrimeUsage, h as PrimeTurnRecord, i as PrimeProjectionDelivery, l as PrimeRawUsage, m as PrimeRowDecoded, n as PrimeExchangeOutcome, o as PrimeProjectionSource, p as PrimeReplyContract, r as PrimeFailure, s as PrimePromptSpec, t as PrimeExchangeOptions, u as PrimeRejectedRow, v as buildPrimeRepairPrompt, w as DecodedReply, x as primeProtocolSha256, y as mergePrimeRawUsage } from "../prime-protocol-iEaSEGZB.js";
15
15
  import { i as nodeHttpPrimeBridgeTransport, n as PrimeBridgeTransportRequest, r as PrimeBridgeTransportResult, t as PrimeBridgeTransport } from "../prime-bridge-transport-Cfqir_Im.js";
16
- import { b as SupervisorRunSources } from "../types-_dfu6Ox2.js";
17
- import { a as askTraceQuestions, i as VerifiedTraceFinding, n as TraceQuestionOutcome, r as TraceQuestionSpec, t as AskTraceQuestionsOptions } from "../trace-questions-DBsrgY_H.js";
16
+ import { b as SupervisorRunSources } from "../types-BLv2Ngla.js";
17
+ import { a as askTraceQuestions, i as VerifiedTraceFinding, n as TraceQuestionOutcome, r as TraceQuestionSpec, t as AskTraceQuestionsOptions } from "../trace-questions-CJANeK9P.js";
18
18
  import { z } from "zod";
19
19
  interface SemanticConceptJudgeAdapterOpts {
20
20
  id?: string;