@sentry/server-utils 11.20.0 → 11.22.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 (66) hide show
  1. package/build/cjs/chunks/config.js +30 -0
  2. package/build/cjs/chunks/config.js.map +1 -1
  3. package/build/cjs/chunks/exports.js +10 -1
  4. package/build/cjs/chunks/exports.js.map +1 -1
  5. package/build/cjs/index.js +381 -16
  6. package/build/cjs/index.js.map +1 -1
  7. package/build/esm/ai/tanstack-ai/constants.js +11 -0
  8. package/build/esm/ai/tanstack-ai/constants.js.map +1 -0
  9. package/build/esm/ai/tanstack-ai/index.js +206 -0
  10. package/build/esm/ai/tanstack-ai/index.js.map +1 -0
  11. package/build/esm/ai/tanstack-ai/utils.js +81 -0
  12. package/build/esm/ai/tanstack-ai/utils.js.map +1 -0
  13. package/build/esm/ai/workers-ai/utils.js +4 -1
  14. package/build/esm/ai/workers-ai/utils.js.map +1 -1
  15. package/build/esm/index.js +2 -1
  16. package/build/esm/index.js.map +1 -1
  17. package/build/esm/integrations/fastify/instrumentation.js +5 -1
  18. package/build/esm/integrations/fastify/instrumentation.js.map +1 -1
  19. package/build/esm/integrations/neon.js +10 -2
  20. package/build/esm/integrations/neon.js.map +1 -1
  21. package/build/esm/integrations/pg.js +41 -14
  22. package/build/esm/integrations/pg.js.map +1 -1
  23. package/build/esm/integrations/pino.js.map +1 -1
  24. package/build/esm/integrations/tanstack-ai.js +59 -0
  25. package/build/esm/integrations/tanstack-ai.js.map +1 -0
  26. package/build/esm/integrations/vercel-ai/extract.js +2 -3
  27. package/build/esm/integrations/vercel-ai/extract.js.map +1 -1
  28. package/build/esm/orchestrion/channels.js +2 -0
  29. package/build/esm/orchestrion/channels.js.map +1 -1
  30. package/build/esm/orchestrion/config/index.js +2 -0
  31. package/build/esm/orchestrion/config/index.js.map +1 -1
  32. package/build/esm/orchestrion/config/prisma.js +2 -0
  33. package/build/esm/orchestrion/config/prisma.js.map +1 -1
  34. package/build/esm/orchestrion/config/tanstack-ai.js +19 -0
  35. package/build/esm/orchestrion/config/tanstack-ai.js.map +1 -0
  36. package/build/esm/package.json +1 -1
  37. package/build/esm/tracing-channel.js.map +1 -1
  38. package/build/types/ai/tanstack-ai/constants.d.ts +8 -0
  39. package/build/types/ai/tanstack-ai/constants.d.ts.map +1 -0
  40. package/build/types/ai/tanstack-ai/index.d.ts +18 -0
  41. package/build/types/ai/tanstack-ai/index.d.ts.map +1 -0
  42. package/build/types/ai/tanstack-ai/types.d.ts +127 -0
  43. package/build/types/ai/tanstack-ai/types.d.ts.map +1 -0
  44. package/build/types/ai/tanstack-ai/utils.d.ts +21 -0
  45. package/build/types/ai/tanstack-ai/utils.d.ts.map +1 -0
  46. package/build/types/ai/workers-ai/utils.d.ts.map +1 -1
  47. package/build/types/index.d.ts +2 -0
  48. package/build/types/index.d.ts.map +1 -1
  49. package/build/types/integrations/fastify/instrumentation.d.ts.map +1 -1
  50. package/build/types/integrations/neon.d.ts.map +1 -1
  51. package/build/types/integrations/pg.d.ts +6 -1
  52. package/build/types/integrations/pg.d.ts.map +1 -1
  53. package/build/types/integrations/pino.d.ts.map +1 -1
  54. package/build/types/integrations/tanstack-ai.d.ts +18 -0
  55. package/build/types/integrations/tanstack-ai.d.ts.map +1 -0
  56. package/build/types/integrations/vercel-ai/extract.d.ts +2 -5
  57. package/build/types/integrations/vercel-ai/extract.d.ts.map +1 -1
  58. package/build/types/orchestrion/channels.d.ts +2 -0
  59. package/build/types/orchestrion/channels.d.ts.map +1 -1
  60. package/build/types/orchestrion/config/index.d.ts.map +1 -1
  61. package/build/types/orchestrion/config/prisma.d.ts +2 -1
  62. package/build/types/orchestrion/config/prisma.d.ts.map +1 -1
  63. package/build/types/orchestrion/config/tanstack-ai.d.ts +17 -0
  64. package/build/types/orchestrion/config/tanstack-ai.d.ts.map +1 -0
  65. package/build/types/tracing-channel.d.ts.map +1 -1
  66. package/package.json +4 -4
