@sentry/server-utils 11.22.0 → 11.23.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 (241) hide show
  1. package/build/THIRD-PARTY-LICENSES.txt +10 -10
  2. package/build/cjs/chunks/config.js +2 -2
  3. package/build/cjs/chunks/config.js.map +1 -1
  4. package/build/cjs/chunks/core.js +0 -1
  5. package/build/cjs/chunks/exports.js +72 -27
  6. package/build/cjs/chunks/exports.js.map +1 -1
  7. package/build/cjs/chunks/module-details-from-path.js +427 -428
  8. package/build/cjs/chunks/module-details-from-path.js.map +1 -1
  9. package/build/cjs/chunks/moduleInjectedTransform.js +419 -421
  10. package/build/cjs/chunks/moduleInjectedTransform.js.map +1 -1
  11. package/build/cjs/chunks/rolldown-runtime.js +8 -6
  12. package/build/cjs/index.js +42 -25
  13. package/build/cjs/index.js.map +1 -1
  14. package/build/cjs/index.request-handler.js +2 -2
  15. package/build/cjs/orchestrion/bundler/bun.js +1 -1
  16. package/build/cjs/orchestrion/bundler/esbuild.js +1 -1
  17. package/build/cjs/orchestrion/bundler/rollup.js +1 -1
  18. package/build/cjs/orchestrion/bundler/vite.js +2 -2
  19. package/build/cjs/orchestrion/bundler/webpack-loader.js +2 -2
  20. package/build/cjs/orchestrion/bundler/webpack.js +4 -4
  21. package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/defineProperty.js +1 -1
  22. package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/assertClassBrand.js +1 -1
  23. package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/checkPrivateRedeclaration.js +1 -1
  24. package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/classPrivateFieldGet2.js +1 -1
  25. package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/classPrivateFieldInitSpec.js +1 -1
  26. package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/classPrivateFieldSet2.js +1 -1
  27. package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/classPrivateMethodInitSpec.js +1 -1
  28. package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/defineProperty.js +1 -1
  29. package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/toPrimitive.js +1 -1
  30. package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/toPropertyKey.js +1 -1
  31. package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/typeof.js +1 -1
  32. package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/toPrimitive.js +1 -1
  33. package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/toPropertyKey.js +1 -1
  34. package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/typeof.js +1 -1
  35. package/build/esm/_virtual/_rolldown/runtime.js +8 -6
  36. package/build/esm/ai/anthropic-ai/index.js +2 -2
  37. package/build/esm/ai/anthropic-ai/streaming.js +11 -2
  38. package/build/esm/ai/anthropic-ai/streaming.js.map +1 -1
  39. package/build/esm/ai/anthropic-ai/tool-runner.js +3 -3
  40. package/build/esm/ai/anthropic-ai/utils.js +2 -2
  41. package/build/esm/ai/core/span-hooks.js +1 -1
  42. package/build/esm/ai/core/time-to-first-chunk.js +1 -1
  43. package/build/esm/ai/core/utils.js +2 -2
  44. package/build/esm/ai/flue/index.js +2 -2
  45. package/build/esm/ai/flue/utils.js +2 -2
  46. package/build/esm/ai/google-genai/decisions.js +1 -1
  47. package/build/esm/ai/google-genai/index.js +2 -2
  48. package/build/esm/ai/google-genai/streaming.js +9 -2
  49. package/build/esm/ai/google-genai/streaming.js.map +1 -1
  50. package/build/esm/ai/google-genai/utils.js +1 -1
  51. package/build/esm/ai/langchain/embeddings.js +3 -3
  52. package/build/esm/ai/langchain/index.js +15 -9
  53. package/build/esm/ai/langchain/index.js.map +1 -1
  54. package/build/esm/ai/langchain/typesafe-classifier.js +2 -2
  55. package/build/esm/ai/langchain/utils.js +3 -4
  56. package/build/esm/ai/langchain/utils.js.map +1 -1
  57. package/build/esm/ai/langgraph/agent-span.js +3 -3
  58. package/build/esm/ai/langgraph/index.js +1 -1
  59. package/build/esm/ai/langgraph/stream.js +2 -2
  60. package/build/esm/ai/langgraph/utils.js +3 -3
  61. package/build/esm/ai/mastra/index.js +2 -2
  62. package/build/esm/ai/mastra/span-registry.js +1 -1
  63. package/build/esm/ai/mastra/utils.js +2 -2
  64. package/build/esm/ai/mistral/index.js +2 -2
  65. package/build/esm/ai/mistral/streaming.js +18 -9
  66. package/build/esm/ai/mistral/streaming.js.map +1 -1
  67. package/build/esm/ai/openai/index.js +2 -2
  68. package/build/esm/ai/openai/mapping.js +1 -1
  69. package/build/esm/ai/openai/streaming.js +15 -2
  70. package/build/esm/ai/openai/streaming.js.map +1 -1
  71. package/build/esm/ai/openai/utils.js +2 -2
  72. package/build/esm/ai/pi-ai/chat.js +12 -4
  73. package/build/esm/ai/pi-ai/chat.js.map +1 -1
  74. package/build/esm/ai/pi-ai/providers.js +1 -1
  75. package/build/esm/ai/pi-ai/recording.js +1 -1
  76. package/build/esm/ai/pi-durable/index.js +2 -2
  77. package/build/esm/ai/pi-durable/runs.js +3 -3
  78. package/build/esm/ai/pi-durable/tools.js +3 -3
  79. package/build/esm/ai/tanstack-ai/index.js +2 -2
  80. package/build/esm/ai/tanstack-ai/utils.js +2 -2
  81. package/build/esm/ai/typesafe/index.js +3 -3
  82. package/build/esm/ai/workers-ai/index.js +2 -2
  83. package/build/esm/ai/workers-ai/streaming.js +7 -5
  84. package/build/esm/ai/workers-ai/streaming.js.map +1 -1
  85. package/build/esm/ai/workers-ai/utils.js +3 -3
  86. package/build/esm/async-context.js +1 -1
  87. package/build/esm/cron/common.js +1 -1
  88. package/build/esm/cron/cron.js +1 -1
  89. package/build/esm/cron/node-cron.js +1 -1
  90. package/build/esm/cron/node-schedule.js +1 -1
  91. package/build/esm/eve.js +1 -1
  92. package/build/esm/integrations/amqplib.js +3 -3
  93. package/build/esm/integrations/anthropic.js +3 -4
  94. package/build/esm/integrations/anthropic.js.map +1 -1
  95. package/build/esm/integrations/aws-sdk/index.js +3 -3
  96. package/build/esm/integrations/aws-sdk/services/MessageAttributes.js +1 -1
  97. package/build/esm/integrations/aws-sdk/services/bedrock-runtime-content.js +2 -2
  98. package/build/esm/integrations/aws-sdk/services/bedrock-runtime.js +3 -3
  99. package/build/esm/integrations/aws-sdk/services/dynamodb.js +1 -1
  100. package/build/esm/integrations/aws-sdk/services/lambda.js +2 -2
  101. package/build/esm/integrations/aws-sdk/services/sns.js +3 -3
  102. package/build/esm/integrations/aws-sdk/services/sqs.js +2 -2
  103. package/build/esm/integrations/bullmq/meter.js +2 -2
  104. package/build/esm/integrations/bullmq/tracer.js +2 -2
  105. package/build/esm/integrations/clickhouse.js +3 -3
  106. package/build/esm/integrations/cron.js +1 -1
  107. package/build/esm/integrations/dataloader.js +3 -3
  108. package/build/esm/integrations/express/error-handler.js +1 -1
  109. package/build/esm/integrations/express/index.js +1 -1
  110. package/build/esm/integrations/express/instrumentation.js +3 -3
  111. package/build/esm/integrations/fastify/errors.js +1 -1
  112. package/build/esm/integrations/fastify/index.js +1 -1
  113. package/build/esm/integrations/fastify/instrumentation.js +3 -3
  114. package/build/esm/integrations/firebase/firestore.js +2 -2
  115. package/build/esm/integrations/firebase/functions.js +1 -1
  116. package/build/esm/integrations/firebase/index.js +1 -1
  117. package/build/esm/integrations/flue.js +1 -1
  118. package/build/esm/integrations/generic-pool.js +3 -3
  119. package/build/esm/integrations/google-genai.js +2 -2
  120. package/build/esm/integrations/graphql/graphql-dc-subscriber.js +3 -3
  121. package/build/esm/integrations/graphql/index.js +1 -1
  122. package/build/esm/integrations/graphql/resolvers.js +2 -2
  123. package/build/esm/integrations/graphql/spans.js +3 -3
  124. package/build/esm/integrations/groq.js +1 -1
  125. package/build/esm/integrations/hapi/hapi-error-handler.js +1 -1
  126. package/build/esm/integrations/hapi/hapi-utils.js +4 -5
  127. package/build/esm/integrations/hapi/hapi-utils.js.map +1 -1
  128. package/build/esm/integrations/hapi/index.js +1 -1
  129. package/build/esm/integrations/hono/applyPatches.js +1 -1
  130. package/build/esm/integrations/hono/createHonoMiddleware.js +1 -1
  131. package/build/esm/integrations/hono/honoIntegration.js +3 -3
  132. package/build/esm/integrations/hono/matchResult.js +1 -1
  133. package/build/esm/integrations/hono/middlewareHandlers.js +2 -2
  134. package/build/esm/integrations/hono/patchAppRequest.js +3 -3
  135. package/build/esm/integrations/hono/patchAppUse.js +1 -1
  136. package/build/esm/integrations/hono/patchRoute.js +1 -1
  137. package/build/esm/integrations/hono/wrapMiddlewareSpan.js +3 -3
  138. package/build/esm/integrations/kafkajs/consumer.js +2 -2
  139. package/build/esm/integrations/kafkajs/index.js +1 -1
  140. package/build/esm/integrations/kafkajs/spans.js +2 -2
  141. package/build/esm/integrations/knex.js +3 -3
  142. package/build/esm/integrations/koa/index.js +3 -3
  143. package/build/esm/integrations/langchain.js +1 -1
  144. package/build/esm/integrations/langgraph.js +1 -1
  145. package/build/esm/integrations/lru-memoizer.js +1 -1
  146. package/build/esm/integrations/mastra-classifier.js +2 -2
  147. package/build/esm/integrations/mastra.js +4 -4
  148. package/build/esm/integrations/mcp-server.js +2 -2
  149. package/build/esm/integrations/mistral.js +2 -2
  150. package/build/esm/integrations/mongodb/index.js +1 -1
  151. package/build/esm/integrations/mongodb/mongodb-span.js +1 -1
  152. package/build/esm/integrations/mongoose/index.js +1 -1
  153. package/build/esm/integrations/mongoose/mongoose-dc-subscriber.js +3 -3
  154. package/build/esm/integrations/mongoose/mongoose-legacy-span.js +1 -1
  155. package/build/esm/integrations/mysql.js +3 -3
  156. package/build/esm/integrations/mysql2/index.js +1 -1
  157. package/build/esm/integrations/mysql2/mysql2-dc-subscriber.js +3 -3
  158. package/build/esm/integrations/neon.js +3 -3
  159. package/build/esm/integrations/nitro/captureStorageEvents.js +3 -3
  160. package/build/esm/integrations/nitro/captureTracingEvents.js +3 -3
  161. package/build/esm/integrations/nitro/index.js +1 -1
  162. package/build/esm/integrations/nitro/setServerTimingHeaders.js +1 -1
  163. package/build/esm/integrations/node-cron.js +1 -1
  164. package/build/esm/integrations/node-schedule.js +1 -1
  165. package/build/esm/integrations/openai-compatible.js +2 -2
  166. package/build/esm/integrations/openai.js +2 -2
  167. package/build/esm/integrations/pg.js +3 -3
  168. package/build/esm/integrations/pi-ai.js +1 -1
  169. package/build/esm/integrations/pi-durable.js +1 -1
  170. package/build/esm/integrations/pino.js +1 -1
  171. package/build/esm/integrations/postgresjs/index.js +3 -3
  172. package/build/esm/integrations/postgresjs/postgresjs-dc-subscriber.js +3 -3
  173. package/build/esm/integrations/postgresjs-wrapper.js +1 -1
  174. package/build/esm/integrations/prisma/index.js +1 -1
  175. package/build/esm/integrations/prisma/orchestrion.js +8 -12
  176. package/build/esm/integrations/prisma/orchestrion.js.map +1 -1
  177. package/build/esm/integrations/prisma/tracing-helper.js +2 -2
  178. package/build/esm/integrations/redis/index.js +3 -3
  179. package/build/esm/integrations/redis/ioredis-channel-subscriber.js +3 -3
  180. package/build/esm/integrations/redis/redis-cache.js +1 -1
  181. package/build/esm/integrations/redis/redis-dc-subscriber.js +3 -3
  182. package/build/esm/integrations/serveTunnel.js +2 -2
  183. package/build/esm/integrations/tanstack-ai.js +1 -1
  184. package/build/esm/integrations/tedious.js +4 -4
  185. package/build/esm/integrations/together-ai.js +1 -1
  186. package/build/esm/integrations/typesafe.js +1 -1
  187. package/build/esm/integrations/vercel-ai/extract.js +1 -1
  188. package/build/esm/integrations/vercel-ai/index.js +1 -1
  189. package/build/esm/integrations/vercel-ai/util.js +21 -2
  190. package/build/esm/integrations/vercel-ai/util.js.map +1 -1
  191. package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js +3 -3
  192. package/build/esm/integrations/vercel-ai/vercel-ai-orchestrion-subscriber.js +1 -1
  193. package/build/esm/integrations/vercel-ai/vercel-ai-tool-telemetry.js +3 -3
  194. package/build/esm/integrations/winston.js +1 -1
  195. package/build/esm/opentelemetry.js +1 -1
  196. package/build/esm/orchestrion/bundler/esbuild.js +1 -1
  197. package/build/esm/orchestrion/bundler/externalRequire.js +1 -1
  198. package/build/esm/orchestrion/bundler/rollup.js +1 -1
  199. package/build/esm/orchestrion/bundler/webpack-loader.js +1 -1
  200. package/build/esm/orchestrion/bundler/webpack.js +1 -1
  201. package/build/esm/orchestrion/config/index.js +1 -1
  202. package/build/esm/orchestrion/config/mistral.js +1 -1
  203. package/build/esm/orchestrion/config/mistral.js.map +1 -1
  204. package/build/esm/orchestrion/detect.js +1 -1
  205. package/build/esm/orchestrion/instrumentation.js +1 -1
  206. package/build/esm/package.json +1 -1
  207. package/build/esm/tracing-channel.js +1 -2
  208. package/build/esm/tracing-channel.js.map +1 -1
  209. package/build/esm/utils/cronMonitoring.js +1 -1
  210. package/build/esm/utils/diagnosticsChannel.js +1 -1
  211. package/build/esm/utils/module.js +2 -2
  212. package/build/esm/utils/module.js.map +1 -1
  213. package/build/esm/utils/monitorStream.js +1 -1
  214. package/build/esm/utils/serverTimingTraceHeader.js +1 -1
  215. package/build/esm/utils/tunnelServer.js +1 -1
  216. package/build/esm/utils/wrapServerRequestHandler.js +4 -4
  217. package/build/esm/vendored/@apm-js-collab/code-transformer/lib/matcher.js +3 -3
  218. package/build/esm/vendored/@apm-js-collab/code-transformer/lib/transformer.js +5 -5
  219. package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/core-BiWIBBjf.js +1 -1
  220. package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/webpack-loader-factory.js +1 -1
  221. package/build/esm/vendored/esquery/dist/esquery.min.js +1 -0
  222. package/build/esm/vendored/esquery/dist/esquery.min.js.map +1 -1
  223. package/build/esm/vendored/meriyah/dist/meriyah.js +416 -418
  224. package/build/esm/vendored/meriyah/dist/meriyah.js.map +1 -1
  225. package/build/esm/vendored/meriyah/dist/meriyah2.js +416 -418
  226. package/build/esm/vendored/meriyah/dist/meriyah2.js.map +1 -1
  227. package/build/esm/vendored/source-map/lib/base64-vlq.js +1 -1
  228. package/build/esm/vendored/source-map/lib/base64-vlq.js.map +1 -1
  229. package/build/types/ai/anthropic-ai/streaming.d.ts.map +1 -1
  230. package/build/types/ai/anthropic-ai/types.d.ts +1 -0
  231. package/build/types/ai/anthropic-ai/types.d.ts.map +1 -1
  232. package/build/types/ai/google-genai/streaming.d.ts.map +1 -1
  233. package/build/types/ai/langchain/index.d.ts.map +1 -1
  234. package/build/types/ai/mistral/streaming.d.ts.map +1 -1
  235. package/build/types/ai/openai/streaming.d.ts.map +1 -1
  236. package/build/types/ai/pi-ai/chat.d.ts.map +1 -1
  237. package/build/types/ai/workers-ai/streaming.d.ts.map +1 -1
  238. package/build/types/integrations/vercel-ai/util.d.ts.map +1 -1
  239. package/build/types/orchestrion/config/mistral.d.ts +3 -3
  240. package/build/types/tracing-channel.d.ts.map +1 -1
  241. package/package.json +3 -3
