@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,14 +1,29 @@
1
+ import { amqplibChannelIntegration } from '../integrations/tracing-channel/amqplib';
1
2
  import { anthropicChannelIntegration } from '../integrations/tracing-channel/anthropic';
3
+ import { dataloaderChannelIntegration } from '../integrations/tracing-channel/dataloader';
4
+ import { genericPoolChannelIntegration } from '../integrations/tracing-channel/generic-pool';
5
+ import { googleGenAIChannelIntegration } from '../integrations/tracing-channel/google-genai';
6
+ import { graphqlChannelIntegration } from '../integrations/tracing-channel/graphql';
2
7
  import { hapiChannelIntegration } from '../integrations/tracing-channel/hapi';
3
8
  import { ioredisChannelIntegration } from '../integrations/tracing-channel/ioredis';
9
+ import { kafkajsChannelIntegration } from '../integrations/tracing-channel/kafkajs';
10
+ import { knexChannelIntegration } from '../integrations/tracing-channel/knex';
4
11
  import { lruMemoizerChannelIntegration } from '../integrations/tracing-channel/lru-memoizer';
5
12
  import { mysqlChannelIntegration } from '../integrations/tracing-channel/mysql';
13
+ import { mysql2ChannelIntegration } from '../integrations/tracing-channel/mysql2';
6
14
  import { openaiChannelIntegration } from '../integrations/tracing-channel/openai';
7
15
  import { postgresChannelIntegration } from '../integrations/tracing-channel/postgres';
16
+ import { postgresJsChannelIntegration } from '../integrations/tracing-channel/postgres-js';
8
17
  import { vercelAiChannelIntegration } from '../integrations/tracing-channel/vercel-ai';
18
+ import { expressChannelIntegration } from '../integrations/tracing-channel/express';
9
19
  export { detectOrchestrionSetup, isOrchestrionInjected } from './detect';
10
- export { anthropicChannelIntegration, hapiChannelIntegration, ioredisChannelIntegration, lruMemoizerChannelIntegration, mysqlChannelIntegration, openaiChannelIntegration, postgresChannelIntegration, vercelAiChannelIntegration, };
20
+ export { nestjsChannels } from './config/nestjs';
21
+ export { amqplibChannelIntegration, anthropicChannelIntegration, dataloaderChannelIntegration, genericPoolChannelIntegration, googleGenAIChannelIntegration, graphqlChannelIntegration, hapiChannelIntegration, ioredisChannelIntegration, kafkajsChannelIntegration, knexChannelIntegration, lruMemoizerChannelIntegration, mysqlChannelIntegration, mysql2ChannelIntegration, openaiChannelIntegration, postgresChannelIntegration, postgresJsChannelIntegration, vercelAiChannelIntegration, expressChannelIntegration, };
11
22
  export { IORedisChannelIntegrationOptions, IORedisResponseHook } from '../integrations/tracing-channel/ioredis';
23
+ export { PostgresJsChannelIntegrationOptions } from '../integrations/tracing-channel/postgres-js';
24
+ export { redisChannelIntegration } from '../integrations/tracing-channel/redis';
25
+ export { RedisChannelIntegrationOptions, RedisResponseHook } from '../integrations/tracing-channel/redis';
26
+ export * from '../integrations/tracing-channel/graphql/graphql-types';
12
27
  /**
13
28
  * The canonical set of orchestrion diagnostics-channel integrations, keyed by their public
14
29
  * (OTel-parity) factory name.
@@ -18,9 +33,18 @@ export { IORedisChannelIntegrationOptions, IORedisResponseHook } from '../integr
18
33
  * `diagnosticsChannelInjectionIntegrations()` map — picks it up automatically, so there's no separate
19
34
  * list to keep in sync.
20
35
  *
21
- * NOTE: `ioredisChannelIntegration` is intentionally NOT here. It only partially replaces the
22
- * composite OTel `Redis` integration and needs the node SDK's redis cache `responseHook` (which
23
- * can't live in `server-utils`), so `@sentry/node` wires it up separately.
36
+ * NOTE: `ioredisChannelIntegration` and `redisChannelIntegration` are intentionally NOT here. They
37
+ * only partially replace the composite OTel `Redis` integration and need the node SDK's redis cache
38
+ * `responseHook` (which can't live in `server-utils`), so `@sentry/node` wires them up separately.
39
+ *
40
+ * Framework SDKs that own their own channel listener (e.g. `@sentry/nestjs`'s `Nest`) are NOT here
41
+ * either: their transform config is still in `SENTRY_INSTRUMENTATIONS`, but the listener lives in
42
+ * their package and picks the channel-vs-OTel path itself at `setupOnce`, so it needs no central swap.
43
+ *
44
+ * NOTE: `dataloaderChannelIntegration` is also NOT here. Everything in this map is auto-appended to
45
+ * the default integrations, but the OTel `Dataloader` integration is opt-in (never a default). Like
46
+ * `@sentry/nestjs`'s `Nest`, its `@sentry/node` factory picks the channel-vs-OTel path itself at
47
+ * `setupOnce` (via `isOrchestrionInjected()`), so there's nothing for the central swap to do.
24
48
  */