@@ -0,0 +1,19 @@
1
+ import { getModuleNames } from "./module-names.js";
2
+ // src/orchestrion/config/tanstack-ai.ts
3
+ const tanstackAiConfig = [{
4
+ channelName: "chat",
5
+ module: {
6
+ name: "@tanstack/ai",
7
+ versionRange: ">=1.0.0 <2.0.0",
8
+ filePath: "dist/esm/activities/chat/index.js"
9
+ },
10
+ functionQuery: {
11
+ functionName: "chat",
12
+ kind: "Sync"
13
+ }
14
+ }];
15
+ const tanstackAiModuleNames = getModuleNames(tanstackAiConfig);
16
+ const tanstackAiChannels = { TANSTACK_AI_CHAT: "orchestrion:@tanstack/ai:chat" };
17
+ export { tanstackAiChannels, tanstackAiConfig, tanstackAiModuleNames };
18
+
19
+ //# sourceMappingURL=tanstack-ai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tanstack-ai.js","names":[],"sources":["../../../../src/orchestrion/config/tanstack-ai.ts"],"sourcesContent":["import type { InstrumentationConfig } from '../apmTypes';\nimport { getModuleNames } from './module-names';\n\n// `chat()` takes its middleware per call, and `@tanstack/ai` has no global middleware registry, so\n// the integration changes the options of each call. `chat` returns a stream or a promise, depending\n// on `stream`, but it runs nothing before it returns, so `Sync` is enough: we only need `start`.\nexport const tanstackAiConfig = [\n {\n channelName: 'chat',\n module: { name: '@tanstack/ai', versionRange: '>=1.0.0 <2.0.0', filePath: 'dist/esm/activities/chat/index.js' },\n functionQuery: { functionName: 'chat', kind: 'Sync' },\n },\n] satisfies InstrumentationConfig[];\n\nexport const tanstackAiModuleNames = getModuleNames(tanstackAiConfig);\n\nexport const tanstackAiChannels = {\n TANSTACK_AI_CHAT: 'orchestrion:@tanstack/ai:chat',\n} as const;\n"],"mappings":";;AAMA,MAAa,mBAAmB,CAC9B;CACE,aAAa;CACb,QAAQ;EAAE,MAAM;EAAgB,cAAc;EAAkB,UAAU;CAAoC;CAC9G,eAAe;EAAE,cAAc;EAAQ,MAAM;CAAO;AACtD,CACF;AAEA,MAAa,wBAAwB,eAAe,gBAAgB;AAEpE,MAAa,qBAAqB,EAChC,kBAAkB,gCACpB"}
@@ -1 +1 @@
1
- {"type":"module","version":"11.20.0","sideEffects":false}
1
+ {"type":"module","version":"11.22.0","sideEffects":false}
@@ -1 +1 @@
1
- {"version":3,"file":"tracing-channel.js","names":[],"sources":["../../src/tracing-channel.ts"],"sourcesContent":["import type { TracingChannel, TracingChannelSubscribers } from 'node:diagnostics_channel';\nimport type { AsyncLocalStorage } from 'node:async_hooks';\nimport type { ExclusiveEventHintOrCaptureContext, Span } from '@sentry/core';\nimport {\n debug,\n captureException,\n isObjectLike,\n SPAN_STATUS_ERROR,\n getAsyncContextStrategy,\n getMainCarrier,\n spanIsIgnored,\n getRootSpan,\n withActiveSpan,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build';\nimport { ERROR_TYPE } from '@sentry/conventions/attributes';\n\nexport type TracingChannelPayloadWithSpan<TData extends object> = TData & {\n /**\n * The current active span for the traced call.\n */\n _sentrySpan?: Span;\n\n /**\n * The context's active store value, used to restore the context for asyncStart continuations for callback-based tracing.\n */\n _sentryCallerStore?: unknown;\n\n /** Set by Node's tracing channel when the traced operation failed. */\n error?: unknown;\n};\n\n/*\n * A type patch so that we don't have to handle all subscription types.\n */\nexport interface SentryTracingChannel<TData extends object = object> extends Omit<\n TracingChannel<TData, TracingChannelPayloadWithSpan<TData>>,\n 'subscribe' | 'unsubscribe'\n> {\n subscribe(subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>>): void;\n unsubscribe(subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>>): void;\n}\n\nexport interface TracingChannelLifeCycleOptions<TData extends object = object> {\n /**\n * Invoked with the span and the channel context object once the traced operation completes\n * Use it to enrich the span from the result/error (branch on `'error' in data` / `'result' in data`) or to run cleanup.\n */\n beforeSpanEnd?: (span: Span, data: TracingChannelPayloadWithSpan<TData>) => void;\n\n /**\n * Whether a thrown error is captured as a Sentry event. The span is always marked with error status regardless. Defaults to `false`.\n * You can alternatively pass a function that sets the ExclusiveEventHintOrCaptureContext on the captured error.\n * Set `true` for instrumentations that own the error boundary, (e.g: route handlers)\n * For database drivers, it is not recommended to set this at all.\n */\n captureError?: boolean | ((e: unknown) => ExclusiveEventHintOrCaptureContext);\n\n /**\n * Take ownership of *when* the span ends: return `true` and the helper won't end it on\n * `end`/`asyncEnd`. For results that settle out-of-band — e.g. a streamed `EventEmitter` that\n * completes via its own `'end'`/`'error'` events.\n *\n * Call `end` when it settles — `end()` on success, `end(error)` on failure. `end` owns *how* the span\n * ends (error status/attributes, `captureError`, `beforeSpanEnd`) and is idempotent. Default `false`\n * lets the helper end the span as usual.\n */\n deferSpanEnd?: (args: {\n span: Span;\n data: TracingChannelPayloadWithSpan<TData>;\n /** Ends the span: `end()` on success, `end(error)` on failure (which marks `data` as errored). Idempotent. */\n end: (error?: unknown) => void;\n }) => boolean;\n}\n\n/** Returned by {@link bindTracingChannelToSpan}: the bound channel plus a teardown handle. */\nexport interface TracingChannelBindingHandle<TData extends object = object> {\n /**\n * The tracing channel with the span bound into async context.\n */\n channel: SentryTracingChannel<TData>;\n\n /**\n * Tears down the binding: unsubscribes lifecycle handlers, when present, and unbinds the start store.\n * Idempotent, and a no-op when no async context binding was available.\n */\n unbind: () => void;\n}\n\nconst NOOP = (): void => {};\n\n/** Runs a span-building callback so a throw inside it can never break the user's traced call. */\nexport function safeChannelCallback<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch (error) {\n DEBUG_BUILD && debug.warn('[instrumentation] error handling channel event', error);\n return undefined;\n }\n}\n\n/**\n * Bind a span and its lifecycle to a tracing channel so the span becomes the active async context\n * for the traced operation and is ended when the operation completes.\n *\n * `getSpan` may return `undefined` to opt a payload out entirely: nothing is bound, no span is\n * tracked, and the active context is left untouched. Use it for events that ride the same channel\n * but should reuse the enclosing span instead of opening (and ending) their own — e.g. an agent\n * loop's per-step events, where ending a freshly opened span would close the parent prematurely.\n */\nexport function bindTracingChannelToSpan<TData extends object>(\n channel: TracingChannel<TData, TData>,\n getSpan: (data: TracingChannelPayloadWithSpan<TData>) => Span | undefined,\n opts?: TracingChannelLifeCycleOptions<TData>,\n): TracingChannelBindingHandle<TData> {\n const handle = bindSpanToChannelStore(channel, getSpan);\n\n const beforeSpanEnd = opts?.beforeSpanEnd;\n const deferSpanEnd = opts?.deferSpanEnd;\n const getErrorHint = (e: unknown): ExclusiveEventHintOrCaptureContext => {\n if (typeof opts?.captureError === 'function') {\n return opts.captureError(e);\n }\n\n return {\n mechanism: {\n type: 'auto.diagnostic_channels.bind_span',\n handled: false,\n },\n };\n };\n\n // Apply Sentry error status + attributes (and capture, if configured) to a span. Shared by the\n // channel `error` lifecycle and the deferred `end` util so the two can't drift.\n const annotateSpanError = (span: Span, error: unknown): void => {\n if (opts?.captureError) {\n captureException(error, getErrorHint(error));\n }\n\n const { message, attributes } = getErrorInfo(error);\n span.setStatus({ code: SPAN_STATUS_ERROR, message });\n span.setAttributes(attributes);\n };\n\n // Creates an end fn for deferred handlers to use, ensures consistent span end behavior\n const makeDeferredEnd = (span: Span, data: TracingChannelPayloadWithSpan<TData>) => {\n let ended = false;\n\n return (error?: unknown): void => {\n if (ended) {\n return;\n }\n\n ended = true;\n if (error !== undefined) {\n annotateSpanError(span, error);\n // Without this the payload still looks successful, so `beforeSpanEnd` enriches the span from\n // a `result` the operation never produced.\n data.error = error;\n }\n\n endBoundSpan(data, beforeSpanEnd);\n };\n };\n\n const subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>> = {\n start: NOOP,\n asyncStart: NOOP,\n end(data) {\n // The operation settled synchronously (returned or threw)\n // Presence checks because caller can return `undefined` result or throw a falsy value.\n if ('error' in data || 'result' in data) {\n const span = data._sentrySpan;\n if (span && deferSpanEnd?.({ span, data, end: makeDeferredEnd(span, data) })) {\n return;\n }\n endBoundSpan(data, beforeSpanEnd);\n }\n },\n error(data) {\n // No span was bound for this payload (`getSpan` returned undefined), so there is nothing to\n // annotate and no instrumentation that owns capturing this error.\n const span = data._sentrySpan;\n if (!span) {\n return;\n }\n\n annotateSpanError(span, data.error);\n },\n asyncEnd(data) {\n const span = data._sentrySpan;\n if (span && deferSpanEnd?.({ span, data, end: makeDeferredEnd(span, data) })) {\n return;\n }\n endBoundSpan(data, beforeSpanEnd);\n },\n };\n\n handle.channel.subscribe(subscribers);\n\n return {\n channel: handle.channel,\n unbind: () => {\n handle.channel.unsubscribe(subscribers);\n handle.unbind();\n },\n };\n}\n\n/**\n * Bind a span into the channel's async context so it becomes active for the traced operation,\n * without managing its lifecycle. The primitive behind {@link bindTracingChannelToSpan}, which\n * layers span-ending and error handling on top.\n *\n * `getSpan` may return `undefined` to leave the active context untouched for that payload.\n */\nexport function bindSpanToChannelStore<TData extends object>(\n channel: TracingChannel<TData, TData>,\n getSpan: (data: TracingChannelPayloadWithSpan<TData>) => Span | undefined,\n): TracingChannelBindingHandle<TData> {\n // Grabs the tracing channel binding defined by the AsyncContext strategy implementation\n const binding = getAsyncContextStrategy(getMainCarrier()).getTracingChannelBinding?.();\n\n // If no binding, then either the implementer doesn't support tracing channels or there is no active strategy\n // Failure mode here means we would still access the channel and potentially subscribe to it, but parenting will be off.\n if (!binding) {\n DEBUG_BUILD && debug.log('[TracingChannel] Could not access async context binding.');\n\n return {\n channel,\n unbind: NOOP,\n };\n }\n\n // Grab the ALS instance, we don't really care what is in it as long as the AsyncContext strategy can use its value to figure out parenting.\n const asyncLocalStorage = binding.asyncLocalStorage as AsyncLocalStorage<TData>;\n\n // bindStore activates the ALS for the traced call; any getStore() inside it returns the value bound for that context.\n // 1. Produce: Binds the span to the active context via withActiveSpan(span), and returns the store for the active context.\n // 2. Bind: the courier hands that opaque value to channel.start.bindStore(asyncLocalStorage, producer), which runs the traced op inside asyncLocalStorage.run(value, …); it never inspects the value.\n // 3. Read: inside the op, Sentry's scope machinery calls getScopes() → asyncStorage.getStore() on that same ALS, so getCurrentScope/getIsolationScope/getActiveSpan resolve to the scope carrying our span.\n // 4. Nest: any child span started in the traced op parents to that active span.\n channel.start.bindStore(asyncLocalStorage, (data: TracingChannelPayloadWithSpan<TData>) => {\n // Stash the caller's store before we swap in the span store, so `asyncStart` can restore it for\n // callback-style channels (see `_sentryCallerStore`).\n data._sentryCallerStore = asyncLocalStorage.getStore();\n\n const span = getSpan(data);\n if (!span) {\n // Leave the active context untouched so nested operations keep parenting to the enclosing span.\n return data._sentryCallerStore as TData;\n }\n data._sentrySpan = span;\n\n return getStoreWithActiveSpan(asyncLocalStorage, span) as TData;\n });\n\n // Restore the caller's context for the async continuation. Only callback-style channels `runStores`\n // `asyncStart` (so the callback runs inside this store). promise channels `publish` it, leaving this\n // inert, their continuation already inherits the caller's context natively.\n channel.asyncStart.bindStore(asyncLocalStorage, (data: TracingChannelPayloadWithSpan<TData>) => {\n return data._sentryCallerStore as TData;\n });\n\n return {\n channel,\n unbind: () => {\n // Removes the stores\n channel.start.unbindStore(asyncLocalStorage);\n channel.asyncStart.unbindStore(asyncLocalStorage);\n },\n };\n}\n\nfunction endBoundSpan<TData extends object>(\n data: TracingChannelPayloadWithSpan<TData>,\n beforeSpanEnd: TracingChannelLifeCycleOptions<TData>['beforeSpanEnd'],\n): void {\n const span = data._sentrySpan;\n if (!span) {\n return;\n }\n beforeSpanEnd?.(span, data);\n span.end();\n}\n\ntype ErrorInfo = {\n message: string | undefined;\n attributes: Record<string, string>;\n};\n\n/**\n * Best-effort message and attribute extraction for thrown/rejected values.\n */\nfunction getErrorInfo(error: unknown): ErrorInfo {\n const errorIsObject = isObjectLike(error);\n const raw = errorIsObject ? ('message' in error ? error.message : undefined) : error;\n\n // Leave the status message unset if not set (e.g. an `AggregateError` from\n // ECONNREFUSED, whose `.message` is empty). Otherwise cast to string.\n const message = raw ? String(raw) : undefined;\n const type = errorIsObject && 'name' in error ? String(error.name) : 'unknown';\n\n return {\n message,\n attributes: {\n [ERROR_TYPE]: type,\n },\n };\n}\n\nfunction getStoreWithActiveSpan(asyncLocalStorage: AsyncLocalStorage<unknown>, span: Span): unknown {\n // Do not make an ignored *child* the active span: no span is emitted for it, so its children and\n // outgoing requests must propagate from the nearest emitted parent instead. An ignored *root* is\n // still activated so its whole subtree is dropped with it. Mirrors core `startSpan` and the OTel\n // context manager (`spanIsIgnored(span) && getRootSpan(span) !== span`).\n if (spanIsIgnored(span) && getRootSpan(span) !== span) {\n return asyncLocalStorage.getStore();\n }\n\n return withActiveSpan(span, () => {\n return asyncLocalStorage.getStore();\n });\n}\n"],"mappings":";;;;AAyFA,MAAM,aAAmB,CAAC;;AAG1B,SAAgB,oBAAuB,IAA4B;CACjE,IAAI;EACF,OAAO,GAAG;CACZ,SAAS,OAAO;EACd,eAAe,MAAM,KAAK,kDAAkD,KAAK;EACjF;CACF;AACF;;;;;;;;;;AAWA,SAAgB,yBACd,SACA,SACA,MACoC;CACpC,MAAM,SAAS,uBAAuB,SAAS,OAAO;CAEtD,MAAM,gBAAgB,MAAM;CAC5B,MAAM,eAAe,MAAM;CAC3B,MAAM,gBAAgB,MAAmD;EACvE,IAAI,OAAO,MAAM,iBAAiB,YAChC,OAAO,KAAK,aAAa,CAAC;EAG5B,OAAO,EACL,WAAW;GACT,MAAM;GACN,SAAS;EACX,EACF;CACF;CAIA,MAAM,qBAAqB,MAAY,UAAyB;EAC9D,IAAI,MAAM,cACR,iBAAiB,OAAO,aAAa,KAAK,CAAC;EAG7C,MAAM,EAAE,SAAS,eAAe,aAAa,KAAK;EAClD,KAAK,UAAU;GAAE,MAAM;GAAmB;EAAQ,CAAC;EACnD,KAAK,cAAc,UAAU;CAC/B;CAGA,MAAM,mBAAmB,MAAY,SAA+C;EAClF,IAAI,QAAQ;EAEZ,QAAQ,UAA0B;GAChC,IAAI,OACF;GAGF,QAAQ;GACR,IAAI,UAAU,KAAA,GAAW;IACvB,kBAAkB,MAAM,KAAK;IAG7B,KAAK,QAAQ;GACf;GAEA,aAAa,MAAM,aAAa;EAClC;CACF;CAEA,MAAM,cAAwF;EAC5F,OAAO;EACP,YAAY;EACZ,IAAI,MAAM;GAGR,I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M,OAAO,KAAK;CAClB,IAAI,CAAC,MACH;CAEF,gBAAgB,MAAM,IAAI;CAC1B,KAAK,IAAI;AACX;;;;AAUA,SAAS,aAAa,OAA2B;CAC/C,MAAM,gBAAgB,aAAa,KAAK;CACxC,MAAM,MAAM,gBAAiB,aAAa,QAAQ,MAAM,UAAU,KAAA,IAAa;CAI/E,MAAM,UAAU,MAAM,OAAO,GAAG,IAAI,KAAA;CACpC,MAAM,OAAO,iBAAiB,UAAU,QAAQ,OAAO,MAAM,IAAI,IAAI;CAErE,OAAO;EACL;EACA,YAAY,GACT,aAAa,KAChB;CACF;AACF;AAEA,SAAS,uBAAuB,mBAA+C,MAAqB;CAKlG,IAAI,cAAc,IAAI,KAAK,YAAY,IAAI,MAAM,MAC/C,OAAO,kBAAkB,SAAS;CAGpC,OAAO,eAAe,YAAY;EAChC,OAAO,kBAAkB,SAAS;CACpC,CAAC;AACH"}
1
+ {"version":3,"file":"tracing-channel.js","names":[],"sources":["../../src/tracing-channel.ts"],"sourcesContent":["import type { TracingChannel, TracingChannelSubscribers } from 'node:diagnostics_channel';\nimport type { AsyncLocalStorage } from 'node:async_hooks';\nimport type { ExclusiveEventHintOrCaptureContext, Span } from '@sentry/core';\nimport {\n debug,\n captureException,\n isObjectLike,\n SPAN_STATUS_ERROR,\n getAsyncContextStrategy,\n getMainCarrier,\n spanIsIgnored,\n getRootSpan,\n withActiveSpan,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build';\nimport { ERROR_TYPE } from '@sentry/conventions/attributes';\n\nexport type TracingChannelPayloadWithSpan<TData extends object> = TData & {\n /**\n * The current active span for the traced call.\n */\n _sentrySpan?: Span;\n\n /**\n * The context's active store value, used to restore the context for asyncStart continuations for callback-based tracing.\n */\n _sentryCallerStore?: unknown;\n\n /** Set by Node's tracing channel when the traced operation failed. */\n error?: unknown;\n};\n\n/*\n * A type patch so that we don't have to handle all subscription types.\n */\nexport interface SentryTracingChannel<TData extends object = object> extends Omit<\n TracingChannel<TData, TracingChannelPayloadWithSpan<TData>>,\n 'subscribe' | 'unsubscribe'\n> {\n subscribe(subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>>): void;\n unsubscribe(subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>>): void;\n}\n\nexport interface TracingChannelLifeCycleOptions<TData extends object = object> {\n /**\n * Invoked with the span and the channel context object once the traced operation completes\n * Use it to enrich the span from the result/error (branch on `'error' in data` / `'result' in data`) or to run cleanup.\n */\n beforeSpanEnd?: (span: Span, data: TracingChannelPayloadWithSpan<TData>) => void;\n\n /**\n * Whether a thrown error is captured as a Sentry event. The span is always marked with error status regardless. Defaults to `false`.\n * You can alternatively pass a function that sets the ExclusiveEventHintOrCaptureContext on the captured error.\n * Set `true` for instrumentations that own the error boundary, (e.g: route handlers)\n * For database drivers, it is not recommended to set this at all.\n */\n captureError?: boolean | ((e: unknown) => ExclusiveEventHintOrCaptureContext);\n\n /**\n * Take ownership of *when* the span ends: return `true` and the helper won't end it on\n * `end`/`asyncEnd`. For results that settle out-of-band — e.g. a streamed `EventEmitter` that\n * completes via its own `'end'`/`'error'` events.\n *\n * Call `end` when it settles — `end()` on success, `end(error)` on failure. `end` owns *how* the span\n * ends (error status/attributes, `captureError`, `beforeSpanEnd`) and is idempotent. Default `false`\n * lets the helper end the span as usual.\n */\n deferSpanEnd?: (args: {\n span: Span;\n data: TracingChannelPayloadWithSpan<TData>;\n /** Ends the span: `end()` on success, `end(error)` on failure (which marks `data` as errored). Idempotent. */\n end: (error?: unknown) => void;\n }) => boolean;\n}\n\n/** Returned by {@link bindTracingChannelToSpan}: the bound channel plus a teardown handle. */\nexport interface TracingChannelBindingHandle<TData extends object = object> {\n /**\n * The tracing channel with the span bound into async context.\n */\n channel: SentryTracingChannel<TData>;\n\n /**\n * Tears down the binding: unsubscribes lifecycle handlers, when present, and unbinds the start store.\n * Idempotent, and a no-op when no async context binding was available.\n */\n unbind: () => void;\n}\n\nconst NOOP = (): void => {};\n\n/** Runs a span-building callback so a throw inside it can never break the user's traced call. */\nexport function safeChannelCallback<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch (error) {\n DEBUG_BUILD && debug.warn('[instrumentation] error handling channel event', error);\n return undefined;\n }\n}\n\n/**\n * Bind a span and its lifecycle to a tracing channel so the span becomes the active async context\n * for the traced operation and is ended when the operation completes.\n *\n * `getSpan` may return `undefined` to opt a payload out entirely: nothing is bound, no span is\n * tracked, and the active context is left untouched. Use it for events that ride the same channel\n * but should reuse the enclosing span instead of opening (and ending) their own — e.g. an agent\n * loop's per-step events, where ending a freshly opened span would close the parent prematurely.\n */\nexport function bindTracingChannelToSpan<TData extends object>(\n channel: TracingChannel<TData, TData>,\n getSpan: (data: TracingChannelPayloadWithSpan<TData>) => Span | undefined,\n opts?: TracingChannelLifeCycleOptions<TData>,\n): TracingChannelBindingHandle<TData> {\n const handle = bindSpanToChannelStore(channel, getSpan);\n\n const beforeSpanEnd = opts?.beforeSpanEnd;\n const deferSpanEnd = opts?.deferSpanEnd;\n const getErrorHint = (e: unknown): ExclusiveEventHintOrCaptureContext => {\n if (typeof opts?.captureError === 'function') {\n return opts.captureError(e);\n }\n\n return {\n mechanism: {\n type: 'auto.diagnostic_channels.bind_span',\n handled: false,\n },\n };\n };\n\n // Apply Sentry error status + attributes (and capture, if configured) to a span. Shared by the\n // channel `error` lifecycle and the deferred `end` util so the two can't drift.\n const annotateSpanError = (span: Span, error: unknown): void => {\n if (opts?.captureError) {\n // oxlint-disable-next-line sdk/require-exception-mechanism -- hint comes from `getErrorHint`, which sets a mechanism unless `captureError` overrides it\n captureException(error, getErrorHint(error));\n }\n\n const { message, attributes } = getErrorInfo(error);\n span.setStatus({ code: SPAN_STATUS_ERROR, message });\n span.setAttributes(attributes);\n };\n\n // Creates an end fn for deferred handlers to use, ensures consistent span end behavior\n const makeDeferredEnd = (span: Span, data: TracingChannelPayloadWithSpan<TData>) => {\n let ended = false;\n\n return (error?: unknown): void => {\n if (ended) {\n return;\n }\n\n ended = true;\n if (error !== undefined) {\n annotateSpanError(span, error);\n // Without this the payload still looks successful, so `beforeSpanEnd` enriches the span from\n // a `result` the operation never produced.\n data.error = error;\n }\n\n endBoundSpan(data, beforeSpanEnd);\n };\n };\n\n const subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>> = {\n start: NOOP,\n asyncStart: NOOP,\n end(data) {\n // The operation settled synchronously (returned or threw)\n // Presence checks because caller can return `undefined` result or throw a falsy value.\n if ('error' in data || 'result' in data) {\n const span = data._sentrySpan;\n if (span && deferSpanEnd?.({ span, data, end: makeDeferredEnd(span, data) })) {\n return;\n }\n endBoundSpan(data, beforeSpanEnd);\n }\n },\n error(data) {\n // No span was bound for this payload (`getSpan` returned undefined), so there is nothing to\n // annotate and no instrumentation that owns capturing this error.\n const span = data._sentrySpan;\n if (!span) {\n return;\n }\n\n annotateSpanError(span, data.error);\n },\n asyncEnd(data) {\n const span = data._sentrySpan;\n if (span && deferSpanEnd?.({ span, data, end: makeDeferredEnd(span, data) })) {\n return;\n }\n endBoundSpan(data, beforeSpanEnd);\n },\n };\n\n handle.channel.subscribe(subscribers);\n\n return {\n channel: handle.channel,\n unbind: () => {\n handle.channel.unsubscribe(subscribers);\n handle.unbind();\n },\n };\n}\n\n/**\n * Bind a span into the channel's async context so it becomes active for the traced operation,\n * without managing its lifecycle. The primitive behind {@link bindTracingChannelToSpan}, which\n * layers span-ending and error handling on top.\n *\n * `getSpan` may return `undefined` to leave the active context untouched for that payload.\n */\nexport function bindSpanToChannelStore<TData extends object>(\n channel: TracingChannel<TData, TData>,\n getSpan: (data: TracingChannelPayloadWithSpan<TData>) => Span | undefined,\n): TracingChannelBindingHandle<TData> {\n // Grabs the tracing channel binding defined by the AsyncContext strategy implementation\n const binding = getAsyncContextStrategy(getMainCarrier()).getTracingChannelBinding?.();\n\n // If no binding, then either the implementer doesn't support tracing channels or there is no active strategy\n // Failure mode here means we would still access the channel and potentially subscribe to it, but parenting will be off.\n if (!binding) {\n DEBUG_BUILD && debug.log('[TracingChannel] Could not access async context binding.');\n\n return {\n channel,\n unbind: NOOP,\n };\n }\n\n // Grab the ALS instance, we don't really care what is in it as long as the AsyncContext strategy can use its value to figure out parenting.\n const asyncLocalStorage = binding.asyncLocalStorage as AsyncLocalStorage<TData>;\n\n // bindStore activates the ALS for the traced call; any getStore() inside it returns the value bound for that context.\n // 1. Produce: Binds the span to the active context via withActiveSpan(span), and returns the store for the active context.\n // 2. Bind: the courier hands that opaque value to channel.start.bindStore(asyncLocalStorage, producer), which runs the traced op inside asyncLocalStorage.run(value, …); it never inspects the value.\n // 3. Read: inside the op, Sentry's scope machinery calls getScopes() → asyncStorage.getStore() on that same ALS, so getCurrentScope/getIsolationScope/getActiveSpan resolve to the scope carrying our span.\n // 4. Nest: any child span started in the traced op parents to that active span.\n channel.start.bindStore(asyncLocalStorage, (data: TracingChannelPayloadWithSpan<TData>) => {\n // Stash the caller's store before we swap in the span store, so `asyncStart` can restore it for\n // callback-style channels (see `_sentryCallerStore`).\n data._sentryCallerStore = asyncLocalStorage.getStore();\n\n const span = getSpan(data);\n if (!span) {\n // Leave the active context untouched so nested operations keep parenting to the enclosing span.\n return data._sentryCallerStore as TData;\n }\n data._sentrySpan = span;\n\n return getStoreWithActiveSpan(asyncLocalStorage, span) as TData;\n });\n\n // Restore the caller's context for the async continuation. Only callback-style channels `runStores`\n // `asyncStart` (so the callback runs inside this store). promise channels `publish` it, leaving this\n // inert, their continuation already inherits the caller's context natively.\n channel.asyncStart.bindStore(asyncLocalStorage, (data: TracingChannelPayloadWithSpan<TData>) => {\n return data._sentryCallerStore as TData;\n });\n\n return {\n channel,\n unbind: () => {\n // Removes the stores\n channel.start.unbindStore(asyncLocalStorage);\n channel.asyncStart.unbindStore(asyncLocalStorage);\n },\n };\n}\n\nfunction endBoundSpan<TData extends object>(\n data: TracingChannelPayloadWithSpan<TData>,\n beforeSpanEnd: TracingChannelLifeCycleOptions<TData>['beforeSpanEnd'],\n): void {\n const span = data._sentrySpan;\n if (!span) {\n return;\n }\n beforeSpanEnd?.(span, data);\n span.end();\n}\n\ntype ErrorInfo = {\n message: string | undefined;\n attributes: Record<string, string>;\n};\n\n/**\n * Best-effort message and attribute extraction for thrown/rejected values.\n */\nfunction getErrorInfo(error: unknown): ErrorInfo {\n const errorIsObject = isObjectLike(error);\n const raw = errorIsObject ? ('message' in error ? error.message : undefined) : error;\n\n // Leave the status message unset if not set (e.g. an `AggregateError` from\n // ECONNREFUSED, whose `.message` is empty). Otherwise cast to string.\n const message = raw ? String(raw) : undefined;\n const type = errorIsObject && 'name' in error ? String(error.name) : 'unknown';\n\n return {\n message,\n attributes: {\n [ERROR_TYPE]: type,\n },\n };\n}\n\nfunction getStoreWithActiveSpan(asyncLocalStorage: AsyncLocalStorage<unknown>, span: Span): unknown {\n // Do not make an ignored *child* the active span: no span is emitted for it, so its children and\n // outgoing requests must propagate from the nearest emitted parent instead. An ignored *root* is\n // still activated so its whole subtree is dropped with it. Mirrors core `startSpan` and the OTel\n // context manager (`spanIsIgnored(span) && getRootSpan(span) !== span`).\n if (spanIsIgnored(span) && getRootSpan(span) !== span) {\n return asyncLocalStorage.getStore();\n }\n\n return withActiveSpan(span, () => {\n return asyncLocalStorage.getStore();\n });\n}\n"],"mappings":";;;;AAyFA,MAAM,aAAmB,CAAC;;AAG1B,SAAgB,oBAAuB,IAA4B;CACjE,IAAI;EACF,OAAO,GAAG;CACZ,SAAS,OAAO;EACd,eAAe,MAAM,KAAK,kDAAkD,KAAK;EACjF;CACF;AACF;;;;;;;;;;AAWA,SAAgB,yBACd,SACA,SACA,MACoC;CACpC,MAAM,SAAS,uBAAuB,SAAS,OAAO;CAEtD,MAAM,gBAAgB,MAAM;CAC5B,MAAM,eAAe,MAAM;CAC3B,MAAM,gBAAgB,MAAmD;EACvE,IAAI,OAAO,MAAM,iBAAiB,YAChC,OAAO,KAAK,aAAa,CAAC;EAG5B,OAAO,EACL,WAAW;GACT,MAA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our middleware, so a `chat()` call that already has it does not get a second one.
5
+ * `Symbol.for`, so that two copies of the SDK in one process see each other's middleware.
6
+ */
7
+ export declare const TANSTACK_AI_MIDDLEWARE_BRAND: unique symbol;
8
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/ai/tanstack-ai/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,EAAG,YAAqB,CAAC;AAElE,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,4BAA4B,eAA8C,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { GenAiSpanHooks } from '../core/span-hooks';
2
+ import type { GenAiCallOptions } from '../core/utils';
3
+ import type { TanstackAICallInfo, TanstackAIChatMiddleware } from './types';
4
+ /**
5
+ * `call` is the options object of the `chat()` call. The recording options run when `chat()` is
6
+ * called. The hooks run for every span (`invoke_agent`, `chat` and `execute_tool`) while the run is
7
+ * read, which can be in another async context than the call. `onSpanEnd` gets the `error` of a
8
+ * failed run or tool.
9
+ */
10
+ export type TanstackAIOptions = GenAiCallOptions<TanstackAICallInfo> & GenAiSpanHooks<TanstackAICallInfo>;
11
+ /**
12
+ * Makes the chat middleware for one `chat()` call. Call it when `chat()` is called: the parent of the
13
+ * `invoke_agent` span is the span that is active then, and the recording options are decided then.
14
+ * The middleware cannot make its spans active, so the spans of other work in the run do not nest
15
+ * below them.
16
+ */
17
+ export declare function createTanstackAIMiddleware(options: TanstackAIOptions, call: TanstackAICallInfo): TanstackAIChatMiddleware;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ai/tanstack-ai/index.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,KAAK,EACV,kBAAkB,EAClB,wBAAwB,EAGzB,MAAM,SAAS,CAAC;AAGjB;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,GAAG,cAAc,CAAC,kBAAkB,CAAC,CAAC;AAK1G;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE,kBAAkB,GACvB,wBAAwB,CAiQ1B"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * The parts of the `@tanstack/ai` 1.x chat middleware contract that we use. `@tanstack/ai` is not a
3
+ * dependency of this package, so these mirror `ChatMiddleware`, `ChatMiddlewareContext` and
4
+ * `ChatMiddlewareConfig`.
5
+ */
6
+ import type { TANSTACK_AI_MIDDLEWARE_BRAND } from './constants';
7
+ /** The options of a `chat()` call. The recording options and the span hooks get this object. */
8
+ export interface TanstackAICallInfo {
9
+ threadId?: string;
10
+ stream?: boolean;
11
+ outputSchema?: unknown;
12
+ middleware?: unknown;
13
+ [key: string]: unknown;
14
+ }
15
+ /** Mirrors `TokenUsage`. */
16
+ export interface TanstackAIUsage {
17
+ promptTokens?: number;
18
+ completionTokens?: number;
19
+ totalTokens?: number;
20
+ promptTokensDetails?: {
21
+ cachedTokens?: number;
22
+ cacheWriteTokens?: number;
23
+ };
24
+ completionTokensDetails?: {
25
+ reasoningTokens?: number;
26
+ };
27
+ }
28
+ export interface TanstackAITool {
29
+ name: string;
30
+ description?: string;
31
+ inputSchema?: unknown;
32
+ execute?: unknown;
33
+ }
34
+ /** Mirrors `ModelMessage`. */
35
+ export interface TanstackAIModelMessage {
36
+ role: 'user' | 'assistant' | 'tool';
37
+ content: string | null | Array<{
38
+ type: string;
39
+ content?: string;
40
+ }>;
41
+ toolCalls?: Array<{
42
+ id: string;
43
+ function?: {
44
+ name: string;
45
+ arguments: string;
46
+ };
47
+ }>;
48
+ toolCallId?: string;
49
+ }
50
+ export type TanstackAISystemPrompt = string | {
51
+ content: string;
52
+ };
53
+ export interface TanstackAIMiddlewareContext {
54
+ phase: string;
55
+ /** The adapter name, for example `openai-chat`. */
56
+ provider: string;
57
+ model: string;
58
+ threadId: string;
59
+ subagentName?: string;
60
+ /** The metadata of the current model call. TanStack sets it when the model call starts. */
61
+ callMetadata?: {
62
+ model?: string;
63
+ responseId?: string;
64
+ source?: {
65
+ provider?: string;
66
+ };
67
+ };
68
+ signal?: AbortSignal;
69
+ }
70
+ export interface TanstackAIMiddlewareConfig {
71
+ messages: TanstackAIModelMessage[];
72
+ /** The messages sent to the provider, when a middleware makes them different from `messages`. */
73
+ providerMessages?: TanstackAIModelMessage[];
74
+ systemPrompts: TanstackAISystemPrompt[];
75
+ tools: TanstackAITool[];
76
+ modelOptions?: Record<string, unknown>;
77
+ }
78
+ /** A stream chunk: an AG-UI event, discriminated by `type`. */
79
+ export interface TanstackAIChunk {
80
+ type: string;
81
+ delta?: string;
82
+ model?: string;
83
+ responseId?: string;
84
+ finishReason?: string | null;
85
+ toolCallId?: string;
86
+ toolCallName?: string;
87
+ input?: unknown;
88
+ /** `{ type: 'interrupt' }` on the `RUN_FINISHED` chunk of a run that stops at an interrupt. */
89
+ outcome?: {
90
+ type: string;
91
+ };
92
+ /** The error of a `RUN_ERROR` chunk. */
93
+ error?: {
94
+ message: string;
95
+ code?: string;
96
+ };
97
+ message?: string;
98
+ code?: string;
99
+ }
100
+ export interface TanstackAIToolCallHookContext {
101
+ toolName: string;
102
+ toolCallId: string;
103
+ args: unknown;
104
+ tool?: TanstackAITool;
105
+ }
106
+ export interface TanstackAIAfterToolCallInfo {
107
+ toolCallId: string;
108
+ ok: boolean;
109
+ result?: unknown;
110
+ error?: unknown;
111
+ }
112
+ export interface TanstackAIChatMiddleware {
113
+ name: string;
114
+ [TANSTACK_AI_MIDDLEWARE_BRAND]: true;
115
+ onConfig(ctx: TanstackAIMiddlewareContext, config: TanstackAIMiddlewareConfig): void;
116
+ onChunk(ctx: TanstackAIMiddlewareContext, chunk: TanstackAIChunk): void;
117
+ onInterruptBoundary(ctx: TanstackAIMiddlewareContext): void;
118
+ onUsage(ctx: TanstackAIMiddlewareContext, usage: TanstackAIUsage): void;
119
+ onGuardToolCall(ctx: TanstackAIMiddlewareContext, hookCtx: TanstackAIToolCallHookContext): void;
120
+ onAfterToolCall(ctx: TanstackAIMiddlewareContext, info: TanstackAIAfterToolCallInfo): void;
121
+ onFinish(ctx: TanstackAIMiddlewareContext): void;
122
+ onAbort(ctx: TanstackAIMiddlewareContext): void;
123
+ onError(ctx: TanstackAIMiddlewareContext, info: {
124
+ error: unknown;
125
+ }): void;
126
+ }
127
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ai/tanstack-ai/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAEhE,gGAAgG;AAChG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,4BAA4B;AAC5B,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3E,uBAAuB,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACxD;AAED,MAAM,WAAW,cAAc;IAC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2B,EAAE,MAAM,EAAE,0BAA0B,GAAG,IAAI,CAAC;IACrF,OAAO,CAAC,GAAG,EAAE,2BAA2B,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IACxE,mBAAmB,CAAC,GAAG,EAAE,2BAA2B,GAAG,IAAI,CAAC;IAC5D,OAAO,CAAC,GAAG,EAAE,2BAA2B,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IACxE,eAAe,CAAC,GAAG,EAAE,2BAA2B,EAAE,OAAO,EAAE,6BAA6B,GAAG,IAAI,CAAC;IAChG,eAAe,CAAC,GAAG,EAAE,2BAA2B,EAAE,IAAI,EAAE,2BAA2B,GAAG,IAAI,CAAC;IAC3F,QAAQ,CAAC,GAAG,EAAE,2BAA2B,GAAG,IAAI,CAAC;IACjD,OAAO,CAAC,GAAG,EAAE,2BAA2B,GAAG,IAAI,CAAC;IAChD,OAAO,CAAC,GAAG,EAAE,2BAA2B,EAAE,IAAI,EAAE;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CAC3E"}
@@ -0,0 +1,21 @@
1
+ import type { TanstackAIChunk, TanstackAIMiddlewareContext, TanstackAIModelMessage, TanstackAISystemPrompt, TanstackAIUsage } from './types';
2
+ /**
3
+ * `ctx.provider` is the adapter name, which for some adapters also names the API (for example
4
+ * `openrouter-responses`). The call metadata has the provider of the adapter, but only after the
5
+ * first model call started.
6
+ */
7
+ export declare function getProviderName(ctx: TanstackAIMiddlewareContext): string;
8
+ export declare function getInputAttributes(messages: ReadonlyArray<TanstackAIModelMessage>, systemPrompts: ReadonlyArray<TanstackAISystemPrompt>): Record<string, string | undefined>;
9
+ /**
10
+ * TanStack AI has no common option for temperature, top p or max tokens. Each adapter takes them in
11
+ * `modelOptions` and passes them to the provider with the provider's key name (snake_case or camelCase,
12
+ * and `max_tokens` or `max_output_tokens`). So we take the first of the known keys that has a value.
13
+ */
14
+ export declare function getRequestAttributes(modelOptions?: Record<string, unknown>): Record<string, number | undefined>;
15
+ export declare function getUsageAttributes(usage: TanstackAIUsage): Record<string, number>;
16
+ /** The error of a `RUN_ERROR` chunk. */
17
+ export declare function getRunError(chunk: TanstackAIChunk): {
18
+ message?: string;
19
+ code?: string;
20
+ };
21
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/ai/tanstack-ai/utils.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,eAAe,EACf,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,2BAA2B,GAAG,MAAM,CAExE;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,aAAa,CAAC,sBAAsB,CAAC,EAC/C,aAAa,EAAE,aAAa,CAAC,sBAAsB,CAAC,GACnD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAYpC;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAenH;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYjF;AA2BD,wCAAwC;AACxC,wBAAgB,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAEvF"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/ai/workers-ai/utils.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,E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,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,sBAAsB,CAgBxF;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,OAAO,EACf,aAAa,EAAE,MAAM,GACpB,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAmCpC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAiD7F;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,OAAO,EACf,aAAa,EAAE,OAAO,EACtB,aAAa,CAAC,EAAE,sBAAsB,GACrC,IAAI,CAyDN"}
@@ -45,6 +45,8 @@ export { createFlueInstrumentation } from './ai/flue';
45
45
  export { flueIntegration } from './integrations/flue';
