@sentry/core 10.47.0 → 10.49.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 (413) hide show
  1. package/build/cjs/attributes.js +43 -0
  2. package/build/cjs/attributes.js.map +1 -1
  3. package/build/cjs/client.js +13 -6
  4. package/build/cjs/client.js.map +1 -1
  5. package/build/cjs/envelope.js +4 -3
  6. package/build/cjs/envelope.js.map +1 -1
  7. package/build/cjs/fetch.js +36 -17
  8. package/build/cjs/fetch.js.map +1 -1
  9. package/build/cjs/index.js +53 -18
  10. package/build/cjs/index.js.map +1 -1
  11. package/build/cjs/integration.js +6 -0
  12. package/build/cjs/integration.js.map +1 -1
  13. package/build/cjs/integrations/conversationId.js +11 -0
  14. package/build/cjs/integrations/conversationId.js.map +1 -1
  15. package/build/cjs/integrations/express/index.js +243 -0
  16. package/build/cjs/integrations/express/index.js.map +1 -0
  17. package/build/cjs/integrations/express/patch-layer.js +257 -0
  18. package/build/cjs/integrations/express/patch-layer.js.map +1 -0
  19. package/build/cjs/integrations/express/request-layer-store.js +25 -0
  20. package/build/cjs/integrations/express/request-layer-store.js.map +1 -0
  21. package/build/cjs/integrations/express/set-sdk-processing-metadata.js +17 -0
  22. package/build/cjs/integrations/express/set-sdk-processing-metadata.js.map +1 -0
  23. package/build/cjs/integrations/express/types.js +17 -0
  24. package/build/cjs/integrations/express/types.js.map +1 -0
  25. package/build/cjs/integrations/express/utils.js +238 -0
  26. package/build/cjs/integrations/express/utils.js.map +1 -0
  27. package/build/cjs/integrations/mcp-server/correlation.js +5 -1
  28. package/build/cjs/integrations/mcp-server/correlation.js.map +1 -1
  29. package/build/cjs/integrations/mcp-server/handlers.js +18 -10
  30. package/build/cjs/integrations/mcp-server/handlers.js.map +1 -1
  31. package/build/cjs/integrations/mcp-server/index.js +2 -1
  32. package/build/cjs/integrations/mcp-server/index.js.map +1 -1
  33. package/build/cjs/integrations/mcp-server/transport.js +1 -1
  34. package/build/cjs/integrations/mcp-server/transport.js.map +1 -1
  35. package/build/cjs/integrations/mcp-server/validation.js +7 -5
  36. package/build/cjs/integrations/mcp-server/validation.js.map +1 -1
  37. package/build/cjs/integrations/requestdata.js.map +1 -1
  38. package/build/cjs/integrations/spanStreaming.js +48 -0
  39. package/build/cjs/integrations/spanStreaming.js.map +1 -0
  40. package/build/cjs/semanticAttributes.js +35 -3
  41. package/build/cjs/semanticAttributes.js.map +1 -1
  42. package/build/cjs/tracing/ai/gen-ai-attributes.js +3 -89
  43. package/build/cjs/tracing/ai/gen-ai-attributes.js.map +1 -1
  44. package/build/cjs/tracing/ai/utils.js +74 -0
  45. package/build/cjs/tracing/ai/utils.js.map +1 -1
  46. package/build/cjs/tracing/anthropic-ai/index.js +6 -17
  47. package/build/cjs/tracing/anthropic-ai/index.js.map +1 -1
  48. package/build/cjs/tracing/anthropic-ai/streaming.js +2 -100
  49. package/build/cjs/tracing/anthropic-ai/streaming.js.map +1 -1
  50. package/build/cjs/tracing/anthropic-ai/utils.js +4 -2
  51. package/build/cjs/tracing/anthropic-ai/utils.js.map +1 -1
  52. package/build/cjs/tracing/dynamicSamplingContext.js +2 -1
  53. package/build/cjs/tracing/dynamicSamplingContext.js.map +1 -1
  54. package/build/cjs/tracing/google-genai/constants.js +1 -6
  55. package/build/cjs/tracing/google-genai/constants.js.map +1 -1
  56. package/build/cjs/tracing/google-genai/index.js +40 -35
  57. package/build/cjs/tracing/google-genai/index.js.map +1 -1
  58. package/build/cjs/tracing/google-genai/streaming.js +2 -23
  59. package/build/cjs/tracing/google-genai/streaming.js.map +1 -1
  60. package/build/cjs/tracing/langchain/embeddings.js +132 -0
  61. package/build/cjs/tracing/langchain/embeddings.js.map +1 -0
  62. package/build/cjs/tracing/langchain/index.js +3 -0
  63. package/build/cjs/tracing/langchain/index.js.map +1 -1
  64. package/build/cjs/tracing/langchain/utils.js +12 -4
  65. package/build/cjs/tracing/langchain/utils.js.map +1 -1
  66. package/build/cjs/tracing/langgraph/index.js +4 -3
  67. package/build/cjs/tracing/langgraph/index.js.map +1 -1
  68. package/build/cjs/tracing/openai/index.js +14 -34
  69. package/build/cjs/tracing/openai/index.js.map +1 -1
  70. package/build/cjs/tracing/openai/streaming.js +3 -34
  71. package/build/cjs/tracing/openai/streaming.js.map +1 -1
  72. package/build/cjs/tracing/openai/utils.js +78 -204
  73. package/build/cjs/tracing/openai/utils.js.map +1 -1
  74. package/build/cjs/tracing/sentryNonRecordingSpan.js +7 -0
  75. package/build/cjs/tracing/sentryNonRecordingSpan.js.map +1 -1
  76. package/build/cjs/tracing/sentrySpan.js +39 -0
  77. package/build/cjs/tracing/sentrySpan.js.map +1 -1
  78. package/build/cjs/tracing/spans/beforeSendSpan.js +43 -0
  79. package/build/cjs/tracing/spans/beforeSendSpan.js.map +1 -0
  80. package/build/cjs/tracing/spans/captureSpan.js +126 -0
  81. package/build/cjs/tracing/spans/captureSpan.js.map +1 -0
  82. package/build/cjs/tracing/spans/envelope.js +38 -0
  83. package/build/cjs/tracing/spans/envelope.js.map +1 -0
  84. package/build/cjs/tracing/spans/estimateSize.js +41 -0
  85. package/build/cjs/tracing/spans/estimateSize.js.map +1 -0
  86. package/build/cjs/tracing/spans/hasSpanStreamingEnabled.js +11 -0
  87. package/build/cjs/tracing/spans/hasSpanStreamingEnabled.js.map +1 -0
  88. package/build/cjs/tracing/spans/spanBuffer.js +158 -0
  89. package/build/cjs/tracing/spans/spanBuffer.js.map +1 -0
  90. package/build/cjs/tracing/trace.js +83 -13
  91. package/build/cjs/tracing/trace.js.map +1 -1
  92. package/build/cjs/tracing/utils.js +3 -37
  93. package/build/cjs/tracing/utils.js.map +1 -1
  94. package/build/cjs/tracing/vercel-ai/constants.js +15 -23
  95. package/build/cjs/tracing/vercel-ai/constants.js.map +1 -1
  96. package/build/cjs/tracing/vercel-ai/index.js +32 -45
  97. package/build/cjs/tracing/vercel-ai/index.js.map +1 -1
  98. package/build/cjs/tracing/vercel-ai/utils.js +11 -42
  99. package/build/cjs/tracing/vercel-ai/utils.js.map +1 -1
  100. package/build/cjs/tracing/vercel-ai/vercel-ai-attributes.js +4 -1
  101. package/build/cjs/tracing/vercel-ai/vercel-ai-attributes.js.map +1 -1
  102. package/build/cjs/utils/browser.js +2 -3
  103. package/build/cjs/utils/browser.js.map +1 -1
  104. package/build/cjs/utils/featureFlags.js +6 -0
  105. package/build/cjs/utils/featureFlags.js.map +1 -1
  106. package/build/cjs/utils/object.js +33 -0
  107. package/build/cjs/utils/object.js.map +1 -1
  108. package/build/cjs/utils/spanUtils.js +116 -13
  109. package/build/cjs/utils/spanUtils.js.map +1 -1
  110. package/build/cjs/utils/stacktrace.js +3 -1
  111. package/build/cjs/utils/stacktrace.js.map +1 -1
  112. package/build/cjs/utils/string.js +3 -0
  113. package/build/cjs/utils/string.js.map +1 -1
  114. package/build/cjs/utils/version.js +1 -1
  115. package/build/cjs/utils/weakRef.js +62 -0
  116. package/build/cjs/utils/weakRef.js.map +1 -0
  117. package/build/esm/attributes.js +43 -1
  118. package/build/esm/attributes.js.map +1 -1
  119. package/build/esm/client.js +8 -1
  120. package/build/esm/client.js.map +1 -1
  121. package/build/esm/envelope.js +2 -1
  122. package/build/esm/envelope.js.map +1 -1
  123. package/build/esm/fetch.js +36 -17
  124. package/build/esm/fetch.js.map +1 -1
  125. package/build/esm/index.js +12 -3
  126. package/build/esm/index.js.map +1 -1
  127. package/build/esm/integration.js +6 -0
  128. package/build/esm/integration.js.map +1 -1
  129. package/build/esm/integrations/conversationId.js +11 -0
  130. package/build/esm/integrations/conversationId.js.map +1 -1
  131. package/build/esm/integrations/express/index.js +239 -0
  132. package/build/esm/integrations/express/index.js.map +1 -0
  133. package/build/esm/integrations/express/patch-layer.js +255 -0
  134. package/build/esm/integrations/express/patch-layer.js.map +1 -0
  135. package/build/esm/integrations/express/request-layer-store.js +22 -0
  136. package/build/esm/integrations/express/request-layer-store.js.map +1 -0
  137. package/build/esm/integrations/express/set-sdk-processing-metadata.js +15 -0
  138. package/build/esm/integrations/express/set-sdk-processing-metadata.js.map +1 -0
  139. package/build/esm/integrations/express/types.js +10 -0
  140. package/build/esm/integrations/express/types.js.map +1 -0
  141. package/build/esm/integrations/express/utils.js +225 -0
  142. package/build/esm/integrations/express/utils.js.map +1 -0
  143. package/build/esm/integrations/mcp-server/correlation.js +5 -1
  144. package/build/esm/integrations/mcp-server/correlation.js.map +1 -1
  145. package/build/esm/integrations/mcp-server/handlers.js +18 -10
  146. package/build/esm/integrations/mcp-server/handlers.js.map +1 -1
  147. package/build/esm/integrations/mcp-server/index.js +2 -1
  148. package/build/esm/integrations/mcp-server/index.js.map +1 -1
  149. package/build/esm/integrations/mcp-server/transport.js +1 -1
  150. package/build/esm/integrations/mcp-server/transport.js.map +1 -1
  151. package/build/esm/integrations/mcp-server/validation.js +7 -5
  152. package/build/esm/integrations/mcp-server/validation.js.map +1 -1
  153. package/build/esm/integrations/requestdata.js.map +1 -1
  154. package/build/esm/integrations/spanStreaming.js +46 -0
  155. package/build/esm/integrations/spanStreaming.js.map +1 -0
  156. package/build/esm/package.json +1 -1
  157. package/build/esm/semanticAttributes.js +26 -4
  158. package/build/esm/semanticAttributes.js.map +1 -1
  159. package/build/esm/tracing/ai/gen-ai-attributes.js +3 -76
  160. package/build/esm/tracing/ai/gen-ai-attributes.js.map +1 -1
  161. package/build/esm/tracing/ai/utils.js +73 -2
  162. package/build/esm/tracing/ai/utils.js.map +1 -1
  163. package/build/esm/tracing/anthropic-ai/index.js +8 -19
  164. package/build/esm/tracing/anthropic-ai/index.js.map +1 -1
  165. package/build/esm/tracing/anthropic-ai/streaming.js +3 -101
  166. package/build/esm/tracing/anthropic-ai/streaming.js.map +1 -1
  167. package/build/esm/tracing/anthropic-ai/utils.js +5 -3
  168. package/build/esm/tracing/anthropic-ai/utils.js.map +1 -1
  169. package/build/esm/tracing/dynamicSamplingContext.js +2 -1
  170. package/build/esm/tracing/dynamicSamplingContext.js.map +1 -1
  171. package/build/esm/tracing/google-genai/constants.js +2 -5
  172. package/build/esm/tracing/google-genai/constants.js.map +1 -1
  173. package/build/esm/tracing/google-genai/index.js +42 -37
  174. package/build/esm/tracing/google-genai/index.js.map +1 -1
  175. package/build/esm/tracing/google-genai/streaming.js +2 -23
  176. package/build/esm/tracing/google-genai/streaming.js.map +1 -1
  177. package/build/esm/tracing/langchain/embeddings.js +129 -0
  178. package/build/esm/tracing/langchain/embeddings.js.map +1 -0
  179. package/build/esm/tracing/langchain/index.js +4 -1
  180. package/build/esm/tracing/langchain/index.js.map +1 -1
  181. package/build/esm/tracing/langchain/utils.js +13 -5
  182. package/build/esm/tracing/langchain/utils.js.map +1 -1
  183. package/build/esm/tracing/langgraph/index.js +5 -4
  184. package/build/esm/tracing/langgraph/index.js.map +1 -1
  185. package/build/esm/tracing/openai/index.js +16 -36
  186. package/build/esm/tracing/openai/index.js.map +1 -1
  187. package/build/esm/tracing/openai/streaming.js +4 -35
  188. package/build/esm/tracing/openai/streaming.js.map +1 -1
  189. package/build/esm/tracing/openai/utils.js +79 -196
  190. package/build/esm/tracing/openai/utils.js.map +1 -1
  191. package/build/esm/tracing/sentryNonRecordingSpan.js +7 -0
  192. package/build/esm/tracing/sentryNonRecordingSpan.js.map +1 -1
  193. package/build/esm/tracing/sentrySpan.js +40 -1
  194. package/build/esm/tracing/sentrySpan.js.map +1 -1
  195. package/build/esm/tracing/spans/beforeSendSpan.js +40 -0
  196. package/build/esm/tracing/spans/beforeSendSpan.js.map +1 -0
  197. package/build/esm/tracing/spans/captureSpan.js +122 -0
  198. package/build/esm/tracing/spans/captureSpan.js.map +1 -0
  199. package/build/esm/tracing/spans/envelope.js +36 -0
  200. package/build/esm/tracing/spans/envelope.js.map +1 -0
  201. package/build/esm/tracing/spans/estimateSize.js +39 -0
  202. package/build/esm/tracing/spans/estimateSize.js.map +1 -0
  203. package/build/esm/tracing/spans/hasSpanStreamingEnabled.js +9 -0
  204. package/build/esm/tracing/spans/hasSpanStreamingEnabled.js.map +1 -0
  205. package/build/esm/tracing/spans/spanBuffer.js +156 -0
  206. package/build/esm/tracing/spans/spanBuffer.js.map +1 -0
  207. package/build/esm/tracing/trace.js +84 -14
  208. package/build/esm/tracing/trace.js.map +1 -1
  209. package/build/esm/tracing/utils.js +3 -37
  210. package/build/esm/tracing/utils.js.map +1 -1
  211. package/build/esm/tracing/vercel-ai/constants.js +15 -19
  212. package/build/esm/tracing/vercel-ai/constants.js.map +1 -1
  213. package/build/esm/tracing/vercel-ai/index.js +29 -42
  214. package/build/esm/tracing/vercel-ai/index.js.map +1 -1
  215. package/build/esm/tracing/vercel-ai/utils.js +14 -44
  216. package/build/esm/tracing/vercel-ai/utils.js.map +1 -1
  217. package/build/esm/tracing/vercel-ai/vercel-ai-attributes.js +4 -1
  218. package/build/esm/tracing/vercel-ai/vercel-ai-attributes.js.map +1 -1
  219. package/build/esm/utils/browser.js +2 -3
  220. package/build/esm/utils/browser.js.map +1 -1
  221. package/build/esm/utils/featureFlags.js +6 -0
  222. package/build/esm/utils/featureFlags.js.map +1 -1
  223. package/build/esm/utils/object.js +33 -1
  224. package/build/esm/utils/object.js.map +1 -1
  225. package/build/esm/utils/spanUtils.js +112 -14
  226. package/build/esm/utils/spanUtils.js.map +1 -1
  227. package/build/esm/utils/stacktrace.js +3 -1
  228. package/build/esm/utils/stacktrace.js.map +1 -1
  229. package/build/esm/utils/string.js +3 -0
  230. package/build/esm/utils/string.js.map +1 -1
  231. package/build/esm/utils/version.js +1 -1
  232. package/build/esm/utils/weakRef.js +59 -0
  233. package/build/esm/utils/weakRef.js.map +1 -0
  234. package/build/types/attributes.d.ts +5 -0
  235. package/build/types/attributes.d.ts.map +1 -1
  236. package/build/types/build-time-plugins/buildTimeOptionsBase.d.ts +13 -0
  237. package/build/types/build-time-plugins/buildTimeOptionsBase.d.ts.map +1 -1
  238. package/build/types/client.d.ts +35 -1
  239. package/build/types/client.d.ts.map +1 -1
  240. package/build/types/envelope.d.ts.map +1 -1
  241. package/build/types/fetch.d.ts +12 -8
  242. package/build/types/fetch.d.ts.map +1 -1
  243. package/build/types/index.d.ts +16 -5
  244. package/build/types/index.d.ts.map +1 -1
  245. package/build/types/integration.d.ts.map +1 -1
  246. package/build/types/integrations/conversationId.d.ts.map +1 -1
  247. package/build/types/integrations/express/index.d.ts +82 -0
  248. package/build/types/integrations/express/index.d.ts.map +1 -0
  249. package/build/types/integrations/express/patch-layer.d.ts +32 -0
  250. package/build/types/integrations/express/patch-layer.d.ts.map +1 -0
  251. package/build/types/integrations/express/request-layer-store.d.ts +32 -0
  252. package/build/types/integrations/express/request-layer-store.d.ts.map +1 -0
  253. package/build/types/integrations/express/set-sdk-processing-metadata.d.ts +35 -0
  254. package/build/types/integrations/express/set-sdk-processing-metadata.d.ts.map +1 -0
  255. package/build/types/integrations/express/types.d.ts +158 -0
  256. package/build/types/integrations/express/types.d.ts.map +1 -0
  257. package/build/types/integrations/express/utils.d.ts +93 -0
  258. package/build/types/integrations/express/utils.d.ts.map +1 -0
  259. package/build/types/integrations/mcp-server/correlation.d.ts +2 -1
  260. package/build/types/integrations/mcp-server/correlation.d.ts.map +1 -1
  261. package/build/types/integrations/mcp-server/handlers.d.ts +9 -4
  262. package/build/types/integrations/mcp-server/handlers.d.ts.map +1 -1
  263. package/build/types/integrations/mcp-server/index.d.ts +2 -1
  264. package/build/types/integrations/mcp-server/index.d.ts.map +1 -1
  265. package/build/types/integrations/mcp-server/types.d.ts +40 -7
  266. package/build/types/integrations/mcp-server/types.d.ts.map +1 -1
  267. package/build/types/integrations/mcp-server/validation.d.ts +4 -1
  268. package/build/types/integrations/mcp-server/validation.d.ts.map +1 -1
  269. package/build/types/integrations/requestdata.d.ts.map +1 -1
  270. package/build/types/integrations/spanStreaming.d.ts +2 -0
  271. package/build/types/integrations/spanStreaming.d.ts.map +1 -0
  272. package/build/types/semanticAttributes.d.ts +23 -3
  273. package/build/types/semanticAttributes.d.ts.map +1 -1
  274. package/build/types/tracing/ai/gen-ai-attributes.d.ts +4 -44
  275. package/build/types/tracing/ai/gen-ai-attributes.d.ts.map +1 -1
  276. package/build/types/tracing/ai/utils.d.ts +32 -2
  277. package/build/types/tracing/ai/utils.d.ts.map +1 -1
  278. package/build/types/tracing/anthropic-ai/index.d.ts.map +1 -1
  279. package/build/types/tracing/anthropic-ai/streaming.d.ts.map +1 -1
  280. package/build/types/tracing/anthropic-ai/types.d.ts +5 -0
  281. package/build/types/tracing/anthropic-ai/types.d.ts.map +1 -1
  282. package/build/types/tracing/anthropic-ai/utils.d.ts +1 -1
  283. package/build/types/tracing/anthropic-ai/utils.d.ts.map +1 -1
  284. package/build/types/tracing/dynamicSamplingContext.d.ts.map +1 -1
  285. package/build/types/tracing/google-genai/constants.d.ts +1 -3
  286. package/build/types/tracing/google-genai/constants.d.ts.map +1 -1
  287. package/build/types/tracing/google-genai/index.d.ts.map +1 -1
  288. package/build/types/tracing/google-genai/streaming.d.ts.map +1 -1
  289. package/build/types/tracing/google-genai/types.d.ts +5 -0
  290. package/build/types/tracing/google-genai/types.d.ts.map +1 -1
  291. package/build/types/tracing/index.d.ts +1 -0
  292. package/build/types/tracing/index.d.ts.map +1 -1
  293. package/build/types/tracing/langchain/embeddings.d.ts +27 -0
  294. package/build/types/tracing/langchain/embeddings.d.ts.map +1 -0
  295. package/build/types/tracing/langchain/index.d.ts +1 -0
  296. package/build/types/tracing/langchain/index.d.ts.map +1 -1
  297. package/build/types/tracing/langchain/types.d.ts +5 -0
  298. package/build/types/tracing/langchain/types.d.ts.map +1 -1
  299. package/build/types/tracing/langchain/utils.d.ts +2 -2
  300. package/build/types/tracing/langchain/utils.d.ts.map +1 -1
  301. package/build/types/tracing/langgraph/index.d.ts.map +1 -1
  302. package/build/types/tracing/langgraph/types.d.ts +5 -0
  303. package/build/types/tracing/langgraph/types.d.ts.map +1 -1
  304. package/build/types/tracing/openai/index.d.ts.map +1 -1
  305. package/build/types/tracing/openai/streaming.d.ts.map +1 -1
  306. package/build/types/tracing/openai/types.d.ts +5 -0
  307. package/build/types/tracing/openai/types.d.ts.map +1 -1
  308. package/build/types/tracing/openai/utils.d.ts +4 -49
  309. package/build/types/tracing/openai/utils.d.ts.map +1 -1
  310. package/build/types/tracing/sentryNonRecordingSpan.d.ts +12 -1
  311. package/build/types/tracing/sentryNonRecordingSpan.d.ts.map +1 -1
  312. package/build/types/tracing/sentrySpan.d.ts +10 -1
  313. package/build/types/tracing/sentrySpan.d.ts.map +1 -1
  314. package/build/types/tracing/spans/beforeSendSpan.d.ts +35 -0
  315. package/build/types/tracing/spans/beforeSendSpan.d.ts.map +1 -0
  316. package/build/types/tracing/spans/captureSpan.d.ts +26 -0
  317. package/build/types/tracing/spans/captureSpan.d.ts.map +1 -0
  318. package/build/types/tracing/spans/envelope.d.ts +8 -0
  319. package/build/types/tracing/spans/envelope.d.ts.map +1 -0
  320. package/build/types/tracing/spans/estimateSize.d.ts +12 -0
  321. package/build/types/tracing/spans/estimateSize.d.ts.map +1 -0
  322. package/build/types/tracing/spans/hasSpanStreamingEnabled.d.ts +6 -0
  323. package/build/types/tracing/spans/hasSpanStreamingEnabled.d.ts.map +1 -0
  324. package/build/types/tracing/spans/spanBuffer.d.ts +60 -0
  325. package/build/types/tracing/spans/spanBuffer.d.ts.map +1 -0
  326. package/build/types/tracing/trace.d.ts.map +1 -1
  327. package/build/types/tracing/utils.d.ts.map +1 -1
  328. package/build/types/tracing/vercel-ai/constants.d.ts +2 -5
  329. package/build/types/tracing/vercel-ai/constants.d.ts.map +1 -1
  330. package/build/types/tracing/vercel-ai/index.d.ts.map +1 -1
  331. package/build/types/tracing/vercel-ai/utils.d.ts +1 -5
  332. package/build/types/tracing/vercel-ai/utils.d.ts.map +1 -1
  333. package/build/types/tracing/vercel-ai/vercel-ai-attributes.d.ts +0 -480
  334. package/build/types/tracing/vercel-ai/vercel-ai-attributes.d.ts.map +1 -1
  335. package/build/types/types-hoist/envelope.d.ts +22 -2
  336. package/build/types/types-hoist/envelope.d.ts.map +1 -1
  337. package/build/types/types-hoist/integration.d.ts +8 -0
  338. package/build/types/types-hoist/integration.d.ts.map +1 -1
  339. package/build/types/types-hoist/link.d.ts +2 -2
  340. package/build/types/types-hoist/link.d.ts.map +1 -1
  341. package/build/types/types-hoist/options.d.ts +26 -2
  342. package/build/types/types-hoist/options.d.ts.map +1 -1
  343. package/build/types/types-hoist/span.d.ts +35 -0
  344. package/build/types/types-hoist/span.d.ts.map +1 -1
  345. package/build/types/types-hoist/view-hierarchy.d.ts +1 -0
  346. package/build/types/types-hoist/view-hierarchy.d.ts.map +1 -1
  347. package/build/types/utils/browser.d.ts +1 -1
  348. package/build/types/utils/browser.d.ts.map +1 -1
  349. package/build/types/utils/featureFlags.d.ts.map +1 -1
  350. package/build/types/utils/object.d.ts +10 -0
  351. package/build/types/utils/object.d.ts.map +1 -1
  352. package/build/types/utils/spanUtils.d.ts +27 -2
  353. package/build/types/utils/spanUtils.d.ts.map +1 -1
  354. package/build/types/utils/stacktrace.d.ts.map +1 -1
  355. package/build/types/utils/string.d.ts +2 -2
  356. package/build/types/utils/string.d.ts.map +1 -1
  357. package/build/types/utils/weakRef.d.ts +34 -0
  358. package/build/types/utils/weakRef.d.ts.map +1 -0
  359. package/build/types-ts3.8/attributes.d.ts +5 -0
  360. package/build/types-ts3.8/build-time-plugins/buildTimeOptionsBase.d.ts +13 -0
  361. package/build/types-ts3.8/client.d.ts +35 -1
  362. package/build/types-ts3.8/fetch.d.ts +14 -10
  363. package/build/types-ts3.8/index.d.ts +16 -5
  364. package/build/types-ts3.8/integrations/express/index.d.ts +82 -0
  365. package/build/types-ts3.8/integrations/express/patch-layer.d.ts +32 -0
  366. package/build/types-ts3.8/integrations/express/request-layer-store.d.ts +32 -0
  367. package/build/types-ts3.8/integrations/express/set-sdk-processing-metadata.d.ts +35 -0
  368. package/build/types-ts3.8/integrations/express/types.d.ts +158 -0
  369. package/build/types-ts3.8/integrations/express/utils.d.ts +96 -0
  370. package/build/types-ts3.8/integrations/mcp-server/correlation.d.ts +2 -1
  371. package/build/types-ts3.8/integrations/mcp-server/handlers.d.ts +9 -4
  372. package/build/types-ts3.8/integrations/mcp-server/index.d.ts +2 -1
  373. package/build/types-ts3.8/integrations/mcp-server/types.d.ts +40 -7
  374. package/build/types-ts3.8/integrations/mcp-server/validation.d.ts +4 -1
  375. package/build/types-ts3.8/integrations/spanStreaming.d.ts +2 -0
  376. package/build/types-ts3.8/semanticAttributes.d.ts +23 -3
  377. package/build/types-ts3.8/tracing/ai/gen-ai-attributes.d.ts +4 -44
  378. package/build/types-ts3.8/tracing/ai/utils.d.ts +32 -2
  379. package/build/types-ts3.8/tracing/anthropic-ai/types.d.ts +5 -0
  380. package/build/types-ts3.8/tracing/anthropic-ai/utils.d.ts +1 -1
  381. package/build/types-ts3.8/tracing/google-genai/constants.d.ts +1 -3
  382. package/build/types-ts3.8/tracing/google-genai/types.d.ts +5 -0
  383. package/build/types-ts3.8/tracing/index.d.ts +1 -0
  384. package/build/types-ts3.8/tracing/langchain/embeddings.d.ts +27 -0
  385. package/build/types-ts3.8/tracing/langchain/index.d.ts +1 -0
  386. package/build/types-ts3.8/tracing/langchain/types.d.ts +5 -0
  387. package/build/types-ts3.8/tracing/langchain/utils.d.ts +2 -2
  388. package/build/types-ts3.8/tracing/langgraph/types.d.ts +5 -0
  389. package/build/types-ts3.8/tracing/openai/types.d.ts +5 -0
  390. package/build/types-ts3.8/tracing/openai/utils.d.ts +4 -49
  391. package/build/types-ts3.8/tracing/sentryNonRecordingSpan.d.ts +12 -1
  392. package/build/types-ts3.8/tracing/sentrySpan.d.ts +10 -1
  393. package/build/types-ts3.8/tracing/spans/beforeSendSpan.d.ts +35 -0
  394. package/build/types-ts3.8/tracing/spans/captureSpan.d.ts +26 -0
  395. package/build/types-ts3.8/tracing/spans/envelope.d.ts +8 -0
  396. package/build/types-ts3.8/tracing/spans/estimateSize.d.ts +12 -0
  397. package/build/types-ts3.8/tracing/spans/hasSpanStreamingEnabled.d.ts +6 -0
  398. package/build/types-ts3.8/tracing/spans/spanBuffer.d.ts +60 -0
  399. package/build/types-ts3.8/tracing/vercel-ai/constants.d.ts +2 -5
  400. package/build/types-ts3.8/tracing/vercel-ai/utils.d.ts +1 -5
  401. package/build/types-ts3.8/tracing/vercel-ai/vercel-ai-attributes.d.ts +0 -480
  402. package/build/types-ts3.8/types-hoist/envelope.d.ts +22 -2
  403. package/build/types-ts3.8/types-hoist/integration.d.ts +8 -0
  404. package/build/types-ts3.8/types-hoist/link.d.ts +2 -2
  405. package/build/types-ts3.8/types-hoist/options.d.ts +26 -2
  406. package/build/types-ts3.8/types-hoist/span.d.ts +35 -0
  407. package/build/types-ts3.8/types-hoist/view-hierarchy.d.ts +1 -0
  408. package/build/types-ts3.8/utils/browser.d.ts +1 -1
  409. package/build/types-ts3.8/utils/object.d.ts +10 -0
  410. package/build/types-ts3.8/utils/spanUtils.d.ts +27 -2
  411. package/build/types-ts3.8/utils/string.d.ts +2 -2
  412. package/build/types-ts3.8/utils/weakRef.d.ts +34 -0
  413. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Use this attribute to represent the source of a span.
