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,176 @@
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 openai_1 = __importDefault(require("./openai"));
8
+ const anthropic_1 = __importDefault(require("./anthropic"));
9
+ const cohere_1 = __importDefault(require("./cohere"));
10
+ const groq_1 = __importDefault(require("./groq"));
11
+ const ai21_1 = __importDefault(require("./ai21"));
12
+ const gradient_1 = __importDefault(require("./gradient"));
13
+ const browser_use_1 = __importDefault(require("./browser-use"));
14
+ const mistral_1 = __importDefault(require("./mistral"));
15
+ const google_ai_1 = __importDefault(require("./google-ai"));
16
+ const vertexai_1 = __importDefault(require("./vertexai"));
17
+ const together_1 = __importDefault(require("./together"));
18
+ const ollama_1 = __importDefault(require("./ollama"));
19
+ const vllm_1 = __importDefault(require("./vllm"));
20
+ const vercel_ai_1 = __importDefault(require("./vercel-ai"));
21
+ const langchain_1 = __importDefault(require("./langchain"));
22
+ const langgraph_1 = __importDefault(require("./langgraph"));
23
+ const pinecone_1 = __importDefault(require("./pinecone"));
24
+ const bedrock_1 = __importDefault(require("./bedrock"));
25
+ const llamaindex_1 = __importDefault(require("./llamaindex"));
26
+ const huggingface_1 = __importDefault(require("./huggingface"));
27
+ const replicate_1 = __importDefault(require("./replicate"));
28
+ const chroma_1 = __importDefault(require("./chroma"));
29
+ const qdrant_1 = __importDefault(require("./qdrant"));
30
+ const milvus_1 = __importDefault(require("./milvus"));
31
+ const azure_ai_inference_1 = __importDefault(require("./azure-ai-inference"));
32
+ const openai_agents_1 = __importDefault(require("./openai-agents"));
33
+ const strands_1 = __importDefault(require("./strands"));
34
+ const google_adk_1 = __importDefault(require("./google-adk"));
35
+ const claude_agent_sdk_1 = __importDefault(require("./claude-agent-sdk"));
36
+ const cursor_sdk_1 = __importDefault(require("./cursor-sdk"));
37
+ const astra_1 = __importDefault(require("./astra"));
38
+ const mcp_1 = __importDefault(require("./mcp"));
39
+ const mem0_1 = __importDefault(require("./mem0"));
40
+ const elevenlabs_1 = __importDefault(require("./elevenlabs"));
41
+ const assemblyai_1 = __importDefault(require("./assemblyai"));
42
+ const transformers_1 = __importDefault(require("./transformers"));
43
+ const pg_1 = __importDefault(require("./pg"));
44
+ const firecrawl_1 = __importDefault(require("./firecrawl"));
45
+ const letta_1 = __importDefault(require("./letta"));
46
+ /**
47
+ * OTel community instrumentations loaded dynamically (like Python SDK).
48
+ * Each entry maps a logical name to the npm package and exported class.
49
+ * If the package is installed, the instrumentation is registered automatically.
50
+ * If not installed, it is silently skipped.
51
+ *
52
+ * Node.js equivalents of the Python SDK's OTel instrumentations:
53
+ * Python: requests, urllib, urllib3 → Node: http (@opentelemetry/instrumentation-http)
54
+ * Python: httpx, aiohttp-client → Node: undici (@opentelemetry/instrumentation-undici)
55
+ * Python: django, flask, fastapi… → Node: express, fastify, koa, hapi, nestjs-core
56
+ */
57
+ const OTEL_COMMUNITY_INSTRUMENTATIONS = {
58
+ // HTTP client instrumentations
59
+ 'http': { pkg: '@opentelemetry/instrumentation-http', cls: 'HttpInstrumentation' },
60
+ 'undici': { pkg: '@opentelemetry/instrumentation-undici', cls: 'UndiciInstrumentation' },
61
+ // HTTP framework instrumentations
62
+ 'express': { pkg: '@opentelemetry/instrumentation-express', cls: 'ExpressInstrumentation' },
63
+ 'fastify': { pkg: '@opentelemetry/instrumentation-fastify', cls: 'FastifyInstrumentation' },
64
+ 'koa': { pkg: '@opentelemetry/instrumentation-koa', cls: 'KoaInstrumentation' },
65
+ 'hapi': { pkg: '@opentelemetry/instrumentation-hapi', cls: 'HapiInstrumentation' },
66
+ 'nestjs-core': { pkg: '@opentelemetry/instrumentation-nestjs-core', cls: 'NestInstrumentation' },
67
+ };
68
+ function loadOtelCommunityInstrumentations(disabledInstrumentors) {
69
+ const instances = [];
70
+ for (const [name, { pkg, cls }] of Object.entries(OTEL_COMMUNITY_INSTRUMENTATIONS)) {
71
+ if (disabledInstrumentors.includes(name))
72
+ continue;
73
+ try {
74
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
75
+ const mod = require(pkg);
76
+ const InstrClass = mod[cls];
77
+ if (InstrClass) {
78
+ instances.push(new InstrClass());
79
+ }
80
+ }
81
+ catch {
82
+ // Package not installed — skip silently (same as Python SDK)
83
+ }
84
+ }
85
+ return instances;
86
+ }
87
+ class Instrumentations {
88
+ static setup(tracerProvider, disabledInstrumentors = [], instrumentations) {
89
+ const otelCommunity = loadOtelCommunityInstrumentations(disabledInstrumentors);
90
+ if (instrumentations === undefined) {
91
+ const filteredInstrumentations = this.getFilteredInstrumentations(disabledInstrumentors);
92
+ (0, instrumentation_1.registerInstrumentations)({
93
+ instrumentations: [
94
+ ...filteredInstrumentations.map(([_, instrumentation]) => instrumentation),
95
+ ...otelCommunity,
96
+ ],
97
+ tracerProvider,
98
+ });
99
+ }
100
+ else {
101
+ const filteredInstrumentations = this.getFilteredInstrumentations(disabledInstrumentors, instrumentations);
102
+ filteredInstrumentations.forEach(([k, instrumentation]) => {
103
+ if (this.availableInstrumentations[k].setTracerProvider) {
104
+ this.availableInstrumentations[k].setTracerProvider(tracerProvider);
105
+ }
106
+ if (this.availableInstrumentations[k].manualPatch) {
107
+ this.availableInstrumentations[k].manualPatch(instrumentation);
108
+ }
109
+ });
110
+ (0, instrumentation_1.registerInstrumentations)({
111
+ instrumentations: otelCommunity,
112
+ tracerProvider,
113
+ });
114
+ }
115
+ }
116
+ static getFilteredInstrumentations(disabledInstrumentors, instrumentations) {
117
+ const availableInstrumentations = instrumentations || this.availableInstrumentations;
118
+ return Object.keys(availableInstrumentations)
119
+ .filter((k) => {
120
+ if (disabledInstrumentors.includes(k)) {
121
+ if (typeof availableInstrumentations[k].disable === 'function') {
122
+ availableInstrumentations[k].disable();
123
+ }
124
+ return false;
125
+ }
126
+ if (typeof availableInstrumentations[k].enable === 'function') {
127
+ availableInstrumentations[k].enable();
128
+ }
129
+ return true;
130
+ })
131
+ .map((k) => [k, availableInstrumentations[k]]);
132
+ }
133
+ }
134
+ Instrumentations.availableInstrumentations = {
135
+ openai: new openai_1.default(),
136
+ anthropic: new anthropic_1.default(),
137
+ cohere: new cohere_1.default(),
138
+ groq: new groq_1.default(),
139
+ ai21: new ai21_1.default(),
140
+ gradient: new gradient_1.default(),
141
+ 'browser-use': new browser_use_1.default(),
142
+ mistral: new mistral_1.default(),
143
+ 'google-ai': new google_ai_1.default(),
144
+ vertexai: new vertexai_1.default(),
145
+ together: new together_1.default(),
146
+ ollama: new ollama_1.default(),
147
+ vllm: new vllm_1.default(),
148
+ 'vercel-ai': new vercel_ai_1.default(),
149
+ langchain: new langchain_1.default(),
150
+ langgraph: new langgraph_1.default(),
151
+ pinecone: new pinecone_1.default(),
152
+ bedrock: new bedrock_1.default(),
153
+ llamaindex: new llamaindex_1.default(),
154
+ huggingface: new huggingface_1.default(),
155
+ replicate: new replicate_1.default(),
156
+ chroma: new chroma_1.default(),
157
+ qdrant: new qdrant_1.default(),
158
+ milvus: new milvus_1.default(),
159
+ 'azure-ai-inference': new azure_ai_inference_1.default(),
160
+ 'openai-agents': new openai_agents_1.default(),
161
+ strands: new strands_1.default(),
162
+ 'google-adk': new google_adk_1.default(),
163
+ 'claude-agent-sdk': new claude_agent_sdk_1.default(),
164
+ 'cursor-sdk': new cursor_sdk_1.default(),
165
+ 'astra': new astra_1.default(),
166
+ mcp: new mcp_1.default(),
167
+ mem0: new mem0_1.default(),
168
+ elevenlabs: new elevenlabs_1.default(),
169
+ assemblyai: new assemblyai_1.default(),
170
+ transformers: new transformers_1.default(),
171
+ pg: new pg_1.default(),
172
+ firecrawl: new firecrawl_1.default(),
173
+ letta: new letta_1.default(),
174
+ };
175
+ exports.default = Instrumentations;
176
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/instrumentation/index.ts"],"names":[],"mappings":";;;;;AAAA,oEAA0E;AAI1E,sDAA6C;AAC7C,4DAAmD;AACnD,sDAA6C;AAC7C,kDAAyC;AACzC,kDAAyC;AACzC,0DAAiD;AACjD,gEAAsD;AACtD,wDAA+C;AAC/C,4DAAkD;AAClD,0DAAiD;AACjD,0DAAiD;AACjD,sDAA6C;AAC7C,kDAAyC;AACzC,4DAAkD;AAClD,4DAAmD;AACnD,4DAAmD;AACnD,0DAAiD;AACjD,wDAA+C;AAC/C,8DAAqD;AACrD,gEAAuD;AACvD,4DAAmD;AACnD,sDAA6C;AAC7C,sDAA6C;AAC7C,sDAA6C;AAC7C,8EAAmE;AACnE,oEAA0D;AAC1D,wDAA+C;AAC/C,8DAAoD;AACpD,0EAA+D;AAC/D,8DAAoD;AACpD,oDAA2C;AAC3C,gDAAu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etry/instrumentation';
2
+ import { InstrumentationConfig } from '@opentelemetry/instrumentation';
3
+ export interface LangChainInstrumentationConfig extends InstrumentationConfig {
4
+ }
5
+ export default class Shield360LangChainInstrumentation extends InstrumentationBase {
6
+ private _callbackManager;
7
+ private _ritmHook;
8
+ constructor(config?: LangChainInstrumentationConfig);
9
+ protected init(): void | InstrumentationModuleDefinition | InstrumentationModuleDefinition[];
10
+ enable(): void;
11
+ disable(): void;
12
+ manualPatch(callbacksManagerModule: any): void;
13
+ private _patchFromCache;
14
+ private _applyPatch;
15
+ private _unpatch;
16
+ }
@@ -0,0 +1,91 @@
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 Shield360LangChainInstrumentation extends instrumentation_1.InstrumentationBase {
10
+ constructor(config = {}) {
11
+ super(`${constant_1.INSTRUMENTATION_PREFIX}/instrumentation-langchain`, '1.0.0', config);
12
+ this._callbackManager = null;
13
+ this._ritmHook = null;
14
+ }
15
+ init() {
16
+ return [];
17
+ }
18
+ enable() {
19
+ super.enable();
20
+ if (this._ritmHook)
21
+ return;
22
+ try {
23
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
24
+ const { Hook } = require('require-in-the-middle');
25
+ this._ritmHook = new Hook(['@langchain/core/language_models/chat_models'], { internals: true }, (exports) => {
26
+ this._patchFromCache();
27
+ return exports;
28
+ });
29
+ }
30
+ catch { /* require-in-the-middle not available */ }
31
+ }
32
+ disable() {
33
+ super.disable();
34
+ this._ritmHook?.unhook?.();
35
+ this._ritmHook = null;
36
+ this._unpatch();
37
+ }
38
+ manualPatch(callbacksManagerModule) {
39
+ const CallbackManager = callbacksManagerModule?.CallbackManager;
40
+ if (CallbackManager) {
41
+ this._callbackManager = CallbackManager;
42
+ this._applyPatch(CallbackManager);
43
+ }
44
+ }
45
+ _patchFromCache() {
46
+ try {
47
+ const cache = require.cache;
48
+ for (const filepath of Object.keys(cache)) {
49
+ if (filepath.includes('@langchain') &&
50
+ filepath.includes('callbacks') &&
51
+ filepath.includes('manager') &&
52
+ !filepath.endsWith('.map')) {
53
+ const mod = cache[filepath];
54
+ const CallbackManager = mod?.exports?.CallbackManager;
55
+ if (CallbackManager && typeof CallbackManager._configureSync === 'function') {
56
+ this._callbackManager = CallbackManager;
57
+ this._applyPatch(CallbackManager);
58
+ return;
59
+ }
60
+ }
61
+ }
62
+ }
63
+ catch (e) {
64
+ console.error('LangChain: error scanning require.cache for CallbackManager:', e);
65
+ }
66
+ }
67
+ _applyPatch(CallbackManager) {
68
+ try {
69
+ if ((0, instrumentation_1.isWrapped)(CallbackManager._configureSync)) {
70
+ this._unwrap(CallbackManager, '_configureSync');
71
+ }
72
+ this._wrap(CallbackManager, '_configureSync', wrapper_1.default._patchConfigure(this.tracer));
73
+ }
74
+ catch (e) {
75
+ console.error('Error in LangChain _patch method:', e);
76
+ }
77
+ }
78
+ _unpatch() {
79
+ if (!this._callbackManager)
80
+ return;
81
+ try {
82
+ if ((0, instrumentation_1.isWrapped)(this._callbackManager._configureSync)) {
83
+ this._unwrap(this._callbackManager, '_configureSync');
84
+ }
85
+ }
86
+ catch { /* ignore */ }
87
+ this._callbackManager = null;
88
+ }
89
+ }
90
+ exports.default = Shield360LangChainInstrumentation;
91
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentation/langchain/index.ts"],"names":[],"mappings":";;;;;AAAA,oEAIwC;AAExC,6CAAwD;AACxD,wDAAyC;AAIzC,MAAqB,iCAAkC,SAAQ,qCAAmB;IAIhF,YAAY,SAAyC,EAAE;QACrD,KAAK,CAAC,GAAG,iCAAsB,4BAA4B,EAAE,OAAO,EAAE,MAAM,CAAC,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,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;YACxD,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;QACxB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;CACF;AA5FD,oDA4FC"}
@@ -0,0 +1,41 @@
1
+ import { Tracer } from '@opentelemetry/api';
2
+ import { runWithFrameworkLlm } from '../../helpers';
3
+ import BaseWrapper from '../base-wrapper';
4
+ declare class Shield360CallbackHandler {
5
+ name: string;
6
+ lc_serializable: boolean;
7
+ awaitHandlers: boolean;
8
+ private tracer;
9
+ private spans;
10
+ private skippedRuns;
11
+ constructor(tracer: Tracer);
12
+ private _getNameFromCallback;
13
+ private _resolveParentRunId;
14
+ private _getParentContext;
15
+ private _createSpan;
16
+ private _newHolder;
17
+ private _setCommonAttributes;
18
+ private _setModelParameters;
19
+ private _endSpan;
20
+ handleChainStart(chain: any, inputs: any, runId: string, parentRunId?: string, _tags?: string[], metadata?: any, _runType?: string, name?: string): void;
21
+ handleChainEnd(outputs: any, runId: string): void;
22
+ handleChainError(error: any, runId: string): void;
23
+ handleChatModelStart(llm: any, messages: any[][], runId: string, parentRunId?: string, _extraParams?: any, _tags?: string[], metadata?: any, kwargs?: any): void;
24
+ handleLLMStart(serialized: any, prompts: string[], runId: string, parentRunId?: string, _extraParams?: any, _tags?: string[], metadata?: any, kwargs?: any): void;
25
+ handleLLMNewToken(token: string, _idx: any, runId: string, _chunk?: any): void;
26
+ handleLLMEnd(output: any, runId: string): void;
27
+ handleLLMError(error: any, runId: string): void;
28
+ handleToolStart(tool: any, input: string, runId: string, parentRunId?: string, _tags?: string[], metadata?: any, kwargs?: any): void;
29
+ handleToolEnd(output: any, runId: string): void;
30
+ handleToolError(error: any, runId: string): void;
31
+ handleRetrieverStart(retriever: any, query: string, runId: string, parentRunId?: string, _tags?: string[], metadata?: any, kwargs?: any): void;
32
+ handleRetrieverEnd(documents: any[], runId: string): void;
33
+ handleRetrieverError(error: any, runId: string): void;
34
+ handleAgentAction(action: any, runId: string): void;
35
+ handleAgentFinish(finish: any, runId: string): void;
36
+ }
37
+ declare class LangChainWrapper extends BaseWrapper {
38
+ static _patchConfigure(tracer: Tracer): any;
39
+ }
40
+ export { Shield360CallbackHandler, runWithFrameworkLlm };
41
+ export default LangChainWrapper;