@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,80 @@
1
+ /**
2
+ * The `agent` fixture — RFC 004 control inversion (#256, §4.1).
3
+ *
4
+ * Instead of the framework eagerly invoking the agent before the test body
5
+ * runs, the body drives invocation itself, exactly the way a Playwright test
6
+ * calls `await page.goto(...)`:
7
+ *
8
+ * ```js
9
+ * test('payment RCA', async ({ agent, expect, judge }) => {
10
+ * const id = await seedTicket(); // setup BEFORE the agent
11
+ * const result = await agent.run(`Triage ${id}`);
12
+ * expect(result).toHaveCalledTool('search_logs');
13
+ * await judge(result, 'identifies the DB outage');
14
+ * });
15
+ * ```
16
+ *
17
+ * **Exactly one invocation per test (enforced).** The goal is to *benchmark*
18
+ * an agent: one test ⇒ one invocation ⇒ one comparable trajectory. A second
19
+ * `agent.run()` throws. Multi-turn conversations, if a connector models them,
20
+ * happen inside that single run — they are not multiple harness invocations.
21
+ *
22
+ * This module owns only the **contract** and the one-run guard. The actual
23
+ * connector invocation + RunResult construction (trajectory accessor, lazy
24
+ * traces, runId correlation) is supplied by the runner via the `invoke`
25
+ * callback, since that requires server-side connector/trace machinery.
26
+ */
27
+ import type { EvalResult } from './types.js';
28
+ /** Options accepted by `agent.run(prompt, options)`. */
29
+ export interface AgentRunOptions {
30
+ /** Context items passed to the agent alongside the prompt. */
31
+ context?: {
32
+ description: string;
33
+ value: string;
34
+ }[];
35
+ /**
36
+ * Structured values forwarded to the connector's payload builder (e.g. a
37
+ * provisioned workspace dir). Stringly-typed env is the lowest common
38
+ * denominator every subprocess connector inherits automatically.
39
+ */
40
+ env?: Record<string, string>;
41
+ }
42
+ /**
43
+ * The single capability the framework hands the test body. `run()` is the
44
+ * agent equivalent of Playwright's `page.goto()`.
45
+ */
46
+ export interface AgentFixture {
47
+ /**
48
+ * Invoke the agent once and return a fully-captured result (trajectory,
49
+ * output, runId, traces). Throws if called more than once in a test, or if
50
+ * no prompt is available (none passed and no `defaultPrompt` configured).
51
+ */
52
+ run(prompt?: string, options?: AgentRunOptions): Promise<EvalResult>;
53
+ /** True once `run()` has been called (read-only introspection). */
54
+ readonly invoked: boolean;
55
+ }
56
+ /** The runner-supplied invocation implementation. */
57
+ export type AgentInvokeFn = (prompt: string, options?: AgentRunOptions) => Promise<EvalResult>;
58
+ export interface CreateAgentFixtureOptions {
59
+ /**
60
+ * Prompt used when `agent.run()` is called with no argument. Mirrors the
61
+ * test's `defaultPrompt` (discovery/UI display). When neither is present,
62
+ * `run()` throws rather than invoking with an empty prompt.
63
+ */
64
+ defaultPrompt?: string;
65
+ /** Default context merged under any per-call context. */
66
+ defaultContext?: {
67
+ description: string;
68
+ value: string;
69
+ }[];
70
+ }
71
+ /**
72
+ * Build an {@link AgentFixture} around a runner-supplied {@link AgentInvokeFn}.
73
+ *
74
+ * Enforces the one-invocation-per-test rule and resolves the effective
75
+ * prompt/context (per-call argument wins over the test's `defaultPrompt` /
76
+ * `defaultContext`). The `invoke` callback does the real work (connector +
77
+ * RunResult wrapping) and is only ever called at most once.
78
+ */
79
+ export declare function createAgentFixture(invoke: AgentInvokeFn, options?: CreateAgentFixtureOptions): AgentFixture;
80
+ //# sourceMappingURL=agentFixture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentFixture.d.ts","sourceRoot":"","sources":["../../../testCases/agentFixture.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,OAAO,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnD;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrE,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,qDAAqD;AACrD,MAAM,MAAM,aAAa,GAAG,CAC1B,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,eAAe,KACtB,OAAO,CAAC,UAAU,CAAC,CAAC;AAEzB,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yDAAyD;IACzD,cAAc,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC3D;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,aAAa,EACrB,OAAO,GAAE,yBAA8B,GACtC,YAAY,CAoCd"}
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Copyright OpenSearch Contributors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * Build an {@link AgentFixture} around a runner-supplied {@link AgentInvokeFn}.
7
+ *
8
+ * Enforces the one-invocation-per-test rule and resolves the effective
9
+ * prompt/context (per-call argument wins over the test's `defaultPrompt` /
10
+ * `defaultContext`). The `invoke` callback does the real work (connector +
11
+ * RunResult wrapping) and is only ever called at most once.
12
+ */
13
+ export function createAgentFixture(invoke, options = {}) {
14
+ let invoked = false;
15
+ return {
16
+ get invoked() {
17
+ return invoked;
18
+ },
19
+ async run(prompt, runOptions) {
20
+ if (invoked) {
21
+ throw new Error('agent.run() may be called at most once per test. Benchmarking ' +
22
+ 'requires exactly one agent invocation per test so trajectories ' +
23
+ 'stay comparable across runs. For multi-turn conversations, model ' +
24
+ 'the turns inside a single run via your connector.');
25
+ }
26
+ const effectivePrompt = prompt ?? options.defaultPrompt;
27
+ if (effectivePrompt == null || effectivePrompt === '') {
28
+ throw new Error('agent.run() requires a prompt — none was passed and the test has ' +
29
+ 'no `defaultPrompt`. Pass a prompt: `await agent.run("...")`.');
30
+ }
31
+ // Mark invoked BEFORE awaiting so a concurrent/re-entrant second call
32
+ // (e.g. forgetting to await) still trips the guard deterministically.
33
+ invoked = true;
34
+ const mergedContext = [
35
+ ...(options.defaultContext ?? []),
36
+ ...(runOptions?.context ?? []),
37
+ ];
38
+ const context = mergedContext.length > 0 ? mergedContext : undefined;
39
+ return invoke(effectivePrompt, { ...runOptions, context });
40
+ },
41
+ };
42
+ }
43
+ //# sourceMappingURL=agentFixture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentFixture.js","sourceRoot":"","sources":["../../../testCases/agentFixture.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2EH;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAqB,EACrB,UAAqC,EAAE;IAEvC,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,OAAO;QACL,IAAI,OAAO;YACT,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,MAAe,EAAE,UAA4B;YACrD,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CACb,gEAAgE;oBAChE,iEAAiE;oBACjE,mEAAmE;oBACnE,mDAAmD,CACpD,CAAC;YACJ,CAAC;YACD,MAAM,eAAe,GAAG,MAAM,IAAI,OAAO,CAAC,aAAa,CAAC;YACxD,IAAI,eAAe,IAAI,IAAI,IAAI,eAAe,KAAK,EAAE,EAAE,CAAC;gBACtD,MAAM,IAAI,KAAK,CACb,mEAAmE;oBACnE,8DAA8D,CAC/D,CAAC;YACJ,CAAC;YACD,sEAAsE;YACtE,sEAAsE;YACtE,OAAO,GAAG,IAAI,CAAC;YAEf,MAAM,aAAa,GAAG;gBACpB,GAAG,CAAC,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC;gBACjC,GAAG,CAAC,UAAU,EAAE,OAAO,IAAI,EAAE,CAAC;aAC/B,CAAC;YACF,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC;YAErE,OAAO,MAAM,CAAC,eAAe,EAAE,EAAE,GAAG,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7D,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Build the authoring-surface object handed to code-imported eval files.
3
+ * Must mirror the public `@opensearch-project/agent-health` package exports
4
+ * that a test body uses (the runtime registrars + matchers), so `.js` and
5
+ * `.ts`/`.mjs` files behave identically.
6
+ */
7
+ export declare function getAuthoringSurface(): Record<string, unknown>;
8
+ /** The stable list of authoring-surface export names (for drift tests). */
9
+ export declare const AUTHORING_SURFACE_NAMES: string[];
10
+ //# sourceMappingURL=authoringSurface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoringSurface.d.ts","sourceRoot":"","sources":["../../../testCases/authoringSurface.ts"],"names":[],"mappings":"AAkCA;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoB7D;AAED,2EAA2E;AAC3E,eAAO,MAAM,uBAAuB,UAA4C,CAAC"}
@@ -0,0 +1,54 @@
1
+ /*
2
+ * Copyright OpenSearch Contributors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * The single source of truth for the SDK's **test-authoring surface** — the
7
+ * exact set of names a `.eval.{js,ts,mjs}` file gets when it imports
8
+ * `@opensearch-project/agent-health` (RFC 004 §4.7, #232).
9
+ *
10
+ * Why this exists: the loader binds two ways. `.ts`/`.mjs` files are
11
+ * `import()`-ed and resolve the real package exports; `.js` (CJS) files are
12
+ * executed in a synthetic context where `require('@opensearch-project/...')`
13
+ * is intercepted and handed a hand-built object. Historically that object was
14
+ * a hardcoded subset that silently drifted from the real package exports — so
15
+ * a new export (e.g. `defineEvaluator`) worked in `.ts` files but was
16
+ * `undefined` in `.js` files. Centralizing the surface here, and having BOTH
17
+ * the loader's CJS injection and the package index reference it, kills the
18
+ * drift: add a name once and every loader path sees it.
19
+ */
20
+ import { test, describe, beforeAll, afterAll, beforeEach, afterEach, } from './define.js';
21
+ import { judge } from './judge.js';
22
+ import { defineEvaluator, evaluate } from './evaluators.js';
23
+ import { expect } from '../matchers/expect.js';
24
+ import { source, workflow } from '../workflow/index.js';
25
+ /**
26
+ * Build the authoring-surface object handed to code-imported eval files.
27
+ * Must mirror the public `@opensearch-project/agent-health` package exports
28
+ * that a test body uses (the runtime registrars + matchers), so `.js` and
29
+ * `.ts`/`.mjs` files behave identically.
30
+ */
31
+ export function getAuthoringSurface() {
32
+ return {
33
+ // Registrars (file-scoped singletons — registrations land in the
34
+ // loader's per-file registry).
35
+ test,
36
+ describe,
37
+ beforeAll,
38
+ afterAll,
39
+ beforeEach,
40
+ afterEach,
41
+ // Judge + custom evaluators.
42
+ judge,
43
+ defineEvaluator,
44
+ evaluate,
45
+ // Matcher API.
46
+ expect,
47
+ // Workflow SDK (for .workflow.{js,ts,mjs} files).
48
+ source,
49
+ workflow,
50
+ };
51
+ }
52
+ /** The stable list of authoring-surface export names (for drift tests). */
53
+ export const AUTHORING_SURFACE_NAMES = Object.keys(getAuthoringSurface()).sort();
54
+ //# sourceMappingURL=authoringSurface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoringSurface.js","sourceRoot":"","sources":["../../../testCases/authoringSurface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,UAAU,EACV,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,iEAAiE;QACjE,+BAA+B;QAC/B,IAAI;QACJ,QAAQ;QACR,SAAS;QACT,QAAQ;QACR,UAAU;QACV,SAAS;QACT,6BAA6B;QAC7B,KAAK;QACL,eAAe;QACf,QAAQ;QACR,eAAe;QACf,MAAM;QACN,kDAAkD;QAClD,MAAM;QACN,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,2EAA2E;AAC3E,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC"}
@@ -0,0 +1,13 @@
1
+ export interface CodemodResult {
2
+ /** The transformed source (equals input when nothing changed). */
3
+ code: string;
4
+ /** Whether any edit was applied. */
5
+ changed: boolean;
6
+ /** Human-readable notes per test (migrated / skipped + why). */
7
+ notes: string[];
8
+ }
9
+ /**
10
+ * Run the codemod over a single file's source text.
11
+ */
12
+ export declare function migrateEvalSource(code: string, fileName?: string): CodemodResult;
13
+ //# sourceMappingURL=codemod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codemod.d.ts","sourceRoot":"","sources":["../../../testCases/codemod.ts"],"names":[],"mappings":"AAgCA,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,gEAAgE;IAChE,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AA0CD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAY,GAAG,aAAa,CA4HnF"}
@@ -0,0 +1,169 @@
1
+ /*
2
+ * Copyright OpenSearch Contributors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * Codemod: migrate v1 code-SDK eval files to the RFC-004 control-inversion
7
+ * shape (#256, phase 10 tooling).
8
+ *
9
+ * v1 bodies received a pre-populated `result` fixture (the framework invoked
10
+ * the agent eagerly). v2 bodies own invocation: `const result = await
11
+ * agent.run()`. This transform rewrites each `test(name, options, body)`
12
+ * whose body destructures `result` AND whose options carry a `prompt`:
13
+ *
14
+ * test('x', { prompt: 'p' }, function ({ result, judge }) { ...result... })
15
+ * ↓
16
+ * test('x', { prompt: 'p' }, async ({ agent, judge }) => {
17
+ * const result = await agent.run();
18
+ * ...result...
19
+ * })
20
+ *
21
+ * Tests with no `prompt` (data-only) are left untouched — their `result` is
22
+ * the empty placeholder, which is still valid. Bodies that already call
23
+ * `agent.run()` are skipped (idempotent).
24
+ *
25
+ * Uses the TypeScript compiler API for a precise, formatting-preserving
26
+ * transform via plain text-range edits (no full reprint), so it works on
27
+ * both `.eval.js` and `.eval.ts`.
28
+ */
29
+ import * as ts from 'typescript';
30
+ /** Is this call expression a `test(...)` / `test.only(...)` registration? */
31
+ function isTestCall(node) {
32
+ const e = node.expression;
33
+ if (ts.isIdentifier(e))
34
+ return e.text === 'test';
35
+ if (ts.isPropertyAccessExpression(e) && ts.isIdentifier(e.expression)) {
36
+ return e.expression.text === 'test';
37
+ }
38
+ return false;
39
+ }
40
+ /** Extract the options-object literal argument (2nd arg) if present. */
41
+ function optionsArg(call) {
42
+ const a = call.arguments[1];
43
+ return a && ts.isObjectLiteralExpression(a) ? a : undefined;
44
+ }
45
+ /** Does the options object declare a non-empty `prompt`? */
46
+ function hasPrompt(opts) {
47
+ if (!opts)
48
+ return false;
49
+ return opts.properties.some((p) => ts.isPropertyAssignment(p) &&
50
+ ((ts.isIdentifier(p.name) && p.name.text === 'prompt') ||
51
+ (ts.isStringLiteral(p.name) && p.name.text === 'prompt')));
52
+ }
53
+ /** The body is the last argument when it's a function/arrow. */
54
+ function bodyArg(call) {
55
+ const last = call.arguments[call.arguments.length - 1];
56
+ if (last && (ts.isFunctionExpression(last) || ts.isArrowFunction(last)))
57
+ return last;
58
+ return undefined;
59
+ }
60
+ /**
61
+ * Run the codemod over a single file's source text.
62
+ */
63
+ export function migrateEvalSource(code, fileName = 'eval.ts') {
64
+ const sf = ts.createSourceFile(fileName, code, ts.ScriptTarget.Latest,
65
+ /*setParentNodes*/ true, fileName.endsWith('.ts') ? ts.ScriptKind.TS : ts.ScriptKind.JS);
66
+ const edits = [];
67
+ const notes = [];
68
+ const visit = (node) => {
69
+ if (ts.isCallExpression(node) && isTestCall(node)) {
70
+ processTest(node);
71
+ }
72
+ ts.forEachChild(node, visit);
73
+ };
74
+ function testName(call) {
75
+ const a = call.arguments[0];
76
+ return a && ts.isStringLiteralLike(a) ? a.text : '<anonymous>';
77
+ }
78
+ function processTest(call) {
79
+ const name = testName(call);
80
+ const body = bodyArg(call);
81
+ if (!body)
82
+ return; // no function body (e.g. test(name) stub)
83
+ const param = body.parameters[0];
84
+ // Only the object-destructuring fixture form is migrated.
85
+ if (!param || !ts.isObjectBindingPattern(param.name)) {
86
+ return;
87
+ }
88
+ const binding = param.name;
89
+ const names = binding.elements
90
+ .map((el) => (ts.isIdentifier(el.name) ? el.name.text : ''))
91
+ .filter(Boolean);
92
+ const usesResult = names.includes('result');
93
+ const usesAgent = names.includes('agent');
94
+ // Idempotency / applicability guards.
95
+ const bodyText = body.body ? body.body.getText(sf) : '';
96
+ const hasAgentRun = /\bagent\s*\.\s*run\s*\(/.test(bodyText);
97
+ if (hasAgentRun && !usesResult) {
98
+ // Fully migrated: calls agent.run() and no longer destructures `result`.
99
+ notes.push(`skip ${name}: already migrated (calls agent.run(), no result binding)`);
100
+ return;
101
+ }
102
+ if (hasAgentRun && usesResult) {
103
+ // Half-migrated: agent.run() is in, but `result` is still destructured
104
+ // (and almost certainly still referenced). The runner hands the body an
105
+ // empty placeholder `result` when `agent` is destructured separately, so
106
+ // those `result.*` reads silently read empties and assertions fail — the
107
+ // migration *looks* broken when it isn't. We can't safely rename those
108
+ // reads to the agent.run() return value, so surface for manual review
109
+ // instead of silently reporting "already migrated".
110
+ notes.push(`review ${name}: half-migrated — calls agent.run() but still destructures \`result\`. ` +
111
+ `Capture the agent.run() return value (\`const result = await agent.run()\`) and drop the \`result\` fixture.`);
112
+ return;
113
+ }
114
+ if (!hasPrompt(optionsArg(call))) {
115
+ notes.push(`skip ${name}: no prompt (data-only test, result placeholder is valid)`);
116
+ return;
117
+ }
118
+ if (!usesResult) {
119
+ notes.push(`skip ${name}: body does not use result`);
120
+ return;
121
+ }
122
+ // 1) Rewrite the destructuring: replace `result` with `agent` (or add
123
+ // `agent` if result+agent both somehow absent). Keep other fixtures.
124
+ const newNames = names.map((n) => (n === 'result' ? 'agent' : n));
125
+ if (usesAgent) {
126
+ // agent already destructured — just drop `result`.
127
+ const filtered = names.filter((n) => n !== 'result');
128
+ newNames.length = 0;
129
+ newNames.push(...filtered);
130
+ }
131
+ const newBinding = `{ ${newNames.join(', ')} }`;
132
+ edits.push({ start: binding.getStart(sf), end: binding.getEnd(), text: newBinding });
133
+ // 2) Ensure the function is async.
134
+ const isAsync = body.modifiers?.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword);
135
+ if (!isAsync) {
136
+ edits.push({ start: body.getStart(sf), end: body.getStart(sf), text: 'async ' });
137
+ }
138
+ // 3) Insert `const result = await agent.run();` at the top of the body.
139
+ // Handle both block bodies `{ ... }` and expression arrow bodies.
140
+ if (body.body && ts.isBlock(body.body)) {
141
+ const openBrace = body.body.getStart(sf) + 1; // just after `{`
142
+ edits.push({ start: openBrace, end: openBrace, text: `\n const result = await agent.run();` });
143
+ }
144
+ else if (body.body) {
145
+ // Expression-bodied arrow: wrap into a block.
146
+ const exprStart = body.body.getStart(sf);
147
+ const exprEnd = body.body.getEnd();
148
+ const exprText = body.body.getText(sf);
149
+ edits.push({
150
+ start: exprStart,
151
+ end: exprEnd,
152
+ text: `{\n const result = await agent.run();\n return ${exprText};\n}`,
153
+ });
154
+ }
155
+ notes.push(`migrate ${name}: result → agent.run()`);
156
+ }
157
+ visit(sf);
158
+ if (edits.length === 0) {
159
+ return { code, changed: false, notes };
160
+ }
161
+ // Apply edits right-to-left so offsets stay valid.
162
+ edits.sort((a, b) => b.start - a.start);
163
+ let out = code;
164
+ for (const e of edits) {
165
+ out = out.slice(0, e.start) + e.text + out.slice(e.end);
166
+ }
167
+ return { code: out, changed: true, notes };
168
+ }
169
+ //# sourceMappingURL=codemod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codemod.js","sourceRoot":"","sources":["../../../testCases/codemod.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAiBjC,6EAA6E;AAC7E,SAAS,UAAU,CAAC,IAAuB;IACzC,MAAM,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;IAC1B,IAAI,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;IACjD,IAAI,EAAE,CAAC,0BAA0B,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;QACtE,OAAO,CAAC,CAAC,UAAU,CAAC,IAAI,KAAK,MAAM,CAAC;IACtC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,wEAAwE;AACxE,SAAS,UAAU,CAAC,IAAuB;IACzC,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC5B,OAAO,CAAC,IAAI,EAAE,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9D,CAAC;AAED,4DAA4D;AAC5D,SAAS,SAAS,CAAC,IAA4C;IAC7D,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CACzB,CAAC,CAAC,EAAE,EAAE,CACJ,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC;QAC1B,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAA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CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACvC,KAAK,CAAC,IAAI,CAAC;gBACT,KAAK,EAAE,SAAS;gBAChB,GAAG,EAAE,OAAO;gBACZ,IAAI,EAAE,oDAAoD,QAAQ,MAAM;aACzE,CAAC,CAAC;QACL,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,WAAW,IAAI,wBAAwB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,EAAE,CAAC,CAAC;IAEV,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACzC,CAAC;IAED,mDAAmD;IACnD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,GAAG,GAAG,IAAI,CAAC;IACf,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,114 @@
1
+ import type { CodeTestCase, TestOptions, EvalResult, HookFn, RegisteredHook } from './types.js';
2
+ /** @internal */
3
+ export declare function _resetExperimentalWarning(): void;
4
+ export declare function setActiveFile(filePath: string): void;
5
+ /**
6
+ * Register a code-based test case.
7
+ *
8
+ * Two valid signatures (Playwright-style):
9
+ * - `test(name, body)` — no options at all
10
+ * - `test(name, options, body)` — with options
11
+ *
12
+ * Only `name` is required. All TestOptions fields are optional. When
13
+ * `options.prompt` is absent, the runner skips agent invocation and the
14
+ * body receives an empty EvalResult.
15
+ *
16
+ * Throws if a test with the same name is already registered in the same
17
+ * source file. Cross-file duplicates are allowed (storage identity is
18
+ * `name + sourceFile`).
19
+ *
20
+ * @experimental The SDK shape (signature, options, body fixtures) may change
21
+ * in a minor release without a deprecation cycle. See `lib/index.ts`.
22
+ */
23
+ export declare function test(name: string, body: (result: EvalResult) => Promise<void> | void): void;
24
+ export declare function test(name: string, options: TestOptions, body: (result: EvalResult) => Promise<void> | void): void;
25
+ /**
26
+ * Group tests under a benchmark name. Equivalent to Playwright's
27
+ * `describe()` — the wrapped `test()` calls inherit the describe's name as
28
+ * their benchmark group. Nested describes flatten with ' > '.
29
+ *
30
+ * @example
31
+ * describe('RCA Suite', () => {
32
+ * test('payment-service is the root cause', { prompt: ... }, async ({ result, judge }) => {
33
+ * expect(result.trajectory).to.haveCalledTool('search_logs');
34
+ * await judge(result, 'identifies the failing dependency');
35
+ * });
36
+ * });
37
+ *
38
+ * The describe body MUST be synchronous (no `await`/dynamic content), like
39
+ * Playwright. The function is invoked once at registration time.
40
+ */
41
+ export declare function describe(name: string, fn: () => void): void;
42
+ export declare function getRegisteredTests(filePath?: string): CodeTestCase[];
43
+ /**
44
+ * Return all hooks registered for the given file (or every file when no
45
+ * argument is given). Returns a snapshot — mutating the result has no
46
+ * effect on the registry.
47
+ */
48
+ export declare function getRegisteredHooks(filePath?: string): RegisteredHook[];
49
+ export declare function clearRegistry(filePath?: string): void;
50
+ /**
51
+ * Register a hook that runs **once** before the first test in its scope.
52
+ *
53
+ * Scope is the surrounding `describe(...)` block, or the whole file when
54
+ * called at the top level. With parallel test execution (the runner
55
+ * dispatches up to `concurrency` tests at once), the orchestrator uses a
56
+ * once-latch so all parallel arrivals await the same `beforeAll` promise.
57
+ *
58
+ * @example
59
+ * beforeAll(async () => {
60
+ * await fs.mkdir('/tmp/agent-health-fixtures', { recursive: true });
61
+ * });
62
+ */
63
+ export declare function beforeAll(fn: HookFn): void;
64
+ /**
65
+ * Register a hook that runs **once** after the last test in its scope.
66
+ *
67
+ * Always runs, even when every test in the scope failed. The orchestrator
68
+ * uses a remaining-test counter (decremented on each test completion,
69
+ * regardless of pass/fail) and triggers `afterAll` when it hits zero.
70
+ *
71
+ * @example
72
+ * afterAll(async () => {
73
+ * await fs.rm('/tmp/agent-health-fixtures', { recursive: true });
74
+ * });
75
+ */
76
+ export declare function afterAll(fn: HookFn): void;
77
+ /**
78
+ * Register a hook that runs **before each test** in its scope.
79
+ *
80
+ * Receives the same fixtures object the body will see, plus a
81
+ * `provide(key, value)` function for stashing values that the test body
82
+ * (and `afterEach`) can read via `fixtures.provisioned[key]`. Each test
83
+ * gets its own provisioned bag, so concurrent tests are isolated.
84
+ *
85
+ * @example
86
+ * beforeEach(async ({ provide, testInfo }) => {
87
+ * const dir = await fs.mkdtemp(`/tmp/${testInfo.name}-`);
88
+ * provide('workspaceDir', dir);
89
+ * });
90
+ */
91
+ export declare function beforeEach(fn: HookFn): void;
92
+ /**
93
+ * Register a hook that runs **after each test** in its scope.
94
+ *
95
+ * Always runs, even when the test body or a `beforeEach` threw. Reads
96
+ * provisioned values via `fixtures.provisioned[key]` for cleanup. Errors
97
+ * thrown from `afterEach` are captured as MatcherResult entries on the
98
+ * test — they don't crash the runner.
99
+ *
100
+ * @example
101
+ * afterEach(async ({ provisioned }) => {
102
+ * if (provisioned.workspaceDir) {
103
+ * await fs.rm(provisioned.workspaceDir as string, { recursive: true, force: true });
104
+ * }
105
+ * });
106
+ */
107
+ export declare function afterEach(fn: HookFn): void;
108
+ export declare namespace test {
109
+ const beforeAll: (fn: HookFn) => void;
110
+ const afterAll: (fn: HookFn) => void;
111
+ const beforeEach: (fn: HookFn) => void;
112
+ const afterEach: (fn: HookFn) => void;
113
+ }
114
+ //# sourceMappingURL=define.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../testCases/define.ts"],"names":[],"mappings":"AAKA,O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