3
- * Should be one of: custom, url, route, view, component, task, unknown
4
- *
2
+ * Use this attribute to represent the source of a span name.
3
+ * Must be one of: custom, url, route, view, component, task
4
+ * TODO(v11): rename this to sentry.span.source'
5
5
  */
6
6
  export declare const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = "sentry.source";
7
7
  /**
@@ -32,6 +32,26 @@ export declare const SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON = "sentry
32
32
  export declare const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT = "sentry.measurement_unit";
33
33
  /** The value of a measurement, which may be stored as a TimedEvent. */
34
34
  export declare const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE = "sentry.measurement_value";
35
+ /** The release version of the application */
36
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_RELEASE = "sentry.release";
37
+ /** The environment name (e.g., "production", "staging", "development") */
38
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT = "sentry.environment";
39
+ /** The segment name (e.g., "GET /users") */
40
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_NAME = "sentry.segment.name";
41
+ /** The id of the segment that this span belongs to. */
42
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_ID = "sentry.segment.id";
43
+ /** The name of the Sentry SDK (e.g., "sentry.php", "sentry.javascript") */
44
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME = "sentry.sdk.name";
45
+ /** The version of the Sentry SDK */
46
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION = "sentry.sdk.version";
47
+ /** The user ID (gated by sendDefaultPii) */
48
+ export declare const SEMANTIC_ATTRIBUTE_USER_ID = "user.id";
49
+ /** The user email (gated by sendDefaultPii) */
50
+ export declare const SEMANTIC_ATTRIBUTE_USER_EMAIL = "user.email";
51
+ /** The user IP address (gated by sendDefaultPii) */
52
+ export declare const SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS = "user.ip_address";
53
+ /** The user username (gated by sendDefaultPii) */
54
+ export declare const SEMANTIC_ATTRIBUTE_USER_USERNAME = "user.name";
35
55
  /**
36
56
  * A custom span name set by users guaranteed to be taken over any automatically
37
57
  * inferred name. This attribute is removed before the span is sent.
@@ -165,34 +165,18 @@ export declare const GEN_AI_USAGE_INPUT_TOKENS_CACHED_ATTRIBUTE = "gen_ai.usage.
165
165
  */
