@sentry/server-utils 10.64.0 → 10.66.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/build/cjs/graphql/graphql-dc-subscriber.js +123 -0
  2. package/build/cjs/graphql/graphql-dc-subscriber.js.map +1 -0
  3. package/build/cjs/graphql/index.js +23 -0
  4. package/build/cjs/graphql/index.js.map +1 -0
  5. package/build/cjs/graphql/utils.js +92 -0
  6. package/build/cjs/graphql/utils.js.map +1 -0
  7. package/build/cjs/index.js +13 -11
  8. package/build/cjs/index.js.map +1 -1
  9. package/build/cjs/integrations/tracing-channel/amqplib.js +420 -0
  10. package/build/cjs/integrations/tracing-channel/amqplib.js.map +1 -0
  11. package/build/cjs/integrations/tracing-channel/dataloader.js +95 -0
  12. package/build/cjs/integrations/tracing-channel/dataloader.js.map +1 -0
  13. package/build/cjs/integrations/tracing-channel/express/index.js +24 -0
  14. package/build/cjs/integrations/tracing-channel/express/index.js.map +1 -0
  15. package/build/cjs/integrations/tracing-channel/express/instrumentation.js +173 -0
  16. package/build/cjs/integrations/tracing-channel/express/instrumentation.js.map +1 -0
  17. package/build/cjs/integrations/tracing-channel/express/route.js +76 -0
  18. package/build/cjs/integrations/tracing-channel/express/route.js.map +1 -0
  19. package/build/cjs/integrations/tracing-channel/fastify/instrumentation.js +1 -1
  20. package/build/cjs/integrations/tracing-channel/fastify/instrumentation.js.map +1 -1
  21. package/build/cjs/integrations/tracing-channel/generic-pool.js +34 -0
  22. package/build/cjs/integrations/tracing-channel/generic-pool.js.map +1 -0
  23. package/build/cjs/integrations/tracing-channel/google-genai.js +96 -0
  24. package/build/cjs/integrations/tracing-channel/google-genai.js.map +1 -0
  25. package/build/cjs/integrations/tracing-channel/graphql/constants.js +26 -0
  26. package/build/cjs/integrations/tracing-channel/graphql/constants.js.map +1 -0
  27. package/build/cjs/integrations/tracing-channel/graphql/index.js +66 -0
  28. package/build/cjs/integrations/tracing-channel/graphql/index.js.map +1 -0
  29. package/build/cjs/integrations/tracing-channel/graphql/resolvers.js +168 -0
  30. package/build/cjs/integrations/tracing-channel/graphql/resolvers.js.map +1 -0
  31. package/build/cjs/integrations/tracing-channel/graphql/spans.js +102 -0
  32. package/build/cjs/integrations/tracing-channel/graphql/spans.js.map +1 -0
  33. package/build/cjs/integrations/tracing-channel/ioredis.js +35 -32
  34. package/build/cjs/integrations/tracing-channel/ioredis.js.map +1 -1
  35. package/build/cjs/integrations/tracing-channel/kafkajs/consumer.js +71 -0
  36. package/build/cjs/integrations/tracing-channel/kafkajs/consumer.js.map +1 -0
  37. package/build/cjs/integrations/tracing-channel/kafkajs/index.js +70 -0
  38. package/build/cjs/integrations/tracing-channel/kafkajs/index.js.map +1 -0
  39. package/build/cjs/integrations/tracing-channel/kafkajs/semconv.js +22 -0
  40. package/build/cjs/integrations/tracing-channel/kafkajs/semconv.js.map +1 -0
  41. package/build/cjs/integrations/tracing-channel/kafkajs/spans.js +119 -0
  42. package/build/cjs/integrations/tracing-channel/kafkajs/spans.js.map +1 -0
  43. package/build/cjs/integrations/tracing-channel/knex.js +188 -0
  44. package/build/cjs/integrations/tracing-channel/knex.js.map +1 -0
  45. package/build/cjs/integrations/tracing-channel/mysql.js +1 -1
  46. package/build/cjs/integrations/tracing-channel/mysql.js.map +1 -1
  47. package/build/cjs/integrations/tracing-channel/mysql2.js +83 -0
  48. package/build/cjs/integrations/tracing-channel/mysql2.js.map +1 -0
  49. package/build/cjs/integrations/tracing-channel/openai.js.map +1 -1
  50. package/build/cjs/integrations/tracing-channel/postgres-js.js +191 -0
  51. package/build/cjs/integrations/tracing-channel/postgres-js.js.map +1 -0
  52. package/build/cjs/integrations/tracing-channel/postgres.js +5 -5
  53. package/build/cjs/integrations/tracing-channel/postgres.js.map +1 -1
  54. package/build/cjs/integrations/tracing-channel/redis.js +227 -0
  55. package/build/cjs/integrations/tracing-channel/redis.js.map +1 -0
  56. package/build/cjs/integrations/tracing-channel/vercel-ai.js +2 -2
  57. package/build/cjs/integrations/tracing-channel/vercel-ai.js.map +1 -1
  58. package/build/cjs/mongoose/mongoose-dc-subscriber.js +1 -1
  59. package/build/cjs/mongoose/mongoose-dc-subscriber.js.map +1 -1
  60. package/build/cjs/mysql2/index.js +23 -0
  61. package/build/cjs/mysql2/index.js.map +1 -0
  62. package/build/cjs/mysql2/mysql2-dc-subscriber.js +68 -0
  63. package/build/cjs/mysql2/mysql2-dc-subscriber.js.map +1 -0
  64. package/build/cjs/orchestrion/bundler/esbuild.js +11 -0
  65. package/build/cjs/orchestrion/bundler/esbuild.js.map +1 -0
  66. package/build/cjs/orchestrion/bundler/options.js +15 -0
  67. package/build/cjs/orchestrion/bundler/options.js.map +1 -0
  68. package/build/cjs/orchestrion/bundler/rollup.js +11 -0
  69. package/build/cjs/orchestrion/bundler/rollup.js.map +1 -0
  70. package/build/cjs/orchestrion/bundler/vite.js +4 -21
  71. package/build/cjs/orchestrion/bundler/vite.js.map +1 -1
  72. package/build/cjs/orchestrion/bundler/webpack.js +32 -0
  73. package/build/cjs/orchestrion/bundler/webpack.js.map +1 -0
  74. package/build/cjs/orchestrion/channels.js +53 -11
  75. package/build/cjs/orchestrion/channels.js.map +1 -1
  76. package/build/cjs/orchestrion/config/amqplib.js +81 -0
  77. package/build/cjs/orchestrion/config/amqplib.js.map +1 -0
  78. package/build/cjs/orchestrion/config/dataloader.js +53 -0
  79. package/build/cjs/orchestrion/config/dataloader.js.map +1 -0
  80. package/build/cjs/orchestrion/config/express.js +76 -0
  81. package/build/cjs/orchestrion/config/express.js.map +1 -0
  82. package/build/cjs/orchestrion/config/firebase.js +8 -0
  83. package/build/cjs/orchestrion/config/firebase.js.map +1 -0
  84. package/build/cjs/orchestrion/config/generic-pool.js +21 -0
  85. package/build/cjs/orchestrion/config/generic-pool.js.map +1 -0
  86. package/build/cjs/orchestrion/config/google-genai.js +38 -0
  87. package/build/cjs/orchestrion/config/google-genai.js.map +1 -0
  88. package/build/cjs/orchestrion/config/graphql.js +28 -0
  89. package/build/cjs/orchestrion/config/graphql.js.map +1 -0
  90. package/build/cjs/orchestrion/config/index.js +59 -14
  91. package/build/cjs/orchestrion/config/index.js.map +1 -1
  92. package/build/cjs/orchestrion/config/kafkajs.js +30 -0
  93. package/build/cjs/orchestrion/config/kafkajs.js.map +1 -0
  94. package/build/cjs/orchestrion/config/knex.js +43 -0
  95. package/build/cjs/orchestrion/config/knex.js.map +1 -0
  96. package/build/cjs/orchestrion/config/langchain.js +8 -0
  97. package/build/cjs/orchestrion/config/langchain.js.map +1 -0
  98. package/build/cjs/orchestrion/config/langgraph.js +8 -0
  99. package/build/cjs/orchestrion/config/langgraph.js.map +1 -0
  100. package/build/cjs/orchestrion/config/mongodb.js +8 -0
  101. package/build/cjs/orchestrion/config/mongodb.js.map +1 -0
  102. package/build/cjs/orchestrion/config/mongoose.js +8 -0
  103. package/build/cjs/orchestrion/config/mongoose.js.map +1 -0
  104. package/build/cjs/orchestrion/config/mysql2.js +32 -0
  105. package/build/cjs/orchestrion/config/mysql2.js.map +1 -0
  106. package/build/cjs/orchestrion/config/nestjs.js +122 -0
  107. package/build/cjs/orchestrion/config/nestjs.js.map +1 -0
  108. package/build/cjs/orchestrion/config/postgres.js +50 -0
  109. package/build/cjs/orchestrion/config/postgres.js.map +1 -0
  110. package/build/cjs/orchestrion/config/prisma.js +8 -0
  111. package/build/cjs/orchestrion/config/prisma.js.map +1 -0
  112. package/build/cjs/orchestrion/config/react-router.js +8 -0
  113. package/build/cjs/orchestrion/config/react-router.js.map +1 -0
  114. package/build/cjs/orchestrion/config/redis.js +76 -0
  115. package/build/cjs/orchestrion/config/redis.js.map +1 -0
  116. package/build/cjs/orchestrion/config/remix.js +8 -0
  117. package/build/cjs/orchestrion/config/remix.js.map +1 -0
  118. package/build/cjs/orchestrion/config/tedious.js +8 -0
  119. package/build/cjs/orchestrion/config/tedious.js.map +1 -0
  120. package/build/cjs/orchestrion/config/vercel-ai.js +18 -14
  121. package/build/cjs/orchestrion/config/vercel-ai.js.map +1 -1
  122. package/build/cjs/orchestrion/detect.js +12 -11
  123. package/build/cjs/orchestrion/detect.js.map +1 -1
  124. package/build/cjs/orchestrion/index.js +33 -1
  125. package/build/cjs/orchestrion/index.js.map +1 -1
  126. package/build/cjs/orchestrion/runtime/register.js +25 -14
  127. package/build/cjs/orchestrion/runtime/register.js.map +1 -1
  128. package/build/cjs/prisma/global.js +14 -0
  129. package/build/cjs/prisma/global.js.map +1 -0
  130. package/build/cjs/prisma/index.js +27 -0
  131. package/build/cjs/prisma/index.js.map +1 -0
  132. package/build/cjs/prisma/tracing-helper.js +211 -0
  133. package/build/cjs/prisma/tracing-helper.js.map +1 -0
  134. package/build/cjs/redis/index.js +23 -0
  135. package/build/cjs/redis/index.js.map +1 -0
  136. package/build/cjs/redis/redis-dc-subscriber.js +23 -35
  137. package/build/cjs/redis/redis-dc-subscriber.js.map +1 -1
  138. package/build/cjs/tracing-channel.js +7 -6
  139. package/build/cjs/tracing-channel.js.map +1 -1
  140. package/build/cjs/vercel-ai/util.js +112 -0
  141. package/build/cjs/vercel-ai/util.js.map +1 -0
  142. package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js +138 -74
  143. package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
  144. package/build/cjs/vercel-ai/{vercel-ai-orchestrion-v6-subscriber.js → vercel-ai-orchestrion-subscriber.js} +153 -23
  145. package/build/cjs/vercel-ai/vercel-ai-orchestrion-subscriber.js.map +1 -0
  146. package/build/esm/graphql/graphql-dc-subscriber.js +116 -0
  147. package/build/esm/graphql/graphql-dc-subscriber.js.map +1 -0
  148. package/build/esm/graphql/index.js +21 -0
  149. package/build/esm/graphql/index.js.map +1 -0
  150. package/build/esm/graphql/utils.js +87 -0
  151. package/build/esm/graphql/utils.js.map +1 -0
  152. package/build/esm/index.js +4 -1
  153. package/build/esm/index.js.map +1 -1
  154. package/build/esm/integrations/tracing-channel/amqplib.js +418 -0
  155. package/build/esm/integrations/tracing-channel/amqplib.js.map +1 -0
  156. package/build/esm/integrations/tracing-channel/anthropic.js +1 -1
  157. package/build/esm/integrations/tracing-channel/dataloader.js +93 -0
  158. package/build/esm/integrations/tracing-channel/dataloader.js.map +1 -0
  159. package/build/esm/integrations/tracing-channel/express/index.js +22 -0
  160. package/build/esm/integrations/tracing-channel/express/index.js.map +1 -0
  161. package/build/esm/integrations/tracing-channel/express/instrumentation.js +171 -0
  162. package/build/esm/integrations/tracing-channel/express/instrumentation.js.map +1 -0
  163. package/build/esm/integrations/tracing-channel/express/route.js +68 -0
  164. package/build/esm/integrations/tracing-channel/express/route.js.map +1 -0
  165. package/build/esm/integrations/tracing-channel/fastify/instrumentation.js +2 -2
  166. package/build/esm/integrations/tracing-channel/fastify/instrumentation.js.map +1 -1
  167. package/build/esm/integrations/tracing-channel/generic-pool.js +32 -0
  168. package/build/esm/integrations/tracing-channel/generic-pool.js.map +1 -0
  169. package/build/esm/integrations/tracing-channel/google-genai.js +94 -0
  170. package/build/esm/integrations/tracing-channel/google-genai.js.map +1 -0
  171. package/build/esm/integrations/tracing-channel/graphql/constants.js +14 -0
  172. package/build/esm/integrations/tracing-channel/graphql/constants.js.map +1 -0
  173. package/build/esm/integrations/tracing-channel/graphql/index.js +63 -0
  174. package/build/esm/integrations/tracing-channel/graphql/index.js.map +1 -0
  175. package/build/esm/integrations/tracing-channel/graphql/resolvers.js +164 -0
  176. package/build/esm/integrations/tracing-channel/graphql/resolvers.js.map +1 -0
  177. package/build/esm/integrations/tracing-channel/graphql/spans.js +96 -0
  178. package/build/esm/integrations/tracing-channel/graphql/spans.js.map +1 -0
  179. package/build/esm/integrations/tracing-channel/ioredis.js +36 -34
  180. package/build/esm/integrations/tracing-channel/ioredis.js.map +1 -1
  181. package/build/esm/integrations/tracing-channel/kafkajs/consumer.js +67 -0
  182. package/build/esm/integrations/tracing-channel/kafkajs/consumer.js.map +1 -0
  183. package/build/esm/integrations/tracing-channel/kafkajs/index.js +68 -0
  184. package/build/esm/integrations/tracing-channel/kafkajs/index.js.map +1 -0
  185. package/build/esm/integrations/tracing-channel/kafkajs/semconv.js +12 -0
  186. package/build/esm/integrations/tracing-channel/kafkajs/semconv.js.map +1 -0
  187. package/build/esm/integrations/tracing-channel/kafkajs/spans.js +112 -0
  188. package/build/esm/integrations/tracing-channel/kafkajs/spans.js.map +1 -0
  189. package/build/esm/integrations/tracing-channel/knex.js +186 -0
  190. package/build/esm/integrations/tracing-channel/knex.js.map +1 -0
  191. package/build/esm/integrations/tracing-channel/mysql.js +2 -2
  192. package/build/esm/integrations/tracing-channel/mysql.js.map +1 -1
  193. package/build/esm/integrations/tracing-channel/mysql2.js +81 -0
  194. package/build/esm/integrations/tracing-channel/mysql2.js.map +1 -0
  195. package/build/esm/integrations/tracing-channel/openai.js +1 -1
  196. package/build/esm/integrations/tracing-channel/openai.js.map +1 -1
  197. package/build/esm/integrations/tracing-channel/postgres-js.js +189 -0
  198. package/build/esm/integrations/tracing-channel/postgres-js.js.map +1 -0
  199. package/build/esm/integrations/tracing-channel/postgres.js +6 -6
  200. package/build/esm/integrations/tracing-channel/postgres.js.map +1 -1
  201. package/build/esm/integrations/tracing-channel/redis.js +225 -0
  202. package/build/esm/integrations/tracing-channel/redis.js.map +1 -0
  203. package/build/esm/integrations/tracing-channel/vercel-ai.js +1 -1
  204. package/build/esm/integrations/tracing-channel/vercel-ai.js.map +1 -1
  205. package/build/esm/mongoose/mongoose-dc-subscriber.js +2 -2
  206. package/build/esm/mongoose/mongoose-dc-subscriber.js.map +1 -1
  207. package/build/esm/mysql2/index.js +21 -0
  208. package/build/esm/mysql2/index.js.map +1 -0
  209. package/build/esm/mysql2/mysql2-dc-subscriber.js +62 -0
  210. package/build/esm/mysql2/mysql2-dc-subscriber.js.map +1 -0
  211. package/build/esm/orchestrion/bundler/esbuild.js +9 -0
  212. package/build/esm/orchestrion/bundler/esbuild.js.map +1 -0
  213. package/build/esm/orchestrion/bundler/options.js +13 -0
  214. package/build/esm/orchestrion/bundler/options.js.map +1 -0
  215. package/build/esm/orchestrion/bundler/rollup.js +9 -0
  216. package/build/esm/orchestrion/bundler/rollup.js.map +1 -0
  217. package/build/esm/orchestrion/bundler/vite.js +5 -22
  218. package/build/esm/orchestrion/bundler/vite.js.map +1 -1
  219. package/build/esm/orchestrion/bundler/webpack.js +27 -0
  220. package/build/esm/orchestrion/bundler/webpack.js.map +1 -0
  221. package/build/esm/orchestrion/channels.js +53 -11
  222. package/build/esm/orchestrion/channels.js.map +1 -1
  223. package/build/esm/orchestrion/config/amqplib.js +78 -0
  224. package/build/esm/orchestrion/config/amqplib.js.map +1 -0
  225. package/build/esm/orchestrion/config/dataloader.js +50 -0
  226. package/build/esm/orchestrion/config/dataloader.js.map +1 -0
  227. package/build/esm/orchestrion/config/express.js +73 -0
  228. package/build/esm/orchestrion/config/express.js.map +1 -0
  229. package/build/esm/orchestrion/config/firebase.js +5 -0
  230. package/build/esm/orchestrion/config/firebase.js.map +1 -0
  231. package/build/esm/orchestrion/config/generic-pool.js +18 -0
  232. package/build/esm/orchestrion/config/generic-pool.js.map +1 -0
  233. package/build/esm/orchestrion/config/google-genai.js +35 -0
  234. package/build/esm/orchestrion/config/google-genai.js.map +1 -0
  235. package/build/esm/orchestrion/config/graphql.js +25 -0
  236. package/build/esm/orchestrion/config/graphql.js.map +1 -0
  237. package/build/esm/orchestrion/config/index.js +59 -15
  238. package/build/esm/orchestrion/config/index.js.map +1 -1
  239. package/build/esm/orchestrion/config/kafkajs.js +27 -0
  240. package/build/esm/orchestrion/config/kafkajs.js.map +1 -0
  241. package/build/esm/orchestrion/config/knex.js +40 -0
  242. package/build/esm/orchestrion/config/knex.js.map +1 -0
  243. package/build/esm/orchestrion/config/langchain.js +5 -0
  244. package/build/esm/orchestrion/config/langchain.js.map +1 -0
  245. package/build/esm/orchestrion/config/langgraph.js +5 -0
  246. package/build/esm/orchestrion/config/langgraph.js.map +1 -0
  247. package/build/esm/orchestrion/config/mongodb.js +5 -0
  248. package/build/esm/orchestrion/config/mongodb.js.map +1 -0
  249. package/build/esm/orchestrion/config/mongoose.js +5 -0
  250. package/build/esm/orchestrion/config/mongoose.js.map +1 -0
  251. package/build/esm/orchestrion/config/mysql2.js +29 -0
  252. package/build/esm/orchestrion/config/mysql2.js.map +1 -0
  253. package/build/esm/orchestrion/config/nestjs.js +119 -0
  254. package/build/esm/orchestrion/config/nestjs.js.map +1 -0
  255. package/build/esm/orchestrion/config/postgres.js +47 -0
  256. package/build/esm/orchestrion/config/postgres.js.map +1 -0
  257. package/build/esm/orchestrion/config/prisma.js +5 -0
  258. package/build/esm/orchestrion/config/prisma.js.map +1 -0
  259. package/build/esm/orchestrion/config/react-router.js +5 -0
  260. package/build/esm/orchestrion/config/react-router.js.map +1 -0
  261. package/build/esm/orchestrion/config/redis.js +73 -0
  262. package/build/esm/orchestrion/config/redis.js.map +1 -0
  263. package/build/esm/orchestrion/config/remix.js +5 -0
  264. package/build/esm/orchestrion/config/remix.js.map +1 -0
  265. package/build/esm/orchestrion/config/tedious.js +5 -0
  266. package/build/esm/orchestrion/config/tedious.js.map +1 -0
  267. package/build/esm/orchestrion/config/vercel-ai.js +18 -14
  268. package/build/esm/orchestrion/config/vercel-ai.js.map +1 -1
  269. package/build/esm/orchestrion/detect.js +13 -12
  270. package/build/esm/orchestrion/detect.js.map +1 -1
  271. package/build/esm/orchestrion/index.js +23 -2
  272. package/build/esm/orchestrion/index.js.map +1 -1
  273. package/build/esm/orchestrion/runtime/register.js +27 -16
  274. package/build/esm/orchestrion/runtime/register.js.map +1 -1
  275. package/build/esm/package.json +1 -1
  276. package/build/esm/prisma/global.js +12 -0
  277. package/build/esm/prisma/global.js.map +1 -0
  278. package/build/esm/prisma/index.js +24 -0
  279. package/build/esm/prisma/index.js.map +1 -0
  280. package/build/esm/prisma/tracing-helper.js +209 -0
  281. package/build/esm/prisma/tracing-helper.js.map +1 -0
  282. package/build/esm/redis/index.js +21 -0
  283. package/build/esm/redis/index.js.map +1 -0
  284. package/build/esm/redis/redis-dc-subscriber.js +24 -36
  285. package/build/esm/redis/redis-dc-subscriber.js.map +1 -1
  286. package/build/esm/tracing-channel.js +8 -7
  287. package/build/esm/tracing-channel.js.map +1 -1
  288. package/build/esm/vercel-ai/util.js +106 -0
  289. package/build/esm/vercel-ai/util.js.map +1 -0
  290. package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js +121 -59
  291. package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
  292. package/build/esm/vercel-ai/{vercel-ai-orchestrion-v6-subscriber.js → vercel-ai-orchestrion-subscriber.js} +153 -23
  293. package/build/esm/vercel-ai/vercel-ai-orchestrion-subscriber.js.map +1 -0
  294. package/build/types/graphql/graphql-dc-subscriber.d.ts +94 -0
  295. package/build/types/graphql/graphql-dc-subscriber.d.ts.map +1 -0
  296. package/build/types/graphql/index.d.ts +12 -0
  297. package/build/types/graphql/index.d.ts.map +1 -0
  298. package/build/types/graphql/utils.d.ts +36 -0
  299. package/build/types/graphql/utils.d.ts.map +1 -0
  300. package/build/types/index.d.ts +6 -2
  301. package/build/types/index.d.ts.map +1 -1
  302. package/build/types/integrations/tracing-channel/amqplib.d.ts +11 -0
  303. package/build/types/integrations/tracing-channel/amqplib.d.ts.map +1 -0
  304. package/build/types/integrations/tracing-channel/dataloader.d.ts +11 -0
  305. package/build/types/integrations/tracing-channel/dataloader.d.ts.map +1 -0
  306. package/build/types/integrations/tracing-channel/express/index.d.ts +18 -0
  307. package/build/types/integrations/tracing-channel/express/index.d.ts.map +1 -0
  308. package/build/types/integrations/tracing-channel/express/instrumentation.d.ts +4 -0
  309. package/build/types/integrations/tracing-channel/express/instrumentation.d.ts.map +1 -0
  310. package/build/types/integrations/tracing-channel/express/route.d.ts +28 -0
  311. package/build/types/integrations/tracing-channel/express/route.d.ts.map +1 -0
  312. package/build/types/integrations/tracing-channel/express/types.d.ts +64 -0
  313. package/build/types/integrations/tracing-channel/express/types.d.ts.map +1 -0
  314. package/build/types/integrations/tracing-channel/fastify/instrumentation.d.ts.map +1 -1
  315. package/build/types/integrations/tracing-channel/generic-pool.d.ts +10 -0
  316. package/build/types/integrations/tracing-channel/generic-pool.d.ts.map +1 -0
  317. package/build/types/integrations/tracing-channel/google-genai.d.ts +12 -0
  318. package/build/types/integrations/tracing-channel/google-genai.d.ts.map +1 -0
  319. package/build/types/integrations/tracing-channel/graphql/constants.d.ts +12 -0
  320. package/build/types/integrations/tracing-channel/graphql/constants.d.ts.map +1 -0
  321. package/build/types/integrations/tracing-channel/graphql/graphql-types.d.ts +135 -0
  322. package/build/types/integrations/tracing-channel/graphql/graphql-types.d.ts.map +1 -0
  323. package/build/types/integrations/tracing-channel/graphql/index.d.ts +28 -0
  324. package/build/types/integrations/tracing-channel/graphql/index.d.ts.map +1 -0
  325. package/build/types/integrations/tracing-channel/graphql/resolvers.d.ts +13 -0
  326. package/build/types/integrations/tracing-channel/graphql/resolvers.d.ts.map +1 -0
  327. package/build/types/integrations/tracing-channel/graphql/spans.d.ts +17 -0
  328. package/build/types/integrations/tracing-channel/graphql/spans.d.ts.map +1 -0
  329. package/build/types/integrations/tracing-channel/graphql/types.d.ts +25 -0
  330. package/build/types/integrations/tracing-channel/graphql/types.d.ts.map +1 -0
  331. package/build/types/integrations/tracing-channel/ioredis.d.ts +20 -0
  332. package/build/types/integrations/tracing-channel/ioredis.d.ts.map +1 -1
  333. package/build/types/integrations/tracing-channel/kafkajs/consumer.d.ts +8 -0
  334. package/build/types/integrations/tracing-channel/kafkajs/consumer.d.ts.map +1 -0
  335. package/build/types/integrations/tracing-channel/kafkajs/index.d.ts +17 -0
  336. package/build/types/integrations/tracing-channel/kafkajs/index.d.ts.map +1 -0
  337. package/build/types/integrations/tracing-channel/kafkajs/semconv.d.ts +10 -0
  338. package/build/types/integrations/tracing-channel/kafkajs/semconv.d.ts.map +1 -0
  339. package/build/types/integrations/tracing-channel/kafkajs/spans.d.ts +38 -0
  340. package/build/types/integrations/tracing-channel/kafkajs/spans.d.ts.map +1 -0
  341. package/build/types/integrations/tracing-channel/kafkajs/types.d.ts +40 -0
  342. package/build/types/integrations/tracing-channel/kafkajs/types.d.ts.map +1 -0
  343. package/build/types/integrations/tracing-channel/knex.d.ts +11 -0
  344. package/build/types/integrations/tracing-channel/knex.d.ts.map +1 -0
  345. package/build/types/integrations/tracing-channel/mysql.d.ts.map +1 -1
  346. package/build/types/integrations/tracing-channel/mysql2.d.ts +15 -0
  347. package/build/types/integrations/tracing-channel/mysql2.d.ts.map +1 -0
  348. package/build/types/integrations/tracing-channel/openai.d.ts.map +1 -1
  349. package/build/types/integrations/tracing-channel/postgres-js.d.ts +26 -0
  350. package/build/types/integrations/tracing-channel/postgres-js.d.ts.map +1 -0
  351. package/build/types/integrations/tracing-channel/postgres.d.ts.map +1 -1
  352. package/build/types/integrations/tracing-channel/redis.d.ts +16 -0
  353. package/build/types/integrations/tracing-channel/redis.d.ts.map +1 -0
  354. package/build/types/integrations/tracing-channel/vercel-ai.d.ts +1 -1
  355. package/build/types/mongoose/mongoose-dc-subscriber.d.ts.map +1 -1
  356. package/build/types/mysql2/index.d.ts +11 -0
  357. package/build/types/mysql2/index.d.ts.map +1 -0
  358. package/build/types/mysql2/mysql2-dc-subscriber.d.ts +59 -0
  359. package/build/types/mysql2/mysql2-dc-subscriber.d.ts.map +1 -0
  360. package/build/types/orchestrion/bundler/esbuild.d.ts +21 -0
  361. package/build/types/orchestrion/bundler/esbuild.d.ts.map +1 -0
  362. package/build/types/orchestrion/bundler/options.d.ts +19 -0
  363. package/build/types/orchestrion/bundler/options.d.ts.map +1 -0
  364. package/build/types/orchestrion/bundler/rollup.d.ts +17 -0
  365. package/build/types/orchestrion/bundler/rollup.d.ts.map +1 -0
  366. package/build/types/orchestrion/bundler/vite.d.ts +4 -17
  367. package/build/types/orchestrion/bundler/vite.d.ts.map +1 -1
  368. package/build/types/orchestrion/bundler/webpack.d.ts +19 -0
  369. package/build/types/orchestrion/bundler/webpack.d.ts.map +1 -0
  370. package/build/types/orchestrion/channels.d.ts +71 -10
  371. package/build/types/orchestrion/channels.d.ts.map +1 -1
  372. package/build/types/orchestrion/config/amqplib.d.ts +66 -0
  373. package/build/types/orchestrion/config/amqplib.d.ts.map +1 -0
  374. package/build/types/orchestrion/config/dataloader.d.ts +46 -0
  375. package/build/types/orchestrion/config/dataloader.d.ts.map +1 -0
  376. package/build/types/orchestrion/config/express.d.ts +32 -0
  377. package/build/types/orchestrion/config/express.d.ts.map +1 -0
  378. package/build/types/orchestrion/config/firebase.d.ts +4 -0
  379. package/build/types/orchestrion/config/firebase.d.ts.map +1 -0
  380. package/build/types/orchestrion/config/generic-pool.d.ts +31 -0
  381. package/build/types/orchestrion/config/generic-pool.d.ts.map +1 -0
  382. package/build/types/orchestrion/config/google-genai.d.ts +30 -0
  383. package/build/types/orchestrion/config/google-genai.d.ts.map +1 -0
  384. package/build/types/orchestrion/config/graphql.d.ts +29 -0
  385. package/build/types/orchestrion/config/graphql.d.ts.map +1 -0
  386. package/build/types/orchestrion/config/index.d.ts +18 -5
  387. package/build/types/orchestrion/config/index.d.ts.map +1 -1
  388. package/build/types/orchestrion/config/kafkajs.d.ts +17 -0
  389. package/build/types/orchestrion/config/kafkajs.d.ts.map +1 -0
  390. package/build/types/orchestrion/config/knex.d.ts +9 -0
  391. package/build/types/orchestrion/config/knex.d.ts.map +1 -0
  392. package/build/types/orchestrion/config/langchain.d.ts +4 -0
  393. package/build/types/orchestrion/config/langchain.d.ts.map +1 -0
  394. package/build/types/orchestrion/config/langgraph.d.ts +4 -0
  395. package/build/types/orchestrion/config/langgraph.d.ts.map +1 -0
  396. package/build/types/orchestrion/config/mongodb.d.ts +4 -0
  397. package/build/types/orchestrion/config/mongodb.d.ts.map +1 -0
  398. package/build/types/orchestrion/config/mongoose.d.ts +4 -0
  399. package/build/types/orchestrion/config/mongoose.d.ts.map +1 -0
  400. package/build/types/orchestrion/config/mysql2.d.ts +18 -0
  401. package/build/types/orchestrion/config/mysql2.d.ts.map +1 -0
  402. package/build/types/orchestrion/config/nestjs.d.ts +24 -0
  403. package/build/types/orchestrion/config/nestjs.d.ts.map +1 -0
  404. package/build/types/orchestrion/config/postgres.d.ts +9 -0
  405. package/build/types/orchestrion/config/postgres.d.ts.map +1 -0
  406. package/build/types/orchestrion/config/prisma.d.ts +4 -0
  407. package/build/types/orchestrion/config/prisma.d.ts.map +1 -0
  408. package/build/types/orchestrion/config/react-router.d.ts +4 -0
  409. package/build/types/orchestrion/config/react-router.d.ts.map +1 -0
  410. package/build/types/orchestrion/config/redis.d.ts +37 -0
  411. package/build/types/orchestrion/config/redis.d.ts.map +1 -0
  412. package/build/types/orchestrion/config/remix.d.ts +4 -0
  413. package/build/types/orchestrion/config/remix.d.ts.map +1 -0
  414. package/build/types/orchestrion/config/tedious.d.ts +4 -0
  415. package/build/types/orchestrion/config/tedious.d.ts.map +1 -0
  416. package/build/types/orchestrion/config/vercel-ai.d.ts +1 -0
  417. package/build/types/orchestrion/config/vercel-ai.d.ts.map +1 -1
  418. package/build/types/orchestrion/detect.d.ts +3 -10
  419. package/build/types/orchestrion/detect.d.ts.map +1 -1
  420. package/build/types/orchestrion/index.d.ts +55 -4
  421. package/build/types/orchestrion/index.d.ts.map +1 -1
  422. package/build/types/orchestrion/runtime/register.d.ts +11 -9
  423. package/build/types/orchestrion/runtime/register.d.ts.map +1 -1
  424. package/build/types/prisma/global.d.ts +5 -0
  425. package/build/types/prisma/global.d.ts.map +1 -0
  426. package/build/types/prisma/index.d.ts +45 -0
  427. package/build/types/prisma/index.d.ts.map +1 -0
  428. package/build/types/prisma/tracing-helper.d.ts +46 -0
  429. package/build/types/prisma/tracing-helper.d.ts.map +1 -0
  430. package/build/types/prisma/types.d.ts +37 -0
  431. package/build/types/prisma/types.d.ts.map +1 -0
  432. package/build/types/redis/index.d.ts +18 -0
  433. package/build/types/redis/index.d.ts.map +1 -0
  434. package/build/types/redis/redis-dc-subscriber.d.ts +0 -5
  435. package/build/types/redis/redis-dc-subscriber.d.ts.map +1 -1
  436. package/build/types/tracing-channel.d.ts +5 -0
  437. package/build/types/tracing-channel.d.ts.map +1 -1
  438. package/build/types/vercel-ai/util.d.ts +30 -0
  439. package/build/types/vercel-ai/util.d.ts.map +1 -0
  440. package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts +6 -2
  441. package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -1
  442. package/build/types/vercel-ai/{vercel-ai-orchestrion-v6-subscriber.d.ts → vercel-ai-orchestrion-subscriber.d.ts} +1 -1
  443. package/build/types/vercel-ai/vercel-ai-orchestrion-subscriber.d.ts.map +1 -0
  444. package/build/types-ts3.8/graphql/graphql-dc-subscriber.d.ts +94 -0
  445. package/build/types-ts3.8/graphql/index.d.ts +12 -0
  446. package/build/types-ts3.8/graphql/utils.d.ts +36 -0
  447. package/build/types-ts3.8/index.d.ts +6 -2
  448. package/build/types-ts3.8/integrations/tracing-channel/amqplib.d.ts +11 -0
  449. package/build/types-ts3.8/integrations/tracing-channel/dataloader.d.ts +11 -0
  450. package/build/types-ts3.8/integrations/tracing-channel/express/index.d.ts +18 -0
  451. package/build/types-ts3.8/integrations/tracing-channel/express/instrumentation.d.ts +4 -0
  452. package/build/types-ts3.8/integrations/tracing-channel/express/route.d.ts +28 -0
  453. package/build/types-ts3.8/integrations/tracing-channel/express/types.d.ts +64 -0
  454. package/build/types-ts3.8/integrations/tracing-channel/generic-pool.d.ts +10 -0
  455. package/build/types-ts3.8/integrations/tracing-channel/google-genai.d.ts +12 -0
  456. package/build/types-ts3.8/integrations/tracing-channel/graphql/constants.d.ts +12 -0
  457. package/build/types-ts3.8/integrations/tracing-channel/graphql/graphql-types.d.ts +135 -0
  458. package/build/types-ts3.8/integrations/tracing-channel/graphql/index.d.ts +30 -0
  459. package/build/types-ts3.8/integrations/tracing-channel/graphql/resolvers.d.ts +13 -0
  460. package/build/types-ts3.8/integrations/tracing-channel/graphql/spans.d.ts +17 -0
  461. package/build/types-ts3.8/integrations/tracing-channel/graphql/types.d.ts +25 -0
  462. package/build/types-ts3.8/integrations/tracing-channel/ioredis.d.ts +20 -0
  463. package/build/types-ts3.8/integrations/tracing-channel/kafkajs/consumer.d.ts +8 -0
  464. package/build/types-ts3.8/integrations/tracing-channel/kafkajs/index.d.ts +17 -0
  465. package/build/types-ts3.8/integrations/tracing-channel/kafkajs/semconv.d.ts +10 -0
  466. package/build/types-ts3.8/integrations/tracing-channel/kafkajs/spans.d.ts +38 -0
  467. package/build/types-ts3.8/integrations/tracing-channel/kafkajs/types.d.ts +40 -0
  468. package/build/types-ts3.8/integrations/tracing-channel/knex.d.ts +11 -0
  469. package/build/types-ts3.8/integrations/tracing-channel/mysql2.d.ts +15 -0
  470. package/build/types-ts3.8/integrations/tracing-channel/postgres-js.d.ts +26 -0
  471. package/build/types-ts3.8/integrations/tracing-channel/redis.d.ts +16 -0
  472. package/build/types-ts3.8/integrations/tracing-channel/vercel-ai.d.ts +1 -1
  473. package/build/types-ts3.8/mysql2/index.d.ts +11 -0
  474. package/build/types-ts3.8/mysql2/mysql2-dc-subscriber.d.ts +59 -0
  475. package/build/types-ts3.8/orchestrion/bundler/esbuild.d.ts +21 -0
  476. package/build/types-ts3.8/orchestrion/bundler/options.d.ts +19 -0
  477. package/build/types-ts3.8/orchestrion/bundler/rollup.d.ts +17 -0
  478. package/build/types-ts3.8/orchestrion/bundler/vite.d.ts +4 -17
  479. package/build/types-ts3.8/orchestrion/bundler/webpack.d.ts +19 -0
  480. package/build/types-ts3.8/orchestrion/channels.d.ts +71 -10
  481. package/build/types-ts3.8/orchestrion/config/amqplib.d.ts +66 -0
  482. package/build/types-ts3.8/orchestrion/config/dataloader.d.ts +46 -0
  483. package/build/types-ts3.8/orchestrion/config/express.d.ts +32 -0
  484. package/build/types-ts3.8/orchestrion/config/firebase.d.ts +4 -0
  485. package/build/types-ts3.8/orchestrion/config/generic-pool.d.ts +31 -0
  486. package/build/types-ts3.8/orchestrion/config/google-genai.d.ts +30 -0
  487. package/build/types-ts3.8/orchestrion/config/graphql.d.ts +29 -0
  488. package/build/types-ts3.8/orchestrion/config/index.d.ts +18 -5
  489. package/build/types-ts3.8/orchestrion/config/kafkajs.d.ts +17 -0
  490. package/build/types-ts3.8/orchestrion/config/knex.d.ts +9 -0
  491. package/build/types-ts3.8/orchestrion/config/langchain.d.ts +4 -0
  492. package/build/types-ts3.8/orchestrion/config/langgraph.d.ts +4 -0
  493. package/build/types-ts3.8/orchestrion/config/mongodb.d.ts +4 -0
  494. package/build/types-ts3.8/orchestrion/config/mongoose.d.ts +4 -0
  495. package/build/types-ts3.8/orchestrion/config/mysql2.d.ts +18 -0
  496. package/build/types-ts3.8/orchestrion/config/nestjs.d.ts +24 -0
  497. package/build/types-ts3.8/orchestrion/config/postgres.d.ts +9 -0
  498. package/build/types-ts3.8/orchestrion/config/prisma.d.ts +4 -0
  499. package/build/types-ts3.8/orchestrion/config/react-router.d.ts +4 -0
  500. package/build/types-ts3.8/orchestrion/config/redis.d.ts +37 -0
  501. package/build/types-ts3.8/orchestrion/config/remix.d.ts +4 -0
  502. package/build/types-ts3.8/orchestrion/config/tedious.d.ts +4 -0
  503. package/build/types-ts3.8/orchestrion/config/vercel-ai.d.ts +1 -0
  504. package/build/types-ts3.8/orchestrion/detect.d.ts +3 -10
  505. package/build/types-ts3.8/orchestrion/index.d.ts +57 -4
  506. package/build/types-ts3.8/orchestrion/runtime/register.d.ts +11 -9
  507. package/build/types-ts3.8/prisma/global.d.ts +5 -0
  508. package/build/types-ts3.8/prisma/index.d.ts +45 -0
  509. package/build/types-ts3.8/prisma/tracing-helper.d.ts +52 -0
  510. package/build/types-ts3.8/prisma/types.d.ts +40 -0
  511. package/build/types-ts3.8/redis/index.d.ts +18 -0
  512. package/build/types-ts3.8/redis/redis-dc-subscriber.d.ts +0 -5
  513. package/build/types-ts3.8/tracing-channel.d.ts +5 -0
  514. package/build/types-ts3.8/vercel-ai/util.d.ts +30 -0
  515. package/build/types-ts3.8/vercel-ai/vercel-ai-dc-subscriber.d.ts +6 -2
  516. package/build/types-ts3.8/vercel-ai/{vercel-ai-orchestrion-v6-subscriber.d.ts → vercel-ai-orchestrion-subscriber.d.ts} +1 -1
  517. package/package.json +41 -8
  518. package/build/cjs/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js.map +0 -1
  519. package/build/esm/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js.map +0 -1
  520. package/build/types/vercel-ai/vercel-ai-orchestrion-v6-subscriber.d.ts.map +0 -1
