openlit 1.13.0 → 1.14.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 (348) hide show
  1. package/README.md +34 -1
  2. package/dist/__tests__/manual-trace.test.js +118 -0
  3. package/dist/__tests__/manual-trace.test.js.map +1 -0
  4. package/dist/__tests__/register.test.js +90 -0
  5. package/dist/__tests__/register.test.js.map +1 -0
  6. package/dist/config.d.ts +7 -1
  7. package/dist/config.js +3 -1
  8. package/dist/config.js.map +1 -1
  9. package/dist/evals/__tests__/offline.test.js +418 -0
  10. package/dist/evals/__tests__/offline.test.js.map +1 -0
  11. package/dist/evals/index.d.ts +2 -5
  12. package/dist/evals/index.js +12 -26
  13. package/dist/evals/index.js.map +1 -1
  14. package/dist/evals/offline.d.ts +6 -0
  15. package/dist/evals/offline.js +347 -0
  16. package/dist/evals/offline.js.map +1 -0
  17. package/dist/evals/types.d.ts +69 -18
  18. package/dist/evals/types.js +20 -0
  19. package/dist/evals/types.js.map +1 -1
  20. package/dist/guard/__tests__/integration.test.js +178 -0
  21. package/dist/guard/__tests__/integration.test.js.map +1 -0
  22. package/dist/guard/__tests__/pii.test.js +109 -0
  23. package/dist/guard/__tests__/pii.test.js.map +1 -0
  24. package/dist/guard/__tests__/pipeline.test.js +162 -0
  25. package/dist/guard/__tests__/pipeline.test.js.map +1 -0
  26. package/dist/guard/__tests__/prompt-injection.test.js +92 -0
  27. package/dist/guard/__tests__/prompt-injection.test.js.map +1 -0
  28. package/dist/guard/base.d.ts +75 -14
  29. package/dist/guard/base.js +130 -53
  30. package/dist/guard/base.js.map +1 -1
  31. package/dist/guard/custom.d.ts +19 -0
  32. package/dist/guard/custom.js +46 -0
  33. package/dist/guard/custom.js.map +1 -0
  34. package/dist/guard/index.d.ts +24 -5
  35. package/dist/guard/index.js +39 -21
  36. package/dist/guard/index.js.map +1 -1
  37. package/dist/guard/integration.d.ts +32 -0
  38. package/dist/guard/integration.js +328 -0
  39. package/dist/guard/integration.js.map +1 -0
  40. package/dist/guard/moderation.d.ts +18 -0
  41. package/dist/guard/moderation.js +61 -0
  42. package/dist/guard/moderation.js.map +1 -0
  43. package/dist/guard/pii.d.ts +17 -0
  44. package/dist/guard/pii.js +94 -0
  45. package/dist/guard/pii.js.map +1 -0
  46. package/dist/guard/pipeline.d.ts +18 -0
  47. package/dist/guard/pipeline.js +96 -0
  48. package/dist/guard/pipeline.js.map +1 -0
  49. package/dist/guard/prompt-injection.d.ts +20 -6
  50. package/dist/guard/prompt-injection.js +59 -68
  51. package/dist/guard/prompt-injection.js.map +1 -1
  52. package/dist/guard/schema.d.ts +20 -0
  53. package/dist/guard/schema.js +99 -0
  54. package/dist/guard/schema.js.map +1 -0
  55. package/dist/guard/sensitive-topic.d.ts +22 -6
  56. package/dist/guard/sensitive-topic.js +78 -64
  57. package/dist/guard/sensitive-topic.js.map +1 -1
  58. package/dist/guard/topic-restriction.d.ts +21 -6
  59. package/dist/guard/topic-restriction.js +43 -64
  60. package/dist/guard/topic-restriction.js.map +1 -1
  61. package/dist/helpers.d.ts +133 -2
  62. package/dist/helpers.js +415 -5
  63. package/dist/helpers.js.map +1 -1
  64. package/dist/index.d.ts +54 -30
  65. package/dist/index.js +104 -22
  66. package/dist/index.js.map +1 -1
  67. package/dist/instrumentation/__tests__/ai21-rag-trace-comparison.test.d.ts +13 -0
  68. package/dist/instrumentation/__tests__/ai21-rag-trace-comparison.test.js +176 -0
  69. package/dist/instrumentation/__tests__/ai21-rag-trace-comparison.test.js.map +1 -0
  70. package/dist/instrumentation/__tests__/ai21-trace-comparison.test.d.ts +10 -0
  71. package/dist/instrumentation/__tests__/ai21-trace-comparison.test.js +203 -0
  72. package/dist/instrumentation/__tests__/ai21-trace-comparison.test.js.map +1 -0
  73. package/dist/instrumentation/__tests__/assemblyai-wrapper.test.js +262 -0
  74. package/dist/instrumentation/__tests__/assemblyai-wrapper.test.js.map +1 -0
  75. package/dist/instrumentation/__tests__/astra-trace-comparison.test.d.ts +7 -0
  76. package/dist/instrumentation/__tests__/astra-trace-comparison.test.js +160 -0
  77. package/dist/instrumentation/__tests__/astra-trace-comparison.test.js.map +1 -0
  78. package/dist/instrumentation/__tests__/browser-use-wrapper.test.js +284 -0
  79. package/dist/instrumentation/__tests__/browser-use-wrapper.test.js.map +1 -0
  80. package/dist/instrumentation/__tests__/cache-pricing.test.d.ts +12 -0
  81. package/dist/instrumentation/__tests__/cache-pricing.test.js +95 -0
  82. package/dist/instrumentation/__tests__/cache-pricing.test.js.map +1 -0
  83. package/dist/instrumentation/__tests__/elevenlabs-wrapper.test.d.ts +1 -0
  84. package/dist/instrumentation/__tests__/elevenlabs-wrapper.test.js +282 -0
  85. package/dist/instrumentation/__tests__/elevenlabs-wrapper.test.js.map +1 -0
  86. package/dist/instrumentation/__tests__/firecrawl-wrapper.test.d.ts +1 -0
  87. package/dist/instrumentation/__tests__/firecrawl-wrapper.test.js +238 -0
  88. package/dist/instrumentation/__tests__/firecrawl-wrapper.test.js.map +1 -0
  89. package/dist/instrumentation/__tests__/gpu-collector.test.d.ts +1 -0
  90. package/dist/instrumentation/__tests__/gpu-collector.test.js +247 -0
  91. package/dist/instrumentation/__tests__/gpu-collector.test.js.map +1 -0
  92. package/dist/instrumentation/__tests__/gradient-trace-comparison.test.d.ts +11 -0
  93. package/dist/instrumentation/__tests__/gradient-trace-comparison.test.js +391 -0
  94. package/dist/instrumentation/__tests__/gradient-trace-comparison.test.js.map +1 -0
  95. package/dist/instrumentation/__tests__/groq-trace-comparison.test.js +150 -0
  96. package/dist/instrumentation/__tests__/groq-trace-comparison.test.js.map +1 -1
  97. package/dist/instrumentation/__tests__/helpers-genai.test.d.ts +14 -0
  98. package/dist/instrumentation/__tests__/helpers-genai.test.js +347 -0
  99. package/dist/instrumentation/__tests__/helpers-genai.test.js.map +1 -0
  100. package/dist/instrumentation/__tests__/langchain-role-map.test.d.ts +1 -0
  101. package/dist/instrumentation/__tests__/langchain-role-map.test.js +19 -0
  102. package/dist/instrumentation/__tests__/langchain-role-map.test.js.map +1 -0
  103. package/dist/instrumentation/__tests__/mem0-trace-comparison.test.d.ts +13 -0
  104. package/dist/instrumentation/__tests__/mem0-trace-comparison.test.js +208 -0
  105. package/dist/instrumentation/__tests__/mem0-trace-comparison.test.js.map +1 -0
  106. package/dist/instrumentation/__tests__/pg-trace-comparison.test.d.ts +21 -0
  107. package/dist/instrumentation/__tests__/pg-trace-comparison.test.js +455 -0
  108. package/dist/instrumentation/__tests__/pg-trace-comparison.test.js.map +1 -0
  109. package/dist/instrumentation/__tests__/transformers-trace-comparison.test.d.ts +11 -0
  110. package/dist/instrumentation/__tests__/transformers-trace-comparison.test.js +214 -0
  111. package/dist/instrumentation/__tests__/transformers-trace-comparison.test.js.map +1 -0
  112. package/dist/instrumentation/__tests__/vertexai-trace-comparison.test.d.ts +6 -0
  113. package/dist/instrumentation/__tests__/vertexai-trace-comparison.test.js +409 -0
  114. package/dist/instrumentation/__tests__/vertexai-trace-comparison.test.js.map +1 -0
  115. package/dist/instrumentation/__tests__/vllm-trace-comparison.test.d.ts +1 -0
  116. package/dist/instrumentation/__tests__/vllm-trace-comparison.test.js +519 -0
  117. package/dist/instrumentation/__tests__/vllm-trace-comparison.test.js.map +1 -0
  118. package/dist/instrumentation/ai21/index.d.ts +11 -0
  119. package/dist/instrumentation/ai21/index.js +67 -0
  120. package/dist/instrumentation/ai21/index.js.map +1 -0
  121. package/dist/instrumentation/ai21/wrapper.d.ts +54 -0
  122. package/dist/instrumentation/ai21/wrapper.js +511 -0
  123. package/dist/instrumentation/ai21/wrapper.js.map +1 -0
  124. package/dist/instrumentation/anthropic/wrapper.js +56 -2
  125. package/dist/instrumentation/anthropic/wrapper.js.map +1 -1
  126. package/dist/instrumentation/assemblyai/index.d.ts +12 -0
  127. package/dist/instrumentation/assemblyai/index.js +91 -0
  128. package/dist/instrumentation/assemblyai/index.js.map +1 -0
  129. package/dist/instrumentation/assemblyai/wrapper.d.ts +35 -0
  130. package/dist/instrumentation/assemblyai/wrapper.js +233 -0
  131. package/dist/instrumentation/assemblyai/wrapper.js.map +1 -0
  132. package/dist/instrumentation/astra/index.d.ts +11 -0
  133. package/dist/instrumentation/astra/index.js +87 -0
  134. package/dist/instrumentation/astra/index.js.map +1 -0
  135. package/dist/instrumentation/astra/wrapper.d.ts +39 -0
  136. package/dist/instrumentation/astra/wrapper.js +349 -0
  137. package/dist/instrumentation/astra/wrapper.js.map +1 -0
  138. package/dist/instrumentation/azure-ai-inference/wrapper.d.ts +13 -0
  139. package/dist/instrumentation/azure-ai-inference/wrapper.js +60 -1
  140. package/dist/instrumentation/azure-ai-inference/wrapper.js.map +1 -1
  141. package/dist/instrumentation/bedrock/wrapper.d.ts +13 -0
  142. package/dist/instrumentation/bedrock/wrapper.js +78 -2
  143. package/dist/instrumentation/bedrock/wrapper.js.map +1 -1
  144. package/dist/instrumentation/browser-use/index.d.ts +11 -0
  145. package/dist/instrumentation/browser-use/index.js +98 -0
  146. package/dist/instrumentation/browser-use/index.js.map +1 -0
  147. package/dist/instrumentation/browser-use/wrapper.d.ts +12 -0
  148. package/dist/instrumentation/browser-use/wrapper.js +706 -0
  149. package/dist/instrumentation/browser-use/wrapper.js.map +1 -0
  150. package/dist/instrumentation/claude-agent-sdk/wrapper.js +90 -4
  151. package/dist/instrumentation/claude-agent-sdk/wrapper.js.map +1 -1
  152. package/dist/instrumentation/cohere/wrapper.d.ts +13 -0
  153. package/dist/instrumentation/cohere/wrapper.js +59 -0
  154. package/dist/instrumentation/cohere/wrapper.js.map +1 -1
  155. package/dist/instrumentation/cursor-sdk/wrapper.js +111 -15
  156. package/dist/instrumentation/cursor-sdk/wrapper.js.map +1 -1
  157. package/dist/instrumentation/elevenlabs/index.d.ts +12 -0
  158. package/dist/instrumentation/elevenlabs/index.js +92 -0
  159. package/dist/instrumentation/elevenlabs/index.js.map +1 -0
  160. package/dist/instrumentation/elevenlabs/wrapper.d.ts +34 -0
  161. package/dist/instrumentation/elevenlabs/wrapper.js +280 -0
  162. package/dist/instrumentation/elevenlabs/wrapper.js.map +1 -0
  163. package/dist/instrumentation/firecrawl/index.d.ts +13 -0
  164. package/dist/instrumentation/firecrawl/index.js +115 -0
  165. package/dist/instrumentation/firecrawl/index.js.map +1 -0
  166. package/dist/instrumentation/firecrawl/wrapper.d.ts +22 -0
  167. package/dist/instrumentation/firecrawl/wrapper.js +378 -0
  168. package/dist/instrumentation/firecrawl/wrapper.js.map +1 -0
  169. package/dist/instrumentation/google-ai/wrapper.d.ts +13 -0
  170. package/dist/instrumentation/google-ai/wrapper.js +85 -1
  171. package/dist/instrumentation/google-ai/wrapper.js.map +1 -1
  172. package/dist/instrumentation/gpu/index.d.ts +38 -0
  173. package/dist/instrumentation/gpu/index.js +233 -0
  174. package/dist/instrumentation/gpu/index.js.map +1 -0
  175. package/dist/instrumentation/gradient/index.d.ts +12 -0
  176. package/dist/instrumentation/gradient/index.js +74 -0
  177. package/dist/instrumentation/gradient/index.js.map +1 -0
  178. package/dist/instrumentation/gradient/utils.d.ts +14 -0
  179. package/dist/instrumentation/gradient/utils.js +119 -0
  180. package/dist/instrumentation/gradient/utils.js.map +1 -0
  181. package/dist/instrumentation/gradient/wrapper.d.ts +76 -0
  182. package/dist/instrumentation/gradient/wrapper.js +584 -0
  183. package/dist/instrumentation/gradient/wrapper.js.map +1 -0
  184. package/dist/instrumentation/groq/wrapper.js +42 -0
  185. package/dist/instrumentation/groq/wrapper.js.map +1 -1
  186. package/dist/instrumentation/huggingface/wrapper.d.ts +13 -0
  187. package/dist/instrumentation/huggingface/wrapper.js +66 -0
  188. package/dist/instrumentation/huggingface/wrapper.js.map +1 -1
  189. package/dist/instrumentation/index.js +26 -0
  190. package/dist/instrumentation/index.js.map +1 -1
  191. package/dist/instrumentation/langchain/wrapper.js +5 -8
  192. package/dist/instrumentation/langchain/wrapper.js.map +1 -1
  193. package/dist/instrumentation/langgraph/wrapper.js +12 -11
  194. package/dist/instrumentation/langgraph/wrapper.js.map +1 -1
  195. package/dist/instrumentation/llamaindex/wrapper.d.ts +14 -1
  196. package/dist/instrumentation/llamaindex/wrapper.js +68 -0
  197. package/dist/instrumentation/llamaindex/wrapper.js.map +1 -1
  198. package/dist/instrumentation/mcp/index.d.ts +20 -0
  199. package/dist/instrumentation/mcp/index.js +282 -0
  200. package/dist/instrumentation/mcp/index.js.map +1 -0
  201. package/dist/instrumentation/mcp/wrapper.d.ts +72 -0
  202. package/dist/instrumentation/mcp/wrapper.js +571 -0
  203. package/dist/instrumentation/mcp/wrapper.js.map +1 -0
  204. package/dist/instrumentation/mem0/index.d.ts +17 -0
  205. package/dist/instrumentation/mem0/index.js +113 -0
  206. package/dist/instrumentation/mem0/index.js.map +1 -0
  207. package/dist/instrumentation/mem0/wrapper.d.ts +37 -0
  208. package/dist/instrumentation/mem0/wrapper.js +298 -0
  209. package/dist/instrumentation/mem0/wrapper.js.map +1 -0
  210. package/dist/instrumentation/mistral/wrapper.d.ts +13 -0
  211. package/dist/instrumentation/mistral/wrapper.js +60 -1
  212. package/dist/instrumentation/mistral/wrapper.js.map +1 -1
  213. package/dist/instrumentation/ollama/wrapper.d.ts +13 -0
  214. package/dist/instrumentation/ollama/wrapper.js +67 -1
  215. package/dist/instrumentation/ollama/wrapper.js.map +1 -1
  216. package/dist/instrumentation/openai/wrapper.d.ts +13 -0
  217. package/dist/instrumentation/openai/wrapper.js +89 -3
  218. package/dist/instrumentation/openai/wrapper.js.map +1 -1
  219. package/dist/instrumentation/pg/index.d.ts +20 -0
  220. package/dist/instrumentation/pg/index.js +74 -0
  221. package/dist/instrumentation/pg/index.js.map +1 -0
  222. package/dist/instrumentation/pg/wrapper.d.ts +66 -0
  223. package/dist/instrumentation/pg/wrapper.js +441 -0
  224. package/dist/instrumentation/pg/wrapper.js.map +1 -0
  225. package/dist/instrumentation/replicate/wrapper.d.ts +13 -0
  226. package/dist/instrumentation/replicate/wrapper.js +61 -0
  227. package/dist/instrumentation/replicate/wrapper.js.map +1 -1
  228. package/dist/instrumentation/strands/processor.d.ts +6 -0
  229. package/dist/instrumentation/strands/processor.js +73 -3
  230. package/dist/instrumentation/strands/processor.js.map +1 -1
  231. package/dist/instrumentation/strands/utils.d.ts +2 -2
  232. package/dist/instrumentation/strands/utils.js +15 -2
  233. package/dist/instrumentation/strands/utils.js.map +1 -1
  234. package/dist/instrumentation/together/wrapper.d.ts +13 -0
  235. package/dist/instrumentation/together/wrapper.js +59 -1
  236. package/dist/instrumentation/together/wrapper.js.map +1 -1
  237. package/dist/instrumentation/transformers/index.d.ts +35 -0
  238. package/dist/instrumentation/transformers/index.js +119 -0
  239. package/dist/instrumentation/transformers/index.js.map +1 -0
  240. package/dist/instrumentation/transformers/wrapper.d.ts +49 -0
  241. package/dist/instrumentation/transformers/wrapper.js +472 -0
  242. package/dist/instrumentation/transformers/wrapper.js.map +1 -0
  243. package/dist/instrumentation/vercel-ai/wrapper.d.ts +13 -0
  244. package/dist/instrumentation/vercel-ai/wrapper.js +106 -1
  245. package/dist/instrumentation/vercel-ai/wrapper.js.map +1 -1
  246. package/dist/instrumentation/vertexai/index.d.ts +11 -0
  247. package/dist/instrumentation/vertexai/index.js +70 -0
  248. package/dist/instrumentation/vertexai/index.js.map +1 -0
  249. package/dist/instrumentation/vertexai/wrapper.d.ts +67 -0
  250. package/dist/instrumentation/vertexai/wrapper.js +529 -0
  251. package/dist/instrumentation/vertexai/wrapper.js.map +1 -0
  252. package/dist/instrumentation/vllm/index.d.ts +13 -0
  253. package/dist/instrumentation/vllm/index.js +67 -0
  254. package/dist/instrumentation/vllm/index.js.map +1 -0
  255. package/dist/instrumentation/vllm/wrapper.d.ts +60 -0
  256. package/dist/instrumentation/vllm/wrapper.js +482 -0
  257. package/dist/instrumentation/vllm/wrapper.js.map +1 -0
  258. package/dist/llm/index.d.ts +9 -2
  259. package/dist/llm/index.js.map +1 -1
  260. package/dist/manual-trace.d.ts +40 -0
  261. package/dist/manual-trace.js +103 -0
  262. package/dist/manual-trace.js.map +1 -0
  263. package/dist/otel/metrics.d.ts +11 -0
  264. package/dist/otel/metrics.js +48 -0
  265. package/dist/otel/metrics.js.map +1 -1
  266. package/dist/register.d.ts +4 -0
  267. package/dist/register.js +52 -0
  268. package/dist/register.js.map +1 -0
  269. package/dist/score/__tests__/score.test.d.ts +1 -0
  270. package/dist/score/__tests__/score.test.js +143 -0
  271. package/dist/score/__tests__/score.test.js.map +1 -0
  272. package/dist/score/index.d.ts +2 -0
  273. package/dist/score/index.js +6 -0
  274. package/dist/score/index.js.map +1 -0
  275. package/dist/score/score.d.ts +15 -0
  276. package/dist/score/score.js +135 -0
  277. package/dist/score/score.js.map +1 -0
  278. package/dist/semantic-convention.d.ts +273 -0
  279. package/dist/semantic-convention.js +317 -0
  280. package/dist/semantic-convention.js.map +1 -1
  281. package/dist/types.d.ts +15 -1
  282. package/package.json +18 -1
  283. package/dist/evals/__tests__/anthropic.test.js +0 -9
  284. package/dist/evals/__tests__/anthropic.test.js.map +0 -1
  285. package/dist/evals/__tests__/base.test.js +0 -37
  286. package/dist/evals/__tests__/base.test.js.map +0 -1
  287. package/dist/evals/__tests__/core.test.js +0 -33
  288. package/dist/evals/__tests__/core.test.js.map +0 -1
  289. package/dist/evals/__tests__/metrics.test.js +0 -59
  290. package/dist/evals/__tests__/metrics.test.js.map +0 -1
  291. package/dist/evals/__tests__/openai.test.js +0 -9
  292. package/dist/evals/__tests__/openai.test.js.map +0 -1
  293. package/dist/evals/__tests__/providers.test.js +0 -14
  294. package/dist/evals/__tests__/providers.test.js.map +0 -1
  295. package/dist/evals/__tests__/utils.test.js +0 -46
  296. package/dist/evals/__tests__/utils.test.js.map +0 -1
  297. package/dist/evals/all.d.ts +0 -4
  298. package/dist/evals/all.js +0 -35
  299. package/dist/evals/all.js.map +0 -1
  300. package/dist/evals/base.d.ts +0 -15
  301. package/dist/evals/base.js +0 -51
  302. package/dist/evals/base.js.map +0 -1
  303. package/dist/evals/bias.d.ts +0 -4
  304. package/dist/evals/bias.js +0 -35
  305. package/dist/evals/bias.js.map +0 -1
  306. package/dist/evals/hallucination.d.ts +0 -4
  307. package/dist/evals/hallucination.js +0 -32
  308. package/dist/evals/hallucination.js.map +0 -1
  309. package/dist/evals/llm/anthropic.d.ts +0 -5
  310. package/dist/evals/llm/anthropic.js +0 -42
  311. package/dist/evals/llm/anthropic.js.map +0 -1
  312. package/dist/evals/llm/openai.d.ts +0 -6
  313. package/dist/evals/llm/openai.js +0 -28
  314. package/dist/evals/llm/openai.js.map +0 -1
  315. package/dist/evals/llm/providers.d.ts +0 -7
  316. package/dist/evals/llm/providers.js +0 -10
  317. package/dist/evals/llm/providers.js.map +0 -1
  318. package/dist/evals/metrics.d.ts +0 -9
  319. package/dist/evals/metrics.js +0 -38
  320. package/dist/evals/metrics.js.map +0 -1
  321. package/dist/evals/toxicity.d.ts +0 -4
  322. package/dist/evals/toxicity.js +0 -33
  323. package/dist/evals/toxicity.js.map +0 -1
  324. package/dist/evals/utils.d.ts +0 -4
  325. package/dist/evals/utils.js +0 -39
  326. package/dist/evals/utils.js.map +0 -1
  327. package/dist/guard/__tests__/gaurd.test.js +0 -136
  328. package/dist/guard/__tests__/gaurd.test.js.map +0 -1
  329. package/dist/guard/__tests__/utils.test.js +0 -64
  330. package/dist/guard/__tests__/utils.test.js.map +0 -1
  331. package/dist/guard/all.d.ts +0 -8
  332. package/dist/guard/all.js +0 -28
  333. package/dist/guard/all.js.map +0 -1
  334. package/dist/guard/types.d.ts +0 -26
  335. package/dist/guard/types.js +0 -4
  336. package/dist/guard/types.js.map +0 -1
  337. package/dist/guard/utils.d.ts +0 -13
  338. package/dist/guard/utils.js +0 -79
  339. package/dist/guard/utils.js.map +0 -1
  340. /package/dist/{evals/__tests__/anthropic.test.d.ts → __tests__/manual-trace.test.d.ts} +0 -0
  341. /package/dist/{evals/__tests__/metrics.test.d.ts → __tests__/register.test.d.ts} +0 -0
  342. /package/dist/evals/__tests__/{base.test.d.ts → offline.test.d.ts} +0 -0
  343. /package/dist/{evals/__tests__/core.test.d.ts → guard/__tests__/integration.test.d.ts} +0 -0
  344. /package/dist/{evals/__tests__/openai.test.d.ts → guard/__tests__/pii.test.d.ts} +0 -0
  345. /package/dist/{evals/__tests__/providers.test.d.ts → guard/__tests__/pipeline.test.d.ts} +0 -0
  346. /package/dist/{evals/__tests__/utils.test.d.ts → guard/__tests__/prompt-injection.test.d.ts} +0 -0
  347. /package/dist/{guard/__tests__/gaurd.test.d.ts → instrumentation/__tests__/assemblyai-wrapper.test.d.ts} +0 -0
  348. /package/dist/{guard/__tests__/utils.test.d.ts → instrumentation/__tests__/browser-use-wrapper.test.d.ts} +0 -0
