@opensearch-project/agent-health 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (551) hide show
  1. package/README.md +36 -5
  2. package/cli/dist/index.js +8292 -2938
  3. package/deployment/cloudformation/agent-health-observability.yaml +223 -32
  4. package/dist/assets/index-BfxtxmKc.css +1 -0
  5. package/dist/assets/index-CrjAfDHu.js +243 -0
  6. package/dist/index.html +2 -2
  7. package/docs/ARCHITECTURE.md +450 -0
  8. package/docs/BACKEND_JOB_QUEUE.md +405 -0
  9. package/docs/CLAUDE_CODE_TELEMETRY.md +283 -0
  10. package/docs/CLI.md +474 -0
  11. package/docs/CODING_AGENT_ANALYTICS.md +298 -0
  12. package/docs/CONFIGURATION.md +388 -0
  13. package/docs/CONNECTORS.md +536 -0
  14. package/docs/INSTRUMENT_WITH_OTEL.md +397 -0
  15. package/docs/ML-COMMONS-SETUP.md +289 -0
  16. package/docs/NPX_PACKAGING.md +195 -0
  17. package/docs/PERFORMANCE-MONITORING.md +200 -0
  18. package/docs/PERFORMANCE.md +390 -0
  19. package/docs/PI_PROFILING.md +169 -0
  20. package/docs/PLAN-non-agui-agent-support.md +525 -0
  21. package/docs/SDK.md +626 -0
  22. package/docs/SKILLS.md +264 -0
  23. package/docs/STORAGE_INDEX_FIELD_LIMITS.md +216 -0
  24. package/docs/blogs/2026-02-28-opensearch-agent-health.md +200 -0
  25. package/docs/blogs/getting-started-blog.md +608 -0
  26. package/docs/diagrams/Agent-health.excalidraw +5656 -0
  27. package/docs/diagrams/architecture.png +0 -0
  28. package/docs/plans/field-redesign.md +468 -0
  29. package/docs/rfcs/001-coding-agent-analytics.md +374 -0
  30. package/docs/rfcs/002-enterprise-leaderboard.md +267 -0
  31. package/docs/rfcs/003-remote-aggregation.md +146 -0
  32. package/docs/rfcs/004-test-sdk-v2.md +599 -0
  33. package/docs/skills/AGENT_HEALTH.md +652 -0
  34. package/docs/skills/AGENT_PROFILE.md +191 -0
  35. package/docs/skills/add-connector/SKILL.md +68 -0
  36. package/docs/skills/agent-health-profile/SKILL.md +40 -0
  37. package/docs/skills/config-auth/SKILL.md +194 -0
  38. package/docs/skills/config-auth/evals/evals.json +35 -0
  39. package/docs/skills/create-pr/SKILL.md +73 -0
  40. package/docs/skills/instrument-otel/SKILL.md +84 -0
  41. package/docs/skills/write-test/SKILL.md +124 -0
  42. package/docs/ui prd.md +376 -0
  43. package/examples/README.md +53 -0
  44. package/examples/config/agent-health.config.example.ts +155 -0
  45. package/examples/connectors/echo-connector.ts +131 -0
  46. package/examples/eval-files/demo.eval.js +128 -0
  47. package/examples/eval-files/ops-rca-classification.eval.js +71 -0
  48. package/examples/eval-files/ops-rca-evaluator.json +15 -0
  49. package/examples/eval-files/sdk-demo.eval.js +72 -0
  50. package/examples/eval-files/sdk-describe-demo.eval.js +50 -0
  51. package/examples/eval-files/sdk-hooks-demo.eval.js +99 -0
  52. package/examples/pi-profiling/README.md +77 -0
  53. package/examples/pi-profiling/agent-health-profile.ts +417 -0
  54. package/lib/dist/lib/agentUtils.d.ts +29 -0
  55. package/lib/dist/lib/agentUtils.d.ts.map +1 -0
  56. package/lib/dist/lib/agentUtils.js +43 -0
  57. package/lib/dist/lib/agentUtils.js.map +1 -0
  58. package/lib/dist/lib/bedrockCompat.d.ts +27 -0
  59. package/lib/dist/lib/bedrockCompat.d.ts.map +1 -0
  60. package/lib/dist/lib/bedrockCompat.js +83 -0
  61. package/lib/dist/lib/bedrockCompat.js.map +1 -0
  62. package/lib/dist/lib/benchmarkExport.d.ts +14 -0
  63. package/lib/dist/lib/benchmarkExport.d.ts.map +1 -0
  64. package/lib/dist/lib/benchmarkExport.js +41 -0
  65. package/lib/dist/lib/benchmarkExport.js.map +1 -0
  66. package/lib/dist/lib/benchmarkImage.d.ts +52 -0
  67. package/lib/dist/lib/benchmarkImage.d.ts.map +1 -0
  68. package/lib/dist/lib/benchmarkImage.js +113 -0
  69. package/lib/dist/lib/benchmarkImage.js.map +1 -0
  70. package/lib/dist/lib/benchmarkVersionUtils.d.ts +50 -0
  71. package/lib/dist/lib/benchmarkVersionUtils.d.ts.map +1 -0
  72. package/lib/dist/lib/benchmarkVersionUtils.js +89 -0
  73. package/lib/dist/lib/benchmarkVersionUtils.js.map +1 -0
  74. package/lib/dist/lib/chunkedFetch.d.ts +18 -0
  75. package/lib/dist/lib/chunkedFetch.d.ts.map +1 -0
  76. package/lib/dist/lib/chunkedFetch.js +40 -0
  77. package/lib/dist/lib/chunkedFetch.js.map +1 -0
  78. package/lib/dist/lib/comparisonInsights.d.ts +104 -0
  79. package/lib/dist/lib/comparisonInsights.d.ts.map +1 -0
  80. package/lib/dist/lib/comparisonInsights.js +212 -0
  81. package/lib/dist/lib/comparisonInsights.js.map +1 -0
  82. package/lib/dist/lib/config/defineConfig.d.ts +27 -0
  83. package/lib/dist/lib/config/defineConfig.d.ts.map +1 -0
  84. package/lib/dist/lib/config/defineConfig.js +28 -0
  85. package/lib/dist/lib/config/defineConfig.js.map +1 -0
  86. package/lib/dist/lib/config/index.d.ts +9 -0
  87. package/lib/dist/lib/config/index.d.ts.map +1 -0
  88. package/lib/dist/lib/config/index.js +8 -0
  89. package/lib/dist/lib/config/index.js.map +1 -0
  90. package/lib/dist/lib/config/loader.d.ts +39 -0
  91. package/lib/dist/lib/config/loader.d.ts.map +1 -0
  92. package/lib/dist/lib/config/loader.js +263 -0
  93. package/lib/dist/lib/config/loader.js.map +1 -0
  94. package/lib/dist/lib/config/statePaths.d.ts +61 -0
  95. package/lib/dist/lib/config/statePaths.d.ts.map +1 -0
  96. package/lib/dist/lib/config/statePaths.js +188 -0
  97. package/lib/dist/lib/config/statePaths.js.map +1 -0
  98. package/lib/dist/lib/config/types.d.ts +245 -0
  99. package/lib/dist/lib/config/types.d.ts.map +1 -0
  100. package/lib/dist/lib/config/types.js +6 -0
  101. package/lib/dist/lib/config/types.js.map +1 -0
  102. package/lib/dist/lib/config.d.ts +39 -0
  103. package/lib/dist/lib/config.d.ts.map +1 -0
  104. package/lib/dist/lib/config.js +118 -0
  105. package/lib/dist/lib/config.js.map +1 -0
  106. package/lib/dist/lib/constants.d.ts +81 -0
  107. package/lib/dist/lib/constants.d.ts.map +1 -0
  108. package/lib/dist/lib/constants.js +374 -0
  109. package/lib/dist/lib/constants.js.map +1 -0
  110. package/lib/dist/lib/contextFormat.d.ts +26 -0
  111. package/lib/dist/lib/contextFormat.d.ts.map +1 -0
  112. package/lib/dist/lib/contextFormat.js +28 -0
  113. package/lib/dist/lib/contextFormat.js.map +1 -0
  114. package/lib/dist/lib/contextUtilization.d.ts +23 -0
  115. package/lib/dist/lib/contextUtilization.d.ts.map +1 -0
  116. package/lib/dist/lib/contextUtilization.js +72 -0
  117. package/lib/dist/lib/contextUtilization.js.map +1 -0
  118. package/lib/dist/lib/dashboardMetrics.d.ts +87 -0
  119. package/lib/dist/lib/dashboardMetrics.d.ts.map +1 -0
  120. package/lib/dist/lib/dashboardMetrics.js +242 -0
  121. package/lib/dist/lib/dashboardMetrics.js.map +1 -0
  122. package/lib/dist/lib/dataSourceConfig.d.ts +108 -0
  123. package/lib/dist/lib/dataSourceConfig.d.ts.map +1 -0
  124. package/lib/dist/lib/dataSourceConfig.js +166 -0
  125. package/lib/dist/lib/dataSourceConfig.js.map +1 -0
  126. package/lib/dist/lib/debug.d.ts +26 -0
  127. package/lib/dist/lib/debug.d.ts.map +1 -0
  128. package/lib/dist/lib/debug.js +132 -0
  129. package/lib/dist/lib/debug.js.map +1 -0
  130. package/lib/dist/lib/diagnostics.d.ts +28 -0
  131. package/lib/dist/lib/diagnostics.d.ts.map +1 -0
  132. package/lib/dist/lib/diagnostics.js +65 -0
  133. package/lib/dist/lib/diagnostics.js.map +1 -0
  134. package/lib/dist/lib/envCompat.d.ts +27 -0
  135. package/lib/dist/lib/envCompat.d.ts.map +1 -0
  136. package/lib/dist/lib/envCompat.js +82 -0
  137. package/lib/dist/lib/envCompat.js.map +1 -0
  138. package/lib/dist/lib/evaluationRerun.d.ts +63 -0
  139. package/lib/dist/lib/evaluationRerun.d.ts.map +1 -0
  140. package/lib/dist/lib/evaluationRerun.js +85 -0
  141. package/lib/dist/lib/evaluationRerun.js.map +1 -0
  142. package/lib/dist/lib/findPackageRoot.d.ts +7 -0
  143. package/lib/dist/lib/findPackageRoot.d.ts.map +1 -0
  144. package/lib/dist/lib/findPackageRoot.js +57 -0
  145. package/lib/dist/lib/findPackageRoot.js.map +1 -0
  146. package/lib/dist/lib/hooks.d.ts +36 -0
  147. package/lib/dist/lib/hooks.d.ts.map +1 -0
  148. package/lib/dist/lib/hooks.js +112 -0
  149. package/lib/dist/lib/hooks.js.map +1 -0
  150. package/lib/dist/lib/index.d.ts +47 -0
  151. package/lib/dist/lib/index.d.ts.map +1 -0
  152. package/lib/dist/lib/index.js +62 -0
  153. package/lib/dist/lib/index.js.map +1 -0
  154. package/lib/dist/lib/labels.d.ts +90 -0
  155. package/lib/dist/lib/labels.d.ts.map +1 -0
  156. package/lib/dist/lib/labels.js +158 -0
  157. package/lib/dist/lib/labels.js.map +1 -0
  158. package/lib/dist/lib/markdown.d.ts +16 -0
  159. package/lib/dist/lib/markdown.d.ts.map +1 -0
  160. package/lib/dist/lib/markdown.js +42 -0
  161. package/lib/dist/lib/markdown.js.map +1 -0
  162. package/lib/dist/lib/matchers/expect.d.ts +3 -0
  163. package/lib/dist/lib/matchers/expect.d.ts.map +1 -0
  164. package/lib/dist/lib/matchers/expect.js +225 -0
  165. package/lib/dist/lib/matchers/expect.js.map +1 -0
  166. package/lib/dist/lib/matchers/index.d.ts +8 -0
  167. package/lib/dist/lib/matchers/index.d.ts.map +1 -0
  168. package/lib/dist/lib/matchers/index.js +9 -0
  169. package/lib/dist/lib/matchers/index.js.map +1 -0
  170. package/lib/dist/lib/matchers/judgeAccessor.d.ts +113 -0
  171. package/lib/dist/lib/matchers/judgeAccessor.d.ts.map +1 -0
  172. package/lib/dist/lib/matchers/judgeAccessor.js +183 -0
  173. package/lib/dist/lib/matchers/judgeAccessor.js.map +1 -0
  174. package/lib/dist/lib/matchers/session.d.ts +39 -0
  175. package/lib/dist/lib/matchers/session.d.ts.map +1 -0
  176. package/lib/dist/lib/matchers/session.js +116 -0
  177. package/lib/dist/lib/matchers/session.js.map +1 -0
  178. package/lib/dist/lib/matchers/traces.d.ts +70 -0
  179. package/lib/dist/lib/matchers/traces.d.ts.map +1 -0
  180. package/lib/dist/lib/matchers/traces.js +236 -0
  181. package/lib/dist/lib/matchers/traces.js.map +1 -0
  182. package/lib/dist/lib/matchers/tracesPricing.d.ts +38 -0
  183. package/lib/dist/lib/matchers/tracesPricing.d.ts.map +1 -0
  184. package/lib/dist/lib/matchers/tracesPricing.js +64 -0
  185. package/lib/dist/lib/matchers/tracesPricing.js.map +1 -0
  186. package/lib/dist/lib/matchers/types.d.ts +75 -0
  187. package/lib/dist/lib/matchers/types.d.ts.map +1 -0
  188. package/lib/dist/lib/matchers/types.js +6 -0
  189. package/lib/dist/lib/matchers/types.js.map +1 -0
  190. package/lib/dist/lib/packagePaths.d.ts +29 -0
  191. package/lib/dist/lib/packagePaths.d.ts.map +1 -0
  192. package/lib/dist/lib/packagePaths.js +63 -0
  193. package/lib/dist/lib/packagePaths.js.map +1 -0
  194. package/lib/dist/lib/performance.d.ts +51 -0
  195. package/lib/dist/lib/performance.d.ts.map +1 -0
  196. package/lib/dist/lib/performance.js +159 -0
  197. package/lib/dist/lib/performance.js.map +1 -0
  198. package/lib/dist/lib/portConfig.d.ts +29 -0
  199. package/lib/dist/lib/portConfig.d.ts.map +1 -0
  200. package/lib/dist/lib/portConfig.js +64 -0
  201. package/lib/dist/lib/portConfig.js.map +1 -0
  202. package/lib/dist/lib/preferences.d.ts +63 -0
  203. package/lib/dist/lib/preferences.d.ts.map +1 -0
  204. package/lib/dist/lib/preferences.js +117 -0
  205. package/lib/dist/lib/preferences.js.map +1 -0
  206. package/lib/dist/lib/resolveAgentModel.d.ts +22 -0
  207. package/lib/dist/lib/resolveAgentModel.d.ts.map +1 -0
  208. package/lib/dist/lib/resolveAgentModel.js +37 -0
  209. package/lib/dist/lib/resolveAgentModel.js.map +1 -0
  210. package/lib/dist/lib/runStats.d.ts +116 -0
  211. package/lib/dist/lib/runStats.d.ts.map +1 -0
  212. package/lib/dist/lib/runStats.js +192 -0
  213. package/lib/dist/lib/runStats.js.map +1 -0
  214. package/lib/dist/lib/telemetry/constants.d.ts +60 -0
  215. package/lib/dist/lib/telemetry/constants.d.ts.map +1 -0
  216. package/lib/dist/lib/telemetry/constants.js +87 -0
  217. package/lib/dist/lib/telemetry/constants.js.map +1 -0
  218. package/lib/dist/lib/telemetry/evalSpans.d.ts +61 -0
  219. package/lib/dist/lib/telemetry/evalSpans.d.ts.map +1 -0
  220. package/lib/dist/lib/telemetry/evalSpans.js +254 -0
  221. package/lib/dist/lib/telemetry/evalSpans.js.map +1 -0
  222. package/lib/dist/lib/telemetry/index.d.ts +11 -0
  223. package/lib/dist/lib/telemetry/index.d.ts.map +1 -0
  224. package/lib/dist/lib/telemetry/index.js +15 -0
  225. package/lib/dist/lib/telemetry/index.js.map +1 -0
  226. package/lib/dist/lib/telemetry/opensearchExporter.d.ts +43 -0
  227. package/lib/dist/lib/telemetry/opensearchExporter.d.ts.map +1 -0
  228. package/lib/dist/lib/telemetry/opensearchExporter.js +217 -0
  229. package/lib/dist/lib/telemetry/opensearchExporter.js.map +1 -0
  230. package/lib/dist/lib/telemetry/provider.d.ts +55 -0
  231. package/lib/dist/lib/telemetry/provider.d.ts.map +1 -0
  232. package/lib/dist/lib/telemetry/provider.js +140 -0
  233. package/lib/dist/lib/telemetry/provider.js.map +1 -0
  234. package/lib/dist/lib/testCaseLabels.d.ts +34 -0
  235. package/lib/dist/lib/testCaseLabels.d.ts.map +1 -0
  236. package/lib/dist/lib/testCaseLabels.js +88 -0
  237. package/lib/dist/lib/testCaseLabels.js.map +1 -0
  238. package/lib/dist/lib/testCaseValidation.d.ts +140 -0
  239. package/lib/dist/lib/testCaseValidation.d.ts.map +1 -0
  240. package/lib/dist/lib/testCaseValidation.js +162 -0
  241. package/lib/dist/lib/testCaseValidation.js.map +1 -0
  242. package/lib/dist/lib/testCases/agentFixture.d.ts +80 -0
  243. package/lib/dist/lib/testCases/agentFixture.d.ts.map +1 -0
  244. package/lib/dist/lib/testCases/agentFixture.js +43 -0
  245. package/lib/dist/lib/testCases/agentFixture.js.map +1 -0
  246. package/lib/dist/lib/testCases/authoringSurface.d.ts +10 -0
  247. package/lib/dist/lib/testCases/authoringSurface.d.ts.map +1 -0
  248. package/lib/dist/lib/testCases/authoringSurface.js +54 -0
  249. package/lib/dist/lib/testCases/authoringSurface.js.map +1 -0
  250. package/lib/dist/lib/testCases/codemod.d.ts +13 -0
  251. package/lib/dist/lib/testCases/codemod.d.ts.map +1 -0
  252. package/lib/dist/lib/testCases/codemod.js +169 -0
  253. package/lib/dist/lib/testCases/codemod.js.map +1 -0
  254. package/lib/dist/lib/testCases/define.d.ts +114 -0
  255. package/lib/dist/lib/testCases/define.d.ts.map +1 -0
  256. package/lib/dist/lib/testCases/define.js +253 -0
  257. package/lib/dist/lib/testCases/define.js.map +1 -0
  258. package/lib/dist/lib/testCases/evaluators.d.ts +80 -0
  259. package/lib/dist/lib/testCases/evaluators.d.ts.map +1 -0
  260. package/lib/dist/lib/testCases/evaluators.js +105 -0
  261. package/lib/dist/lib/testCases/evaluators.js.map +1 -0
  262. package/lib/dist/lib/testCases/index.d.ts +14 -0
  263. package/lib/dist/lib/testCases/index.d.ts.map +1 -0
  264. package/lib/dist/lib/testCases/index.js +12 -0
  265. package/lib/dist/lib/testCases/index.js.map +1 -0
  266. package/lib/dist/lib/testCases/judge.d.ts +165 -0
  267. package/lib/dist/lib/testCases/judge.d.ts.map +1 -0
  268. package/lib/dist/lib/testCases/judge.js +359 -0
  269. package/lib/dist/lib/testCases/judge.js.map +1 -0
  270. package/lib/dist/lib/testCases/loader.d.ts +36 -0
  271. package/lib/dist/lib/testCases/loader.d.ts.map +1 -0
  272. package/lib/dist/lib/testCases/loader.js +179 -0
  273. package/lib/dist/lib/testCases/loader.js.map +1 -0
  274. package/lib/dist/lib/testCases/types.d.ts +242 -0
  275. package/lib/dist/lib/testCases/types.d.ts.map +1 -0
  276. package/lib/dist/lib/testCases/types.js +6 -0
  277. package/lib/dist/lib/testCases/types.js.map +1 -0
  278. package/lib/dist/lib/theme.d.ts +6 -0
  279. package/lib/dist/lib/theme.d.ts.map +1 -0
  280. package/lib/dist/lib/theme.js +36 -0
  281. package/lib/dist/lib/theme.js.map +1 -0
  282. package/lib/dist/lib/uiTelemetry.d.ts +7 -0
  283. package/lib/dist/lib/uiTelemetry.d.ts.map +1 -0
  284. package/lib/dist/lib/uiTelemetry.js +25 -0
  285. package/lib/dist/lib/uiTelemetry.js.map +1 -0
  286. package/lib/dist/lib/utils.d.ts +111 -0
  287. package/lib/dist/lib/utils.d.ts.map +1 -0
  288. package/lib/dist/lib/utils.js +254 -0
  289. package/lib/dist/lib/utils.js.map +1 -0
  290. package/lib/dist/lib/workflow/consolidate.d.ts +12 -0
  291. package/lib/dist/lib/workflow/consolidate.d.ts.map +1 -0
  292. package/lib/dist/lib/workflow/consolidate.js +33 -0
  293. package/lib/dist/lib/workflow/consolidate.js.map +1 -0
  294. package/lib/dist/lib/workflow/index.d.ts +13 -0
  295. package/lib/dist/lib/workflow/index.d.ts.map +1 -0
  296. package/lib/dist/lib/workflow/index.js +12 -0
  297. package/lib/dist/lib/workflow/index.js.map +1 -0
  298. package/lib/dist/lib/workflow/ledger.d.ts +30 -0
  299. package/lib/dist/lib/workflow/ledger.d.ts.map +1 -0
  300. package/lib/dist/lib/workflow/ledger.js +41 -0
  301. package/lib/dist/lib/workflow/ledger.js.map +1 -0
  302. package/lib/dist/lib/workflow/pool.d.ts +13 -0
  303. package/lib/dist/lib/workflow/pool.d.ts.map +1 -0
  304. package/lib/dist/lib/workflow/pool.js +44 -0
  305. package/lib/dist/lib/workflow/pool.js.map +1 -0
  306. package/lib/dist/lib/workflow/source.d.ts +22 -0
  307. package/lib/dist/lib/workflow/source.d.ts.map +1 -0
  308. package/lib/dist/lib/workflow/source.js +29 -0
  309. package/lib/dist/lib/workflow/source.js.map +1 -0
  310. package/lib/dist/lib/workflow/stepB.d.ts +71 -0
  311. package/lib/dist/lib/workflow/stepB.d.ts.map +1 -0
  312. package/lib/dist/lib/workflow/stepB.js +99 -0
  313. package/lib/dist/lib/workflow/stepB.js.map +1 -0
  314. package/lib/dist/lib/workflow/types.d.ts +86 -0
  315. package/lib/dist/lib/workflow/types.d.ts.map +1 -0
  316. package/lib/dist/lib/workflow/types.js +6 -0
  317. package/lib/dist/lib/workflow/types.js.map +1 -0
  318. package/lib/dist/lib/workflow/workflow.d.ts +119 -0
  319. package/lib/dist/lib/workflow/workflow.d.ts.map +1 -0
  320. package/lib/dist/lib/workflow/workflow.js +195 -0
  321. package/lib/dist/lib/workflow/workflow.js.map +1 -0
  322. package/lib/dist/services/agent/aguiConverter.d.ts +50 -0
  323. package/lib/dist/services/agent/aguiConverter.d.ts.map +1 -0
  324. package/lib/dist/services/agent/aguiConverter.js +449 -0
  325. package/lib/dist/services/agent/aguiConverter.js.map +1 -0
  326. package/lib/dist/services/agent/index.d.ts +10 -0
  327. package/lib/dist/services/agent/index.d.ts.map +1 -0
  328. package/lib/dist/services/agent/index.js +12 -0
  329. package/lib/dist/services/agent/index.js.map +1 -0
  330. package/lib/dist/services/agent/payloadBuilder.d.ts +33 -0
  331. package/lib/dist/services/agent/payloadBuilder.d.ts.map +1 -0
  332. package/lib/dist/services/agent/payloadBuilder.js +75 -0
  333. package/lib/dist/services/agent/payloadBuilder.js.map +1 -0
  334. package/lib/dist/services/agent/sseStream.d.ts +43 -0
  335. package/lib/dist/services/agent/sseStream.d.ts.map +1 -0
  336. package/lib/dist/services/agent/sseStream.js +223 -0
  337. package/lib/dist/services/agent/sseStream.js.map +1 -0
  338. package/lib/dist/services/connectors/agui/AGUIStreamingConnector.d.ts +44 -0
  339. package/lib/dist/services/connectors/agui/AGUIStreamingConnector.d.ts.map +1 -0
  340. package/lib/dist/services/connectors/agui/AGUIStreamingConnector.js +95 -0
  341. package/lib/dist/services/connectors/agui/AGUIStreamingConnector.js.map +1 -0
  342. package/lib/dist/services/connectors/base/BaseConnector.d.ts +81 -0
  343. package/lib/dist/services/connectors/base/BaseConnector.d.ts.map +1 -0
  344. package/lib/dist/services/connectors/base/BaseConnector.js +170 -0
  345. package/lib/dist/services/connectors/base/BaseConnector.js.map +1 -0
  346. package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.d.ts +126 -0
  347. package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.d.ts.map +1 -0
  348. package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.js +417 -0
  349. package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.js.map +1 -0
  350. package/lib/dist/services/connectors/index.d.ts +13 -0
  351. package/lib/dist/services/connectors/index.d.ts.map +1 -0
  352. package/lib/dist/services/connectors/index.js +32 -0
  353. package/lib/dist/services/connectors/index.js.map +1 -0
  354. package/lib/dist/services/connectors/kiro/KiroConnector.d.ts +48 -0
  355. package/lib/dist/services/connectors/kiro/KiroConnector.d.ts.map +1 -0
  356. package/lib/dist/services/connectors/kiro/KiroConnector.js +158 -0
  357. package/lib/dist/services/connectors/kiro/KiroConnector.js.map +1 -0
  358. package/lib/dist/services/connectors/langgraph/LangGraphConnector.d.ts +36 -0
  359. package/lib/dist/services/connectors/langgraph/LangGraphConnector.d.ts.map +1 -0
  360. package/lib/dist/services/connectors/langgraph/LangGraphConnector.js +175 -0
  361. package/lib/dist/services/connectors/langgraph/LangGraphConnector.js.map +1 -0
  362. package/lib/dist/services/connectors/mock/MockConnector.d.ts +37 -0
  363. package/lib/dist/services/connectors/mock/MockConnector.d.ts.map +1 -0
  364. package/lib/dist/services/connectors/mock/MockConnector.js +120 -0
  365. package/lib/dist/services/connectors/mock/MockConnector.js.map +1 -0
  366. package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.d.ts +42 -0
  367. package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.d.ts.map +1 -0
  368. package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.js +133 -0
  369. package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.js.map +1 -0
  370. package/lib/dist/services/connectors/pi/PiConnector.d.ts +87 -0
  371. package/lib/dist/services/connectors/pi/PiConnector.d.ts.map +1 -0
  372. package/lib/dist/services/connectors/pi/PiConnector.js +274 -0
  373. package/lib/dist/services/connectors/pi/PiConnector.js.map +1 -0
  374. package/lib/dist/services/connectors/registry.d.ts +57 -0
  375. package/lib/dist/services/connectors/registry.d.ts.map +1 -0
  376. package/lib/dist/services/connectors/registry.js +106 -0
  377. package/lib/dist/services/connectors/registry.js.map +1 -0
  378. package/lib/dist/services/connectors/rest/RESTConnector.d.ts +38 -0
  379. package/lib/dist/services/connectors/rest/RESTConnector.d.ts.map +1 -0
  380. package/lib/dist/services/connectors/rest/RESTConnector.js +117 -0
  381. package/lib/dist/services/connectors/rest/RESTConnector.js.map +1 -0
  382. package/lib/dist/services/connectors/server.d.ts +13 -0
  383. package/lib/dist/services/connectors/server.d.ts.map +1 -0
  384. package/lib/dist/services/connectors/server.js +34 -0
  385. package/lib/dist/services/connectors/server.js.map +1 -0
  386. package/lib/dist/services/connectors/strands/StrandsConnector.d.ts +48 -0
  387. package/lib/dist/services/connectors/strands/StrandsConnector.d.ts.map +1 -0
  388. package/lib/dist/services/connectors/strands/StrandsConnector.js +221 -0
  389. package/lib/dist/services/connectors/strands/StrandsConnector.js.map +1 -0
  390. package/lib/dist/services/connectors/subprocess/SubprocessConnector.d.ts +88 -0
  391. package/lib/dist/services/connectors/subprocess/SubprocessConnector.d.ts.map +1 -0
  392. package/lib/dist/services/connectors/subprocess/SubprocessConnector.js +426 -0
  393. package/lib/dist/services/connectors/subprocess/SubprocessConnector.js.map +1 -0
  394. package/lib/dist/services/connectors/types.d.ts +213 -0
  395. package/lib/dist/services/connectors/types.d.ts.map +1 -0
  396. package/lib/dist/services/connectors/types.js +6 -0
  397. package/lib/dist/services/connectors/types.js.map +1 -0
  398. package/lib/dist/services/evaluation/bedrockJudge.d.ts +71 -0
  399. package/lib/dist/services/evaluation/bedrockJudge.d.ts.map +1 -0
  400. package/lib/dist/services/evaluation/bedrockJudge.js +169 -0
  401. package/lib/dist/services/evaluation/bedrockJudge.js.map +1 -0
  402. package/lib/dist/services/evaluation/evaluatorError.d.ts +56 -0
  403. package/lib/dist/services/evaluation/evaluatorError.d.ts.map +1 -0
  404. package/lib/dist/services/evaluation/evaluatorError.js +56 -0
  405. package/lib/dist/services/evaluation/evaluatorError.js.map +1 -0
  406. package/lib/dist/services/evaluation/index.d.ts +106 -0
  407. package/lib/dist/services/evaluation/index.d.ts.map +1 -0
  408. package/lib/dist/services/evaluation/index.js +684 -0
  409. package/lib/dist/services/evaluation/index.js.map +1 -0
  410. package/lib/dist/services/evaluation/mockTrajectory.d.ts +3 -0
  411. package/lib/dist/services/evaluation/mockTrajectory.d.ts.map +1 -0
  412. package/lib/dist/services/evaluation/mockTrajectory.js +72 -0
  413. package/lib/dist/services/evaluation/mockTrajectory.js.map +1 -0
  414. package/lib/dist/services/opensearch/client.d.ts +26 -0
  415. package/lib/dist/services/opensearch/client.d.ts.map +1 -0
  416. package/lib/dist/services/opensearch/client.js +131 -0
  417. package/lib/dist/services/opensearch/client.js.map +1 -0
  418. package/lib/dist/services/opensearch/index.d.ts +16 -0
  419. package/lib/dist/services/opensearch/index.d.ts.map +1 -0
  420. package/lib/dist/services/opensearch/index.js +25 -0
  421. package/lib/dist/services/opensearch/index.js.map +1 -0
  422. package/lib/dist/services/storage/asyncBenchmarkStorage.d.ts +123 -0
  423. package/lib/dist/services/storage/asyncBenchmarkStorage.d.ts.map +1 -0
  424. package/lib/dist/services/storage/asyncBenchmarkStorage.js +440 -0
  425. package/lib/dist/services/storage/asyncBenchmarkStorage.js.map +1 -0
  426. package/lib/dist/services/storage/asyncRunStorage.d.ts +135 -0
  427. package/lib/dist/services/storage/asyncRunStorage.d.ts.map +1 -0
  428. package/lib/dist/services/storage/asyncRunStorage.js +524 -0
  429. package/lib/dist/services/storage/asyncRunStorage.js.map +1 -0
  430. package/lib/dist/services/storage/asyncTestCaseStorage.d.ts +170 -0
  431. package/lib/dist/services/storage/asyncTestCaseStorage.d.ts.map +1 -0
  432. package/lib/dist/services/storage/asyncTestCaseStorage.js +301 -0
  433. package/lib/dist/services/storage/asyncTestCaseStorage.js.map +1 -0
  434. package/lib/dist/services/storage/index.d.ts +17 -0
  435. package/lib/dist/services/storage/index.d.ts.map +1 -0
  436. package/lib/dist/services/storage/index.js +20 -0
  437. package/lib/dist/services/storage/index.js.map +1 -0
  438. package/lib/dist/services/storage/migration.d.ts +54 -0
  439. package/lib/dist/services/storage/migration.d.ts.map +1 -0
  440. package/lib/dist/services/storage/migration.js +296 -0
  441. package/lib/dist/services/storage/migration.js.map +1 -0
  442. package/lib/dist/services/storage/opensearchClient.d.ts +947 -0
  443. package/lib/dist/services/storage/opensearchClient.d.ts.map +1 -0
  444. package/lib/dist/services/storage/opensearchClient.js +442 -0
  445. package/lib/dist/services/storage/opensearchClient.js.map +1 -0
  446. package/lib/dist/services/traces/browserRecovery.d.ts +37 -0
  447. package/lib/dist/services/traces/browserRecovery.d.ts.map +1 -0
  448. package/lib/dist/services/traces/browserRecovery.js +108 -0
  449. package/lib/dist/services/traces/browserRecovery.js.map +1 -0
  450. package/lib/dist/services/traces/categoryStyles.d.ts +21 -0
  451. package/lib/dist/services/traces/categoryStyles.d.ts.map +1 -0
  452. package/lib/dist/services/traces/categoryStyles.js +56 -0
  453. package/lib/dist/services/traces/categoryStyles.js.map +1 -0
  454. package/lib/dist/services/traces/executionOrderTransform.d.ts +35 -0
  455. package/lib/dist/services/traces/executionOrderTransform.d.ts.map +1 -0
  456. package/lib/dist/services/traces/executionOrderTransform.js +313 -0
  457. package/lib/dist/services/traces/executionOrderTransform.js.map +1 -0
  458. package/lib/dist/services/traces/fetchSpansForRun.d.ts +86 -0
  459. package/lib/dist/services/traces/fetchSpansForRun.d.ts.map +1 -0
  460. package/lib/dist/services/traces/fetchSpansForRun.js +69 -0
  461. package/lib/dist/services/traces/fetchSpansForRun.js.map +1 -0
  462. package/lib/dist/services/traces/flowTransform.d.ts +24 -0
  463. package/lib/dist/services/traces/flowTransform.d.ts.map +1 -0
  464. package/lib/dist/services/traces/flowTransform.js +228 -0
  465. package/lib/dist/services/traces/flowTransform.js.map +1 -0
  466. package/lib/dist/services/traces/index.d.ts +121 -0
  467. package/lib/dist/services/traces/index.d.ts.map +1 -0
  468. package/lib/dist/services/traces/index.js +255 -0
  469. package/lib/dist/services/traces/index.js.map +1 -0
  470. package/lib/dist/services/traces/intentTransform.d.ts +20 -0
  471. package/lib/dist/services/traces/intentTransform.d.ts.map +1 -0
  472. package/lib/dist/services/traces/intentTransform.js +131 -0
  473. package/lib/dist/services/traces/intentTransform.js.map +1 -0
  474. package/lib/dist/services/traces/judgeAgentsHints.d.ts +63 -0
  475. package/lib/dist/services/traces/judgeAgentsHints.d.ts.map +1 -0
  476. package/lib/dist/services/traces/judgeAgentsHints.js +89 -0
  477. package/lib/dist/services/traces/judgeAgentsHints.js.map +1 -0
  478. package/lib/dist/services/traces/messageExtraction.d.ts +15 -0
  479. package/lib/dist/services/traces/messageExtraction.d.ts.map +1 -0
  480. package/lib/dist/services/traces/messageExtraction.js +313 -0
  481. package/lib/dist/services/traces/messageExtraction.js.map +1 -0
  482. package/lib/dist/services/traces/spanCategorization.d.ts +63 -0
  483. package/lib/dist/services/traces/spanCategorization.d.ts.map +1 -0
  484. package/lib/dist/services/traces/spanCategorization.js +276 -0
  485. package/lib/dist/services/traces/spanCategorization.js.map +1 -0
  486. package/lib/dist/services/traces/spanPreprocessing.d.ts +37 -0
  487. package/lib/dist/services/traces/spanPreprocessing.d.ts.map +1 -0
  488. package/lib/dist/services/traces/spanPreprocessing.js +102 -0
  489. package/lib/dist/services/traces/spanPreprocessing.js.map +1 -0
  490. package/lib/dist/services/traces/spansToTrajectory.d.ts +36 -0
  491. package/lib/dist/services/traces/spansToTrajectory.d.ts.map +1 -0
  492. package/lib/dist/services/traces/spansToTrajectory.js +425 -0
  493. package/lib/dist/services/traces/spansToTrajectory.js.map +1 -0
  494. package/lib/dist/services/traces/toolSimilarity.d.ts +35 -0
  495. package/lib/dist/services/traces/toolSimilarity.d.ts.map +1 -0
  496. package/lib/dist/services/traces/toolSimilarity.js +203 -0
  497. package/lib/dist/services/traces/toolSimilarity.js.map +1 -0
  498. package/lib/dist/services/traces/traceComparison.d.ts +31 -0
  499. package/lib/dist/services/traces/traceComparison.d.ts.map +1 -0
  500. package/lib/dist/services/traces/traceComparison.js +318 -0
  501. package/lib/dist/services/traces/traceComparison.js.map +1 -0
  502. package/lib/dist/services/traces/traceGrouping.d.ts +19 -0
  503. package/lib/dist/services/traces/traceGrouping.d.ts.map +1 -0
  504. package/lib/dist/services/traces/traceGrouping.js +107 -0
  505. package/lib/dist/services/traces/traceGrouping.js.map +1 -0
  506. package/lib/dist/services/traces/tracePoller.d.ts +108 -0
  507. package/lib/dist/services/traces/tracePoller.d.ts.map +1 -0
  508. package/lib/dist/services/traces/tracePoller.js +475 -0
  509. package/lib/dist/services/traces/tracePoller.js.map +1 -0
  510. package/lib/dist/services/traces/traceStats.d.ts +45 -0
  511. package/lib/dist/services/traces/traceStats.d.ts.map +1 -0
  512. package/lib/dist/services/traces/traceStats.js +114 -0
  513. package/lib/dist/services/traces/traceStats.js.map +1 -0
  514. package/lib/dist/services/traces/traceSummary.d.ts +47 -0
  515. package/lib/dist/services/traces/traceSummary.d.ts.map +1 -0
  516. package/lib/dist/services/traces/traceSummary.js +68 -0
  517. package/lib/dist/services/traces/traceSummary.js.map +1 -0
  518. package/lib/dist/services/traces/utils.d.ts +33 -0
  519. package/lib/dist/services/traces/utils.d.ts.map +1 -0
  520. package/lib/dist/services/traces/utils.js +114 -0
  521. package/lib/dist/services/traces/utils.js.map +1 -0
  522. package/lib/dist/types/agui.d.ts +13 -0
  523. package/lib/dist/types/agui.d.ts.map +1 -0
  524. package/lib/dist/types/agui.js +16 -0
  525. package/lib/dist/types/agui.js.map +1 -0
  526. package/lib/dist/types/index.d.ts +1229 -0
  527. package/lib/dist/types/index.d.ts.map +1 -0
  528. package/lib/dist/types/index.js +12 -0
  529. package/lib/dist/types/index.js.map +1 -0
  530. package/lib/dist/types/skills.d.ts +146 -0
  531. package/lib/dist/types/skills.d.ts.map +1 -0
  532. package/lib/dist/types/skills.js +6 -0
  533. package/lib/dist/types/skills.js.map +1 -0
  534. package/observio-sample-agent/pi-package/README.md +112 -0
  535. package/observio-sample-agent/pi-package/extensions/agent-health.ts +373 -0
  536. package/observio-sample-agent/pi-package/package.json +17 -0
  537. package/observio-sample-agent/pi-package/prompts/agent-health.md +37 -0
  538. package/observio-sample-agent/pi-package/skills/create-pr/SKILL.md +88 -0
  539. package/observio-sample-agent/pi-package/skills/fix-bug/SKILL.md +71 -0
  540. package/observio-sample-agent/pi-package/skills/implement-feature/SKILL.md +156 -0
  541. package/observio-sample-agent/pi-package/skills/instrument-otel/SKILL.md +208 -0
  542. package/observio-sample-agent/pi-package/skills/setup-collector/SKILL.md +146 -0
  543. package/observio-sample-agent/pi-package/skills/write-test/SKILL.md +115 -0
  544. package/package.json +45 -9
  545. package/server/dist/app.js +34031 -18731
  546. package/server/dist/index.js +30737 -15338
  547. package/tsconfig.lib.json +71 -0
  548. package/dist/assets/index-BOIP5L7h.js +0 -246
  549. package/dist/assets/index-CU9YKpAL.css +0 -1
  550. package/lib/dist/config/index.js +0 -452
  551. package/lib/dist/index.js +0 -1725
