From 1e49221b6979002e9e60bfad5c3c6fb0ea3912ea Mon Sep 17 00:00:00 2001 From: JPeer264 Date: Fri, 17 Jul 2026 10:15:33 +0200 Subject: [PATCH 1/2] fix(cloudflare,deno,node): Align types of vercelai --- .../src/integrations/tracing/vercelai.ts | 5 +++++ .../integrations/tracing/vercelai.ts | 10 +-------- .../deno/src/integrations/tracing/vercelai.ts | 10 +-------- .../integrations/tracing/vercelai/types.ts | 22 ++----------------- packages/server-utils/src/index.ts | 1 + packages/server-utils/src/vercel-ai/index.ts | 4 ++-- .../src/integrations/tracing/vercelai.ts | 5 +++++ 7 files changed, 17 insertions(+), 40 deletions(-) diff --git a/packages/cloudflare/src/integrations/tracing/vercelai.ts b/packages/cloudflare/src/integrations/tracing/vercelai.ts index 70483113e886..9d28d41d5bb0 100644 --- a/packages/cloudflare/src/integrations/tracing/vercelai.ts +++ b/packages/cloudflare/src/integrations/tracing/vercelai.ts @@ -19,6 +19,11 @@ interface VercelAiOptions { * Defaults to `true`. */ enableTruncation?: boolean; + + // `recordInputs`/`recordOutputs` are intentionally omitted: this entrypoint only post-processes + // spans the AI SDK already emitted, so it cannot decide whether inputs/outputs are recorded. + // Control this per call via `experimental_telemetry.recordInputs`/`recordOutputs`, or use the + // `@sentry/cloudflare/nodejs_compat` entrypoint for integration-level control on ai >= 7. } const _vercelAIIntegration = ((options: VercelAiOptions = {}) => { diff --git a/packages/cloudflare/src/nodejs_compat/integrations/tracing/vercelai.ts b/packages/cloudflare/src/nodejs_compat/integrations/tracing/vercelai.ts index 5d41e5d60531..e808b3c04443 100644 --- a/packages/cloudflare/src/nodejs_compat/integrations/tracing/vercelai.ts +++ b/packages/cloudflare/src/nodejs_compat/integrations/tracing/vercelai.ts @@ -7,17 +7,9 @@ import type { IntegrationFn } from '@sentry/core'; import { defineIntegration } from '@sentry/core'; -import { vercelAiIntegration as serverUtilsVercelAiIntegration } from '@sentry/server-utils'; +import { vercelAiIntegration as serverUtilsVercelAiIntegration, type VercelAiOptions } from '@sentry/server-utils'; import { vercelAIIntegration as cloudflareVercelAIIntegration } from '../../../integrations/tracing/vercelai'; -interface VercelAiOptions { - /** - * Enable or disable truncation of recorded input messages. - * Defaults to `true`. - */ - enableTruncation?: boolean; -} - const _vercelAIIntegration = ((options: VercelAiOptions = {}) => { const inner = serverUtilsVercelAiIntegration(options); const instrumentation = cloudflareVercelAIIntegration(options); diff --git a/packages/deno/src/integrations/tracing/vercelai.ts b/packages/deno/src/integrations/tracing/vercelai.ts index 1ce650884967..a46ff82ae1e5 100644 --- a/packages/deno/src/integrations/tracing/vercelai.ts +++ b/packages/deno/src/integrations/tracing/vercelai.ts @@ -4,15 +4,7 @@ import type { IntegrationFn } from '@sentry/core'; import { addVercelAiProcessors, defineIntegration, extendIntegration } from '@sentry/core'; -import { vercelAiIntegration as serverUtilsVercelAiIntegration } from '@sentry/server-utils'; - -interface VercelAiOptions { - /** - * Enable or disable truncation of recorded input messages. - * Defaults to `true`. - */ - enableTruncation?: boolean; -} +import { vercelAiIntegration as serverUtilsVercelAiIntegration, type VercelAiOptions } from '@sentry/server-utils'; const _vercelAIIntegration = ((options: VercelAiOptions = {}) => { const inner = serverUtilsVercelAiIntegration(options); diff --git a/packages/node/src/integrations/tracing/vercelai/types.ts b/packages/node/src/integrations/tracing/vercelai/types.ts index 2206399c97e1..cdf8a515867a 100644 --- a/packages/node/src/integrations/tracing/vercelai/types.ts +++ b/packages/node/src/integrations/tracing/vercelai/types.ts @@ -1,4 +1,5 @@ import type { Integration } from '@sentry/core'; +import type { VercelAiOptions as VercelAiBaseOptions } from '@sentry/server-utils'; /** * Telemetry configuration. @@ -45,31 +46,12 @@ export declare type AttributeValue = | Array | Array; -export interface VercelAiOptions { - /** - * Enable or disable input recording. Enabled if `dataCollection.genAI.inputs` (or the deprecated `sendDefaultPii` option) is `true` - * or if you set `isEnabled` to `true` in your ai SDK method telemetry settings. - * Integration-level options take precedence over global `dataCollection` config. - */ - recordInputs?: boolean; - /** - * Enable or disable output recording. Enabled if `dataCollection.genAI.outputs` (or the deprecated `sendDefaultPii` option) is `true` - * or if you set `isEnabled` to `true` in your ai SDK method telemetry settings. - * Integration-level options take precedence over global `dataCollection` config. - */ - recordOutputs?: boolean; - +export interface VercelAiOptions extends VercelAiBaseOptions { /** * By default, the instrumentation will register span processors only when the ai package is used. * If you want to register the span processors even when the ai package usage cannot be detected, you can set `force` to `true`. */ force?: boolean; - - /** - * Enable or disable truncation of recorded input messages. - * Defaults to `true`. - */ - enableTruncation?: boolean; } export interface VercelAiIntegration extends Integration { diff --git a/packages/server-utils/src/index.ts b/packages/server-utils/src/index.ts index 2e7cd578ee94..ebcc3ed37acf 100644 --- a/packages/server-utils/src/index.ts +++ b/packages/server-utils/src/index.ts @@ -22,6 +22,7 @@ export type { } from './tracing-channel'; export { vercelAiIntegration } from './vercel-ai'; export type { InstrumentationConfig } from './orchestrion'; +export type { VercelAiOptions } from './vercel-ai'; export { fastifyIntegration, // oxlint-disable-next-line typescript/no-deprecated diff --git a/packages/server-utils/src/vercel-ai/index.ts b/packages/server-utils/src/vercel-ai/index.ts index 251ba91519c5..64296801c322 100644 --- a/packages/server-utils/src/vercel-ai/index.ts +++ b/packages/server-utils/src/vercel-ai/index.ts @@ -2,7 +2,7 @@ import { defineIntegration, waitForTracingChannelBinding, type IntegrationFn } f import { subscribeVercelAiTracingChannel } from './vercel-ai-dc-subscriber'; import * as dc from 'node:diagnostics_channel'; -type VercelAiOptions = { +export interface VercelAiOptions { /** * Enable or disable input recording. Enabled if `dataCollection.genAI.inputs` (or the deprecated `sendDefaultPii` option) is `true` * or if you set `isEnabled` to `true` in your ai SDK method telemetry settings. @@ -22,7 +22,7 @@ type VercelAiOptions = { * Defaults to `true`. */ enableTruncation?: boolean; -}; +} const _vercelAiIntegration = ((options: VercelAiOptions = {}) => { return { diff --git a/packages/vercel-edge/src/integrations/tracing/vercelai.ts b/packages/vercel-edge/src/integrations/tracing/vercelai.ts index 06a444a50cb6..7f5fbddf09fa 100644 --- a/packages/vercel-edge/src/integrations/tracing/vercelai.ts +++ b/packages/vercel-edge/src/integrations/tracing/vercelai.ts @@ -19,6 +19,11 @@ interface VercelAiOptions { * Defaults to `true`. */ enableTruncation?: boolean; + + // `recordInputs`/`recordOutputs` are intentionally omitted: this entrypoint only post-processes + // spans the AI SDK already emitted (no OTel patch or tracing channel in the edge runtime), so it + // cannot decide whether inputs/outputs are recorded. Control this per call via + // `experimental_telemetry.recordInputs`/`recordOutputs`. } const _vercelAIIntegration = ((options: VercelAiOptions = {}) => { From 6f21bc6bc946d209d0a876733b48164084343de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Peer=20St=C3=B6cklmair?= Date: Fri, 17 Jul 2026 17:35:31 +0200 Subject: [PATCH 2/2] Update packages/server-utils/src/index.ts Co-authored-by: Charly Gomez --- packages/server-utils/src/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/server-utils/src/index.ts b/packages/server-utils/src/index.ts index ebcc3ed37acf..17cd92bb662e 100644 --- a/packages/server-utils/src/index.ts +++ b/packages/server-utils/src/index.ts @@ -20,9 +20,8 @@ export type { TracingChannelBindingHandle, TracingChannelPayloadWithSpan, } from './tracing-channel'; -export { vercelAiIntegration } from './vercel-ai'; export type { InstrumentationConfig } from './orchestrion'; -export type { VercelAiOptions } from './vercel-ai'; +export { vercelAiIntegration, type VercelAiOptions } from './vercel-ai'; export { fastifyIntegration, // oxlint-disable-next-line typescript/no-deprecated