166
166
  export declare const GEN_AI_INVOKE_AGENT_OPERATION_ATTRIBUTE = "gen_ai.invoke_agent";
167
167
  /**
168
- * The span operation name for generating text
168
+ * The span operation name for generating content
169
169
  */
170
- export declare const GEN_AI_GENERATE_TEXT_DO_GENERATE_OPERATION_ATTRIBUTE = "gen_ai.generate_text";
171
- /**
172
- * The span operation name for streaming text
173
- */
174
- export declare const GEN_AI_STREAM_TEXT_DO_STREAM_OPERATION_ATTRIBUTE = "gen_ai.stream_text";
175
- /**
176
- * The span operation name for generating object
177
- */
178
- export declare const GEN_AI_GENERATE_OBJECT_DO_GENERATE_OPERATION_ATTRIBUTE = "gen_ai.generate_object";
179
- /**
180
- * The span operation name for streaming object
181
- */
182
- export declare const GEN_AI_STREAM_OBJECT_DO_STREAM_OPERATION_ATTRIBUTE = "gen_ai.stream_object";
170
+ export declare const GEN_AI_GENERATE_CONTENT_OPERATION_ATTRIBUTE = "gen_ai.generate_content";
183
171
  /**
184
172
  * The embeddings input
185
173
  * Only recorded when recordInputs is enabled
186
174
  */