25
49
  export declare const channelIntegrations: {
26
50
  readonly postgresIntegration: (options?: {
@@ -28,9 +52,18 @@ export declare const channelIntegrations: {
28
52
  } | undefined) => import("@sentry/core").Integration & {
29
53
  name: "Postgres";
30
54
  };
55
+ readonly postgresJsIntegration: (options?: import(".").PostgresJsChannelIntegrationOptions | undefined) => import("@sentry/core").Integration & {
56
+ name: "PostgresJs";
57
+ };
31
58
  readonly mysqlIntegration: () => import("@sentry/core").Integration & {
32
59
  name: "Mysql";
33
60
  };
61
+ readonly mysql2Integration: () => import("@sentry/core").Integration & {
62
+ name: "Mysql2";
63
+ };
64
+ readonly genericPoolIntegration: () => import("@sentry/core").Integration & {
65
+ name: "GenericPool";
66
+ };
34
67
  readonly lruMemoizerIntegration: () => import("@sentry/core").Integration & {
35
68
  name: "LruMemoizer";
36
69
  };
@@ -40,6 +73,9 @@ export declare const channelIntegrations: {
40
73
  readonly anthropicIntegration: (options?: import("@sentry/core").AnthropicAiOptions | undefined) => import("@sentry/core").Integration & {
41
74
  name: "Anthropic_AI";
42
75
  };
76
+ readonly googleGenAIIntegration: (options?: import("@sentry/core").GoogleGenAIOptions | undefined) => import("@sentry/core").Integration & {
77
+ name: "Google_GenAI";
78
+ };
43
79
  readonly vercelAiIntegration: (options?: {
44
80
  recordInputs?: boolean;
45
81
  recordOutputs?: boolean;
@@ -47,8 +83,25 @@ export declare const channelIntegrations: {
47
83
  } | undefined) => import("@sentry/core").Integration & {
48
84
  name: "VercelAI";
49
85
  };
86
+ readonly amqplibIntegration: () => import("@sentry/core").Integration & {
87
+ name: "Amqplib";
88
+ };
50
89
  readonly hapiIntegration: () => import("@sentry/core").Integration & {
51
90
  name: "Hapi";
52
91
  };
92
+ readonly expressIntegration: (options?: import("../integrations/tracing-channel/express/types").ExpressIntegrationOptions | undefined) => import("@sentry/core").Integration & {
93
+ name: "Express";
94
+ };
95
+ readonly graphqlIntegration: (options?: import("../graphql/graphql-dc-subscriber").GraphqlDiagnosticChannelsOptions) => Pick<import("@sentry/core").Integration & {
96
+ name: "Graphql";
97
+ }, Exclude<keyof (import("@sentry/core").Integration & {
98
+ name: "Graphql";
99
+ }), "name" | "setupOnce">> & {
100
+ name: "Graphql";
101
+ setupOnce: () => void | undefined;
102
+ };
103
+ readonly kafkajsIntegration: () => import("@sentry/core").Integration & {
104
+ name: "Kafka";
105
+ };
53
106
  };
54
107
  //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,13 @@
1
- declare global {
2
- var __SENTRY_ORCHESTRION__: {
3
- runtime?: boolean;
4
- bundler?: boolean;
5
- } | undefined;
1
+ export interface RegisterDiagnosticsChannelInjectionOptions {
2
+ /**
3
+ * Absolute directory of the `@apm-js-collab/tracing-hooks` package (forward slashes).
4
+ *
5
+ * Needed when SDK code is bundled into an app's server build: the default bare-specifier
6
+ * require then resolves from the emitted chunk, which fails under isolated installs (pnpm).
7
+ * Framework SDKs (e.g. `@sentry/nextjs`) resolve the package at build time and pass its
8
+ * location here; it is loaded through an opaque `createRequire` that bundlers can't trace.
9
+ */
10
+ tracingHooksDir?: string;
6
11
  }
7
12
  /**
8
13
  * Synchronously register the diagnostics-channel injection module hooks.
@@ -15,9 +20,6 @@ declare global {
15
20
  *
16
21
  * Libraries imported *after* this call publish the `tracingChannel` events that
17
22
  * the channel-based integrations subscribe to.
18
- *
19
- * Idempotent via `globalThis.__SENTRY_ORCHESTRION__` — a no-op if the runtime
20
- * `--import` hook or a bundler plugin already injected the channels.
21
23
  */
22
- export declare function registerDiagnosticsChannelInjection(): void;
24
+ export declare function registerDiagnosticsChannelInjection(options?: RegisterDiagnosticsChannelInjectionOptions): void;
23
25
  //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { TracingHelper } from './types';
2
+ export declare function getGlobalTracingHelper(): TracingHelper | undefined;
3
+ export declare function setGlobalTracingHelper(helper: TracingHelper): void;
4
+ export declare function clearGlobalTracingHelper(): void;
5
+ //# sourceMappingURL=global.d.ts.map
@@ -0,0 +1,45 @@
1
+ export interface PrismaInstrumentationConfig {
2
+ /**
3
+ * Span types that should not be traced. Matched against the full span name (e.g. `prisma:client:operation`),
4
+ * either exactly (string) or by pattern (RegExp).
5
+ */
6
+ ignoreSpanTypes?: (string | RegExp)[];
7
+ }
8
+ export interface PrismaOptions {
9
+ /**
10
+ * @deprecated This is no longer used, v5 works out of the box.
11
+ */
12
+ prismaInstrumentation?: unknown;
13
+ /**
14
+ * Configuration for the Prisma tracing helper.
15
+ */
16
+ instrumentationConfig?: PrismaInstrumentationConfig;
17
+ }
18
+ /**
19
+ * Sets up the global Prisma tracing helper that Prisma looks up on `globalThis` to emit tracing data.
20
+ *
21
+ * Prisma reads `globalThis.PRISMA_INSTRUMENTATION` (and its versioned variant) to find a "TracingHelper"
22
+ * which it uses internally to create spans, so it can produce tracing data without depending on
23
+ * OpenTelemetry. The helper we install here mints spans through Sentry's span APIs. A single helper
24
+ * serves both Prisma v5 (which calls `createEngineSpan`) and v6/v7 (which call `dispatchEngineSpans`),
25
+ * so it doesn't blow up on version mismatches.
26
+ */
27
+ export declare function instrumentPrisma(options?: PrismaOptions): void;
28
+ /**
29
+ * Adds Sentry tracing instrumentation for the [prisma](https://www.npmjs.com/package/prisma) library.
30
+ * For more information, see the [`prismaIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/).
31
+ *
32
+ * NOTE: This integration works out of the box with Prisma v6, and v7.
33
+ * On Prisma versions prior to v6, add `previewFeatures = ["tracing"]` to the client generator block of your Prisma schema:
34
+ *
35
+ * ```
36
+ * generator client {
37
+ * provider = "prisma-client-js"
38
+ * previewFeatures = ["tracing"]
39
+ * }
40
+ * ```
41
+ */
42
+ export declare const prismaIntegration: (options?: PrismaOptions | undefined) => import("@sentry/core").Integration & {
43
+ name: "Prisma";
44
+ };
45
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,52 @@
1
+ import { Span } from '@sentry/core';
2
+ import { EngineSpan, ExtendedSpanOptions, SpanCallback, TracingHelper } from './types';
3
+ type Options = {
4
+ ignoreSpanTypes: (string | RegExp)[];
5
+ };
6
+ type V5EngineSpanEvent = {
7
+ span: boolean;
8
+ spans: V5EngineSpan[];
9
+ };
10
+ type V5EngineSpanKind = 'client' | 'internal';
11
+ type V5EngineSpan = {
12
+ span: boolean;
13
+ name: string;
14
+ trace_id: string;
15
+ span_id: string;
16
+ parent_span_id: string;
17
+ start_time: [
18
+ number,
19
+ number
20
+ ];
21
+ end_time: [
22
+ number,
23
+ number
24
+ ];
25
+ attributes?: Record<string, string>;
26
+ links?: {
27
+ trace_id: string;
28
+ span_id: string;
29
+ }[];
30
+ kind: V5EngineSpanKind;
31
+ };
32
+ /**
33
+ * This satisifes the TracingHelper interface for Prisma v5 and v6/v7.
34
+ */
35
+ export declare class ActiveTracingHelper implements TracingHelper {
36
+ private ignoreSpanTypes;
37
+ constructor({ ignoreSpanTypes }: Options);
38
+ isEnabled(): boolean;
39
+ getTraceParent(span?: Span): string;
40
+ dispatchEngineSpans(spans: EngineSpan[]): void;
41
+ /**
42
+ * Prisma v5 broke the tracing helper interface with the v6 major, replacing `createEngineSpan` with
43
+ * `dispatchEngineSpans`. We implement the v6/v7 interface (`dispatchEngineSpans`) but also keep this
44
+ * v5-only method so the same helper doesn't blow up in Prisma 5 users' faces, minting v5 engine spans
45
+ * through Sentry's span APIs instead of crashing.
46
+ */
47
+ createEngineSpan(engineSpanEvent: V5EngineSpanEvent): void;
48
+ getActiveContext(): Span | undefined;
49
+ runInChildSpan<R>(nameOrOptions: string | ExtendedSpanOptions, callback: SpanCallback<R>): R;
50
+ }
51
+ export {};
52
+ //# sourceMappingURL=tracing-helper.d.ts.map
@@ -0,0 +1,40 @@
1
+ import { Span, SpanAttributes, SpanKindValue, SpanLink, SpanTimeInput } from '@sentry/core';
2
+ export type SpanCallback<R> = (span?: Span, parentSpan?: Span) => R;
3
+ export interface ExtendedSpanOptions {
4
+ /** The name of the span */
5
+ name: string;
6
+ internal?: boolean;
7
+ /** Whether it propagates context (?=true) */
8
+ active?: boolean;
9
+ attributes?: SpanAttributes;
10
+ kind?: SpanKindValue;
11
+ links?: SpanLink[];
12
+ startTime?: SpanTimeInput;
13
+ }
14
+ export type EngineSpanId = string;
15
+ export type HrTime = [
16
+ number,
17
+ number
18
+ ];
19
+ export type EngineSpanKind = 'client' | 'internal';
20
+ export type EngineSpan = {
21
+ id: EngineSpanId;
22
+ parentId: string | null;
23
+ name: string;
24
+ startTime: HrTime;
25
+ endTime: HrTime;
26
+ kind: EngineSpanKind;
27
+ attributes?: Record<string, unknown>;
28
+ links?: EngineSpanId[];
29
+ };
30
+ export interface TracingHelper {
31
+ isEnabled(): boolean;
32
+ getTraceParent(span?: Span): string;
33
+ dispatchEngineSpans(spans: EngineSpan[]): void;
34
+ getActiveContext(): Span | undefined;
35
+ runInChildSpan<R>(nameOrOptions: string | ExtendedSpanOptions, callback: SpanCallback<R>): R;
36
+ }
37
+ export interface PrismaInstrumentationGlobalValue {
38
+ helper?: TracingHelper;
39
+ }
40
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,18 @@
1
+ import { RedisDiagnosticChannelResponseHook } from './redis-dc-subscriber';
2
+ /** Options controlling the redis diagnostics-channel subscription. */
3
+ export interface RedisDiagnosticChannelsOptions {
4
+ /**
5
+ * Optional hook invoked once the redis command response arrives. Useful for attaching
6
+ * response-derived attributes (e.g. cache hit/miss, payload size).
7
+ */
8
+ responseHook?: RedisDiagnosticChannelResponseHook;
9
+ }
10
+ /**
11
+ * Auto-instrument the [redis](https://www.npmjs.com/package/redis) and
12
+ * [ioredis](https://www.npmjs.com/package/ioredis) libraries via their native
13
+ * `node:diagnostics_channel` tracing channels (node-redis >= 5.12.0, ioredis >= 5.11.0).
14
+ */
15
+ export declare const redisIntegration: (options?: RedisDiagnosticChannelsOptions | undefined) => import("@sentry/core").Integration & {
16
+ name: string;
17
+ };
18
+ //# sourceMappingURL=index.d.ts.map
@@ -84,11 +84,6 @@ export type RedisTracingChannelFactory = <T extends object>(name: string) => Tra
84
84
  * On older client versions the channels are never published to, so subscribers
85
85
  * are inert — there is no double-instrumentation against any IITM-based
86
86
  * patcher gated to those older versions.
87
- *
88
- * Idempotent: subsequent calls update the response hook but do not
89
- * re-subscribe.
90
87
  */
91
88
  export declare function subscribeRedisDiagnosticChannels(tracingChannel: RedisTracingChannelFactory, responseHook?: RedisDiagnosticChannelResponseHook): void;
92
- /** Test-only: detach all channel bindings and reset module-local subscribe state. */
93
- export declare function _resetRedisDiagnosticChannelsForTesting(): void;
94
89
  //# sourceMappingURL=redis-dc-subscriber.d.ts.map
@@ -42,6 +42,11 @@ export interface TracingChannelLifeCycleOptions<TData extends object = object> {
42
42
  /** Ends the span: `end()` on success, `end(error)` on failure. Idempotent. */
43
43
  end: (error?: unknown) => void;
44
44
  }) => boolean;
45
+ /**
46
+ * Apply span/scope binding only if there is a parent span, similar to returning `undefined` in the `getSpan` callback.
47
+ * If you need to perform some conditional checking on the parent span before deciding, do it in the `getSpan` callback.
48
+ */
49
+ requiresParentSpan?: boolean;
45
50
  }
46
51
  /** Returned by {@link bindTracingChannelToSpan}: the bound channel plus a teardown handle. */
47
52
  export interface TracingChannelBindingHandle<TData extends object = object> {
@@ -0,0 +1,30 @@
1
+ /** Shared, state-free helpers for the Vercel AI (`ai`) channel subscribers, plus the streamed model-call tap. */
2
+ /** Narrow to a string, or `undefined` for anything else. */
3
+ export declare function asString(value: unknown): string | undefined;
4
+ /** Narrow to a finite number, or `undefined` for anything else (including `NaN`). */
5
+ export declare function asNumber(value: unknown): number | undefined;
6
+ /** Add two optional numbers, treating a missing operand as `0` but returning `undefined` when both are absent. */
7
+ export declare function sum(a: number | undefined, b: number | undefined): number | undefined;
8
+ /** The aggregate handed back once a streamed model call finishes, in the shape `enrichSpanOnEnd` expects. */
9
+ export interface StreamedModelCallResult {
10
+ text?: string;
11
+ toolCalls: Array<Record<string, unknown>>;
12
+ usage?: unknown;
13
+ finishReason?: unknown;
14
+ responseId?: string;
15
+ responseModel?: string;
16
+ providerMetadata?: unknown;
17
+ }
18
+ /** A minimal structural check — the streamed model call exposes a web `ReadableStream` on `result.stream`. */
19
+ export declare function isReadableStream(value: unknown): value is ReadableStream<unknown>;
20
+ /**
21
+ * Wrap a streamed model call's `ReadableStream` so its chunks are observed as the SDK consumes them,
22
+ * without altering what the SDK sees. Returns a replacement stream to swap onto `result.stream`.
23
+ *
24
+ * `onFinal` runs exactly once when the stream drains cleanly; `onError` runs exactly once if it errors
25
+ * or is cancelled. Reading one source chunk per `pull` preserves the SDK's backpressure. The
26
+ * `try/catch` around every read guarantees the owning span is always ended — a leaked open span on a
27
+ * mid-stream failure would be worse than a slightly-less-enriched one.
28
+ */
29
+ export declare function tapModelCallStream(stream: ReadableStream<unknown>, onFinal: (result: StreamedModelCallResult) => void, onError: (error: unknown) => void): ReadableStream<unknown>;
30
+ //# sourceMappingURL=util.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { Span } from '@sentry/core';
2
2
  import { TracingChannel } from 'node:diagnostics_channel';
3
+ import { StreamedModelCallResult } from './util';
3
4
  /** Drop the per-operation `callId` maps once the owning top-level operation settles (success or error). */
4
5
  export declare function clearOperationId(data: VercelAiChannelMessage): void;
5
6
  /**
@@ -10,7 +11,7 @@ export declare function clearOperationId(data: VercelAiChannelMessage): void;
10
11
  */
11
12
  export declare function clearOperationCallId(callId: string): void;
12
13
  /** The lifecycle event types the `ai:telemetry` channel can carry. */
13
- export type ChannelEventType = 'generateText' | 'streamText' | 'step' | 'languageModelCall' | 'executeTool' | 'embed' | 'embedMany' | 'rerank';
14
+ export type ChannelEventType = 'generateText' | 'streamText' | 'generateObject' | 'step' | 'languageModelCall' | 'executeTool' | 'embed' | 'embedMany' | 'rerank';
14
15
  /**
15
16
  * The context object the AI SDK passes through one tracing-channel call. It is the same object
16
17
  * identity across `start`/`end`/`asyncEnd`/`error`, and Node's `tracingChannel` attaches
@@ -49,9 +50,11 @@ export interface VercelAiChannelOptions {
49
50
  *
50
51
  * Safe to always call: on `ai` versions that don't publish to the channel (e.g. < 7) nothing is
51
52
  * ever emitted and this is inert, so there is no double-instrumentation against the OTel-based
52
- * patcher. Idempotent.
53
+ * patcher. The integration's `setupOnce` guarantees this runs a single time.
53
54
  */
54
55
  export declare function subscribeVercelAiTracingChannel(tracingChannel: VercelAiTracingChannelFactory, options?: VercelAiChannelOptions): void;
56
+ /** Map the tapped stream aggregate onto the `languageModelCall` result shape `enrichSpanOnEnd` reads. */
57
+ export declare function streamedResultToChannelResult(final: StreamedModelCallResult): Record<string, unknown>;
55
58
  /**
56
59
  * Transform a channel `start` payload into the span that should be active for the operation. For
57
60
  * `step` we deliberately don't open a span (model calls and tool calls are siblings under the
@@ -65,4 +68,5 @@ export declare function createSpanFromMessage(data: VercelAiChannelMessage, chan
65
68
  * we simply don't set the attribute rather than emit a malformed span.
66
69
  */
67
70
  export declare function enrichSpanOnEnd(span: Span, data: VercelAiChannelMessage, channelOptions: VercelAiChannelOptions): void;
71
+ export declare function captureToolError(span: Span, data: VercelAiChannelMessage, error: unknown): void;
68
72
  //# sourceMappingURL=vercel-ai-dc-subscriber.d.ts.map
@@ -9,4 +9,4 @@ import { VercelAiChannelOptions, VercelAiTracingChannelFactory } from './vercel-
9
9
  * subscribe time so we never look the integration up per event.
10
10
  */
11
11
  export declare function subscribeVercelAiOrchestrionChannels(tracingChannel: VercelAiTracingChannelFactory, options?: VercelAiChannelOptions): void;
12
- //# sourceMappingURL=vercel-ai-orchestrion-v6-subscriber.d.ts.map
12
+ //# sourceMappingURL=vercel-ai-orchestrion-subscriber.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/server-utils",
3
- "version": "10.64.0",
3
+ "version": "10.66.0",
4
4
  "description": "Server Utilities for all Sentry JavaScript SDKs",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/server-utils",
@@ -39,7 +39,23 @@
39
39
  },
40
40
  "./orchestrion/vite": {
41
41
  "types": "./build/types/orchestrion/bundler/vite.d.ts",
42
- "import": "./build/esm/orchestrion/bundler/vite.js"
42
+ "import": "./build/esm/orchestrion/bundler/vite.js",
43
+ "require": "./build/cjs/orchestrion/bundler/vite.js"
44
+ },
45
+ "./orchestrion/rollup": {
46
+ "types": "./build/types/orchestrion/bundler/rollup.d.ts",
47
+ "import": "./build/esm/orchestrion/bundler/rollup.js",
48
+ "require": "./build/cjs/orchestrion/bundler/rollup.js"
49
+ },
50
+ "./orchestrion/webpack": {
51
+ "types": "./build/types/orchestrion/bundler/webpack.d.ts",
52
+ "import": "./build/esm/orchestrion/bundler/webpack.js",
53
+ "require": "./build/cjs/orchestrion/bundler/webpack.js"
54
+ },
55
+ "./orchestrion/esbuild": {
56
+ "types": "./build/types/orchestrion/bundler/esbuild.d.ts",
57
+ "import": "./build/esm/orchestrion/bundler/esbuild.js",
58
+ "require": "./build/cjs/orchestrion/bundler/esbuild.js"
43
59
  },
44
60
  "./orchestrion/import-hook": {
45
61
  "import": "./build/orchestrion/import-hook.mjs"
@@ -61,6 +77,15 @@
61
77
  ],
62
78
  "orchestrion/vite": [
63
79
  "build/types-ts3.8/orchestrion/bundler/vite.d.ts"
80
+ ],
81
+ "orchestrion/rollup": [
82
+ "build/types-ts3.8/orchestrion/bundler/rollup.d.ts"
83
+ ],
84
+ "orchestrion/webpack": [
85
+ "build/types-ts3.8/orchestrion/bundler/webpack.d.ts"
86
+ ],
87
+ "orchestrion/esbuild": [
88
+ "build/types-ts3.8/orchestrion/bundler/esbuild.d.ts"
64
89
  ]
65
90
  },
66
91
  "*": {
@@ -75,6 +100,15 @@
75
100
  ],
76
101
  "orchestrion/vite": [
77
102
  "build/types/orchestrion/bundler/vite.d.ts"
103
+ ],
104
+ "orchestrion/rollup": [
105
+ "build/types/orchestrion/bundler/rollup.d.ts"
106
+ ],
107
+ "orchestrion/webpack": [
108
+ "build/types/orchestrion/bundler/webpack.d.ts"
109
+ ],
110
+ "orchestrion/esbuild": [
111
+ "build/types/orchestrion/bundler/esbuild.d.ts"
78
112
  ]
79
113
  }
