@ai-sdk/anthropic 3.0.0-beta.93 → 3.0.0-beta.95

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.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/anthropic-provider.ts","../src/version.ts","../src/anthropic-messages-language-model.ts","../src/anthropic-error.ts","../src/convert-anthropic-messages-usage.ts","../src/anthropic-messages-api.ts","../src/anthropic-messages-options.ts","../src/anthropic-prepare-tools.ts","../src/get-cache-control.ts","../src/tool/text-editor_20250728.ts","../src/tool/web-search_20250305.ts","../src/tool/web-fetch-20250910.ts","../src/convert-to-anthropic-messages-prompt.ts","../src/tool/code-execution_20250522.ts","../src/tool/code-execution_20250825.ts","../src/tool/tool-search-regex_20251119.ts","../src/map-anthropic-stop-reason.ts","../src/tool/bash_20241022.ts","../src/tool/bash_20250124.ts","../src/tool/computer_20241022.ts","../src/tool/computer_20250124.ts","../src/tool/memory_20250818.ts","../src/tool/text-editor_20241022.ts","../src/tool/text-editor_20250124.ts","../src/tool/text-editor_20250429.ts","../src/tool/tool-search-bm25_20251119.ts","../src/anthropic-tools.ts","../src/forward-anthropic-container-id-from-last-step.ts"],"sourcesContent":["export type { AnthropicMessageMetadata } from './anthropic-message-metadata';\nexport type { AnthropicProviderOptions } from './anthropic-messages-options';\nexport type { AnthropicToolOptions } from './anthropic-prepare-tools';\nexport { anthropic, createAnthropic } from './anthropic-provider';\nexport type {\n AnthropicProvider,\n AnthropicProviderSettings,\n} from './anthropic-provider';\nexport { forwardAnthropicContainerIdFromLastStep } from './forward-anthropic-container-id-from-last-step';\nexport { VERSION } from './version';\n","import {\n LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\n} from '@ai-sdk/provider';\nimport {\n FetchFunction,\n generateId,\n loadApiKey,\n loadOptionalSetting,\n withoutTrailingSlash,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { VERSION } from './version';\nimport { AnthropicMessagesLanguageModel } from './anthropic-messages-language-model';\nimport { AnthropicMessagesModelId } from './anthropic-messages-options';\nimport { anthropicTools } from './anthropic-tools';\n\nexport interface AnthropicProvider extends ProviderV3 {\n /**\nCreates a model for text generation.\n*/\n (modelId: AnthropicMessagesModelId): LanguageModelV3;\n\n /**\nCreates a model for text generation.\n*/\n languageModel(modelId: AnthropicMessagesModelId): LanguageModelV3;\n\n chat(modelId: AnthropicMessagesModelId): LanguageModelV3;\n\n messages(modelId: AnthropicMessagesModelId): LanguageModelV3;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n\n /**\nAnthropic-specific computer use tool.\n */\n tools: typeof anthropicTools;\n}\n\nexport interface AnthropicProviderSettings {\n /**\nUse a different URL prefix for API calls, e.g. to use proxy servers.\nThe default prefix is `https://api.anthropic.com/v1`.\n */\n baseURL?: string;\n\n /**\nAPI key that is being send using the `x-api-key` header.\nIt defaults to the `ANTHROPIC_API_KEY` environment variable.\n */\n apiKey?: string;\n\n /**\nCustom headers to include in the requests.\n */\n headers?: Record<string, string>;\n\n /**\nCustom fetch implementation. You can use it as a middleware to intercept requests,\nor to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n\n generateId?: () => string;\n\n /**\n * Custom provider name\n * Defaults to 'anthropic.messages'.\n */\n name?: string;\n}\n\n/**\nCreate an Anthropic provider instance.\n */\nexport function createAnthropic(\n options: AnthropicProviderSettings = {},\n): AnthropicProvider {\n const baseURL =\n withoutTrailingSlash(\n loadOptionalSetting({\n settingValue: options.baseURL,\n environmentVariableName: 'ANTHROPIC_BASE_URL',\n }),\n ) ?? 'https://api.anthropic.com/v1';\n\n const providerName = options.name ?? 'anthropic.messages';\n\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n 'anthropic-version': '2023-06-01',\n 'x-api-key': loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'ANTHROPIC_API_KEY',\n description: 'Anthropic',\n }),\n ...options.headers,\n },\n `ai-sdk/anthropic/${VERSION}`,\n );\n\n const createChatModel = (modelId: AnthropicMessagesModelId) =>\n new AnthropicMessagesLanguageModel(modelId, {\n provider: providerName,\n baseURL,\n headers: getHeaders,\n fetch: options.fetch,\n generateId: options.generateId ?? generateId,\n supportedUrls: () => ({\n 'image/*': [/^https?:\\/\\/.*$/],\n }),\n });\n\n const provider = function (modelId: AnthropicMessagesModelId) {\n if (new.target) {\n throw new Error(\n 'The Anthropic model function cannot be called with the new keyword.',\n );\n }\n\n return createChatModel(modelId);\n };\n\n provider.specificationVersion = 'v3' as const;\n provider.languageModel = createChatModel;\n provider.chat = createChatModel;\n provider.messages = createChatModel;\n\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n provider.tools = anthropicTools;\n\n return provider;\n}\n\n/**\nDefault Anthropic provider instance.\n */\nexport const anthropic = createAnthropic();\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n","import {\n APICallError,\n JSONObject,\n LanguageModelV3,\n LanguageModelV3Content,\n LanguageModelV3FinishReason,\n LanguageModelV3FunctionTool,\n LanguageModelV3Prompt,\n LanguageModelV3Source,\n LanguageModelV3StreamPart,\n LanguageModelV3ToolCall,\n SharedV3ProviderMetadata,\n SharedV3Warning,\n} from '@ai-sdk/provider';\nimport {\n combineHeaders,\n createEventSourceResponseHandler,\n createJsonResponseHandler,\n createToolNameMapping,\n FetchFunction,\n generateId,\n InferSchema,\n parseProviderOptions,\n ParseResult,\n postJsonToApi,\n Resolvable,\n resolve,\n} from '@ai-sdk/provider-utils';\nimport { anthropicFailedResponseHandler } from './anthropic-error';\nimport { AnthropicMessageMetadata } from './anthropic-message-metadata';\nimport {\n AnthropicMessagesUsage,\n convertAnthropicMessagesUsage,\n} from './convert-anthropic-messages-usage';\nimport {\n AnthropicContextManagementConfig,\n AnthropicContainer,\n anthropicMessagesChunkSchema,\n anthropicMessagesResponseSchema,\n AnthropicReasoningMetadata,\n AnthropicResponseContextManagement,\n Citation,\n} from './anthropic-messages-api';\nimport {\n AnthropicMessagesModelId,\n anthropicProviderOptions,\n} from './anthropic-messages-options';\nimport { prepareTools } from './anthropic-prepare-tools';\nimport { convertToAnthropicMessagesPrompt } from './convert-to-anthropic-messages-prompt';\nimport { CacheControlValidator } from './get-cache-control';\nimport { mapAnthropicStopReason } from './map-anthropic-stop-reason';\n\nfunction createCitationSource(\n citation: Citation,\n citationDocuments: Array<{\n title: string;\n filename?: string;\n mediaType: string;\n }>,\n generateId: () => string,\n): LanguageModelV3Source | undefined {\n if (citation.type !== 'page_location' && citation.type !== 'char_location') {\n return;\n }\n\n const documentInfo = citationDocuments[citation.document_index];\n\n if (!documentInfo) {\n return;\n }\n\n return {\n type: 'source' as const,\n sourceType: 'document' as const,\n id: generateId(),\n mediaType: documentInfo.mediaType,\n title: citation.document_title ?? documentInfo.title,\n filename: documentInfo.filename,\n providerMetadata: {\n anthropic:\n citation.type === 'page_location'\n ? {\n citedText: citation.cited_text,\n startPageNumber: citation.start_page_number,\n endPageNumber: citation.end_page_number,\n }\n : {\n citedText: citation.cited_text,\n startCharIndex: citation.start_char_index,\n endCharIndex: citation.end_char_index,\n },\n } satisfies SharedV3ProviderMetadata,\n };\n}\n\ntype AnthropicMessagesConfig = {\n provider: string;\n baseURL: string;\n headers: Resolvable<Record<string, string | undefined>>;\n fetch?: FetchFunction;\n buildRequestUrl?: (baseURL: string, isStreaming: boolean) => string;\n transformRequestBody?: (args: Record<string, any>) => Record<string, any>;\n supportedUrls?: () => LanguageModelV3['supportedUrls'];\n generateId?: () => string;\n\n /**\n * When false, the model will use JSON tool fallback for structured outputs.\n */\n supportsNativeStructuredOutput?: boolean;\n};\n\nexport class AnthropicMessagesLanguageModel implements LanguageModelV3 {\n readonly specificationVersion = 'v3';\n\n readonly modelId: AnthropicMessagesModelId;\n\n private readonly config: AnthropicMessagesConfig;\n private readonly generateId: () => string;\n\n constructor(\n modelId: AnthropicMessagesModelId,\n config: AnthropicMessagesConfig,\n ) {\n this.modelId = modelId;\n this.config = config;\n this.generateId = config.generateId ?? generateId;\n }\n\n supportsUrl(url: URL): boolean {\n return url.protocol === 'https:';\n }\n\n get provider(): string {\n return this.config.provider;\n }\n\n get supportedUrls() {\n return this.config.supportedUrls?.() ?? {};\n }\n\n private async getArgs({\n userSuppliedBetas,\n prompt,\n maxOutputTokens,\n temperature,\n topP,\n topK,\n frequencyPenalty,\n presencePenalty,\n stopSequences,\n responseFormat,\n seed,\n tools,\n toolChoice,\n providerOptions,\n stream,\n }: Parameters<LanguageModelV3['doGenerate']>[0] & {\n stream: boolean;\n userSuppliedBetas: Set<string>;\n }) {\n const warnings: SharedV3Warning[] = [];\n\n if (frequencyPenalty != null) {\n warnings.push({ type: 'unsupported', feature: 'frequencyPenalty' });\n }\n\n if (presencePenalty != null) {\n warnings.push({ type: 'unsupported', feature: 'presencePenalty' });\n }\n\n if (seed != null) {\n warnings.push({ type: 'unsupported', feature: 'seed' });\n }\n\n if (temperature != null && temperature > 1) {\n warnings.push({\n type: 'unsupported',\n feature: 'temperature',\n details: `${temperature} exceeds anthropic maximum of 1.0. clamped to 1.0`,\n });\n temperature = 1;\n } else if (temperature != null && temperature < 0) {\n warnings.push({\n type: 'unsupported',\n feature: 'temperature',\n details: `${temperature} is below anthropic minimum of 0. clamped to 0`,\n });\n temperature = 0;\n }\n\n if (responseFormat?.type === 'json') {\n if (responseFormat.schema == null) {\n warnings.push({\n type: 'unsupported',\n feature: 'responseFormat',\n details:\n 'JSON response format requires a schema. ' +\n 'The response format is ignored.',\n });\n }\n }\n\n const anthropicOptions = await parseProviderOptions({\n provider: 'anthropic',\n providerOptions,\n schema: anthropicProviderOptions,\n });\n\n const {\n maxOutputTokens: maxOutputTokensForModel,\n supportsStructuredOutput: modelSupportsStructuredOutput,\n isKnownModel,\n } = getModelCapabilities(this.modelId);\n\n const supportsStructuredOutput =\n (this.config.supportsNativeStructuredOutput ?? true) &&\n modelSupportsStructuredOutput;\n\n const structureOutputMode =\n anthropicOptions?.structuredOutputMode ?? 'auto';\n const useStructuredOutput =\n structureOutputMode === 'outputFormat' ||\n (structureOutputMode === 'auto' && supportsStructuredOutput);\n\n const jsonResponseTool: LanguageModelV3FunctionTool | undefined =\n responseFormat?.type === 'json' &&\n responseFormat.schema != null &&\n !useStructuredOutput\n ? {\n type: 'function',\n name: 'json',\n description: 'Respond with a JSON object.',\n inputSchema: responseFormat.schema,\n }\n : undefined;\n\n const contextManagement = anthropicOptions?.contextManagement;\n\n // Create a shared cache control validator to track breakpoints across tools and messages\n const cacheControlValidator = new CacheControlValidator();\n\n const toolNameMapping = createToolNameMapping({\n tools,\n providerToolNames: {\n 'anthropic.code_execution_20250522': 'code_execution',\n 'anthropic.code_execution_20250825': 'code_execution',\n 'anthropic.computer_20241022': 'computer',\n 'anthropic.computer_20250124': 'computer',\n 'anthropic.text_editor_20241022': 'str_replace_editor',\n 'anthropic.text_editor_20250124': 'str_replace_editor',\n 'anthropic.text_editor_20250429': 'str_replace_based_edit_tool',\n 'anthropic.text_editor_20250728': 'str_replace_based_edit_tool',\n 'anthropic.bash_20241022': 'bash',\n 'anthropic.bash_20250124': 'bash',\n 'anthropic.memory_20250818': 'memory',\n 'anthropic.web_search_20250305': 'web_search',\n 'anthropic.web_fetch_20250910': 'web_fetch',\n 'anthropic.tool_search_regex_20251119': 'tool_search_tool_regex',\n 'anthropic.tool_search_bm25_20251119': 'tool_search_tool_bm25',\n },\n });\n\n const { prompt: messagesPrompt, betas } =\n await convertToAnthropicMessagesPrompt({\n prompt,\n sendReasoning: anthropicOptions?.sendReasoning ?? true,\n warnings,\n cacheControlValidator,\n toolNameMapping,\n });\n\n const isThinking = anthropicOptions?.thinking?.type === 'enabled';\n let thinkingBudget = anthropicOptions?.thinking?.budgetTokens;\n\n const maxTokens = maxOutputTokens ?? maxOutputTokensForModel;\n\n const baseArgs = {\n // model id:\n model: this.modelId,\n\n // standardized settings:\n max_tokens: maxTokens,\n temperature,\n top_k: topK,\n top_p: topP,\n stop_sequences: stopSequences,\n\n // provider specific settings:\n ...(isThinking && {\n thinking: { type: 'enabled', budget_tokens: thinkingBudget },\n }),\n ...(anthropicOptions?.effort && {\n output_config: { effort: anthropicOptions.effort },\n }),\n\n // structured output:\n ...(useStructuredOutput &&\n responseFormat?.type === 'json' &&\n responseFormat.schema != null && {\n output_format: {\n type: 'json_schema',\n schema: responseFormat.schema,\n },\n }),\n\n // mcp servers:\n ...(anthropicOptions?.mcpServers &&\n anthropicOptions.mcpServers.length > 0 && {\n mcp_servers: anthropicOptions.mcpServers.map(server => ({\n type: server.type,\n name: server.name,\n url: server.url,\n authorization_token: server.authorizationToken,\n tool_configuration: server.toolConfiguration\n ? {\n allowed_tools: server.toolConfiguration.allowedTools,\n enabled: server.toolConfiguration.enabled,\n }\n : undefined,\n })),\n }),\n\n // container: For programmatic tool calling (just an ID string) or agent skills (object with id and skills)\n ...(anthropicOptions?.container && {\n container:\n anthropicOptions.container.skills &&\n anthropicOptions.container.skills.length > 0\n ? // Object format when skills are provided (agent skills feature)\n ({\n id: anthropicOptions.container.id,\n skills: anthropicOptions.container.skills.map(skill => ({\n type: skill.type,\n skill_id: skill.skillId,\n version: skill.version,\n })),\n } satisfies AnthropicContainer)\n : // String format for container ID only (programmatic tool calling)\n anthropicOptions.container.id,\n }),\n\n // prompt:\n system: messagesPrompt.system,\n messages: messagesPrompt.messages,\n\n ...(contextManagement && {\n context_management: {\n edits: contextManagement.edits\n .map(edit => {\n const strategy = edit.type;\n switch (strategy) {\n case 'clear_tool_uses_20250919':\n return {\n type: edit.type,\n ...(edit.trigger !== undefined && {\n trigger: edit.trigger,\n }),\n ...(edit.keep !== undefined && { keep: edit.keep }),\n ...(edit.clearAtLeast !== undefined && {\n clear_at_least: edit.clearAtLeast,\n }),\n ...(edit.clearToolInputs !== undefined && {\n clear_tool_inputs: edit.clearToolInputs,\n }),\n ...(edit.excludeTools !== undefined && {\n exclude_tools: edit.excludeTools,\n }),\n };\n\n case 'clear_thinking_20251015':\n return {\n type: edit.type,\n ...(edit.keep !== undefined && { keep: edit.keep }),\n };\n\n default:\n warnings.push({\n type: 'other',\n message: `Unknown context management strategy: ${strategy}`,\n });\n return undefined;\n }\n })\n .filter(edit => edit !== undefined),\n },\n }),\n };\n\n if (isThinking) {\n if (thinkingBudget == null) {\n warnings.push({\n type: 'compatibility',\n feature: 'extended thinking',\n details:\n 'thinking budget is required when thinking is enabled. using default budget of 1024 tokens.',\n });\n\n baseArgs.thinking = {\n type: 'enabled',\n budget_tokens: 1024,\n };\n\n thinkingBudget = 1024;\n }\n\n if (baseArgs.temperature != null) {\n baseArgs.temperature = undefined;\n warnings.push({\n type: 'unsupported',\n feature: 'temperature',\n details: 'temperature is not supported when thinking is enabled',\n });\n }\n\n if (topK != null) {\n baseArgs.top_k = undefined;\n warnings.push({\n type: 'unsupported',\n feature: 'topK',\n details: 'topK is not supported when thinking is enabled',\n });\n }\n\n if (topP != null) {\n baseArgs.top_p = undefined;\n warnings.push({\n type: 'unsupported',\n feature: 'topP',\n details: 'topP is not supported when thinking is enabled',\n });\n }\n\n // adjust max tokens to account for thinking:\n baseArgs.max_tokens = maxTokens + (thinkingBudget ?? 0);\n }\n\n // limit to max output tokens for known models to enable model switching without breaking it:\n if (isKnownModel && baseArgs.max_tokens > maxOutputTokensForModel) {\n // only warn if max output tokens is provided as input:\n if (maxOutputTokens != null) {\n warnings.push({\n type: 'unsupported',\n feature: 'maxOutputTokens',\n details:\n `${baseArgs.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${maxOutputTokensForModel} max output tokens. ` +\n `The max output tokens have been limited to ${maxOutputTokensForModel}.`,\n });\n }\n baseArgs.max_tokens = maxOutputTokensForModel;\n }\n\n if (\n anthropicOptions?.mcpServers &&\n anthropicOptions.mcpServers.length > 0\n ) {\n betas.add('mcp-client-2025-04-04');\n }\n\n if (contextManagement) {\n betas.add('context-management-2025-06-27');\n }\n\n if (\n anthropicOptions?.container &&\n anthropicOptions.container.skills &&\n anthropicOptions.container.skills.length > 0\n ) {\n betas.add('code-execution-2025-08-25');\n betas.add('skills-2025-10-02');\n betas.add('files-api-2025-04-14');\n\n if (\n !tools?.some(\n tool =>\n tool.type === 'provider' &&\n tool.id === 'anthropic.code_execution_20250825',\n )\n ) {\n warnings.push({\n type: 'other',\n message: 'code execution tool is required when using skills',\n });\n }\n }\n\n if (anthropicOptions?.effort) {\n betas.add('effort-2025-11-24');\n }\n\n // only when streaming: enable fine-grained tool streaming\n if (stream && (anthropicOptions?.toolStreaming ?? true)) {\n betas.add('fine-grained-tool-streaming-2025-05-14');\n }\n\n // structured output:\n // Only pass beta when actually using native output_format\n const usingNativeOutputFormat =\n useStructuredOutput &&\n responseFormat?.type === 'json' &&\n responseFormat.schema != null;\n\n if (usingNativeOutputFormat) {\n betas.add('structured-outputs-2025-11-13');\n }\n\n const {\n tools: anthropicTools,\n toolChoice: anthropicToolChoice,\n toolWarnings,\n betas: toolsBetas,\n } = await prepareTools(\n jsonResponseTool != null\n ? {\n tools: [...(tools ?? []), jsonResponseTool],\n toolChoice: { type: 'required' },\n disableParallelToolUse: true,\n cacheControlValidator,\n supportsStructuredOutput,\n }\n : {\n tools: tools ?? [],\n toolChoice,\n disableParallelToolUse: anthropicOptions?.disableParallelToolUse,\n cacheControlValidator,\n supportsStructuredOutput,\n },\n );\n\n // Extract cache control warnings once at the end\n const cacheWarnings = cacheControlValidator.getWarnings();\n\n return {\n args: {\n ...baseArgs,\n tools: anthropicTools,\n tool_choice: anthropicToolChoice,\n stream: stream === true ? true : undefined, // do not send when not streaming\n },\n warnings: [...warnings, ...toolWarnings, ...cacheWarnings],\n betas: new Set([...betas, ...toolsBetas, ...userSuppliedBetas]),\n usesJsonResponseTool: jsonResponseTool != null,\n toolNameMapping,\n };\n }\n\n private async getHeaders({\n betas,\n headers,\n }: {\n betas: Set<string>;\n headers: Record<string, string | undefined> | undefined;\n }) {\n return combineHeaders(\n await resolve(this.config.headers),\n headers,\n betas.size > 0 ? { 'anthropic-beta': Array.from(betas).join(',') } : {},\n );\n }\n\n private async getBetasFromHeaders(\n requestHeaders: Record<string, string | undefined> | undefined,\n ) {\n const configHeaders = await resolve(this.config.headers);\n\n const configBetaHeader = configHeaders['anthropic-beta'] ?? '';\n const requestBetaHeader = requestHeaders?.['anthropic-beta'] ?? '';\n\n return new Set(\n [\n ...configBetaHeader.toLowerCase().split(','),\n ...requestBetaHeader.toLowerCase().split(','),\n ]\n .map(beta => beta.trim())\n .filter(beta => beta !== ''),\n );\n }\n\n private buildRequestUrl(isStreaming: boolean): string {\n return (\n this.config.buildRequestUrl?.(this.config.baseURL, isStreaming) ??\n `${this.config.baseURL}/messages`\n );\n }\n\n private transformRequestBody(args: Record<string, any>): Record<string, any> {\n return this.config.transformRequestBody?.(args) ?? args;\n }\n\n private extractCitationDocuments(prompt: LanguageModelV3Prompt): Array<{\n title: string;\n filename?: string;\n mediaType: string;\n }> {\n const isCitationPart = (part: {\n type: string;\n mediaType?: string;\n providerOptions?: { anthropic?: { citations?: { enabled?: boolean } } };\n }) => {\n if (part.type !== 'file') {\n return false;\n }\n\n if (\n part.mediaType !== 'application/pdf' &&\n part.mediaType !== 'text/plain'\n ) {\n return false;\n }\n\n const anthropic = part.providerOptions?.anthropic;\n const citationsConfig = anthropic?.citations as\n | { enabled?: boolean }\n | undefined;\n return citationsConfig?.enabled ?? false;\n };\n\n return prompt\n .filter(message => message.role === 'user')\n .flatMap(message => message.content)\n .filter(isCitationPart)\n .map(part => {\n // TypeScript knows this is a file part due to our filter\n const filePart = part as Extract<typeof part, { type: 'file' }>;\n return {\n title: filePart.filename ?? 'Untitled Document',\n filename: filePart.filename,\n mediaType: filePart.mediaType,\n };\n });\n }\n\n async doGenerate(\n options: Parameters<LanguageModelV3['doGenerate']>[0],\n ): Promise<Awaited<ReturnType<LanguageModelV3['doGenerate']>>> {\n const { args, warnings, betas, usesJsonResponseTool, toolNameMapping } =\n await this.getArgs({\n ...options,\n stream: false,\n userSuppliedBetas: await this.getBetasFromHeaders(options.headers),\n });\n\n // Extract citation documents for response processing\n const citationDocuments = this.extractCitationDocuments(options.prompt);\n\n const {\n responseHeaders,\n value: response,\n rawValue: rawResponse,\n } = await postJsonToApi({\n url: this.buildRequestUrl(false),\n headers: await this.getHeaders({ betas, headers: options.headers }),\n body: this.transformRequestBody(args),\n failedResponseHandler: anthropicFailedResponseHandler,\n successfulResponseHandler: createJsonResponseHandler(\n anthropicMessagesResponseSchema,\n ),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch,\n });\n\n const content: Array<LanguageModelV3Content> = [];\n const mcpToolCalls: Record<string, LanguageModelV3ToolCall> = {};\n let isJsonResponseFromTool = false;\n\n // map response content to content array\n for (const part of response.content) {\n switch (part.type) {\n case 'text': {\n if (!usesJsonResponseTool) {\n content.push({ type: 'text', text: part.text });\n\n // Process citations if present\n if (part.citations) {\n for (const citation of part.citations) {\n const source = createCitationSource(\n citation,\n citationDocuments,\n this.generateId,\n );\n\n if (source) {\n content.push(source);\n }\n }\n }\n }\n break;\n }\n case 'thinking': {\n content.push({\n type: 'reasoning',\n text: part.thinking,\n providerMetadata: {\n anthropic: {\n signature: part.signature,\n } satisfies AnthropicReasoningMetadata,\n },\n });\n break;\n }\n case 'redacted_thinking': {\n content.push({\n type: 'reasoning',\n text: '',\n providerMetadata: {\n anthropic: {\n redactedData: part.data,\n } satisfies AnthropicReasoningMetadata,\n },\n });\n break;\n }\n case 'tool_use': {\n const isJsonResponseTool =\n usesJsonResponseTool && part.name === 'json';\n\n if (isJsonResponseTool) {\n isJsonResponseFromTool = true;\n\n // when a json response tool is used, the tool call becomes the text:\n content.push({\n type: 'text',\n text: JSON.stringify(part.input),\n });\n } else {\n const caller = part.caller;\n const callerInfo = caller\n ? {\n type: caller.type,\n toolId: 'tool_id' in caller ? caller.tool_id : undefined,\n }\n : undefined;\n\n content.push({\n type: 'tool-call',\n toolCallId: part.id,\n toolName: part.name,\n input: JSON.stringify(part.input),\n ...(callerInfo && {\n providerMetadata: {\n anthropic: {\n caller: callerInfo,\n },\n },\n }),\n });\n }\n\n break;\n }\n case 'server_tool_use': {\n // code execution 20250825 needs mapping:\n if (\n part.name === 'text_editor_code_execution' ||\n part.name === 'bash_code_execution'\n ) {\n content.push({\n type: 'tool-call',\n toolCallId: part.id,\n toolName: toolNameMapping.toCustomToolName('code_execution'),\n input: JSON.stringify({ type: part.name, ...part.input }),\n providerExecuted: true,\n });\n } else if (\n part.name === 'web_search' ||\n part.name === 'code_execution' ||\n part.name === 'web_fetch'\n ) {\n // For code_execution, inject 'programmatic-tool-call' type when input has { code } format\n const inputToSerialize =\n part.name === 'code_execution' &&\n part.input != null &&\n typeof part.input === 'object' &&\n 'code' in part.input &&\n !('type' in part.input)\n ? { type: 'programmatic-tool-call', ...part.input }\n : part.input;\n\n content.push({\n type: 'tool-call',\n toolCallId: part.id,\n toolName: toolNameMapping.toCustomToolName(part.name),\n input: JSON.stringify(inputToSerialize),\n providerExecuted: true,\n });\n } else if (\n part.name === 'tool_search_tool_regex' ||\n part.name === 'tool_search_tool_bm25'\n ) {\n content.push({\n type: 'tool-call',\n toolCallId: part.id,\n toolName: toolNameMapping.toCustomToolName(part.name),\n input: JSON.stringify(part.input),\n providerExecuted: true,\n });\n }\n\n break;\n }\n case 'mcp_tool_use': {\n mcpToolCalls[part.id] = {\n type: 'tool-call',\n toolCallId: part.id,\n toolName: part.name,\n input: JSON.stringify(part.input),\n providerExecuted: true,\n dynamic: true,\n providerMetadata: {\n anthropic: {\n type: 'mcp-tool-use',\n serverName: part.server_name,\n },\n },\n };\n content.push(mcpToolCalls[part.id]);\n break;\n }\n case 'mcp_tool_result': {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: mcpToolCalls[part.tool_use_id].toolName,\n isError: part.is_error,\n result: part.content,\n dynamic: true,\n providerMetadata: mcpToolCalls[part.tool_use_id].providerMetadata,\n });\n break;\n }\n case 'web_fetch_tool_result': {\n if (part.content.type === 'web_fetch_result') {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_fetch'),\n result: {\n type: 'web_fetch_result',\n url: part.content.url,\n retrievedAt: part.content.retrieved_at,\n content: {\n type: part.content.content.type,\n title: part.content.content.title,\n citations: part.content.content.citations,\n source: {\n type: part.content.content.source.type,\n mediaType: part.content.content.source.media_type,\n data: part.content.content.source.data,\n },\n },\n },\n });\n } else if (part.content.type === 'web_fetch_tool_result_error') {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_fetch'),\n isError: true,\n result: {\n type: 'web_fetch_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n break;\n }\n case 'web_search_tool_result': {\n if (Array.isArray(part.content)) {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_search'),\n result: part.content.map(result => ({\n url: result.url,\n title: result.title,\n pageAge: result.page_age ?? null,\n encryptedContent: result.encrypted_content,\n type: result.type,\n })),\n });\n\n for (const result of part.content) {\n content.push({\n type: 'source',\n sourceType: 'url',\n id: this.generateId(),\n url: result.url,\n title: result.title,\n providerMetadata: {\n anthropic: {\n pageAge: result.page_age ?? null,\n },\n },\n });\n }\n } else {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_search'),\n isError: true,\n result: {\n type: 'web_search_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n break;\n }\n\n // code execution 20250522:\n case 'code_execution_tool_result': {\n if (part.content.type === 'code_execution_result') {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('code_execution'),\n result: {\n type: part.content.type,\n stdout: part.content.stdout,\n stderr: part.content.stderr,\n return_code: part.content.return_code,\n content: part.content.content ?? [],\n },\n });\n } else if (part.content.type === 'code_execution_tool_result_error') {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('code_execution'),\n isError: true,\n result: {\n type: 'code_execution_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n break;\n }\n\n // code execution 20250825:\n case 'bash_code_execution_tool_result':\n case 'text_editor_code_execution_tool_result': {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('code_execution'),\n result: part.content,\n });\n break;\n }\n\n // tool search tool results:\n case 'tool_search_tool_result': {\n if (part.content.type === 'tool_search_tool_search_result') {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('tool_search'),\n result: part.content.tool_references.map(ref => ({\n type: ref.type,\n toolName: ref.tool_name,\n })),\n });\n } else {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('tool_search'),\n isError: true,\n result: {\n type: 'tool_search_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n break;\n }\n }\n }\n\n return {\n content,\n finishReason: mapAnthropicStopReason({\n finishReason: response.stop_reason,\n isJsonResponseFromTool,\n }),\n usage: convertAnthropicMessagesUsage(response.usage),\n request: { body: args },\n response: {\n id: response.id ?? undefined,\n modelId: response.model ?? undefined,\n headers: responseHeaders,\n body: rawResponse,\n },\n warnings,\n providerMetadata: {\n anthropic: {\n usage: response.usage as JSONObject,\n cacheCreationInputTokens:\n response.usage.cache_creation_input_tokens ?? null,\n stopSequence: response.stop_sequence ?? null,\n container: response.container\n ? {\n expiresAt: response.container.expires_at,\n id: response.container.id,\n skills:\n response.container.skills?.map(skill => ({\n type: skill.type,\n skillId: skill.skill_id,\n version: skill.version,\n })) ?? null,\n }\n : null,\n contextManagement:\n mapAnthropicResponseContextManagement(\n response.context_management,\n ) ?? null,\n } satisfies AnthropicMessageMetadata,\n },\n };\n }\n\n async doStream(\n options: Parameters<LanguageModelV3['doStream']>[0],\n ): Promise<Awaited<ReturnType<LanguageModelV3['doStream']>>> {\n const {\n args: body,\n warnings,\n betas,\n usesJsonResponseTool,\n toolNameMapping,\n } = await this.getArgs({\n ...options,\n stream: true,\n userSuppliedBetas: await this.getBetasFromHeaders(options.headers),\n });\n\n // Extract citation documents for response processing\n const citationDocuments = this.extractCitationDocuments(options.prompt);\n\n const url = this.buildRequestUrl(true);\n const { responseHeaders, value: response } = await postJsonToApi({\n url,\n headers: await this.getHeaders({ betas, headers: options.headers }),\n body: this.transformRequestBody(body),\n failedResponseHandler: anthropicFailedResponseHandler,\n successfulResponseHandler: createEventSourceResponseHandler(\n anthropicMessagesChunkSchema,\n ),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch,\n });\n\n let finishReason: LanguageModelV3FinishReason = 'unknown';\n const usage: AnthropicMessagesUsage = {\n input_tokens: 0,\n output_tokens: 0,\n cache_creation_input_tokens: 0,\n cache_read_input_tokens: 0,\n };\n\n const contentBlocks: Record<\n number,\n | {\n type: 'tool-call';\n toolCallId: string;\n toolName: string;\n input: string;\n providerExecuted?: boolean;\n firstDelta: boolean;\n providerToolName?: string;\n caller?: {\n type: 'code_execution_20250825' | 'direct';\n toolId?: string;\n };\n }\n | { type: 'text' | 'reasoning' }\n > = {};\n const mcpToolCalls: Record<string, LanguageModelV3ToolCall> = {};\n\n let contextManagement:\n | AnthropicMessageMetadata['contextManagement']\n | null = null;\n let rawUsage: JSONObject | undefined = undefined;\n let cacheCreationInputTokens: number | null = null;\n let stopSequence: string | null = null;\n let container: AnthropicMessageMetadata['container'] | null = null;\n let isJsonResponseFromTool = false;\n\n let blockType:\n | 'text'\n | 'thinking'\n | 'tool_use'\n | 'redacted_thinking'\n | 'server_tool_use'\n | 'web_fetch_tool_result'\n | 'web_search_tool_result'\n | 'code_execution_tool_result'\n | 'text_editor_code_execution_tool_result'\n | 'bash_code_execution_tool_result'\n | 'tool_search_tool_result'\n | 'mcp_tool_use'\n | 'mcp_tool_result'\n | undefined = undefined;\n\n const generateId = this.generateId;\n\n const transformedStream = response.pipeThrough(\n new TransformStream<\n ParseResult<InferSchema<typeof anthropicMessagesChunkSchema>>,\n LanguageModelV3StreamPart\n >({\n start(controller) {\n controller.enqueue({ type: 'stream-start', warnings });\n },\n\n transform(chunk, controller) {\n if (options.includeRawChunks) {\n controller.enqueue({ type: 'raw', rawValue: chunk.rawValue });\n }\n\n if (!chunk.success) {\n controller.enqueue({ type: 'error', error: chunk.error });\n return;\n }\n\n const value = chunk.value;\n\n switch (value.type) {\n case 'ping': {\n return; // ignored\n }\n\n case 'content_block_start': {\n const part = value.content_block;\n const contentBlockType = part.type;\n blockType = contentBlockType;\n\n switch (contentBlockType) {\n case 'text': {\n // when a json response tool is used, the tool call is returned as text,\n // so we ignore the text content:\n if (usesJsonResponseTool) {\n return;\n }\n\n contentBlocks[value.index] = { type: 'text' };\n controller.enqueue({\n type: 'text-start',\n id: String(value.index),\n });\n return;\n }\n\n case 'thinking': {\n contentBlocks[value.index] = { type: 'reasoning' };\n controller.enqueue({\n type: 'reasoning-start',\n id: String(value.index),\n });\n return;\n }\n\n case 'redacted_thinking': {\n contentBlocks[value.index] = { type: 'reasoning' };\n controller.enqueue({\n type: 'reasoning-start',\n id: String(value.index),\n providerMetadata: {\n anthropic: {\n redactedData: part.data,\n } satisfies AnthropicReasoningMetadata,\n },\n });\n return;\n }\n\n case 'tool_use': {\n const isJsonResponseTool =\n usesJsonResponseTool && part.name === 'json';\n\n if (isJsonResponseTool) {\n isJsonResponseFromTool = true;\n\n contentBlocks[value.index] = { type: 'text' };\n\n controller.enqueue({\n type: 'text-start',\n id: String(value.index),\n });\n } else {\n // Extract caller info for type-safe access\n const caller = part.caller;\n const callerInfo = caller\n ? {\n type: caller.type,\n toolId:\n 'tool_id' in caller ? caller.tool_id : undefined,\n }\n : undefined;\n\n // Programmatic tool calling: for deferred tool calls from code_execution,\n // input may be present directly in content_block_start.\n // Only use if non-empty (empty {} means input comes via deltas)\n const hasNonEmptyInput =\n part.input && Object.keys(part.input).length > 0;\n const initialInput = hasNonEmptyInput\n ? JSON.stringify(part.input)\n : '';\n\n contentBlocks[value.index] = {\n type: 'tool-call',\n toolCallId: part.id,\n toolName: part.name,\n input: initialInput,\n firstDelta: initialInput.length === 0,\n ...(callerInfo && { caller: callerInfo }),\n };\n\n controller.enqueue({\n type: 'tool-input-start',\n id: part.id,\n toolName: part.name,\n });\n }\n return;\n }\n\n case 'server_tool_use': {\n if (\n [\n 'web_fetch',\n 'web_search',\n // code execution 20250825:\n 'code_execution',\n // code execution 20250825 text editor:\n 'text_editor_code_execution',\n // code execution 20250825 bash:\n 'bash_code_execution',\n ].includes(part.name)\n ) {\n // map tool names for the code execution 20250825 tool:\n const providerToolName =\n part.name === 'text_editor_code_execution' ||\n part.name === 'bash_code_execution'\n ? 'code_execution'\n : part.name;\n\n const customToolName =\n toolNameMapping.toCustomToolName(providerToolName);\n\n contentBlocks[value.index] = {\n type: 'tool-call',\n toolCallId: part.id,\n toolName: customToolName,\n input: '',\n providerExecuted: true,\n firstDelta: true,\n providerToolName: part.name,\n };\n\n controller.enqueue({\n type: 'tool-input-start',\n id: part.id,\n toolName: customToolName,\n providerExecuted: true,\n });\n } else if (\n part.name === 'tool_search_tool_regex' ||\n part.name === 'tool_search_tool_bm25'\n ) {\n const customToolName = toolNameMapping.toCustomToolName(\n part.name,\n );\n\n contentBlocks[value.index] = {\n type: 'tool-call',\n toolCallId: part.id,\n toolName: customToolName,\n input: '',\n providerExecuted: true,\n firstDelta: true,\n providerToolName: part.name,\n };\n\n controller.enqueue({\n type: 'tool-input-start',\n id: part.id,\n toolName: customToolName,\n providerExecuted: true,\n });\n }\n\n return;\n }\n\n case 'web_fetch_tool_result': {\n if (part.content.type === 'web_fetch_result') {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_fetch'),\n result: {\n type: 'web_fetch_result',\n url: part.content.url,\n retrievedAt: part.content.retrieved_at,\n content: {\n type: part.content.content.type,\n title: part.content.content.title,\n citations: part.content.content.citations,\n source: {\n type: part.content.content.source.type,\n mediaType: part.content.content.source.media_type,\n data: part.content.content.source.data,\n },\n },\n },\n });\n } else if (\n part.content.type === 'web_fetch_tool_result_error'\n ) {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_fetch'),\n isError: true,\n result: {\n type: 'web_fetch_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n\n return;\n }\n\n case 'web_search_tool_result': {\n if (Array.isArray(part.content)) {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_search'),\n result: part.content.map(result => ({\n url: result.url,\n title: result.title,\n pageAge: result.page_age ?? null,\n encryptedContent: result.encrypted_content,\n type: result.type,\n })),\n });\n\n for (const result of part.content) {\n controller.enqueue({\n type: 'source',\n sourceType: 'url',\n id: generateId(),\n url: result.url,\n title: result.title,\n providerMetadata: {\n anthropic: {\n pageAge: result.page_age ?? null,\n },\n },\n });\n }\n } else {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_search'),\n isError: true,\n result: {\n type: 'web_search_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n return;\n }\n\n // code execution 20250522:\n case 'code_execution_tool_result': {\n if (part.content.type === 'code_execution_result') {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName:\n toolNameMapping.toCustomToolName('code_execution'),\n result: {\n type: part.content.type,\n stdout: part.content.stdout,\n stderr: part.content.stderr,\n return_code: part.content.return_code,\n content: part.content.content ?? [],\n },\n });\n } else if (\n part.content.type === 'code_execution_tool_result_error'\n ) {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName:\n toolNameMapping.toCustomToolName('code_execution'),\n isError: true,\n result: {\n type: 'code_execution_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n\n return;\n }\n\n // code execution 20250825:\n case 'bash_code_execution_tool_result':\n case 'text_editor_code_execution_tool_result': {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName:\n toolNameMapping.toCustomToolName('code_execution'),\n result: part.content,\n });\n return;\n }\n\n // tool search tool results:\n case 'tool_search_tool_result': {\n if (part.content.type === 'tool_search_tool_search_result') {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('tool_search'),\n result: part.content.tool_references.map(ref => ({\n type: ref.type,\n toolName: ref.tool_name,\n })),\n });\n } else {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('tool_search'),\n isError: true,\n result: {\n type: 'tool_search_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n return;\n }\n\n case 'mcp_tool_use': {\n mcpToolCalls[part.id] = {\n type: 'tool-call',\n toolCallId: part.id,\n toolName: part.name,\n input: JSON.stringify(part.input),\n providerExecuted: true,\n dynamic: true,\n providerMetadata: {\n anthropic: {\n type: 'mcp-tool-use',\n serverName: part.server_name,\n },\n },\n };\n controller.enqueue(mcpToolCalls[part.id]);\n return;\n }\n\n case 'mcp_tool_result': {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: mcpToolCalls[part.tool_use_id].toolName,\n isError: part.is_error,\n result: part.content,\n dynamic: true,\n providerMetadata:\n mcpToolCalls[part.tool_use_id].providerMetadata,\n });\n return;\n }\n\n default: {\n const _exhaustiveCheck: never = contentBlockType;\n throw new Error(\n `Unsupported content block type: ${_exhaustiveCheck}`,\n );\n }\n }\n }\n\n case 'content_block_stop': {\n // when finishing a tool call block, send the full tool call:\n if (contentBlocks[value.index] != null) {\n const contentBlock = contentBlocks[value.index];\n\n switch (contentBlock.type) {\n case 'text': {\n controller.enqueue({\n type: 'text-end',\n id: String(value.index),\n });\n break;\n }\n\n case 'reasoning': {\n controller.enqueue({\n type: 'reasoning-end',\n id: String(value.index),\n });\n break;\n }\n\n case 'tool-call':\n // when a json response tool is used, the tool call is returned as text,\n // so we ignore the tool call content:\n const isJsonResponseTool =\n usesJsonResponseTool && contentBlock.toolName === 'json';\n\n if (!isJsonResponseTool) {\n controller.enqueue({\n type: 'tool-input-end',\n id: contentBlock.toolCallId,\n });\n\n // For code_execution, inject 'programmatic-tool-call' type\n // when input has { code } format (programmatic tool calling)\n let finalInput =\n contentBlock.input === '' ? '{}' : contentBlock.input;\n if (contentBlock.providerToolName === 'code_execution') {\n try {\n const parsed = JSON.parse(finalInput);\n if (\n parsed != null &&\n typeof parsed === 'object' &&\n 'code' in parsed &&\n !('type' in parsed)\n ) {\n finalInput = JSON.stringify({\n type: 'programmatic-tool-call',\n ...parsed,\n });\n }\n } catch {\n // ignore parse errors, use original input\n }\n }\n\n controller.enqueue({\n type: 'tool-call',\n toolCallId: contentBlock.toolCallId,\n toolName: contentBlock.toolName,\n input: finalInput,\n providerExecuted: contentBlock.providerExecuted,\n ...(contentBlock.caller && {\n providerMetadata: {\n anthropic: {\n caller: contentBlock.caller,\n },\n },\n }),\n });\n }\n break;\n }\n\n delete contentBlocks[value.index];\n }\n\n blockType = undefined; // reset block type\n\n return;\n }\n\n case 'content_block_delta': {\n const deltaType = value.delta.type;\n\n switch (deltaType) {\n case 'text_delta': {\n // when a json response tool is used, the tool call is returned as text,\n // so we ignore the text content:\n if (usesJsonResponseTool) {\n return; // excluding the text-start will also exclude the text-end\n }\n\n controller.enqueue({\n type: 'text-delta',\n id: String(value.index),\n delta: value.delta.text,\n });\n\n return;\n }\n\n case 'thinking_delta': {\n controller.enqueue({\n type: 'reasoning-delta',\n id: String(value.index),\n delta: value.delta.thinking,\n });\n\n return;\n }\n\n case 'signature_delta': {\n // signature are only supported on thinking blocks:\n if (blockType === 'thinking') {\n controller.enqueue({\n type: 'reasoning-delta',\n id: String(value.index),\n delta: '',\n providerMetadata: {\n anthropic: {\n signature: value.delta.signature,\n } satisfies AnthropicReasoningMetadata,\n },\n });\n }\n\n return;\n }\n\n case 'input_json_delta': {\n const contentBlock = contentBlocks[value.index];\n let delta = value.delta.partial_json;\n\n // skip empty deltas to enable replacing the first character\n // in the code execution 20250825 tool.\n if (delta.length === 0) {\n return;\n }\n\n if (isJsonResponseFromTool) {\n if (contentBlock?.type !== 'text') {\n return; // exclude reasoning\n }\n\n controller.enqueue({\n type: 'text-delta',\n id: String(value.index),\n delta,\n });\n } else {\n if (contentBlock?.type !== 'tool-call') {\n return;\n }\n\n // for the code execution 20250825, we need to add\n // the type to the delta and change the tool name.\n if (\n contentBlock.firstDelta &&\n (contentBlock.providerToolName ===\n 'bash_code_execution' ||\n contentBlock.providerToolName ===\n 'text_editor_code_execution')\n ) {\n delta = `{\"type\": \"${contentBlock.providerToolName}\",${delta.substring(1)}`;\n }\n\n controller.enqueue({\n type: 'tool-input-delta',\n id: contentBlock.toolCallId,\n delta,\n });\n\n contentBlock.input += delta;\n contentBlock.firstDelta = false;\n }\n\n return;\n }\n\n case 'citations_delta': {\n const citation = value.delta.citation;\n const source = createCitationSource(\n citation,\n citationDocuments,\n generateId,\n );\n\n if (source) {\n controller.enqueue(source);\n }\n\n return;\n }\n\n default: {\n const _exhaustiveCheck: never = deltaType;\n throw new Error(\n `Unsupported delta type: ${_exhaustiveCheck}`,\n );\n }\n }\n }\n\n case 'message_start': {\n usage.input_tokens = value.message.usage.input_tokens;\n usage.cache_read_input_tokens =\n value.message.usage.cache_read_input_tokens ?? 0;\n usage.cache_creation_input_tokens =\n value.message.usage.cache_creation_input_tokens ?? 0;\n\n rawUsage = {\n ...(value.message.usage as JSONObject),\n };\n\n cacheCreationInputTokens =\n value.message.usage.cache_creation_input_tokens ?? null;\n\n if (value.message.container != null) {\n container = {\n expiresAt: value.message.container.expires_at,\n id: value.message.container.id,\n skills: null,\n };\n }\n\n if (value.message.stop_reason != null) {\n finishReason = mapAnthropicStopReason({\n finishReason: value.message.stop_reason,\n isJsonResponseFromTool,\n });\n }\n\n controller.enqueue({\n type: 'response-metadata',\n id: value.message.id ?? undefined,\n modelId: value.message.model ?? undefined,\n });\n\n // Programmatic tool calling: process pre-populated content blocks\n // (for deferred tool calls, content may be in message_start)\n if (value.message.content != null) {\n for (\n let contentIndex = 0;\n contentIndex < value.message.content.length;\n contentIndex++\n ) {\n const part = value.message.content[contentIndex];\n if (part.type === 'tool_use') {\n const caller = part.caller;\n const callerInfo = caller\n ? {\n type: caller.type,\n toolId:\n 'tool_id' in caller ? caller.tool_id : undefined,\n }\n : undefined;\n\n controller.enqueue({\n type: 'tool-input-start',\n id: part.id,\n toolName: part.name,\n });\n\n const inputStr = JSON.stringify(part.input ?? {});\n controller.enqueue({\n type: 'tool-input-delta',\n id: part.id,\n delta: inputStr,\n });\n\n controller.enqueue({\n type: 'tool-input-end',\n id: part.id,\n });\n\n controller.enqueue({\n type: 'tool-call',\n toolCallId: part.id,\n toolName: part.name,\n input: inputStr,\n ...(callerInfo && {\n providerMetadata: {\n anthropic: {\n caller: callerInfo,\n },\n },\n }),\n });\n }\n }\n }\n\n return;\n }\n\n case 'message_delta': {\n usage.output_tokens = value.usage.output_tokens;\n\n finishReason = mapAnthropicStopReason({\n finishReason: value.delta.stop_reason,\n isJsonResponseFromTool,\n });\n\n stopSequence = value.delta.stop_sequence ?? null;\n container =\n value.delta.container != null\n ? {\n expiresAt: value.delta.container.expires_at,\n id: value.delta.container.id,\n skills:\n value.delta.container.skills?.map(skill => ({\n type: skill.type,\n skillId: skill.skill_id,\n version: skill.version,\n })) ?? null,\n }\n : null;\n\n if (value.delta.context_management) {\n contextManagement = mapAnthropicResponseContextManagement(\n value.delta.context_management,\n );\n }\n\n rawUsage = {\n ...rawUsage,\n ...(value.usage as JSONObject),\n };\n\n return;\n }\n\n case 'message_stop': {\n controller.enqueue({\n type: 'finish',\n finishReason,\n usage: convertAnthropicMessagesUsage(usage),\n providerMetadata: {\n anthropic: {\n usage: (rawUsage as JSONObject) ?? null,\n cacheCreationInputTokens,\n stopSequence,\n container,\n contextManagement,\n } satisfies AnthropicMessageMetadata,\n },\n });\n return;\n }\n\n case 'error': {\n controller.enqueue({ type: 'error', error: value.error });\n return;\n }\n\n default: {\n const _exhaustiveCheck: never = value;\n throw new Error(`Unsupported chunk type: ${_exhaustiveCheck}`);\n }\n }\n },\n }),\n );\n\n // The first chunk needs to be pulled immediately to check if it is an error\n const [streamForFirstChunk, streamForConsumer] = transformedStream.tee();\n\n const firstChunkReader = streamForFirstChunk.getReader();\n try {\n await firstChunkReader.read(); // streamStart comes first, ignored\n\n let result = await firstChunkReader.read();\n\n // when raw chunks are enabled, the first chunk is a raw chunk, so we need to read the next chunk\n if (result.value?.type === 'raw') {\n result = await firstChunkReader.read();\n }\n\n // The Anthropic API returns 200 responses when there are overloaded errors.\n // We handle the case where the first chunk is an error here and transform\n // it into an APICallError.\n if (result.value?.type === 'error') {\n const error = result.value.error as { message: string; type: string };\n\n throw new APICallError({\n message: error.message,\n url,\n requestBodyValues: body,\n statusCode: error.type === 'overloaded_error' ? 529 : 500,\n responseHeaders,\n responseBody: JSON.stringify(error),\n isRetryable: error.type === 'overloaded_error',\n });\n }\n } finally {\n firstChunkReader.cancel().catch(() => {});\n firstChunkReader.releaseLock();\n }\n\n return {\n stream: streamForConsumer,\n request: { body },\n response: { headers: responseHeaders },\n };\n }\n}\n\n/**\n * Returns the capabilities of a Claude model that are used for defaults and feature selection.\n *\n * @see https://docs.claude.com/en/docs/about-claude/models/overview#model-comparison-table\n * @see https://platform.claude.com/docs/en/build-with-claude/structured-outputs\n */\nfunction getModelCapabilities(modelId: string): {\n maxOutputTokens: number;\n supportsStructuredOutput: boolean;\n isKnownModel: boolean;\n} {\n if (\n modelId.includes('claude-sonnet-4-5') ||\n modelId.includes('claude-opus-4-5')\n ) {\n return {\n maxOutputTokens: 64000,\n supportsStructuredOutput: true,\n isKnownModel: true,\n };\n } else if (modelId.includes('claude-opus-4-1')) {\n return {\n maxOutputTokens: 32000,\n supportsStructuredOutput: true,\n isKnownModel: true,\n };\n } else if (\n modelId.includes('claude-sonnet-4-') ||\n modelId.includes('claude-3-7-sonnet') ||\n modelId.includes('claude-haiku-4-5')\n ) {\n return {\n maxOutputTokens: 64000,\n supportsStructuredOutput: false,\n isKnownModel: true,\n };\n } else if (modelId.includes('claude-opus-4-')) {\n return {\n maxOutputTokens: 32000,\n supportsStructuredOutput: false,\n isKnownModel: true,\n };\n } else if (modelId.includes('claude-3-5-haiku')) {\n return {\n maxOutputTokens: 8192,\n supportsStructuredOutput: false,\n isKnownModel: true,\n };\n } else if (modelId.includes('claude-3-haiku')) {\n return {\n maxOutputTokens: 4096,\n supportsStructuredOutput: false,\n isKnownModel: true,\n };\n } else {\n return {\n maxOutputTokens: 4096,\n supportsStructuredOutput: false,\n isKnownModel: false,\n };\n }\n}\n\nfunction mapAnthropicResponseContextManagement(\n contextManagement: AnthropicResponseContextManagement | null | undefined,\n): AnthropicMessageMetadata['contextManagement'] | null {\n return contextManagement\n ? {\n appliedEdits: contextManagement.applied_edits\n .map(edit => {\n const strategy = edit.type;\n\n switch (strategy) {\n case 'clear_tool_uses_20250919':\n return {\n type: edit.type,\n clearedToolUses: edit.cleared_tool_uses,\n clearedInputTokens: edit.cleared_input_tokens,\n };\n\n case 'clear_thinking_20251015':\n return {\n type: edit.type,\n clearedThinkingTurns: edit.cleared_thinking_turns,\n clearedInputTokens: edit.cleared_input_tokens,\n };\n }\n })\n .filter(edit => edit !== undefined),\n }\n : null;\n}\n","import {\n createJsonErrorResponseHandler,\n InferSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const anthropicErrorDataSchema = lazySchema(() =>\n zodSchema(\n z.object({\n type: z.literal('error'),\n error: z.object({\n type: z.string(),\n message: z.string(),\n }),\n }),\n ),\n);\n\nexport type AnthropicErrorData = InferSchema<typeof anthropicErrorDataSchema>;\n\nexport const anthropicFailedResponseHandler = createJsonErrorResponseHandler({\n errorSchema: anthropicErrorDataSchema,\n errorToMessage: data => data.error.message,\n});\n","import { LanguageModelV3Usage } from '@ai-sdk/provider';\n\nexport type AnthropicMessagesUsage = {\n input_tokens: number;\n output_tokens: number;\n cache_creation_input_tokens?: number | null;\n cache_read_input_tokens?: number | null;\n};\n\nexport function convertAnthropicMessagesUsage(\n usage: AnthropicMessagesUsage,\n): LanguageModelV3Usage {\n const inputTokens = usage.input_tokens;\n const outputTokens = usage.output_tokens;\n const cacheCreationTokens = usage.cache_creation_input_tokens ?? 0;\n const cacheReadTokens = usage.cache_read_input_tokens ?? 0;\n\n return {\n inputTokens: {\n total: inputTokens + cacheCreationTokens + cacheReadTokens,\n noCache: inputTokens,\n cacheRead: cacheReadTokens,\n cacheWrite: cacheCreationTokens,\n },\n outputTokens: {\n total: outputTokens,\n text: undefined,\n reasoning: undefined,\n },\n raw: usage,\n };\n}\n","import { JSONSchema7 } from '@ai-sdk/provider';\nimport { InferSchema, lazySchema, zodSchema } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport type AnthropicMessagesPrompt = {\n system: Array<AnthropicTextContent> | undefined;\n messages: AnthropicMessage[];\n};\n\nexport type AnthropicMessage = AnthropicUserMessage | AnthropicAssistantMessage;\n\nexport type AnthropicCacheControl = {\n type: 'ephemeral';\n ttl?: '5m' | '1h';\n};\n\nexport interface AnthropicUserMessage {\n role: 'user';\n content: Array<\n | AnthropicTextContent\n | AnthropicImageContent\n | AnthropicDocumentContent\n | AnthropicToolResultContent\n >;\n}\n\nexport interface AnthropicAssistantMessage {\n role: 'assistant';\n content: Array<\n | AnthropicTextContent\n | AnthropicThinkingContent\n | AnthropicRedactedThinkingContent\n | AnthropicToolCallContent\n | AnthropicServerToolUseContent\n | AnthropicCodeExecutionToolResultContent\n | AnthropicWebFetchToolResultContent\n | AnthropicWebSearchToolResultContent\n | AnthropicToolSearchToolResultContent\n | AnthropicBashCodeExecutionToolResultContent\n | AnthropicTextEditorCodeExecutionToolResultContent\n | AnthropicMcpToolUseContent\n | AnthropicMcpToolResultContent\n >;\n}\n\nexport interface AnthropicTextContent {\n type: 'text';\n text: string;\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicThinkingContent {\n type: 'thinking';\n thinking: string;\n signature: string;\n // Note: thinking blocks cannot be directly cached with cache_control.\n // They are cached implicitly when appearing in previous assistant turns.\n cache_control?: never;\n}\n\nexport interface AnthropicRedactedThinkingContent {\n type: 'redacted_thinking';\n data: string;\n // Note: redacted thinking blocks cannot be directly cached with cache_control.\n // They are cached implicitly when appearing in previous assistant turns.\n cache_control?: never;\n}\n\ntype AnthropicContentSource =\n | {\n type: 'base64';\n media_type: string;\n data: string;\n }\n | {\n type: 'url';\n url: string;\n }\n | {\n type: 'text';\n media_type: 'text/plain';\n data: string;\n };\n\nexport interface AnthropicImageContent {\n type: 'image';\n source: AnthropicContentSource;\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicDocumentContent {\n type: 'document';\n source: AnthropicContentSource;\n title?: string;\n context?: string;\n citations?: { enabled: boolean };\n cache_control: AnthropicCacheControl | undefined;\n}\n\n/**\n * The caller information for programmatic tool calling.\n * Present when a tool is called from within code execution.\n */\nexport type AnthropicToolCallCaller =\n | {\n type: 'code_execution_20250825';\n tool_id: string;\n }\n | {\n type: 'direct';\n };\n\nexport interface AnthropicToolCallContent {\n type: 'tool_use';\n id: string;\n name: string;\n input: unknown;\n /**\n * Present when this tool call was triggered by a server-executed tool\n * (e.g., code execution calling a user-defined tool programmatically).\n */\n caller?: AnthropicToolCallCaller;\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicServerToolUseContent {\n type: 'server_tool_use';\n id: string;\n name:\n | 'web_fetch'\n | 'web_search'\n // code execution 20250522:\n | 'code_execution'\n // code execution 20250825:\n | 'bash_code_execution'\n | 'text_editor_code_execution'\n // tool search:\n | 'tool_search_tool_regex'\n | 'tool_search_tool_bm25';\n input: unknown;\n cache_control: AnthropicCacheControl | undefined;\n}\n\n// Nested content types for tool results (without cache_control)\n// Sub-content blocks cannot be cached directly according to Anthropic docs\ntype AnthropicNestedTextContent = Omit<\n AnthropicTextContent,\n 'cache_control'\n> & {\n cache_control?: never;\n};\n\ntype AnthropicNestedImageContent = Omit<\n AnthropicImageContent,\n 'cache_control'\n> & {\n cache_control?: never;\n};\n\ntype AnthropicNestedDocumentContent = Omit<\n AnthropicDocumentContent,\n 'cache_control'\n> & {\n cache_control?: never;\n};\n\nexport interface AnthropicToolResultContent {\n type: 'tool_result';\n tool_use_id: string;\n content:\n | string\n | Array<\n | AnthropicNestedTextContent\n | AnthropicNestedImageContent\n | AnthropicNestedDocumentContent\n >;\n is_error: boolean | undefined;\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicWebSearchToolResultContent {\n type: 'web_search_tool_result';\n tool_use_id: string;\n content: Array<{\n url: string;\n title: string | null;\n page_age: string | null;\n encrypted_content: string;\n type: string;\n }>;\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicToolSearchToolResultContent {\n type: 'tool_search_tool_result';\n tool_use_id: string;\n content:\n | {\n type: 'tool_search_tool_search_result';\n tool_references: Array<{\n type: 'tool_reference';\n tool_name: string;\n }>;\n }\n | {\n type: 'tool_search_tool_result_error';\n error_code: string;\n };\n cache_control: AnthropicCacheControl | undefined;\n}\n\n// code execution results for code_execution_20250522 tool:\nexport interface AnthropicCodeExecutionToolResultContent {\n type: 'code_execution_tool_result';\n tool_use_id: string;\n content:\n | {\n type: 'code_execution_result';\n stdout: string;\n stderr: string;\n return_code: number;\n content: Array<{ type: 'code_execution_output'; file_id: string }>;\n }\n | {\n type: 'code_execution_tool_result_error';\n error_code: string;\n };\n cache_control: AnthropicCacheControl | undefined;\n}\n\n// text editor code execution results for code_execution_20250825 tool:\nexport interface AnthropicTextEditorCodeExecutionToolResultContent {\n type: 'text_editor_code_execution_tool_result';\n tool_use_id: string;\n content:\n | {\n type: 'text_editor_code_execution_tool_result_error';\n error_code: string;\n }\n | {\n type: 'text_editor_code_execution_create_result';\n is_file_update: boolean;\n }\n | {\n type: 'text_editor_code_execution_view_result';\n content: string;\n file_type: string;\n num_lines: number | null;\n start_line: number | null;\n total_lines: number | null;\n }\n | {\n type: 'text_editor_code_execution_str_replace_result';\n lines: string[] | null;\n new_lines: number | null;\n new_start: number | null;\n old_lines: number | null;\n old_start: number | null;\n };\n cache_control: AnthropicCacheControl | undefined;\n}\n\n// bash code execution results for code_execution_20250825 tool:\nexport interface AnthropicBashCodeExecutionToolResultContent {\n type: 'bash_code_execution_tool_result';\n tool_use_id: string;\n content:\n | {\n type: 'bash_code_execution_result';\n stdout: string;\n stderr: string;\n return_code: number;\n content: {\n type: 'bash_code_execution_output';\n file_id: string;\n }[];\n }\n | {\n type: 'bash_code_execution_tool_result_error';\n error_code: string;\n };\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicWebFetchToolResultContent {\n type: 'web_fetch_tool_result';\n tool_use_id: string;\n content: {\n type: 'web_fetch_result';\n url: string;\n retrieved_at: string | null;\n content: {\n type: 'document';\n title: string | null;\n citations?: { enabled: boolean };\n source:\n | { type: 'base64'; media_type: 'application/pdf'; data: string }\n | { type: 'text'; media_type: 'text/plain'; data: string };\n };\n };\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicMcpToolUseContent {\n type: 'mcp_tool_use';\n id: string;\n name: string;\n server_name: string;\n input: unknown;\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicMcpToolResultContent {\n type: 'mcp_tool_result';\n tool_use_id: string;\n is_error: boolean;\n content: string | Array<{ type: 'text'; text: string }>;\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport type AnthropicTool =\n | {\n name: string;\n description: string | undefined;\n input_schema: JSONSchema7;\n cache_control: AnthropicCacheControl | undefined;\n strict?: boolean;\n /**\n * When true, this tool is deferred and will only be loaded when\n * discovered via the tool search tool.\n */\n defer_loading?: boolean;\n /**\n * Programmatic tool calling: specifies which server-executed tools\n * are allowed to call this tool. When set, only the specified callers\n * can invoke this tool programmatically.\n *\n * @example ['code_execution_20250825']\n */\n allowed_callers?: Array<'code_execution_20250825'>;\n }\n | {\n type: 'code_execution_20250522';\n name: string;\n cache_control: AnthropicCacheControl | undefined;\n }\n | {\n type: 'code_execution_20250825';\n name: string;\n }\n | {\n name: string;\n type: 'computer_20250124' | 'computer_20241022';\n display_width_px: number;\n display_height_px: number;\n display_number: number;\n cache_control: AnthropicCacheControl | undefined;\n }\n | {\n name: string;\n type:\n | 'text_editor_20250124'\n | 'text_editor_20241022'\n | 'text_editor_20250429';\n cache_control: AnthropicCacheControl | undefined;\n }\n | {\n name: string;\n type: 'text_editor_20250728';\n max_characters?: number;\n cache_control: AnthropicCacheControl | undefined;\n }\n | {\n name: string;\n type: 'bash_20250124' | 'bash_20241022';\n cache_control: AnthropicCacheControl | undefined;\n }\n | {\n name: string;\n type: 'memory_20250818';\n }\n | {\n type: 'web_fetch_20250910';\n name: string;\n max_uses?: number;\n allowed_domains?: string[];\n blocked_domains?: string[];\n citations?: { enabled: boolean };\n max_content_tokens?: number;\n cache_control: AnthropicCacheControl | undefined;\n }\n | {\n type: 'web_search_20250305';\n name: string;\n max_uses?: number;\n allowed_domains?: string[];\n blocked_domains?: string[];\n user_location?: {\n type: 'approximate';\n city?: string;\n region?: string;\n country?: string;\n timezone?: string;\n };\n cache_control: AnthropicCacheControl | undefined;\n }\n | {\n type: 'tool_search_tool_regex_20251119';\n name: string;\n }\n | {\n type: 'tool_search_tool_bm25_20251119';\n name: string;\n };\n\nexport type AnthropicToolChoice =\n | { type: 'auto' | 'any'; disable_parallel_tool_use?: boolean }\n | { type: 'tool'; name: string; disable_parallel_tool_use?: boolean };\n\nexport type AnthropicContainer = {\n id?: string | null;\n skills?: Array<{\n type: 'anthropic' | 'custom';\n skill_id: string;\n version?: string;\n }> | null;\n};\n\nexport type AnthropicInputTokensTrigger = {\n type: 'input_tokens';\n value: number;\n};\n\nexport type AnthropicToolUsesTrigger = {\n type: 'tool_uses';\n value: number;\n};\n\nexport type AnthropicContextManagementTrigger =\n | AnthropicInputTokensTrigger\n | AnthropicToolUsesTrigger;\n\nexport type AnthropicClearToolUsesEdit = {\n type: 'clear_tool_uses_20250919';\n trigger?: AnthropicContextManagementTrigger;\n keep?: {\n type: 'tool_uses';\n value: number;\n };\n clear_at_least?: {\n type: 'input_tokens';\n value: number;\n };\n clear_tool_inputs?: boolean;\n exclude_tools?: string[];\n};\n\nexport type AnthropicClearThinkingBlockEdit = {\n type: 'clear_thinking_20251015';\n keep?: 'all' | { type: 'thinking_turns'; value: number };\n};\n\nexport type AnthropicContextManagementEdit =\n | AnthropicClearToolUsesEdit\n | AnthropicClearThinkingBlockEdit;\n\nexport type AnthropicContextManagementConfig = {\n edits: AnthropicContextManagementEdit[];\n};\n\nexport type AnthropicResponseClearToolUsesEdit = {\n type: 'clear_tool_uses_20250919';\n cleared_tool_uses: number;\n cleared_input_tokens: number;\n};\n\nexport type AnthropicResponseClearThinkingBlockEdit = {\n type: 'clear_thinking_20251015';\n cleared_thinking_turns: number;\n cleared_input_tokens: number;\n};\n\nexport type AnthropicResponseContextManagementEdit =\n | AnthropicResponseClearToolUsesEdit\n | AnthropicResponseClearThinkingBlockEdit;\n\nexport type AnthropicResponseContextManagement = {\n applied_edits: AnthropicResponseContextManagementEdit[];\n};\n\n// limited version of the schema, focussed on what is needed for the implementation\n// this approach limits breakages when the API changes and increases efficiency\nexport const anthropicMessagesResponseSchema = lazySchema(() =>\n zodSchema(\n z.object({\n type: z.literal('message'),\n id: z.string().nullish(),\n model: z.string().nullish(),\n content: z.array(\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('text'),\n text: z.string(),\n citations: z\n .array(\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('web_search_result_location'),\n cited_text: z.string(),\n url: z.string(),\n title: z.string(),\n encrypted_index: z.string(),\n }),\n z.object({\n type: z.literal('page_location'),\n cited_text: z.string(),\n document_index: z.number(),\n document_title: z.string().nullable(),\n start_page_number: z.number(),\n end_page_number: z.number(),\n }),\n z.object({\n type: z.literal('char_location'),\n cited_text: z.string(),\n document_index: z.number(),\n document_title: z.string().nullable(),\n start_char_index: z.number(),\n end_char_index: z.number(),\n }),\n ]),\n )\n .optional(),\n }),\n z.object({\n type: z.literal('thinking'),\n thinking: z.string(),\n signature: z.string(),\n }),\n z.object({\n type: z.literal('redacted_thinking'),\n data: z.string(),\n }),\n z.object({\n type: z.literal('tool_use'),\n id: z.string(),\n name: z.string(),\n input: z.unknown(),\n // Programmatic tool calling: caller info when triggered from code execution\n caller: z\n .union([\n z.object({\n type: z.literal('code_execution_20250825'),\n tool_id: z.string(),\n }),\n z.object({\n type: z.literal('direct'),\n }),\n ])\n .optional(),\n }),\n z.object({\n type: z.literal('server_tool_use'),\n id: z.string(),\n name: z.string(),\n input: z.record(z.string(), z.unknown()).nullish(),\n }),\n z.object({\n type: z.literal('mcp_tool_use'),\n id: z.string(),\n name: z.string(),\n input: z.unknown(),\n server_name: z.string(),\n }),\n z.object({\n type: z.literal('mcp_tool_result'),\n tool_use_id: z.string(),\n is_error: z.boolean(),\n content: z.array(\n z.union([\n z.string(),\n z.object({ type: z.literal('text'), text: z.string() }),\n ]),\n ),\n }),\n z.object({\n type: z.literal('web_fetch_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.object({\n type: z.literal('web_fetch_result'),\n url: z.string(),\n retrieved_at: z.string(),\n content: z.object({\n type: z.literal('document'),\n title: z.string().nullable(),\n citations: z.object({ enabled: z.boolean() }).optional(),\n source: z.union([\n z.object({\n type: z.literal('base64'),\n media_type: z.literal('application/pdf'),\n data: z.string(),\n }),\n z.object({\n type: z.literal('text'),\n media_type: z.literal('text/plain'),\n data: z.string(),\n }),\n ]),\n }),\n }),\n z.object({\n type: z.literal('web_fetch_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n z.object({\n type: z.literal('web_search_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.array(\n z.object({\n type: z.literal('web_search_result'),\n url: z.string(),\n title: z.string(),\n encrypted_content: z.string(),\n page_age: z.string().nullish(),\n }),\n ),\n z.object({\n type: z.literal('web_search_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n // code execution results for code_execution_20250522 tool:\n z.object({\n type: z.literal('code_execution_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.object({\n type: z.literal('code_execution_result'),\n stdout: z.string(),\n stderr: z.string(),\n return_code: z.number(),\n content: z\n .array(\n z.object({\n type: z.literal('code_execution_output'),\n file_id: z.string(),\n }),\n )\n .optional()\n .default([]),\n }),\n z.object({\n type: z.literal('code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n // bash code execution results for code_execution_20250825 tool:\n z.object({\n type: z.literal('bash_code_execution_tool_result'),\n tool_use_id: z.string(),\n content: z.discriminatedUnion('type', [\n z.object({\n type: z.literal('bash_code_execution_result'),\n content: z.array(\n z.object({\n type: z.literal('bash_code_execution_output'),\n file_id: z.string(),\n }),\n ),\n stdout: z.string(),\n stderr: z.string(),\n return_code: z.number(),\n }),\n z.object({\n type: z.literal('bash_code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n // text editor code execution results for code_execution_20250825 tool:\n z.object({\n type: z.literal('text_editor_code_execution_tool_result'),\n tool_use_id: z.string(),\n content: z.discriminatedUnion('type', [\n z.object({\n type: z.literal('text_editor_code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_view_result'),\n content: z.string(),\n file_type: z.string(),\n num_lines: z.number().nullable(),\n start_line: z.number().nullable(),\n total_lines: z.number().nullable(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_create_result'),\n is_file_update: z.boolean(),\n }),\n z.object({\n type: z.literal(\n 'text_editor_code_execution_str_replace_result',\n ),\n lines: z.array(z.string()).nullable(),\n new_lines: z.number().nullable(),\n new_start: z.number().nullable(),\n old_lines: z.number().nullable(),\n old_start: z.number().nullable(),\n }),\n ]),\n }),\n // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:\n z.object({\n type: z.literal('tool_search_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.object({\n type: z.literal('tool_search_tool_search_result'),\n tool_references: z.array(\n z.object({\n type: z.literal('tool_reference'),\n tool_name: z.string(),\n }),\n ),\n }),\n z.object({\n type: z.literal('tool_search_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n ]),\n ),\n stop_reason: z.string().nullish(),\n stop_sequence: z.string().nullish(),\n usage: z.looseObject({\n input_tokens: z.number(),\n output_tokens: z.number(),\n cache_creation_input_tokens: z.number().nullish(),\n cache_read_input_tokens: z.number().nullish(),\n }),\n container: z\n .object({\n expires_at: z.string(),\n id: z.string(),\n skills: z\n .array(\n z.object({\n type: z.union([z.literal('anthropic'), z.literal('custom')]),\n skill_id: z.string(),\n version: z.string(),\n }),\n )\n .nullish(),\n })\n .nullish(),\n context_management: z\n .object({\n applied_edits: z.array(\n z.union([\n z.object({\n type: z.literal('clear_tool_uses_20250919'),\n cleared_tool_uses: z.number(),\n cleared_input_tokens: z.number(),\n }),\n z.object({\n type: z.literal('clear_thinking_20251015'),\n cleared_thinking_turns: z.number(),\n cleared_input_tokens: z.number(),\n }),\n ]),\n ),\n })\n .nullish(),\n }),\n ),\n);\n\n// limited version of the schema, focused on what is needed for the implementation\n// this approach limits breakages when the API changes and increases efficiency\nexport const anthropicMessagesChunkSchema = lazySchema(() =>\n zodSchema(\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('message_start'),\n message: z.object({\n id: z.string().nullish(),\n model: z.string().nullish(),\n role: z.string().nullish(),\n usage: z.looseObject({\n input_tokens: z.number(),\n cache_creation_input_tokens: z.number().nullish(),\n cache_read_input_tokens: z.number().nullish(),\n }),\n // Programmatic tool calling: content may be pre-populated for deferred tool calls\n content: z\n .array(\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('tool_use'),\n id: z.string(),\n name: z.string(),\n input: z.unknown(),\n caller: z\n .union([\n z.object({\n type: z.literal('code_execution_20250825'),\n tool_id: z.string(),\n }),\n z.object({\n type: z.literal('direct'),\n }),\n ])\n .optional(),\n }),\n ]),\n )\n .nullish(),\n stop_reason: z.string().nullish(),\n container: z\n .object({\n expires_at: z.string(),\n id: z.string(),\n })\n .nullish(),\n }),\n }),\n z.object({\n type: z.literal('content_block_start'),\n index: z.number(),\n content_block: z.discriminatedUnion('type', [\n z.object({\n type: z.literal('text'),\n text: z.string(),\n }),\n z.object({\n type: z.literal('thinking'),\n thinking: z.string(),\n }),\n z.object({\n type: z.literal('tool_use'),\n id: z.string(),\n name: z.string(),\n // Programmatic tool calling: input may be present directly for deferred tool calls\n input: z.record(z.string(), z.unknown()).optional(),\n // Programmatic tool calling: caller info when triggered from code execution\n caller: z\n .union([\n z.object({\n type: z.literal('code_execution_20250825'),\n tool_id: z.string(),\n }),\n z.object({\n type: z.literal('direct'),\n }),\n ])\n .optional(),\n }),\n z.object({\n type: z.literal('redacted_thinking'),\n data: z.string(),\n }),\n z.object({\n type: z.literal('server_tool_use'),\n id: z.string(),\n name: z.string(),\n input: z.record(z.string(), z.unknown()).nullish(),\n }),\n z.object({\n type: z.literal('mcp_tool_use'),\n id: z.string(),\n name: z.string(),\n input: z.unknown(),\n server_name: z.string(),\n }),\n z.object({\n type: z.literal('mcp_tool_result'),\n tool_use_id: z.string(),\n is_error: z.boolean(),\n content: z.array(\n z.union([\n z.string(),\n z.object({ type: z.literal('text'), text: z.string() }),\n ]),\n ),\n }),\n z.object({\n type: z.literal('web_fetch_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.object({\n type: z.literal('web_fetch_result'),\n url: z.string(),\n retrieved_at: z.string(),\n content: z.object({\n type: z.literal('document'),\n title: z.string().nullable(),\n citations: z.object({ enabled: z.boolean() }).optional(),\n source: z.union([\n z.object({\n type: z.literal('base64'),\n media_type: z.literal('application/pdf'),\n data: z.string(),\n }),\n z.object({\n type: z.literal('text'),\n media_type: z.literal('text/plain'),\n data: z.string(),\n }),\n ]),\n }),\n }),\n z.object({\n type: z.literal('web_fetch_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n z.object({\n type: z.literal('web_search_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.array(\n z.object({\n type: z.literal('web_search_result'),\n url: z.string(),\n title: z.string(),\n encrypted_content: z.string(),\n page_age: z.string().nullish(),\n }),\n ),\n z.object({\n type: z.literal('web_search_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n // code execution results for code_execution_20250522 tool:\n z.object({\n type: z.literal('code_execution_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.object({\n type: z.literal('code_execution_result'),\n stdout: z.string(),\n stderr: z.string(),\n return_code: z.number(),\n content: z\n .array(\n z.object({\n type: z.literal('code_execution_output'),\n file_id: z.string(),\n }),\n )\n .optional()\n .default([]),\n }),\n z.object({\n type: z.literal('code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n // bash code execution results for code_execution_20250825 tool:\n z.object({\n type: z.literal('bash_code_execution_tool_result'),\n tool_use_id: z.string(),\n content: z.discriminatedUnion('type', [\n z.object({\n type: z.literal('bash_code_execution_result'),\n content: z.array(\n z.object({\n type: z.literal('bash_code_execution_output'),\n file_id: z.string(),\n }),\n ),\n stdout: z.string(),\n stderr: z.string(),\n return_code: z.number(),\n }),\n z.object({\n type: z.literal('bash_code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n // text editor code execution results for code_execution_20250825 tool:\n z.object({\n type: z.literal('text_editor_code_execution_tool_result'),\n tool_use_id: z.string(),\n content: z.discriminatedUnion('type', [\n z.object({\n type: z.literal('text_editor_code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_view_result'),\n content: z.string(),\n file_type: z.string(),\n num_lines: z.number().nullable(),\n start_line: z.number().nullable(),\n total_lines: z.number().nullable(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_create_result'),\n is_file_update: z.boolean(),\n }),\n z.object({\n type: z.literal(\n 'text_editor_code_execution_str_replace_result',\n ),\n lines: z.array(z.string()).nullable(),\n new_lines: z.number().nullable(),\n new_start: z.number().nullable(),\n old_lines: z.number().nullable(),\n old_start: z.number().nullable(),\n }),\n ]),\n }),\n // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:\n z.object({\n type: z.literal('tool_search_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.object({\n type: z.literal('tool_search_tool_search_result'),\n tool_references: z.array(\n z.object({\n type: z.literal('tool_reference'),\n tool_name: z.string(),\n }),\n ),\n }),\n z.object({\n type: z.literal('tool_search_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n ]),\n }),\n z.object({\n type: z.literal('content_block_delta'),\n index: z.number(),\n delta: z.discriminatedUnion('type', [\n z.object({\n type: z.literal('input_json_delta'),\n partial_json: z.string(),\n }),\n z.object({\n type: z.literal('text_delta'),\n text: z.string(),\n }),\n z.object({\n type: z.literal('thinking_delta'),\n thinking: z.string(),\n }),\n z.object({\n type: z.literal('signature_delta'),\n signature: z.string(),\n }),\n z.object({\n type: z.literal('citations_delta'),\n citation: z.discriminatedUnion('type', [\n z.object({\n type: z.literal('web_search_result_location'),\n cited_text: z.string(),\n url: z.string(),\n title: z.string(),\n encrypted_index: z.string(),\n }),\n z.object({\n type: z.literal('page_location'),\n cited_text: z.string(),\n document_index: z.number(),\n document_title: z.string().nullable(),\n start_page_number: z.number(),\n end_page_number: z.number(),\n }),\n z.object({\n type: z.literal('char_location'),\n cited_text: z.string(),\n document_index: z.number(),\n document_title: z.string().nullable(),\n start_char_index: z.number(),\n end_char_index: z.number(),\n }),\n ]),\n }),\n ]),\n }),\n z.object({\n type: z.literal('content_block_stop'),\n index: z.number(),\n }),\n z.object({\n type: z.literal('error'),\n error: z.object({\n type: z.string(),\n message: z.string(),\n }),\n }),\n z.object({\n type: z.literal('message_delta'),\n delta: z.object({\n stop_reason: z.string().nullish(),\n stop_sequence: z.string().nullish(),\n container: z\n .object({\n expires_at: z.string(),\n id: z.string(),\n skills: z\n .array(\n z.object({\n type: z.union([\n z.literal('anthropic'),\n z.literal('custom'),\n ]),\n skill_id: z.string(),\n version: z.string(),\n }),\n )\n .nullish(),\n })\n .nullish(),\n context_management: z\n .object({\n applied_edits: z.array(\n z.union([\n z.object({\n type: z.literal('clear_tool_uses_20250919'),\n cleared_tool_uses: z.number(),\n cleared_input_tokens: z.number(),\n }),\n z.object({\n type: z.literal('clear_thinking_20251015'),\n cleared_thinking_turns: z.number(),\n cleared_input_tokens: z.number(),\n }),\n ]),\n ),\n })\n .nullish(),\n }),\n usage: z.looseObject({\n output_tokens: z.number(),\n cache_creation_input_tokens: z.number().nullish(),\n }),\n }),\n z.object({\n type: z.literal('message_stop'),\n }),\n z.object({\n type: z.literal('ping'),\n }),\n ]),\n ),\n);\n\nexport const anthropicReasoningMetadataSchema = lazySchema(() =>\n zodSchema(\n z.object({\n signature: z.string().optional(),\n redactedData: z.string().optional(),\n }),\n ),\n);\n\nexport type AnthropicReasoningMetadata = InferSchema<\n typeof anthropicReasoningMetadataSchema\n>;\n\nexport type Citation = NonNullable<\n (InferSchema<typeof anthropicMessagesResponseSchema>['content'][number] & {\n type: 'text';\n })['citations']\n>[number];\n","import { z } from 'zod/v4';\n\n// https://docs.claude.com/en/docs/about-claude/models/overview\nexport type AnthropicMessagesModelId =\n | 'claude-3-5-haiku-20241022'\n | 'claude-3-5-haiku-latest'\n | 'claude-3-7-sonnet-20250219'\n | 'claude-3-7-sonnet-latest'\n | 'claude-3-haiku-20240307'\n | 'claude-haiku-4-5-20251001'\n | 'claude-haiku-4-5'\n | 'claude-opus-4-0'\n | 'claude-opus-4-1-20250805'\n | 'claude-opus-4-1'\n | 'claude-opus-4-20250514'\n | 'claude-opus-4-5'\n | 'claude-opus-4-5-20251101'\n | 'claude-sonnet-4-0'\n | 'claude-sonnet-4-20250514'\n | 'claude-sonnet-4-5-20250929'\n | 'claude-sonnet-4-5'\n | (string & {});\n\n/**\n * Anthropic file part provider options for document-specific features.\n * These options apply to individual file parts (documents).\n */\nexport const anthropicFilePartProviderOptions = z.object({\n /**\n * Citation configuration for this document.\n * When enabled, this document will generate citations in the response.\n */\n citations: z\n .object({\n /**\n * Enable citations for this document\n */\n enabled: z.boolean(),\n })\n .optional(),\n\n /**\n * Custom title for the document.\n * If not provided, the filename will be used.\n */\n title: z.string().optional(),\n\n /**\n * Context about the document that will be passed to the model\n * but not used towards cited content.\n * Useful for storing document metadata as text or stringified JSON.\n */\n context: z.string().optional(),\n});\n\nexport type AnthropicFilePartProviderOptions = z.infer<\n typeof anthropicFilePartProviderOptions\n>;\n\nexport const anthropicProviderOptions = z.object({\n /**\n * Whether to send reasoning to the model.\n *\n * This allows you to deactivate reasoning inputs for models that do not support them.\n */\n sendReasoning: z.boolean().optional(),\n\n /**\n * Determines how structured outputs are generated.\n *\n * - `outputFormat`: Use the `output_format` parameter to specify the structured output format.\n * - `jsonTool`: Use a special 'json' tool to specify the structured output format.\n * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).\n */\n structuredOutputMode: z.enum(['outputFormat', 'jsonTool', 'auto']).optional(),\n\n /**\n * Configuration for enabling Claude's extended thinking.\n *\n * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.\n * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.\n */\n thinking: z\n .object({\n type: z.union([z.literal('enabled'), z.literal('disabled')]),\n budgetTokens: z.number().optional(),\n })\n .optional(),\n\n /**\n * Whether to disable parallel function calling during tool use. Default is false.\n * When set to true, Claude will use at most one tool per response.\n */\n disableParallelToolUse: z.boolean().optional(),\n\n /**\n * Cache control settings for this message.\n * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching\n */\n cacheControl: z\n .object({\n type: z.literal('ephemeral'),\n ttl: z.union([z.literal('5m'), z.literal('1h')]).optional(),\n })\n .optional(),\n\n /**\n * MCP servers to be utilized in this request.\n */\n mcpServers: z\n .array(\n z.object({\n type: z.literal('url'),\n name: z.string(),\n url: z.string(),\n authorizationToken: z.string().nullish(),\n toolConfiguration: z\n .object({\n enabled: z.boolean().nullish(),\n allowedTools: z.array(z.string()).nullish(),\n })\n .nullish(),\n }),\n )\n .optional(),\n\n /**\n * Agent Skills configuration. Skills enable Claude to perform specialized tasks\n * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.\n * Requires code execution tool to be enabled.\n */\n container: z\n .object({\n id: z.string().optional(),\n skills: z\n .array(\n z.object({\n type: z.union([z.literal('anthropic'), z.literal('custom')]),\n skillId: z.string(),\n version: z.string().optional(),\n }),\n )\n .optional(),\n })\n .optional(),\n\n /**\n * Whether to enable tool streaming (and structured output streaming).\n *\n * When set to false, the model will return all tool calls and results\n * at once after a delay.\n *\n * @default true\n */\n toolStreaming: z.boolean().optional(),\n\n /**\n * @default 'high'\n */\n effort: z.enum(['low', 'medium', 'high']).optional(),\n\n contextManagement: z\n .object({\n edits: z.array(\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('clear_tool_uses_20250919'),\n trigger: z\n .discriminatedUnion('type', [\n z.object({\n type: z.literal('input_tokens'),\n value: z.number(),\n }),\n z.object({\n type: z.literal('tool_uses'),\n value: z.number(),\n }),\n ])\n .optional(),\n keep: z\n .object({\n type: z.literal('tool_uses'),\n value: z.number(),\n })\n .optional(),\n clearAtLeast: z\n .object({\n type: z.literal('input_tokens'),\n value: z.number(),\n })\n .optional(),\n clearToolInputs: z.boolean().optional(),\n excludeTools: z.array(z.string()).optional(),\n }),\n z.object({\n type: z.literal('clear_thinking_20251015'),\n keep: z\n .union([\n z.literal('all'),\n z.object({\n type: z.literal('thinking_turns'),\n value: z.number(),\n }),\n ])\n .optional(),\n }),\n ]),\n ),\n })\n .optional(),\n});\n\nexport type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;\n","import {\n LanguageModelV3CallOptions,\n SharedV3Warning,\n UnsupportedFunctionalityError,\n} from '@ai-sdk/provider';\nimport { AnthropicTool, AnthropicToolChoice } from './anthropic-messages-api';\nimport { CacheControlValidator } from './get-cache-control';\nimport { textEditor_20250728ArgsSchema } from './tool/text-editor_20250728';\nimport { webSearch_20250305ArgsSchema } from './tool/web-search_20250305';\nimport { webFetch_20250910ArgsSchema } from './tool/web-fetch-20250910';\nimport { validateTypes } from '@ai-sdk/provider-utils';\n\nexport interface AnthropicToolOptions {\n deferLoading?: boolean;\n allowedCallers?: Array<'code_execution_20250825'>;\n}\n\nexport async function prepareTools({\n tools,\n toolChoice,\n disableParallelToolUse,\n cacheControlValidator,\n supportsStructuredOutput,\n}: {\n tools: LanguageModelV3CallOptions['tools'];\n toolChoice: LanguageModelV3CallOptions['toolChoice'] | undefined;\n disableParallelToolUse?: boolean;\n cacheControlValidator?: CacheControlValidator;\n\n /**\n * Whether the model supports structured output.\n */\n supportsStructuredOutput: boolean;\n}): Promise<{\n tools: Array<AnthropicTool> | undefined;\n toolChoice: AnthropicToolChoice | undefined;\n toolWarnings: SharedV3Warning[];\n betas: Set<string>;\n}> {\n // when the tools array is empty, change it to undefined to prevent errors:\n tools = tools?.length ? tools : undefined;\n\n const toolWarnings: SharedV3Warning[] = [];\n const betas = new Set<string>();\n const validator = cacheControlValidator || new CacheControlValidator();\n\n if (tools == null) {\n return { tools: undefined, toolChoice: undefined, toolWarnings, betas };\n }\n\n const anthropicTools: AnthropicTool[] = [];\n\n for (const tool of tools) {\n switch (tool.type) {\n case 'function': {\n const cacheControl = validator.getCacheControl(tool.providerOptions, {\n type: 'tool definition',\n canCache: true,\n });\n\n // Read Anthropic-specific provider options\n const anthropicOptions = tool.providerOptions?.anthropic as\n | AnthropicToolOptions\n | undefined;\n const deferLoading = anthropicOptions?.deferLoading;\n const allowedCallers = anthropicOptions?.allowedCallers;\n\n anthropicTools.push({\n name: tool.name,\n description: tool.description,\n input_schema: tool.inputSchema,\n cache_control: cacheControl,\n ...(supportsStructuredOutput === true && tool.strict != null\n ? { strict: tool.strict }\n : {}),\n ...(deferLoading != null ? { defer_loading: deferLoading } : {}),\n ...(allowedCallers != null\n ? { allowed_callers: allowedCallers }\n : {}),\n ...(tool.inputExamples != null\n ? {\n input_examples: tool.inputExamples.map(\n example => example.input,\n ),\n }\n : {}),\n });\n\n if (supportsStructuredOutput === true) {\n betas.add('structured-outputs-2025-11-13');\n }\n\n if (tool.inputExamples != null || allowedCallers != null) {\n betas.add('advanced-tool-use-2025-11-20');\n }\n\n break;\n }\n\n case 'provider': {\n // Note: Provider-defined tools don't currently support providerOptions in the SDK,\n // so cache_control cannot be set on them. The Anthropic API supports caching all tools,\n // but the SDK would need to be updated to expose providerOptions on provider-defined tools.\n switch (tool.id) {\n case 'anthropic.code_execution_20250522': {\n betas.add('code-execution-2025-05-22');\n anthropicTools.push({\n type: 'code_execution_20250522',\n name: 'code_execution',\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.code_execution_20250825': {\n betas.add('code-execution-2025-08-25');\n anthropicTools.push({\n type: 'code_execution_20250825',\n name: 'code_execution',\n });\n break;\n }\n case 'anthropic.computer_20250124': {\n betas.add('computer-use-2025-01-24');\n anthropicTools.push({\n name: 'computer',\n type: 'computer_20250124',\n display_width_px: tool.args.displayWidthPx as number,\n display_height_px: tool.args.displayHeightPx as number,\n display_number: tool.args.displayNumber as number,\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.computer_20241022': {\n betas.add('computer-use-2024-10-22');\n anthropicTools.push({\n name: 'computer',\n type: 'computer_20241022',\n display_width_px: tool.args.displayWidthPx as number,\n display_height_px: tool.args.displayHeightPx as number,\n display_number: tool.args.displayNumber as number,\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.text_editor_20250124': {\n betas.add('computer-use-2025-01-24');\n anthropicTools.push({\n name: 'str_replace_editor',\n type: 'text_editor_20250124',\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.text_editor_20241022': {\n betas.add('computer-use-2024-10-22');\n anthropicTools.push({\n name: 'str_replace_editor',\n type: 'text_editor_20241022',\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.text_editor_20250429': {\n betas.add('computer-use-2025-01-24');\n anthropicTools.push({\n name: 'str_replace_based_edit_tool',\n type: 'text_editor_20250429',\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.text_editor_20250728': {\n const args = await validateTypes({\n value: tool.args,\n schema: textEditor_20250728ArgsSchema,\n });\n anthropicTools.push({\n name: 'str_replace_based_edit_tool',\n type: 'text_editor_20250728',\n max_characters: args.maxCharacters,\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.bash_20250124': {\n betas.add('computer-use-2025-01-24');\n anthropicTools.push({\n name: 'bash',\n type: 'bash_20250124',\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.bash_20241022': {\n betas.add('computer-use-2024-10-22');\n anthropicTools.push({\n name: 'bash',\n type: 'bash_20241022',\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.memory_20250818': {\n betas.add('context-management-2025-06-27');\n anthropicTools.push({\n name: 'memory',\n type: 'memory_20250818',\n });\n break;\n }\n case 'anthropic.web_fetch_20250910': {\n betas.add('web-fetch-2025-09-10');\n const args = await validateTypes({\n value: tool.args,\n schema: webFetch_20250910ArgsSchema,\n });\n anthropicTools.push({\n type: 'web_fetch_20250910',\n name: 'web_fetch',\n max_uses: args.maxUses,\n allowed_domains: args.allowedDomains,\n blocked_domains: args.blockedDomains,\n citations: args.citations,\n max_content_tokens: args.maxContentTokens,\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.web_search_20250305': {\n const args = await validateTypes({\n value: tool.args,\n schema: webSearch_20250305ArgsSchema,\n });\n anthropicTools.push({\n type: 'web_search_20250305',\n name: 'web_search',\n max_uses: args.maxUses,\n allowed_domains: args.allowedDomains,\n blocked_domains: args.blockedDomains,\n user_location: args.userLocation,\n cache_control: undefined,\n });\n break;\n }\n\n case 'anthropic.tool_search_regex_20251119': {\n betas.add('advanced-tool-use-2025-11-20');\n anthropicTools.push({\n type: 'tool_search_tool_regex_20251119',\n name: 'tool_search_tool_regex',\n });\n break;\n }\n\n case 'anthropic.tool_search_bm25_20251119': {\n betas.add('advanced-tool-use-2025-11-20');\n anthropicTools.push({\n type: 'tool_search_tool_bm25_20251119',\n name: 'tool_search_tool_bm25',\n });\n break;\n }\n\n default: {\n toolWarnings.push({\n type: 'unsupported',\n feature: `provider-defined tool ${tool.id}`,\n });\n break;\n }\n }\n break;\n }\n\n default: {\n toolWarnings.push({\n type: 'unsupported',\n feature: `tool ${tool}`,\n });\n break;\n }\n }\n }\n\n if (toolChoice == null) {\n return {\n tools: anthropicTools,\n toolChoice: disableParallelToolUse\n ? { type: 'auto', disable_parallel_tool_use: disableParallelToolUse }\n : undefined,\n toolWarnings,\n betas,\n };\n }\n\n const type = toolChoice.type;\n\n switch (type) {\n case 'auto':\n return {\n tools: anthropicTools,\n toolChoice: {\n type: 'auto',\n disable_parallel_tool_use: disableParallelToolUse,\n },\n toolWarnings,\n betas,\n };\n case 'required':\n return {\n tools: anthropicTools,\n toolChoice: {\n type: 'any',\n disable_parallel_tool_use: disableParallelToolUse,\n },\n toolWarnings,\n betas,\n };\n case 'none':\n // Anthropic does not support 'none' tool choice, so we remove the tools:\n return { tools: undefined, toolChoice: undefined, toolWarnings, betas };\n case 'tool':\n return {\n tools: anthropicTools,\n toolChoice: {\n type: 'tool',\n name: toolChoice.toolName,\n disable_parallel_tool_use: disableParallelToolUse,\n },\n toolWarnings,\n betas,\n };\n default: {\n const _exhaustiveCheck: never = type;\n throw new UnsupportedFunctionalityError({\n functionality: `tool choice type: ${_exhaustiveCheck}`,\n });\n }\n }\n}\n","import { SharedV3Warning, SharedV3ProviderMetadata } from '@ai-sdk/provider';\nimport { AnthropicCacheControl } from './anthropic-messages-api';\n\n// Anthropic allows a maximum of 4 cache breakpoints per request\nconst MAX_CACHE_BREAKPOINTS = 4;\n\n// Helper function to extract cache_control from provider metadata\n// Allows both cacheControl and cache_control for flexibility\nfunction getCacheControl(\n providerMetadata: SharedV3ProviderMetadata | undefined,\n): AnthropicCacheControl | undefined {\n const anthropic = providerMetadata?.anthropic;\n\n // allow both cacheControl and cache_control:\n const cacheControlValue = anthropic?.cacheControl ?? anthropic?.cache_control;\n\n // Pass through value assuming it is of the correct type.\n // The Anthropic API will validate the value.\n return cacheControlValue as AnthropicCacheControl | undefined;\n}\n\nexport class CacheControlValidator {\n private breakpointCount = 0;\n private warnings: SharedV3Warning[] = [];\n\n getCacheControl(\n providerMetadata: SharedV3ProviderMetadata | undefined,\n context: { type: string; canCache: boolean },\n ): AnthropicCacheControl | undefined {\n const cacheControlValue = getCacheControl(providerMetadata);\n\n if (!cacheControlValue) {\n return undefined;\n }\n\n // Validate that cache_control is allowed in this context\n if (!context.canCache) {\n this.warnings.push({\n type: 'unsupported',\n feature: 'cache_control on non-cacheable context',\n details: `cache_control cannot be set on ${context.type}. It will be ignored.`,\n });\n return undefined;\n }\n\n // Validate cache breakpoint limit\n this.breakpointCount++;\n if (this.breakpointCount > MAX_CACHE_BREAKPOINTS) {\n this.warnings.push({\n type: 'unsupported',\n feature: 'cacheControl breakpoint limit',\n details: `Maximum ${MAX_CACHE_BREAKPOINTS} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`,\n });\n return undefined;\n }\n\n return cacheControlValue;\n }\n\n getWarnings(): SharedV3Warning[] {\n return this.warnings;\n }\n}\n","import { createProviderToolFactory } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport { lazySchema, zodSchema } from '@ai-sdk/provider-utils';\n\nexport const textEditor_20250728ArgsSchema = lazySchema(() =>\n zodSchema(\n z.object({\n maxCharacters: z.number().optional(),\n }),\n ),\n);\n\nconst textEditor_20250728InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n command: z.enum(['view', 'create', 'str_replace', 'insert']),\n path: z.string(),\n file_text: z.string().optional(),\n insert_line: z.number().int().optional(),\n new_str: z.string().optional(),\n old_str: z.string().optional(),\n view_range: z.array(z.number().int()).optional(),\n }),\n ),\n);\n\nconst factory = createProviderToolFactory<\n {\n /**\n * The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`.\n * Note: `undo_edit` is not supported in Claude 4 models.\n */\n command: 'view' | 'create' | 'str_replace' | 'insert';\n\n /**\n * Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.\n */\n path: string;\n\n /**\n * Required parameter of `create` command, with the content of the file to be created.\n */\n file_text?: string;\n\n /**\n * Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.\n */\n insert_line?: number;\n\n /**\n * Optional parameter of `str_replace` command containing the new string (if not given, no string will be added). Required parameter of `insert` command containing the string to insert.\n */\n new_str?: string;\n\n /**\n * Required parameter of `str_replace` command containing the string in `path` to replace.\n */\n old_str?: string;\n\n /**\n * Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.\n */\n view_range?: number[];\n },\n {\n /**\n * Optional parameter to control truncation when viewing large files. Only compatible with text_editor_20250728 and later versions.\n */\n maxCharacters?: number;\n }\n>({\n id: 'anthropic.text_editor_20250728',\n inputSchema: textEditor_20250728InputSchema,\n});\n\nexport const textEditor_20250728 = (\n args: Parameters<typeof factory>[0] = {}, // default\n) => {\n return factory(args);\n};\n","import {\n createProviderToolFactoryWithOutputSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const webSearch_20250305ArgsSchema = lazySchema(() =>\n zodSchema(\n z.object({\n maxUses: z.number().optional(),\n allowedDomains: z.array(z.string()).optional(),\n blockedDomains: z.array(z.string()).optional(),\n userLocation: z\n .object({\n type: z.literal('approximate'),\n city: z.string().optional(),\n region: z.string().optional(),\n country: z.string().optional(),\n timezone: z.string().optional(),\n })\n .optional(),\n }),\n ),\n);\n\nexport const webSearch_20250305OutputSchema = lazySchema(() =>\n zodSchema(\n z.array(\n z.object({\n url: z.string(),\n title: z.string().nullable(),\n pageAge: z.string().nullable(),\n encryptedContent: z.string(),\n type: z.literal('web_search_result'),\n }),\n ),\n ),\n);\n\nconst webSearch_20250305InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n query: z.string(),\n }),\n ),\n);\n\nconst factory = createProviderToolFactoryWithOutputSchema<\n {\n /**\n * The search query to execute.\n */\n query: string;\n },\n Array<{\n type: 'web_search_result';\n\n /**\n * The URL of the source page.\n */\n url: string;\n\n /**\n * The title of the source page.\n */\n title: string | null;\n\n /**\n * When the site was last updated\n */\n pageAge: string | null;\n\n /**\n * Encrypted content that must be passed back in multi-turn conversations for citations\n */\n encryptedContent: string;\n }>,\n {\n /**\n * Maximum number of web searches Claude can perform during the conversation.\n */\n maxUses?: number;\n\n /**\n * Optional list of domains that Claude is allowed to search.\n */\n allowedDomains?: string[];\n\n /**\n * Optional list of domains that Claude should avoid when searching.\n */\n blockedDomains?: string[];\n\n /**\n * Optional user location information to provide geographically relevant search results.\n */\n userLocation?: {\n /**\n * The type of location (must be approximate)\n */\n type: 'approximate';\n\n /**\n * The city name\n */\n city?: string;\n\n /**\n * The region or state\n */\n region?: string;\n\n /**\n * The country\n */\n country?: string;\n\n /**\n * The IANA timezone ID.\n */\n timezone?: string;\n };\n }\n>({\n id: 'anthropic.web_search_20250305',\n inputSchema: webSearch_20250305InputSchema,\n outputSchema: webSearch_20250305OutputSchema,\n});\n\nexport const webSearch_20250305 = (\n args: Parameters<typeof factory>[0] = {}, // default\n) => {\n return factory(args);\n};\n","import {\n createProviderToolFactoryWithOutputSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const webFetch_20250910ArgsSchema = lazySchema(() =>\n zodSchema(\n z.object({\n maxUses: z.number().optional(),\n allowedDomains: z.array(z.string()).optional(),\n blockedDomains: z.array(z.string()).optional(),\n citations: z.object({ enabled: z.boolean() }).optional(),\n maxContentTokens: z.number().optional(),\n }),\n ),\n);\n\nexport const webFetch_20250910OutputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n type: z.literal('web_fetch_result'),\n url: z.string(),\n content: z.object({\n type: z.literal('document'),\n title: z.string().nullable(),\n citations: z.object({ enabled: z.boolean() }).optional(),\n source: z.union([\n z.object({\n type: z.literal('base64'),\n mediaType: z.literal('application/pdf'),\n data: z.string(),\n }),\n z.object({\n type: z.literal('text'),\n mediaType: z.literal('text/plain'),\n data: z.string(),\n }),\n ]),\n }),\n retrievedAt: z.string().nullable(),\n }),\n ),\n);\n\nconst webFetch_20250910InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n url: z.string(),\n }),\n ),\n);\n\nconst factory = createProviderToolFactoryWithOutputSchema<\n {\n /**\n * The URL to fetch.\n */\n url: string;\n },\n {\n type: 'web_fetch_result';\n\n /**\n * Fetched content URL\n */\n url: string;\n\n /**\n * Fetched content.\n */\n content: {\n type: 'document';\n\n /**\n * Title of the document\n */\n title: string | null;\n\n /**\n * Citation configuration for the document\n */\n citations?: { enabled: boolean };\n\n source:\n | {\n type: 'base64';\n mediaType: 'application/pdf';\n data: string;\n }\n | {\n type: 'text';\n mediaType: 'text/plain';\n data: string;\n };\n };\n\n /**\n * ISO 8601 timestamp when the content was retrieved\n */\n retrievedAt: string | null;\n },\n {\n /**\n * The maxUses parameter limits the number of web fetches performed\n */\n maxUses?: number;\n\n /**\n * Only fetch from these domains\n */\n allowedDomains?: string[];\n\n /**\n * Never fetch from these domains\n */\n blockedDomains?: string[];\n\n /**\n * Unlike web search where citations are always enabled, citations are optional for\n * web fetch. Set \"citations\": {\"enabled\": true} to enable Claude to cite specific passages\n * from fetched documents.\n */\n citations?: {\n enabled: boolean;\n };\n\n /**\n * The maxContentTokens parameter limits the amount of content that will be included in the context.\n */\n maxContentTokens?: number;\n }\n>({\n id: 'anthropic.web_fetch_20250910',\n inputSchema: webFetch_20250910InputSchema,\n outputSchema: webFetch_20250910OutputSchema,\n});\n\nexport const webFetch_20250910 = (\n args: Parameters<typeof factory>[0] = {}, // default\n) => {\n return factory(args);\n};\n","import {\n SharedV3Warning,\n LanguageModelV3DataContent,\n LanguageModelV3Message,\n LanguageModelV3Prompt,\n SharedV3ProviderMetadata,\n UnsupportedFunctionalityError,\n} from '@ai-sdk/provider';\nimport {\n convertToBase64,\n parseProviderOptions,\n validateTypes,\n isNonNullable,\n ToolNameMapping,\n} from '@ai-sdk/provider-utils';\nimport {\n AnthropicAssistantMessage,\n AnthropicMessagesPrompt,\n anthropicReasoningMetadataSchema,\n AnthropicToolResultContent,\n AnthropicUserMessage,\n AnthropicWebFetchToolResultContent,\n} from './anthropic-messages-api';\nimport { anthropicFilePartProviderOptions } from './anthropic-messages-options';\nimport { CacheControlValidator } from './get-cache-control';\nimport { codeExecution_20250522OutputSchema } from './tool/code-execution_20250522';\nimport { codeExecution_20250825OutputSchema } from './tool/code-execution_20250825';\nimport { toolSearchRegex_20251119OutputSchema as toolSearchOutputSchema } from './tool/tool-search-regex_20251119';\nimport { webFetch_20250910OutputSchema } from './tool/web-fetch-20250910';\nimport { webSearch_20250305OutputSchema } from './tool/web-search_20250305';\n\nfunction convertToString(data: LanguageModelV3DataContent): string {\n if (typeof data === 'string') {\n return Buffer.from(data, 'base64').toString('utf-8');\n }\n\n if (data instanceof Uint8Array) {\n return new TextDecoder().decode(data);\n }\n\n if (data instanceof URL) {\n throw new UnsupportedFunctionalityError({\n functionality: 'URL-based text documents are not supported for citations',\n });\n }\n\n throw new UnsupportedFunctionalityError({\n functionality: `unsupported data type for text documents: ${typeof data}`,\n });\n}\n\nexport async function convertToAnthropicMessagesPrompt({\n prompt,\n sendReasoning,\n warnings,\n cacheControlValidator,\n toolNameMapping,\n}: {\n prompt: LanguageModelV3Prompt;\n sendReasoning: boolean;\n warnings: SharedV3Warning[];\n cacheControlValidator?: CacheControlValidator;\n toolNameMapping: ToolNameMapping;\n}): Promise<{\n prompt: AnthropicMessagesPrompt;\n betas: Set<string>;\n}> {\n const betas = new Set<string>();\n const blocks = groupIntoBlocks(prompt);\n const validator = cacheControlValidator || new CacheControlValidator();\n\n let system: AnthropicMessagesPrompt['system'] = undefined;\n const messages: AnthropicMessagesPrompt['messages'] = [];\n\n async function shouldEnableCitations(\n providerMetadata: SharedV3ProviderMetadata | undefined,\n ): Promise<boolean> {\n const anthropicOptions = await parseProviderOptions({\n provider: 'anthropic',\n providerOptions: providerMetadata,\n schema: anthropicFilePartProviderOptions,\n });\n\n return anthropicOptions?.citations?.enabled ?? false;\n }\n\n async function getDocumentMetadata(\n providerMetadata: SharedV3ProviderMetadata | undefined,\n ): Promise<{ title?: string; context?: string }> {\n const anthropicOptions = await parseProviderOptions({\n provider: 'anthropic',\n providerOptions: providerMetadata,\n schema: anthropicFilePartProviderOptions,\n });\n\n return {\n title: anthropicOptions?.title,\n context: anthropicOptions?.context,\n };\n }\n\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n const isLastBlock = i === blocks.length - 1;\n const type = block.type;\n\n switch (type) {\n case 'system': {\n if (system != null) {\n throw new UnsupportedFunctionalityError({\n functionality:\n 'Multiple system messages that are separated by user/assistant messages',\n });\n }\n\n system = block.messages.map(({ content, providerOptions }) => ({\n type: 'text',\n text: content,\n cache_control: validator.getCacheControl(providerOptions, {\n type: 'system message',\n canCache: true,\n }),\n }));\n\n break;\n }\n\n case 'user': {\n // combines all user and tool messages in this block into a single message:\n const anthropicContent: AnthropicUserMessage['content'] = [];\n\n for (const message of block.messages) {\n const { role, content } = message;\n switch (role) {\n case 'user': {\n for (let j = 0; j < content.length; j++) {\n const part = content[j];\n\n // cache control: first add cache control from part.\n // for the last part of a message,\n // check also if the message has cache control.\n const isLastPart = j === content.length - 1;\n\n const cacheControl =\n validator.getCacheControl(part.providerOptions, {\n type: 'user message part',\n canCache: true,\n }) ??\n (isLastPart\n ? validator.getCacheControl(message.providerOptions, {\n type: 'user message',\n canCache: true,\n })\n : undefined);\n\n switch (part.type) {\n case 'text': {\n anthropicContent.push({\n type: 'text',\n text: part.text,\n cache_control: cacheControl,\n });\n break;\n }\n\n case 'file': {\n if (part.mediaType.startsWith('image/')) {\n anthropicContent.push({\n type: 'image',\n source:\n part.data instanceof URL\n ? {\n type: 'url',\n url: part.data.toString(),\n }\n : {\n type: 'base64',\n media_type:\n part.mediaType === 'image/*'\n ? 'image/jpeg'\n : part.mediaType,\n data: convertToBase64(part.data),\n },\n cache_control: cacheControl,\n });\n } else if (part.mediaType === 'application/pdf') {\n betas.add('pdfs-2024-09-25');\n\n const enableCitations = await shouldEnableCitations(\n part.providerOptions,\n );\n\n const metadata = await getDocumentMetadata(\n part.providerOptions,\n );\n\n anthropicContent.push({\n type: 'document',\n source:\n part.data instanceof URL\n ? {\n type: 'url',\n url: part.data.toString(),\n }\n : {\n type: 'base64',\n media_type: 'application/pdf',\n data: convertToBase64(part.data),\n },\n title: metadata.title ?? part.filename,\n ...(metadata.context && { context: metadata.context }),\n ...(enableCitations && {\n citations: { enabled: true },\n }),\n cache_control: cacheControl,\n });\n } else if (part.mediaType === 'text/plain') {\n const enableCitations = await shouldEnableCitations(\n part.providerOptions,\n );\n\n const metadata = await getDocumentMetadata(\n part.providerOptions,\n );\n\n anthropicContent.push({\n type: 'document',\n source:\n part.data instanceof URL\n ? {\n type: 'url',\n url: part.data.toString(),\n }\n : {\n type: 'text',\n media_type: 'text/plain',\n data: convertToString(part.data),\n },\n title: metadata.title ?? part.filename,\n ...(metadata.context && { context: metadata.context }),\n ...(enableCitations && {\n citations: { enabled: true },\n }),\n cache_control: cacheControl,\n });\n } else {\n throw new UnsupportedFunctionalityError({\n functionality: `media type: ${part.mediaType}`,\n });\n }\n\n break;\n }\n }\n }\n\n break;\n }\n case 'tool': {\n for (let i = 0; i < content.length; i++) {\n const part = content[i];\n\n // cache control: first add cache control from part.\n // for the last part of a message,\n // check also if the message has cache control.\n const isLastPart = i === content.length - 1;\n\n const cacheControl =\n validator.getCacheControl(part.providerOptions, {\n type: 'tool result part',\n canCache: true,\n }) ??\n (isLastPart\n ? validator.getCacheControl(message.providerOptions, {\n type: 'tool result message',\n canCache: true,\n })\n : undefined);\n\n const output = part.output;\n let contentValue: AnthropicToolResultContent['content'];\n switch (output.type) {\n case 'content':\n contentValue = output.value\n .map(contentPart => {\n switch (contentPart.type) {\n case 'text':\n return {\n type: 'text' as const,\n text: contentPart.text,\n };\n case 'image-data': {\n return {\n type: 'image' as const,\n source: {\n type: 'base64' as const,\n media_type: contentPart.mediaType,\n data: contentPart.data,\n },\n };\n }\n case 'image-url': {\n return {\n type: 'image' as const,\n source: {\n type: 'url' as const,\n url: contentPart.url,\n },\n };\n }\n case 'file-url': {\n return {\n type: 'document' as const,\n source: {\n type: 'url' as const,\n url: contentPart.url,\n },\n };\n }\n case 'file-data': {\n if (contentPart.mediaType === 'application/pdf') {\n betas.add('pdfs-2024-09-25');\n return {\n type: 'document' as const,\n source: {\n type: 'base64' as const,\n media_type: contentPart.mediaType,\n data: contentPart.data,\n },\n };\n }\n\n warnings.push({\n type: 'other',\n message: `unsupported tool content part type: ${contentPart.type} with media type: ${contentPart.mediaType}`,\n });\n\n return undefined;\n }\n default: {\n warnings.push({\n type: 'other',\n message: `unsupported tool content part type: ${contentPart.type}`,\n });\n\n return undefined;\n }\n }\n })\n .filter(isNonNullable);\n break;\n case 'text':\n case 'error-text':\n contentValue = output.value;\n break;\n case 'execution-denied':\n contentValue = output.reason ?? 'Tool execution denied.';\n break;\n case 'json':\n case 'error-json':\n default:\n contentValue = JSON.stringify(output.value);\n break;\n }\n\n anthropicContent.push({\n type: 'tool_result',\n tool_use_id: part.toolCallId,\n content: contentValue,\n is_error:\n output.type === 'error-text' || output.type === 'error-json'\n ? true\n : undefined,\n cache_control: cacheControl,\n });\n }\n\n break;\n }\n default: {\n const _exhaustiveCheck: never = role;\n throw new Error(`Unsupported role: ${_exhaustiveCheck}`);\n }\n }\n }\n\n messages.push({ role: 'user', content: anthropicContent });\n\n break;\n }\n\n case 'assistant': {\n // combines multiple assistant messages in this block into a single message:\n const anthropicContent: AnthropicAssistantMessage['content'] = [];\n\n const mcpToolUseIds = new Set<string>();\n\n for (let j = 0; j < block.messages.length; j++) {\n const message = block.messages[j];\n const isLastMessage = j === block.messages.length - 1;\n const { content } = message;\n\n for (let k = 0; k < content.length; k++) {\n const part = content[k];\n const isLastContentPart = k === content.length - 1;\n\n // cache control: first add cache control from part.\n // for the last part of a message,\n // check also if the message has cache control.\n const cacheControl =\n validator.getCacheControl(part.providerOptions, {\n type: 'assistant message part',\n canCache: true,\n }) ??\n (isLastContentPart\n ? validator.getCacheControl(message.providerOptions, {\n type: 'assistant message',\n canCache: true,\n })\n : undefined);\n\n switch (part.type) {\n case 'text': {\n anthropicContent.push({\n type: 'text',\n text:\n // trim the last text part if it's the last message in the block\n // because Anthropic does not allow trailing whitespace\n // in pre-filled assistant responses\n isLastBlock && isLastMessage && isLastContentPart\n ? part.text.trim()\n : part.text,\n\n cache_control: cacheControl,\n });\n break;\n }\n\n case 'reasoning': {\n if (sendReasoning) {\n const reasoningMetadata = await parseProviderOptions({\n provider: 'anthropic',\n providerOptions: part.providerOptions,\n schema: anthropicReasoningMetadataSchema,\n });\n\n if (reasoningMetadata != null) {\n if (reasoningMetadata.signature != null) {\n // Note: thinking blocks cannot have cache_control directly\n // They are cached implicitly when in previous assistant turns\n // Validate to provide helpful error message\n validator.getCacheControl(part.providerOptions, {\n type: 'thinking block',\n canCache: false,\n });\n anthropicContent.push({\n type: 'thinking',\n thinking: part.text,\n signature: reasoningMetadata.signature,\n });\n } else if (reasoningMetadata.redactedData != null) {\n // Note: redacted thinking blocks cannot have cache_control directly\n // They are cached implicitly when in previous assistant turns\n // Validate to provide helpful error message\n validator.getCacheControl(part.providerOptions, {\n type: 'redacted thinking block',\n canCache: false,\n });\n anthropicContent.push({\n type: 'redacted_thinking',\n data: reasoningMetadata.redactedData,\n });\n } else {\n warnings.push({\n type: 'other',\n message: 'unsupported reasoning metadata',\n });\n }\n } else {\n warnings.push({\n type: 'other',\n message: 'unsupported reasoning metadata',\n });\n }\n } else {\n warnings.push({\n type: 'other',\n message:\n 'sending reasoning content is disabled for this model',\n });\n }\n break;\n }\n\n case 'tool-call': {\n if (part.providerExecuted) {\n const providerToolName = toolNameMapping.toProviderToolName(\n part.toolName,\n );\n const isMcpToolUse =\n part.providerOptions?.anthropic?.type === 'mcp-tool-use';\n\n if (isMcpToolUse) {\n mcpToolUseIds.add(part.toolCallId);\n\n const serverName =\n part.providerOptions?.anthropic?.serverName;\n\n if (serverName == null || typeof serverName !== 'string') {\n warnings.push({\n type: 'other',\n message:\n 'mcp tool use server name is required and must be a string',\n });\n break;\n }\n\n anthropicContent.push({\n type: 'mcp_tool_use',\n id: part.toolCallId,\n name: part.toolName,\n input: part.input,\n server_name: serverName,\n cache_control: cacheControl,\n });\n } else if (\n // code execution 20250825:\n providerToolName === 'code_execution' &&\n part.input != null &&\n typeof part.input === 'object' &&\n 'type' in part.input &&\n typeof part.input.type === 'string' &&\n (part.input.type === 'bash_code_execution' ||\n part.input.type === 'text_editor_code_execution')\n ) {\n anthropicContent.push({\n type: 'server_tool_use',\n id: part.toolCallId,\n name: part.input.type, // map back to subtool name\n input: part.input,\n cache_control: cacheControl,\n });\n } else if (\n // code execution 20250825 programmatic tool calling:\n // Strip the fake 'programmatic-tool-call' type before sending to Anthropic\n providerToolName === 'code_execution' &&\n part.input != null &&\n typeof part.input === 'object' &&\n 'type' in part.input &&\n part.input.type === 'programmatic-tool-call'\n ) {\n const { type: _, ...inputWithoutType } = part.input as {\n type: string;\n code: string;\n };\n anthropicContent.push({\n type: 'server_tool_use',\n id: part.toolCallId,\n name: 'code_execution',\n input: inputWithoutType,\n cache_control: cacheControl,\n });\n } else {\n if (\n providerToolName === 'code_execution' || // code execution 20250522\n providerToolName === 'web_fetch' ||\n providerToolName === 'web_search'\n ) {\n anthropicContent.push({\n type: 'server_tool_use',\n id: part.toolCallId,\n name: providerToolName,\n input: part.input,\n cache_control: cacheControl,\n });\n } else if (\n providerToolName === 'tool_search_tool_regex' ||\n providerToolName === 'tool_search_tool_bm25'\n ) {\n anthropicContent.push({\n type: 'server_tool_use',\n id: part.toolCallId,\n name: providerToolName,\n input: part.input,\n cache_control: cacheControl,\n });\n } else {\n warnings.push({\n type: 'other',\n message: `provider executed tool call for tool ${part.toolName} is not supported`,\n });\n }\n }\n\n break;\n }\n\n // Extract caller info from provider options for programmatic tool calling\n const callerOptions = part.providerOptions?.anthropic as\n | { caller?: { type: string; toolId?: string } }\n | undefined;\n const caller = callerOptions?.caller\n ? callerOptions.caller.type === 'code_execution_20250825' &&\n callerOptions.caller.toolId\n ? {\n type: 'code_execution_20250825' as const,\n tool_id: callerOptions.caller.toolId,\n }\n : callerOptions.caller.type === 'direct'\n ? { type: 'direct' as const }\n : undefined\n : undefined;\n\n anthropicContent.push({\n type: 'tool_use',\n id: part.toolCallId,\n name: part.toolName,\n input: part.input,\n ...(caller && { caller }),\n cache_control: cacheControl,\n });\n break;\n }\n\n case 'tool-result': {\n const providerToolName = toolNameMapping.toProviderToolName(\n part.toolName,\n );\n\n if (mcpToolUseIds.has(part.toolCallId)) {\n const output = part.output;\n\n if (output.type !== 'json' && output.type !== 'error-json') {\n warnings.push({\n type: 'other',\n message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`,\n });\n\n break;\n }\n\n anthropicContent.push({\n type: 'mcp_tool_result',\n tool_use_id: part.toolCallId,\n is_error: output.type === 'error-json',\n content: output.value as unknown as\n | string\n | Array<{ type: 'text'; text: string }>,\n cache_control: cacheControl,\n });\n } else if (providerToolName === 'code_execution') {\n const output = part.output;\n\n // Handle error types for code_execution tools (e.g., from programmatic tool calling)\n if (\n output.type === 'error-text' ||\n output.type === 'error-json'\n ) {\n let errorInfo: { type?: string; errorCode?: string } = {};\n try {\n if (typeof output.value === 'string') {\n errorInfo = JSON.parse(output.value);\n } else if (\n typeof output.value === 'object' &&\n output.value !== null\n ) {\n errorInfo = output.value as typeof errorInfo;\n }\n } catch {}\n\n if (errorInfo.type === 'code_execution_tool_result_error') {\n anthropicContent.push({\n type: 'code_execution_tool_result',\n tool_use_id: part.toolCallId,\n content: {\n type: 'code_execution_tool_result_error' as const,\n error_code: errorInfo.errorCode ?? 'unknown',\n },\n cache_control: cacheControl,\n });\n } else {\n anthropicContent.push({\n type: 'bash_code_execution_tool_result',\n tool_use_id: part.toolCallId,\n cache_control: cacheControl,\n content: {\n type: 'bash_code_execution_tool_result_error' as const,\n error_code: errorInfo.errorCode ?? 'unknown',\n },\n });\n }\n break;\n }\n\n if (output.type !== 'json') {\n warnings.push({\n type: 'other',\n message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`,\n });\n\n break;\n }\n\n if (\n output.value == null ||\n typeof output.value !== 'object' ||\n !('type' in output.value) ||\n typeof output.value.type !== 'string'\n ) {\n warnings.push({\n type: 'other',\n message: `provider executed tool result output value is not a valid code execution result for tool ${part.toolName}`,\n });\n break;\n }\n\n // to distinguish between code execution 20250522 and 20250825,\n // we check if a type property is present in the output.value\n if (output.value.type === 'code_execution_result') {\n // code execution 20250522\n const codeExecutionOutput = await validateTypes({\n value: output.value,\n schema: codeExecution_20250522OutputSchema,\n });\n\n anthropicContent.push({\n type: 'code_execution_tool_result',\n tool_use_id: part.toolCallId,\n content: {\n type: codeExecutionOutput.type,\n stdout: codeExecutionOutput.stdout,\n stderr: codeExecutionOutput.stderr,\n return_code: codeExecutionOutput.return_code,\n content: codeExecutionOutput.content ?? [],\n },\n cache_control: cacheControl,\n });\n } else {\n // code execution 20250825\n const codeExecutionOutput = await validateTypes({\n value: output.value,\n schema: codeExecution_20250825OutputSchema,\n });\n\n if (codeExecutionOutput.type === 'code_execution_result') {\n // Programmatic tool calling result - same format as 20250522\n anthropicContent.push({\n type: 'code_execution_tool_result',\n tool_use_id: part.toolCallId,\n content: {\n type: codeExecutionOutput.type,\n stdout: codeExecutionOutput.stdout,\n stderr: codeExecutionOutput.stderr,\n return_code: codeExecutionOutput.return_code,\n content: codeExecutionOutput.content ?? [],\n },\n cache_control: cacheControl,\n });\n } else if (\n codeExecutionOutput.type ===\n 'bash_code_execution_result' ||\n codeExecutionOutput.type ===\n 'bash_code_execution_tool_result_error'\n ) {\n anthropicContent.push({\n type: 'bash_code_execution_tool_result',\n tool_use_id: part.toolCallId,\n cache_control: cacheControl,\n content: codeExecutionOutput,\n });\n } else {\n anthropicContent.push({\n type: 'text_editor_code_execution_tool_result',\n tool_use_id: part.toolCallId,\n cache_control: cacheControl,\n content: codeExecutionOutput,\n });\n }\n }\n break;\n }\n\n if (providerToolName === 'web_fetch') {\n const output = part.output;\n\n if (output.type !== 'json') {\n warnings.push({\n type: 'other',\n message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`,\n });\n\n break;\n }\n\n const webFetchOutput = await validateTypes({\n value: output.value,\n schema: webFetch_20250910OutputSchema,\n });\n\n anthropicContent.push({\n type: 'web_fetch_tool_result',\n tool_use_id: part.toolCallId,\n content: {\n type: 'web_fetch_result',\n url: webFetchOutput.url,\n retrieved_at: webFetchOutput.retrievedAt,\n content: {\n type: 'document',\n title: webFetchOutput.content.title,\n citations: webFetchOutput.content.citations,\n source: {\n type: webFetchOutput.content.source.type,\n media_type: webFetchOutput.content.source.mediaType,\n data: webFetchOutput.content.source.data,\n } as AnthropicWebFetchToolResultContent['content']['content']['source'],\n },\n },\n cache_control: cacheControl,\n });\n\n break;\n }\n\n if (providerToolName === 'web_search') {\n const output = part.output;\n\n if (output.type !== 'json') {\n warnings.push({\n type: 'other',\n message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`,\n });\n\n break;\n }\n\n const webSearchOutput = await validateTypes({\n value: output.value,\n schema: webSearch_20250305OutputSchema,\n });\n\n anthropicContent.push({\n type: 'web_search_tool_result',\n tool_use_id: part.toolCallId,\n content: webSearchOutput.map(result => ({\n url: result.url,\n title: result.title,\n page_age: result.pageAge,\n encrypted_content: result.encryptedContent,\n type: result.type,\n })),\n cache_control: cacheControl,\n });\n\n break;\n }\n\n if (\n providerToolName === 'tool_search_tool_regex' ||\n providerToolName === 'tool_search_tool_bm25'\n ) {\n const output = part.output;\n\n if (output.type !== 'json') {\n warnings.push({\n type: 'other',\n message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`,\n });\n\n break;\n }\n\n const toolSearchOutput = await validateTypes({\n value: output.value,\n schema: toolSearchOutputSchema,\n });\n\n // Convert tool references back to API format\n const toolReferences = toolSearchOutput.map(ref => ({\n type: 'tool_reference' as const,\n tool_name: ref.toolName,\n }));\n\n anthropicContent.push({\n type: 'tool_search_tool_result',\n tool_use_id: part.toolCallId,\n content: {\n type: 'tool_search_tool_search_result',\n tool_references: toolReferences,\n },\n cache_control: cacheControl,\n });\n\n break;\n }\n\n warnings.push({\n type: 'other',\n message: `provider executed tool result for tool ${part.toolName} is not supported`,\n });\n\n break;\n }\n }\n }\n }\n\n messages.push({ role: 'assistant', content: anthropicContent });\n\n break;\n }\n\n default: {\n const _exhaustiveCheck: never = type;\n throw new Error(`content type: ${_exhaustiveCheck}`);\n }\n }\n }\n\n return {\n prompt: { system, messages },\n betas,\n };\n}\n\ntype SystemBlock = {\n type: 'system';\n messages: Array<LanguageModelV3Message & { role: 'system' }>;\n};\ntype AssistantBlock = {\n type: 'assistant';\n messages: Array<LanguageModelV3Message & { role: 'assistant' }>;\n};\ntype UserBlock = {\n type: 'user';\n messages: Array<LanguageModelV3Message & { role: 'user' | 'tool' }>;\n};\n\nfunction groupIntoBlocks(\n prompt: LanguageModelV3Prompt,\n): Array<SystemBlock | AssistantBlock | UserBlock> {\n const blocks: Array<SystemBlock | AssistantBlock | UserBlock> = [];\n let currentBlock: SystemBlock | AssistantBlock | UserBlock | undefined =\n undefined;\n\n for (const message of prompt) {\n const { role } = message;\n switch (role) {\n case 'system': {\n if (currentBlock?.type !== 'system') {\n currentBlock = { type: 'system', messages: [] };\n blocks.push(currentBlock);\n }\n\n currentBlock.messages.push(message);\n break;\n }\n case 'assistant': {\n if (currentBlock?.type !== 'assistant') {\n currentBlock = { type: 'assistant', messages: [] };\n blocks.push(currentBlock);\n }\n\n currentBlock.messages.push(message);\n break;\n }\n case 'user': {\n if (currentBlock?.type !== 'user') {\n currentBlock = { type: 'user', messages: [] };\n blocks.push(currentBlock);\n }\n\n currentBlock.messages.push(message);\n break;\n }\n case 'tool': {\n if (currentBlock?.type !== 'user') {\n currentBlock = { type: 'user', messages: [] };\n blocks.push(currentBlock);\n }\n\n currentBlock.messages.push(message);\n break;\n }\n default: {\n const _exhaustiveCheck: never = role;\n throw new Error(`Unsupported role: ${_exhaustiveCheck}`);\n }\n }\n }\n\n return blocks;\n}\n","import {\n createProviderToolFactoryWithOutputSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const codeExecution_20250522OutputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n type: z.literal('code_execution_result'),\n stdout: z.string(),\n stderr: z.string(),\n return_code: z.number(),\n content: z\n .array(\n z.object({\n type: z.literal('code_execution_output'),\n file_id: z.string(),\n }),\n )\n .optional()\n .default([]),\n }),\n ),\n);\n\nconst codeExecution_20250522InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n code: z.string(),\n }),\n ),\n);\n\nconst factory = createProviderToolFactoryWithOutputSchema<\n {\n /**\n * The Python code to execute.\n */\n code: string;\n },\n {\n type: 'code_execution_result';\n stdout: string;\n stderr: string;\n return_code: number;\n content: Array<{ type: 'code_execution_output'; file_id: string }>;\n },\n {}\n>({\n id: 'anthropic.code_execution_20250522',\n inputSchema: codeExecution_20250522InputSchema,\n outputSchema: codeExecution_20250522OutputSchema,\n});\n\nexport const codeExecution_20250522 = (\n args: Parameters<typeof factory>[0] = {},\n) => {\n return factory(args);\n};\n","import {\n createProviderToolFactoryWithOutputSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const codeExecution_20250825OutputSchema = lazySchema(() =>\n zodSchema(\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('code_execution_result'),\n stdout: z.string(),\n stderr: z.string(),\n return_code: z.number(),\n content: z\n .array(\n z.object({\n type: z.literal('code_execution_output'),\n file_id: z.string(),\n }),\n )\n .optional()\n .default([]),\n }),\n z.object({\n type: z.literal('bash_code_execution_result'),\n content: z.array(\n z.object({\n type: z.literal('bash_code_execution_output'),\n file_id: z.string(),\n }),\n ),\n stdout: z.string(),\n stderr: z.string(),\n return_code: z.number(),\n }),\n z.object({\n type: z.literal('bash_code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_view_result'),\n content: z.string(),\n file_type: z.string(),\n num_lines: z.number().nullable(),\n start_line: z.number().nullable(),\n total_lines: z.number().nullable(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_create_result'),\n is_file_update: z.boolean(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_str_replace_result'),\n lines: z.array(z.string()).nullable(),\n new_lines: z.number().nullable(),\n new_start: z.number().nullable(),\n old_lines: z.number().nullable(),\n old_start: z.number().nullable(),\n }),\n ]),\n ),\n);\n\nexport const codeExecution_20250825InputSchema = lazySchema(() =>\n zodSchema(\n z.discriminatedUnion('type', [\n // Programmatic tool calling format (mapped from { code } by AI SDK)\n z.object({\n type: z.literal('programmatic-tool-call'),\n code: z.string(),\n }),\n z.object({\n type: z.literal('bash_code_execution'),\n command: z.string(),\n }),\n z.discriminatedUnion('command', [\n z.object({\n type: z.literal('text_editor_code_execution'),\n command: z.literal('view'),\n path: z.string(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution'),\n command: z.literal('create'),\n path: z.string(),\n file_text: z.string().nullish(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution'),\n command: z.literal('str_replace'),\n path: z.string(),\n old_str: z.string(),\n new_str: z.string(),\n }),\n ]),\n ]),\n ),\n);\n\nconst factory = createProviderToolFactoryWithOutputSchema<\n | {\n type: 'programmatic-tool-call';\n /**\n * Programmatic tool calling: Python code to execute when code_execution\n * is used with allowedCallers to trigger client-executed tools.\n */\n code: string;\n }\n | {\n type: 'bash_code_execution';\n\n /**\n * Shell command to execute.\n */\n command: string;\n }\n | {\n type: 'text_editor_code_execution';\n command: 'view';\n\n /**\n * The path to the file to view.\n */\n path: string;\n }\n | {\n type: 'text_editor_code_execution';\n command: 'create';\n\n /**\n * The path to the file to edit.\n */\n path: string;\n\n /**\n * The text of the file to edit.\n */\n file_text?: string | null;\n }\n | {\n type: 'text_editor_code_execution';\n command: 'str_replace';\n\n /**\n * The path to the file to edit.\n */\n path: string;\n\n /**\n * The string to replace.\n */\n old_str: string;\n\n /**\n * The new string to replace the old string with.\n */\n new_str: string;\n },\n | {\n /**\n * Programmatic tool calling result: returned when code_execution runs code\n * that calls client-executed tools via allowedCallers.\n */\n type: 'code_execution_result';\n\n /**\n * Output from successful execution\n */\n stdout: string;\n\n /**\n * Error messages if execution fails\n */\n stderr: string;\n\n /**\n * 0 for success, non-zero for failure\n */\n return_code: number;\n\n /**\n * Output file Id list\n */\n content: Array<{ type: 'code_execution_output'; file_id: string }>;\n }\n | {\n type: 'bash_code_execution_result';\n\n /**\n * Output file Id list\n */\n content: Array<{\n type: 'bash_code_execution_output';\n file_id: string;\n }>;\n\n /**\n * Output from successful execution\n */\n stdout: string;\n\n /**\n * Error messages if execution fails\n */\n stderr: string;\n\n /**\n * 0 for success, non-zero for failure\n */\n return_code: number;\n }\n | {\n type: 'bash_code_execution_tool_result_error';\n\n /**\n * Available options: invalid_tool_input, unavailable, too_many_requests,\n * execution_time_exceeded, output_file_too_large.\n */\n error_code: string;\n }\n | {\n type: 'text_editor_code_execution_tool_result_error';\n\n /**\n * Available options: invalid_tool_input, unavailable, too_many_requests,\n * execution_time_exceeded, file_not_found.\n */\n error_code: string;\n }\n | {\n type: 'text_editor_code_execution_view_result';\n\n content: string;\n\n /**\n * The type of the file. Available options: text, image, pdf.\n */\n file_type: string;\n\n num_lines: number | null;\n start_line: number | null;\n total_lines: number | null;\n }\n | {\n type: 'text_editor_code_execution_create_result';\n\n is_file_update: boolean;\n }\n | {\n type: 'text_editor_code_execution_str_replace_result';\n\n lines: string[] | null;\n new_lines: number | null;\n new_start: number | null;\n old_lines: number | null;\n old_start: number | null;\n },\n {\n // no arguments\n }\n>({\n id: 'anthropic.code_execution_20250825',\n inputSchema: codeExecution_20250825InputSchema,\n outputSchema: codeExecution_20250825OutputSchema,\n // Programmatic tool calling: tool results may be deferred to a later turn\n // when code execution triggers a client-executed tool that needs to be\n // resolved before the code execution result can be returned.\n supportsDeferredResults: true,\n});\n\nexport const codeExecution_20250825 = (\n args: Parameters<typeof factory>[0] = {},\n) => {\n return factory(args);\n};\n","import {\n createProviderToolFactoryWithOutputSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\n/**\n * Output schema for tool search results - returns tool references\n * that are automatically expanded into full tool definitions by the API.\n */\nexport const toolSearchRegex_20251119OutputSchema = lazySchema(() =>\n zodSchema(\n z.array(\n z.object({\n type: z.literal('tool_reference'),\n toolName: z.string(),\n }),\n ),\n ),\n);\n\n/**\n * Input schema for regex-based tool search.\n * Claude constructs regex patterns using Python's re.search() syntax.\n */\nconst toolSearchRegex_20251119InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n /**\n * A regex pattern to search for tools.\n * Uses Python re.search() syntax. Maximum 200 characters.\n *\n * Examples:\n * - \"weather\" - matches tool names/descriptions containing \"weather\"\n * - \"get_.*_data\" - matches tools like get_user_data, get_weather_data\n * - \"database.*query|query.*database\" - OR patterns for flexibility\n * - \"(?i)slack\" - case-insensitive search\n */\n pattern: z.string(),\n /**\n * Maximum number of tools to return. Optional.\n */\n limit: z.number().optional(),\n }),\n ),\n);\n\nconst factory = createProviderToolFactoryWithOutputSchema<\n {\n /**\n * A regex pattern to search for tools.\n * Uses Python re.search() syntax. Maximum 200 characters.\n *\n * Examples:\n * - \"weather\" - matches tool names/descriptions containing \"weather\"\n * - \"get_.*_data\" - matches tools like get_user_data, get_weather_data\n * - \"database.*query|query.*database\" - OR patterns for flexibility\n * - \"(?i)slack\" - case-insensitive search\n */\n pattern: string;\n /**\n * Maximum number of tools to return. Optional.\n */\n limit?: number;\n },\n Array<{\n type: 'tool_reference';\n /**\n * The name of the discovered tool.\n */\n toolName: string;\n }>,\n {}\n>({\n id: 'anthropic.tool_search_regex_20251119',\n inputSchema: toolSearchRegex_20251119InputSchema,\n outputSchema: toolSearchRegex_20251119OutputSchema,\n});\n\n/**\n * Creates a tool search tool that uses regex patterns to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand. Instead of loading all\n * tool definitions into the context window upfront, Claude searches your tool\n * catalog and loads only the tools it needs.\n *\n * When Claude uses this tool, it constructs regex patterns using Python's\n * re.search() syntax (NOT natural language queries).\n *\n * **Important**: This tool should never have `deferLoading: true` in providerOptions.\n *\n * @example\n * ```ts\n * import { anthropicTools } from '@ai-sdk/anthropic';\n *\n * const tools = {\n * toolSearch: anthropicTools.toolSearchRegex_20251119(),\n * // Other tools with deferLoading...\n * };\n * ```\n *\n * @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-search-tool\n */\nexport const toolSearchRegex_20251119 = (\n args: Parameters<typeof factory>[0] = {},\n) => {\n return factory(args);\n};\n","import { LanguageModelV3FinishReason } from '@ai-sdk/provider';\n\n/**\n * @see https://docs.anthropic.com/en/api/messages#response-stop-reason\n */\nexport function mapAnthropicStopReason({\n finishReason,\n isJsonResponseFromTool,\n}: {\n finishReason: string | null | undefined;\n isJsonResponseFromTool?: boolean;\n}): LanguageModelV3FinishReason {\n switch (finishReason) {\n case 'pause_turn':\n case 'end_turn':\n case 'stop_sequence':\n return 'stop';\n case 'refusal':\n return 'content-filter';\n case 'tool_use':\n return isJsonResponseFromTool ? 'stop' : 'tool-calls';\n case 'max_tokens':\n return 'length';\n case 'model_context_window_exceeded':\n return 'length';\n default:\n return 'unknown';\n }\n}\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst bash_20241022InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n command: z.string(),\n restart: z.boolean().optional(),\n }),\n ),\n);\n\nexport const bash_20241022 = createProviderToolFactory<\n {\n /**\n * The bash command to run. Required unless the tool is being restarted.\n */\n command: string;\n\n /**\n * Specifying true will restart this tool. Otherwise, leave this unspecified.\n */\n restart?: boolean;\n },\n {}\n>({\n id: 'anthropic.bash_20241022',\n inputSchema: bash_20241022InputSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst bash_20250124InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n command: z.string(),\n restart: z.boolean().optional(),\n }),\n ),\n);\n\nexport const bash_20250124 = createProviderToolFactory<\n {\n /**\n * The bash command to run. Required unless the tool is being restarted.\n */\n command: string;\n\n /**\n * Specifying true will restart this tool. Otherwise, leave this unspecified.\n */\n restart?: boolean;\n },\n {}\n>({\n id: 'anthropic.bash_20250124',\n inputSchema: bash_20250124InputSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst computer_20241022InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n action: z.enum([\n 'key',\n 'type',\n 'mouse_move',\n 'left_click',\n 'left_click_drag',\n 'right_click',\n 'middle_click',\n 'double_click',\n 'screenshot',\n 'cursor_position',\n ]),\n coordinate: z.array(z.number().int()).optional(),\n text: z.string().optional(),\n }),\n ),\n);\n\nexport const computer_20241022 = createProviderToolFactory<\n {\n /**\n * The action to perform. The available actions are:\n * - `key`: Press a key or key-combination on the keyboard.\n * - This supports xdotool's `key` syntax.\n * - Examples: \"a\", \"Return\", \"alt+Tab\", \"ctrl+s\", \"Up\", \"KP_0\" (for the numpad 0 key).\n * - `type`: Type a string of text on the keyboard.\n * - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.\n * - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.\n * - `left_click`: Click the left mouse button.\n * - `left_click_drag`: Click and drag the cursor to a specified (x, y) pixel coordinate on the screen.\n * - `right_click`: Click the right mouse button.\n * - `middle_click`: Click the middle mouse button.\n * - `double_click`: Double-click the left mouse button.\n * - `screenshot`: Take a screenshot of the screen.\n */\n action:\n | 'key'\n | 'type'\n | 'mouse_move'\n | 'left_click'\n | 'left_click_drag'\n | 'right_click'\n | 'middle_click'\n | 'double_click'\n | 'screenshot'\n | 'cursor_position';\n\n /**\n * (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=mouse_move` and `action=left_click_drag`.\n */\n coordinate?: number[];\n\n /**\n * Required only by `action=type` and `action=key`.\n */\n text?: string;\n },\n {\n /**\n * The width of the display being controlled by the model in pixels.\n */\n displayWidthPx: number;\n\n /**\n * The height of the display being controlled by the model in pixels.\n */\n displayHeightPx: number;\n\n /**\n * The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.\n */\n displayNumber?: number;\n }\n>({\n id: 'anthropic.computer_20241022',\n inputSchema: computer_20241022InputSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst computer_20250124InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n action: z.enum([\n 'key',\n 'hold_key',\n 'type',\n 'cursor_position',\n 'mouse_move',\n 'left_mouse_down',\n 'left_mouse_up',\n 'left_click',\n 'left_click_drag',\n 'right_click',\n 'middle_click',\n 'double_click',\n 'triple_click',\n 'scroll',\n 'wait',\n 'screenshot',\n ]),\n coordinate: z.tuple([z.number().int(), z.number().int()]).optional(),\n duration: z.number().optional(),\n scroll_amount: z.number().optional(),\n scroll_direction: z.enum(['up', 'down', 'left', 'right']).optional(),\n start_coordinate: z\n .tuple([z.number().int(), z.number().int()])\n .optional(),\n text: z.string().optional(),\n }),\n ),\n);\n\nexport const computer_20250124 = createProviderToolFactory<\n {\n /**\n * - `key`: Press a key or key-combination on the keyboard.\n * - This supports xdotool's `key` syntax.\n * - Examples: \"a\", \"Return\", \"alt+Tab\", \"ctrl+s\", \"Up\", \"KP_0\" (for the numpad 0 key).\n * - `hold_key`: Hold down a key or multiple keys for a specified duration (in seconds). Supports the same syntax as `key`.\n * - `type`: Type a string of text on the keyboard.\n * - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.\n * - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.\n * - `left_mouse_down`: Press the left mouse button.\n * - `left_mouse_up`: Release the left mouse button.\n * - `left_click`: Click the left mouse button at the specified (x, y) pixel coordinate on the screen. You can also include a key combination to hold down while clicking using the `text` parameter.\n * - `left_click_drag`: Click and drag the cursor from `start_coordinate` to a specified (x, y) pixel coordinate on the screen.\n * - `right_click`: Click the right mouse button at the specified (x, y) pixel coordinate on the screen.\n * - `middle_click`: Click the middle mouse button at the specified (x, y) pixel coordinate on the screen.\n * - `double_click`: Double-click the left mouse button at the specified (x, y) pixel coordinate on the screen.\n * - `triple_click`: Triple-click the left mouse button at the specified (x, y) pixel coordinate on the screen.\n * - `scroll`: Scroll the screen in a specified direction by a specified amount of clicks of the scroll wheel, at the specified (x, y) pixel coordinate. DO NOT use PageUp/PageDown to scroll.\n * - `wait`: Wait for a specified duration (in seconds).\n * - `screenshot`: Take a screenshot of the screen.\n */\n action:\n | 'key'\n | 'hold_key'\n | 'type'\n | 'cursor_position'\n | 'mouse_move'\n | 'left_mouse_down'\n | 'left_mouse_up'\n | 'left_click'\n | 'left_click_drag'\n | 'right_click'\n | 'middle_click'\n | 'double_click'\n | 'triple_click'\n | 'scroll'\n | 'wait'\n | 'screenshot';\n\n /**\n * (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=mouse_move` and `action=left_click_drag`.\n */\n coordinate?: [number, number];\n\n /**\n * The duration to hold the key down for. Required only by `action=hold_key` and `action=wait`.\n */\n duration?: number;\n\n /**\n * The number of 'clicks' to scroll. Required only by `action=scroll`.\n */\n scroll_amount?: number;\n\n /**\n * The direction to scroll the screen. Required only by `action=scroll`.\n */\n scroll_direction?: 'up' | 'down' | 'left' | 'right';\n\n /**\n * (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to start the drag from. Required only by `action=left_click_drag`.\n */\n start_coordinate?: [number, number];\n\n /**\n * Required only by `action=type`, `action=key`, and `action=hold_key`. Can also be used by click or scroll actions to hold down keys while clicking or scrolling.\n */\n text?: string;\n },\n {\n /**\n * The width of the display being controlled by the model in pixels.\n */\n displayWidthPx: number;\n\n /**\n * The height of the display being controlled by the model in pixels.\n */\n displayHeightPx: number;\n\n /**\n * The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.\n */\n displayNumber?: number;\n }\n>({\n id: 'anthropic.computer_20250124',\n inputSchema: computer_20250124InputSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst memory_20250818InputSchema = lazySchema(() =>\n zodSchema(\n z.discriminatedUnion('command', [\n z.object({\n command: z.literal('view'),\n path: z.string(),\n view_range: z.tuple([z.number(), z.number()]).optional(),\n }),\n z.object({\n command: z.literal('create'),\n path: z.string(),\n file_text: z.string(),\n }),\n z.object({\n command: z.literal('str_replace'),\n path: z.string(),\n old_str: z.string(),\n new_str: z.string(),\n }),\n z.object({\n command: z.literal('insert'),\n path: z.string(),\n insert_line: z.number(),\n insert_text: z.string(),\n }),\n z.object({\n command: z.literal('delete'),\n path: z.string(),\n }),\n z.object({\n command: z.literal('rename'),\n old_path: z.string(),\n new_path: z.string(),\n }),\n ]),\n ),\n);\n\nexport const memory_20250818 = createProviderToolFactory<\n | { command: 'view'; path: string; view_range?: [number, number] }\n | { command: 'create'; path: string; file_text: string }\n | { command: 'str_replace'; path: string; old_str: string; new_str: string }\n | {\n command: 'insert';\n path: string;\n insert_line: number;\n insert_text: string;\n }\n | { command: 'delete'; path: string }\n | { command: 'rename'; old_path: string; new_path: string },\n {}\n>({\n id: 'anthropic.memory_20250818',\n inputSchema: memory_20250818InputSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst textEditor_20241022InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n command: z.enum(['view', 'create', 'str_replace', 'insert', 'undo_edit']),\n path: z.string(),\n file_text: z.string().optional(),\n insert_line: z.number().int().optional(),\n new_str: z.string().optional(),\n old_str: z.string().optional(),\n view_range: z.array(z.number().int()).optional(),\n }),\n ),\n);\n\nexport const textEditor_20241022 = createProviderToolFactory<\n {\n /**\n * The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`.\n */\n command: 'view' | 'create' | 'str_replace' | 'insert' | 'undo_edit';\n\n /**\n * Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.\n */\n path: string;\n\n /**\n * Required parameter of `create` command, with the content of the file to be created.\n */\n file_text?: string;\n\n /**\n * Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.\n */\n insert_line?: number;\n\n /**\n * Optional parameter of `str_replace` command containing the new string (if not given, no string will be added). Required parameter of `insert` command containing the string to insert.\n */\n new_str?: string;\n\n /**\n * Required parameter of `str_replace` command containing the string in `path` to replace.\n */\n old_str?: string;\n\n /**\n * Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.\n */\n view_range?: number[];\n },\n {}\n>({\n id: 'anthropic.text_editor_20241022',\n inputSchema: textEditor_20241022InputSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst textEditor_20250124InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n command: z.enum(['view', 'create', 'str_replace', 'insert', 'undo_edit']),\n path: z.string(),\n file_text: z.string().optional(),\n insert_line: z.number().int().optional(),\n new_str: z.string().optional(),\n old_str: z.string().optional(),\n view_range: z.array(z.number().int()).optional(),\n }),\n ),\n);\n\nexport const textEditor_20250124 = createProviderToolFactory<\n {\n /**\n * The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`.\n */\n command: 'view' | 'create' | 'str_replace' | 'insert' | 'undo_edit';\n\n /**\n * Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.\n */\n path: string;\n\n /**\n * Required parameter of `create` command, with the content of the file to be created.\n */\n file_text?: string;\n\n /**\n * Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.\n */\n insert_line?: number;\n\n /**\n * Optional parameter of `str_replace` command containing the new string (if not given, no string will be added). Required parameter of `insert` command containing the string to insert.\n */\n new_str?: string;\n\n /**\n * Required parameter of `str_replace` command containing the string in `path` to replace.\n */\n old_str?: string;\n\n /**\n * Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.\n */\n view_range?: number[];\n },\n {}\n>({\n id: 'anthropic.text_editor_20250124',\n inputSchema: textEditor_20250124InputSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst textEditor_20250429InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n command: z.enum(['view', 'create', 'str_replace', 'insert']),\n path: z.string(),\n file_text: z.string().optional(),\n insert_line: z.number().int().optional(),\n new_str: z.string().optional(),\n old_str: z.string().optional(),\n view_range: z.array(z.number().int()).optional(),\n }),\n ),\n);\n\nexport const textEditor_20250429 = createProviderToolFactory<\n {\n /**\n * The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`.\n * Note: `undo_edit` is not supported in Claude 4 models.\n */\n command: 'view' | 'create' | 'str_replace' | 'insert';\n\n /**\n * Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.\n */\n path: string;\n\n /**\n * Required parameter of `create` command, with the content of the file to be created.\n */\n file_text?: string;\n\n /**\n * Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.\n */\n insert_line?: number;\n\n /**\n * Optional parameter of `str_replace` command containing the new string (if not given, no string will be added). Required parameter of `insert` command containing the string to insert.\n */\n new_str?: string;\n\n /**\n * Required parameter of `str_replace` command containing the string in `path` to replace.\n */\n old_str?: string;\n\n /**\n * Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.\n */\n view_range?: number[];\n },\n {}\n>({\n id: 'anthropic.text_editor_20250429',\n inputSchema: textEditor_20250429InputSchema,\n});\n","import {\n createProviderToolFactoryWithOutputSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\n/**\n * Output schema for tool search results - returns tool references\n * that are automatically expanded into full tool definitions by the API.\n */\nexport const toolSearchBm25_20251119OutputSchema = lazySchema(() =>\n zodSchema(\n z.array(\n z.object({\n type: z.literal('tool_reference'),\n toolName: z.string(),\n }),\n ),\n ),\n);\n\n/**\n * Input schema for BM25-based tool search.\n * Claude uses natural language queries to search for tools.\n */\nconst toolSearchBm25_20251119InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n /**\n * A natural language query to search for tools.\n * Claude will use BM25 text search to find relevant tools.\n */\n query: z.string(),\n /**\n * Maximum number of tools to return. Optional.\n */\n limit: z.number().optional(),\n }),\n ),\n);\n\nconst factory = createProviderToolFactoryWithOutputSchema<\n {\n /**\n * A natural language query to search for tools.\n * Claude will use BM25 text search to find relevant tools.\n */\n query: string;\n /**\n * Maximum number of tools to return. Optional.\n */\n limit?: number;\n },\n Array<{\n type: 'tool_reference';\n /**\n * The name of the discovered tool.\n */\n toolName: string;\n }>,\n {}\n>({\n id: 'anthropic.tool_search_bm25_20251119',\n inputSchema: toolSearchBm25_20251119InputSchema,\n outputSchema: toolSearchBm25_20251119OutputSchema,\n});\n\n/**\n * Creates a tool search tool that uses BM25 (natural language) to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand. Instead of loading all\n * tool definitions into the context window upfront, Claude searches your tool\n * catalog and loads only the tools it needs.\n *\n * When Claude uses this tool, it uses natural language queries (NOT regex patterns)\n * to search for tools using BM25 text search.\n *\n * **Important**: This tool should never have `deferLoading: true` in providerOptions.\n *\n * @example\n * ```ts\n * import { anthropicTools } from '@ai-sdk/anthropic';\n *\n * const tools = {\n * toolSearch: anthropicTools.toolSearchBm25_20251119(),\n * // Other tools with deferLoading...\n * };\n * ```\n *\n * @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-search-tool\n */\nexport const toolSearchBm25_20251119 = (\n args: Parameters<typeof factory>[0] = {},\n) => {\n return factory(args);\n};\n","import { bash_20241022 } from './tool/bash_20241022';\nimport { bash_20250124 } from './tool/bash_20250124';\nimport { codeExecution_20250522 } from './tool/code-execution_20250522';\nimport { codeExecution_20250825 } from './tool/code-execution_20250825';\nimport { computer_20241022 } from './tool/computer_20241022';\nimport { computer_20250124 } from './tool/computer_20250124';\nimport { memory_20250818 } from './tool/memory_20250818';\nimport { textEditor_20241022 } from './tool/text-editor_20241022';\nimport { textEditor_20250124 } from './tool/text-editor_20250124';\nimport { textEditor_20250429 } from './tool/text-editor_20250429';\nimport { textEditor_20250728 } from './tool/text-editor_20250728';\nimport { toolSearchBm25_20251119 } from './tool/tool-search-bm25_20251119';\nimport { toolSearchRegex_20251119 } from './tool/tool-search-regex_20251119';\nimport { webFetch_20250910 } from './tool/web-fetch-20250910';\nimport { webSearch_20250305 } from './tool/web-search_20250305';\n\nexport const anthropicTools = {\n /**\n * The bash tool enables Claude to execute shell commands in a persistent bash session,\n * allowing system operations, script execution, and command-line automation.\n *\n * Image results are supported.\n */\n bash_20241022,\n\n /**\n * The bash tool enables Claude to execute shell commands in a persistent bash session,\n * allowing system operations, script execution, and command-line automation.\n *\n * Image results are supported.\n */\n bash_20250124,\n\n /**\n * Claude can analyze data, create visualizations, perform complex calculations,\n * run system commands, create and edit files, and process uploaded files directly within\n * the API conversation.\n *\n * The code execution tool allows Claude to run Bash commands and manipulate files,\n * including writing code, in a secure, sandboxed environment.\n */\n codeExecution_20250522,\n\n /**\n * Claude can analyze data, create visualizations, perform complex calculations,\n * run system commands, create and edit files, and process uploaded files directly within\n * the API conversation.\n *\n * The code execution tool allows Claude to run both Python and Bash commands and manipulate files,\n * including writing code, in a secure, sandboxed environment.\n *\n * This is the latest version with enhanced Bash support and file operations.\n */\n codeExecution_20250825,\n\n /**\n * Claude can interact with computer environments through the computer use tool, which\n * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.\n *\n * Image results are supported.\n *\n * @param displayWidthPx - The width of the display being controlled by the model in pixels.\n * @param displayHeightPx - The height of the display being controlled by the model in pixels.\n * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.\n */\n computer_20241022,\n\n /**\n * Claude can interact with computer environments through the computer use tool, which\n * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.\n *\n * Image results are supported.\n *\n * @param displayWidthPx - The width of the display being controlled by the model in pixels.\n * @param displayHeightPx - The height of the display being controlled by the model in pixels.\n * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.\n */\n computer_20250124,\n\n /**\n * The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.\n * Claude can create, read, update, and delete files that persist between sessions,\n * allowing it to build knowledge over time without keeping everything in the context window.\n * The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.\n *\n * Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.\n */\n memory_20250818,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents. This allows Claude\n * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.\n *\n * Supported models: Claude Sonnet 3.5\n */\n textEditor_20241022,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents. This allows Claude\n * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.\n *\n * Supported models: Claude Sonnet 3.7\n */\n textEditor_20250124,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents. This allows Claude\n * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.\n *\n * Note: This version does not support the \"undo_edit\" command.\n *\n * @deprecated Use textEditor_20250728 instead\n */\n textEditor_20250429,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents. This allows Claude\n * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.\n *\n * Note: This version does not support the \"undo_edit\" command and adds optional max_characters parameter.\n *\n * Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1\n *\n * @param maxCharacters - Optional maximum number of characters to view in the file\n */\n textEditor_20250728,\n\n /**\n * Creates a web fetch tool that gives Claude direct access to real-time web content.\n *\n * @param maxUses - The max_uses parameter limits the number of web fetches performed\n * @param allowedDomains - Only fetch from these domains\n * @param blockedDomains - Never fetch from these domains\n * @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set \"citations\": {\"enabled\": true} to enable Claude to cite specific passages from fetched documents.\n * @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.\n */\n webFetch_20250910,\n\n /**\n * Creates a web search tool that gives Claude direct access to real-time web content.\n *\n * @param maxUses - Maximum number of web searches Claude can perform during the conversation.\n * @param allowedDomains - Optional list of domains that Claude is allowed to search.\n * @param blockedDomains - Optional list of domains that Claude should avoid when searching.\n * @param userLocation - Optional user location information to provide geographically relevant search results.\n */\n webSearch_20250305,\n\n /**\n * Creates a tool search tool that uses regex patterns to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand. Instead of loading all\n * tool definitions into the context window upfront, Claude searches your tool\n * catalog and loads only the tools it needs.\n *\n * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools\n * to mark them for deferred loading.\n *\n * Supported models: Claude Opus 4.5, Claude Sonnet 4.5\n */\n toolSearchRegex_20251119,\n\n /**\n * Creates a tool search tool that uses BM25 (natural language) to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand. Instead of loading all\n * tool definitions into the context window upfront, Claude searches your tool\n * catalog and loads only the tools it needs.\n *\n * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools\n * to mark them for deferred loading.\n *\n * Supported models: Claude Opus 4.5, Claude Sonnet 4.5\n */\n toolSearchBm25_20251119,\n};\n","import { JSONObject } from '@ai-sdk/provider';\nimport { AnthropicMessageMetadata } from './anthropic-message-metadata';\n\n/**\n * Sets the Anthropic container ID in the provider options based on\n * any previous step's provider metadata.\n *\n * Searches backwards through steps to find the most recent container ID.\n * You can use this function in `prepareStep` to forward the container ID between steps.\n */\nexport function forwardAnthropicContainerIdFromLastStep({\n steps,\n}: {\n steps: Array<{\n providerMetadata?: Record<string, JSONObject>;\n }>;\n}): undefined | { providerOptions?: Record<string, JSONObject> } {\n // Search backwards through steps to find the most recent container ID\n for (let i = steps.length - 1; i >= 0; i--) {\n const containerId = (\n steps[i].providerMetadata?.anthropic as\n | AnthropicMessageMetadata\n | undefined\n )?.container?.id;\n\n if (containerId) {\n return {\n providerOptions: {\n anthropic: {\n container: { id: containerId },\n },\n },\n };\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,mBAIO;AACP,IAAAC,0BAOO;;;ACVA,IAAM,UACX,OACI,kBACA;;;ACLN,IAAAC,mBAaO;AACP,IAAAC,0BAaO;;;AC3BP,4BAKO;AACP,gBAAkB;AAEX,IAAM,+BAA2B;AAAA,EAAW,UACjD;AAAA,IACE,YAAE,OAAO;AAAA,MACP,MAAM,YAAE,QAAQ,OAAO;AAAA,MACvB,OAAO,YAAE,OAAO;AAAA,QACd,MAAM,YAAE,OAAO;AAAA,QACf,SAAS,YAAE,OAAO;AAAA,MACpB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;AAIO,IAAM,qCAAiC,sDAA+B;AAAA,EAC3E,aAAa;AAAA,EACb,gBAAgB,UAAQ,KAAK,MAAM;AACrC,CAAC;;;AChBM,SAAS,8BACd,OACsB;AAXxB;AAYE,QAAM,cAAc,MAAM;AAC1B,QAAM,eAAe,MAAM;AAC3B,QAAM,uBAAsB,WAAM,gCAAN,YAAqC;AACjE,QAAM,mBAAkB,WAAM,4BAAN,YAAiC;AAEzD,SAAO;AAAA,IACL,aAAa;AAAA,MACX,OAAO,cAAc,sBAAsB;AAAA,MAC3C,SAAS;AAAA,MACT,WAAW;AAAA,MACX,YAAY;AAAA,IACd;AAAA,IACA,cAAc;AAAA,MACZ,OAAO;AAAA,MACP,MAAM;AAAA,MACN,WAAW;AAAA,IACb;AAAA,IACA,KAAK;AAAA,EACP;AACF;;;AC9BA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AAS,gBAAgB;AACzB,WAAS,OAAO;AAChB,WAAS,WAAW;AAEpB,WAAS,iBAAiB,CAAC,YAAoB;AAC7C,UAAM,IAAI,kCAAiB,EAAE,SAAS,WAAW,iBAAiB,CAAC;AAAA,EACrE;AACA,WAAS,qBAAqB,SAAS;AACvC,WAAS,aAAa,CAAC,YAAoB;AACzC,UAAM,IAAI,kCAAiB,EAAE,SAAS,WAAW,aAAa,CAAC;AAAA,EACjE;AAEA,WAAS,QAAQ;AAEjB,SAAO;AACT;AAKO,IAAM,YAAY,gBAAgB;;;A2B5IlC,SAAS,wCAAwC;AAAA,EACtD;AACF,GAIiE;AAhBjE;AAkBE,WAAS,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK;AAC1C,UAAM,eACJ,uBAAM,CAAC,EAAE,qBAAT,mBAA2B,cAA3B,mBAGC,cAHD,mBAGY;AAEd,QAAI,aAAa;AACf,aAAO;AAAA,QACL,iBAAiB;AAAA,UACf,WAAW;AAAA,YACT,WAAW,EAAE,IAAI,YAAY;AAAA,UAC/B;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":["import_provider","import_provider_utils","import_provider","import_provider_utils","import_provider_utils","import_v4","import_v4","anthropic","import_provider_utils","import_v4","import_provider_utils","import_v4","factory","import_provider_utils","import_v4","factory","import_provider_utils","anthropicTools","import_provider","import_provider_utils","import_provider_utils","import_v4","factory","import_provider_utils","import_v4","factory","import_provider_utils","import_v4","factory","_a","_b","i","generateId","anthropicTools","anthropic","_a","_b","import_provider_utils","import_v4","import_provider_utils","import_v4","import_provider_utils","import_v4","import_provider_utils","import_v4","import_provider_utils","import_v4","import_provider_utils","import_v4","import_provider_utils","import_v4","import_provider_utils","import_v4","import_provider_utils","import_v4","factory","_a"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/anthropic-provider.ts","../src/version.ts","../src/anthropic-messages-language-model.ts","../src/anthropic-error.ts","../src/anthropic-messages-api.ts","../src/anthropic-messages-options.ts","../src/anthropic-prepare-tools.ts","../src/get-cache-control.ts","../src/tool/text-editor_20250728.ts","../src/tool/web-search_20250305.ts","../src/tool/web-fetch-20250910.ts","../src/convert-anthropic-messages-usage.ts","../src/convert-to-anthropic-messages-prompt.ts","../src/tool/code-execution_20250522.ts","../src/tool/code-execution_20250825.ts","../src/tool/tool-search-regex_20251119.ts","../src/map-anthropic-stop-reason.ts","../src/tool/bash_20241022.ts","../src/tool/bash_20250124.ts","../src/tool/computer_20241022.ts","../src/tool/computer_20250124.ts","../src/tool/memory_20250818.ts","../src/tool/text-editor_20241022.ts","../src/tool/text-editor_20250124.ts","../src/tool/text-editor_20250429.ts","../src/tool/tool-search-bm25_20251119.ts","../src/anthropic-tools.ts","../src/forward-anthropic-container-id-from-last-step.ts"],"sourcesContent":["export type { AnthropicMessageMetadata } from './anthropic-message-metadata';\nexport type { AnthropicProviderOptions } from './anthropic-messages-options';\nexport type { AnthropicToolOptions } from './anthropic-prepare-tools';\nexport { anthropic, createAnthropic } from './anthropic-provider';\nexport type {\n AnthropicProvider,\n AnthropicProviderSettings,\n} from './anthropic-provider';\nexport { forwardAnthropicContainerIdFromLastStep } from './forward-anthropic-container-id-from-last-step';\nexport { VERSION } from './version';\n","import {\n LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\n} from '@ai-sdk/provider';\nimport {\n FetchFunction,\n generateId,\n loadApiKey,\n loadOptionalSetting,\n withoutTrailingSlash,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { VERSION } from './version';\nimport { AnthropicMessagesLanguageModel } from './anthropic-messages-language-model';\nimport { AnthropicMessagesModelId } from './anthropic-messages-options';\nimport { anthropicTools } from './anthropic-tools';\n\nexport interface AnthropicProvider extends ProviderV3 {\n /**\nCreates a model for text generation.\n*/\n (modelId: AnthropicMessagesModelId): LanguageModelV3;\n\n /**\nCreates a model for text generation.\n*/\n languageModel(modelId: AnthropicMessagesModelId): LanguageModelV3;\n\n chat(modelId: AnthropicMessagesModelId): LanguageModelV3;\n\n messages(modelId: AnthropicMessagesModelId): LanguageModelV3;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n\n /**\nAnthropic-specific computer use tool.\n */\n tools: typeof anthropicTools;\n}\n\nexport interface AnthropicProviderSettings {\n /**\nUse a different URL prefix for API calls, e.g. to use proxy servers.\nThe default prefix is `https://api.anthropic.com/v1`.\n */\n baseURL?: string;\n\n /**\nAPI key that is being send using the `x-api-key` header.\nIt defaults to the `ANTHROPIC_API_KEY` environment variable.\n */\n apiKey?: string;\n\n /**\nCustom headers to include in the requests.\n */\n headers?: Record<string, string>;\n\n /**\nCustom fetch implementation. You can use it as a middleware to intercept requests,\nor to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n\n generateId?: () => string;\n\n /**\n * Custom provider name\n * Defaults to 'anthropic.messages'.\n */\n name?: string;\n}\n\n/**\nCreate an Anthropic provider instance.\n */\nexport function createAnthropic(\n options: AnthropicProviderSettings = {},\n): AnthropicProvider {\n const baseURL =\n withoutTrailingSlash(\n loadOptionalSetting({\n settingValue: options.baseURL,\n environmentVariableName: 'ANTHROPIC_BASE_URL',\n }),\n ) ?? 'https://api.anthropic.com/v1';\n\n const providerName = options.name ?? 'anthropic.messages';\n\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n 'anthropic-version': '2023-06-01',\n 'x-api-key': loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'ANTHROPIC_API_KEY',\n description: 'Anthropic',\n }),\n ...options.headers,\n },\n `ai-sdk/anthropic/${VERSION}`,\n );\n\n const createChatModel = (modelId: AnthropicMessagesModelId) =>\n new AnthropicMessagesLanguageModel(modelId, {\n provider: providerName,\n baseURL,\n headers: getHeaders,\n fetch: options.fetch,\n generateId: options.generateId ?? generateId,\n supportedUrls: () => ({\n 'image/*': [/^https?:\\/\\/.*$/],\n }),\n });\n\n const provider = function (modelId: AnthropicMessagesModelId) {\n if (new.target) {\n throw new Error(\n 'The Anthropic model function cannot be called with the new keyword.',\n );\n }\n\n return createChatModel(modelId);\n };\n\n provider.specificationVersion = 'v3' as const;\n provider.languageModel = createChatModel;\n provider.chat = createChatModel;\n provider.messages = createChatModel;\n\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n provider.tools = anthropicTools;\n\n return provider;\n}\n\n/**\nDefault Anthropic provider instance.\n */\nexport const anthropic = createAnthropic();\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n","import {\n APICallError,\n JSONObject,\n LanguageModelV3,\n LanguageModelV3CallOptions,\n LanguageModelV3Content,\n LanguageModelV3FinishReason,\n LanguageModelV3FunctionTool,\n LanguageModelV3GenerateResult,\n LanguageModelV3Prompt,\n LanguageModelV3Source,\n LanguageModelV3StreamPart,\n LanguageModelV3StreamResult,\n LanguageModelV3ToolCall,\n SharedV3ProviderMetadata,\n SharedV3Warning,\n} from '@ai-sdk/provider';\nimport {\n combineHeaders,\n createEventSourceResponseHandler,\n createJsonResponseHandler,\n createToolNameMapping,\n FetchFunction,\n generateId,\n InferSchema,\n parseProviderOptions,\n ParseResult,\n postJsonToApi,\n Resolvable,\n resolve,\n} from '@ai-sdk/provider-utils';\nimport { anthropicFailedResponseHandler } from './anthropic-error';\nimport { AnthropicMessageMetadata } from './anthropic-message-metadata';\nimport {\n AnthropicContainer,\n anthropicMessagesChunkSchema,\n anthropicMessagesResponseSchema,\n AnthropicReasoningMetadata,\n AnthropicResponseContextManagement,\n Citation,\n} from './anthropic-messages-api';\nimport {\n AnthropicMessagesModelId,\n anthropicProviderOptions,\n} from './anthropic-messages-options';\nimport { prepareTools } from './anthropic-prepare-tools';\nimport {\n AnthropicMessagesUsage,\n convertAnthropicMessagesUsage,\n} from './convert-anthropic-messages-usage';\nimport { convertToAnthropicMessagesPrompt } from './convert-to-anthropic-messages-prompt';\nimport { CacheControlValidator } from './get-cache-control';\nimport { mapAnthropicStopReason } from './map-anthropic-stop-reason';\n\nfunction createCitationSource(\n citation: Citation,\n citationDocuments: Array<{\n title: string;\n filename?: string;\n mediaType: string;\n }>,\n generateId: () => string,\n): LanguageModelV3Source | undefined {\n if (citation.type !== 'page_location' && citation.type !== 'char_location') {\n return;\n }\n\n const documentInfo = citationDocuments[citation.document_index];\n\n if (!documentInfo) {\n return;\n }\n\n return {\n type: 'source' as const,\n sourceType: 'document' as const,\n id: generateId(),\n mediaType: documentInfo.mediaType,\n title: citation.document_title ?? documentInfo.title,\n filename: documentInfo.filename,\n providerMetadata: {\n anthropic:\n citation.type === 'page_location'\n ? {\n citedText: citation.cited_text,\n startPageNumber: citation.start_page_number,\n endPageNumber: citation.end_page_number,\n }\n : {\n citedText: citation.cited_text,\n startCharIndex: citation.start_char_index,\n endCharIndex: citation.end_char_index,\n },\n } satisfies SharedV3ProviderMetadata,\n };\n}\n\ntype AnthropicMessagesConfig = {\n provider: string;\n baseURL: string;\n headers: Resolvable<Record<string, string | undefined>>;\n fetch?: FetchFunction;\n buildRequestUrl?: (baseURL: string, isStreaming: boolean) => string;\n transformRequestBody?: (args: Record<string, any>) => Record<string, any>;\n supportedUrls?: () => LanguageModelV3['supportedUrls'];\n generateId?: () => string;\n\n /**\n * When false, the model will use JSON tool fallback for structured outputs.\n */\n supportsNativeStructuredOutput?: boolean;\n};\n\nexport class AnthropicMessagesLanguageModel implements LanguageModelV3 {\n readonly specificationVersion = 'v3';\n\n readonly modelId: AnthropicMessagesModelId;\n\n private readonly config: AnthropicMessagesConfig;\n private readonly generateId: () => string;\n\n constructor(\n modelId: AnthropicMessagesModelId,\n config: AnthropicMessagesConfig,\n ) {\n this.modelId = modelId;\n this.config = config;\n this.generateId = config.generateId ?? generateId;\n }\n\n supportsUrl(url: URL): boolean {\n return url.protocol === 'https:';\n }\n\n get provider(): string {\n return this.config.provider;\n }\n\n get supportedUrls() {\n return this.config.supportedUrls?.() ?? {};\n }\n\n private async getArgs({\n userSuppliedBetas,\n prompt,\n maxOutputTokens,\n temperature,\n topP,\n topK,\n frequencyPenalty,\n presencePenalty,\n stopSequences,\n responseFormat,\n seed,\n tools,\n toolChoice,\n providerOptions,\n stream,\n }: LanguageModelV3CallOptions & {\n stream: boolean;\n userSuppliedBetas: Set<string>;\n }) {\n const warnings: SharedV3Warning[] = [];\n\n if (frequencyPenalty != null) {\n warnings.push({ type: 'unsupported', feature: 'frequencyPenalty' });\n }\n\n if (presencePenalty != null) {\n warnings.push({ type: 'unsupported', feature: 'presencePenalty' });\n }\n\n if (seed != null) {\n warnings.push({ type: 'unsupported', feature: 'seed' });\n }\n\n if (temperature != null && temperature > 1) {\n warnings.push({\n type: 'unsupported',\n feature: 'temperature',\n details: `${temperature} exceeds anthropic maximum of 1.0. clamped to 1.0`,\n });\n temperature = 1;\n } else if (temperature != null && temperature < 0) {\n warnings.push({\n type: 'unsupported',\n feature: 'temperature',\n details: `${temperature} is below anthropic minimum of 0. clamped to 0`,\n });\n temperature = 0;\n }\n\n if (responseFormat?.type === 'json') {\n if (responseFormat.schema == null) {\n warnings.push({\n type: 'unsupported',\n feature: 'responseFormat',\n details:\n 'JSON response format requires a schema. ' +\n 'The response format is ignored.',\n });\n }\n }\n\n const anthropicOptions = await parseProviderOptions({\n provider: 'anthropic',\n providerOptions,\n schema: anthropicProviderOptions,\n });\n\n const {\n maxOutputTokens: maxOutputTokensForModel,\n supportsStructuredOutput: modelSupportsStructuredOutput,\n isKnownModel,\n } = getModelCapabilities(this.modelId);\n\n const supportsStructuredOutput =\n (this.config.supportsNativeStructuredOutput ?? true) &&\n modelSupportsStructuredOutput;\n\n const structureOutputMode =\n anthropicOptions?.structuredOutputMode ?? 'auto';\n const useStructuredOutput =\n structureOutputMode === 'outputFormat' ||\n (structureOutputMode === 'auto' && supportsStructuredOutput);\n\n const jsonResponseTool: LanguageModelV3FunctionTool | undefined =\n responseFormat?.type === 'json' &&\n responseFormat.schema != null &&\n !useStructuredOutput\n ? {\n type: 'function',\n name: 'json',\n description: 'Respond with a JSON object.',\n inputSchema: responseFormat.schema,\n }\n : undefined;\n\n const contextManagement = anthropicOptions?.contextManagement;\n\n // Create a shared cache control validator to track breakpoints across tools and messages\n const cacheControlValidator = new CacheControlValidator();\n\n const toolNameMapping = createToolNameMapping({\n tools,\n providerToolNames: {\n 'anthropic.code_execution_20250522': 'code_execution',\n 'anthropic.code_execution_20250825': 'code_execution',\n 'anthropic.computer_20241022': 'computer',\n 'anthropic.computer_20250124': 'computer',\n 'anthropic.text_editor_20241022': 'str_replace_editor',\n 'anthropic.text_editor_20250124': 'str_replace_editor',\n 'anthropic.text_editor_20250429': 'str_replace_based_edit_tool',\n 'anthropic.text_editor_20250728': 'str_replace_based_edit_tool',\n 'anthropic.bash_20241022': 'bash',\n 'anthropic.bash_20250124': 'bash',\n 'anthropic.memory_20250818': 'memory',\n 'anthropic.web_search_20250305': 'web_search',\n 'anthropic.web_fetch_20250910': 'web_fetch',\n 'anthropic.tool_search_regex_20251119': 'tool_search_tool_regex',\n 'anthropic.tool_search_bm25_20251119': 'tool_search_tool_bm25',\n },\n });\n\n const { prompt: messagesPrompt, betas } =\n await convertToAnthropicMessagesPrompt({\n prompt,\n sendReasoning: anthropicOptions?.sendReasoning ?? true,\n warnings,\n cacheControlValidator,\n toolNameMapping,\n });\n\n const isThinking = anthropicOptions?.thinking?.type === 'enabled';\n let thinkingBudget = anthropicOptions?.thinking?.budgetTokens;\n\n const maxTokens = maxOutputTokens ?? maxOutputTokensForModel;\n\n const baseArgs = {\n // model id:\n model: this.modelId,\n\n // standardized settings:\n max_tokens: maxTokens,\n temperature,\n top_k: topK,\n top_p: topP,\n stop_sequences: stopSequences,\n\n // provider specific settings:\n ...(isThinking && {\n thinking: { type: 'enabled', budget_tokens: thinkingBudget },\n }),\n ...(anthropicOptions?.effort && {\n output_config: { effort: anthropicOptions.effort },\n }),\n\n // structured output:\n ...(useStructuredOutput &&\n responseFormat?.type === 'json' &&\n responseFormat.schema != null && {\n output_format: {\n type: 'json_schema',\n schema: responseFormat.schema,\n },\n }),\n\n // mcp servers:\n ...(anthropicOptions?.mcpServers &&\n anthropicOptions.mcpServers.length > 0 && {\n mcp_servers: anthropicOptions.mcpServers.map(server => ({\n type: server.type,\n name: server.name,\n url: server.url,\n authorization_token: server.authorizationToken,\n tool_configuration: server.toolConfiguration\n ? {\n allowed_tools: server.toolConfiguration.allowedTools,\n enabled: server.toolConfiguration.enabled,\n }\n : undefined,\n })),\n }),\n\n // container: For programmatic tool calling (just an ID string) or agent skills (object with id and skills)\n ...(anthropicOptions?.container && {\n container:\n anthropicOptions.container.skills &&\n anthropicOptions.container.skills.length > 0\n ? // Object format when skills are provided (agent skills feature)\n ({\n id: anthropicOptions.container.id,\n skills: anthropicOptions.container.skills.map(skill => ({\n type: skill.type,\n skill_id: skill.skillId,\n version: skill.version,\n })),\n } satisfies AnthropicContainer)\n : // String format for container ID only (programmatic tool calling)\n anthropicOptions.container.id,\n }),\n\n // prompt:\n system: messagesPrompt.system,\n messages: messagesPrompt.messages,\n\n ...(contextManagement && {\n context_management: {\n edits: contextManagement.edits\n .map(edit => {\n const strategy = edit.type;\n switch (strategy) {\n case 'clear_tool_uses_20250919':\n return {\n type: edit.type,\n ...(edit.trigger !== undefined && {\n trigger: edit.trigger,\n }),\n ...(edit.keep !== undefined && { keep: edit.keep }),\n ...(edit.clearAtLeast !== undefined && {\n clear_at_least: edit.clearAtLeast,\n }),\n ...(edit.clearToolInputs !== undefined && {\n clear_tool_inputs: edit.clearToolInputs,\n }),\n ...(edit.excludeTools !== undefined && {\n exclude_tools: edit.excludeTools,\n }),\n };\n\n case 'clear_thinking_20251015':\n return {\n type: edit.type,\n ...(edit.keep !== undefined && { keep: edit.keep }),\n };\n\n default:\n warnings.push({\n type: 'other',\n message: `Unknown context management strategy: ${strategy}`,\n });\n return undefined;\n }\n })\n .filter(edit => edit !== undefined),\n },\n }),\n };\n\n if (isThinking) {\n if (thinkingBudget == null) {\n warnings.push({\n type: 'compatibility',\n feature: 'extended thinking',\n details:\n 'thinking budget is required when thinking is enabled. using default budget of 1024 tokens.',\n });\n\n baseArgs.thinking = {\n type: 'enabled',\n budget_tokens: 1024,\n };\n\n thinkingBudget = 1024;\n }\n\n if (baseArgs.temperature != null) {\n baseArgs.temperature = undefined;\n warnings.push({\n type: 'unsupported',\n feature: 'temperature',\n details: 'temperature is not supported when thinking is enabled',\n });\n }\n\n if (topK != null) {\n baseArgs.top_k = undefined;\n warnings.push({\n type: 'unsupported',\n feature: 'topK',\n details: 'topK is not supported when thinking is enabled',\n });\n }\n\n if (topP != null) {\n baseArgs.top_p = undefined;\n warnings.push({\n type: 'unsupported',\n feature: 'topP',\n details: 'topP is not supported when thinking is enabled',\n });\n }\n\n // adjust max tokens to account for thinking:\n baseArgs.max_tokens = maxTokens + (thinkingBudget ?? 0);\n }\n\n // limit to max output tokens for known models to enable model switching without breaking it:\n if (isKnownModel && baseArgs.max_tokens > maxOutputTokensForModel) {\n // only warn if max output tokens is provided as input:\n if (maxOutputTokens != null) {\n warnings.push({\n type: 'unsupported',\n feature: 'maxOutputTokens',\n details:\n `${baseArgs.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${maxOutputTokensForModel} max output tokens. ` +\n `The max output tokens have been limited to ${maxOutputTokensForModel}.`,\n });\n }\n baseArgs.max_tokens = maxOutputTokensForModel;\n }\n\n if (\n anthropicOptions?.mcpServers &&\n anthropicOptions.mcpServers.length > 0\n ) {\n betas.add('mcp-client-2025-04-04');\n }\n\n if (contextManagement) {\n betas.add('context-management-2025-06-27');\n }\n\n if (\n anthropicOptions?.container &&\n anthropicOptions.container.skills &&\n anthropicOptions.container.skills.length > 0\n ) {\n betas.add('code-execution-2025-08-25');\n betas.add('skills-2025-10-02');\n betas.add('files-api-2025-04-14');\n\n if (\n !tools?.some(\n tool =>\n tool.type === 'provider' &&\n tool.id === 'anthropic.code_execution_20250825',\n )\n ) {\n warnings.push({\n type: 'other',\n message: 'code execution tool is required when using skills',\n });\n }\n }\n\n if (anthropicOptions?.effort) {\n betas.add('effort-2025-11-24');\n }\n\n // only when streaming: enable fine-grained tool streaming\n if (stream && (anthropicOptions?.toolStreaming ?? true)) {\n betas.add('fine-grained-tool-streaming-2025-05-14');\n }\n\n // structured output:\n // Only pass beta when actually using native output_format\n const usingNativeOutputFormat =\n useStructuredOutput &&\n responseFormat?.type === 'json' &&\n responseFormat.schema != null;\n\n if (usingNativeOutputFormat) {\n betas.add('structured-outputs-2025-11-13');\n }\n\n const {\n tools: anthropicTools,\n toolChoice: anthropicToolChoice,\n toolWarnings,\n betas: toolsBetas,\n } = await prepareTools(\n jsonResponseTool != null\n ? {\n tools: [...(tools ?? []), jsonResponseTool],\n toolChoice: { type: 'required' },\n disableParallelToolUse: true,\n cacheControlValidator,\n supportsStructuredOutput,\n }\n : {\n tools: tools ?? [],\n toolChoice,\n disableParallelToolUse: anthropicOptions?.disableParallelToolUse,\n cacheControlValidator,\n supportsStructuredOutput,\n },\n );\n\n // Extract cache control warnings once at the end\n const cacheWarnings = cacheControlValidator.getWarnings();\n\n return {\n args: {\n ...baseArgs,\n tools: anthropicTools,\n tool_choice: anthropicToolChoice,\n stream: stream === true ? true : undefined, // do not send when not streaming\n },\n warnings: [...warnings, ...toolWarnings, ...cacheWarnings],\n betas: new Set([...betas, ...toolsBetas, ...userSuppliedBetas]),\n usesJsonResponseTool: jsonResponseTool != null,\n toolNameMapping,\n };\n }\n\n private async getHeaders({\n betas,\n headers,\n }: {\n betas: Set<string>;\n headers: Record<string, string | undefined> | undefined;\n }) {\n return combineHeaders(\n await resolve(this.config.headers),\n headers,\n betas.size > 0 ? { 'anthropic-beta': Array.from(betas).join(',') } : {},\n );\n }\n\n private async getBetasFromHeaders(\n requestHeaders: Record<string, string | undefined> | undefined,\n ) {\n const configHeaders = await resolve(this.config.headers);\n\n const configBetaHeader = configHeaders['anthropic-beta'] ?? '';\n const requestBetaHeader = requestHeaders?.['anthropic-beta'] ?? '';\n\n return new Set(\n [\n ...configBetaHeader.toLowerCase().split(','),\n ...requestBetaHeader.toLowerCase().split(','),\n ]\n .map(beta => beta.trim())\n .filter(beta => beta !== ''),\n );\n }\n\n private buildRequestUrl(isStreaming: boolean): string {\n return (\n this.config.buildRequestUrl?.(this.config.baseURL, isStreaming) ??\n `${this.config.baseURL}/messages`\n );\n }\n\n private transformRequestBody(args: Record<string, any>): Record<string, any> {\n return this.config.transformRequestBody?.(args) ?? args;\n }\n\n private extractCitationDocuments(prompt: LanguageModelV3Prompt): Array<{\n title: string;\n filename?: string;\n mediaType: string;\n }> {\n const isCitationPart = (part: {\n type: string;\n mediaType?: string;\n providerOptions?: { anthropic?: { citations?: { enabled?: boolean } } };\n }) => {\n if (part.type !== 'file') {\n return false;\n }\n\n if (\n part.mediaType !== 'application/pdf' &&\n part.mediaType !== 'text/plain'\n ) {\n return false;\n }\n\n const anthropic = part.providerOptions?.anthropic;\n const citationsConfig = anthropic?.citations as\n | { enabled?: boolean }\n | undefined;\n return citationsConfig?.enabled ?? false;\n };\n\n return prompt\n .filter(message => message.role === 'user')\n .flatMap(message => message.content)\n .filter(isCitationPart)\n .map(part => {\n // TypeScript knows this is a file part due to our filter\n const filePart = part as Extract<typeof part, { type: 'file' }>;\n return {\n title: filePart.filename ?? 'Untitled Document',\n filename: filePart.filename,\n mediaType: filePart.mediaType,\n };\n });\n }\n\n async doGenerate(\n options: LanguageModelV3CallOptions,\n ): Promise<LanguageModelV3GenerateResult> {\n const { args, warnings, betas, usesJsonResponseTool, toolNameMapping } =\n await this.getArgs({\n ...options,\n stream: false,\n userSuppliedBetas: await this.getBetasFromHeaders(options.headers),\n });\n\n // Extract citation documents for response processing\n const citationDocuments = this.extractCitationDocuments(options.prompt);\n\n const {\n responseHeaders,\n value: response,\n rawValue: rawResponse,\n } = await postJsonToApi({\n url: this.buildRequestUrl(false),\n headers: await this.getHeaders({ betas, headers: options.headers }),\n body: this.transformRequestBody(args),\n failedResponseHandler: anthropicFailedResponseHandler,\n successfulResponseHandler: createJsonResponseHandler(\n anthropicMessagesResponseSchema,\n ),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch,\n });\n\n const content: Array<LanguageModelV3Content> = [];\n const mcpToolCalls: Record<string, LanguageModelV3ToolCall> = {};\n let isJsonResponseFromTool = false;\n\n // map response content to content array\n for (const part of response.content) {\n switch (part.type) {\n case 'text': {\n if (!usesJsonResponseTool) {\n content.push({ type: 'text', text: part.text });\n\n // Process citations if present\n if (part.citations) {\n for (const citation of part.citations) {\n const source = createCitationSource(\n citation,\n citationDocuments,\n this.generateId,\n );\n\n if (source) {\n content.push(source);\n }\n }\n }\n }\n break;\n }\n case 'thinking': {\n content.push({\n type: 'reasoning',\n text: part.thinking,\n providerMetadata: {\n anthropic: {\n signature: part.signature,\n } satisfies AnthropicReasoningMetadata,\n },\n });\n break;\n }\n case 'redacted_thinking': {\n content.push({\n type: 'reasoning',\n text: '',\n providerMetadata: {\n anthropic: {\n redactedData: part.data,\n } satisfies AnthropicReasoningMetadata,\n },\n });\n break;\n }\n case 'tool_use': {\n const isJsonResponseTool =\n usesJsonResponseTool && part.name === 'json';\n\n if (isJsonResponseTool) {\n isJsonResponseFromTool = true;\n\n // when a json response tool is used, the tool call becomes the text:\n content.push({\n type: 'text',\n text: JSON.stringify(part.input),\n });\n } else {\n const caller = part.caller;\n const callerInfo = caller\n ? {\n type: caller.type,\n toolId: 'tool_id' in caller ? caller.tool_id : undefined,\n }\n : undefined;\n\n content.push({\n type: 'tool-call',\n toolCallId: part.id,\n toolName: part.name,\n input: JSON.stringify(part.input),\n ...(callerInfo && {\n providerMetadata: {\n anthropic: {\n caller: callerInfo,\n },\n },\n }),\n });\n }\n\n break;\n }\n case 'server_tool_use': {\n // code execution 20250825 needs mapping:\n if (\n part.name === 'text_editor_code_execution' ||\n part.name === 'bash_code_execution'\n ) {\n content.push({\n type: 'tool-call',\n toolCallId: part.id,\n toolName: toolNameMapping.toCustomToolName('code_execution'),\n input: JSON.stringify({ type: part.name, ...part.input }),\n providerExecuted: true,\n });\n } else if (\n part.name === 'web_search' ||\n part.name === 'code_execution' ||\n part.name === 'web_fetch'\n ) {\n // For code_execution, inject 'programmatic-tool-call' type when input has { code } format\n const inputToSerialize =\n part.name === 'code_execution' &&\n part.input != null &&\n typeof part.input === 'object' &&\n 'code' in part.input &&\n !('type' in part.input)\n ? { type: 'programmatic-tool-call', ...part.input }\n : part.input;\n\n content.push({\n type: 'tool-call',\n toolCallId: part.id,\n toolName: toolNameMapping.toCustomToolName(part.name),\n input: JSON.stringify(inputToSerialize),\n providerExecuted: true,\n });\n } else if (\n part.name === 'tool_search_tool_regex' ||\n part.name === 'tool_search_tool_bm25'\n ) {\n content.push({\n type: 'tool-call',\n toolCallId: part.id,\n toolName: toolNameMapping.toCustomToolName(part.name),\n input: JSON.stringify(part.input),\n providerExecuted: true,\n });\n }\n\n break;\n }\n case 'mcp_tool_use': {\n mcpToolCalls[part.id] = {\n type: 'tool-call',\n toolCallId: part.id,\n toolName: part.name,\n input: JSON.stringify(part.input),\n providerExecuted: true,\n dynamic: true,\n providerMetadata: {\n anthropic: {\n type: 'mcp-tool-use',\n serverName: part.server_name,\n },\n },\n };\n content.push(mcpToolCalls[part.id]);\n break;\n }\n case 'mcp_tool_result': {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: mcpToolCalls[part.tool_use_id].toolName,\n isError: part.is_error,\n result: part.content,\n dynamic: true,\n providerMetadata: mcpToolCalls[part.tool_use_id].providerMetadata,\n });\n break;\n }\n case 'web_fetch_tool_result': {\n if (part.content.type === 'web_fetch_result') {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_fetch'),\n result: {\n type: 'web_fetch_result',\n url: part.content.url,\n retrievedAt: part.content.retrieved_at,\n content: {\n type: part.content.content.type,\n title: part.content.content.title,\n citations: part.content.content.citations,\n source: {\n type: part.content.content.source.type,\n mediaType: part.content.content.source.media_type,\n data: part.content.content.source.data,\n },\n },\n },\n });\n } else if (part.content.type === 'web_fetch_tool_result_error') {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_fetch'),\n isError: true,\n result: {\n type: 'web_fetch_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n break;\n }\n case 'web_search_tool_result': {\n if (Array.isArray(part.content)) {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_search'),\n result: part.content.map(result => ({\n url: result.url,\n title: result.title,\n pageAge: result.page_age ?? null,\n encryptedContent: result.encrypted_content,\n type: result.type,\n })),\n });\n\n for (const result of part.content) {\n content.push({\n type: 'source',\n sourceType: 'url',\n id: this.generateId(),\n url: result.url,\n title: result.title,\n providerMetadata: {\n anthropic: {\n pageAge: result.page_age ?? null,\n },\n },\n });\n }\n } else {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_search'),\n isError: true,\n result: {\n type: 'web_search_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n break;\n }\n\n // code execution 20250522:\n case 'code_execution_tool_result': {\n if (part.content.type === 'code_execution_result') {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('code_execution'),\n result: {\n type: part.content.type,\n stdout: part.content.stdout,\n stderr: part.content.stderr,\n return_code: part.content.return_code,\n content: part.content.content ?? [],\n },\n });\n } else if (part.content.type === 'code_execution_tool_result_error') {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('code_execution'),\n isError: true,\n result: {\n type: 'code_execution_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n break;\n }\n\n // code execution 20250825:\n case 'bash_code_execution_tool_result':\n case 'text_editor_code_execution_tool_result': {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('code_execution'),\n result: part.content,\n });\n break;\n }\n\n // tool search tool results:\n case 'tool_search_tool_result': {\n if (part.content.type === 'tool_search_tool_search_result') {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('tool_search'),\n result: part.content.tool_references.map(ref => ({\n type: ref.type,\n toolName: ref.tool_name,\n })),\n });\n } else {\n content.push({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('tool_search'),\n isError: true,\n result: {\n type: 'tool_search_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n break;\n }\n }\n }\n\n return {\n content,\n finishReason: {\n unified: mapAnthropicStopReason({\n finishReason: response.stop_reason,\n isJsonResponseFromTool,\n }),\n raw: response.stop_reason ?? undefined,\n },\n usage: convertAnthropicMessagesUsage(response.usage),\n request: { body: args },\n response: {\n id: response.id ?? undefined,\n modelId: response.model ?? undefined,\n headers: responseHeaders,\n body: rawResponse,\n },\n warnings,\n providerMetadata: {\n anthropic: {\n usage: response.usage as JSONObject,\n cacheCreationInputTokens:\n response.usage.cache_creation_input_tokens ?? null,\n stopSequence: response.stop_sequence ?? null,\n container: response.container\n ? {\n expiresAt: response.container.expires_at,\n id: response.container.id,\n skills:\n response.container.skills?.map(skill => ({\n type: skill.type,\n skillId: skill.skill_id,\n version: skill.version,\n })) ?? null,\n }\n : null,\n contextManagement:\n mapAnthropicResponseContextManagement(\n response.context_management,\n ) ?? null,\n } satisfies AnthropicMessageMetadata,\n },\n };\n }\n\n async doStream(\n options: LanguageModelV3CallOptions,\n ): Promise<LanguageModelV3StreamResult> {\n const {\n args: body,\n warnings,\n betas,\n usesJsonResponseTool,\n toolNameMapping,\n } = await this.getArgs({\n ...options,\n stream: true,\n userSuppliedBetas: await this.getBetasFromHeaders(options.headers),\n });\n\n // Extract citation documents for response processing\n const citationDocuments = this.extractCitationDocuments(options.prompt);\n\n const url = this.buildRequestUrl(true);\n const { responseHeaders, value: response } = await postJsonToApi({\n url,\n headers: await this.getHeaders({ betas, headers: options.headers }),\n body: this.transformRequestBody(body),\n failedResponseHandler: anthropicFailedResponseHandler,\n successfulResponseHandler: createEventSourceResponseHandler(\n anthropicMessagesChunkSchema,\n ),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch,\n });\n\n let finishReason: LanguageModelV3FinishReason = {\n unified: 'other',\n raw: undefined,\n };\n const usage: AnthropicMessagesUsage = {\n input_tokens: 0,\n output_tokens: 0,\n cache_creation_input_tokens: 0,\n cache_read_input_tokens: 0,\n };\n\n const contentBlocks: Record<\n number,\n | {\n type: 'tool-call';\n toolCallId: string;\n toolName: string;\n input: string;\n providerExecuted?: boolean;\n firstDelta: boolean;\n providerToolName?: string;\n caller?: {\n type: 'code_execution_20250825' | 'direct';\n toolId?: string;\n };\n }\n | { type: 'text' | 'reasoning' }\n > = {};\n const mcpToolCalls: Record<string, LanguageModelV3ToolCall> = {};\n\n let contextManagement:\n | AnthropicMessageMetadata['contextManagement']\n | null = null;\n let rawUsage: JSONObject | undefined = undefined;\n let cacheCreationInputTokens: number | null = null;\n let stopSequence: string | null = null;\n let container: AnthropicMessageMetadata['container'] | null = null;\n let isJsonResponseFromTool = false;\n\n let blockType:\n | 'text'\n | 'thinking'\n | 'tool_use'\n | 'redacted_thinking'\n | 'server_tool_use'\n | 'web_fetch_tool_result'\n | 'web_search_tool_result'\n | 'code_execution_tool_result'\n | 'text_editor_code_execution_tool_result'\n | 'bash_code_execution_tool_result'\n | 'tool_search_tool_result'\n | 'mcp_tool_use'\n | 'mcp_tool_result'\n | undefined = undefined;\n\n const generateId = this.generateId;\n\n const transformedStream = response.pipeThrough(\n new TransformStream<\n ParseResult<InferSchema<typeof anthropicMessagesChunkSchema>>,\n LanguageModelV3StreamPart\n >({\n start(controller) {\n controller.enqueue({ type: 'stream-start', warnings });\n },\n\n transform(chunk, controller) {\n if (options.includeRawChunks) {\n controller.enqueue({ type: 'raw', rawValue: chunk.rawValue });\n }\n\n if (!chunk.success) {\n controller.enqueue({ type: 'error', error: chunk.error });\n return;\n }\n\n const value = chunk.value;\n\n switch (value.type) {\n case 'ping': {\n return; // ignored\n }\n\n case 'content_block_start': {\n const part = value.content_block;\n const contentBlockType = part.type;\n blockType = contentBlockType;\n\n switch (contentBlockType) {\n case 'text': {\n // when a json response tool is used, the tool call is returned as text,\n // so we ignore the text content:\n if (usesJsonResponseTool) {\n return;\n }\n\n contentBlocks[value.index] = { type: 'text' };\n controller.enqueue({\n type: 'text-start',\n id: String(value.index),\n });\n return;\n }\n\n case 'thinking': {\n contentBlocks[value.index] = { type: 'reasoning' };\n controller.enqueue({\n type: 'reasoning-start',\n id: String(value.index),\n });\n return;\n }\n\n case 'redacted_thinking': {\n contentBlocks[value.index] = { type: 'reasoning' };\n controller.enqueue({\n type: 'reasoning-start',\n id: String(value.index),\n providerMetadata: {\n anthropic: {\n redactedData: part.data,\n } satisfies AnthropicReasoningMetadata,\n },\n });\n return;\n }\n\n case 'tool_use': {\n const isJsonResponseTool =\n usesJsonResponseTool && part.name === 'json';\n\n if (isJsonResponseTool) {\n isJsonResponseFromTool = true;\n\n contentBlocks[value.index] = { type: 'text' };\n\n controller.enqueue({\n type: 'text-start',\n id: String(value.index),\n });\n } else {\n // Extract caller info for type-safe access\n const caller = part.caller;\n const callerInfo = caller\n ? {\n type: caller.type,\n toolId:\n 'tool_id' in caller ? caller.tool_id : undefined,\n }\n : undefined;\n\n // Programmatic tool calling: for deferred tool calls from code_execution,\n // input may be present directly in content_block_start.\n // Only use if non-empty (empty {} means input comes via deltas)\n const hasNonEmptyInput =\n part.input && Object.keys(part.input).length > 0;\n const initialInput = hasNonEmptyInput\n ? JSON.stringify(part.input)\n : '';\n\n contentBlocks[value.index] = {\n type: 'tool-call',\n toolCallId: part.id,\n toolName: part.name,\n input: initialInput,\n firstDelta: initialInput.length === 0,\n ...(callerInfo && { caller: callerInfo }),\n };\n\n controller.enqueue({\n type: 'tool-input-start',\n id: part.id,\n toolName: part.name,\n });\n }\n return;\n }\n\n case 'server_tool_use': {\n if (\n [\n 'web_fetch',\n 'web_search',\n // code execution 20250825:\n 'code_execution',\n // code execution 20250825 text editor:\n 'text_editor_code_execution',\n // code execution 20250825 bash:\n 'bash_code_execution',\n ].includes(part.name)\n ) {\n // map tool names for the code execution 20250825 tool:\n const providerToolName =\n part.name === 'text_editor_code_execution' ||\n part.name === 'bash_code_execution'\n ? 'code_execution'\n : part.name;\n\n const customToolName =\n toolNameMapping.toCustomToolName(providerToolName);\n\n contentBlocks[value.index] = {\n type: 'tool-call',\n toolCallId: part.id,\n toolName: customToolName,\n input: '',\n providerExecuted: true,\n firstDelta: true,\n providerToolName: part.name,\n };\n\n controller.enqueue({\n type: 'tool-input-start',\n id: part.id,\n toolName: customToolName,\n providerExecuted: true,\n });\n } else if (\n part.name === 'tool_search_tool_regex' ||\n part.name === 'tool_search_tool_bm25'\n ) {\n const customToolName = toolNameMapping.toCustomToolName(\n part.name,\n );\n\n contentBlocks[value.index] = {\n type: 'tool-call',\n toolCallId: part.id,\n toolName: customToolName,\n input: '',\n providerExecuted: true,\n firstDelta: true,\n providerToolName: part.name,\n };\n\n controller.enqueue({\n type: 'tool-input-start',\n id: part.id,\n toolName: customToolName,\n providerExecuted: true,\n });\n }\n\n return;\n }\n\n case 'web_fetch_tool_result': {\n if (part.content.type === 'web_fetch_result') {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_fetch'),\n result: {\n type: 'web_fetch_result',\n url: part.content.url,\n retrievedAt: part.content.retrieved_at,\n content: {\n type: part.content.content.type,\n title: part.content.content.title,\n citations: part.content.content.citations,\n source: {\n type: part.content.content.source.type,\n mediaType: part.content.content.source.media_type,\n data: part.content.content.source.data,\n },\n },\n },\n });\n } else if (\n part.content.type === 'web_fetch_tool_result_error'\n ) {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_fetch'),\n isError: true,\n result: {\n type: 'web_fetch_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n\n return;\n }\n\n case 'web_search_tool_result': {\n if (Array.isArray(part.content)) {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_search'),\n result: part.content.map(result => ({\n url: result.url,\n title: result.title,\n pageAge: result.page_age ?? null,\n encryptedContent: result.encrypted_content,\n type: result.type,\n })),\n });\n\n for (const result of part.content) {\n controller.enqueue({\n type: 'source',\n sourceType: 'url',\n id: generateId(),\n url: result.url,\n title: result.title,\n providerMetadata: {\n anthropic: {\n pageAge: result.page_age ?? null,\n },\n },\n });\n }\n } else {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('web_search'),\n isError: true,\n result: {\n type: 'web_search_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n return;\n }\n\n // code execution 20250522:\n case 'code_execution_tool_result': {\n if (part.content.type === 'code_execution_result') {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName:\n toolNameMapping.toCustomToolName('code_execution'),\n result: {\n type: part.content.type,\n stdout: part.content.stdout,\n stderr: part.content.stderr,\n return_code: part.content.return_code,\n content: part.content.content ?? [],\n },\n });\n } else if (\n part.content.type === 'code_execution_tool_result_error'\n ) {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName:\n toolNameMapping.toCustomToolName('code_execution'),\n isError: true,\n result: {\n type: 'code_execution_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n\n return;\n }\n\n // code execution 20250825:\n case 'bash_code_execution_tool_result':\n case 'text_editor_code_execution_tool_result': {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName:\n toolNameMapping.toCustomToolName('code_execution'),\n result: part.content,\n });\n return;\n }\n\n // tool search tool results:\n case 'tool_search_tool_result': {\n if (part.content.type === 'tool_search_tool_search_result') {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('tool_search'),\n result: part.content.tool_references.map(ref => ({\n type: ref.type,\n toolName: ref.tool_name,\n })),\n });\n } else {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: toolNameMapping.toCustomToolName('tool_search'),\n isError: true,\n result: {\n type: 'tool_search_tool_result_error',\n errorCode: part.content.error_code,\n },\n });\n }\n return;\n }\n\n case 'mcp_tool_use': {\n mcpToolCalls[part.id] = {\n type: 'tool-call',\n toolCallId: part.id,\n toolName: part.name,\n input: JSON.stringify(part.input),\n providerExecuted: true,\n dynamic: true,\n providerMetadata: {\n anthropic: {\n type: 'mcp-tool-use',\n serverName: part.server_name,\n },\n },\n };\n controller.enqueue(mcpToolCalls[part.id]);\n return;\n }\n\n case 'mcp_tool_result': {\n controller.enqueue({\n type: 'tool-result',\n toolCallId: part.tool_use_id,\n toolName: mcpToolCalls[part.tool_use_id].toolName,\n isError: part.is_error,\n result: part.content,\n dynamic: true,\n providerMetadata:\n mcpToolCalls[part.tool_use_id].providerMetadata,\n });\n return;\n }\n\n default: {\n const _exhaustiveCheck: never = contentBlockType;\n throw new Error(\n `Unsupported content block type: ${_exhaustiveCheck}`,\n );\n }\n }\n }\n\n case 'content_block_stop': {\n // when finishing a tool call block, send the full tool call:\n if (contentBlocks[value.index] != null) {\n const contentBlock = contentBlocks[value.index];\n\n switch (contentBlock.type) {\n case 'text': {\n controller.enqueue({\n type: 'text-end',\n id: String(value.index),\n });\n break;\n }\n\n case 'reasoning': {\n controller.enqueue({\n type: 'reasoning-end',\n id: String(value.index),\n });\n break;\n }\n\n case 'tool-call':\n // when a json response tool is used, the tool call is returned as text,\n // so we ignore the tool call content:\n const isJsonResponseTool =\n usesJsonResponseTool && contentBlock.toolName === 'json';\n\n if (!isJsonResponseTool) {\n controller.enqueue({\n type: 'tool-input-end',\n id: contentBlock.toolCallId,\n });\n\n // For code_execution, inject 'programmatic-tool-call' type\n // when input has { code } format (programmatic tool calling)\n let finalInput =\n contentBlock.input === '' ? '{}' : contentBlock.input;\n if (contentBlock.providerToolName === 'code_execution') {\n try {\n const parsed = JSON.parse(finalInput);\n if (\n parsed != null &&\n typeof parsed === 'object' &&\n 'code' in parsed &&\n !('type' in parsed)\n ) {\n finalInput = JSON.stringify({\n type: 'programmatic-tool-call',\n ...parsed,\n });\n }\n } catch {\n // ignore parse errors, use original input\n }\n }\n\n controller.enqueue({\n type: 'tool-call',\n toolCallId: contentBlock.toolCallId,\n toolName: contentBlock.toolName,\n input: finalInput,\n providerExecuted: contentBlock.providerExecuted,\n ...(contentBlock.caller && {\n providerMetadata: {\n anthropic: {\n caller: contentBlock.caller,\n },\n },\n }),\n });\n }\n break;\n }\n\n delete contentBlocks[value.index];\n }\n\n blockType = undefined; // reset block type\n\n return;\n }\n\n case 'content_block_delta': {\n const deltaType = value.delta.type;\n\n switch (deltaType) {\n case 'text_delta': {\n // when a json response tool is used, the tool call is returned as text,\n // so we ignore the text content:\n if (usesJsonResponseTool) {\n return; // excluding the text-start will also exclude the text-end\n }\n\n controller.enqueue({\n type: 'text-delta',\n id: String(value.index),\n delta: value.delta.text,\n });\n\n return;\n }\n\n case 'thinking_delta': {\n controller.enqueue({\n type: 'reasoning-delta',\n id: String(value.index),\n delta: value.delta.thinking,\n });\n\n return;\n }\n\n case 'signature_delta': {\n // signature are only supported on thinking blocks:\n if (blockType === 'thinking') {\n controller.enqueue({\n type: 'reasoning-delta',\n id: String(value.index),\n delta: '',\n providerMetadata: {\n anthropic: {\n signature: value.delta.signature,\n } satisfies AnthropicReasoningMetadata,\n },\n });\n }\n\n return;\n }\n\n case 'input_json_delta': {\n const contentBlock = contentBlocks[value.index];\n let delta = value.delta.partial_json;\n\n // skip empty deltas to enable replacing the first character\n // in the code execution 20250825 tool.\n if (delta.length === 0) {\n return;\n }\n\n if (isJsonResponseFromTool) {\n if (contentBlock?.type !== 'text') {\n return; // exclude reasoning\n }\n\n controller.enqueue({\n type: 'text-delta',\n id: String(value.index),\n delta,\n });\n } else {\n if (contentBlock?.type !== 'tool-call') {\n return;\n }\n\n // for the code execution 20250825, we need to add\n // the type to the delta and change the tool name.\n if (\n contentBlock.firstDelta &&\n (contentBlock.providerToolName ===\n 'bash_code_execution' ||\n contentBlock.providerToolName ===\n 'text_editor_code_execution')\n ) {\n delta = `{\"type\": \"${contentBlock.providerToolName}\",${delta.substring(1)}`;\n }\n\n controller.enqueue({\n type: 'tool-input-delta',\n id: contentBlock.toolCallId,\n delta,\n });\n\n contentBlock.input += delta;\n contentBlock.firstDelta = false;\n }\n\n return;\n }\n\n case 'citations_delta': {\n const citation = value.delta.citation;\n const source = createCitationSource(\n citation,\n citationDocuments,\n generateId,\n );\n\n if (source) {\n controller.enqueue(source);\n }\n\n return;\n }\n\n default: {\n const _exhaustiveCheck: never = deltaType;\n throw new Error(\n `Unsupported delta type: ${_exhaustiveCheck}`,\n );\n }\n }\n }\n\n case 'message_start': {\n usage.input_tokens = value.message.usage.input_tokens;\n usage.cache_read_input_tokens =\n value.message.usage.cache_read_input_tokens ?? 0;\n usage.cache_creation_input_tokens =\n value.message.usage.cache_creation_input_tokens ?? 0;\n\n rawUsage = {\n ...(value.message.usage as JSONObject),\n };\n\n cacheCreationInputTokens =\n value.message.usage.cache_creation_input_tokens ?? null;\n\n if (value.message.container != null) {\n container = {\n expiresAt: value.message.container.expires_at,\n id: value.message.container.id,\n skills: null,\n };\n }\n\n if (value.message.stop_reason != null) {\n finishReason = {\n unified: mapAnthropicStopReason({\n finishReason: value.message.stop_reason,\n isJsonResponseFromTool,\n }),\n raw: value.message.stop_reason,\n };\n }\n\n controller.enqueue({\n type: 'response-metadata',\n id: value.message.id ?? undefined,\n modelId: value.message.model ?? undefined,\n });\n\n // Programmatic tool calling: process pre-populated content blocks\n // (for deferred tool calls, content may be in message_start)\n if (value.message.content != null) {\n for (\n let contentIndex = 0;\n contentIndex < value.message.content.length;\n contentIndex++\n ) {\n const part = value.message.content[contentIndex];\n if (part.type === 'tool_use') {\n const caller = part.caller;\n const callerInfo = caller\n ? {\n type: caller.type,\n toolId:\n 'tool_id' in caller ? caller.tool_id : undefined,\n }\n : undefined;\n\n controller.enqueue({\n type: 'tool-input-start',\n id: part.id,\n toolName: part.name,\n });\n\n const inputStr = JSON.stringify(part.input ?? {});\n controller.enqueue({\n type: 'tool-input-delta',\n id: part.id,\n delta: inputStr,\n });\n\n controller.enqueue({\n type: 'tool-input-end',\n id: part.id,\n });\n\n controller.enqueue({\n type: 'tool-call',\n toolCallId: part.id,\n toolName: part.name,\n input: inputStr,\n ...(callerInfo && {\n providerMetadata: {\n anthropic: {\n caller: callerInfo,\n },\n },\n }),\n });\n }\n }\n }\n\n return;\n }\n\n case 'message_delta': {\n usage.output_tokens = value.usage.output_tokens;\n\n finishReason = {\n unified: mapAnthropicStopReason({\n finishReason: value.delta.stop_reason,\n isJsonResponseFromTool,\n }),\n raw: value.delta.stop_reason ?? undefined,\n };\n\n stopSequence = value.delta.stop_sequence ?? null;\n container =\n value.delta.container != null\n ? {\n expiresAt: value.delta.container.expires_at,\n id: value.delta.container.id,\n skills:\n value.delta.container.skills?.map(skill => ({\n type: skill.type,\n skillId: skill.skill_id,\n version: skill.version,\n })) ?? null,\n }\n : null;\n\n if (value.delta.context_management) {\n contextManagement = mapAnthropicResponseContextManagement(\n value.delta.context_management,\n );\n }\n\n rawUsage = {\n ...rawUsage,\n ...(value.usage as JSONObject),\n };\n\n return;\n }\n\n case 'message_stop': {\n controller.enqueue({\n type: 'finish',\n finishReason,\n usage: convertAnthropicMessagesUsage(usage),\n providerMetadata: {\n anthropic: {\n usage: (rawUsage as JSONObject) ?? null,\n cacheCreationInputTokens,\n stopSequence,\n container,\n contextManagement,\n } satisfies AnthropicMessageMetadata,\n },\n });\n return;\n }\n\n case 'error': {\n controller.enqueue({ type: 'error', error: value.error });\n return;\n }\n\n default: {\n const _exhaustiveCheck: never = value;\n throw new Error(`Unsupported chunk type: ${_exhaustiveCheck}`);\n }\n }\n },\n }),\n );\n\n // The first chunk needs to be pulled immediately to check if it is an error\n const [streamForFirstChunk, streamForConsumer] = transformedStream.tee();\n\n const firstChunkReader = streamForFirstChunk.getReader();\n try {\n await firstChunkReader.read(); // streamStart comes first, ignored\n\n let result = await firstChunkReader.read();\n\n // when raw chunks are enabled, the first chunk is a raw chunk, so we need to read the next chunk\n if (result.value?.type === 'raw') {\n result = await firstChunkReader.read();\n }\n\n // The Anthropic API returns 200 responses when there are overloaded errors.\n // We handle the case where the first chunk is an error here and transform\n // it into an APICallError.\n if (result.value?.type === 'error') {\n const error = result.value.error as { message: string; type: string };\n\n throw new APICallError({\n message: error.message,\n url,\n requestBodyValues: body,\n statusCode: error.type === 'overloaded_error' ? 529 : 500,\n responseHeaders,\n responseBody: JSON.stringify(error),\n isRetryable: error.type === 'overloaded_error',\n });\n }\n } finally {\n firstChunkReader.cancel().catch(() => {});\n firstChunkReader.releaseLock();\n }\n\n return {\n stream: streamForConsumer,\n request: { body },\n response: { headers: responseHeaders },\n };\n }\n}\n\n/**\n * Returns the capabilities of a Claude model that are used for defaults and feature selection.\n *\n * @see https://docs.claude.com/en/docs/about-claude/models/overview#model-comparison-table\n * @see https://platform.claude.com/docs/en/build-with-claude/structured-outputs\n */\nfunction getModelCapabilities(modelId: string): {\n maxOutputTokens: number;\n supportsStructuredOutput: boolean;\n isKnownModel: boolean;\n} {\n if (\n modelId.includes('claude-sonnet-4-5') ||\n modelId.includes('claude-opus-4-5')\n ) {\n return {\n maxOutputTokens: 64000,\n supportsStructuredOutput: true,\n isKnownModel: true,\n };\n } else if (modelId.includes('claude-opus-4-1')) {\n return {\n maxOutputTokens: 32000,\n supportsStructuredOutput: true,\n isKnownModel: true,\n };\n } else if (\n modelId.includes('claude-sonnet-4-') ||\n modelId.includes('claude-3-7-sonnet') ||\n modelId.includes('claude-haiku-4-5')\n ) {\n return {\n maxOutputTokens: 64000,\n supportsStructuredOutput: false,\n isKnownModel: true,\n };\n } else if (modelId.includes('claude-opus-4-')) {\n return {\n maxOutputTokens: 32000,\n supportsStructuredOutput: false,\n isKnownModel: true,\n };\n } else if (modelId.includes('claude-3-5-haiku')) {\n return {\n maxOutputTokens: 8192,\n supportsStructuredOutput: false,\n isKnownModel: true,\n };\n } else if (modelId.includes('claude-3-haiku')) {\n return {\n maxOutputTokens: 4096,\n supportsStructuredOutput: false,\n isKnownModel: true,\n };\n } else {\n return {\n maxOutputTokens: 4096,\n supportsStructuredOutput: false,\n isKnownModel: false,\n };\n }\n}\n\nfunction mapAnthropicResponseContextManagement(\n contextManagement: AnthropicResponseContextManagement | null | undefined,\n): AnthropicMessageMetadata['contextManagement'] | null {\n return contextManagement\n ? {\n appliedEdits: contextManagement.applied_edits\n .map(edit => {\n const strategy = edit.type;\n\n switch (strategy) {\n case 'clear_tool_uses_20250919':\n return {\n type: edit.type,\n clearedToolUses: edit.cleared_tool_uses,\n clearedInputTokens: edit.cleared_input_tokens,\n };\n\n case 'clear_thinking_20251015':\n return {\n type: edit.type,\n clearedThinkingTurns: edit.cleared_thinking_turns,\n clearedInputTokens: edit.cleared_input_tokens,\n };\n }\n })\n .filter(edit => edit !== undefined),\n }\n : null;\n}\n","import {\n createJsonErrorResponseHandler,\n InferSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const anthropicErrorDataSchema = lazySchema(() =>\n zodSchema(\n z.object({\n type: z.literal('error'),\n error: z.object({\n type: z.string(),\n message: z.string(),\n }),\n }),\n ),\n);\n\nexport type AnthropicErrorData = InferSchema<typeof anthropicErrorDataSchema>;\n\nexport const anthropicFailedResponseHandler = createJsonErrorResponseHandler({\n errorSchema: anthropicErrorDataSchema,\n errorToMessage: data => data.error.message,\n});\n","import { JSONSchema7 } from '@ai-sdk/provider';\nimport { InferSchema, lazySchema, zodSchema } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport type AnthropicMessagesPrompt = {\n system: Array<AnthropicTextContent> | undefined;\n messages: AnthropicMessage[];\n};\n\nexport type AnthropicMessage = AnthropicUserMessage | AnthropicAssistantMessage;\n\nexport type AnthropicCacheControl = {\n type: 'ephemeral';\n ttl?: '5m' | '1h';\n};\n\nexport interface AnthropicUserMessage {\n role: 'user';\n content: Array<\n | AnthropicTextContent\n | AnthropicImageContent\n | AnthropicDocumentContent\n | AnthropicToolResultContent\n >;\n}\n\nexport interface AnthropicAssistantMessage {\n role: 'assistant';\n content: Array<\n | AnthropicTextContent\n | AnthropicThinkingContent\n | AnthropicRedactedThinkingContent\n | AnthropicToolCallContent\n | AnthropicServerToolUseContent\n | AnthropicCodeExecutionToolResultContent\n | AnthropicWebFetchToolResultContent\n | AnthropicWebSearchToolResultContent\n | AnthropicToolSearchToolResultContent\n | AnthropicBashCodeExecutionToolResultContent\n | AnthropicTextEditorCodeExecutionToolResultContent\n | AnthropicMcpToolUseContent\n | AnthropicMcpToolResultContent\n >;\n}\n\nexport interface AnthropicTextContent {\n type: 'text';\n text: string;\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicThinkingContent {\n type: 'thinking';\n thinking: string;\n signature: string;\n // Note: thinking blocks cannot be directly cached with cache_control.\n // They are cached implicitly when appearing in previous assistant turns.\n cache_control?: never;\n}\n\nexport interface AnthropicRedactedThinkingContent {\n type: 'redacted_thinking';\n data: string;\n // Note: redacted thinking blocks cannot be directly cached with cache_control.\n // They are cached implicitly when appearing in previous assistant turns.\n cache_control?: never;\n}\n\ntype AnthropicContentSource =\n | {\n type: 'base64';\n media_type: string;\n data: string;\n }\n | {\n type: 'url';\n url: string;\n }\n | {\n type: 'text';\n media_type: 'text/plain';\n data: string;\n };\n\nexport interface AnthropicImageContent {\n type: 'image';\n source: AnthropicContentSource;\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicDocumentContent {\n type: 'document';\n source: AnthropicContentSource;\n title?: string;\n context?: string;\n citations?: { enabled: boolean };\n cache_control: AnthropicCacheControl | undefined;\n}\n\n/**\n * The caller information for programmatic tool calling.\n * Present when a tool is called from within code execution.\n */\nexport type AnthropicToolCallCaller =\n | {\n type: 'code_execution_20250825';\n tool_id: string;\n }\n | {\n type: 'direct';\n };\n\nexport interface AnthropicToolCallContent {\n type: 'tool_use';\n id: string;\n name: string;\n input: unknown;\n /**\n * Present when this tool call was triggered by a server-executed tool\n * (e.g., code execution calling a user-defined tool programmatically).\n */\n caller?: AnthropicToolCallCaller;\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicServerToolUseContent {\n type: 'server_tool_use';\n id: string;\n name:\n | 'web_fetch'\n | 'web_search'\n // code execution 20250522:\n | 'code_execution'\n // code execution 20250825:\n | 'bash_code_execution'\n | 'text_editor_code_execution'\n // tool search:\n | 'tool_search_tool_regex'\n | 'tool_search_tool_bm25';\n input: unknown;\n cache_control: AnthropicCacheControl | undefined;\n}\n\n// Nested content types for tool results (without cache_control)\n// Sub-content blocks cannot be cached directly according to Anthropic docs\ntype AnthropicNestedTextContent = Omit<\n AnthropicTextContent,\n 'cache_control'\n> & {\n cache_control?: never;\n};\n\ntype AnthropicNestedImageContent = Omit<\n AnthropicImageContent,\n 'cache_control'\n> & {\n cache_control?: never;\n};\n\ntype AnthropicNestedDocumentContent = Omit<\n AnthropicDocumentContent,\n 'cache_control'\n> & {\n cache_control?: never;\n};\n\nexport interface AnthropicToolResultContent {\n type: 'tool_result';\n tool_use_id: string;\n content:\n | string\n | Array<\n | AnthropicNestedTextContent\n | AnthropicNestedImageContent\n | AnthropicNestedDocumentContent\n >;\n is_error: boolean | undefined;\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicWebSearchToolResultContent {\n type: 'web_search_tool_result';\n tool_use_id: string;\n content: Array<{\n url: string;\n title: string | null;\n page_age: string | null;\n encrypted_content: string;\n type: string;\n }>;\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicToolSearchToolResultContent {\n type: 'tool_search_tool_result';\n tool_use_id: string;\n content:\n | {\n type: 'tool_search_tool_search_result';\n tool_references: Array<{\n type: 'tool_reference';\n tool_name: string;\n }>;\n }\n | {\n type: 'tool_search_tool_result_error';\n error_code: string;\n };\n cache_control: AnthropicCacheControl | undefined;\n}\n\n// code execution results for code_execution_20250522 tool:\nexport interface AnthropicCodeExecutionToolResultContent {\n type: 'code_execution_tool_result';\n tool_use_id: string;\n content:\n | {\n type: 'code_execution_result';\n stdout: string;\n stderr: string;\n return_code: number;\n content: Array<{ type: 'code_execution_output'; file_id: string }>;\n }\n | {\n type: 'code_execution_tool_result_error';\n error_code: string;\n };\n cache_control: AnthropicCacheControl | undefined;\n}\n\n// text editor code execution results for code_execution_20250825 tool:\nexport interface AnthropicTextEditorCodeExecutionToolResultContent {\n type: 'text_editor_code_execution_tool_result';\n tool_use_id: string;\n content:\n | {\n type: 'text_editor_code_execution_tool_result_error';\n error_code: string;\n }\n | {\n type: 'text_editor_code_execution_create_result';\n is_file_update: boolean;\n }\n | {\n type: 'text_editor_code_execution_view_result';\n content: string;\n file_type: string;\n num_lines: number | null;\n start_line: number | null;\n total_lines: number | null;\n }\n | {\n type: 'text_editor_code_execution_str_replace_result';\n lines: string[] | null;\n new_lines: number | null;\n new_start: number | null;\n old_lines: number | null;\n old_start: number | null;\n };\n cache_control: AnthropicCacheControl | undefined;\n}\n\n// bash code execution results for code_execution_20250825 tool:\nexport interface AnthropicBashCodeExecutionToolResultContent {\n type: 'bash_code_execution_tool_result';\n tool_use_id: string;\n content:\n | {\n type: 'bash_code_execution_result';\n stdout: string;\n stderr: string;\n return_code: number;\n content: {\n type: 'bash_code_execution_output';\n file_id: string;\n }[];\n }\n | {\n type: 'bash_code_execution_tool_result_error';\n error_code: string;\n };\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicWebFetchToolResultContent {\n type: 'web_fetch_tool_result';\n tool_use_id: string;\n content: {\n type: 'web_fetch_result';\n url: string;\n retrieved_at: string | null;\n content: {\n type: 'document';\n title: string | null;\n citations?: { enabled: boolean };\n source:\n | { type: 'base64'; media_type: 'application/pdf'; data: string }\n | { type: 'text'; media_type: 'text/plain'; data: string };\n };\n };\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicMcpToolUseContent {\n type: 'mcp_tool_use';\n id: string;\n name: string;\n server_name: string;\n input: unknown;\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport interface AnthropicMcpToolResultContent {\n type: 'mcp_tool_result';\n tool_use_id: string;\n is_error: boolean;\n content: string | Array<{ type: 'text'; text: string }>;\n cache_control: AnthropicCacheControl | undefined;\n}\n\nexport type AnthropicTool =\n | {\n name: string;\n description: string | undefined;\n input_schema: JSONSchema7;\n cache_control: AnthropicCacheControl | undefined;\n strict?: boolean;\n /**\n * When true, this tool is deferred and will only be loaded when\n * discovered via the tool search tool.\n */\n defer_loading?: boolean;\n /**\n * Programmatic tool calling: specifies which server-executed tools\n * are allowed to call this tool. When set, only the specified callers\n * can invoke this tool programmatically.\n *\n * @example ['code_execution_20250825']\n */\n allowed_callers?: Array<'code_execution_20250825'>;\n }\n | {\n type: 'code_execution_20250522';\n name: string;\n cache_control: AnthropicCacheControl | undefined;\n }\n | {\n type: 'code_execution_20250825';\n name: string;\n }\n | {\n name: string;\n type: 'computer_20250124' | 'computer_20241022';\n display_width_px: number;\n display_height_px: number;\n display_number: number;\n cache_control: AnthropicCacheControl | undefined;\n }\n | {\n name: string;\n type:\n | 'text_editor_20250124'\n | 'text_editor_20241022'\n | 'text_editor_20250429';\n cache_control: AnthropicCacheControl | undefined;\n }\n | {\n name: string;\n type: 'text_editor_20250728';\n max_characters?: number;\n cache_control: AnthropicCacheControl | undefined;\n }\n | {\n name: string;\n type: 'bash_20250124' | 'bash_20241022';\n cache_control: AnthropicCacheControl | undefined;\n }\n | {\n name: string;\n type: 'memory_20250818';\n }\n | {\n type: 'web_fetch_20250910';\n name: string;\n max_uses?: number;\n allowed_domains?: string[];\n blocked_domains?: string[];\n citations?: { enabled: boolean };\n max_content_tokens?: number;\n cache_control: AnthropicCacheControl | undefined;\n }\n | {\n type: 'web_search_20250305';\n name: string;\n max_uses?: number;\n allowed_domains?: string[];\n blocked_domains?: string[];\n user_location?: {\n type: 'approximate';\n city?: string;\n region?: string;\n country?: string;\n timezone?: string;\n };\n cache_control: AnthropicCacheControl | undefined;\n }\n | {\n type: 'tool_search_tool_regex_20251119';\n name: string;\n }\n | {\n type: 'tool_search_tool_bm25_20251119';\n name: string;\n };\n\nexport type AnthropicToolChoice =\n | { type: 'auto' | 'any'; disable_parallel_tool_use?: boolean }\n | { type: 'tool'; name: string; disable_parallel_tool_use?: boolean };\n\nexport type AnthropicContainer = {\n id?: string | null;\n skills?: Array<{\n type: 'anthropic' | 'custom';\n skill_id: string;\n version?: string;\n }> | null;\n};\n\nexport type AnthropicInputTokensTrigger = {\n type: 'input_tokens';\n value: number;\n};\n\nexport type AnthropicToolUsesTrigger = {\n type: 'tool_uses';\n value: number;\n};\n\nexport type AnthropicContextManagementTrigger =\n | AnthropicInputTokensTrigger\n | AnthropicToolUsesTrigger;\n\nexport type AnthropicClearToolUsesEdit = {\n type: 'clear_tool_uses_20250919';\n trigger?: AnthropicContextManagementTrigger;\n keep?: {\n type: 'tool_uses';\n value: number;\n };\n clear_at_least?: {\n type: 'input_tokens';\n value: number;\n };\n clear_tool_inputs?: boolean;\n exclude_tools?: string[];\n};\n\nexport type AnthropicClearThinkingBlockEdit = {\n type: 'clear_thinking_20251015';\n keep?: 'all' | { type: 'thinking_turns'; value: number };\n};\n\nexport type AnthropicContextManagementEdit =\n | AnthropicClearToolUsesEdit\n | AnthropicClearThinkingBlockEdit;\n\nexport type AnthropicContextManagementConfig = {\n edits: AnthropicContextManagementEdit[];\n};\n\nexport type AnthropicResponseClearToolUsesEdit = {\n type: 'clear_tool_uses_20250919';\n cleared_tool_uses: number;\n cleared_input_tokens: number;\n};\n\nexport type AnthropicResponseClearThinkingBlockEdit = {\n type: 'clear_thinking_20251015';\n cleared_thinking_turns: number;\n cleared_input_tokens: number;\n};\n\nexport type AnthropicResponseContextManagementEdit =\n | AnthropicResponseClearToolUsesEdit\n | AnthropicResponseClearThinkingBlockEdit;\n\nexport type AnthropicResponseContextManagement = {\n applied_edits: AnthropicResponseContextManagementEdit[];\n};\n\n// limited version of the schema, focussed on what is needed for the implementation\n// this approach limits breakages when the API changes and increases efficiency\nexport const anthropicMessagesResponseSchema = lazySchema(() =>\n zodSchema(\n z.object({\n type: z.literal('message'),\n id: z.string().nullish(),\n model: z.string().nullish(),\n content: z.array(\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('text'),\n text: z.string(),\n citations: z\n .array(\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('web_search_result_location'),\n cited_text: z.string(),\n url: z.string(),\n title: z.string(),\n encrypted_index: z.string(),\n }),\n z.object({\n type: z.literal('page_location'),\n cited_text: z.string(),\n document_index: z.number(),\n document_title: z.string().nullable(),\n start_page_number: z.number(),\n end_page_number: z.number(),\n }),\n z.object({\n type: z.literal('char_location'),\n cited_text: z.string(),\n document_index: z.number(),\n document_title: z.string().nullable(),\n start_char_index: z.number(),\n end_char_index: z.number(),\n }),\n ]),\n )\n .optional(),\n }),\n z.object({\n type: z.literal('thinking'),\n thinking: z.string(),\n signature: z.string(),\n }),\n z.object({\n type: z.literal('redacted_thinking'),\n data: z.string(),\n }),\n z.object({\n type: z.literal('tool_use'),\n id: z.string(),\n name: z.string(),\n input: z.unknown(),\n // Programmatic tool calling: caller info when triggered from code execution\n caller: z\n .union([\n z.object({\n type: z.literal('code_execution_20250825'),\n tool_id: z.string(),\n }),\n z.object({\n type: z.literal('direct'),\n }),\n ])\n .optional(),\n }),\n z.object({\n type: z.literal('server_tool_use'),\n id: z.string(),\n name: z.string(),\n input: z.record(z.string(), z.unknown()).nullish(),\n }),\n z.object({\n type: z.literal('mcp_tool_use'),\n id: z.string(),\n name: z.string(),\n input: z.unknown(),\n server_name: z.string(),\n }),\n z.object({\n type: z.literal('mcp_tool_result'),\n tool_use_id: z.string(),\n is_error: z.boolean(),\n content: z.array(\n z.union([\n z.string(),\n z.object({ type: z.literal('text'), text: z.string() }),\n ]),\n ),\n }),\n z.object({\n type: z.literal('web_fetch_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.object({\n type: z.literal('web_fetch_result'),\n url: z.string(),\n retrieved_at: z.string(),\n content: z.object({\n type: z.literal('document'),\n title: z.string().nullable(),\n citations: z.object({ enabled: z.boolean() }).optional(),\n source: z.union([\n z.object({\n type: z.literal('base64'),\n media_type: z.literal('application/pdf'),\n data: z.string(),\n }),\n z.object({\n type: z.literal('text'),\n media_type: z.literal('text/plain'),\n data: z.string(),\n }),\n ]),\n }),\n }),\n z.object({\n type: z.literal('web_fetch_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n z.object({\n type: z.literal('web_search_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.array(\n z.object({\n type: z.literal('web_search_result'),\n url: z.string(),\n title: z.string(),\n encrypted_content: z.string(),\n page_age: z.string().nullish(),\n }),\n ),\n z.object({\n type: z.literal('web_search_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n // code execution results for code_execution_20250522 tool:\n z.object({\n type: z.literal('code_execution_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.object({\n type: z.literal('code_execution_result'),\n stdout: z.string(),\n stderr: z.string(),\n return_code: z.number(),\n content: z\n .array(\n z.object({\n type: z.literal('code_execution_output'),\n file_id: z.string(),\n }),\n )\n .optional()\n .default([]),\n }),\n z.object({\n type: z.literal('code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n // bash code execution results for code_execution_20250825 tool:\n z.object({\n type: z.literal('bash_code_execution_tool_result'),\n tool_use_id: z.string(),\n content: z.discriminatedUnion('type', [\n z.object({\n type: z.literal('bash_code_execution_result'),\n content: z.array(\n z.object({\n type: z.literal('bash_code_execution_output'),\n file_id: z.string(),\n }),\n ),\n stdout: z.string(),\n stderr: z.string(),\n return_code: z.number(),\n }),\n z.object({\n type: z.literal('bash_code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n // text editor code execution results for code_execution_20250825 tool:\n z.object({\n type: z.literal('text_editor_code_execution_tool_result'),\n tool_use_id: z.string(),\n content: z.discriminatedUnion('type', [\n z.object({\n type: z.literal('text_editor_code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_view_result'),\n content: z.string(),\n file_type: z.string(),\n num_lines: z.number().nullable(),\n start_line: z.number().nullable(),\n total_lines: z.number().nullable(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_create_result'),\n is_file_update: z.boolean(),\n }),\n z.object({\n type: z.literal(\n 'text_editor_code_execution_str_replace_result',\n ),\n lines: z.array(z.string()).nullable(),\n new_lines: z.number().nullable(),\n new_start: z.number().nullable(),\n old_lines: z.number().nullable(),\n old_start: z.number().nullable(),\n }),\n ]),\n }),\n // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:\n z.object({\n type: z.literal('tool_search_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.object({\n type: z.literal('tool_search_tool_search_result'),\n tool_references: z.array(\n z.object({\n type: z.literal('tool_reference'),\n tool_name: z.string(),\n }),\n ),\n }),\n z.object({\n type: z.literal('tool_search_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n ]),\n ),\n stop_reason: z.string().nullish(),\n stop_sequence: z.string().nullish(),\n usage: z.looseObject({\n input_tokens: z.number(),\n output_tokens: z.number(),\n cache_creation_input_tokens: z.number().nullish(),\n cache_read_input_tokens: z.number().nullish(),\n }),\n container: z\n .object({\n expires_at: z.string(),\n id: z.string(),\n skills: z\n .array(\n z.object({\n type: z.union([z.literal('anthropic'), z.literal('custom')]),\n skill_id: z.string(),\n version: z.string(),\n }),\n )\n .nullish(),\n })\n .nullish(),\n context_management: z\n .object({\n applied_edits: z.array(\n z.union([\n z.object({\n type: z.literal('clear_tool_uses_20250919'),\n cleared_tool_uses: z.number(),\n cleared_input_tokens: z.number(),\n }),\n z.object({\n type: z.literal('clear_thinking_20251015'),\n cleared_thinking_turns: z.number(),\n cleared_input_tokens: z.number(),\n }),\n ]),\n ),\n })\n .nullish(),\n }),\n ),\n);\n\n// limited version of the schema, focused on what is needed for the implementation\n// this approach limits breakages when the API changes and increases efficiency\nexport const anthropicMessagesChunkSchema = lazySchema(() =>\n zodSchema(\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('message_start'),\n message: z.object({\n id: z.string().nullish(),\n model: z.string().nullish(),\n role: z.string().nullish(),\n usage: z.looseObject({\n input_tokens: z.number(),\n cache_creation_input_tokens: z.number().nullish(),\n cache_read_input_tokens: z.number().nullish(),\n }),\n // Programmatic tool calling: content may be pre-populated for deferred tool calls\n content: z\n .array(\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('tool_use'),\n id: z.string(),\n name: z.string(),\n input: z.unknown(),\n caller: z\n .union([\n z.object({\n type: z.literal('code_execution_20250825'),\n tool_id: z.string(),\n }),\n z.object({\n type: z.literal('direct'),\n }),\n ])\n .optional(),\n }),\n ]),\n )\n .nullish(),\n stop_reason: z.string().nullish(),\n container: z\n .object({\n expires_at: z.string(),\n id: z.string(),\n })\n .nullish(),\n }),\n }),\n z.object({\n type: z.literal('content_block_start'),\n index: z.number(),\n content_block: z.discriminatedUnion('type', [\n z.object({\n type: z.literal('text'),\n text: z.string(),\n }),\n z.object({\n type: z.literal('thinking'),\n thinking: z.string(),\n }),\n z.object({\n type: z.literal('tool_use'),\n id: z.string(),\n name: z.string(),\n // Programmatic tool calling: input may be present directly for deferred tool calls\n input: z.record(z.string(), z.unknown()).optional(),\n // Programmatic tool calling: caller info when triggered from code execution\n caller: z\n .union([\n z.object({\n type: z.literal('code_execution_20250825'),\n tool_id: z.string(),\n }),\n z.object({\n type: z.literal('direct'),\n }),\n ])\n .optional(),\n }),\n z.object({\n type: z.literal('redacted_thinking'),\n data: z.string(),\n }),\n z.object({\n type: z.literal('server_tool_use'),\n id: z.string(),\n name: z.string(),\n input: z.record(z.string(), z.unknown()).nullish(),\n }),\n z.object({\n type: z.literal('mcp_tool_use'),\n id: z.string(),\n name: z.string(),\n input: z.unknown(),\n server_name: z.string(),\n }),\n z.object({\n type: z.literal('mcp_tool_result'),\n tool_use_id: z.string(),\n is_error: z.boolean(),\n content: z.array(\n z.union([\n z.string(),\n z.object({ type: z.literal('text'), text: z.string() }),\n ]),\n ),\n }),\n z.object({\n type: z.literal('web_fetch_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.object({\n type: z.literal('web_fetch_result'),\n url: z.string(),\n retrieved_at: z.string(),\n content: z.object({\n type: z.literal('document'),\n title: z.string().nullable(),\n citations: z.object({ enabled: z.boolean() }).optional(),\n source: z.union([\n z.object({\n type: z.literal('base64'),\n media_type: z.literal('application/pdf'),\n data: z.string(),\n }),\n z.object({\n type: z.literal('text'),\n media_type: z.literal('text/plain'),\n data: z.string(),\n }),\n ]),\n }),\n }),\n z.object({\n type: z.literal('web_fetch_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n z.object({\n type: z.literal('web_search_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.array(\n z.object({\n type: z.literal('web_search_result'),\n url: z.string(),\n title: z.string(),\n encrypted_content: z.string(),\n page_age: z.string().nullish(),\n }),\n ),\n z.object({\n type: z.literal('web_search_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n // code execution results for code_execution_20250522 tool:\n z.object({\n type: z.literal('code_execution_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.object({\n type: z.literal('code_execution_result'),\n stdout: z.string(),\n stderr: z.string(),\n return_code: z.number(),\n content: z\n .array(\n z.object({\n type: z.literal('code_execution_output'),\n file_id: z.string(),\n }),\n )\n .optional()\n .default([]),\n }),\n z.object({\n type: z.literal('code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n // bash code execution results for code_execution_20250825 tool:\n z.object({\n type: z.literal('bash_code_execution_tool_result'),\n tool_use_id: z.string(),\n content: z.discriminatedUnion('type', [\n z.object({\n type: z.literal('bash_code_execution_result'),\n content: z.array(\n z.object({\n type: z.literal('bash_code_execution_output'),\n file_id: z.string(),\n }),\n ),\n stdout: z.string(),\n stderr: z.string(),\n return_code: z.number(),\n }),\n z.object({\n type: z.literal('bash_code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n // text editor code execution results for code_execution_20250825 tool:\n z.object({\n type: z.literal('text_editor_code_execution_tool_result'),\n tool_use_id: z.string(),\n content: z.discriminatedUnion('type', [\n z.object({\n type: z.literal('text_editor_code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_view_result'),\n content: z.string(),\n file_type: z.string(),\n num_lines: z.number().nullable(),\n start_line: z.number().nullable(),\n total_lines: z.number().nullable(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_create_result'),\n is_file_update: z.boolean(),\n }),\n z.object({\n type: z.literal(\n 'text_editor_code_execution_str_replace_result',\n ),\n lines: z.array(z.string()).nullable(),\n new_lines: z.number().nullable(),\n new_start: z.number().nullable(),\n old_lines: z.number().nullable(),\n old_start: z.number().nullable(),\n }),\n ]),\n }),\n // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:\n z.object({\n type: z.literal('tool_search_tool_result'),\n tool_use_id: z.string(),\n content: z.union([\n z.object({\n type: z.literal('tool_search_tool_search_result'),\n tool_references: z.array(\n z.object({\n type: z.literal('tool_reference'),\n tool_name: z.string(),\n }),\n ),\n }),\n z.object({\n type: z.literal('tool_search_tool_result_error'),\n error_code: z.string(),\n }),\n ]),\n }),\n ]),\n }),\n z.object({\n type: z.literal('content_block_delta'),\n index: z.number(),\n delta: z.discriminatedUnion('type', [\n z.object({\n type: z.literal('input_json_delta'),\n partial_json: z.string(),\n }),\n z.object({\n type: z.literal('text_delta'),\n text: z.string(),\n }),\n z.object({\n type: z.literal('thinking_delta'),\n thinking: z.string(),\n }),\n z.object({\n type: z.literal('signature_delta'),\n signature: z.string(),\n }),\n z.object({\n type: z.literal('citations_delta'),\n citation: z.discriminatedUnion('type', [\n z.object({\n type: z.literal('web_search_result_location'),\n cited_text: z.string(),\n url: z.string(),\n title: z.string(),\n encrypted_index: z.string(),\n }),\n z.object({\n type: z.literal('page_location'),\n cited_text: z.string(),\n document_index: z.number(),\n document_title: z.string().nullable(),\n start_page_number: z.number(),\n end_page_number: z.number(),\n }),\n z.object({\n type: z.literal('char_location'),\n cited_text: z.string(),\n document_index: z.number(),\n document_title: z.string().nullable(),\n start_char_index: z.number(),\n end_char_index: z.number(),\n }),\n ]),\n }),\n ]),\n }),\n z.object({\n type: z.literal('content_block_stop'),\n index: z.number(),\n }),\n z.object({\n type: z.literal('error'),\n error: z.object({\n type: z.string(),\n message: z.string(),\n }),\n }),\n z.object({\n type: z.literal('message_delta'),\n delta: z.object({\n stop_reason: z.string().nullish(),\n stop_sequence: z.string().nullish(),\n container: z\n .object({\n expires_at: z.string(),\n id: z.string(),\n skills: z\n .array(\n z.object({\n type: z.union([\n z.literal('anthropic'),\n z.literal('custom'),\n ]),\n skill_id: z.string(),\n version: z.string(),\n }),\n )\n .nullish(),\n })\n .nullish(),\n context_management: z\n .object({\n applied_edits: z.array(\n z.union([\n z.object({\n type: z.literal('clear_tool_uses_20250919'),\n cleared_tool_uses: z.number(),\n cleared_input_tokens: z.number(),\n }),\n z.object({\n type: z.literal('clear_thinking_20251015'),\n cleared_thinking_turns: z.number(),\n cleared_input_tokens: z.number(),\n }),\n ]),\n ),\n })\n .nullish(),\n }),\n usage: z.looseObject({\n output_tokens: z.number(),\n cache_creation_input_tokens: z.number().nullish(),\n }),\n }),\n z.object({\n type: z.literal('message_stop'),\n }),\n z.object({\n type: z.literal('ping'),\n }),\n ]),\n ),\n);\n\nexport const anthropicReasoningMetadataSchema = lazySchema(() =>\n zodSchema(\n z.object({\n signature: z.string().optional(),\n redactedData: z.string().optional(),\n }),\n ),\n);\n\nexport type AnthropicReasoningMetadata = InferSchema<\n typeof anthropicReasoningMetadataSchema\n>;\n\nexport type Citation = NonNullable<\n (InferSchema<typeof anthropicMessagesResponseSchema>['content'][number] & {\n type: 'text';\n })['citations']\n>[number];\n","import { z } from 'zod/v4';\n\n// https://docs.claude.com/en/docs/about-claude/models/overview\nexport type AnthropicMessagesModelId =\n | 'claude-3-5-haiku-20241022'\n | 'claude-3-5-haiku-latest'\n | 'claude-3-7-sonnet-20250219'\n | 'claude-3-7-sonnet-latest'\n | 'claude-3-haiku-20240307'\n | 'claude-haiku-4-5-20251001'\n | 'claude-haiku-4-5'\n | 'claude-opus-4-0'\n | 'claude-opus-4-1-20250805'\n | 'claude-opus-4-1'\n | 'claude-opus-4-20250514'\n | 'claude-opus-4-5'\n | 'claude-opus-4-5-20251101'\n | 'claude-sonnet-4-0'\n | 'claude-sonnet-4-20250514'\n | 'claude-sonnet-4-5-20250929'\n | 'claude-sonnet-4-5'\n | (string & {});\n\n/**\n * Anthropic file part provider options for document-specific features.\n * These options apply to individual file parts (documents).\n */\nexport const anthropicFilePartProviderOptions = z.object({\n /**\n * Citation configuration for this document.\n * When enabled, this document will generate citations in the response.\n */\n citations: z\n .object({\n /**\n * Enable citations for this document\n */\n enabled: z.boolean(),\n })\n .optional(),\n\n /**\n * Custom title for the document.\n * If not provided, the filename will be used.\n */\n title: z.string().optional(),\n\n /**\n * Context about the document that will be passed to the model\n * but not used towards cited content.\n * Useful for storing document metadata as text or stringified JSON.\n */\n context: z.string().optional(),\n});\n\nexport type AnthropicFilePartProviderOptions = z.infer<\n typeof anthropicFilePartProviderOptions\n>;\n\nexport const anthropicProviderOptions = z.object({\n /**\n * Whether to send reasoning to the model.\n *\n * This allows you to deactivate reasoning inputs for models that do not support them.\n */\n sendReasoning: z.boolean().optional(),\n\n /**\n * Determines how structured outputs are generated.\n *\n * - `outputFormat`: Use the `output_format` parameter to specify the structured output format.\n * - `jsonTool`: Use a special 'json' tool to specify the structured output format.\n * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).\n */\n structuredOutputMode: z.enum(['outputFormat', 'jsonTool', 'auto']).optional(),\n\n /**\n * Configuration for enabling Claude's extended thinking.\n *\n * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.\n * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.\n */\n thinking: z\n .object({\n type: z.union([z.literal('enabled'), z.literal('disabled')]),\n budgetTokens: z.number().optional(),\n })\n .optional(),\n\n /**\n * Whether to disable parallel function calling during tool use. Default is false.\n * When set to true, Claude will use at most one tool per response.\n */\n disableParallelToolUse: z.boolean().optional(),\n\n /**\n * Cache control settings for this message.\n * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching\n */\n cacheControl: z\n .object({\n type: z.literal('ephemeral'),\n ttl: z.union([z.literal('5m'), z.literal('1h')]).optional(),\n })\n .optional(),\n\n /**\n * MCP servers to be utilized in this request.\n */\n mcpServers: z\n .array(\n z.object({\n type: z.literal('url'),\n name: z.string(),\n url: z.string(),\n authorizationToken: z.string().nullish(),\n toolConfiguration: z\n .object({\n enabled: z.boolean().nullish(),\n allowedTools: z.array(z.string()).nullish(),\n })\n .nullish(),\n }),\n )\n .optional(),\n\n /**\n * Agent Skills configuration. Skills enable Claude to perform specialized tasks\n * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.\n * Requires code execution tool to be enabled.\n */\n container: z\n .object({\n id: z.string().optional(),\n skills: z\n .array(\n z.object({\n type: z.union([z.literal('anthropic'), z.literal('custom')]),\n skillId: z.string(),\n version: z.string().optional(),\n }),\n )\n .optional(),\n })\n .optional(),\n\n /**\n * Whether to enable tool streaming (and structured output streaming).\n *\n * When set to false, the model will return all tool calls and results\n * at once after a delay.\n *\n * @default true\n */\n toolStreaming: z.boolean().optional(),\n\n /**\n * @default 'high'\n */\n effort: z.enum(['low', 'medium', 'high']).optional(),\n\n contextManagement: z\n .object({\n edits: z.array(\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('clear_tool_uses_20250919'),\n trigger: z\n .discriminatedUnion('type', [\n z.object({\n type: z.literal('input_tokens'),\n value: z.number(),\n }),\n z.object({\n type: z.literal('tool_uses'),\n value: z.number(),\n }),\n ])\n .optional(),\n keep: z\n .object({\n type: z.literal('tool_uses'),\n value: z.number(),\n })\n .optional(),\n clearAtLeast: z\n .object({\n type: z.literal('input_tokens'),\n value: z.number(),\n })\n .optional(),\n clearToolInputs: z.boolean().optional(),\n excludeTools: z.array(z.string()).optional(),\n }),\n z.object({\n type: z.literal('clear_thinking_20251015'),\n keep: z\n .union([\n z.literal('all'),\n z.object({\n type: z.literal('thinking_turns'),\n value: z.number(),\n }),\n ])\n .optional(),\n }),\n ]),\n ),\n })\n .optional(),\n});\n\nexport type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;\n","import {\n LanguageModelV3CallOptions,\n SharedV3Warning,\n UnsupportedFunctionalityError,\n} from '@ai-sdk/provider';\nimport { AnthropicTool, AnthropicToolChoice } from './anthropic-messages-api';\nimport { CacheControlValidator } from './get-cache-control';\nimport { textEditor_20250728ArgsSchema } from './tool/text-editor_20250728';\nimport { webSearch_20250305ArgsSchema } from './tool/web-search_20250305';\nimport { webFetch_20250910ArgsSchema } from './tool/web-fetch-20250910';\nimport { validateTypes } from '@ai-sdk/provider-utils';\n\nexport interface AnthropicToolOptions {\n deferLoading?: boolean;\n allowedCallers?: Array<'code_execution_20250825'>;\n}\n\nexport async function prepareTools({\n tools,\n toolChoice,\n disableParallelToolUse,\n cacheControlValidator,\n supportsStructuredOutput,\n}: {\n tools: LanguageModelV3CallOptions['tools'];\n toolChoice: LanguageModelV3CallOptions['toolChoice'] | undefined;\n disableParallelToolUse?: boolean;\n cacheControlValidator?: CacheControlValidator;\n\n /**\n * Whether the model supports structured output.\n */\n supportsStructuredOutput: boolean;\n}): Promise<{\n tools: Array<AnthropicTool> | undefined;\n toolChoice: AnthropicToolChoice | undefined;\n toolWarnings: SharedV3Warning[];\n betas: Set<string>;\n}> {\n // when the tools array is empty, change it to undefined to prevent errors:\n tools = tools?.length ? tools : undefined;\n\n const toolWarnings: SharedV3Warning[] = [];\n const betas = new Set<string>();\n const validator = cacheControlValidator || new CacheControlValidator();\n\n if (tools == null) {\n return { tools: undefined, toolChoice: undefined, toolWarnings, betas };\n }\n\n const anthropicTools: AnthropicTool[] = [];\n\n for (const tool of tools) {\n switch (tool.type) {\n case 'function': {\n const cacheControl = validator.getCacheControl(tool.providerOptions, {\n type: 'tool definition',\n canCache: true,\n });\n\n // Read Anthropic-specific provider options\n const anthropicOptions = tool.providerOptions?.anthropic as\n | AnthropicToolOptions\n | undefined;\n const deferLoading = anthropicOptions?.deferLoading;\n const allowedCallers = anthropicOptions?.allowedCallers;\n\n anthropicTools.push({\n name: tool.name,\n description: tool.description,\n input_schema: tool.inputSchema,\n cache_control: cacheControl,\n ...(supportsStructuredOutput === true && tool.strict != null\n ? { strict: tool.strict }\n : {}),\n ...(deferLoading != null ? { defer_loading: deferLoading } : {}),\n ...(allowedCallers != null\n ? { allowed_callers: allowedCallers }\n : {}),\n ...(tool.inputExamples != null\n ? {\n input_examples: tool.inputExamples.map(\n example => example.input,\n ),\n }\n : {}),\n });\n\n if (supportsStructuredOutput === true) {\n betas.add('structured-outputs-2025-11-13');\n }\n\n if (tool.inputExamples != null || allowedCallers != null) {\n betas.add('advanced-tool-use-2025-11-20');\n }\n\n break;\n }\n\n case 'provider': {\n // Note: Provider-defined tools don't currently support providerOptions in the SDK,\n // so cache_control cannot be set on them. The Anthropic API supports caching all tools,\n // but the SDK would need to be updated to expose providerOptions on provider-defined tools.\n switch (tool.id) {\n case 'anthropic.code_execution_20250522': {\n betas.add('code-execution-2025-05-22');\n anthropicTools.push({\n type: 'code_execution_20250522',\n name: 'code_execution',\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.code_execution_20250825': {\n betas.add('code-execution-2025-08-25');\n anthropicTools.push({\n type: 'code_execution_20250825',\n name: 'code_execution',\n });\n break;\n }\n case 'anthropic.computer_20250124': {\n betas.add('computer-use-2025-01-24');\n anthropicTools.push({\n name: 'computer',\n type: 'computer_20250124',\n display_width_px: tool.args.displayWidthPx as number,\n display_height_px: tool.args.displayHeightPx as number,\n display_number: tool.args.displayNumber as number,\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.computer_20241022': {\n betas.add('computer-use-2024-10-22');\n anthropicTools.push({\n name: 'computer',\n type: 'computer_20241022',\n display_width_px: tool.args.displayWidthPx as number,\n display_height_px: tool.args.displayHeightPx as number,\n display_number: tool.args.displayNumber as number,\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.text_editor_20250124': {\n betas.add('computer-use-2025-01-24');\n anthropicTools.push({\n name: 'str_replace_editor',\n type: 'text_editor_20250124',\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.text_editor_20241022': {\n betas.add('computer-use-2024-10-22');\n anthropicTools.push({\n name: 'str_replace_editor',\n type: 'text_editor_20241022',\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.text_editor_20250429': {\n betas.add('computer-use-2025-01-24');\n anthropicTools.push({\n name: 'str_replace_based_edit_tool',\n type: 'text_editor_20250429',\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.text_editor_20250728': {\n const args = await validateTypes({\n value: tool.args,\n schema: textEditor_20250728ArgsSchema,\n });\n anthropicTools.push({\n name: 'str_replace_based_edit_tool',\n type: 'text_editor_20250728',\n max_characters: args.maxCharacters,\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.bash_20250124': {\n betas.add('computer-use-2025-01-24');\n anthropicTools.push({\n name: 'bash',\n type: 'bash_20250124',\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.bash_20241022': {\n betas.add('computer-use-2024-10-22');\n anthropicTools.push({\n name: 'bash',\n type: 'bash_20241022',\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.memory_20250818': {\n betas.add('context-management-2025-06-27');\n anthropicTools.push({\n name: 'memory',\n type: 'memory_20250818',\n });\n break;\n }\n case 'anthropic.web_fetch_20250910': {\n betas.add('web-fetch-2025-09-10');\n const args = await validateTypes({\n value: tool.args,\n schema: webFetch_20250910ArgsSchema,\n });\n anthropicTools.push({\n type: 'web_fetch_20250910',\n name: 'web_fetch',\n max_uses: args.maxUses,\n allowed_domains: args.allowedDomains,\n blocked_domains: args.blockedDomains,\n citations: args.citations,\n max_content_tokens: args.maxContentTokens,\n cache_control: undefined,\n });\n break;\n }\n case 'anthropic.web_search_20250305': {\n const args = await validateTypes({\n value: tool.args,\n schema: webSearch_20250305ArgsSchema,\n });\n anthropicTools.push({\n type: 'web_search_20250305',\n name: 'web_search',\n max_uses: args.maxUses,\n allowed_domains: args.allowedDomains,\n blocked_domains: args.blockedDomains,\n user_location: args.userLocation,\n cache_control: undefined,\n });\n break;\n }\n\n case 'anthropic.tool_search_regex_20251119': {\n betas.add('advanced-tool-use-2025-11-20');\n anthropicTools.push({\n type: 'tool_search_tool_regex_20251119',\n name: 'tool_search_tool_regex',\n });\n break;\n }\n\n case 'anthropic.tool_search_bm25_20251119': {\n betas.add('advanced-tool-use-2025-11-20');\n anthropicTools.push({\n type: 'tool_search_tool_bm25_20251119',\n name: 'tool_search_tool_bm25',\n });\n break;\n }\n\n default: {\n toolWarnings.push({\n type: 'unsupported',\n feature: `provider-defined tool ${tool.id}`,\n });\n break;\n }\n }\n break;\n }\n\n default: {\n toolWarnings.push({\n type: 'unsupported',\n feature: `tool ${tool}`,\n });\n break;\n }\n }\n }\n\n if (toolChoice == null) {\n return {\n tools: anthropicTools,\n toolChoice: disableParallelToolUse\n ? { type: 'auto', disable_parallel_tool_use: disableParallelToolUse }\n : undefined,\n toolWarnings,\n betas,\n };\n }\n\n const type = toolChoice.type;\n\n switch (type) {\n case 'auto':\n return {\n tools: anthropicTools,\n toolChoice: {\n type: 'auto',\n disable_parallel_tool_use: disableParallelToolUse,\n },\n toolWarnings,\n betas,\n };\n case 'required':\n return {\n tools: anthropicTools,\n toolChoice: {\n type: 'any',\n disable_parallel_tool_use: disableParallelToolUse,\n },\n toolWarnings,\n betas,\n };\n case 'none':\n // Anthropic does not support 'none' tool choice, so we remove the tools:\n return { tools: undefined, toolChoice: undefined, toolWarnings, betas };\n case 'tool':\n return {\n tools: anthropicTools,\n toolChoice: {\n type: 'tool',\n name: toolChoice.toolName,\n disable_parallel_tool_use: disableParallelToolUse,\n },\n toolWarnings,\n betas,\n };\n default: {\n const _exhaustiveCheck: never = type;\n throw new UnsupportedFunctionalityError({\n functionality: `tool choice type: ${_exhaustiveCheck}`,\n });\n }\n }\n}\n","import { SharedV3Warning, SharedV3ProviderMetadata } from '@ai-sdk/provider';\nimport { AnthropicCacheControl } from './anthropic-messages-api';\n\n// Anthropic allows a maximum of 4 cache breakpoints per request\nconst MAX_CACHE_BREAKPOINTS = 4;\n\n// Helper function to extract cache_control from provider metadata\n// Allows both cacheControl and cache_control for flexibility\nfunction getCacheControl(\n providerMetadata: SharedV3ProviderMetadata | undefined,\n): AnthropicCacheControl | undefined {\n const anthropic = providerMetadata?.anthropic;\n\n // allow both cacheControl and cache_control:\n const cacheControlValue = anthropic?.cacheControl ?? anthropic?.cache_control;\n\n // Pass through value assuming it is of the correct type.\n // The Anthropic API will validate the value.\n return cacheControlValue as AnthropicCacheControl | undefined;\n}\n\nexport class CacheControlValidator {\n private breakpointCount = 0;\n private warnings: SharedV3Warning[] = [];\n\n getCacheControl(\n providerMetadata: SharedV3ProviderMetadata | undefined,\n context: { type: string; canCache: boolean },\n ): AnthropicCacheControl | undefined {\n const cacheControlValue = getCacheControl(providerMetadata);\n\n if (!cacheControlValue) {\n return undefined;\n }\n\n // Validate that cache_control is allowed in this context\n if (!context.canCache) {\n this.warnings.push({\n type: 'unsupported',\n feature: 'cache_control on non-cacheable context',\n details: `cache_control cannot be set on ${context.type}. It will be ignored.`,\n });\n return undefined;\n }\n\n // Validate cache breakpoint limit\n this.breakpointCount++;\n if (this.breakpointCount > MAX_CACHE_BREAKPOINTS) {\n this.warnings.push({\n type: 'unsupported',\n feature: 'cacheControl breakpoint limit',\n details: `Maximum ${MAX_CACHE_BREAKPOINTS} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`,\n });\n return undefined;\n }\n\n return cacheControlValue;\n }\n\n getWarnings(): SharedV3Warning[] {\n return this.warnings;\n }\n}\n","import { createProviderToolFactory } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport { lazySchema, zodSchema } from '@ai-sdk/provider-utils';\n\nexport const textEditor_20250728ArgsSchema = lazySchema(() =>\n zodSchema(\n z.object({\n maxCharacters: z.number().optional(),\n }),\n ),\n);\n\nconst textEditor_20250728InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n command: z.enum(['view', 'create', 'str_replace', 'insert']),\n path: z.string(),\n file_text: z.string().optional(),\n insert_line: z.number().int().optional(),\n new_str: z.string().optional(),\n old_str: z.string().optional(),\n view_range: z.array(z.number().int()).optional(),\n }),\n ),\n);\n\nconst factory = createProviderToolFactory<\n {\n /**\n * The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`.\n * Note: `undo_edit` is not supported in Claude 4 models.\n */\n command: 'view' | 'create' | 'str_replace' | 'insert';\n\n /**\n * Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.\n */\n path: string;\n\n /**\n * Required parameter of `create` command, with the content of the file to be created.\n */\n file_text?: string;\n\n /**\n * Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.\n */\n insert_line?: number;\n\n /**\n * Optional parameter of `str_replace` command containing the new string (if not given, no string will be added). Required parameter of `insert` command containing the string to insert.\n */\n new_str?: string;\n\n /**\n * Required parameter of `str_replace` command containing the string in `path` to replace.\n */\n old_str?: string;\n\n /**\n * Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.\n */\n view_range?: number[];\n },\n {\n /**\n * Optional parameter to control truncation when viewing large files. Only compatible with text_editor_20250728 and later versions.\n */\n maxCharacters?: number;\n }\n>({\n id: 'anthropic.text_editor_20250728',\n inputSchema: textEditor_20250728InputSchema,\n});\n\nexport const textEditor_20250728 = (\n args: Parameters<typeof factory>[0] = {}, // default\n) => {\n return factory(args);\n};\n","import {\n createProviderToolFactoryWithOutputSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const webSearch_20250305ArgsSchema = lazySchema(() =>\n zodSchema(\n z.object({\n maxUses: z.number().optional(),\n allowedDomains: z.array(z.string()).optional(),\n blockedDomains: z.array(z.string()).optional(),\n userLocation: z\n .object({\n type: z.literal('approximate'),\n city: z.string().optional(),\n region: z.string().optional(),\n country: z.string().optional(),\n timezone: z.string().optional(),\n })\n .optional(),\n }),\n ),\n);\n\nexport const webSearch_20250305OutputSchema = lazySchema(() =>\n zodSchema(\n z.array(\n z.object({\n url: z.string(),\n title: z.string().nullable(),\n pageAge: z.string().nullable(),\n encryptedContent: z.string(),\n type: z.literal('web_search_result'),\n }),\n ),\n ),\n);\n\nconst webSearch_20250305InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n query: z.string(),\n }),\n ),\n);\n\nconst factory = createProviderToolFactoryWithOutputSchema<\n {\n /**\n * The search query to execute.\n */\n query: string;\n },\n Array<{\n type: 'web_search_result';\n\n /**\n * The URL of the source page.\n */\n url: string;\n\n /**\n * The title of the source page.\n */\n title: string | null;\n\n /**\n * When the site was last updated\n */\n pageAge: string | null;\n\n /**\n * Encrypted content that must be passed back in multi-turn conversations for citations\n */\n encryptedContent: string;\n }>,\n {\n /**\n * Maximum number of web searches Claude can perform during the conversation.\n */\n maxUses?: number;\n\n /**\n * Optional list of domains that Claude is allowed to search.\n */\n allowedDomains?: string[];\n\n /**\n * Optional list of domains that Claude should avoid when searching.\n */\n blockedDomains?: string[];\n\n /**\n * Optional user location information to provide geographically relevant search results.\n */\n userLocation?: {\n /**\n * The type of location (must be approximate)\n */\n type: 'approximate';\n\n /**\n * The city name\n */\n city?: string;\n\n /**\n * The region or state\n */\n region?: string;\n\n /**\n * The country\n */\n country?: string;\n\n /**\n * The IANA timezone ID.\n */\n timezone?: string;\n };\n }\n>({\n id: 'anthropic.web_search_20250305',\n inputSchema: webSearch_20250305InputSchema,\n outputSchema: webSearch_20250305OutputSchema,\n});\n\nexport const webSearch_20250305 = (\n args: Parameters<typeof factory>[0] = {}, // default\n) => {\n return factory(args);\n};\n","import {\n createProviderToolFactoryWithOutputSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const webFetch_20250910ArgsSchema = lazySchema(() =>\n zodSchema(\n z.object({\n maxUses: z.number().optional(),\n allowedDomains: z.array(z.string()).optional(),\n blockedDomains: z.array(z.string()).optional(),\n citations: z.object({ enabled: z.boolean() }).optional(),\n maxContentTokens: z.number().optional(),\n }),\n ),\n);\n\nexport const webFetch_20250910OutputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n type: z.literal('web_fetch_result'),\n url: z.string(),\n content: z.object({\n type: z.literal('document'),\n title: z.string().nullable(),\n citations: z.object({ enabled: z.boolean() }).optional(),\n source: z.union([\n z.object({\n type: z.literal('base64'),\n mediaType: z.literal('application/pdf'),\n data: z.string(),\n }),\n z.object({\n type: z.literal('text'),\n mediaType: z.literal('text/plain'),\n data: z.string(),\n }),\n ]),\n }),\n retrievedAt: z.string().nullable(),\n }),\n ),\n);\n\nconst webFetch_20250910InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n url: z.string(),\n }),\n ),\n);\n\nconst factory = createProviderToolFactoryWithOutputSchema<\n {\n /**\n * The URL to fetch.\n */\n url: string;\n },\n {\n type: 'web_fetch_result';\n\n /**\n * Fetched content URL\n */\n url: string;\n\n /**\n * Fetched content.\n */\n content: {\n type: 'document';\n\n /**\n * Title of the document\n */\n title: string | null;\n\n /**\n * Citation configuration for the document\n */\n citations?: { enabled: boolean };\n\n source:\n | {\n type: 'base64';\n mediaType: 'application/pdf';\n data: string;\n }\n | {\n type: 'text';\n mediaType: 'text/plain';\n data: string;\n };\n };\n\n /**\n * ISO 8601 timestamp when the content was retrieved\n */\n retrievedAt: string | null;\n },\n {\n /**\n * The maxUses parameter limits the number of web fetches performed\n */\n maxUses?: number;\n\n /**\n * Only fetch from these domains\n */\n allowedDomains?: string[];\n\n /**\n * Never fetch from these domains\n */\n blockedDomains?: string[];\n\n /**\n * Unlike web search where citations are always enabled, citations are optional for\n * web fetch. Set \"citations\": {\"enabled\": true} to enable Claude to cite specific passages\n * from fetched documents.\n */\n citations?: {\n enabled: boolean;\n };\n\n /**\n * The maxContentTokens parameter limits the amount of content that will be included in the context.\n */\n maxContentTokens?: number;\n }\n>({\n id: 'anthropic.web_fetch_20250910',\n inputSchema: webFetch_20250910InputSchema,\n outputSchema: webFetch_20250910OutputSchema,\n});\n\nexport const webFetch_20250910 = (\n args: Parameters<typeof factory>[0] = {}, // default\n) => {\n return factory(args);\n};\n","import { LanguageModelV3Usage } from '@ai-sdk/provider';\n\nexport type AnthropicMessagesUsage = {\n input_tokens: number;\n output_tokens: number;\n cache_creation_input_tokens?: number | null;\n cache_read_input_tokens?: number | null;\n};\n\nexport function convertAnthropicMessagesUsage(\n usage: AnthropicMessagesUsage,\n): LanguageModelV3Usage {\n const inputTokens = usage.input_tokens;\n const outputTokens = usage.output_tokens;\n const cacheCreationTokens = usage.cache_creation_input_tokens ?? 0;\n const cacheReadTokens = usage.cache_read_input_tokens ?? 0;\n\n return {\n inputTokens: {\n total: inputTokens + cacheCreationTokens + cacheReadTokens,\n noCache: inputTokens,\n cacheRead: cacheReadTokens,\n cacheWrite: cacheCreationTokens,\n },\n outputTokens: {\n total: outputTokens,\n text: undefined,\n reasoning: undefined,\n },\n raw: usage,\n };\n}\n","import {\n SharedV3Warning,\n LanguageModelV3DataContent,\n LanguageModelV3Message,\n LanguageModelV3Prompt,\n SharedV3ProviderMetadata,\n UnsupportedFunctionalityError,\n} from '@ai-sdk/provider';\nimport {\n convertToBase64,\n parseProviderOptions,\n validateTypes,\n isNonNullable,\n ToolNameMapping,\n} from '@ai-sdk/provider-utils';\nimport {\n AnthropicAssistantMessage,\n AnthropicMessagesPrompt,\n anthropicReasoningMetadataSchema,\n AnthropicToolResultContent,\n AnthropicUserMessage,\n AnthropicWebFetchToolResultContent,\n} from './anthropic-messages-api';\nimport { anthropicFilePartProviderOptions } from './anthropic-messages-options';\nimport { CacheControlValidator } from './get-cache-control';\nimport { codeExecution_20250522OutputSchema } from './tool/code-execution_20250522';\nimport { codeExecution_20250825OutputSchema } from './tool/code-execution_20250825';\nimport { toolSearchRegex_20251119OutputSchema as toolSearchOutputSchema } from './tool/tool-search-regex_20251119';\nimport { webFetch_20250910OutputSchema } from './tool/web-fetch-20250910';\nimport { webSearch_20250305OutputSchema } from './tool/web-search_20250305';\n\nfunction convertToString(data: LanguageModelV3DataContent): string {\n if (typeof data === 'string') {\n return Buffer.from(data, 'base64').toString('utf-8');\n }\n\n if (data instanceof Uint8Array) {\n return new TextDecoder().decode(data);\n }\n\n if (data instanceof URL) {\n throw new UnsupportedFunctionalityError({\n functionality: 'URL-based text documents are not supported for citations',\n });\n }\n\n throw new UnsupportedFunctionalityError({\n functionality: `unsupported data type for text documents: ${typeof data}`,\n });\n}\n\nexport async function convertToAnthropicMessagesPrompt({\n prompt,\n sendReasoning,\n warnings,\n cacheControlValidator,\n toolNameMapping,\n}: {\n prompt: LanguageModelV3Prompt;\n sendReasoning: boolean;\n warnings: SharedV3Warning[];\n cacheControlValidator?: CacheControlValidator;\n toolNameMapping: ToolNameMapping;\n}): Promise<{\n prompt: AnthropicMessagesPrompt;\n betas: Set<string>;\n}> {\n const betas = new Set<string>();\n const blocks = groupIntoBlocks(prompt);\n const validator = cacheControlValidator || new CacheControlValidator();\n\n let system: AnthropicMessagesPrompt['system'] = undefined;\n const messages: AnthropicMessagesPrompt['messages'] = [];\n\n async function shouldEnableCitations(\n providerMetadata: SharedV3ProviderMetadata | undefined,\n ): Promise<boolean> {\n const anthropicOptions = await parseProviderOptions({\n provider: 'anthropic',\n providerOptions: providerMetadata,\n schema: anthropicFilePartProviderOptions,\n });\n\n return anthropicOptions?.citations?.enabled ?? false;\n }\n\n async function getDocumentMetadata(\n providerMetadata: SharedV3ProviderMetadata | undefined,\n ): Promise<{ title?: string; context?: string }> {\n const anthropicOptions = await parseProviderOptions({\n provider: 'anthropic',\n providerOptions: providerMetadata,\n schema: anthropicFilePartProviderOptions,\n });\n\n return {\n title: anthropicOptions?.title,\n context: anthropicOptions?.context,\n };\n }\n\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n const isLastBlock = i === blocks.length - 1;\n const type = block.type;\n\n switch (type) {\n case 'system': {\n if (system != null) {\n throw new UnsupportedFunctionalityError({\n functionality:\n 'Multiple system messages that are separated by user/assistant messages',\n });\n }\n\n system = block.messages.map(({ content, providerOptions }) => ({\n type: 'text',\n text: content,\n cache_control: validator.getCacheControl(providerOptions, {\n type: 'system message',\n canCache: true,\n }),\n }));\n\n break;\n }\n\n case 'user': {\n // combines all user and tool messages in this block into a single message:\n const anthropicContent: AnthropicUserMessage['content'] = [];\n\n for (const message of block.messages) {\n const { role, content } = message;\n switch (role) {\n case 'user': {\n for (let j = 0; j < content.length; j++) {\n const part = content[j];\n\n // cache control: first add cache control from part.\n // for the last part of a message,\n // check also if the message has cache control.\n const isLastPart = j === content.length - 1;\n\n const cacheControl =\n validator.getCacheControl(part.providerOptions, {\n type: 'user message part',\n canCache: true,\n }) ??\n (isLastPart\n ? validator.getCacheControl(message.providerOptions, {\n type: 'user message',\n canCache: true,\n })\n : undefined);\n\n switch (part.type) {\n case 'text': {\n anthropicContent.push({\n type: 'text',\n text: part.text,\n cache_control: cacheControl,\n });\n break;\n }\n\n case 'file': {\n if (part.mediaType.startsWith('image/')) {\n anthropicContent.push({\n type: 'image',\n source:\n part.data instanceof URL\n ? {\n type: 'url',\n url: part.data.toString(),\n }\n : {\n type: 'base64',\n media_type:\n part.mediaType === 'image/*'\n ? 'image/jpeg'\n : part.mediaType,\n data: convertToBase64(part.data),\n },\n cache_control: cacheControl,\n });\n } else if (part.mediaType === 'application/pdf') {\n betas.add('pdfs-2024-09-25');\n\n const enableCitations = await shouldEnableCitations(\n part.providerOptions,\n );\n\n const metadata = await getDocumentMetadata(\n part.providerOptions,\n );\n\n anthropicContent.push({\n type: 'document',\n source:\n part.data instanceof URL\n ? {\n type: 'url',\n url: part.data.toString(),\n }\n : {\n type: 'base64',\n media_type: 'application/pdf',\n data: convertToBase64(part.data),\n },\n title: metadata.title ?? part.filename,\n ...(metadata.context && { context: metadata.context }),\n ...(enableCitations && {\n citations: { enabled: true },\n }),\n cache_control: cacheControl,\n });\n } else if (part.mediaType === 'text/plain') {\n const enableCitations = await shouldEnableCitations(\n part.providerOptions,\n );\n\n const metadata = await getDocumentMetadata(\n part.providerOptions,\n );\n\n anthropicContent.push({\n type: 'document',\n source:\n part.data instanceof URL\n ? {\n type: 'url',\n url: part.data.toString(),\n }\n : {\n type: 'text',\n media_type: 'text/plain',\n data: convertToString(part.data),\n },\n title: metadata.title ?? part.filename,\n ...(metadata.context && { context: metadata.context }),\n ...(enableCitations && {\n citations: { enabled: true },\n }),\n cache_control: cacheControl,\n });\n } else {\n throw new UnsupportedFunctionalityError({\n functionality: `media type: ${part.mediaType}`,\n });\n }\n\n break;\n }\n }\n }\n\n break;\n }\n case 'tool': {\n for (let i = 0; i < content.length; i++) {\n const part = content[i];\n\n // cache control: first add cache control from part.\n // for the last part of a message,\n // check also if the message has cache control.\n const isLastPart = i === content.length - 1;\n\n const cacheControl =\n validator.getCacheControl(part.providerOptions, {\n type: 'tool result part',\n canCache: true,\n }) ??\n (isLastPart\n ? validator.getCacheControl(message.providerOptions, {\n type: 'tool result message',\n canCache: true,\n })\n : undefined);\n\n const output = part.output;\n let contentValue: AnthropicToolResultContent['content'];\n switch (output.type) {\n case 'content':\n contentValue = output.value\n .map(contentPart => {\n switch (contentPart.type) {\n case 'text':\n return {\n type: 'text' as const,\n text: contentPart.text,\n };\n case 'image-data': {\n return {\n type: 'image' as const,\n source: {\n type: 'base64' as const,\n media_type: contentPart.mediaType,\n data: contentPart.data,\n },\n };\n }\n case 'image-url': {\n return {\n type: 'image' as const,\n source: {\n type: 'url' as const,\n url: contentPart.url,\n },\n };\n }\n case 'file-url': {\n return {\n type: 'document' as const,\n source: {\n type: 'url' as const,\n url: contentPart.url,\n },\n };\n }\n case 'file-data': {\n if (contentPart.mediaType === 'application/pdf') {\n betas.add('pdfs-2024-09-25');\n return {\n type: 'document' as const,\n source: {\n type: 'base64' as const,\n media_type: contentPart.mediaType,\n data: contentPart.data,\n },\n };\n }\n\n warnings.push({\n type: 'other',\n message: `unsupported tool content part type: ${contentPart.type} with media type: ${contentPart.mediaType}`,\n });\n\n return undefined;\n }\n default: {\n warnings.push({\n type: 'other',\n message: `unsupported tool content part type: ${contentPart.type}`,\n });\n\n return undefined;\n }\n }\n })\n .filter(isNonNullable);\n break;\n case 'text':\n case 'error-text':\n contentValue = output.value;\n break;\n case 'execution-denied':\n contentValue = output.reason ?? 'Tool execution denied.';\n break;\n case 'json':\n case 'error-json':\n default:\n contentValue = JSON.stringify(output.value);\n break;\n }\n\n anthropicContent.push({\n type: 'tool_result',\n tool_use_id: part.toolCallId,\n content: contentValue,\n is_error:\n output.type === 'error-text' || output.type === 'error-json'\n ? true\n : undefined,\n cache_control: cacheControl,\n });\n }\n\n break;\n }\n default: {\n const _exhaustiveCheck: never = role;\n throw new Error(`Unsupported role: ${_exhaustiveCheck}`);\n }\n }\n }\n\n messages.push({ role: 'user', content: anthropicContent });\n\n break;\n }\n\n case 'assistant': {\n // combines multiple assistant messages in this block into a single message:\n const anthropicContent: AnthropicAssistantMessage['content'] = [];\n\n const mcpToolUseIds = new Set<string>();\n\n for (let j = 0; j < block.messages.length; j++) {\n const message = block.messages[j];\n const isLastMessage = j === block.messages.length - 1;\n const { content } = message;\n\n for (let k = 0; k < content.length; k++) {\n const part = content[k];\n const isLastContentPart = k === content.length - 1;\n\n // cache control: first add cache control from part.\n // for the last part of a message,\n // check also if the message has cache control.\n const cacheControl =\n validator.getCacheControl(part.providerOptions, {\n type: 'assistant message part',\n canCache: true,\n }) ??\n (isLastContentPart\n ? validator.getCacheControl(message.providerOptions, {\n type: 'assistant message',\n canCache: true,\n })\n : undefined);\n\n switch (part.type) {\n case 'text': {\n anthropicContent.push({\n type: 'text',\n text:\n // trim the last text part if it's the last message in the block\n // because Anthropic does not allow trailing whitespace\n // in pre-filled assistant responses\n isLastBlock && isLastMessage && isLastContentPart\n ? part.text.trim()\n : part.text,\n\n cache_control: cacheControl,\n });\n break;\n }\n\n case 'reasoning': {\n if (sendReasoning) {\n const reasoningMetadata = await parseProviderOptions({\n provider: 'anthropic',\n providerOptions: part.providerOptions,\n schema: anthropicReasoningMetadataSchema,\n });\n\n if (reasoningMetadata != null) {\n if (reasoningMetadata.signature != null) {\n // Note: thinking blocks cannot have cache_control directly\n // They are cached implicitly when in previous assistant turns\n // Validate to provide helpful error message\n validator.getCacheControl(part.providerOptions, {\n type: 'thinking block',\n canCache: false,\n });\n anthropicContent.push({\n type: 'thinking',\n thinking: part.text,\n signature: reasoningMetadata.signature,\n });\n } else if (reasoningMetadata.redactedData != null) {\n // Note: redacted thinking blocks cannot have cache_control directly\n // They are cached implicitly when in previous assistant turns\n // Validate to provide helpful error message\n validator.getCacheControl(part.providerOptions, {\n type: 'redacted thinking block',\n canCache: false,\n });\n anthropicContent.push({\n type: 'redacted_thinking',\n data: reasoningMetadata.redactedData,\n });\n } else {\n warnings.push({\n type: 'other',\n message: 'unsupported reasoning metadata',\n });\n }\n } else {\n warnings.push({\n type: 'other',\n message: 'unsupported reasoning metadata',\n });\n }\n } else {\n warnings.push({\n type: 'other',\n message:\n 'sending reasoning content is disabled for this model',\n });\n }\n break;\n }\n\n case 'tool-call': {\n if (part.providerExecuted) {\n const providerToolName = toolNameMapping.toProviderToolName(\n part.toolName,\n );\n const isMcpToolUse =\n part.providerOptions?.anthropic?.type === 'mcp-tool-use';\n\n if (isMcpToolUse) {\n mcpToolUseIds.add(part.toolCallId);\n\n const serverName =\n part.providerOptions?.anthropic?.serverName;\n\n if (serverName == null || typeof serverName !== 'string') {\n warnings.push({\n type: 'other',\n message:\n 'mcp tool use server name is required and must be a string',\n });\n break;\n }\n\n anthropicContent.push({\n type: 'mcp_tool_use',\n id: part.toolCallId,\n name: part.toolName,\n input: part.input,\n server_name: serverName,\n cache_control: cacheControl,\n });\n } else if (\n // code execution 20250825:\n providerToolName === 'code_execution' &&\n part.input != null &&\n typeof part.input === 'object' &&\n 'type' in part.input &&\n typeof part.input.type === 'string' &&\n (part.input.type === 'bash_code_execution' ||\n part.input.type === 'text_editor_code_execution')\n ) {\n anthropicContent.push({\n type: 'server_tool_use',\n id: part.toolCallId,\n name: part.input.type, // map back to subtool name\n input: part.input,\n cache_control: cacheControl,\n });\n } else if (\n // code execution 20250825 programmatic tool calling:\n // Strip the fake 'programmatic-tool-call' type before sending to Anthropic\n providerToolName === 'code_execution' &&\n part.input != null &&\n typeof part.input === 'object' &&\n 'type' in part.input &&\n part.input.type === 'programmatic-tool-call'\n ) {\n const { type: _, ...inputWithoutType } = part.input as {\n type: string;\n code: string;\n };\n anthropicContent.push({\n type: 'server_tool_use',\n id: part.toolCallId,\n name: 'code_execution',\n input: inputWithoutType,\n cache_control: cacheControl,\n });\n } else {\n if (\n providerToolName === 'code_execution' || // code execution 20250522\n providerToolName === 'web_fetch' ||\n providerToolName === 'web_search'\n ) {\n anthropicContent.push({\n type: 'server_tool_use',\n id: part.toolCallId,\n name: providerToolName,\n input: part.input,\n cache_control: cacheControl,\n });\n } else if (\n providerToolName === 'tool_search_tool_regex' ||\n providerToolName === 'tool_search_tool_bm25'\n ) {\n anthropicContent.push({\n type: 'server_tool_use',\n id: part.toolCallId,\n name: providerToolName,\n input: part.input,\n cache_control: cacheControl,\n });\n } else {\n warnings.push({\n type: 'other',\n message: `provider executed tool call for tool ${part.toolName} is not supported`,\n });\n }\n }\n\n break;\n }\n\n // Extract caller info from provider options for programmatic tool calling\n const callerOptions = part.providerOptions?.anthropic as\n | { caller?: { type: string; toolId?: string } }\n | undefined;\n const caller = callerOptions?.caller\n ? callerOptions.caller.type === 'code_execution_20250825' &&\n callerOptions.caller.toolId\n ? {\n type: 'code_execution_20250825' as const,\n tool_id: callerOptions.caller.toolId,\n }\n : callerOptions.caller.type === 'direct'\n ? { type: 'direct' as const }\n : undefined\n : undefined;\n\n anthropicContent.push({\n type: 'tool_use',\n id: part.toolCallId,\n name: part.toolName,\n input: part.input,\n ...(caller && { caller }),\n cache_control: cacheControl,\n });\n break;\n }\n\n case 'tool-result': {\n const providerToolName = toolNameMapping.toProviderToolName(\n part.toolName,\n );\n\n if (mcpToolUseIds.has(part.toolCallId)) {\n const output = part.output;\n\n if (output.type !== 'json' && output.type !== 'error-json') {\n warnings.push({\n type: 'other',\n message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`,\n });\n\n break;\n }\n\n anthropicContent.push({\n type: 'mcp_tool_result',\n tool_use_id: part.toolCallId,\n is_error: output.type === 'error-json',\n content: output.value as unknown as\n | string\n | Array<{ type: 'text'; text: string }>,\n cache_control: cacheControl,\n });\n } else if (providerToolName === 'code_execution') {\n const output = part.output;\n\n // Handle error types for code_execution tools (e.g., from programmatic tool calling)\n if (\n output.type === 'error-text' ||\n output.type === 'error-json'\n ) {\n let errorInfo: { type?: string; errorCode?: string } = {};\n try {\n if (typeof output.value === 'string') {\n errorInfo = JSON.parse(output.value);\n } else if (\n typeof output.value === 'object' &&\n output.value !== null\n ) {\n errorInfo = output.value as typeof errorInfo;\n }\n } catch {}\n\n if (errorInfo.type === 'code_execution_tool_result_error') {\n anthropicContent.push({\n type: 'code_execution_tool_result',\n tool_use_id: part.toolCallId,\n content: {\n type: 'code_execution_tool_result_error' as const,\n error_code: errorInfo.errorCode ?? 'unknown',\n },\n cache_control: cacheControl,\n });\n } else {\n anthropicContent.push({\n type: 'bash_code_execution_tool_result',\n tool_use_id: part.toolCallId,\n cache_control: cacheControl,\n content: {\n type: 'bash_code_execution_tool_result_error' as const,\n error_code: errorInfo.errorCode ?? 'unknown',\n },\n });\n }\n break;\n }\n\n if (output.type !== 'json') {\n warnings.push({\n type: 'other',\n message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`,\n });\n\n break;\n }\n\n if (\n output.value == null ||\n typeof output.value !== 'object' ||\n !('type' in output.value) ||\n typeof output.value.type !== 'string'\n ) {\n warnings.push({\n type: 'other',\n message: `provider executed tool result output value is not a valid code execution result for tool ${part.toolName}`,\n });\n break;\n }\n\n // to distinguish between code execution 20250522 and 20250825,\n // we check if a type property is present in the output.value\n if (output.value.type === 'code_execution_result') {\n // code execution 20250522\n const codeExecutionOutput = await validateTypes({\n value: output.value,\n schema: codeExecution_20250522OutputSchema,\n });\n\n anthropicContent.push({\n type: 'code_execution_tool_result',\n tool_use_id: part.toolCallId,\n content: {\n type: codeExecutionOutput.type,\n stdout: codeExecutionOutput.stdout,\n stderr: codeExecutionOutput.stderr,\n return_code: codeExecutionOutput.return_code,\n content: codeExecutionOutput.content ?? [],\n },\n cache_control: cacheControl,\n });\n } else {\n // code execution 20250825\n const codeExecutionOutput = await validateTypes({\n value: output.value,\n schema: codeExecution_20250825OutputSchema,\n });\n\n if (codeExecutionOutput.type === 'code_execution_result') {\n // Programmatic tool calling result - same format as 20250522\n anthropicContent.push({\n type: 'code_execution_tool_result',\n tool_use_id: part.toolCallId,\n content: {\n type: codeExecutionOutput.type,\n stdout: codeExecutionOutput.stdout,\n stderr: codeExecutionOutput.stderr,\n return_code: codeExecutionOutput.return_code,\n content: codeExecutionOutput.content ?? [],\n },\n cache_control: cacheControl,\n });\n } else if (\n codeExecutionOutput.type ===\n 'bash_code_execution_result' ||\n codeExecutionOutput.type ===\n 'bash_code_execution_tool_result_error'\n ) {\n anthropicContent.push({\n type: 'bash_code_execution_tool_result',\n tool_use_id: part.toolCallId,\n cache_control: cacheControl,\n content: codeExecutionOutput,\n });\n } else {\n anthropicContent.push({\n type: 'text_editor_code_execution_tool_result',\n tool_use_id: part.toolCallId,\n cache_control: cacheControl,\n content: codeExecutionOutput,\n });\n }\n }\n break;\n }\n\n if (providerToolName === 'web_fetch') {\n const output = part.output;\n\n if (output.type !== 'json') {\n warnings.push({\n type: 'other',\n message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`,\n });\n\n break;\n }\n\n const webFetchOutput = await validateTypes({\n value: output.value,\n schema: webFetch_20250910OutputSchema,\n });\n\n anthropicContent.push({\n type: 'web_fetch_tool_result',\n tool_use_id: part.toolCallId,\n content: {\n type: 'web_fetch_result',\n url: webFetchOutput.url,\n retrieved_at: webFetchOutput.retrievedAt,\n content: {\n type: 'document',\n title: webFetchOutput.content.title,\n citations: webFetchOutput.content.citations,\n source: {\n type: webFetchOutput.content.source.type,\n media_type: webFetchOutput.content.source.mediaType,\n data: webFetchOutput.content.source.data,\n } as AnthropicWebFetchToolResultContent['content']['content']['source'],\n },\n },\n cache_control: cacheControl,\n });\n\n break;\n }\n\n if (providerToolName === 'web_search') {\n const output = part.output;\n\n if (output.type !== 'json') {\n warnings.push({\n type: 'other',\n message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`,\n });\n\n break;\n }\n\n const webSearchOutput = await validateTypes({\n value: output.value,\n schema: webSearch_20250305OutputSchema,\n });\n\n anthropicContent.push({\n type: 'web_search_tool_result',\n tool_use_id: part.toolCallId,\n content: webSearchOutput.map(result => ({\n url: result.url,\n title: result.title,\n page_age: result.pageAge,\n encrypted_content: result.encryptedContent,\n type: result.type,\n })),\n cache_control: cacheControl,\n });\n\n break;\n }\n\n if (\n providerToolName === 'tool_search_tool_regex' ||\n providerToolName === 'tool_search_tool_bm25'\n ) {\n const output = part.output;\n\n if (output.type !== 'json') {\n warnings.push({\n type: 'other',\n message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`,\n });\n\n break;\n }\n\n const toolSearchOutput = await validateTypes({\n value: output.value,\n schema: toolSearchOutputSchema,\n });\n\n // Convert tool references back to API format\n const toolReferences = toolSearchOutput.map(ref => ({\n type: 'tool_reference' as const,\n tool_name: ref.toolName,\n }));\n\n anthropicContent.push({\n type: 'tool_search_tool_result',\n tool_use_id: part.toolCallId,\n content: {\n type: 'tool_search_tool_search_result',\n tool_references: toolReferences,\n },\n cache_control: cacheControl,\n });\n\n break;\n }\n\n warnings.push({\n type: 'other',\n message: `provider executed tool result for tool ${part.toolName} is not supported`,\n });\n\n break;\n }\n }\n }\n }\n\n messages.push({ role: 'assistant', content: anthropicContent });\n\n break;\n }\n\n default: {\n const _exhaustiveCheck: never = type;\n throw new Error(`content type: ${_exhaustiveCheck}`);\n }\n }\n }\n\n return {\n prompt: { system, messages },\n betas,\n };\n}\n\ntype SystemBlock = {\n type: 'system';\n messages: Array<LanguageModelV3Message & { role: 'system' }>;\n};\ntype AssistantBlock = {\n type: 'assistant';\n messages: Array<LanguageModelV3Message & { role: 'assistant' }>;\n};\ntype UserBlock = {\n type: 'user';\n messages: Array<LanguageModelV3Message & { role: 'user' | 'tool' }>;\n};\n\nfunction groupIntoBlocks(\n prompt: LanguageModelV3Prompt,\n): Array<SystemBlock | AssistantBlock | UserBlock> {\n const blocks: Array<SystemBlock | AssistantBlock | UserBlock> = [];\n let currentBlock: SystemBlock | AssistantBlock | UserBlock | undefined =\n undefined;\n\n for (const message of prompt) {\n const { role } = message;\n switch (role) {\n case 'system': {\n if (currentBlock?.type !== 'system') {\n currentBlock = { type: 'system', messages: [] };\n blocks.push(currentBlock);\n }\n\n currentBlock.messages.push(message);\n break;\n }\n case 'assistant': {\n if (currentBlock?.type !== 'assistant') {\n currentBlock = { type: 'assistant', messages: [] };\n blocks.push(currentBlock);\n }\n\n currentBlock.messages.push(message);\n break;\n }\n case 'user': {\n if (currentBlock?.type !== 'user') {\n currentBlock = { type: 'user', messages: [] };\n blocks.push(currentBlock);\n }\n\n currentBlock.messages.push(message);\n break;\n }\n case 'tool': {\n if (currentBlock?.type !== 'user') {\n currentBlock = { type: 'user', messages: [] };\n blocks.push(currentBlock);\n }\n\n currentBlock.messages.push(message);\n break;\n }\n default: {\n const _exhaustiveCheck: never = role;\n throw new Error(`Unsupported role: ${_exhaustiveCheck}`);\n }\n }\n }\n\n return blocks;\n}\n","import {\n createProviderToolFactoryWithOutputSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const codeExecution_20250522OutputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n type: z.literal('code_execution_result'),\n stdout: z.string(),\n stderr: z.string(),\n return_code: z.number(),\n content: z\n .array(\n z.object({\n type: z.literal('code_execution_output'),\n file_id: z.string(),\n }),\n )\n .optional()\n .default([]),\n }),\n ),\n);\n\nconst codeExecution_20250522InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n code: z.string(),\n }),\n ),\n);\n\nconst factory = createProviderToolFactoryWithOutputSchema<\n {\n /**\n * The Python code to execute.\n */\n code: string;\n },\n {\n type: 'code_execution_result';\n stdout: string;\n stderr: string;\n return_code: number;\n content: Array<{ type: 'code_execution_output'; file_id: string }>;\n },\n {}\n>({\n id: 'anthropic.code_execution_20250522',\n inputSchema: codeExecution_20250522InputSchema,\n outputSchema: codeExecution_20250522OutputSchema,\n});\n\nexport const codeExecution_20250522 = (\n args: Parameters<typeof factory>[0] = {},\n) => {\n return factory(args);\n};\n","import {\n createProviderToolFactoryWithOutputSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const codeExecution_20250825OutputSchema = lazySchema(() =>\n zodSchema(\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('code_execution_result'),\n stdout: z.string(),\n stderr: z.string(),\n return_code: z.number(),\n content: z\n .array(\n z.object({\n type: z.literal('code_execution_output'),\n file_id: z.string(),\n }),\n )\n .optional()\n .default([]),\n }),\n z.object({\n type: z.literal('bash_code_execution_result'),\n content: z.array(\n z.object({\n type: z.literal('bash_code_execution_output'),\n file_id: z.string(),\n }),\n ),\n stdout: z.string(),\n stderr: z.string(),\n return_code: z.number(),\n }),\n z.object({\n type: z.literal('bash_code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_tool_result_error'),\n error_code: z.string(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_view_result'),\n content: z.string(),\n file_type: z.string(),\n num_lines: z.number().nullable(),\n start_line: z.number().nullable(),\n total_lines: z.number().nullable(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_create_result'),\n is_file_update: z.boolean(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution_str_replace_result'),\n lines: z.array(z.string()).nullable(),\n new_lines: z.number().nullable(),\n new_start: z.number().nullable(),\n old_lines: z.number().nullable(),\n old_start: z.number().nullable(),\n }),\n ]),\n ),\n);\n\nexport const codeExecution_20250825InputSchema = lazySchema(() =>\n zodSchema(\n z.discriminatedUnion('type', [\n // Programmatic tool calling format (mapped from { code } by AI SDK)\n z.object({\n type: z.literal('programmatic-tool-call'),\n code: z.string(),\n }),\n z.object({\n type: z.literal('bash_code_execution'),\n command: z.string(),\n }),\n z.discriminatedUnion('command', [\n z.object({\n type: z.literal('text_editor_code_execution'),\n command: z.literal('view'),\n path: z.string(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution'),\n command: z.literal('create'),\n path: z.string(),\n file_text: z.string().nullish(),\n }),\n z.object({\n type: z.literal('text_editor_code_execution'),\n command: z.literal('str_replace'),\n path: z.string(),\n old_str: z.string(),\n new_str: z.string(),\n }),\n ]),\n ]),\n ),\n);\n\nconst factory = createProviderToolFactoryWithOutputSchema<\n | {\n type: 'programmatic-tool-call';\n /**\n * Programmatic tool calling: Python code to execute when code_execution\n * is used with allowedCallers to trigger client-executed tools.\n */\n code: string;\n }\n | {\n type: 'bash_code_execution';\n\n /**\n * Shell command to execute.\n */\n command: string;\n }\n | {\n type: 'text_editor_code_execution';\n command: 'view';\n\n /**\n * The path to the file to view.\n */\n path: string;\n }\n | {\n type: 'text_editor_code_execution';\n command: 'create';\n\n /**\n * The path to the file to edit.\n */\n path: string;\n\n /**\n * The text of the file to edit.\n */\n file_text?: string | null;\n }\n | {\n type: 'text_editor_code_execution';\n command: 'str_replace';\n\n /**\n * The path to the file to edit.\n */\n path: string;\n\n /**\n * The string to replace.\n */\n old_str: string;\n\n /**\n * The new string to replace the old string with.\n */\n new_str: string;\n },\n | {\n /**\n * Programmatic tool calling result: returned when code_execution runs code\n * that calls client-executed tools via allowedCallers.\n */\n type: 'code_execution_result';\n\n /**\n * Output from successful execution\n */\n stdout: string;\n\n /**\n * Error messages if execution fails\n */\n stderr: string;\n\n /**\n * 0 for success, non-zero for failure\n */\n return_code: number;\n\n /**\n * Output file Id list\n */\n content: Array<{ type: 'code_execution_output'; file_id: string }>;\n }\n | {\n type: 'bash_code_execution_result';\n\n /**\n * Output file Id list\n */\n content: Array<{\n type: 'bash_code_execution_output';\n file_id: string;\n }>;\n\n /**\n * Output from successful execution\n */\n stdout: string;\n\n /**\n * Error messages if execution fails\n */\n stderr: string;\n\n /**\n * 0 for success, non-zero for failure\n */\n return_code: number;\n }\n | {\n type: 'bash_code_execution_tool_result_error';\n\n /**\n * Available options: invalid_tool_input, unavailable, too_many_requests,\n * execution_time_exceeded, output_file_too_large.\n */\n error_code: string;\n }\n | {\n type: 'text_editor_code_execution_tool_result_error';\n\n /**\n * Available options: invalid_tool_input, unavailable, too_many_requests,\n * execution_time_exceeded, file_not_found.\n */\n error_code: string;\n }\n | {\n type: 'text_editor_code_execution_view_result';\n\n content: string;\n\n /**\n * The type of the file. Available options: text, image, pdf.\n */\n file_type: string;\n\n num_lines: number | null;\n start_line: number | null;\n total_lines: number | null;\n }\n | {\n type: 'text_editor_code_execution_create_result';\n\n is_file_update: boolean;\n }\n | {\n type: 'text_editor_code_execution_str_replace_result';\n\n lines: string[] | null;\n new_lines: number | null;\n new_start: number | null;\n old_lines: number | null;\n old_start: number | null;\n },\n {\n // no arguments\n }\n>({\n id: 'anthropic.code_execution_20250825',\n inputSchema: codeExecution_20250825InputSchema,\n outputSchema: codeExecution_20250825OutputSchema,\n // Programmatic tool calling: tool results may be deferred to a later turn\n // when code execution triggers a client-executed tool that needs to be\n // resolved before the code execution result can be returned.\n supportsDeferredResults: true,\n});\n\nexport const codeExecution_20250825 = (\n args: Parameters<typeof factory>[0] = {},\n) => {\n return factory(args);\n};\n","import {\n createProviderToolFactoryWithOutputSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\n/**\n * Output schema for tool search results - returns tool references\n * that are automatically expanded into full tool definitions by the API.\n */\nexport const toolSearchRegex_20251119OutputSchema = lazySchema(() =>\n zodSchema(\n z.array(\n z.object({\n type: z.literal('tool_reference'),\n toolName: z.string(),\n }),\n ),\n ),\n);\n\n/**\n * Input schema for regex-based tool search.\n * Claude constructs regex patterns using Python's re.search() syntax.\n */\nconst toolSearchRegex_20251119InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n /**\n * A regex pattern to search for tools.\n * Uses Python re.search() syntax. Maximum 200 characters.\n *\n * Examples:\n * - \"weather\" - matches tool names/descriptions containing \"weather\"\n * - \"get_.*_data\" - matches tools like get_user_data, get_weather_data\n * - \"database.*query|query.*database\" - OR patterns for flexibility\n * - \"(?i)slack\" - case-insensitive search\n */\n pattern: z.string(),\n /**\n * Maximum number of tools to return. Optional.\n */\n limit: z.number().optional(),\n }),\n ),\n);\n\nconst factory = createProviderToolFactoryWithOutputSchema<\n {\n /**\n * A regex pattern to search for tools.\n * Uses Python re.search() syntax. Maximum 200 characters.\n *\n * Examples:\n * - \"weather\" - matches tool names/descriptions containing \"weather\"\n * - \"get_.*_data\" - matches tools like get_user_data, get_weather_data\n * - \"database.*query|query.*database\" - OR patterns for flexibility\n * - \"(?i)slack\" - case-insensitive search\n */\n pattern: string;\n /**\n * Maximum number of tools to return. Optional.\n */\n limit?: number;\n },\n Array<{\n type: 'tool_reference';\n /**\n * The name of the discovered tool.\n */\n toolName: string;\n }>,\n {}\n>({\n id: 'anthropic.tool_search_regex_20251119',\n inputSchema: toolSearchRegex_20251119InputSchema,\n outputSchema: toolSearchRegex_20251119OutputSchema,\n});\n\n/**\n * Creates a tool search tool that uses regex patterns to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand. Instead of loading all\n * tool definitions into the context window upfront, Claude searches your tool\n * catalog and loads only the tools it needs.\n *\n * When Claude uses this tool, it constructs regex patterns using Python's\n * re.search() syntax (NOT natural language queries).\n *\n * **Important**: This tool should never have `deferLoading: true` in providerOptions.\n *\n * @example\n * ```ts\n * import { anthropicTools } from '@ai-sdk/anthropic';\n *\n * const tools = {\n * toolSearch: anthropicTools.toolSearchRegex_20251119(),\n * // Other tools with deferLoading...\n * };\n * ```\n *\n * @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-search-tool\n */\nexport const toolSearchRegex_20251119 = (\n args: Parameters<typeof factory>[0] = {},\n) => {\n return factory(args);\n};\n","import { LanguageModelV3FinishReason } from '@ai-sdk/provider';\n\n/**\n * @see https://docs.anthropic.com/en/api/messages#response-stop-reason\n */\nexport function mapAnthropicStopReason({\n finishReason,\n isJsonResponseFromTool,\n}: {\n finishReason: string | null | undefined;\n isJsonResponseFromTool?: boolean;\n}): LanguageModelV3FinishReason['unified'] {\n switch (finishReason) {\n case 'pause_turn':\n case 'end_turn':\n case 'stop_sequence':\n return 'stop';\n case 'refusal':\n return 'content-filter';\n case 'tool_use':\n return isJsonResponseFromTool ? 'stop' : 'tool-calls';\n case 'max_tokens':\n case 'model_context_window_exceeded':\n return 'length';\n default:\n return 'other';\n }\n}\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst bash_20241022InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n command: z.string(),\n restart: z.boolean().optional(),\n }),\n ),\n);\n\nexport const bash_20241022 = createProviderToolFactory<\n {\n /**\n * The bash command to run. Required unless the tool is being restarted.\n */\n command: string;\n\n /**\n * Specifying true will restart this tool. Otherwise, leave this unspecified.\n */\n restart?: boolean;\n },\n {}\n>({\n id: 'anthropic.bash_20241022',\n inputSchema: bash_20241022InputSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst bash_20250124InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n command: z.string(),\n restart: z.boolean().optional(),\n }),\n ),\n);\n\nexport const bash_20250124 = createProviderToolFactory<\n {\n /**\n * The bash command to run. Required unless the tool is being restarted.\n */\n command: string;\n\n /**\n * Specifying true will restart this tool. Otherwise, leave this unspecified.\n */\n restart?: boolean;\n },\n {}\n>({\n id: 'anthropic.bash_20250124',\n inputSchema: bash_20250124InputSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst computer_20241022InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n action: z.enum([\n 'key',\n 'type',\n 'mouse_move',\n 'left_click',\n 'left_click_drag',\n 'right_click',\n 'middle_click',\n 'double_click',\n 'screenshot',\n 'cursor_position',\n ]),\n coordinate: z.array(z.number().int()).optional(),\n text: z.string().optional(),\n }),\n ),\n);\n\nexport const computer_20241022 = createProviderToolFactory<\n {\n /**\n * The action to perform. The available actions are:\n * - `key`: Press a key or key-combination on the keyboard.\n * - This supports xdotool's `key` syntax.\n * - Examples: \"a\", \"Return\", \"alt+Tab\", \"ctrl+s\", \"Up\", \"KP_0\" (for the numpad 0 key).\n * - `type`: Type a string of text on the keyboard.\n * - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.\n * - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.\n * - `left_click`: Click the left mouse button.\n * - `left_click_drag`: Click and drag the cursor to a specified (x, y) pixel coordinate on the screen.\n * - `right_click`: Click the right mouse button.\n * - `middle_click`: Click the middle mouse button.\n * - `double_click`: Double-click the left mouse button.\n * - `screenshot`: Take a screenshot of the screen.\n */\n action:\n | 'key'\n | 'type'\n | 'mouse_move'\n | 'left_click'\n | 'left_click_drag'\n | 'right_click'\n | 'middle_click'\n | 'double_click'\n | 'screenshot'\n | 'cursor_position';\n\n /**\n * (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=mouse_move` and `action=left_click_drag`.\n */\n coordinate?: number[];\n\n /**\n * Required only by `action=type` and `action=key`.\n */\n text?: string;\n },\n {\n /**\n * The width of the display being controlled by the model in pixels.\n */\n displayWidthPx: number;\n\n /**\n * The height of the display being controlled by the model in pixels.\n */\n displayHeightPx: number;\n\n /**\n * The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.\n */\n displayNumber?: number;\n }\n>({\n id: 'anthropic.computer_20241022',\n inputSchema: computer_20241022InputSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst computer_20250124InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n action: z.enum([\n 'key',\n 'hold_key',\n 'type',\n 'cursor_position',\n 'mouse_move',\n 'left_mouse_down',\n 'left_mouse_up',\n 'left_click',\n 'left_click_drag',\n 'right_click',\n 'middle_click',\n 'double_click',\n 'triple_click',\n 'scroll',\n 'wait',\n 'screenshot',\n ]),\n coordinate: z.tuple([z.number().int(), z.number().int()]).optional(),\n duration: z.number().optional(),\n scroll_amount: z.number().optional(),\n scroll_direction: z.enum(['up', 'down', 'left', 'right']).optional(),\n start_coordinate: z\n .tuple([z.number().int(), z.number().int()])\n .optional(),\n text: z.string().optional(),\n }),\n ),\n);\n\nexport const computer_20250124 = createProviderToolFactory<\n {\n /**\n * - `key`: Press a key or key-combination on the keyboard.\n * - This supports xdotool's `key` syntax.\n * - Examples: \"a\", \"Return\", \"alt+Tab\", \"ctrl+s\", \"Up\", \"KP_0\" (for the numpad 0 key).\n * - `hold_key`: Hold down a key or multiple keys for a specified duration (in seconds). Supports the same syntax as `key`.\n * - `type`: Type a string of text on the keyboard.\n * - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.\n * - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.\n * - `left_mouse_down`: Press the left mouse button.\n * - `left_mouse_up`: Release the left mouse button.\n * - `left_click`: Click the left mouse button at the specified (x, y) pixel coordinate on the screen. You can also include a key combination to hold down while clicking using the `text` parameter.\n * - `left_click_drag`: Click and drag the cursor from `start_coordinate` to a specified (x, y) pixel coordinate on the screen.\n * - `right_click`: Click the right mouse button at the specified (x, y) pixel coordinate on the screen.\n * - `middle_click`: Click the middle mouse button at the specified (x, y) pixel coordinate on the screen.\n * - `double_click`: Double-click the left mouse button at the specified (x, y) pixel coordinate on the screen.\n * - `triple_click`: Triple-click the left mouse button at the specified (x, y) pixel coordinate on the screen.\n * - `scroll`: Scroll the screen in a specified direction by a specified amount of clicks of the scroll wheel, at the specified (x, y) pixel coordinate. DO NOT use PageUp/PageDown to scroll.\n * - `wait`: Wait for a specified duration (in seconds).\n * - `screenshot`: Take a screenshot of the screen.\n */\n action:\n | 'key'\n | 'hold_key'\n | 'type'\n | 'cursor_position'\n | 'mouse_move'\n | 'left_mouse_down'\n | 'left_mouse_up'\n | 'left_click'\n | 'left_click_drag'\n | 'right_click'\n | 'middle_click'\n | 'double_click'\n | 'triple_click'\n | 'scroll'\n | 'wait'\n | 'screenshot';\n\n /**\n * (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=mouse_move` and `action=left_click_drag`.\n */\n coordinate?: [number, number];\n\n /**\n * The duration to hold the key down for. Required only by `action=hold_key` and `action=wait`.\n */\n duration?: number;\n\n /**\n * The number of 'clicks' to scroll. Required only by `action=scroll`.\n */\n scroll_amount?: number;\n\n /**\n * The direction to scroll the screen. Required only by `action=scroll`.\n */\n scroll_direction?: 'up' | 'down' | 'left' | 'right';\n\n /**\n * (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to start the drag from. Required only by `action=left_click_drag`.\n */\n start_coordinate?: [number, number];\n\n /**\n * Required only by `action=type`, `action=key`, and `action=hold_key`. Can also be used by click or scroll actions to hold down keys while clicking or scrolling.\n */\n text?: string;\n },\n {\n /**\n * The width of the display being controlled by the model in pixels.\n */\n displayWidthPx: number;\n\n /**\n * The height of the display being controlled by the model in pixels.\n */\n displayHeightPx: number;\n\n /**\n * The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.\n */\n displayNumber?: number;\n }\n>({\n id: 'anthropic.computer_20250124',\n inputSchema: computer_20250124InputSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst memory_20250818InputSchema = lazySchema(() =>\n zodSchema(\n z.discriminatedUnion('command', [\n z.object({\n command: z.literal('view'),\n path: z.string(),\n view_range: z.tuple([z.number(), z.number()]).optional(),\n }),\n z.object({\n command: z.literal('create'),\n path: z.string(),\n file_text: z.string(),\n }),\n z.object({\n command: z.literal('str_replace'),\n path: z.string(),\n old_str: z.string(),\n new_str: z.string(),\n }),\n z.object({\n command: z.literal('insert'),\n path: z.string(),\n insert_line: z.number(),\n insert_text: z.string(),\n }),\n z.object({\n command: z.literal('delete'),\n path: z.string(),\n }),\n z.object({\n command: z.literal('rename'),\n old_path: z.string(),\n new_path: z.string(),\n }),\n ]),\n ),\n);\n\nexport const memory_20250818 = createProviderToolFactory<\n | { command: 'view'; path: string; view_range?: [number, number] }\n | { command: 'create'; path: string; file_text: string }\n | { command: 'str_replace'; path: string; old_str: string; new_str: string }\n | {\n command: 'insert';\n path: string;\n insert_line: number;\n insert_text: string;\n }\n | { command: 'delete'; path: string }\n | { command: 'rename'; old_path: string; new_path: string },\n {}\n>({\n id: 'anthropic.memory_20250818',\n inputSchema: memory_20250818InputSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst textEditor_20241022InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n command: z.enum(['view', 'create', 'str_replace', 'insert', 'undo_edit']),\n path: z.string(),\n file_text: z.string().optional(),\n insert_line: z.number().int().optional(),\n new_str: z.string().optional(),\n old_str: z.string().optional(),\n view_range: z.array(z.number().int()).optional(),\n }),\n ),\n);\n\nexport const textEditor_20241022 = createProviderToolFactory<\n {\n /**\n * The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`.\n */\n command: 'view' | 'create' | 'str_replace' | 'insert' | 'undo_edit';\n\n /**\n * Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.\n */\n path: string;\n\n /**\n * Required parameter of `create` command, with the content of the file to be created.\n */\n file_text?: string;\n\n /**\n * Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.\n */\n insert_line?: number;\n\n /**\n * Optional parameter of `str_replace` command containing the new string (if not given, no string will be added). Required parameter of `insert` command containing the string to insert.\n */\n new_str?: string;\n\n /**\n * Required parameter of `str_replace` command containing the string in `path` to replace.\n */\n old_str?: string;\n\n /**\n * Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.\n */\n view_range?: number[];\n },\n {}\n>({\n id: 'anthropic.text_editor_20241022',\n inputSchema: textEditor_20241022InputSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst textEditor_20250124InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n command: z.enum(['view', 'create', 'str_replace', 'insert', 'undo_edit']),\n path: z.string(),\n file_text: z.string().optional(),\n insert_line: z.number().int().optional(),\n new_str: z.string().optional(),\n old_str: z.string().optional(),\n view_range: z.array(z.number().int()).optional(),\n }),\n ),\n);\n\nexport const textEditor_20250124 = createProviderToolFactory<\n {\n /**\n * The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`.\n */\n command: 'view' | 'create' | 'str_replace' | 'insert' | 'undo_edit';\n\n /**\n * Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.\n */\n path: string;\n\n /**\n * Required parameter of `create` command, with the content of the file to be created.\n */\n file_text?: string;\n\n /**\n * Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.\n */\n insert_line?: number;\n\n /**\n * Optional parameter of `str_replace` command containing the new string (if not given, no string will be added). Required parameter of `insert` command containing the string to insert.\n */\n new_str?: string;\n\n /**\n * Required parameter of `str_replace` command containing the string in `path` to replace.\n */\n old_str?: string;\n\n /**\n * Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.\n */\n view_range?: number[];\n },\n {}\n>({\n id: 'anthropic.text_editor_20250124',\n inputSchema: textEditor_20250124InputSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst textEditor_20250429InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n command: z.enum(['view', 'create', 'str_replace', 'insert']),\n path: z.string(),\n file_text: z.string().optional(),\n insert_line: z.number().int().optional(),\n new_str: z.string().optional(),\n old_str: z.string().optional(),\n view_range: z.array(z.number().int()).optional(),\n }),\n ),\n);\n\nexport const textEditor_20250429 = createProviderToolFactory<\n {\n /**\n * The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`.\n * Note: `undo_edit` is not supported in Claude 4 models.\n */\n command: 'view' | 'create' | 'str_replace' | 'insert';\n\n /**\n * Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.\n */\n path: string;\n\n /**\n * Required parameter of `create` command, with the content of the file to be created.\n */\n file_text?: string;\n\n /**\n * Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.\n */\n insert_line?: number;\n\n /**\n * Optional parameter of `str_replace` command containing the new string (if not given, no string will be added). Required parameter of `insert` command containing the string to insert.\n */\n new_str?: string;\n\n /**\n * Required parameter of `str_replace` command containing the string in `path` to replace.\n */\n old_str?: string;\n\n /**\n * Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.\n */\n view_range?: number[];\n },\n {}\n>({\n id: 'anthropic.text_editor_20250429',\n inputSchema: textEditor_20250429InputSchema,\n});\n","import {\n createProviderToolFactoryWithOutputSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\n/**\n * Output schema for tool search results - returns tool references\n * that are automatically expanded into full tool definitions by the API.\n */\nexport const toolSearchBm25_20251119OutputSchema = lazySchema(() =>\n zodSchema(\n z.array(\n z.object({\n type: z.literal('tool_reference'),\n toolName: z.string(),\n }),\n ),\n ),\n);\n\n/**\n * Input schema for BM25-based tool search.\n * Claude uses natural language queries to search for tools.\n */\nconst toolSearchBm25_20251119InputSchema = lazySchema(() =>\n zodSchema(\n z.object({\n /**\n * A natural language query to search for tools.\n * Claude will use BM25 text search to find relevant tools.\n */\n query: z.string(),\n /**\n * Maximum number of tools to return. Optional.\n */\n limit: z.number().optional(),\n }),\n ),\n);\n\nconst factory = createProviderToolFactoryWithOutputSchema<\n {\n /**\n * A natural language query to search for tools.\n * Claude will use BM25 text search to find relevant tools.\n */\n query: string;\n /**\n * Maximum number of tools to return. Optional.\n */\n limit?: number;\n },\n Array<{\n type: 'tool_reference';\n /**\n * The name of the discovered tool.\n */\n toolName: string;\n }>,\n {}\n>({\n id: 'anthropic.tool_search_bm25_20251119',\n inputSchema: toolSearchBm25_20251119InputSchema,\n outputSchema: toolSearchBm25_20251119OutputSchema,\n});\n\n/**\n * Creates a tool search tool that uses BM25 (natural language) to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand. Instead of loading all\n * tool definitions into the context window upfront, Claude searches your tool\n * catalog and loads only the tools it needs.\n *\n * When Claude uses this tool, it uses natural language queries (NOT regex patterns)\n * to search for tools using BM25 text search.\n *\n * **Important**: This tool should never have `deferLoading: true` in providerOptions.\n *\n * @example\n * ```ts\n * import { anthropicTools } from '@ai-sdk/anthropic';\n *\n * const tools = {\n * toolSearch: anthropicTools.toolSearchBm25_20251119(),\n * // Other tools with deferLoading...\n * };\n * ```\n *\n * @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-search-tool\n */\nexport const toolSearchBm25_20251119 = (\n args: Parameters<typeof factory>[0] = {},\n) => {\n return factory(args);\n};\n","import { bash_20241022 } from './tool/bash_20241022';\nimport { bash_20250124 } from './tool/bash_20250124';\nimport { codeExecution_20250522 } from './tool/code-execution_20250522';\nimport { codeExecution_20250825 } from './tool/code-execution_20250825';\nimport { computer_20241022 } from './tool/computer_20241022';\nimport { computer_20250124 } from './tool/computer_20250124';\nimport { memory_20250818 } from './tool/memory_20250818';\nimport { textEditor_20241022 } from './tool/text-editor_20241022';\nimport { textEditor_20250124 } from './tool/text-editor_20250124';\nimport { textEditor_20250429 } from './tool/text-editor_20250429';\nimport { textEditor_20250728 } from './tool/text-editor_20250728';\nimport { toolSearchBm25_20251119 } from './tool/tool-search-bm25_20251119';\nimport { toolSearchRegex_20251119 } from './tool/tool-search-regex_20251119';\nimport { webFetch_20250910 } from './tool/web-fetch-20250910';\nimport { webSearch_20250305 } from './tool/web-search_20250305';\n\nexport const anthropicTools = {\n /**\n * The bash tool enables Claude to execute shell commands in a persistent bash session,\n * allowing system operations, script execution, and command-line automation.\n *\n * Image results are supported.\n */\n bash_20241022,\n\n /**\n * The bash tool enables Claude to execute shell commands in a persistent bash session,\n * allowing system operations, script execution, and command-line automation.\n *\n * Image results are supported.\n */\n bash_20250124,\n\n /**\n * Claude can analyze data, create visualizations, perform complex calculations,\n * run system commands, create and edit files, and process uploaded files directly within\n * the API conversation.\n *\n * The code execution tool allows Claude to run Bash commands and manipulate files,\n * including writing code, in a secure, sandboxed environment.\n */\n codeExecution_20250522,\n\n /**\n * Claude can analyze data, create visualizations, perform complex calculations,\n * run system commands, create and edit files, and process uploaded files directly within\n * the API conversation.\n *\n * The code execution tool allows Claude to run both Python and Bash commands and manipulate files,\n * including writing code, in a secure, sandboxed environment.\n *\n * This is the latest version with enhanced Bash support and file operations.\n */\n codeExecution_20250825,\n\n /**\n * Claude can interact with computer environments through the computer use tool, which\n * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.\n *\n * Image results are supported.\n *\n * @param displayWidthPx - The width of the display being controlled by the model in pixels.\n * @param displayHeightPx - The height of the display being controlled by the model in pixels.\n * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.\n */\n computer_20241022,\n\n /**\n * Claude can interact with computer environments through the computer use tool, which\n * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.\n *\n * Image results are supported.\n *\n * @param displayWidthPx - The width of the display being controlled by the model in pixels.\n * @param displayHeightPx - The height of the display being controlled by the model in pixels.\n * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.\n */\n computer_20250124,\n\n /**\n * The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.\n * Claude can create, read, update, and delete files that persist between sessions,\n * allowing it to build knowledge over time without keeping everything in the context window.\n * The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.\n *\n * Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.\n */\n memory_20250818,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents. This allows Claude\n * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.\n *\n * Supported models: Claude Sonnet 3.5\n */\n textEditor_20241022,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents. This allows Claude\n * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.\n *\n * Supported models: Claude Sonnet 3.7\n */\n textEditor_20250124,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents. This allows Claude\n * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.\n *\n * Note: This version does not support the \"undo_edit\" command.\n *\n * @deprecated Use textEditor_20250728 instead\n */\n textEditor_20250429,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents. This allows Claude\n * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.\n *\n * Note: This version does not support the \"undo_edit\" command and adds optional max_characters parameter.\n *\n * Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1\n *\n * @param maxCharacters - Optional maximum number of characters to view in the file\n */\n textEditor_20250728,\n\n /**\n * Creates a web fetch tool that gives Claude direct access to real-time web content.\n *\n * @param maxUses - The max_uses parameter limits the number of web fetches performed\n * @param allowedDomains - Only fetch from these domains\n * @param blockedDomains - Never fetch from these domains\n * @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set \"citations\": {\"enabled\": true} to enable Claude to cite specific passages from fetched documents.\n * @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.\n */\n webFetch_20250910,\n\n /**\n * Creates a web search tool that gives Claude direct access to real-time web content.\n *\n * @param maxUses - Maximum number of web searches Claude can perform during the conversation.\n * @param allowedDomains - Optional list of domains that Claude is allowed to search.\n * @param blockedDomains - Optional list of domains that Claude should avoid when searching.\n * @param userLocation - Optional user location information to provide geographically relevant search results.\n */\n webSearch_20250305,\n\n /**\n * Creates a tool search tool that uses regex patterns to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand. Instead of loading all\n * tool definitions into the context window upfront, Claude searches your tool\n * catalog and loads only the tools it needs.\n *\n * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools\n * to mark them for deferred loading.\n *\n * Supported models: Claude Opus 4.5, Claude Sonnet 4.5\n */\n toolSearchRegex_20251119,\n\n /**\n * Creates a tool search tool that uses BM25 (natural language) to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand. Instead of loading all\n * tool definitions into the context window upfront, Claude searches your tool\n * catalog and loads only the tools it needs.\n *\n * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools\n * to mark them for deferred loading.\n *\n * Supported models: Claude Opus 4.5, Claude Sonnet 4.5\n */\n toolSearchBm25_20251119,\n};\n","import { JSONObject } from '@ai-sdk/provider';\nimport { AnthropicMessageMetadata } from './anthropic-message-metadata';\n\n/**\n * Sets the Anthropic container ID in the provider options based on\n * any previous step's provider metadata.\n *\n * Searches backwards through steps to find the most recent container ID.\n * You can use this function in `prepareStep` to forward the container ID between steps.\n */\nexport function forwardAnthropicContainerIdFromLastStep({\n steps,\n}: {\n steps: Array<{\n providerMetadata?: Record<string, JSONObject>;\n }>;\n}): undefined | { providerOptions?: Record<string, JSONObject> } {\n // Search backwards through steps to find the most recent container ID\n for (let i = steps.length - 1; i >= 0; i--) {\n const containerId = (\n steps[i].providerMetadata?.anthropic as\n | AnthropicMessageMetadata\n | undefined\n )?.container?.id;\n\n if (containerId) {\n return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AAO,gBAAgB,OAAO;AAAA,EAChC;AAEA,WAAS,uBAAuB;AAChC,WAAS,gBAAgB;AACzB,WAAS,OAAO;AAChB,WAAS,WAAW;AAEpB,WAAS,iBAAiB,CAAC,YAAoB;AAC7C,UAAM,IAAI,kCAAiB,EAAE,SAAS,WAAW,iBAAiB,CAAC;AAAA,EACrE;AACA,WAAS,qBAAqB,SAAS;AACvC,WAAS,aAAa,CAAC,YAAoB;AACzC,UAAM,IAAI,kCAAiB,EAAE,SAAS,WAAW,aAAa,CAAC;AAAA,EACjE;AAEA,WAAS,QAAQ;AAEjB,SAAO;AACT;AAKO,IAAM,YAAY,gBAAgB;;;A2B5IlC,SAAS,wCAAwC;AAAA,EACtD;AACF,GAIiE;AAhBjE;AAkBE,WAAS,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK;AAC1C,UAAM,eACJ,uBAAM,CAAC,EAAE,qBAAT,mBAA2B,cAA3B,mBAGC,cAHD,mBAGY;AAEd,QAAI,aAAa;AACf,aAAO;AAAA,QACL,iBAAiB;AAAA,UACf,WAAW;AAAA,YACT,WAAW,EAAE,IAAI,YAAY;AAAA,UAC/B;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":["import_provider","import_provider_utils","import_provider","import_provider_utils","import_provider_utils","import_v4","import_v4","anthropic","import_provider_utils","import_v4","import_provider_utils","import_v4","factory","import_provider_utils","import_v4","factory","import_provider_utils","anthropicTools","import_provider","import_provider_utils","import_provider_utils","import_v4","factory","import_provider_utils","import_v4","factory","import_provider_utils","import_v4","factory","_a","_b","i","generateId","anthropicTools","anthropic","_a","_b","import_provider_utils","import_v4","import_provider_utils","import_v4","import_provider_utils","import_v4","import_provider_utils","import_v4","import_provider_utils","import_v4","import_provider_utils","import_v4","import_provider_utils","import_v4","import_provider_utils","import_v4","import_provider_utils","import_v4","factory","_a"]}