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,584 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const api_1 = require("@opentelemetry/api");
40
+ const config_1 = __importDefault(require("../../config"));
41
+ const helpers_1 = __importStar(require("../../helpers"));
42
+ const semantic_convention_1 = __importDefault(require("../../semantic-convention"));
43
+ const base_wrapper_1 = __importDefault(require("../base-wrapper"));
44
+ const utils_1 = require("./utils");
45
+ const AI_SYSTEM = semantic_convention_1.default.GEN_AI_SYSTEM_DIGITALOCEAN;
46
+ class GradientWrapper extends base_wrapper_1.default {
47
+ static _patchChatCompletionCreate(tracer) {
48
+ return GradientWrapper._buildChatPatch(tracer, {
49
+ operationName: semantic_convention_1.default.GEN_AI_OPERATION_TYPE_CHAT,
50
+ endpointKind: 'inference',
51
+ genAIEndpoint: 'digitalocean.chat.completions',
52
+ apiType: 'chat',
53
+ });
54
+ }
55
+ static _patchAgentChatCompletionCreate(tracer) {
56
+ return GradientWrapper._buildChatPatch(tracer, {
57
+ operationName: semantic_convention_1.default.GEN_AI_OPERATION_TYPE_AGENT,
58
+ endpointKind: 'agent',
59
+ genAIEndpoint: 'digitalocean.agents.chat.completions',
60
+ apiType: 'chat',
61
+ isAgent: true,
62
+ });
63
+ }
64
+ static _buildChatPatch(tracer, options) {
65
+ const { operationName, endpointKind, genAIEndpoint, apiType, isAgent = false } = options;
66
+ return (originalMethod) => {
67
+ return async function (...args) {
68
+ if ((0, helpers_1.isFrameworkLlmActive)())
69
+ return originalMethod.apply(this, args);
70
+ const body = args[0] || {};
71
+ const requestModel = body.model || 'unknown';
72
+ const [serverAddress, serverPort] = (0, utils_1.resolveGradientEndpoint)(this, endpointKind);
73
+ const spanName = `${operationName} ${requestModel}`;
74
+ const effectiveCtx = (0, helpers_1.getFrameworkParentContext)() ?? api_1.context.active();
75
+ const span = tracer.startSpan(spanName, {
76
+ kind: api_1.SpanKind.CLIENT,
77
+ attributes: (0, utils_1.gradientSpanCreationAttrs)(operationName, requestModel, serverAddress, serverPort),
78
+ }, effectiveCtx);
79
+ if (isAgent) {
80
+ const agentId = (0, utils_1.agentIdFromHost)(serverAddress);
81
+ if (agentId) {
82
+ span.setAttribute(semantic_convention_1.default.GEN_AI_AGENT_ID, agentId);
83
+ }
84
+ }
85
+ return api_1.context
86
+ .with(api_1.trace.setSpan(effectiveCtx, span), async () => originalMethod.apply(this, args))
87
+ .then((response) => {
88
+ if (body.stream) {
89
+ return helpers_1.default.createStreamProxy(response, GradientWrapper._chatCompletionGenerator({
90
+ args,
91
+ genAIEndpoint,
92
+ response,
93
+ span,
94
+ serverAddress,
95
+ serverPort,
96
+ operationName,
97
+ apiType,
98
+ }));
99
+ }
100
+ return GradientWrapper._chatCompletion({
101
+ args,
102
+ genAIEndpoint,
103
+ response,
104
+ span,
105
+ serverAddress,
106
+ serverPort,
107
+ operationName,
108
+ apiType,
109
+ });
110
+ })
111
+ .catch((e) => {
112
+ helpers_1.default.handleException(span, e);
113
+ base_wrapper_1.default.recordMetrics(span, {
114
+ genAIEndpoint,
115
+ model: requestModel,
116
+ aiSystem: AI_SYSTEM,
117
+ serverAddress,
118
+ serverPort,
119
+ errorType: e?.constructor?.name || '_OTHER',
120
+ });
121
+ span.end();
122
+ throw e;
123
+ });
124
+ };
125
+ };
126
+ }
127
+ static _patchImageGenerate(tracer) {
128
+ const genAIEndpoint = 'digitalocean.images.generate';
129
+ return (originalMethod) => {
130
+ return async function (...args) {
131
+ if ((0, helpers_1.isFrameworkLlmActive)())
132
+ return originalMethod.apply(this, args);
133
+ const body = args[0] || {};
134
+ const requestModel = body.model || 'unknown';
135
+ const [serverAddress, serverPort] = (0, utils_1.resolveGradientEndpoint)(this, 'inference');
136
+ const spanName = `${semantic_convention_1.default.GEN_AI_OPERATION_TYPE_CHAT} ${requestModel}`;
137
+ const effectiveCtx = (0, helpers_1.getFrameworkParentContext)() ?? api_1.context.active();
138
+ const span = tracer.startSpan(spanName, {
139
+ kind: api_1.SpanKind.CLIENT,
140
+ attributes: (0, utils_1.gradientSpanCreationAttrs)(semantic_convention_1.default.GEN_AI_OPERATION_TYPE_CHAT, requestModel, serverAddress, serverPort),
141
+ }, effectiveCtx);
142
+ return api_1.context.with(api_1.trace.setSpan(effectiveCtx, span), async () => {
143
+ let metricParams;
144
+ try {
145
+ const response = await originalMethod.apply(this, args);
146
+ metricParams = GradientWrapper._imageGenerateCommonSetter({
147
+ args,
148
+ genAIEndpoint,
149
+ response,
150
+ span,
151
+ serverAddress,
152
+ serverPort,
153
+ });
154
+ return response;
155
+ }
156
+ catch (e) {
157
+ helpers_1.default.handleException(span, e);
158
+ base_wrapper_1.default.recordMetrics(span, {
159
+ genAIEndpoint,
160
+ model: requestModel,
161
+ aiSystem: AI_SYSTEM,
162
+ serverAddress,
163
+ serverPort,
164
+ errorType: e?.constructor?.name || '_OTHER',
165
+ });
166
+ throw e;
167
+ }
168
+ finally {
169
+ span.end();
170
+ if (metricParams) {
171
+ base_wrapper_1.default.recordMetrics(span, metricParams);
172
+ }
173
+ }
174
+ });
175
+ };
176
+ };
177
+ }
178
+ static async _chatCompletion({ args, genAIEndpoint, response, span, serverAddress, serverPort, operationName, apiType, }) {
179
+ let metricParams;
180
+ try {
181
+ metricParams = await GradientWrapper._chatCompletionCommonSetter({
182
+ args,
183
+ genAIEndpoint,
184
+ result: response,
185
+ span,
186
+ serverAddress,
187
+ serverPort,
188
+ operationName,
189
+ apiType,
190
+ });
191
+ return response;
192
+ }
193
+ catch (e) {
194
+ helpers_1.default.handleException(span, e);
195
+ throw e;
196
+ }
197
+ finally {
198
+ span.end();
199
+ if (metricParams) {
200
+ base_wrapper_1.default.recordMetrics(span, metricParams);
201
+ }
202
+ }
203
+ }
204
+ static async *_chatCompletionGenerator({ args, genAIEndpoint, response, span, serverAddress, serverPort, operationName, apiType, }) {
205
+ let metricParams;
206
+ const timestamps = [];
207
+ const startTime = Date.now();
208
+ try {
209
+ const { messages } = args[0];
210
+ let { tools } = args[0];
211
+ const result = {
212
+ id: '0',
213
+ created: -1,
214
+ model: '',
215
+ system_fingerprint: '',
216
+ choices: [
217
+ {
218
+ index: 0,
219
+ logprobs: null,
220
+ finish_reason: 'stop',
221
+ message: { role: 'assistant', content: '', reasoning_content: '' },
222
+ },
223
+ ],
224
+ usage: {
225
+ prompt_tokens: 0,
226
+ completion_tokens: 0,
227
+ total_tokens: 0,
228
+ output_tokens_details: { reasoning_tokens: 0 },
229
+ },
230
+ };
231
+ const toolCalls = [];
232
+ let reasoningText = '';
233
+ for await (const chunk of response) {
234
+ timestamps.push(Date.now());
235
+ if (chunk.id)
236
+ result.id = chunk.id;
237
+ if (chunk.created)
238
+ result.created = chunk.created;
239
+ if (chunk.model)
240
+ result.model = chunk.model;
241
+ if (chunk.system_fingerprint)
242
+ result.system_fingerprint = chunk.system_fingerprint;
243
+ if (chunk.choices?.[0]?.finish_reason) {
244
+ result.choices[0].finish_reason = chunk.choices[0].finish_reason;
245
+ }
246
+ if (chunk.choices?.[0]?.logprobs) {
247
+ result.choices[0].logprobs = chunk.choices[0].logprobs;
248
+ }
249
+ if (chunk.choices?.[0]?.delta?.content) {
250
+ result.choices[0].message.content += chunk.choices[0].delta.content;
251
+ }
252
+ if (chunk.choices?.[0]?.delta?.reasoning_content) {
253
+ reasoningText += chunk.choices[0].delta.reasoning_content;
254
+ result.choices[0].message.reasoning_content = reasoningText;
255
+ }
256
+ if (chunk.choices?.[0]?.delta?.tool_calls) {
257
+ const deltaTools = chunk.choices[0].delta.tool_calls;
258
+ for (const tool of deltaTools) {
259
+ const idx = tool.index || 0;
260
+ while (toolCalls.length <= idx) {
261
+ toolCalls.push({
262
+ id: '',
263
+ type: 'function',
264
+ function: { name: '', arguments: '' },
265
+ });
266
+ }
267
+ if (tool.id) {
268
+ toolCalls[idx].id = tool.id;
269
+ toolCalls[idx].type = tool.type || 'function';
270
+ if (tool.function?.name)
271
+ toolCalls[idx].function.name = tool.function.name;
272
+ if (tool.function?.arguments)
273
+ toolCalls[idx].function.arguments = tool.function.arguments;
274
+ }
275
+ else if (tool.function?.arguments) {
276
+ toolCalls[idx].function.arguments += tool.function.arguments;
277
+ }
278
+ }
279
+ tools = true;
280
+ }
281
+ if (chunk.usage) {
282
+ result.usage.prompt_tokens = chunk.usage.prompt_tokens || 0;
283
+ result.usage.completion_tokens = chunk.usage.completion_tokens || 0;
284
+ result.usage.total_tokens = chunk.usage.total_tokens || 0;
285
+ const details = chunk.usage.output_tokens_details || chunk.usage.completion_tokens_details;
286
+ if (details?.reasoning_tokens) {
287
+ result.usage.output_tokens_details.reasoning_tokens = details.reasoning_tokens;
288
+ }
289
+ }
290
+ yield chunk;
291
+ }
292
+ if (toolCalls.length > 0) {
293
+ result.choices[0].message = {
294
+ ...result.choices[0].message,
295
+ tool_calls: toolCalls,
296
+ };
297
+ }
298
+ if (!result.usage.prompt_tokens && !result.usage.completion_tokens) {
299
+ let promptTokens = 0;
300
+ for (const message of messages || []) {
301
+ promptTokens += helpers_1.default.openaiTokens(message.content, result.model) ?? 0;
302
+ }
303
+ const completionTokens = helpers_1.default.openaiTokens(result.choices[0].message.content ?? '', result.model);
304
+ if (completionTokens) {
305
+ result.usage = {
306
+ ...result.usage,
307
+ prompt_tokens: promptTokens,
308
+ completion_tokens: completionTokens,
309
+ total_tokens: promptTokens + completionTokens,
310
+ };
311
+ }
312
+ }
313
+ args[0].tools = tools;
314
+ const ttft = timestamps.length > 0 ? (timestamps[0] - startTime) / 1000 : 0;
315
+ let tbt = 0;
316
+ if (timestamps.length > 1) {
317
+ const timeDiffs = timestamps.slice(1).map((t, i) => t - timestamps[i]);
318
+ tbt = timeDiffs.reduce((a, b) => a + b, 0) / timeDiffs.length / 1000;
319
+ }
320
+ metricParams = await GradientWrapper._chatCompletionCommonSetter({
321
+ args,
322
+ genAIEndpoint,
323
+ result,
324
+ span,
325
+ ttft,
326
+ tbt,
327
+ serverAddress,
328
+ serverPort,
329
+ operationName,
330
+ apiType,
331
+ reasoningText,
332
+ });
333
+ return result;
334
+ }
335
+ catch (e) {
336
+ helpers_1.default.handleException(span, e);
337
+ throw e;
338
+ }
339
+ finally {
340
+ span.end();
341
+ if (metricParams) {
342
+ base_wrapper_1.default.recordMetrics(span, metricParams);
343
+ }
344
+ }
345
+ }
346
+ static _imageGenerateCommonSetter({ args, genAIEndpoint, response, span, serverAddress, serverPort, }) {
347
+ const captureContent = config_1.default.captureMessageContent;
348
+ const body = args[0] || {};
349
+ const requestModel = body.model || 'unknown';
350
+ const responseModel = response?.model || requestModel;
351
+ const size = body.size || response?.size || '1024x1024';
352
+ const quality = body.quality || response?.quality || 'standard';
353
+ const pricingInfo = config_1.default.pricingInfo || {};
354
+ const cost = helpers_1.default.getImageModelCost(requestModel, pricingInfo, size, quality);
355
+ GradientWrapper.setBaseSpanAttributes(span, {
356
+ genAIEndpoint,
357
+ model: requestModel,
358
+ user: body.user,
359
+ cost,
360
+ aiSystem: AI_SYSTEM,
361
+ serverAddress,
362
+ serverPort,
363
+ });
364
+ span.setAttribute(semantic_convention_1.default.GEN_AI_OUTPUT_TYPE, 'image');
365
+ if (response?.created != null) {
366
+ span.setAttribute(semantic_convention_1.default.GEN_AI_RESPONSE_ID, String(response.created));
367
+ }
368
+ span.setAttribute(semantic_convention_1.default.GEN_AI_RESPONSE_MODEL, responseModel);
369
+ if (captureContent && body.prompt) {
370
+ span.setAttribute(semantic_convention_1.default.GEN_AI_INPUT_MESSAGES, JSON.stringify([
371
+ {
372
+ role: 'user',
373
+ parts: [{ type: 'text', content: String(body.prompt) }],
374
+ },
375
+ ]));
376
+ }
377
+ return {
378
+ genAIEndpoint,
379
+ model: requestModel,
380
+ user: body.user,
381
+ cost,
382
+ aiSystem: AI_SYSTEM,
383
+ serverAddress,
384
+ serverPort,
385
+ };
386
+ }
387
+ static async _chatCompletionCommonSetter({ args, genAIEndpoint, result, span, ttft = 0, tbt = 0, serverAddress, serverPort, operationName = semantic_convention_1.default.GEN_AI_OPERATION_TYPE_CHAT, apiType = 'chat', reasoningText, }) {
388
+ const captureContent = config_1.default.captureMessageContent;
389
+ const body = args[0] || {};
390
+ const requestModel = body.model || 'unknown';
391
+ const { messages, tools: _tools, stream: _stream = false } = body;
392
+ (0, utils_1.applyGradientChatRequestAttributes)(span, body);
393
+ span.setAttribute(semantic_convention_1.default.OPENAI_API_TYPE, apiType);
394
+ if (captureContent) {
395
+ span.setAttribute(semantic_convention_1.default.GEN_AI_INPUT_MESSAGES, helpers_1.default.buildInputMessages(messages || []));
396
+ }
397
+ if (result.id) {
398
+ span.setAttribute(semantic_convention_1.default.GEN_AI_RESPONSE_ID, result.id);
399
+ }
400
+ const responseModel = result.model || requestModel;
401
+ const usage = result.usage || { prompt_tokens: 0, completion_tokens: 0, total_tokens: 0 };
402
+ const pricingInfo = config_1.default.pricingInfo || {};
403
+ const cost = helpers_1.default.getChatModelCost(requestModel, pricingInfo, usage.prompt_tokens, usage.completion_tokens);
404
+ GradientWrapper.setBaseSpanAttributes(span, {
405
+ genAIEndpoint,
406
+ model: requestModel,
407
+ user: body.user,
408
+ cost,
409
+ aiSystem: AI_SYSTEM,
410
+ serverAddress,
411
+ serverPort,
412
+ });
413
+ span.setAttribute(semantic_convention_1.default.GEN_AI_RESPONSE_MODEL, responseModel);
414
+ if (result.system_fingerprint) {
415
+ span.setAttribute(semantic_convention_1.default.GEN_AI_RESPONSE_SYSTEM_FINGERPRINT, result.system_fingerprint);
416
+ }
417
+ const inputTokens = usage.prompt_tokens || 0;
418
+ const outputTokens = usage.completion_tokens || 0;
419
+ span.setAttribute(semantic_convention_1.default.GEN_AI_USAGE_INPUT_TOKENS, inputTokens);
420
+ span.setAttribute(semantic_convention_1.default.GEN_AI_USAGE_OUTPUT_TOKENS, outputTokens);
421
+ span.setAttribute(semantic_convention_1.default.GEN_AI_CLIENT_TOKEN_USAGE, inputTokens + outputTokens);
422
+ const reasoningTokens = usage.output_tokens_details?.reasoning_tokens ??
423
+ usage.completion_tokens_details?.reasoning_tokens ??
424
+ 0;
425
+ if (reasoningTokens) {
426
+ span.setAttribute(semantic_convention_1.default.GEN_AI_USAGE_REASONING_TOKENS, reasoningTokens);
427
+ }
428
+ if (ttft > 0) {
429
+ span.setAttribute(semantic_convention_1.default.GEN_AI_SERVER_TTFT, ttft);
430
+ }
431
+ if (tbt > 0) {
432
+ span.setAttribute(semantic_convention_1.default.GEN_AI_SERVER_TBT, tbt);
433
+ }
434
+ if (result.choices?.[0]?.finish_reason) {
435
+ span.setAttribute(semantic_convention_1.default.GEN_AI_RESPONSE_FINISH_REASON, [
436
+ result.choices[0].finish_reason,
437
+ ]);
438
+ }
439
+ const outputType = body.response_format?.type === 'json_object'
440
+ ? semantic_convention_1.default.GEN_AI_OUTPUT_TYPE_JSON
441
+ : semantic_convention_1.default.GEN_AI_OUTPUT_TYPE_TEXT;
442
+ span.setAttribute(semantic_convention_1.default.GEN_AI_OUTPUT_TYPE, outputType);
443
+ const message = result.choices?.[0]?.message || {};
444
+ const resolvedReasoning = reasoningText ||
445
+ message.reasoning_content ||
446
+ '';
447
+ if (message.tool_calls) {
448
+ const toolCalls = message.tool_calls;
449
+ const toolNames = toolCalls.map((t) => t.function?.name || '').filter(Boolean);
450
+ const toolIds = toolCalls.map((t) => t.id || '').filter(Boolean);
451
+ const toolArgs = toolCalls.map((t) => t.function?.arguments || '').filter(Boolean);
452
+ if (toolNames.length > 0) {
453
+ span.setAttribute(semantic_convention_1.default.GEN_AI_TOOL_NAME, toolNames.join(', '));
454
+ }
455
+ if (toolIds.length > 0) {
456
+ span.setAttribute(semantic_convention_1.default.GEN_AI_TOOL_CALL_ID, toolIds.join(', '));
457
+ }
458
+ if (toolArgs.length > 0) {
459
+ span.setAttribute(semantic_convention_1.default.GEN_AI_TOOL_ARGS, toolArgs.join(', '));
460
+ }
461
+ }
462
+ let inputMessagesJson;
463
+ let outputMessagesJson;
464
+ const toolDefinitionsJson = helpers_1.default.buildToolDefinitions(_tools);
465
+ const systemInstructionsJson = helpers_1.default.buildSystemInstructionsFromMessages(messages || []);
466
+ const versionExtras = {};
467
+ try {
468
+ const maxTokens = body.max_completion_tokens ?? body.max_tokens ?? null;
469
+ const versionHash = helpers_1.default.computeAgentVersionHash({
470
+ systemInstructions: systemInstructionsJson ?? null,
471
+ toolDefinitions: toolDefinitionsJson ?? null,
472
+ primaryModel: responseModel || requestModel,
473
+ runtimeConfig: {
474
+ temperature: body.temperature ?? null,
475
+ top_p: body.top_p ?? null,
476
+ max_tokens: maxTokens,
477
+ provider: AI_SYSTEM,
478
+ },
479
+ providers: [AI_SYSTEM],
480
+ });
481
+ if (versionHash) {
482
+ versionExtras[semantic_convention_1.default.SHIELD360_AGENT_VERSION_HASH] = versionHash;
483
+ span.setAttribute(semantic_convention_1.default.SHIELD360_AGENT_VERSION_HASH, versionHash);
484
+ }
485
+ }
486
+ catch {
487
+ // Never fail the wrapped call on hash issues.
488
+ }
489
+ const versionLabel = (0, helpers_1.getCurrentAgentVersion)();
490
+ if (versionLabel) {
491
+ versionExtras[semantic_convention_1.default.GEN_AI_AGENT_VERSION] = versionLabel;
492
+ span.setAttribute(semantic_convention_1.default.GEN_AI_AGENT_VERSION, versionLabel);
493
+ }
494
+ if (captureContent) {
495
+ const toolCalls = message.tool_calls;
496
+ outputMessagesJson = GradientWrapper._buildOutputMessages(message.content || '', result.choices?.[0]?.finish_reason || 'stop', toolCalls, resolvedReasoning || undefined);
497
+ span.setAttribute(semantic_convention_1.default.GEN_AI_OUTPUT_MESSAGES, outputMessagesJson);
498
+ inputMessagesJson = helpers_1.default.buildInputMessages(messages || []);
499
+ if (systemInstructionsJson) {
500
+ span.setAttribute(semantic_convention_1.default.GEN_AI_SYSTEM_INSTRUCTIONS, systemInstructionsJson);
501
+ }
502
+ }
503
+ if (toolDefinitionsJson) {
504
+ span.setAttribute(semantic_convention_1.default.GEN_AI_TOOL_DEFINITIONS, toolDefinitionsJson);
505
+ }
506
+ if (!config_1.default.disableEvents) {
507
+ const eventAttrs = {
508
+ [semantic_convention_1.default.GEN_AI_OPERATION]: operationName,
509
+ [semantic_convention_1.default.GEN_AI_REQUEST_MODEL]: requestModel,
510
+ [semantic_convention_1.default.GEN_AI_RESPONSE_MODEL]: responseModel,
511
+ [semantic_convention_1.default.SERVER_ADDRESS]: serverAddress,
512
+ [semantic_convention_1.default.SERVER_PORT]: serverPort,
513
+ [semantic_convention_1.default.GEN_AI_RESPONSE_ID]: result.id,
514
+ [semantic_convention_1.default.GEN_AI_RESPONSE_FINISH_REASON]: [result.choices?.[0]?.finish_reason],
515
+ [semantic_convention_1.default.GEN_AI_OUTPUT_TYPE]: outputType,
516
+ [semantic_convention_1.default.GEN_AI_USAGE_INPUT_TOKENS]: inputTokens,
517
+ [semantic_convention_1.default.GEN_AI_USAGE_OUTPUT_TOKENS]: outputTokens,
518
+ ...versionExtras,
519
+ };
520
+ if (captureContent) {
521
+ if (inputMessagesJson)
522
+ eventAttrs[semantic_convention_1.default.GEN_AI_INPUT_MESSAGES] = inputMessagesJson;
523
+ if (systemInstructionsJson) {
524
+ eventAttrs[semantic_convention_1.default.GEN_AI_SYSTEM_INSTRUCTIONS] = systemInstructionsJson;
525
+ }
526
+ if (outputMessagesJson) {
527
+ eventAttrs[semantic_convention_1.default.GEN_AI_OUTPUT_MESSAGES] = outputMessagesJson;
528
+ }
529
+ }
530
+ if (toolDefinitionsJson) {
531
+ eventAttrs[semantic_convention_1.default.GEN_AI_TOOL_DEFINITIONS] = toolDefinitionsJson;
532
+ }
533
+ helpers_1.default.emitInferenceEvent(span, eventAttrs);
534
+ }
535
+ return {
536
+ genAIEndpoint,
537
+ model: requestModel,
538
+ user: body.user,
539
+ cost,
540
+ aiSystem: AI_SYSTEM,
541
+ serverAddress,
542
+ serverPort,
543
+ };
544
+ }
545
+ static _buildOutputMessages(text, finishReason, toolCalls, reasoning) {
546
+ try {
547
+ const parts = [];
548
+ if (reasoning) {
549
+ parts.push({ type: 'reasoning', content: reasoning });
550
+ }
551
+ if (text) {
552
+ parts.push({ type: 'text', content: text });
553
+ }
554
+ if (toolCalls?.length) {
555
+ for (const tc of toolCalls) {
556
+ let argsVal = tc.function?.arguments || tc.arguments || {};
557
+ if (typeof argsVal === 'string') {
558
+ try {
559
+ argsVal = JSON.parse(argsVal);
560
+ }
561
+ catch {
562
+ argsVal = { raw: argsVal };
563
+ }
564
+ }
565
+ parts.push({
566
+ type: 'tool_call',
567
+ id: tc.id || '',
568
+ name: tc.function?.name || tc.name || '',
569
+ arguments: argsVal,
570
+ });
571
+ }
572
+ }
573
+ return JSON.stringify([
574
+ { role: 'assistant', parts, finish_reason: finishReason || 'stop' },
575
+ ]);
576
+ }
577
+ catch {
578
+ return '[]';
579
+ }
580
+ }
581
+ }
582
+ GradientWrapper.aiSystem = AI_SYSTEM;
583
+ exports.default = GradientWrapper;
584
+ //# sourceMappingURL=wrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../../src/instrumentation/gradient/wrapper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAwF;AACxF,0DAA2C;AAC3C,yDAIuB;AACvB,oFAA2D;AAC3D,mEAA0C;AAC1C,mCAMiB;AAEjB,MAAM,SAAS,GAAG,6BAAkB,CAAC,0BAA0B,CAAC;AAUhE,MAAM,eAAgB,SAAQ,sBAAW;IAGvC,MAAM,CAAC,0BAA0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AI,IAAI,EAAE,CAAC,IAAI,IAAI,EAAE;wBACxC,SAAS,EAAE,OAAO;qBACnB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YACD,OAAO,IAAI,CAAC,SAAS,CAAC;gBACpB,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,IAAI,MAAM,EAAE;aACpE,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;;AA3qBM,wBAAQ,GAAG,SAAS,CAAC;AA8qB9B,kBAAe,eAAe,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { InstrumentationBase, InstrumentationModuleDefinition } from '@opentelemetry/instrumentation';
2
+ import { InstrumentationConfig } from '@opentelemetry/instrumentation';
3
+ export interface GroqInstrumentationConfig extends InstrumentationConfig {
4
+ }
5
+ export default class Shield360GroqInstrumentation extends InstrumentationBase {
6
+ constructor(config?: GroqInstrumentationConfig);
7
+ protected init(): void | InstrumentationModuleDefinition | InstrumentationModuleDefinition[];
8
+ manualPatch(groq: any): void;
9
+ protected _patch(moduleExports: any): void;
10
+ protected _unpatch(moduleExports: any): void;
11
+ }