80
114
  },
@@ -82,12 +116,11 @@
82
116
  "access": "public"
83
117
  },
84
118
  "dependencies": {
85
- "@apm-js-collab/code-transformer-bundler-plugins": "^0.5.0",
86
- "@apm-js-collab/code-transformer": "^0.15.0",
87
- "@apm-js-collab/tracing-hooks": "^0.10.1",
88
- "@sentry/conventions": "^0.15.1",
89
- "@sentry/core": "10.64.0",
90
- "magic-string": "~0.30.0"
119
+ "@apm-js-collab/code-transformer-bundler-plugins": "^0.6.1",
120
+ "@apm-js-collab/code-transformer": "^0.18.0",
121
+ "@apm-js-collab/tracing-hooks": "^0.13.0",
122
+ "@sentry/conventions": "^0.16.0",
123
+ "@sentry/core": "10.66.0"
91
124
  },
92
125
  "devDependencies": {
93
126
  "@types/node": "^18.19.1",
@@ -1 +0,0 @@
1
- {"version":3,"file":"vercel-ai-orchestrion-v6-subscriber.js","sources":["../../../src/vercel-ai/vercel-ai-orchestrion-v6-subscriber.ts"],"sourcesContent":["import type { Span } from '@sentry/core';\nimport { debug, getActiveSpan, 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 clearOperationCallId,\n clearOperationId,\n createSpanFromMessage,\n enrichSpanOnEnd,\n type VercelAiChannelMessage,\n type VercelAiChannelOptions,\n type VercelAiTracingChannelFactory,\n} from './vercel-ai-dc-subscriber';\n\n/**\n * 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`). v6 has 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 v6'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 v6 and v7.\n *\n * The model call (`languageModelCall` / `generate_content` span) has no\n * injectable definition in `ai`, so we instead wrap `resolveLanguageModel` (the\n * single chokepoint every model call flows through) and monkey-patch\n * `doGenerate`/`doStream` on the returned model.\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');\n\n/** A resolved model with our patch bookkeeping (idempotency flag). */\ntype PatchableModel = ResolvedModel & { [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>();\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(\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 = isRecord(data.arguments[0]) ? data.arguments[0] : {};\n const telemetry = isRecord(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 const callId = asString(message.event.callId);\n if (callId) {\n callIdBySpan.set(span, callId);\n }\n recordingBySpan.set(span, recording(telemetry));\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 },\n );\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 (!isRecord(ctx.result)) {\n return;\n }\n const model = ctx.result as PatchableModel;\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 if (!model[PATCHED]) {\n model[PATCHED] = true;\n patchModelMethod(model, 'doGenerate', options);\n patchModelMethod(model, 'doStream', options);\n }\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\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 = isRecord(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 tools: callArgs.tools,\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 // `doStream` resolves to `{ stream, ... }` before the stream is consumed; we end here (start/end\n // bracket the call) to match the channel timing.\n return result.then(value => {\n message.result = value;\n enrichSpanOnEnd(span, message, options);\n span.end();\n clearStreamCallId();\n return value;\n }, failSpan);\n } catch (error) {\n return failSpan(error);\n }\n };\n}\n\nfunction buildTextMessage(type: 'generateText' | 'streamText'): 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 // 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 return { recordInputs: telemetry.recordInputs, recordOutputs: telemetry.recordOutputs };\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 isRecord(model) ? asString(model[field]) : undefined;\n}\n\nfunction asString(value: unknown): string | undefined {\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n"],"names":["CHANNELS","DEBUG_BUILD","debug","tracingChannel","createSpanFromMessage","bindTracingChannelToSpan","enrichSpanOnEnd","clearOperationId","getActiveSpan","withActiveSpan","clearOperationCallId","SPAN_STATUS_ERROR"],"mappings":";;;;;;;;AAoDA,MAAM,OAAA,0BAAiB,4BAA4B,CAAA;AAMnD,IAAI,aAAA,GAAgB,CAAA;AACpB,SAAS,UAAA,GAAqB;AAC5B,EAAA,OAAO,CAAA,GAAA,EAAM,EAAE,aAAa,CAAA,CAAA;AAC9B;AAIA,MAAM,QAAA,uBAAe,OAAA,EAAwC;AAI7D,MAAM,cAAA,uBAAqB,OAAA,EAAc;AACzC,MAAM,YAAA,uBAAmB,OAAA,EAAsB;AAM/C,MAAM,eAAA,uBAAsB,OAAA,EAA4C;AAMxE,MAAM,mBAAA,uBAA0B,OAAA,EAAgB;AAEhD,IAAI,UAAA,GAAa,KAAA;AAWV,SAAS,oCAAA,CACd,cAAA,EACA,OAAA,GAAkC,EAAC,EAC7B;AACN,EAAA,IAAI,UAAA,EAAY;AACd,IAAA;AAAA,EACF;AACA,EAAA,UAAA,GAAa,IAAA;AAEb,EAAA,IAAI;AACF,IAAA,aAAA,CAAc,gBAAgBA,iBAAA,CAAS,uBAAA,EAAyB,gBAAA,CAAiB,cAAc,GAAG,OAAO,CAAA;AACzG,IAAA,aAAA,CAAc,gBAAgBA,iBAAA,CAAS,qBAAA,EAAuB,gBAAA,CAAiB,YAAY,GAAG,OAAO,CAAA;AACrG,IAAA,aAAA;AAAA,MACE,cAAA;AAAA,MACAA,iBAAA,CAAS,eAAA;AAAA,MACT,CAAC,aAAa,SAAA,MAAe;AAAA,QAC3B,IAA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AAA,CAAW,KAAA,EAAO,UAAU,GAAG,OAAA,EAAS,UAAA,CAAW,KAAA,EAAO,SAAS,CAAA,EAAE;AAC1F;AAEA,SAAS,UAAA,CAAW,OAAgB,KAAA,EAAmD;AACrF,EAAA,OAAO,SAAS,KAAK,CAAA,GAAI,SAAS,KAAA,CAAM,KAAK,CAAC,CAAA,GAAI,MAAA;AACpD;AAEA,SAAS,SAAS,KAAA,EAAoC;AACpD,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,GAAW,KAAA,GAAQ,MAAA;AAC7C;AAEA,SAAS,SAAS,KAAA,EAAkD;AAClE,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA;AAChD;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"vercel-ai-orchestrion-v6-subscriber.js","sources":["../../../src/vercel-ai/vercel-ai-orchestrion-v6-subscriber.ts"],"sourcesContent":["import type { Span } from '@sentry/core';\nimport { debug, getActiveSpan, 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 clearOperationCallId,\n clearOperationId,\n createSpanFromMessage,\n enrichSpanOnEnd,\n type VercelAiChannelMessage,\n type VercelAiChannelOptions,\n type VercelAiTracingChannelFactory,\n} from './vercel-ai-dc-subscriber';\n\n/**\n * 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`). v6 has 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 v6'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 v6 and v7.\n *\n * The model call (`languageModelCall` / `generate_content` span) has no\n * injectable definition in `ai`, so we instead wrap `resolveLanguageModel` (the\n * single chokepoint every model call flows through) and monkey-patch\n * `doGenerate`/`doStream` on the returned model.\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');\n\n/** A resolved model with our patch bookkeeping (idempotency flag). */\ntype PatchableModel = ResolvedModel & { [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>();\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(\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 = isRecord(data.arguments[0]) ? data.arguments[0] : {};\n const telemetry = isRecord(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 const callId = asString(message.event.callId);\n if (callId) {\n callIdBySpan.set(span, callId);\n }\n recordingBySpan.set(span, recording(telemetry));\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 },\n );\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 (!isRecord(ctx.result)) {\n return;\n }\n const model = ctx.result as PatchableModel;\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 if (!model[PATCHED]) {\n model[PATCHED] = true;\n patchModelMethod(model, 'doGenerate', options);\n patchModelMethod(model, 'doStream', options);\n }\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\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 = isRecord(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 tools: callArgs.tools,\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 // `doStream` resolves to `{ stream, ... }` before the stream is consumed; we end here (start/end\n // bracket the call) to match the channel timing.\n return result.then(value => {\n message.result = value;\n enrichSpanOnEnd(span, message, options);\n span.end();\n clearStreamCallId();\n return value;\n }, failSpan);\n } catch (error) {\n return failSpan(error);\n }\n };\n}\n\nfunction buildTextMessage(type: 'generateText' | 'streamText'): 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 // 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 return { recordInputs: telemetry.recordInputs, recordOutputs: telemetry.recordOutputs };\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 isRecord(model) ? asString(model[field]) : undefined;\n}\n\nfunction asString(value: unknown): string | undefined {\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n"],"names":[],"mappings":";;;;;;AAoDA,MAAM,OAAA,0BAAiB,4BAA4B,CAAA;AAMnD,IAAI,aAAA,GAAgB,CAAA;AACpB,SAAS,UAAA,GAAqB;AAC5B,EAAA,OAAO,CAAA,GAAA,EAAM,EAAE,aAAa,CAAA,CAAA;AA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