@tangle-network/agent-eval 0.150.2 → 0.161.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (342) hide show
  1. package/CHANGELOG.md +158 -1
  2. package/README.md +7 -3
  3. package/dist/{active-curriculum-C4mk67HP.js → active-curriculum-CD5TU2yW.js} +3 -13
  4. package/dist/active-curriculum-CD5TU2yW.js.map +1 -0
  5. package/dist/{agent-profile-cell-BkcRDikH.d.ts → agent-profile-cell-CTOZJUuE.d.ts} +4 -2
  6. package/dist/agent-profile-cell-CTOZJUuE.d.ts.map +1 -0
  7. package/dist/analyst/index.d.ts +19 -36
  8. package/dist/analyst/index.d.ts.map +1 -1
  9. package/dist/analyst/index.js +8 -8
  10. package/dist/analyst/index.js.map +1 -1
  11. package/dist/{backend-integrity-DOCa_QrR.d.ts → backend-integrity-DxuQCu_A.d.ts} +4 -3
  12. package/dist/backend-integrity-DxuQCu_A.d.ts.map +1 -0
  13. package/dist/{benchmark-BtAWA8nT.d.ts → benchmark-CGPp-kDC.d.ts} +3 -3
  14. package/dist/{benchmark-BtAWA8nT.d.ts.map → benchmark-CGPp-kDC.d.ts.map} +1 -1
  15. package/dist/{benchmark-command-BU1Las59.js → benchmark-command-BDC3Gocz.js} +26 -31
  16. package/dist/benchmark-command-BDC3Gocz.js.map +1 -0
  17. package/dist/benchmarks/index.d.ts +6 -19
  18. package/dist/benchmarks/index.d.ts.map +1 -1
  19. package/dist/benchmarks/index.js +4 -4
  20. package/dist/benchmarks/index.js.map +1 -1
  21. package/dist/builder-eval/index.d.ts +3 -3
  22. package/dist/builder-eval/index.js +2 -2
  23. package/dist/campaign/index.d.ts +9 -9
  24. package/dist/campaign/index.js +7 -7
  25. package/dist/{campaign-la-gEYNz.js → campaign-BSmOwskD.js} +77 -795
  26. package/dist/campaign-BSmOwskD.js.map +1 -0
  27. package/dist/{canonical-D-XsTQ6_.js → canonical-IL-Bu-14.js} +26 -2
  28. package/dist/canonical-IL-Bu-14.js.map +1 -0
  29. package/dist/{capture-fetch-BBVFzhkk.d.ts → capture-fetch-CqwsJkkG.d.ts} +3 -3
  30. package/dist/{capture-fetch-BBVFzhkk.d.ts.map → capture-fetch-CqwsJkkG.d.ts.map} +1 -1
  31. package/dist/{chat-client-Bvmxedyv.js → chat-client-DlMlAeYI.js} +5 -55
  32. package/dist/{chat-client-Bvmxedyv.js.map → chat-client-DlMlAeYI.js.map} +1 -1
  33. package/dist/chat-json-call-6g5sJobJ.js +53 -0
  34. package/dist/chat-json-call-6g5sJobJ.js.map +1 -0
  35. package/dist/cli.js +54 -19
  36. package/dist/cli.js.map +1 -1
  37. package/dist/{client-LIuo-KPv.js → client-CX7KqIdB.js} +3 -3
  38. package/dist/client-CX7KqIdB.js.map +1 -0
  39. package/dist/{client-kPQYT_56.d.ts → client-L9VVPkim.d.ts} +4 -4
  40. package/dist/{client-kPQYT_56.d.ts.map → client-L9VVPkim.d.ts.map} +1 -1
  41. package/dist/contract/index.d.ts +13 -27
  42. package/dist/contract/index.d.ts.map +1 -1
  43. package/dist/contract/index.js +14 -17
  44. package/dist/contract/index.js.map +1 -1
  45. package/dist/{counterfactual--bpysZF0.d.ts → counterfactual-BaFUWK3H.d.ts} +4 -4
  46. package/dist/{counterfactual--bpysZF0.d.ts.map → counterfactual-BaFUWK3H.d.ts.map} +1 -1
  47. package/dist/{counterfactual-lDfCx0Uz.js → counterfactual-D_VWavVm.js} +2 -2
  48. package/dist/{counterfactual-lDfCx0Uz.js.map → counterfactual-D_VWavVm.js.map} +1 -1
  49. package/dist/{dataset-CJjKqQfA.d.ts → dataset-DQqhOCPt.d.ts} +5 -4
  50. package/dist/{dataset-CJjKqQfA.d.ts.map → dataset-DQqhOCPt.d.ts.map} +1 -1
  51. package/dist/{default-registry-Cw0Ohdoj.d.ts → default-registry-G9CKMNkc.d.ts} +7 -8
  52. package/dist/{default-registry-Cw0Ohdoj.d.ts.map → default-registry-G9CKMNkc.d.ts.map} +1 -1
  53. package/dist/{define-agent-eval-CEQWL9Hy.d.ts → define-agent-eval-Dx1JnPEa.d.ts} +26 -6
  54. package/dist/define-agent-eval-Dx1JnPEa.d.ts.map +1 -0
  55. package/dist/{define-agent-eval-C8V8sMqP.js → define-agent-eval-h-s-sI-v.js} +15 -9
  56. package/dist/define-agent-eval-h-s-sI-v.js.map +1 -0
  57. package/dist/{dspy-rlm-engine-CBYlPvNy.js → dspy-rlm-engine-DptEII26.js} +95 -15
  58. package/dist/dspy-rlm-engine-DptEII26.js.map +1 -0
  59. package/dist/{emitter-CPBAhxum.js → emitter-BpYFQPj4.js} +2 -18
  60. package/dist/emitter-BpYFQPj4.js.map +1 -0
  61. package/dist/{emitter-DGQGoLyj.d.ts → emitter-D_jYSGRd.d.ts} +4 -20
  62. package/dist/{emitter-DGQGoLyj.d.ts.map → emitter-D_jYSGRd.d.ts.map} +1 -1
  63. package/dist/{engine-BLzhNzoY.d.ts → engine-Cu5qD5Fc.d.ts} +9 -11
  64. package/dist/{engine-BLzhNzoY.d.ts.map → engine-Cu5qD5Fc.d.ts.map} +1 -1
  65. package/dist/{eval-campaign-CQuZrLR_.js → eval-campaign-BsXWL2-2.js} +17 -28
  66. package/dist/eval-campaign-BsXWL2-2.js.map +1 -0
  67. package/dist/{exact-types-ccQAyut1.d.ts → exact-types-qnexxJ1Z.d.ts} +2 -2
  68. package/dist/{exact-types-ccQAyut1.d.ts.map → exact-types-qnexxJ1Z.d.ts.map} +1 -1
  69. package/dist/{exec-y-DCLqK7.js → exec-D9WpA2p-.js} +2 -2
  70. package/dist/exec-D9WpA2p-.js.map +1 -0
  71. package/dist/experiment/index.d.ts +45 -11
  72. package/dist/experiment/index.d.ts.map +1 -1
  73. package/dist/experiment/index.js +30 -11
  74. package/dist/experiment/index.js.map +1 -1
  75. package/dist/{experiment-tracker-0MhuPArU.d.ts → experiment-tracker-DCO6Cz4s.d.ts} +2 -2
  76. package/dist/{experiment-tracker-0MhuPArU.d.ts.map → experiment-tracker-DCO6Cz4s.d.ts.map} +1 -1
  77. package/dist/{exporters-q9iL-2Jf.js → exporters-Df7TgHFv.js} +3 -3
  78. package/dist/exporters-Df7TgHFv.js.map +1 -0
  79. package/dist/{external-optimizer-contracts-DbLsm4Po.d.ts → external-optimizer-contracts-szBJ_1vh.d.ts} +2 -2
  80. package/dist/{external-optimizer-contracts-DbLsm4Po.d.ts.map → external-optimizer-contracts-szBJ_1vh.d.ts.map} +1 -1
  81. package/dist/{external-optimizer-process-x9oEXKsU.js → external-optimizer-process-WosTBChy.js} +4 -4
  82. package/dist/{external-optimizer-process-x9oEXKsU.js.map → external-optimizer-process-WosTBChy.js.map} +1 -1
  83. package/dist/{external-optimizer-subprocess-CKNb42oM.js → external-optimizer-subprocess-BIWbHpgD.js} +4 -4
  84. package/dist/{external-optimizer-subprocess-CKNb42oM.js.map → external-optimizer-subprocess-BIWbHpgD.js.map} +1 -1
  85. package/dist/{failure-cluster-BLURuWG4.d.ts → failure-cluster-CXL8NbEw.d.ts} +3 -3
  86. package/dist/{failure-cluster-BLURuWG4.d.ts.map → failure-cluster-CXL8NbEw.d.ts.map} +1 -1
  87. package/dist/{feedback-trajectory-DpTTjo0q.d.ts → feedback-trajectory-B3ZHaHV_.d.ts} +7 -7
  88. package/dist/{feedback-trajectory-DpTTjo0q.d.ts.map → feedback-trajectory-B3ZHaHV_.d.ts.map} +1 -1
  89. package/dist/fuzz.js +1 -1
  90. package/dist/{hf-dataset-XggBupCr.js → hf-dataset-D8_RNIis.js} +4 -4
  91. package/dist/{hf-dataset-XggBupCr.js.map → hf-dataset-D8_RNIis.js.map} +1 -1
  92. package/dist/hosted/index.d.ts +3 -14
  93. package/dist/hosted/index.d.ts.map +1 -1
  94. package/dist/hosted/index.js +2 -2
  95. package/dist/{index-Aj3WO3_a.d.ts → index-CGtH1piv.d.ts} +48 -26
  96. package/dist/index-CGtH1piv.d.ts.map +1 -0
  97. package/dist/{index-BNPtkBPf.d.ts → index-D-IiQIBB.d.ts} +5 -10
  98. package/dist/index-D-IiQIBB.d.ts.map +1 -0
  99. package/dist/{index-IQccV3Ou.d.ts → index-D-V8gCs_.d.ts} +13 -90
  100. package/dist/index-D-V8gCs_.d.ts.map +1 -0
  101. package/dist/{index-B8Ui1mr1.d.ts → index-lfaSeKSD.d.ts} +18 -2
  102. package/dist/index-lfaSeKSD.d.ts.map +1 -0
  103. package/dist/index-vrJugRal.d.ts +1 -0
  104. package/dist/index.d.ts +68 -56
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +59 -110
  107. package/dist/index.js.map +1 -1
  108. package/dist/{insight-report-BeT8KCgI.d.ts → insight-report-DRe8LB6d.d.ts} +4 -4
  109. package/dist/{insight-report-BeT8KCgI.d.ts.map → insight-report-DRe8LB6d.d.ts.map} +1 -1
  110. package/dist/{integrity-DL91tucI.js → integrity-CyWSSoQS.js} +2 -2
  111. package/dist/{integrity-DL91tucI.js.map → integrity-CyWSSoQS.js.map} +1 -1
  112. package/dist/{integrity-B0dZ96EO.d.ts → integrity-DUNX9Fao.d.ts} +3 -3
  113. package/dist/{integrity-B0dZ96EO.d.ts.map → integrity-DUNX9Fao.d.ts.map} +1 -1
  114. package/dist/{kind-factory-DmAa0h3K.js → kind-factory-DY8FdoXf.js} +3 -71
  115. package/dist/kind-factory-DY8FdoXf.js.map +1 -0
  116. package/dist/ledger-core/index.d.ts +2 -2
  117. package/dist/ledger-core/index.js +3 -3
  118. package/dist/{ledger-core-DTae9rv_.js → ledger-core-BOzlRygb.js} +2 -2
  119. package/dist/{ledger-core-DTae9rv_.js.map → ledger-core-BOzlRygb.js.map} +1 -1
  120. package/dist/{llm-client-Bg32RW0j.js → llm-client-hgDieDNN.js} +53 -98
  121. package/dist/llm-client-hgDieDNN.js.map +1 -0
  122. package/dist/{llm-judge-BqqMS8t7.js → llm-judge-BhasIPFT.js} +1135 -77
  123. package/dist/llm-judge-BhasIPFT.js.map +1 -0
  124. package/dist/{matrix-DrVnRp4G.d.ts → matrix-eXKRMHnL.d.ts} +74 -72
  125. package/dist/matrix-eXKRMHnL.d.ts.map +1 -0
  126. package/dist/meta-eval/index.d.ts +8 -6
  127. package/dist/meta-eval/index.d.ts.map +1 -1
  128. package/dist/meta-eval/index.js +8 -6
  129. package/dist/meta-eval/index.js.map +1 -1
  130. package/dist/{mint-BV6tLVWl.js → mint-DfODW1KW.js} +3 -3
  131. package/dist/{mint-BV6tLVWl.js.map → mint-DfODW1KW.js.map} +1 -1
  132. package/dist/multishot/golden/index.d.ts +2 -8
  133. package/dist/multishot/golden/index.d.ts.map +1 -1
  134. package/dist/multishot/golden/index.js +56 -86
  135. package/dist/multishot/golden/index.js.map +1 -1
  136. package/dist/multishot/index.d.ts +11 -46
  137. package/dist/multishot/index.d.ts.map +1 -1
  138. package/dist/multishot/index.js +30 -83
  139. package/dist/multishot/index.js.map +1 -1
  140. package/dist/openapi.json +1 -1
  141. package/dist/{opencode-sqlite-DJWAXLms.js → opencode-sqlite-eK6HW6dr.js} +2 -6
  142. package/dist/{opencode-sqlite-DJWAXLms.js.map → opencode-sqlite-eK6HW6dr.js.map} +1 -1
  143. package/dist/pipelines/index.d.ts +5 -5
  144. package/dist/pipelines/index.js +3 -3
  145. package/dist/{pre-registration-zFSLEiFU.d.ts → pre-registration-CzFCcwYk.d.ts} +55 -40
  146. package/dist/pre-registration-CzFCcwYk.d.ts.map +1 -0
  147. package/dist/pre-registration-KN9jkh58.js +110 -0
  148. package/dist/pre-registration-KN9jkh58.js.map +1 -0
  149. package/dist/{produced-state-Bnq4FaDO.js → produced-state-DZ89riy5.js} +8 -8
  150. package/dist/produced-state-DZ89riy5.js.map +1 -0
  151. package/dist/profile-cell.d.ts +1 -1
  152. package/dist/profile-cell.js +31 -5
  153. package/dist/profile-cell.js.map +1 -1
  154. package/dist/{promotion-policy-DLOUkYhI.d.ts → promotion-policy-DtnOIZvk.d.ts} +2 -2
  155. package/dist/{promotion-policy-DLOUkYhI.d.ts.map → promotion-policy-DtnOIZvk.d.ts.map} +1 -1
  156. package/dist/{query-Di7eEQ79.js → query-CHmMP42p.js} +20 -11
  157. package/dist/query-CHmMP42p.js.map +1 -0
  158. package/dist/{query-CJ_DX8vl.d.ts → query-DxPYqpmT.d.ts} +10 -4
  159. package/dist/query-DxPYqpmT.d.ts.map +1 -0
  160. package/dist/raw-provider-sink-BU29Sh8h.d.ts +134 -0
  161. package/dist/raw-provider-sink-BU29Sh8h.d.ts.map +1 -0
  162. package/dist/{registry-BQwrSYpC.d.ts → registry-8You7OK1.d.ts} +5 -7
  163. package/dist/{registry-BQwrSYpC.d.ts.map → registry-8You7OK1.d.ts.map} +1 -1
  164. package/dist/{release-confidence-BknrpBnO.js → release-confidence-DKfD2RYU.js} +28 -14
  165. package/dist/release-confidence-DKfD2RYU.js.map +1 -0
  166. package/dist/{release-confidence-4XrqlpFD.d.ts → release-confidence-Dqt0NFep.d.ts} +7 -6
  167. package/dist/release-confidence-Dqt0NFep.d.ts.map +1 -0
  168. package/dist/reporting.d.ts +3 -3
  169. package/dist/reporting.js +3 -3
  170. package/dist/{researcher-DJnoUE8c.d.ts → researcher-Cz565b7D.d.ts} +34 -21
  171. package/dist/researcher-Cz565b7D.d.ts.map +1 -0
  172. package/dist/{reward-hacking-62tojkQd.d.ts → reward-hacking-MBf7qpSB.d.ts} +2 -2
  173. package/dist/{reward-hacking-62tojkQd.d.ts.map → reward-hacking-MBf7qpSB.d.ts.map} +1 -1
  174. package/dist/{reward-hacking-C0x0xihA.js → reward-hacking-t4lB1yt8.js} +2 -2
  175. package/dist/{reward-hacking-C0x0xihA.js.map → reward-hacking-t4lB1yt8.js.map} +1 -1
  176. package/dist/rl.d.ts +11 -42
  177. package/dist/rl.d.ts.map +1 -1
  178. package/dist/rl.js +41 -24
  179. package/dist/rl.js.map +1 -1
  180. package/dist/rollout/index.d.ts +3 -3
  181. package/dist/rollout/index.js +7 -7
  182. package/dist/{rollout-ytVQ7WT8.js → rollout-Dm2tSdiQ.js} +6 -6
  183. package/dist/{rollout-ytVQ7WT8.js.map → rollout-Dm2tSdiQ.js.map} +1 -1
  184. package/dist/{rubric-predictive-validity-CzxLoZge.js → rubric-predictive-validity-CK8SCOg-.js} +5 -15
  185. package/dist/rubric-predictive-validity-CK8SCOg-.js.map +1 -0
  186. package/dist/{rubric-predictive-validity-C7LnNvF2.d.ts → rubric-predictive-validity-CxycqzX5.d.ts} +4 -3
  187. package/dist/rubric-predictive-validity-CxycqzX5.d.ts.map +1 -0
  188. package/dist/{run-record-D2lDdSAz.js → run-record-BC0ebuRP.js} +2 -2
  189. package/dist/{run-record-D2lDdSAz.js.map → run-record-BC0ebuRP.js.map} +1 -1
  190. package/dist/{run-record-DVV82Gwh.d.ts → run-record-VVy4T9OW.d.ts} +3 -3
  191. package/dist/{run-record-DVV82Gwh.d.ts.map → run-record-VVy4T9OW.d.ts.map} +1 -1
  192. package/dist/{schema-BtVldJ3T.d.ts → schema-Bjgdsn73.d.ts} +2 -4
  193. package/dist/{schema-BtVldJ3T.d.ts.map → schema-Bjgdsn73.d.ts.map} +1 -1
  194. package/dist/{schema-Cef2cFmb.d.ts → schema-BzWDXhOR.d.ts} +2 -5
  195. package/dist/schema-BzWDXhOR.d.ts.map +1 -0
  196. package/dist/{schema-C6DW4ZHR.js → schema-C1aaAxTf.js} +2 -2
  197. package/dist/schema-C1aaAxTf.js.map +1 -0
  198. package/dist/{schema-CRhEY1SO.js → schema-k6ZBftVv.js} +2 -8
  199. package/dist/{schema-CRhEY1SO.js.map → schema-k6ZBftVv.js.map} +1 -1
  200. package/dist/{semantic-concept-judge-laMCnTLn.js → semantic-concept-judge-BSkKKHeq.js} +14 -38
  201. package/dist/semantic-concept-judge-BSkKKHeq.js.map +1 -0
  202. package/dist/{sequential-eprocess-CbUt2htw.js → sequential-eprocess-D1jKoihe.js} +49 -2
  203. package/dist/sequential-eprocess-D1jKoihe.js.map +1 -0
  204. package/dist/{sequential-C458DXNf.js → sequential-rYW-Ophm.js} +41 -16
  205. package/dist/sequential-rYW-Ophm.js.map +1 -0
  206. package/dist/{series-convergence-BxKEgBwA.d.ts → series-convergence-D9WgpXGi.d.ts} +2 -2
  207. package/dist/{series-convergence-BxKEgBwA.d.ts.map → series-convergence-D9WgpXGi.d.ts.map} +1 -1
  208. package/dist/{server-dIWwF3j_.js → server-BtFd4uzB.js} +19 -42
  209. package/dist/server-BtFd4uzB.js.map +1 -0
  210. package/dist/{skillopt-optimization-method-CPBlTcj5.js → skillopt-optimization-method-DbaekMcn.js} +794 -8
  211. package/dist/skillopt-optimization-method-DbaekMcn.js.map +1 -0
  212. package/dist/{skillopt-optimization-method-BDD_o1xE.d.ts → skillopt-optimization-method-x7TTF23P.d.ts} +20 -7
  213. package/dist/{skillopt-optimization-method-BDD_o1xE.d.ts.map → skillopt-optimization-method-x7TTF23P.d.ts.map} +1 -1
  214. package/dist/{statistical-heldout-_woZ9q9j.d.ts → statistical-heldout-Cy3EhjlC.d.ts} +21 -8
  215. package/dist/statistical-heldout-Cy3EhjlC.d.ts.map +1 -0
  216. package/dist/{steps-AmkT-GIM.d.ts → steps-CiNVJry_.d.ts} +2 -17
  217. package/dist/steps-CiNVJry_.d.ts.map +1 -0
  218. package/dist/{store-CT9YIIve.d.ts → store-B06JdC56.d.ts} +2 -2
  219. package/dist/{store-CT9YIIve.d.ts.map → store-B06JdC56.d.ts.map} +1 -1
  220. package/dist/{store-otlp-CDYWW_8N.js → store-otlp-C_Rq5I4D.js} +2 -2
  221. package/dist/{store-otlp-CDYWW_8N.js.map → store-otlp-C_Rq5I4D.js.map} +1 -1
  222. package/dist/{store-tool-spans-Br2_IUhm.d.ts → store-tool-spans-DPUG7UUY.d.ts} +6 -6
  223. package/dist/{store-tool-spans-Br2_IUhm.d.ts.map → store-tool-spans-DPUG7UUY.d.ts.map} +1 -1
  224. package/dist/{store-tool-spans-CykkbOlv.js → store-tool-spans-Dlh9vkFK.js} +3 -3
  225. package/dist/{store-tool-spans-CykkbOlv.js.map → store-tool-spans-Dlh9vkFK.js.map} +1 -1
  226. package/dist/storyboard/index.d.ts +1 -1
  227. package/dist/{summary-report-DW2bEpdB.js → summary-report-BI5hUtvK.js} +6 -16
  228. package/dist/summary-report-BI5hUtvK.js.map +1 -0
  229. package/dist/{summary-report-B__Y5ub3.d.ts → summary-report-CC07PhEL.d.ts} +6 -5
  230. package/dist/summary-report-CC07PhEL.d.ts.map +1 -0
  231. package/dist/supervisor-run/index.d.ts +3 -16
  232. package/dist/supervisor-run/index.d.ts.map +1 -1
  233. package/dist/supervisor-run/index.js +3 -3
  234. package/dist/supervisor-run/index.js.map +1 -1
  235. package/dist/{task-failure-attributes--ZTP3tYO.js → task-failure-attributes-DTl-7-Kw.js} +3 -3
  236. package/dist/{task-failure-attributes--ZTP3tYO.js.map → task-failure-attributes-DTl-7-Kw.js.map} +1 -1
  237. package/dist/{tool-groups-B4tqh8jB.d.ts → tool-groups-Ci8i9ErB.d.ts} +3 -3
  238. package/dist/tool-groups-Ci8i9ErB.d.ts.map +1 -0
  239. package/dist/{tool-waste-C-VHSRwF.js → tool-waste-BqzmVdJk.js} +2 -2
  240. package/dist/{tool-waste-C-VHSRwF.js.map → tool-waste-BqzmVdJk.js.map} +1 -1
  241. package/dist/{tool-waste-DjRDEsuI.d.ts → tool-waste-Dro0gJi3.d.ts} +4 -4
  242. package/dist/{tool-waste-DjRDEsuI.d.ts.map → tool-waste-Dro0gJi3.d.ts.map} +1 -1
  243. package/dist/trace-repair/index.d.ts +4 -77
  244. package/dist/trace-repair/index.d.ts.map +1 -1
  245. package/dist/trace-repair/index.js +5 -15
  246. package/dist/trace-repair/index.js.map +1 -1
  247. package/dist/traces.d.ts +13 -23
  248. package/dist/traces.d.ts.map +1 -1
  249. package/dist/traces.js +9 -20
  250. package/dist/traces.js.map +1 -1
  251. package/dist/{trajectory-YC15QDYQ.d.ts → trajectory-Bi157Gun.d.ts} +3 -3
  252. package/dist/{trajectory-YC15QDYQ.d.ts.map → trajectory-Bi157Gun.d.ts.map} +1 -1
  253. package/dist/trajectory-replay/index.d.ts +5 -5
  254. package/dist/trajectory-replay/index.js +5 -5
  255. package/dist/{provenance-oA4-zUqm.d.ts → transient-failure-DKF5Mofa.d.ts} +468 -13
  256. package/dist/transient-failure-DKF5Mofa.d.ts.map +1 -0
  257. package/dist/types-B3jzCp0p.js.map +1 -1
  258. package/dist/{types-CLAwnY-L.d.ts → types-BPb2Kf_C2.d.ts} +3 -3
  259. package/dist/types-BPb2Kf_C2.d.ts.map +1 -0
  260. package/dist/types-Bfk0uxRj.d.ts +443 -0
  261. package/dist/types-Bfk0uxRj.d.ts.map +1 -0
  262. package/dist/{types-DdFNuyxQ.d.ts → types-D4s7Z6nq.d.ts} +30 -6
  263. package/dist/types-D4s7Z6nq.d.ts.map +1 -0
  264. package/dist/{types-B2NsbrNy.d.ts → types-D9ssmxKL.d.ts} +3 -3
  265. package/dist/{types-B2NsbrNy.d.ts.map → types-D9ssmxKL.d.ts.map} +1 -1
  266. package/dist/{types-I5WwVzQ7.d.ts → types-DeIUdzNd.d.ts} +2 -2
  267. package/dist/{types-I5WwVzQ7.d.ts.map → types-DeIUdzNd.d.ts.map} +1 -1
  268. package/dist/{verdict-BndeTAh_.js → verdict-B0xltqu6.js} +2 -2
  269. package/dist/{verdict-BndeTAh_.js.map → verdict-B0xltqu6.js.map} +1 -1
  270. package/dist/verdict-cache-CdVVTVmn.js +88 -0
  271. package/dist/verdict-cache-CdVVTVmn.js.map +1 -0
  272. package/dist/wire/index.d.ts +21 -111
  273. package/dist/wire/index.d.ts.map +1 -1
  274. package/dist/wire/index.js +2 -2
  275. package/docs/building-doctrine.md +3 -3
  276. package/docs/campaign-proposers.md +41 -10
  277. package/docs/design/statistics-decisions.md +89 -1
  278. package/docs/eval-surface-map.md +14 -0
  279. package/docs/experiment.md +19 -2
  280. package/docs/feedback-trajectories.md +1 -1
  281. package/docs/multishot-golden-records.md +4 -4
  282. package/docs/public-api.md +1616 -0
  283. package/docs/research-report-methodology.md +1 -1
  284. package/docs/search-history-receipts.md +39 -1
  285. package/docs/trace-analysis.md +1 -1
  286. package/docs/trace-repair-admission.md +1 -1
  287. package/docs/trace-repair-continuation.md +1 -1
  288. package/docs/verdicts.md +24 -0
  289. package/package.json +7 -3
  290. package/dist/active-curriculum-C4mk67HP.js.map +0 -1
  291. package/dist/agent-profile-cell-BkcRDikH.d.ts.map +0 -1
  292. package/dist/backend-integrity-DOCa_QrR.d.ts.map +0 -1
  293. package/dist/benchmark-command-BU1Las59.js.map +0 -1
  294. package/dist/campaign-la-gEYNz.js.map +0 -1
  295. package/dist/canonical-D-XsTQ6_.js.map +0 -1
  296. package/dist/client-LIuo-KPv.js.map +0 -1
  297. package/dist/define-agent-eval-C8V8sMqP.js.map +0 -1
  298. package/dist/define-agent-eval-CEQWL9Hy.d.ts.map +0 -1
  299. package/dist/dspy-rlm-engine-CBYlPvNy.js.map +0 -1
  300. package/dist/emitter-CPBAhxum.js.map +0 -1
  301. package/dist/eval-campaign-CQuZrLR_.js.map +0 -1
  302. package/dist/exec-y-DCLqK7.js.map +0 -1
  303. package/dist/exporters-q9iL-2Jf.js.map +0 -1
  304. package/dist/index-Aj3WO3_a.d.ts.map +0 -1
  305. package/dist/index-B8Ui1mr1.d.ts.map +0 -1
  306. package/dist/index-BNPtkBPf.d.ts.map +0 -1
  307. package/dist/index-C1ravkGA.d.ts +0 -1
  308. package/dist/index-IQccV3Ou.d.ts.map +0 -1
  309. package/dist/kind-factory-DmAa0h3K.js.map +0 -1
  310. package/dist/llm-client-Bg32RW0j.js.map +0 -1
  311. package/dist/llm-judge-BqqMS8t7.js.map +0 -1
  312. package/dist/matrix-DrVnRp4G.d.ts.map +0 -1
  313. package/dist/pre-registration-DakwTRXk.js +0 -96
  314. package/dist/pre-registration-DakwTRXk.js.map +0 -1
  315. package/dist/pre-registration-zFSLEiFU.d.ts.map +0 -1
  316. package/dist/produced-state-Bnq4FaDO.js.map +0 -1
  317. package/dist/provenance-oA4-zUqm.d.ts.map +0 -1
  318. package/dist/query-CJ_DX8vl.d.ts.map +0 -1
  319. package/dist/query-Di7eEQ79.js.map +0 -1
  320. package/dist/release-confidence-4XrqlpFD.d.ts.map +0 -1
  321. package/dist/release-confidence-BknrpBnO.js.map +0 -1
  322. package/dist/researcher-DJnoUE8c.d.ts.map +0 -1
  323. package/dist/rubric-predictive-validity-C7LnNvF2.d.ts.map +0 -1
  324. package/dist/rubric-predictive-validity-CzxLoZge.js.map +0 -1
  325. package/dist/schema-C6DW4ZHR.js.map +0 -1
  326. package/dist/schema-Cef2cFmb.d.ts.map +0 -1
  327. package/dist/semantic-concept-judge-laMCnTLn.js.map +0 -1
  328. package/dist/sequential-C458DXNf.js.map +0 -1
  329. package/dist/sequential-eprocess-CbUt2htw.js.map +0 -1
  330. package/dist/server-dIWwF3j_.js.map +0 -1
  331. package/dist/skillopt-optimization-method-CPBlTcj5.js.map +0 -1
  332. package/dist/statistical-heldout-_woZ9q9j.d.ts.map +0 -1
  333. package/dist/steps-AmkT-GIM.d.ts.map +0 -1
  334. package/dist/summary-report-B__Y5ub3.d.ts.map +0 -1
  335. package/dist/summary-report-DW2bEpdB.js.map +0 -1
  336. package/dist/tool-groups-B4tqh8jB.d.ts.map +0 -1
  337. package/dist/types-CLAwnY-L.d.ts.map +0 -1
  338. package/dist/types-DdFNuyxQ.d.ts.map +0 -1
  339. package/dist/types-jUBXJ7Iz.d.ts +0 -884
  340. package/dist/types-jUBXJ7Iz.d.ts.map +0 -1
  341. package/dist/verdict-cache-mZf5FEiY.js +0 -107
  342. package/dist/verdict-cache-mZf5FEiY.js.map +0 -1