@@ -1,7 +1,22 @@
1
- import { BaseGuard } from './base';
2
- import { GuardConfig, GuardResult } from './types';
3
- export declare class TopicRestriction extends BaseGuard {
4
- constructor(config?: GuardConfig);
5
- protected getSystemPrompt(): string;
6
- detect(text: string): Promise<GuardResult>;
1
+ /**
2
+ * Topic restriction guard.
3
+ *
4
+ * Enforces allow/deny topic lists using a user-provided topic classifier.
5
+ *
6
+ * Must stay in sync with: sdk/python/src/openlit/guard/topic_restriction.py
7
+ */
8
+ import { Guard, GuardPhase, GuardResult, GuardOptions } from './base';
9
+ export interface TopicRestrictionOptions extends GuardOptions {
10
+ classifier: (text: string) => string;
11
+ allowed?: string[];
12
+ denied?: string[];
13
+ }
14
+ export declare class TopicRestriction extends Guard {
15
+ readonly name = "topic_restriction";
16
+ readonly phases: GuardPhase[];
17
+ private readonly _classifier;
18
+ private readonly _allowed;
19
+ private readonly _denied;
20
+ constructor(opts: TopicRestrictionOptions);
21
+ evaluate(text: string): GuardResult;
7
22
  }
@@ -1,74 +1,53 @@
1
1
  "use strict";
2
+ /**
3
+ * Topic restriction guard.
4
+ *
5
+ * Enforces allow/deny topic lists using a user-provided topic classifier.
6
+ *
7
+ * Must stay in sync with: sdk/python/src/openlit/guard/topic_restriction.py
8
+ */
2
9
  Object.defineProperty(exports, "__esModule", { value: true });
3
10
  exports.TopicRestriction = void 0;
4
11
  const base_1 = require("./base");
5
- const utils_1 = require("./utils");
6
- const utils_2 = require("../evals/utils");
7
- const llm_1 = require("../llm");
8
- class TopicRestriction extends base_1.BaseGuard {
9
- constructor(config = {}) {
10
- super(config);
11
- }
12
- getSystemPrompt() {
13
- return [
14
- 'Output Requirement: JSON Format Only',
15
- '',
16
- 'Your task is to carefully analyze the provided text and identify any instances of restricted topics, and categorize the classification when found. Apply strict criteria in your assessment.',
17
- '',
18
- 'Restricted topics include information or requests that are not allowed or are outside the permitted scope for this system.',
19
- '',
20
- 'Presented Text:',
21
- '{{prompt}}',
22
- '',
23
- 'Expected JSON Structure:',
24
- '',
25
- '{',
26
- ' "score": "float",',
27
- ' "verdict": "yes or no",',
28
- ' "guard": "topic_restriction",',
29
- ' "classification": "CATEGORY_OF_TOPIC_RESTRICTION",',
30
- ' "explanation": "Very short one-sentence reason"',
31
- '}',
32
- '',
33
- 'Scoring System:',
34
- '- The score ranges from 0 to 1. Scores should be 0 if the classification is "none". Any other classification must be accompanied by a valid category and a score reflecting the restriction.',
35
- '',
36
- 'Important: Use only the categories below to classify restricted topics. If the text does not fit any listed category, classify it as "none" with a score of 0.',
37
- '',
38
- 'Categories of Restricted Topics (use only these categories):',
39
- '- politics: Requests or discussions about political figures, parties, or policies that are not allowed.',
40
- '- violence: Requests or discussions involving physical harm, aggression, or violent acts.',
41
- '- personal_information: Requests for or mentions of sensitive personal data (e.g., credit card, address, email, phone number).',
42
- '- confidential: Requests for or mentions of confidential or proprietary information.',
43
- '- illegal: Requests or discussions about illegal activities.',
44
- '',
45
- 'Final Steps:',
46
- '- If no restricted topics are detected, or if the topic does not fit into one of the above categories, the return must be: {"score": 0, "verdict": "no", "guard": "none", "classification": "none", "explanation": "none"}.',
47
- ].join('\n');
12
+ class TopicRestriction extends base_1.Guard {
13
+ constructor(opts) {
14
+ super({ action: opts.action ?? 'deny', maxScanLength: opts.maxScanLength });
15
+ this.name = 'topic_restriction';
16
+ this.phases = [base_1.GuardPhase.PREFLIGHT];
17
+ if (typeof opts.classifier !== 'function') {
18
+ throw new base_1.GuardConfigError("TopicRestriction requires a callable 'classifier'");
19
+ }
20
+ if (opts.allowed && opts.denied) {
21
+ throw new base_1.GuardConfigError("Provide either 'allowed' or 'denied', not both");
22
+ }
23
+ if (!opts.allowed && !opts.denied) {
24
+ throw new base_1.GuardConfigError("Provide either 'allowed' or 'denied' topic list");
25
+ }
26
+ this._classifier = opts.classifier;
27
+ this._allowed = opts.allowed ? new Set(opts.allowed.map((t) => t.toLowerCase())) : null;
28
+ this._denied = opts.denied ? new Set(opts.denied.map((t) => t.toLowerCase())) : null;
48
29
  }
49
- async detect(text) {
50
- const customRuleResult = (0, utils_1.customRuleDetection)(text, this.customRules);
51
- let llmResult = {
52
- score: 0,
53
- verdict: 'no',
54
- guard: 'none',
55
- classification: 'none',
56
- explanation: 'none'
57
- };
58
- if (this.provider) {
59
- // Use correct template variable for prompt and satisfy EvalsInput type
60
- const prompt = (0, utils_2.formatPrompt)(this.getSystemPrompt(), { prompt: text, text });
61
- const response = await this.llmResponse(prompt);
62
- llmResult = (0, utils_1.toGuardResult)((0, llm_1.parseLlmResponse)(response), 'topic_restriction');
30
+ evaluate(text) {
31
+ const topic = this._classifier(text).toLowerCase().trim();
32
+ if (this._allowed !== null && !this._allowed.has(topic)) {
33
+ return (0, base_1.makeGuardResult)({
34
+ action: this._action,
35
+ score: 1.0,
36
+ guardName: this.name,
37
+ classification: topic,
38
+ explanation: `Topic '${topic}' is not in the allowed list`,
39
+ });
63
40
  }
64
- let result = customRuleResult.score >= llmResult.score ? customRuleResult : llmResult;
65
- result = (0, utils_1.applyThresholdScore)(result, this.thresholdScore);
66
- // Metrics collection if enabled
67
- if (this.collectMetrics) {
68
- const validator = this.provider || 'custom';
69
- (0, utils_1.guardMetrics)().add(1, (0, utils_1.guardMetricAttributes)(result.verdict, result.score, validator, result.classification, result.explanation));
41
+ if (this._denied !== null && this._denied.has(topic)) {
42
+ return (0, base_1.makeGuardResult)({
43
+ action: this._action,
44
+ score: 1.0,
45
+ guardName: this.name,
46
+ classification: topic,
47
+ explanation: `Topic '${topic}' is in the denied list`,
48
+ });
70
49
  }
71
- return result;
50
+ return (0, base_1.makeGuardResult)({ guardName: this.name, classification: topic });
72
51
  }
73
52
  }
74
53
  exports.TopicRestriction = TopicRestriction;
@@ -1 +1 @@
1
- {"version":3,"file":"topic-restriction.js","sourceRoot":"","sources":["../../src/guard/topic-restriction.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AAEnC,mCAAuH;AACvH,0CAA8C;AAC9C,gCAA0C;AAE1C,MAAa,gBAAiB,SAAQ,gBAAS;IAC7C,YAAY,SAAsB,EAAE;QAClC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAES,eAAe;QACvB,OAAO;YACL,sCAAsC;YACtC,EAAE;YACF,8LAA8L;YAC9L,EAAE;YACF,4HAA4H;YAC5H,EAAE;YACF,iBAAiB;YACjB,YAAY;YACZ,EAAE;YACF,0BAA0B;YAC1B,EAAE;YACF,GAAG;YACH,uBAAuB;YACvB,6BAA6B;YAC7B,mCAAmC;YACnC,wDAAwD;YACxD,qDAAqD;YACrD,GAAG;YACH,EAAE;YACF,iBAAiB;YACjB,8LAA8L;YAC9L,EAAE;YACF,gKAAgK;YAChK,EAAE;YACF,8DAA8D;YAC9D,yGAAyG;YACzG,2FAA2F;YAC3F,gIAAgI;YAChI,sFAAsF;YACtF,8DAA8D;YAC9D,EAAE;YACF,cAAc;YACd,6NAA6N;SAC9N,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY;QACvB,MAAM,gBAAgB,GAAG,IAAA,2BAAmB,EAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACrE,IAAI,SAAS,GAAgB;YAC3B,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,MAAM;YACb,cAAc,EAAE,MAAM;YACtB,WAAW,EAAE,MAAM;SACpB,CAAC;QACF,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,uEAAuE;YACvE,MAAM,MAAM,GAAG,IAAA,oBAAY,EAAC,IAAI,CAAC,eAAe,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YAC5E,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAChD,SAAS,GAAG,IAAA,qBAAa,EAAC,IAAA,sBAAgB,EAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,CAAC;QAC7E,CAAC;QACD,IAAI,MAAM,GAAG,gBAAgB,CAAC,KAAK,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC;QACtF,MAAM,GAAG,IAAA,2BAAmB,EAAC,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAE1D,gCAAgC;QAChC,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC;YAC5C,IAAA,oBAAY,GAAE,CAAC,GAAG,CAAC,CAAC,EAAE,IAAA,6BAAqB,EAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;QACnI,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AApED,4CAoEC"}
1
+ {"version":3,"file":"topic-restriction.js","sourceRoot":"","sources":["../../src/guard/topic-restriction.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAyG;AAQzG,MAAa,gBAAiB,SAAQ,YAAK;IAQzC,YAAY,IAA6B;QACvC,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QARrE,SAAI,GAAG,mBAAmB,CAAC;QAC3B,WAAM,GAAG,CAAC,iBAAU,CAAC,SAAS,CAAC,CAAC;QASvC,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;YAC1C,MAAM,IAAI,uBAAgB,CAAC,mDAAmD,CAAC,CAAC;QAClF,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChC,MAAM,IAAI,uBAAgB,CAAC,gDAAgD,CAAC,CAAC;QAC/E,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YAClC,MAAM,IAAI,uBAAgB,CAAC,iDAAiD,CAAC,CAAC;QAChF,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACxF,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACvF,CAAC;IAED,QAAQ,CAAC,IAAY;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAE1D,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACxD,OAAO,IAAA,sBAAe,EAAC;gBACrB,MAAM,EAAE,IAAI,CAAC,OAAO;gBACpB,KAAK,EAAE,GAAG;gBACV,SAAS,EAAE,IAAI,CAAC,IAAI;gBACpB,cAAc,EAAE,KAAK;gBACrB,WAAW,EAAE,UAAU,KAAK,8BAA8B;aAC3D,CAAC,CAAC;QACL,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACrD,OAAO,IAAA,sBAAe,EAAC;gBACrB,MAAM,EAAE,IAAI,CAAC,OAAO;gBACpB,KAAK,EAAE,GAAG;gBACV,SAAS,EAAE,IAAI,CAAC,IAAI;gBACpB,cAAc,EAAE,KAAK;gBACrB,WAAW,EAAE,UAAU,KAAK,yBAAyB;aACtD,CAAC,CAAC;QACL,CAAC;QAED,OAAO,IAAA,sBAAe,EAAC,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1E,CAAC;CACF;AAnDD,4CAmDC"}
package/dist/helpers.d.ts CHANGED
@@ -22,6 +22,52 @@ export declare function setFrameworkLlmActive(): void;
22
22
  * Mirrors Python's ContextVar.reset(token) in Strands processor.
23
23
  */
24
24
  export declare function resetFrameworkLlmActive(): void;
25
+ /**
26
+ * Returns the user-supplied agent version label set via
27
+ * `OpenLit.setAgentVersion()` / `runWithAgentVersion()`, if any.
28
+ *
29
+ * Provider wrappers stamp this on `gen_ai.agent.version` so the server-side
30
+ * materializer can group traces by the user's preferred label in addition to
31
+ * the auto-computed `openlit.agent.version_hash` fingerprint.
32
+ */
33
+ export declare function getCurrentAgentVersion(): string | undefined;
34
+ /**
35
+ * Set the agent version label for the current execution context.
36
+ *
37
+ * IMPORTANT: this uses `AsyncLocalStorage.enterWith` which permanently
38
+ * mutates the current async resource. Sequential requests handled on the
39
+ * same Node worker (or reused thread/connection) will inherit the label
40
+ * until something overwrites or clears it. **Always pair with a matching
41
+ * `resetAgentVersion()` in a `finally` block**, or prefer
42
+ * `runWithAgentVersion(label, fn)` which guarantees scoped cleanup.
43
+ *
44
+ * @example
45
+ * try {
46
+ * setAgentVersion('hotfix-2026-05-12');
47
+ * await runAgent();
48
+ * } finally {
49
+ * resetAgentVersion();
50
+ * }
51
+ *
52
+ * @example
53
+ * // Preferred — automatic scope cleanup, no leak risk:
54
+ * await runWithAgentVersion('hotfix-2026-05-12', () => runAgent());
55
+ */
56
+ export declare function setAgentVersion(version: string): void;
57
+ /**
58
+ * Clear the agent version label set by `setAgentVersion()`. No-op if no
59
+ * label is active. See the `setAgentVersion` docstring for the leak
60
+ * scenario this guards against.
61
+ */
62
+ export declare function resetAgentVersion(): void;
63
+ /**
64
+ * Run `fn` with the given agent version label bound to the current async
65
+ * scope. Mirrors `openlit.agent_version_context()` in Python and is the
66
+ * recommended way to attach a label — the store is automatically restored
67
+ * when `fn` resolves so there is no risk of leaking the label across
68
+ * subsequent requests.
69
+ */
70
+ export declare function runWithAgentVersion<T>(version: string, fn: () => T): T;
25
71
  /**
26
72
  * Returns true when a LangGraph wrapper is controlling execution.
27
73
  * LangChain's callback handler skips its own invoke_workflow span when true.
@@ -56,6 +102,11 @@ export declare function setFrameworkParentContext(ctx: Context): void;
56
102
  */
57
103
  export declare function clearFrameworkParentContext(): void;
58
104
  export declare function getServerAddressForProvider(provider: string): [string, number];
105
+ /** LangChain/LangGraph message type → OTel GenAI role (mirrors Python LANGCHAIN_ROLE_MAPPING). */
106
+ export declare const LANGCHAIN_ROLE_MAP: Record<string, string>;
107
+ export declare const OTEL_ASSISTANT_ROLE: string;
108
+ /** Map a raw LangChain message type/role to the OTel GenAI convention value. */
109
+ export declare function mapLangChainRole(rawRole: string | undefined | null): string;
59
110
  /**
60
111
  * Apply global (from init) and context-scoped (from usingAttributes /
61
112
  * injectAdditionalAttributes) custom attributes to a span.
@@ -89,16 +140,96 @@ export default class OpenLitHelper {
89
140
  static readonly PROMPT_TOKEN_FACTOR = 1000;
90
141
  static openaiTokens(text: string, model: string): number;
91
142
  static generalTokens(text: string): number;
92
- static getChatModelCost(model: string, pricingInfo: any, promptTokens: number, completionTokens: number): number;
143
+ /**
144
+ * Compute chat completion cost, optionally accounting for prompt-cache tokens.
145
+ *
146
+ * When the model's pricing entry defines `cacheReadPrice` / `cacheCreationPrice`,
147
+ * the matching cache tokens are billed at those rates instead of the regular
148
+ * prompt price.
149
+ *
150
+ * Token accounting differs across providers:
151
+ * - Anthropic's native API reports `promptTokens` exclusive of cache tokens,
152
+ * so cache tokens are added on top (keep `promptTokensIncludeCache` false).
153
+ * - OpenAI / LangChain report `promptTokens` inclusive of cache read tokens,
154
+ * so pass `promptTokensIncludeCache: true` to subtract the re-priced cache
155
+ * tokens from the prompt base and avoid billing them twice.
156
+ *
157
+ * Cache tokens are only re-priced (and, when inclusive, only subtracted) when a
158
+ * dedicated cache price exists, so the result is identical to the legacy
159
+ * behaviour for any model without cache pricing configured.
160
+ */
161
+ static getChatModelCost(model: string, pricingInfo: any, promptTokens: number, completionTokens: number, cacheReadTokens?: number, cacheCreationTokens?: number, promptTokensIncludeCache?: boolean): number;
93
162
  static getEmbedModelCost(model: string, pricingInfo: any, promptTokens: number): number;
94
163
  static getImageModelCost(model: string, pricingInfo: any, size: string, quality: number): number;
95
- static getAudioModelCost(model: string, pricingInfo: any, prompt: string): number;
164
+ static getAudioModelCost(model: string, pricingInfo: any, prompt: string, duration?: number): number;
96
165
  static fetchPricingInfo(pricingJson: any): Promise<any>;
97
166
  /**
98
167
  * Build OTel-spec input messages JSON string from provider messages array.
99
168
  * Format: [{"role": "user", "parts": [{"type": "text", "content": "..."}]}]
100
169
  */
101
170
  static buildInputMessages(messages: any[], system?: string): string;
171
+ /**
172
+ * Extract system message(s) from a chat-completions messages array.
173
+ * Returns an OTel ``gen_ai.system_instructions`` payload
174
+ * (``[{"type": "text", "content": "..."}]``) JSON-encoded as a string,
175
+ * or ``undefined`` when no system message is present.
176
+ *
177
+ * Mirrors Python's ``build_system_instructions_from_messages``.
178
+ */
179
+ static buildSystemInstructionsFromMessages(messages: any[]): string | undefined;
180
+ /**
181
+ * Normalize a request ``tools`` array into the OTel
182
+ * ``gen_ai.tool.definitions`` schema and return it as a JSON string,
183
+ * or ``undefined`` when there is nothing usable.
184
+ *
185
+ * Accepts both the OpenAI-style schema
186
+ * (``{"type": "function", "function": {...}}``) and the flat schema
187
+ * (``{"name": ..., "description": ..., "parameters": ...}``), and
188
+ * Anthropic's ``input_schema`` synonym for ``parameters``.
189
+ *
190
+ * Mirrors Python's ``build_tool_definitions``.
191
+ */
192
+ static buildToolDefinitions(tools: any): string | undefined;
193
+ /**
194
+ * Compute the canonical agent-version fingerprint.
195
+ *
196
+ * Mirrors `fingerprint()` in
197
+ * `src/client/src/lib/platform/agents/snapshot.ts` so that the SDK stamps
198
+ * `openlit.agent.version_hash` with the same value the server-side
199
+ * materializer derives from `otel_traces`. The hash covers the parts that
200
+ * meaningfully change agent behavior: system prompt, tool set (name +
201
+ * schema), primary model, and sampling config.
202
+ *
203
+ * Accepts the same shapes used by the SDK chat finalizers:
204
+ * - `systemInstructions`: the JSON string emitted on
205
+ * `gen_ai.system_instructions`, the original list of `{type,content}`
206
+ * parts, or a plain string.
207
+ * - `toolDefinitions`: the JSON string emitted on
208
+ * `gen_ai.tool.definitions`, or the original list of
209
+ * `{type, name, description, parameters}` items.
210
+ */
211
+ static computeAgentVersionHash(args: {
212
+ systemInstructions?: string | unknown[] | null;
213
+ toolDefinitions?: string | unknown[] | null;
214
+ primaryModel?: string | null;
215
+ runtimeConfig?: {
216
+ temperature?: number | null;
217
+ top_p?: number | null;
218
+ max_tokens?: number | null;
219
+ provider?: string | null;
220
+ } | null;
221
+ providers?: string[] | null;
222
+ }): string;
223
+ private static readonly _VERSION_HASH_CACHE_MAX;
224
+ private static _versionHashCache;
225
+ /**
226
+ * Build a stable, cheap cache key for the version-hash memoization. Uses
227
+ * `JSON.stringify` of inputs (orders-of-magnitude cheaper than the full
228
+ * canonical pass we want to skip on a cache hit). Returns `null` if
229
+ * inputs can't be stringified (circular refs etc.) — the caller falls
230
+ * back to uncached computation.
231
+ */
232
+ private static _buildAgentVersionCacheKey;
102
233
  /**
103
234
  * Build OTel-spec output messages JSON string from provider response.
104
235
  * Format: [{"role": "assistant", "parts": [{"type": "text", "content": "..."}], "finish_reason": "stop"}]