46
46
  export { piAiIntegration } from './integrations/pi-ai';
47
47
  export { piDurableIntegration } from './integrations/pi-durable';
48
+ export { tanstackAIIntegration } from './integrations/tanstack-ai';
49
+ export type { TanstackAIOptions } from './ai/tanstack-ai';
48
50
  export type { FlueOptions } from './ai/flue';
49
51
  export { mastraIntegration } from './integrations/mastra';
50
52
  export { mcpServerIntegration } from './integrations/mcp-server';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAG1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,IAAI,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAC3G,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AACvE,YAAY,EAAE,qB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B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAE9E,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAErG,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../../../src/integrations/fastify/instrumentation.ts"],"names":[],"mappings":"AA8XA;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAaxC"}
1
+ {"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../../../src/integrations/fastify/instrumentation.ts"],"names":[],"mappings":"AAsYA;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAaxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"neon.d.ts","sourceRoot":"","sources":["../../../src/integrations/neon.ts"],"names":[],"mappings":"AAyJA;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe;;CAAsC,CAAC"}
1
+ {"version":3,"file":"neon.d.ts","sourceRoot":"","sources":["../../../src/integrations/neon.ts"],"names":[],"mappings":"AA4KA;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe;;CAAsC,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { SpanAttributes } from '@sentry/core';
1
+ import type { Span, SpanAttributes } from '@sentry/core';
2
2
  export interface PgConnectionParams {
3
3
  database?: string;
4
4
  host?: string;
@@ -16,6 +16,11 @@ export interface PgQuerySpanOptions {
16
16
  * streamable `Submittable` result, so it's the only one that defers span-ending to the emitter.
17
17
  */
18
18
  export declare function bindPgQueryChannel(channelName: string, options: PgQuerySpanOptions): void;
19
+ /**
20
+ * Sets `db.response.returned_rows` from a pg-style result (`{ rowCount, rows }`), or an array of them
21
+ * (one per statement of a multi-statement query), summed. Sets nothing when no count is known.
22
+ */
23
+ export declare function setReturnedRows(span: Span, results: unknown): void;
19
24
  /** The `db.*`/`server.*` attributes for a pg-style set of connection parameters. */
20
25
  export declare function getConnectionAttributes(params: PgConnectionParams): SpanAttributes;
21
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"pg.d.ts","sourceRoot":"","sources":["../../../src/integrations/pg.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAwB,cAAc,EAAE,MAAM,cAAc,CAAC;AA0CzE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAgCD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IAGf,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAEzF;AAkHD,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CAQlF;AAsDD;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB;yBA7N+B,OAAO;;;CA6NI,CAAC"}
1
+ {"version":3,"file":"pg.d.ts","sourceRoot":"","sources":["../../../src/integrations/pg.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAwB,IAAI,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA0C/E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAgCD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IAGf,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAEzF;AAsHD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAUlE;AA4BD,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CAQlF;AAsDD;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB;yBA3Q+B,OAAO;;;CA2QI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"pino.d.ts","sourceRoot":"","sources":["../../../src/integrations/pino.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAiDpE,KAAK,WAAW,GAAG;IACjB;;;;;;OAMG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;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;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe;;;wBACN,OAAO,GAAG,IAAI;0BAKZ,OAAO,GAAG,IAAI;CAKpC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { TanstackAIOptions } from '../ai/tanstack-ai';
2
+ /**
3
+ * Traces the `chat()` calls of TanStack AI (`@tanstack/ai` >= 1.0.0 < 2), through the
4
+ * `orchestrion:@tanstack/ai:chat` channel. Each call gets a `gen_ai.invoke_agent` span, with a
5
+ * `gen_ai.chat` span for each model call and a `gen_ai.execute_tool` span for each tool run.
6
+ * Needs the Sentry runtime hook (`--import`) or bundler plugin.
7
+ *
8
+ * @example
9
+ * ```javascript
10
+ * Sentry.init({
11
+ * integrations: [Sentry.tanstackAIIntegration({ recordInputs: true, recordOutputs: true })],
12
+ * });
13
+ * ```
14
+ */
15
+ export declare const tanstackAIIntegration: (options?: TanstackAIOptions | undefined) => import("@sentry/core").Integration & {
16
+ name: "TanStackAI";
17
+ };
18
+ //# sourceMappingURL=tanstack-ai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tanstack-ai.d.ts","sourceRoot":"","sources":["../../../src/integrations/tanstack-ai.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAiE3D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB;;CAA4C,CAAC"}
@@ -1,10 +1,7 @@
1
1
  /** Maps the AI SDK `experimental_extract` input and output to the Clairic shape of the `gen_ai.extract` schemas. */
2
+ import type { ExtractRequest } from '@sentry/conventions/attributes';
2
3
  interface ExtractState {
3
- request: {
4
- state?: string;
5
- images?: string[];
6
- documents?: string[];
7
- };
4
+ request: Pick<ExtractRequest, 'state' | 'images' | 'documents'>;
8
5
  /** For each AI SDK state part, the offset of its text in `request.state`, or `'image'` for an image part. */
9
6
  parts: (number | 'image' | undefined)[];
10
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../../src/integrations/vercel-ai/extract.ts"],"names":[],"mappings":"AAAA,oHAAoH;AAapH,UAAU,YAAY;IACpB,OAAO,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACrE,6GAA6G;IAC7G,KAAK,EAAE,CAAC,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,EAAE,CAAC;CACzC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAoC3D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAOxD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,GAC3B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBzB"}
1
+ {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../../src/integrations/vercel-ai/extract.ts"],"names":[],"mappings":"AAAA,oHAAoH;AAEpH,OAAO,KAAK,EAAiB,cAAc,EAAe,MAAM,gCAAgC,CAAC;AAYjG,UAAU,YAAY;IACpB,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC,CAAC;IAChE,6GAA6G;IAC7G,KAAK,EAAE,CAAC,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,EAAE,CAAC;CACzC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAoC3D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAOxD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,GAC3B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBzB"}
@@ -166,6 +166,7 @@ export declare const CHANNELS: {
166
166
  readonly POSTGRESJS_CONNECT: 'orchestrion:postgres:connect';
167
167
  readonly PRISMA_AGGREGATE: 'orchestrion:@prisma/orm-family-sql:aggregate';
168
168
  readonly PRISMA_FIRST: 'orchestrion:@prisma/orm-family-sql:first';
169
+ readonly PRISMA_FIRST_OR_THROW: 'orchestrion:@prisma/orm-family-sql:firstOrThrow';
169
170
  readonly PRISMA_CREATE: 'orchestrion:@prisma/orm-family-sql:create';
170
171
  readonly PRISMA_CREATE_AND_COUNT: 'orchestrion:@prisma/orm-family-sql:createAndCount';
171
172
  readonly PRISMA_UPSERT: 'orchestrion:@prisma/orm-family-sql:upsert';
@@ -188,6 +189,7 @@ export declare const CHANNELS: {
188
189
  readonly REMIX_MATCH_SERVER_ROUTES: 'orchestrion:@remix-run/server-runtime:matchServerRoutes';
189
190
  readonly REMIX_CALL_ROUTE_LOADER: 'orchestrion:@remix-run/server-runtime:callRouteLoader';
190
191
  readonly REMIX_CALL_ROUTE_ACTION: 'orchestrion:@remix-run/server-runtime:callRouteAction';
192
+ readonly TANSTACK_AI_CHAT: 'orchestrion:@tanstack/ai:chat';
191
193
  readonly TEDIOUS_CONNECT: 'orchestrion:tedious:connect';
192
194
  readonly TEDIOUS_EXEC_SQL: 'orchestrion:tedious:execSql';
193
195
  readonly TEDIOUS_EXEC_SQL_BATCH: 'orchestrion:tedious:execSqlBatch';
@@ -1 +1 @@
1
- {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../../src/orchestrion/channels.ts"],"names":[],"mappings":"AA6CA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CX,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../../src/orchestrion/channels.ts"],"names":[],"mappings":"AA8CA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CX,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/orchestrion/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAsDzD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAgD1D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,+BAA+B,EAAE,qBAAqB,EAElE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,gBAAgB,GAAE,qBAAqB,EAAO,GAAG,MAAM,EAAE,CAOhG;AAED,8FAA8F;AAC9F,eAAO,MAAM,yBAAyB,EAAE,MAAM,EAA8B,CA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eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
@@ -1,11 +1,12 @@
1
1
  import type { InstrumentationConfig } from '../apmTypes';
2
- export declare const PRISMA_ASYNC_TERMINALS: readonly ['aggregate', 'first', 'create', 'createAndCount', 'upsert', 'update', 'updateAndCount', 'delete', 'deleteAndCount'];
2
+ export declare const PRISMA_ASYNC_TERMINALS: readonly ['aggregate', 'first', 'firstOrThrow', 'create', 'createAndCount', 'upsert', 'update', 'updateAndCount', 'delete', 'deleteAndCount'];
3
3
  export declare const PRISMA_LAZY_TERMINALS: readonly ['all', 'createAll', 'updateAll', 'deleteAll'];
4
4
  export declare const prismaConfig: InstrumentationConfig[];
5
5
  export declare const prismaModuleNames: string[];
6
6
  export declare const prismaChannels: {
7
7
  readonly PRISMA_AGGREGATE: 'orchestrion:@prisma/orm-family-sql:aggregate';
8
8
  readonly PRISMA_FIRST: 'orchestrion:@prisma/orm-family-sql:first';
9
+ readonly PRISMA_FIRST_OR_THROW: 'orchestrion:@prisma/orm-family-sql:firstOrThrow';
9
10
  readonly PRISMA_CREATE: 'orchestrion:@prisma/orm-family-sql:create';
10
11
  readonly PRISMA_CREATE_AND_COUNT: 'orchestrion:@prisma/orm-family-sql:createAndCount';
11
12
  readonly PRISMA_UPSERT: 'orchestrion:@prisma/orm-family-sql:upsert';
@@ -1 +1 @@
1
- {"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../../../../src/orchestrion/config/prisma.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAUzD,eAAO,MAAM,sBAAsB,YACjC,WAAW,EACX,OAAO,EACP,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,CACR,CAAC;AAIX,eAAO,MAAM,qBAAqB,YAAI,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,CAAU,CAAC;AAY7F,eAAO,MAAM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AAE,2CAA2C;aAC1D,uBAAuB,EAAE,mDAAmD;aAC5E,UAAU,EAAE,wCAAwC;aACpD,iBAAiB,EAAE,8CAA8C;aACjE,iBAAiB,EAAE,8CAA8C;aACjE,iBAAiB,EAAE,8CAA8C;CACzD,CAAC"}
@@ -0,0 +1,17 @@
1
+ export declare const tanstackAiConfig: {
2
+ channelName: string;
3
+ module: {
4
+ name: string;
5
+ versionRange: string;
6
+ filePath: string;
7
+ };
8
+ functionQuery: {
9
+ functionName: string;
10
+ kind: "Sync";
11
+ };
12
+ }[];
13
+ export declare const tanstackAiModuleNames: string[];
14
+ export declare const tanstackAiChannels: {
15
+ readonly TANSTACK_AI_CHAT: 'orchestrion:@tanstack/ai:chat';
16
+ };
17
+ //# sourceMappingURL=tanstack-ai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tanstack-ai.d.ts","sourceRoot":"","sources":["../../../../src/orchestrion/config/tanstack-ai.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB;;;QAGf,IAAI;QAAkB,YAAY;QAAoB,QAAQ;;;;;;GAGzC,CAAC;AAEpC,eAAO,MAAM,qBAAqB,UAAmC,CAAC;AAEtE,eAAO,MAAM,kBAAkB;aAC7B,gBAAgB,EAAE,+BAA+B;CACzC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tracing-channel.d.ts","sourceRoot":"","sources":["../../src/tracing-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE1F,OAAO,KAAK,EAAE,kCAAkC,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAe7E,MAAM,MAAM,6BAA6B,CAAC,KAAK,SAAS,MAAM,IAAI,KAAK,GAAG;IACxE;;OAEG;IACH,WAAW,CAAC,EAAE,IAAI,CAAC;IAEnB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,sEAAsE;IACtE,KAAK,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EAAE,CAAC,IAAI,EAAE,6BAA6B,CAAC,KAAK,CAAC,KAAK,IAAI,GAAG,SAAS,EACzE,IAAI,CAAC,EAAE,8BAA8B,CAAC,KAAK,CAAC,GAC3C,2BAA2B,CAAC,KAAK,CAAC,CA8FpC;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,SAAS,MAAM,EACzD,OAAO,EAAE,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,EACrC,OAAO,EAAE,CAAC,IAAI,EAAE,6BAA6B,CAAC,KAAK,CAAC,KAAK,IAAI,GAAG,SAAS,GACxE,2BAA2B,CAAC,KAAK,CAAC,CAqDpC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/server-utils",
3
- "version": "11.20.0",
3
+ "version": "11.22.0",
4
4
  "description": "Server Utilities for all Sentry JavaScript SDKs",
5
5
  "repository": {
6
6
  "type": "git",
@@ -105,13 +105,13 @@
105
105
  },
106
106
  "dependencies": {
107
107
  "@opentelemetry/api": "^1.9.1",
108
- "@sentry/conventions": "^0.36.0",
109
- "@sentry/core": "11.20.0"
108
+ "@sentry/conventions": "^0.37.0",
109
+ "@sentry/core": "11.22.0"
110
110
  },
111
111
  "devDependencies": {
112
112
  "@apm-js-collab/code-transformer-bundler-plugins": "^0.7.6",
113
113
  "@neondatabase/serverless": "1.2.0",
114
- "@sentry-internal/rollup-utils": "11.20.0",
114
+ "@sentry-internal/rollup-utils": "11.22.0",
115
115
  "@types/node": "^20.19.0",
116
116
  "meriyah": "^6.1.4",
117
117
  "vite": "^8.3.6",