@@ -1,10 +1,10 @@
1
1
  import { c as CostLedgerHandle } from "./cost-ledger-DbQdN3nO.js";
2
- import { a as RunRecord } from "./run-record-DVV82Gwh.js";
3
- import { E as LlmCallMetadata, Y as ServedModelPolicy, p as ChatClient } from "./types-jUBXJ7Iz.js";
4
- import { _ as ExternalTextCandidate, c as ExternalOptimizerModelBudget, h as ExternalOptimizerRunnerCommand, l as ExternalOptimizerModelCall, m as ExternalOptimizerResumeMode, r as ExternalOptimizerCallbackLimits, v as ExternalTextEvaluationRequest } from "./external-optimizer-contracts-DbLsm4Po.js";
5
- import { R as Scenario, S as JudgeConfig, i as CampaignCostMeter, j as MutableSurface, o as CampaignScenarioIdentity, p as Gate } from "./types-DdFNuyxQ.js";
6
- import { Q as OptimizationPackageSource, W as OptimizationMethod, k as RedTeamCase, z as CanaryOptions } from "./provenance-oA4-zUqm.js";
7
- import { t as DetectRewardHackingInput } from "./reward-hacking-62tojkQd.js";
2
+ import { a as RunRecord } from "./run-record-VVy4T9OW.js";
3
+ import { Qn as ServedModelPolicy, V as SearchRunIdentity, W as RedTeamCase, at as OptimizationMethod, et as CanaryOptions, pt as OptimizationPackageSource } from "./transient-failure-DKF5Mofa.js";
4
+ import { C as LlmCallMetadata, p as ChatClient } from "./types-Bfk0uxRj.js";
5
+ import { _ as ExternalTextCandidate, c as ExternalOptimizerModelBudget, h as ExternalOptimizerRunnerCommand, l as ExternalOptimizerModelCall, m as ExternalOptimizerResumeMode, r as ExternalOptimizerCallbackLimits, v as ExternalTextEvaluationRequest } from "./external-optimizer-contracts-szBJ_1vh.js";
6
+ import { R as Scenario, S as JudgeConfig, i as CampaignCostMeter, j as MutableSurface, o as CampaignScenarioIdentity, p as Gate } from "./types-D4s7Z6nq.js";
7
+ import { t as DetectRewardHackingInput } from "./reward-hacking-MBf7qpSB.js";
8
8
  //#region src/reference-equivalence-judge.d.ts
9
9
  declare const REFERENCE_EQUIVALENCE_JUDGE_VERSION = "reference-equivalence-judge-v1-2026-07-13";
10
10
  declare const REFERENCE_EQUIVALENCE_INPUT_LIMITS: {
@@ -377,6 +377,19 @@ interface GepaOptimizationMethodConfig<TScenario extends Scenario, TArtifact = u
377
377
  */
378
378
  trustResumeState?: boolean;
379
379
  runner?: GepaRunnerCommand;
380
+ /**
381
+ * Record GEPA's own candidate population into the canonical `SearchLedger`
382
+ * and return the bounded receipt on the method result, so a comparison run
383
+ * under `searchHistoryPolicy: 'require-complete'` accepts this method.
384
+ *
385
+ * `identity` declares the immutable revisions and the model snapshot the
386
+ * ledger requires and the bridge does not report. `path` defaults to
387
+ * `<runDir>/search-ledger.jsonl`.
388
+ */
389
+ searchLedger?: {
390
+ identity: SearchRunIdentity;
391
+ path?: string;
392
+ };
380
393
  }
381
394
  declare function gepaOptimizationMethod<TScenario extends Scenario, TArtifact>(config: GepaOptimizationMethodConfig<TScenario, TArtifact>): OptimizationMethod<TScenario, TArtifact>;
382
395
  //#endregion
@@ -437,4 +450,4 @@ interface SkillOptOptimizationMethodConfig<TScenario extends Scenario, TArtifact
437
450
  declare function skillOptOptimizationMethod<TScenario extends Scenario, TArtifact>(config: SkillOptOptimizationMethodConfig<TScenario, TArtifact>): OptimizationMethod<TScenario, TArtifact>;
438
451
  //#endregion
439
452
  export { campaignScenarioIdentity as A, runReferenceEquivalenceJudge as B, ExternalTextOptimizerContext as C, decodeExternalTextCandidate as D, ExternalTextEvaluationResponse as E, ReferenceEquivalenceJudgeInput as F, ReferenceEquivalenceJudgeOptions as I, ReferenceEquivalenceJudgeResult as L, campaignSplitDigestFromIdentities as M, REFERENCE_EQUIVALENCE_INPUT_LIMITS as N, assertCampaignDesign as O, REFERENCE_EQUIVALENCE_JUDGE_VERSION as P, ReferenceEquivalenceScenario as R, ExternalTextOptimizationMethodConfig as S, ExternalOptimizationExample as T, DefaultProductionGateOptions as _, GepaAdaptiveEngineRun as a, composeGate as b, GepaOptimizationMethodConfig as c, gepaOptimizationMethod as d, OpenAICompatibleOptimizerModel as f, DefaultProductionGateCheck as g, heldOutGate as h, skillOptOptimizationMethod as i, campaignSplitDigest as j, assertCampaignSplitIdentity as k, GepaOptimizationRecipe as l, HeldOutGateOptions as m, SkillOptRunnerCommand as n, GepaEngineOptions as o, OptimizerModelBudget as p, SkillOptTrainerConfig as r, GepaEngineRun as s, SkillOptOptimizationMethodConfig as t, GepaRunnerCommand as u, DefaultProductionRewardHackingOptions as v, ExternalTextOptimizerResult as w, externalTextOptimizationMethod as x, defaultProductionGate as y, createReferenceEquivalenceJudge as z };
