@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,179 @@
1
+ /*
2
+ * Copyright OpenSearch Contributors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { createHash } from 'crypto';
6
+ import { readFileSync } from 'fs';
7
+ import { resolve, dirname } from 'path';
8
+ import { pathToFileURL } from 'url';
9
+ import { createRequire, Module as NodeModule } from 'module';
10
+ import { setActiveFile, getRegisteredTests, getRegisteredHooks, clearRegistry, } from './define.js';
11
+ import { getAuthoringSurface } from './authoringSurface.js';
12
+ const CODE_EXTENSIONS = ['.ts', '.js', '.mjs'];
13
+ export function isCodeFile(filename) {
14
+ const lower = filename.toLowerCase();
15
+ return CODE_EXTENSIONS.some(ext => lower.endsWith(ext));
16
+ }
17
+ // Re-exported so CLI/server importers keep a single import path
18
+ // (`@/lib/testCases/loader`) for both the loader and the language
19
+ // detector, while the browser-side EvalSourceCodeView component imports
20
+ // the same isomorphic implementation directly from `@/lib/utils` (this
21
+ // module pulls in `fs`/`module`, which are Node-only and unsafe to bundle
22
+ // into the browser).
23
+ export { detectSourceLanguage } from '../../lib/utils.js';
24
+ export function computeTestCaseHash(tc, fileSource) {
25
+ const content = JSON.stringify({
26
+ name: tc.name,
27
+ prompt: tc.options.prompt,
28
+ context: tc.options.context,
29
+ labels: tc.options.labels,
30
+ description: tc.options.description,
31
+ // Include the new expected* fields so editing them invalidates the
32
+ // sourceHash and the upsert path picks up the change. Without this,
33
+ // a user adding `expectedOutcomes: [...]` to an existing test would
34
+ // see the test case stay on its old version and the new outcomes
35
+ // would never reach storage.
36
+ expectedOutcomes: tc.options.expectedOutcomes,
37
+ expectedTrajectory: tc.options.expectedTrajectory,
38
+ // Fold in the WHOLE file's raw text (optional -- omitted by callers that
39
+ // don't have it, e.g. existing unit tests exercising this function in
40
+ // isolation). Without this, editing ONLY the evaluate() body, a helper
41
+ // function, an import, or even just a comment would leave every
42
+ // options-derived field above unchanged, `sourceHash` would stay put,
43
+ // `bulkUpsert` would classify the row as unchanged, and the persisted
44
+ // `sourceCode` -- the entire point of the eval-source viewer -- would
45
+ // silently go stale relative to the real file on disk.
46
+ fileSource,
47
+ });
48
+ return createHash('sha256').update(content).digest('hex');
49
+ }
50
+ export async function loadTestCasesFromModule(filePath) {
51
+ const absPath = resolve(filePath);
52
+ // Read the raw file text up front, before any execution path below --
53
+ // both the .js (already needed its own read for the CJS wrapper) and the
54
+ // .ts/.mjs (dynamic `import()`) paths reuse this single read. For .js this
55
+ // read IS the executed source (the CJS wrapper below runs this exact
56
+ // string). For .ts/.mjs, `import()` reads the file independently via
57
+ // Node's own module loader a few lines later -- in the extremely narrow
58
+ // window where the file is edited between this read and that import
59
+ // resolving, `fileSource` could theoretically diverge from what actually
60
+ // ran. That's an accepted, practically negligible risk (same file, same
61
+ // synchronous-ish call, no network hop) rather than a guarantee.
62
+ const fileSource = readFileSync(absPath, 'utf-8');
63
+ // Clear any prior registration for this file and set it as active
64
+ clearRegistry(absPath);
65
+ setActiveFile(absPath);
66
+ let module;
67
+ if (absPath.endsWith('.js')) {
68
+ // For CJS .js files, execute in a fresh context with our test() function
69
+ // injected. This avoids module caching issues across multiple loads.
70
+ const code = fileSource;
71
+ const fileDir = dirname(absPath);
72
+ // NOTE: do not call require('module') here — this file is bundled as ESM
73
+ // by esbuild for the server, and Dynamic require of built-ins is unsupported
74
+ // in ESM output. Use the statically-imported NodeModule instead.
75
+ const Module = NodeModule;
76
+ const m = new Module(absPath);
77
+ m.filename = absPath;
78
+ m.paths = Module._nodeModulePaths(fileDir);
79
+ // Provide a require function scoped to the file's directory, but override
80
+ // any require of the define module to return our own instance
81
+ const fileRequire = createRequire(absPath);
82
+ // Match if `id` looks like our own define module before doing any
83
+ // filesystem resolution. Required because:
84
+ // 1) the loader is bundled as ESM by esbuild, so synthetic CJS
85
+ // `require.resolve` is unavailable here, and
86
+ // 2) `lib/testCases/define.ts` is not compiled to a .js sibling, so
87
+ // `fileRequire.resolve('../../lib/testCases/define')` from a
88
+ // fixture would throw MODULE_NOT_FOUND.
89
+ const isDefineId = (id) => {
90
+ const normalized = id.replace(/\\/g, '/').replace(/\.js$/, '');
91
+ return (normalized === 'lib/testCases/define' ||
92
+ normalized.endsWith('/lib/testCases/define'));
93
+ };
94
+ // Intercept the published package name as well — fixtures generally
95
+ // do `require('@opensearch-project/agent-health')` and Node's resolver
96
+ // would otherwise hit the package's exports map (which only exposes
97
+ // 'import' for ESM consumers).
98
+ const isPackageName = (id) => id === '@opensearch-project/agent-health' ||
99
+ id === '@opensearch/agent-health' ||
100
+ id === 'agent-health';
101
+ // The object handed back when a CJS eval file requires the SDK. Single
102
+ // source of truth shared with the package exports (see authoringSurface)
103
+ // so `.js` and `.ts`/`.mjs` files see the SAME surface — no drift (#232).
104
+ const sdkExports = getAuthoringSurface();
105
+ const wrappedRequire = (id) => {
106
+ if (isDefineId(id) || isPackageName(id)) {
107
+ return sdkExports;
108
+ }
109
+ // Fall back to a resolution-based check so that fixtures requiring the
110
+ // SDK by absolute path or via the published package name still hand back
111
+ // our test() registrar (and therefore land in our file-scoped registry).
112
+ try {
113
+ const resolved = fileRequire.resolve(id);
114
+ const normalized = resolved.replace(/\\/g, '/');
115
+ if (normalized.endsWith('/lib/testCases/define.js') ||
116
+ normalized.endsWith('/lib/testCases/define')) {
117
+ return sdkExports;
118
+ }
119
+ }
120
+ catch {
121
+ // ignore unresolvable IDs — fileRequire below will surface the error
122
+ }
123
+ return fileRequire(id);
124
+ };
125
+ wrappedRequire.resolve = fileRequire.resolve;
126
+ const wrapper = `(function(exports, require, module, __filename, __dirname) { ${code}\n});`;
127
+ const compiledFn = eval(wrapper);
128
+ compiledFn(m.exports, wrappedRequire, m, absPath, fileDir);
129
+ module = m.exports;
130
+ }
131
+ else {
132
+ // For .ts and .mjs files, use dynamic import
133
+ try {
134
+ const fileUrl = pathToFileURL(absPath).href;
135
+ module = await import(fileUrl);
136
+ }
137
+ catch (err) {
138
+ if (err.code === 'ERR_UNKNOWN_FILE_EXTENSION' && absPath.endsWith('.ts')) {
139
+ throw new Error(`Cannot import TypeScript file: ${filePath}\n` +
140
+ 'Install tsx as a dependency: npm install tsx\n' +
141
+ 'Or pre-compile .eval.ts to .eval.js before running.');
142
+ }
143
+ throw new Error(`Failed to import module: ${filePath}\n${err.message}`);
144
+ }
145
+ }
146
+ // Tests come exclusively from test() / describe() registration calls
147
+ // (Playwright-style). Legacy default-export array form was removed when
148
+ // we dropped defineTestCases() — the SDK is experimental and the API
149
+ // shape is intentionally narrow.
150
+ const testCases = getRegisteredTests(absPath);
151
+ if (testCases.length === 0) {
152
+ throw new Error(`Module ${filePath} has no test cases. Register tests with test(name, options?, body) inside the file.`);
153
+ }
154
+ // Compute per-test-case hash. Includes fileSource (see
155
+ // computeTestCaseHash) so ANY change to the file -- not just the
156
+ // options fields already tracked -- invalidates the hash and triggers a
157
+ // re-persist, keeping the stored sourceCode in sync with disk.
158
+ const loaded = testCases.map(tc => ({
159
+ ...tc,
160
+ hash: computeTestCaseHash(tc, fileSource),
161
+ }));
162
+ // Derive describe-group → test names mapping. Tests outside any
163
+ // describe() have benchmarkPath=undefined and are excluded; the CLI/
164
+ // server adds them to the file-default benchmark separately.
165
+ const benchmarks = new Map();
166
+ for (const tc of loaded) {
167
+ if (tc.benchmarkPath) {
168
+ const list = benchmarks.get(tc.benchmarkPath) ?? [];
169
+ list.push(tc.name);
170
+ benchmarks.set(tc.benchmarkPath, list);
171
+ }
172
+ }
173
+ // Collect every hook the file registered. Empty when no
174
+ // beforeEach/afterEach/beforeAll/afterAll were called — the orchestrator
175
+ // is a no-op in that case so existing tests are unaffected.
176
+ const hooks = getRegisteredHooks(absPath);
177
+ return { testCases: loaded, filePath: absPath, benchmarks, hooks, fileSource };
178
+ }
179
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../testCases/loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,UAAU,EAAE,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CAAC,CAAC,CAAC;IAEJ,gEAAgE;IAChE,qEAAqE;IACrE,6DAA6D;IAC7D,MAAM,UAAU,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC/C,KAAK,MAAM,EAAE,IAAI,MAAM,EAAE,CAAC;QACxB,IAAI,EAAE,CAAC,aAAa,EAAE,CAAC;YACrB,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;YACpD,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;YACnB,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,wDAAwD;IACxD,yEAAyE;IACzE,4DAA4D;IAC5D,MAAM,KAAK,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AACjF,CAAC"}
@@ -0,0 +1,242 @@
1
+ import type { TrajectoryStep } from '../../types/index.js';
2
+ import type { TracesAccessor } from '../matchers/index.js';
3
+ /**
4
+ * Options for a code-based test case.
5
+ *
6
+ * All fields are optional. Only the test name (the first argument to
7
+ * `test()`) is required. When `prompt` is omitted, the runner skips agent
8
+ * invocation entirely and the test body runs against an empty EvalResult —
9
+ * useful for purely deterministic / data-driven tests.
10
+ *
11
+ * Categories and difficulty levels live in `labels` as prefixed strings
12
+ * (e.g. `'category:RCA'`, `'difficulty:Medium'`). The legacy top-level
13
+ * `category` / `difficulty` keys were removed in favor of this single
14
+ * unified tagging system.
15
+ */
16
+ export interface TestOptions {
17
+ /**
18
+ * Initial prompt sent to the agent. When omitted, the runner does not
19
+ * invoke the agent and the test body receives an empty EvalResult.
20
+ */
21
+ prompt?: string;
22
+ /** Free-form description shown in the UI. */
23
+ description?: string;
24
+ /** Additional context items passed to the agent alongside the prompt. */
25
+ context?: {
26
+ description: string;
27
+ value: string;
28
+ }[];
29
+ /**
30
+ * Labels for filtering and grouping. Use prefixed strings for what was
31
+ * previously `category` and `difficulty`:
32
+ * `['category:RCA', 'difficulty:Medium', 'team:platform']`.
33
+ */
34
+ labels?: string[];
35
+ /** Per-test timeout override in milliseconds. */
36
+ timeout?: number;
37
+ /**
38
+ * Plain-text descriptions of expected agent behaviour, used by the
39
+ * server-side LLM judge and by importers/exporters that round-trip
40
+ * test cases through JSON. Forwarded to the persisted test case so
41
+ * server evaluators (`-e <evaluator>`) can grade against the same
42
+ * criteria a human reviewer would write into the JSON form.
43
+ *
44
+ * Inline `judge(result, criteria)` from a test body does NOT need this
45
+ * field — the body passes the claim directly to /api/judge. Set this
46
+ * when you want the criteria to (a) live with the test definition for
47
+ * non-code consumers, or (b) be available to a server-side evaluator
48
+ * that runs alongside or instead of the body.
49
+ */
50
+ expectedOutcomes?: string[];
51
+ /**
52
+ * Optional reference trajectory for trajectory-alignment evaluators and
53
+ * Golden Path comparison. Leave undefined when the test only cares about
54
+ * outcome quality, not the specific path the agent took.
55
+ *
56
+ * Shape mirrors `TestCase.expectedTrajectory` in `@/types` so the
57
+ * upsert path can forward without coercion.
58
+ */
59
+ expectedTrajectory?: {
60
+ step: number;
61
+ description: string;
62
+ requiredTools: string[];
63
+ }[];
64
+ }
65
+ /**
66
+ * The trajectory accessor namespace exposed via EvalResult.trajectory in
67
+ * the new SDK. It IS the same array returned by the runner so users can
68
+ * iterate freely; the helpers are added as non-enumerable methods so
69
+ * `for/of` and JSON.stringify behave naturally.
70
+ */
71
+ export interface TrajectoryAccessor extends Array<TrajectoryStep> {
72
+ /** Steps of the given type, in order of occurrence. */
73
+ stepsOfType(type: string): TrajectoryStep[];
74
+ /** All `action` steps, optionally filtered by toolName and partial args. */
75
+ toolCalls(name?: string, argsPartial?: Record<string, unknown>): TrajectoryStep[];
76
+ /** First action-step matching, with `.index` annotated for ordering checks, or null. */
77
+ firstToolCall(name?: string, argsPartial?: Record<string, unknown>): (TrajectoryStep & {
78
+ index: number;
79
+ }) | null;
80
+ }
81
+ export interface CodeTestCase {
82
+ name: string;
83
+ options: TestOptions;
84
+ evaluate: TestBodyFn | LegacyEvaluateFn;
85
+ /** Resolved file the test was registered from — set by the loader. */
86
+ sourceFile?: string;
87
+ /**
88
+ * Benchmark group path — the joined `describe('...', ...)` names that
89
+ * wrapped this `test()` call, joined with ' > ' for nested describes.
90
+ * `undefined` when the test was registered outside any describe; the
91
+ * loader/CLI then puts the test into the file-default benchmark.
92
+ */
93
+ benchmarkPath?: string;
94
+ }
95
+ /**
96
+ * The Playwright-style test body signature: receives a fixtures object
97
+ * with `result`, `judge`, `traces`, and `expect`.
98
+ */
99
+ export type TestBodyFn = (fixtures: TestFixtures) => Promise<void> | void;
100
+ /**
101
+ * Legacy single-arg signature kept for backward compatibility. Old code
102
+ * that did `test(name, opts, async (result) => { ... })` keeps working.
103
+ */
104
+ export type LegacyEvaluateFn = (result: EvalResult) => Promise<void> | void;
105
+ export interface TestFixtures {
106
+ result: EvalResult;
107
+ judge: typeof import('./judge.js').judge;
108
+ traces: TracesAccessor;
109
+ expect: typeof import('../matchers/expect.js').expect;
110
+ /**
111
+ * The `agent` fixture (RFC 004 control inversion). The test body calls
112
+ * `await agent.run(prompt)` to drive the agent itself, instead of the
113
+ * framework invoking eagerly before the body. Optional during the
114
+ * transition: present when the runner provides it; `result` remains for
115
+ * the legacy eager path. Enforces one invocation per test.
116
+ */
117
+ agent?: import('./agentFixture.js').AgentFixture;
118
+ /**
119
+ * The `evaluate` fixture (RFC 004 §4.4): run a custom programmatic
120
+ * evaluator registered via `defineEvaluator()`. Gates by default;
121
+ * `.observe()` feeds score/insights only.
122
+ */
123
+ evaluate?: import('./evaluators.js').EvaluateFn;
124
+ /**
125
+ * Static, read-only metadata about the currently-executing test. Useful
126
+ * for naming temp dirs, logging, and routing — never mutate.
127
+ */
128
+ testInfo: TestInfo;
129
+ /**
130
+ * Values made available by `beforeEach` hooks via `provide(key, value)`.
131
+ * Always present (empty when no hooks ran). Read-only from the test body.
132
+ */
133
+ provisioned: Readonly<Record<string, unknown>>;
134
+ /**
135
+ * Only present inside `beforeEach` hooks. Stores a value into the
136
+ * provisioned bag for this test. The orchestrator handed to the test
137
+ * body and `afterEach` does NOT include `provide` (it's `undefined`),
138
+ * so referencing `fixtures.provide` outside `beforeEach` is a runtime
139
+ * error — not a no-op. Read provisioned values via
140
+ * `fixtures.provisioned[key]` instead.
141
+ */
142
+ provide?: (key: string, value: unknown) => void;
143
+ }
144
+ /**
145
+ * Static metadata about a test execution, exposed via `fixtures.testInfo`
146
+ * and `hookContext.testInfo`. Frozen at the start of the test so hooks and
147
+ * body see the same values.
148
+ */
149
+ export interface TestInfo {
150
+ /** Test name as registered with `test(name, ...)`. */
151
+ name: string;
152
+ /**
153
+ * Joined describe path, e.g. `'A > B'`. `undefined` when the test was
154
+ * registered outside any describe block.
155
+ */
156
+ benchmarkPath?: string;
157
+ /**
158
+ * The eval source file the test was loaded from (the absolute path the
159
+ * loader resolved). `undefined` for tests registered outside the loader
160
+ * (e.g. unit tests that call `test()` directly).
161
+ */
162
+ sourceFile?: string;
163
+ /**
164
+ * Storage id of the test case for this run. `undefined` when the
165
+ * orchestrator runs without a backing storage layer (unit tests).
166
+ */
167
+ testCaseId?: string;
168
+ }
169
+ /**
170
+ * Lifecycle hook kinds, modelled after Playwright. `beforeAll`/`afterAll`
171
+ * run once per scope (file or describe); `beforeEach`/`afterEach` run
172
+ * around every matching test in the scope.
173
+ */
174
+ export type HookKind = 'beforeAll' | 'afterAll' | 'beforeEach' | 'afterEach';
175
+ /**
176
+ * The function signature accepted by every hook. Receives the same
177
+ * fixtures object the test body sees. `beforeEach` may call
178
+ * `fixtures.provide(key, value)` to expose values to the body / `afterEach`.
179
+ */
180
+ export type HookFn = (fixtures: TestFixtures) => Promise<void> | void;
181
+ /**
182
+ * One registered hook, captured at registration time. The scope chain is
183
+ * the joined describe path (`undefined` at file top level), exactly
184
+ * matching how `test()` records `benchmarkPath`.
185
+ */
186
+ export interface RegisteredHook {
187
+ kind: HookKind;
188
+ fn: HookFn;
189
+ /** File path the hook was registered from (set by the loader). */
190
+ sourceFile?: string;
191
+ /**
192
+ * Joined describe path the hook lives in, e.g. `'A > B'`. `undefined`
193
+ * means the hook is file-scoped (outside any describe).
194
+ */
195
+ describePath?: string;
196
+ }
197
+ export interface EvalResult {
198
+ /** All trajectory steps with sugar accessors (toolCalls, firstToolCall, etc.). */
199
+ trajectory: TrajectoryAccessor;
200
+ /** Concatenated final response text from the agent's `assistant`/`response` steps. */
201
+ agentOutput: string;
202
+ /** Convenience: same as agentOutput. Returns the last assistant text. */
203
+ finalResponse(): string;
204
+ /** Try-parse `agentOutput` as JSON. Returns undefined when not parseable. */
205
+ parsedOutput(): unknown;
206
+ /** Raw AG-UI events as received from the agent. */
207
+ rawEvents: any[];
208
+ /** Agent-supplied run id (for log/trace correlation). */
209
+ runId?: string;
210
+ /** Wall-clock duration of the agent invocation in ms (0 when no prompt). */
211
+ durationMs: number;
212
+ /** Token usage when reported by the agent. */
213
+ tokenUsage?: {
214
+ prompt: number;
215
+ completion: number;
216
+ total: number;
217
+ };
218
+ /**
219
+ * OTel traces for this run, available after `agent.run()` resolves
220
+ * (RFC 004 §4.6). Mirrors the standalone `traces` fixture but scoped to
221
+ * the result, so `result.traces.totalTokens` reads the same data. Present
222
+ * only on results returned by `agent.run()`; reading it on the empty
223
+ * placeholder (before `agent.run()`) yields the loud-failure accessor.
224
+ */
225
+ traces?: import('../matchers/traces.js').TracesAccessor;
226
+ /**
227
+ * Strategy-C trace-correlation hints (`{ serviceName, startedAt, endedAt }[]`)
228
+ * the runner computed for this run's agent. Forwarded by `judge()` as
229
+ * `JudgeRequest.agents` so the agent (trace) judge can find the run's spans
230
+ * in OpenSearch by service-name + window — the SAME hints the classic
231
+ * `waitForTracesAndJudge` path builds via `buildJudgeAgentsHints`. This is
232
+ * what brings SDK `judge()` to parity with the UI/runner trace-judge path
233
+ * (without it the SDK judge only sends `runId`, which misses subprocess
234
+ * agents' spans). Present only when the runner could derive a service name.
235
+ */
236
+ judgeAgents?: Array<{
237
+ serviceName: string;
238
+ startedAt: number;
239
+ endedAt: number;
240
+ }>;
241
+ }
242
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../testCases/types.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,OAAO,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnD;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,MAAM,EAAE,CAAC;KACzB,EAAE,CAAC;CACL;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CAAC;IAC/D,uDAAuD;IACvD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,EAAE,CAAC;IAC5C,4EAA4E;IAC5E,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAA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,CAAA;KAAE,CAAC;IACnE;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,uBAAuB,EAAE,cAAc,CAAC;IAExD;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClF"}
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright OpenSearch Contributors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../testCases/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,6 @@
1
+ export type Theme = 'light' | 'dark';
2
+ export declare function getTheme(): Theme;
3
+ export declare function setTheme(theme: Theme): void;
4
+ export declare function applyTheme(theme: Theme): void;
5
+ export declare function initializeTheme(): void;
6
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../theme.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;AAIrC,wBAAgB,QAAQ,IAAI,KAAK,CAShC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAK3C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAU7C;AAED,wBAAgB,eAAe,IAAI,IAAI,CAGtC"}
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Copyright OpenSearch Contributors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ const THEME_STORAGE_KEY = 'agent-health-theme';
6
+ export function getTheme() {
7
+ if (typeof window === 'undefined')
8
+ return 'dark';
9
+ const stored = localStorage.getItem(THEME_STORAGE_KEY);
10
+ if (stored === 'light' || stored === 'dark') {
11
+ return stored;
12
+ }
13
+ return 'dark';
14
+ }
15
+ export function setTheme(theme) {
16
+ if (typeof window === 'undefined')
17
+ return;
18
+ localStorage.setItem(THEME_STORAGE_KEY, theme);
19
+ applyTheme(theme);
20
+ }
21
+ export function applyTheme(theme) {
22
+ if (typeof window === 'undefined')
23
+ return;
24
+ const root = document.documentElement;
25
+ if (theme === 'dark') {
26
+ root.classList.add('dark');
27
+ }
28
+ else {
29
+ root.classList.remove('dark');
30
+ }
31
+ }
32
+ export function initializeTheme() {
33
+ const theme = getTheme();
34
+ applyTheme(theme);
35
+ }
36
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../theme.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAE/C,MAAM,UAAU,QAAQ;IACtB,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,MAAM,CAAC;IAEjD,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACvD,IAAI,MAAM,KAAK,OAAO,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QAC5C,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAY;IACnC,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAE1C,YAAY,CAAC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;IAC/C,UAAU,CAAC,KAAK,CAAC,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAY;IACrC,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAE1C,MAAM,IAAI,GAAG,QAAQ,CAAC,eAAe,CAAC;IAEtC,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;QACrB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,UAAU,CAAC,KAAK,CAAC,CAAC;AACpB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Fire-and-forget UI usage telemetry. Lets us understand load/usage patterns
3
+ * (e.g. which comparison search scope is used, how often, result counts)
4
+ * without a heavyweight analytics dependency. Never blocks the UI or throws.
5
+ */
6
+ export declare function recordUiEvent(event: string, props?: Record<string, unknown>): void;
7
+ //# sourceMappingURL=uiTelemetry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uiTelemetry.d.ts","sourceRoot":"","sources":["../../uiTelemetry.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAalF"}
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright OpenSearch Contributors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * Fire-and-forget UI usage telemetry. Lets us understand load/usage patterns
7
+ * (e.g. which comparison search scope is used, how often, result counts)
8
+ * without a heavyweight analytics dependency. Never blocks the UI or throws.
9
+ */
10
+ export function recordUiEvent(event, props) {
11
+ try {
12
+ void fetch('/api/telemetry/ui-event', {
13
+ method: 'POST',
14
+ headers: { 'Content-Type': 'application/json' },
15
+ body: JSON.stringify({ event, props }),
16
+ keepalive: true,
17
+ }).catch(() => {
18
+ /* telemetry is best-effort */
19
+ });
20
+ }
21
+ catch {
22
+ /* never let telemetry break the UI */
23
+ }
24
+ }
25
+ //# sourceMappingURL=uiTelemetry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uiTelemetry.js","sourceRoot":"","sources":["../../uiTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa,EAAE,KAA+B;IAC1E,IAAI,CAAC;QACH,KAAK,KAAK,CAAC,yBAAyB,EAAE;YACpC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;YACtC,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;YACZ,8BAA8B;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,sCAAsC;IACxC,CAAC;AACH,CAAC"}
@@ -0,0 +1,111 @@
1
+ import { type ClassValue } from "clsx";
2
+ import { Difficulty, DateFormatVariant } from "../types/index.js";
3
+ export declare function cn(...inputs: ClassValue[]): string;
4
+ /**
5
+ * Returns Tailwind classes for styling label badges
6
+ * Only difficulty:Easy/Medium/Hard get special colors; all others use hash-based palette
7
+ */
8
+ export declare const getLabelColor: (label: string) => string;
9
+ /**
10
+ * Returns Tailwind classes for styling difficulty badges
11
+ * @deprecated Use getLabelColor with difficulty: prefixed labels instead
12
+ */
13
+ export declare const getDifficultyColor: (difficulty: Difficulty) => string;
14
+ /**
15
+ * Formats a timestamp string to a localized date string
16
+ * @param timestamp - ISO timestamp string
17
+ * @param variant - 'date' (date only), 'datetime' (default, with time), 'detailed' (with seconds)
18
+ */
19
+ export declare const formatDate: (timestamp: string, variant?: DateFormatVariant) => string;
20
+ /**
21
+ * Formats a timestamp to relative time (e.g., "5m ago", "2h ago")
22
+ * Falls back to formatDate for timestamps older than 7 days
23
+ */
24
+ export declare const formatRelativeTime: (timestamp: string) => string;
25
+ /**
26
+ * Gets the display name for a model ID from config
27
+ */
28
+ export declare const getModelName: (modelId: string) => string;
29
+ /**
30
+ * Returns a short, stable suffix for a TestCaseRun id, suitable for embedding
31
+ * in an auto-generated run name. Run ids are shaped
32
+ * `report-<timestamp>-<random>` (file adapter) or arbitrary keys (OpenSearch),
33
+ * so we take the trailing 6 characters which gives a recognizable yet compact
34
+ * label without exposing the full id. Falls back to the full id for very short
35
+ * ids (e.g. legacy data).
36
+ */
37
+ export declare const getRunShortId: (runId: string) => string;
38
+ /**
39
+ * Resolves the display name for a TestCaseRun.
40
+ *
41
+ * Prefers the persisted `name` field (set from the run config dialog or
42
+ * auto-generated server-side). Falls back to `Run <short-id>` for older
43
+ * runs that pre-date the field, so every row in the runs list has a
44
+ * recognizable label instead of a raw id slice.
45
+ */
46
+ export declare const getRunDisplayName: (run: {
47
+ id: string;
48
+ name?: string;
49
+ }) => string;
50
+ /**
51
+ * Computes a single "overall score" percentage to display next to a run in
52
+ * a list, from whatever metrics that run happens to carry.
53
+ *
54
+ * Why this is non-trivial:
55
+ * - Only the *RCA Default* system evaluator emits a metric named `accuracy`.
56
+ * Other system evaluators (Factuality, Tool Use, Reasoning, Safety) and
57
+ * any custom evaluator emit completely different metric names like
58
+ * `tool_selection_accuracy`, `reasoning_coherence`, `bias_detection`, etc.
59
+ * - The runs list used to hardcode `run.metrics?.accuracy ?? 0`, which made
60
+ * every non-RCA run display `0%` even when the judge had passed it.
61
+ *
62
+ * The fix is to take the **arithmetic mean of all populated numeric metrics**
63
+ * on the run. This works for any evaluator without having to look up its
64
+ * `scoringConfig`, gives a reasonable summary number, and degrades to `null`
65
+ * (rendered as `—`) when no metrics are present — the only honest answer
66
+ * for runs whose judge call hasn't completed or which were never scored.
67
+ *
68
+ * Returns `null` when there are no numeric metrics; otherwise an integer
69
+ * percentage rounded to the nearest whole number.
70
+ */
71
+ export declare const getRunOverallScore: (metrics: Record<string, number | undefined> | undefined | null) => number | null;
72
+ /**
73
+ * Returns theme-aware Tailwind classes for pass rate badges
74
+ * Light mode: More saturated backgrounds with darker text for better visibility
75
+ * Dark mode: Lighter text on dark backgrounds
76
+ */
77
+ export declare const getPassRateColor: (passRate: number) => string;
78
+ /**
79
+ * Returns theme-aware Tailwind classes for status indicators
80
+ * Used for success/error/warning/info states
81
+ * Light mode: More saturated backgrounds (100 shade) for better visibility
82
+ * Dark mode: Semi-transparent darker backgrounds with lighter text
83
+ */
84
+ export declare const getStatusColor: (status: "success" | "error" | "warning" | "info" | "neutral") => string;
85
+ /**
86
+ * Returns theme-aware text color classes for metrics
87
+ * Used for displaying metric values in stats cards
88
+ * Light mode: Darker colors for WCAG AA compliance (4.5:1 contrast ratio)
89
+ * Dark mode: Lighter colors for visibility on dark backgrounds
90
+ */
91
+ export declare const getMetricTextColor: (type: "primary" | "success" | "error" | "warning" | "info" | "secondary") => string;
92
+ /**
93
+ * Truncates text to a specified length with ellipsis
94
+ */
95
+ export declare const truncate: (text: string, length: number) => string;
96
+ /**
97
+ * Detect the syntax-highlighting language for a code-SDK eval file from its
98
+ * extension. Isomorphic (no Node built-ins) so it's shared by the CLI/server
99
+ * import path (lib/testCases/loader.ts, which re-exports this) AND the
100
+ * browser-side EvalSourceCodeView component -- one source of truth for
101
+ * "what language is this file" instead of duplicating the extension check.
102
+ *
103
+ * `.mjs`/`.js`/`.cjs` -> javascript, everything else code-like (`.ts` and
104
+ * unknown extensions) -> typescript. There's no `.jsx`/`.tsx` case today --
105
+ * eval files are plain Node scripts, not React -- but typescript's grammar
106
+ * is a superset of JS syntax so defaulting unknown-but-code extensions to
107
+ * it is the safer guess for highlighting purposes (worst case: a few
108
+ * JS-only tokens render unstyled, never mis-highlighted).
109
+ */
110
+ export declare function detectSourceLanguage(fileName: string): 'javascript' | 'typescript';
111
+ //# sourceMappingURL=utils.d.ts.map