@tangle-network/agent-eval 0.135.4 → 0.137.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +4 -2
  3. package/dist/{agent-profile-cell-OhuTee9n.js → agent-profile-cell-CbfBm2g6.js} +2 -2
  4. package/dist/{agent-profile-cell-OhuTee9n.js.map → agent-profile-cell-CbfBm2g6.js.map} +1 -1
  5. package/dist/{agent-profile-cell-CCm3l2v2.d.ts → agent-profile-cell-Cw0PVwDr.d.ts} +2 -2
  6. package/dist/{agent-profile-cell-CCm3l2v2.d.ts.map → agent-profile-cell-Cw0PVwDr.d.ts.map} +1 -1
  7. package/dist/analyst/index.d.ts +139 -17
  8. package/dist/analyst/index.d.ts.map +1 -1
  9. package/dist/analyst/index.js +606 -4
  10. package/dist/analyst/index.js.map +1 -1
  11. package/dist/{analyze-runs-jjCmF8pU.js → analyze-runs-BScZvqMV.js} +6 -6
  12. package/dist/{analyze-runs-jjCmF8pU.js.map → analyze-runs-BScZvqMV.js.map} +1 -1
  13. package/dist/{analyze-runs-Cda5Xkj1.d.ts → analyze-runs-PVtnfjvA.d.ts} +6 -6
  14. package/dist/{analyze-runs-Cda5Xkj1.d.ts.map → analyze-runs-PVtnfjvA.d.ts.map} +1 -1
  15. package/dist/{baseline-BUeFcgrn.js → baseline-C-GocmIW.js} +2 -2
  16. package/dist/{baseline-BUeFcgrn.js.map → baseline-C-GocmIW.js.map} +1 -1
  17. package/dist/benchmark-CHX4orG7.d.ts +184 -0
  18. package/dist/benchmark-CHX4orG7.d.ts.map +1 -0
  19. package/dist/benchmark-YDrpumqB.js +414 -0
  20. package/dist/benchmark-YDrpumqB.js.map +1 -0
  21. package/dist/benchmarks/index.d.ts +1 -1
  22. package/dist/benchmarks/index.js +1 -1
  23. package/dist/{benchmarks-Dfgm9ts5.js → benchmarks-DCLkQOmc.js} +3 -3
  24. package/dist/{benchmarks-Dfgm9ts5.js.map → benchmarks-DCLkQOmc.js.map} +1 -1
  25. package/dist/builder-eval/index.js +2 -2
  26. package/dist/campaign/index.d.ts +6 -6
  27. package/dist/campaign/index.js +3 -3
  28. package/dist/{campaign-Dz8uQnhC.js → campaign-lgObcHFC.js} +212 -78
  29. package/dist/campaign-lgObcHFC.js.map +1 -0
  30. package/dist/cli.js +1 -1
  31. package/dist/client-C8L6h6Wf.d.ts +202 -0
  32. package/dist/client-C8L6h6Wf.d.ts.map +1 -0
  33. package/dist/completion-verifier-DSyRNVzU.d.ts +240 -0
  34. package/dist/completion-verifier-DSyRNVzU.d.ts.map +1 -0
  35. package/dist/contract/index.d.ts +10 -9
  36. package/dist/contract/index.d.ts.map +1 -1
  37. package/dist/contract/index.js +10 -10
  38. package/dist/control.d.ts +2 -2
  39. package/dist/control.js +1 -1
  40. package/dist/{cost-ledger-DHAjwNj7.js → cost-ledger-D-5_-dhi.js} +2 -2
  41. package/dist/{cost-ledger-DHAjwNj7.js.map → cost-ledger-D-5_-dhi.js.map} +1 -1
  42. package/dist/{cost-ledger-fGS_u_O1.d.ts → cost-ledger-D2o6JOrL.d.ts} +2 -2
  43. package/dist/{cost-ledger-fGS_u_O1.d.ts.map → cost-ledger-D2o6JOrL.d.ts.map} +1 -1
  44. package/dist/{dataset-BvtnC8Dc.d.ts → dataset-v_Y5902-.d.ts} +2 -2
  45. package/dist/{dataset-BvtnC8Dc.d.ts.map → dataset-v_Y5902-.d.ts.map} +1 -1
  46. package/dist/{default-registry-CHmdy2An.js → default-registry-CLXbRt0f.js} +119 -38
  47. package/dist/default-registry-CLXbRt0f.js.map +1 -0
  48. package/dist/{default-registry-Brxr728w.d.ts → default-registry-Dc5D_Loc.d.ts} +63 -137
  49. package/dist/default-registry-Dc5D_Loc.d.ts.map +1 -0
  50. package/dist/{errors-8YnH8WlF.js → errors-D-LKuDhb.js} +8 -2
  51. package/dist/errors-D-LKuDhb.js.map +1 -0
  52. package/dist/{errors-CEk209JS.d.ts → errors-DkfjIDvD.d.ts} +9 -3
  53. package/dist/errors-DkfjIDvD.d.ts.map +1 -0
  54. package/dist/{eval-campaign-Cc8WZJ6b.js → eval-campaign-CHqfLnff.js} +6 -6
  55. package/dist/{eval-campaign-Cc8WZJ6b.js.map → eval-campaign-CHqfLnff.js.map} +1 -1
  56. package/dist/{extract-usage-DIQpN-ww.js → extract-usage-p-56bh8q.js} +3 -3
  57. package/dist/{extract-usage-DIQpN-ww.js.map → extract-usage-p-56bh8q.js.map} +1 -1
  58. package/dist/{feedback-trajectory-CVaeREXV.d.ts → feedback-trajectory-N_F0PwHz.d.ts} +90 -3
  59. package/dist/feedback-trajectory-N_F0PwHz.d.ts.map +1 -0
  60. package/dist/fuzz.d.ts +1 -1
  61. package/dist/fuzz.js +2 -2
  62. package/dist/hosted/index.d.ts +3 -2
  63. package/dist/hosted/index.d.ts.map +1 -1
  64. package/dist/index-BipJlj-C.d.ts +316 -0
  65. package/dist/index-BipJlj-C.d.ts.map +1 -0
  66. package/dist/{index-CQsJcqch.d.ts → index-BnP1QJUv.d.ts} +5 -5
  67. package/dist/{index-CQsJcqch.d.ts.map → index-BnP1QJUv.d.ts.map} +1 -1
  68. package/dist/{index-B4Fjfo5U.d.ts → index-C-Pr4OWg.d.ts} +88 -317
  69. package/dist/index-C-Pr4OWg.d.ts.map +1 -0
  70. package/dist/{index-DuhJaaiH.d.ts → index-DEb46kc6.d.ts} +2 -2
  71. package/dist/{index-DuhJaaiH.d.ts.map → index-DEb46kc6.d.ts.map} +1 -1
  72. package/dist/{index-C2fkZhv_.d.ts → index-DRNl6g_N.d.ts} +3 -3
  73. package/dist/{index-C2fkZhv_.d.ts.map → index-DRNl6g_N.d.ts.map} +1 -1
  74. package/dist/{index-AbhwHp0V.d.ts → index-U3RHOShi.d.ts} +2 -2
  75. package/dist/{index-AbhwHp0V.d.ts.map → index-U3RHOShi.d.ts.map} +1 -1
  76. package/dist/index.d.ts +29 -70
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +507 -33
  79. package/dist/index.js.map +1 -1
  80. package/dist/{client-DcvgkaZi.d.ts → insight-report-B9ooYH_g.d.ts} +5 -203
  81. package/dist/insight-report-B9ooYH_g.d.ts.map +1 -0
  82. package/dist/integrity-CCXTftiL.js +1360 -0
  83. package/dist/integrity-CCXTftiL.js.map +1 -0
  84. package/dist/{integrity-rmVhXWA7.d.ts → integrity-CKxosZ5Z.d.ts} +3 -3
  85. package/dist/{integrity-rmVhXWA7.d.ts.map → integrity-CKxosZ5Z.d.ts.map} +1 -1
  86. package/dist/{integrity-BzRbCHzi.js → integrity-fdt8XPAv.js} +2 -2
  87. package/dist/{integrity-BzRbCHzi.js.map → integrity-fdt8XPAv.js.map} +1 -1
  88. package/dist/ledger-core/index.d.ts +1 -1
  89. package/dist/ledger-core/index.js +1 -1
  90. package/dist/{ledger-core-DAKFKRzi.js → ledger-core-t6sItivm.js} +85 -85
  91. package/dist/{ledger-core-DAKFKRzi.js.map → ledger-core-t6sItivm.js.map} +1 -1
  92. package/dist/{llm-client-DHx8pzyJ.js → llm-client-DKB25jV8.js} +3 -3
  93. package/dist/{llm-client-DHx8pzyJ.js.map → llm-client-DKB25jV8.js.map} +1 -1
  94. package/dist/meta-eval/index.d.ts +2 -2
  95. package/dist/meta-eval/index.js +3 -3
  96. package/dist/{mint-DyRUc9k6.js → mint-Ctwk079K.js} +4 -4
  97. package/dist/{mint-DyRUc9k6.js.map → mint-Ctwk079K.js.map} +1 -1
  98. package/dist/multishot/index.d.ts +2 -2
  99. package/dist/openapi.json +1 -1
  100. package/dist/{paired-arms-BbFKrAU-.js → paired-arms-iZ08VFMN.js} +3 -3
  101. package/dist/{paired-arms-BbFKrAU-.js.map → paired-arms-iZ08VFMN.js.map} +1 -1
  102. package/dist/pipelines/index.js +2 -2
  103. package/dist/profile-cell.d.ts +1 -1
  104. package/dist/profile-cell.js +1 -1
  105. package/dist/{propose-review-control-SQ-n9-We.js → propose-review-control-DLXz4FCX.js} +2 -2
  106. package/dist/{propose-review-control-SQ-n9-We.js.map → propose-review-control-DLXz4FCX.js.map} +1 -1
  107. package/dist/registry-BdM7SuTr.d.ts +124 -0
  108. package/dist/registry-BdM7SuTr.d.ts.map +1 -0
  109. package/dist/{release-report-DooPguBc.js → release-report-B5XPBvAU.js} +4 -4
  110. package/dist/{release-report-DooPguBc.js.map → release-report-B5XPBvAU.js.map} +1 -1
  111. package/dist/{release-report-DpBxGGI1.d.ts → release-report-CofgVNZt.d.ts} +4 -4
  112. package/dist/{release-report-DpBxGGI1.d.ts.map → release-report-CofgVNZt.d.ts.map} +1 -1
  113. package/dist/{replay-C6wRg47C.js → replay-Bju0T8Ls.js} +248 -8
  114. package/dist/replay-Bju0T8Ls.js.map +1 -0
  115. package/dist/{replay-BRfMIs81.d.ts → replay-K8FaC0CB.d.ts} +227 -52
  116. package/dist/replay-K8FaC0CB.d.ts.map +1 -0
  117. package/dist/reporting.d.ts +4 -4
  118. package/dist/reporting.js +4 -4
  119. package/dist/{researcher-Doo95b50.d.ts → researcher-Da0Wj-bt.d.ts} +6 -7
  120. package/dist/researcher-Da0Wj-bt.d.ts.map +1 -0
  121. package/dist/{reward-hacking-D-QqXvg-.d.ts → reward-hacking-CQ3hTCO3.d.ts} +2 -2
  122. package/dist/{reward-hacking-D-QqXvg-.d.ts.map → reward-hacking-CQ3hTCO3.d.ts.map} +1 -1
  123. package/dist/{reward-hacking-a-kYs0-i.js → reward-hacking-GyN0kMd8.js} +3 -3
  124. package/dist/{reward-hacking-a-kYs0-i.js.map → reward-hacking-GyN0kMd8.js.map} +1 -1
  125. package/dist/rl.d.ts +6 -6
  126. package/dist/rl.js +9 -9
  127. package/dist/rollout/index.d.ts +1 -1
  128. package/dist/rollout/index.js +3 -3
  129. package/dist/{rollout-DLSUIWLu.js → rollout-DQFl0UXA.js} +2 -2
  130. package/dist/{rollout-DLSUIWLu.js.map → rollout-DQFl0UXA.js.map} +1 -1
  131. package/dist/{rubric-predictive-validity-BJf-8ejY.js → rubric-predictive-validity-BRR632r1.js} +2 -2
  132. package/dist/{rubric-predictive-validity-BJf-8ejY.js.map → rubric-predictive-validity-BRR632r1.js.map} +1 -1
  133. package/dist/{rubric-predictive-validity-C1dCLcvb.d.ts → rubric-predictive-validity-C4sztLR3.d.ts} +2 -2
  134. package/dist/{rubric-predictive-validity-C1dCLcvb.d.ts.map → rubric-predictive-validity-C4sztLR3.d.ts.map} +1 -1
  135. package/dist/{run-evidence-DokQtX0-.d.ts → run-evidence-BDIircdA.d.ts} +3 -3
  136. package/dist/{run-evidence-DokQtX0-.d.ts.map → run-evidence-BDIircdA.d.ts.map} +1 -1
  137. package/dist/{run-record-DcObtIGh.d.ts → run-record-BPCa2rQ8.d.ts} +4 -4
  138. package/dist/{run-record-DcObtIGh.d.ts.map → run-record-BPCa2rQ8.d.ts.map} +1 -1
  139. package/dist/{run-record-BIwU2wdV.js → run-record-vRgqWmJw.js} +3 -3
  140. package/dist/{run-record-BIwU2wdV.js.map → run-record-vRgqWmJw.js.map} +1 -1
  141. package/dist/{semantic-concept-judge-Btozx3Vc.js → semantic-concept-judge-Bz64IckK.js} +4 -4
  142. package/dist/{semantic-concept-judge-Btozx3Vc.js.map → semantic-concept-judge-Bz64IckK.js.map} +1 -1
  143. package/dist/{server-Bz3WQJs6.js → server-KjXZZUDX.js} +3 -3
  144. package/dist/{server-Bz3WQJs6.js.map → server-KjXZZUDX.js.map} +1 -1
  145. package/dist/{skill-usage-BDQVPIG1.d.ts → skill-usage-CFDLLlhF.d.ts} +25 -47
  146. package/dist/skill-usage-CFDLLlhF.d.ts.map +1 -0
  147. package/dist/{skillopt-optimization-method-CwSYkv35.d.ts → skillopt-optimization-method-BpbnlvAZ.d.ts} +11 -12
  148. package/dist/skillopt-optimization-method-BpbnlvAZ.d.ts.map +1 -0
  149. package/dist/{skillopt-optimization-method-0UmPD6aP.js → skillopt-optimization-method-f4o9sUT4.js} +7 -7
  150. package/dist/{skillopt-optimization-method-0UmPD6aP.js.map → skillopt-optimization-method-f4o9sUT4.js.map} +1 -1
  151. package/dist/{statistics-CnGCLLqc.js → statistics-ByxzSiOM.js} +2 -2
  152. package/dist/{statistics-CnGCLLqc.js.map → statistics-ByxzSiOM.js.map} +1 -1
  153. package/dist/{statistics-CKOqre5S.d.ts → statistics-_7P642CN.d.ts} +2 -2
  154. package/dist/{statistics-CKOqre5S.d.ts.map → statistics-_7P642CN.d.ts.map} +1 -1
  155. package/dist/{summary-report-BEk8OFLs.js → summary-report-9A5y7EsK.js} +4 -4
  156. package/dist/{summary-report-BEk8OFLs.js.map → summary-report-9A5y7EsK.js.map} +1 -1
  157. package/dist/{summary-report-CPMINBqs.d.ts → summary-report-DHipz9Kx.d.ts} +3 -3
  158. package/dist/{summary-report-CPMINBqs.d.ts.map → summary-report-DHipz9Kx.d.ts.map} +1 -1
  159. package/dist/supervisor-run/index.d.ts +3 -2
  160. package/dist/supervisor-run/index.js +3 -2
  161. package/dist/{supervisor-run-B7lUGoyZ.js → supervisor-run-B2EWUmQY.js} +221 -519
  162. package/dist/supervisor-run-B2EWUmQY.js.map +1 -0
  163. package/dist/{test-graded-scenario-BsqWLmPt.js → test-graded-scenario-JHcKQNpq.js} +2 -2
  164. package/dist/{test-graded-scenario-BsqWLmPt.js.map → test-graded-scenario-JHcKQNpq.js.map} +1 -1
  165. package/dist/tools-DZk2Jn64.js +1876 -0
  166. package/dist/tools-DZk2Jn64.js.map +1 -0
  167. package/dist/traces.d.ts +6 -7
  168. package/dist/traces.js +5 -6
  169. package/dist/{types-DVjczBM9.d.ts → types-CKswbJGO.d.ts} +260 -6
  170. package/dist/types-CKswbJGO.d.ts.map +1 -0
  171. package/dist/{types-DiWLru6Z.d.ts → types-CTGbIm57.d.ts} +5 -5
  172. package/dist/{types-DiWLru6Z.d.ts.map → types-CTGbIm57.d.ts.map} +1 -1
  173. package/dist/types-CTvKfr5F.d.ts +804 -0
  174. package/dist/types-CTvKfr5F.d.ts.map +1 -0
  175. package/dist/{index-C61Wi7yg.d.ts → types-Dea6tiVI.d.ts} +47 -235
  176. package/dist/types-Dea6tiVI.d.ts.map +1 -0
  177. package/dist/wire/index.d.ts +3 -3
  178. package/dist/wire/index.js +1 -1
  179. package/docs/feedback-trajectories.md +100 -1
  180. package/docs/trace-analysis.md +374 -58
  181. package/package.json +7 -3
  182. package/dist/analyst-BkTS3C58.d.ts +0 -89
  183. package/dist/analyst-BkTS3C58.d.ts.map +0 -1
  184. package/dist/analyst-j5je5J7c.js +0 -152
  185. package/dist/analyst-j5je5J7c.js.map +0 -1
  186. package/dist/campaign-Dz8uQnhC.js.map +0 -1
  187. package/dist/client-DcvgkaZi.d.ts.map +0 -1
  188. package/dist/default-registry-Brxr728w.d.ts.map +0 -1
  189. package/dist/default-registry-CHmdy2An.js.map +0 -1
  190. package/dist/errors-8YnH8WlF.js.map +0 -1
  191. package/dist/errors-CEk209JS.d.ts.map +0 -1
  192. package/dist/feedback-trajectory-CVaeREXV.d.ts.map +0 -1
  193. package/dist/index-B4Fjfo5U.d.ts.map +0 -1
  194. package/dist/index-C61Wi7yg.d.ts.map +0 -1
  195. package/dist/llm-client-BiK4HW0u.d.ts +0 -290
  196. package/dist/llm-client-BiK4HW0u.d.ts.map +0 -1
  197. package/dist/raw-provider-sink-BU29Sh8h.d.ts +0 -134
  198. package/dist/raw-provider-sink-BU29Sh8h.d.ts.map +0 -1
  199. package/dist/replay-BRfMIs81.d.ts.map +0 -1
  200. package/dist/replay-C6wRg47C.js.map +0 -1
  201. package/dist/researcher-Doo95b50.d.ts.map +0 -1
  202. package/dist/skill-usage-BDQVPIG1.d.ts.map +0 -1
  203. package/dist/skillopt-optimization-method-CwSYkv35.d.ts.map +0 -1
  204. package/dist/store-CxJry_cs.d.ts +0 -229
  205. package/dist/store-CxJry_cs.d.ts.map +0 -1
  206. package/dist/supervisor-run-B7lUGoyZ.js.map +0 -1
  207. package/dist/tools-D8yTtNSN.js +0 -1190
  208. package/dist/tools-D8yTtNSN.js.map +0 -1
  209. package/dist/types-Cc3qbqzj.d.ts +0 -387
  210. package/dist/types-Cc3qbqzj.d.ts.map +0 -1
  211. package/dist/types-DVjczBM9.d.ts.map +0 -1
