From 3100049bf6a2df0fcd1418586ffaaae9662cf8b8 Mon Sep 17 00:00:00 2001 From: Nicolas Hrubec Date: Thu, 6 Aug 2026 16:56:44 +0200 Subject: [PATCH] feat(v10/server-utils): Add `GenAiOptions` and deprecate `VercelAiOptions` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Forward-compat for the v11 consolidation of AI integration option types into a single shared `GenAiOptions`. Adds `GenAiOptions` (`{ recordInputs?, recordOutputs? }`) to `@sentry/server-utils` now, and marks the existing public `VercelAiOptions` (shipped since v10.68) `@deprecated` in favour of it. `VercelAiOptions` still extends `GenAiOptions` and keeps `enableTruncation`, so nothing breaks on v10 — users just get an IDE deprecation warning and a migration path before v11. Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/server-utils/src/index.ts | 7 ++++++- packages/server-utils/src/vercel-ai/index.ts | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/server-utils/src/index.ts b/packages/server-utils/src/index.ts index ec61e9492588..6367f15ba848 100644 --- a/packages/server-utils/src/index.ts +++ b/packages/server-utils/src/index.ts @@ -28,7 +28,12 @@ export type { TracingChannelPayloadWithSpan, } from './tracing-channel'; export type { InstrumentationConfig } from './orchestrion'; -export { vercelAiIntegration, type VercelAiOptions } from './vercel-ai'; +export { + vercelAiIntegration, + type GenAiOptions, + // oxlint-disable-next-line typescript/no-deprecated + 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 64296801c322..29fa63f05f19 100644 --- a/packages/server-utils/src/vercel-ai/index.ts +++ b/packages/server-utils/src/vercel-ai/index.ts @@ -2,7 +2,13 @@ import { defineIntegration, waitForTracingChannelBinding, type IntegrationFn } f import { subscribeVercelAiTracingChannel } from './vercel-ai-dc-subscriber'; import * as dc from 'node:diagnostics_channel'; -export interface VercelAiOptions { +/** + * Recording options shared by all AI integrations. + * + * In v11 every AI integration accepts this single type; prefer it over the + * per-integration option types. + */ +export interface GenAiOptions { /** * 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. @@ -16,14 +22,23 @@ export interface VercelAiOptions { * Integration-level options take precedence over global `dataCollection` config. */ recordOutputs?: boolean; +} +/** + * @deprecated Use {@link GenAiOptions} instead. This type will be removed in v11. + * Note that `enableTruncation` is also removed in v11 (gen_ai input truncation no longer exists). + */ +export interface VercelAiOptions extends GenAiOptions { /** * Enable or disable truncation of recorded input messages. * Defaults to `true`. + * + * @deprecated gen_ai input truncation is removed in v11; this option no longer has an effect there. */ enableTruncation?: boolean; } +// oxlint-disable-next-line typescript/no-deprecated const _vercelAiIntegration = ((options: VercelAiOptions = {}) => { return { name: 'VercelAI' as const,