Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix(studio): redact query rows and errors from Braintrust traces below the data opt-in level (#52106)

Matt Rossman1bd6ce0bc809
diff --git a/apps/studio/lib/ai/braintrust-logger.sdk.test.ts b/apps/studio/lib/ai/braintrust-logger.sdk.test.ts
new file mode 100644
index 00000000000..3bcd372a3c6
--- /dev/null
+++ b/apps/studio/lib/ai/braintrust-logger.sdk.test.ts
@@ -0,0 +1,112 @@
+import * as ai from 'ai'
+import { convertArrayToReadableStream, MockLanguageModelV4 } from 'ai/test'
+import { expect, it } from 'vitest'
+import { z } from 'zod'
+
+import { hideToolErrorsFromModel } from './generate-assistant-response.utils'
+
+type DoStream = Extract<
+ NonNullable<ConstructorParameters<typeof MockLanguageModelV4>[0]>['doStream'],
+ (...args: never[]) => unknown
+>
+type StreamPart =
+ Awaited<ReturnType<DoStream>>['stream'] extends ReadableStream<infer Part> ? Part : never
+
+// Exercise SDK span exports and approval continuation together.
+// approved [rows, error, error] → parallel execution → model step
+it('hides rows and errors from the model and Braintrust', async () => {
+ process.env.BRAINTRUST_API_KEY = 'test'
+ process.env.BRAINTRUST_PROJECT_ID = '00000000-0000-4000-8000-000000000000'
+ const braintrust = await import('braintrust')
+ const { setInitialTestState, simulateLoginForTests, useTestBackgroundLogger } =
+ braintrust._exportsForTestingOnly
+ setInitialTestState()
+ await simulateLoginForTests()
+ const uploads = useTestBackgroundLogger()
+ const { hideSpanErrorFromTrace } = await import('./braintrust-logger')
+ // Use a named test project to avoid a network lookup.
+ braintrust.initLogger({ projectId: process.env.BRAINTRUST_PROJECT_ID, projectName: 'test' })
+
+ const queryErrors = [
+ new Error('invalid input syntax for type integer: "Walk dog"'),
+ new Error('invalid input syntax for type integer: "Feed cat"'),
+ ]
+ const usage = {
+ inputTokens: { total: 1, noCache: undefined, cacheRead: undefined, cacheWrite: undefined },
+ outputTokens: { total: 1, text: undefined, reasoning: undefined },
+ }
+ const prompts: unknown[] = []
+ const doStream: DoStream = async ({ prompt }) => {
+ prompts.push(prompt)
+ return {
+ stream: convertArrayToReadableStream<StreamPart>([
+ { type: 'text-start', id: 'text' },
+ { type: 'text-delta', id: 'text', delta: 'done' },
+ { type: 'text-end', id: 'text' },
+ { type: 'finish', finishReason: { unified: 'stop', raw: undefined }, usage },
+ ]),
+ }
+ }
+ const toolCall = (toolCallId: string, failure: number | null) => ({
+ type: 'tool-call' as const,
+ toolCallId,
+ toolName: 'execute_sql',
+ input: { failure },
+ })
+ const { streamText } = braintrust.wrapAISDK(ai)
+ const result = streamText({
+ model: new MockLanguageModelV4({ doStream }),
+ messages: [
+ { role: 'user', content: 'Count signups' },
+ {
+ role: 'assistant',
+ content: [
+ toolCall('rows', null),
+ { type: 'tool-approval-request', approvalId: 'approve-rows', toolCallId: 'rows' },
+ toolCall('error-0', 0),
+ { type: 'tool-approval-request', approvalId: 'approve-error-0', toolCallId: 'error-0' },
+ toolCall('error-1', 1),
+ { type: 'tool-approval-request', approvalId: 'approve-error-1', toolCallId: 'error-1' },
+ ],
+ },
+ {
+ role: 'tool',
+ content: [
+ { type: 'tool-approval-response', approvalId: 'approve-rows', approved: true },
+ { type: 'tool-approval-response', approvalId: 'approve-error-0', approved: true },
+ { type: 'tool-approval-response', approvalId: 'approve-error-1', approved: true },
+ ],
+ },
+ ],
+ prepareStep: ({ messages }) => ({ messages: hideToolErrorsFromModel(messages, 'schema') }),
+ tools: {
+ execute_sql: ai.tool({
+ inputSchema: z.object({ failure: z.number().nullable() }),
+ needsApproval: true,
+ execute: async ({ failure }) => {
+ if (failure === null) {
+ return { rows: [{ title: 'Buy milk' }], totalRows: 1, optInLevel: 'schema' }
+ }
+ hideSpanErrorFromTrace()
+ throw queryErrors[failure]
+ },
+ toModelOutput: () => ({ type: 'text', value: 'rows hidden' }),
+ }),
+ },
+ })
+ const streamParts = []
+ for await (const part of result.fullStream) streamParts.push(part)
+ await braintrust.flush()
+
+ // Redaction must preserve the errors streamed to the UI.
+ for (const error of queryErrors) {
+ expect(streamParts).toContainEqual(expect.objectContaining({ type: 'tool-error', error }))
+ }
+ expect(prompts).toHaveLength(1)
+ const promptsJson = JSON.stringify(prompts)
+ const uploadsJson = JSON.stringify(await uploads.drain())
+ for (const secret of ['Buy milk', 'Walk dog', 'Feed cat']) {
+ expect(promptsJson).not.toContain(secret)
+ expect(uploadsJson).not.toContain(secret)
+ }
+})
diff --git a/apps/studio/lib/ai/braintrust-logger.test.ts b/apps/studio/lib/ai/braintrust-logger.test.ts
index 4f087b60212..7a43f56a22f 100644
--- a/apps/studio/lib/ai/braintrust-logger.test.ts
+++ b/apps/studio/lib/ai/braintrust-logger.test.ts
@@ -1,6 +1,13 @@
import { describe, expect, it } from 'vitest'
-import { isTracingAllowed } from './braintrust-logger'
+import {
+ hideSpanErrorFromTrace,
+ isTracingAllowed,
+ maskTraceValue,
+ redactHiddenSpanError,
+} from './braintrust-logger'
+import { NO_DATA_ERROR, NO_DATA_PERMISSIONS } from './tools/execute-sql-output'
+import { sanitizeNotebookRunOutput, type NotebookRunOutput } from './tools/notebook-run-output'
describe('isTracingAllowed', () => {
it('allows tracing for non-EU regions', () => {
@@ -17,3 +24,78 @@ describe('isTracingAllowed', () => {
expect(isTracingAllowed({ projectRegion: undefined })).toBe(false)
})
})
+
+describe('maskTraceValue', () => {
+ const rows = [{ email: '[email protected]' }]
+ const notebook = {
+ id: 'nb',
+ name: 'Signups',
+ updated_at: '2026-10-21T00:00:00Z',
+ optInLevel: 'schema',
+ cells: [
+ {
+ cell_id: 'a',
+ title: 'Emails',
+ source: 'database',
+ status: 'success',
+ rows,
+ },
+ ],
+ } satisfies NotebookRunOutput
+
+ it('masks execute_sql output below the data level', () => {
+ expect(maskTraceValue({ rows, totalRows: 1, optInLevel: 'disabled' })).toBe(NO_DATA_PERMISSIONS)
+ })
+
+ it('preserves output at the data level', () => {
+ const output = { rows, totalRows: 1, optInLevel: 'schema_and_log_and_data' }
+ expect(maskTraceValue(output)).toEqual(output)
+ })
+
+ it('masks run_notebook output below the data level', () => {
+ const masked = maskTraceValue(notebook)
+ expect(masked).toEqual(sanitizeNotebookRunOutput(notebook, 'schema'))
+ expect(JSON.stringify(masked)).not.toContain('[email protected]')
+ })
+
+ it('keeps only the stamp when no tool schema matches', () => {
+ expect(maskTraceValue({ records: rows, optInLevel: 'bogus' })).toEqual({ optInLevel: 'bogus' })
+ })
+
+ it('leaves unstamped values alone', () => {
+ const modelView = { rows, note: 'Only the first 100 rows are included.' }
+ expect(maskTraceValue(modelView)).toEqual(modelView)
+ })
+
+ it('masks stamped output in message history', () => {
+ const messages = [{ parts: [{ output: { rows, optInLevel: 'schema' } }] }]
+ expect(maskTraceValue(messages)).toEqual([{ parts: [{ output: NO_DATA_PERMISSIONS }] }])
+ })
+})
+
+describe('redactHiddenSpanError', () => {
+ it('hides child errors until the hidden span ends', () => {
+ hideSpanErrorFromTrace('parent')
+ const childError = (span_id: string) => ({
+ span_id,
+ span_parents: ['parent'],
+ error: 'key (email)=([email protected])',
+ })
+
+ for (const span_id of ['tool-1', 'tool-2']) {
+ expect(redactHiddenSpanError(childError(span_id))).toEqual({
+ ...childError(span_id),
+ error: NO_DATA_ERROR,
+ })
+ }
+ redactHiddenSpanError({ span_id: 'parent', metrics: { end: 1 } })
+ expect(redactHiddenSpanError(childError('tool-3'))).toEqual(childError('tool-3'))
+ })
+
+ it('leaves errors on other spans alone', () => {
+ hideSpanErrorFromTrace('hidden')
+ const otherError = { span_id: 'other', span_parents: ['root'], error: 'boom' }
+
+ expect(redactHiddenSpanError(otherError)).toEqual(otherError)
+ })
+})
diff --git a/apps/studio/lib/ai/braintrust-logger.ts b/apps/studio/lib/ai/braintrust-logger.ts
index ad0d57781a8..e8d2a2ede0e 100644
--- a/apps/studio/lib/ai/braintrust-logger.ts
+++ b/apps/studio/lib/ai/braintrust-logger.ts
@@ -1,5 +1,11 @@
-import { initLogger } from 'braintrust'
+import { currentSpan, initLogger, type SpanExportData } from 'braintrust'
+import { configureInstrumentation } from 'braintrust/instrumentation'
+import { contract as executeSqlContract } from './tools/execute-sql'
+import { NO_DATA_ERROR } from './tools/execute-sql-output'
+import { contract as runNotebookContract } from './tools/run-notebook'
+
+const DATA_LEVEL = 'schema_and_log_and_data'
const BRAINTRUST_API_KEY = process.env.BRAINTRUST_API_KEY
const BRAINTRUST_PROJECT_ID = process.env.BRAINTRUST_PROJECT_ID
@@ -11,6 +17,84 @@ if (IS_TRACING_ENABLED) {
apiKey: BRAINTRUST_API_KEY,
projectId: BRAINTRUST_PROJECT_ID,
})
+ // Span customizers can redact errors before upload.
+ // https://www.braintrust.dev/docs/admin/data-management/protect-sensitive-data#redact-before-upload
+ configureInstrumentation({ spanCustomizers: [{ onSpanExport: redactSpanExport }] })
+}
+
+const MASKED_FIELDS = ['input', 'output', 'expected', 'metadata']
+
+export function redactSpanExport(data: SpanExportData): SpanExportData {
+ const masked = { ...data }
+ for (const field of MASKED_FIELDS) {
+ if (field in data) masked[field] = maskTraceValue(data[field])
+ }
+ return redactHiddenSpanError(masked)
+}
+
+// Markers survive if their span never exports an end record.
+const hiddenErrorSpanIds = new Set<string>()
+
+/**
+ * Keeps a shared parent marked across parallel failures. See braintrust-logger.sdk.test.ts.
+ * [tool error, tool error] → one marker → parent end clears it
+ */
+export function hideSpanErrorFromTrace(spanId = currentSpan().spanId) {
+ if (spanId) hiddenErrorSpanIds.add(spanId)
+}
+
+// The parent marker also hides unrelated child errors.
+export function redactHiddenSpanError(data: SpanExportData): SpanExportData {
+ const parentIds = Array.isArray(data.span_parents) ? data.span_parents : []
+ const hiddenId = [data.span_id, ...parentIds].find(
+ (id): id is string => typeof id === 'string' && hiddenErrorSpanIds.has(id)
+ )
+ if (hiddenId === undefined) return data
+
+ const isEnd = isRecord(data.metrics) && data.metrics.end !== undefined
+ if (data.span_id === hiddenId && isEnd) hiddenErrorSpanIds.delete(hiddenId)
+
+ return data.error === undefined ? data : { ...data, error: NO_DATA_ERROR }
+}
+
+function isRecord(value: unknown): value is Record<string, unknown> {
+ return typeof value === 'object' && value !== null
+}
+
+/**
+ * Masks stamped tool output using its contract's model view.
+ * TODO remove once Braintrust logs `toModelOutput`.
+ * https://github.com/braintrustdata/braintrust-sdk-javascript/issues/2651
+ */
+export function maskTraceValue(value: unknown): unknown {
+ if (Array.isArray(value)) return value.map(maskTraceValue)
+ if (typeof value !== 'object' || value === null) return value
+
+ if (
+ 'optInLevel' in value &&
+ typeof value.optInLevel === 'string' &&
+ value.optInLevel !== DATA_LEVEL
+ ) {
+ return toModelView(value) ?? { optInLevel: value.optInLevel }
+ }
+
+ return Object.fromEntries(
+ Object.entries(value).map(([key, child]) => [key, maskTraceValue(child)])
+ )
+}
+
+function toModelView(value: object) {
+ const sqlOutput = executeSqlContract.outputSchema.safeParse(value)
+ if (sqlOutput.success) {
+ return executeSqlContract.toModelOutput(sqlOutput.data, sqlOutput.data.optInLevel)
+ }
+
+ const notebookOutput = runNotebookContract.outputSchema.safeParse(value)
+ if (notebookOutput.success && notebookOutput.data.optInLevel) {
+ return runNotebookContract.toModelOutput(notebookOutput.data, notebookOutput.data.optInLevel)
+ }
+
+ return undefined
}
// Checks that the project is outside the EU. An unknown region fails closed.
diff --git a/apps/studio/lib/ai/generate-assistant-response.ts b/apps/studio/lib/ai/generate-assistant-response.ts
index e5e97bcb6b7..601cffd3479 100644
--- a/apps/studio/lib/ai/generate-assistant-response.ts
+++ b/apps/studio/lib/ai/generate-assistant-response.ts
@@ -16,7 +16,10 @@ import type { AssistantEvalInput } from '@/evals/scorer'
import type { AiOptInLevel } from '@/hooks/misc/useOrgOptedIntoAi'
import { buildAssistantContextMessages, NO_SCHEMA_ACCESS_MESSAGE } from '@/lib/ai/assistant-context'
import { IS_TRACING_ENABLED } from '@/lib/ai/braintrust-logger'
-import { prepareMessagesForModel } from '@/lib/ai/generate-assistant-response.utils'
+import {
+ hideToolErrorsFromModel,
+ prepareMessagesForModel,
+} from '@/lib/ai/generate-assistant-response.utils'
import {
CHAT_PROMPT,
GENERAL_PROMPT,
@@ -149,6 +152,9 @@ export async function generateAssistantResponse({
instructions: systemMessage,
stopWhen: isStepCount(20),
messages: coreMessages,
+ prepareStep: ({ messages }) => ({
+ messages: hideToolErrorsFromModel(messages, aiOptInLevel),
+ }),
...(providerOptions && { providerOptions }),
tools,
...(abortSignal && { abortSignal }),
diff --git a/apps/studio/lib/ai/generate-assistant-response.utils.test.ts b/apps/studio/lib/ai/generate-assistant-response.utils.test.ts
index 0f06dc84ca7..58b302f3166 100644
--- a/apps/studio/lib/ai/generate-assistant-response.utils.test.ts
+++ b/apps/studio/lib/ai/generate-assistant-response.utils.test.ts
@@ -1,7 +1,11 @@
-import type { ToolUIPart, UIMessage } from 'ai'
+import type { ModelMessage, ToolUIPart, UIMessage } from 'ai'
import { describe, expect, it } from 'vitest'
-import { prepareMessagesForModel } from './generate-assistant-response.utils'
+import {
+ hideToolErrorsFromModel,
+ prepareMessagesForModel,
+} from './generate-assistant-response.utils'
+import { NO_DATA_ERROR } from './tools/execute-sql-output'
import { encodeNotebookToolError, NotebookToolError } from './tools/notebook-tool-error'
function assistantMessage(parts: UIMessage['parts']): UIMessage {
@@ -147,3 +151,42 @@ describe('prepareMessagesForModel', () => {
expect(result[0].parts).toEqual([{ type: 'text', text: 'hello' }])
})
})
+
+describe('hideToolErrorsFromModel', () => {
+ const toolError = (toolName: string): ModelMessage => ({
+ role: 'tool',
+ content: [
+ {
+ type: 'tool-result',
+ toolCallId: 'call-1',
+ toolName,
+ output: { type: 'error-text', value: 'duplicate key (email)=([email protected])' },
+ },
+ ],
+ })
+
+ it('hides execute_sql errors below the data level', () => {
+ expect(hideToolErrorsFromModel([toolError('execute_sql')], 'schema')).toEqual([
+ {
+ role: 'tool',
+ content: [
+ {
+ type: 'tool-result',
+ toolCallId: 'call-1',
+ toolName: 'execute_sql',
+ output: { type: 'error-text', value: NO_DATA_ERROR },
+ },
+ ],
+ },
+ ])
+ })
+
+ it('keeps errors at the data level and from other tools', () => {
+ const messages = [toolError('execute_sql'), toolError('search_docs')]
+
+ expect(hideToolErrorsFromModel(messages, 'schema_and_log_and_data')).toEqual(messages)
+ expect(hideToolErrorsFromModel([toolError('search_docs')], 'schema')).toEqual([
+ toolError('search_docs'),
+ ])
+ })
+})
diff --git a/apps/studio/lib/ai/generate-assistant-response.utils.ts b/apps/studio/lib/ai/generate-assistant-response.utils.ts
index 1c82b83cbef..56a630dec95 100644
--- a/apps/studio/lib/ai/generate-assistant-response.utils.ts
+++ b/apps/studio/lib/ai/generate-assistant-response.utils.ts
@@ -1,6 +1,14 @@
-import { isToolUIPart, type DynamicToolUIPart, type ToolUIPart, type UIMessage } from 'ai'
+import {
+ isToolUIPart,
+ type DynamicToolUIPart,
+ type ModelMessage,
+ type ToolUIPart,
+ type UIMessage,
+} from 'ai'
import type { AiOptInLevel } from '@/hooks/misc/useOrgOptedIntoAi'
+import { isOptInLevelAtLeast } from '@/lib/ai/opt-in-level'
+import { NO_DATA_ERROR } from '@/lib/ai/tools/execute-sql-output'
import { decodeNotebookToolError } from '@/lib/ai/tools/notebook-tool-error'
import { sanitizeMessagePart } from '@/lib/ai/tools/tool-sanitizer'
@@ -48,3 +56,25 @@ export function prepareMessagesForModel(rawMessages: UIMessage[], aiOptInLevel:
return msg
})
}
+
+/**
+ * Database errors can echo row values. Sanitize same-request steps here.
+ * `prepareMessagesForModel` drops errors from later turns.
+ */
+export function hideToolErrorsFromModel(messages: ModelMessage[], aiOptInLevel: AiOptInLevel) {
+ if (isOptInLevelAtLeast(aiOptInLevel, 'schema_and_log_and_data')) return messages
+
+ return messages.map((message) => {
+ if (message.role !== 'tool') return message
+ return {
+ ...message,
+ content: message.content.map((part) =>
+ part.type === 'tool-result' &&
+ part.toolName === 'execute_sql' &&
+ (part.output.type === 'error-text' || part.output.type === 'error-json')
+ ? { ...part, output: { type: 'error-text' as const, value: NO_DATA_ERROR } }
+ : part
+ ),
+ }
+ })
+}
diff --git a/apps/studio/lib/ai/tools/execute-sql-output.ts b/apps/studio/lib/ai/tools/execute-sql-output.ts
index 0c582e19bd9..cdfee35bd79 100644
--- a/apps/studio/lib/ai/tools/execute-sql-output.ts
+++ b/apps/studio/lib/ai/tools/execute-sql-output.ts
@@ -8,6 +8,9 @@ import type { AiOptInLevel } from '@/hooks/misc/useOrgOptedIntoAi'
export const NO_DATA_PERMISSIONS =
'The query was executed and the user has viewed the results but decided not to share in the conversation due to permission levels. Continue with your plan unless instructed to interpret the result. If you need the rows to answer and `update_opt_in_level` is available, call it with `schema_and_log_and_data`, unless the user already skipped that request in this chat.'
+export const NO_DATA_ERROR =
+ 'The query failed. The error is not shared at the current permission level.'
+
// the rows.length default covers chats saved before execute_sql sliced its rows
export const toModelRows = <T>(
rows: T[],
diff --git a/apps/studio/lib/ai/tools/execute-sql.server.ts b/apps/studio/lib/ai/tools/execute-sql.server.ts
index 5aedfab52de..8d95c9ed600 100644
--- a/apps/studio/lib/ai/tools/execute-sql.server.ts
+++ b/apps/studio/lib/ai/tools/execute-sql.server.ts
@@ -7,6 +7,8 @@ import { approvalGatedToolFromContract } from './tool-from-contract'
import type { ApprovalGatedToolFactory } from './types'
import { DEFAULT_CELL_ROW_LIMIT } from '@/components/interfaces/Explorer/QueryCell/QueryCell.utils'
import { executeSql } from '@/data/sql/execute-sql-mutation'
+import { hideSpanErrorFromTrace } from '@/lib/ai/braintrust-logger'
+import { isOptInLevelAtLeast } from '@/lib/ai/opt-in-level'
export const createTool: ApprovalGatedToolFactory<typeof contract> = (ctx) => {
const { projectRef, connectionString, aiOptInLevel } = ctx
@@ -24,7 +26,10 @@ export const createTool: ApprovalGatedToolFactory<typeof contract> = (ctx) => {
{ projectRef, connectionString, sql: limitedSql },
abortSignal,
authHeaders
- )
+ ).catch((error: unknown) => {
+ if (!isOptInLevelAtLeast(aiOptInLevel, 'schema_and_log_and_data')) hideSpanErrorFromTrace()
+ throw error
+ })
const rows = Array.isArray(result) ? result : []
const isCapped = rows.length > DEFAULT_CELL_ROW_LIMIT
const hasMoreRows = isCappedInDatabase && isCapped
diff --git a/apps/studio/lib/ai/tools/studio-tools.test.ts b/apps/studio/lib/ai/tools/studio-tools.test.ts
index d925d6017cf..62cdcb9a512 100644
--- a/apps/studio/lib/ai/tools/studio-tools.test.ts
+++ b/apps/studio/lib/ai/tools/studio-tools.test.ts
@@ -139,6 +139,30 @@ describe('ai/tools/studio-tools', () => {
})
})
+ it('preserves execute_sql errors below the data level', async () => {
+ const error = new Error('duplicate key (email)=([email protected])')
+ vi.mocked(executeSql).mockRejectedValue(error)
+
+ const tools = getStudioTools({
+ projectRef: 'test-project',
+ connectionString: 'encrypted-connection-string',
+ aiOptInLevel: 'schema',
+ })
+
+ if (!tools.execute_sql.execute) throw new Error('execute is undefined')
+ await expect(
+ tools.execute_sql.execute(
+ {
+ sql: 'INSERT INTO users (email) VALUES (1)',
+ label: 'Insert',
+ chartConfig: { view: 'table' },
+ isWriteQuery: true,
+ },
+ { toolCallId: 'test', messages: [], context: {} }
+ )
+ ).rejects.toBe(error)
+ })
+
it('should return execute_sql rows with data opt-in', async () => {
const rows = [{ email: '[email protected]' }]
vi.mocked(executeSql).mockResolvedValue({ result: rows })
diff --git a/apps/studio/lib/api/generate-v4.test.ts b/apps/studio/lib/api/generate-v4.test.ts
index 9d1934837c5..fbc229aa264 100644
--- a/apps/studio/lib/api/generate-v4.test.ts
+++ b/apps/studio/lib/api/generate-v4.test.ts
@@ -38,6 +38,9 @@ vi.mock('ai', async () => {
const actual = await vi.importActual('ai')
return {
...actual,
+ // Braintrust reads this property to check whether `ai` is a language model.
+ // Vitest throws if the mock omits it.
+ specificationVersion: undefined,
streamText: vi.fn().mockImplementation(() => ({
stream: new ReadableStream({
start(controller) {
diff --git a/apps/studio/package.json b/apps/studio/package.json
index bd5a8b3c166..2e5ae7d7319 100644
--- a/apps/studio/package.json
+++ b/apps/studio/package.json
@@ -99,7 +99,7 @@
"ai": "7.0.59",
"ai-commands": "workspace:*",
"awesome-debounce-promise": "^2.1.0",
- "braintrust": "^3.9.0",
+ "braintrust": "^3.37.2",
"class-variance-authority": "^0.7.1",
"common": "workspace:*",
"common-tags": "^1.8.2",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b59cc5e854a..57212ada2d9 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1192,8 +1192,8 @@ importers:
specifier: ^2.1.0
version: 2.1.0
braintrust:
- specifier: ^3.9.0
+ specifier: ^3.37.2
class-variance-authority:
specifier: ^0.7.1
version: 0.7.1
@@ -3260,10 +3260,6 @@ packages:
peerDependencies:
zod: ^3.25.76 || ^4.1.8
- '@ai-sdk/[email protected]':
- resolution: {integrity: sha512-qZMxYJ0qqX/RfnuIaab+zp8UAeJn/ygXXAffR5I4N0n1IrvA6qBsjc8hXLmBiMV2zoXlifkacF7sEFnYnjBcqg==}
- engines: {node: '>=18'}
-
'@ai-sdk/[email protected]':
resolution: {integrity: sha512-6o7Y2SeO9vFKB8lArHXehNuusnpddKPk7xqL7T2/b+OvXMRIXUO1rR4wcv1hAFUAT9avGZshty3Wlua/XA7TvA==}
engines: {node: '>=18'}
@@ -3292,9 +3288,6 @@ packages:
resolution: {integrity: sha512-YxLBY5nGlurL7QeJLq6e5g0ouBpAp0pwgyA/5rHXEXwhiPLn9ZHbT+Y2LlP90GT872cSocfjWRYu/fnpuBudNQ==}
engines: {node: '>=18.0.0'}
- '@apm-js-collab/[email protected]':
- resolution: {integrity: sha512-5F2ob4cMYezbaUGAk+YltbDvb9BFIghN92ubct9Ho/0MFx4FkChCxYV99NkU6Kx+RAgaqBV6yxKuWreQ6K8SOw==}
-
'@apm-js-collab/[email protected]':
resolution: {integrity: sha512-XmXYVs8CzJ1Aj79noVbn2weUO/XWtRyURpGqx7aU7DOXlUQhR0WKOQNF0okh7PCeY37vxf7kU3v57OAkEPm3ww==}
hasBin: true
@@ -3808,6 +3801,44 @@ packages:
'@braintree/[email protected]':
resolution: {integrity: sha512-jigsZK+sMF/cuiB7sERuo9V7N9jx+dhmHHnQyDSVdpZwVutaBu7WvNYqMDLSgFgfB30n452TP3vjDAvFC973mA==}
+ '@braintrust/[email protected]':
+ resolution: {integrity: sha512-mY6VW/3VwcOQOGN8sYHS6F0xzHTFwgZcNlj7zlQttI6OXOCGt/bhonGIqd03QBhxmj0M31ymSS7TqSeCK/RYIQ==}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@braintrust/[email protected]':
+ resolution: {integrity: sha512-woyRyDv2DfCF8+von+3X9f1cddAbFnKLSfCbEkrBQVc0ZsAM60as8nehYv7DkafJF/67yKFx/sUraV65sukesQ==}
+ cpu: [x64]
+ os: [darwin]
+
+ '@braintrust/[email protected]':
+ resolution: {integrity: sha512-J9/7f3EIMKmFmSSQHQnAQLpUgB8YJENrOlkABjlTprBgsIYVgz7tSH7yg2P3ur+2Jem7PpGnrDxHGh/UjRfjsg==}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ '@braintrust/[email protected]':
+ resolution: {integrity: sha512-KnLgENOoztBXcH+mLFJe4bYzi67kSOuELOQrm4Hler35GjgaBMI1fFLIUjKRPAmyT9VIhBMhy1ICfGEFLueMEQ==}
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ '@braintrust/[email protected]':
+ resolution: {integrity: sha512-HJFbUl3HYYY1Ivw8OYBeIMcIsU9r7+fC9BzLWB5FdH7881ToKee2wbbLZssMCxFbMVeUxzEo+SzGD/1Z9Gk9CA==}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ '@braintrust/[email protected]':
+ resolution: {integrity: sha512-+7PkdBAmiqEJsWteGHP/Zs62F75PkHPA8m/ej4TOz/mHGKulUU0bZibw91KRqIB7J7jGi5ItvCiqkiGaLKLnyw==}
+ cpu: [arm64]
+ os: [win32]
+
+ '@braintrust/[email protected]':
+ resolution: {integrity: sha512-Q0c+pVUGm82n/7N8QJ5s6j/G/Q0GFzqOaTipHjkmElLbAOOEcfRH/uljdtIPNBiEQcrzqirS0GmOgiFkeQ3Txg==}
+ cpu: [x64]
+ os: [win32]
+
'@bramus/[email protected]':
resolution: {integrity: sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==}
hasBin: true
@@ -10195,6 +10226,9 @@ packages:
resolution: {integrity: sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==}
+ resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==}
+
resolution: {integrity: sha512-MxT4XZL7pzLHpuvhDKdMaQHMGGkJDLluKBLsbstn+8wv9sWcFT6h+0ve9qkml95amVTZtZV83gQe2hY+ojgHLg==}
hasBin: true
@@ -10209,9 +10243,6 @@ packages:
resolution: {integrity: sha512-PMqBCBvrOVDRqLGooQb+z+t1Q0PiPyurUQeZRR5uHBOVZcW8B04KMmnT12USnhpNX2wCPagWzLVppQMUG3u0Dw==}
- resolution: {integrity: sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==}
-
resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==}
engines: {node: '>=6'}
@@ -10546,10 +10577,6 @@ packages:
resolution: {integrity: sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==}
- resolution: {integrity: sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==}
- engines: {node: '>=18'}
-
resolution: {integrity: sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==}
@@ -10564,11 +10591,15 @@ packages:
resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==}
engines: {node: '>=8'}
- resolution: {integrity: sha512-Sd/HC8qGgKsRf3hX1nLeyhoQZkUBIVmq4c+kV36FEbK77JyHiq9Bz11q/KPr1zzmPRhHRx4bA5zySuMUbVWFug==}
+ resolution: {integrity: sha512-iHbtwSBJ/5Q7yWE86L3xJZlGPkr0ZwqQbu4xELzXBRMcIbiOHBkyA+MDrY/QbW/50JLVaiJXWn+eP2DiWNr7+Q==}
hasBin: true
peerDependencies:
+ '@types/react': '>=18'
zod: ^3.25.34 || ^4.0
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
resolution: {integrity: sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg==}
@@ -10645,10 +10676,6 @@ packages:
resolution: {integrity: sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==}
- resolution: {integrity: sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==}
- engines: {node: '>=16'}
-
resolution: {integrity: sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==}
@@ -10789,10 +10816,6 @@ packages:
resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==}
engines: {node: '>=6'}
- resolution: {integrity: sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==}
- engines: {node: '>=10'}
-
resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==}
engines: {node: '>=8'}
@@ -11520,9 +11543,6 @@ packages:
resolution: {integrity: sha512-6RBY/bSn42UrqATwsiULj2uYFyEykB3XeA/NLIVQeHNXlYV6D4Idxx3/aa6k5Y45Dwzx7sygeLotnqHWSeURYA==}
- resolution: {integrity: sha512-7oEtnzNlcE+hr4OvO3GR6Gndgw8BhW+wKOEwMqSleyY7N29jbAxzyW5BaJl7qBCw+6OIxfMWtY0T+6dxq8RWLw==}
-
resolution: {integrity: sha512-rZHcgBkbYavBeD9ej6sP56XfG53d51CD4dnaw989YX/nZ/ZJfgRx/9ePKmTNiUiyQvh4mtrMoS3OAWW+yoYtpg==}
@@ -14844,6 +14864,10 @@ packages:
resolution: {integrity: sha512-Rwi3pnapEqirPSbWbrZaa6N3nmqq4Xer/2XooiOKyV3q12ML06f7MOuc5DVH8ONZIFhwIYQ3yzPH4nt7iWHaTg==}
engines: {node: 18 || 20 || >=22}
+ resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==}
+ engines: {node: 18 || 20 || >=22}
+
resolution: {integrity: sha512-twmL+S8+7yIsE9wsqgzU3E8/LumN3M3QELrBZ20OdmQ9jB2JvW5oZtBEmft84k/Gs5CG9mqtWc6Y9vW+JEzGxw==}
@@ -18873,10 +18897,6 @@ packages:
resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==}
- resolution: {integrity: sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==}
- engines: {node: '>=18'}
-
resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==}
engines: {node: '>=8'}
@@ -19216,10 +19236,6 @@ snapshots:
undici: 7.30.0
zod: 3.25.76
- '@ai-sdk/[email protected]':
- dependencies:
- json-schema: 0.4.0
-
'@ai-sdk/[email protected]':
dependencies:
json-schema: 0.4.0
@@ -19256,15 +19272,6 @@ snapshots:
magic-string: 0.30.21
module-details-from-path: 1.0.4
- '@apm-js-collab/[email protected]':
- dependencies:
- '@types/estree': 1.0.8
- astring: 1.9.0
- esquery: 1.7.0
- meriyah: 6.1.4
- semifies: 1.0.0
- source-map: 0.6.1
-
'@apm-js-collab/[email protected]':
dependencies:
'@types/estree': 1.0.8
@@ -20218,6 +20225,27 @@ snapshots:
'@braintree/[email protected]': {}
+ '@braintrust/[email protected]':
+ optional: true
+
+ '@braintrust/[email protected]':
+ optional: true
+
+ '@braintrust/[email protected]':
+ optional: true
+
+ '@braintrust/[email protected]':
+ optional: true
+
+ '@braintrust/[email protected]':
+ optional: true
+
+ '@braintrust/[email protected]':
+ optional: true
+
+ '@braintrust/[email protected]':
+ optional: true
+
'@bramus/[email protected]':
dependencies:
css-tree: 3.1.0
@@ -27598,6 +27626,13 @@ snapshots:
json-schema-traverse: 1.0.0
require-from-string: 2.0.2
+ dependencies:
+ fast-deep-equal: 3.1.3
+ fast-uri: 3.1.8
+ json-schema-traverse: 1.0.0
+ require-from-string: 2.0.2
+
dependencies:
process-ancestry: 0.1.0
@@ -27608,10 +27643,6 @@ snapshots:
- dependencies:
- string-width: 4.2.3
-
@@ -28086,17 +28117,6 @@ snapshots:
- dependencies:
- ansi-align: 3.0.1
- camelcase: 8.0.0
- chalk: 5.6.2
- cli-boxes: 3.0.0
- string-width: 7.2.0
- type-fest: 4.30.0
- widest-line: 5.0.0
- wrap-ansi: 9.0.2
-
dependencies:
balanced-match: 1.0.2
@@ -28114,37 +28134,46 @@ snapshots:
dependencies:
fill-range: 7.1.1
dependencies:
- '@ai-sdk/provider': 1.1.3
- '@apm-js-collab/code-transformer': 0.12.0
'@next/env': 14.2.35
'@vercel/functions': 1.6.0(@aws-sdk/[email protected])
- ajv: 8.18.0
+ acorn: 8.18.0
+ acorn-import-attributes: 1.9.5([email protected])
+ ajv: 8.20.0
argparse: 2.0.1
- boxen: 8.0.1
- chalk: 4.1.2
+ astring: 1.9.0
+ cjs-module-lexer: 2.2.0
cli-progress: 3.12.0
cli-table3: 0.6.5
cors: 2.8.5
- dc-browser: 1.0.4
dotenv: 16.5.0
esbuild: 0.28.1
+ esquery: 1.7.0
eventsource-parser: 1.1.2
- express: 4.22.1([email protected])
- graceful-fs: 4.2.11
+ express: 5.2.1([email protected])
http-errors: 2.0.1
- minimatch: 9.0.7
+ meriyah: 6.1.4
+ minimatch: 10.2.6
module-details-from-path: 1.0.4
mustache: 4.2.0
pluralize: 8.0.0
- simple-git: 3.36.0([email protected])
+ semifies: 1.0.0
source-map: 0.7.6
termi-link: 1.1.0
unplugin: 2.3.11
uuid: 11.1.1
zod: 3.25.76
zod-to-json-schema: 3.25.1([email protected])
+ optionalDependencies:
+ '@braintrust/bt-darwin-arm64': 0.12.0
+ '@braintrust/bt-darwin-x64': 0.12.0
+ '@braintrust/bt-linux-arm64': 0.12.0
+ '@braintrust/bt-linux-x64': 0.12.0
+ '@braintrust/bt-linux-x64-musl': 0.12.0
+ '@braintrust/bt-win32-arm64': 0.12.0
+ '@braintrust/bt-win32-x64': 0.12.0
+ '@types/react': 19.2.14
transitivePeerDependencies:
- '@aws-sdk/credential-provider-web-identity'
- supports-color
@@ -28249,8 +28278,6 @@ snapshots:
pascal-case: 3.1.2
tslib: 2.8.1
-
@@ -28411,8 +28438,6 @@ snapshots:
-
dependencies:
restore-cursor: 3.1.0
@@ -29147,8 +29172,6 @@ snapshots:
-
@@ -33343,6 +33366,10 @@ snapshots:
dependencies:
brace-expansion: 5.0.12
+ dependencies:
+ brace-expansion: 5.0.12
+
dependencies:
brace-expansion: 1.1.21
@@ -38462,10 +38489,6 @@ snapshots:
dependencies:
string-width: 4.2.3
- dependencies:
- string-width: 7.2.0
-
dependencies:
ansi-styles: 4.3.0
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index a6876016899..075db868db8 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -67,6 +67,7 @@ allowBuilds:
'@supabase/pg-meta@file:packages/pg-meta': set this to true or false
ai-commands@file:packages/ai-commands: set this to true or false
api-types@file:packages/api-types: set this to true or false
+ braintrust: false
common@file:packages/common: set this to true or false
config@file:packages/config: set this to true or false
contentlayer2: false