@@ -1,21 +1,21 @@
1
- import { s as ValidationError, t as AgentEvalError } from "./errors-8YnH8WlF.js";
2
- import { p as canonicalize, s as buildAgentProfileCell } from "./agent-profile-cell-OhuTee9n.js";
3
- import { i as CostLedger } from "./cost-ledger-DHAjwNj7.js";
4
- import { f as maximumChargeForLlmRequest, l as costReceiptFromLlm, u as costReceiptFromLlmError } from "./llm-client-DHx8pzyJ.js";
5
- import { $ as SEARCH_LEDGER_FILE_CONTEXT, B as surfaceContentHash, E as pairHoldout, Et as contentHash, F as assertCodeSurfaceIdentity, J as planCampaignRun, Pt as recoverTruncatedJson, Ut as summarizeBackendIntegrity, Vt as assertRealBackend, Wt as JudgeParseError, Y as runCampaign, et as SearchLedgerConflictError, h as labelTrustRank, nt as SearchLedgerIntegrityError, tt as SearchLedgerError } from "./skillopt-optimization-method-0UmPD6aP.js";
6
- import { C as mulberry32, E as pairedBootstrap, m as eProcess } from "./statistics-CnGCLLqc.js";
7
- import { t as comparePairedArms } from "./paired-arms-BbFKrAU-.js";
8
- import { o as runTaskScore, r as modelHasSnapshot, s as validateRunRecord } from "./run-record-BIwU2wdV.js";
9
- import { t as analyzeTraces } from "./analyst-j5je5J7c.js";
10
- import { c as campaignCellToRunRecord } from "./reward-hacking-a-kYs0-i.js";
11
- import { d as canonicalString, t as FileLedgerJournal } from "./ledger-core-DAKFKRzi.js";
1
+ import { c as ValidationError, t as AgentEvalError } from "./errors-D-LKuDhb.js";
2
+ import { p as canonicalize, s as buildAgentProfileCell } from "./agent-profile-cell-CbfBm2g6.js";
3
+ import { i as CostLedger, t as CostAccountingIncompleteError } from "./cost-ledger-D-5_-dhi.js";
4
+ import { f as maximumChargeForLlmRequest, l as costReceiptFromLlm, u as costReceiptFromLlmError } from "./llm-client-DKB25jV8.js";
5
+ import { $ as SEARCH_LEDGER_FILE_CONTEXT, B as surfaceContentHash, E as pairHoldout, Et as contentHash, F as assertCodeSurfaceIdentity, J as planCampaignRun, Pt as recoverTruncatedJson, Ut as summarizeBackendIntegrity, Vt as assertRealBackend, Wt as JudgeParseError, Y as runCampaign, et as SearchLedgerConflictError, h as labelTrustRank, nt as SearchLedgerIntegrityError, tt as SearchLedgerError } from "./skillopt-optimization-method-f4o9sUT4.js";
6
+ import { C as mulberry32, E as pairedBootstrap, m as eProcess } from "./statistics-ByxzSiOM.js";
7
+ import { t as comparePairedArms } from "./paired-arms-iZ08VFMN.js";
8
+ import { m as canonicalString, t as FileLedgerJournal } from "./ledger-core-t6sItivm.js";
9
+ import { o as runTaskScore, r as modelHasSnapshot, s as validateRunRecord } from "./run-record-vRgqWmJw.js";
10
+ import { r as scoreAnalystFindings } from "./benchmark-YDrpumqB.js";
11
+ import { c as campaignCellToRunRecord } from "./reward-hacking-GyN0kMd8.js";
12
12
  import { z } from "zod";
