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,529 @@
1
+ "use strict";
2
+ /**
3
+ * Cross-Language Trace Comparison Tests for HuggingFace Inference Integration
4
+ *
5
+ * Verifies that the TypeScript SDK generates traces consistent with
6
+ * OTel GenAI semantic conventions and the OpenAI reference wrapper pattern.
7
+ */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const wrapper_1 = __importDefault(require("../huggingface/wrapper"));
13
+ const config_1 = __importDefault(require("../../config"));
14
+ const helpers_1 = __importDefault(require("../../helpers"));
15
+ const base_wrapper_1 = __importDefault(require("../base-wrapper"));
16
+ const semantic_convention_1 = __importDefault(require("../../semantic-convention"));
17
+ jest.mock('../../config');
18
+ jest.mock('../../helpers');
19
+ jest.mock('../base-wrapper');
20
+ describe('HuggingFace Cross-Language Trace Comparison', () => {
21
+ let mockSpan;
22
+ let mockTracer;
23
+ beforeEach(() => {
24
+ mockSpan = {
25
+ setAttribute: jest.fn(),
26
+ addEvent: jest.fn(),
27
+ end: jest.fn(),
28
+ setStatus: jest.fn(),
29
+ };
30
+ mockTracer = {
31
+ startSpan: jest.fn().mockReturnValue(mockSpan),
32
+ };
33
+ config_1.default.environment = 'shield360-testing';
34
+ config_1.default.applicationName = 'shield360-test';
35
+ config_1.default.captureMessageContent = true;
36
+ config_1.default.pricingInfo = {};
37
+ config_1.default.disableEvents = false;
38
+ helpers_1.default.getChatModelCost = jest.fn().mockReturnValue(0.0005);
39
+ helpers_1.default.generalTokens = jest.fn().mockReturnValue(8);
40
+ helpers_1.default.buildInputMessages = jest.fn().mockReturnValue('[]');
41
+ helpers_1.default.buildOutputMessages = jest.fn().mockReturnValue('[]');
42
+ helpers_1.default.handleException = jest.fn();
43
+ helpers_1.default.emitInferenceEvent = jest.fn();
44
+ helpers_1.default.createStreamProxy = jest.fn().mockImplementation((stream, _gen) => stream);
45
+ base_wrapper_1.default.recordMetrics = jest.fn();
46
+ base_wrapper_1.default.setBaseSpanAttributes = jest.fn().mockImplementation((span, attrs) => {
47
+ span.setAttribute(semantic_convention_1.default.GEN_AI_PROVIDER_NAME_OTEL, attrs.aiSystem);
48
+ span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_MODEL, attrs.model);
49
+ if (attrs.cost !== undefined)
50
+ span.setAttribute(semantic_convention_1.default.GEN_AI_USAGE_COST, attrs.cost);
51
+ if (attrs.serverAddress)
52
+ span.setAttribute(semantic_convention_1.default.SERVER_ADDRESS, attrs.serverAddress);
53
+ if (attrs.serverPort !== undefined)
54
+ span.setAttribute(semantic_convention_1.default.SERVER_PORT, attrs.serverPort);
55
+ });
56
+ });
57
+ afterEach(() => {
58
+ jest.clearAllMocks();
59
+ });
60
+ // ── Span Creation ──────────────────────────────────────────────────────────
61
+ describe('Span Creation', () => {
62
+ it('should create span with name "{operation} {model}"', () => {
63
+ const patchedFn = wrapper_1.default._patchChatCompletion(mockTracer);
64
+ const originalMethod = jest.fn().mockResolvedValue({
65
+ id: 'test', model: 'meta-llama/Meta-Llama-3-8B-Instruct',
66
+ choices: [{ message: { content: 'hi' }, finish_reason: 'stop' }],
67
+ usage: { prompt_tokens: 5, completion_tokens: 3, total_tokens: 8 },
68
+ });
69
+ const wrapped = patchedFn(originalMethod);
70
+ wrapped.call({}, { model: 'meta-llama/Meta-Llama-3-8B-Instruct', messages: [] });
71
+ expect(mockTracer.startSpan).toHaveBeenCalledWith('chat meta-llama/Meta-Llama-3-8B-Instruct', expect.objectContaining({
72
+ kind: expect.any(Number),
73
+ attributes: expect.objectContaining({
74
+ [semantic_convention_1.default.GEN_AI_OPERATION]: 'chat',
75
+ [semantic_convention_1.default.GEN_AI_PROVIDER_NAME_OTEL]: 'huggingface',
76
+ [semantic_convention_1.default.GEN_AI_REQUEST_MODEL]: 'meta-llama/Meta-Llama-3-8B-Instruct',
77
+ [semantic_convention_1.default.SERVER_ADDRESS]: 'api-inference.huggingface.co',
78
+ [semantic_convention_1.default.SERVER_PORT]: 443,
79
+ }),
80
+ }), expect.anything());
81
+ });
82
+ it('should create text generation span with name "text_completion {model}"', () => {
83
+ const patchedFn = wrapper_1.default._patchTextGeneration(mockTracer);
84
+ const originalMethod = jest.fn().mockResolvedValue({ generated_text: 'result' });
85
+ const wrapped = patchedFn(originalMethod);
86
+ wrapped.call({}, { model: 'gpt2', inputs: 'test' });
87
+ expect(mockTracer.startSpan).toHaveBeenCalledWith('text_completion gpt2', expect.objectContaining({
88
+ attributes: expect.objectContaining({
89
+ [semantic_convention_1.default.GEN_AI_OPERATION]: 'text_completion',
90
+ [semantic_convention_1.default.GEN_AI_PROVIDER_NAME_OTEL]: 'huggingface',
91
+ [semantic_convention_1.default.GEN_AI_REQUEST_MODEL]: 'gpt2',
92
+ }),
93
+ }), expect.anything());
94
+ });
95
+ });
96
+ // ── Chat Completion ───────────────────────────────────────────────────────
97
+ describe('Chat Completion', () => {
98
+ const mockArgs = [
99
+ {
100
+ model: 'meta-llama/Meta-Llama-3-8B-Instruct',
101
+ messages: [{ role: 'user', content: 'What is LLM Observability?' }],
102
+ max_tokens: 100,
103
+ temperature: 0.7,
104
+ stream: false,
105
+ },
106
+ ];
107
+ const mockResponse = {
108
+ id: 'hf-chat-123',
109
+ created: Date.now(),
110
+ model: 'meta-llama/Meta-Llama-3-8B-Instruct',
111
+ choices: [
112
+ {
113
+ index: 0,
114
+ finish_reason: 'stop',
115
+ message: { role: 'assistant', content: 'LLM Observability is...' },
116
+ },
117
+ ],
118
+ usage: { prompt_tokens: 12, completion_tokens: 25, total_tokens: 37 },
119
+ };
120
+ it('should set gen_ai.provider.name = "huggingface" via setBaseSpanAttributes', async () => {
121
+ await wrapper_1.default._chatCompletion({
122
+ args: mockArgs,
123
+ genAIEndpoint: 'huggingface.chat.completions',
124
+ response: mockResponse,
125
+ span: mockSpan,
126
+ });
127
+ expect(base_wrapper_1.default.setBaseSpanAttributes).toHaveBeenCalledWith(mockSpan, expect.objectContaining({ aiSystem: 'huggingface' }));
128
+ });
129
+ it('should set token usage attributes without sentinel total_tokens', async () => {
130
+ await wrapper_1.default._chatCompletion({
131
+ args: mockArgs,
132
+ genAIEndpoint: 'huggingface.chat.completions',
133
+ response: mockResponse,
134
+ span: mockSpan,
135
+ });
136
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_USAGE_INPUT_TOKENS, 12);
137
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_USAGE_OUTPUT_TOKENS, 25);
138
+ expect(mockSpan.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_USAGE_TOTAL_TOKENS, expect.anything());
139
+ expect(mockSpan.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_CLIENT_TOKEN_USAGE, expect.anything());
140
+ });
141
+ it('should set server.address and server.port via setBaseSpanAttributes', async () => {
142
+ await wrapper_1.default._chatCompletion({
143
+ args: mockArgs,
144
+ genAIEndpoint: 'huggingface.chat.completions',
145
+ response: mockResponse,
146
+ span: mockSpan,
147
+ });
148
+ expect(base_wrapper_1.default.setBaseSpanAttributes).toHaveBeenCalledWith(mockSpan, expect.objectContaining({
149
+ serverAddress: 'api-inference.huggingface.co',
150
+ serverPort: 443,
151
+ }));
152
+ });
153
+ it('should set request params: temperature, max_tokens, top_p, is_stream', async () => {
154
+ await wrapper_1.default._chatCompletion({
155
+ args: mockArgs,
156
+ genAIEndpoint: 'huggingface.chat.completions',
157
+ response: mockResponse,
158
+ span: mockSpan,
159
+ });
160
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_TEMPERATURE, 0.7);
161
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_MAX_TOKENS, 100);
162
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_IS_STREAM, false);
163
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_TOP_P, 1);
164
+ });
165
+ it('should conditionally set frequency_penalty, presence_penalty, seed, stop', async () => {
166
+ const argsWithExtras = [
167
+ {
168
+ ...mockArgs[0],
169
+ frequency_penalty: 0.5,
170
+ presence_penalty: 0.3,
171
+ seed: 42,
172
+ stop: ['\n'],
173
+ n: 2,
174
+ },
175
+ ];
176
+ await wrapper_1.default._chatCompletion({
177
+ args: argsWithExtras,
178
+ genAIEndpoint: 'huggingface.chat.completions',
179
+ response: mockResponse,
180
+ span: mockSpan,
181
+ });
182
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_FREQUENCY_PENALTY, 0.5);
183
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_PRESENCE_PENALTY, 0.3);
184
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_SEED, 42);
185
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_STOP_SEQUENCES, ['\n']);
186
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_CHOICE_COUNT, 2);
187
+ });
188
+ it('should NOT set frequency_penalty or presence_penalty when 0', async () => {
189
+ await wrapper_1.default._chatCompletion({
190
+ args: [{ ...mockArgs[0], frequency_penalty: 0, presence_penalty: 0 }],
191
+ genAIEndpoint: 'huggingface.chat.completions',
192
+ response: mockResponse,
193
+ span: mockSpan,
194
+ });
195
+ expect(mockSpan.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_FREQUENCY_PENALTY, expect.anything());
196
+ expect(mockSpan.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_PRESENCE_PENALTY, expect.anything());
197
+ });
198
+ it('should set finish_reason and output_type', async () => {
199
+ await wrapper_1.default._chatCompletion({
200
+ args: mockArgs,
201
+ genAIEndpoint: 'huggingface.chat.completions',
202
+ response: mockResponse,
203
+ span: mockSpan,
204
+ });
205
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_RESPONSE_FINISH_REASON, ['stop']);
206
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_OUTPUT_TYPE, semantic_convention_1.default.GEN_AI_OUTPUT_TYPE_TEXT);
207
+ });
208
+ it('should emit inference event via emitInferenceEvent', async () => {
209
+ await wrapper_1.default._chatCompletion({
210
+ args: mockArgs,
211
+ genAIEndpoint: 'huggingface.chat.completions',
212
+ response: mockResponse,
213
+ span: mockSpan,
214
+ });
215
+ expect(helpers_1.default.emitInferenceEvent).toHaveBeenCalledWith(mockSpan, expect.objectContaining({
216
+ [semantic_convention_1.default.GEN_AI_OPERATION]: 'chat',
217
+ [semantic_convention_1.default.GEN_AI_REQUEST_MODEL]: 'meta-llama/Meta-Llama-3-8B-Instruct',
218
+ [semantic_convention_1.default.GEN_AI_RESPONSE_MODEL]: 'meta-llama/Meta-Llama-3-8B-Instruct',
219
+ [semantic_convention_1.default.SERVER_ADDRESS]: 'api-inference.huggingface.co',
220
+ [semantic_convention_1.default.SERVER_PORT]: 443,
221
+ [semantic_convention_1.default.GEN_AI_USAGE_INPUT_TOKENS]: 12,
222
+ [semantic_convention_1.default.GEN_AI_USAGE_OUTPUT_TOKENS]: 25,
223
+ }));
224
+ });
225
+ it('should not emit event when disableEvents=true', async () => {
226
+ config_1.default.disableEvents = true;
227
+ await wrapper_1.default._chatCompletion({
228
+ args: mockArgs,
229
+ genAIEndpoint: 'huggingface.chat.completions',
230
+ response: mockResponse,
231
+ span: mockSpan,
232
+ });
233
+ expect(helpers_1.default.emitInferenceEvent).not.toHaveBeenCalled();
234
+ });
235
+ it('should call recordMetrics after span ends', async () => {
236
+ await wrapper_1.default._chatCompletion({
237
+ args: mockArgs,
238
+ genAIEndpoint: 'huggingface.chat.completions',
239
+ response: mockResponse,
240
+ span: mockSpan,
241
+ });
242
+ expect(mockSpan.end).toHaveBeenCalled();
243
+ expect(base_wrapper_1.default.recordMetrics).toHaveBeenCalledWith(mockSpan, expect.objectContaining({
244
+ genAIEndpoint: 'huggingface.chat.completions',
245
+ model: 'meta-llama/Meta-Llama-3-8B-Instruct',
246
+ aiSystem: 'huggingface',
247
+ }));
248
+ });
249
+ it('should use Shield360Config.pricingInfo for cost calculation', async () => {
250
+ config_1.default.pricingInfo = { chat: {} };
251
+ await wrapper_1.default._chatCompletion({
252
+ args: mockArgs,
253
+ genAIEndpoint: 'huggingface.chat.completions',
254
+ response: mockResponse,
255
+ span: mockSpan,
256
+ });
257
+ expect(helpers_1.default.getChatModelCost).toHaveBeenCalledWith('meta-llama/Meta-Llama-3-8B-Instruct', { chat: {} }, 12, 25);
258
+ });
259
+ });
260
+ // ── Error Handling ─────────────────────────────────────────────────────────
261
+ describe('Error Handling', () => {
262
+ it('should record metrics with errorType on catch path', async () => {
263
+ const patchedFn = wrapper_1.default._patchChatCompletion(mockTracer);
264
+ const error = new TypeError('network failure');
265
+ const originalMethod = jest.fn().mockRejectedValue(error);
266
+ const wrapped = patchedFn(originalMethod);
267
+ await expect(wrapped.call({}, { model: 'test-model', messages: [] })).rejects.toThrow('network failure');
268
+ expect(helpers_1.default.handleException).toHaveBeenCalledWith(mockSpan, error);
269
+ expect(base_wrapper_1.default.recordMetrics).toHaveBeenCalledWith(mockSpan, expect.objectContaining({
270
+ errorType: 'TypeError',
271
+ model: 'test-model',
272
+ aiSystem: 'huggingface',
273
+ serverAddress: 'api-inference.huggingface.co',
274
+ serverPort: 443,
275
+ }));
276
+ expect(mockSpan.end).toHaveBeenCalled();
277
+ });
278
+ it('should record metrics with errorType on text generation error', async () => {
279
+ const patchedFn = wrapper_1.default._patchTextGeneration(mockTracer);
280
+ const error = new RangeError('out of bounds');
281
+ const originalMethod = jest.fn().mockRejectedValue(error);
282
+ const wrapped = patchedFn(originalMethod);
283
+ await expect(wrapped.call({}, { model: 'gpt2', inputs: 'test' })).rejects.toThrow('out of bounds');
284
+ expect(base_wrapper_1.default.recordMetrics).toHaveBeenCalledWith(mockSpan, expect.objectContaining({
285
+ errorType: 'RangeError',
286
+ model: 'gpt2',
287
+ aiSystem: 'huggingface',
288
+ }));
289
+ });
290
+ });
291
+ // ── Streaming ─────────────────────────────────────────────────────────────
292
+ describe('Streaming Chat Completion', () => {
293
+ it('should set is_stream=true and accumulate content across chunks', async () => {
294
+ const mockArgs = [
295
+ {
296
+ model: 'meta-llama/Meta-Llama-3-8B-Instruct',
297
+ messages: [{ role: 'user', content: 'Hello' }],
298
+ stream: true,
299
+ },
300
+ ];
301
+ async function* mockStream() {
302
+ yield {
303
+ id: 'hf-stream-1',
304
+ created: Date.now(),
305
+ model: 'meta-llama/Meta-Llama-3-8B-Instruct',
306
+ choices: [{ delta: { content: 'Hello' } }],
307
+ };
308
+ yield {
309
+ id: 'hf-stream-1',
310
+ created: Date.now(),
311
+ model: 'meta-llama/Meta-Llama-3-8B-Instruct',
312
+ choices: [{ delta: { content: ' world' }, finish_reason: 'stop' }],
313
+ };
314
+ }
315
+ const generator = wrapper_1.default._chatCompletionGenerator({
316
+ args: mockArgs,
317
+ genAIEndpoint: 'huggingface.chat.completions',
318
+ response: mockStream(),
319
+ span: mockSpan,
320
+ });
321
+ for await (const _ of generator) { /* consume */ }
322
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_IS_STREAM, true);
323
+ expect(mockSpan.end).toHaveBeenCalled();
324
+ expect(base_wrapper_1.default.recordMetrics).toHaveBeenCalled();
325
+ expect(helpers_1.default.emitInferenceEvent).toHaveBeenCalled();
326
+ });
327
+ it('should handle tool call deltas across streaming chunks', async () => {
328
+ const mockArgs = [
329
+ {
330
+ model: 'meta-llama/Meta-Llama-3-8B-Instruct',
331
+ messages: [{ role: 'user', content: 'Weather?' }],
332
+ stream: true,
333
+ },
334
+ ];
335
+ async function* mockStream() {
336
+ yield {
337
+ id: 'hf-stream-tc',
338
+ model: 'meta-llama/Meta-Llama-3-8B-Instruct',
339
+ choices: [{
340
+ delta: {
341
+ tool_calls: [{
342
+ index: 0,
343
+ id: 'call_1',
344
+ type: 'function',
345
+ function: { name: 'get_weather', arguments: '{"loc' },
346
+ }],
347
+ },
348
+ }],
349
+ };
350
+ yield {
351
+ id: 'hf-stream-tc',
352
+ model: 'meta-llama/Meta-Llama-3-8B-Instruct',
353
+ choices: [{
354
+ delta: {
355
+ tool_calls: [{
356
+ index: 0,
357
+ function: { arguments: '":"SF"}' },
358
+ }],
359
+ },
360
+ finish_reason: 'tool_calls',
361
+ }],
362
+ };
363
+ }
364
+ const generator = wrapper_1.default._chatCompletionGenerator({
365
+ args: mockArgs,
366
+ genAIEndpoint: 'huggingface.chat.completions',
367
+ response: mockStream(),
368
+ span: mockSpan,
369
+ });
370
+ for await (const _ of generator) { /* consume */ }
371
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_TOOL_NAME, 'get_weather');
372
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_TOOL_CALL_ID, 'call_1');
373
+ });
374
+ });
375
+ // ── Text Generation ───────────────────────────────────────────────────────
376
+ describe('Text Generation', () => {
377
+ it('should set text_completion operation and correct attributes', async () => {
378
+ const mockArgs = [
379
+ {
380
+ model: 'gpt2',
381
+ inputs: 'The meaning of life is',
382
+ parameters: { max_new_tokens: 50, temperature: 0.9 },
383
+ },
384
+ ];
385
+ const mockResponse = { generated_text: 'The meaning of life is 42.' };
386
+ await wrapper_1.default._textGeneration({
387
+ args: mockArgs,
388
+ genAIEndpoint: 'huggingface.text.generation',
389
+ response: mockResponse,
390
+ span: mockSpan,
391
+ });
392
+ expect(base_wrapper_1.default.setBaseSpanAttributes).toHaveBeenCalledWith(mockSpan, expect.objectContaining({ aiSystem: 'huggingface' }));
393
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_MAX_TOKENS, 50);
394
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_TEMPERATURE, 0.9);
395
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_IS_STREAM, false);
396
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_OUTPUT_TYPE, semantic_convention_1.default.GEN_AI_OUTPUT_TYPE_TEXT);
397
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_RESPONSE_FINISH_REASON, ['stop']);
398
+ expect(mockSpan.end).toHaveBeenCalled();
399
+ });
400
+ it('should use OTel message format for input/output content', async () => {
401
+ const mockArgs = [
402
+ {
403
+ model: 'gpt2',
404
+ inputs: 'The meaning of life is',
405
+ parameters: {},
406
+ },
407
+ ];
408
+ const mockResponse = { generated_text: '42.' };
409
+ await wrapper_1.default._textGeneration({
410
+ args: mockArgs,
411
+ genAIEndpoint: 'huggingface.text.generation',
412
+ response: mockResponse,
413
+ span: mockSpan,
414
+ });
415
+ expect(helpers_1.default.buildInputMessages).toHaveBeenCalledWith([{ role: 'user', content: 'The meaning of life is' }]);
416
+ expect(helpers_1.default.buildOutputMessages).toHaveBeenCalledWith('42.', 'stop');
417
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_INPUT_MESSAGES, expect.any(String));
418
+ expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_OUTPUT_MESSAGES, expect.any(String));
419
+ });
420
+ it('should emit inference event for text generation', async () => {
421
+ const mockArgs = [
422
+ {
423
+ model: 'gpt2',
424
+ inputs: 'test',
425
+ parameters: {},
426
+ },
427
+ ];
428
+ const mockResponse = { generated_text: 'result' };
429
+ await wrapper_1.default._textGeneration({
430
+ args: mockArgs,
431
+ genAIEndpoint: 'huggingface.text.generation',
432
+ response: mockResponse,
433
+ span: mockSpan,
434
+ });
435
+ expect(helpers_1.default.emitInferenceEvent).toHaveBeenCalledWith(mockSpan, expect.objectContaining({
436
+ [semantic_convention_1.default.GEN_AI_OPERATION]: 'text_completion',
437
+ [semantic_convention_1.default.GEN_AI_REQUEST_MODEL]: 'gpt2',
438
+ [semantic_convention_1.default.GEN_AI_OUTPUT_TYPE]: semantic_convention_1.default.GEN_AI_OUTPUT_TYPE_TEXT,
439
+ }));
440
+ });
441
+ it('should not set legacy content attributes', async () => {
442
+ const mockArgs = [
443
+ {
444
+ model: 'gpt2',
445
+ inputs: 'The meaning of life is',
446
+ parameters: {},
447
+ },
448
+ ];
449
+ const mockResponse = { generated_text: '42.' };
450
+ await wrapper_1.default._textGeneration({
451
+ args: mockArgs,
452
+ genAIEndpoint: 'huggingface.text.generation',
453
+ response: mockResponse,
454
+ span: mockSpan,
455
+ });
456
+ expect(mockSpan.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_CONTENT_PROMPT_EVENT, expect.anything());
457
+ expect(mockSpan.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_CONTENT_COMPLETION_EVENT, expect.anything());
458
+ });
459
+ it('should not set total_tokens or client.token.usage (legacy)', async () => {
460
+ const mockArgs = [
461
+ {
462
+ model: 'gpt2',
463
+ inputs: 'test',
464
+ parameters: {},
465
+ },
466
+ ];
467
+ const mockResponse = { generated_text: 'result' };
468
+ await wrapper_1.default._textGeneration({
469
+ args: mockArgs,
470
+ genAIEndpoint: 'huggingface.text.generation',
471
+ response: mockResponse,
472
+ span: mockSpan,
473
+ });
474
+ expect(mockSpan.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_USAGE_TOTAL_TOKENS, expect.anything());
475
+ expect(mockSpan.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_CLIENT_TOKEN_USAGE, expect.anything());
476
+ });
477
+ });
478
+ // ── Content Gating ─────────────────────────────────────────────────────────
479
+ describe('Content capture gating', () => {
480
+ it('should not set input/output messages when captureMessageContent=false', async () => {
481
+ config_1.default.captureMessageContent = false;
482
+ const mockArgs = [
483
+ {
484
+ model: 'meta-llama/Meta-Llama-3-8B-Instruct',
485
+ messages: [{ role: 'user', content: 'Secret' }],
486
+ stream: false,
487
+ },
488
+ ];
489
+ const mockResponse = {
490
+ id: 'hf-123',
491
+ model: 'meta-llama/Meta-Llama-3-8B-Instruct',
492
+ choices: [{ message: { content: 'Reply' }, finish_reason: 'stop' }],
493
+ usage: { prompt_tokens: 5, completion_tokens: 3, total_tokens: 8 },
494
+ };
495
+ await wrapper_1.default._chatCompletion({
496
+ args: mockArgs,
497
+ genAIEndpoint: 'huggingface.chat.completions',
498
+ response: mockResponse,
499
+ span: mockSpan,
500
+ });
501
+ expect(mockSpan.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_INPUT_MESSAGES, expect.anything());
502
+ expect(mockSpan.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_OUTPUT_MESSAGES, expect.anything());
503
+ });
504
+ it('should still emit event even when captureMessageContent=false', async () => {
505
+ config_1.default.captureMessageContent = false;
506
+ const mockArgs = [
507
+ {
508
+ model: 'meta-llama/Meta-Llama-3-8B-Instruct',
509
+ messages: [{ role: 'user', content: 'Secret' }],
510
+ stream: false,
511
+ },
512
+ ];
513
+ const mockResponse = {
514
+ id: 'hf-123',
515
+ model: 'meta-llama/Meta-Llama-3-8B-Instruct',
516
+ choices: [{ message: { content: 'Reply' }, finish_reason: 'stop' }],
517
+ usage: { prompt_tokens: 5, completion_tokens: 3, total_tokens: 8 },
518
+ };
519
+ await wrapper_1.default._chatCompletion({
520
+ args: mockArgs,
521
+ genAIEndpoint: 'huggingface.chat.completions',
522
+ response: mockResponse,
523
+ span: mockSpan,
524
+ });
525
+ expect(helpers_1.default.emitInferenceEvent).toHaveBeenCalled();
526
+ });
527
+ });
528
+ });
529
+ //# sourceMappingURL=huggingface-trace-comparison.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"huggingface-trace-comparison.test.js","sourceRoot":"","sources":["../../../src/instrumentation/__tests__/huggingface-trace-comparison.test.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAEH,qEAAwD;AACxD,0DAA2C;AAC3C,4DAA4C;AAC5C,mEAA0C;AAC1C,oFAA2D;AAE3D,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAC1B,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAC3B,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;AAE7B,QAAQ,CAAC,6CAA6C,EAAE,GAAG,EAAE;I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C,eAAe,CAAC;gBACvC,IAAI,EAAE,QAAQ;gBACd,aAAa,EAAE,8BAA8B;gBAC7C,QAAQ,EAAE,YAAY;gBACtB,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;YAEH,MAAM,CAAC,iBAAe,CAAC,kBAAkB,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAChE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const helpers_1 = require("../../helpers");
4
+ describe('LangChain role mapping', () => {
5
+ it('maps LangChain internal types to OTel GenAI roles', () => {
6
+ expect(helpers_1.LANGCHAIN_ROLE_MAP.human).toBe('user');
7
+ expect(helpers_1.LANGCHAIN_ROLE_MAP.ai).toBe('assistant');
8
+ expect(helpers_1.OTEL_ASSISTANT_ROLE).toBe('assistant');
9
+ });
10
+ it('mapLangChainRole passes through already-normalised roles', () => {
11
+ expect((0, helpers_1.mapLangChainRole)('user')).toBe('user');
12
+ expect((0, helpers_1.mapLangChainRole)('assistant')).toBe('assistant');
13
+ });
14
+ it('mapLangChainRole defaults empty raw roles to assistant', () => {
15
+ expect((0, helpers_1.mapLangChainRole)('')).toBe('assistant');
16
+ expect((0, helpers_1.mapLangChainRole)(null)).toBe('assistant');
17
+ });
18
+ });
19
+ //# sourceMappingURL=langchain-role-map.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"langchain-role-map.test.js","sourceRoot":"","sources":["../../../src/instrumentation/__tests__/langchain-role-map.test.ts"],"names":[],"mappings":";;AAAA,2CAIuB;AAEvB,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,CAAC,4BAAkB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9C,MAAM,CAAC,4BAAkB,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAChD,MAAM,CAAC,6BAAmB,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,CAAC,IAAA,0BAAgB,EAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9C,MAAM,CAAC,IAAA,0BAAgB,EAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAChE,MAAM,CAAC,IAAA,0BAAgB,EAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/C,MAAM,CAAC,IAAA,0BAAgB,EAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}