@tangle-network/agent-eval 0.163.2 → 0.171.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 (249) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/README.md +2 -0
  3. package/dist/adapters/http.d.ts +108 -0
  4. package/dist/adapters/http.d.ts.map +1 -0
  5. package/dist/adapters/http.js +208 -0
  6. package/dist/adapters/http.js.map +1 -0
  7. package/dist/analyst/index.d.ts +40 -70
  8. package/dist/analyst/index.d.ts.map +1 -1
  9. package/dist/analyst/index.js +18 -311
  10. package/dist/analyst/index.js.map +1 -1
  11. package/dist/{backend-integrity-DxuQCu_A.d.ts → backend-integrity-e79K3UPD.d.ts} +3 -3
  12. package/dist/{backend-integrity-DxuQCu_A.d.ts.map → backend-integrity-e79K3UPD.d.ts.map} +1 -1
  13. package/dist/{benchmark-BhT16ep9.js → benchmark-C4wk_Sjr.js} +10 -3
  14. package/dist/benchmark-C4wk_Sjr.js.map +1 -0
  15. package/dist/{benchmark-command-CF-4GEWZ.js → benchmark-command-D8k3Gf0J.js} +236 -251
  16. package/dist/benchmark-command-D8k3Gf0J.js.map +1 -0
  17. package/dist/{benchmark-CGPp-kDC.d.ts → benchmark-h-h4bfqj.d.ts} +3 -3
  18. package/dist/{benchmark-CGPp-kDC.d.ts.map → benchmark-h-h4bfqj.d.ts.map} +1 -1
  19. package/dist/benchmarks/index.d.ts +5 -5
  20. package/dist/benchmarks/index.js +3 -3
  21. package/dist/builder-eval/index.d.ts +3 -3
  22. package/dist/builder-eval/index.js +1 -1
  23. package/dist/campaign/index.d.ts +8 -8
  24. package/dist/campaign/index.js +7 -7
  25. package/dist/{campaign-DQZmc2Dq.js → campaign-B72njjHj.js} +15 -14
  26. package/dist/campaign-B72njjHj.js.map +1 -0
  27. package/dist/{canonical-IL-Bu-14.js → canonical-DPyQ_rpt.js} +22 -2
  28. package/dist/{canonical-IL-Bu-14.js.map → canonical-DPyQ_rpt.js.map} +1 -1
  29. package/dist/{chat-client-DlMlAeYI.js → chat-client-DEtybj5i.js} +5 -5
  30. package/dist/{chat-client-DlMlAeYI.js.map → chat-client-DEtybj5i.js.map} +1 -1
  31. package/dist/cli.js +2 -2
  32. package/dist/{client-CX7KqIdB.js → client-BvwNkIRN.js} +2 -2
  33. package/dist/{client-CX7KqIdB.js.map → client-BvwNkIRN.js.map} +1 -1
  34. package/dist/{client-L9VVPkim.d.ts → client-CDtcZ3p9.d.ts} +4 -4
  35. package/dist/{client-L9VVPkim.d.ts.map → client-CDtcZ3p9.d.ts.map} +1 -1
  36. package/dist/contract/index.d.ts +12 -703
  37. package/dist/contract/index.js +11 -11
  38. package/dist/{counterfactual-BaFUWK3H.d.ts → counterfactual-Bee5_BIn.d.ts} +4 -4
  39. package/dist/{counterfactual-BaFUWK3H.d.ts.map → counterfactual-Bee5_BIn.d.ts.map} +1 -1
  40. package/dist/{default-registry-G9CKMNkc.d.ts → default-registry-B0s2zU-s.d.ts} +6 -6
  41. package/dist/{default-registry-G9CKMNkc.d.ts.map → default-registry-B0s2zU-s.d.ts.map} +1 -1
  42. package/dist/{define-agent-eval-Dx1JnPEa.d.ts → define-agent-eval-Cjy2yhqP.d.ts} +7 -7
  43. package/dist/{define-agent-eval-Dx1JnPEa.d.ts.map → define-agent-eval-Cjy2yhqP.d.ts.map} +1 -1
  44. package/dist/{define-agent-eval-D08pWIJb.js → define-agent-eval-Dy8QgxAI.js} +20 -8
  45. package/dist/{define-agent-eval-D08pWIJb.js.map → define-agent-eval-Dy8QgxAI.js.map} +1 -1
  46. package/dist/{dspy-rlm-engine-DhA9qKIm.js → dspy-rlm-engine-CS3qcCEk.js} +3 -10
  47. package/dist/dspy-rlm-engine-CS3qcCEk.js.map +1 -0
  48. package/dist/{emitter-D_jYSGRd.d.ts → emitter-Bvnu0VzL.d.ts} +3 -3
  49. package/dist/{emitter-D_jYSGRd.d.ts.map → emitter-Bvnu0VzL.d.ts.map} +1 -1
  50. package/dist/{engine-Cu5qD5Fc.d.ts → engine-CAmTUk52.d.ts} +7 -7
  51. package/dist/{engine-Cu5qD5Fc.d.ts.map → engine-CAmTUk52.d.ts.map} +1 -1
  52. package/dist/{eval-campaign-BfohKmzx.js → eval-campaign-JDTeE6Pl.js} +4 -4
  53. package/dist/{eval-campaign-BfohKmzx.js.map → eval-campaign-JDTeE6Pl.js.map} +1 -1
  54. package/dist/{exact-types-qnexxJ1Z.d.ts → exact-types-BEecmnWm.d.ts} +2 -2
  55. package/dist/{exact-types-qnexxJ1Z.d.ts.map → exact-types-BEecmnWm.d.ts.map} +1 -1
  56. package/dist/experiment/index.d.ts +5 -5
  57. package/dist/experiment/index.js +4 -4
  58. package/dist/{experiment-tracker-DCO6Cz4s.d.ts → experiment-tracker-Dm8yQMqb.d.ts} +2 -2
  59. package/dist/{experiment-tracker-DCO6Cz4s.d.ts.map → experiment-tracker-Dm8yQMqb.d.ts.map} +1 -1
  60. package/dist/{external-optimizer-process-BFmh36vW.js → external-optimizer-process-CQxylYeG.js} +4 -11
  61. package/dist/external-optimizer-process-CQxylYeG.js.map +1 -0
  62. package/dist/{external-optimizer-subprocess-CqLMW3nh.js → external-optimizer-subprocess-Cex8Da2i.js} +25 -11
  63. package/dist/external-optimizer-subprocess-Cex8Da2i.js.map +1 -0
  64. package/dist/{failure-cluster-CXL8NbEw.d.ts → failure-cluster-6YSvsKlp.d.ts} +3 -3
  65. package/dist/{failure-cluster-CXL8NbEw.d.ts.map → failure-cluster-6YSvsKlp.d.ts.map} +1 -1
  66. package/dist/{feedback-trajectory-B3ZHaHV_.d.ts → feedback-trajectory-DIqpCyF0.d.ts} +6 -6
  67. package/dist/{feedback-trajectory-B3ZHaHV_.d.ts.map → feedback-trajectory-DIqpCyF0.d.ts.map} +1 -1
  68. package/dist/fuzz.d.ts +1 -1
  69. package/dist/{skillopt-optimization-method-x7TTF23P.d.ts → heldout-gate-Dh2b62w8.d.ts} +111 -111
  70. package/dist/heldout-gate-Dh2b62w8.d.ts.map +1 -0
  71. package/dist/hosted/index.d.ts +2 -2
  72. package/dist/hosted/index.js +1 -1
  73. package/dist/{index-D-V8gCs_.d.ts → index-8VIogTyS.d.ts} +30 -22
  74. package/dist/index-8VIogTyS.d.ts.map +1 -0
  75. package/dist/{index-D-IiQIBB.d.ts → index-DMoxLG8P.d.ts} +3 -3
  76. package/dist/{index-D-IiQIBB.d.ts.map → index-DMoxLG8P.d.ts.map} +1 -1
  77. package/dist/{index-D_P7Ye43.d.ts → index-DNgf5gyG.d.ts} +2 -2
  78. package/dist/{index-D_P7Ye43.d.ts.map → index-DNgf5gyG.d.ts.map} +1 -1
  79. package/dist/{index-CGtH1piv.d.ts → index-DT73JraI.d.ts} +7 -38
  80. package/dist/index-DT73JraI.d.ts.map +1 -0
  81. package/dist/index-fNXZMCzX.d.ts +704 -0
  82. package/dist/index-fNXZMCzX.d.ts.map +1 -0
  83. package/dist/index.d.ts +197 -38
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +736 -28
  86. package/dist/index.js.map +1 -1
  87. package/dist/{insight-report-DRe8LB6d.d.ts → insight-report-08F022xN.d.ts} +4 -4
  88. package/dist/{insight-report-DRe8LB6d.d.ts.map → insight-report-08F022xN.d.ts.map} +1 -1
  89. package/dist/{integrity-DUNX9Fao.d.ts → integrity-B_EDELom.d.ts} +2 -2
  90. package/dist/{integrity-DUNX9Fao.d.ts.map → integrity-B_EDELom.d.ts.map} +1 -1
  91. package/dist/internal-BMFSR8Ns.js.map +1 -1
  92. package/dist/{kind-factory-DY8FdoXf.js → kind-factory-DMeEoMQZ.js} +3 -10
  93. package/dist/kind-factory-DMeEoMQZ.js.map +1 -0
  94. package/dist/ledger-core/index.js +2 -2
  95. package/dist/{ledger-core-BOzlRygb.js → ledger-core-PIfjCbKn.js} +2 -2
  96. package/dist/{ledger-core-BOzlRygb.js.map → ledger-core-PIfjCbKn.js.map} +1 -1
  97. package/dist/{llm-judge-Du7WQPh7.js → llm-judge-BtJ2Sfk_.js} +101 -20
  98. package/dist/llm-judge-BtJ2Sfk_.js.map +1 -0
  99. package/dist/matrix/index.d.ts +2 -2
  100. package/dist/{matrix-eXKRMHnL.d.ts → matrix-DiHmUobV.d.ts} +3 -3
  101. package/dist/{matrix-eXKRMHnL.d.ts.map → matrix-DiHmUobV.d.ts.map} +1 -1
  102. package/dist/meta-eval/index.d.ts +3 -3
  103. package/dist/meta-eval/index.js +1 -1
  104. package/dist/{mint-DfODW1KW.js → mint-DjfDUMHr.js} +2 -2
  105. package/dist/{mint-DfODW1KW.js.map → mint-DjfDUMHr.js.map} +1 -1
  106. package/dist/multishot/golden/index.d.ts +1 -1
  107. package/dist/multishot/index.d.ts +2 -2
  108. package/dist/openapi.json +4 -4
  109. package/dist/pipelines/index.d.ts +5 -5
  110. package/dist/pipelines/index.js +3 -3
  111. package/dist/{pareto-BqNW3LJR.d.ts → power-preflight-Ptse_Kq7.d.ts} +43 -43
  112. package/dist/power-preflight-Ptse_Kq7.d.ts.map +1 -0
  113. package/dist/{pre-registration-KN9jkh58.js → pre-registration-D94b7Of5.js} +2 -2
  114. package/dist/{pre-registration-KN9jkh58.js.map → pre-registration-D94b7Of5.js.map} +1 -1
  115. package/dist/{pre-registration-CzFCcwYk.d.ts → pre-registration-DHz6P_6f.d.ts} +2 -2
  116. package/dist/{pre-registration-CzFCcwYk.d.ts.map → pre-registration-DHz6P_6f.d.ts.map} +1 -1
  117. package/dist/{produced-state-Be0BK3RN.js → produced-state-Cm6DU_Ao.js} +4 -4
  118. package/dist/{produced-state-Be0BK3RN.js.map → produced-state-Cm6DU_Ao.js.map} +1 -1
  119. package/dist/profile-cell.js +1 -1
  120. package/dist/{promotion-policy-DtnOIZvk.d.ts → promotion-policy-WSXtBgBb.d.ts} +3 -3
  121. package/dist/{promotion-policy-DtnOIZvk.d.ts.map → promotion-policy-WSXtBgBb.d.ts.map} +1 -1
  122. package/dist/{run-score-lDzV0X8j.js → proposal-findings-bko3GGy-.js} +2 -31
  123. package/dist/proposal-findings-bko3GGy-.js.map +1 -0
  124. package/dist/{transient-failure-DKF5Mofa.d.ts → provenance-CafMdZKM.d.ts} +895 -891
  125. package/dist/provenance-CafMdZKM.d.ts.map +1 -0
  126. package/dist/{query-_5g6re3_.js → query-BPGMVlbM.js} +3 -3
  127. package/dist/{query-_5g6re3_.js.map → query-BPGMVlbM.js.map} +1 -1
  128. package/dist/{query-CwnHlu5p.d.ts → query-Na5gEIGd.d.ts} +3 -3
  129. package/dist/{query-CwnHlu5p.d.ts.map → query-Na5gEIGd.d.ts.map} +1 -1
  130. package/dist/{registry-8You7OK1.d.ts → registry-xEb_xfns.d.ts} +3 -3
  131. package/dist/{registry-8You7OK1.d.ts.map → registry-xEb_xfns.d.ts.map} +1 -1
  132. package/dist/{release-confidence-nGDJiiwc.js → release-confidence-CzUHc4z4.js} +3 -3
  133. package/dist/{release-confidence-nGDJiiwc.js.map → release-confidence-CzUHc4z4.js.map} +1 -1
  134. package/dist/{release-confidence-Dqt0NFep.d.ts → release-confidence-D6lQw_o7.d.ts} +4 -4
  135. package/dist/{release-confidence-Dqt0NFep.d.ts.map → release-confidence-D6lQw_o7.d.ts.map} +1 -1
  136. package/dist/reporting.d.ts +3 -3
  137. package/dist/reporting.js +2 -2
  138. package/dist/{researcher-Cz565b7D.d.ts → researcher-CMUTQXD7.d.ts} +6 -6
  139. package/dist/{researcher-Cz565b7D.d.ts.map → researcher-CMUTQXD7.d.ts.map} +1 -1
  140. package/dist/{reward-hacking-MBf7qpSB.d.ts → reward-hacking-CgPRUesA.d.ts} +2 -2
  141. package/dist/{reward-hacking-MBf7qpSB.d.ts.map → reward-hacking-CgPRUesA.d.ts.map} +1 -1
  142. package/dist/{reward-hacking-O5zKDANP.js → reward-hacking-SkxYgT0x.js} +2 -2
  143. package/dist/{reward-hacking-O5zKDANP.js.map → reward-hacking-SkxYgT0x.js.map} +1 -1
  144. package/dist/rl.d.ts +8 -8
  145. package/dist/rl.d.ts.map +1 -1
  146. package/dist/rl.js +6 -5
  147. package/dist/rl.js.map +1 -1
  148. package/dist/rollout/index.d.ts +1 -1
  149. package/dist/rollout/index.js +2 -2
  150. package/dist/{rollout-Dm2tSdiQ.js → rollout-Crypdx8s.js} +2 -2
  151. package/dist/{rollout-Dm2tSdiQ.js.map → rollout-Crypdx8s.js.map} +1 -1
  152. package/dist/{rubric-predictive-validity-CxycqzX5.d.ts → rubric-predictive-validity-DluJLCKQ.d.ts} +2 -2
  153. package/dist/{rubric-predictive-validity-CxycqzX5.d.ts.map → rubric-predictive-validity-DluJLCKQ.d.ts.map} +1 -1
  154. package/dist/{run-record-BC0ebuRP.js → run-record-DLORoL7t.js} +2 -2
  155. package/dist/{run-record-BC0ebuRP.js.map → run-record-DLORoL7t.js.map} +1 -1
  156. package/dist/{run-record-VVy4T9OW.d.ts → run-record-DQjRcYwA.d.ts} +3 -3
  157. package/dist/{run-record-VVy4T9OW.d.ts.map → run-record-DQjRcYwA.d.ts.map} +1 -1
  158. package/dist/{schema-k6ZBftVv.js → schema-CdIX2aHu.js} +5 -1
  159. package/dist/{schema-k6ZBftVv.js.map → schema-CdIX2aHu.js.map} +1 -1
  160. package/dist/{schema-Bjgdsn73.d.ts → schema-DID1Cqct.d.ts} +7 -3
  161. package/dist/{schema-Bjgdsn73.d.ts.map → schema-DID1Cqct.d.ts.map} +1 -1
  162. package/dist/{semantic-concept-judge-BsDMOwJr.js → semantic-concept-judge-I36eejJx.js} +2 -2
  163. package/dist/{semantic-concept-judge-BsDMOwJr.js.map → semantic-concept-judge-I36eejJx.js.map} +1 -1
  164. package/dist/{sequential-BLMbdrD7.js → sequential-B51qAYE4.js} +2 -2
  165. package/dist/{sequential-BLMbdrD7.js.map → sequential-B51qAYE4.js.map} +1 -1
  166. package/dist/{server-BjYiJHoJ.js → server-CCEnywOR.js} +26 -18
  167. package/dist/server-CCEnywOR.js.map +1 -0
  168. package/dist/{skillopt-optimization-method-UArRo-nr.js → skillopt-optimization-method-DzlF2RM7.js} +9 -9
  169. package/dist/{skillopt-optimization-method-UArRo-nr.js.map → skillopt-optimization-method-DzlF2RM7.js.map} +1 -1
  170. package/dist/{statistical-heldout-Cy3EhjlC.d.ts → statistical-heldout-UhiexnjU.d.ts} +3 -3
  171. package/dist/{statistical-heldout-Cy3EhjlC.d.ts.map → statistical-heldout-UhiexnjU.d.ts.map} +1 -1
  172. package/dist/{store-B06JdC56.d.ts → store-Cq9oOrI1.d.ts} +2 -2
  173. package/dist/{store-B06JdC56.d.ts.map → store-Cq9oOrI1.d.ts.map} +1 -1
  174. package/dist/{store-otlp-C_Rq5I4D.js → store-otlp-CHjBvWQY.js} +2 -2
  175. package/dist/{store-otlp-C_Rq5I4D.js.map → store-otlp-CHjBvWQY.js.map} +1 -1
  176. package/dist/{store-tool-spans-BVga3c37.js → store-tool-spans-B9o6tU8f.js} +3 -3
  177. package/dist/{store-tool-spans-BVga3c37.js.map → store-tool-spans-B9o6tU8f.js.map} +1 -1
  178. package/dist/{store-tool-spans-DPUG7UUY.d.ts → store-tool-spans-D_qMl2__.d.ts} +102 -36
  179. package/dist/store-tool-spans-D_qMl2__.d.ts.map +1 -0
  180. package/dist/storyboard/index.d.ts +1 -1
  181. package/dist/{summary-report-BXeQ5Ues.js → summary-report-Bgh8CpNK.js} +2 -2
  182. package/dist/{summary-report-BXeQ5Ues.js.map → summary-report-Bgh8CpNK.js.map} +1 -1
  183. package/dist/{summary-report-CC07PhEL.d.ts → summary-report-DRstQNBX.d.ts} +3 -3
  184. package/dist/{summary-report-CC07PhEL.d.ts.map → summary-report-DRstQNBX.d.ts.map} +1 -1
  185. package/dist/{task-failure-attributes-DTl-7-Kw.js → task-failure-attributes-CBGtLS_H.js} +3 -3
  186. package/dist/{task-failure-attributes-DTl-7-Kw.js.map → task-failure-attributes-CBGtLS_H.js.map} +1 -1
  187. package/dist/{tool-groups-Ci8i9ErB.d.ts → tool-groups-RGYfVWpc.d.ts} +3 -3
  188. package/dist/tool-groups-RGYfVWpc.d.ts.map +1 -0
  189. package/dist/{tool-waste-CKc7bYIg.d.ts → tool-waste-BrmLKxMw.d.ts} +4 -4
  190. package/dist/{tool-waste-CKc7bYIg.d.ts.map → tool-waste-BrmLKxMw.d.ts.map} +1 -1
  191. package/dist/{tool-waste-8BQiUc8K.js → tool-waste-CwGHzBzX.js} +2 -2
  192. package/dist/{tool-waste-8BQiUc8K.js.map → tool-waste-CwGHzBzX.js.map} +1 -1
  193. package/dist/trace-repair/index.d.ts +3 -3
  194. package/dist/trace-repair/index.d.ts.map +1 -1
  195. package/dist/trace-repair/index.js +4 -3
  196. package/dist/trace-repair/index.js.map +1 -1
  197. package/dist/traces.d.ts +59 -61
  198. package/dist/traces.d.ts.map +1 -1
  199. package/dist/traces.js +7 -7
  200. package/dist/{trajectory-Bi157Gun.d.ts → trajectory-r1bQqvBQ.d.ts} +3 -3
  201. package/dist/{trajectory-Bi157Gun.d.ts.map → trajectory-r1bQqvBQ.d.ts.map} +1 -1
  202. package/dist/trajectory-replay/index.d.ts +3 -3
  203. package/dist/trajectory-replay/index.js +1 -1
  204. package/dist/{types-BPb2Kf_C.d.ts → types-CMyW4GnH.d.ts} +3 -3
  205. package/dist/{types-BPb2Kf_C.d.ts.map → types-CMyW4GnH.d.ts.map} +1 -1
  206. package/dist/{types-BI4fT3HN.js → types-CiWITkGo.js} +11 -2
  207. package/dist/types-CiWITkGo.js.map +1 -0
  208. package/dist/{types-D9ssmxKL.d.ts → types-DMoNFDWi.d.ts} +6 -3
  209. package/dist/{types-D9ssmxKL.d.ts.map → types-DMoNFDWi.d.ts.map} +1 -1
  210. package/dist/{types-D4s7Z6nq.d.ts → types-JHMOqZI4.d.ts} +13 -3
  211. package/dist/types-JHMOqZI4.d.ts.map +1 -0
  212. package/dist/{verdict-B0xltqu6.js → verdict-BQ3pCFf8.js} +2 -2
  213. package/dist/{verdict-B0xltqu6.js.map → verdict-BQ3pCFf8.js.map} +1 -1
  214. package/dist/{verdict-cache-CdVVTVmn.js → verdict-cache-B3eCVQtY.js} +2 -2
  215. package/dist/{verdict-cache-CdVVTVmn.js.map → verdict-cache-B3eCVQtY.js.map} +1 -1
  216. package/dist/wire/index.d.ts +26 -11
  217. package/dist/wire/index.d.ts.map +1 -1
  218. package/dist/wire/index.js +2 -2
  219. package/docs/campaign-proposers.md +4 -0
  220. package/docs/code-agent-intake.md +64 -0
  221. package/docs/concepts.md +1 -1
  222. package/docs/design/statistics-decisions.md +1 -1
  223. package/docs/distributed-driver.md +3 -6
  224. package/docs/public-api.md +122 -106
  225. package/docs/wire-protocol.md +5 -3
  226. package/package.json +27 -19
  227. package/dist/benchmark-BhT16ep9.js.map +0 -1
  228. package/dist/benchmark-command-CF-4GEWZ.js.map +0 -1
  229. package/dist/campaign-DQZmc2Dq.js.map +0 -1
  230. package/dist/capture-fetch-CqwsJkkG.d.ts +0 -68
  231. package/dist/capture-fetch-CqwsJkkG.d.ts.map +0 -1
  232. package/dist/contract/index.d.ts.map +0 -1
  233. package/dist/dspy-rlm-engine-DhA9qKIm.js.map +0 -1
  234. package/dist/external-optimizer-process-BFmh36vW.js.map +0 -1
  235. package/dist/external-optimizer-subprocess-CqLMW3nh.js.map +0 -1
  236. package/dist/index-CGtH1piv.d.ts.map +0 -1
  237. package/dist/index-D-V8gCs_.d.ts.map +0 -1
  238. package/dist/index-vrJugRal.d.ts +0 -1
  239. package/dist/kind-factory-DY8FdoXf.js.map +0 -1
  240. package/dist/llm-judge-Du7WQPh7.js.map +0 -1
  241. package/dist/pareto-BqNW3LJR.d.ts.map +0 -1
  242. package/dist/run-score-lDzV0X8j.js.map +0 -1
  243. package/dist/server-BjYiJHoJ.js.map +0 -1
  244. package/dist/skillopt-optimization-method-x7TTF23P.d.ts.map +0 -1
  245. package/dist/store-tool-spans-DPUG7UUY.d.ts.map +0 -1
  246. package/dist/tool-groups-Ci8i9ErB.d.ts.map +0 -1
  247. package/dist/transient-failure-DKF5Mofa.d.ts.map +0 -1
  248. package/dist/types-BI4fT3HN.js.map +0 -1
  249. package/dist/types-D4s7Z6nq.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,133 @@ All notable changes to `@tangle-network/agent-eval` and its sibling `agent-eval-
4
4
 
5
5
  ---
6
6
 
7
+ ## [0.171.0] — 2026-08-31
8
+
9
+ ### Changed
10
+
11
+ - Compile and publish the exported `AgentProfile` contract against `@tangle-network/agent-interface` 2.
12
+ This keeps Eval, Runtime, and consumers on one canonical profile type.
13
+ - Refresh direct dependencies to their latest approved versions.
14
+ - Pin Zod 4.5.4 through a version-scoped release-age exception for this compatibility cohort.
15
+ - Set Node.js 20.19.0 as the minimum version required by the dependency graph.
16
+ - Pin the four dependency manifests with digest `43f2e94849ab4d777ac8c0c358c6c4f0687129c322c0565fb5cc8583922a433d`.
17
+
18
+ ---
19
+
20
+ ## [0.170.0] — 2026-08-21
21
+
22
+ ### Added
23
+
24
+ - `pnpm check:collation-ordering`, wired into `verify:package`. It reports a `localeCompare` comparator inside a function that also canonicalizes or hashes — the shape that let eleven orderings decide a digest from the host's collation rather than from the value. The rule is narrow on purpose: ordering a table a human reads is not this gate's business, and a Markdown renderer that sorts rows does not canonicalize, so it is not reported. An allowlist entry matching nothing fails the gate, so a stale waiver cannot hide a new one.
25
+ - `scripts/source-scan.mjs` holds the reading primitives both source gates share — walking `src/`, naming a function by its binding, locating an offset, visiting a tree. A second gate with its own copies would have re-created the duplication these releases removed, and sharing them means the naming fix in 0.168.1 reaches both gates rather than one.
26
+
27
+ ---
28
+
29
+ ## [0.169.0] — 2026-08-21
30
+
31
+ ### Fixed
32
+
33
+ - Eleven orderings that reach a digest, a stable serialization, or a stored identity no longer read the host's collation. RFC 8785 canonicalizes an array **by position**, so a `localeCompare` sort in front of `canonicalString` or `hashCanonical` let the machine decide the digest bytes: the ids `Accuracy, brevity, Clarity` order as `Accuracy,brevity,Clarity` under an en-US collation and as `Accuracy,Clarity,brevity` by code unit, and the two produce different digests for the same data. `compareCodeUnits` in `src/ledger-core/canonical.ts` is now the one comparator for an ordering whose result is hashed.
34
+ - Three of the ten carried a docstring asserting an invariant the code did not hold: `hashScenarios` ("independent of insertion order" — it was not independent of collation), `Dataset.toJsonl` ("deterministic byte-for-byte"), and `serializeFeedbackTrajectoriesJsonl` ("two exports of equal stores are byte-equal"). `testSuiteDigest`'s "two suites with the same digest are the same suite" was in the same position.
35
+ - Digest and serialization sites: `src/dataset.ts` (`hashScenarios`, `toJsonl`), `src/feedback-trajectory.ts` (`serializeFeedbackTrajectoriesJsonl`), `src/trace-repair/test-oracle.ts` (`testSuiteDigest`), `src/campaign/provenance.ts` (`costReceiptsDigest`, `campaignMeasurementDigest` cells), `src/analyst/benchmark-summary.ts` (finding signature), `src/analyst/benchmark-verification-artifacts.ts` (artifact order, which reaches a verification span id), `src/rl/verified-findings-dataset.ts` (dataset rows), `src/campaign/run-campaign.ts` (the campaign's retained cell order).
36
+ - Ordering-only sites fixed for the same reason, since each decides which records a caller sees: `src/campaign/labeled-store/fs-adapter.ts` (which records a `slice(0, count)` returns) and `src/analyst/benchmark-public-data.ts` (which rows a seeded public-benchmark sample selects).
37
+ - No retention window is added, and that is a per-site finding rather than an assumption: nothing in this package stores one of these values and later recomputes it from source data to compare. `verifyLoopProvenanceRecord` re-hashes the record's stored fields, and `assertCampaignSplitIdentity` recomputes a split digest whose builder never sorted. The values move once, like `rubricVersion` in 0.167.0, rather than needing the dual-verify `surfaceHash` required.
38
+ - A comparator for a report a human reads is left alone; `renderSurfaceDiff` and the Markdown renderers keep `localeCompare`.
39
+
40
+ ---
41
+
42
+ ## [0.168.1] — 2026-08-21
43
+
44
+ ### Fixed
45
+
46
+ - `scripts/check-canonical-json.mjs` no longer names a function after the function it is passed to. An arrow in argument position sits behind the text `helper(`, and the name fallback read that as its name; the fabricated name then entered the module's sorter set, so every caller of the REAL function of that name read as sorting. A gate that reports a file and line whose function contains no sort teaches the next reader that it lies, which is how a useful check gets switched off.
47
+ - Names now come from a binding only — a declaration id, a `const`/`let`/`var` binding, or an object-property key — and a function with no binding is reported as `(anonymous)` and located by its line. Only a bound function can be called by name, so only a bound one is registered as a sorting helper.
48
+
49
+ ---
50
+
51
+ ## [0.168.0] — 2026-08-21
52
+
53
+ ### Fixed
54
+
55
+ - A component surface's stored identity no longer depends on the host's collation. `componentSurfaceIdentityMaterial` ordered component names with `localeCompare`, which reads the runtime's default collation rather than the value, and that material feeds `surfaceContentHash` and `surfaceHash` — identities that are **written down** and later recomputed and compared. Three sites do exactly that (`src/campaign/provenance.ts:351`, `src/campaign/presets/run-optimization.ts:658` and `:693`), each of them a fail-closed refusal, so under a different ICU build or locale a legitimate resume or parent selection could be rejected as a surface that does not match its own identity. The material now comes from `canonicalString`, which orders keys by UTF-16 code unit (RFC 8785) — a property of the value alone.
56
+ - `surfaceHashMatches(surface, storedHash)` is the verify path for the retention window. A stored loop key is 16 hex characters with no room for a scheme tag, so unlike an `agent-profile-cell` id it cannot name the scheme that minted it; the matcher tries the current material and then the retired one, which gives the same property — a key minted by an earlier release still matches its own surface, and an edited surface matches neither. The retired builder is private and reachable only from that matcher; nothing mints from it. The three comparison sites now use the matcher instead of `!==`.
57
+ - Every stored component-surface identity moves, not only one whose names sort differently under a collation: RFC 8785 also orders the two top-level keys, so `components` now precedes `schema`. Prompt and code surfaces are unaffected — neither builds material from an ordered key list.
58
+
59
+ ---
60
+
61
+ ## [0.167.1] — 2026-08-21
62
+
63
+ ### Changed
64
+
65
+ - `waitForActiveHandlers` and `sendJsonIfOpen` had three byte-identical private copies each, one per local HTTP server (`src/analyst/trace-tool-callback.ts`, `src/campaign/external-optimizer-callback.ts`, `src/campaign/external-optimizer-model-proxy.ts`). Both now live in `src/campaign/external-optimizer-http.ts`, the module all three already imported `closeServer`, `listenLocal`, and `sendJson` from. The drain loop re-reads the handler set on every pass because a running handler can register another; a copy that awaited one snapshot would let the caller close the server with work outstanding. No behavior change and no export change: the helpers are internal to that module's consumers.
66
+
67
+ ---
68
+
69
+ ## [0.167.0] — 2026-08-21
70
+
71
+ ### Changed
72
+
73
+ - `rubricVersion` is now `<name>@sha256-rfc8785:<hex>` and comes from `hashCanonical`, this package's only canonical-JSON encoder. It was a 32-bit djb2 hash over a private `stableStringify` — the twelfth canonical-JSON encoder in the tree, and the only one whose key order came from `localeCompare`. `localeCompare` orders by the runtime's collation rather than by the value, so a rubric whose dimension ids differ only in case (`Accuracy`, `brevity`) could serialize in a different order under a different collation and produce a different tag for the same rubric. RFC 8785 orders by UTF-16 code unit, which depends on the value alone.
74
+ - The scheme is named inside the value. A consumer holding a tag from an earlier release reads a different scheme and can tell "this package changed how it hashes" from "the rubric changed"; with a bare hex string the two are indistinguishable. Tags minted before this release (`anti-slop@a4f2b8c1`) are not comparable with these, and nothing in this package verifies a stored tag — `rubricVersion` is compared for equality, never recomputed against a record — so no legacy encoder is retained.
75
+ - `WIRE_VERSION` is `1.1.0`. The request and response shapes are unchanged, so the major stays `1` and every client that checks the major (`clients/python/src/agent_eval_rpc/client.py:139`) keeps working; the minor moves because a response value changed meaning.
76
+ - The Python client carries `rubricVersion` as an opaque `str` and never computes or parses it, so it needs no change beyond the version lockstep.
77
+ - `RUBRIC_VERSION_SCHEME` is exported from `/wire` for a caller that wants to compare a tag's scheme without parsing the string.
78
+
79
+ ---
80
+
81
+ ## [0.166.1] — 2026-08-21
82
+
83
+ ### Changed
84
+
85
+ - The seven FNV-1a loops in this package each say what they hash and why they are frozen. They look interchangeable and are not: one hashes IEEE-754 bytes rather than a string (`src/statistics/internal.ts`), one masks each code unit to a byte and the rest do not (`src/partition-held-out.ts`), one is deliberately left signed so subtracting two results is a valid comparator (`src/analyst/benchmark.ts`), and one runs two accumulators with different offsets to make a 64-bit-wide id (`src/eval-campaign.ts`). Unifying them would move held-out splits, cell keys, replay seeds, and published bootstrap intervals that were already decided under the current values, so each now carries the one line that stops the next reader from "fixing" it. No behavior change.
86
+
87
+ ---
88
+
89
+ ## [0.165.0] — 2026-08-21
90
+
91
+ ### Added
92
+
93
+ - `@tangle-network/agent-eval/adapters/http` is published. `httpDispatch` (coordinator side) and `runDispatchServer` (worker side) have existed in `src/adapters/http.ts` with a test, a two-process runnable example under `examples/distributed-driver/`, and a design document since 0.130.x, but no `exports` entry — so every `import` line in `docs/distributed-driver.md` threw `ERR_PACKAGE_PATH_NOT_EXPORTED` against an installed copy, and the example could only be run from a checkout. The document's status note and the three "not currently published" fence comments are removed because they are no longer true.
94
+
95
+ ---
96
+
97
+ ## [0.164.2] — 2026-08-21
98
+
99
+ ### Changed
100
+
101
+ - Three vocabularies that were declared twice now derive from one array each. No member changes, no reordering, and no public export changes; the schemas that validate them are generated from the same declaration they validate against, so the two halves cannot drift apart.
102
+ - `AnalystComparisonMetric` was a hand-written 18-member union, `METRICS` repeated the same 18 members as an array, `LOWER_IS_BETTER` repeated 8 of them as a set, and `src/analyst/benchmark-command-validation.ts` repeated all 18 again as a `z.enum` over the persisted artifact. A metric added to the union but missed in that enum would have been rejected at artifact validation with no compile error. One `ANALYST_COMPARISON_METRIC_DIRECTION` table now carries every metric and its direction; the type, the reporting order, the artifact schema, and `analystComparisonMetricDirection` all derive from it.
103
+ - `FailureClass` was a 35-member union followed by `FAILURE_CLASSES`, a `readonly FailureClass[]` repeating the same 35 members. The array could silently omit a member the type declared. `FAILURE_CLASSES` is now the `as const` owner and the type derives from it.
104
+ - `AnalystSeverity` was a union in `src/analyst/types.ts` and `ANALYST_SEVERITIES` was a private copy in `src/analyst/finding-signature.ts` feeding the finding schema's `z.enum`. `ANALYST_SEVERITIES` now lives beside the type it defines.
105
+
106
+ ---
107
+
108
+ ## [0.164.1] — 2026-08-21
109
+
110
+ ### Changed
111
+
112
+ - The analyst-benchmark pin is authored by the tool that checks it. `pnpm analyst:pin` (`--write`) rewrites `ANALYST_BENCHMARK_IMPLEMENTATION_FILES` from the import graph and both live digests from the sources; it refuses a `--source-root` and never writes `ANALYST_BENCHMARK_EVIDENCE_IMPLEMENTATION_SHA256` or `ANALYST_BENCHMARK_EVIDENCE_DEPENDENCY_LOCK_SHA256`, which state facts about already-published evidence. Every check the gate made still runs unchanged in every other mode.
113
+ - `src/analyst/benchmark-implementation.test.ts` no longer keeps a second hand-copied copy of the 108-entry source manifest. `assertCompleteSourceManifest` in the checker already proves the manifest equals the import graph on every `pnpm build` and `pnpm verify:package`; the test's `EXPECTED_FILES` restated the constant it imported, so adding one source file meant editing the same list in two places. The two tests that prove the gate actually fails — a mutated bound source, and a transitive source missing from the manifest — are unchanged and now read the constant.
114
+
115
+ ---
116
+
117
+ ## [0.164.0] — 2026-08-21
118
+
119
+ ### Removed
120
+
121
+ - `createVerifierAdapter`, `createRunCriticAdapter`, and `createJudgeAdapter` from `/analyst`, with their `VerifierAdapterOpts`, `RunCriticAdapterOpts`, and `JudgeAdapterOpts`. Every channel was silent: no import or mention across the 31 repositories the census sweeps on their default branches, no hit in a GitHub code search across the organisation outside this repository's own source and changelog, nothing in the published `dist/` of `@tangle-network/agent-runtime@0.153.1`, `@tangle-network/agent-knowledge@10.6.0`, or `@tangle-network/braid@0.2.0`, and no test, example, doc, or in-repository caller. `createSemanticConceptJudgeAdapter` is the remaining adapter and is unchanged.
122
+
123
+ ### Added
124
+
125
+ - `docs/code-agent-intake.md`. The per-harness intake functions — `fromCodexSession`, `fromClaudeCodeSession`, `fromOpenCodeSession`, `fromKimiCodeSession`, `fromPiSession` — plus `parseCodeAgentJsonl`, `parseCodeAgentJsonlFile`, `streamCodeAgentJsonlFile`, `observeCodeAgentSession`, `parseAgentTrace`, and `partitionRunsByAuthoringModel` had no Markdown front door, which is the only reason the census read them as unused. The document states the three steps, names the fields on `CodeAgentSessionDiagnostic` and `CodeAgentSessionMetrics` that a caller must read before aggregating, and says which path to use above V8's string ceiling. Linked from the README documentation index.
126
+
127
+ ### Fixed
128
+
129
+ - `pnpm api:census` counted `scripts/` and `benchmarks/` as no evidence at all. Neither directory was walked, so a symbol whose only caller is a maintenance script read as a deletion candidate — including `renderEvidenceIndex`, which `pnpm evidence:check` calls inside `pnpm verify:package`. Acting on that row would have failed the release gate. Both directories are now walked and count as in-package production callers, and `SOURCE_FILE` accepts `.mjs`/`.cjs`/`.js` so a `.mjs` script is read at all. Eleven symbols moved from `none` to `production` on this pass.
130
+ - `docs/public-api.md` now records the four rules that decided the `none` review, so the next reader inherits the judgment rather than repeating the sweep. Totals moved from 903/211/238 (production/planned/none) to 926/205/220.
131
+
132
+ ---
133
+
7
134
  ## [0.163.2] — 2026-08-21
8
135
 
9
136
  ### Fixed
package/README.md CHANGED
@@ -153,6 +153,7 @@ and [DSPy](./docs/campaign-proposers.md#use-official-dspy-optimizers).
153
153
  | `@tangle-network/agent-eval/benchmarks` | Benchmark adapters and retrieval metrics. |
154
154
  | `@tangle-network/agent-eval/rl` | Export rewards, preferences, and training rows. |
155
155
  | `@tangle-network/agent-eval/wire` | HTTP and RPC schemas for other languages. |
156
+ | `@tangle-network/agent-eval/adapters/http` | Run campaign cells on remote workers over HTTP. |
156
157
 
157
158
  Use the root import for common primitives.
158
159
  Use a subpath when you want an explicit capability boundary.
@@ -169,6 +170,7 @@ Use a subpath when you want an explicit capability boundary.
169
170
  | How do I register an experiment as a sealed object? | [`docs/experiment.md`](./docs/experiment.md) |
170
171
  | How is something certified without an answer key? | [`docs/verification-strategies.md`](./docs/verification-strategies.md) |
171
172
  | Where does every verifier land its result? | [`docs/verdicts.md`](./docs/verdicts.md) |
173
+ | How do I turn a coding-agent session log into runs? | [`docs/code-agent-intake.md`](./docs/code-agent-intake.md) |
172
174
  | How do I score a string from another language? | [`docs/wire-protocol.md`](./docs/wire-protocol.md) |
173
175
 
174
176
  The [example index](./examples/README.md) lists every runnable example.
@@ -0,0 +1,108 @@
1
+ import { R as Scenario, d as DispatchContext, f as DispatchFn } from "../types-JHMOqZI4.js";
2
+ import "../index-fNXZMCzX.js";
3
+ //#region src/adapters/http.d.ts
4
+ interface HttpDispatchOptions<TScenario extends Scenario, _TArtifact> {
5
+ /** Static endpoint URL. Mutually exclusive with `resolveUrl`. */
6
+ url?: string;
7
+ /**
8
+ * Dynamic per-cell URL resolver. Receives the scenario + the substrate
9
+ * placement key (from `RunCampaignOptions.cellPlacement`) and returns the
10
+ * worker URL to invoke. Mutually exclusive with `url`.
11
+ */
12
+ resolveUrl?: (input: {
13
+ scenario: TScenario;
14
+ placement?: string;
15
+ cellId: string;
16
+ }) => string;
17
+ /** Bearer token or static auth string set as `Authorization`. */
18
+ auth?: string | (() => string | Promise<string>);
19
+ /** Extra headers merged into every request. */
20
+ headers?: Record<string, string>;
21
+ /** Per-call timeout in ms. Default 5 minutes. */
22
+ timeoutMs?: number;
23
+ /** How many idempotent retries on 5xx / network errors. Default 2. */
24
+ retries?: number;
25
+ /** Optional fetch override (auth wrappers, custom agent, mocks). */
26
+ fetchImpl?: typeof fetch;
27
+ }
28
+ interface HttpDispatchRequestBody<TScenario extends Scenario> {
29
+ scenario: TScenario;
30
+ cellId: string;
31
+ runAttemptId: string;
32
+ rep: number;
33
+ generation?: number;
34
+ seed: number;
35
+ placement?: string;
36
+ cycleId?: string;
37
+ }
38
+ interface HttpDispatchResponseBody<TArtifact> {
39
+ artifact: TArtifact;
40
+ }
41
+ /**
42
+ * Wrap a remote HTTP endpoint as a `Dispatch`. The remote side should run
43
+ * `runDispatchServer` (or any service that speaks the same wire shape).
44
+ *
45
+ * Cancellation: the substrate's per-cell `AbortSignal` is forwarded; the
46
+ * server's `runDispatchServer` translates the resulting `AbortError` into
47
+ * a 499 (client-closed) so the client doesn't retry.
48
+ */
49
+ declare function httpDispatch<TScenario extends Scenario, TArtifact>(opts: HttpDispatchOptions<TScenario, TArtifact>): DispatchFn<TScenario, TArtifact>;
50
+ interface RunDispatchServerOptions<TScenario extends Scenario, TArtifact> {
51
+ /** The Dispatch this server exposes — what runs when a request lands. */
52
+ dispatch: DispatchFn<TScenario, TArtifact>;
53
+ /** TCP port to bind. */
54
+ port: number;
55
+ /** Optional bind host; defaults to 0.0.0.0. */
56
+ host?: string;
57
+ /** Required for any non-test deployment: the bearer token clients must
58
+ * send. The substrate refuses to start without auth unless `auth: false`
59
+ * is set explicitly (intended ONLY for closed-network/internal testing). */
60
+ auth: string | false;
61
+ /** Path the server listens on. Default `/dispatch`. */
62
+ path?: string;
63
+ /**
64
+ * Per-request handler that wraps `dispatch` with whatever context the
65
+ * worker side needs to construct a `DispatchContext` — typically the
66
+ * trace writer, artifact writer, and cost meter. The substrate provides
67
+ * synthetic-but-typed defaults if not supplied; production deployments
68
+ * should wire real ones (e.g. ship traces to your OTel collector).
69
+ */
70
+ contextFactory?: (req: HttpDispatchRequestBody<TScenario>, signal: AbortSignal) => Promise<DispatchContext>;
71
+ /** Optional max payload size for the request body (bytes). Default 10 MB. */
72
+ maxBodyBytes?: number;
73
+ /** Hook for observability — called on every successful or failed turn. */
74
+ onRequest?: (event: {
75
+ cellId: string;
76
+ durationMs: number;
77
+ success: boolean;
78
+ error?: unknown;
79
+ }) => void;
80
+ }
81
+ interface DispatchServerHandle {
82
+ /** The actual bound port (useful when `port: 0` requests an ephemeral port). */
83
+ port: number;
84
+ /** Stop accepting new connections and drain existing ones. */
85
+ close: () => Promise<void>;
86
+ }
87
+ /**
88
+ * Start an HTTP server exposing a local `Dispatch` over the wire. Pair with
89
+ * `httpDispatch` on the driver side.
90
+ *
91
+ * Wire shape:
92
+ *
93
+ * POST /dispatch
94
+ * Authorization: Bearer <token>
95
+ * Body: HttpDispatchRequestBody
96
+ * 200 OK: HttpDispatchResponseBody
97
+ * 401: missing/invalid auth
98
+ * 408: per-request timeout exceeded
99
+ * 499: client aborted before completion
100
+ * 500: dispatch threw
101
+ *
102
+ * The server is `node:http`-based to keep the runtime dependency surface
103
+ * minimal — works in plain Node, sandbox, or any container.
104
+ */
105
+ declare function runDispatchServer<TScenario extends Scenario, TArtifact>(opts: RunDispatchServerOptions<TScenario, TArtifact>): Promise<DispatchServerHandle>;
106
+ //#endregion
107
+ export { DispatchServerHandle, HttpDispatchOptions, HttpDispatchRequestBody, HttpDispatchResponseBody, RunDispatchServerOptions, httpDispatch, runDispatchServer };
108
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","names":[],"sources":["../../src/adapters/http.ts"],"mappings":";;;UA0CiB,oBAAoB,kBAAkB,UAAU;;EAE/D;;;;;;EAMA,cAAc;IAAS,UAAU;IAAW;IAAoB;;;EAEhE,gCAAgC;;EAEhC,UAAU;;EAEV;;EAEA;;EAEA,mBAAmB;;UAGJ,wBAAwB,kBAAkB;EACzD,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe,yBAAyB;EACxC,UAAU;;;;;;;;;;iBAiBI,aAAa,kBAAkB,UAAU,WACvD,MAAM,oBAAoB,WAAW,aACpC,WAAS,WAAW;UAqFN,yBAAyB,kBAAkB,UAAU;;EAEpE,UAAU,WAAS,WAAW;;EAE9B;;EAEA;;;;EAIA;;EAEA;;;;;;;;EAQA,kBACE,KAAK,wBAAwB,YAC7B,QAAQ,gBACL,QAAQ;;EAEb;;EAEA,aAAa;IACX;IACA;IACA;IACA;;;UAIa;;EAEf;;EAEA,aAAa;;;;;;;;;;;;;;;;;;;;iBAqBO,kBAAkB,kBAAkB,UAAU,WAClE,MAAM,yBAAyB,WAAW,aACzC,QAAQ"}
@@ -0,0 +1,208 @@
1
+ //#region src/adapters/http.ts
2
+ function resolveAuth(auth) {
3
+ if (!auth) return Promise.resolve(null);
4
+ if (typeof auth === "string") return Promise.resolve(auth);
5
+ return Promise.resolve(auth());
6
+ }
7
+ /**
8
+ * Wrap a remote HTTP endpoint as a `Dispatch`. The remote side should run
9
+ * `runDispatchServer` (or any service that speaks the same wire shape).
10
+ *
11
+ * Cancellation: the substrate's per-cell `AbortSignal` is forwarded; the
12
+ * server's `runDispatchServer` translates the resulting `AbortError` into
13
+ * a 499 (client-closed) so the client doesn't retry.
14
+ */
15
+ function httpDispatch(opts) {
16
+ if (!opts.url && !opts.resolveUrl) throw new Error("httpDispatch: pass exactly one of `url` or `resolveUrl`.");
17
+ if (opts.url && opts.resolveUrl) throw new Error("httpDispatch: pass exactly one of `url` or `resolveUrl`, not both.");
18
+ const timeoutMs = opts.timeoutMs ?? 300 * 1e3;
19
+ const maxRetries = opts.retries ?? 2;
20
+ const f = opts.fetchImpl ?? ((...args) => fetch(...args));
21
+ return async (scenario, ctx) => {
22
+ const url = opts.url ?? opts.resolveUrl({
23
+ scenario,
24
+ placement: ctx.placement,
25
+ cellId: ctx.cellId
26
+ });
27
+ const authValue = await resolveAuth(opts.auth);
28
+ const body = {
29
+ scenario,
30
+ cellId: ctx.cellId,
31
+ runAttemptId: ctx.runAttemptId,
32
+ rep: ctx.rep,
33
+ generation: ctx.generation,
34
+ seed: ctx.seed,
35
+ placement: ctx.placement,
36
+ cycleId: ctx.cycleId
37
+ };
38
+ let lastError;
39
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
40
+ const ourTimeout = AbortSignal.timeout(timeoutMs);
41
+ const combinedSignal = AbortSignal.any([ctx.signal, ourTimeout]);
42
+ try {
43
+ const res = await f(url, {
44
+ method: "POST",
45
+ headers: {
46
+ "Content-Type": "application/json",
47
+ ...authValue ? { Authorization: authValue.startsWith("Bearer ") ? authValue : `Bearer ${authValue}` } : {},
48
+ ...opts.headers
49
+ },
50
+ body: JSON.stringify(body),
51
+ signal: combinedSignal
52
+ });
53
+ if (!res.ok) {
54
+ if (!(res.status >= 500 || res.status === 408 || res.status === 429) || attempt === maxRetries) {
55
+ const text = await res.text().catch(() => "");
56
+ throw new Error(`httpDispatch ${url} failed (${res.status}): ${text.slice(0, 500)}`);
57
+ }
58
+ await sleep(2 ** attempt * 200 + Math.random() * 200);
59
+ continue;
60
+ }
61
+ return (await res.json()).artifact;
62
+ } catch (err) {
63
+ if (ctx.signal.aborted) throw err;
64
+ lastError = err;
65
+ if (attempt === maxRetries) throw err;
66
+ await sleep(2 ** attempt * 200 + Math.random() * 200);
67
+ }
68
+ }
69
+ throw lastError ?? /* @__PURE__ */ new Error("httpDispatch exhausted retries");
70
+ };
71
+ }
72
+ function sleep(ms) {
73
+ return new Promise((resolve) => {
74
+ const t = setTimeout(resolve, ms);
75
+ if (typeof t.unref === "function") t.unref();
76
+ });
77
+ }
78
+ /**
79
+ * Start an HTTP server exposing a local `Dispatch` over the wire. Pair with
80
+ * `httpDispatch` on the driver side.
81
+ *
82
+ * Wire shape:
83
+ *
84
+ * POST /dispatch
85
+ * Authorization: Bearer <token>
86
+ * Body: HttpDispatchRequestBody
87
+ * 200 OK: HttpDispatchResponseBody
88
+ * 401: missing/invalid auth
89
+ * 408: per-request timeout exceeded
90
+ * 499: client aborted before completion
91
+ * 500: dispatch threw
92
+ *
93
+ * The server is `node:http`-based to keep the runtime dependency surface
94
+ * minimal — works in plain Node, sandbox, or any container.
95
+ */
96
+ async function runDispatchServer(opts) {
97
+ if (opts.auth === void 0) throw new Error("runDispatchServer: 'auth' is required (pass a bearer-token string, or `auth: false` explicitly for a closed-network test deployment).");
98
+ const path = opts.path ?? "/dispatch";
99
+ const maxBytes = opts.maxBodyBytes ?? 10 * 1024 * 1024;
100
+ const expectedAuth = typeof opts.auth === "string" ? `Bearer ${opts.auth.replace(/^Bearer\s+/, "")}` : null;
101
+ const { createServer } = await import("node:http");
102
+ const server = createServer(async (req, res) => {
103
+ const start = Date.now();
104
+ let cellId = "unknown";
105
+ let success = false;
106
+ let errCaught;
107
+ try {
108
+ if (req.method !== "POST" || req.url?.split("?")[0] !== path) {
109
+ res.statusCode = 404;
110
+ res.end("not found");
111
+ return;
112
+ }
113
+ if (expectedAuth) {
114
+ if (req.headers.authorization !== expectedAuth) {
115
+ res.statusCode = 401;
116
+ res.end("unauthorized");
117
+ return;
118
+ }
119
+ }
120
+ const chunks = [];
121
+ let totalBytes = 0;
122
+ const aborter = new AbortController();
123
+ res.on("close", () => {
124
+ if (!res.writableEnded) aborter.abort();
125
+ });
126
+ for await (const chunk of req) {
127
+ const buf = chunk;
128
+ totalBytes += buf.length;
129
+ if (totalBytes > maxBytes) {
130
+ res.statusCode = 413;
131
+ res.end("payload too large");
132
+ return;
133
+ }
134
+ chunks.push(buf);
135
+ }
136
+ const body = JSON.parse(Buffer.concat(chunks).toString("utf8"));
137
+ if (typeof body.runAttemptId !== "string" || body.runAttemptId.trim().length === 0) throw new Error("runDispatchServer: request runAttemptId is required");
138
+ cellId = body.cellId;
139
+ const ctx = opts.contextFactory ? await opts.contextFactory(body, aborter.signal) : {
140
+ cellId: body.cellId,
141
+ runAttemptId: body.runAttemptId,
142
+ rep: body.rep,
143
+ generation: body.generation,
144
+ seed: body.seed,
145
+ signal: aborter.signal,
146
+ placement: body.placement,
147
+ cycleId: body.cycleId,
148
+ trace: NOOP_TRACE,
149
+ artifacts: NOOP_ARTIFACTS,
150
+ cost: NOOP_COST
151
+ };
152
+ if (ctx.runAttemptId !== body.runAttemptId) throw new Error("runDispatchServer: contextFactory must preserve request runAttemptId");
153
+ const responseBody = { artifact: await opts.dispatch(body.scenario, ctx) };
154
+ res.statusCode = 200;
155
+ res.setHeader("content-type", "application/json");
156
+ res.end(JSON.stringify(responseBody));
157
+ success = true;
158
+ } catch (err) {
159
+ errCaught = err;
160
+ if (err?.name === "AbortError") {
161
+ res.statusCode = 499;
162
+ res.end("client aborted");
163
+ return;
164
+ }
165
+ res.statusCode = 500;
166
+ res.setHeader("content-type", "application/json");
167
+ res.end(JSON.stringify({ error: err instanceof Error ? err.message : String(err) }));
168
+ } finally {
169
+ opts.onRequest?.({
170
+ cellId,
171
+ durationMs: Date.now() - start,
172
+ success,
173
+ error: errCaught
174
+ });
175
+ }
176
+ });
177
+ await new Promise((resolve, reject) => {
178
+ server.once("error", reject);
179
+ server.listen(opts.port, opts.host ?? "0.0.0.0", () => resolve());
180
+ });
181
+ const addr = server.address();
182
+ return {
183
+ port: typeof addr === "object" && addr ? addr.port : opts.port,
184
+ close: () => new Promise((resolve, reject) => {
185
+ server.close((err) => err ? reject(err) : resolve());
186
+ })
187
+ };
188
+ }
189
+ const NOOP_TRACE = { span: () => ({
190
+ end: () => {},
191
+ setAttribute: () => {},
192
+ setStatus: () => {},
193
+ recordException: () => {},
194
+ addEvent: () => {}
195
+ }) };
196
+ const NOOP_ARTIFACTS = {
197
+ write: async () => void 0,
198
+ read: async () => void 0,
199
+ list: async () => []
200
+ };
201
+ const NOOP_COST = {
202
+ record: () => {},
203
+ total: () => 0
204
+ };
205
+ //#endregion
206
+ export { httpDispatch, runDispatchServer };
207
+
208
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","names":[],"sources":["../../src/adapters/http.ts"],"sourcesContent":["/**\n * # `@tangle-network/agent-eval/adapters/http` — distributed Dispatch over HTTP.\n *\n * Decouples coordinator and worker. The coordinator (running\n * `runImprovementLoop` or `runCampaign`) can live anywhere — your VPC, a dev\n * laptop, a cron VM. The workers (running the actual agent) can live anywhere else — different\n * regions, different clouds, different boxes — as long as they speak HTTP.\n *\n * Both sides:\n *\n * - **`httpDispatch({ url | resolveUrl, ... })`** — client. Returns a\n * `Dispatch` that POSTs `{ scenario, ctx }` to a worker URL and parses\n * the artifact back. AbortSignal-aware, retries on idempotent errors,\n * bounded timeout per call.\n * - **`runDispatchServer({ dispatch, port, ... })`** — server. Wraps your\n * local `Dispatch` as an HTTP endpoint. Handles auth, JSON parsing,\n * error mapping, and cancellation when the client aborts.\n *\n * # Topology examples\n *\n * **Single-worker:** coordinator on box A, worker on box B. Set\n * `httpDispatch({ url: 'https://box-b/dispatch' })`.\n *\n * **Multi-region:** N workers across regions. Use `httpDispatch({ resolveUrl })`\n * with a function that picks the URL per cell from `ctx.placement`. Combined\n * with `cellPlacement` on `RunCampaignOptions`, the substrate fans cells\n * across geographies in parallel.\n *\n * **Coordinator-as-a-service:** coordinator runs as a long-lived process or service\n * (holds optimization state across generations); workers are stateless\n * HTTP services that can scale horizontally per cell.\n */\n\nimport type { Dispatch, DispatchContext, Scenario } from '../contract'\n\n// ── Client ───────────────────────────────────────────────────────────\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars -- TArtifact is unused\n// in this options interface but kept as a parameter so callers can write\n// `HttpDispatchOptions<MyScenario, MyArtifact>` symmetrically with\n// `Dispatch<MyScenario, MyArtifact>`. Marking it unused at the position\n// where it bites.\nexport interface HttpDispatchOptions<TScenario extends Scenario, _TArtifact> {\n /** Static endpoint URL. Mutually exclusive with `resolveUrl`. */\n url?: string\n /**\n * Dynamic per-cell URL resolver. Receives the scenario + the substrate\n * placement key (from `RunCampaignOptions.cellPlacement`) and returns the\n * worker URL to invoke. Mutually exclusive with `url`.\n */\n resolveUrl?: (input: { scenario: TScenario; placement?: string; cellId: string }) => string\n /** Bearer token or static auth string set as `Authorization`. */\n auth?: string | (() => string | Promise<string>)\n /** Extra headers merged into every request. */\n headers?: Record<string, string>\n /** Per-call timeout in ms. Default 5 minutes. */\n timeoutMs?: number\n /** How many idempotent retries on 5xx / network errors. Default 2. */\n retries?: number\n /** Optional fetch override (auth wrappers, custom agent, mocks). */\n fetchImpl?: typeof fetch\n}\n\nexport interface HttpDispatchRequestBody<TScenario extends Scenario> {\n scenario: TScenario\n cellId: string\n runAttemptId: string\n rep: number\n generation?: number\n seed: number\n placement?: string\n cycleId?: string\n}\n\nexport interface HttpDispatchResponseBody<TArtifact> {\n artifact: TArtifact\n}\n\nfunction resolveAuth(auth: HttpDispatchOptions<Scenario, unknown>['auth']): Promise<string | null> {\n if (!auth) return Promise.resolve(null)\n if (typeof auth === 'string') return Promise.resolve(auth)\n return Promise.resolve(auth())\n}\n\n/**\n * Wrap a remote HTTP endpoint as a `Dispatch`. The remote side should run\n * `runDispatchServer` (or any service that speaks the same wire shape).\n *\n * Cancellation: the substrate's per-cell `AbortSignal` is forwarded; the\n * server's `runDispatchServer` translates the resulting `AbortError` into\n * a 499 (client-closed) so the client doesn't retry.\n */\nexport function httpDispatch<TScenario extends Scenario, TArtifact>(\n opts: HttpDispatchOptions<TScenario, TArtifact>,\n): Dispatch<TScenario, TArtifact> {\n if (!opts.url && !opts.resolveUrl) {\n throw new Error('httpDispatch: pass exactly one of `url` or `resolveUrl`.')\n }\n if (opts.url && opts.resolveUrl) {\n throw new Error('httpDispatch: pass exactly one of `url` or `resolveUrl`, not both.')\n }\n const timeoutMs = opts.timeoutMs ?? 5 * 60 * 1000\n const maxRetries = opts.retries ?? 2\n const f: typeof fetch = opts.fetchImpl ?? ((...args) => fetch(...args))\n\n return async (scenario, ctx) => {\n const url =\n opts.url ?? opts.resolveUrl!({ scenario, placement: ctx.placement, cellId: ctx.cellId })\n const authValue = await resolveAuth(opts.auth)\n const body: HttpDispatchRequestBody<TScenario> = {\n scenario,\n cellId: ctx.cellId,\n runAttemptId: ctx.runAttemptId,\n rep: ctx.rep,\n generation: ctx.generation,\n seed: ctx.seed,\n placement: ctx.placement,\n cycleId: ctx.cycleId,\n }\n\n let lastError: unknown\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n // Compose the request signal: caller's signal OR our timeout.\n const ourTimeout = AbortSignal.timeout(timeoutMs)\n const combinedSignal = AbortSignal.any([ctx.signal, ourTimeout])\n try {\n const res = await f(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(authValue\n ? {\n Authorization: authValue.startsWith('Bearer ')\n ? authValue\n : `Bearer ${authValue}`,\n }\n : {}),\n ...opts.headers,\n },\n body: JSON.stringify(body),\n signal: combinedSignal,\n })\n if (!res.ok) {\n // 4xx is non-retryable (caller error, auth, bad scenario shape).\n // 5xx / 408 / 429 / 502 / 503 / 504 are retryable.\n const retryable = res.status >= 500 || res.status === 408 || res.status === 429\n if (!retryable || attempt === maxRetries) {\n const text = await res.text().catch(() => '')\n throw new Error(`httpDispatch ${url} failed (${res.status}): ${text.slice(0, 500)}`)\n }\n // exponential backoff with jitter\n await sleep(2 ** attempt * 200 + Math.random() * 200)\n continue\n }\n const parsed = (await res.json()) as HttpDispatchResponseBody<TArtifact>\n return parsed.artifact\n } catch (err) {\n // Caller-driven abort is terminal — never retry.\n if (ctx.signal.aborted) throw err\n lastError = err\n if (attempt === maxRetries) throw err\n await sleep(2 ** attempt * 200 + Math.random() * 200)\n }\n }\n throw lastError ?? new Error('httpDispatch exhausted retries')\n }\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => {\n const t = setTimeout(resolve, ms)\n // Don't keep node process alive purely for backoff sleeps.\n if (typeof (t as { unref?: () => void }).unref === 'function')\n (t as { unref: () => void }).unref()\n })\n}\n\n// ── Server ───────────────────────────────────────────────────────────\n\nexport interface RunDispatchServerOptions<TScenario extends Scenario, TArtifact> {\n /** The Dispatch this server exposes — what runs when a request lands. */\n dispatch: Dispatch<TScenario, TArtifact>\n /** TCP port to bind. */\n port: number\n /** Optional bind host; defaults to 0.0.0.0. */\n host?: string\n /** Required for any non-test deployment: the bearer token clients must\n * send. The substrate refuses to start without auth unless `auth: false`\n * is set explicitly (intended ONLY for closed-network/internal testing). */\n auth: string | false\n /** Path the server listens on. Default `/dispatch`. */\n path?: string\n /**\n * Per-request handler that wraps `dispatch` with whatever context the\n * worker side needs to construct a `DispatchContext` — typically the\n * trace writer, artifact writer, and cost meter. The substrate provides\n * synthetic-but-typed defaults if not supplied; production deployments\n * should wire real ones (e.g. ship traces to your OTel collector).\n */\n contextFactory?: (\n req: HttpDispatchRequestBody<TScenario>,\n signal: AbortSignal,\n ) => Promise<DispatchContext>\n /** Optional max payload size for the request body (bytes). Default 10 MB. */\n maxBodyBytes?: number\n /** Hook for observability — called on every successful or failed turn. */\n onRequest?: (event: {\n cellId: string\n durationMs: number\n success: boolean\n error?: unknown\n }) => void\n}\n\nexport interface DispatchServerHandle {\n /** The actual bound port (useful when `port: 0` requests an ephemeral port). */\n port: number\n /** Stop accepting new connections and drain existing ones. */\n close: () => Promise<void>\n}\n\n/**\n * Start an HTTP server exposing a local `Dispatch` over the wire. Pair with\n * `httpDispatch` on the driver side.\n *\n * Wire shape:\n *\n * POST /dispatch\n * Authorization: Bearer <token>\n * Body: HttpDispatchRequestBody\n * 200 OK: HttpDispatchResponseBody\n * 401: missing/invalid auth\n * 408: per-request timeout exceeded\n * 499: client aborted before completion\n * 500: dispatch threw\n *\n * The server is `node:http`-based to keep the runtime dependency surface\n * minimal — works in plain Node, sandbox, or any container.\n */\nexport async function runDispatchServer<TScenario extends Scenario, TArtifact>(\n opts: RunDispatchServerOptions<TScenario, TArtifact>,\n): Promise<DispatchServerHandle> {\n if (opts.auth === undefined) {\n throw new Error(\n \"runDispatchServer: 'auth' is required (pass a bearer-token string, or `auth: false` explicitly for a closed-network test deployment).\",\n )\n }\n const path = opts.path ?? '/dispatch'\n const maxBytes = opts.maxBodyBytes ?? 10 * 1024 * 1024\n const expectedAuth =\n typeof opts.auth === 'string' ? `Bearer ${opts.auth.replace(/^Bearer\\s+/, '')}` : null\n\n // Lazy-import node:http so the file is usable from non-Node bundlers\n // that import the client side only (e.g. an edge driver shipping\n // httpDispatch alone). Server side is opt-in by calling this function.\n const { createServer } = await import('node:http')\n\n const server = createServer(async (req, res) => {\n const start = Date.now()\n let cellId = 'unknown'\n let success = false\n let errCaught: unknown\n\n try {\n if (req.method !== 'POST' || req.url?.split('?')[0] !== path) {\n res.statusCode = 404\n res.end('not found')\n return\n }\n if (expectedAuth) {\n const got = req.headers.authorization\n if (got !== expectedAuth) {\n res.statusCode = 401\n res.end('unauthorized')\n return\n }\n }\n\n // Read body up to maxBytes\n const chunks: Buffer[] = []\n let totalBytes = 0\n const aborter = new AbortController()\n // The request stream's 'close' fires when the BODY completes, so it\n // cannot signal disconnection. The response stream's 'close' fires\n // once per exchange: with `writableEnded` still false it means the\n // client went away before the dispatch answered.\n res.on('close', () => {\n if (!res.writableEnded) aborter.abort()\n })\n\n for await (const chunk of req) {\n const buf = chunk as Buffer\n totalBytes += buf.length\n if (totalBytes > maxBytes) {\n res.statusCode = 413\n res.end('payload too large')\n return\n }\n chunks.push(buf)\n }\n\n const body = JSON.parse(\n Buffer.concat(chunks).toString('utf8'),\n ) as HttpDispatchRequestBody<TScenario>\n if (typeof body.runAttemptId !== 'string' || body.runAttemptId.trim().length === 0) {\n throw new Error('runDispatchServer: request runAttemptId is required')\n }\n cellId = body.cellId\n\n const ctx: DispatchContext = opts.contextFactory\n ? await opts.contextFactory(body, aborter.signal)\n : {\n cellId: body.cellId,\n runAttemptId: body.runAttemptId,\n rep: body.rep,\n generation: body.generation,\n seed: body.seed,\n signal: aborter.signal,\n placement: body.placement,\n cycleId: body.cycleId,\n trace: NOOP_TRACE,\n artifacts: NOOP_ARTIFACTS,\n cost: NOOP_COST,\n }\n if (ctx.runAttemptId !== body.runAttemptId) {\n throw new Error('runDispatchServer: contextFactory must preserve request runAttemptId')\n }\n\n const artifact = await opts.dispatch(body.scenario, ctx)\n const responseBody: HttpDispatchResponseBody<TArtifact> = { artifact }\n\n res.statusCode = 200\n res.setHeader('content-type', 'application/json')\n res.end(JSON.stringify(responseBody))\n success = true\n } catch (err) {\n errCaught = err\n // Client-cancelled — they don't care about the result.\n if ((err as Error)?.name === 'AbortError') {\n res.statusCode = 499\n res.end('client aborted')\n return\n }\n res.statusCode = 500\n res.setHeader('content-type', 'application/json')\n res.end(JSON.stringify({ error: err instanceof Error ? err.message : String(err) }))\n } finally {\n opts.onRequest?.({\n cellId,\n durationMs: Date.now() - start,\n success,\n error: errCaught,\n })\n }\n })\n\n await new Promise<void>((resolve, reject) => {\n server.once('error', reject)\n server.listen(opts.port, opts.host ?? '0.0.0.0', () => resolve())\n })\n\n const addr = server.address()\n const boundPort = typeof addr === 'object' && addr ? addr.port : opts.port\n\n return {\n port: boundPort,\n close: () =>\n new Promise<void>((resolve, reject) => {\n server.close((err) => (err ? reject(err) : resolve()))\n }),\n }\n}\n\n// ── No-op default ctx machinery (worker can replace via contextFactory) ──\n\nconst NOOP_TRACE = {\n span: () => ({\n end: () => {},\n setAttribute: () => {},\n setStatus: () => {},\n recordException: () => {},\n addEvent: () => {},\n }),\n} as unknown as DispatchContext['trace']\n\nconst NOOP_ARTIFACTS = {\n write: async () => undefined,\n read: async () => undefined,\n list: async () => [],\n} as unknown as DispatchContext['artifacts']\n\nconst NOOP_COST = {\n record: () => {},\n total: () => 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