13
13
  import { closeSync, constants, existsSync, fstatSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, readlinkSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
14
14
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
15
15
  import { createHash, randomUUID } from "node:crypto";
16
+ import { harnessSupportsModel } from "@tangle-network/agent-interface";
16
17
  import { devNull, tmpdir } from "node:os";
17
18
  import { execFileSync } from "node:child_process";
18
- import { harnessSupportsModel } from "@tangle-network/agent-interface";
19
19
  //#region src/completion-verifier.ts
20
20
  /**
21
21
  * Completion verifier — the task-completion oracle.
@@ -623,78 +623,82 @@ function agentProfileHash(profile) {
623
623
  }
624
624
  //#endregion
625
625
  //#region src/campaign/analyst-surface.ts
626
- function surfaceToText(surface) {
627
- if (typeof surface === "string") return surface;
628
- throw new Error(`buildAnalystSurfaceDispatch: the analyst surface must be a string actorDescription, got a ${surface.kind}-tier surface. The analyst prompt is prompt-tier.`);
629
- }
630
- /**
631
- * Build the `dispatchWithSurface(surface, scenario, ctx)` the improvement loop
632
- * calls: run the analyst with `surface` as its actorDescription over the
633
- * scenario's trace corpus and return its findings.
634
- */
635
- function buildAnalystSurfaceDispatch(opts) {
636
- const analyze = opts.analyze ?? analyzeTraces;
637
- return async (surface, scenario, _ctx) => {
638
- const actorDescription = surfaceToText(surface);
639
- const res = await analyze({ question: scenario.question }, {
640
- ...opts.analystOptions,
641
- actorDescription,
642
- source: scenario.source
626
+ function buildTraceAnalystSurfaceDispatch(options) {
627
+ return async (surface, scenario, context) => {
628
+ if (typeof surface !== "string") throw new TypeError(`buildTraceAnalystSurfaceDispatch requires a string prompt, received ${surface.kind}`);
629
+ return options.analyze({
630
+ actorDescription: surface,
631
+ traceStore: scenario.traceStore,
632
+ runId: `${context.cellId}:${scenario.id}`,
633
+ signal: context.signal
643
634
  });
644
- return {
645
- answer: res.answer,
646
- findings: res.findings,
647
- actorPromptVersion: res.actorPromptVersion
648
- };
649
635
  };
650
636
  }
651
- /**
652
- * Deterministic, ground-truth judge for analyst findings. Composite =
653
- * recall of the scenario's `expectedFailureModes` (optionally blended with a
654
- * precision term that penalizes findings tripping `forbiddenCues`). No LLM —
655
- * the score is a function of the labels, so the analyst prompt is optimized
656
- * toward surfacing real failures, not toward a judge it can flatter.
657
- */
658
- function failureModeRecallJudge(opts = {}) {
659
- const recallWeight = opts.recallWeight ?? .5;
637
+ function traceAnalystQualityJudge() {
660
638
  return {
661
- name: "failure-mode-recall",
662
- dimensions: [{
663
- key: "recall",
664
- description: "fraction of ground-truth failure modes the analyst surfaced"
665
- }, {
666
- key: "precision",
667
- description: "1 − share of findings that named a failure/tool/error absent from this corpus"
668
- }],
669
- appliesTo: (s) => s.kind === "analyst-surface",
670
- score({ artifact, scenario }) {
671
- const modes = scenario.expectedFailureModes;
672
- if (modes.length === 0) throw new Error(`failureModeRecallJudge: scenario '${scenario.id}' has no expectedFailureModes — refusing to score (a vacuous 1.0 would corrupt the comparison)`);
673
- const hay = artifact.findings.join("\n").toLowerCase();
674
- const matched = modes.filter((m) => m.cues.some((c) => hay.includes(c.toLowerCase())));
675
- const recall = matched.length / modes.length;
676
- const forbidden = (scenario.forbiddenCues ?? []).map((c) => c.toLowerCase());
677
- let precision = 1;
678
- let hallucinated = 0;
679
- if (forbidden.length > 0) {
680
- const denom = Math.max(1, artifact.findings.length);
681
- hallucinated = artifact.findings.filter((f) => forbidden.some((c) => f.toLowerCase().includes(c))).length;
682
- precision = 1 - hallucinated / denom;
639
+ name: "trace-analyst-quality",
640
+ judgeVersion: "agent-eval:trace-analyst-quality:v2",
641
+ dimensions: [
642
+ {
643
+ key: "issue_recall",
644
+ description: "share of labeled issues found"
645
+ },
646
+ {
647
+ key: "finding_precision",
648
+ description: "share of findings tied to a labeled issue"
649
+ },
650
+ {
651
+ key: "f1",
652
+ description: "harmonic mean of issue recall and finding precision"
653
+ },
654
+ {
655
+ key: "critical_step_accuracy",
656
+ description: "share of labeled causal steps cited"
657
+ },
658
+ {
659
+ key: "citation_coverage",
660
+ description: "share of findings with evidence citations"
661
+ },
662
+ {
663
+ key: "citation_label_agreement",
664
+ description: "share of citations matching a labeled case location"
665
+ },
666
+ {
667
+ key: "clean",
668
+ description: "1 when a clean case produces no findings"
683
669
  }
684
- const composite = forbidden.length > 0 ? recallWeight * recall + (1 - recallWeight) * precision : recall;
685
- const missed = modes.filter((m) => !matched.includes(m)).map((m) => m.id);
686
- const notes = `matched ${matched.length}/${modes.length} failure modes` + (missed.length ? `; missed [${missed.join(", ")}]` : "") + (hallucinated ? `; ${hallucinated} out-of-corpus finding(s)` : "");
687
- return {
688
- dimensions: {
689
- recall,
690
- precision
691
- },
692
- composite,
693
- notes
694
- };
670
+ ],
671
+ appliesTo: (scenario) => scenario.kind === "trace-analyst",
672
+ score({ artifact, scenario }) {
673
+ return traceAnalystJudgeScore(scoreAnalystFindings({
674
+ id: scenario.id,
675
+ expectedIssues: scenario.expectedIssues,
676
+ labeledEvidence: scenario.labeledEvidence
677
+ }, artifact.findings));
695
678
  }
696
679
  };
697
680
  }
681
+ function traceAnalystJudgeScore(score) {
682
+ const dimensions = {
683
+ issue_recall: score.issueRecall,
684
+ finding_precision: score.findingPrecision,
685
+ f1: score.f1,
686
+ clean: score.cleanFalsePositive ? 0 : 1
687
+ };
688
+ if (score.criticalStepAccuracy !== null) dimensions.critical_step_accuracy = score.criticalStepAccuracy;
689
+ if (score.citationCoverage !== null) dimensions.citation_coverage = score.citationCoverage;
690
+ if (score.citationLabelAgreement !== null) dimensions.citation_label_agreement = score.citationLabelAgreement;
691
+ const notes = [
692
+ `${score.matchedIssueIds.length}/${score.expectedIssueCount} issues found`,
693
+ `${score.supportedFindingIndexes.length}/${score.supportedFindingIndexes.length + score.unsupportedFindingIndexes.length} findings supported`,
694
+ `${score.unlabeledEvidence.length} citations outside labeled locations`
695
+ ].join("; ");
696
+ return {
697
+ dimensions,
698
+ composite: score.criticalStepAccuracy === null ? score.f1 : (score.f1 + score.criticalStepAccuracy) / 2,
699
+ notes
700
+ };
701
+ }
698
702
  //#endregion
699
703
  //#region src/campaign/cross-surface-context.ts
700
704
  function validateCrossSurfaceInput(input) {
@@ -3373,6 +3377,136 @@ function isTransientTransportFailure(message, opts = {}) {
3373
3377
  return false;
3374
3378
  }
3375
3379
  //#endregion
3380
+ //#region src/campaign/upstream-evaluators.ts
3381
+ function phoenixEvaluatorJudge(evaluator, options) {
3382
+ if ((evaluator.optimizationDirection === "MINIMIZE" || evaluator.optimizationDirection === "NEUTRAL") && !options.toComposite) throw new TypeError(`phoenixEvaluatorJudge requires toComposite for a ${evaluator.optimizationDirection} evaluator`);
3383
+ const paidCall = validatePaidEvaluation(evaluator.name, evaluator.kind, options.paidCall);
3384
+ return upstreamJudge({
3385
+ name: options.name ?? evaluator.name,
3386
+ dimension: options.dimension,
3387
+ judgeVersion: options.judgeVersion,
3388
+ appliesTo: options.appliesTo,
3389
+ toComposite: options.toComposite
3390
+ }, async (input) => {
3391
+ const result = await runUpstreamEvaluation({
3392
+ name: evaluator.name,
3393
+ kind: evaluator.kind,
3394
+ signal: input.signal,
3395
+ costLedger: input.costLedger,
3396
+ costPhase: input.costPhase,
3397
+ costTags: input.costTags,
3398
+ scenarioId: input.scenario.id,
3399
+ paidCall,
3400
+ execute: (context) => evaluator.evaluate(options.mapInput({
3401
+ artifact: input.artifact,
3402
+ scenario: input.scenario
3403
+ }), context)
3404
+ });
3405
+ if (result.score === void 0 || !Number.isFinite(result.score)) throw new Error(`${evaluator.name}: Phoenix evaluator returned no finite score`);
3406
+ return {
3407
+ score: result.score,
3408
+ notes: [result.label, result.explanation].filter(Boolean).join(": ") || evaluator.name
3409
+ };
3410
+ });
3411
+ }
3412
+ function autoevalsScorerJudge(scorer, options) {
3413
+ const paidCall = validatePaidEvaluation(options.name, options.kind, options.paidCall);
3414
+ return upstreamJudge(options, async (input) => {
3415
+ const result = await runUpstreamEvaluation({
3416
+ name: options.name,
3417
+ kind: options.kind,
3418
+ signal: input.signal,
3419
+ costLedger: input.costLedger,
3420
+ costPhase: input.costPhase,
3421
+ costTags: input.costTags,
3422
+ scenarioId: input.scenario.id,
3423
+ paidCall,
3424
+ execute: (context) => scorer(options.mapInput({
3425
+ artifact: input.artifact,
3426
+ scenario: input.scenario
3427
+ }), context)
3428
+ });
3429
+ if (result.score === null || !Number.isFinite(result.score)) throw new Error(`${options.name}: Autoevals scorer returned no finite score`);
3430
+ return {
3431
+ score: result.score,
3432
+ notes: result.metadata ? JSON.stringify(result.metadata) : result.name
3433
+ };
3434
+ });
3435
+ }
3436
+ function upstreamJudge(options, evaluate) {
3437
+ const dimension = options.dimension ?? options.name;
3438
+ return {
3439
+ name: options.name,
3440
+ judgeVersion: options.judgeVersion,
3441
+ dimensions: [{
3442
+ key: dimension,
3443
+ description: `Score from ${options.name}`
3444
+ }],
3445
+ appliesTo: options.appliesTo,
3446
+ async score(input) {
3447
+ const result = await evaluate(input);
3448
+ const composite = options.toComposite ? options.toComposite(result.score) : result.score;
3449
+ if (!Number.isFinite(composite)) throw new Error(`${options.name}: toComposite returned a non-finite score`);
3450
+ return {
3451
+ dimensions: { [dimension]: result.score },
3452
+ composite,
3453
+ notes: result.notes
3454
+ };
3455
+ }
3456
+ };
3457
+ }
3458
+ function validatePaidEvaluation(name, kind, paidCall) {
3459
+ if (kind === "CODE") {
3460
+ if (paidCall) throw new TypeError(`${name}: CODE evaluator cannot declare paidCall`);
3461
+ return;
3462
+ }
3463
+ if (!paidCall) throw new TypeError(`${name}: LLM evaluator requires paidCall cost and token capture`);
3464
+ if (!paidCall.model.trim()) throw new TypeError(`${name}: paidCall.model must be non-empty`);
3465
+ return paidCall;
3466
+ }
3467
+ async function runUpstreamEvaluation(input) {
3468
+ if (input.kind === "CODE") return abortableEvaluation(input.signal, () => input.execute({ signal: input.signal }));
3469
+ if (!input.paidCall) throw new CostAccountingIncompleteError(`${input.name}: missing paid-call configuration`);
3470
+ if (!input.costLedger) throw new CostAccountingIncompleteError(`${input.name}: LLM evaluator requires the campaign cost ledger`);
3471
+ const paid = await input.costLedger.runPaidCall({
3472
+ channel: "judge",
3473
+ phase: input.costPhase ?? "judge",
3474
+ actor: input.name,
3475
+ model: input.paidCall.model,
3476
+ ...input.paidCall.maximumCharge ? { maximumCharge: input.paidCall.maximumCharge } : {},
3477
+ tags: {
3478
+ ...input.costTags,
3479
+ scenarioId: input.scenarioId
3480
+ },
3481
+ signal: input.signal,
3482
+ execute: (signal, callId) => Promise.resolve(input.execute({
3483
+ signal,
3484
+ callId
3485
+ })),
3486
+ receipt: input.paidCall.receipt,
3487
+ ...input.paidCall.receiptFromError ? { receiptFromError: input.paidCall.receiptFromError } : {}
3488
+ });
3489
+ if (!paid.succeeded) throw paid.error;
3490
+ const recorded = input.costLedger.list().find((receipt) => receipt.callId === paid.callId);
3491
+ if (!recorded) throw new CostAccountingIncompleteError(`${input.name}: paid evaluator returned without a recorded cost receipt`);
3492
+ if (recorded.costUnknown || recorded.usageUnknown) throw new CostAccountingIncompleteError(`${input.name}: paid evaluator returned without complete cost and token usage`);
3493
+ return paid.value;
3494
+ }
3495
+ async function abortableEvaluation(signal, execute) {
3496
+ if (signal.aborted) throw signal.reason;
3497
+ let rejectAborted;
3498
+ const aborted = new Promise((_resolve, reject) => {
3499
+ rejectAborted = reject;
3500
+ });
3501
+ const onAbort = () => rejectAborted(signal.reason);
3502
+ signal.addEventListener("abort", onAbort, { once: true });
3503
+ try {
3504
+ return await Promise.race([Promise.resolve().then(execute), aborted]);
3505
+ } finally {
3506
+ signal.removeEventListener("abort", onAbort);
3507
+ }
3508
+ }
3509
+ //#endregion
3376
3510
  //#region src/campaign/worktree/index.ts
3377
3511
  /**
3378
3512
  * VCS-pluggable worktree adapter. One improvement = one worktree, PR-like
@@ -3894,6 +4028,6 @@ function resolveWorktreePath(surface, worktreeDir) {
3894
4028
  return verifyCodeSurface(surface, worktreeDir).path;
3895
4029
  }
3896
4030
  //#endregion
3897
- export { planEvalFixtureRun as A, harnessAxisOf as B, rolloutArgumentDiff as C, discoverEvalFixtures as D, neutralizationGate as E, HARNESS_NATIVE_MODEL as F, parseCorrectnessResponse as G, completionVerdict as H, agentProfileHash as I, verifyCompletion as K, agentProfileId as L, buildAnalystSurfaceDispatch as M, failureModeRecallJudge as N, loadEvalFixture as O, CODING_HARNESSES as P, agentProfileModelId as R, classifyUngroundedLiterals as S, sequentialPairedGate as T, createLlmCorrectnessChecker as U, extractProducedState as V, createTokenRecallChecker as W, scoreboardSummary as _, isTransientTransportFailure as a, FsLabeledScenarioStore as b, openSearchLedger as c, selectDiscriminative as d, ProfileMatrixError as f, scoreUserStory as g, renderScoreboardMarkdown as h, verifyCodeSurface as i, analyzeCrossSurfaceInteractions as j, loadEvalFixtureScenarios as k, validateSearchLedgerEvent as l, makePlaybackDispatch as m, gitWorktreeAdapter as n, FileSearchLedger as o, runProfileMatrix as p, resolveWorktreePath as r, SEARCH_LEDGER_SCHEMA as s, WorktreeAdapterError as t, scoreDiscrimination as u, userStoryScoreboard as v, sequentialDecide as w, LabeledScenarioStoreError as x, neutralizeText as y, expandProfileAxes as z };
4031
+ export { loadEvalFixture as A, agentProfileModelId as B, LabeledScenarioStoreError as C, sequentialPairedGate as D, sequentialDecide as E, traceAnalystQualityJudge as F, createLlmCorrectnessChecker as G, harnessAxisOf as H, CODING_HARNESSES as I, verifyCompletion as J, createTokenRecallChecker as K, HARNESS_NATIVE_MODEL as L, planEvalFixtureRun as M, analyzeCrossSurfaceInteractions as N, neutralizationGate as O, buildTraceAnalystSurfaceDispatch as P, agentProfileHash as R, FsLabeledScenarioStore as S, rolloutArgumentDiff as T, extractProducedState as U, expandProfileAxes as V, completionVerdict as W, renderScoreboardMarkdown as _, autoevalsScorerJudge as a, userStoryScoreboard as b, FileSearchLedger as c, validateSearchLedgerEvent as d, scoreDiscrimination as f, makePlaybackDispatch as g, runProfileMatrix as h, verifyCodeSurface as i, loadEvalFixtureScenarios as j, discoverEvalFixtures as k, SEARCH_LEDGER_SCHEMA as l, ProfileMatrixError as m, gitWorktreeAdapter as n, phoenixEvaluatorJudge as o, selectDiscriminative as p, parseCorrectnessResponse as q, resolveWorktreePath as r, isTransientTransportFailure as s, WorktreeAdapterError as t, openSearchLedger as u, scoreUserStory as v, classifyUngroundedLiterals as w, neutralizeText as x, scoreboardSummary as y, agentProfileId as z };
3898
4032
 
3899
- //# sourceMappingURL=campaign-Dz8uQnhC.js.map
4033
+ //# sourceMappingURL=campaign-lgObcHFC.js.map