@@ -15,12 +15,14 @@ var __esmMin = (fn, res, err) => () => {
15
15
  };
16
16
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
17
17
  var __copyProps = (to, from, except, desc) => {
18
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
19
- key = keys[i];
20
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
21
- get: ((k) => from[k]).bind(null, key),
22
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
23
- });
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
20
+ desc = __getOwnPropDesc(from, key);
21
+ __defProp(to, key, {
22
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
23
+ enumerable: !desc || desc.enumerable
24
+ });
25
+ }
24
26
  }
25
27
  return to;
26
28
  };
@@ -1,21 +1,21 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./chunks/rolldown-runtime.js");
3
3
  const require_exports = require("./chunks/exports.js");
4
+ let _sentry_core = require("@sentry/core");
4
5
  const require_debug_build = require("./chunks/debug-build.js");
5
- const require_config = require("./chunks/config.js");
6
- const require_pi_ai = require("./chunks/pi-ai.js");
7
6
  let _sentry_conventions_attributes = require("@sentry/conventions/attributes");
8
- let _sentry_core = require("@sentry/core");
9
7
  let _sentry_conventions_op = require("@sentry/conventions/op");
10
- let _sentry_core_server = require("@sentry/core/server");
11
8
  let node_diagnostics_channel = require("node:diagnostics_channel");
