@tangle-network/agent-eval 0.144.4 → 0.144.6

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 (140) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/{agent-profile-cell-Cw0PVwDr.d.ts → agent-profile-cell-BOP-iA9Q.d.ts} +2 -2
  3. package/dist/{agent-profile-cell-Cw0PVwDr.d.ts.map → agent-profile-cell-BOP-iA9Q.d.ts.map} +1 -1
  4. package/dist/analyst/index.d.ts +366 -19
  5. package/dist/analyst/index.d.ts.map +1 -1
  6. package/dist/analyst/index.js +8 -8
  7. package/dist/{benchmark-CYtcIF2V.js → benchmark-B181aMF9.js} +2 -2
  8. package/dist/{benchmark-CYtcIF2V.js.map → benchmark-B181aMF9.js.map} +1 -1
  9. package/dist/{benchmark-CP6kWfj8.d.ts → benchmark-J9Qe6j2_.d.ts} +3 -3
  10. package/dist/{benchmark-CP6kWfj8.d.ts.map → benchmark-J9Qe6j2_.d.ts.map} +1 -1
  11. package/dist/{benchmark-command-9FTgq6Fg.js → benchmark-command-CQd78YHt.js} +922 -36
  12. package/dist/benchmark-command-CQd78YHt.js.map +1 -0
  13. package/dist/benchmarks/index.d.ts +1 -1
  14. package/dist/benchmarks/index.js +1 -1
  15. package/dist/{benchmarks-CkG1bWFa.js → benchmarks-BEOkuvIg.js} +3 -3
  16. package/dist/{benchmarks-CkG1bWFa.js.map → benchmarks-BEOkuvIg.js.map} +1 -1
  17. package/dist/campaign/index.d.ts +6 -6
  18. package/dist/campaign/index.js +3 -3
  19. package/dist/{campaign-DjGFyPxH.js → campaign-CXsdyym7.js} +4 -4
  20. package/dist/{campaign-DjGFyPxH.js.map → campaign-CXsdyym7.js.map} +1 -1
  21. package/dist/cli.js +2 -2
  22. package/dist/{client-Bbht4xxl.d.ts → client-0JI64ovJ.d.ts} +4 -4
  23. package/dist/{client-Bbht4xxl.d.ts.map → client-0JI64ovJ.d.ts.map} +1 -1
  24. package/dist/{completion-verifier-EJERfFwF.d.ts → completion-verifier-CBiee74w.d.ts} +5 -5
  25. package/dist/{completion-verifier-EJERfFwF.d.ts.map → completion-verifier-CBiee74w.d.ts.map} +1 -1
  26. package/dist/contract/index.d.ts +10 -10
  27. package/dist/contract/index.js +5 -5
  28. package/dist/control.d.ts +2 -2
  29. package/dist/{cost-ledger-FuQvHxPm.d.ts → cost-ledger-Bv_e8XHY.d.ts} +2 -2
  30. package/dist/{cost-ledger-FuQvHxPm.d.ts.map → cost-ledger-Bv_e8XHY.d.ts.map} +1 -1
  31. package/dist/{dataset-v_Y5902-.d.ts → dataset-C8xaLXdY.d.ts} +2 -2
  32. package/dist/{dataset-v_Y5902-.d.ts.map → dataset-C8xaLXdY.d.ts.map} +1 -1
  33. package/dist/{default-registry-SOyHB6qG.js → default-registry-Dta70shL.js} +4 -4
  34. package/dist/{default-registry-SOyHB6qG.js.map → default-registry-Dta70shL.js.map} +1 -1
  35. package/dist/{default-registry-iXfu2trt.d.ts → default-registry-J9m-_tya.d.ts} +5 -5
  36. package/dist/{default-registry-iXfu2trt.d.ts.map → default-registry-J9m-_tya.d.ts.map} +1 -1
  37. package/dist/{dspy-rlm-engine-IRCG8kdi.js → dspy-rlm-engine-19FQEMBK.js} +2 -2
  38. package/dist/{dspy-rlm-engine-IRCG8kdi.js.map → dspy-rlm-engine-19FQEMBK.js.map} +1 -1
  39. package/dist/{errors-DkfjIDvD.d.ts → errors-CKPfb2aH.d.ts} +2 -2
  40. package/dist/{errors-DkfjIDvD.d.ts.map → errors-CKPfb2aH.d.ts.map} +1 -1
  41. package/dist/errors-D-LKuDhb.js.map +1 -1
  42. package/dist/{eval-campaign-lZcDIwQM.js → eval-campaign-CfLQQs9B.js} +2 -2
  43. package/dist/{eval-campaign-lZcDIwQM.js.map → eval-campaign-CfLQQs9B.js.map} +1 -1
  44. package/dist/{exact-types-BygCBR4L.d.ts → exact-types-CBYF5MGd.d.ts} +2 -2
  45. package/dist/{exact-types-BygCBR4L.d.ts.map → exact-types-CBYF5MGd.d.ts.map} +1 -1
  46. package/dist/{external-optimizer-contracts-CdmX2K2S.d.ts → external-optimizer-contracts-Q9c0L3eY.d.ts} +3 -3
  47. package/dist/{external-optimizer-contracts-CdmX2K2S.d.ts.map → external-optimizer-contracts-Q9c0L3eY.d.ts.map} +1 -1
  48. package/dist/{extract-usage-7l1Xq5ti.js → extract-usage-BW27f3XW.js} +2 -2
  49. package/dist/{extract-usage-7l1Xq5ti.js.map → extract-usage-BW27f3XW.js.map} +1 -1
  50. package/dist/{feedback-trajectory-CSIkRLQX.d.ts → feedback-trajectory-GgoS0-MK.d.ts} +4 -4
  51. package/dist/{feedback-trajectory-CSIkRLQX.d.ts.map → feedback-trajectory-GgoS0-MK.d.ts.map} +1 -1
  52. package/dist/fuzz.d.ts +1 -1
  53. package/dist/hosted/index.d.ts +3 -3
  54. package/dist/{index-D_qTihaQ.d.ts → index-4XwggC10.d.ts} +5 -5
  55. package/dist/{index-D_qTihaQ.d.ts.map → index-4XwggC10.d.ts.map} +1 -1
  56. package/dist/{index-CNOCxBLh.d.ts → index-B6-B0zTB.d.ts} +2 -2
  57. package/dist/{index-CNOCxBLh.d.ts.map → index-B6-B0zTB.d.ts.map} +1 -1
  58. package/dist/{index-BuHs_OnD.d.ts → index-BIL5vxxt.d.ts} +12 -12
  59. package/dist/{index-BuHs_OnD.d.ts.map → index-BIL5vxxt.d.ts.map} +1 -1
  60. package/dist/{index-DEb46kc6.d.ts → index-CvSN3IG1.d.ts} +2 -2
  61. package/dist/{index-DEb46kc6.d.ts.map → index-CvSN3IG1.d.ts.map} +1 -1
  62. package/dist/{index-DGIzNtRv.d.ts → index-Dx1kF3Ez.d.ts} +3 -3
  63. package/dist/{index-DGIzNtRv.d.ts.map → index-Dx1kF3Ez.d.ts.map} +1 -1
  64. package/dist/index.d.ts +68 -77
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +62 -126
  67. package/dist/index.js.map +1 -1
  68. package/dist/{insight-report-D5m1z0_n.d.ts → insight-report-DqEsugpr.d.ts} +4 -4
  69. package/dist/{insight-report-D5m1z0_n.d.ts.map → insight-report-DqEsugpr.d.ts.map} +1 -1
  70. package/dist/{integrity-DRXobPEs.d.ts → integrity-CNGUaGBY.d.ts} +3 -3
  71. package/dist/{integrity-DRXobPEs.d.ts.map → integrity-CNGUaGBY.d.ts.map} +1 -1
  72. package/dist/{kind-factory-Bvwe3pup.js → kind-factory-BHIgPmzS.js} +2 -2
  73. package/dist/{kind-factory-Bvwe3pup.js.map → kind-factory-BHIgPmzS.js.map} +1 -1
  74. package/dist/ledger-core/index.d.ts +1 -1
  75. package/dist/{llm-client-D3EoChAU.js → llm-client-Dv5BiKLE.js} +289 -7
  76. package/dist/llm-client-Dv5BiKLE.js.map +1 -0
  77. package/dist/meta-eval/index.d.ts +2 -2
  78. package/dist/multishot/index.d.ts +2 -2
  79. package/dist/multishot/index.js +1 -1
  80. package/dist/multishot/index.js.map +1 -1
  81. package/dist/openapi.json +1 -1
  82. package/dist/profile-cell.d.ts +1 -1
  83. package/dist/{release-report-BZRWdq_t.d.ts → release-report-ChOgpIoQ.d.ts} +4 -4
  84. package/dist/{release-report-BZRWdq_t.d.ts.map → release-report-ChOgpIoQ.d.ts.map} +1 -1
  85. package/dist/{replay-CqOsGjzU.js → replay-GW61ezMW.js} +4 -4
  86. package/dist/{replay-CqOsGjzU.js.map → replay-GW61ezMW.js.map} +1 -1
  87. package/dist/{replay-DQ-55DC_.d.ts → replay-Krvb114g.d.ts} +7 -7
  88. package/dist/{replay-DQ-55DC_.d.ts.map → replay-Krvb114g.d.ts.map} +1 -1
  89. package/dist/reporting.d.ts +4 -4
  90. package/dist/{researcher-BSiCoM1s.d.ts → researcher-xLeNcpKX.d.ts} +6 -6
  91. package/dist/{researcher-BSiCoM1s.d.ts.map → researcher-xLeNcpKX.d.ts.map} +1 -1
  92. package/dist/{reward-hacking-DFgkEY4p.d.ts → reward-hacking-RZgnGWlx.d.ts} +2 -2
  93. package/dist/{reward-hacking-DFgkEY4p.d.ts.map → reward-hacking-RZgnGWlx.d.ts.map} +1 -1
  94. package/dist/rl.d.ts +5 -5
  95. package/dist/rl.js +1 -1
  96. package/dist/rollout/index.d.ts +1 -1
  97. package/dist/{rubric-predictive-validity-C4r4Y-q8.d.ts → rubric-predictive-validity-9qAwzkZm.d.ts} +2 -2
  98. package/dist/{rubric-predictive-validity-C4r4Y-q8.d.ts.map → rubric-predictive-validity-9qAwzkZm.d.ts.map} +1 -1
  99. package/dist/{run-evidence-H1vRpIdT.d.ts → run-evidence-C6G41MSI.d.ts} +3 -3
  100. package/dist/{run-evidence-H1vRpIdT.d.ts.map → run-evidence-C6G41MSI.d.ts.map} +1 -1
  101. package/dist/{run-record-ooo9FWns.d.ts → run-record-DdSa93_W.d.ts} +4 -4
  102. package/dist/{run-record-ooo9FWns.d.ts.map → run-record-DdSa93_W.d.ts.map} +1 -1
  103. package/dist/{semantic-concept-judge-Do5aM9wP.js → semantic-concept-judge-DwF6n05O.js} +3 -3
  104. package/dist/{semantic-concept-judge-Do5aM9wP.js.map → semantic-concept-judge-DwF6n05O.js.map} +1 -1
  105. package/dist/{server-Df00sdwz.js → server-D6XJQHw7.js} +2 -2
  106. package/dist/{server-Df00sdwz.js.map → server-D6XJQHw7.js.map} +1 -1
  107. package/dist/{skill-usage-DtpLou9L.d.ts → skill-usage-GlOphAhX.d.ts} +9 -9
  108. package/dist/{skill-usage-DtpLou9L.d.ts.map → skill-usage-GlOphAhX.d.ts.map} +1 -1
  109. package/dist/{skillopt-optimization-method-CvSJGdm3.d.ts → skillopt-optimization-method-7S43rbDB.d.ts} +12 -12
  110. package/dist/{skillopt-optimization-method-CvSJGdm3.d.ts.map → skillopt-optimization-method-7S43rbDB.d.ts.map} +1 -1
  111. package/dist/{skillopt-optimization-method-C4FX42dy.js → skillopt-optimization-method-Bfb-vBKe.js} +2 -2
  112. package/dist/{skillopt-optimization-method-C4FX42dy.js.map → skillopt-optimization-method-Bfb-vBKe.js.map} +1 -1
  113. package/dist/{statistics-B4u_CiFd.d.ts → statistics-C-dm-J6H.d.ts} +2 -2
  114. package/dist/{statistics-B4u_CiFd.d.ts.map → statistics-C-dm-J6H.d.ts.map} +1 -1
  115. package/dist/{store-otlp-D4I90_vR.js → store-otlp-CKtTpRhv.js} +2 -2
  116. package/dist/{store-otlp-D4I90_vR.js.map → store-otlp-CKtTpRhv.js.map} +1 -1
  117. package/dist/{summary-report-BOM6dfP7.d.ts → summary-report-B0cAyA7N.d.ts} +3 -3
  118. package/dist/{summary-report-BOM6dfP7.d.ts.map → summary-report-B0cAyA7N.d.ts.map} +1 -1
  119. package/dist/{tool-groups-CMmsgTzj.d.ts → tool-groups-CK0JCkqO.d.ts} +9 -9
  120. package/dist/{tool-groups-CMmsgTzj.d.ts.map → tool-groups-CK0JCkqO.d.ts.map} +1 -1
  121. package/dist/traces.d.ts +6 -6
  122. package/dist/traces.js +4 -4
  123. package/dist/{types-y8jrxXWd.d.ts → types-BhP9q0Fq.d.ts} +22 -4
  124. package/dist/{types-y8jrxXWd.d.ts.map → types-BhP9q0Fq.d.ts.map} +1 -1
  125. package/dist/{types-DcJxgsLy.d.ts → types-DOZyvsFU.d.ts} +5 -5
  126. package/dist/{types-DcJxgsLy.d.ts.map → types-DOZyvsFU.d.ts.map} +1 -1
  127. package/dist/{types-BjMFz88h.d.ts → types-XMVEdrE_.d.ts} +207 -6
  128. package/dist/types-XMVEdrE_.d.ts.map +1 -0
  129. package/dist/{usage-receipt-CgxMEBZq.js → usage-receipt-EVI8B8Xu.js} +8 -1
  130. package/dist/usage-receipt-EVI8B8Xu.js.map +1 -0
  131. package/dist/wire/index.d.ts +3 -3
  132. package/dist/wire/index.js +1 -1
  133. package/docs/building-doctrine.md +15 -0
  134. package/docs/prime-analyst.md +120 -0
  135. package/docs/trace-analysis.md +1 -1
  136. package/package.json +3 -3
  137. package/dist/benchmark-command-9FTgq6Fg.js.map +0 -1
  138. package/dist/llm-client-D3EoChAU.js.map +0 -1
  139. package/dist/types-BjMFz88h.d.ts.map +0 -1
  140. package/dist/usage-receipt-CgxMEBZq.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { g as JudgeScore } from "./types-BjMFz88h.js";