@@ -1,16 +1,19 @@
1
- import { debug, withActiveSpan, getActiveSpan, SPAN_STATUS_ERROR } from '@sentry/core';
1
+ import { debug, isObjectLike, withActiveSpan, SPAN_STATUS_ERROR, getActiveSpan } from '@sentry/core';
2
2
  import { DEBUG_BUILD } from '../debug-build.js';
3
3
  import { CHANNELS } from '../orchestrion/channels.js';
4
4
  import { bindTracingChannelToSpan } from '../tracing-channel.js';
5
- import { createSpanFromMessage, enrichSpanOnEnd, clearOperationCallId, clearOperationId } from './vercel-ai-dc-subscriber.js';
5
+ import { enrichSpanOnEnd, clearOperationId, createSpanFromMessage, streamedResultToChannelResult, clearOperationCallId, captureToolError } from './vercel-ai-dc-subscriber.js';
6
+ import { asString, isReadableStream, tapModelCallStream } from './util.js';
6
7
 
7
8
  const PATCHED = /* @__PURE__ */ Symbol("SentryVercelAiModelPatched");
9
+ const TOOL_PATCHED = /* @__PURE__ */ Symbol("SentryVercelAiToolPatched");
8
10
  let callIdCounter = 0;
9
11
  function nextCallId() {
10
12
  return `v6-${++callIdCounter}`;
11
13
  }