12
- node_diagnostics_channel = require_rolldown_runtime.__toESM(node_diagnostics_channel);
9
+ const require_config = require("./chunks/config.js");
10
+ const require_pi_ai = require("./chunks/pi-ai.js");
13
11
  let _sentry_conventions_metrics = require("@sentry/conventions/metrics");
14
12
  let node_module = require("node:module");
15
13
  let node_path = require("node:path");
16
14
  let node_url = require("node:url");
15
+ let _sentry_core_server = require("@sentry/core/server");
17
16
  let node_events = require("node:events");
18
17
  let node_net = require("node:net");
18
+ node_diagnostics_channel = require_rolldown_runtime.__toESM(node_diagnostics_channel);
19
19
  node_net = require_rolldown_runtime.__toESM(node_net);
20
20
  // src/integrations/koa/koa-error-handler.ts
21
21
  const ERROR_HANDLER_ATTACHED = "__SENTRY_KOA_ERROR_HANDLER_ATTACHED__";
@@ -260,8 +260,7 @@ function wrapExtArguments(args, pluginName) {
260
260
  return;
261
261
  } else if (isDirectExtInput(args)) {
262
262
  const extInput = args;
263
- const method = extInput[1];
264
- args[1] = wrapExtMethods(method, extInput[0], pluginName);
263
+ args[1] = wrapExtMethods(extInput[1], extInput[0], pluginName);
265
264
  return;
266
265
  } else if (isLifecycleExtEventObj(args[0])) {
267
266
  const lifecycleEventObj = args[0];
@@ -460,7 +459,6 @@ function getErrorInfo(error) {
460
459
  };
461
460
  }