1
+ import { g as JudgeScore } from "./types-XMVEdrE_.js";
2
2
  //#region src/judge-calibration.d.ts
3
3
  /**
4
4
  * Judge calibration — measure judge quality against human gold + bias.
@@ -965,4 +965,4 @@ declare function eProcess(opts?: EProcessOptions): EProcess;
965
965
  declare function mulberry32(seed: number): () => number;
966
966
  //#endregion
967
967
  export { pairedCohensDz as $, WeightedCompositeInput as A, positionalBias as At, eProcess as B, RankTestMethod as C, GoldenItem as Ct, ScoreRiskDifferenceResult as D, calibrateJudge as Dt, RiskDifferenceResult as E, VerbosityBiasResult as Et, cliffsDelta as F, mannWhitneyU as G, interRaterReliability as H, cohensD as I, mcnemarRequiredN as J, mcnemar as K, confidenceInterval as L, WilcoxonSignedRankResult as M, verbosityBias as Mt, benjaminiHochberg as N, SignTestAlternative as O, calibrateJudgeContinuous as Ot, bonferroni as P, pairedBootstrap as Q, corpusInterRaterAgreement as R, ProportionInterval as S, ContinuousCalibrationResult as St, RankTestOptions as T, SelfPreferenceResult as Tt, interpretCliffs as U, holm as V, isBinaryOutcomeVector as W, normalizeScores as X, mulberry32 as Y, pairedBinaryScale as Z, McNemarResult as _, wilson as _t, CorpusAgreementReport as a, pairedSignTest as at, PairedSignTestResult as b, ContinuousAgreement as bt, DEFAULT_PERMUTATIONS as c, passAtK as ct, EProcessState as d, requiredPairedSampleSize as dt, pairedDeltaTieFraction as et, EProcessStep as f, requiredSampleSize as ft, MannWhitneyResult as g, wilcoxonSignedRank as gt, MANN_WHITNEY_EXACT_MAX_WORK as h, weightedMean as ht, CorpusAgreementPerDimension as i, pairedRiskDifferenceScore as it, WeightedCompositeResult as j, selfPreference as jt, WILCOXON_EXACT_MAX_N as k, continuousAgreement as kt, EProcess as l, pearsonR as lt, MANN_WHITNEY_EXACT_MAX_STATES as m, weightedComposite as mt, CliffsMagnitude as n, pairedRiskDifference as nt, CorpusScoreRecord as o, pairedTTest as ot, ExactRiskDifferenceResult as p, spearmanR as pt, mcnemarPower as q, CorpusAgreementOptions as r, pairedRiskDifferenceExact as rt, DECISION_PAIRED_DELTA_STATISTIC as s, partialCredit as st, BOOTSTRAP_GATE_MIN_N as t, pairedMde as tt, EProcessOptions as u, ranks as ut, PairedBootstrapOptions as v, CalibrationResult as vt, RankTestMethodRequest as w, PositionalBiasResult as wt, PairedTTestResult as x, ContinuousAgreementOptions as xt, PairedBootstrapResult as y, CandidateScore as yt, corpusInterRaterAgreementFromJudgeScores as z };
968
- //# sourceMappingURL=statistics-B4u_CiFd.d.ts.map
968
+ //# sourceMappingURL=statistics-C-dm-J6H.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"statistics-B4u_CiFd.d.ts","names":[],"sources":["../src/judge-calibration.ts","../src/statistics.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;UAuBiB;EACf;EACA;;EAEA;;UAGe;EACf;EACA;;EAEA;;UAGe;EACf;EACA;;EAEA;;EAEA;;EAEA,YAAY;IAAQ;IAAgB;IAAe;IAAe;;;;;;iBAMpD,eACd,QAAQ,cACR,WAAW,mBACV;UA0Bc;;;;;EAKf;EACA;;;;;;iBAOc,eAAe,QAAQ,mBAAmB;UAgBzC;;EAEf;EACA;;iBAGc,cACd,SAAS;EAAQ;EAAmB;KACnC;UAYc;;EAEf;EACA;EACA;EACA;;;;;;;iBAQc,eACd,SAAS;EAAQ;EAAe;KAC/B;UA8Ec;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;IACE;IACA;;;EAGF;;EAEA;;UAGe;;EAEf;;EAEA;;EAEA;;EAEA;;;;;;;;;iBAUc,oBACd,oBACA,OAAM,6BACL;UAqEc,oCAAoC;;EAEnD;;EAEA;EACA;EACA;IACE;IACA;;;;;;;iBAQY,yBACd,QAAQ,cACR,WAAW,kBACX,OAAM,6BACL;;;;;cCnVU,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AQ,mBACR,OAAO;;;iBAkBO,uBACd,QAAQ,mBACR,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA4CI;;;;;;;;;;;iBAYG,QAAQ,WAAW,WAAW;UAgE7B;;;EAGf;;;;EAIA;;;;EAIA;;UAGe;;EAEf;;EAEA;;EAEA;;UAGe,sBAAsB;EACrC;EACA;EACA;;EAEA;;EAEA;;UAGe;;;EAGf,OAAO,YAAY;EACnB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8BK,SAAS,OAAM,kBAAuB;;;;;iBAsatC,WAAW"}
@@ -1,5 +1,5 @@
1
1
  import { n as CaptureIntegrityError } from "./errors-D-LKuDhb.js";
2
- import { $ as spanEpochMillis, C as TraceNotFoundError, J as extractOtlpAttributes, S as TraceFileTooLargeError, Z as projectOtlpFlatLine, _ 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, q as compareSpanTime, u as compileSearchRegex, x as TraceFileMissingError, y as TraceAnalysisValidationError } from "./kind-factory-Bvwe3pup.js";
2
+ import { $ as spanEpochMillis, C as TraceNotFoundError, J as extractOtlpAttributes, S as TraceFileTooLargeError, Z as projectOtlpFlatLine, _ 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, q as compareSpanTime, u as compileSearchRegex, x as TraceFileMissingError, y as TraceAnalysisValidationError } from "./kind-factory-BHIgPmzS.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-D4I90_vR.js.map
757
+ //# sourceMappingURL=store-otlp-CKtTpRhv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"store-otlp-D4I90_vR.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,M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,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-CKtTpRhv.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;I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1B,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,5 +1,5 @@
1
- import { a as RunRecord } from "./run-record-ooo9FWns.js";
2
- import { y as PairedBootstrapResult } from "./statistics-B4u_CiFd.js";
1
+ import { a as RunRecord } from "./run-record-DdSa93_W.js";
2
+ import { y as PairedBootstrapResult } from "./statistics-C-dm-J6H.js";
3
3
  import { n as FailureClusterReport } from "./failure-cluster-CqcvCcdR.js";
4
4
  //#region src/paired-promotion-decision.d.ts
5
5
  /** Which paired estimator produced the deciding interval. */