187
175
  export declare const GEN_AI_EMBEDDINGS_INPUT_ATTRIBUTE = "gen_ai.embeddings.input";
188
176
  /**
189
- * The span operation name for embedding
190
- */
191
- export declare const GEN_AI_EMBED_DO_EMBED_OPERATION_ATTRIBUTE = "gen_ai.embeddings";
192
- /**
193
- * The span operation name for embedding many
177
+ * The span operation for embeddings
194
178
  */
195
- export declare const GEN_AI_EMBED_MANY_DO_EMBED_OPERATION_ATTRIBUTE = "gen_ai.embeddings";
179
+ export declare const GEN_AI_EMBEDDINGS_OPERATION_ATTRIBUTE = "gen_ai.embeddings";
196
180
  /**
197
181
  * The span operation name for reranking
198
182
  */
@@ -226,28 +210,4 @@ export declare const GEN_AI_TOOL_OUTPUT_ATTRIBUTE = "gen_ai.tool.output";
226
210
  * @see https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/#gen-ai-tool-description
227
211
  */
228
212
  export declare const GEN_AI_TOOL_DESCRIPTION_ATTRIBUTE = "gen_ai.tool.description";
229
- /**
230
- * The response ID from OpenAI
231
- */
232
- export declare const OPENAI_RESPONSE_ID_ATTRIBUTE = "openai.response.id";
233
- /**
234
- * The response model from OpenAI
235
- */
236
- export declare const OPENAI_RESPONSE_MODEL_ATTRIBUTE = "openai.response.model";
237
- /**
238
- * The response timestamp from OpenAI (ISO string)
239
- */
240
- export declare const OPENAI_RESPONSE_TIMESTAMP_ATTRIBUTE = "openai.response.timestamp";
241
- /**
242
- * The number of completion tokens used
243
- */
244
- export declare const OPENAI_USAGE_COMPLETION_TOKENS_ATTRIBUTE = "openai.usage.completion_tokens";
245
- /**
246
- * The number of prompt tokens used
247
- */
248
- export declare const OPENAI_USAGE_PROMPT_TOKENS_ATTRIBUTE = "openai.usage.prompt_tokens";
249
- /**
250
- * The response timestamp from Anthropic AI (ISO string)
251
- */
252
- export declare const ANTHROPIC_AI_RESPONSE_TIMESTAMP_ATTRIBUTE = "anthropic.response.timestamp";
253
213
  //# sourceMappingURL=gen-ai-attributes.d.ts.map