440
- //# sourceMappingURL=skillopt-optimization-method-BDD_o1xE.d.ts.map
453
+ //# sourceMappingURL=skillopt-optimization-method-x7TTF23P.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"skillopt-optimization-method-BDD_o1xE.d.ts","names":[],"sources":["../src/reference-equivalence-judge.ts","../src/campaign/coverage.ts","../src/campaign/external-text-evaluation.ts","../src/campaign/external-text-optimization-contract.ts","../src/campaign/external-text-optimization.ts","../src/campaign/gates/compose.ts","../src/campaign/gates/default-production-gate.ts","../src/campaign/gates/heldout-gate.ts","../src/campaign/optimizer-model.ts","../src/campaign/gepa-optimization-method.ts","../src/campaign/skillopt-optimization-method.ts"],"mappings":";;;;;;;;cAOa;cAEA;WACX;WACA;WACA;;UAGe,qCAAqC;EACpD;EACA;;UAGe;EACf;EACA;EACA;;UAGe;;EAEf,MAAM;;EAEN;;EAEA,SAAS;;EAET,aAAa;;UAGE,wCAAwC;EACvD;EACA;EACA;EACA;;;iBA0Bc,gCACd,SAAS,mCACR,oBAAoB;;iBA2CD,6BACpB,OAAO,gCACP,SAAS,mCACR,QAAQ;;;;iBCxGK,qBAAqB,kBAAkB,UACrD,oBAAoB,aACpB;;iBA2Bc,yBAAyB,kBAAkB,UACzD,UAAU,YACT,2BAA2B,KAAK;;iBAUnB,kCACd,oBAAoB,4BACpB;;iBAgBc,oBAAoB,kBAAkB,UACpD,oBAAoB,aACpB;;iBAOc,4BACd,oBAAoB,4BACpB,cACA;;;UCpEe;EACf;EACA;;UAGe;EACf;EACA;IACE;IACA,YAAY;IACZ;IACA;;;IAGA;IACA;MACE;MACA;;;;iBAwHU,4BAA4B,WAAW,wBAAwB;;;UC3I9D;WACN;WACA;WACA;WACA;WACA;WACA,eAAe;WACf,mBAAmB;WACnB,uBAAuB;WACvB;WACA;;WAEA;WACA;WACA;WACA,QAAQ;;WAER,MAAM;WACN,WACP,SAFa,kCAGV,QAAQ;;UAGE;EACf,eAAe;EACf;EAC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ACf;;EAGA;EACA,kBAAkB;EAClB,cAAc;EACd;;;KAIM,oBAAoB;UAEf,6BAA6B,kBAAkB,UAAU;;EAExE;;EAEA,QAAQ;;EAER;;EAEA;;EAEA;;;;;EAKA;;EAEA;;EAEA;;EAEA,2BAA2B,QAAQ;;EAEnC;;;;;;EAMA,YAAY;;;;;;EAMZ,oBAAoB,UAAU;;EAE9B,oBAAoB,UAAU,WAAW,UAAU;;EAEnD,SAAS;;;;;EAKT;EACA,SAAS;;iBA6CK,uBAAuB,kBAAkB,UAAU,WACjE,QAAQ,6BAA6B,WAAW,aAC/C,mBAAmB,WAAW;;;UC/KhB;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;EAKA,YAAY;;KAGF,wBAAwB;UAEnB,iCAAiC,kBAAkB,UAAU;EAC5E;;EAEA;EACA;;EAEA;EACA,SAAS;;;;;EAKT,WAAW;;EAEX;;EAEA;EACA;;EAEA;;EAEA,2BAA2B,QAAQ;EACnC;EACA,oBAAoB,UAAU;EAC9B,oBAAoB,UAAU,WAAW,UAAU;EACnD,SAAS;EACT,SAAS;;;iBAIK,2BAA2B,kBAAkB,UAAU,WACrE,QAAQ,iCAAiC,WAAW,aACnD,mBAAmB,WAAW"}
1
+ {"version":3,"file":"skillopt-optimization-method-x7TTF23P.d.ts","names":[],"sources":["../src/reference-equivalence-judge.ts","../src/campaign/coverage.ts","../src/campaign/external-text-evaluation.ts","../src/campaign/external-text-optimization-contract.ts","../src/campaign/external-text-optimization.ts","../src/campaign/gates/compose.ts","../src/campaign/gates/default-production-gate.ts","../src/campaign/gates/heldout-gate.ts","../src/campaign/optimizer-model.ts","../src/campaign/gepa-optimization-method.ts","../src/campaign/skillopt-optimization-method.ts"],"mappings":";;;;;;;;cAOa;cAEA;WACX;WACA;WACA;;UAGe,qCAAqC;EACpD;EACA;;UAGe;EACf;EACA;EACA;;UAGe;;EAEf,MAAM;;EAEN;;EAEA,SA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U;EAC5E;;EAEA;EACA;;EAEA;EACA,SAAS;;;;;EAKT,WAAW;;EAEX;;EAEA;EACA;;EAEA;;EAEA,2BAA2B,QAAQ;EACnC;EACA,oBAAoB,UAAU;EAC9B,oBAAoB,UAAU,WAAW,UAAU;EACnD,SAAS;EACT,SAAS;;;iBAIK,2BAA2B,kBAAkB,UAAU,WACrE,QAAQ,iCAAiC,WAAW,aACnD,mBAAmB,WAAW"}
@@ -1,5 +1,5 @@
1
- import { R as Scenario, b as GenerationRecord, p as Gate, w as JudgeScore } from "./types-DdFNuyxQ.js";
2
- import { r as SignedManifest, w as EProcessState } from "./pre-registration-zFSLEiFU.js";
1
+ import { R as Scenario, b as GenerationRecord, p as Gate, w as JudgeScore } from "./types-D4s7Z6nq.js";
2
+ import { T as EProcessState, r as SignedManifest } from "./pre-registration-CzFCcwYk.js";
3
3
  import { a as PairedPromotionDecision, d as PairedBootstrapResult, i as PairedMcNemarEvidence, r as PairedDecisionStatistic, t as PairedDecisionMethod } from "./paired-promotion-decision-CGzg0cI_.js";
4
4
  //#region src/campaign/gates/sequential.d.ts
5
5
  type SequentialDecision = 'promote' | 'continue' | 'undecided-at-maxN';
@@ -38,7 +38,21 @@ interface SequentialPairedGateOptions {
38
38
  preRegistration?: SignedManifest;
39
39
  /** Override the gate name in reports. */
40
40
  name?: string;
41
+ /** Continue the observe-stream from a `state()` snapshot taken before a
42
+ * restart. The gate's parameters still resolve from this options object
43
+ * (and the manifest); the snapshot must have been recorded under the same
44
+ * alpha, maxBet, and null boundary, and its decision must be one this
45
+ * configuration could have reached at its n, or construction throws.
46
+ * `decide(ctx)` is unaffected — it always runs on a fresh stream. */
47
+ resume?: SequentialStreamState;
41
48
  }
49
+ /** Snapshot of one observe-stream: the e-process state plus the gate's own
50
+ * decision, which applies `minN` and `maxN` on top of the core latch. A
51
+ * gate rebuilt with `resume` from this value continues exactly where the
52
+ * snapshot was taken. */
53
+ type SequentialStreamState = EProcessState & {
54
+ decision: SequentialDecision;
55
+ };
42
56
  interface SequentialPairedGate<TArtifact = unknown, TScenario extends Scenario = Scenario> extends Gate<TArtifact, TScenario> {
43
57
  /** Streaming entry point: feed one paired per-scenario delta
44
58
  * (candidate − baseline, native scale). Each gate instance carries ONE
@@ -48,10 +62,9 @@ interface SequentialPairedGate<TArtifact = unknown, TScenario extends Scenario =
48
62
  * the result reopens optional stopping — start a NEW pre-registered
49
63
  * test). */
50
64
  observe(delta: number): SequentialObservation;
51
- /** Read-only snapshot of the observe-stream. */
52
- state(): EProcessState & {
53
- decision: SequentialDecision;
54
- };
65
+ /** Read-only snapshot of the observe-stream. Pass it back as
66
+ * `resume` to continue the stream after a restart. */
67
+ state(): SequentialStreamState;
55
68
  }
56
69
  /**
57
70
  * Anytime-valid sequential paired gate. Conforms to the existing `Gate`
@@ -278,5 +291,5 @@ declare function dimensionRegressions(candidate: Map<string, Record<string, Judg
278
291
  statistic?: 'mean' | 'median';
279
292
  }): DimensionRegression[];
280
293
  //#endregion
281
- export { detectScale as a, pairHoldout as c, SequentialDecision as d, SequentialObservation as f, sequentialPairedGate as g, sequentialDecide as h, PairedHoldout as i, SequentialDecideFn as l, SequentialPairedGateOptions as m, HeldoutSignificance as n, dimensionRegressions as o, SequentialPairedGate as p, HeldoutSignificanceOptions as r, heldoutSignificance as s, DimensionRegression as t, SequentialDecideOptions as u };
282
- //# sourceMappingURL=statistical-heldout-_woZ9q9j.d.ts.map
294
+ export { sequentialPairedGate as _, detectScale as a, pairHoldout as c, SequentialDecision as d, SequentialObservation as f, sequentialDecide as g, SequentialStreamState as h, PairedHoldout as i, SequentialDecideFn as l, SequentialPairedGateOptions as m, HeldoutSignificance as n, dimensionRegressions as o, SequentialPairedGate as p, HeldoutSignificanceOptions as r, heldoutSignificance as s, DimensionRegression as t, SequentialDecideOptions as u };
295
+ //# sourceMappingURL=statistical-heldout-Cy3EhjlC.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statistical-heldout-Cy3EhjlC.d.ts","names":[],"s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rC,aAAa,aACb,8BACA;EACE;EACA;EACA;EACA;;;EAGA;IAED"}
@@ -69,21 +69,6 @@ declare function isSubmitAction(action: string): boolean;
69
69
  * replay, so the recorded end state and the replayed one would differ.
70
70
  */
71
71
  declare function isSubmitOnlyAction(action: string): boolean;
72
- /**
73
- * A field the dump replaced with a counter instead of its text.
74
- *
75
- * The counter is hexadecimal and rises by one per dropped string in document
76
- * order, so a decimal-only reading (`$12`) accepts every marker that carries a
77
- * letter (`$3a`) as if it were real text. A command read that way replays as
78
- * the literal two-to-four characters `$3a`, which is not the command the run
79
- * executed.
80
- *
81
- * Nothing in the dump maps a marker back to its text: the same marker carries
82
- * different content in different rows, so there is no dictionary to read. A
83
- * field that matches is unrecoverable, so a caller rejects the row that holds
84
- * it rather than replaying the marker.
85
- */
86
- declare const RECORDED_ELISION_PATTERN: RegExp;
87
72
  declare function isElidedField(value: string | null | undefined): boolean;
88
73
  /** Substring the timeout notice always carries, whatever the command was. */
89
74
  declare const TIMEOUT_OBSERVATION_MARKER = "timed out and has been killed";
@@ -212,5 +197,5 @@ declare function unreadableExitCount(steps: readonly RecordedTrajectoryStep[]):
212
197
  */
213
198
  declare function assertReplayableTrajectory(decoded: DecodedTrajectory): void;
214
199
  //#endregion
215
- export { isSubmitAction as _, RecordedObservationKind as a, parseRecordedReturncode as b, SUBMIT_ACTION_SIGNATURE as c, classifyObservation as d, decodeRecordedTurns as f, isRecordedTimeout as g, isElidedField as h, RecordedFinalOutcome as i, TIMEOUT_OBSERVATION_MARKER as l, finalRecordedOutcome as m, FORMAT_ERROR_OBSERVATION_PREFIX as n, RecordedTrajectoryStep as o, deriveFailureSignature as p, RECORDED_ELISION_PATTERN as r, RecordedTrajectoryTurn as s, DecodedTrajectory as t, assertReplayableTrajectory as u, isSubmitOnlyAction as v, unreadableExitCount as x, parseObservationOutput as y };
216
- //# sourceMappingURL=steps-AmkT-GIM.d.ts.map
200
+ export { isSubmitOnlyAction as _, RecordedTrajectoryStep as a, unreadableExitCount as b, TIMEOUT_OBSERVATION_MARKER as c, decodeRecordedTurns as d, deriveFailureSignature as f, isSubmitAction as g, isRecordedTimeout as h, RecordedObservationKind as i, assertReplayableTrajectory as l, isElidedField as m, FORMAT_ERROR_OBSERVATION_PREFIX as n, RecordedTrajectoryTurn as o, finalRecordedOutcome as p, RecordedFinalOutcome as r, SUBMIT_ACTION_SIGNATURE as s, DecodedTrajectory as t, classifyObservation as u, parseObservationOutput as v, parseRecordedReturncode as y };
201
+ //# sourceMappingURL=steps-CiNVJry_.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps-CiNVJry_.d.ts","names":[],"sources":["../src/trajectory-replay/steps.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAmCiB;;WAEN;WACA;;WAEA;;;iBAIK,wBAAwB;;;iBAQxB,uBAAuB;;;;;;;;iBAavB,uBAAuB;;;;;cAW1B;iBAEG,eAAe;;;;;;;;;;iBAaf,mBAAmB;iBAwBnB,cAAc;;cAOjB;;cAGA;;;;;;;;;;;KAaD;iBAQI,oBAAoB,6BAA6B;;;;iBAYjD,kBAAkB;;;;;;;UAYjB;WACN;WACA;WACA;aAA4B;;WAC5B;;UAGM;;WAEN,gBAAgB;;WAEhB;;;;;;;;;WASA;;WAEA;;WAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmCK,oBAAoB,gBAAgB,2BAA2B;;;;;;;;;KAyCnE;WACG;WAA6B;;WAC7B;;WACA;WAA6B,QAAQ;;;;;;;;iBAQpC,qBACd,gBAAgB,2BACf;;;;;;;iBAiBa,oBAAoB,gBAAgB;;;;;;;;;iBAYpC,2BAA2B,SAAS"}
@@ -1,4 +1,4 @@
1
- import { C as TraceEvent, _ as Span, f as Run, h as RunStatus, i as EventKind, n as BudgetLedgerEntry, p as RunLayer, t as Artifact, y as SpanKind } from "./schema-BtVldJ3T.js";
1
+ import { C as TraceEvent, _ as Span, f as Run, h as RunStatus, i as EventKind, n as BudgetLedgerEntry, p as RunLayer, t as Artifact, y as SpanKind } from "./schema-Bjgdsn73.js";
2
2
  //#region src/trace/store.d.ts
