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,219 @@
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 config_1 = __importDefault(require("../../config"));
8
+ const helpers_1 = __importDefault(require("../../helpers"));
9
+ const semantic_convention_1 = __importDefault(require("../../semantic-convention"));
10
+ const base_wrapper_1 = __importDefault(require("../base-wrapper"));
11
+ class MilvusWrapper extends base_wrapper_1.default {
12
+ static _setCommonAttributes(span, dbOperation, collectionName) {
13
+ const applicationName = config_1.default.applicationName || '';
14
+ const environment = config_1.default.environment || '';
15
+ span.setAttribute(semantic_convention_1.default.DB_SYSTEM_NAME, MilvusWrapper.dbSystem);
16
+ span.setAttribute(semantic_convention_1.default.DB_OPERATION_NAME, dbOperation);
17
+ span.setAttribute(semantic_convention_1.default.DB_COLLECTION_NAME, collectionName);
18
+ span.setAttribute(semantic_convention_1.default.SERVER_ADDRESS, MilvusWrapper.serverAddress);
19
+ span.setAttribute(semantic_convention_1.default.SERVER_PORT, MilvusWrapper.serverPort);
20
+ span.setAttribute(semantic_convention_1.default.GEN_AI_ENVIRONMENT, environment);
21
+ span.setAttribute(semantic_convention_1.default.GEN_AI_APPLICATION_NAME, applicationName);
22
+ }
23
+ // Milvus SDK uses `collection_name` in params for most methods
24
+ static _getCollectionName(params) {
25
+ return params?.collection_name || params?.collectionName || 'unknown';
26
+ }
27
+ static _patchSearch(tracer) {
28
+ const dbOperation = semantic_convention_1.default.DB_OPERATION_SEARCH;
29
+ return (originalMethod) => {
30
+ return async function (...args) {
31
+ const params = args[0] || {};
32
+ const collectionName = MilvusWrapper._getCollectionName(params);
33
+ const spanName = `${dbOperation} ${collectionName}`;
34
+ const span = tracer.startSpan(spanName, { kind: api_1.SpanKind.CLIENT });
35
+ const startTime = Date.now();
36
+ return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), async () => {
37
+ try {
38
+ const response = await originalMethod.apply(this, args);
39
+ const duration = (Date.now() - startTime) / 1000;
40
+ MilvusWrapper._setCommonAttributes(span, dbOperation, collectionName);
41
+ span.setAttribute(semantic_convention_1.default.DB_CLIENT_OPERATION_DURATION, duration);
42
+ span.setAttribute(semantic_convention_1.default.DB_VECTOR_QUERY_TOP_K, params.topk || params.limit || 10);
43
+ if (params.expr || params.filter) {
44
+ span.setAttribute(semantic_convention_1.default.DB_FILTER, params.expr || params.filter);
45
+ }
46
+ if (params.output_fields) {
47
+ span.setAttribute(semantic_convention_1.default.DB_OUTPUT_FIELDS, JSON.stringify(params.output_fields));
48
+ }
49
+ const resultCount = response?.results?.length || 0;
50
+ span.setAttribute(semantic_convention_1.default.DB_N_RESULTS, resultCount);
51
+ if (config_1.default.captureMessageContent && params.vectors) {
52
+ const vectors = Array.isArray(params.vectors) ? params.vectors : [];
53
+ span.setAttribute(semantic_convention_1.default.DB_QUERY_TEXT, JSON.stringify(vectors.slice(0, 1).map((v) => v?.slice(0, 10))));
54
+ }
55
+ span.setAttribute(semantic_convention_1.default.DB_QUERY_SUMMARY, `${dbOperation} ${collectionName} topk=${params.topk || params.limit || 10}`);
56
+ span.setStatus({ code: 1 });
57
+ return response;
58
+ }
59
+ catch (e) {
60
+ helpers_1.default.handleException(span, e);
61
+ throw e;
62
+ }
63
+ finally {
64
+ span.end();
65
+ }
66
+ });
67
+ };
68
+ };
69
+ }
70
+ static _patchInsert(tracer) {
71
+ const dbOperation = semantic_convention_1.default.DB_OPERATION_INSERT;
72
+ return (originalMethod) => {
73
+ return async function (...args) {
74
+ const params = args[0] || {};
75
+ const collectionName = MilvusWrapper._getCollectionName(params);
76
+ const spanName = `${dbOperation} ${collectionName}`;
77
+ const span = tracer.startSpan(spanName, { kind: api_1.SpanKind.CLIENT });
78
+ const startTime = Date.now();
79
+ return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), async () => {
80
+ try {
81
+ const response = await originalMethod.apply(this, args);
82
+ const duration = (Date.now() - startTime) / 1000;
83
+ MilvusWrapper._setCommonAttributes(span, dbOperation, collectionName);
84
+ span.setAttribute(semantic_convention_1.default.DB_CLIENT_OPERATION_DURATION, duration);
85
+ const data = params.data || params.fields_data || [];
86
+ const rowCount = Array.isArray(data) ? data.length : 0;
87
+ span.setAttribute(semantic_convention_1.default.DB_VECTOR_COUNT, rowCount);
88
+ span.setAttribute(semantic_convention_1.default.DB_QUERY_SUMMARY, `${dbOperation} ${collectionName} rows=${rowCount}`);
89
+ span.setStatus({ code: 1 });
90
+ return response;
91
+ }
92
+ catch (e) {
93
+ helpers_1.default.handleException(span, e);
94
+ throw e;
95
+ }
96
+ finally {
97
+ span.end();
98
+ }
99
+ });
100
+ };
101
+ };
102
+ }
103
+ static _patchUpsert(tracer) {
104
+ const dbOperation = semantic_convention_1.default.DB_OPERATION_UPSERT;
105
+ return (originalMethod) => {
106
+ return async function (...args) {
107
+ const params = args[0] || {};
108
+ const collectionName = MilvusWrapper._getCollectionName(params);
109
+ const spanName = `${dbOperation} ${collectionName}`;
110
+ const span = tracer.startSpan(spanName, { kind: api_1.SpanKind.CLIENT });
111
+ const startTime = Date.now();
112
+ return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), async () => {
113
+ try {
114
+ const response = await originalMethod.apply(this, args);
115
+ const duration = (Date.now() - startTime) / 1000;
116
+ MilvusWrapper._setCommonAttributes(span, dbOperation, collectionName);
117
+ span.setAttribute(semantic_convention_1.default.DB_CLIENT_OPERATION_DURATION, duration);
118
+ const data = params.data || params.fields_data || [];
119
+ const rowCount = Array.isArray(data) ? data.length : 0;
120
+ span.setAttribute(semantic_convention_1.default.DB_VECTOR_COUNT, rowCount);
121
+ span.setAttribute(semantic_convention_1.default.DB_QUERY_SUMMARY, `${dbOperation} ${collectionName} rows=${rowCount}`);
122
+ span.setStatus({ code: 1 });
123
+ return response;
124
+ }
125
+ catch (e) {
126
+ helpers_1.default.handleException(span, e);
127
+ throw e;
128
+ }
129
+ finally {
130
+ span.end();
131
+ }
132
+ });
133
+ };
134
+ };
135
+ }
136
+ static _patchDelete(tracer) {
137
+ const dbOperation = semantic_convention_1.default.DB_OPERATION_DELETE;
138
+ return (originalMethod) => {
139
+ return async function (...args) {
140
+ const params = args[0] || {};
141
+ const collectionName = MilvusWrapper._getCollectionName(params);
142
+ const spanName = `${dbOperation} ${collectionName}`;
143
+ const span = tracer.startSpan(spanName, { kind: api_1.SpanKind.CLIENT });
144
+ const startTime = Date.now();
145
+ return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), async () => {
146
+ try {
147
+ const response = await originalMethod.apply(this, args);
148
+ const duration = (Date.now() - startTime) / 1000;
149
+ MilvusWrapper._setCommonAttributes(span, dbOperation, collectionName);
150
+ span.setAttribute(semantic_convention_1.default.DB_CLIENT_OPERATION_DURATION, duration);
151
+ if (params.expr || params.filter) {
152
+ span.setAttribute(semantic_convention_1.default.DB_FILTER, params.expr || params.filter);
153
+ }
154
+ const ids = params.ids || [];
155
+ if (Array.isArray(ids) && ids.length > 0) {
156
+ span.setAttribute(semantic_convention_1.default.DB_ID_COUNT, ids.length);
157
+ }
158
+ span.setAttribute(semantic_convention_1.default.DB_QUERY_SUMMARY, `${dbOperation} ${collectionName}`);
159
+ span.setStatus({ code: 1 });
160
+ return response;
161
+ }
162
+ catch (e) {
163
+ helpers_1.default.handleException(span, e);
164
+ throw e;
165
+ }
166
+ finally {
167
+ span.end();
168
+ }
169
+ });
170
+ };
171
+ };
172
+ }
173
+ static _patchQuery(tracer) {
174
+ const dbOperation = semantic_convention_1.default.DB_OPERATION_QUERY;
175
+ return (originalMethod) => {
176
+ return async function (...args) {
177
+ const params = args[0] || {};
178
+ const collectionName = MilvusWrapper._getCollectionName(params);
179
+ const spanName = `${dbOperation} ${collectionName}`;
180
+ const span = tracer.startSpan(spanName, { kind: api_1.SpanKind.CLIENT });
181
+ const startTime = Date.now();
182
+ return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), async () => {
183
+ try {
184
+ const response = await originalMethod.apply(this, args);
185
+ const duration = (Date.now() - startTime) / 1000;
186
+ MilvusWrapper._setCommonAttributes(span, dbOperation, collectionName);
187
+ span.setAttribute(semantic_convention_1.default.DB_CLIENT_OPERATION_DURATION, duration);
188
+ if (params.expr || params.filter) {
189
+ span.setAttribute(semantic_convention_1.default.DB_FILTER, params.expr || params.filter);
190
+ }
191
+ if (params.limit) {
192
+ span.setAttribute(semantic_convention_1.default.DB_QUERY_LIMIT, params.limit);
193
+ }
194
+ if (params.output_fields) {
195
+ span.setAttribute(semantic_convention_1.default.DB_OUTPUT_FIELDS, JSON.stringify(params.output_fields));
196
+ }
197
+ const resultCount = response?.data?.length || 0;
198
+ span.setAttribute(semantic_convention_1.default.DB_N_RESULTS, resultCount);
199
+ span.setAttribute(semantic_convention_1.default.DB_QUERY_SUMMARY, `${dbOperation} ${collectionName} results=${resultCount}`);
200
+ span.setStatus({ code: 1 });
201
+ return response;
202
+ }
203
+ catch (e) {
204
+ helpers_1.default.handleException(span, e);
205
+ throw e;
206
+ }
207
+ finally {
208
+ span.end();
209
+ }
210
+ });
211
+ };
212
+ };
213
+ }
214
+ }
215
+ MilvusWrapper.dbSystem = semantic_convention_1.default.DB_SYSTEM_MILVUS;
216
+ MilvusWrapper.serverAddress = 'localhost';
217
+ MilvusWrapper.serverPort = 19530;
218
+ exports.default = MilvusWrapper;
219
+ //# sourceMappingURL=wrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../../src/instrumentation/milvus/wrapper.ts"],"names":[],"mappings":";;;;;AAAA,4CAAsE;AACtE,0DAA2C;AAC3C,4DAA4C;AAC5C,oFAA2D;AAC3D,mEAA0C;AAE1C,MAAM,aAAc,SAAQ,sBAAW;IAKrC,MAAM,CAAC,oBAAoB,CAAC,IAAS,EAAE,WAAmB,EAAE,cAAsB;QAChF,MAAM,eAAe,GAAG,gBAAe,CAAC,eAAe,IAAI,EAAE,CAAC;QAC9D,MAAM,WAAW,GAAG,gBAAe,CAAC,WAAW,IAAI,EAAE,CAAC;QAEtD,IAAI,CAAC,YAAY,CAAC,6BAAkB,CAAC,cAAc,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC7E,IAAI,CAAC,YAAY,CAAC,6BAAkB,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;QACrE,IAAI,CAAC,YAAY,CAAC,6BAAkB,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;QACzE,IAAI,CAAC,YAAY,CAAC,6BAAkB,CAAC,cAAc,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;QAClF,IAAI,CAAC,YAAY,CAAC,6BAAkB,CAAC,WAAW,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;QAC5E,IAAI,CAA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EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;wBACrE,CAAC;wBACD,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;4BACzB,IAAI,CAAC,YAAY,CAAC,6BAAkB,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;wBAC/F,CAAC;wBAED,MAAM,WAAW,GAAG,QAAQ,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC;wBAChD,IAAI,CAAC,YAAY,CAAC,6BAAkB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;wBAChE,IAAI,CAAC,YAAY,CAAC,6BAAkB,CAAC,gBAAgB,EACnD,GAAG,WAAW,IAAI,cAAc,YAAY,WAAW,EAAE,CAAC,CAAC;wBAE7D,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;wBAC5B,OAAO,QAAQ,CAAC;oBAClB,CAAC;oBAAC,OAAO,CAAM,EAAE,CAAC;wBAChB,iBAAe,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;wBACzC,MAAM,CAAC,CAAC;oBACV,CAAC;4BAAS,CAAC;wBACT,IAAI,CAAC,GAAG,EAAE,CAAC;oBACb,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;;AAxOM,sBAAQ,GAAG,6BAAkB,CAAC,gBAAgB,CAAC;AAC/C,2BAAa,GAAG,WAAW,CAAC;AAC5B,wBAAU,GAAG,KAAK,CAAC;AAyO5B,kBAAe,aAAa,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { InstrumentationBase, InstrumentationModuleDefinition } from '@opentelemetry/instrumentation';
2
+ import { InstrumentationConfig } from '@opentelemetry/instrumentation';
3
+ export interface MistralInstrumentationConfig extends InstrumentationConfig {
4
+ }
5
+ export default class Shield360MistralInstrumentation extends InstrumentationBase {
6
+ constructor(config?: MistralInstrumentationConfig);
7
+ protected init(): void | InstrumentationModuleDefinition | InstrumentationModuleDefinition[];
8
+ manualPatch(mistral: any): void;
9
+ protected _patch(moduleExports: any): void;
10
+ protected _unpatch(moduleExports: any): void;
11
+ }
@@ -0,0 +1,66 @@
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 instrumentation_1 = require("@opentelemetry/instrumentation");
7
+ const constant_1 = require("../../constant");
8
+ const wrapper_1 = __importDefault(require("./wrapper"));
9
+ class Shield360MistralInstrumentation extends instrumentation_1.InstrumentationBase {
10
+ constructor(config = {}) {
11
+ super(`${constant_1.INSTRUMENTATION_PREFIX}/instrumentation-mistral`, '1.0.0', config);
12
+ }
13
+ init() {
14
+ const module = new instrumentation_1.InstrumentationNodeModuleDefinition('@mistralai/mistralai', ['>=1.0.0'], (moduleExports) => {
15
+ this._patch(moduleExports);
16
+ return moduleExports;
17
+ }, (moduleExports) => {
18
+ if (moduleExports !== undefined) {
19
+ this._unpatch(moduleExports);
20
+ }
21
+ });
22
+ return [module];
23
+ }
24
+ manualPatch(mistral) {
25
+ this._patch(mistral);
26
+ }
27
+ _patch(moduleExports) {
28
+ try {
29
+ // Chat and Embeddings are instance properties in the new SDK — get their
30
+ // prototypes via a dummy instance (no API calls are made at construction time)
31
+ const dummy = new moduleExports.Mistral({ apiKey: 'dummy' });
32
+ const ChatProto = Object.getPrototypeOf(dummy.chat);
33
+ const EmbeddingsProto = Object.getPrototypeOf(dummy.embeddings);
34
+ if ((0, instrumentation_1.isWrapped)(ChatProto.complete)) {
35
+ this._unwrap(ChatProto, 'complete');
36
+ }
37
+ if ((0, instrumentation_1.isWrapped)(ChatProto.stream)) {
38
+ this._unwrap(ChatProto, 'stream');
39
+ }
40
+ if ((0, instrumentation_1.isWrapped)(EmbeddingsProto.create)) {
41
+ this._unwrap(EmbeddingsProto, 'create');
42
+ }
43
+ this._wrap(ChatProto, 'complete', wrapper_1.default._patchChatCompletionCreate(this.tracer));
44
+ this._wrap(ChatProto, 'stream', wrapper_1.default._patchChatCompletionCreate(this.tracer));
45
+ this._wrap(EmbeddingsProto, 'create', wrapper_1.default._patchEmbedding(this.tracer));
46
+ }
47
+ catch (e) {
48
+ console.error('Error in _patch method:', e);
49
+ }
50
+ }
51
+ _unpatch(moduleExports) {
52
+ try {
53
+ const dummy = new moduleExports.Mistral({ apiKey: 'dummy' });
54
+ const ChatProto = Object.getPrototypeOf(dummy.chat);
55
+ const EmbeddingsProto = Object.getPrototypeOf(dummy.embeddings);
56
+ this._unwrap(ChatProto, 'complete');
57
+ this._unwrap(ChatProto, 'stream');
58
+ this._unwrap(EmbeddingsProto, 'create');
59
+ }
60
+ catch (e) {
61
+ console.error('Error in _unpatch method:', e);
62
+ }
63
+ }
64
+ }
65
+ exports.default = Shield360MistralInstrumentation;
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentation/mistral/index.ts"],"names":[],"mappings":";;;;;AAAA,oEAKwC;AAExC,6CAAwD;AACxD,wDAAuC;AAIvC,MAAqB,+BAAgC,SAAQ,qCAAmB;IAC9E,YAAY,SAAuC,EAAE;QACnD,KAAK,CAAC,GAAG,iCAAsB,0BAA0B,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9E,CAAC;IAES,IAAI;QACZ,MAAM,MAAM,GAAG,IAAI,qDAAmC,CACpD,sBAAsB,EACtB,CAAC,SAAS,CAAC,EACX,CAAC,aAAa,EAAE,EAAE;YAChB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YAC3B,OAAO,aAAa,CAAC;QACvB,CAAC,EACD,CAAC,aAAa,EAAE,EAAE;YAChB,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;gBAChC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;YAC/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AAI,CAAC,MAAM,CAAC,CAAC,CAAC;QACrF,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAES,QAAQ,CAAC,aAAkB;QACnC,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7D,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpD,MAAM,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAChE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YACpC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAClC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;QAC1C,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,CAAC,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;CACF;AAhED,kDAgEC"}
@@ -0,0 +1,49 @@
1
+ import { Span, Tracer } from '@opentelemetry/api';
2
+ import BaseWrapper from '../base-wrapper';
3
+ declare class MistralWrapper extends BaseWrapper {
4
+ static aiSystem: string;
5
+ static serverAddress: string;
6
+ static serverPort: number;
7
+ /**
8
+ * Stamp `shield360.agent.version_hash` (auto) and `gen_ai.agent.version`
9
+ * (user override, if set) on the span and return the same attributes so
10
+ * the caller can merge them into the inference event extras.
11
+ */
12
+ static _stampAgentVersion(span: Span, args: {
13
+ systemInstructionsJson?: string;
14
+ toolDefinitionsJson?: string;
15
+ primaryModel?: string;
16
+ temperature?: number | null;
17
+ top_p?: number | null;
18
+ max_tokens?: number | null;
19
+ }): Record<string, string>;
20
+ static _patchChatCompletionCreate(tracer: Tracer): any;
21
+ static _chatCompletion({ args, genAIEndpoint, response, span, }: {
22
+ args: any[];
23
+ genAIEndpoint: string;
24
+ response: any;
25
+ span: Span;
26
+ }): Promise<any>;
27
+ static _chatCompletionGenerator({ args, genAIEndpoint, response, span, }: {
28
+ args: any[];
29
+ genAIEndpoint: string;
30
+ response: any;
31
+ span: Span;
32
+ }): AsyncGenerator<unknown, any, unknown>;
33
+ static _chatCompletionCommonSetter({ args, genAIEndpoint, result, span, ttft, tbt, }: {
34
+ args: any[];
35
+ genAIEndpoint: string;
36
+ result: any;
37
+ span: Span;
38
+ ttft?: number;
39
+ tbt?: number;
40
+ }): Promise<{
41
+ genAIEndpoint: string;
42
+ model: any;
43
+ user: any;
44
+ cost: number;
45
+ aiSystem: string;
46
+ }>;
47
+ static _patchEmbedding(tracer: Tracer): any;
48
+ }
49
+ export default MistralWrapper;