@@ -8,10 +8,12 @@ export interface AIRecordingOptions {
8
8
  * which gen_ai operation it maps to and whether it is intrinsically streaming.
9
9
  */
10
10
  export interface InstrumentedMethodEntry {
11
- /** Operation name (e.g. 'chat', 'embeddings', 'generate_content') */
12
- operation: string;
11
+ /** Operation name (e.g. 'chat', 'embeddings', 'generate_content'). Omit for factory methods that only need result proxying. */
12
+ operation?: string;
13
13
  /** True if the method itself is always streaming (not param-based) */
14
14
  streaming?: boolean;
15
+ /** When set, the method's return value is re-proxied with this as the base path */
16
+ proxyResultPath?: string;
15
17
  }
16
18
  /**
17
19
  * Maps method paths to their registry entries.
@@ -24,6 +26,12 @@ export type InstrumentedMethodRegistry = Record<string, InstrumentedMethodEntry>
24
26
  * Precedence: explicit option > sendDefaultPii > false
25
27
  */
26
28
  export declare function resolveAIRecordingOptions<T extends AIRecordingOptions>(options?: T): T & Required<AIRecordingOptions>;
29
+ /**
30
+ * Resolves whether truncation should be enabled.
31
+ * If the user explicitly set `enableTruncation`, that value is used.
32
+ * Otherwise, truncation is disabled when span streaming is active.
33
+ */
34
+ export declare function shouldEnableTruncation(enableTruncation: boolean | undefined): boolean;
27
35
  /**
28
36
  * Build method path from current traversal
29
37
  */
@@ -37,6 +45,28 @@ export declare function buildMethodPath(currentPath: string, prop: string): stri
37
45
  * @param cachedOutputTokens - The number of cached output tokens
38
46
  */
39
47
  export declare function setTokenUsageAttributes(span: Span, promptTokens?: number, completionTokens?: number, cachedInputTokens?: number, cachedOutputTokens?: number): void;
48
+ export interface StreamResponseState {
49
+ responseId?: string;
50
+ responseModel?: string;
51
+ finishReasons: string[];
52
+ responseTexts: string[];
53
+ toolCalls: unknown[];
54
+ promptTokens?: number;
55
+ completionTokens?: number;
56
+ totalTokens?: number;
57
+ cacheCreationInputTokens?: number;
58
+ cacheReadInputTokens?: number;
59
+ }
60
+ /**
61
+ * Ends a streaming span by setting all accumulated response attributes and ending the span.
62
+ * Shared across OpenAI, Anthropic, and Google GenAI streaming implementations.
63
+ */
64
+ export declare function endStreamSpan(span: Span, state: StreamResponseState, recordOutputs: boolean): void;
65
+ /**
66
+ * Serialize a value to a JSON string without truncation.
67
+ * Strings are returned as-is, arrays and objects are JSON-stringified.
68
+ */
69
+ export declare function getJsonString<T>(value: T | T[]): string;
40
70
  /**
41
71
  * Get the truncated JSON string for a string or array of strings.
42
72
  *
@@ -8,6 +8,11 @@ export interface AnthropicAiOptions {
8
8
  * Enable or disable output recording.
9
9
  */
10
10
  recordOutputs?: boolean;
11
+ /**
12
+ * Enable or disable truncation of recorded input messages.
13
+ * Defaults to `true`.
14
+ */
15
+ enableTruncation?: boolean;
11
16
  }