3
3
  interface RunFilter {
4
4
  scenarioId?: string;
@@ -114,4 +114,4 @@ declare class FileSystemTraceStore implements TraceStore {
114
114
  }
115
115
  //#endregion
116
116
  export { RunFilter as a, InMemoryTraceStore as i, FileSystemTraceStore as n, SpanFilter as o, FileSystemTraceStoreOptions as r, TraceStore as s, EventFilter as t };
117
- //# sourceMappingURL=store-CT9YIIve.d.ts.map
117
+ //# sourceMappingURL=store-B06JdC56.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"store-CT9YIIve.d.ts","names":[],"sources":["../src/trace/store.ts"],"mappings":";;UAuBiB;EACf;EACA;EACA,SAAS;EACT;EACA;EACA;IAAQ;IAAa;;EACrB;EACA;EACA;EACA,QAPS;;UAUM;EACf;EACA;EACA,OAAO;EACP;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA,OAAO;EACP;EACA;;UAGe;EACf,UAAU,KAAK,MAAM;EACrB,UAAU,eAAe,OAAO,QAAQ,OAAO;EAC/C,WAAW,MAAM,OAAO;EACxB,WAAW,gBAAgB,OAAO,QAAQ,QAAQ;EAClD,YAAY,OAAO,aAAa;EAChC,eAAe,UAAU,WAAW;EACpC,kBAAkB,OAAO,oBAAoB;EAE7C,OAAO,gBAAgB,QAAQ;EAC/B,SAAS,SAAS,YAAY,QAAQ;EACtC,MAAM,SAAS,aAAa,QAAQ;EACpC,OAAO,SAAS,cAAc,QAAQ;EACtC,OAAO,gBAAgB,QAAQ;EAC/B,UAAU,gBAAgB,QAAQ;;cAKvB,8BAA8B;UACjC;UACA;UACA;UACA;UACA;EAEF,UAAU,KAAK,MAAM;EAKrB,UAAU,eAAe,OAAO,QAAQ,OAAO;EAM/C,WAAW,MAAM,OAAO;EAIxB,WAAW,gBAAgB,OAAO,QAAQ,QAAQ;EAMlD,YAAY,OAAO,aAAa;EAIhC,eAAe,UAAU,WAAW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, G as extractOtlpAttributes, J as projectOtlpFlatLine, S as TraceFileTooLargeError, W as compareSpanTime, X as spanEpochMillis, _ as TraceAnalysisLimitError, b as TraceFileMalformedError, d as truncateForBudget, f as validateInteger, g as SpanNotFoundError, h as TRACE_ANALYSIS_LIMITS, p as DEFAULT_TRACE_ANALYST_BUDGETS, u as compileSearchRegex, x as TraceFileMissingError, y as TraceAnalysisValidationError } from "./kind-factory-DmAa0h3K.js";
2
+ import { B as projectOtlpFlatLine, L as compareSpanTime, R as extractOtlpAttributes, S as TraceNotFoundError, V as spanEpochMillis, b as TraceFileMissingError, d as validateInteger, f as DEFAULT_TRACE_ANALYST_BUDGETS, g as TraceAnalysisLimitError, h as SpanNotFoundError, l as compileSearchRegex, m as TRACE_ANALYSIS_LIMITS, u as truncateForBudget, v as TraceAnalysisValidationError, x as TraceFileTooLargeError, y as TraceFileMalformedError } from "./kind-factory-DY8FdoXf.js";
3
3
  import { readFile, stat } from "node:fs/promises";
4
4
  //#region src/trace-analyst/shared-abortable-task.ts
5
5
  function createSharedAbortableTask(factory) {
@@ -754,4 +754,4 @@ function finalizeErrorClusters(clusters, errorTraceCount) {
754
754
  //#endregion
755
755
  export { otlpTextToTraceAnalysisStore as i, OtlpFileTraceStore as n, createOtlpBufferTraceStore as r, DEFAULT_MAX_TRACE_FILE_BYTES as t };
756
756
 
757
- //# sourceMappingURL=store-otlp-CDYWW_8N.js.map
757
+ //# sourceMappingURL=store-otlp-C_Rq5I4D.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"store-otlp-CDYWW_8N.js","names":[],"sources":["../src/trace-analyst/shared-abortable-task.ts","../src/trace-analyst/store-otlp.ts"],"sourcesContent":["export interface SharedAbortableTask<T> {\n controller: AbortController\n promise: Promise<T>\n consumers: number\n settled: boolean\n}\n\nexport function createSharedAbortableTask<T>(\n factory: (signal: AbortSignal) => Promise<T>,\n): SharedAbortableTask<T> {\n const controller = new AbortController()\n const task: SharedAbortableTask<T> = {\n controller,\n promise: factory(controller.signal),\n consumers: 0,\n settled: false,\n }\n void task.promise.then(\n () => {\n task.settled = true\n },\n () => {\n task.settled = true\n },\n )\n return task\n}\n\nexport function waitForSharedTask<T>(\n task: SharedAbortableTask<T>,\n signal: AbortSignal | undefined,\n): Promise<T> {\n signal?.throwIfAborted()\n task.consumers += 1\n\n return new Promise<T>((resolve, reject) => {\n let finished = false\n const finish = (callback: () => void): void => {\n if (finished) return\n finished = true\n signal?.removeEventListener('abort', onAbort)\n task.consumers -= 1\n callback()\n }\n const onAbort = (): void => {\n finish(() => {\n reject(signal?.reason)\n if (!task.settled && task.consumers === 0) {\n task.controller.abort(signal?.reason)\n }\n })\n }\n\n signal?.addEventListener('abort', onAbort, { once: true })\n task.promise.then(\n (value) => finish(() => resolve(value)),\n (error: unknown) => finish(() => reject(error)),\n )\n if (signal?.aborted) onAbort()\n })\n}\n","/**\n * `OtlpFileTraceStore` — read-only OTLP-JSONL trace store for the\n * trace-analyst.\n *\n * Wire shape. Each line of the input file is one OTLP-shaped span. The\n * store understands flattened OTLP JSONL plus the OpenInference vocab.\n * We project upstream's full\n * span shape down to `TraceAnalystSpan` lazily — full materialisation\n * only happens for the spans the agent actually requests.\n *\n * Indexing. On first read the store builds an in-memory index keyed\n * by `trace_id` carrying:\n * - byte offsets + lengths for each span line (for surgical reads\n * without re-parsing the whole file)\n * - a `TraceAnalystTraceSummary` rollup\n * - sets of services / agents / models / tools / has_errors\n * - byte size of the trace's JSONL slab\n *\n * Memory bound. The index keeps span metadata only — names, kinds,\n * offsets, status. Attribute payloads stay on disk until requested.\n * For a 50MB JSONL with 50k spans, the index is ~5MB.\n *\n * Concurrency. The store builds the index once on first read and\n * caches it. Subsequent reads reuse the index. The file is opened on\n * each read; we never hold a long-lived FD.\n */\n\nimport { readFile, stat } from 'node:fs/promises'\nimport type { RE2JS } from 're2js'\nimport { CaptureIntegrityError } from '../errors'\nimport {\n SpanNotFoundError,\n TraceAnalysisLimitError,\n TraceAnalysisValidationError,\n TraceFileMalformedError,\n TraceFileMissingError,\n TraceFileTooLargeError,\n TraceNotFoundError,\n} from './errors'\nimport {\n compareSpanTime,\n extractOtlpAttributes,\n projectOtlpFlatLine,\n spanEpochMillis,\n} from './otlp-span'\nimport {\n createSharedAbortableTask,\n type SharedAbortableTask,\n waitForSharedTask,\n} from './shared-abortable-task'\nimport {\n compileSearchRegex,\n TRACE_ANALYSIS_LIMITS,\n type TraceAnalysisStore,\n type TraceAnalysisStoreContext,\n truncateForBudget,\n validateInteger,\n} from './store'\nimport {\n type DatasetOverview,\n DEFAULT_TRACE_ANALYST_BUDGETS,\n type ErrorCluster,\n type QueryTracesPage,\n type SearchSpanResult,\n type SearchTraceResult,\n type SpanMatchRecord,\n type TraceAnalystFilters,\n type TraceAnalystSpan,\n type TraceAnalystSpanKind,\n type TraceAnalystSpanStatus,\n type TraceAnalystTraceSummary,\n type ViewSpansResult,\n type ViewTraceOversized,\n type ViewTraceResult,\n} from './types'\n\n/** Lines indexed between event-loop yields. Bounded synchronous work per\n * tick keeps the index build from starving other tasks on large files\n * while staying coarse enough that the yields are cheap. */\nconst INDEX_YIELD_LINES = 5000\nconst SCAN_YIELD_ITEMS = 500\n\n/** Hand control back to the event loop without busy-waiting. */\nfunction yieldToEventLoop(): Promise<void> {\n return new Promise((resolve) => setImmediate(resolve))\n}\n\nasync function scanCheckpoint(signal: AbortSignal | undefined, item: number): Promise<void> {\n signal?.throwIfAborted()\n if (item > 0 && item % SCAN_YIELD_ITEMS === 0) {\n await yieldToEventLoop()\n signal?.throwIfAborted()\n }\n}\n\ninterface SpanIndexEntry {\n span_id: string\n parent_span_id: string | null\n name: string\n kind: TraceAnalystSpanKind\n start_time: string\n end_time: string\n duration_ms: number\n status: TraceAnalystSpanStatus\n status_message: string | undefined\n service_name: string | null\n agent_name: string | null\n model_name: string | null\n tool_name: string | null\n /** Byte offset in the raw JSONL file to the start of this span's line. */\n line_byte_offset: number\n /** Length of this line in bytes (excluding the trailing newline). */\n line_byte_length: number\n}\n\ninterface TraceIndexEntry {\n trace_id: string\n service_name: string | null\n agent_name: string | null\n span_count: number\n has_errors: boolean\n start_time: string\n end_time: string\n duration_ms: number\n raw_jsonl_bytes: number\n models: Set<string>\n tools: Set<string>\n spans: SpanIndexEntry[]\n /** Sorted by line offset for stable iteration. */\n}\n\ninterface DatasetIndex {\n byTrace: Map<string, TraceIndexEntry>\n totalRawBytes: number\n // Pre-computed sorted trace_ids for sample/query stability.\n sortedTraceIds: string[]\n}\n\nexport interface ToolSpansToTraceAnalysisStoreOptions {\n /** Override the discovery (`viewTrace`) per-attribute byte cap. */\n perAttributeViewBudget?: number\n /** Override the surgical (`viewSpans`) per-attribute byte cap. */\n perAttributeSpanBudget?: number\n /** Override the per-call ceiling that triggers oversized summaries. */\n perCallByteCeiling?: number\n /** Override the per-match text budget. */\n perMatchTextBudget?: number\n}\n\ntype BufferedOtlpTraceStoreOptions = ToolSpansToTraceAnalysisStoreOptions\n\nexport interface OtlpFileTraceStoreOptions extends BufferedOtlpTraceStoreOptions {\n /** Path to the OTLP-JSONL file. */\n path: string\n /**\n * Hard ceiling on the trace file size in bytes. The store reads the\n * whole file into one Buffer and indexes it in memory, so an\n * unbounded file OOMs the process. Above this size the store fails\n * loud with `TraceFileTooLargeError` instead of degrading silently.\n * Default 256 MiB.\n */\n maxFileBytes?: number\n}\n\n/** Default ceiling for {@link OtlpFileTraceStoreOptions.maxFileBytes}. */\nexport const DEFAULT_MAX_TRACE_FILE_BYTES = 256 * 1024 * 1024\n\nabstract class BufferedOtlpTraceStore implements TraceAnalysisStore {\n private readonly perAttributeViewBudget: number\n private readonly perAttributeSpanBudget: number\n private readonly perCallByteCeiling: number\n private readonly perMatchTextBudget: number\n private indexValue?: DatasetIndex\n private indexTask?: SharedAbortableTask<DatasetIndex>\n private bufferValue?: Buffer\n private bufferTask?: SharedAbortableTask<Buffer>\n\n constructor(opts: BufferedOtlpTraceStoreOptions) {\n this.perAttributeViewBudget = validateInteger(\n opts.perAttributeViewBudget ?? DEFAULT_TRACE_ANALYST_BUDGETS.perAttributeViewBudget,\n 'perAttributeViewBudget',\n TRACE_ANALYSIS_LIMITS.minimumTextBudget,\n )\n this.perAttributeSpanBudget = validateInteger(\n opts.perAttributeSpanBudget ?? DEFAULT_TRACE_ANALYST_BUDGETS.perAttributeSpanBudget,\n 'perAttributeSpanBudget',\n TRACE_ANALYSIS_LIMITS.minimumTextBudget,\n )\n this.perCallByteCeiling = validateInteger(\n opts.perCallByteCeiling ?? DEFAULT_TRACE_ANALYST_BUDGETS.perCallByteCeiling,\n 'perCallByteCeiling',\n 1,\n )\n this.perMatchTextBudget = validateInteger(\n opts.perMatchTextBudget ?? DEFAULT_TRACE_ANALYST_BUDGETS.perMatchTextBudget,\n 'perMatchTextBudget',\n TRACE_ANALYSIS_LIMITS.minimumTextBudget,\n )\n }\n\n // ─── Public API ────────────────────────────────────────────────────\n\n async hasTrace(trace_id: string, context?: TraceAnalysisStoreContext): Promise<boolean> {\n context?.signal?.throwIfAborted()\n const idx = await this.index(context)\n context?.signal?.throwIfAborted()\n return idx.byTrace.has(trace_id)\n }\n\n async hasSpans(\n opts: { trace_id: string; span_ids: readonly string[] },\n context?: TraceAnalysisStoreContext,\n ): Promise<string[]> {\n context?.signal?.throwIfAborted()\n const idx = await this.index(context)\n const trace = idx.byTrace.get(opts.trace_id)\n if (!trace) return []\n const requested = new Set(opts.span_ids)\n const found: string[] = []\n for (let index = 0; index < trace.spans.length; index += 1) {\n await scanCheckpoint(context?.signal, index)\n const spanId = trace.spans[index]!.span_id\n if (requested.has(spanId)) found.push(spanId)\n }\n return found\n }\n\n async getOverview(\n filters?: TraceAnalystFilters,\n context?: TraceAnalysisStoreContext,\n ): Promise<DatasetOverview> {\n const idx = await this.index(context)\n const matched = await this.matchedTraces(idx, filters, context)\n\n const services = new Set<string>()\n const agents = new Set<string>()\n const models = new Set<string>()\n const tools = new Set<string>()\n let rawBytes = 0\n let earliest: string | null = null\n let latest: string | null = null\n let errorTraceCount = 0\n let errorSpanCount = 0\n const clusters = new Map<string, ErrorClusterAccumulator>()\n\n let traceIndex = 0\n for (const t of matched) {\n await scanCheckpoint(context?.signal, traceIndex++)\n if (t.service_name) services.add(t.service_name)\n if (t.agent_name) agents.add(t.agent_name)\n for (const m of t.models) models.add(m)\n for (const tn of t.tools) tools.add(tn)\n rawBytes += t.raw_jsonl_bytes\n if (!earliest || compareSpanTime(t.start_time, earliest) < 0) earliest = t.start_time\n if (!latest || compareSpanTime(t.end_time, latest) > 0) latest = t.end_time\n if (t.has_errors) {\n errorTraceCount += 1\n let spanIndex = 0\n for (const s of t.spans) {\n await scanCheckpoint(context?.signal, spanIndex++)\n if (s.status !== 'ERROR') continue\n errorSpanCount += 1\n accumulateErrorCluster(clusters, t.trace_id, s)\n }\n }\n }\n\n const sample_trace_ids = matched.slice(0, 20).map((t) => t.trace_id)\n return {\n total_traces: matched.length,\n raw_jsonl_bytes: rawBytes,\n services: [...services].sort(),\n agents: [...agents].sort(),\n models: [...models].sort(),\n tool_names: [...tools].sort(),\n sample_trace_ids,\n errors: { trace_count: errorTraceCount, span_count: errorSpanCount },\n error_clusters: finalizeErrorClusters(clusters, errorTraceCount),\n time_range: earliest && latest ? { earliest, latest } : null,\n }\n }\n\n async queryTraces(\n opts: { filters?: TraceAnalystFilters; limit: number; offset?: number },\n context?: TraceAnalysisStoreContext,\n ): Promise<QueryTracesPage> {\n const limit = validateInteger(\n opts.limit,\n 'queryTraces.limit',\n 1,\n TRACE_ANALYSIS_LIMITS.queryTraces,\n )\n const offset = validateInteger(opts.offset ?? 0, 'queryTraces.offset', 0)\n\n const idx = await this.index(context)\n const matched = await this.matchedTraces(idx, opts.filters, context)\n const slice = matched.slice(offset, offset + limit)\n return {\n traces: slice.map((t) => this.toSummary(t)),\n total: matched.length,\n has_more: offset + slice.length < matched.length,\n }\n }\n\n async countTraces(\n filters?: TraceAnalystFilters,\n context?: TraceAnalysisStoreContext,\n ): Promise<number> {\n const idx = await this.index(context)\n const matched = await this.matchedTraces(idx, filters, context)\n return matched.length\n }\n\n async viewTrace(\n opts: { trace_id: string; per_attribute_byte_cap?: number },\n context?: TraceAnalysisStoreContext,\n ): Promise<ViewTraceResult> {\n context?.signal?.throwIfAborted()\n const idx = await this.index(context)\n const trace = idx.byTrace.get(opts.trace_id)\n if (!trace) {\n throw new TraceNotFoundError(opts.trace_id)\n }\n const cap = validateInteger(\n opts.per_attribute_byte_cap ?? this.perAttributeViewBudget,\n 'viewTrace.per_attribute_byte_cap',\n 1,\n )\n\n // Probe size first — if the materialised payload would exceed\n // the per-call ceiling we return an oversized summary rather than\n // blowing the agent's context.\n const buf = await this.buffer(context)\n const spans: TraceAnalystSpan[] = []\n let runningBytes = 0\n let span_response_bytes_max = 0\n const counter: TruncationCounter = { value: 0 }\n let spanIndex = 0\n for (const s of trace.spans) {\n await scanCheckpoint(context?.signal, spanIndex++)\n const projected = this.projectSpan(buf, trace.trace_id, s, cap, counter)\n const bytes = Buffer.byteLength(JSON.stringify(projected), 'utf8')\n span_response_bytes_max = Math.max(span_response_bytes_max, bytes)\n runningBytes += bytes\n if (runningBytes > this.perCallByteCeiling) {\n return {\n trace_id: trace.trace_id,\n oversized: this.buildOversizedSummary(trace, span_response_bytes_max),\n }\n }\n spans.push(projected)\n }\n return { trace_id: trace.trace_id, spans }\n }\n\n async viewSpans(\n opts: { trace_id: string; span_ids: readonly string[]; per_attribute_byte_cap?: number },\n context?: TraceAnalysisStoreContext,\n ): Promise<ViewSpansResult> {\n context?.signal?.throwIfAborted()\n const idx = await this.index(context)\n const trace = idx.byTrace.get(opts.trace_id)\n if (!trace) throw new TraceNotFoundError(opts.trace_id)\n if (opts.span_ids.length < 1 || opts.span_ids.length > TRACE_ANALYSIS_LIMITS.viewSpans) {\n throw new TraceAnalysisValidationError(\n `viewSpans.span_ids must contain 1..${TRACE_ANALYSIS_LIMITS.viewSpans} ids, got ${opts.span_ids.length}`,\n )\n }\n const cap = validateInteger(\n opts.per_attribute_byte_cap ?? this.perAttributeSpanBudget,\n 'viewSpans.per_attribute_byte_cap',\n 1,\n )\n\n const requested = [...new Set(opts.span_ids)]\n const wantSet = new Set(requested)\n const foundById = new Map<string, SpanIndexEntry>()\n for (let index = 0; index < trace.spans.length; index += 1) {\n await scanCheckpoint(context?.signal, index)\n const span = trace.spans[index]!\n if (wantSet.has(span.span_id)) foundById.set(span.span_id, span)\n }\n const missing = requested.filter((id) => !foundById.has(id))\n\n const buf = await this.buffer(context)\n const spans: TraceAnalystSpan[] = []\n let truncatedAttributeCount = 0\n const omitted = new Set(requested.filter((id) => foundById.has(id)))\n const buildResult = (): ViewSpansResult => ({\n trace_id: trace.trace_id,\n spans,\n missing_span_ids: missing,\n omitted_span_ids: requested.filter((id) => omitted.has(id)),\n has_more: omitted.size > 0,\n truncated_attribute_count: truncatedAttributeCount,\n })\n const metadataBytes = Buffer.byteLength(JSON.stringify(buildResult()), 'utf8')\n if (metadataBytes > this.perCallByteCeiling) {\n throw new TraceAnalysisLimitError(\n 'viewSpans',\n metadataBytes,\n this.perCallByteCeiling,\n `viewSpans accounting requires ${metadataBytes} bytes, over the ${this.perCallByteCeiling}-byte response limit`,\n )\n }\n let spanIndex = 0\n let smallestRejectedBytes = Number.POSITIVE_INFINITY\n for (const id of requested) {\n await scanCheckpoint(context?.signal, spanIndex++)\n const s = foundById.get(id)\n if (!s) continue\n const counter: TruncationCounter = { value: 0 }\n const projected = this.projectSpan(buf, trace.trace_id, s, cap, counter)\n spans.push(projected)\n omitted.delete(id)\n truncatedAttributeCount += counter.value\n const responseBytes = Buffer.byteLength(JSON.stringify(buildResult()), 'utf8')\n if (responseBytes <= this.perCallByteCeiling) {\n continue\n }\n smallestRejectedBytes = Math.min(smallestRejectedBytes, responseBytes)\n if (requested.length === 1) {\n throw new TraceAnalysisLimitError(\n 'viewSpans',\n responseBytes,\n this.perCallByteCeiling,\n `viewSpans cannot fit span ${JSON.stringify(id)} in the ${this.perCallByteCeiling}-byte response limit`,\n )\n }\n spans.pop()\n omitted.add(id)\n truncatedAttributeCount -= counter.value\n }\n if (foundById.size > 0 && spans.length === 0) {\n throw new TraceAnalysisLimitError(\n 'viewSpans',\n smallestRejectedBytes,\n this.perCallByteCeiling,\n `viewSpans cannot fit one requested span in the ${this.perCallByteCeiling}-byte response limit`,\n )\n }\n return buildResult()\n }\n\n async searchTrace(\n opts: { trace_id: string; regex_pattern: string; max_matches?: number },\n context?: TraceAnalysisStoreContext,\n ): Promise<SearchTraceResult> {\n const max_matches = validateInteger(\n opts.max_matches ?? 50,\n 'searchTrace.max_matches',\n 1,\n TRACE_ANALYSIS_LIMITS.searchMatches,\n )\n const idx = await this.index(context)\n const trace = idx.byTrace.get(opts.trace_id)\n if (!trace) throw new TraceNotFoundError(opts.trace_id)\n const re = compileSearchRegex(opts.regex_pattern)\n\n const buf = await this.buffer(context)\n const hits: SpanMatchRecord[] = []\n let hasMore = false\n let spanIndex = 0\n for (const s of trace.spans) {\n await scanCheckpoint(context?.signal, spanIndex++)\n const remaining = max_matches - hits.length\n const localHits = await this.scanSpanForMatches(\n buf,\n trace.trace_id,\n s,\n re,\n this.perMatchTextBudget,\n remaining,\n context,\n )\n for (const h of localHits.records) {\n if (hits.length >= max_matches) break\n hits.push(h)\n }\n if (localHits.hasMore) {\n hasMore = true\n break\n }\n }\n return {\n trace_id: trace.trace_id,\n hits,\n has_more: hasMore,\n }\n }\n\n async searchSpan(\n opts: { trace_id: string; span_id: string; regex_pattern: string; max_matches?: number },\n context?: TraceAnalysisStoreContext,\n ): Promise<SearchSpanResult> {\n const max_matches = validateInteger(\n opts.max_matches ?? 50,\n 'searchSpan.max_matches',\n 1,\n TRACE_ANALYSIS_LIMITS.searchMatches,\n )\n const idx = await this.index(context)\n const trace = idx.byTrace.get(opts.trace_id)\n if (!trace) throw new TraceNotFoundError(opts.trace_id)\n let span: SpanIndexEntry | undefined\n for (let index = 0; index < trace.spans.length; index += 1) {\n await scanCheckpoint(context?.signal, index)\n const candidate = trace.spans[index]!\n if (candidate.span_id === opts.span_id) {\n span = candidate\n break\n }\n }\n if (!span) {\n throw new SpanNotFoundError(opts.trace_id, opts.span_id)\n }\n const re = compileSearchRegex(opts.regex_pattern)\n const buf = await this.buffer(context)\n const localHits = await this.scanSpanForMatches(\n buf,\n trace.trace_id,\n span,\n re,\n this.perMatchTextBudget,\n max_matches,\n context,\n )\n return {\n trace_id: trace.trace_id,\n span_id: span.span_id,\n hits: localHits.records,\n has_more: localHits.hasMore,\n }\n }\n\n // ─── Index building ────────────────────────────────────────────────\n\n /** Force the index to materialise. Useful to amortise startup cost\n * before the first agent call. */\n async ensureIndexed(context?: TraceAnalysisStoreContext): Promise<void> {\n await this.index(context)\n }\n\n private async buffer(context?: TraceAnalysisStoreContext): Promise<Buffer> {\n context?.signal?.throwIfAborted()\n if (this.bufferValue) return this.bufferValue\n if (!this.bufferTask) {\n const task = createSharedAbortableTask((signal) => this.readBuffer(signal))\n this.bufferTask = task\n void task.promise.then(\n (value) => {\n this.bufferValue = value\n if (this.bufferTask === task) this.bufferTask = undefined\n },\n () => {\n if (this.bufferTask === task) this.bufferTask = undefined\n },\n )\n }\n return waitForSharedTask(this.bufferTask, context?.signal)\n }\n\n protected abstract readBuffer(signal?: AbortSignal): Promise<Buffer>\n\n protected abstract sourcePath(): string\n\n private async index(context?: TraceAnalysisStoreContext): Promise<DatasetIndex> {\n context?.signal?.throwIfAborted()\n if (this.indexValue) return this.indexValue\n if (!this.indexTask) {\n const task = createSharedAbortableTask((signal) => this.buildIndex(signal))\n this.indexTask = task\n void task.promise.then(\n (value) => {\n this.indexValue = value\n if (this.indexTask === task) this.indexTask = undefined\n },\n () => {\n if (this.indexTask === task) this.indexTask = undefined\n },\n )\n }\n return waitForSharedTask(this.indexTask, context?.signal)\n }\n\n private async buildIndex(signal?: AbortSignal): Promise<DatasetIndex> {\n // readGuarded surfaces missing/oversized files as typed errors.\n const buf = await this.buffer({ signal })\n signal?.throwIfAborted()\n\n const byTrace = new Map<string, TraceIndexEntry>()\n let cursor = 0\n let lineNumber = 0\n let sinceYield = 0\n while (cursor < buf.length) {\n lineNumber += 1\n // Yield to the event loop every INDEX_YIELD_LINES lines so a huge\n // file doesn't monopolise the thread for the whole index build.\n if (++sinceYield >= INDEX_YIELD_LINES) {\n sinceYield = 0\n await yieldToEventLoop()\n signal?.throwIfAborted()\n }\n const newlineIndex = buf.indexOf(0x0a, cursor) // \\n\n const lineEnd = newlineIndex === -1 ? buf.length : newlineIndex\n const lineLength = lineEnd - cursor\n if (lineLength === 0) {\n cursor = lineEnd + 1\n continue\n }\n const lineSlice = buf.subarray(cursor, lineEnd).toString('utf8')\n const lineOffset = cursor\n cursor = lineEnd + 1\n\n let parsed: unknown\n try {\n parsed = JSON.parse(lineSlice)\n } catch (cause) {\n throw new TraceFileMalformedError(this.sourcePath(), lineNumber, lineOffset, cause)\n }\n if (!parsed || typeof parsed !== 'object') {\n throw new TraceFileMalformedError(this.sourcePath(), lineNumber, lineOffset)\n }\n const span = projectOtlpFlatLine(parsed as Record<string, unknown>)\n if (!span) {\n throw new TraceFileMalformedError(this.sourcePath(), lineNumber, lineOffset)\n }\n\n let entry = byTrace.get(span.trace_id)\n if (!entry) {\n entry = {\n trace_id: span.trace_id,\n service_name: span.service_name,\n agent_name: span.agent_name,\n span_count: 0,\n has_errors: false,\n start_time: span.start_time,\n end_time: span.end_time,\n duration_ms: 0,\n raw_jsonl_bytes: 0,\n models: new Set(),\n tools: new Set(),\n spans: [],\n }\n byTrace.set(span.trace_id, entry)\n } else {\n // Pin the trace's service/agent to the first AGENT span we\n // Prefer the first agent/service fields that appear in the trace.\n if (!entry.service_name && span.service_name) entry.service_name = span.service_name\n if (!entry.agent_name && span.agent_name) entry.agent_name = span.agent_name\n }\n\n const indexEntry: SpanIndexEntry = {\n span_id: span.span_id,\n parent_span_id: span.parent_span_id,\n name: span.name,\n kind: span.kind,\n start_time: span.start_time,\n end_time: span.end_time,\n duration_ms: span.duration_ms,\n status: span.status,\n status_message: span.status_message,\n service_name: span.service_name,\n agent_name: span.agent_name,\n model_name: span.model_name,\n tool_name: span.tool_name,\n line_byte_offset: lineOffset,\n line_byte_length: lineLength,\n }\n entry.spans.push(indexEntry)\n entry.span_count += 1\n entry.raw_jsonl_bytes += lineLength + 1 // +1 newline byte\n if (span.status === 'ERROR') entry.has_errors = true\n if (compareSpanTime(span.start_time, entry.start_time) < 0) entry.start_time = span.start_time\n if (compareSpanTime(span.end_time, entry.end_time) > 0) entry.end_time = span.end_time\n if (span.model_name) entry.models.add(span.model_name)\n if (span.tool_name) entry.tools.add(span.tool_name)\n }\n\n // Compute trace duration once, sort spans by start time for\n // stable iteration.\n let totalRawBytes = 0\n for (const t of byTrace.values()) {\n signal?.throwIfAborted()\n totalRawBytes += t.raw_jsonl_bytes\n t.spans.sort(\n (a, b) =>\n compareSpanTime(a.start_time, b.start_time) || a.line_byte_offset - b.line_byte_offset,\n )\n // Duration is 0 unless BOTH bounds parse — a missing/garbage timestamp\n // yields 0, never a NaN (→ null in JSON) or a bogus epoch-from-zero span.\n const startMs = spanEpochMillis(t.start_time)\n const endMs = spanEpochMillis(t.end_time)\n t.duration_ms = startMs === null || endMs === null ? 0 : Math.max(0, endMs - startMs)\n }\n const sortedTraceIds = [...byTrace.keys()].sort()\n signal?.throwIfAborted()\n\n return { byTrace, totalRawBytes, sortedTraceIds }\n }\n\n // ─── Filter pipeline ───────────────────────────────────────────────\n\n private async matchedTraces(\n idx: DatasetIndex,\n filters: TraceAnalystFilters | undefined,\n context?: TraceAnalysisStoreContext,\n ): Promise<TraceIndexEntry[]> {\n context?.signal?.throwIfAborted()\n const traces: TraceIndexEntry[] = []\n for (let index = 0; index < idx.sortedTraceIds.length; index += 1) {\n await scanCheckpoint(context?.signal, index)\n const trace = idx.byTrace.get(idx.sortedTraceIds[index]!)\n if (trace) traces.push(trace)\n }\n if (!filters) return traces\n\n const indexedFiltered: TraceIndexEntry[] = []\n for (let index = 0; index < traces.length; index += 1) {\n await scanCheckpoint(context?.signal, index)\n const t = traces[index]!\n if (filters.has_errors !== undefined && t.has_errors !== filters.has_errors) continue\n if (filters.service_names && filters.service_names.length > 0) {\n if (!t.service_name || !filters.service_names.includes(t.service_name)) continue\n }\n if (filters.agent_names && filters.agent_names.length > 0) {\n if (!t.agent_name || !filters.agent_names.includes(t.agent_name)) continue\n }\n if (filters.model_names && filters.model_names.length > 0) {\n if (![...t.models].some((m) => filters.model_names!.includes(m))) continue\n }\n if (filters.tool_names && filters.tool_names.length > 0) {\n if (![...t.tools].some((tn) => filters.tool_names!.includes(tn))) continue\n }\n if (filters.start_time_after && t.start_time < filters.start_time_after) continue\n if (filters.start_time_before && t.start_time > filters.start_time_before) continue\n indexedFiltered.push(t)\n }\n\n if (!filters.regex_pattern) return indexedFiltered\n\n // Opt-in raw-bytes scan — only over the already-narrowed set.\n const re = compileSearchRegex(filters.regex_pattern)\n const buf = await this.buffer(context)\n const out: TraceIndexEntry[] = []\n let traceIndex = 0\n for (const t of indexedFiltered) {\n await scanCheckpoint(context?.signal, traceIndex++)\n let matched = false\n let spanIndex = 0\n for (const s of t.spans) {\n await scanCheckpoint(context?.signal, spanIndex++)\n const slice = buf.subarray(s.line_byte_offset, s.line_byte_offset + s.line_byte_length)\n // Buffer.toString allocates; tolerate it because regex_pattern\n // is opt-in. Future optimisation: byte-level fast-path for\n // ASCII-only patterns.\n if (re.test(slice.toString('utf8'))) {\n matched = true\n break\n }\n }\n if (matched) out.push(t)\n }\n return out\n }\n\n private toSummary(t: TraceIndexEntry): TraceAnalystTraceSummary {\n return {\n trace_id: t.trace_id,\n service_name: t.service_name,\n agent_name: t.agent_name,\n span_count: t.span_count,\n has_errors: t.has_errors,\n start_time: t.start_time,\n end_time: t.end_time,\n duration_ms: t.duration_ms,\n raw_jsonl_bytes: t.raw_jsonl_bytes,\n models: [...t.models].sort(),\n tools: [...t.tools].sort(),\n }\n }\n\n // ─── Span projection (lazy attribute reads) ────────────────────────\n\n private projectSpan(\n buf: Buffer,\n trace_id: string,\n s: SpanIndexEntry,\n perAttrCap: number,\n counter: TruncationCounter,\n ): TraceAnalystSpan {\n const slice = buf\n .subarray(s.line_byte_offset, s.line_byte_offset + s.line_byte_length)\n .toString('utf8')\n let raw: Record<string, unknown> = {}\n try {\n const parsed = JSON.parse(slice)\n if (parsed && typeof parsed === 'object') raw = parsed as Record<string, unknown>\n } catch {\n // Should not happen — index pre-validated.\n }\n const attrs = extractOtlpAttributes(raw)\n const projected: Record<string, unknown> = {}\n for (const [k, v] of Object.entries(attrs)) {\n if (typeof v === 'string') {\n const trunc = truncateForBudget(v, perAttrCap)\n if (trunc !== v) counter.value += 1\n projected[k] = trunc\n } else if (Array.isArray(v) || (v && typeof v === 'object')) {\n const json = JSON.stringify(v)\n const trunc = truncateForBudget(json, perAttrCap)\n if (trunc !== json) {\n counter.value += 1\n projected[k] = trunc\n } else {\n projected[k] = v\n }\n } else {\n projected[k] = v\n }\n }\n return {\n trace_id,\n span_id: s.span_id,\n parent_span_id: s.parent_span_id,\n name: s.name,\n kind: s.kind,\n start_time: s.start_time,\n end_time: s.end_time,\n duration_ms: s.duration_ms,\n status: s.status,\n status_message: s.status_message,\n service_name: s.service_name,\n agent_name: s.agent_name,\n model_name: s.model_name,\n tool_name: s.tool_name,\n attributes: projected,\n }\n }\n\n private buildOversizedSummary(\n t: TraceIndexEntry,\n span_response_bytes_max: number,\n ): ViewTraceOversized {\n const counts = new Map<string, number>()\n let errorCount = 0\n for (const s of t.spans) {\n counts.set(s.name, (counts.get(s.name) ?? 0) + 1)\n if (s.status === 'ERROR') errorCount += 1\n }\n const top = [...counts.entries()].sort((a, b) => b[1] - a[1]).slice(0, 20)\n return {\n span_count: t.span_count,\n top_span_names: top,\n span_response_bytes_max,\n error_span_count: errorCount,\n }\n }\n\n private async scanSpanForMatches(\n buf: Buffer,\n trace_id: string,\n s: SpanIndexEntry,\n re: RE2JS,\n textBudget: number,\n recordCap: number,\n context?: TraceAnalysisStoreContext,\n ): Promise<{ records: SpanMatchRecord[]; hasMore: boolean }> {\n // We scan against the original raw JSONL slice for each span and\n // record byte positions; the matched_text + context window is\n // truncated to `textBudget` bytes per record so total tool output\n // stays bounded even if hits cluster.\n const slice = buf\n .subarray(s.line_byte_offset, s.line_byte_offset + s.line_byte_length)\n .toString('utf8')\n const records: SpanMatchRecord[] = []\n let hasMore = false\n let matchIndex = 0\n for (const match of re.matchAll(slice)) {\n await scanCheckpoint(context?.signal, matchIndex++)\n if (records.length >= recordCap) {\n hasMore = true\n break\n }\n const offset = match.index ?? 0\n const before = slice.slice(Math.max(0, offset - textBudget / 2), offset)\n const after = slice.slice(\n offset + match[0].length,\n offset + match[0].length + Math.floor(textBudget / 2),\n )\n records.push({\n trace_id,\n span_id: s.span_id,\n span_name: s.name,\n span_kind: s.kind,\n attribute_path: bestAttributePathForOffset(slice, offset) ?? 'span.raw',\n matched_text: truncateForBudget(match[0], textBudget),\n context_before: truncateForBudget(before, textBudget),\n context_after: truncateForBudget(after, textBudget),\n match_offset: offset,\n })\n }\n return { records, hasMore }\n }\n}\n\nexport class OtlpFileTraceStore extends BufferedOtlpTraceStore {\n private readonly path: string\n private readonly maxFileBytes: number\n\n constructor(opts: OtlpFileTraceStoreOptions) {\n super(opts)\n this.path = opts.path\n this.maxFileBytes = validateInteger(\n opts.maxFileBytes ?? DEFAULT_MAX_TRACE_FILE_BYTES,\n 'maxFileBytes',\n 1,\n )\n }\n\n /** Stat-then-read so an oversized file fails loud before allocating the\n * source buffer. Missing files remain distinct from malformed traces. */\n protected async readBuffer(signal?: AbortSignal): Promise<Buffer> {\n signal?.throwIfAborted()\n let stats: Awaited<ReturnType<typeof stat>>\n try {\n stats = await stat(this.path)\n } catch (err) {\n if ((err as NodeJS.ErrnoException)?.code === 'ENOENT') {\n throw new TraceFileMissingError(this.path)\n }\n throw err\n }\n if (stats.size > this.maxFileBytes) {\n throw new TraceFileTooLargeError(this.path, stats.size, this.maxFileBytes)\n }\n signal?.throwIfAborted()\n return readFile(this.path, { signal })\n }\n\n protected sourcePath(): string {\n return this.path\n }\n}\n\nclass OtlpBufferTraceStore extends BufferedOtlpTraceStore {\n constructor(\n private readonly source: Buffer,\n opts: BufferedOtlpTraceStoreOptions,\n ) {\n super(opts)\n }\n\n protected async readBuffer(signal?: AbortSignal): Promise<Buffer> {\n signal?.throwIfAborted()\n return this.source\n }\n\n protected sourcePath(): string {\n return '<memory>'\n }\n}\n\n/** Build the bounded trace store directly from OpenInference JSONL text. */\nexport function otlpTextToTraceAnalysisStore(\n text: string,\n opts: ToolSpansToTraceAnalysisStoreOptions = {},\n): TraceAnalysisStore {\n if (!text.trim()) throw new CaptureIntegrityError('OTLP trace text must not be empty')\n return new OtlpBufferTraceStore(Buffer.from(text, 'utf8'), opts)\n}\n\nexport function createOtlpBufferTraceStore(\n source: Buffer,\n options: ToolSpansToTraceAnalysisStoreOptions = {},\n): TraceAnalysisStore {\n return new OtlpBufferTraceStore(source, options)\n}\n\nexport {\n SpanNotFoundError,\n TraceFileMalformedError,\n TraceFileMissingError,\n TraceFileTooLargeError,\n TraceNotFoundError,\n} from './errors'\n\n// ─── OTLP shape readers ──────────────────────────────────────────────\n//\n// The per-line projection lives in `./otlp-span` so the index here and\n// `otlpToRunRecords` read the same vocabulary off the same parser.\n\n// Per-call truncation counter. Each public read that projects spans\n// owns one of these and threads it through projectSpan; a store-keyed\n// counter would let two concurrent reads on the same store report each\n// other's truncation counts.\ninterface TruncationCounter {\n value: number\n}\n\n/** A `\"` at `idx` is a real JSON delimiter only when the run of `\\`\n * immediately preceding it is even-length; an odd run means the quote\n * is escaped (`\\\"`) and is part of a string value, not a boundary. */\nfunction isUnescapedQuote(slice: string, idx: number): boolean {\n if (slice[idx] !== '\"') return false\n let backslashes = 0\n let b = idx - 1\n while (b >= 0 && slice[b] === '\\\\') {\n backslashes += 1\n b -= 1\n }\n return backslashes % 2 === 0\n}\n\n/** Scan backwards from `from` (inclusive) for the nearest UNescaped `\"`.\n * Returns its index, or -1 when none is found. */\nfunction prevUnescapedQuote(slice: string, from: number): number {\n for (let i = from; i >= 0; i -= 1) {\n if (slice[i] === '\"' && isUnescapedQuote(slice, i)) return i\n }\n return -1\n}\n\n/**\n * Best-effort: locate the JSON path for the substring at `offset` in\n * a single span's JSONL slice. The slice is '...,\"key\":\"value...\"' — we\n * walk back from `offset` to the value-opening quote, past the `:`, to\n * the key's closing then opening quote, skipping `\\\"`-escaped quotes that\n * live inside string values. Returns `null` when the offset doesn't fall\n * inside a recognisable string field.\n */\nfunction bestAttributePathForOffset(slice: string, offset: number): string | null {\n // Value-opening quote: nearest unescaped '\"' at or before the offset.\n const valueQuote = prevUnescapedQuote(slice, Math.min(offset, slice.length - 1))\n if (valueQuote < 1) return null\n // The ':' separating key and value sits before the value quote.\n let j = valueQuote - 1\n while (j >= 0 && slice[j] !== ':') j -= 1\n if (j < 1) return null\n // Key closing quote, then key opening quote — both unescaped.\n const keyClose = prevUnescapedQuote(slice, j - 1)\n if (keyClose < 1) return null\n const keyOpen = prevUnescapedQuote(slice, keyClose - 1)\n if (keyOpen < 0) return null\n return slice.slice(keyOpen + 1, keyClose)\n}\n\n// ─── Error-cluster extraction ────────────────────────────────────────\n//\n// Deterministic failure-coverage population. The error-span loop in\n// getOverview already visits every ERROR span; bucketing them by a\n// normalized status_message signature turns \"N error spans\" into \"K\n// distinct failure modes\" — the checklist an analyst must close. No LLM.\n\nconst ERROR_CLUSTER_EXEMPLARS = 5\n\ninterface ErrorClusterAccumulator {\n signature: string\n sample: string\n traceIds: Set<string>\n spanIds: string[]\n spanCount: number\n spanNames: Map<string, number>\n toolNames: Map<string, number>\n}\n\n/** Collapse volatile tokens so semantically identical failures share a key:\n * hex/uuid ids → <id>, numbers → #, quoted/abs paths → <path>, durations →\n * <dur>, whitespace collapsed. Empty/absent messages fall back to the span\n * name so a no-message error still forms a real cluster. */\nfunction normalizeErrorSignature(message: string | undefined, spanName: string): string {\n const raw = (message ?? '').trim()\n const base = raw.length > 0 ? raw : `(${spanName || 'error'} — no message)`\n const norm = base\n .replace(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, '<id>')\n .replace(/\\b[0-9a-f]{12,}\\b/gi, '<id>')\n .replace(/(?:\\/[\\w.\\-@]+){2,}/g, '<path>')\n .replace(/\\b\\d+(?:\\.\\d+)?(ms|s|m|h|kb|mb|gb)?\\b/gi, (_m, u) => (u ? `#${u}` : '#'))\n .replace(/\\s+/g, ' ')\n .trim()\n return norm\n}\n\nfunction bump(map: Map<string, number>, key: string | null): void {\n if (!key) return\n map.set(key, (map.get(key) ?? 0) + 1)\n}\n\nfunction topKey(map: Map<string, number>): string | null {\n let best: string | null = null\n let bestN = 0\n for (const [k, n] of map)\n if (n > bestN) {\n best = k\n bestN = n\n }\n return best\n}\n\nfunction accumulateErrorCluster(\n clusters: Map<string, ErrorClusterAccumulator>,\n traceId: string,\n span: SpanIndexEntry,\n): void {\n const signature = normalizeErrorSignature(span.status_message, span.name)\n let acc = clusters.get(signature)\n if (!acc) {\n acc = {\n signature,\n sample: span.status_message ?? span.name ?? '',\n traceIds: new Set(),\n spanIds: [],\n spanCount: 0,\n spanNames: new Map(),\n toolNames: new Map(),\n }\n clusters.set(signature, acc)\n }\n acc.traceIds.add(traceId)\n acc.spanCount += 1\n if (acc.spanIds.length < ERROR_CLUSTER_EXEMPLARS && !acc.spanIds.includes(span.span_id)) {\n acc.spanIds.push(span.span_id)\n }\n bump(acc.spanNames, span.name)\n bump(acc.toolNames, span.tool_name)\n}\n\nfunction finalizeErrorClusters(\n clusters: Map<string, ErrorClusterAccumulator>,\n errorTraceCount: number,\n): ErrorCluster[] {\n const out = [...clusters.values()].map(\n (acc): ErrorCluster => ({\n signature: acc.signature,\n status_message_sample: acc.sample,\n span_name: topKey(acc.spanNames),\n tool_name: topKey(acc.toolNames),\n trace_count: acc.traceIds.size,\n span_count: acc.spanCount,\n prevalence: errorTraceCount > 0 ? acc.traceIds.size / errorTraceCount : 0,\n exemplar_trace_ids: [...acc.traceIds].slice(0, ERROR_CLUSTER_EXEMPLARS),\n exemplar_span_ids: acc.spanIds.slice(0, ERROR_CLUSTER_EXEMPLARS),\n }),\n )\n out.sort((a, b) => b.trace_count - a.trace_count || b.span_count - a.span_count)\n return out\n}\n"],"mappings":";;;;AAOA,SAAgB,0BACd,SACwB;CACxB,MAAM,aAAa,IAAI,gBAAgB;CACvC,MAAM,OAA+B;EACnC;EACA,SAAS,QAAQ,WAAW,MAAM;EAClC,WAAW;EACX,SAAS;CACX;CACA,KAAU,QAAQ,WACV;EACJ,KAAK,UAAU;CACjB,SACM;EACJ,KAAK,UAAU;CACjB,CACF;CACA,OAAO;AACT;AAEA,SAAgB,kBACd,MACA,QACY;CACZ,QAAQ,eAAe;CACvB,KAAK,aAAa;CAElB,OAAO,IAAI,SAAY,SAAS,WAAW;EACzC,IAAI,WAAW;EACf,MAAM,UAAU,aAA+B;GAC7C,IAAI,UAAU;GACd,WAAW;GACX,QAAQ,oBAAoB,SAAS,OAAO;GAC5C,KAAK,aAAa;GAClB,SAAS;EACX;EACA,MAAM,gBAAsB;GAC1B,aAAa;IACX,OAAO,QAAQ,MAAM;IACrB,IAAI,CAAC,KAAK,WAAW,KAAK,cAAc,GACtC,KAAK,WAAW,MAAM,QAAQ,MAAM;GAExC,CAAC;EACH;EAEA,QAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;EACzD,KAAK,QAAQ,MACV,UAAU,aAAa,QAAQ,KAAK,CAAC,IACrC,UAAmB,aAAa,OAAO,KAAK,CAAC,CAChD;EACA,IAAI,QAAQ,SAAS,QAAQ;CAC/B,CAAC;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACmBA,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;;AAGzB,SAAS,mBAAkC;CACzC,OAAO,IAAI,SAAS,YAAY,aAAa,OAAO,CAAC;AACvD;AAEA,eAAe,eAAe,QAAiC,MAA6B;CAC1F,QAAQ,eAAe;CACvB,IAAI,OAA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AS;CAChC,IAAI,CAAC,KAAK;EACR,MAAM;GACJ;GACA,QAAQ,KAAK,kBAAkB,KAAK,QAAQ;GAC5C,0BAAU,IAAI,IAAI;GAClB,SAAS,CAAC;GACV,WAAW;GACX,2BAAW,IAAI,IAAI;GACnB,2BAAW,IAAI,IAAI;EACrB;EACA,SAAS,IAAI,WAAW,GAAG;CAC7B;CACA,IAAI,SAAS,IAAI,OAAO;CACxB,IAAI,aAAa;CACjB,IAAI,IAAI,QAAQ,SAAS,2BAA2B,CAAC,IAAI,QAAQ,SAAS,KAAK,OAAO,GACpF,IAAI,QAAQ,KAAK,KAAK,OAAO;CAE/B,KAAK,IAAI,WAAW,KAAK,IAAI;CAC7B,KAAK,IAAI,WAAW,KAAK,SAAS;AACpC;AAEA,SAAS,sBACP,UACA,iBACgB;CAChB,MAAM,MAAM,CAAC,GAAG,SAAS,OAAO,CAAC,CAAC,CAAC,KAChC,SAAuB;EACtB,WAAW,IAAI;EACf,uBAAuB,IAAI;EAC3B,WAAW,OAAO,IAAI,SAAS;EAC/B,WAAW,OAAO,IAAI,SAAS;EAC/B,aAAa,IAAI,SAAS;EAC1B,YAAY,IAAI;EAChB,YAAY,kBAAkB,IAAI,IAAI,SAAS,OAAO,kBAAkB;EACxE,oBAAoB,CAAC,GAAG,IAAI,QAAQ,CAAC,CAAC,MAAM,GAAG,uBAAuB;EACtE,mBAAmB,IAAI,QAAQ,MAAM,GAAG,uBAAuB;CACjE,EACF;CACA,IAAI,MAAM,GAAG,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU;CAC/E,OAAO;AACT"}
1
+ {"version":3,"file":"store-otlp-C_Rq5I4D.js","names":[],"sources":["../src/trace-analyst/shared-abortable-task.ts","../src/trace-analyst/store-otlp.ts"],"sourcesContent":["export interface SharedAbortableTask<T> {\n controller: AbortController\n promise: Promise<T>\n consumers: number\n settled: boolean\n}\n\nexport function createSharedAbortableTask<T>(\n factory: (signal: AbortSignal) => Promise<T>,\n): SharedAbortableTask<T> {\n const controller = new AbortController()\n const task: SharedAbortableTask<T> = {\n controller,\n promise: factory(controller.signal),\n consumers: 0,\n settled: false,\n }\n void task.promise.then(\n () => {\n task.settled = true\n },\n () => {\n task.settled = true\n },\n )\n return task\n}\n\nexport function waitForSharedTask<T>(\n task: SharedAbortableTask<T>,\n signal: AbortSignal | undefined,\n): Promise<T> {\n signal?.throwIfAborted()\n task.consumers += 1\n\n return new Promise<T>((resolve, reject) => {\n let finished = false\n const finish = (callback: () => void): void => {\n if (finished) return\n finished = true\n signal?.removeEventListener('abort', onAbort)\n task.consumers -= 1\n callback()\n }\n const onAbort = (): void => {\n finish(() => {\n reject(signal?.reason)\n if (!task.settled && task.consumers === 0) {\n task.controller.abort(signal?.reason)\n }\n })\n }\n\n signal?.addEventListener('abort', onAbort, { once: true })\n task.promise.then(\n (value) => finish(() => resolve(value)),\n (error: unknown) => finish(() => reject(error)),\n )\n if (signal?.aborted) onAbort()\n })\n}\n","/**\n * `OtlpFileTraceStore` — read-only OTLP-JSONL trace store for the\n * trace-analyst.\n *\n * Wire shape. Each line of the input file is one OTLP-shaped span. The\n * store understands flattened OTLP JSONL plus the OpenInference vocab.\n * We project upstream's full\n * span shape down to `TraceAnalystSpan` lazily — full materialisation\n * only happens for the spans the agent actually requests.\n *\n * Indexing. On first read the store builds an in-memory index keyed\n * by `trace_id` carrying:\n * - byte offsets + lengths for each span line (for surgical reads\n * without re-parsing the whole file)\n * - a `TraceAnalystTraceSummary` rollup\n * - sets of services / agents / models / tools / has_errors\n * - byte size of the trace's JSONL slab\n *\n * Memory bound. The index keeps span metadata only — names, kinds,\n * offsets, status. Attribute payloads stay on disk until requested.\n * For a 50MB JSONL with 50k spans, the index is ~5MB.\n *\n * Concurrency. The store builds the index once on first read and\n * caches it. Subsequent reads reuse the index. The file is opened on\n * each read; we never hold a long-lived FD.\n */\n\nimport { readFile, stat } from 'node:fs/promises'\nimport type { RE2JS } from 're2js'\nimport { CaptureIntegrityError } from '../errors'\nimport {\n SpanNotFoundError,\n TraceAnalysisLimitError,\n TraceAnalysisValidationError,\n TraceFileMalformedError,\n TraceFileMissingError,\n TraceFileTooLargeError,\n TraceNotFoundError,\n} from './errors'\nimport {\n compareSpanTime,\n extractOtlpAttributes,\n projectOtlpFlatLine,\n spanEpochMillis,\n} from './otlp-span'\nimport {\n createSharedAbortableTask,\n type SharedAbortableTask,\n waitForSharedTask,\n} from './shared-abortable-task'\nimport {\n compileSearchRegex,\n TRACE_ANALYSIS_LIMITS,\n type TraceAnalysisStore,\n type TraceAnalysisStoreContext,\n truncateForBudget,\n validateInteger,\n} from './store'\nimport {\n type DatasetOverview,\n DEFAULT_TRACE_ANALYST_BUDGETS,\n type ErrorCluster,\n type QueryTracesPage,\n type SearchSpanResult,\n type SearchTraceResult,\n type SpanMatchRecord,\n type TraceAnalystFilters,\n type TraceAnalystSpan,\n type TraceAnalystSpanKind,\n type TraceAnalystSpanStatus,\n type TraceAnalystTraceSummary,\n type ViewSpansResult,\n type ViewTraceOversized,\n type ViewTraceResult,\n} from './types'\n\n/** Lines indexed between event-loop yields. Bounded synchronous work per\n * tick keeps the index build from starving other tasks on large files\n * while staying coarse enough that the yields are cheap. */\nconst INDEX_YIELD_LINES = 5000\nconst SCAN_YIELD_ITEMS = 500\n\n/** Hand control back to the event loop without busy-waiting. */\nfunction yieldToEventLoop(): Promise<void> {\n return new Promise((resolve) => setImmediate(resolve))\n}\n\nasync function scanCheckpoint(signal: AbortSignal | undefined, item: number): Promise<void> {\n signal?.throwIfAborted()\n if (item > 0 && item % SCAN_YIELD_ITEMS === 0) {\n await yieldToEventLoop()\n signal?.throwIfAborted()\n }\n}\n\ninterface SpanIndexEntry {\n span_id: string\n parent_span_id: string | null\n name: string\n kind: TraceAnalystSpanKind\n start_time: string\n end_time: string\n duration_ms: number\n status: TraceAnalystSpanStatus\n status_message: string | undefined\n service_name: string | null\n agent_name: string | null\n model_name: string | null\n tool_name: string | null\n /** Byte offset in the raw JSONL file to the start of this span's line. */\n line_byte_offset: number\n /** Length of this line in bytes (excluding the trailing newline). */\n line_byte_length: number\n}\n\ninterface TraceIndexEntry {\n trace_id: string\n service_name: string | null\n agent_name: string | null\n span_count: number\n has_errors: boolean\n start_time: string\n end_time: string\n duration_ms: number\n raw_jsonl_bytes: number\n models: Set<string>\n tools: Set<string>\n spans: SpanIndexEntry[]\n /** Sorted by line offset for stable iteration. */\n}\n\ninterface DatasetIndex {\n byTrace: Map<string, TraceIndexEntry>\n totalRawBytes: number\n // Pre-computed sorted trace_ids for sample/query stability.\n sortedTraceIds: string[]\n}\n\nexport interface ToolSpansToTraceAnalysisStoreOptions {\n /** Override the discovery (`viewTrace`) per-attribute byte cap. */\n perAttributeViewBudget?: number\n /** Override the surgical (`viewSpans`) per-attribute byte cap. */\n perAttributeSpanBudget?: number\n /** Override the per-call ceiling that triggers oversized summaries. */\n perCallByteCeiling?: number\n /** Override the per-match text budget. */\n perMatchTextBudget?: number\n}\n\ntype BufferedOtlpTraceStoreOptions = ToolSpansToTraceAnalysisStoreOptions\n\nexport interface OtlpFileTraceStoreOptions extends BufferedOtlpTraceStoreOptions {\n /** Path to the OTLP-JSONL file. */\n path: string\n /**\n * Hard ceiling on the trace file size in bytes. The store reads the\n * whole file into one Buffer and indexes it in memory, so an\n * unbounded file OOMs the process. Above this size the store fails\n * loud with `TraceFileTooLargeError` instead of degrading silently.\n * Default 256 MiB.\n */\n maxFileBytes?: number\n}\n\n/** Default ceiling for {@link OtlpFileTraceStoreOptions.maxFileBytes}. */\nexport const DEFAULT_MAX_TRACE_FILE_BYTES = 256 * 1024 * 1024\n\nabstract class BufferedOtlpTraceStore implements TraceAnalysisStore {\n private readonly perAttributeViewBudget: number\n private readonly perAttributeSpanBudget: number\n private readonly perCallByteCeiling: number\n private readonly perMatchTextBudget: number\n private indexValue?: DatasetIndex\n private indexTask?: SharedAbortableTask<DatasetIndex>\n private bufferValue?: Buffer\n private bufferTask?: SharedAbortableTask<Buffer>\n\n constructor(opts: BufferedOtlpTraceStoreOptions) {\n this.perAttributeViewBudget = validateInteger(\n opts.perAttributeViewBudget ?? DEFAULT_TRACE_ANALYST_BUDGETS.perAttributeViewBudget,\n 'perAttributeViewBudget',\n TRACE_ANALYSIS_LIMITS.minimumTextBudget,\n )\n this.perAttributeSpanBudget = validateInteger(\n opts.perAttributeSpanBudget ?? DEFAULT_TRACE_ANALYST_BUDGETS.perAttributeSpanBudget,\n 'perAttributeSpanBudget',\n TRACE_ANALYSIS_LIMITS.minimumTextBudget,\n )\n this.perCallByteCeiling = validateInteger(\n opts.perCallByteCeiling ?? DEFAULT_TRACE_ANALYST_BUDGETS.perCallByteCeiling,\n 'perCallByteCeiling',\n 1,\n )\n this.perMatchTextBudget = validateInteger(\n opts.perMatchTextBudget ?? DEFAULT_TRACE_ANALYST_BUDGETS.perMatchTextBudget,\n 'perMatchTextBudget',\n TRACE_ANALYSIS_LIMITS.minimumTextBudget,\n )\n }\n\n // ─── Public API ────────────────────────────────────────────────────\n\n async hasTrace(trace_id: string, context?: TraceAnalysisStoreContext): Promise<boolean> {\n context?.signal?.throwIfAborted()\n const idx = await this.index(context)\n context?.signal?.throwIfAborted()\n return idx.byTrace.has(trace_id)\n }\n\n async hasSpans(\n opts: { trace_id: string; span_ids: readonly string[] },\n context?: TraceAnalysisStoreContext,\n ): Promise<string[]> {\n context?.signal?.throwIfAborted()\n const idx = await this.index(context)\n const trace = idx.byTrace.get(opts.trace_id)\n if (!trace) return []\n const requested = new Set(opts.span_ids)\n const found: string[] = []\n for (let index = 0; index < trace.spans.length; index += 1) {\n await scanCheckpoint(context?.signal, index)\n const spanId = trace.spans[index]!.span_id\n if (requested.has(spanId)) found.push(spanId)\n }\n return found\n }\n\n async getOverview(\n filters?: TraceAnalystFilters,\n context?: TraceAnalysisStoreContext,\n ): Promise<DatasetOverview> {\n const idx = await this.index(context)\n const matched = await this.matchedTraces(idx, filters, context)\n\n const services = new Set<string>()\n const agents = new Set<string>()\n const models = new Set<string>()\n const tools = new Set<string>()\n let rawBytes = 0\n let earliest: string | null = null\n let latest: string | null = null\n let errorTraceCount = 0\n let errorSpanCount = 0\n const clusters = new Map<string, ErrorClusterAccumulator>()\n\n let traceIndex = 0\n for (const t of matched) {\n await scanCheckpoint(context?.signal, traceIndex++)\n if (t.service_name) services.add(t.service_name)\n if (t.agent_name) agents.add(t.agent_name)\n for (const m of t.models) models.add(m)\n for (const tn of t.tools) tools.add(tn)\n rawBytes += t.raw_jsonl_bytes\n if (!earliest || compareSpanTime(t.start_time, earliest) < 0) earliest = t.start_time\n if (!latest || compareSpanTime(t.end_time, latest) > 0) latest = t.end_time\n if (t.has_errors) {\n errorTraceCount += 1\n let spanIndex = 0\n for (const s of t.spans) {\n await scanCheckpoint(context?.signal, spanIndex++)\n if (s.status !== 'ERROR') continue\n errorSpanCount += 1\n accumulateErrorCluster(clusters, t.trace_id, s)\n }\n }\n }\n\n const sample_trace_ids = matched.slice(0, 20).map((t) => t.trace_id)\n return {\n total_traces: matched.length,\n raw_jsonl_bytes: rawBytes,\n services: [...services].sort(),\n agents: [...agents].sort(),\n models: [...models].sort(),\n tool_names: [...tools].sort(),\n sample_trace_ids,\n errors: { trace_count: errorTraceCount, span_count: errorSpanCount },\n error_clusters: finalizeErrorClusters(clusters, errorTraceCount),\n time_range: earliest && latest ? { earliest, latest } : null,\n }\n }\n\n async queryTraces(\n opts: { filters?: TraceAnalystFilters; limit: number; offset?: number },\n context?: TraceAnalysisStoreContext,\n ): Promise<QueryTracesPage> {\n const limit = validateInteger(\n opts.limit,\n 'queryTraces.limit',\n 1,\n TRACE_ANALYSIS_LIMITS.queryTraces,\n )\n const offset = validateInteger(opts.offset ?? 0, 'queryTraces.offset', 0)\n\n const idx = await this.index(context)\n const matched = await this.matchedTraces(idx, opts.filters, context)\n const slice = matched.slice(offset, offset + limit)\n return {\n traces: slice.map((t) => this.toSummary(t)),\n total: matched.length,\n has_more: offset + slice.length < matched.length,\n }\n }\n\n async countTraces(\n filters?: TraceAnalystFilters,\n context?: TraceAnalysisStoreContext,\n ): Promise<number> {\n const idx = await this.index(context)\n const matched = await this.matchedTraces(idx, filters, context)\n return matched.length\n }\n\n async viewTrace(\n opts: { trace_id: string; per_attribute_byte_cap?: number },\n context?: TraceAnalysisStoreContext,\n ): Promise<ViewTraceResult> {\n context?.signal?.throwIfAborted()\n const idx = await this.index(context)\n const trace = idx.byTrace.get(opts.trace_id)\n if (!trace) {\n throw new TraceNotFoundError(opts.trace_id)\n }\n const cap = validateInteger(\n opts.per_attribute_byte_cap ?? this.perAttributeViewBudget,\n 'viewTrace.per_attribute_byte_cap',\n 1,\n )\n\n // Probe size first — if the materialised payload would exceed\n // the per-call ceiling we return an oversized summary rather than\n // blowing the agent's context.\n const buf = await this.buffer(context)\n const spans: TraceAnalystSpan[] = []\n let runningBytes = 0\n let span_response_bytes_max = 0\n const counter: TruncationCounter = { value: 0 }\n let spanIndex = 0\n for (const s of trace.spans) {\n await scanCheckpoint(context?.signal, spanIndex++)\n const projected = this.projectSpan(buf, trace.trace_id, s, cap, counter)\n const bytes = Buffer.byteLength(JSON.stringify(projected), 'utf8')\n span_response_bytes_max = Math.max(span_response_bytes_max, bytes)\n runningBytes += bytes\n if (runningBytes > this.perCallByteCeiling) {\n return {\n trace_id: trace.trace_id,\n oversized: this.buildOversizedSummary(trace, span_response_bytes_max),\n }\n }\n spans.push(projected)\n }\n return { trace_id: trace.trace_id, spans }\n }\n\n async viewSpans(\n opts: { trace_id: string; span_ids: readonly string[]; per_attribute_byte_cap?: number },\n context?: TraceAnalysisStoreContext,\n ): Promise<ViewSpansResult> {\n context?.signal?.throwIfAborted()\n const idx = await this.index(context)\n const trace = idx.byTrace.get(opts.trace_id)\n if (!trace) throw new TraceNotFoundError(opts.trace_id)\n if (opts.span_ids.length < 1 || opts.span_ids.length > TRACE_ANALYSIS_LIMITS.viewSpans) {\n throw new TraceAnalysisValidationError(\n `viewSpans.span_ids must contain 1..${TRACE_ANALYSIS_LIMITS.viewSpans} ids, got ${opts.span_ids.length}`,\n )\n }\n const cap = validateInteger(\n opts.per_attribute_byte_cap ?? this.perAttributeSpanBudget,\n 'viewSpans.per_attribute_byte_cap',\n 1,\n )\n\n const requested = [...new Set(opts.span_ids)]\n const wantSet = new Set(requested)\n const foundById = new Map<string, SpanIndexEntry>()\n for (let index = 0; index < trace.spans.length; index += 1) {\n await scanCheckpoint(context?.signal, index)\n const span = trace.spans[index]!\n if (wantSet.has(span.span_id)) foundById.set(span.span_id, span)\n }\n const missing = requested.filter((id) => !foundById.has(id))\n\n const buf = await this.buffer(context)\n const spans: TraceAnalystSpan[] = []\n let truncatedAttributeCount = 0\n const omitted = new Set(requested.filter((id) => foundById.has(id)))\n const buildResult = (): ViewSpansResult => ({\n trace_id: trace.trace_id,\n spans,\n missing_span_ids: missing,\n omitted_span_ids: requested.filter((id) => omitted.has(id)),\n has_more: omitted.size > 0,\n truncated_attribute_count: truncatedAttributeCount,\n })\n const metadataBytes = Buffer.byteLength(JSON.stringify(buildResult()), 'utf8')\n if (metadataBytes > this.perCallByteCeiling) {\n throw new TraceAnalysisLimitError(\n 'viewSpans',\n metadataBytes,\n this.perCallByteCeiling,\n `viewSpans accounting requires ${metadataBytes} bytes, over the ${this.perCallByteCeiling}-byte response limit`,\n )\n }\n let spanIndex = 0\n let smallestRejectedBytes = Number.POSITIVE_INFINITY\n for (const id of requested) {\n await scanCheckpoint(context?.signal, spanIndex++)\n const s = foundById.get(id)\n if (!s) continue\n const counter: TruncationCounter = { value: 0 }\n const projected = this.projectSpan(buf, trace.trace_id, s, cap, counter)\n spans.push(projected)\n omitted.delete(id)\n truncatedAttributeCount += counter.value\n const responseBytes = Buffer.byteLength(JSON.stringify(buildResult()), 'utf8')\n if (responseBytes <= this.perCallByteCeiling) {\n continue\n }\n smallestRejectedBytes = Math.min(smallestRejectedBytes, responseBytes)\n if (requested.length === 1) {\n throw new TraceAnalysisLimitError(\n 'viewSpans',\n responseBytes,\n this.perCallByteCeiling,\n `viewSpans cannot fit span ${JSON.stringify(id)} in the ${this.perCallByteCeiling}-byte response limit`,\n )\n }\n spans.pop()\n omitted.add(id)\n truncatedAttributeCount -= counter.value\n }\n if (foundById.size > 0 && spans.length === 0) {\n throw new TraceAnalysisLimitError(\n 'viewSpans',\n smallestRejectedBytes,\n this.perCallByteCeiling,\n `viewSpans cannot fit one requested span in the ${this.perCallByteCeiling}-byte response limit`,\n )\n }\n return buildResult()\n }\n\n async searchTrace(\n opts: { trace_id: string; regex_pattern: string; max_matches?: number },\n context?: TraceAnalysisStoreContext,\n ): Promise<SearchTraceResult> {\n const max_matches = validateInteger(\n opts.max_matches ?? 50,\n 'searchTrace.max_matches',\n 1,\n TRACE_ANALYSIS_LIMITS.searchMatches,\n )\n const idx = await this.index(context)\n const trace = idx.byTrace.get(opts.trace_id)\n if (!trace) throw new TraceNotFoundError(opts.trace_id)\n const re = compileSearchRegex(opts.regex_pattern)\n\n const buf = await this.buffer(context)\n const hits: SpanMatchRecord[] = []\n let hasMore = false\n let spanIndex = 0\n for (const s of trace.spans) {\n await scanCheckpoint(context?.signal, spanIndex++)\n const remaining = max_matches - hits.length\n const localHits = await this.scanSpanForMatches(\n buf,\n trace.trace_id,\n s,\n re,\n this.perMatchTextBudget,\n remaining,\n context,\n )\n for (const h of localHits.records) {\n if (hits.length >= max_matches) break\n hits.push(h)\n }\n if (localHits.hasMore) {\n hasMore = true\n break\n }\n }\n return {\n trace_id: trace.trace_id,\n hits,\n has_more: hasMore,\n }\n }\n\n async searchSpan(\n opts: { trace_id: string; span_id: string; regex_pattern: string; max_matches?: number },\n context?: TraceAnalysisStoreContext,\n ): Promise<SearchSpanResult> {\n const max_matches = validateInteger(\n opts.max_matches ?? 50,\n 'searchSpan.max_matches',\n 1,\n TRACE_ANALYSIS_LIMITS.searchMatches,\n )\n const idx = await this.index(context)\n const trace = idx.byTrace.get(opts.trace_id)\n if (!trace) throw new TraceNotFoundError(opts.trace_id)\n let span: SpanIndexEntry | undefined\n for (let index = 0; index < trace.spans.length; index += 1) {\n await scanCheckpoint(context?.signal, index)\n const candidate = trace.spans[index]!\n if (candidate.span_id === opts.span_id) {\n span = candidate\n break\n }\n }\n if (!span) {\n throw new SpanNotFoundError(opts.trace_id, opts.span_id)\n }\n const re = compileSearchRegex(opts.regex_pattern)\n const buf = await this.buffer(context)\n const localHits = await this.scanSpanForMatches(\n buf,\n trace.trace_id,\n span,\n re,\n this.perMatchTextBudget,\n max_matches,\n context,\n )\n return {\n trace_id: trace.trace_id,\n span_id: span.span_id,\n hits: localHits.records,\n has_more: localHits.hasMore,\n }\n }\n\n // ─── Index building ────────────────────────────────────────────────\n\n /** Force the index to materialise. Useful to amortise startup cost\n * before the first agent call. */\n async ensureIndexed(context?: TraceAnalysisStoreContext): Promise<void> {\n await this.index(context)\n }\n\n private async buffer(context?: TraceAnalysisStoreContext): Promise<Buffer> {\n context?.signal?.throwIfAborted()\n if (this.bufferValue) return this.bufferValue\n if (!this.bufferTask) {\n const task = createSharedAbortableTask((signal) => this.readBuffer(signal))\n this.bufferTask = task\n void task.promise.then(\n (value) => {\n this.bufferValue = value\n if (this.bufferTask === task) this.bufferTask = undefined\n },\n () => {\n if (this.bufferTask === task) this.bufferTask = undefined\n },\n )\n }\n return waitForSharedTask(this.bufferTask, context?.signal)\n }\n\n protected abstract readBuffer(signal?: AbortSignal): Promise<Buffer>\n\n protected abstract sourcePath(): string\n\n private async index(context?: TraceAnalysisStoreContext): Promise<DatasetIndex> {\n context?.signal?.throwIfAborted()\n if (this.indexValue) return this.indexValue\n if (!this.indexTask) {\n const task = createSharedAbortableTask((signal) => this.buildIndex(signal))\n this.indexTask = task\n void task.promise.then(\n (value) => {\n this.indexValue = value\n if (this.indexTask === task) this.indexTask = undefined\n },\n () => {\n if (this.indexTask === task) this.indexTask = undefined\n },\n )\n }\n return waitForSharedTask(this.indexTask, context?.signal)\n }\n\n private async buildIndex(signal?: AbortSignal): Promise<DatasetIndex> {\n // readGuarded surfaces missing/oversized files as typed errors.\n const buf = await this.buffer({ signal })\n signal?.throwIfAborted()\n\n const byTrace = new Map<string, TraceIndexEntry>()\n let cursor = 0\n let lineNumber = 0\n let sinceYield = 0\n while (cursor < buf.length) {\n lineNumber += 1\n // Yield to the event loop every INDEX_YIELD_LINES lines so a huge\n // file doesn't monopolise the thread for the whole index build.\n if (++sinceYield >= INDEX_YIELD_LINES) {\n sinceYield = 0\n await yieldToEventLoop()\n signal?.throwIfAborted()\n }\n const newlineIndex = buf.indexOf(0x0a, cursor) // \\n\n const lineEnd = newlineIndex === -1 ? buf.length : newlineIndex\n const lineLength = lineEnd - cursor\n if (lineLength === 0) {\n cursor = lineEnd + 1\n continue\n }\n const lineSlice = buf.subarray(cursor, lineEnd).toString('utf8')\n const lineOffset = cursor\n cursor = lineEnd + 1\n\n let parsed: unknown\n try {\n parsed = JSON.parse(lineSlice)\n } catch (cause) {\n throw new TraceFileMalformedError(this.sourcePath(), lineNumber, lineOffset, cause)\n }\n if (!parsed || typeof parsed !== 'object') {\n throw new TraceFileMalformedError(this.sourcePath(), lineNumber, lineOffset)\n }\n const span = projectOtlpFlatLine(parsed as Record<string, unknown>)\n if (!span) {\n throw new TraceFileMalformedError(this.sourcePath(), lineNumber, lineOffset)\n }\n\n let entry = byTrace.get(span.trace_id)\n if (!entry) {\n entry = {\n trace_id: span.trace_id,\n service_name: span.service_name,\n agent_name: span.agent_name,\n span_count: 0,\n has_errors: false,\n start_time: span.start_time,\n end_time: span.end_time,\n duration_ms: 0,\n raw_jsonl_bytes: 0,\n models: new Set(),\n tools: new Set(),\n spans: [],\n }\n byTrace.set(span.trace_id, entry)\n } else {\n // Pin the trace's service/agent to the first AGENT span we\n // Prefer the first agent/service fields that appear in the trace.\n if (!entry.service_name && span.service_name) entry.service_name = span.service_name\n if (!entry.agent_name && span.agent_name) entry.agent_name = span.agent_name\n }\n\n const indexEntry: SpanIndexEntry = {\n span_id: span.span_id,\n parent_span_id: span.parent_span_id,\n name: span.name,\n kind: span.kind,\n start_time: span.start_time,\n end_time: span.end_time,\n duration_ms: span.duration_ms,\n status: span.status,\n status_message: span.status_message,\n service_name: span.service_name,\n agent_name: span.agent_name,\n model_name: span.model_name,\n tool_name: span.tool_name,\n line_byte_offset: lineOffset,\n line_byte_length: lineLength,\n }\n entry.spans.push(indexEntry)\n entry.span_count += 1\n entry.raw_jsonl_bytes += lineLength + 1 // +1 newline byte\n if (span.status === 'ERROR') entry.has_errors = true\n if (compareSpanTime(span.start_time, entry.start_time) < 0) entry.start_time = span.start_time\n if (compareSpanTime(span.end_time, entry.end_time) > 0) entry.end_time = span.end_time\n if (span.model_name) entry.models.add(span.model_name)\n if (span.tool_name) entry.tools.add(span.tool_name)\n }\n\n // Compute trace duration once, sort spans by start time for\n // stable iteration.\n let totalRawBytes = 0\n for (const t of byTrace.values()) {\n signal?.throwIfAborted()\n totalRawBytes += t.raw_jsonl_bytes\n t.spans.sort(\n (a, b) =>\n compareSpanTime(a.start_time, b.start_time) || a.line_byte_offset - b.line_byte_offset,\n )\n // Duration is 0 unless BOTH bounds parse — a missing/garbage timestamp\n // yields 0, never a NaN (→ null in JSON) or a bogus epoch-from-zero span.\n const startMs = spanEpochMillis(t.start_time)\n const endMs = spanEpochMillis(t.end_time)\n t.duration_ms = startMs === null || endMs === null ? 0 : Math.max(0, endMs - startMs)\n }\n const sortedTraceIds = [...byTrace.keys()].sort()\n signal?.throwIfAborted()\n\n return { byTrace, totalRawBytes, sortedTraceIds }\n }\n\n // ─── Filter pipeline ───────────────────────────────────────────────\n\n private async matchedTraces(\n idx: DatasetIndex,\n filters: TraceAnalystFilters | undefined,\n context?: TraceAnalysisStoreContext,\n ): Promise<TraceIndexEntry[]> {\n context?.signal?.throwIfAborted()\n const traces: TraceIndexEntry[] = []\n for (let index = 0; index < idx.sortedTraceIds.length; index += 1) {\n await scanCheckpoint(context?.signal, index)\n const trace = idx.byTrace.get(idx.sortedTraceIds[index]!)\n if (trace) traces.push(trace)\n }\n if (!filters) return traces\n\n const indexedFiltered: TraceIndexEntry[] = []\n for (let index = 0; index < traces.length; index += 1) {\n await scanCheckpoint(context?.signal, index)\n const t = traces[index]!\n if (filters.has_errors !== undefined && t.has_errors !== filters.has_errors) continue\n if (filters.service_names && filters.service_names.length > 0) {\n if (!t.service_name || !filters.service_names.includes(t.service_name)) continue\n }\n if (filters.agent_names && filters.agent_names.length > 0) {\n if (!t.agent_name || !filters.agent_names.includes(t.agent_name)) continue\n }\n if (filters.model_names && filters.model_names.length > 0) {\n if (![...t.models].some((m) => filters.model_names!.includes(m))) continue\n }\n if (filters.tool_names && filters.tool_names.length > 0) {\n if (![...t.tools].some((tn) => filters.tool_names!.includes(tn))) continue\n }\n if (filters.start_time_after && t.start_time < filters.start_time_after) continue\n if (filters.start_time_before && t.start_time > filters.start_time_before) continue\n indexedFiltered.push(t)\n }\n\n if (!filters.regex_pattern) return indexedFiltered\n\n // Opt-in raw-bytes scan — only over the already-narrowed set.\n const re = compileSearchRegex(filters.regex_pattern)\n const buf = await this.buffer(context)\n const out: TraceIndexEntry[] = []\n let traceIndex = 0\n for (const t of indexedFiltered) {\n await scanCheckpoint(context?.signal, traceIndex++)\n let matched = false\n let spanIndex = 0\n for (const s of t.spans) {\n await scanCheckpoint(context?.signal, spanIndex++)\n const slice = buf.subarray(s.line_byte_offset, s.line_byte_offset + s.line_byte_length)\n // Buffer.toString allocates; tolerate it because regex_pattern\n // is opt-in. Future optimisation: byte-level fast-path for\n // ASCII-only patterns.\n if (re.test(slice.toString('utf8'))) {\n matched = true\n break\n }\n }\n if (matched) out.push(t)\n }\n return out\n }\n\n private toSummary(t: TraceIndexEntry): TraceAnalystTraceSummary {\n return {\n trace_id: t.trace_id,\n service_name: t.service_name,\n agent_name: t.agent_name,\n span_count: t.span_count,\n has_errors: t.has_errors,\n start_time: t.start_time,\n end_time: t.end_time,\n duration_ms: t.duration_ms,\n raw_jsonl_bytes: t.raw_jsonl_bytes,\n models: [...t.models].sort(),\n tools: [...t.tools].sort(),\n }\n }\n\n // ─── Span projection (lazy attribute reads) ────────────────────────\n\n private projectSpan(\n buf: Buffer,\n trace_id: string,\n s: SpanIndexEntry,\n perAttrCap: number,\n counter: TruncationCounter,\n ): TraceAnalystSpan {\n const slice = buf\n .subarray(s.line_byte_offset, s.line_byte_offset + s.line_byte_length)\n .toString('utf8')\n let raw: Record<string, unknown> = {}\n try {\n const parsed = JSON.parse(slice)\n if (parsed && typeof parsed === 'object') raw = parsed as Record<string, unknown>\n } catch {\n // Should not happen — index pre-validated.\n }\n const attrs = extractOtlpAttributes(raw)\n const projected: Record<string, unknown> = {}\n for (const [k, v] of Object.entries(attrs)) {\n if (typeof v === 'string') {\n const trunc = truncateForBudget(v, perAttrCap)\n if (trunc !== v) counter.value += 1\n projected[k] = trunc\n } else if (Array.isArray(v) || (v && typeof v === 'object')) {\n const json = JSON.stringify(v)\n const trunc = truncateForBudget(json, perAttrCap)\n if (trunc !== json) {\n counter.value += 1\n projected[k] = trunc\n } else {\n projected[k] = v\n }\n } else {\n projected[k] = v\n }\n }\n return {\n trace_id,\n span_id: s.span_id,\n parent_span_id: s.parent_span_id,\n name: s.name,\n kind: s.kind,\n start_time: s.start_time,\n end_time: s.end_time,\n duration_ms: s.duration_ms,\n status: s.status,\n status_message: s.status_message,\n service_name: s.service_name,\n agent_name: s.agent_name,\n model_name: s.model_name,\n tool_name: s.tool_name,\n attributes: projected,\n }\n }\n\n private buildOversizedSummary(\n t: TraceIndexEntry,\n span_response_bytes_max: number,\n ): ViewTraceOversized {\n const counts = new Map<string, number>()\n let errorCount = 0\n for (const s of t.spans) {\n counts.set(s.name, (counts.get(s.name) ?? 0) + 1)\n if (s.status === 'ERROR') errorCount += 1\n }\n const top = [...counts.entries()].sort((a, b) => b[1] - a[1]).slice(0, 20)\n return {\n span_count: t.span_count,\n top_span_names: top,\n span_response_bytes_max,\n error_span_count: errorCount,\n }\n }\n\n private async scanSpanForMatches(\n buf: Buffer,\n trace_id: string,\n s: SpanIndexEntry,\n re: RE2JS,\n textBudget: number,\n recordCap: number,\n context?: TraceAnalysisStoreContext,\n ): Promise<{ records: SpanMatchRecord[]; hasMore: boolean }> {\n // We scan against the original raw JSONL slice for each span and\n // record byte positions; the matched_text + context window is\n // truncated to `textBudget` bytes per record so total tool output\n // stays bounded even if hits cluster.\n const slice = buf\n .subarray(s.line_byte_offset, s.line_byte_offset + s.line_byte_length)\n .toString('utf8')\n const records: SpanMatchRecord[] = []\n let hasMore = false\n let matchIndex = 0\n for (const match of re.matchAll(slice)) {\n await scanCheckpoint(context?.signal, matchIndex++)\n if (records.length >= recordCap) {\n hasMore = true\n break\n }\n const offset = match.index ?? 0\n const before = slice.slice(Math.max(0, offset - textBudget / 2), offset)\n const after = slice.slice(\n offset + match[0].length,\n offset + match[0].length + Math.floor(textBudget / 2),\n )\n records.push({\n trace_id,\n span_id: s.span_id,\n span_name: s.name,\n span_kind: s.kind,\n attribute_path: bestAttributePathForOffset(slice, offset) ?? 'span.raw',\n matched_text: truncateForBudget(match[0], textBudget),\n context_before: truncateForBudget(before, textBudget),\n context_after: truncateForBudget(after, textBudget),\n match_offset: offset,\n })\n }\n return { records, hasMore }\n }\n}\n\nexport class OtlpFileTraceStore extends BufferedOtlpTraceStore {\n private readonly path: string\n private readonly maxFileBytes: number\n\n constructor(opts: OtlpFileTraceStoreOptions) {\n super(opts)\n this.path = opts.path\n this.maxFileBytes = validateInteger(\n opts.maxFileBytes ?? DEFAULT_MAX_TRACE_FILE_BYTES,\n 'maxFileBytes',\n 1,\n )\n }\n\n /** Stat-then-read so an oversized file fails loud before allocating the\n * source buffer. Missing files remain distinct from malformed traces. */\n protected async readBuffer(signal?: AbortSignal): Promise<Buffer> {\n signal?.throwIfAborted()\n let stats: Awaited<ReturnType<typeof stat>>\n try {\n stats = await stat(this.path)\n } catch (err) {\n if ((err as NodeJS.ErrnoException)?.code === 'ENOENT') {\n throw new TraceFileMissingError(this.path)\n }\n throw err\n }\n if (stats.size > this.maxFileBytes) {\n throw new TraceFileTooLargeError(this.path, stats.size, this.maxFileBytes)\n }\n signal?.throwIfAborted()\n return readFile(this.path, { signal })\n }\n\n protected sourcePath(): string {\n return this.path\n }\n}\n\nclass OtlpBufferTraceStore extends BufferedOtlpTraceStore {\n constructor(\n private readonly source: Buffer,\n opts: BufferedOtlpTraceStoreOptions,\n ) {\n super(opts)\n }\n\n protected async readBuffer(signal?: AbortSignal): Promise<Buffer> {\n signal?.throwIfAborted()\n return this.source\n }\n\n protected sourcePath(): string {\n return '<memory>'\n }\n}\n\n/** Build the bounded trace store directly from OpenInference JSONL text. */\nexport function otlpTextToTraceAnalysisStore(\n text: string,\n opts: ToolSpansToTraceAnalysisStoreOptions = {},\n): TraceAnalysisStore {\n if (!text.trim()) throw new CaptureIntegrityError('OTLP trace text must not be empty')\n return new OtlpBufferTraceStore(Buffer.from(text, 'utf8'), opts)\n}\n\nexport function createOtlpBufferTraceStore(\n source: Buffer,\n options: ToolSpansToTraceAnalysisStoreOptions = {},\n): TraceAnalysisStore {\n return new OtlpBufferTraceStore(source, options)\n}\n\nexport {\n SpanNotFoundError,\n TraceFileMalformedError,\n TraceFileMissingError,\n TraceFileTooLargeError,\n TraceNotFoundError,\n} from './errors'\n\n// ─── OTLP shape readers ──────────────────────────────────────────────\n//\n// The per-line projection lives in `./otlp-span` so the index here and\n// `otlpToRunRecords` read the same vocabulary off the same parser.\n\n// Per-call truncation counter. Each public read that projects spans\n// owns one of these and threads it through projectSpan; a store-keyed\n// counter would let two concurrent reads on the same store report each\n// other's truncation counts.\ninterface TruncationCounter {\n value: number\n}\n\n/** A `\"` at `idx` is a real JSON delimiter only when the run of `\\`\n * immediately preceding it is even-length; an odd run means the quote\n * is escaped (`\\\"`) and is part of a string value, not a boundary. */\nfunction isUnescapedQuote(slice: string, idx: number): boolean {\n if (slice[idx] !== '\"') return false\n let backslashes = 0\n let b = idx - 1\n while (b >= 0 && slice[b] === '\\\\') {\n backslashes += 1\n b -= 1\n }\n return backslashes % 2 === 0\n}\n\n/** Scan backwards from `from` (inclusive) for the nearest UNescaped `\"`.\n * Returns its index, or -1 when none is found. */\nfunction prevUnescapedQuote(slice: string, from: number): number {\n for (let i = from; i >= 0; i -= 1) {\n if (slice[i] === '\"' && isUnescapedQuote(slice, i)) return i\n }\n return -1\n}\n\n/**\n * Best-effort: locate the JSON path for the substring at `offset` in\n * a single span's JSONL slice. The slice is '...,\"key\":\"value...\"' — we\n * walk back from `offset` to the value-opening quote, past the `:`, to\n * the key's closing then opening quote, skipping `\\\"`-escaped quotes that\n * live inside string values. Returns `null` when the offset doesn't fall\n * inside a recognisable string field.\n */\nfunction bestAttributePathForOffset(slice: string, offset: number): string | null {\n // Value-opening quote: nearest unescaped '\"' at or before the offset.\n const valueQuote = prevUnescapedQuote(slice, Math.min(offset, slice.length - 1))\n if (valueQuote < 1) return null\n // The ':' separating key and value sits before the value quote.\n let j = valueQuote - 1\n while (j >= 0 && slice[j] !== ':') j -= 1\n if (j < 1) return null\n // Key closing quote, then key opening quote — both unescaped.\n const keyClose = prevUnescapedQuote(slice, j - 1)\n if (keyClose < 1) return null\n const keyOpen = prevUnescapedQuote(slice, keyClose - 1)\n if (keyOpen < 0) return null\n return slice.slice(keyOpen + 1, keyClose)\n}\n\n// ─── Error-cluster extraction ────────────────────────────────────────\n//\n// Deterministic failure-coverage population. The error-span loop in\n// getOverview already visits every ERROR span; bucketing them by a\n// normalized status_message signature turns \"N error spans\" into \"K\n// distinct failure modes\" — the checklist an analyst must close. No LLM.\n\nconst ERROR_CLUSTER_EXEMPLARS = 5\n\ninterface ErrorClusterAccumulator {\n signature: string\n sample: string\n traceIds: Set<string>\n spanIds: string[]\n spanCount: number\n spanNames: Map<string, number>\n toolNames: Map<string, number>\n}\n\n/** Collapse volatile tokens so semantically identical failures share a key:\n * hex/uuid ids → <id>, numbers → #, quoted/abs paths → <path>, durations →\n * <dur>, whitespace collapsed. Empty/absent messages fall back to the span\n * name so a no-message error still forms a real cluster. */\nfunction normalizeErrorSignature(message: string | undefined, spanName: string): string {\n const raw = (message ?? '').trim()\n const base = raw.length > 0 ? raw : `(${spanName || 'error'} — no message)`\n const norm = base\n .replace(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, '<id>')\n .replace(/\\b[0-9a-f]{12,}\\b/gi, '<id>')\n .replace(/(?:\\/[\\w.\\-@]+){2,}/g, '<path>')\n .replace(/\\b\\d+(?:\\.\\d+)?(ms|s|m|h|kb|mb|gb)?\\b/gi, (_m, u) => (u ? `#${u}` : '#'))\n .replace(/\\s+/g, ' ')\n .trim()\n return norm\n}\n\nfunction bump(map: Map<string, number>, key: string | null): void {\n if (!key) return\n map.set(key, (map.get(key) ?? 0) + 1)\n}\n\nfunction topKey(map: Map<string, number>): string | null {\n let best: string | null = null\n let bestN = 0\n for (const [k, n] of map)\n if (n > bestN) {\n best = k\n bestN = n\n }\n return best\n}\n\nfunction accumulateErrorCluster(\n clusters: Map<string, ErrorClusterAccumulator>,\n traceId: string,\n span: SpanIndexEntry,\n): void {\n const signature = normalizeErrorSignature(span.status_message, span.name)\n let acc = clusters.get(signature)\n if (!acc) {\n acc = {\n signature,\n sample: span.status_message ?? span.name ?? '',\n traceIds: new Set(),\n spanIds: [],\n spanCount: 0,\n spanNames: new Map(),\n toolNames: new Map(),\n }\n clusters.set(signature, acc)\n }\n acc.traceIds.add(traceId)\n acc.spanCount += 1\n if (acc.spanIds.length < ERROR_CLUSTER_EXEMPLARS && !acc.spanIds.includes(span.span_id)) {\n acc.spanIds.push(span.span_id)\n }\n bump(acc.spanNames, span.name)\n bump(acc.toolNames, span.tool_name)\n}\n\nfunction finalizeErrorClusters(\n clusters: Map<string, ErrorClusterAccumulator>,\n errorTraceCount: number,\n): ErrorCluster[] {\n const out = [...clusters.values()].map(\n (acc): ErrorCluster => ({\n signature: acc.signature,\n status_message_sample: acc.sample,\n span_name: topKey(acc.spanNames),\n tool_name: topKey(acc.toolNames),\n trace_count: acc.traceIds.size,\n span_count: acc.spanCount,\n prevalence: errorTraceCount > 0 ? acc.traceIds.size / errorTraceCount : 0,\n exemplar_trace_ids: [...acc.traceIds].slice(0, ERROR_CLUSTER_EXEMPLARS),\n exemplar_span_ids: acc.spanIds.slice(0, ERROR_CLUSTER_EXEMPLARS),\n }),\n )\n out.sort((a, b) => b.trace_count - a.trace_count || b.span_count - a.span_count)\n return out\n}\n"],"mappings":";;;;AAOA,SAAgB,0BACd,SACwB;CACxB,MAAM,aAAa,IAAI,gBAAgB;CACvC,MAAM,OAA+B;EACnC;EACA,SAAS,QAAQ,WAAW,MAAM;EAClC,WAAW;EACX,SAAS;CACX;CACA,KAAU,QAAQ,WACV;EACJ,KAAK,UAAU;CACjB,SACM;EACJ,KAAK,UAAU;CACjB,CACF;CACA,OAAO;AACT;AAEA,SAAgB,kBACd,MACA,QACY;CACZ,QAAQ,eAAe;CACvB,KAAK,aAAa;CAElB,OAAO,IAAI,SAAY,SAAS,WAAW;EACzC,IAAI,WAAW;EACf,MAAM,UAAU,aAA+B;GAC7C,IAAI,UAAU;GACd,WAAW;GACX,QAAQ,oBAAoB,SAAS,OAAO;GAC5C,KAAK,aAAa;GAClB,SAAS;EACX;EACA,MAAM,gBAAsB;GAC1B,aAAa;IACX,OAAO,QAAQ,MAAM;IACrB,IAAI,CAAC,KAAK,WAAW,KAAK,cAAc,GACtC,KAAK,WAAW,MAAM,QAAQ,MAAM;GAExC,CAAC;EACH;EAEA,QAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;EACzD,KAAK,QAAQ,MACV,UAAU,aAAa,QAAQ,KAAK,CAAC,IACrC,UAAmB,aAAa,OAAO,KAAK,CAAC,CAChD;EACA,IAAI,QAAQ,SAAS,QAAQ;CAC/B,CAAC;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACmBA,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;;AAGzB,SAAS,mBAAkC;CACzC,OAAO,IAAI,SAAS,YAAY,aAAa,OAAO,CAAC;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,YAAY,wBAAwB,KAAK,gBAAgB,KAAK,IAAI;CACxE,IAAI,MAAM,SAAS,IAAI,SAAS;CAChC,IAAI,CAAC,KAAK;EACR,MAAM;GACJ;GACA,QAAQ,KAAK,kBAAkB,KAAK,QAAQ;GAC5C,0BAAU,IAAI,IAAI;GAClB,SAAS,CAAC;GACV,WAAW;GACX,2BAAW,IAAI,IAAI;GACnB,2BAAW,IAAI,IAAI;EACrB;EACA,SAAS,IAAI,WAAW,GAAG;CAC7B;CACA,IAAI,SAAS,IAAI,OAAO;CACxB,IAAI,aAAa;CACjB,IAAI,IAAI,QAAQ,SAAS,2BAA2B,CAAC,IAAI,QAAQ,SAAS,KAAK,OAAO,GACpF,IAAI,QAAQ,KAAK,KAAK,OAAO;CAE/B,KAAK,IAAI,WAAW,KAAK,IAAI;CAC7B,KAAK,IAAI,WAAW,KAAK,SAAS;AACpC;AAEA,SAAS,sBACP,UACA,iBACgB;CAChB,MAAM,MAAM,CAAC,GAAG,SAAS,OAAO,CAAC,CAAC,CAAC,KAChC,SAAuB;EACtB,WAAW,IAAI;EACf,uBAAuB,IAAI;EAC3B,WAAW,OAAO,IAAI,SAAS;EAC/B,WAAW,OAAO,IAAI,SAAS;EAC/B,aAAa,IAAI,SAAS;EAC1B,YAAY,IAAI;EAChB,YAAY,kBAAkB,IAAI,IAAI,SAAS,OAAO,kBAAkB;EACxE,oBAAoB,CAAC,GAAG,IAAI,QAAQ,CAAC,CAAC,MAAM,GAAG,uBAAuB;EACtE,mBAAmB,IAAI,QAAQ,MAAM,GAAG,uBAAuB;CACjE,EACF;CACA,IAAI,MAAM,GAAG,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU;CAC/E,OAAO;AACT"}
@@ -1,10 +1,10 @@
1
1
  import { r as CaptureIntegrityError } from "./errors-DEE6u6ot.js";
2
2
  import { c as CostLedgerHandle } from "./cost-ledger-DbQdN3nO.js";
3
- import { S as ToolSpan } from "./schema-BtVldJ3T.js";
4
- import { s as TraceStore } from "./store-CT9YIIve.js";
5
- import { A as SearchSpanResult, B as ViewSpansResult, D as DatasetOverview, F as TraceAnalystFilters, H as ViewTraceResult, S as BoundedTraceAnalysisStoreOptions, T as TraceAnalysisStoreContext, f as AnalystUsageReceipt, i as AnalystFinding, j as SearchTraceResult, k as QueryTracesPage, w as TraceAnalysisStore } from "./types-B2NsbrNy.js";
6
- import { a as TraceAnalystLimits, i as TraceAnalysisEngineResult, n as TraceAnalysisEngine } from "./engine-BLzhNzoY.js";
7
- import { t as TraceToolGroupName } from "./tool-groups-B4tqh8jB.js";
3
+ import { S as ToolSpan } from "./schema-Bjgdsn73.js";
4
+ import { s as TraceStore } from "./store-B06JdC56.js";
5
+ import { A as SearchSpanResult, B as ViewSpansResult, D as DatasetOverview, F as TraceAnalystFilters, H as ViewTraceResult, S as BoundedTraceAnalysisStoreOptions, T as TraceAnalysisStoreContext, f as AnalystUsageReceipt, i as AnalystFinding, j as SearchTraceResult, k as QueryTracesPage, w as TraceAnalysisStore } from "./types-D9ssmxKL.js";
6
+ import { i as TraceAnalystLimits, r as TraceAnalysisEngineResult, t as TraceAnalysisEngine } from "./engine-Cu5qD5Fc.js";
7
+ import { t as TraceToolGroupName } from "./tool-groups-Ci8i9ErB.js";
8
8
  //#region src/trace/otel.d.ts
9
9
  declare const OTEL_AGENT_EVAL_SCOPE: {
10
10
  name: string;
@@ -339,4 +339,4 @@ declare class ToolTraceMissingError extends CaptureIntegrityError {
339
339
  declare function toolSpansToTraceAnalysisStore(spans: readonly ToolSpan[] | null | undefined, options?: ToolSpansToTraceAnalysisStoreOptions): TraceAnalysisStore;
340
340
  //#endregion
341
341
  export { createBoundedTraceAnalysisStore as A, OtlpSpan as B, scoreTraceInsightReadiness as C, AnalyzeTracesResult as D, AnalyzeTracesOptions as E, redactString as F, redactValue as I, OTEL_AGENT_EVAL_SCOPE as L, REDACTION_VERSION as M, RedactionReport as N, analyzeTraces as O, RedactionRule as P, OtlpExport as R, planTraceInsightQuestions as S, AnalyzeTracesInput as T, exportRunAsOtlp as V, buildTraceInsightPrompt as _, ToolSpansToTraceAnalysisStoreOptions as a, domainEvidencePattern as b, TraceInsightFinding as c, TraceInsightQualityGate as d, TraceInsightQuestion as f, buildTraceInsightContext as g, TraceInsightTask as h, OtlpFileTraceStoreOptions as i, DEFAULT_REDACTION_RULES as j, OtlpFlatLine as k, TraceInsightPanelRole as l, TraceInsightSuite as m, toolSpansToTraceAnalysisStore as n, otlpTextToTraceAnalysisStore as o, TraceInsightReadiness as p, OtlpFileTraceStore as r, TraceInsightContext as s, ToolTraceMissingError as t, TraceInsightPromptInput as u, defaultTraceInsightPanel as v, tokenizeDomainWords as w, inferDomainKeywords as x, describeTraceInsightScope as y, OtlpResourceSpans as z };
342
- //# sourceMappingURL=store-tool-spans-Br2_IUhm.d.ts.map
342
+ //# sourceMappingURL=store-tool-spans-DPUG7UUY.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"store-tool-spans-Br2_IUhm.d.ts","names":[],"sources":["../src/trace/otel.ts","../src/trace/redact.ts","../src/trace-analyst/store-boundary.ts","../src/trace/otlp-flat.ts","../src/trace-analyst/analyst.ts","../src/trace-analyst/insights.ts","../src/trace-analyst/store-otlp.ts","../src/trace-analyst/store-tool-spans.ts"],"mappings":";;;;;;;;cAqBa;EAA0B;EAAoC;;UAE1D;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY;IACV;IACA;MAAS;MAAsB;MAAmB;MAAsB;;;EAE1E,SAAS;IAAQ;IAAsB;IAAc,aAAa;;EAClE;IAAW;IAAc;;;UAGV;EACf;IAAY,YAAY;;EACxB,YAAY;IAAQ,cAAc;IAAuB,OAAO;;;UAGjD;EACf,eAAe;;;iBAIK,gBACpB,OAAO,YACP,eACA,gBAAe,4CACd,QAAQ;;;;;;;;;;;;;;;;UCvCM;EACf;EACA,SAAS;;EAET;;UAGe;EACf;EACA,QAAQ;;;cAIG,yBAAyB;cAezB;;;;;iBAMG,aACd,eAC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jD;;;;;;;;EAQA;;uBAMa,kCAAkC;mBAC9B;mBACA;mBACA;mBACA;UACT;UACA;UACA;UACA;EAER,YAAY,MAAM;EAyBZ,SAAS,kBAAkB,UAAU,4BAA4B;EAOjE,SACJ;IAAQ;IAAkB;KAC1B,UAAU,4BACT;EAeG,YACJ,UAAU,qBACV,UAAU,4BACT,QAAQ;EAoDL,YACJ;IAAQ,UAAU;IAAqB;IAAe;KACtD,UAAU,4BACT,QAAQ;EAmBL,YACJ,UAAU,qBACV,UAAU,4BACT;EAMG,UACJ;IAAQ;IAAkB;KAC1B,UAAU,4BACT,QAAQ;EAuCL,UACJ;IAAQ;IAAkB;IAA6B;KACvD,UAAU,4BACT,QAAQ;EAsFL,YACJ;IAAQ;IAAkB;IAAuB;KACjD,UAAU,4BACT,QAAQ;EA4CL,WACJ;IAAQ;IAAkB;IAAiB;IAAuB;KAClE,UAAU,4BACT,QAAQ;;;EA6CL,cAAc,UAAU,4BAA4B;UAI5C;qBAmBK,WAAW,SAAS,cAAc,QAAQ;qBAE1C;UAEL;UAmBA;UAsHA;UA+DN;UAkBA;UAwDA;UAmBM;;cA+CH,2BAA2B;mBACrB;mBACA;EAEjB,YAAY,MAAM;;;YAYF,WAAW,SAAS,cAAc,QAAQ;YAkBhD;;;iBAwBI,6BACd,cACA,OAAM,uCACL;;;;cC/7BU,8BAA8B;EACzC;;;;;;iBASc,8BACd,gBAAgB,+BAChB,UAAS,uCACR"}
1
+ {"version":3,"file":"store-tool-spans-DPUG7UUY.d.ts","names":[],"sources":["../src/trace/otel.ts","../src/trace/redact.ts","../src/trace-analyst/store-boundary.ts","../src/trace/otlp-flat.ts","../src/trace-analyst/analyst.ts","../src/trace-analyst/insights.ts","../src/trace-analyst/store-otlp.ts","../src/trace-analyst/store-tool-spans.ts"],"mappings":";;;;;;;;cAqBa;EAA0B;EAAoC;;UAE1D;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY;IACV;IACA;MAAS;MAAsB;MAAmB;M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@
1
1
  import { n as CaptureIntegrityError } from "./errors-Dngq5h35.js";
2
- import { Q as applyToolSpanOtlpAttributes, i as runTraceAnalyst, tt as traceSpanKindToOpenInferenceKind } from "./kind-factory-DmAa0h3K.js";
2
+ import { K as traceSpanKindToOpenInferenceKind, U as applyToolSpanOtlpAttributes, r as runTraceAnalyst } from "./kind-factory-DY8FdoXf.js";
3
3
  import { OPENINFERENCE_SPAN_KIND, applyLlmSpanOtlpAttributes } from "./trace-attributes.js";
4
4
  import { r as extractUsageFromSse, t as extractUsage } from "./extract-usage-BrQ8mCLX.js";
5
5
  import { a as providerFromBaseUrl, i as defaultProviderRedactor } from "./raw-provider-sink-BQd7mzyT.js";
6
- import { n as OtlpFileTraceStore, r as createOtlpBufferTraceStore } from "./store-otlp-CDYWW_8N.js";
6
+ import { n as OtlpFileTraceStore, r as createOtlpBufferTraceStore } from "./store-otlp-C_Rq5I4D.js";
7
7
  import { randomUUID } from "node:crypto";
8
8
  import { deriveHexId, isW3CSpanId, isW3CTraceId } from "@tangle-network/agent-trace-contract";
9
9
  //#region src/trace/capture-fetch.ts
@@ -664,4 +664,4 @@ function toolSpanTimeIso(value, spanId, field) {
664
664
  //#endregion
665
665
  export { captureFetchToRawSink as S, TRACE_ANALYST_ACTOR_DESCRIPTION_VERSION as _, spanStatusToOtlp as a, spanIdForWire as b, defaultTraceInsightPanel as c, inferDomainKeywords as d, planTraceInsightQuestions as f, TRACE_ANALYST_ACTOR_DESCRIPTION as g, analyzeTraces as h, epochMillisToIso as i, describeTraceInsightScope as l, tokenizeDomainWords as m, toolSpansToTraceAnalysisStore as n, buildTraceInsightContext as o, scoreTraceInsightReadiness as p, createOtlpFlatLine as r, buildTraceInsightPrompt as s, ToolTraceMissingError as t, domainEvidencePattern as u, OTEL_AGENT_EVAL_SCOPE as v, traceIdForWire as x, exportRunAsOtlp as y };
666
666
 
667
- //# sourceMappingURL=store-tool-spans-CykkbOlv.js.map
667
+ //# sourceMappingURL=store-tool-spans-Dlh9vkFK.js.map