462
461
  function getStoreWithActiveSpan(asyncLocalStorage, span) {
463
- if ((0, _sentry_core.spanIsIgnored)(span) && (0, _sentry_core.getRootSpan)(span) !== span) return asyncLocalStorage.getStore();
464
462
  return (0, _sentry_core.withActiveSpan)(span, () => {
465
463
  return asyncLocalStorage.getStore();
466
464
  });
@@ -1300,7 +1298,7 @@ function patchConsumption(result, span, end) {
1300
1298
  const toArray = result.toArray;
1301
1299
  const asyncIterator = result[Symbol.asyncIterator];
1302
1300
  const patchedToArray = function() {
1303
- return runUnderSpan(span, () => toArray.call(this)).then((value) => {
1301
+ return (0, _sentry_core.withActiveSpan)(span, () => toArray.call(this)).then((value) => {
1304
1302
  end();
1305
1303
  return value;
1306
1304
  }, (error) => {
@@ -1309,16 +1307,12 @@ function patchConsumption(result, span, end) {
1309
1307
  });
1310
1308
  };
1311
1309
  const patchedAsyncIterator = function() {
1312
- return wrapIterator(runUnderSpan(span, () => asyncIterator.call(this)), span, end);
1310
+ return wrapIterator((0, _sentry_core.withActiveSpan)(span, () => asyncIterator.call(this)), span, end);
1313
1311
  };
1314
1312
  result.toArray = patchedToArray;
1315
1313
  result[Symbol.asyncIterator] = patchedAsyncIterator;
1316
1314
  return true;
1317
1315
  }
1318
- function runUnderSpan(span, callback) {
1319
- if ((0, _sentry_core.spanIsIgnored)(span) && (0, _sentry_core.getRootSpan)(span) !== span) return callback();
1320
- return (0, _sentry_core.withActiveSpan)(span, callback);
1321
- }
1322
1316
  function wrapIterator(iterator, span, end) {
1323
1317
  const settle = (step) => step.then((result) => {
1324
1318
  if (result.done) end();
@@ -1328,7 +1322,7 @@ function wrapIterator(iterator, span, end) {
1328
1322
  throw error;
1329
1323
  });
1330
1324
  return {
1331
- next: (...args) => settle(runUnderSpan(span, () => iterator.next(...args))),
1325
+ next: (...args) => settle((0, _sentry_core.withActiveSpan)(span, () => iterator.next(...args))),
1332
1326
  return: (value) => {
1333
1327
  const iteratorReturn = iterator.return?.bind(iterator);
1334
1328
  if (!iteratorReturn) {
@@ -1338,7 +1332,7 @@ function wrapIterator(iterator, span, end) {
1338
1332
  value
1339
1333
  });
1340
1334
  }
1341
- return settle(runUnderSpan(span, () => iteratorReturn(value)));
1335
+ return settle((0, _sentry_core.withActiveSpan)(span, () => iteratorReturn(value)));
1342
1336
  },
1343
1337
  throw: (error) => {
1344
1338
  const iteratorThrow = iterator.throw?.bind(iterator);
@@ -1346,7 +1340,7 @@ function wrapIterator(iterator, span, end) {
1346
1340
  end(error);
1347
1341
  return Promise.reject(error);
1348
1342
  }
1349
- return settle(runUnderSpan(span, () => iteratorThrow(error)));
1343
+ return settle((0, _sentry_core.withActiveSpan)(span, () => iteratorThrow(error)));
1350
1344
  },
1351
1345
  [Symbol.asyncIterator]() {
1352
1346
  return this;
@@ -1953,8 +1947,7 @@ function instrumentAnthropic(options) {
1953
1947
  function createGenAiSpan$4(data, operation, options, stream) {
1954
1948
  const args = data.arguments ?? [];
1955
1949
  if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$32)) return;
1956
- const requestOptions = args[1];
1957
- if (isStreamHelperRequest(requestOptions?.headers) && isInsideStreamHelperSpan()) return;
1950
+ if (isStreamHelperRequest(args[1]?.headers) && isInsideStreamHelperSpan()) return;
1958
1951
  const params = typeof args[0] === "object" && args[0] !== null ? args[0] : void 0;
1959
1952
  const call = {
1960
1953
  operation,
@@ -3619,10 +3612,7 @@ function beforeSchedule(change, options) {
3619
3612
  * keeps runs from an earlier spec, the job doesn't check in.
3620
3613
  */
3621
3614
  function onSchedule(change) {
3622
- if (change.result === true) {
3623
- const job = change.self;
3624
- updateMonitorConfig(job?.job, addsToPendingRuns.has(change) ? void 0 : getMonitorConfig(change.arguments[0]));
3625
- }
3615
+ if (change.result === true) updateMonitorConfig(change.self?.job, addsToPendingRuns.has(change) ? void 0 : getMonitorConfig(change.arguments[0]));
3626
3616
  }
3627
3617
  /** Whether node-schedule runs a job with this spec once: a `Date`, a timestamp, or a date string. */
3628
3618
  function isOneOffSpec(spec) {
@@ -6365,6 +6355,14 @@ function getRequestContentAttributes(context) {
6365
6355
  };
6366
6356
  }
6367
6357
  /**
6358
+ * Whether an event carries new model output. `start`, empty `*_start`, `*_end` and `done` events do not.
6359
+ */
6360
+ function hasOutput$1(event) {
6361
+ const { type, delta } = event ?? {};
6362
+ if (type === "text_delta" || type === "thinking_delta" || type === "toolcall_delta") return !!delta;
6363
+ return type === "toolcall_start";
6364
+ }
6365
+ /**
6368
6366
  * Records `gen_ai.response.time_to_first_chunk` for a streamed request. The stream has one consumer,
6369
6367
  * so instead of reading it, this wraps `push`, which the provider calls for each event as it decodes
6370
6368
  * it. The wrapper is removed after the first chunk.
@@ -6373,7 +6371,7 @@ function observePiAiFirstChunk(span, events) {
6373
6371
  const push = events?.push;
6374
6372
  if (!events || typeof push !== "function") return;
6375
6373
  events.push = function(event) {
6376
- if (event?.type !== "start") {
6374
+ if (hasOutput$1(event)) {
6377
6375
  require_exports.recordTimeToFirstChunk(span);
6378
6376
  events.push = push;
6379
6377
  }
@@ -9660,7 +9658,7 @@ function tapModelCallStream(span, stream, onFinal, onError) {
9660
9658
  controller.close();
9661
9659
  return;
9662
9660
  }
9663
- if (value?.type !== "stream-start") require_exports.recordTimeToFirstChunk(span);
9661
+ if (hasOutput(value)) require_exports.recordTimeToFirstChunk(span);
9664
9662
  text += accumulateChunk(state, value) ?? "";
9665
9663
  controller.enqueue(value);
9666
9664
  } catch (error) {
@@ -9675,6 +9673,25 @@ function tapModelCallStream(span, stream, onFinal, onError) {
9675
9673
  });
9676
9674
  }
9677
9675
  /**
9676
+ * Whether a chunk carries new model output, which is what `gen_ai.response.time_to_first_chunk` measures.
9677
+ * `stream-start`, `response-metadata`, empty `*-start` and `finish` chunks do not.
9678
+ */
9679
+ function hasOutput(chunk) {
9680
+ if (!(0, _sentry_core.isObjectLike)(chunk)) return false;
9681
+ const { type, delta, textDelta, argsTextDelta } = chunk;
9682
+ switch (type) {
9683
+ case "text-delta":
9684
+ case "reasoning-delta":
9685
+ case "tool-input-delta": return !!(delta ?? textDelta);
9686
+ case "reasoning": return !!textDelta;
9687
+ case "tool-call-delta": return !!argsTextDelta;
9688
+ case "tool-input-start":
9689
+ case "tool-call":
9690
+ case "file": return true;
9691
+ default: return false;
9692
+ }
9693
+ }
9694
+ /**
9678
9695
  * Fold a single streamed chunk into the running aggregate. Returns any text delta so the caller can
9679
9696
  * accumulate it (kept out of `state` until the end to avoid re-joining on every chunk).
9680
9697
  */