12
17
  export type Message = {
13
18
  role: 'user' | 'assistant';
@@ -5,7 +5,7 @@ import { AnthropicAiResponse } from './types';
5
5
  * Set the messages and messages original length attributes.
6
6
  * Extracts system instructions before truncation.
7
7
  */
8
- export declare function setMessagesAttribute(span: Span, messages: unknown): void;
8
+ export declare function setMessagesAttribute(span: Span, messages: unknown, enableTruncation: boolean): void;
9
9
  /**
10
10
  * Map an Anthropic API error type to a SpanStatusType value.
11
11
  * @see https://docs.anthropic.com/en/api/errors#error-shapes
@@ -11,7 +11,7 @@ export declare const GOOGLE_GENAI_METHOD_REGISTRY: {
11
11
  readonly operation: "embeddings";
12
12
  };
13
13
  readonly 'chats.create': {
14
- readonly operation: "chat";
14
+ readonly proxyResultPath: "chat";
15
15
  };
16
16
  readonly 'chat.sendMessage': {
17
17
  readonly operation: "chat";
@@ -22,6 +22,4 @@ export declare const GOOGLE_GENAI_METHOD_REGISTRY: {
22
22
  };
23
23
  };
24
24
  export declare const GOOGLE_GENAI_SYSTEM_NAME = "google_genai";
25
- export declare const CHATS_CREATE_METHOD = "chats.create";
26
- export declare const CHAT_PATH = "chat";
27
25
  //# sourceMappingURL=constants.d.ts.map
@@ -8,6 +8,11 @@ export interface GoogleGenAIOptions {
8
8
  * Enable or disable output recording.
9
9
  */
10
10
  recordOutputs?: boolean;
11
+ /**
12
+ * Enable or disable truncation of recorded input messages.
13
+ * Defaults to `true`.
14
+ */
15
+ enableTruncation?: boolean;
11
16
  }
12
17
  /**
13
18
  * Google GenAI Content Part
@@ -10,4 +10,5 @@ export { getDynamicSamplingContextFromClient, getDynamicSamplingContextFromSpan,
10
10
  export { setMeasurement, timedEventsToMeasurements } from './measurement';
11
11
  export { sampleSpan } from './sampling';
12
12
  export { logSpanEnd, logSpanStart } from './logSpans';
13
+ export { captureSpan } from './spans/captureSpan';
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,27 @@
1
+ import { LangChainOptions } from './types';
2
+ /**
3
+ * Wraps a LangChain embedding method (embedQuery or embedDocuments) to create Sentry spans.
4
+ *
5
+ * Used internally by the Node.js auto-instrumentation to patch embedding class prototypes.
6
+ */
7
+ export declare function instrumentEmbeddingMethod(originalMethod: (...args: unknown[]) => Promise<unknown>, options?: LangChainOptions): (...args: unknown[]) => Promise<unknown>;
8
+ /**
9
+ * Wraps a LangChain embeddings instance to create Sentry spans for `embedQuery` and `embedDocuments` calls.
10
+ *
11
+ * Use this in non-Node runtimes (Cloudflare, browser, etc.) where auto-instrumentation is not available.
12
+ *
13
+ * @example
14
+ * ```javascript
15
+ * import * as Sentry from '@sentry/cloudflare';
16
+ * import { OpenAIEmbeddings } from '@langchain/openai';
17
+ *
18
+ * const embeddings = Sentry.instrumentLangChainEmbeddings(
19
+ * new OpenAIEmbeddings({ model: 'text-embedding-3-small' })
20
+ * );
21
+ *
22
+ * await embeddings.embedQuery('Hello world');
23
+ * await embeddings.embedDocuments(['doc1', 'doc2']);
24
+ * ```
25
+ */
26
+ export declare function instrumentLangChainEmbeddings<T extends object>(instance: T, options?: LangChainOptions): T;
27
+ //# sourceMappingURL=embeddings.d.ts.map
@@ -6,4 +6,5 @@ import { LangChainCallbackHandler, LangChainOptions } from './types';
6
6
  * This is a stateful handler that tracks spans across multiple LangChain executions.
7
7
  */
8
8
  export declare function createLangChainCallbackHandler(options?: LangChainOptions): LangChainCallbackHandler;
9
+ export { instrumentLangChainEmbeddings } from './embeddings';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -12,6 +12,11 @@ export interface LangChainOptions {
12
12
  * @default false (respects sendDefaultPii option)
13
13
  */
14
14
  recordOutputs?: boolean;
15
+ /**
16
+ * Enable or disable truncation of recorded input messages.
17
+ * Defaults to `true`.
18
+ */
19
+ enableTruncation?: boolean;
15
20
  }
16
21
  /**
17
22
  * LangChain Serialized type (compatible with @langchain/core)
@@ -36,7 +36,7 @@ export declare function normalizeLangChainMessages(messages: LangChainMessage[])
36
36
  * - When `recordInputs` is true, string prompts are wrapped into `{role:"user"}`
37
37
  * messages to align with the chat schema used elsewhere.
38
38
  */
39
- export declare function extractLLMRequestAttributes(llm: LangChainSerialized, prompts: string[], recordInputs: boolean, invocationParams?: Record<string, unknown>, langSmithMetadata?: Record<string, unknown>): Record<string, SpanAttributeValue>;
39
+ export declare function extractLLMRequestAttributes(llm: LangChainSerialized, prompts: string[], recordInputs: boolean, enableTruncation: boolean, invocationParams?: Record<string, unknown>, langSmithMetadata?: Record<string, unknown>): Record<string, SpanAttributeValue>;
40
40
  /**
41
41
  * Extracts attributes for ChatModel invocations (array-of-arrays of messages).
42
42
  *
@@ -46,7 +46,7 @@ export declare function extractLLMRequestAttributes(llm: LangChainSerialized, pr
46
46
  * consistent `{ role, content }` array when `recordInputs` is true.
47
47
  * - Provider system value falls back to `serialized.id?.[2]`.
48
48
  */
49
- export declare function extractChatModelRequestAttributes(llm: LangChainSerialized, langChainMessages: LangChainMessage[][], recordInputs: boolean, invocationParams?: Record<string, unknown>, langSmithMetadata?: Record<string, unknown>): Record<string, SpanAttributeValue>;
49
+ export declare function extractChatModelRequestAttributes(llm: LangChainSerialized, langChainMessages: LangChainMessage[][], recordInputs: boolean, enableTruncation: boolean, invocationParams?: Record<string, unknown>, langSmithMetadata?: Record<string, unknown>): Record<string, SpanAttributeValue>;
50
50
  /**
51
51
  * Extracts response-related attributes based on a `LangChainLLMResult`.
52
52
  *
@@ -7,6 +7,11 @@ export interface LangGraphOptions {
7
7
  * Enable or disable output recording.
8
8
  */
9
9
  recordOutputs?: boolean;
10
+ /**
11
+ * Enable or disable truncation of recorded input messages.
12
+ * Defaults to `true`.
13
+ */
14
+ enableTruncation?: boolean;
10
15
  }
