shield360 1.0.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 (520) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +310 -0
  3. package/dist/__tests__/manual-trace.test.d.ts +1 -0
  4. package/dist/__tests__/manual-trace.test.js +118 -0
  5. package/dist/__tests__/manual-trace.test.js.map +1 -0
  6. package/dist/__tests__/register.test.d.ts +0 -0
  7. package/dist/__tests__/register.test.js +90 -0
  8. package/dist/__tests__/register.test.js.map +1 -0
  9. package/dist/config.d.ts +28 -0
  10. package/dist/config.js +22 -0
  11. package/dist/config.js.map +1 -0
  12. package/dist/constant.d.ts +6 -0
  13. package/dist/constant.js +14 -0
  14. package/dist/constant.js.map +1 -0
  15. package/dist/evals/__tests__/offline.test.d.ts +1 -0
  16. package/dist/evals/__tests__/offline.test.js +427 -0
  17. package/dist/evals/__tests__/offline.test.js.map +1 -0
  18. package/dist/evals/index.d.ts +2 -0
  19. package/dist/evals/index.js +15 -0
  20. package/dist/evals/index.js.map +1 -0
  21. package/dist/evals/offline.d.ts +6 -0
  22. package/dist/evals/offline.js +350 -0
  23. package/dist/evals/offline.js.map +1 -0
  24. package/dist/evals/types.d.ts +74 -0
  25. package/dist/evals/types.js +23 -0
  26. package/dist/evals/types.js.map +1 -0
  27. package/dist/features/__tests__/rule-engine.test.d.ts +1 -0
  28. package/dist/features/__tests__/rule-engine.test.js +146 -0
  29. package/dist/features/__tests__/rule-engine.test.js.map +1 -0
  30. package/dist/features/base.d.ts +8 -0
  31. package/dist/features/base.js +15 -0
  32. package/dist/features/base.js.map +1 -0
  33. package/dist/features/prompt-hub.d.ts +4 -0
  34. package/dist/features/prompt-hub.js +66 -0
  35. package/dist/features/prompt-hub.js.map +1 -0
  36. package/dist/features/rule-engine.d.ts +6 -0
  37. package/dist/features/rule-engine.js +60 -0
  38. package/dist/features/rule-engine.js.map +1 -0
  39. package/dist/features/vault.d.ts +4 -0
  40. package/dist/features/vault.js +63 -0
  41. package/dist/features/vault.js.map +1 -0
  42. package/dist/guard/__tests__/findings.test.d.ts +1 -0
  43. package/dist/guard/__tests__/findings.test.js +79 -0
  44. package/dist/guard/__tests__/findings.test.js.map +1 -0
  45. package/dist/guard/__tests__/integration.test.d.ts +1 -0
  46. package/dist/guard/__tests__/integration.test.js +215 -0
  47. package/dist/guard/__tests__/integration.test.js.map +1 -0
  48. package/dist/guard/__tests__/pii.test.d.ts +1 -0
  49. package/dist/guard/__tests__/pii.test.js +131 -0
  50. package/dist/guard/__tests__/pii.test.js.map +1 -0
  51. package/dist/guard/__tests__/pipeline.test.d.ts +1 -0
  52. package/dist/guard/__tests__/pipeline.test.js +162 -0
  53. package/dist/guard/__tests__/pipeline.test.js.map +1 -0
  54. package/dist/guard/__tests__/prompt-injection.test.d.ts +1 -0
  55. package/dist/guard/__tests__/prompt-injection.test.js +92 -0
  56. package/dist/guard/__tests__/prompt-injection.test.js.map +1 -0
  57. package/dist/guard/__tests__/report.test.d.ts +1 -0
  58. package/dist/guard/__tests__/report.test.js +50 -0
  59. package/dist/guard/__tests__/report.test.js.map +1 -0
  60. package/dist/guard/base.d.ts +79 -0
  61. package/dist/guard/base.js +136 -0
  62. package/dist/guard/base.js.map +1 -0
  63. package/dist/guard/custom.d.ts +19 -0
  64. package/dist/guard/custom.js +46 -0
  65. package/dist/guard/custom.js.map +1 -0
  66. package/dist/guard/findings.d.ts +31 -0
  67. package/dist/guard/findings.js +156 -0
  68. package/dist/guard/findings.js.map +1 -0
  69. package/dist/guard/index.d.ts +24 -0
  70. package/dist/guard/index.js +42 -0
  71. package/dist/guard/index.js.map +1 -0
  72. package/dist/guard/integration.d.ts +44 -0
  73. package/dist/guard/integration.js +363 -0
  74. package/dist/guard/integration.js.map +1 -0
  75. package/dist/guard/moderation.d.ts +18 -0
  76. package/dist/guard/moderation.js +61 -0
  77. package/dist/guard/moderation.js.map +1 -0
  78. package/dist/guard/pii.d.ts +17 -0
  79. package/dist/guard/pii.js +114 -0
  80. package/dist/guard/pii.js.map +1 -0
  81. package/dist/guard/pipeline.d.ts +26 -0
  82. package/dist/guard/pipeline.js +139 -0
  83. package/dist/guard/pipeline.js.map +1 -0
  84. package/dist/guard/prompt-injection.d.ts +21 -0
  85. package/dist/guard/prompt-injection.js +70 -0
  86. package/dist/guard/prompt-injection.js.map +1 -0
  87. package/dist/guard/report.d.ts +34 -0
  88. package/dist/guard/report.js +182 -0
  89. package/dist/guard/report.js.map +1 -0
  90. package/dist/guard/schema.d.ts +20 -0
  91. package/dist/guard/schema.js +99 -0
  92. package/dist/guard/schema.js.map +1 -0
  93. package/dist/guard/sensitive-topic.d.ts +23 -0
  94. package/dist/guard/sensitive-topic.js +89 -0
  95. package/dist/guard/sensitive-topic.js.map +1 -0
  96. package/dist/guard/topic-restriction.d.ts +22 -0
  97. package/dist/guard/topic-restriction.js +54 -0
  98. package/dist/guard/topic-restriction.js.map +1 -0
  99. package/dist/helpers.d.ts +246 -0
  100. package/dist/helpers.js +903 -0
  101. package/dist/helpers.js.map +1 -0
  102. package/dist/index.d.ts +71 -0
  103. package/dist/index.js +234 -0
  104. package/dist/index.js.map +1 -0
  105. package/dist/instrumentation/__tests__/ai21-rag-trace-comparison.test.d.ts +13 -0
  106. package/dist/instrumentation/__tests__/ai21-rag-trace-comparison.test.js +176 -0
  107. package/dist/instrumentation/__tests__/ai21-rag-trace-comparison.test.js.map +1 -0
  108. package/dist/instrumentation/__tests__/ai21-trace-comparison.test.d.ts +10 -0
  109. package/dist/instrumentation/__tests__/ai21-trace-comparison.test.js +203 -0
  110. package/dist/instrumentation/__tests__/ai21-trace-comparison.test.js.map +1 -0
  111. package/dist/instrumentation/__tests__/anthropic-wrapper.test.d.ts +1 -0
  112. package/dist/instrumentation/__tests__/anthropic-wrapper.test.js +284 -0
  113. package/dist/instrumentation/__tests__/anthropic-wrapper.test.js.map +1 -0
  114. package/dist/instrumentation/__tests__/assemblyai-wrapper.test.d.ts +1 -0
  115. package/dist/instrumentation/__tests__/assemblyai-wrapper.test.js +284 -0
  116. package/dist/instrumentation/__tests__/assemblyai-wrapper.test.js.map +1 -0
  117. package/dist/instrumentation/__tests__/astra-trace-comparison.test.d.ts +7 -0
  118. package/dist/instrumentation/__tests__/astra-trace-comparison.test.js +160 -0
  119. package/dist/instrumentation/__tests__/astra-trace-comparison.test.js.map +1 -0
  120. package/dist/instrumentation/__tests__/base-wrapper.test.d.ts +1 -0
  121. package/dist/instrumentation/__tests__/base-wrapper.test.js +171 -0
  122. package/dist/instrumentation/__tests__/base-wrapper.test.js.map +1 -0
  123. package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.d.ts +1 -0
  124. package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.js +422 -0
  125. package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.js.map +1 -0
  126. package/dist/instrumentation/__tests__/browser-use-wrapper.test.d.ts +1 -0
  127. package/dist/instrumentation/__tests__/browser-use-wrapper.test.js +284 -0
  128. package/dist/instrumentation/__tests__/browser-use-wrapper.test.js.map +1 -0
  129. package/dist/instrumentation/__tests__/cache-pricing.test.d.ts +15 -0
  130. package/dist/instrumentation/__tests__/cache-pricing.test.js +155 -0
  131. package/dist/instrumentation/__tests__/cache-pricing.test.js.map +1 -0
  132. package/dist/instrumentation/__tests__/chroma-trace-comparison.test.d.ts +18 -0
  133. package/dist/instrumentation/__tests__/chroma-trace-comparison.test.js +209 -0
  134. package/dist/instrumentation/__tests__/chroma-trace-comparison.test.js.map +1 -0
  135. package/dist/instrumentation/__tests__/cohere-wrapper.test.d.ts +1 -0
  136. package/dist/instrumentation/__tests__/cohere-wrapper.test.js +256 -0
  137. package/dist/instrumentation/__tests__/cohere-wrapper.test.js.map +1 -0
  138. package/dist/instrumentation/__tests__/elevenlabs-wrapper.test.d.ts +1 -0
  139. package/dist/instrumentation/__tests__/elevenlabs-wrapper.test.js +282 -0
  140. package/dist/instrumentation/__tests__/elevenlabs-wrapper.test.js.map +1 -0
  141. package/dist/instrumentation/__tests__/firecrawl-wrapper.test.d.ts +1 -0
  142. package/dist/instrumentation/__tests__/firecrawl-wrapper.test.js +238 -0
  143. package/dist/instrumentation/__tests__/firecrawl-wrapper.test.js.map +1 -0
  144. package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.d.ts +4 -0
  145. package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.js +229 -0
  146. package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.js.map +1 -0
  147. package/dist/instrumentation/__tests__/gpu-collector.test.d.ts +1 -0
  148. package/dist/instrumentation/__tests__/gpu-collector.test.js +247 -0
  149. package/dist/instrumentation/__tests__/gpu-collector.test.js.map +1 -0
  150. package/dist/instrumentation/__tests__/gradient-trace-comparison.test.d.ts +11 -0
  151. package/dist/instrumentation/__tests__/gradient-trace-comparison.test.js +391 -0
  152. package/dist/instrumentation/__tests__/gradient-trace-comparison.test.js.map +1 -0
  153. package/dist/instrumentation/__tests__/groq-trace-comparison.test.d.ts +7 -0
  154. package/dist/instrumentation/__tests__/groq-trace-comparison.test.js +687 -0
  155. package/dist/instrumentation/__tests__/groq-trace-comparison.test.js.map +1 -0
  156. package/dist/instrumentation/__tests__/helpers-genai.test.d.ts +14 -0
  157. package/dist/instrumentation/__tests__/helpers-genai.test.js +347 -0
  158. package/dist/instrumentation/__tests__/helpers-genai.test.js.map +1 -0
  159. package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.d.ts +7 -0
  160. package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.js +529 -0
  161. package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.js.map +1 -0
  162. package/dist/instrumentation/__tests__/langchain-role-map.test.d.ts +1 -0
  163. package/dist/instrumentation/__tests__/langchain-role-map.test.js +19 -0
  164. package/dist/instrumentation/__tests__/langchain-role-map.test.js.map +1 -0
  165. package/dist/instrumentation/__tests__/langchain-wrapper.test.d.ts +1 -0
  166. package/dist/instrumentation/__tests__/langchain-wrapper.test.js +282 -0
  167. package/dist/instrumentation/__tests__/langchain-wrapper.test.js.map +1 -0
  168. package/dist/instrumentation/__tests__/letta-wrapper.test.d.ts +1 -0
  169. package/dist/instrumentation/__tests__/letta-wrapper.test.js +285 -0
  170. package/dist/instrumentation/__tests__/letta-wrapper.test.js.map +1 -0
  171. package/dist/instrumentation/__tests__/mem0-trace-comparison.test.d.ts +13 -0
  172. package/dist/instrumentation/__tests__/mem0-trace-comparison.test.js +208 -0
  173. package/dist/instrumentation/__tests__/mem0-trace-comparison.test.js.map +1 -0
  174. package/dist/instrumentation/__tests__/milvus-trace-comparison.test.d.ts +17 -0
  175. package/dist/instrumentation/__tests__/milvus-trace-comparison.test.js +206 -0
  176. package/dist/instrumentation/__tests__/milvus-trace-comparison.test.js.map +1 -0
  177. package/dist/instrumentation/__tests__/mistral-trace-comparison.test.d.ts +1 -0
  178. package/dist/instrumentation/__tests__/mistral-trace-comparison.test.js +345 -0
  179. package/dist/instrumentation/__tests__/mistral-trace-comparison.test.js.map +1 -0
  180. package/dist/instrumentation/__tests__/openai-wrapper.test.d.ts +1 -0
  181. package/dist/instrumentation/__tests__/openai-wrapper.test.js +179 -0
  182. package/dist/instrumentation/__tests__/openai-wrapper.test.js.map +1 -0
  183. package/dist/instrumentation/__tests__/pg-trace-comparison.test.d.ts +21 -0
  184. package/dist/instrumentation/__tests__/pg-trace-comparison.test.js +455 -0
  185. package/dist/instrumentation/__tests__/pg-trace-comparison.test.js.map +1 -0
  186. package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.d.ts +17 -0
  187. package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.js +182 -0
  188. package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.js.map +1 -0
  189. package/dist/instrumentation/__tests__/replicate-trace-comparison.test.d.ts +8 -0
  190. package/dist/instrumentation/__tests__/replicate-trace-comparison.test.js +346 -0
  191. package/dist/instrumentation/__tests__/replicate-trace-comparison.test.js.map +1 -0
  192. package/dist/instrumentation/__tests__/together-trace-comparison.test.d.ts +4 -0
  193. package/dist/instrumentation/__tests__/together-trace-comparison.test.js +289 -0
  194. package/dist/instrumentation/__tests__/together-trace-comparison.test.js.map +1 -0
  195. package/dist/instrumentation/__tests__/trace-comparison-utils.d.ts +67 -0
  196. package/dist/instrumentation/__tests__/trace-comparison-utils.js +255 -0
  197. package/dist/instrumentation/__tests__/trace-comparison-utils.js.map +1 -0
  198. package/dist/instrumentation/__tests__/transformers-trace-comparison.test.d.ts +11 -0
  199. package/dist/instrumentation/__tests__/transformers-trace-comparison.test.js +214 -0
  200. package/dist/instrumentation/__tests__/transformers-trace-comparison.test.js.map +1 -0
  201. package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.d.ts +8 -0
  202. package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.js +446 -0
  203. package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.js.map +1 -0
  204. package/dist/instrumentation/__tests__/vertexai-trace-comparison.test.d.ts +6 -0
  205. package/dist/instrumentation/__tests__/vertexai-trace-comparison.test.js +409 -0
  206. package/dist/instrumentation/__tests__/vertexai-trace-comparison.test.js.map +1 -0
  207. package/dist/instrumentation/__tests__/vllm-trace-comparison.test.d.ts +1 -0
  208. package/dist/instrumentation/__tests__/vllm-trace-comparison.test.js +519 -0
  209. package/dist/instrumentation/__tests__/vllm-trace-comparison.test.js.map +1 -0
  210. package/dist/instrumentation/ai21/index.d.ts +11 -0
  211. package/dist/instrumentation/ai21/index.js +67 -0
  212. package/dist/instrumentation/ai21/index.js.map +1 -0
  213. package/dist/instrumentation/ai21/wrapper.d.ts +54 -0
  214. package/dist/instrumentation/ai21/wrapper.js +511 -0
  215. package/dist/instrumentation/ai21/wrapper.js.map +1 -0
  216. package/dist/instrumentation/anthropic/index.d.ts +11 -0
  217. package/dist/instrumentation/anthropic/index.js +45 -0
  218. package/dist/instrumentation/anthropic/index.js.map +1 -0
  219. package/dist/instrumentation/anthropic/wrapper.d.ts +34 -0
  220. package/dist/instrumentation/anthropic/wrapper.js +426 -0
  221. package/dist/instrumentation/anthropic/wrapper.js.map +1 -0
  222. package/dist/instrumentation/assemblyai/index.d.ts +12 -0
  223. package/dist/instrumentation/assemblyai/index.js +91 -0
  224. package/dist/instrumentation/assemblyai/index.js.map +1 -0
  225. package/dist/instrumentation/assemblyai/wrapper.d.ts +35 -0
  226. package/dist/instrumentation/assemblyai/wrapper.js +238 -0
  227. package/dist/instrumentation/assemblyai/wrapper.js.map +1 -0
  228. package/dist/instrumentation/astra/index.d.ts +11 -0
  229. package/dist/instrumentation/astra/index.js +87 -0
  230. package/dist/instrumentation/astra/index.js.map +1 -0
  231. package/dist/instrumentation/astra/wrapper.d.ts +39 -0
  232. package/dist/instrumentation/astra/wrapper.js +349 -0
  233. package/dist/instrumentation/astra/wrapper.js.map +1 -0
  234. package/dist/instrumentation/azure-ai-inference/index.d.ts +11 -0
  235. package/dist/instrumentation/azure-ai-inference/index.js +76 -0
  236. package/dist/instrumentation/azure-ai-inference/index.js.map +1 -0
  237. package/dist/instrumentation/azure-ai-inference/wrapper.d.ts +55 -0
  238. package/dist/instrumentation/azure-ai-inference/wrapper.js +580 -0
  239. package/dist/instrumentation/azure-ai-inference/wrapper.js.map +1 -0
  240. package/dist/instrumentation/base-wrapper.d.ts +16 -0
  241. package/dist/instrumentation/base-wrapper.js +139 -0
  242. package/dist/instrumentation/base-wrapper.js.map +1 -0
  243. package/dist/instrumentation/bedrock/index.d.ts +11 -0
  244. package/dist/instrumentation/bedrock/index.js +52 -0
  245. package/dist/instrumentation/bedrock/index.js.map +1 -0
  246. package/dist/instrumentation/bedrock/wrapper.d.ts +41 -0
  247. package/dist/instrumentation/bedrock/wrapper.js +494 -0
  248. package/dist/instrumentation/bedrock/wrapper.js.map +1 -0
  249. package/dist/instrumentation/browser-use/index.d.ts +11 -0
  250. package/dist/instrumentation/browser-use/index.js +98 -0
  251. package/dist/instrumentation/browser-use/index.js.map +1 -0
  252. package/dist/instrumentation/browser-use/wrapper.d.ts +12 -0
  253. package/dist/instrumentation/browser-use/wrapper.js +706 -0
  254. package/dist/instrumentation/browser-use/wrapper.js.map +1 -0
  255. package/dist/instrumentation/chroma/index.d.ts +11 -0
  256. package/dist/instrumentation/chroma/index.js +70 -0
  257. package/dist/instrumentation/chroma/index.js.map +1 -0
  258. package/dist/instrumentation/chroma/wrapper.d.ts +10 -0
  259. package/dist/instrumentation/chroma/wrapper.js +127 -0
  260. package/dist/instrumentation/chroma/wrapper.js.map +1 -0
  261. package/dist/instrumentation/claude-agent-sdk/index.d.ts +23 -0
  262. package/dist/instrumentation/claude-agent-sdk/index.js +83 -0
  263. package/dist/instrumentation/claude-agent-sdk/index.js.map +1 -0
  264. package/dist/instrumentation/claude-agent-sdk/wrapper.d.ts +13 -0
  265. package/dist/instrumentation/claude-agent-sdk/wrapper.js +1123 -0
  266. package/dist/instrumentation/claude-agent-sdk/wrapper.js.map +1 -0
  267. package/dist/instrumentation/cohere/index.d.ts +11 -0
  268. package/dist/instrumentation/cohere/index.js +53 -0
  269. package/dist/instrumentation/cohere/index.js.map +1 -0
  270. package/dist/instrumentation/cohere/wrapper.d.ts +50 -0
  271. package/dist/instrumentation/cohere/wrapper.js +452 -0
  272. package/dist/instrumentation/cohere/wrapper.js.map +1 -0
  273. package/dist/instrumentation/cursor-sdk/index.d.ts +21 -0
  274. package/dist/instrumentation/cursor-sdk/index.js +58 -0
  275. package/dist/instrumentation/cursor-sdk/index.js.map +1 -0
  276. package/dist/instrumentation/cursor-sdk/wrapper.d.ts +17 -0
  277. package/dist/instrumentation/cursor-sdk/wrapper.js +789 -0
  278. package/dist/instrumentation/cursor-sdk/wrapper.js.map +1 -0
  279. package/dist/instrumentation/elevenlabs/index.d.ts +12 -0
  280. package/dist/instrumentation/elevenlabs/index.js +92 -0
  281. package/dist/instrumentation/elevenlabs/index.js.map +1 -0
  282. package/dist/instrumentation/elevenlabs/wrapper.d.ts +34 -0
  283. package/dist/instrumentation/elevenlabs/wrapper.js +280 -0
  284. package/dist/instrumentation/elevenlabs/wrapper.js.map +1 -0
  285. package/dist/instrumentation/firecrawl/index.d.ts +13 -0
  286. package/dist/instrumentation/firecrawl/index.js +115 -0
  287. package/dist/instrumentation/firecrawl/index.js.map +1 -0
  288. package/dist/instrumentation/firecrawl/wrapper.d.ts +22 -0
  289. package/dist/instrumentation/firecrawl/wrapper.js +378 -0
  290. package/dist/instrumentation/firecrawl/wrapper.js.map +1 -0
  291. package/dist/instrumentation/google-adk/index.d.ts +57 -0
  292. package/dist/instrumentation/google-adk/index.js +371 -0
  293. package/dist/instrumentation/google-adk/index.js.map +1 -0
  294. package/dist/instrumentation/google-adk/utils.d.ts +45 -0
  295. package/dist/instrumentation/google-adk/utils.js +663 -0
  296. package/dist/instrumentation/google-adk/utils.js.map +1 -0
  297. package/dist/instrumentation/google-adk/wrapper.d.ts +11 -0
  298. package/dist/instrumentation/google-adk/wrapper.js +391 -0
  299. package/dist/instrumentation/google-adk/wrapper.js.map +1 -0
  300. package/dist/instrumentation/google-ai/index.d.ts +11 -0
  301. package/dist/instrumentation/google-ai/index.js +48 -0
  302. package/dist/instrumentation/google-ai/index.js.map +1 -0
  303. package/dist/instrumentation/google-ai/wrapper.d.ts +52 -0
  304. package/dist/instrumentation/google-ai/wrapper.js +466 -0
  305. package/dist/instrumentation/google-ai/wrapper.js.map +1 -0
  306. package/dist/instrumentation/gpu/index.d.ts +38 -0
  307. package/dist/instrumentation/gpu/index.js +233 -0
  308. package/dist/instrumentation/gpu/index.js.map +1 -0
  309. package/dist/instrumentation/gradient/index.d.ts +12 -0
  310. package/dist/instrumentation/gradient/index.js +74 -0
  311. package/dist/instrumentation/gradient/index.js.map +1 -0
  312. package/dist/instrumentation/gradient/utils.d.ts +14 -0
  313. package/dist/instrumentation/gradient/utils.js +119 -0
  314. package/dist/instrumentation/gradient/utils.js.map +1 -0
  315. package/dist/instrumentation/gradient/wrapper.d.ts +76 -0
  316. package/dist/instrumentation/gradient/wrapper.js +584 -0
  317. package/dist/instrumentation/gradient/wrapper.js.map +1 -0
  318. package/dist/instrumentation/groq/index.d.ts +11 -0
  319. package/dist/instrumentation/groq/index.js +43 -0
  320. package/dist/instrumentation/groq/index.js.map +1 -0
  321. package/dist/instrumentation/groq/wrapper.d.ts +35 -0
  322. package/dist/instrumentation/groq/wrapper.js +442 -0
  323. package/dist/instrumentation/groq/wrapper.js.map +1 -0
  324. package/dist/instrumentation/huggingface/index.d.ts +13 -0
  325. package/dist/instrumentation/huggingface/index.js +110 -0
  326. package/dist/instrumentation/huggingface/index.js.map +1 -0
  327. package/dist/instrumentation/huggingface/wrapper.d.ts +54 -0
  328. package/dist/instrumentation/huggingface/wrapper.js +514 -0
  329. package/dist/instrumentation/huggingface/wrapper.js.map +1 -0
  330. package/dist/instrumentation/index.d.ts +7 -0
  331. package/dist/instrumentation/index.js +176 -0
  332. package/dist/instrumentation/index.js.map +1 -0
  333. package/dist/instrumentation/langchain/index.d.ts +16 -0
  334. package/dist/instrumentation/langchain/index.js +91 -0
  335. package/dist/instrumentation/langchain/index.js.map +1 -0
  336. package/dist/instrumentation/langchain/wrapper.d.ts +41 -0
  337. package/dist/instrumentation/langchain/wrapper.js +1235 -0
  338. package/dist/instrumentation/langchain/wrapper.js.map +1 -0
  339. package/dist/instrumentation/langgraph/index.d.ts +12 -0
  340. package/dist/instrumentation/langgraph/index.js +99 -0
  341. package/dist/instrumentation/langgraph/index.js.map +1 -0
  342. package/dist/instrumentation/langgraph/wrapper.d.ts +20 -0
  343. package/dist/instrumentation/langgraph/wrapper.js +620 -0
  344. package/dist/instrumentation/langgraph/wrapper.js.map +1 -0
  345. package/dist/instrumentation/letta/index.d.ts +10 -0
  346. package/dist/instrumentation/letta/index.js +122 -0
  347. package/dist/instrumentation/letta/index.js.map +1 -0
  348. package/dist/instrumentation/letta/utils.d.ts +24 -0
  349. package/dist/instrumentation/letta/utils.js +343 -0
  350. package/dist/instrumentation/letta/utils.js.map +1 -0
  351. package/dist/instrumentation/letta/wrapper.d.ts +37 -0
  352. package/dist/instrumentation/letta/wrapper.js +180 -0
  353. package/dist/instrumentation/letta/wrapper.js.map +1 -0
  354. package/dist/instrumentation/llamaindex/index.d.ts +36 -0
  355. package/dist/instrumentation/llamaindex/index.js +221 -0
  356. package/dist/instrumentation/llamaindex/index.js.map +1 -0
  357. package/dist/instrumentation/llamaindex/wrapper.d.ts +36 -0
  358. package/dist/instrumentation/llamaindex/wrapper.js +811 -0
  359. package/dist/instrumentation/llamaindex/wrapper.js.map +1 -0
  360. package/dist/instrumentation/mcp/index.d.ts +20 -0
  361. package/dist/instrumentation/mcp/index.js +282 -0
  362. package/dist/instrumentation/mcp/index.js.map +1 -0
  363. package/dist/instrumentation/mcp/wrapper.d.ts +72 -0
  364. package/dist/instrumentation/mcp/wrapper.js +571 -0
  365. package/dist/instrumentation/mcp/wrapper.js.map +1 -0
  366. package/dist/instrumentation/mem0/index.d.ts +17 -0
  367. package/dist/instrumentation/mem0/index.js +113 -0
  368. package/dist/instrumentation/mem0/index.js.map +1 -0
  369. package/dist/instrumentation/mem0/wrapper.d.ts +37 -0
  370. package/dist/instrumentation/mem0/wrapper.js +298 -0
  371. package/dist/instrumentation/mem0/wrapper.js.map +1 -0
  372. package/dist/instrumentation/milvus/index.d.ts +11 -0
  373. package/dist/instrumentation/milvus/index.js +67 -0
  374. package/dist/instrumentation/milvus/index.js.map +1 -0
  375. package/dist/instrumentation/milvus/wrapper.d.ts +15 -0
  376. package/dist/instrumentation/milvus/wrapper.js +219 -0
  377. package/dist/instrumentation/milvus/wrapper.js.map +1 -0
  378. package/dist/instrumentation/mistral/index.d.ts +11 -0
  379. package/dist/instrumentation/mistral/index.js +66 -0
  380. package/dist/instrumentation/mistral/index.js.map +1 -0
  381. package/dist/instrumentation/mistral/wrapper.d.ts +49 -0
  382. package/dist/instrumentation/mistral/wrapper.js +482 -0
  383. package/dist/instrumentation/mistral/wrapper.js.map +1 -0
  384. package/dist/instrumentation/ollama/index.d.ts +11 -0
  385. package/dist/instrumentation/ollama/index.js +72 -0
  386. package/dist/instrumentation/ollama/index.js.map +1 -0
  387. package/dist/instrumentation/ollama/wrapper.d.ts +73 -0
  388. package/dist/instrumentation/ollama/wrapper.js +629 -0
  389. package/dist/instrumentation/ollama/wrapper.js.map +1 -0
  390. package/dist/instrumentation/openai/index.d.ts +11 -0
  391. package/dist/instrumentation/openai/index.js +79 -0
  392. package/dist/instrumentation/openai/index.js.map +1 -0
  393. package/dist/instrumentation/openai/wrapper.d.ts +80 -0
  394. package/dist/instrumentation/openai/wrapper.js +1121 -0
  395. package/dist/instrumentation/openai/wrapper.js.map +1 -0
  396. package/dist/instrumentation/openai-agents/index.d.ts +20 -0
  397. package/dist/instrumentation/openai-agents/index.js +174 -0
  398. package/dist/instrumentation/openai-agents/index.js.map +1 -0
  399. package/dist/instrumentation/openai-agents/processor.d.ts +35 -0
  400. package/dist/instrumentation/openai-agents/processor.js +249 -0
  401. package/dist/instrumentation/openai-agents/processor.js.map +1 -0
  402. package/dist/instrumentation/openai-agents/utils.d.ts +20 -0
  403. package/dist/instrumentation/openai-agents/utils.js +624 -0
  404. package/dist/instrumentation/openai-agents/utils.js.map +1 -0
  405. package/dist/instrumentation/pg/index.d.ts +20 -0
  406. package/dist/instrumentation/pg/index.js +74 -0
  407. package/dist/instrumentation/pg/index.js.map +1 -0
  408. package/dist/instrumentation/pg/wrapper.d.ts +66 -0
  409. package/dist/instrumentation/pg/wrapper.js +441 -0
  410. package/dist/instrumentation/pg/wrapper.js.map +1 -0
  411. package/dist/instrumentation/pinecone/index.d.ts +11 -0
  412. package/dist/instrumentation/pinecone/index.js +79 -0
  413. package/dist/instrumentation/pinecone/index.js.map +1 -0
  414. package/dist/instrumentation/pinecone/wrapper.d.ts +14 -0
  415. package/dist/instrumentation/pinecone/wrapper.js +198 -0
  416. package/dist/instrumentation/pinecone/wrapper.js.map +1 -0
  417. package/dist/instrumentation/qdrant/index.d.ts +11 -0
  418. package/dist/instrumentation/qdrant/index.js +67 -0
  419. package/dist/instrumentation/qdrant/index.js.map +1 -0
  420. package/dist/instrumentation/qdrant/wrapper.d.ts +14 -0
  421. package/dist/instrumentation/qdrant/wrapper.js +213 -0
  422. package/dist/instrumentation/qdrant/wrapper.js.map +1 -0
  423. package/dist/instrumentation/replicate/index.d.ts +11 -0
  424. package/dist/instrumentation/replicate/index.js +57 -0
  425. package/dist/instrumentation/replicate/index.js.map +1 -0
  426. package/dist/instrumentation/replicate/wrapper.d.ts +28 -0
  427. package/dist/instrumentation/replicate/wrapper.js +242 -0
  428. package/dist/instrumentation/replicate/wrapper.js.map +1 -0
  429. package/dist/instrumentation/strands/index.d.ts +21 -0
  430. package/dist/instrumentation/strands/index.js +83 -0
  431. package/dist/instrumentation/strands/index.js.map +1 -0
  432. package/dist/instrumentation/strands/processor.d.ts +51 -0
  433. package/dist/instrumentation/strands/processor.js +625 -0
  434. package/dist/instrumentation/strands/processor.js.map +1 -0
  435. package/dist/instrumentation/strands/utils.d.ts +24 -0
  436. package/dist/instrumentation/strands/utils.js +373 -0
  437. package/dist/instrumentation/strands/utils.js.map +1 -0
  438. package/dist/instrumentation/together/index.d.ts +11 -0
  439. package/dist/instrumentation/together/index.js +43 -0
  440. package/dist/instrumentation/together/index.js.map +1 -0
  441. package/dist/instrumentation/together/wrapper.d.ts +48 -0
  442. package/dist/instrumentation/together/wrapper.js +409 -0
  443. package/dist/instrumentation/together/wrapper.js.map +1 -0
  444. package/dist/instrumentation/transformers/index.d.ts +35 -0
  445. package/dist/instrumentation/transformers/index.js +119 -0
  446. package/dist/instrumentation/transformers/index.js.map +1 -0
  447. package/dist/instrumentation/transformers/wrapper.d.ts +49 -0
  448. package/dist/instrumentation/transformers/wrapper.js +472 -0
  449. package/dist/instrumentation/transformers/wrapper.js.map +1 -0
  450. package/dist/instrumentation/vercel-ai/index.d.ts +10 -0
  451. package/dist/instrumentation/vercel-ai/index.js +59 -0
  452. package/dist/instrumentation/vercel-ai/index.js.map +1 -0
  453. package/dist/instrumentation/vercel-ai/wrapper.d.ts +50 -0
  454. package/dist/instrumentation/vercel-ai/wrapper.js +539 -0
  455. package/dist/instrumentation/vercel-ai/wrapper.js.map +1 -0
  456. package/dist/instrumentation/vertexai/index.d.ts +11 -0
  457. package/dist/instrumentation/vertexai/index.js +70 -0
  458. package/dist/instrumentation/vertexai/index.js.map +1 -0
  459. package/dist/instrumentation/vertexai/wrapper.d.ts +67 -0
  460. package/dist/instrumentation/vertexai/wrapper.js +530 -0
  461. package/dist/instrumentation/vertexai/wrapper.js.map +1 -0
  462. package/dist/instrumentation/vllm/index.d.ts +13 -0
  463. package/dist/instrumentation/vllm/index.js +67 -0
  464. package/dist/instrumentation/vllm/index.js.map +1 -0
  465. package/dist/instrumentation/vllm/wrapper.d.ts +60 -0
  466. package/dist/instrumentation/vllm/wrapper.js +482 -0
  467. package/dist/instrumentation/vllm/wrapper.js.map +1 -0
  468. package/dist/llm/anthropic.d.ts +5 -0
  469. package/dist/llm/anthropic.js +39 -0
  470. package/dist/llm/anthropic.js.map +1 -0
  471. package/dist/llm/index.d.ts +10 -0
  472. package/dist/llm/index.js +93 -0
  473. package/dist/llm/index.js.map +1 -0
  474. package/dist/llm/openai.d.ts +6 -0
  475. package/dist/llm/openai.js +52 -0
  476. package/dist/llm/openai.js.map +1 -0
  477. package/dist/llm/providers.d.ts +7 -0
  478. package/dist/llm/providers.js +10 -0
  479. package/dist/llm/providers.js.map +1 -0
  480. package/dist/manual-trace.d.ts +40 -0
  481. package/dist/manual-trace.js +103 -0
  482. package/dist/manual-trace.js.map +1 -0
  483. package/dist/otel/__tests__/metrics.test.d.ts +1 -0
  484. package/dist/otel/__tests__/metrics.test.js +40 -0
  485. package/dist/otel/__tests__/metrics.test.js.map +1 -0
  486. package/dist/otel/events.d.ts +11 -0
  487. package/dist/otel/events.js +74 -0
  488. package/dist/otel/events.js.map +1 -0
  489. package/dist/otel/metrics.d.ts +35 -0
  490. package/dist/otel/metrics.js +219 -0
  491. package/dist/otel/metrics.js.map +1 -0
  492. package/dist/otel/tracing.d.ts +12 -0
  493. package/dist/otel/tracing.js +93 -0
  494. package/dist/otel/tracing.js.map +1 -0
  495. package/dist/otel/utils.d.ts +11 -0
  496. package/dist/otel/utils.js +34 -0
  497. package/dist/otel/utils.js.map +1 -0
  498. package/dist/pricing.json +951 -0
  499. package/dist/prompt-hub.d.ts +4 -0
  500. package/dist/prompt-hub.js +66 -0
  501. package/dist/prompt-hub.js.map +1 -0
  502. package/dist/register.d.ts +4 -0
  503. package/dist/register.js +52 -0
  504. package/dist/register.js.map +1 -0
  505. package/dist/score/__tests__/score.test.d.ts +1 -0
  506. package/dist/score/__tests__/score.test.js +143 -0
  507. package/dist/score/__tests__/score.test.js.map +1 -0
  508. package/dist/score/index.d.ts +2 -0
  509. package/dist/score/index.js +6 -0
  510. package/dist/score/index.js.map +1 -0
  511. package/dist/score/score.d.ts +15 -0
  512. package/dist/score/score.js +135 -0
  513. package/dist/score/score.js.map +1 -0
  514. package/dist/semantic-convention.d.ts +555 -0
  515. package/dist/semantic-convention.js +630 -0
  516. package/dist/semantic-convention.js.map +1 -0
  517. package/dist/types.d.ts +131 -0
  518. package/dist/types.js +3 -0
  519. package/dist/types.js.map +1 -0
  520. package/package.json +136 -0
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+ /**
3
+ * Cross-Language Trace Comparison Tests for ChromaDB Integration
4
+ *
5
+ * Verifies that TypeScript SDK generates traces consistent with the Python SDK
6
+ * for ChromaDB Collection operations.
7
+ *
8
+ * Python SDK reference: sdk/python/src/shield360/instrumentation/chroma/utils.py
9
+ *
10
+ * Key alignment:
11
+ * - db.system.name = 'chroma'
12
+ * - db.operation.name: INSERT (add), QUERY (query), GET (get), DELETE, PEEK, UPDATE, UPSERT
13
+ * - db.collection.name
14
+ * - server.address, server.port (default localhost:8000)
15
+ * - db.vector.query.top_k for query
16
+ * - db.filter for where-clause filtering
17
+ * - db.query.summary
18
+ */
19
+ var __importDefault = (this && this.__importDefault) || function (mod) {
20
+ return (mod && mod.__esModule) ? mod : { "default": mod };
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ const wrapper_1 = __importDefault(require("../chroma/wrapper"));
24
+ const config_1 = __importDefault(require("../../config"));
25
+ const helpers_1 = __importDefault(require("../../helpers"));
26
+ const semantic_convention_1 = __importDefault(require("../../semantic-convention"));
27
+ jest.mock('../../config');
28
+ jest.mock('../../helpers');
29
+ describe('ChromaDB Cross-Language Trace Comparison', () => {
30
+ let mockSpan;
31
+ let mockTracer;
32
+ beforeEach(() => {
33
+ mockSpan = {
34
+ setAttribute: jest.fn(),
35
+ addEvent: jest.fn(),
36
+ end: jest.fn(),
37
+ setStatus: jest.fn(),
38
+ };
39
+ mockTracer = {
40
+ startSpan: jest.fn().mockReturnValue(mockSpan),
41
+ };
42
+ config_1.default.environment = 'shield360-testing';
43
+ config_1.default.applicationName = 'shield360-test';
44
+ config_1.default.captureMessageContent = true;
45
+ helpers_1.default.handleException = jest.fn();
46
+ });
47
+ afterEach(() => {
48
+ jest.clearAllMocks();
49
+ });
50
+ // ── Helper: invoke wrapper ────────────────────────────────────────────────
51
+ async function invokeWrapped(method, dbOperation, collectionName, params, returnValue = {}) {
52
+ const patchFn = wrapper_1.default._patchCollectionMethod(mockTracer, dbOperation);
53
+ const originalMethod = jest.fn().mockResolvedValue(returnValue);
54
+ const fakeCollectionInstance = { name: collectionName };
55
+ const wrapped = patchFn(originalMethod);
56
+ await wrapped.call(fakeCollectionInstance, params);
57
+ }
58
+ // ── Common DB attributes ──────────────────────────────────────────────────
59
+ it('should set db.system.name = "chroma" matching Python DB_SYSTEM_CHROMA', async () => {
60
+ await invokeWrapped('add', semantic_convention_1.default.DB_OPERATION_INSERT, 'test_col', {
61
+ ids: ['id1'],
62
+ embeddings: [[0.1, 0.2]],
63
+ });
64
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_SYSTEM_NAME, 'chroma');
65
+ });
66
+ it('should set server.address = localhost and server.port = 8000 (Python defaults)', async () => {
67
+ await invokeWrapped('add', semantic_convention_1.default.DB_OPERATION_INSERT, 'test_col', {
68
+ ids: ['id1'],
69
+ });
70
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.SERVER_ADDRESS, 'localhost');
71
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.SERVER_PORT, 8000);
72
+ });
73
+ it('should set db.collection.name from collection instance', async () => {
74
+ await invokeWrapped('add', semantic_convention_1.default.DB_OPERATION_INSERT, 'my_collection', {
75
+ ids: ['id1'],
76
+ });
77
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_COLLECTION_NAME, 'my_collection');
78
+ });
79
+ // ── add → INSERT ──────────────────────────────────────────────────────────
80
+ describe('add() → INSERT (matches Python DB_OPERATION_INSERT)', () => {
81
+ it('should set db.operation.name = "INSERT"', async () => {
82
+ await invokeWrapped('add', semantic_convention_1.default.DB_OPERATION_INSERT, 'col', {
83
+ ids: ['id1', 'id2'],
84
+ embeddings: [[0.1], [0.2]],
85
+ documents: ['doc1', 'doc2'],
86
+ });
87
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_OPERATION_NAME, 'INSERT');
88
+ });
89
+ it('should set db.vector.count = number of ids', async () => {
90
+ await invokeWrapped('add', semantic_convention_1.default.DB_OPERATION_INSERT, 'col', {
91
+ ids: ['id1', 'id2', 'id3'],
92
+ });
93
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_VECTOR_COUNT, 3);
94
+ });
95
+ it('should set db.documents_count when documents provided', async () => {
96
+ await invokeWrapped('add', semantic_convention_1.default.DB_OPERATION_INSERT, 'col', {
97
+ ids: ['id1'],
98
+ documents: ['doc1'],
99
+ });
100
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_DOCUMENTS_COUNT, 1);
101
+ });
102
+ });
103
+ // ── query → QUERY ─────────────────────────────────────────────────────────
104
+ describe('query() → QUERY (vector similarity search)', () => {
105
+ it('should set db.operation.name = "QUERY"', async () => {
106
+ await invokeWrapped('query', semantic_convention_1.default.DB_OPERATION_QUERY, 'col', {
107
+ queryEmbeddings: [[0.1, 0.2]],
108
+ nResults: 5,
109
+ }, { ids: [['id1', 'id2']] });
110
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_OPERATION_NAME, 'QUERY');
111
+ });
112
+ it('should set db.vector.query.top_k from nResults', async () => {
113
+ await invokeWrapped('query', semantic_convention_1.default.DB_OPERATION_QUERY, 'col', {
114
+ queryEmbeddings: [[0.1]],
115
+ nResults: 10,
116
+ }, { ids: [['id1']] });
117
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_VECTOR_QUERY_TOP_K, 10);
118
+ });
119
+ it('should set db.filter when where clause provided (matching Python DB_FILTER)', async () => {
120
+ const where = { source: 'test' };
121
+ await invokeWrapped('query', semantic_convention_1.default.DB_OPERATION_QUERY, 'col', {
122
+ queryEmbeddings: [[0.1]],
123
+ nResults: 5,
124
+ where,
125
+ });
126
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_FILTER, JSON.stringify(where));
127
+ });
128
+ it('should set db.n_results to number of matched results', async () => {
129
+ await invokeWrapped('query', semantic_convention_1.default.DB_OPERATION_QUERY, 'col', {
130
+ queryEmbeddings: [[0.1]],
131
+ nResults: 5,
132
+ }, { ids: [['r1', 'r2', 'r3']] });
133
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_N_RESULTS, 3);
134
+ });
135
+ });
136
+ // ── get → GET ────────────────────────────────────────────────────────────
137
+ describe('get() → GET (retrieve by IDs)', () => {
138
+ it('should set db.operation.name = "GET"', async () => {
139
+ await invokeWrapped('get', semantic_convention_1.default.DB_OPERATION_GET, 'col', {
140
+ ids: ['id1', 'id2'],
141
+ }, { ids: ['id1', 'id2'] });
142
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_OPERATION_NAME, 'GET');
143
+ });
144
+ it('should set db.ids_count from ids array length', async () => {
145
+ await invokeWrapped('get', semantic_convention_1.default.DB_OPERATION_GET, 'col', {
146
+ ids: ['id1', 'id2'],
147
+ });
148
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_ID_COUNT, 2);
149
+ });
150
+ });
151
+ // ── delete → DELETE ───────────────────────────────────────────────────────
152
+ describe('delete() → DELETE', () => {
153
+ it('should set db.operation.name = "DELETE"', async () => {
154
+ await invokeWrapped('delete', semantic_convention_1.default.DB_OPERATION_DELETE, 'col', {
155
+ ids: ['id1'],
156
+ });
157
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_OPERATION_NAME, 'DELETE');
158
+ });
159
+ it('should set db.filter when where clause provided', async () => {
160
+ const where = { category: 'old' };
161
+ await invokeWrapped('delete', semantic_convention_1.default.DB_OPERATION_DELETE, 'col', {
162
+ where,
163
+ });
164
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_FILTER, JSON.stringify(where));
165
+ });
166
+ });
167
+ // ── peek → PEEK ───────────────────────────────────────────────────────────
168
+ describe('peek() → PEEK', () => {
169
+ it('should set db.operation.name = "PEEK"', async () => {
170
+ await invokeWrapped('peek', semantic_convention_1.default.DB_OPERATION_PEEK, 'col', 5, {
171
+ ids: ['id1', 'id2', 'id3', 'id4', 'id5'],
172
+ });
173
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_OPERATION_NAME, 'PEEK');
174
+ });
175
+ });
176
+ // ── upsert → UPSERT ───────────────────────────────────────────────────────
177
+ describe('upsert() → UPSERT', () => {
178
+ it('should set db.operation.name = "UPSERT" and db.vector.count', async () => {
179
+ await invokeWrapped('upsert', semantic_convention_1.default.DB_OPERATION_UPSERT, 'col', {
180
+ ids: ['id1', 'id2'],
181
+ embeddings: [[0.1], [0.2]],
182
+ });
183
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_OPERATION_NAME, 'UPSERT');
184
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_VECTOR_COUNT, 2);
185
+ });
186
+ });
187
+ // ── update → UPDATE ───────────────────────────────────────────────────────
188
+ describe('update() → UPDATE', () => {
189
+ it('should set db.operation.name = "UPDATE"', async () => {
190
+ await invokeWrapped('update', semantic_convention_1.default.DB_OPERATION_UPDATE, 'col', {
191
+ ids: ['id1'],
192
+ documents: ['new content'],
193
+ });
194
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.DB_OPERATION_NAME, 'UPDATE');
195
+ });
196
+ });
197
+ // ── Error handling ────────────────────────────────────────────────────────
198
+ it('should call handleException on error', async () => {
199
+ const patchFn = wrapper_1.default._patchCollectionMethod(mockTracer, semantic_convention_1.default.DB_OPERATION_QUERY);
200
+ const error = new Error('Collection not found');
201
+ const originalMethod = jest.fn().mockRejectedValue(error);
202
+ const fakeInstance = { name: 'missing_col' };
203
+ const wrapped = patchFn(originalMethod);
204
+ await expect(wrapped.call(fakeInstance, {})).rejects.toThrow('Collection not found');
205
+ expect(helpers_1.default.handleException).toHaveBeenCalledWith(mockSpan, error);
206
+ expect(mockSpan.end).toHaveBeenCalled();
207
+ });
208
+ });
209
+ //# sourceMappingURL=chroma-trace-comparison.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chroma-trace-comparison.test.js","sourceRoot":"","sources":["../../../src/instrumentation/__tests__/chroma-trace-comparison.test.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;AAEH,gEAA8C;AAC9C,0DAA2C;AAC3C,4DAA4C;AAC5C,oFAA2D;AAE3D,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAC1B,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAE3B,QAAQ,CAAC,0CAA0C,EAAE,GAAG,EA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,kBAAkB,CAAC,CAAC;QACxG,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAChD,MAAM,cAAc,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC1D,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;QAC7C,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;QAExC,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;QACrF,MAAM,CAAC,iBAAe,CAAC,eAAe,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC9E,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,256 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const api_1 = require("@opentelemetry/api");
7
+ const wrapper_1 = __importDefault(require("../cohere/wrapper"));
8
+ const config_1 = __importDefault(require("../../config"));
9
+ const helpers_1 = __importDefault(require("../../helpers"));
10
+ const base_wrapper_1 = __importDefault(require("../base-wrapper"));
11
+ const semantic_convention_1 = __importDefault(require("../../semantic-convention"));
12
+ jest.mock('../../../src/config');
13
+ jest.mock('../../../src/helpers');
14
+ jest.mock('../../../src/instrumentation/base-wrapper');
15
+ const mockTracer = api_1.trace.getTracer('test-tracer');
16
+ describe('CohereWrapper', () => {
17
+ let span;
18
+ beforeEach(() => {
19
+ span = mockTracer.startSpan('test-span');
20
+ span.setAttribute = jest.fn();
21
+ span.addEvent = jest.fn();
22
+ jest.clearAllMocks();
23
+ });
24
+ afterEach(() => {
25
+ span.end();
26
+ });
27
+ describe('_chat', () => {
28
+ it('should call recordMetrics after span ends', async () => {
29
+ const mockArgs = [{ model: 'command-r-plus', message: 'test message' }];
30
+ const mockResponse = {
31
+ response_id: '123',
32
+ text: 'response text',
33
+ finishReason: 'stop',
34
+ meta: { billedUnits: { inputTokens: 10, outputTokens: 20 } },
35
+ };
36
+ const mockGenAIEndpoint = 'cohere.chat';
37
+ jest
38
+ .spyOn(wrapper_1.default, '_chatCommonSetter')
39
+ .mockImplementationOnce(async ({ genAIEndpoint, span: s }) => {
40
+ s.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_TEMPERATURE, 1);
41
+ return {
42
+ genAIEndpoint,
43
+ model: 'command-r-plus',
44
+ user: 'test-user',
45
+ cost: 0.5,
46
+ aiSystem: 'cohere',
47
+ };
48
+ });
49
+ await wrapper_1.default._chat({
50
+ args: mockArgs,
51
+ genAIEndpoint: mockGenAIEndpoint,
52
+ response: mockResponse,
53
+ span,
54
+ });
55
+ expect(base_wrapper_1.default.recordMetrics).toHaveBeenCalledWith(span, {
56
+ genAIEndpoint: mockGenAIEndpoint,
57
+ model: 'command-r-plus',
58
+ user: 'test-user',
59
+ cost: 0.5,
60
+ aiSystem: 'cohere',
61
+ });
62
+ });
63
+ it('should rethrow errors from _chatCommonSetter', async () => {
64
+ const mockArgs = [{ model: 'command-r-plus', message: 'test message' }];
65
+ const mockResponse = {
66
+ response_id: '123',
67
+ meta: { billedUnits: { inputTokens: 10, outputTokens: 20 } },
68
+ };
69
+ jest.spyOn(wrapper_1.default, '_chatCommonSetter').mockRejectedValue(new Error('Test error'));
70
+ await expect(wrapper_1.default._chat({
71
+ args: mockArgs,
72
+ genAIEndpoint: 'cohere.chat',
73
+ response: mockResponse,
74
+ span,
75
+ })).rejects.toThrow('Test error');
76
+ });
77
+ });
78
+ describe('_chatGenerator', () => {
79
+ it('should call recordMetrics after span ends in generator', async () => {
80
+ const mockArgs = [{ model: 'command-r-plus', message: 'test message' }];
81
+ const mockResponse = async function* () {
82
+ yield { eventType: 'stream', response: { response_id: '123' } };
83
+ yield {
84
+ eventType: 'stream-end',
85
+ response: {
86
+ response_id: '123',
87
+ text: 'response text',
88
+ finishReason: 'stop',
89
+ meta: { billedUnits: { inputTokens: 10, outputTokens: 20 } },
90
+ },
91
+ };
92
+ }();
93
+ const mockGenAIEndpoint = 'cohere.chat';
94
+ jest.spyOn(wrapper_1.default, '_chatCommonSetter').mockResolvedValue({
95
+ genAIEndpoint: mockGenAIEndpoint,
96
+ model: 'command-r-plus',
97
+ user: 'test-user',
98
+ cost: 0.5,
99
+ aiSystem: 'cohere',
100
+ });
101
+ const generator = wrapper_1.default._chatGenerator({
102
+ args: mockArgs,
103
+ genAIEndpoint: mockGenAIEndpoint,
104
+ response: mockResponse,
105
+ span,
106
+ });
107
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
108
+ for await (const _ of generator) {
109
+ // Consume generator without using the value
110
+ }
111
+ expect(base_wrapper_1.default.recordMetrics).toHaveBeenCalledWith(span, {
112
+ genAIEndpoint: mockGenAIEndpoint,
113
+ model: 'command-r-plus',
114
+ user: 'test-user',
115
+ cost: 0.5,
116
+ aiSystem: 'cohere',
117
+ });
118
+ });
119
+ });
120
+ describe('_chatCommonSetter', () => {
121
+ it('should set span attributes and return metric parameters', async () => {
122
+ const mockArgs = [
123
+ {
124
+ model: 'command-r-plus',
125
+ message: 'test message',
126
+ max_tokens: 100,
127
+ temperature: 0.7,
128
+ p: 0.9,
129
+ k: 5,
130
+ frequency_penalty: 0.5,
131
+ presence_penalty: 0.3,
132
+ seed: 42,
133
+ stop_sequences: ['END'],
134
+ },
135
+ ];
136
+ const mockResult = {
137
+ response_id: '123',
138
+ meta: { billedUnits: { inputTokens: 10, outputTokens: 20 } },
139
+ text: 'response text',
140
+ finishReason: 'stop',
141
+ };
142
+ const mockGenAIEndpoint = 'cohere.chat';
143
+ jest.restoreAllMocks();
144
+ config_1.default.pricingInfo = {};
145
+ config_1.default.disableEvents = true;
146
+ jest.spyOn(helpers_1.default, 'getChatModelCost').mockReturnValue(0.5);
147
+ const metricParams = await wrapper_1.default._chatCommonSetter({
148
+ args: mockArgs,
149
+ genAIEndpoint: mockGenAIEndpoint,
150
+ result: mockResult,
151
+ span,
152
+ });
153
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_TOP_P, 0.9);
154
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_TOP_K, 5);
155
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_MAX_TOKENS, 100);
156
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_TEMPERATURE, 0.7);
157
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_PRESENCE_PENALTY, 0.3);
158
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_FREQUENCY_PENALTY, 0.5);
159
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_SEED, 42);
160
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_IS_STREAM, false);
161
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_STOP_SEQUENCES, ['END']);
162
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_RESPONSE_MODEL, 'command-r-plus');
163
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_RESPONSE_FINISH_REASON, ['stop']);
164
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_OUTPUT_TYPE, 'text');
165
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_USAGE_INPUT_TOKENS, 10);
166
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_USAGE_OUTPUT_TOKENS, 20);
167
+ expect(metricParams).toEqual({
168
+ genAIEndpoint: mockGenAIEndpoint,
169
+ model: 'command-r-plus',
170
+ user: undefined,
171
+ cost: 0.5,
172
+ aiSystem: 'cohere',
173
+ });
174
+ });
175
+ it('should handle tool calls properly', async () => {
176
+ const mockArgs = [
177
+ {
178
+ model: 'command-r-plus',
179
+ message: 'what is the weather?',
180
+ tools: [{ type: 'function', function: { name: 'get_weather' } }],
181
+ },
182
+ ];
183
+ const mockResult = {
184
+ response_id: '456',
185
+ meta: { billedUnits: { inputTokens: 15, outputTokens: 25 } },
186
+ text: '',
187
+ finishReason: 'tool_use',
188
+ toolCalls: [
189
+ {
190
+ id: 'call_abc',
191
+ name: 'get_weather',
192
+ arguments: '{"location":"SF"}',
193
+ },
194
+ ],
195
+ };
196
+ jest.restoreAllMocks();
197
+ config_1.default.pricingInfo = {};
198
+ config_1.default.disableEvents = true;
199
+ jest.spyOn(helpers_1.default, 'getChatModelCost').mockReturnValue(0.3);
200
+ await wrapper_1.default._chatCommonSetter({
201
+ args: mockArgs,
202
+ genAIEndpoint: 'cohere.chat',
203
+ result: mockResult,
204
+ span,
205
+ });
206
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_TOOL_NAME, 'get_weather');
207
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_TOOL_CALL_ID, 'call_abc');
208
+ expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_TOOL_ARGS, '{"location":"SF"}');
209
+ });
210
+ it('should not set sentinel values for optional parameters', async () => {
211
+ const mockArgs = [{ model: 'command-r-plus', message: 'test' }];
212
+ const mockResult = {
213
+ response_id: '789',
214
+ meta: { billedUnits: { inputTokens: 5, outputTokens: 10 } },
215
+ text: 'ok',
216
+ finishReason: 'stop',
217
+ };
218
+ jest.restoreAllMocks();
219
+ config_1.default.pricingInfo = {};
220
+ config_1.default.disableEvents = true;
221
+ jest.spyOn(helpers_1.default, 'getChatModelCost').mockReturnValue(0);
222
+ await wrapper_1.default._chatCommonSetter({
223
+ args: mockArgs,
224
+ genAIEndpoint: 'cohere.chat',
225
+ result: mockResult,
226
+ span,
227
+ });
228
+ const setAttrCalls = span.setAttribute.mock.calls;
229
+ const attrKeys = setAttrCalls.map((call) => call[0]);
230
+ expect(attrKeys).not.toContain(semantic_convention_1.default.GEN_AI_REQUEST_MAX_TOKENS);
231
+ expect(attrKeys).not.toContain(semantic_convention_1.default.GEN_AI_REQUEST_SEED);
232
+ expect(attrKeys).not.toContain(semantic_convention_1.default.GEN_AI_REQUEST_PRESENCE_PENALTY);
233
+ expect(attrKeys).not.toContain(semantic_convention_1.default.GEN_AI_REQUEST_FREQUENCY_PENALTY);
234
+ expect(attrKeys).not.toContain(semantic_convention_1.default.GEN_AI_REQUEST_STOP_SEQUENCES);
235
+ expect(attrKeys).not.toContain(semantic_convention_1.default.GEN_AI_REQUEST_TOP_K);
236
+ expect(attrKeys).not.toContain(semantic_convention_1.default.GEN_AI_USAGE_TOTAL_TOKENS);
237
+ expect(attrKeys).not.toContain(semantic_convention_1.default.GEN_AI_CLIENT_TOKEN_USAGE);
238
+ });
239
+ describe('error handling', () => {
240
+ it('should not call recordMetrics and handle the error properly', async () => {
241
+ const mockArgs = [{ model: 'command-r-plus', message: 'test', max_tokens: 100, temperature: 0.7 }];
242
+ const mockGenAIEndpoint = 'cohere.chat';
243
+ const mockError = new Error('Test error');
244
+ jest.spyOn(wrapper_1.default, '_chatCommonSetter').mockRejectedValue(mockError);
245
+ await expect(wrapper_1.default._chatCommonSetter({
246
+ args: mockArgs,
247
+ genAIEndpoint: mockGenAIEndpoint,
248
+ result: {},
249
+ span,
250
+ })).rejects.toThrow('Test error');
251
+ expect(base_wrapper_1.default.recordMetrics).not.toHaveBeenCalled();
252
+ });
253
+ });
254
+ });
255
+ });
256
+ //# sourceMappingURL=cohere-wrapper.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cohere-wrapper.test.js","sourceRoot":"","sources":["../../../src/instrumentation/__tests__/cohere-wrapper.test.ts"],"names":[],"mappings":";;;;;AAAA,4CAAiD;AACjD,gEAA8C;AAC9C,0DAA2C;AAC3C,4DAA4C;AAC5C,mEAA0C;AAC1C,oFAA2D;AAE3D,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AACjC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAClC,IAAI,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;AAEvD,MAAM,UAAU,GAAG,WAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AAElD,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,IAAI,IAAU,CAAC;IAEf,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QACzC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC1B,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,GAAG,EAAE,CAAC;IACb,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;QACrB,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;YACzD,MAAM,QAAQ,GAAG,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;YACxE,MAAM,YAAY,GAAG;gBACnB,WAAW,EAAE,KAAK;gBAClB,IAAI,EAAE,eAAe;gBACrB,YAAY,EAAE,MAAM;gBACpB,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,WA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