@@ -636,4 +636,4 @@ interface ResearchReport {
636
636
  declare function researchReport(runs: RunRecord[], opts?: ResearchReportOptions): Promise<ResearchReport>;
637
637
  //#endregion
638
638
  export { PairedMcNemarEvidence as A, HeldOutGate as C, PairedDecisionMethod as D, SplitCoverage as E, PairedPromotionDecisionOptions as M, decidePairedPromotion as N, PairedDecisionShape as O, pairedDecisionShape as P, GateEvidence as S, HeldOutGateRejectionCode as T, paretoChart as _, ParetoPoint as a, DeltaStatistic as b, ResearchReportCandidate as c, ResearchReportOptions as d, ResearchReportRecommendation as f, gainHistogram as g, SummaryTableRow as h, ParetoFigureSpec as i, PairedPromotionDecision as j, PairedDecisionStatistic as k, ResearchReportDecision as l, SummaryTableOptions as m, GainDistributionFigureSpec as n, RESEARCH_REPORT_HARD_PAIR_FLOOR as o, SummaryTable as p, GainDistributionOptions as r, ResearchReport as s, GainDistributionBin as t, ResearchReportMethodology as u, researchReport as v, HeldOutGateConfig as w, GateDecision as x, summaryTable as y };
639
- //# sourceMappingURL=summary-report-BOM6dfP7.d.ts.map
639
+ //# sourceMappingURL=summary-report-B0cAyA7N.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"summary-report-BOM6dfP7.d.ts","names":[],"sources":["../src/paired-promotion-decision.ts","../src/held-out-gate.ts","../src/summary-report.ts"],"mappings":";;;;;KA2DY;;KAMA;;UAGK;;EAEf;;EAEA;;EAEA;;EAEA;;UAGe;;;EAGf;;EAEA;;EAEA;;EAEA;;;EAGA;;;;;;;;EAQA;;UAGe;;EAEf;;EAEA;EACA;EACA,WAAW;EACX,QAAQ;;;;;EAKR;;EAEA;;EAEA;;EAEA;;EAEA;;;;EAIA,WAAW;;EAEX,SAAS;;;EAGT;;EAEA;;EAEA;;;EAGA;;EAEA;;EAEA;;;EAGA;;EAEA;;EAEA;;EAEA;;;UAIe;EACf,WAAW;;EAEX;;EAEA;;;;;;;;iBASc,oBACd,kBACA,iBACA,gCACC;;;;;;iBAiBa,sBACd,kBACA,iBACA,UAAS,iCACR;;;KC1DS;;;;;;;;UAiBK;;EAEf;;;EAGA;;;;EAIA;;EAEA;;EAEA;;;EAGA;;UAGe;;;;EAIf;;;;;EAKA;;;;;;;;;;;EAWA;;;;EAIA;;;EAGA;;EAEA;;EAEA;;;EAGA;;;;;;;;;;;;;;;;;EAiBA;;;;;;;;;;;;;EAaA;;;;KAKU,iBAAiB;UAEZ;;EAEf;;EAEA;;EAEA;;;;;;;;EAQA,iBAAiB;;;;;EAKjB,gBAAgB;;;;;EAKhB;;;;;;;;;EASA,gBAAgB;;;EAGhB;;;EAGA;IAAY;IAAa;;;;EAGzB;;;;;;;EAOA;IAAW;IAAW;IAAW;IAAqB;;;;;;EAKtD;;;;;EAKA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;EAKA;;;EAGA;;;;;;;EAOA;;UAGe;;EAEf;;EAEA;;EAEA;;EAEA,UAAU;;EAEV;;EAEA,eAAe;;;;;;;cAQJ;mBACM;mBACA;mBACA;mBACA;mBACA;mBACA;mBACA;mBACA;mBACA;mBAC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B;EACA;;;;;;;;;;;;;;;;;;;;;iBA6IoB,eACpB,MAAM,aACN,OAAM,wBACL,QAAQ"}
1
+ {"version":3,"file":"summary-report-B0cAyA7N.d.ts","names":[],"sources":["../src/paired-promotion-decision.ts","../src/held-out-gate.ts","../src/summary-report.ts"],"mappings":";;;;;KA2DY;;KAMA;;UAGK;;EAEf;;EAEA;;EAEA;;EAEA;;UAGe;;;EAGf;;EAEA;;EAEA;;EAEA;;;EAGA;;;;;;;;EAQA;;UAGe;;EAEf;;EAEA;EACA;EACA,WAAW;EACX,QAAQ;;;;;EAKR;;EAEA;;EAEA;;EAEA;;EAEA;;;;EAIA,WAAW;;EAEX,SAAS;;;EAGT;;EAEA;;EAEA;;;EAGA;;EAEA;;EAEA;;;EAGA;;EAEA;;EAEA;;EAEA;;;UAIe;EACf,WAAW;;EAEX;;EAEA;;;;;;;;iBASc,oBACd,kBACA,iBACA,gCACC;;;;;;iBAiBa,sBACd,kBACA,iBACA,UAAS,iCACR;;;KC1DS;;;;;;;;UAiBK;;EAEf;;;EAGA;;;;EAIA;;EAEA;;EAEA;;;EAGA;;UAGe;;;;EAIf;;;;;EAKA;;;;;;;;;;;EAWA;;;;EAIA;;;EAGA;;EAEA;;EAEA;;;EAGA;;;;;;;;;;;;;;;;;EAiBA;;;;;;;;;;;;;EAaA;;;;KAKU,iBAAiB;UAEZ;;EAEf;;EAEA;;EAEA;;;;;;;;EAQA,iBAAiB;;;;;EAKjB,gBAAgB;;;;;EAKhB;;;;;;;;;EASA,gBAAgB;;;EAGhB;;;EAGA;IAAY;IAAa;;;;EAGzB;;;;;;;EAOA;IAAW;IAAW;IAAW;IAAqB;;;;;;EAKtD;;;;;EAKA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;EAKA;;;EAGA;;;;;;;EAOA;;UAGe;;EAEf;;EAEA;;EAEA;;EAEA,UAAU;;EAEV;;EAEA,eAAe;;;;;;;cAQJ;mBACM;mBACA;mBACA;mBACA;mBACA;mBACA;mBACA;mBAC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kBAAkB;EAClB;EACA;;;;;;;;;;;;;;;;;;;;;iBA6IoB,eACpB,MAAM,aACN,OAAM,wBACL,QAAQ"}
@@ -1,11 +1,11 @@
1
- import { c as CostLedgerHandle } from "./cost-ledger-FuQvHxPm.js";
2
- import { a as RunRecord } from "./run-record-ooo9FWns.js";
3
- import { p as EvidenceRef, x as TraceAnalysisStore, y as BoundedTraceAnalysisStoreOptions } from "./types-y8jrxXWd.js";
4
- import { E as AnalystRegistry, r as CorrectnessChecker } from "./completion-verifier-EJERfFwF.js";
5
- import { S as JudgeConfig } from "./types-DcJxgsLy.js";
6
- import { a as DatasetScenario } from "./dataset-v_Y5902-.js";
7
- import "./summary-report-BOM6dfP7.js";
8
- import { o as InsightReport, r as ExecutionInsight, t as CostProvenanceSummary } from "./insight-report-D5m1z0_n.js";
1
+ import { c as CostLedgerHandle } from "./cost-ledger-Bv_e8XHY.js";
2
+ import { a as RunRecord } from "./run-record-DdSa93_W.js";
3
+ import { p as EvidenceRef, x as TraceAnalysisStore, y as BoundedTraceAnalysisStoreOptions } from "./types-BhP9q0Fq.js";
4
+ import { E as AnalystRegistry, r as CorrectnessChecker } from "./completion-verifier-CBiee74w.js";
5
+ import { S as JudgeConfig } from "./types-DOZyvsFU.js";
6
+ import { a as DatasetScenario } from "./dataset-C8xaLXdY.js";
7
+ import "./summary-report-B0cAyA7N.js";
8
+ import { o as InsightReport, r as ExecutionInsight, t as CostProvenanceSummary } from "./insight-report-DqEsugpr.js";
9
9
  import { z } from "zod";
10
10
  //#region src/contract/analyze-runs.d.ts
11
11
  interface AnalyzeRunsOptions {
@@ -255,4 +255,4 @@ type TraceToolGroupName =
255
255
  declare function buildTraceToolsForGroup(group: TraceToolGroupName, store: TraceAnalysisStore): TraceAnalysisToolDescriptor[];
256
256
  //#endregion
257
257
  export { summarizeExecution as A, MakeEvalToolsConfig as C, ExecutionReport as D, AnalyzeRunsOptions as E, SummarizeExecutionOptions as O, EvalToolDef as S, toOpenAiTool as T, BuildTraceAnalysisToolsOptions as _, TraceAnalysisEngineRequest as a, buildTraceAnalysisToolDescriptors as b, resolveTraceAnalystLimits as c, RawAnalystEvidence as d, RawAnalystEvidenceSchema as f, parseRawFinding as g, evidenceRefsFromRawFinding as h, TraceAnalysisEngine as i, analyzeRuns as k, ANALYST_SEVERITIES as l, RawAnalystFindingSchema as m, buildTraceToolsForGroup as n, TraceAnalysisEngineResult as o, RawAnalystFinding as p, DEFAULT_TRACE_ANALYST_LIMITS as r, TraceAnalystLimits as s, TraceToolGroupName as t, RAW_FINDING_SCHEMA_PROMPT as u, TRACE_ANALYST_TOOL_NAMESPACE as v, makeEvalTools as w, traceAnalystFunctionGroup as x, TraceAnalysisToolDescriptor as y };
258
- //# sourceMappingURL=tool-groups-CMmsgTzj.d.ts.map
258
+ //# sourceMappingURL=tool-groups-CK0JCkqO.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool-groups-CMmsgTzj.d.ts","names":[],"sources":["../src/contract/analyze-runs.ts","../src/eval-tools.ts","../src/trace-analyst/tools.ts","../src/analyst/finding-signature.ts","../src/analyst/engine.ts","../src/analyst/tool-groups.ts"],"mappings":";;;;;;;;;;UAoEiB;;EAEf,MAAM;;;EAGN;;;;;EAKA;EACA;;;EAGA,kBAAkB;;;EAGlB,UAAU;;;;EAIV;IACE;IACA,cAAc;;;;;EAKhB,cAAc;IAAQ;IAAe;IAAe;;;EAEpD;;;;EAIA;;;;;;;;;EASA,eAAe;;;EAGf;;UAGe;EACf,MAAM;EACN;;UAGe;EACf,WAAW;EACX,gBAAgB;;;iBAIF,mBAAmB,MAAM,4BAA4B;iBAgB/C,YAAY,MAAM,qBAAqB,QAAQ;;;;UCpHpD;EACf;EACA;EACA,YAAY;EACZ,UAAU,eAAe;IAAQ,SAAS;QAAkB;;UAG7C;;EAEf,SAAS,MAAM;;;;EAIf;IAAe,kBAAkB;;;;EAGjC,UAAU,KAAK;;;iBAID,aAAa,KAAK;EAChC;EACA;IAAY;IAAc;IAAqB,YAAY;;;;;;;;iBAa7C,cAAc,KAAK,sBAAsB;;;cCjD5C;UAEI,uCAAuC;EACtD,OAAO;;UAGQ,oCAAoC;EACnD,kBAAkB;;;iBAIJ,kCACd,SAAS,iCACR;iBAkHa,0BAA0B,SAAS;EACjD;EACA;EACA;EACA;EACA,WAAW;;;;cCtIA;cAEA,0BAAwB,EAAA;;;GAK1B,EAAA,KAAA;KAEC,qBAAqB,EAAE,aAAa;cAiBnC,yBAAuB,EAAA;;;;;;;;;;;;;;;;;GAKzB,EAAA,KAAA;KAEC,oBAAoB,EAAE,aAAa;;;;;;cAOlC;;iBAYG,2BAA2B,SAAS,oBAAoB;iBAQxD,gBACd,cACA,OAAO,aAAa,SAAS,mCAC5B;;;;UCtEc;;EAEf;;EAEA;;EAEA;;EAEA;;cAGW,8BAA8B,SAAS;UAOnC;EACf;EACA;EACA;EACA,gBAAgB;EAChB,QAAQ;EACR,YAAY;EACZ;EACA,WAAW;EACX,SAAS;EACT,OAAO,iBAAiB,SAAS;;;UAIlB;EACf;EACA,UAAU;;EAEV;;;;;EAKA;;EAEA;EACA,SAAS;;;;;;;;;UAUM;WACN;WACA;WACA;;WAEA;;;;;;;;WAQA,iBAAiB,SAAS;EACnC,QAAQ,SAAS,6BAA6B,QAAQ;;iBAGxC,0BACd,QAAQ,QAAQ,kCACf;;;;KC3DS;;;;;;;;;;;;;;;;;;;;iBAgDI,wBACd,OAAO,oBACP,OAAO,qBACN"}
1
+ {"version":3,"file":"tool-groups-CK0JCkqO.d.ts","names":[],"sources":["../src/contract/analyze-runs.ts","../src/eval-tools.ts","../src/trace-analyst/tools.ts","../src/analyst/finding-signature.ts","../src/analyst/engine.ts","../src/analyst/tool-groups.ts"],"mappings":";;;;;;;;;;UAoEiB;;EAEf,MAAM;;;EAGN;;;;;EAKA;EACA;;;EAGA,kBAAkB;;;EAGlB,UAAU;;;;EAIV;IACE;IACA,cAAc;;;;;EAKhB,cAAc;IAAQ;IAAe;IAAe;;;EAEpD;;;;EA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BACP,OAAO,qBACN"}
package/dist/traces.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { C as TraceEvent, D as isSandboxSpan, E as isRetrievalSpan, O as isToolSpan, S as ToolSpan, T as isLlmSpan, _ as Span, a as FAILURE_CLASSES, b as SpanStatus, c as JudgeSpan, d as RetrievalSpan, f as Run, g as SandboxSpan, h as RunStatus, i as EventKind, l as LlmSpan, m as RunOutcome, n as BudgetLedgerEntry, o as FailureClass, p as RunLayer, r as BudgetSpec, s as GenericSpan, t as Artifact, u as Message, v as SpanBase, w as isJudgeSpan, x as TRACE_SCHEMA_VERSION, y as SpanKind } from "./schema-BtVldJ3T.js";
2
- import { a as ExtractedUsage, c as extractUsageFromResponse, i as ExtractUsageFromSseOptions, l as extractUsageFromSse, n as CaptureFetchOptions, o as SseUsageMode, r as captureFetchToRawSink, s as extractUsage, t as CaptureFetchContext } from "./index-DGIzNtRv.js";
3
- import { _t as RawProviderSink, bt as providerFromBaseUrl, dt as InMemoryRawProviderSink, ft as InMemoryRawProviderSinkOptions, gt as RawProviderEvent, ht as RawProviderDirection, lt as FileSystemRawProviderSink, mt as ProviderRedactor, pt as NoopRawProviderSink, ut as FileSystemRawProviderSinkOptions, vt as RawProviderSinkFilter, yt as defaultProviderRedactor } from "./types-BjMFz88h.js";
2
+ import { a as ExtractedUsage, c as extractUsageFromResponse, i as ExtractUsageFromSseOptions, l as extractUsageFromSse, n as CaptureFetchOptions, o as SseUsageMode, r as captureFetchToRawSink, s as extractUsage, t as CaptureFetchContext } from "./index-Dx1kF3Ez.js";
3
+ import { At as NoopRawProviderSink, Dt as FileSystemRawProviderSinkOptions, Et as FileSystemRawProviderSink, Ft as RawProviderSinkFilter, It as defaultProviderRedactor, Lt as providerFromBaseUrl, Mt as RawProviderDirection, Nt as RawProviderEvent, Ot as InMemoryRawProviderSink, Pt as RawProviderSink, jt as ProviderRedactor, kt as InMemoryRawProviderSinkOptions } from "./types-XMVEdrE_.js";
4
4
  import { a as RunFilter, i as InMemoryTraceStore, n as FileSystemTraceStore, o as SpanFilter, r as FileSystemTraceStoreOptions, s as TraceStore, t as EventFilter } from "./store-CT9YIIve.js";
5
5
  import { a as TraceEmitterOptions, i as TraceEmitter, n as RunCompleteHookContext, o as llmSpanFromProvider, r as SpanHandle, t as RunCompleteHook } from "./emitter-DGQGoLyj.js";
6
- import { a as RunIntegrityReport, i as RunIntegrityIssueCode, n as RunIntegrityExpectations, o as assertRunCaptured, r as RunIntegrityIssue, s as throwIfRunIncomplete, t as RunIntegrityError } from "./integrity-DRXobPEs.js";
7
- import { $ as traceAnalystOnRunComplete, A as stringField, At as OtlpSpanRoleInput, B as TraceInsightReadiness, Bt as exportRunAsOtlp, C as ProjectedOtlpSpan, Ct as createOtelTracingStore, D as inferOtlpKind, Dt as OtelExporter, E as firstStringAttr, Et as OtelExportConfig, F as TraceInsightFinding, Ft as traceSpanKindToOpenInferenceKind, G as defaultTraceInsightPanel, H as TraceInsightTask, I as TraceInsightPanelRole, It as OTEL_AGENT_EVAL_SCOPE, J as inferDomainKeywords, K as describeTraceInsightScope, L as TraceInsightPromptInput, Lt as OtlpExport, M as flattenOtlpExportToNdjson, Mt as applyToolSpanOtlpAttributes, N as OtlpFlatLine, Nt as classifyOtlpSpanRole, O as projectOtlpFlatLine, Ot as createOtelExporter, P as TraceInsightContext, Pt as isOtlpModelCall, Q as TraceAnalystHookOptions, R as TraceInsightQualityGate, Rt as OtlpResourceSpans, S as otlpToTraceRunRecords, St as redactValue, T as extractOtlpAttributes, Tt as ExportableSpan, U as buildTraceInsightContext, V as TraceInsightSuite, W as buildTraceInsightPrompt, X as scoreTraceInsightReadiness, Y as planTraceInsightQuestions, Z as tokenizeDomainWords, _ as OtlpTraceRunRecord, _t as DEFAULT_REDACTION_RULES, a as ReplayFetchOptions, at as TraceFileMissingError, b as otlpRowsToTraceRunRecords, bt as RedactionRule, c as ToolTraceMissingError, ct as AnalyzeTracesInput, d as OtlpFileTraceStoreOptions, dt as analyzeTraces, et as SpanNotFoundError, f as ToolSpansToTraceAnalysisStoreOptions, ft as createBoundedTraceAnalysisStore, g as OtlpToRunRecordsOptions, gt as convertTraceStoresToOtlp, h as TRACE_ANALYST_ACTOR_DESCRIPTION_VERSION, ht as TracesToOtlpResult, i as ReplayCacheStats, it as TraceFileMalformedError, j as FlattenOtlpOptions, jt as ToolSpanOtlpInput, k as readOtlpStatus, kt as OtlpSpanRole, l as toolSpansToTraceAnalysisStore, lt as AnalyzeTracesOptions, m as TRACE_ANALYST_ACTOR_DESCRIPTION, mt as TraceStoreToOtlpOptions, n as ReplayCacheEntry, nt as TraceAnalysisStoreContractError, o as createReplayFetch, ot as TraceFileTooLargeError, p as otlpTextToTraceAnalysisStore, pt as TraceStoreSource, q as domainEvidencePattern, r as ReplayCacheMissError, rt as TraceAnalysisValidationError, s as iterateRawCalls, st as TraceNotFoundError, t as ReplayCache, tt as TraceAnalysisLimitError, u as OtlpFileTraceStore, ut as AnalyzeTracesResult, v as TraceAggregate, vt as REDACTION_VERSION, w as asString, wt as otelRunCompleteHook, x as otlpToRunRecords, xt as redactString, y as otlpRowsToRunRecords, yt as RedactionReport, z as TraceInsightQuestion, zt as OtlpSpan } from "./replay-DQ-55DC_.js";
6
+ import { a as RunIntegrityReport, i as RunIntegrityIssueCode, n as RunIntegrityExpectations, o as assertRunCaptured, r as RunIntegrityIssue, s as throwIfRunIncomplete, t as RunIntegrityError } from "./integrity-CNGUaGBY.js";
7
+ import { $ as traceAnalystOnRunComplete, A as stringField, At as OtlpSpanRoleInput, B as TraceInsightReadiness, Bt as exportRunAsOtlp, C as ProjectedOtlpSpan, Ct as createOtelTracingStore, D as inferOtlpKind, Dt as OtelExporter, E as firstStringAttr, Et as OtelExportConfig, F as TraceInsightFinding, Ft as traceSpanKindToOpenInferenceKind, G as defaultTraceInsightPanel, H as TraceInsightTask, I as TraceInsightPanelRole, It as OTEL_AGENT_EVAL_SCOPE, J as inferDomainKeywords, K as describeTraceInsightScope, L as TraceInsightPromptInput, Lt as OtlpExport, M as flattenOtlpExportToNdjson, Mt as applyToolSpanOtlpAttributes, N as OtlpFlatLine, Nt as classifyOtlpSpanRole, O as projectOtlpFlatLine, Ot as createOtelExporter, P as TraceInsightContext, Pt as isOtlpModelCall, Q as TraceAnalystHookOptions, R as TraceInsightQualityGate, Rt as OtlpResourceSpans, S as otlpToTraceRunRecords, St as redactValue, T as extractOtlpAttributes, Tt as ExportableSpan, U as buildTraceInsightContext, V as TraceInsightSuite, W as buildTraceInsightPrompt, X as scoreTraceInsightReadiness, Y as planTraceInsightQuestions, Z as tokenizeDomainWords, _ as OtlpTraceRunRecord, _t as DEFAULT_REDACTION_RULES, a as ReplayFetchOptions, at as TraceFileMissingError, b as otlpRowsToTraceRunRecords, bt as RedactionRule, c as ToolTraceMissingError, ct as AnalyzeTracesInput, d as OtlpFileTraceStoreOptions, dt as analyzeTraces, et as SpanNotFoundError, f as ToolSpansToTraceAnalysisStoreOptions, ft as createBoundedTraceAnalysisStore, g as OtlpToRunRecordsOptions, gt as convertTraceStoresToOtlp, h as TRACE_ANALYST_ACTOR_DESCRIPTION_VERSION, ht as TracesToOtlpResult, i as ReplayCacheStats, it as TraceFileMalformedError, j as FlattenOtlpOptions, jt as ToolSpanOtlpInput, k as readOtlpStatus, kt as OtlpSpanRole, l as toolSpansToTraceAnalysisStore, lt as AnalyzeTracesOptions, m as TRACE_ANALYST_ACTOR_DESCRIPTION, mt as TraceStoreToOtlpOptions, n as ReplayCacheEntry, nt as TraceAnalysisStoreContractError, o as createReplayFetch, ot as TraceFileTooLargeError, p as otlpTextToTraceAnalysisStore, pt as TraceStoreSource, q as domainEvidencePattern, r as ReplayCacheMissError, rt as TraceAnalysisValidationError, s as iterateRawCalls, st as TraceNotFoundError, t as ReplayCache, tt as TraceAnalysisLimitError, u as OtlpFileTraceStore, ut as AnalyzeTracesResult, v as TraceAggregate, vt as REDACTION_VERSION, w as asString, wt as otelRunCompleteHook, x as otlpToRunRecords, xt as redactString, y as otlpRowsToRunRecords, yt as RedactionReport, z as TraceInsightQuestion, zt as OtlpSpan } from "./replay-Krvb114g.js";
8
8
  import { C as TOOL_LATENCY_MS, D as asNumber, E as applyLlmSpanOtlpAttributes, O as contextInputTokens, S as TOOL_ARGS_CAPTURED, T as TOOL_NAME_ATTR_KEYS, _ as LlmSpanOtlpInput, a as LLM_CACHE_WRITE_TOKEN_ATTR_KEYS, b as RUN_COST_ATTR_KEYS, c as LLM_COST_USD, d as LLM_MODEL_ATTR_KEYS, f as LLM_MODEL_NAME, g as LLM_REASONING_TOKEN_ATTR_KEYS, h as LLM_REASONING_TOKENS, i as LLM_CACHE_WRITE_TOKENS, k as firstNumberAttr, l as LLM_INPUT_TOKENS, m as LLM_OUTPUT_TOKEN_ATTR_KEYS, n as LLM_CACHED_TOKENS, o as LLM_CONTEXT_TOKENS, p as LLM_OUTPUT_TOKENS, r as LLM_CACHED_TOKEN_ATTR_KEYS, s as LLM_COST_ATTR_KEYS, t as INPUT_VALUE, u as LLM_INPUT_TOKEN_ATTR_KEYS, v as OPENINFERENCE_SPAN_KIND, w as TOOL_NAME, x as SPAN_KIND_ATTR_KEYS, y as OUTPUT_VALUE } from "./attribute-vocabulary-DLJ6303h.js";
9
9
  import { a as judgeSpans, c as runsForScenario, i as hasCapturedToolArgs, l as toolSpans, n as argHash, o as llmSpans, r as groupBy, s as runFailureClass, t as aggregateLlm } from "./query-CJ_DX8vl.js";
10
- import { A as TRACE_ANALYST_TRUNCATION_MARKER_PREFIX, C as DEFAULT_TRACE_ANALYST_BUDGETS, D as SearchSpanResult, E as QueryTracesPage, F as TraceAnalystSpanStatus, I as TraceAnalystTraceSummary, L as ViewSpansResult, M as TraceAnalystFilters, N as TraceAnalystSpan, O as SearchTraceResult, P as TraceAnalystSpanKind, R as ViewTraceOversized, S as TraceAnalysisStoreContext, T as ErrorCluster, b as TRACE_ANALYSIS_LIMITS, j as TraceAnalystByteBudgets, k as SpanMatchRecord, w as DatasetOverview, x as TraceAnalysisStore, y as BoundedTraceAnalysisStoreOptions, z as ViewTraceResult } from "./types-y8jrxXWd.js";
11
- import { _ as BuildTraceAnalysisToolsOptions, b as buildTraceAnalysisToolDescriptors, v as TRACE_ANALYST_TOOL_NAMESPACE, x as traceAnalystFunctionGroup, y as TraceAnalysisToolDescriptor } from "./tool-groups-CMmsgTzj.js";
10
+ import { A as TRACE_ANALYST_TRUNCATION_MARKER_PREFIX, C as DEFAULT_TRACE_ANALYST_BUDGETS, D as SearchSpanResult, E as QueryTracesPage, F as TraceAnalystSpanStatus, I as TraceAnalystTraceSummary, L as ViewSpansResult, M as TraceAnalystFilters, N as TraceAnalystSpan, O as SearchTraceResult, P as TraceAnalystSpanKind, R as ViewTraceOversized, S as TraceAnalysisStoreContext, T as ErrorCluster, b as TRACE_ANALYSIS_LIMITS, j as TraceAnalystByteBudgets, k as SpanMatchRecord, w as DatasetOverview, x as TraceAnalysisStore, y as BoundedTraceAnalysisStoreOptions, z as ViewTraceResult } from "./types-BhP9q0Fq.js";
11
+ import { _ as BuildTraceAnalysisToolsOptions, b as buildTraceAnalysisToolDescriptors, v as TRACE_ANALYST_TOOL_NAMESPACE, x as traceAnalystFunctionGroup, y as TraceAnalysisToolDescriptor } from "./tool-groups-CK0JCkqO.js";
12
12
  export { type AnalyzeTracesInput, type AnalyzeTracesOptions, type AnalyzeTracesResult, Artifact, type BoundedTraceAnalysisStoreOptions, BudgetLedgerEntry, BudgetSpec, type BuildTraceAnalysisToolsOptions, CaptureFetchContext, CaptureFetchOptions, DEFAULT_REDACTION_RULES, DEFAULT_TRACE_ANALYST_BUDGETS, type DatasetOverview, type ErrorCluster, EventFilter, EventKind, ExportableSpan, ExtractUsageFromSseOptions, ExtractedUsage, FAILURE_CLASSES, FailureClass, FileSystemRawProviderSink, FileSystemRawProviderSinkOptions, FileSystemTraceStore, FileSystemTraceStoreOptions, type FlattenOtlpOptions, GenericSpan, INPUT_VALUE, InMemoryRawProviderSink, InMemoryRawProviderSinkOptions, InMemoryTraceStore, JudgeSpan, LLM_CACHED_TOKENS, LLM_CACHED_TOKEN_ATTR_KEYS, LLM_CACHE_WRITE_TOKENS, LLM_CACHE_WRITE_TOKEN_ATTR_KEYS, LLM_CONTEXT_TOKENS, LLM_COST_ATTR_KEYS, LLM_COST_USD, LLM_INPUT_TOKENS, LLM_INPUT_TOKEN_ATTR_KEYS, LLM_MODEL_ATTR_KEYS, LLM_MODEL_NAME, LLM_OUTPUT_TOKENS, LLM_OUTPUT_TOKEN_ATTR_KEYS, LLM_REASONING_TOKENS, LLM_REASONING_TOKEN_ATTR_KEYS, LlmSpan, LlmSpanOtlpInput, Message, NoopRawProviderSink, OPENINFERENCE_SPAN_KIND, OTEL_AGENT_EVAL_SCOPE, OUTPUT_VALUE, OtelExportConfig, OtelExporter, OtlpExport, OtlpFileTraceStore, type OtlpFileTraceStoreOptions, type OtlpFlatLine, OtlpResourceSpans, OtlpSpan, OtlpSpanRole, OtlpSpanRoleInput, type OtlpToRunRecordsOptions, type OtlpTraceRunRecord, type ProjectedOtlpSpan, ProviderRedactor, type QueryTracesPage, REDACTION_VERSION, RUN_COST_ATTR_KEYS, RawProviderDirection, RawProviderEvent, RawProviderSink, RawProviderSinkFilter, RedactionReport, RedactionRule, ReplayCache, ReplayCacheEntry, ReplayCacheMissError, ReplayCacheStats, ReplayFetchOptions, RetrievalSpan, Run, RunCompleteHook, RunCompleteHookContext, RunFilter, RunIntegrityError, RunIntegrityExpectations, RunIntegrityIssue, RunIntegrityIssueCode, RunIntegrityReport, RunLayer, RunOutcome, RunStatus, SPAN_KIND_ATTR_KEYS, SandboxSpan, type SearchSpanResult, type SearchTraceResult, Span, SpanBase, SpanFilter, SpanHandle, SpanKind, type SpanMatchRecord, SpanNotFoundError, SpanStatus, SseUsageMode, TOOL_ARGS_CAPTURED, TOOL_LATENCY_MS, TOOL_NAME, TOOL_NAME_ATTR_KEYS, TRACE_ANALYSIS_LIMITS, TRACE_ANALYST_ACTOR_DESCRIPTION, TRACE_ANALYST_ACTOR_DESCRIPTION_VERSION, TRACE_ANALYST_TOOL_NAMESPACE, TRACE_ANALYST_TRUNCATION_MARKER_PREFIX, TRACE_SCHEMA_VERSION, ToolSpan, ToolSpanOtlpInput, type ToolSpansToTraceAnalysisStoreOptions, ToolTraceMissingError, type TraceAggregate, TraceAnalysisLimitError, type TraceAnalysisStore, type TraceAnalysisStoreContext, TraceAnalysisStoreContractError, type TraceAnalysisToolDescriptor, TraceAnalysisValidationError, type TraceAnalystByteBudgets, type TraceAnalystFilters, type TraceAnalystHookOptions, type TraceAnalystSpan, type TraceAnalystSpanKind, type TraceAnalystSpanStatus, type TraceAnalystTraceSummary, TraceEmitter, TraceEmitterOptions, TraceEvent, TraceFileMalformedError, TraceFileMissingError, TraceFileTooLargeError, type TraceInsightContext, type TraceInsightFinding, type TraceInsightPanelRole, type TraceInsightPromptInput, type TraceInsightQualityGate, type TraceInsightQuestion, type TraceInsightReadiness, type TraceInsightSuite, type TraceInsightTask, TraceNotFoundError, TraceStore, TraceStoreSource, TraceStoreToOtlpOptions, TracesToOtlpResult, type ViewSpansResult, type ViewTraceOversized, type ViewTraceResult, aggregateLlm, analyzeTraces, applyLlmSpanOtlpAttributes, applyToolSpanOtlpAttributes, argHash, asNumber, asString, assertRunCaptured, buildTraceAnalysisToolDescriptors, buildTraceInsightContext, buildTraceInsightPrompt, captureFetchToRawSink, classifyOtlpSpanRole, contextInputTokens, convertTraceStoresToOtlp, createBoundedTraceAnalysisStore, createOtelExporter, createOtelTracingStore, createReplayFetch, defaultProviderRedactor, defaultTraceInsightPanel, describeTraceInsightScope, domainEvidencePattern, exportRunAsOtlp, extractOtlpAttributes, extractUsage, extractUsageFromResponse, extractUsageFromSse, firstNumberAttr, firstStringAttr, flattenOtlpExportToNdjson, groupBy, hasCapturedToolArgs, inferDomainKeywords, inferOtlpKind, isJudgeSpan, isLlmSpan, isOtlpModelCall, isRetrievalSpan, isSandboxSpan, isToolSpan, iterateRawCalls, judgeSpans, llmSpanFromProvider, llmSpans, otelRunCompleteHook, otlpRowsToRunRecords, otlpRowsToTraceRunRecords, otlpTextToTraceAnalysisStore, otlpToRunRecords, otlpToTraceRunRecords, planTraceInsightQuestions, projectOtlpFlatLine, providerFromBaseUrl, readOtlpStatus, redactString, redactValue, runFailureClass, runsForScenario, scoreTraceInsightReadiness, stringField, throwIfRunIncomplete, tokenizeDomainWords, toolSpans, toolSpansToTraceAnalysisStore, traceAnalystFunctionGroup, traceAnalystOnRunComplete, traceSpanKindToOpenInferenceKind };
package/dist/traces.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { a as providerFromBaseUrl, i as defaultProviderRedactor, n as InMemoryRawProviderSink, r as NoopRawProviderSink, t as FileSystemRawProviderSink } from "./raw-provider-sink-BQd7mzyT.js";
2
2
  import { INPUT_VALUE, LLM_CACHED_TOKENS, LLM_CACHED_TOKEN_ATTR_KEYS, LLM_CACHE_WRITE_TOKENS, LLM_CACHE_WRITE_TOKEN_ATTR_KEYS, LLM_CONTEXT_TOKENS, LLM_COST_ATTR_KEYS, LLM_COST_USD, LLM_INPUT_TOKENS, LLM_INPUT_TOKEN_ATTR_KEYS, LLM_MODEL_ATTR_KEYS, LLM_MODEL_NAME, LLM_OUTPUT_TOKENS, LLM_OUTPUT_TOKEN_ATTR_KEYS, LLM_REASONING_TOKENS, LLM_REASONING_TOKEN_ATTR_KEYS, OPENINFERENCE_SPAN_KIND, OUTPUT_VALUE, RUN_COST_ATTR_KEYS, SPAN_KIND_ATTR_KEYS, TOOL_ARGS_CAPTURED, TOOL_LATENCY_MS, TOOL_NAME, TOOL_NAME_ATTR_KEYS, applyLlmSpanOtlpAttributes, asNumber, contextInputTokens, firstNumberAttr } from "./trace-attributes.js";
3
- import { C as TraceNotFoundError, J as extractOtlpAttributes, K as asString, Q as readOtlpStatus, S as TraceFileTooLargeError, X as inferOtlpKind, Y as firstStringAttr, Z as projectOtlpFlatLine, _ as TraceAnalysisLimitError, b as TraceFileMalformedError, c as traceAnalystFunctionGroup, et as stringField, g as SpanNotFoundError, h as TRACE_ANALYSIS_LIMITS, it as traceSpanKindToOpenInferenceKind, l as createBoundedTraceAnalysisStore, m as TRACE_ANALYST_TRUNCATION_MARKER_PREFIX, nt as classifyOtlpSpanRole, o as TRACE_ANALYST_TOOL_NAMESPACE, p as DEFAULT_TRACE_ANALYST_BUDGETS, rt as isOtlpModelCall, s as buildTraceAnalysisToolDescriptors, tt as applyToolSpanOtlpAttributes, v as TraceAnalysisStoreContractError, x as TraceFileMissingError, y as TraceAnalysisValidationError } from "./kind-factory-Bvwe3pup.js";
3
+ import { C as TraceNotFoundError, J as extractOtlpAttributes, K as asString, Q as readOtlpStatus, S as TraceFileTooLargeError, X as inferOtlpKind, Y as firstStringAttr, Z as projectOtlpFlatLine, _ as TraceAnalysisLimitError, b as TraceFileMalformedError, c as traceAnalystFunctionGroup, et as stringField, g as SpanNotFoundError, h as TRACE_ANALYSIS_LIMITS, it as traceSpanKindToOpenInferenceKind, l as createBoundedTraceAnalysisStore, m as TRACE_ANALYST_TRUNCATION_MARKER_PREFIX, nt as classifyOtlpSpanRole, o as TRACE_ANALYST_TOOL_NAMESPACE, p as DEFAULT_TRACE_ANALYST_BUDGETS, rt as isOtlpModelCall, s as buildTraceAnalysisToolDescriptors, tt as applyToolSpanOtlpAttributes, v as TraceAnalysisStoreContractError, x as TraceFileMissingError, y as TraceAnalysisValidationError } from "./kind-factory-BHIgPmzS.js";
4
4
  import { n as llmSpanFromProvider, t as TraceEmitter } from "./emitter-CPBAhxum.js";
5
5
  import { a as isRetrievalSpan, i as isLlmSpan, n as TRACE_SCHEMA_VERSION, o as isSandboxSpan, r as isJudgeSpan, s as isToolSpan, t as FAILURE_CLASSES } from "./schema-CRhEY1SO.js";
6
- import { A as TRACE_ANALYST_ACTOR_DESCRIPTION, C as domainEvidencePattern, D as tokenizeDomainWords, E as scoreTraceInsightReadiness, O as traceAnalystOnRunComplete, S as describeTraceInsightScope, T as planTraceInsightQuestions, _ as otlpToTraceRunRecords, a as convertTraceStoresToOtlp, b as buildTraceInsightPrompt, c as otelRunCompleteHook, d as captureFetchToRawSink, f as ToolTraceMissingError, g as otlpToRunRecords, h as otlpRowsToTraceRunRecords, i as iterateRawCalls, j as TRACE_ANALYST_ACTOR_DESCRIPTION_VERSION, k as analyzeTraces, l as OTEL_AGENT_EVAL_SCOPE, m as otlpRowsToRunRecords, n as ReplayCacheMissError, o as createOtelExporter, p as toolSpansToTraceAnalysisStore, r as createReplayFetch, s as createOtelTracingStore, t as ReplayCache, u as exportRunAsOtlp, v as flattenOtlpExportToNdjson, w as inferDomainKeywords, x as defaultTraceInsightPanel, y as buildTraceInsightContext } from "./replay-CqOsGjzU.js";
7
- import { i as otlpTextToTraceAnalysisStore, n as OtlpFileTraceStore } from "./store-otlp-D4I90_vR.js";
8
- import { n as extractUsageFromResponse, r as extractUsageFromSse, t as extractUsage } from "./extract-usage-7l1Xq5ti.js";
6
+ import { A as TRACE_ANALYST_ACTOR_DESCRIPTION, C as domainEvidencePattern, D as tokenizeDomainWords, E as scoreTraceInsightReadiness, O as traceAnalystOnRunComplete, S as describeTraceInsightScope, T as planTraceInsightQuestions, _ as otlpToTraceRunRecords, a as convertTraceStoresToOtlp, b as buildTraceInsightPrompt, c as otelRunCompleteHook, d as captureFetchToRawSink, f as ToolTraceMissingError, g as otlpToRunRecords, h as otlpRowsToTraceRunRecords, i as iterateRawCalls, j as TRACE_ANALYST_ACTOR_DESCRIPTION_VERSION, k as analyzeTraces, l as OTEL_AGENT_EVAL_SCOPE, m as otlpRowsToRunRecords, n as ReplayCacheMissError, o as createOtelExporter, p as toolSpansToTraceAnalysisStore, r as createReplayFetch, s as createOtelTracingStore, t as ReplayCache, u as exportRunAsOtlp, v as flattenOtlpExportToNdjson, w as inferDomainKeywords, x as defaultTraceInsightPanel, y as buildTraceInsightContext } from "./replay-GW61ezMW.js";
7
+ import { i as otlpTextToTraceAnalysisStore, n as OtlpFileTraceStore } from "./store-otlp-CKtTpRhv.js";
8
+ import { n as extractUsageFromResponse, r as extractUsageFromSse, t as extractUsage } from "./extract-usage-BW27f3XW.js";
9
9
  import { a as judgeSpans, c as runsForScenario, i as hasCapturedToolArgs, l as toolSpans, n as argHash, o as llmSpans, r as groupBy, s as runFailureClass, t as aggregateLlm } from "./query-Di7eEQ79.js";
10
10
  import { a as InMemoryTraceStore, i as FileSystemTraceStore, n as assertRunCaptured, r as throwIfRunIncomplete, t as RunIntegrityError } from "./integrity-fdt8XPAv.js";
11
11
  import { i as redactValue, n as REDACTION_VERSION, r as redactString, t as DEFAULT_REDACTION_RULES } from "./redact-7Aq1ukl-.js";
@@ -1,6 +1,6 @@
1
- import { c as CostLedgerHandle } from "./cost-ledger-FuQvHxPm.js";
2
- import { a as RunRecord, n as RunCostProvenance, u as RunTokenUsage } from "./run-record-ooo9FWns.js";
3
- import { A as ChatClient, m as JudgeInput } from "./types-BjMFz88h.js";
1
+ import { c as CostLedgerHandle } from "./cost-ledger-Bv_e8XHY.js";
2
+ import { a as RunRecord, n as RunCostProvenance, u as RunTokenUsage } from "./run-record-DdSa93_W.js";
3
+ import { A as ChatClient, m as JudgeInput } from "./types-XMVEdrE_.js";
4
4
  import { RE2JS } from "re2js";
5
5
  //#region src/trace-analyst/types.d.ts
6
6
  /**
@@ -429,6 +429,24 @@ interface AnalystUsageReceipt {
429
429
  cost: RunCostProvenance;
430
430
  /** Known lower bound when one or more calls have uncaptured cost. */
431
431
  knownCostUsd?: number;
432
+ /**
433
+ * Token counts the provider reported on only one side. Present exactly when
434
+ * `tokens` is null and at least one side WAS reported: `RunTokenUsage` has no
435
+ * nullable side, so a one-sided count cannot live in `tokens` without writing
436
+ * a zero nobody measured. Read it as a lower bound, never as a total — the
437
+ * field exists so a null `tokens` cannot hide a real count.
438
+ */
439
+ partialTokens?: {
440
+ input: number | null;
441
+ output: number | null;
442
+ };
443
+ /**
444
+ * True when the token counts were DERIVED by the transport (from character
445
+ * lengths, say) rather than measured by the model provider. `cost.kind` is
446
+ * `estimated` both for a rate estimate over exact tokens and for one over
447
+ * derived tokens; this is the field that separates them.
448
+ */
449
+ tokensEstimated?: boolean;
432
450
  }
433
451
  /**
434
452
  * Compute the stable finding_id from the identity-defining fields.
@@ -527,4 +545,4 @@ type AnalystRunEvent = {
527
545
  };
528
546
  //#endregion
529
547
  export { TRACE_ANALYST_TRUNCATION_MARKER_PREFIX as A, DEFAULT_TRACE_ANALYST_BUDGETS as C, SearchSpanResult as D, QueryTracesPage as E, TraceAnalystSpanStatus as F, TraceAnalystTraceSummary as I, ViewSpansResult as L, TraceAnalystFilters as M, TraceAnalystSpan as N, SearchTraceResult as O, TraceAnalystSpanKind as P, ViewTraceOversized as R, TraceAnalysisStoreContext as S, ErrorCluster as T, makeFinding as _, AnalystInputKind as a, TRACE_ANALYSIS_LIMITS as b, AnalystRunInputs as c, AnalystSeverity as d, AnalystUsageReceipt as f, computeFindingId as g, ProposalFindingOrigin as h, AnalystFinding as i, TraceAnalystByteBudgets as j, SpanMatchRecord as k, AnalystRunResult as l, ProposalFinding as m, AnalystContext as n, AnalystRequirements as o, EvidenceRef as p, AnalystCost as r, AnalystRunEvent as s, Analyst as t, AnalystRunSummary as u, makeProposalFinding as v, DatasetOverview as w, TraceAnalysisStore as x, BoundedTraceAnalysisStoreOptions as y, ViewTraceResult as z };
530
- //# sourceMappingURL=types-y8jrxXWd.d.ts.map
548
+ //# sourceMappingURL=types-BhP9q0Fq.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-y8jrxXWd.d.ts","names":[],"sources":["../src/trace-analyst/types.ts","../src/trace-analyst/store-contract.ts","../src/analyst/types.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;KAgBY;KAUA;;;;UAKK;EACf;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA;;;EAGA,YAAY;;UAGG;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;;EAEf;;EAEA;;EAEA;;EAEA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AGD;;KAGA;;KAGA,kBAAkB;WACnB,iBAAiB;;UAGX;;;;;;;EAOf;EACA;EACA;;;;;;;;KAWU;UAOK;;EAEf;;EAEA;;EAEA;;EAEA;;UAGe;;EAEf;;EAEA;;;;;;UAOe;EACf,aAAa;EACb;EACA,YAAY;EACZ,aAAa;;EAEb,SAAS;;UAGM;EACf;;EAEA;;EAEA;;EAEA;;EAEA,aAAa;;EAEb;;;;;;;EAOA,OAAO;;;;;;;;;;EAUP,gBAAgB,cAAc;;;;;;;EAO9B,mBAAmB,cAAc;;;;;EAKjC,eAAe,SAAS;;EAExB,OAAO;;EAEP,OAAO,aAAa,SAAS;;EAE7B,SAAS;;;;;;;;UASM,QAAQ;;WAEd;;WAEA;WACA,WAAW;WACX,MAAM;WACN,WAAW;;WAEX;EACT,QAAQ,OAAO,QAAQ,KAAK,iBAAiB,QAAQ;;;UAItC;;EAEf;;EAEA,QAAQ;;EAER,MAAM;;EAEN;;;;;;;;;;iBAac,iBAAiB;EAC/B;EACA;EACA;EACA;;EAEA;;;;;;iBAyBc,YACd,MAAM,KAAK;EACT;EACA;IAED;;iBAiBa,oBACd,MAAM,KAAK;EACT;EACA;IAED;UAOc;EACf;EACA;;EAEA;EACA;EACA;;EAEA,OAAO;;EAEP;IAAU;IAAe;;;UAGV;EACf;EACA;EACA;EACA;EACA,UAAU;EACV,aAAa;;EAEb;;;;;EAKA,wBAAwB;;;;;;;;;;;;;;;KAkBd;EAEN;EACA;EACA;EACA;;EAEA,aAAa;;EAGb;EACA,SAAS;;EAGT;EACA;EACA;;EAGA;;EAEA,SAAS;EACT,UAAU,cAAc;;EAGxB;EACA,QAAQ"}
1
+ {"version":3,"file":"types-BhP9q0Fq.d.ts","names":[],"sources":["../src/trace-analyst/types.ts","../src/trace-analyst/store-contract.ts","../src/analyst/types.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;KAgBY;KAUA;;;;UAKK;EACf;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA;EACA,QA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S as PaidCallResult, T as RunPaidCallInput, a as CostChannel, c as CostLedgerHandle, f as CostLedgerSummary, p as CostProvenance } from "./cost-ledger-FuQvHxPm.js";
2
- import { u as RunTokenUsage } from "./run-record-ooo9FWns.js";
3
- import { U as LlmCallMetadata } from "./types-BjMFz88h.js";
4
- import { m as ProposalFinding } from "./types-y8jrxXWd.js";
1
+ import { S as PaidCallResult, T as RunPaidCallInput, a as CostChannel, c as CostLedgerHandle, f as CostLedgerSummary, p as CostProvenance } from "./cost-ledger-Bv_e8XHY.js";
2
+ import { u as RunTokenUsage } from "./run-record-DdSa93_W.js";
3
+ import { U as LlmCallMetadata } from "./types-XMVEdrE_.js";
4
+ import { m as ProposalFinding } from "./types-BhP9q0Fq.js";
5
5
  //#region src/campaign/types.d.ts
6
6
  /** Stable identifier + kind tag for any scenario. Consumers
7
7
  * extend with their per-domain payload (persona, task, requirement, ...). */
@@ -624,4 +624,4 @@ interface CampaignResult<TArtifact = unknown, TScenario extends Scenario = Scena
624
624
  }