12
14
  const messages = /* @__PURE__ */ new WeakMap();
13
15
  const operationSpans = /* @__PURE__ */ new WeakSet();
16
+ const toolCallSpans = /* @__PURE__ */ new WeakSet();
14
17
  const callIdBySpan = /* @__PURE__ */ new WeakMap();
15
18
  const recordingBySpan = /* @__PURE__ */ new WeakMap();
16
19
  const suppressedTelemetry = /* @__PURE__ */ new WeakSet();
@@ -23,6 +26,7 @@ function subscribeVercelAiOrchestrionChannels(tracingChannel, options = {}) {
23
26
  try {
24
27
  bindOperation(tracingChannel, CHANNELS.VERCEL_AI_GENERATE_TEXT, buildTextMessage("generateText"), options);
25
28
  bindOperation(tracingChannel, CHANNELS.VERCEL_AI_STREAM_TEXT, buildTextMessage("streamText"), options);
29
+ bindOperation(tracingChannel, CHANNELS.VERCEL_AI_GENERATE_OBJECT, buildTextMessage("generateObject"), options);
26
30
  bindOperation(
27
31
  tracingChannel,
28
32
  CHANNELS.VERCEL_AI_EMBED,
@@ -79,8 +83,8 @@ function subscribeVercelAiOrchestrionChannels(tracingChannel, options = {}) {
79
83
  function bindOperation(tracingChannel, channelName, build, options) {
80
84
  const channel = tracingChannel(channelName);
81
85
  const buildOperationSpan = (data) => {
82
- const callOptions = isRecord(data.arguments[0]) ? data.arguments[0] : {};
83
- const telemetry = isRecord(callOptions.experimental_telemetry) ? callOptions.experimental_telemetry : {};
86
+ const callOptions = isObjectLike(data.arguments[0]) ? data.arguments[0] : {};
87
+ const telemetry = isObjectLike(callOptions.experimental_telemetry) ? callOptions.experimental_telemetry : {};
84
88
  if (telemetry.isEnabled === false && !suppressedTelemetry.has(telemetry)) {
85
89
  return void 0;
86
90
  }
@@ -90,11 +94,20 @@ function bindOperation(tracingChannel, channelName, build, options) {
90
94
  if (span) {
91
95
  messages.set(data, message);
92
96
  operationSpans.add(span);
97
+ if (message.type === "executeTool") {
98
+ toolCallSpans.add(span);
99
+ }
93
100
  const callId = asString(message.event.callId);
94
101
  if (callId) {
95
102
  callIdBySpan.set(span, callId);
96
103
  }
97
104
  recordingBySpan.set(span, recording(telemetry));
105
+ if (isObjectLike(callOptions.tools)) {
106
+ patchOperationTools(callOptions.tools, options);
107
+ }
108
+ if (isObjectLike(callOptions.model) && callOptions.model.specificationVersion === "v1") {
109
+ patchModelMethods(callOptions.model, options);
110
+ }
98
111
  }
99
112
  return span;
100
113
  };
@@ -115,10 +128,43 @@ function bindOperation(tracingChannel, channelName, build, options) {
115
128
  clearOperationId(message);
116
129
  }
117
130
  messages.delete(data);
118
- }
131
+ },
132
+ // `streamText` returns synchronously, so its operation span would otherwise end before the stream
133
+ // drains — losing the aggregate usage/output. Defer the end and await the result's completion
134
+ // promises (`totalUsage`/`text`/…, which resolve on drain), mirroring how v7's channel defers the
135
+ // operation span on the SDK's total-usage promise.
136
+ deferSpanEnd: ({ data, end }) => deferStreamTextOperationEnd(data, end)
119
137
  }
120
138
  );
121
139
  }
140
+ function deferStreamTextOperationEnd(data, end) {
141
+ if (messages.get(data)?.type !== "streamText" || "error" in data || !isStreamingResult(data.result)) {
142
+ return false;
143
+ }
144
+ const streamResult = data.result;
145
+ void (async () => {
146
+ try {
147
+ const [usage, text, toolCalls, finishReason, response] = await Promise.all([
148
+ streamResult.totalUsage ?? streamResult.usage,
149
+ streamResult.text,
150
+ streamResult.toolCalls,
151
+ streamResult.finishReason,
152
+ streamResult.response
153
+ ]);
154
+ data.result = { usage, text, toolCalls, finishReason, response };
155
+ end();
156
+ } catch (error) {
157
+ end(error);
158
+ }
159
+ })();
160
+ return true;
161
+ }
162
+ function isStreamingResult(result) {
163
+ return isObjectLike(result) && (isThenable(result.totalUsage) || isThenable(result.usage));
164
+ }
165
+ function isThenable(value) {
166
+ return isObjectLike(value) && typeof value.then === "function";
167
+ }
122
168
  function suppressNativeTelemetry(callOptions, telemetry) {
123
169
  if (telemetry.isEnabled !== true) {
124
170
  return;
@@ -131,15 +177,10 @@ function subscribeResolveLanguageModel(tracingChannel, channelName, options) {
131
177
  tracingChannel(channelName).subscribe({
132
178
  end(rawCtx) {
133
179
  const ctx = rawCtx;
134
- if (!isRecord(ctx.result)) {
180
+ if (!isObjectLike(ctx.result)) {
135
181
  return;
136
182
  }
137
- const model = ctx.result;
138
- if (!model[PATCHED]) {
139
- model[PATCHED] = true;
140
- patchModelMethod(model, "doGenerate", options);
141
- patchModelMethod(model, "doStream", options);
142
- }
183
+ patchModelMethods(ctx.result, options);
143
184
  },
144
185
  start() {
145
186
  },
@@ -155,6 +196,14 @@ function resolveModelCallParent() {
155
196
  const active = getActiveSpan();
156
197
  return active && operationSpans.has(active) ? active : void 0;
157
198
  }
199
+ function patchModelMethods(model, options) {
200
+ if (model[PATCHED]) {
201
+ return;
202
+ }
203
+ model[PATCHED] = true;
204
+ patchModelMethod(model, "doGenerate", options);
205
+ patchModelMethod(model, "doStream", options);
206
+ }
158
207
  function patchModelMethod(model, method, options) {
159
208
  const original = model[method];
160
209
  if (typeof original !== "function") {
@@ -165,7 +214,7 @@ function patchModelMethod(model, method, options) {
165
214
  if (!parent) {
166
215
  return Promise.resolve(original.apply(this, args));
167
216
  }
168
- const callArgs = isRecord(args[0]) ? args[0] : {};
217
+ const callArgs = isObjectLike(args[0]) ? args[0] : {};
169
218
  const callId = callIdBySpan.get(parent);
170
219
  const message = {
171
220
  type: "languageModelCall",
@@ -173,7 +222,9 @@ function patchModelMethod(model, method, options) {
173
222
  callId,
174
223
  provider: model.provider,
175
224
  modelId: model.modelId,
176
- tools: callArgs.tools,
225
+ // v4 nests the tool list under `mode.tools` (the `LanguageModelV1` call shape); v5+ passes a
226
+ // top-level `tools` array. Reading both keeps `available_tools` populated on the model-call span.
227
+ tools: callArgs.tools ?? (isObjectLike(callArgs.mode) ? callArgs.mode.tools : void 0),
177
228
  messages: callArgs.prompt,
178
229
  // Inherit the enclosing operation's per-call recording flags so inputs/tools/outputs are recorded on
179
230
  // the model-call span whenever they are on the parent `invoke_agent` span.
@@ -198,6 +249,26 @@ function patchModelMethod(model, method, options) {
198
249
  try {
199
250
  const result = Promise.resolve(original.apply(this, args));
200
251
  return result.then((value) => {
252
+ if (method === "doStream" && isObjectLike(value) && isReadableStream(value.stream)) {
253
+ value.stream = tapModelCallStream(
254
+ value.stream,
255
+ (final) => {
256
+ message.result = { ...value, ...streamedResultToChannelResult(final) };
257
+ enrichSpanOnEnd(span, message, options);
258
+ span.end();
259
+ clearStreamCallId();
260
+ },
261
+ (error) => {
262
+ span.setStatus({
263
+ code: SPAN_STATUS_ERROR,
264
+ message: error instanceof Error ? error.message : "unknown_error"
265
+ });
266
+ span.end();
267
+ clearStreamCallId();
268
+ }
269
+ );
270
+ return value;
271
+ }
201
272
  message.result = value;
202
273
  enrichSpanOnEnd(span, message, options);
203
274
  span.end();
@@ -209,6 +280,63 @@ function patchModelMethod(model, method, options) {
209
280
  }
210
281
  };
211
282
  }
283
+ function patchOperationTools(tools, options) {
284
+ try {
285
+ for (const [toolName, tool] of Object.entries(tools)) {
286
+ if (isObjectLike(tool)) {
287
+ patchToolExecute(toolName, tool, tools, options);
288
+ }
289
+ }
290
+ } catch {
291
+ DEBUG_BUILD && debug.log("Vercel AI orchestrion tool patching failed.");
292
+ }
293
+ }
294
+ function patchToolExecute(toolName, tool, tools, options) {
295
+ const original = tool.execute;
296
+ if (typeof original !== "function" || tool[TOOL_PATCHED]) {
297
+ return;
298
+ }
299
+ tool[TOOL_PATCHED] = true;
300
+ tool.execute = function(input, ...rest) {
301
+ const parent = resolveModelCallParent();
302
+ if (!parent || toolCallSpans.has(parent)) {
303
+ return original.apply(this, [input, ...rest]);
304
+ }
305
+ const callOptions = isObjectLike(rest[0]) ? rest[0] : {};
306
+ const message = {
307
+ type: "executeTool",
308
+ event: {
309
+ callId: callIdBySpan.get(parent),
310
+ toolCall: { toolName, toolCallId: asString(callOptions.toolCallId), input },
311
+ // The `tools` record (keyed by name) lets the shared core backfill the tool's `description`.
312
+ tools,
313
+ // Inherit the enclosing operation's per-call recording flags so tool inputs/outputs are recorded
314
+ // whenever they are on the parent `invoke_agent` span.
315
+ ...recordingBySpan.get(parent)
316
+ }
317
+ };
318
+ const span = withActiveSpan(parent, () => createSpanFromMessage(message, options));
319
+ if (!span) {
320
+ return original.apply(this, [input, ...rest]);
321
+ }
322
+ const failSpan = (error) => {
323
+ captureToolError(span, message, error);
324
+ span.end();
325
+ throw error;
326
+ };
327
+ try {
328
+ const result = Promise.resolve(original.apply(this, [input, ...rest]));
329
+ return result.then((value) => {
330
+ message.result = { output: value };
331
+ enrichSpanOnEnd(span, message, options);
332
+ span.end();
333
+ return value;
334
+ }, failSpan);
335
+ } catch (error) {
336
+ return failSpan(error);
337
+ }
338
+ };
339
+ }
212
340
  function buildTextMessage(type) {
213
341
  return (options, telemetry) => ({
214
342
  type,
@@ -218,6 +346,10 @@ function buildTextMessage(type) {
218
346
  functionId: asString(telemetry.functionId),
219
347
  ...modelFields(options.model),
220
348
  maxRetries: options.maxRetries,
349
+ // The `ai` SDK takes the system prompt as a top-level `system` option (all of v4/v5/v6); the
350
+ // shared core lifts `event.instructions` into the system-instructions attribute, matching v7's
351
+ // native channel (which carries it as a distinct field rather than inside the messages array).
352
+ instructions: asString(options.system),
221
353
  // Normalize to the message-array shape the shared core (and v7's channel) expects: a bare string
222
354
  // `prompt` becomes a single user message, matching the SDK's own normalization.
223
355
  messages: normalizePromptMessages(options),
@@ -235,20 +367,18 @@ function normalizePromptMessages(options) {
235
367
  return options.messages ?? options.prompt;
236
368
  }
237
369
  function recording(telemetry) {
238
- return { recordInputs: telemetry.recordInputs, recordOutputs: telemetry.recordOutputs };
370
+ const enabledDefault = telemetry.isEnabled === true ? true : void 0;
371
+ return {
372
+ recordInputs: telemetry.recordInputs ?? enabledDefault,
373
+ recordOutputs: telemetry.recordOutputs ?? enabledDefault
374
+ };
239
375
  }
240
376
  function modelFields(model) {
241
377
  return { provider: modelField(model, "provider"), modelId: modelField(model, "modelId") };
242
378
  }
243
379
  function modelField(model, field) {
244
- return isRecord(model) ? asString(model[field]) : void 0;
245
- }
246
- function asString(value) {
247
- return typeof value === "string" ? value : void 0;
248
- }
249
- function isRecord(value) {
250
- return typeof value === "object" && value !== null;
380
+ return isObjectLike(model) ? asString(model[field]) : void 0;
251
381
  }
252
382
 
253
383
  export { subscribeVercelAiOrchestrionChannels };
254
- //# sourceMappingURL=vercel-ai-orchestrion-v6-subscriber.js.map
384
+ //# sourceMappingURL=vercel-ai-orchestrion-subscriber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vercel-ai-orchestrion-subscriber.js","sources":["../../../src/vercel-ai/vercel-ai-orchestrion-subscriber.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type { Span } from '@sentry/core';\nimport { debug, getActiveSpan, isObjectLike, SPAN_STATUS_ERROR, withActiveSpan } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { CHANNELS } from '../orchestrion/channels';\nimport { bindTracingChannelToSpan, type TracingChannelPayloadWithSpan } from '../tracing-channel';\nimport {\n captureToolError,\n clearOperationCallId,\n clearOperationId,\n createSpanFromMessage,\n enrichSpanOnEnd,\n streamedResultToChannelResult,\n type VercelAiChannelMessage,\n type VercelAiChannelOptions,\n type VercelAiTracingChannelFactory,\n} from './vercel-ai-dc-subscriber';\nimport { asString, isReadableStream, tapModelCallStream } from './util';\n\n/**\n * v4, v5 & v6 channel adapter for the Vercel AI (`ai`) SDK.\n *\n * `ai` >= 7 publishes a normalized `ai:telemetry` tracing channel natively\n * (consumed by `subscribeVercelAiTracingChannel`). v4/v5/v6 have no such channel, so\n * orchestrion injects `orchestrion:ai:*` channels around the top-level\n * functions (see `orchestrion/config/index.ts`). The injected channels carry only the\n * wrapped call's `{ arguments, result, error }` — NOT v7's normalized `event`\n * object — so this adapter reconstructs an equivalent {@link VercelAiChannelMessage}\n * from each version's argument/result shapes and delegates to the SAME span-building core\n * (`createSpanFromMessage` / `enrichSpanOnEnd`) the v7 subscriber uses, so the\n * emitted spans are identical between v4, v5, v6 and v7. The shared core reads both v4-style\n * (`promptTokens`/`completionTokens`) and v5+-style (`inputTokens`/`outputTokens`) token names.\n *\n * The model call (`languageModelCall` / `generate_content` span) has no\n * injectable definition in `ai`. On v5/v6 we wrap `resolveLanguageModel` (the\n * single chokepoint every model call flows through) and monkey-patch\n * `doGenerate`/`doStream` on the returned model. v4 has no `resolveLanguageModel`\n * — the passed `LanguageModelV1` (`specificationVersion: 'v1'`) is called directly —\n * so we patch its `doGenerate`/`doStream` at the operation start instead (see\n * `buildOperationSpan`), gated on `'v1'` so it never touches v5/v6 models.\n *\n * Tool-call spans differ by version: v6 exposes a per-call `executeToolCall`\n * function orchestrion wraps into its own channel. v4/v5 have no such export (only a\n * batch `executeTools`), so instead we monkey-patch each tool's `execute` from\n * the operation's `tools`. On v6 that patch is inert: `executeToolCall` runs\n * `execute` inside its own tool-call span (the active async context), so the\n * patch sees that span as its parent and skips — only v4/v5 (where the parent is\n * the enclosing `invoke_agent` span) emit the patched span, so v6 never\n * double-counts tool spans.\n */\n\n/** Shape orchestrion's transform attaches to the tracing-channel context. */\ninterface OrchestrionContext {\n arguments: unknown[];\n result?: unknown;\n error?: unknown;\n}\n\n/** Builds the normalized message for a channel from the wrapped call's first-arg options. */\ntype MessageBuilder = (options: Record<string, unknown>, telemetry: Record<string, unknown>) => VercelAiChannelMessage;\n\n/** A resolved `ai` language model — has `doGenerate`/`doStream` and identity fields. */\ninterface ResolvedModel {\n modelId?: string;\n provider?: string;\n doGenerate?: (...args: unknown[]) => Promise<unknown>;\n doStream?: (...args: unknown[]) => Promise<unknown>;\n}\n\nconst PATCHED = Symbol('SentryVercelAiModelPatched');\nconst TOOL_PATCHED = Symbol('SentryVercelAiToolPatched');\n\n/** A resolved model with our patch bookkeeping (idempotency flag). */\ntype PatchableModel = ResolvedModel & { [PATCHED]?: boolean };\n\n/** A tool definition off an operation's `tools`, with our patch bookkeeping. */\ntype PatchableTool = { execute?: (...args: unknown[]) => unknown; [TOOL_PATCHED]?: boolean };\n\n// Per-operation correlation id. No Date/random (unavailable / non-deterministic) — a counter is enough.\nlet callIdCounter = 0;\nfunction nextCallId(): string {\n return `v6-${++callIdCounter}`;\n}\n\n// The message built on `start` for each operation, keyed by the (stable-identity) channel context, so\n// the `beforeSpanEnd` handler can enrich the span from the settled result and clear the `callId` maps.\nconst messages = new WeakMap<object, VercelAiChannelMessage>();\n// The spans we opened for top-level operations, and each one's `callId`. A model call resolves its\n// parent against this set (so it never mis-attributes to the enclosing `main`/user span) and reads the\n// parent's `callId` so its span can be named after the operation (e.g. `ai.streamText.doStream`).\nconst operationSpans = new WeakSet<Span>();\n// Tool-call spans — only v6's `executeToolCall` channel opens these. The v5 tool-`execute` patch\n// consults this to avoid double-counting: `executeToolCall` runs `execute` inside its span (which is\n// therefore the active parent), so a resolved parent in this set means v6 already spanned the call.\nconst toolCallSpans = new WeakSet<Span>();\nconst callIdBySpan = new WeakMap<Span, string>();\n// The operation's per-call recording flags (`experimental_telemetry.recordInputs/recordOutputs`), keyed by\n// its span. A model call carries no telemetry of its own, so it inherits the enclosing operation's flags —\n// otherwise a per-call `recordInputs: true` would record inputs on the `invoke_agent` span but not on the\n// child `generate_content` span (whose event would fall back to the global default). v7's channel forwards\n// these flags on every event, so this keeps v6 identical.\nconst recordingBySpan = new WeakMap<Span, ReturnType<typeof recording>>();\n\n// The `experimental_telemetry` objects we swapped in to suppress `ai`'s native OTel spans (see\n// `suppressNativeTelemetry`). Our skip logic treats `isEnabled === false` as \"user disabled telemetry,\n// emit no span\"; without this set, a call whose options object we already neutralized — or a user-shared\n// telemetry object we replaced on a prior call — would be misread as user-disabled and lose its span.\nconst suppressedTelemetry = new WeakSet<object>();\n\nlet subscribed = false;\n\n/**\n * Subscribe the v6 orchestrion channel adapter. Safe to always call: inert on\n * `ai` >= 7 (those channels are never published) and when orchestrion injection\n * isn't active. Idempotent.\n *\n * `tracingChannel` is the platform-provided factory (the same one passed to\n * `subscribeVercelAiTracingChannel`); `options` pins the recording settings at\n * subscribe time so we never look the integration up per event.\n */\nexport function subscribeVercelAiOrchestrionChannels(\n tracingChannel: VercelAiTracingChannelFactory,\n options: VercelAiChannelOptions = {},\n): void {\n if (subscribed) {\n return;\n }\n subscribed = true;\n\n try {\n bindOperation(tracingChannel, CHANNELS.VERCEL_AI_GENERATE_TEXT, buildTextMessage('generateText'), options);\n bindOperation(tracingChannel, CHANNELS.VERCEL_AI_STREAM_TEXT, buildTextMessage('streamText'), options);\n bindOperation(tracingChannel, CHANNELS.VERCEL_AI_GENERATE_OBJECT, buildTextMessage('generateObject'), options);\n bindOperation(\n tracingChannel,\n CHANNELS.VERCEL_AI_EMBED,\n (callOptions, telemetry) => ({\n type: 'embed',\n event: {\n callId: nextCallId(),\n ...modelFields(callOptions.model),\n maxRetries: callOptions.maxRetries,\n value: callOptions.value,\n ...recording(telemetry),\n },\n }),\n options,\n );\n bindOperation(\n tracingChannel,\n CHANNELS.VERCEL_AI_EMBED_MANY,\n // `embedMany` takes a `values` array (vs `embed`'s single `value`); the shared core reads it as the\n // embeddings input, matching the OTel path's batch `ai.embedMany` span.\n (callOptions, telemetry) => ({\n type: 'embedMany',\n event: {\n callId: nextCallId(),\n ...modelFields(callOptions.model),\n maxRetries: callOptions.maxRetries,\n values: callOptions.values,\n ...recording(telemetry),\n },\n }),\n options,\n );\n bindOperation(\n tracingChannel,\n CHANNELS.VERCEL_AI_EXECUTE_TOOL_CALL,\n (callOptions, telemetry) => ({\n type: 'executeTool',\n // v6 carries the tool definitions on the executeToolCall args (a record keyed by name);\n // the shared core reads the matching tool's `description` for the span.\n event: {\n callId: nextCallId(),\n toolCall: callOptions.toolCall,\n tools: callOptions.tools,\n ...recording(telemetry),\n },\n }),\n options,\n );\n subscribeResolveLanguageModel(tracingChannel, CHANNELS.VERCEL_AI_RESOLVE_LANGUAGE_MODEL, options);\n } catch {\n DEBUG_BUILD && debug.log('Vercel AI orchestrion channel subscription failed.');\n }\n}\n\n/**\n * Bind one operation channel: `getSpan` opens a span from the message reconstructed out of the wrapped\n * call's first argument; `beforeSpanEnd` enriches it from the settled result (tokens, output messages,\n * finish reasons, …) before the helper ends the span.\n *\n * An operation whose `experimental_telemetry.isEnabled` is explicitly `false` is skipped entirely (no\n * span): the orchestrion channel fires regardless of that flag, whereas v7's native `ai:telemetry`\n * channel is simply not published in that case — so we reproduce v7's \"no telemetry → no span\".\n */\nfunction bindOperation(\n tracingChannel: VercelAiTracingChannelFactory,\n channelName: string,\n build: MessageBuilder,\n options: VercelAiChannelOptions,\n): void {\n const channel = tracingChannel<OrchestrionContext>(channelName);\n\n // Build the operation span from the wrapped call's first argument and track it (so a model call can\n // resolve it as its parent). `bindTracingChannelToSpan` calls this once at channel `start` and makes\n // the returned span the active async context for the operation's duration — that active span is what\n // `resolveModelCallParent` reads. It also sets `data._sentrySpan`, so we don't here.\n const buildOperationSpan = (data: TracingChannelPayloadWithSpan<OrchestrionContext>): Span | undefined => {\n const callOptions = isObjectLike(data.arguments[0]) ? data.arguments[0] : {};\n const telemetry = isObjectLike(callOptions.experimental_telemetry) ? callOptions.experimental_telemetry : {};\n // `isEnabled === false` means the user opted out — emit no span. But `isEnabled` is also `false` on\n // the telemetry object we swap in to suppress native spans, so don't mistake our own object for a\n // user opt-out (which would drop the span on a call whose options we already neutralized).\n if (telemetry.isEnabled === false && !suppressedTelemetry.has(telemetry)) {\n return undefined;\n }\n const message = build(callOptions, telemetry);\n // Stop `ai` from emitting its own native OTel spans for this call — we build the equivalent spans\n // from the channels, so the SDK's would be duplicates. Reads above have already captured everything\n // we need off `telemetry`.\n suppressNativeTelemetry(callOptions, telemetry);\n const span = createSpanFromMessage(message, options);\n if (span) {\n messages.set(data, message);\n operationSpans.add(span);\n // v6's `executeToolCall` span: tracked so the v5 tool-`execute` patch can recognize (and skip)\n // tool calls it runs, since that patch sees this span as its active parent (see `patchToolExecute`).\n if (message.type === 'executeTool') {\n toolCallSpans.add(span);\n }\n const callId = asString(message.event.callId);\n if (callId) {\n callIdBySpan.set(span, callId);\n }\n recordingBySpan.set(span, recording(telemetry));\n // v5 has no `executeToolCall` channel, so patch each tool's `execute` to emit the tool-call span.\n // Inert on v6 (guarded inside `patchToolExecute` when the parent is `executeToolCall`'s own span).\n if (isObjectLike(callOptions.tools)) {\n patchOperationTools(callOptions.tools, options);\n }\n // v4 has no `resolveLanguageModel` chokepoint — the passed `LanguageModelV1`\n // (`specificationVersion: 'v1'`) is called directly — so patch its `doGenerate`/`doStream`\n // here, at the operation start, instead. v5/v6 models are `'v2'` and are patched via\n // `resolveLanguageModel`, so restricting to `'v1'` keeps this strictly additive and avoids\n // double-patching. Embedding models are also `'v1'` but expose no `doGenerate`/`doStream`, so\n // the patch is a no-op for `embed`/`embedMany`.\n if (isObjectLike(callOptions.model) && callOptions.model.specificationVersion === 'v1') {\n patchModelMethods(callOptions.model as PatchableModel, options);\n }\n }\n return span;\n };\n\n bindTracingChannelToSpan(\n channel,\n (data: TracingChannelPayloadWithSpan<OrchestrionContext>) => buildOperationSpan(data),\n {\n beforeSpanEnd: (span, data) => {\n const message = messages.get(data);\n if (!message) {\n return;\n }\n // The helper's `error` handler already set the span status; only enrich from a successful result.\n if (!('error' in data)) {\n // v6's `executeToolCall` returns the tool result/error object directly, whereas the shared core\n // (matching v7) expects it nested under `output`; wrap it so tool-error detection works.\n message.result = message.type === 'executeTool' ? { output: data.result } : data.result;\n enrichSpanOnEnd(span, message, options);\n }\n // A `streamText` model call runs after this (synchronously-returning) operation's span has\n // already ended, so its `callId` entry must outlive the operation — it's cleared once the model\n // call settles (see `patchModelMethod`). Every other operation can clear here.\n if (message.type !== 'streamText') {\n clearOperationId(message);\n }\n messages.delete(data);\n },\n // `streamText` returns synchronously, so its operation span would otherwise end before the stream\n // drains — losing the aggregate usage/output. Defer the end and await the result's completion\n // promises (`totalUsage`/`text`/…, which resolve on drain), mirroring how v7's channel defers the\n // operation span on the SDK's total-usage promise.\n deferSpanEnd: ({ data, end }) => deferStreamTextOperationEnd(data, end),\n },\n );\n}\n\n/**\n * Keep a streamed `streamText` operation span open until the stream drains, then enrich it from the\n * `StreamTextResult`'s completion promises (usage/output/finish reason) and end it. Returns `false` for\n * anything that isn't a streamed `streamText` result, so the helper ends the span as usual.\n */\nfunction deferStreamTextOperationEnd(\n data: TracingChannelPayloadWithSpan<OrchestrionContext>,\n end: (error?: unknown) => void,\n): boolean {\n if (messages.get(data)?.type !== 'streamText' || 'error' in data || !isStreamingResult(data.result)) {\n return false;\n }\n\n const streamResult = data.result;\n void (async () => {\n try {\n const [usage, text, toolCalls, finishReason, response] = await Promise.all([\n streamResult.totalUsage ?? streamResult.usage,\n streamResult.text,\n streamResult.toolCalls,\n streamResult.finishReason,\n streamResult.response,\n ]);\n // Feed the resolved values back through the shared enrichment: `beforeSpanEnd` reads `data.result`.\n data.result = { usage, text, toolCalls, finishReason, response };\n end();\n } catch (error) {\n end(error);\n }\n })();\n\n return true;\n}\n\n/** A `StreamTextResult` exposes its aggregates as promises (`totalUsage`/`usage`); a settled result does not. */\nfunction isStreamingResult(result: unknown): result is Record<string, PromiseLike<unknown> | undefined> {\n return isObjectLike(result) && (isThenable(result.totalUsage) || isThenable(result.usage));\n}\n\nfunction isThenable(value: unknown): boolean {\n return isObjectLike(value) && typeof value.then === 'function';\n}\n\n/**\n * Neutralize `ai`'s native OpenTelemetry instrumentation for this call by pointing\n * `experimental_telemetry` at a copy with `isEnabled: false`. `ai`'s `getTracer` then returns its\n * internal no-op tracer, so it never creates (nor sets active) the duplicate `ai.*` spans we'd\n * otherwise have to drop.\n *\n * Only a call that explicitly enabled telemetry emits native spans — otherwise `ai` already uses its\n * no-op tracer, so there's nothing to suppress and we leave the user's options untouched. When\n * `isEnabled === true`, `telemetry` is `callOptions.experimental_telemetry` and `callOptions` is the\n * real first argument the SDK will read, so the reassignment takes effect for the wrapped call. We\n * replace rather than mutate in place, so a telemetry object the user shares across calls keeps its own\n * `isEnabled: true`; the replacement is tracked in `suppressedTelemetry` so our skip logic doesn't\n * later read it back as a user opt-out.\n */\nfunction suppressNativeTelemetry(callOptions: Record<string, unknown>, telemetry: Record<string, unknown>): void {\n if (telemetry.isEnabled !== true) {\n return;\n }\n const suppressed = { ...telemetry, isEnabled: false };\n suppressedTelemetry.add(suppressed);\n callOptions.experimental_telemetry = suppressed;\n}\n\n/**\n * `resolveLanguageModel` returns the model every call flows through. We don't span it — on `end` we\n * monkey-patch `doGenerate`/`doStream` on the returned model so each invocation produces a\n * `languageModelCall` span parented to the enclosing invoke_agent span.\n */\nfunction subscribeResolveLanguageModel(\n tracingChannel: VercelAiTracingChannelFactory,\n channelName: string,\n options: VercelAiChannelOptions,\n): void {\n tracingChannel<OrchestrionContext>(channelName).subscribe({\n end(rawCtx) {\n const ctx = rawCtx as OrchestrionContext;\n if (!isObjectLike(ctx.result)) {\n return;\n }\n // Patch the model's `doGenerate`/`doStream` once. The model call recovers its parent from the\n // active async context at call time (the operation span `bindTracingChannelToSpan` bound), which\n // propagates into the model call for `streamText` too, so there is nothing to capture on the model here.\n patchModelMethods(ctx.result as PatchableModel, options);\n },\n start() {\n /* no-op */\n },\n asyncStart() {\n /* no-op */\n },\n asyncEnd() {\n /* no-op */\n },\n error() {\n /* no-op */\n },\n });\n}\n\n/**\n * Pick the invoke_agent span a model call should hang under: the operation span that\n * `bindTracingChannelToSpan` planted as the active async context for the enclosing operation.\n *\n * Because we suppress `ai`'s native telemetry (so it never installs its own span as active), the active\n * span inside `doGenerate`/`doStream` is our operation span. The `operationSpans` gate makes this return\n * `undefined` when the active span isn't one of ours — e.g. telemetry was disabled for the call so we\n * opened no operation span and the active span is the user's enclosing span — so the model call is\n * skipped rather than mis-parented.\n *\n * This covers `generateText`/`embed` (whose model call is awaited inside the operation body) and\n * `streamText` alike — `ai` initiates the stream synchronously within the operation's bound context, so\n * the later `doStream` continuation restores the same active span even though the operation's span has\n * already ended. The per-operation binding also disambiguates concurrent calls that share one model\n * instance (a single mutable slot on the shared model could not — it would hold whichever operation\n * resolved the model last).\n */\nfunction resolveModelCallParent(): Span | undefined {\n const active = getActiveSpan();\n return active && operationSpans.has(active) ? active : undefined;\n}\n\n/**\n * Idempotently patch a resolved model's `doGenerate`/`doStream` so each invocation emits a\n * `languageModelCall` span. Shared by the v5/v6 `resolveLanguageModel` path and the v4 path (which\n * patches the passed model at the operation start, as v4 has no `resolveLanguageModel`).\n */\nfunction patchModelMethods(model: PatchableModel, options: VercelAiChannelOptions): void {\n if (model[PATCHED]) {\n return;\n }\n model[PATCHED] = true;\n patchModelMethod(model, 'doGenerate', options);\n patchModelMethod(model, 'doStream', options);\n}\n\nfunction patchModelMethod(\n model: PatchableModel,\n method: 'doGenerate' | 'doStream',\n options: VercelAiChannelOptions,\n): void {\n const original = model[method];\n if (typeof original !== 'function') {\n return;\n }\n model[method] = function (this: unknown, ...args: unknown[]): Promise<unknown> {\n const parent = resolveModelCallParent();\n // No enclosing operation span (e.g. telemetry disabled for the call) → don't open a model-call span.\n if (!parent) {\n return Promise.resolve(original.apply(this, args));\n }\n\n const callArgs = isObjectLike(args[0]) ? args[0] : {};\n // Carry the operation's `callId` so the shared core can name the span after it\n // (`ai.generateText.doGenerate` / `ai.streamText.doStream`).\n const callId = callIdBySpan.get(parent);\n const message: VercelAiChannelMessage = {\n type: 'languageModelCall',\n event: {\n callId,\n provider: model.provider,\n modelId: model.modelId,\n // v4 nests the tool list under `mode.tools` (the `LanguageModelV1` call shape); v5+ passes a\n // top-level `tools` array. Reading both keeps `available_tools` populated on the model-call span.\n tools: callArgs.tools ?? (isObjectLike(callArgs.mode) ? callArgs.mode.tools : undefined),\n messages: callArgs.prompt,\n // Inherit the enclosing operation's per-call recording flags so inputs/tools/outputs are recorded on\n // the model-call span whenever they are on the parent `invoke_agent` span.\n ...recordingBySpan.get(parent),\n },\n };\n const span = withActiveSpan(parent, () => createSpanFromMessage(message, options));\n // `languageModelCall` always opens a span; the guard just keeps the wrapper safe if that changes.\n if (!span) {\n return Promise.resolve(original.apply(this, args));\n }\n\n // `streamText` ends its operation span synchronously, so its `callId` entry was deliberately left in\n // place for this later model call; drop it now that we've used it.\n const clearStreamCallId = (): void => {\n if (method === 'doStream' && callId) {\n clearOperationCallId(callId);\n }\n };\n\n // Both the synchronous throw and the async rejection of the model call must end the span with an\n // error status (an `async` `doGenerate`/`doStream` that throws rejects rather than throwing here).\n const failSpan = (error: unknown): never => {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: error instanceof Error ? error.message : 'unknown_error' });\n span.end();\n clearStreamCallId();\n throw error;\n };\n\n try {\n const result = Promise.resolve(original.apply(this, args));\n return result.then(value => {\n // A streamed model call resolves to `{ stream, ... }` before the stream is consumed, so its\n // usage/finish/output only arrive as the stream drains. Tap it (same helper as the v7 path) and\n // defer ending this model-call span until then. The parent `invoke_agent` span is enriched\n // separately by `deferStreamTextOperationEnd`, which awaits the operation's own result promises.\n if (method === 'doStream' && isObjectLike(value) && isReadableStream(value.stream)) {\n value.stream = tapModelCallStream(\n value.stream,\n final => {\n message.result = { ...value, ...streamedResultToChannelResult(final) };\n enrichSpanOnEnd(span, message, options);\n span.end();\n clearStreamCallId();\n },\n error => {\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n message: error instanceof Error ? error.message : 'unknown_error',\n });\n span.end();\n clearStreamCallId();\n },\n );\n\n return value;\n }\n // `doGenerate` (and any non-stream result) settles with the full result; end here, start/end\n // bracket the call to match the channel timing.\n message.result = value;\n enrichSpanOnEnd(span, message, options);\n span.end();\n clearStreamCallId();\n\n return value;\n }, failSpan);\n } catch (error) {\n return failSpan(error);\n }\n };\n}\n\n/**\n * Patch every executable tool on an operation's `tools` (a record keyed by tool name) so each\n * invocation emits a `gen_ai.execute_tool` span. v5 routes tool execution through the batch\n * `executeTools`, which binds `tool.execute` at call time — so replacing the `execute` property here\n * (before the call runs) is picked up. Tools without an `execute` (client-side tools) are skipped,\n * matching `executeTools`.\n */\nfunction patchOperationTools(tools: Record<string, unknown>, options: VercelAiChannelOptions): void {\n // This runs inside the channel `start` transform (no upstream try/catch), so a throw here would break\n // the user's `ai` call. Instrumentation must never do that — degrade to no tool span instead.\n try {\n for (const [toolName, tool] of Object.entries(tools)) {\n if (isObjectLike(tool)) {\n patchToolExecute(toolName, tool as PatchableTool, tools, options);\n }\n }\n } catch {\n DEBUG_BUILD && debug.log('Vercel AI orchestrion tool patching failed.');\n }\n}\n\nfunction patchToolExecute(\n toolName: string,\n tool: PatchableTool,\n tools: Record<string, unknown>,\n options: VercelAiChannelOptions,\n): void {\n const original = tool.execute;\n if (typeof original !== 'function' || tool[TOOL_PATCHED]) {\n return;\n }\n tool[TOOL_PATCHED] = true;\n tool.execute = function (this: unknown, input: unknown, ...rest: unknown[]): unknown {\n // Skip if there's no enclosing operation span (telemetry disabled for the call), or if that parent\n // is itself a tool-call span — the latter means v6's `executeToolCall` already opened a span for\n // this call and is running `execute` inside it, so spanning again here would double-count. On v5\n // the parent is the enclosing `invoke_agent` operation span, so we proceed.\n const parent = resolveModelCallParent();\n if (!parent || toolCallSpans.has(parent)) {\n return original.apply(this, [input, ...rest]);\n }\n\n // v5 passes `{ toolCallId, messages, abortSignal, ... }` as the second argument to `execute`.\n const callOptions = isObjectLike(rest[0]) ? rest[0] : {};\n const message: VercelAiChannelMessage = {\n type: 'executeTool',\n event: {\n callId: callIdBySpan.get(parent),\n toolCall: { toolName, toolCallId: asString(callOptions.toolCallId), input },\n // The `tools` record (keyed by name) lets the shared core backfill the tool's `description`.\n tools,\n // Inherit the enclosing operation's per-call recording flags so tool inputs/outputs are recorded\n // whenever they are on the parent `invoke_agent` span.\n ...recordingBySpan.get(parent),\n },\n };\n const span = withActiveSpan(parent, () => createSpanFromMessage(message, options));\n // `executeTool` always opens a span; the guard just keeps the wrapper safe if that changes.\n if (!span) {\n return original.apply(this, [input, ...rest]);\n }\n\n // v5's `executeTools` catches a thrown tool error and turns it into `tool-error` content rather\n // than rejecting, so the user never sees a rejection — we must capture it here. Rethrow so\n // `executeTools` still produces its `tool-error` result and the operation continues normally.\n const failSpan = (error: unknown): never => {\n captureToolError(span, message, error);\n span.end();\n throw error;\n };\n\n try {\n const result = Promise.resolve(original.apply(this, [input, ...rest]));\n return result.then(value => {\n // The shared core (matching v6/v7) expects the tool result nested under `output`.\n message.result = { output: value };\n enrichSpanOnEnd(span, message, options);\n span.end();\n return value;\n }, failSpan);\n } catch (error) {\n return failSpan(error);\n }\n };\n}\n\nfunction buildTextMessage(type: 'generateText' | 'streamText' | 'generateObject'): MessageBuilder {\n return (options, telemetry) => ({\n type,\n event: {\n callId: nextCallId(),\n operationId: `ai.${type}`,\n functionId: asString(telemetry.functionId),\n ...modelFields(options.model),\n maxRetries: options.maxRetries,\n // The `ai` SDK takes the system prompt as a top-level `system` option (all of v4/v5/v6); the\n // shared core lifts `event.instructions` into the system-instructions attribute, matching v7's\n // native channel (which carries it as a distinct field rather than inside the messages array).\n instructions: asString(options.system),\n // Normalize to the message-array shape the shared core (and v7's channel) expects: a bare string\n // `prompt` becomes a single user message, matching the SDK's own normalization.\n messages: normalizePromptMessages(options),\n ...recording(telemetry),\n },\n });\n}\n\nfunction normalizePromptMessages(options: Record<string, unknown>): unknown {\n if (Array.isArray(options.messages)) {\n return options.messages;\n }\n if (typeof options.prompt === 'string') {\n return [{ role: 'user', content: options.prompt }];\n }\n return options.messages ?? options.prompt;\n}\n\nfunction recording(telemetry: Record<string, unknown>): { recordInputs: unknown; recordOutputs: unknown } {\n // Match the OTel integration's per-call default: an explicit `recordInputs`/`recordOutputs` wins, but a\n // call that merely enables telemetry (`isEnabled: true`, no explicit flags) defaults both to `true`.\n // Unlike v7's native `ai:telemetry` channel, the orchestrion channels expose `isEnabled`, so — as noted\n // in `resolveRecording` — we CAN reproduce that default here (the native-channel subscriber cannot).\n const enabledDefault = telemetry.isEnabled === true ? true : undefined;\n return {\n recordInputs: telemetry.recordInputs ?? enabledDefault,\n recordOutputs: telemetry.recordOutputs ?? enabledDefault,\n };\n}\n\nfunction modelFields(model: unknown): { provider?: string; modelId?: string } {\n return { provider: modelField(model, 'provider'), modelId: modelField(model, 'modelId') };\n}\n\nfunction modelField(model: unknown, field: 'modelId' | 'provider'): string | undefined {\n return isObjectLike(model) ? asString(model[field]) : undefined;\n}\n"],"names":[],"mappings":";;;;;;;AAqEA,MAAM,OAAA,0BAAiB,4BAA4B,CAAA;AACnD,MAAM,YAAA,0BAAsB,2BAA2B,CAAA;AASvD,IAAI,aAAA,GAAgB,CAAA;AACpB,SAAS,UAAA,GAAqB;AAC5B,EAAA,OAAO,CAAA,GAAA,EAAM,EAAE,aAAa,CAAA,CAAA;AAC9B;AAIA,MAAM,QA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}
@@ -0,0 +1,94 @@
1
+ import type { TracingChannel } from 'node:diagnostics_channel';
2
+ import type { GraphqlDocumentNode } from './utils';
3
+ export declare const GRAPHQL_DC_CHANNEL_PARSE = "graphql:parse";
4
+ export declare const GRAPHQL_DC_CHANNEL_VALIDATE = "graphql:validate";
5
+ export declare const GRAPHQL_DC_CHANNEL_EXECUTE = "graphql:execute";
6
+ export declare const GRAPHQL_DC_CHANNEL_SUBSCRIBE = "graphql:subscribe";
7
+ export declare const GRAPHQL_DC_CHANNEL_RESOLVE = "graphql:resolve";
8
+ /** Context published on the sync-only `graphql:parse` channel. */
9
+ export interface GraphqlParseData {
10
+ source: string | {
11
+ body?: string;
12
+ };
13
+ result?: GraphqlDocumentNode;
14
+ error?: unknown;
15
+ }
16
+ /** Context published on the sync-only `graphql:validate` channel. */
17
+ export interface GraphqlValidateData {
18
+ document: GraphqlDocumentNode;
19
+ /** Validation errors returned by validation; an empty array means the document is valid. */
20
+ result?: ReadonlyArray<unknown>;
21
+ error?: unknown;
22
+ }
23
+ /**
24
+ * Context published on the `graphql:execute` and `graphql:subscribe` channels.
25
+ *
26
+ * `result` carries an `ExecutionResult` (or, for subscriptions, an async generator); GraphQL errors
27
+ * collected during execution surface on `result.errors` rather than as the channel's `error`
28
+ * lifecycle event, which only fires on an abrupt throw.
29
+ */
30
+ export interface GraphqlOperationData {
31
+ document: GraphqlDocumentNode;
32
+ operationName?: string;
33
+ operationType?: string;
34
+ result?: unknown;
35
+ error?: unknown;
36
+ }
37
+ /**
38
+ * Context published on the per-field `graphql:resolve` channel.
39
+ *
40
+ * A resolver throw or rejection publishes the `error` lifecycle event here; the same failure also
41
+ * surfaces in the enclosing execution result.
42
+ */
43
+ export interface GraphqlResolveData {
44
+ fieldName: string;
45
+ parentType: string;
46
+ fieldType: string;
47
+ fieldPath: string;
48
+ /** Whether the field is handled by graphql's default property resolver (vs. a user resolver). */
49
+ isDefaultResolver: boolean;
50
+ alias?: string;
51
+ args?: unknown;
52
+ result?: unknown;
53
+ error?: unknown;
54
+ }
55
+ /** Options controlling which graphql channels the subscriber emits spans for. */
56
+ export interface GraphqlDiagnosticChannelsOptions {
57
+ /**
58
+ * Do not create spans for resolvers. Resolver spans are per-field and can be very high volume.
59
+ * Defaults to `true`.
60
+ */
61
+ ignoreResolveSpans?: boolean;
62
+ /**
63
+ * When resolver spans are enabled, do not create them for graphql's default property resolver
64
+ * (fields without a user-defined resolver), which are rarely interesting. Defaults to `true`.
65
+ */
66
+ ignoreTrivialResolveSpans?: boolean;
67
+ /**
68
+ * Rename the enclosing root span to include the operation name(s), e.g.
69
+ * `GET /graphql` -> `GET /graphql (query GetUser)`. Defaults to `true`.
70
+ */
71
+ useOperationNameForRootSpan?: boolean;
72
+ }
73
+ /**
74
+ * Platform-provided factory that creates a native tracing channel for the given name. The
75
+ * subscriber binds the span and its lifecycle onto the channel via `bindTracingChannelToSpan`,
76
+ * which propagates the active span through the runtime's async context.
77
+ *
78
+ * Node passes `node:diagnostics_channel`'s `tracingChannel` directly.
79
+ */
80
+ export type GraphqlTracingChannelFactory = <T extends object>(name: string) => TracingChannel<T, T>;
81
+ /**
82
+ * Subscribe Sentry span handlers to graphql's diagnostics-channel events
83
+ * (`graphql:parse`, `:validate`, `:execute`, `:subscribe`), published by graphql >= 17.0.0.
84
+ *
85
+ * On older graphql versions the channels are never published to, so the subscribers are inert —
86
+ * there is no double-instrumentation against the vendored OTel patcher, which is gated to `< 17`.
87
+ *
88
+ * The per-field `graphql:resolve` channel is only subscribed when `ignoreResolveSpans` is `false`:
89
+ * resolver spans are per-field and can be extremely high-volume, so they are off by default (matching
90
+ * the legacy OTel path). When enabled, `ignoreTrivialResolveSpans` (default `true`) additionally skips
91
+ * graphql's default property resolver.
92
+ */
93
+ export declare function subscribeGraphqlDiagnosticChannels(tracingChannel: GraphqlTracingChannelFactory, options?: GraphqlDiagnosticChannelsOptions): void;
94
+ //# sourceMappingURL=graphql-dc-subscriber.d.ts.map
@@ -0,0 +1 @@
1
+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O,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,iFAAiF;AACjF,MAAM,WAAW,gCAAgC;IAC/C;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAEpC;;;OAGG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpG;;;;;;;;;;;GAWG;AACH,wBAAgB,kCAAkC,CAChD,cAAc,EAAE,4BAA4B,EAC5C,OAAO,GAAE,gCAAqC,GAC7C,IAAI,CAaN"}
@@ -0,0 +1,12 @@
1
+ import { type GraphqlDiagnosticChannelsOptions } from './graphql-dc-subscriber';
2
+ /**
3
+ * Auto-instrument the [graphql](https://www.npmjs.com/package/graphql) library via its native
4
+ * `node:diagnostics_channel` tracing channels (graphql >= 17).
5
+ *
6
+ * On older graphql versions the channels are never published to, so this integration is inert and
7
+ * the vendored OTel instrumentation (gated to `< 17`) handles instrumentation instead.
8
+ */
9
+ export declare const graphqlIntegration: (options?: GraphqlDiagnosticChannelsOptions | undefined) => import("@sentry/core").Integration & {
10
+ name: "Graphql";
11
+ };
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/graphql/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,gCAAgC,EAAsC,MAAM,yBAAyB,CAAC;AAoBpH;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;CAAyC,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { Span } from '@sentry/core';
2
+ /** Minimal shape of a graphql-js lexer token, enough to locate literal spans for redaction. */
3
+ interface GraphqlToken {
4
+ kind: string;
5
+ start: number;
6
+ end: number;
7
+ next?: GraphqlToken | null;
8
+ }
9
+ /** Minimal shape of a parsed graphql-js `DocumentNode`, enough to read its source and tokens. */
10
+ export interface GraphqlDocumentNode {
11
+ loc?: {
12
+ startToken?: GraphqlToken;
13
+ source?: {
14
+ body?: string;
15
+ };
16
+ };
17
+ }
18
+ /**
19
+ * Rename the enclosing root span to include the operation name(s), e.g. `GET /graphql (query GetUser)`.
20
+ * Mirrors the legacy OTel `useOperationNameForRootSpan` behavior; `parseSpanDescription` reads the same
21
+ * `sentry.graphql.operation` attribute on the OTel export path.
22
+ */
23
+ export declare function renameRootSpanWithOperation(span: Span, operationType: string, operationName?: string): void;
24
+ /**
25
+ * Span name follows the GraphQL semantic conventions: `<operation.type> <operation.name>` when both
26
+ * are available, `<operation.type>` when only the type is, otherwise a static fallback.
27
+ */
28
+ export declare function getOperationSpanName(operationType: string | undefined, operationName: string | undefined, fallbackName: string): string;
29
+ /** Whether a graphql execution result carries GraphQL errors (returned on `result.errors`). */
30
+ export declare function hasResultErrors(result: unknown): boolean;
31
+ /**
32
+ * Returns the redacted document if `dataCollection.graphQL.document` is enabled, `undefined` otherwise.
33
+ */
34
+ export declare function collectGraphqlDocument(document: GraphqlDocumentNode | undefined): string | undefined;
35
+ export {};
36
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/graphql/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAWzC,+FAA+F;AAC/F,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;CAC5B;AAED,iGAAiG;AACjG,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,EAAE;QACJ,UAAU,CAAC,EAAE,YAAY,CAAC;QAC1B,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5B,CAAC;CACH;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CA+B3G;AAiBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,YAAY,EAAE,MAAM,GACnB,MAAM,CASR;AAED,+FAA+F;AAC/F,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAQxD;AAwCD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAKpG"}
@@ -3,9 +3,13 @@
3
3
  *
4
4
  * @module
5
5
  */
6
+ export { graphqlIntegration } from './graphql';
6
7
  export { mongooseIntegration } from './mongoose';
7
- export { IOREDIS_DC_CHANNEL_COMMAND, IOREDIS_DC_CHANNEL_CONNECT, REDIS_DC_CHANNEL_BATCH, REDIS_DC_CHANNEL_COMMAND, REDIS_DC_CHANNEL_CONNECT, subscribeRedisDiagnosticChannels, } from './redis/redis-dc-subscriber';
8
- export type { IORedisCommandData, RedisBatchData, RedisCommandData, RedisConnectData, RedisDiagnosticChannelResponseHook, RedisTracingChannelFactory, } from './redis/redis-dc-subscriber';
8
+ export { mysql2Integration } from './mysql2';
9
+ export { instrumentPrisma, prismaIntegration } from './prisma';
10
+ export type { PrismaInstrumentationConfig, PrismaOptions } from './prisma';
11
+ export { redisIntegration, type RedisDiagnosticChannelsOptions } from './redis';
12
+ export type { RedisDiagnosticChannelResponseHook } from './redis/redis-dc-subscriber';
9
13
  export { defaultDbStatementSerializer } from './redis/redis-statement-serializer';
10
14
  export { bindTracingChannelToSpan } from './tracing-channel';
11
15
  export type { SentryTracingChannel, TracingChannelLifeCycleOptions, TracingChannelBindingHandle, TracingChannelPayloadWithSpan, } from './tracing-channel';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kCAAkC,EAClC,0BAA0B,GAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EACV,oBAAoB,EACpB,8BAA8B,EAC9B,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EACL,kBAAkB,EAElB,kBAAkB,EAElB,iBAAiB,GAClB,MAAM,wCAAwC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC/D,YAAY,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,KAAK,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAChF,YAAY,EAAE,kCAAkC,EAAE,MAAM,6BAA6B,CAAC;AACtF,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EACV,oBAAoB,EACpB,8BAA8B,EAC9B,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EACL,kBAAkB,EAElB,kBAAkB,EAElB,iBAAiB,GAClB,MAAM,wCAAwC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * EXPERIMENTAL: orchestrion-driven `amqplib` integration.
3
+ *
4
+ * Subscribes to the `orchestrion:amqplib:*` diagnostics_channels that the orchestrion code transform
5
+ * injects into `amqplib`'s channel/connection methods. Requires the orchestrion runtime hook or
6
+ * bundler plugin to be active.
7
+ */
8
+ export declare const amqplibChannelIntegration: () => import("@sentry/core").Integration & {
9
+ name: "Amqplib";
10
+ };
11
+ //# sourceMappingURL=amqplib.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amqplib.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing-channel/amqplib.ts"],"names":[],"mappings":"AAqoBA;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB;;CAAgD,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * EXPERIMENTAL: orchestrion-driven `dataloader` integration.
3
+ *
4
+ * Subscribes to the `orchestrion:dataloader:*` diagnostics_channels that the orchestrion code
5
+ * transform injects into `dataloader`'s constructor and prototype methods. Requires the orchestrion
6
+ * runtime hook or bundler plugin to be active.
7
+ */
8
+ export declare const dataloaderChannelIntegration: () => import("@sentry/core").Integration & {
9
+ name: "Dataloader";
10
+ };
11
+ //# sourceMappingURL=dataloader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataloader.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing-channel/dataloader.ts"],"names":[],"mappings":"AAqKA;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B;;CAAmD,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { ExpressIntegrationOptions } from './types';
2
+ /**
3
+ * EXPERIMENTAL — orchestrion-driven Express integration.
4
+ *
5
+ * Subscribes to the `orchestrion:express:handle` (Express v4) and
6
+ * `orchestrion:router:handle` (Express v5, via the `router` package)
7
+ * diagnostics_channels that the orchestrion code transform injects into the
8
+ * routing layer's request handler (`Layer.prototype.handle_request` /
9
+ * `handleRequest`). One span is opened per layer invocation — producing the
10
+ * same spans as the OTel Express instrumentation.
11
+ *
12
+ * Requires the orchestrion runtime hook or bundler plugin to be active — wire
13
+ * that up via `experimentalUseDiagnosticsChannelInjection()`.
14
+ */
15
+ export declare const expressChannelIntegration: (options?: ExpressIntegrationOptions | undefined) => import("@sentry/core").Integration & {
16
+ name: "Express";
17
+ };
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing-channel/express/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAuBzD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB;;CAAgD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type * as diagnosticsChannel from 'node:diagnostics_channel';
2
+ import type { ExpressIntegrationOptions } from './types';
3
+ export declare function instrumentExpress(options: ExpressIntegrationOptions, tracingChannel: typeof diagnosticsChannel.tracingChannel): void;
4
+ //# sourceMappingURL=instrumentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing-channel/express/instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,kBAAkB,MAAM,0BAA0B,CAAC;AA2BpE,OAAO,KAAK,EACV,yBAAyB,EAO1B,MAAM,SAAS,CAAC;AAcjB,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,yBAAyB,EAClC,cAAc,EAAE,OAAO,kBAAkB,CAAC,cAAc,GACvD,IAAI,CAgDN"}