@@ -0,0 +1,37 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright OpenSearch Contributors
3
+ /**
4
+ * Resolve the LLM an agent runs on.
5
+ *
6
+ * The agent's model is owned by the agent's OWN config (`agent-health.config.ts`),
7
+ * NOT a user-facing "agent model" selector. There is intentionally no run-level
8
+ * or UI/CLI way to override it — picking a model separately from the agent is a
9
+ * leaky abstraction (subprocess agents like Claude Code / pi ignore it and run
10
+ * on whatever their connector is configured with). Claude-like agents that DO
11
+ * accept a model take it via their connector config.
12
+ *
13
+ * Resolution order (all from the agent's `connectorConfig`):
14
+ * 1. `connectorConfig.model` — pi / streaming / openai-compatible
15
+ * 2. `connectorConfig.env.ANTHROPIC_MODEL` — claude-code
16
+ * 3. `connectorConfig.args` `--model <id>` — any subprocess agent passing a flag
17
+ *
18
+ * `fallback` exists only for backward compatibility with runs/agents created
19
+ * before the agent-model concept was removed (where the run carried a
20
+ * user-selected `modelId`). New code should not rely on it.
21
+ */
22
+ export function resolveAgentModel(agent, fallback) {
23
+ const cc = (agent?.connectorConfig || {});
24
+ if (typeof cc.model === 'string' && cc.model)
25
+ return cc.model;
26
+ const envModel = cc.env?.ANTHROPIC_MODEL;
27
+ if (typeof envModel === 'string' && envModel)
28
+ return envModel;
29
+ const args = cc.args;
30
+ if (Array.isArray(args)) {
31
+ const i = args.indexOf('--model');
32
+ if (i >= 0 && typeof args[i + 1] === 'string' && args[i + 1])
33
+ return args[i + 1];
34
+ }
35
+ return fallback || '';
36
+ }
37
+ //# sourceMappingURL=resolveAgentModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveAgentModel.js","sourceRoot":"","sources":["../../resolveAgentModel.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,oCAAoC;AAIpC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAqC,EACrC,QAAiB;IAEjB,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,eAAe,IAAI,EAAE,CAAwB,CAAC;IACjE,IAAI,OAAO,EAAE,CAAC,KAAK,KAAK,QAAQ,IAAI,EAAE,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC,KAAK,CAAC;IAC9D,MAAM,QAAQ,GAAG,EAAE,CAAC,GAAG,EAAE,eAAe,CAAC;IACzC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9D,MAAM,IAAI,GAAY,EAAE,CAAC,IAAI,CAAC;IAC9B,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,CAAW,CAAC;IAC7F,CAAC;IACD,OAAO,QAAQ,IAAI,EAAE,CAAC;AACxB,CAAC"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Shared Run Statistics Calculation
3
+ *
4
+ * This module provides shared logic for calculating benchmark run statistics.
5
+ * Both UI and CLI use these functions to ensure consistent pass/fail counting.
6
+ *
7
+ * The canonical approach is:
8
+ * 1. Get report IDs from run.results[testCaseId].reportId
9
+ * 2. Fetch each report by ID
10
+ * 3. Count passFailStatus from the fetched reports
11
+ *
12
+ * For performance optimization, stats are denormalized onto BenchmarkRun.stats
13
+ * and updated incrementally as test cases complete.
14
+ */
15
+ import type { BenchmarkRun, EvaluationReport, RunStats as RunStatsType } from '../types/index.js';
16
+ /**
17
+ * Statistics for a benchmark run
18
+ */
19
+ export interface RunStats {
20
+ /** Number of test cases that passed (passFailStatus === 'passed') */
21
+ passed: number;
22
+ /** Number of test cases that failed (passFailStatus === 'failed' or execution failed) */
23
+ failed: number;
24
+ /** Number of test cases still pending (running, or report not yet available) */
25
+ pending: number;
26
+ /**
27
+ * Number of test cases where the *evaluator* could not produce a verdict
28
+ * (judge validation error, trace timeout, etc.). Excluded from passed and
29
+ * failed counts so a misconfigured evaluator doesn't poison aggregate
30
+ * pass rates. Issue #242.
31
+ */
32
+ errored: number;
33
+ /** Total number of test cases in the run */
34
+ total: number;
35
+ /**
36
+ * Pass rate as a percentage (0-100). Computed over `total - errored`
37
+ * (the *evaluable* set), not over `total`, so a non-retryable judge
38
+ * failure can't masquerade as the agent scoring 0%.
39
+ */
40
+ passRate: number;
41
+ }
42
+ /**
43
+ * Bucket a run's per-test-case results into passed/failed/errored/pending using
44
+ * ONLY the persisted result fields (status + passFailStatus) — no reports
45
+ * needed. This is the SINGLE source of truth for pass/fail/errored counts across
46
+ * the app (the runs list AND the comparison page), so the numbers can't
47
+ * diverge between views.
48
+ *
49
+ * The denormalized `run.stats` is NOT authoritative: its writer historically
50
+ * counted every 'completed' result as passed without checking the verdict, so
51
+ * an errored case (judge produced no verdict) was miscounted as a pass and
52
+ * `errored` was never tracked. Recompute from results instead.
53
+ *
54
+ * Errored (#242): a 'completed' result with no 'passed'/'failed' verdict means
55
+ * the evaluator couldn't produce one (judge validation error, trace timeout).
56
+ * Excluded from passed/failed — exactly as calculateRunStats does via the
57
+ * report's metricsStatus.
58
+ */
59
+ export declare function bucketRunResults(results: Record<string, {
60
+ status?: string;
61
+ passFailStatus?: string;
62
+ }> | undefined): Pick<RunStats, 'passed' | 'failed' | 'errored' | 'pending' | 'total'>;
63
+ /**
64
+ * Calculate statistics for a benchmark run.
65
+ *
66
+ * This function uses the same logic as the UI to count pass/fail status:
67
+ * - Iterates over run.results to get reportIds
68
+ * - Looks up each report in the provided reports map
69
+ * - Counts passFailStatus from completed reports
70
+ *
71
+ * @param run - The benchmark run to calculate stats for
72
+ * @param reports - Map of reportId -> EvaluationReport (pre-fetched)
73
+ * @returns Calculated statistics including passed, failed, pending, total, and passRate
74
+ */
75
+ export declare function calculateRunStats(run: BenchmarkRun, reports: Record<string, EvaluationReport | null>): RunStats;
76
+ /**
77
+ * Extract all report IDs from a run's results that need to be fetched.
78
+ *
79
+ * @param run - The benchmark run to extract report IDs from
80
+ * @returns Array of unique report IDs
81
+ */
82
+ export declare function getReportIdsFromRun(run: BenchmarkRun): string[];
83
+ /**
84
+ * Compute stats from a benchmark run and its reports.
85
+ * This is the server-side version that returns the denormalized stats object.
86
+ *
87
+ * @param run - The benchmark run to compute stats for
88
+ * @param reports - Array of reports for this run
89
+ * @returns Denormalized stats object (passed, failed, pending, total)
90
+ */
91
+ /**
92
+ * Canonical "display" stats for a run detail/list view: prefer recomputing
93
+ * from the persisted per-test-case verdicts (`run.results`) via
94
+ * {@link bucketRunResults} — the single source of truth — and only fall
95
+ * back to the denormalized `run.stats` when `results` is empty (e.g. a run
96
+ * that hasn't started, or legacy data with no results map at all).
97
+ *
98
+ * This is THE single shared helper for pass/fail/errored/pending/total
99
+ * across every surface that renders run stats (runs list, benchmark runs
100
+ * list, run detail page, comparison page) — do not reimplement this logic
101
+ * locally in a component or add a differently-named twin. Historically this
102
+ * logic was duplicated per-page (each with its own subtly different bugs,
103
+ * e.g. `errored` not tracked, or `run.stats` trusted directly even when
104
+ * stale/inflated for trace-judged runs — a 66/84-real-passed run displaying
105
+ * as 84/84). Callers that only need `{passed, failed, errored, total}` can
106
+ * simply ignore the extra `pending` field.
107
+ */
108
+ export declare function computeRunStats(run: {
109
+ results?: Record<string, {
110
+ status?: string;
111
+ passFailStatus?: string;
112
+ }>;
113
+ stats?: Partial<RunStatsType> | null;
114
+ }): Pick<RunStatsType, 'passed' | 'failed' | 'errored' | 'pending' | 'total'>;
115
+ export declare function computeRunStatsFromReports(run: BenchmarkRun, reports: EvaluationReport[]): RunStatsType;
116
+ //# sourceMappingURL=runStats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runStats.d.ts","sourceRoot":"","sources":["../../runStats.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEjG;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IAC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AAE,GAC1B,YAAY,CAed"}
@@ -0,0 +1,192 @@
1
+ /*
2
+ * Copyright OpenSearch Contributors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * Bucket a run's per-test-case results into passed/failed/errored/pending using
7
+ * ONLY the persisted result fields (status + passFailStatus) — no reports
8
+ * needed. This is the SINGLE source of truth for pass/fail/errored counts across
9
+ * the app (the runs list AND the comparison page), so the numbers can't
10
+ * diverge between views.
11
+ *
12
+ * The denormalized `run.stats` is NOT authoritative: its writer historically
13
+ * counted every 'completed' result as passed without checking the verdict, so
14
+ * an errored case (judge produced no verdict) was miscounted as a pass and
15
+ * `errored` was never tracked. Recompute from results instead.
16
+ *
17
+ * Errored (#242): a 'completed' result with no 'passed'/'failed' verdict means
18
+ * the evaluator couldn't produce one (judge validation error, trace timeout).
19
+ * Excluded from passed/failed — exactly as calculateRunStats does via the
20
+ * report's metricsStatus.
21
+ */
22
+ export function bucketRunResults(results) {
23
+ let passed = 0, failed = 0, errored = 0, pending = 0, total = 0;
24
+ for (const r of Object.values(results || {})) {
25
+ total++;
26
+ if (r.status === 'pending' || r.status === 'running') {
27
+ pending++;
28
+ continue;
29
+ }
30
+ if (r.status === 'failed' || r.status === 'cancelled') {
31
+ failed++;
32
+ continue;
33
+ }
34
+ if (r.status === 'completed') {
35
+ if (r.passFailStatus === 'passed')
36
+ passed++;
37
+ else if (r.passFailStatus === 'failed')
38
+ failed++;
39
+ else
40
+ errored++; // completed without a verdict = judge errored (#242)
41
+ continue;
42
+ }
43
+ pending++; // unknown / no status
44
+ }
45
+ return { passed, failed, errored, pending, total };
46
+ }
47
+ /**
48
+ * Calculate statistics for a benchmark run.
49
+ *
50
+ * This function uses the same logic as the UI to count pass/fail status:
51
+ * - Iterates over run.results to get reportIds
52
+ * - Looks up each report in the provided reports map
53
+ * - Counts passFailStatus from completed reports
54
+ *
55
+ * @param run - The benchmark run to calculate stats for
56
+ * @param reports - Map of reportId -> EvaluationReport (pre-fetched)
57
+ * @returns Calculated statistics including passed, failed, pending, total, and passRate
58
+ */
59
+ export function calculateRunStats(run, reports) {
60
+ let passed = 0;
61
+ let failed = 0;
62
+ let pending = 0;
63
+ let errored = 0;
64
+ let total = 0;
65
+ Object.entries(run.results || {}).forEach(([testCaseId, result]) => {
66
+ total++;
67
+ // Check result status first
68
+ if (result.status === 'pending' || result.status === 'running') {
69
+ pending++;
70
+ return;
71
+ }
72
+ if (result.status === 'failed' || result.status === 'cancelled') {
73
+ failed++;
74
+ return;
75
+ }
76
+ // For completed results, check the report's passFailStatus
77
+ if (result.status === 'completed' && result.reportId) {
78
+ const report = reports[result.reportId];
79
+ if (!report) {
80
+ // Report not loaded yet or doesn't exist
81
+ pending++;
82
+ return;
83
+ }
84
+ // Check if evaluation is still pending (trace mode)
85
+ if (report.metricsStatus === 'pending' || report.metricsStatus === 'calculating') {
86
+ pending++;
87
+ return;
88
+ }
89
+ // Issue #242: evaluator could not produce a verdict (judge validation
90
+ // error, trace timeout, etc.). Excluded from passed/failed so
91
+ // misconfigured evaluators don't masquerade as agent failures.
92
+ if (report.metricsStatus === 'error') {
93
+ errored++;
94
+ return;
95
+ }
96
+ // Count based on passFailStatus from LLM judge
97
+ if (report.passFailStatus === 'passed') {
98
+ passed++;
99
+ }
100
+ else {
101
+ // passFailStatus === 'failed' or undefined (treat as failed)
102
+ failed++;
103
+ }
104
+ }
105
+ else {
106
+ // No reportId but status is completed - treat as pending
107
+ pending++;
108
+ }
109
+ });
110
+ // Pass rate is computed over the evaluable set (total minus errored).
111
+ // If every run errored, expose 0% rather than dividing by zero.
112
+ const evaluable = Math.max(0, total - errored);
113
+ const passRate = evaluable > 0 ? Math.round((passed / evaluable) * 100) : 0;
114
+ return {
115
+ passed,
116
+ failed,
117
+ pending,
118
+ errored,
119
+ total,
120
+ passRate,
121
+ };
122
+ }
123
+ /**
124
+ * Extract all report IDs from a run's results that need to be fetched.
125
+ *
126
+ * @param run - The benchmark run to extract report IDs from
127
+ * @returns Array of unique report IDs
128
+ */
129
+ export function getReportIdsFromRun(run) {
130
+ const reportIds = new Set();
131
+ Object.values(run.results || {}).forEach((result) => {
132
+ if (result.reportId) {
133
+ reportIds.add(result.reportId);
134
+ }
135
+ });
136
+ return Array.from(reportIds);
137
+ }
138
+ /**
139
+ * Compute stats from a benchmark run and its reports.
140
+ * This is the server-side version that returns the denormalized stats object.
141
+ *
142
+ * @param run - The benchmark run to compute stats for
143
+ * @param reports - Array of reports for this run
144
+ * @returns Denormalized stats object (passed, failed, pending, total)
145
+ */
146
+ /**
147
+ * Canonical "display" stats for a run detail/list view: prefer recomputing
148
+ * from the persisted per-test-case verdicts (`run.results`) via
149
+ * {@link bucketRunResults} — the single source of truth — and only fall
150
+ * back to the denormalized `run.stats` when `results` is empty (e.g. a run
151
+ * that hasn't started, or legacy data with no results map at all).
152
+ *
153
+ * This is THE single shared helper for pass/fail/errored/pending/total
154
+ * across every surface that renders run stats (runs list, benchmark runs
155
+ * list, run detail page, comparison page) — do not reimplement this logic
156
+ * locally in a component or add a differently-named twin. Historically this
157
+ * logic was duplicated per-page (each with its own subtly different bugs,
158
+ * e.g. `errored` not tracked, or `run.stats` trusted directly even when
159
+ * stale/inflated for trace-judged runs — a 66/84-real-passed run displaying
160
+ * as 84/84). Callers that only need `{passed, failed, errored, total}` can
161
+ * simply ignore the extra `pending` field.
162
+ */
163
+ export function computeRunStats(run) {
164
+ if (run.results && Object.keys(run.results).length > 0) {
165
+ return bucketRunResults(run.results);
166
+ }
167
+ if (run.stats && (run.stats.total ?? 0) > 0) {
168
+ return {
169
+ passed: run.stats.passed ?? 0,
170
+ failed: run.stats.failed ?? 0,
171
+ errored: run.stats.errored ?? 0,
172
+ pending: run.stats.pending ?? 0,
173
+ total: run.stats.total ?? 0,
174
+ };
175
+ }
176
+ return { passed: 0, failed: 0, errored: 0, pending: 0, total: 0 };
177
+ }
178
+ export function computeRunStatsFromReports(run, reports) {
179
+ const reportsMap = {};
180
+ reports.forEach(report => {
181
+ reportsMap[report.id] = report;
182
+ });
183
+ const fullStats = calculateRunStats(run, reportsMap);
184
+ return {
185
+ passed: fullStats.passed,
186
+ failed: fullStats.failed,
187
+ pending: fullStats.pending,
188
+ errored: fullStats.errored,
189
+ total: fullStats.total,
190
+ };
191
+ }
192
+ //# sourceMappingURL=runStats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runStats.js","sourceRoot":"","sources":["../../runStats.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8CH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAiF;IAEjF,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;IAChE,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC;QAC7C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAAC,OAAO,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QAC9E,IAAI,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;YAAC,MAAM,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QAC9E,IAAI,CAAC,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;YAC7B,IAAI,CAAC,CAAC,cAAc,KAAK,QAAQ;gBAAE,MAAM,EAAE,CAAC;iBACvC,IAAI,CAAC,CAAC,cAAc,KAAK,QAAQ;gBAAE,MAAM,EAAE,CAAC;;gBAC5C,OAAO,EAAE,CAAC,CAAC,qDAAqD;YACrE,SAAS;QACX,CAAC;QACD,OAAO,EAAE,CAAC,CAAC,sBAAsB;IACnC,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,M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OAAO,EAAE,SAAS,CAAC,OAAO;QAC1B,KAAK,EAAE,SAAS,CAAC,KAAK;KACvB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * OTel Semantic Convention constants for evaluation telemetry.
3
+ *
4
+ * In-spec attributes are re-exported from @opentelemetry/semantic-conventions.
5
+ * Proposed and extension attributes are defined here as string constants.
6
+ */
7
+ export { ATTR_TEST_SUITE_NAME, ATTR_TEST_SUITE_RUN_STATUS, ATTR_TEST_CASE_NAME, ATTR_TEST_CASE_RESULT_STATUS, TEST_SUITE_RUN_STATUS_VALUE_SUCCESS, TEST_SUITE_RUN_STATUS_VALUE_FAILURE, TEST_SUITE_RUN_STATUS_VALUE_IN_PROGRESS, TEST_CASE_RESULT_STATUS_VALUE_PASS, TEST_CASE_RESULT_STATUS_VALUE_FAIL, ATTR_GEN_AI_OPERATION_NAME, ATTR_GEN_AI_EVALUATION_NAME, ATTR_GEN_AI_EVALUATION_SCORE_VALUE, ATTR_GEN_AI_EVALUATION_SCORE_LABEL, ATTR_GEN_AI_EVALUATION_EXPLANATION, EVENT_GEN_AI_EVALUATION_RESULT, } from '@opentelemetry/semantic-conventions/incubating';
8
+ /** Unique identifier for a specific test suite run */
9
+ export declare const ATTR_TEST_SUITE_RUN_ID: "test.suite.run.id";
10
+ /** Machine-readable unique identifier for a test case */
11
+ export declare const ATTR_TEST_CASE_ID: "test.case.id";
12
+ /** Test case input (prompt) */
13
+ export declare const ATTR_TEST_CASE_INPUT: "test.case.input";
14
+ /** Test case output (agent response) */
15
+ export declare const ATTR_TEST_CASE_OUTPUT: "test.case.output";
16
+ /** Test case expected outcome */
17
+ export declare const ATTR_TEST_CASE_EXPECTED: "test.case.expected";
18
+ /** Model ID used by the LLM judge */
19
+ export declare const ATTR_AGENT_HEALTH_JUDGE_MODEL_ID: "agent_health.judge.model_id";
20
+ /** Time spent in LLM judge evaluation (ms) */
21
+ export declare const ATTR_AGENT_HEALTH_JUDGE_DURATION_MS: "agent_health.judge.duration_ms";
22
+ /** Number of retry attempts for the LLM judge */
23
+ export declare const ATTR_AGENT_HEALTH_JUDGE_ATTEMPTS: "agent_health.judge.attempts";
24
+ /** Time spent in agent execution (ms) */
25
+ export declare const ATTR_AGENT_HEALTH_AGENT_DURATION_MS: "agent_health.agent.duration_ms";
26
+ /** Connector protocol used for agent communication */
27
+ export declare const ATTR_AGENT_HEALTH_CONNECTOR_PROTOCOL: "agent_health.connector.protocol";
28
+ /**
29
+ * Agent run ID — links eval spans to the agent execution trace (Strategy B).
30
+ *
31
+ * Uses Agent Health's own namespace rather than the OpenTelemetry-reserved
32
+ * `gen_ai.*` namespace: `gen_ai.request.id` is not a registered semantic
33
+ * convention attribute (the `gen_ai.request.*` namespace is for request
34
+ * parameters), and the OTEL naming spec advises against adding app-specific
35
+ * keys under an existing OTEL namespace. W3C trace context (shared traceId,
36
+ * Strategy A) remains the primary correlation; this attribute is the loose
37
+ * link for agents that don't propagate context.
38
+ */
39
+ export declare const ATTR_AGENT_HEALTH_AGENT_RUN_ID: "agent_health.run.id";
40
+ /** Operation name value for evaluation spans */
41
+ export declare const GEN_AI_OPERATION_NAME_VALUE_EVALUATION: "evaluation";
42
+ /**
43
+ * OTEL-registered (incubating) conversation/session identifier —
44
+ * `gen_ai.conversation.id` (model/gen-ai/registry.yaml): "the unique
45
+ * identifier for a conversation (session, thread), used to store and correlate
46
+ * messages within this conversation." We stamp this (= the agent run id) on our
47
+ * eval + sample-agent spans so trace queries can correlate on the OTEL-standard
48
+ * attribute in addition to our own `agent_health.run.id`. Declared as a string
49
+ * literal (rather than re-exported from the incubating module) so it's stable
50
+ * regardless of semantic-conventions packaging. See AGENTS.md → Trace
51
+ * correlation conventions.
52
+ */
53
+ export declare const ATTR_GEN_AI_CONVERSATION_ID: "gen_ai.conversation.id";
54
+ /** Maximum length for truncated attribute values */
55
+ export declare const MAX_ATTRIBUTE_LENGTH = 10000;
56
+ /** Maximum length for judge explanation in events */
57
+ export declare const MAX_EXPLANATION_LENGTH = 4000;
58
+ /** Tracer name used for evaluation spans */
59
+ export declare const EVAL_TRACER_NAME = "agent-health-eval";
60
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../telemetry/constants.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AAOH,OAAO,EAEL,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,4BAA4B,EAC5B,mCAAmC,EACnC,mCAAmC,EACnC,uCAAuC,EACvC,kCAAkC,EAClC,kCAAkC,EAGlC,0BAA0B,EAC1B,2BAA2B,EAC3B,kCAAkC,EAClC,kCAAkC,EAClC,kCAAkC,EAGlC,8BAA8B,GAC/B,MAAM,gDAAgD,CAAC;AAOxD,sDAAsD;AACtD,eAAO,MAAM,sBAAsB,EAAG,mBAA4B,CAAC;AAEnE,yDAAyD;AACzD,eAAO,MAAM,iBAAiB,EAAG,cAAuB,CAAC;AAMzD,+BAA+B;AAC/B,eAAO,MAAM,oBAAoB,EAAG,iBAA0B,CAAC;AAE/D,wCAAwC;AACxC,eAAO,MAAM,qBAAqB,EAAG,kBAA2B,CAAC;AAEjE,iCAAiC;AACjC,eAAO,MAAM,uBAAuB,EAAG,oBAA6B,CAAC;AAMrE,qCAAqC;AACrC,eAAO,MAAM,gCAAgC,EAAG,6BAAsC,CAAC;AAEvF,8CAA8C;AAC9C,eAAO,MAAM,mCAAmC,EAAG,gCAAyC,CAAC;AAE7F,iDAAiD;AACjD,eAAO,MAAM,gCAAgC,EAAG,6BAAsC,CAAC;AAEvF,yCAAyC;AACzC,eAAO,MAAM,mCAAmC,EAAG,gCAAyC,CAAC;AAE7F,sDAAsD;AACtD,eAAO,MAAM,oCAAoC,EAAG,iCAA0C,CAAC;AAE/F;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,EAAG,qBAA8B,CAAC;AAM7E,gDAAgD;AAChD,eAAO,MAAM,sCAAsC,EAAG,YAAqB,CAAC;AAE5E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,2BAA2B,EAAG,wBAAiC,CAAC;AAE7E,oDAAoD;AACpD,eAAO,MAAM,oBAAoB,QAAQ,CAAC;AAE1C,qDAAqD;AACrD,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,4CAA4C;AAC5C,eAAO,MAAM,gBAAgB,sBAAsB,CAAC"}
@@ -0,0 +1,87 @@
1
+ /*
2
+ * Copyright OpenSearch Contributors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * OTel Semantic Convention constants for evaluation telemetry.
7
+ *
8
+ * In-spec attributes are re-exported from @opentelemetry/semantic-conventions.
9
+ * Proposed and extension attributes are defined here as string constants.
10
+ */
11
+ // =============================================================================
12
+ // In-spec attributes (Development stability)
13
+ // Re-exported from @opentelemetry/semantic-conventions for convenience
14
+ // =============================================================================
15
+ export {
16
+ // Test attributes (model/test/registry.yaml)
17
+ ATTR_TEST_SUITE_NAME, ATTR_TEST_SUITE_RUN_STATUS, ATTR_TEST_CASE_NAME, ATTR_TEST_CASE_RESULT_STATUS, TEST_SUITE_RUN_STATUS_VALUE_SUCCESS, TEST_SUITE_RUN_STATUS_VALUE_FAILURE, TEST_SUITE_RUN_STATUS_VALUE_IN_PROGRESS, TEST_CASE_RESULT_STATUS_VALUE_PASS, TEST_CASE_RESULT_STATUS_VALUE_FAIL,
18
+ // GenAI evaluation attributes (model/gen-ai/registry.yaml, PR #2563)
19
+ ATTR_GEN_AI_OPERATION_NAME, ATTR_GEN_AI_EVALUATION_NAME, ATTR_GEN_AI_EVALUATION_SCORE_VALUE, ATTR_GEN_AI_EVALUATION_SCORE_LABEL, ATTR_GEN_AI_EVALUATION_EXPLANATION,
20
+ // GenAI evaluation event (model/gen-ai/events.yaml)
21
+ EVENT_GEN_AI_EVALUATION_RESULT, } from '@opentelemetry/semantic-conventions/incubating';
22
+ // =============================================================================
23
+ // Proposed attributes (Issue #3398 — not yet in spec)
24
+ // https://github.com/open-telemetry/semantic-conventions/issues/3398
25
+ // =============================================================================
26
+ /** Unique identifier for a specific test suite run */
27
+ export const ATTR_TEST_SUITE_RUN_ID = 'test.suite.run.id';
28
+ /** Machine-readable unique identifier for a test case */
29
+ export const ATTR_TEST_CASE_ID = 'test.case.id';
30
+ // =============================================================================
31
+ // IO attributes (used by Python SDK, not yet standardized)
32
+ // =============================================================================
33
+ /** Test case input (prompt) */
34
+ export const ATTR_TEST_CASE_INPUT = 'test.case.input';
35
+ /** Test case output (agent response) */
36
+ export const ATTR_TEST_CASE_OUTPUT = 'test.case.output';
37
+ /** Test case expected outcome */
38
+ export const ATTR_TEST_CASE_EXPECTED = 'test.case.expected';
39
+ // =============================================================================
40
+ // Agent Health extension attributes (agent_health.* prefix)
41
+ // =============================================================================
42
+ /** Model ID used by the LLM judge */
43
+ export const ATTR_AGENT_HEALTH_JUDGE_MODEL_ID = 'agent_health.judge.model_id';
44
+ /** Time spent in LLM judge evaluation (ms) */
45
+ export const ATTR_AGENT_HEALTH_JUDGE_DURATION_MS = 'agent_health.judge.duration_ms';
46
+ /** Number of retry attempts for the LLM judge */
47
+ export const ATTR_AGENT_HEALTH_JUDGE_ATTEMPTS = 'agent_health.judge.attempts';
48
+ /** Time spent in agent execution (ms) */
49
+ export const ATTR_AGENT_HEALTH_AGENT_DURATION_MS = 'agent_health.agent.duration_ms';
50
+ /** Connector protocol used for agent communication */
51
+ export const ATTR_AGENT_HEALTH_CONNECTOR_PROTOCOL = 'agent_health.connector.protocol';
52
+ /**
53
+ * Agent run ID — links eval spans to the agent execution trace (Strategy B).
54
+ *
55
+ * Uses Agent Health's own namespace rather than the OpenTelemetry-reserved
56
+ * `gen_ai.*` namespace: `gen_ai.request.id` is not a registered semantic
57
+ * convention attribute (the `gen_ai.request.*` namespace is for request
58
+ * parameters), and the OTEL naming spec advises against adding app-specific
59
+ * keys under an existing OTEL namespace. W3C trace context (shared traceId,
60
+ * Strategy A) remains the primary correlation; this attribute is the loose
61
+ * link for agents that don't propagate context.
62
+ */
63
+ export const ATTR_AGENT_HEALTH_AGENT_RUN_ID = 'agent_health.run.id';
64
+ // =============================================================================
65
+ // Constants
66
+ // =============================================================================
67
+ /** Operation name value for evaluation spans */
68
+ export const GEN_AI_OPERATION_NAME_VALUE_EVALUATION = 'evaluation';
69
+ /**
70
+ * OTEL-registered (incubating) conversation/session identifier —
71
+ * `gen_ai.conversation.id` (model/gen-ai/registry.yaml): "the unique
72
+ * identifier for a conversation (session, thread), used to store and correlate
73
+ * messages within this conversation." We stamp this (= the agent run id) on our
74
+ * eval + sample-agent spans so trace queries can correlate on the OTEL-standard
75
+ * attribute in addition to our own `agent_health.run.id`. Declared as a string
76
+ * literal (rather than re-exported from the incubating module) so it's stable
77
+ * regardless of semantic-conventions packaging. See AGENTS.md → Trace
78
+ * correlation conventions.
79
+ */
80
+ export const ATTR_GEN_AI_CONVERSATION_ID = 'gen_ai.conversation.id';
81
+ /** Maximum length for truncated attribute values */
82
+ export const MAX_ATTRIBUTE_LENGTH = 10000;
83
+ /** Maximum length for judge explanation in events */
84
+ export const MAX_EXPLANATION_LENGTH = 4000;
85
+ /** Tracer name used for evaluation spans */
86
+ export const EVAL_TRACER_NAME = 'agent-health-eval';
87
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../telemetry/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,gFAAgF;AAChF,6CAA6C;AAC7C,uEAAuE;AACvE,gFAAgF;AAEhF,OAAO;AACL,6CAA6C;AAC7C,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,4BAA4B,EAC5B,mCAAmC,EACnC,mCAAmC,EACnC,uCAAuC,EACvC,kCAAkC,EAClC,kCAAkC;AAElC,qEAAqE;AACrE,0BAA0B,EAC1B,2BAA2B,EAC3B,kCAAkC,EAClC,kCAAkC,EAClC,kCAAkC;AAElC,oDAA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AM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C,4CAA4C;AAC5C,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * OTel span helpers for evaluation telemetry.
3
+ *
4
+ * Creates and manages spans for benchmark execution following
5
+ * OpenTelemetry semantic conventions for test suites and GenAI evaluation.
6
+ *
7
+ * Span structure:
8
+ * test_suite_run {benchmarkName} ← root span (1 per benchmark run)
9
+ * └── test_case ← child span (1 per test case)
10
+ * └── Event: gen_ai.evaluation.result
11
+ */
12
+ import { type Context, type Span, type Link } from '@opentelemetry/api';
13
+ import type { Benchmark, BenchmarkRun, TestCase, TestCaseRun } from '../../types/index.js';
14
+ /**
15
+ * Start a test_suite_run root span for a benchmark run.
16
+ *
17
+ * Returns the span and a context carrying it for child span creation.
18
+ * The caller MUST call finalizeTestSuiteRunSpan() when the run completes.
19
+ */
20
+ export declare function startTestSuiteRunSpan(benchmark: Benchmark, run: BenchmarkRun): {
21
+ span: Span;
22
+ context: Context;
23
+ } | null;
24
+ /**
25
+ * Start a test_case child span for a single test case evaluation.
26
+ *
27
+ * @param parentCtx - Context from the parent test_suite_run span
28
+ * @param testCase - The test case being evaluated
29
+ * @param benchmark - Parent benchmark (for name duplication)
30
+ * @param run - Parent benchmark run (for run ID duplication)
31
+ * @param agentRunId - Optional agent execution run ID (links eval span to agent traces)
32
+ * @param links - Optional span links (e.g., to agent execution trace)
33
+ */
34
+ export declare function startTestCaseSpan(parentCtx: Context, testCase: TestCase, benchmark: Benchmark, run: BenchmarkRun, agentRunId?: string, links?: Link[]): {
35
+ span: Span;
36
+ context: Context;
37
+ } | null;
38
+ /**
39
+ * Add gen_ai.evaluation.result events to a test case span.
40
+ *
41
+ * Emits one event per metric (currently: accuracy with pass/fail label).
42
+ */
43
+ export declare function addEvaluationResultEvents(span: Span, report: TestCaseRun): void;
44
+ /**
45
+ * Finalize a test case span with evaluation results and end it.
46
+ */
47
+ export declare function finalizeTestCaseSpan(span: Span, report: TestCaseRun, endTime?: Date): void;
48
+ /**
49
+ * Finalize a test_suite_run span and end it.
50
+ */
51
+ export declare function finalizeTestSuiteRunSpan(span: Span, run: BenchmarkRun): void;
52
+ /**
53
+ * Emit a complete test case span for a deferred (trace-mode) evaluation.
54
+ *
55
+ * Used when the judge runs asynchronously after trace polling completes.
56
+ * Creates a standalone span with explicit timestamps reflecting the original execution.
57
+ */
58
+ export declare function emitDeferredTestCaseSpan(testCase: TestCase, report: TestCaseRun, benchmark: {
59
+ name: string;
60
+ }, runId: string, agentRunId?: string, startTime?: Date, endTime?: Date, agentTraceId?: string): void;
61
+ //# sourceMappingURL=evalSpans.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evalSpans.d.ts","sourceRoot":"","sources":["../../../telemetry/evalSpans.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AAEH,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,IAAI,EAIT,KAAK,IAAI,EACV,MAAM,oBAAoB,CAAC;AA0C5B,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAoB9E;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,YAAY,GAChB;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAkBzC;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,OAAO,EAClB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,YAAY,EACjB,UAAU,CAAC,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,IAAI,EAAE,GACb;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAsCzC;AAED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