625
625
  //#endregion
626
626
  export { LabeledScenarioWrite as A, ScoredSurfaceOutcome as B, JudgeDimension as C, LabeledScenarioSampleArgs as D, LabeledScenarioRecord as E, ProposeContext as F, labelTrustRank as G, SurfaceProposer as H, ProposedCandidate as I, RedactionStatus as L, OptimizerConfig as M, ParetoParent as N, LabeledScenarioSource as O, ProposalTrackContext as P, Scenario as R, JudgeConfig as S, LabelTrust as T, TraceSpan as U, SessionScript as V, isProposedCandidate as W, GateDecision as _, CampaignResult as a, GenerationRecord as b, CampaignTraceWriter as c, DispatchContext as d, DispatchFn as f, GateContribution as g, GateContext as h, CampaignCostMeter as i, MutableSurface as j, LabeledScenarioStore as k, CodeSurface as l, GateCheckStatus as m, CampaignArtifactWriter as n, CampaignScenarioIdentity as o, Gate as p, CampaignCellResult as r, CampaignTokenUsage as s, CampaignAggregates as t, ComponentSurface as u, GateResult as v, JudgeScore as w, JudgeAggregate as x, GenerationCandidate as y, ScenarioAggregate as z };
627
- //# sourceMappingURL=types-DcJxgsLy.d.ts.map
627
+ //# sourceMappingURL=types-DOZyvsFU.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-DcJxgsLy.d.ts","names":[],"sources":["../src/campaign/types.ts"],"mappings":";;;;;;;UAgCiB;EACf;EACA;EACA;;;;;EAKA;;;UAIe,iCAAiC,KAAK;EACrD;;;;;UAMe;EACf;EACA;EACA;EACA;EACA,QAAQ;EACR,OAAO;EACP,WAAW;EACX,MAAM;;EAEN;;EAEA;;;;;;;;EAQA;;;;KAKU,WAAW,kBAAkB,UAAU,cACjD,UAAU,WACV,KAAK,oBACF,QAAQ;;;;UAOI,cAAc,WAAW;EACxC;EACA;EACA;;EAEA;;;EAGA,sBAAsB,UAAU,WAAW,sBAAsB,UAAU,cAAc;;UAK1E;;EAEf;;EAEA;;;;;;;;;UAUe,YAAY,WAAW,kBAAkB,WAAW;EACnE;EACA,YAAY;;;;EAIZ;;;EAGA,MAAM;IACJ,UAAU;IACV,UAAU;IACV,QAAQ;;IAER,aAAa;IACb;IACA,WAAW;MACT,aAAa,QAAQ;EACzB,aAAa,UAAU;;;;;;;;;;;UAYR;EACf,YAAY;EACZ;EACA;;EAEA,UAAU;;;;EAIV;;;EAGA;;EAEA;;EAEA,WAAW,eAAe;;;;;;;UAUX;WACN;;;WAGA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;WAGA;aACE;aACA;aACA;;;WAGF;;;UAIM;WACN;WACA,YAAY,SAAS;;;;;;;;;;;KAYpB,0BAA0B,mBAAmB;;;;;;;UAQxC;EACf,SAAS;;EAET;;;;EAIA;;;;iBAKc,oBACd,OAAO,iBAAiB,oBACvB,SAAS;;;;;;;;;UAkBK;EACf,SAAS;EACT;;;EAGA,YAAY;;;EAGZ;;EAEA;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA;EACA;;;;;UAMe;;;EAGf;;EAEA;EACA;EACA;EACA,YAAY;;;;;EAKZ,WAAW;IAAQ;IAAoB;IAAmB;IAAgB;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