11
16
  /**
12
17
  * LangGraph Tool definition from lc_kwargs
@@ -14,6 +14,11 @@ export interface OpenAiOptions {
14
14
  * Enable or disable output recording.
15
15
  */
16
16
  recordOutputs?: boolean;
17
+ /**
18
+ * Enable or disable truncation of recorded input messages.
19
+ * Defaults to `true`.
20
+ */
21
+ enableTruncation?: boolean;
17
22
  }
18
23
  export interface OpenAiClient {
19
24
  responses?: {
@@ -1,22 +1,5 @@
1
1
  import { Span } from '../../types-hoist/span';
2
- import { ChatCompletionChunk, OpenAiChatCompletionObject, OpenAIConversationObject, OpenAICreateEmbeddingsObject, OpenAIResponseObject, ResponseStreamingEvent } from './types';
3
- /**
4
- * Check if response is a Chat Completion object
5
- */
6
- export declare function isChatCompletionResponse(response: unknown): response is OpenAiChatCompletionObject;
7
- /**
8
- * Check if response is a Responses API object
9
- */
10
- export declare function isResponsesApiResponse(response: unknown): response is OpenAIResponseObject;
11
- /**
12
- * Check if response is an Embeddings API object
13
- */
14
- export declare function isEmbeddingsResponse(response: unknown): response is OpenAICreateEmbeddingsObject;
15
- /**
16
- * Check if response is a Conversations API object
17
- * @see https://platform.openai.com/docs/api-reference/conversations
18
- */
19
- export declare function isConversationResponse(response: unknown): response is OpenAIConversationObject;
2
+ import { ChatCompletionChunk, ResponseStreamingEvent } from './types';
20
3
  /**
21
4
  * Check if streaming event is from the Responses API
22
5
  */
@@ -26,38 +9,10 @@ export declare function isResponsesApiStreamEvent(event: unknown): event is Resp
26
9
  */
27
10
  export declare function isChatCompletionChunk(event: unknown): event is ChatCompletionChunk;
28
11
  /**
29
- * Add attributes for Chat Completion responses
30
- */
31
- export declare function addChatCompletionAttributes(span: Span, response: OpenAiChatCompletionObject, recordOutputs?: boolean): void;
32
- /**
33
- * Add attributes for Responses API responses
34
- */
35
- export declare function addResponsesApiAttributes(span: Span, response: OpenAIResponseObject, recordOutputs?: boolean): void;
36
- /**
37
- * Add attributes for Embeddings API responses
38
- */
39
- export declare function addEmbeddingsAttributes(span: Span, response: OpenAICreateEmbeddingsObject): void;
40
- /**
41
- * Add attributes for Conversations API responses
42
- * @see https://platform.openai.com/docs/api-reference/conversations
43
- */
44
- export declare function addConversationAttributes(span: Span, response: OpenAIConversationObject): void;
45
- /**
46
- * Set token usage attributes
47
- * @param span - The span to add attributes to
48
- * @param promptTokens - The number of prompt tokens
49
- * @param completionTokens - The number of completion tokens
50
- * @param totalTokens - The number of total tokens
51
- */
52
- export declare function setTokenUsageAttributes(span: Span, promptTokens?: number, completionTokens?: number, totalTokens?: number): void;
53
- /**
54
- * Set common response attributes
55
- * @param span - The span to add attributes to
56
- * @param id - The response id
57
- * @param model - The response model
58
- * @param timestamp - The response timestamp
12
+ * Add response attributes to a span using duck-typing.
13
+ * Works for Chat Completions, Responses API, Embeddings, and Conversations API responses.
59
14
  */
60
- export declare function setCommonResponseAttributes(span: Span, id: string, model: string, timestamp: number): void;
15
+ export declare function addResponseAttributes(span: Span, result: unknown, recordOutputs?: boolean): void;
61
16
  /**
62
17
  * Extract request parameters including model settings and conversation context
63
18
  */
@@ -1,12 +1,22 @@
1
+ import { EventDropReason } from '../types-hoist/clientreport';
1
2
  import { SentrySpanArguments, Span, SpanAttributes, SpanAttributeValue, SpanContextData, SpanTimeInput } from '../types-hoist/span';
2
3
  import { SpanStatus } from '../types-hoist/spanStatus';
4
+ interface SentryNonRecordingSpanArguments extends SentrySpanArguments {
5
+ dropReason?: EventDropReason;
6
+ }
3
7
  /**
4
8
  * A Sentry Span that is non-recording, meaning it will not be sent to Sentry.
5
9
  */
6
10
  export declare class SentryNonRecordingSpan implements Span {
7
11
  private _traceId;
8
12
  private _spanId;
9
- constructor(spanContext?: SentrySpanArguments);
13
+ /**
14
+ * Reason why this span was dropped, if applicable ('ignored' or 'sample_rate').
15
+ * Used to propagate the correct client report outcome to descendant spans
16
+ * when span streaming is enabled.
17
+ */
18
+ dropReason?: EventDropReason;
19
+ constructor(spanContext?: SentryNonRecordingSpanArguments);
10
20
  /** @inheritdoc */
11
21
  spanContext(): SpanContextData;
12
22
  /** @inheritdoc */
@@ -36,4 +46,5 @@ export declare class SentryNonRecordingSpan implements Span {
36
46
  */
37
47
  recordException(_exception: unknown, _time?: number | undefined): void;
38
48
  }
49
+ export {};
39
50
  //# sourceMappingURL=sentryNonRecordingSpan.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { SpanLink } from '../types-hoist/link';
2
- import { SentrySpanArguments, Span, SpanAttributes, SpanAttributeValue, SpanContextData, SpanJSON, SpanTimeInput } from '../types-hoist/span';
2
+ import { SentrySpanArguments, Span, SpanAttributes, SpanAttributeValue, SpanContextData, SpanJSON, SpanTimeInput, StreamedSpanJSON } from '../types-hoist/span';
3
3
  import { SpanStatus } from '../types-hoist/spanStatus';
4
4
  import { TimedEvent } from '../types-hoist/timedEvent';
5
5
  /**
@@ -77,6 +77,15 @@ export declare class SentrySpan implements Span {
77
77
  * use `spanToJSON(span)` instead.
78
78
  */
79
79
  getSpanJSON(): SpanJSON;
80
+ /**
81
+ * Get {@link StreamedSpanJSON} representation of this span.
82
+ *
83
+ * @hidden
84
+ * @internal This method is purely for internal purposes and should not be used outside
85
+ * of SDK code. If you need to get a JSON representation of a span,
86
+ * use `spanToStreamedSpanJSON(span)` instead.
87
+ */
88
+ getStreamedSpanJSON(): StreamedSpanJSON;
80
89
  /** @inheritdoc */
81
90
  isRecording(): boolean;
82
91
  /**
@@ -0,0 +1,35 @@
1
+ import { CoreOptions } from '../../types-hoist/options';
2
+ import { BeforeSendStreamedSpanCallback } from '../../types-hoist/options';
3
+ import { StreamedSpanJSON } from '../../types-hoist/span';
4
+ type StaticBeforeSendSpanCallback = CoreOptions['beforeSendSpan'];
5
+ /**
6
+ * A wrapper to use the new span format in your `beforeSendSpan` callback.
7
+ *
8
+ * When using `traceLifecycle: 'stream'`, wrap your callback with this function
9
+ * to receive and return {@link StreamedSpanJSON} instead of the standard {@link SpanJSON}.
10
+ *
11
+ * @example
12
+ *
13
+ * Sentry.init({
14
+ * traceLifecycle: 'stream',
15
+ * beforeSendSpan: withStreamedSpan((span) => {
16
+ * // span is of type StreamedSpanJSON
17
+ * return span;
18
+ * }),
19
+ * });
20
+ *
21
+ * @param callback - The callback function that receives and returns a {@link StreamedSpanJSON}.
22
+ * @returns A callback that is compatible with the `beforeSendSpan` option when using `traceLifecycle: 'stream'`.
23
+ */
24
+ export declare function withStreamedSpan(callback: (span: StreamedSpanJSON) => StreamedSpanJSON): StaticBeforeSendSpanCallback & {
25
+ _streamed: true;
26
+ };
27
+ /**
28
+ * Typesafe check to identify if a `beforeSendSpan` callback expects the streamed span JSON format.
29
+ *
30
+ * @param callback - The `beforeSendSpan` callback to check.
31
+ * @returns `true` if the callback was wrapped with {@link withStreamedSpan}.
32
+ */
33
+ export declare function isStreamedBeforeSendSpanCallback(callback: unknown): callback is BeforeSendStreamedSpanCallback;
34
+ export {};
35
+ //# sourceMappingURL=beforeSendSpan.d.ts.map
@@ -0,0 +1,26 @@
1
+ import { RawAttributes } from '../../attributes';
2
+ import { Client } from '../../client';
3
+ import { SerializedStreamedSpan, Span, StreamedSpanJSON } from '../../types-hoist/span';
4
+ export type SerializedStreamedSpanWithSegmentSpan = SerializedStreamedSpan & {
5
+ _segmentSpan: Span;
6
+ };
7
+ /**
8
+ * Captures a span and returns a JSON representation to be enqueued for sending.
9
+ *
10
+ * IMPORTANT: This function converts the span to JSON immediately to avoid writing
11
+ * to an already-ended OTel span instance (which is blocked by the OTel Span class).
12
+ *
13
+ * @returns the final serialized span with a reference to its segment span. This reference
14
+ * is needed later on to compute the DSC for the span envelope.
15
+ */
16
+ export declare function captureSpan(span: Span, client: Client): SerializedStreamedSpanWithSegmentSpan;
17
+ /**
18
+ * Apply a user-provided beforeSendSpan callback to a span JSON.
19
+ */
20
+ export declare function applyBeforeSendSpanCallback(span: StreamedSpanJSON, beforeSendSpan: (span: StreamedSpanJSON) => StreamedSpanJSON): StreamedSpanJSON;
21
+ /**
22
+ * Safely set attributes on a span JSON.
23
+ * If an attribute already exists, it will not be overwritten.
24
+ */
25
+ export declare function safeSetSpanJSONAttributes(spanJSON: StreamedSpanJSON, newAttributes: RawAttributes<Record<string, unknown>>): void;
26
+ //# sourceMappingURL=captureSpan.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { Client } from '../../client';
2
+ import { DynamicSamplingContext, StreamedSpanEnvelope } from '../../types-hoist/envelope';
3
+ import { SerializedStreamedSpan } from '../../types-hoist/span';
4
+ /**
5
+ * Creates a span v2 span streaming envelope
6
+ */
7
+ export declare function createStreamedSpanEnvelope(serializedSpans: Array<SerializedStreamedSpan>, dsc: Partial<DynamicSamplingContext>, client: Client): StreamedSpanEnvelope;
8
+ //# sourceMappingURL=envelope.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { SerializedStreamedSpan } from '../../types-hoist/span';
2
+ /**
3
+ * Estimates the serialized byte size of a {@link SerializedStreamedSpan}.
4
+ *
5
+ * Uses 2 bytes per character as a UTF-16 approximation, and 8 bytes per number.
6
+ * The estimate is intentionally conservative and may be slightly lower than the
7
+ * actual byte size on the wire.
8
+ * We compensate for this by setting the span buffers internal limit well below the limit
9
+ * of how large an actual span v2 envelope may be.
10
+ */
11
+ export declare function estimateSerializedSpanSizeInBytes(span: SerializedStreamedSpan): number;
12
+ //# sourceMappingURL=estimateSize.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { Client } from '../../client';
2
+ /**
3
+ * Determines if span streaming is enabled for the given client
4
+ */
5
+ export declare function hasSpanStreamingEnabled(client: Client): boolean;
6
+ //# sourceMappingURL=hasSpanStreamingEnabled.d.ts.map
@@ -0,0 +1,60 @@
1
+ import { Client } from '../../client';
2
+ import { SerializedStreamedSpanWithSegmentSpan } from './captureSpan';
3
+ export interface SpanBufferOptions {
4
+ /**
5
+ * Max spans per trace before auto-flush
6
+ * Must not exceed 1000.
7
+ *
8
+ * @default 1_000
9
+ */
10
+ maxSpanLimit?: number;
11
+ /**
12
+ * Per-trace flush timeout in ms. A timeout is started when a trace bucket is first created
13
+ * and fires flush() for that specific trace when it expires.
14
+ * Must be greater than 0.
15
+ *
16
+ * @default 5_000
17
+ */
18
+ flushInterval?: number;
19
+ /**
20
+ * Max accumulated byte weight of spans per trace before auto-flush.
21
+ * Size is estimated, not exact. Uses 2 bytes per character for strings (UTF-16).
22
+ *
23
+ * @default 5_000_000 (5 MB)
24
+ */
25
+ maxTraceWeightInBytes?: number;
26
+ }
27
+ /**
28
+ * A buffer for serialized streamed span JSON objects that flushes them to Sentry in Span v2 envelopes.
29
+ * Handles per-trace timeout-based flushing, size thresholds, and graceful shutdown.
30
+ * Also handles computation of the Dynamic Sampling Context (DSC) for the trace, if it wasn't yet
31
+ * frozen onto the segment span.
32
+ *
33
+ * For this, we need the reference to the segment span instance, from
34
+ * which we compute the DSC. Doing this in the buffer ensures that we compute the DSC as late as possible,
35
+ * allowing span name and data updates up to this point. Worth noting here that the segment span is likely
36
+ * still active and modifyable when child spans are added to the buffer.
37
+ */
38
+ export declare class SpanBuffer {
39
+ private _traceBuckets;
40
+ private _client;
41
+ private _maxSpanLimit;
42
+ private _flushInterval;
43
+ private _maxTraceWeight;
44
+ constructor(client: Client, options?: SpanBufferOptions);
45
+ /**
46
+ * Add a span to the buffer.
47
+ */
48
+ add(spanJSON: SerializedStreamedSpanWithSegmentSpan): void;
49
+ /**
50
+ * Drain and flush all buffered traces.
51
+ */
52
+ drain(): void;
53
+ /**
54
+ * Flush spans of a specific trace.
55
+ * In contrast to {@link SpanBuffer.drain}, this method does not flush all traces, but only the one with the given traceId.
56
+ */
57
+ flush(traceId: string): void;
58
+ private _removeTrace;
59
+ }
60
+ //# sourceMappingURL=spanBuffer.d.ts.map
@@ -1,8 +1,5 @@
1
1
  import { ToolCallSpanContext } from './types';
2
2
  export declare const toolCallSpanContextMap: Map<string, ToolCallSpanContext>;
3
- export declare const INVOKE_AGENT_OPS: Set<string>;
4
- export declare const GENERATE_CONTENT_OPS: Set<string>;
5
- export declare const EMBEDDINGS_OPS: Set<string>;
6
- export declare const RERANK_OPS: Set<string>;
7
- export declare const DO_SPAN_NAME_PREFIX: Record<string, string>;
3
+ /** Maps Vercel AI span names to standardized OpenTelemetry operation names. */
4
+ export declare const SPAN_TO_OPERATION_NAME: Map<string, string>;
8
5
  //# sourceMappingURL=constants.d.ts.map
@@ -44,9 +44,5 @@ export declare function convertUserInputToMessagesFormat(userInput: string): {
44
44
  * Generate a request.messages JSON array from the prompt field in the
45
45
  * invoke_agent op
46
46
  */
47
- export declare function requestMessagesFromPrompt(span: Span, attributes: SpanAttributes): void;
48
- /**
49
- * Maps a Vercel AI span name to the corresponding Sentry op.
50
- */
51
- export declare function getSpanOpFromName(name: string): string | undefined;
47
+ export declare function requestMessagesFromPrompt(span: Span, attributes: SpanAttributes, enableTruncation: boolean): void;
52
48
  //# sourceMappingURL=utils.d.ts.map